From 6c823dd44dbde79f008001a2a11e7bf9bc6bf8cc Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期三, 04 十二月 2024 18:15:44 +0800
Subject: [PATCH] fix:合伙人列表操作日志
---
src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpService.java | 27 ++++++++++++-
src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpCgController.java | 15 ++++---
src/main/java/com/mzl/flower/web/flower/FlowerController.java | 13 +++++-
src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpController.java | 15 ++++---
src/main/java/com/mzl/flower/web/flower/FlowerMarkupPsController.java | 15 ++++++-
src/main/java/com/mzl/flower/service/flower/FlowerMarkupPsService.java | 7 ++-
src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpCgService.java | 28 ++++++++++++-
7 files changed, 93 insertions(+), 27 deletions(-)
diff --git a/src/main/java/com/mzl/flower/service/flower/FlowerMarkupPsService.java b/src/main/java/com/mzl/flower/service/flower/FlowerMarkupPsService.java
index d5cb234..9cb4f26 100644
--- a/src/main/java/com/mzl/flower/service/flower/FlowerMarkupPsService.java
+++ b/src/main/java/com/mzl/flower/service/flower/FlowerMarkupPsService.java
@@ -116,7 +116,7 @@
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);
}
@@ -160,19 +160,20 @@
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);
diff --git a/src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpCgService.java b/src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpCgService.java
index 8f59631..4f2d9b4 100644
--- a/src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpCgService.java
+++ b/src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpCgService.java
@@ -11,15 +11,20 @@
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
@@ -30,27 +35,44 @@
@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("分类列表不能为空");
@@ -59,7 +81,7 @@
FlowerMarkupSpCgSaveDTO cg = new FlowerMarkupSpCgSaveDTO();
BeanUtils.copyProperties(dto, cg);
cg.setCategoryId(categoryId);
- saveMarkupSpCg(cg);
+ saveMarkupSpCg(cg,request);
}
}
public FlowerMarkupSpCgDTO getMarkupSpCg(Long categoryId){
diff --git a/src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpService.java b/src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpService.java
index e6d1697..8e54a9c 100644
--- a/src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpService.java
+++ b/src/main/java/com/mzl/flower/service/flower/FlowerMarkupSpService.java
@@ -7,14 +7,19 @@
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;
@@ -26,9 +31,14 @@
@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());
@@ -36,16 +46,27 @@
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){
@@ -54,7 +75,7 @@
dt.setPartnerId(dto.getPartnerId());
dt.setFee(dto.getFee());
- saveMarkupSp(dt);
+ saveMarkupSp(dt,request);
}
}
}
diff --git a/src/main/java/com/mzl/flower/web/flower/FlowerController.java b/src/main/java/com/mzl/flower/web/flower/FlowerController.java
index 90b581e..78f02f1 100644
--- a/src/main/java/com/mzl/flower/web/flower/FlowerController.java
+++ b/src/main/java/com/mzl/flower/web/flower/FlowerController.java
@@ -54,24 +54,31 @@
}
@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);
}
diff --git a/src/main/java/com/mzl/flower/web/flower/FlowerMarkupPsController.java b/src/main/java/com/mzl/flower/web/flower/FlowerMarkupPsController.java
index 48cf2cf..4c6d264 100644
--- a/src/main/java/com/mzl/flower/web/flower/FlowerMarkupPsController.java
+++ b/src/main/java/com/mzl/flower/web/flower/FlowerMarkupPsController.java
@@ -33,9 +33,12 @@
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")
@@ -45,13 +48,16 @@
}
@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")
@@ -127,6 +133,7 @@
}
@GetMapping("/sp/list/delete")
+ @OperationLog(value = "删除商品加价", type = "markup_s_p")
@ApiOperation(value = "删除商品加价")
@ApiImplicitParams({
@ApiImplicitParam(name = "partnerId", value = "合伙人id", required = true, dataType = "Long", paramType = "query"),
@@ -134,6 +141,8 @@
})
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);
}
}
diff --git a/src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpCgController.java b/src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpCgController.java
index ef808e8..051019a 100644
--- a/src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpCgController.java
+++ b/src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpCgController.java
@@ -22,6 +22,9 @@
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 = "合伙人商品分类加价管理")
@@ -34,35 +37,35 @@
@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);
}
diff --git a/src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpController.java b/src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpController.java
index 88cfaff..da846f4 100644
--- a/src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpController.java
+++ b/src/main/java/com/mzl/flower/web/partner/FlowerMarkupSpController.java
@@ -22,6 +22,9 @@
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 = "合伙人商品加价管理")
@@ -34,23 +37,23 @@
@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);
}
@@ -110,13 +113,13 @@
@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);
}
}
--
Gitblit v1.9.3