xiaoyong931011
2021-07-07 6c5a9e94f11c5ce05336303129a21886383967a6
gc-user/src/main/java/com/xzx/gc/user/controller/AdminJhyInfoController.java
@@ -12,14 +12,14 @@
import com.xzx.gc.entity.ScoreOrder;
import com.xzx.gc.entity.UserInfo;
import com.xzx.gc.model.JsonResult;
import com.xzx.gc.user.dto.AddScoreNumDto;
import com.xzx.gc.user.dto.ExamineJwyDto;
import com.xzx.gc.user.dto.JhyInfoListDto;
import com.xzx.gc.user.dto.*;
import com.xzx.gc.user.mapper.AccountMapper;
import com.xzx.gc.user.mapper.JhyInfoMapper;
import com.xzx.gc.user.mapper.UserMapper;
import com.xzx.gc.user.service.JhyInfoService;
import com.xzx.gc.user.vo.GetScoreNumVo;
import com.xzx.gc.user.vo.JhyInfoListVo;
import com.xzx.gc.user.vo.ViewJhyInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
@@ -57,13 +57,64 @@
    }
    /**
     * 增加积分
     * 查看集货员信息详情
     */
    @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/jhy/viewJhyInfo.json")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = ViewJhyInfoVo.class)})
    @ApiOperation(value="集物员管理-查看集货员信息详情", notes="test: 仅0有正确返回")
    public JsonResult<ViewJhyInfoVo> viewJhyInfo(@RequestBody ViewJhyInfoDto viewJhyInfoDto) {
        Long id = viewJhyInfoDto.getId();
        ViewJhyInfoVo viewJhyInfoVo = jhyInfoService.viewJhyInfo(id);
        return JsonResult.success(viewJhyInfoVo);
    }
    /**
     * 编辑集货员信息
     */
    @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/jhy/updateJhyInfo.json")
    @ApiOperation(value="集物员管理--编辑集货员信息", notes="test: 仅0有正确返回")
    public JsonResult updateJhyInfo(@RequestBody UpdateJhyInfoDto model, HttpServletRequest request) {
        long id = model.getId();
        JhyInfo jhyInfo = jhyInfoMapper.selectByPrimaryKey(id);
        if(ObjectUtil.isEmpty(jhyInfo)){
            return JsonResult.failMessage("当前记录不存在!");
        }
        jhyInfoService.updateJhyInfo(model);
        OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
                .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("集物员管理--编辑集货员信息-" + id).build();
        mqUtil.sendApp(build);
        return  JsonResult.success("操作成功!");
    }
    /**
     * 获取积分
     */
    @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/jhy/getScoreNum.json")
    @ApiResponses(
            @ApiResponse(code = 200, message = "success", response = GetScoreNumVo.class)
    )
    @ApiOperation(value="集物员--获取积分", notes="test: 仅0有正确返回")
    public JsonResult getScoreNum(@RequestBody GetScoreNumDto model, HttpServletRequest request) {
        String userId = model.getUserId();
        UserInfo userInfo = userMapper.selectByPrimaryKey(userId);
        if(ObjectUtil.isEmpty(userInfo)){
            return JsonResult.failMessage("查询不到用户信息!");
        }
        GetScoreNumVo getScoreNumVo = jhyInfoService.getScoreNum(model);
        OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
                .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("积分商城-获取积分-" + userId).build();
        mqUtil.sendApp(build);
        return  JsonResult.success(getScoreNumVo);
    }
    /**
     * 调整积分
     */
    @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/jhy/addScoreNum.json")
    @ApiOperation(value="集物员--增加积分", notes="test: 仅0有正确返回")
    @ApiOperation(value="集物员--调整积分", notes="test: 仅0有正确返回")
    public JsonResult addScoreNum(@RequestBody AddScoreNumDto model, HttpServletRequest request) {
        Integer score = model.getScore();
        if(score <= 0){
        if(score < 0){
            return JsonResult.failMessage("请输入正确的积分数量!");
        }
        String userId = model.getUserId();
@@ -73,7 +124,7 @@
        }
        jhyInfoService.addScoreNum(model);
        OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
                .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("积分商城-"+userId+"-增加积分-" + score).build();
                .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("积分商城-"+userId+"-调整积分-" + score).build();
        mqUtil.sendApp(build);
        return  JsonResult.success("操作成功!");
    }