| | |
| | | package com.xzx.gc.user.controller; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.xzx.gc.common.constant.CommonEnum; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.common.dto.log.OperationAppLog; |
| | | import com.xzx.gc.common.request.BaseController; |
| | | import com.xzx.gc.entity.JhyInfo; |
| | | import com.xzx.gc.entity.ScoreDetails; |
| | | import com.xzx.gc.entity.ScoreOrder; |
| | | import com.xzx.gc.entity.UserInfo; |
| | | import com.xzx.gc.model.JsonResult; |
| | | 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; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import tk.mybatis.mapper.entity.Example; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Api(tags = {"集物员--集物员管理"}) |
| | |
| | | |
| | | @Autowired |
| | | private JhyInfoService jhyInfoService; |
| | | @Autowired |
| | | private JhyInfoMapper jhyInfoMapper; |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | | @ApiOperation(value = "集货员信息列表") |
| | | @ApiResponses( |
| | | @ApiResponse(code = 200, message = "success", response = JhyInfoListVo.class) |
| | | ) |
| | | @PostMapping(value = Constants.ADMIN_VIEW_PREFIX + "/jhy/list.json") |
| | | public JsonResult<Map<String, Object>> jhyList(@RequestBody JhyInfoListDto jhyInfoListDto) { |
| | | return JsonResult.success(jhyInfoService.queryList(jhyInfoListDto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看集货员信息详情 |
| | | */ |
| | | @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有正确返回") |
| | | public JsonResult addScoreNum(@RequestBody AddScoreNumDto model, HttpServletRequest request) { |
| | | Integer score = model.getScore(); |
| | | if(score < 0){ |
| | | return JsonResult.failMessage("请输入正确的积分数量!"); |
| | | } |
| | | String userId = model.getUserId(); |
| | | UserInfo userInfo = userMapper.selectByPrimaryKey(userId); |
| | | if(ObjectUtil.isEmpty(userInfo)){ |
| | | return JsonResult.failMessage("查询不到用户信息!"); |
| | | } |
| | | jhyInfoService.addScoreNum(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("积分商城-"+userId+"-调整积分-" + score).build(); |
| | | mqUtil.sendApp(build); |
| | | return JsonResult.success("操作成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 取消 |
| | | */ |
| | | @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/jhy/examineJwy.json") |
| | | @ApiOperation(value="集物员--审核", notes="test: 仅0有正确返回") |
| | | public JsonResult examineJwy(@RequestBody ExamineJwyDto model, HttpServletRequest request) { |
| | | long id = model.getId(); |
| | | JhyInfo jhyInfo = jhyInfoMapper.selectByPrimaryKey(id); |
| | | if(ObjectUtil.isEmpty(jhyInfo)){ |
| | | return JsonResult.failMessage("当前记录不存在!"); |
| | | } |
| | | Integer status = jhyInfo.getStatus(); |
| | | if(1 != status){ |
| | | return JsonResult.failMessage("当前不是待审核状态!"); |
| | | } |
| | | |
| | | jhyInfoService.examineJwy(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("操作成功!"); |
| | | } |
| | | } |