Helius
2020-12-21 50cfd012b1120d7a39e6a4836b134f57e5551341
modify api
1 files added
3 files modified
87 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/api/action/ApiCommonAction.java 15 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/api/action/UsersAction.java 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/api/vo/UserInfoVo.java 56 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/config/application.properties 6 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/api/action/ApiCommonAction.java
@@ -1,10 +1,12 @@
package com.matrix.system.api.action;
import com.alibaba.fastjson.JSONObject;
import com.jcraft.jsch.UserInfo;
import com.matrix.component.redis.RedisClient;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.UUIDUtil;
import com.matrix.system.api.dto.LoginDto;
import com.matrix.system.api.vo.UserInfoVo;
import com.matrix.system.common.authority.DefaultAuthorityManager;
import com.matrix.system.common.authority.strategy.AccountPasswordLogin;
import com.matrix.system.common.authority.strategy.LoginStrategy;
@@ -13,6 +15,8 @@
import com.matrix.system.hive.service.SysShopInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
@@ -42,6 +46,9 @@
    private RedisClient redisClient;
    @ApiOperation(value = "登陆接口", notes = "手机端登陆接口")
    @ApiResponses({
            @ApiResponse(code = 200, message = "OK",  response = UserInfoVo.class)
    })
    @PostMapping(value = "/login")
    public AjaxResult login(@RequestBody @Validated LoginDto loginDto) {
@@ -60,8 +67,14 @@
        redisClient.saveValue(token, JSONObject.toJSONString(user), 360000);
        redisClient.saveValue(user.getSuId().toString(), token, 3600000);
        UserInfoVo userInfoVo = new UserInfoVo();
        userInfoVo.setId(user.getSuId());
        userInfoVo.setName(user.getSuName());
        userInfoVo.setRoleName(user.getRoleName());
        userInfoVo.setPhoto(user.getSuPhoto());
        AjaxResult result = new AjaxResult();
        result.putInMap("user", user);
        result.putInMap("user", userInfoVo);
        result.setInfo("登陆成功 ");
        return result;
    }
zq-erp/src/main/java/com/matrix/system/api/action/UsersAction.java
@@ -1,6 +1,10 @@
package com.matrix.system.api.action;
import com.matrix.core.pojo.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -15,5 +19,11 @@
    @ApiOperation(value = "获取用户业绩接口 type 1-今日 2-昨天 3-本月 4-上月")
    @GetMapping(value = "/findUserAchieve/{type}")
    public AjaxResult findUserAchieve(@PathVariable("type") Integer type) {
        return null;
    }
}
zq-erp/src/main/java/com/matrix/system/api/vo/UserInfoVo.java
New file
@@ -0,0 +1,56 @@
package com.matrix.system.api.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * @author wzy
 * @date 2020-12-21
 **/
@ApiModel(value = "UserInfoVo", description = "用户信息返回类")
public class UserInfoVo {
    @ApiModelProperty(value = "用户ID", example = "1")
    private Long id;
    @ApiModelProperty(value = "用户名称", example = "呵呵")
    private String name;
    @ApiModelProperty(value = "职位", example = "店长")
    private String roleName;
    @ApiModelProperty(value = "头像", example = "--")
    private String photo;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getRoleName() {
        return roleName;
    }
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
}
zq-erp/src/main/resources/config/application.properties
@@ -4,9 +4,9 @@
#线上测试环境
spring.datasource.username=chuhuan
spring.datasource.password=chuhuan
spring.datasource.url=jdbc:mysql://119.3.52.84:3306/hive_plus_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8
spring.datasource.username=ct_test
spring.datasource.password=123456
spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8