From 56a26f9c0e1c8036cfb8f1acdf6f2a2849293c52 Mon Sep 17 00:00:00 2001 From: "1215525055@qq.com" <1215525055@qq.com> Date: Thu, 5 Jun 2025 12:16:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=9F=E9=80=9A=E8=A1=A5=E6=AD=A3BUG?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 11 +++++ .../api/correction/CorrectionController.java | 10 +++-- .../correction/ICorrectionService.java | 4 ++ .../impl/CorrectionServiceImpl.java | 42 +++++++++++++++++++ .../service/order/impl/OrderServiceImpl.java | 34 ++++----------- 5 files changed, 71 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index 574680a..dfa7ca3 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,17 @@ 1.1.9 + + + io.springfox + springfox-swagger2 + 3.0.0 + + + io.springfox + springfox-swagger-ui + 3.0.0 + org.springframework spring-test diff --git a/src/main/java/cn/com/tenlion/aishop/controller/api/correction/CorrectionController.java b/src/main/java/cn/com/tenlion/aishop/controller/api/correction/CorrectionController.java index 8fcdabe..662c04b 100644 --- a/src/main/java/cn/com/tenlion/aishop/controller/api/correction/CorrectionController.java +++ b/src/main/java/cn/com/tenlion/aishop/controller/api/correction/CorrectionController.java @@ -13,10 +13,12 @@ import cn.com.tenlion.aishop.pojo.dtos.correction.CorrectionDTO; import cn.com.tenlion.aishop.pojo.vos.correction.CorrectionVO; import cn.com.tenlion.aishop.service.correction.ICorrectionService; import io.swagger.annotations.*; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -64,6 +66,7 @@ public class CorrectionController extends DefaultBaseController { return new SuccessResult(); } +/* @ApiOperation(value = "修改沟通", notes = "修改沟通接口") @ApiImplicitParams({ @ApiImplicitParam(name = "correctionId", value = "沟通ID", paramType = "path") @@ -75,6 +78,7 @@ public class CorrectionController extends DefaultBaseController { correctionService.update(correctionId, correctionVO); return new SuccessResult(); } +*/ @ApiOperation(value = "沟通详情", notes = "沟通详情接口") @ApiImplicitParams({ @@ -82,7 +86,7 @@ public class CorrectionController extends DefaultBaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("get/{correctionId}") - public CorrectionDTO get(@PathVariable("correctionId") String correctionId) { + public CorrectionDTO get(@PathVariable("correctionId") String correctionId) { return correctionService.get(correctionId); } @@ -125,7 +129,7 @@ public class CorrectionController extends DefaultBaseController { Map params = requestParams(); params.put("correctionType", "2"); params.put("correctionParentId", "0"); - params.put("userId", securityComponent.getCurrentUser().getUserId()); + // params.put("userId", securityComponent.getCurrentUser().getUserId()); page.setParams(params); return correctionService.listPage(page); } @@ -147,7 +151,7 @@ public class CorrectionController extends DefaultBaseController { Map params = requestParams(); params.put("correctionType", "1"); params.put("correctionParentId", "0"); - params.put("userId", securityComponent.getCurrentUser().getUserId()); + // params.put("userId", securityComponent.getCurrentUser().getUserId()); page.setParams(params); return correctionService.listPage(page); } diff --git a/src/main/java/cn/com/tenlion/aishop/service/correction/ICorrectionService.java b/src/main/java/cn/com/tenlion/aishop/service/correction/ICorrectionService.java index 426039b..f151f49 100644 --- a/src/main/java/cn/com/tenlion/aishop/service/correction/ICorrectionService.java +++ b/src/main/java/cn/com/tenlion/aishop/service/correction/ICorrectionService.java @@ -105,6 +105,10 @@ public interface ICorrectionService { */ CorrectionDTO get(Map params); + CorrectionDTO get(String type, String correctionId); + + Integer getWaitUpload(String type, String orderId); + /** * 沟通详情 * diff --git a/src/main/java/cn/com/tenlion/aishop/service/correction/impl/CorrectionServiceImpl.java b/src/main/java/cn/com/tenlion/aishop/service/correction/impl/CorrectionServiceImpl.java index fdc4a24..0d5bf0c 100644 --- a/src/main/java/cn/com/tenlion/aishop/service/correction/impl/CorrectionServiceImpl.java +++ b/src/main/java/cn/com/tenlion/aishop/service/correction/impl/CorrectionServiceImpl.java @@ -375,6 +375,48 @@ public class CorrectionServiceImpl extends DefaultBaseService implements ICorrec return correctionDao.get(params); } + @Override + public CorrectionDTO get(String type, String correctionId) { + Map params = super.getHashMap(2); + params.put("correctionId", correctionId); + CorrectionDTO dto = get(params); + Map params1 = new HashMap<>(); + if(type.equals("2")) { + params1.put("correctionParentId", dto.getCorrectionId()); + params1.put("orderId", dto.getOrderId()); + params1.put("correctionType", "2"); + String id = getDataId(params1); + dto.setBuyId(id); + } + if(type.equals("1")) { + params1.put("correctionParentId", dto.getCorrectionId()); + params1.put("orderId", dto.getOrderId()); + params1.put("correctionType", "1"); + String id = getDataId(params1); + dto.setSellId(id); + } + return dto; + } + + @Override + public Integer getWaitUpload(String type, String orderId) { + Map params = super.getHashMap(2); + params.put("correctionType", type); + params.put("correctionParentId", "0"); + params.put("orderId", orderId); + List dtos = list(params); + Integer count = 0; + for(CorrectionDTO dto : dtos) { + if(type.equals("2") && !StringUtils.isEmpty(dto.getBuyId())) { + count ++; + } + if(type.equals("1") && !StringUtils.isEmpty(dto.getSellId())) { + count ++; + } + } + return dtos.size() - count; + } + @Override public CorrectionDTO get(String correctionId) { Map params = super.getHashMap(2); diff --git a/src/main/java/cn/com/tenlion/aishop/service/order/impl/OrderServiceImpl.java b/src/main/java/cn/com/tenlion/aishop/service/order/impl/OrderServiceImpl.java index f8be949..8990d2a 100644 --- a/src/main/java/cn/com/tenlion/aishop/service/order/impl/OrderServiceImpl.java +++ b/src/main/java/cn/com/tenlion/aishop/service/order/impl/OrderServiceImpl.java @@ -265,35 +265,11 @@ public class OrderServiceImpl extends DefaultBaseService implements IOrderServic * 查询需要补正的数量 */ if("3,4,5,6".contains(dto.getOrderStatus())) { - // 查询待补正的信息内容 - Integer count = 0; if(userId.equals(dto.getSellUserId())) { - // 卖家 - query.put("correctionType", "1"); - query.put("correctionParentId", "0"); - int count1 = iCorrectionService.count(query); - - query.put("correctionType", "1"); - query.put("createUserId", dto.getSellUserId()); - query.put("correctionParentId", null); - query.put("notBuZheng", "notBuZheng"); - int count2 = iCorrectionService.count(query); - - count = count1 - count2; + dto.setWaitCorrectionCount(iCorrectionService.getWaitUpload("1", dto.getOrderId())); }else if(userId.equals(dto.getBuyUserId())){ - query.put("correctionType", "2"); - query.put("correctionParentId", "0"); - int count1 = iCorrectionService.count(query); - - query.put("correctionType", "2"); - query.put("createUserId", dto.getBuyUserId()); - query.put("correctionParentId", null); - query.put("notBuZheng", "notBuZheng"); - int count2 = iCorrectionService.count(query); - - count = count1 - count2; + dto.setWaitCorrectionCount(iCorrectionService.getWaitUpload("2", dto.getOrderId())); } - dto.setWaitCorrectionCount(count); } } return list; @@ -409,12 +385,16 @@ public class OrderServiceImpl extends DefaultBaseService implements IOrderServic goodsLogVO.setGoodslogContent("订单号:" + orderDTO.getOrderNumber()); iGoodslogService.save(goodsLogVO); if(orderDTO.getOrderStatus().equals("2")) { + String msg = "取消订单《" + simpleDTO.getGoodsName() + "》退款"; + if(orderDTO.getSellUserId().equals(securityComponent.getCurrentUser().getUserId())) { + msg = "卖家取消订单《" + simpleDTO.getGoodsName() + "》退款"; + } // 已付款,进行退款 PayVO payVO = new PayVO(); payVO.setOrderId(orderId); payVO.setUserId(orderDTO.getBuyUserId()); payVO.setAccountMoney(PayUtil.buiderMoney(orderDTO.getPayMoney())); - payVO.setDescription("购买退款." + simpleDTO.getGoodsName()); + payVO.setDescription(msg); remoteService.savePayInShop(payVO); } }