| | |
| | | operationRecord.setContent(content); |
| | | operationRecord.create(SecurityUtils.getUserId()); |
| | | operationRecord.setStatus("success"); |
| | | operationRecord.setModule("markup_s_p"); |
| | | operationRecord.setModule("markup_s_p_cg"); |
| | | operationRecord.setIpAddress(IpUtil.getIpAddress(request)); |
| | | operationRecordMapper.insert(operationRecord); |
| | | } |
| | |
| | | sp.create(SecurityUtils.getUserId()); |
| | | spMapper.insert(sp); |
| | | content = "新增商品加价:商品id:【" + dto.getFlowerId() + "】,合伙人id:【"+dto.getPartnerId()+"】,金额:【" + dto.getFee() + "】"; |
| | | operationRecord.setFunction("新增商品分类加价"); |
| | | operationRecord.setFunction("新增商品加价"); |
| | | } else { |
| | | sp.setFee(dto.getFee()); |
| | | sp.update(SecurityUtils.getUserId()); |
| | | spMapper.updateById(sp); |
| | | content = "修改商品加价:id:【"+sp.getId()+"】,商品id:【" + dto.getFlowerId() + "】,合伙人id:【"+dto.getPartnerId()+"】,金额:【" + dto.getFee() + "】"; |
| | | |
| | | operationRecord.setFunction("修改商品加价"); |
| | | } |
| | | |
| | | markupCacheClient.addMarkupPsSp(dto.getPartnerId(), dto.getFlowerId(), sp); |
| | | operationRecord.create(SecurityUtils.getUserId()); |
| | | operationRecord.setStatus("success"); |
| | | operationRecord.setModule("markup_s_p"); |
| | | |
| | | operationRecord.setContent(content); |
| | | operationRecord.setIpAddress(IpUtil.getIpAddress(request)); |
| | | operationRecordMapper.insert(operationRecord); |
| | |
| | | import com.mzl.flower.dto.response.flower.FlowerMarkupSpCgDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerMarkupSpCgListDTO; |
| | | import com.mzl.flower.entity.flower.FlowerMarkupSpCg; |
| | | import com.mzl.flower.entity.log.OperationRecord; |
| | | import com.mzl.flower.entity.partner.Partner; |
| | | import com.mzl.flower.mapper.flower.FlowerMarkupSpCgMapper; |
| | | import com.mzl.flower.mapper.log.OperationRecordMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.utils.IpUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | @Autowired |
| | | private FlowerMarkupSpCgMapper spCgMapper; |
| | | |
| | | public void saveMarkupSpCg(FlowerMarkupSpCgSaveDTO dto){ |
| | | @Autowired |
| | | private OperationRecordMapper operationRecordMapper; |
| | | |
| | | public void saveMarkupSpCg(FlowerMarkupSpCgSaveDTO dto, HttpServletRequest request) throws IOException { |
| | | |
| | | Long cId = dto.getCategoryId(); |
| | | FlowerMarkupSpCg cg = spCgMapper.selectOne(new QueryWrapper<FlowerMarkupSpCg>() |
| | | .eq("partner_id", dto.getPartnerId()).eq("category_id", cId)); |
| | | String content = ""; |
| | | OperationRecord operationRecord = new OperationRecord(); |
| | | if(cg == null){ |
| | | cg = new FlowerMarkupSpCg(); |
| | | BeanUtils.copyProperties(dto, cg); |
| | | cg.setPartnerId(dto.getPartnerId()); |
| | | cg.create(SecurityUtils.getUserId()); |
| | | spCgMapper.insert(cg); |
| | | content = "新增合伙人商品分类加价:商品分类Id:【" + cg.getCategoryId() + "】,A级:【"+cg.getLevelA()+"】,B级:【" + cg.getLevelB() + "】,C级:【" + cg.getLevelC() + "】" + |
| | | ",D级:【"+dto.getLevelD()+"】,E级:【" + cg.getLevelE() + "】,O级:【" + cg.getLevelO() + "】"; |
| | | operationRecord.setFunction("新增合伙人商品分类加价"); |
| | | } else { |
| | | BeanUtils.copyProperties(dto, cg); |
| | | cg.update(SecurityUtils.getUserId()); |
| | | spCgMapper.updateById(cg); |
| | | content = "修改合伙人商品分类加价:id:【"+cg.getId()+"】,商品分类Id:【" + cg.getCategoryId() + "】,A级:【"+cg.getLevelA()+"】,B级:【" + cg.getLevelB() + "】,C级:【" + cg.getLevelC() + "】" + |
| | | ",D级:【"+dto.getLevelD()+"】,E级:【" + cg.getLevelE() + "】,O级:【" + cg.getLevelO() + "】"; |
| | | operationRecord.setFunction("修改合伙人商品分类加价"); |
| | | } |
| | | |
| | | markupCacheClient.addMarkupSpCg(dto.getPartnerId(), cId, cg); |
| | | operationRecord.setContent(content); |
| | | operationRecord.create(SecurityUtils.getUserId()); |
| | | operationRecord.setStatus("success"); |
| | | operationRecord.setModule("markup_s_p_cg"); |
| | | operationRecord.setIpAddress(IpUtil.getIpAddress(request)); |
| | | operationRecordMapper.insert(operationRecord); |
| | | } |
| | | |
| | | public void saveMarkupSpCgBatch(FlowerMarkupSpCgBatchSaveDTO dto) { |
| | | public void saveMarkupSpCgBatch(FlowerMarkupSpCgBatchSaveDTO dto,HttpServletRequest request) throws IOException { |
| | | List<Long> categoryIds = dto.getCategoryId(); |
| | | if (categoryIds == null || categoryIds.size() == 0) { |
| | | throw new ValidationException("分类列表不能为空"); |
| | |
| | | FlowerMarkupSpCgSaveDTO cg = new FlowerMarkupSpCgSaveDTO(); |
| | | BeanUtils.copyProperties(dto, cg); |
| | | cg.setCategoryId(categoryId); |
| | | saveMarkupSpCg(cg); |
| | | saveMarkupSpCg(cg,request); |
| | | } |
| | | } |
| | | public FlowerMarkupSpCgDTO getMarkupSpCg(Long categoryId){ |
| | |
| | | import com.mzl.flower.dto.response.flower.FlowerMarkupSpDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerMarkupSpListDTO; |
| | | import com.mzl.flower.entity.flower.FlowerMarkupSp; |
| | | import com.mzl.flower.entity.log.OperationRecord; |
| | | import com.mzl.flower.entity.partner.Partner; |
| | | import com.mzl.flower.mapper.flower.FlowerMarkupSpMapper; |
| | | import com.mzl.flower.mapper.log.OperationRecordMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.utils.IpUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | private FlowerMarkupSpMapper spMapper; |
| | | |
| | | public void saveMarkupSp(FlowerMarkupSpSaveDTO dto){ |
| | | @Autowired |
| | | private OperationRecordMapper operationRecordMapper; |
| | | |
| | | public void saveMarkupSp(FlowerMarkupSpSaveDTO dto, HttpServletRequest request) throws IOException { |
| | | FlowerMarkupSp sp = spMapper.selectOne(new QueryWrapper<FlowerMarkupSp>() |
| | | .eq("partner_id", dto.getPartnerId()).eq("flower_id", dto.getFlowerId())); |
| | | String content = ""; |
| | | OperationRecord operationRecord = new OperationRecord(); |
| | | if(sp == null){ |
| | | sp = new FlowerMarkupSp(); |
| | | sp.setFlowerId(dto.getFlowerId()); |
| | |
| | | sp.setPartnerId(dto.getPartnerId()); |
| | | sp.create(SecurityUtils.getUserId()); |
| | | spMapper.insert(sp); |
| | | content = "新增合伙人加价:商品id:【" + dto.getFlowerId() + "】,合伙人id:【"+dto.getPartnerId()+"】,金额:【" + dto.getFee() + "】"; |
| | | operationRecord.setFunction("新增合伙人加价"); |
| | | } else { |
| | | sp.setFee(dto.getFee()); |
| | | sp.update(SecurityUtils.getUserId()); |
| | | spMapper.updateById(sp); |
| | | content = "修改合伙人加价:id:【"+sp.getId()+"】,商品id:【" + dto.getFlowerId() + "】,合伙人id:【"+dto.getPartnerId()+"】,金额:【" + dto.getFee() + "】"; |
| | | operationRecord.setFunction("修改合伙人加价"); |
| | | } |
| | | |
| | | markupCacheClient.addMarkupSp(dto.getPartnerId(), dto.getFlowerId(), sp); |
| | | operationRecord.create(SecurityUtils.getUserId()); |
| | | operationRecord.setStatus("success"); |
| | | operationRecord.setModule("markup_s_p"); |
| | | |
| | | operationRecord.setContent(content); |
| | | operationRecord.setIpAddress(IpUtil.getIpAddress(request)); |
| | | operationRecordMapper.insert(operationRecord); |
| | | } |
| | | |
| | | public void saveMarkupSpBatch(FlowerMarkupSpSaveBatchDTO dto){ |
| | | public void saveMarkupSpBatch(FlowerMarkupSpSaveBatchDTO dto,HttpServletRequest request) throws IOException { |
| | | List<Long> flowerIds = dto.getFlowerIds(); |
| | | if(flowerIds != null && flowerIds.size() > 0){ |
| | | for(Long flowerId : flowerIds){ |
| | |
| | | dt.setPartnerId(dto.getPartnerId()); |
| | | dt.setFee(dto.getFee()); |
| | | |
| | | saveMarkupSp(dt); |
| | | saveMarkupSp(dt,request); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @PostMapping("/list/pass") |
| | | @OperationLog(value = "审核通过", type = "flower_list") |
| | | @ApiOperation(value = "审核通过") |
| | | public ResponseEntity<ReturnDataDTO> passFlower(@RequestBody FlowerAuditDTO dto) { |
| | | flowerService.auditFlower(dto.getId(), dto.getAuditRemarks(), Constants.FLOWER_STATUS.UP.name()); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | String content = "审核通过id:【" + dto.getId() + "】,审核意见为【" + dto.getAuditRemarks() + "】"; |
| | | OperationRecord operationRecord = getOperationRecord(content); |
| | | return returnData(R.SUCCESS.getCode(), null, operationRecord); |
| | | } |
| | | |
| | | @PostMapping("/list/reject") |
| | | @OperationLog(value = "审核驳回", type = "flower_list") |
| | | @ApiOperation(value = "审核驳回") |
| | | public ResponseEntity<ReturnDataDTO> rejectFlower(@RequestBody FlowerAuditDTO dto) { |
| | | flowerService.auditFlower(dto.getId(), dto.getAuditRemarks(), Constants.FLOWER_STATUS.REJECT.name()); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | String content = "审核驳回id:【" + dto.getId() + "】,审核意见为:【" + dto.getAuditRemarks() + "】"; |
| | | OperationRecord operationRecord = getOperationRecord(content); |
| | | return returnData(R.SUCCESS.getCode(), null, operationRecord); |
| | | } |
| | | |
| | | @PostMapping("/list/pass/multi") |
| | | @OperationLog(value = "批量审核通过", type = "flower_list") |
| | | @ApiOperation(value = "批量审核通过") |
| | | public ResponseEntity<ReturnDataDTO> passFlowers(@RequestBody FlowerAuditMultipleDTO dto) { |
| | | flowerService.auditFlowers(dto, Constants.FLOWER_STATUS.UP.name()); |
| | | String content = "批量审核通过id是:【" + dto.getIds() + "】,审核意见为【" + dto.getAuditRemarks() + "】"; |
| | | String content = "批量审核通过id:【" + dto.getIds() + "】,审核意见为【" + dto.getAuditRemarks() + "】"; |
| | | OperationRecord operationRecord = getOperationRecord(content); |
| | | return returnData(R.SUCCESS.getCode(), null, operationRecord); |
| | | } |
| | |
| | | private FlowerMarkupPsService psService; |
| | | |
| | | @PostMapping("/list/new") |
| | | @OperationLog(value = "新增合伙人配置", type = "markup_s_p") |
| | | @ApiOperation(value = "新增合伙人配置") |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupPs(@RequestBody FlowerMarkupPsSaveDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), psService.saveMarkupPs(dto)); |
| | | String content = "新增合伙人配置:合伙人id:【" + dto.getPartnerId() + "】"; |
| | | OperationRecord operationRecord = getOperationRecord(content); |
| | | return returnData(R.SUCCESS.getCode(), psService.saveMarkupPs(dto), operationRecord); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | |
| | | } |
| | | |
| | | @GetMapping("/list/delete") |
| | | @OperationLog(value = "删除合伙人配置", type = "markup_s_p") |
| | | @ApiOperation(value = "删除合伙人配置") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<?>> deleteMarkupPs(Long id){ |
| | | psService.deleteMarkupPs(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | String content = "删除合伙人配置id:【" + id+ "】"; |
| | | OperationRecord operationRecord = getOperationRecord(content); |
| | | return returnData(R.SUCCESS.getCode(), null, operationRecord); |
| | | } |
| | | |
| | | @PostMapping("/spcg/list/save/batch") |
| | |
| | | } |
| | | |
| | | @GetMapping("/sp/list/delete") |
| | | @OperationLog(value = "删除商品加价", type = "markup_s_p") |
| | | @ApiOperation(value = "删除商品加价") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"), |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<?>> deleteMarkupSp(Long partnerId, Long flowerId){ |
| | | psService.deleteMarkupSp(partnerId, flowerId); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | String content = "删除商品加价:合伙人id:【" + partnerId + "】,商品id:【"+flowerId+"】"; |
| | | OperationRecord operationRecord = getOperationRecord(content); |
| | | return returnData(R.SUCCESS.getCode(), null,operationRecord); |
| | | } |
| | | } |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/flower/markup/spcg") |
| | | @Api(value = "合伙人商品分类加价管理", tags = "合伙人商品分类加价管理") |
| | |
| | | |
| | | @PostMapping("/list/save") |
| | | @ApiOperation(value = "新增商品分类加价") |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpCg(@RequestBody FlowerMarkupSpCgSaveDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpCg(@RequestBody FlowerMarkupSpCgSaveDTO dto,HttpServletRequest request) throws IOException { |
| | | Partner s = spCgService.getCurrentPartner(); |
| | | if(s == null){ |
| | | throw new ValidationException("未找到当前合伙人信息"); |
| | | } |
| | | dto.setPartnerId(s.getId()); |
| | | spCgService.saveMarkupSpCg(dto); |
| | | spCgService.saveMarkupSpCg(dto,request); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping("/list/save/batch") |
| | | @ApiOperation(value = "批量新增商品分类加价") |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpCgBatch(@RequestBody FlowerMarkupSpCgBatchSaveDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpCgBatch(@RequestBody FlowerMarkupSpCgBatchSaveDTO dto,HttpServletRequest request) throws IOException { |
| | | Partner s = spCgService.getCurrentPartner(); |
| | | if(s == null){ |
| | | throw new ValidationException("未找到当前合伙人信息"); |
| | | } |
| | | dto.setPartnerId(s.getId()); |
| | | spCgService.saveMarkupSpCgBatch(dto); |
| | | spCgService.saveMarkupSpCgBatch(dto,request); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping("/list/save/platform") |
| | | @ApiOperation(value = "运营平台新增商品分类加价") |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpCgPlatform(@RequestBody FlowerMarkupSpCgSaveDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpCgPlatform(@RequestBody FlowerMarkupSpCgSaveDTO dto, HttpServletRequest request) throws IOException { |
| | | if(dto.getPartnerId()== null || dto.getPartnerId() == 0){ |
| | | throw new ValidationException("合伙人id不能为空"); |
| | | } |
| | | spCgService.saveMarkupSpCg(dto); |
| | | spCgService.saveMarkupSpCg(dto,request); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/flower/markup/sp") |
| | | @Api(value = "合伙人商品加价管理", tags = "合伙人商品加价管理") |
| | |
| | | |
| | | @PostMapping("/list/save") |
| | | @ApiOperation(value = "新增商品加价") |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSp(@RequestBody FlowerMarkupSpSaveDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSp(@RequestBody FlowerMarkupSpSaveDTO dto, HttpServletRequest request) throws IOException { |
| | | Partner s = spService.getCurrentPartner(); |
| | | if(s == null){ |
| | | throw new ValidationException("未找到当前合伙人信息"); |
| | | } |
| | | dto.setPartnerId(s.getId()); |
| | | spService.saveMarkupSp(dto); |
| | | spService.saveMarkupSp(dto,request); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping("/list/save/platform") |
| | | @ApiOperation(value = "运营平台新增商品加价") |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpPlatform(@RequestBody FlowerMarkupSpSaveDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpPlatform(@RequestBody FlowerMarkupSpSaveDTO dto,HttpServletRequest request) throws IOException { |
| | | if(dto.getPartnerId()== null || dto.getPartnerId() == 0){ |
| | | throw new ValidationException("合伙人id不能为空"); |
| | | } |
| | | spService.saveMarkupSp(dto); |
| | | spService.saveMarkupSp(dto,request); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/flower/list/save") |
| | | @ApiOperation(value = "批量新增商品加价") |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpBatch(@RequestBody FlowerMarkupSpSaveBatchDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpBatch(@RequestBody FlowerMarkupSpSaveBatchDTO dto,HttpServletRequest request) throws IOException { |
| | | Partner s = spService.getCurrentPartner(); |
| | | if(s == null){ |
| | | throw new ValidationException("未找到当前合伙人信息"); |
| | | } |
| | | dto.setPartnerId(s.getId()); |
| | | spService.saveMarkupSpBatch(dto); |
| | | spService.saveMarkupSpBatch(dto,request); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | } |