From 879db971ea4d6ce8df239f0b0bca4922daf52121 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 24 Mar 2025 15:01:45 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=8C=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E6=81=A2=E5=A4=8D=E7=8A=B6=E6=80=81=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=97=A8=E5=BA=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cool/store/dao/ShopStageInfoDAO.java | 7 +++ .../store/mapper/ShopStageInfoMapper.java | 3 ++ .../main/resources/mapper/LineInfoMapper.xml | 2 +- .../mapper/OpeningOperationPlanMapper.xml | 2 +- .../resources/mapper/OperationLogMapper.xml | 12 ++--- .../main/resources/mapper/ShopInfoMapper.xml | 6 ++- .../resources/mapper/ShopStageInfoMapper.xml | 13 ++++-- .../com/cool/store/service/ShopService.java | 2 +- .../store/service/impl/ShopServiceImpl.java | 44 +++++++++++++------ .../controller/webb/PCShopController.java | 9 ++-- 10 files changed, 71 insertions(+), 29 deletions(-) diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopStageInfoDAO.java b/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopStageInfoDAO.java index 8f9f228c2..a0286a629 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopStageInfoDAO.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/dao/ShopStageInfoDAO.java @@ -128,6 +128,13 @@ public class ShopStageInfoDAO { return shopStageInfoMapper.getAllCompletionCount(shopId); } + public Integer getCompletionCount(Long shopId) { + if (Objects.isNull(shopId)) { + return 0; + } + return shopStageInfoMapper.getCompletionCount(shopId); + } + /** * @Auther: wangshuo * @Date: 2024/5/3 diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/mapper/ShopStageInfoMapper.java b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/ShopStageInfoMapper.java index 2f867c5dd..770a99a4a 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/mapper/ShopStageInfoMapper.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/ShopStageInfoMapper.java @@ -46,6 +46,9 @@ public interface ShopStageInfoMapper extends Mapper { */ Integer getAllCompletionCount(@Param("shopId") Long shopId); + + Integer getCompletionCount(@Param("shopId") Long shopId); + /** * 跟新店铺阶段信息 * @param shopId diff --git a/coolstore-partner-dao/src/main/resources/mapper/LineInfoMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/LineInfoMapper.xml index f4a72ffc4..9ca17eca3 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/LineInfoMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/LineInfoMapper.xml @@ -480,7 +480,7 @@ left join xfsg_open_area_info b on a.want_shop_area_id = b.id - where a.deleted = 0 and a.line_status = 1 and a.join_status in (1,2) + where a.deleted = 0 and a.line_status = 1 and a.join_status in (1,2) and c.deleted = 0 and (a.investment_manager = #{userId} or c.investment_manager = #{userId} ) diff --git a/coolstore-partner-dao/src/main/resources/mapper/OpeningOperationPlanMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/OpeningOperationPlanMapper.xml index 02f951f92..0ef252f8b 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/OpeningOperationPlanMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/OpeningOperationPlanMapper.xml @@ -51,7 +51,7 @@ op.result_type AS resultType,si.supervisor_user_id as supervisorUserId from xfsg_opening_operation_plan op join xfsg_shop_info si on si.id = op.shop_id - where 1=1 + where si.deleted = 0 AND si.shop_name like concat('%', #{request.shopName}, '%') diff --git a/coolstore-partner-dao/src/main/resources/mapper/OperationLogMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/OperationLogMapper.xml index 9da42e0f6..6394fa4b4 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/OperationLogMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/OperationLogMapper.xml @@ -79,15 +79,17 @@ + \ No newline at end of file diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/ShopService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/ShopService.java index 47afbd64b..df79a9a9f 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/ShopService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/ShopService.java @@ -95,7 +95,7 @@ public interface ShopService { * @return */ Boolean shopClose(Long shopId); - + Boolean updateShopStatue(Long shopId); /** * 分店列表 diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java index 8b9017a51..6188df4d9 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java @@ -193,22 +193,22 @@ public class ShopServiceImpl implements ShopService { @Override public Integer deleteShop(DeleteShopRequest request) { - ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); - if (Objects.nonNull(shopInfo)) { - //进入选址不允许删除操作 - throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); - } -// ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopInfo.getId(), ShopSubStageEnum.SHOP_STAGE_3); -// if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){ +// ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); +// if (Objects.nonNull(shopInfo)) { +// //进入选址不允许删除操作 // throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); // } - if (Objects.nonNull(shopInfo.getPointId())) { - PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(shopInfo.getPointId()); - if (Objects.nonNull(pointInfo) && SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) { - pointInfoDAO.recyclePoint(pointInfo.getId()); - } - pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5)); - } +// ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopInfo.getId(), ShopSubStageEnum.SHOP_STAGE_3); +// if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){ +// throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); +// } +// if (Objects.nonNull(shopInfo.getPointId())) { +// PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(shopInfo.getPointId()); +// if (Objects.nonNull(pointInfo) && SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) { +// pointInfoDAO.recyclePoint(pointInfo.getId()); +// } +// pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5)); +// } ShopInfoDO updateShop = new ShopInfoDO(); updateShop.setId(request.getShopId()); updateShop.setDeleted(true); @@ -410,6 +410,22 @@ public class ShopServiceImpl implements ShopService { return Boolean.TRUE; } + @Override + public Boolean updateShopStatue(Long shopId) { + ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId); + if (Objects.isNull(shopInfo)) { + throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); + } + Integer completionCount = shopStageInfoDAO.getCompletionCount(shopId); + if (completionCount.equals(ShopSubStageEnum.values().length)) { + shopInfo.setShopStatus(ShopStatusEnum.DONE.getCode()); + } else { + shopInfo.setShopStatus(ShopStatusEnum.ING.getCode()); + } + shopInfoDAO.updateShopInfo(shopInfo); + return Boolean.TRUE; + } + @Override public PageInfo getBranchShopList(BranchShopRequest request, String userId) { if (request.getFlag().equals(CommonConstants.TWO)) { diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCShopController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCShopController.java index 1332e6d7d..d69259916 100644 --- a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCShopController.java +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCShopController.java @@ -117,12 +117,15 @@ public class PCShopController { return ResponseResult.success(transferLogService.getTransferLogPage(pageNum, pageSize, lineId, lineShopType)); } - - - @ApiOperation("门店结束跟进") @GetMapping("/shopClose") public ResponseResult shopClose(@RequestParam("shopId")Long shopId) { return ResponseResult.success(shopService.shopClose(shopId)); } + + @ApiOperation("门店恢复状态") + @GetMapping("/updateShopStatue") + public ResponseResult updateShopStatue(@RequestParam("shopId")Long shopId) { + return ResponseResult.success(shopService.updateShopStatue(shopId)); + } } From 5bd795fec30ca2c0f8eeeb1e462b87da5d2cc4c7 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 24 Mar 2025 15:12:50 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=8C=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E6=81=A2=E5=A4=8D=E7=8A=B6=E6=80=81=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=97=A8=E5=BA=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cool/store/request/DeleteShopRequest.java | 4 ++++ .../cool/store/service/impl/ShopServiceImpl.java | 13 ++++++++++++- .../store/controller/webb/PCShopController.java | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/coolstore-partner-model/src/main/java/com/cool/store/request/DeleteShopRequest.java b/coolstore-partner-model/src/main/java/com/cool/store/request/DeleteShopRequest.java index 007194f62..a0ddc3cdf 100644 --- a/coolstore-partner-model/src/main/java/com/cool/store/request/DeleteShopRequest.java +++ b/coolstore-partner-model/src/main/java/com/cool/store/request/DeleteShopRequest.java @@ -3,6 +3,8 @@ package com.cool.store.request; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotNull; + /** * @author zhangchenbiao * @FileName: DeleteShopRequest @@ -13,6 +15,8 @@ import lombok.Data; public class DeleteShopRequest { @ApiModelProperty("店铺id") + @NotNull private Long shopId; + private String userId; } diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java index 6188df4d9..cf011dfd3 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java @@ -192,8 +192,12 @@ public class ShopServiceImpl implements ShopService { } @Override + @Transactional(rollbackFor = Exception.class) public Integer deleteShop(DeleteShopRequest request) { -// ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); + ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); + if (shopInfo==null){ + throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST); + } // if (Objects.nonNull(shopInfo)) { // //进入选址不允许删除操作 // throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); @@ -209,9 +213,16 @@ public class ShopServiceImpl implements ShopService { // } // pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5)); // } + LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfo.getLineId()); + lineInfoDO.setWantShopNum(lineInfoDO.getWantShopNum() - 1); + lineInfoDO.setUpdateTime(new Date()); + lineInfoDO.setUpdateUserId(request.getUserId()); + lineInfoDAO.updateLineInfo(lineInfoDO); ShopInfoDO updateShop = new ShopInfoDO(); updateShop.setId(request.getShopId()); updateShop.setDeleted(true); + updateShop.setUpdateTime(new Date()); + updateShop.setUpdateUserId(request.getUserId()); return shopInfoDAO.updateShopInfo(updateShop); } diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCShopController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCShopController.java index d69259916..883c89668 100644 --- a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCShopController.java +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCShopController.java @@ -59,6 +59,7 @@ public class PCShopController { @ApiOperation("删除店铺") @PostMapping("/deleteShop") public ResponseResult deleteShop(@RequestBody @Validated DeleteShopRequest request) { + request.setUserId(CurrentUserHolder.getUserId()); return ResponseResult.success(shopService.deleteShop(request)); } From 3ffcede71aff80d7b57804ccc2366fece9c7cbb0 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 24 Mar 2025 15:28:31 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=8C=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E6=81=A2=E5=A4=8D=E7=8A=B6=E6=80=81=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=97=A8=E5=BA=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/ShopStageInfoMapper.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/coolstore-partner-dao/src/main/resources/mapper/ShopStageInfoMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/ShopStageInfoMapper.xml index 8bfd0e074..7d4e122bb 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/ShopStageInfoMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/ShopStageInfoMapper.xml @@ -196,8 +196,9 @@ from xfsg_shop_stage_info a inner join xfsg_line_info b on a.line_id = b.id - where - a.shop_sub_stage = #{shopSubStage} and a.shop_sub_stage_status = #{shopSubStageStatus} and a.deleted = 0 and + left join xfsg_shop_info c on a.shop_id = c.id + where c.deleted=0 + and a.shop_sub_stage = #{shopSubStage} and a.shop_sub_stage_status = #{shopSubStageStatus} and a.deleted = 0 and b.deleted = 0 and b.development_manager = #{userId} From 81a76a8d4bcfcd206f0205608cfd92c8a09d1d62 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 24 Mar 2025 15:35:47 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=8C=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E6=81=A2=E5=A4=8D=E7=8A=B6=E6=80=81=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=97=A8=E5=BA=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cool/store/service/impl/ShopServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java index cf011dfd3..e4df4987a 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java @@ -174,6 +174,10 @@ public class ShopServiceImpl implements ShopService { @Override public List getShopStageInfo(Long shopId, Integer shopStage) { + ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId); + if (Objects.isNull(shopInfo)){ + throw new ServiceException(ErrorCodeEnum.SHOP_ID_NOT_EXIST); + } if (Objects.nonNull(shopStage)) { ShopStageEnum shopStageEnum = ShopStageEnum.getShopStageEnum(shopStage); if (Objects.isNull(shopStageEnum)) { From 1d82a08d3754b434cfb0992495e577f0692cfd2c Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 24 Mar 2025 16:08:21 +0800 Subject: [PATCH 05/11] fix --- .../src/main/resources/mapper/OperationLogMapper.xml | 2 +- .../src/main/resources/mapper/ShopInfoMapper.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coolstore-partner-dao/src/main/resources/mapper/OperationLogMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/OperationLogMapper.xml index 6394fa4b4..00ac149a3 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/OperationLogMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/OperationLogMapper.xml @@ -82,7 +82,7 @@ from xfsg_operation_log a left join xfsg_shop_info b on a.shop_id = b.id where - b.delete=0 + b.deleted=0 and a.operator = #{userId} and a.shop_sub_stage_status in diff --git a/coolstore-partner-dao/src/main/resources/mapper/ShopInfoMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/ShopInfoMapper.xml index 1eea77b00..7a4981c76 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/ShopInfoMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/ShopInfoMapper.xml @@ -213,7 +213,7 @@ left join xfsg_line_info xli on xsi.line_id = xli.id left join xfsg_shop_stage_info xssi on xssi.shop_id = xsi.id where - xsi.delete = 0 + xsi.deleted = 0 and xssi.shop_stage = 3 and xssi.shop_sub_stage_status != -100 and From a1b3cf0440040528ddf3dad2fb1e8f240e0398f8 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 31 Mar 2025 15:44:14 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E9=93=BA=E4=BD=8D=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=81=9A=E6=A3=80=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cool/store/service/impl/PointServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java index e42fc5911..47a26f9db 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java @@ -253,6 +253,9 @@ public class PointServiceImpl implements PointService { log.error("铺位基本信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } + if(!pointInfo.getPointStatus().equals(PointStatusEnum.POINT_STATUS_2.getCode())){ + throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); + } PointDetailInfoDO pointDetailInfo = pointDetailInfoDAO.getPointDetailInfoByPointId(pointId); if(Objects.isNull(pointDetailInfo)){ log.error("铺位详细信息不存在"); From 9b8b9bdba27475c7d9bda4cec1bc0aa5c8ac2622 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 31 Mar 2025 15:49:42 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E9=93=BA=E4=BD=8D=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=81=9A=E6=A3=80=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/cool/store/service/impl/PointServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java index 47a26f9db..249f8f62d 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java @@ -102,6 +102,7 @@ public class PointServiceImpl implements PointService { pointInfo.setPointCode(generateCode()); pointInfo.setDevelopmentManager(userId); pointInfo.setDevelopmentTime(new Date()); + pointInfo.setPointStatus(PointStatusEnum.POINT_STATUS_2.getCode()); Long pointId = pointInfoDAO.addPointInfo(pointInfo); PointDetailInfoDO shopPoint = AddPointDetailRequest.convertDO(shopPointDetailRequest); shopPoint.setPointId(pointId); From aa98da801757aada46ffd8692cbbf2aa456e7a54 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 31 Mar 2025 15:50:34 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E9=93=BA=E4=BD=8D=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=81=9A=E6=A3=80=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/service/impl/PointServiceImpl.java | 311 +++++++++--------- 1 file changed, 156 insertions(+), 155 deletions(-) diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java index 249f8f62d..728029da9 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/PointServiceImpl.java @@ -102,7 +102,6 @@ public class PointServiceImpl implements PointService { pointInfo.setPointCode(generateCode()); pointInfo.setDevelopmentManager(userId); pointInfo.setDevelopmentTime(new Date()); - pointInfo.setPointStatus(PointStatusEnum.POINT_STATUS_2.getCode()); Long pointId = pointInfoDAO.addPointInfo(pointInfo); PointDetailInfoDO shopPoint = AddPointDetailRequest.convertDO(shopPointDetailRequest); shopPoint.setPointId(pointId); @@ -113,12 +112,12 @@ public class PointServiceImpl implements PointService { @Override public PointDetailVO getPointDetailInfo(Long pointId, Boolean isGetNodeNo) { PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { log.error("铺位基本信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } PointDetailInfoDO pointDetailInfo = pointDetailInfoDAO.getPointDetailInfoByPointId(pointId); - if(Objects.isNull(pointDetailInfo)){ + if (Objects.isNull(pointDetailInfo)) { log.error("铺位详情信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } @@ -127,10 +126,10 @@ public class PointServiceImpl implements PointService { result.setDevelopmentManagerUserName(userName); result.setDevelopmentManagerUserId(pointInfo.getDevelopmentManager()); result.setRegionNodeName(regionService.getBelongWarRegionName(pointInfo.getRegionId())); - if(Objects.nonNull(isGetNodeNo) && isGetNodeNo){ + if (Objects.nonNull(isGetNodeNo) && isGetNodeNo) { result.setCurNodeNo(pointTodoInfoDAO.getCurNodeNoByPoint(pointId)); } - if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){ + if (SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) { List canSubmitRentContractShopIds = shopStageInfoDAO.getCanSubmitRentContractShopIds(Arrays.asList(pointInfo.getShopId())); boolean canSubmitRentContract = CollectionUtils.isEmpty(canSubmitRentContractShopIds) ? Boolean.FALSE : Boolean.TRUE; result.setCanSubmitRentContract(canSubmitRentContract); @@ -142,7 +141,7 @@ public class PointServiceImpl implements PointService { @Transactional(rollbackFor = Exception.class) public Long updatePointDetailInfo(UpdatePointDetailRequest shopPointDetailRequest) { PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(shopPointDetailRequest.getPointId()); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { log.error("铺位基本信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } @@ -158,10 +157,10 @@ public class PointServiceImpl implements PointService { public Integer generateEvaluationReport(Long pointId) { PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); PointDetailInfoDO pointDetailInfo = pointDetailInfoDAO.getPointDetailInfoByPointId(pointId); - if(Objects.isNull(pointInfo) || Objects.isNull(pointDetailInfo)){ + if (Objects.isNull(pointInfo) || Objects.isNull(pointDetailInfo)) { throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } - if(!pointDetailInfo.isCanSubmitEvaluable() || StringUtils.isBlank(pointInfo.getPointArea())){ + if (!pointDetailInfo.isCanSubmitEvaluable() || StringUtils.isBlank(pointInfo.getPointArea())) { throw new ServiceException(ErrorCodeEnum.POINT_NOT_COMPLETE); } Integer totalPointScore = pointDetailInfo.getTotalPointScore(); @@ -177,18 +176,18 @@ public class PointServiceImpl implements PointService { @Transactional(rollbackFor = Exception.class) public Integer pointInvalid(Long pointId) { PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { log.error("铺位基本信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } - if(PointStatusEnum.POINT_STATUS_6.getCode().equals(pointInfo.getPointStatus())){ + if (PointStatusEnum.POINT_STATUS_6.getCode().equals(pointInfo.getPointStatus())) { throw new ServiceException(ErrorCodeEnum.POINT_SIGNED); } PointInfoDO updatePoint = new PointInfoDO(); updatePoint.setId(pointId); updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_7.getCode()); pointInfoDAO.updatePointInfo(updatePoint); - if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){ + if (SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) { rollbackSelectPoint(pointInfo.getShopId(), pointInfo.getId()); } return pointRecommendDAO.updateRecommendStatus(pointId, PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_6, null); @@ -198,7 +197,7 @@ public class PointServiceImpl implements PointService { * 回退选址状态 * @return */ - private void rollbackSelectPoint(Long shopId, Long pointId){ + private void rollbackSelectPoint(Long shopId, Long pointId) { //店铺回退待带选址 shopInfoDAO.unbindPoint(shopId); //铺位回退 @@ -207,7 +206,7 @@ public class PointServiceImpl implements PointService { shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_10); //租赁合同回到未开始 Integer result = shopStageInfoDAO.updateShopStageToNotStarted(shopId, ShopSubStageEnum.SHOP_STAGE_2); - if(result > CommonConstants.ZERO){ + if (result > CommonConstants.ZERO) { //删除租赁合同 shopRentInfoDAO.deleteRentContractByShopId(shopId); } @@ -217,14 +216,14 @@ public class PointServiceImpl implements PointService { @Transactional(rollbackFor = Exception.class) public Integer pointUnbind(Long pointId) { PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { log.error("铺位基本信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } - if(PointStatusEnum.POINT_STATUS_6.getCode().equals(pointInfo.getPointStatus())){ + if (PointStatusEnum.POINT_STATUS_6.getCode().equals(pointInfo.getPointStatus())) { throw new ServiceException(ErrorCodeEnum.POINT_SIGNED); } - if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){ + if (SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) { rollbackSelectPoint(pointInfo.getShopId(), pointInfo.getId()); } //将已选择、已被他人选择的状态更新成待选泽 @@ -234,7 +233,7 @@ public class PointServiceImpl implements PointService { @Override public Integer addMapEvaluationReport(AddMapEvaluationReportRequest request) { PointDetailInfoDO pointDetailInfo = pointDetailInfoDAO.getPointDetailInfoByPointId(request.getPointId()); - if(Objects.isNull(pointDetailInfo)){ + if (Objects.isNull(pointDetailInfo)) { log.error("铺位基本信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } @@ -250,25 +249,26 @@ public class PointServiceImpl implements PointService { Long pointId = request.getPointId(); PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { log.error("铺位基本信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } - if(!pointInfo.getPointStatus().equals(PointStatusEnum.POINT_STATUS_2.getCode())){ + if (!pointInfo.getPointStatus().equals(PointStatusEnum.POINT_STATUS_2.getCode()) + && !pointInfo.getPointStatus().equals(PointStatusEnum.POINT_STATUS_1.getCode())) { throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); } PointDetailInfoDO pointDetailInfo = pointDetailInfoDAO.getPointDetailInfoByPointId(pointId); - if(Objects.isNull(pointDetailInfo)){ + if (Objects.isNull(pointDetailInfo)) { log.error("铺位详细信息不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } //处理子任务审核记录表 AuditSettingVO auditSetting = getAuditSetting(); - if(Objects.isNull(auditSetting)){ + if (Objects.isNull(auditSetting)) { throw new ServiceException(ErrorCodeEnum.POINT_AUDIT_NOT_SETTING); } List auditNode = dealAuditNode(auditSetting, pointInfo.getRegionId(), pointInfo.getDevelopmentManager()); - if(auditNode.size()==CommonConstants.ONE){ + if (auditNode.size() == CommonConstants.ONE) { throw new ServiceException(ErrorCodeEnum.CONFIRM_THE_APPROVER); } int submitAuditCount = pointInfo.getSubmitAuditCount() + 1; @@ -301,7 +301,7 @@ public class PointServiceImpl implements PointService { public AuditSettingVO getAuditSetting() { String cacheKey = MessageFormat.format(AUDIT_SETTING_KEY, enterpriseId); String auditSetting = redisUtilPool.getString(cacheKey); - if(StringUtils.isBlank(auditSetting)){ + if (StringUtils.isBlank(auditSetting)) { return null; } return JSONObject.parseObject(auditSetting, AuditSettingVO.class); @@ -341,25 +341,25 @@ public class PointServiceImpl implements PointService { * @param currentNo * @return */ - private Integer dealNextAuditRecord(PointInfoDO pointInfo, Map pointAuditRecordMap, Integer currentNo){ + private Integer dealNextAuditRecord(PointInfoDO pointInfo, Map pointAuditRecordMap, Integer currentNo) { Integer result = CommonConstants.ZERO; PointAuditRecordDO nextAuditRecord = getNextAuditRecord(currentNo, pointAuditRecordMap); - if(Objects.nonNull(nextAuditRecord)){ + if (Objects.nonNull(nextAuditRecord)) { pointAuditRecordDAO.updatePointAuditRecord(PointAuditRecordDO.convert(nextAuditRecord.getId(), new Date())); //审批通过的情况下 生成下一个节点的待办数据 pointTodoInfoDAO.addPointTodoInfo(PointAuditRecordDO.convertTODO(nextAuditRecord)); List sendMessageUserIds = JSONObject.parseArray(nextAuditRecord.getHandlerUserIds(), String.class); HashMap map = new HashMap<>(); - map.put("pointName",pointInfo.getPointName()) ; - map.put("pointAddress",pointInfo.getAddress()) ; + map.put("pointName", pointInfo.getPointName()); + map.put("pointAddress", pointInfo.getAddress()); commonService.sendQWMessage(sendMessageUserIds, MessageEnum.MESSAGE_13, map); - }else{ + } else { PointInfoDO updatePoint = new PointInfoDO(); updatePoint.setId(pointInfo.getId()); //没有下一节点 审批通过 updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_5.getCode()); updatePoint.setStorageStatus(StorageStatusEnum.IN_STORAGE.getCode()); - if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){ + if (SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) { initUploadRentContract(pointInfo); } Map messageMap = new HashMap<>(); @@ -378,7 +378,7 @@ public class PointServiceImpl implements PointService { * @param reason * @return */ - private Integer auditRejectDeal(PointInfoDO pointInfo, String reason){ + private Integer auditRejectDeal(PointInfoDO pointInfo, String reason) { Long pointId = pointInfo.getId(); PointInfoDO pointInfoUpdate = new PointInfoDO(); pointInfoUpdate.setId(pointId); @@ -398,17 +398,17 @@ public class PointServiceImpl implements PointService { @Override @Transactional(rollbackFor = Exception.class) public Integer audit(String userId, PointAuditRequest request) { - if(!request.check()){ + if (!request.check()) { throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); } Long pointId = request.getPointId(); PointTodoInfoDO pointTodo = pointTodoInfoDAO.getPointToDoByUserIdAndPointId(userId, pointId); - if(Objects.isNull(pointTodo)){ + if (Objects.isNull(pointTodo)) { log.info("该用户没有待办数据"); throw new ServiceException(ErrorCodeEnum.USER_NOT_TODO_AUDIT); } PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { log.info("铺位不存在"); throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } @@ -417,14 +417,14 @@ public class PointServiceImpl implements PointService { pointTodoInfoDAO.updatePointTodoInfo(pointId, pointTodo.getNodeNo(), pointInfo.getSubmitAuditCount(), userId); Map pointAuditRecordMap = pointAuditRecordDAO.getPointAuditRecordMap(pointId, pointInfo.getSubmitAuditCount()); PointAuditRecordDO pointAuditRecord = pointAuditRecordMap.get(pointTodo.getNodeNo()); - if(Objects.isNull(pointAuditRecord)){ + if (Objects.isNull(pointAuditRecord)) { log.info("铺位处理记录中的数据不对"); throw new ServiceException(ErrorCodeEnum.POINT_AUDIT_NODE_ERROR); } NodeNoEnum nodeNoEnum = NodeNoEnum.getByCode(pointTodo.getNodeNo()); PointAuditRecordDO auditRecord = PointAuditRecordDO.convert(pointAuditRecord.getId(), userId, auditStatus, request.getReason(), nodeNoEnum); pointAuditRecordDAO.updatePointAuditRecord(auditRecord); - if(AuditStatusEnum.REJECT.equals(auditStatus)){ + if (AuditStatusEnum.REJECT.equals(auditStatus)) { return auditRejectDeal(pointInfo, request.getReason()); } //处理下一节点任务及更新point状态 @@ -434,13 +434,13 @@ public class PointServiceImpl implements PointService { @Override public Integer turnDevelopmentManager(TurnDevelopmentManagerRequest request) { PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(request.getPointId()); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } - if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus()) || PointStatusEnum.POINT_STATUS_6.getCode().equals(pointInfo.getPointStatus())){ + if (SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus()) || PointStatusEnum.POINT_STATUS_6.getCode().equals(pointInfo.getPointStatus())) { throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); } - if(PointStatusEnum.POINT_STATUS_7.getCode().equals(pointInfo.getPointStatus())){ + if (PointStatusEnum.POINT_STATUS_7.getCode().equals(pointInfo.getPointStatus())) { throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); } pointInfo.setDevelopmentManager(request.getDevelopmentManager()); @@ -450,8 +450,8 @@ public class PointServiceImpl implements PointService { @Override public PageInfo getLinePage(PointLinePageRequest request) { Page lineList = lineInfoDAO.getLinePageByDevelopmentManager(request); - List userPortraitList = lineList.stream().filter(x -> StringUtils.isNotEmpty(x.getUserPortrait() )).map(LineInfoDO::getUserPortrait).collect(Collectors.toList()); - List investmentManagerUserIds = lineList.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager() )).map(LineInfoDO::getInvestmentManager).collect(Collectors.toList()); + List userPortraitList = lineList.stream().filter(x -> StringUtils.isNotEmpty(x.getUserPortrait())).map(LineInfoDO::getUserPortrait).collect(Collectors.toList()); + List investmentManagerUserIds = lineList.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager())).map(LineInfoDO::getInvestmentManager).collect(Collectors.toList()); List lineIds = lineList.stream().map(LineInfoDO::getId).collect(Collectors.toList()); List wantShopAreaIds = lineList.stream().map(LineInfoDO::getWantShopAreaId).collect(Collectors.toList()); Map recommendShopNumMap = pointRecommendDAO.getPushShopNumMap(lineIds); @@ -468,8 +468,8 @@ public class PointServiceImpl implements PointService { @Override public PageInfo getShopPage(PointLinePageRequest request) { List listByDevelopmentManager = shopInfoDAO.getShopPointListByDevelopmentManager(request); - List userPortraitList = listByDevelopmentManager.stream().filter(x -> StringUtils.isNotEmpty(x.getUserPortrait() )).map(ShopPointDTO::getUserPortrait).collect(Collectors.toList()); - List investmentManagerUserIds = listByDevelopmentManager.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager() )).map(ShopPointDTO::getInvestmentManager).collect(Collectors.toList()); + List userPortraitList = listByDevelopmentManager.stream().filter(x -> StringUtils.isNotEmpty(x.getUserPortrait())).map(ShopPointDTO::getUserPortrait).collect(Collectors.toList()); + List investmentManagerUserIds = listByDevelopmentManager.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager())).map(ShopPointDTO::getInvestmentManager).collect(Collectors.toList()); List shopIds = listByDevelopmentManager.stream().map(ShopPointDTO::getShopId).collect(Collectors.toList()); List wantShopAreaIds = listByDevelopmentManager.stream().map(ShopPointDTO::getWantShopAreaId).collect(Collectors.toList()); Map recommendShopNumMap = pointRecommendDAO.getShopPushPointNumMap(shopIds); @@ -480,7 +480,7 @@ public class PointServiceImpl implements PointService { List lineIds = listByDevelopmentManager.stream().map(ShopPointDTO::getLineId).collect(Collectors.toList()); Map partnerNameMap = lineInfoDAO.getUserNameMap(lineIds); - List resultList = ShopPointBaseInfoVO.convertList(partnerNameMap,listByDevelopmentManager, userNameMap, userPortraitMap, cityMap, recommendShopNumMap); + List resultList = ShopPointBaseInfoVO.convertList(partnerNameMap, listByDevelopmentManager, userNameMap, userPortraitMap, cityMap, recommendShopNumMap); PageInfo resultPage = new PageInfo(listByDevelopmentManager); resultPage.setList(resultList); return resultPage; @@ -492,7 +492,7 @@ public class PointServiceImpl implements PointService { * @return */ @Override - public LinePointBaseInfoVO getLineInfo(Long lineId){ + public LinePointBaseInfoVO getLineInfo(Long lineId) { LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId); Map recommendShopNumMap = pointRecommendDAO.getPushShopNumMap(Arrays.asList(lineId)); HyOpenAreaInfoDO cityArea = hyOpenAreaInfoDAO.selectById(lineInfo.getWantShopAreaId()); @@ -509,16 +509,16 @@ public class PointServiceImpl implements PointService { @Override public PageInfo getMyPointPage(PointPageRequest request) { - if(CollectionUtils.isNotEmpty(request.getRegionIds())){ - if(request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)){ + if (CollectionUtils.isNotEmpty(request.getRegionIds())) { + if (request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)) { request.setRegionIds(null); - }else{ + } else { request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds())); } } List resultList = new ArrayList(); Page pointPage = pointInfoDAO.getMyPointPage(request); - if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){ + if (Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())) { List regionIds = pointPage.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList()); List developmentManagers = pointPage.stream().map(PointInfoDO::getDevelopmentManager).distinct().collect(Collectors.toList()); Map userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers); @@ -531,23 +531,23 @@ public class PointServiceImpl implements PointService { } @Override - public PageInfo getTeamPointPage(AllPointPageRequest request){ - if(!sysRoleService.checkIsAdmin(request.getCurUserId())){ + public PageInfo getTeamPointPage(AllPointPageRequest request) { + if (!sysRoleService.checkIsAdmin(request.getCurUserId())) { request.setAuthRegionIds(userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(request.getCurUserId())); } - if(CollectionUtils.isNotEmpty(request.getRegionIds())){ - if(request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)){ + if (CollectionUtils.isNotEmpty(request.getRegionIds())) { + if (request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)) { request.setRegionIds(null); - }else{ + } else { request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds())); } } - if(Objects.nonNull(request.getPointStatus()) && PointStatusEnum.POINT_STATUS_3.getCode().equals(request.getPointStatus())){ + if (Objects.nonNull(request.getPointStatus()) && PointStatusEnum.POINT_STATUS_3.getCode().equals(request.getPointStatus())) { request.setPointStatus(PointStatusEnum.POINT_STATUS_4.getCode()); } List resultList = new ArrayList(); Page pointPage = pointInfoDAO.getTeamPointPage(request); - if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){ + if (Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())) { List regionIds = pointPage.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList()); List developmentManagers = pointPage.stream().map(PointInfoDO::getDevelopmentManager).distinct().collect(Collectors.toList()); Map userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers); @@ -562,10 +562,10 @@ public class PointServiceImpl implements PointService { @Override public List getPointAllAuditRecord(Long pointId) { List auditRecordList = pointAuditRecordDAO.getPointAllAuditRecord(pointId); - if(CollectionUtils.isEmpty(auditRecordList)){ + if (CollectionUtils.isEmpty(auditRecordList)) { return Lists.newArrayList(); } - List userIds = auditRecordList.stream().map(o->JSONObject.parseArray(o.getHandlerUserIds(), String.class)).flatMap(Collection::stream).distinct().collect(Collectors.toList()); + List userIds = auditRecordList.stream().map(o -> JSONObject.parseArray(o.getHandlerUserIds(), String.class)).flatMap(Collection::stream).distinct().collect(Collectors.toList()); Map userMap = enterpriseUserDAO.getUserInfoMap(userIds); return PointAuditRecordVO.convert(auditRecordList, userMap); } @@ -602,7 +602,7 @@ public class PointServiceImpl implements PointService { public PageInfo getRecommendPointList(RecommendPointPageRequest request) { List resultList = new ArrayList(); Page pointPage = pointInfoDAO.getRecommendPointList(request); - if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){ + if (Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())) { List regionIds = pointPage.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList()); List developmentManagers = pointPage.stream().map(PointInfoDO::getDevelopmentManager).distinct().collect(Collectors.toList()); Map userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers); @@ -619,26 +619,26 @@ public class PointServiceImpl implements PointService { List pointIds = request.getPointIds(); List pointList = pointInfoDAO.getPointListByIds(pointIds); List selectList = pointList.stream().filter(o -> SelectStatusEnum.SELECT_STATUS_1.getCode().equals(o.getSelectStatus())).collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(selectList)){ + if (CollectionUtils.isNotEmpty(selectList)) { String pointNames = selectList.stream().map(PointInfoDO::getPointName).collect(Collectors.joining(",")); throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, pointNames + ",已经被选"); } List invalidList = pointList.stream().filter(o -> PointStatusEnum.POINT_STATUS_7.getCode().equals(o.getPointStatus())).collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(invalidList)){ + if (CollectionUtils.isNotEmpty(invalidList)) { String pointNames = invalidList.stream().map(PointInfoDO::getPointName).collect(Collectors.joining(",")); throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, pointNames + ",已失效"); } List recommendPointList = pointRecommendDAO.getShopRecommendPointList(request.getShopId()); - if(CollectionUtils.isNotEmpty(recommendPointList)){ + if (CollectionUtils.isNotEmpty(recommendPointList)) { List recommendList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus()) || - PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(o.getStatus()) || - PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_4.getCode().equals(o.getStatus())) - .filter(o->request.getPointIds().contains(o.getPointId())).collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(recommendList)){ + PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(o.getStatus()) || + PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_4.getCode().equals(o.getStatus())) + .filter(o -> request.getPointIds().contains(o.getPointId())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(recommendList)) { throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "铺位已推送,请勿重复推送"); } - List selectedList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(o.getStatus())).filter(o->request.getPointIds().contains(o.getPointId())).collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(selectedList)){ + List selectedList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(o.getStatus())).filter(o -> request.getPointIds().contains(o.getPointId())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(selectedList)) { throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "铺位已选,请勿重复推送"); } } @@ -650,31 +650,31 @@ public class PointServiceImpl implements PointService { public Integer pointRecommendLine(PointRecommendLineRequest request) { Long pointId = request.getPointId(); PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } - if(PointStatusEnum.POINT_STATUS_7.getCode().equals(pointInfo.getPointStatus())){ + if (PointStatusEnum.POINT_STATUS_7.getCode().equals(pointInfo.getPointStatus())) { throw new ServiceException(ErrorCodeEnum.POINT_IS_INVALID); } - if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){ + if (SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) { throw new ServiceException(ErrorCodeEnum.POINT_SELECTED); } List recommendPointList = pointRecommendDAO.getRecommendPointListByPointId(pointId); - if(CollectionUtils.isNotEmpty(recommendPointList)){ + if (CollectionUtils.isNotEmpty(recommendPointList)) { List recommendList = recommendPointList.stream().filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(o.getStatus()) || - PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(o.getStatus()) || - PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_4.getCode().equals(o.getStatus())) - .filter(o->request.getShopIds().contains(o.getShopId())).collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(recommendList)){ + PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(o.getStatus()) || + PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_4.getCode().equals(o.getStatus())) + .filter(o -> request.getShopIds().contains(o.getShopId())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(recommendList)) { throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "推送失败,铺位已被选"); } List shopIds = recommendPointList.stream() .filter(o -> PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(o.getStatus())) - .filter(o->request.getShopIds().contains(o.getShopId())).map(PointRecommendDO::getShopId).collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(shopIds)){ - throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "请勿重复推送"); - } + .filter(o -> request.getShopIds().contains(o.getShopId())).map(PointRecommendDO::getShopId).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(shopIds)) { + throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "请勿重复推送"); } + } List recommendList = request.convertList(); return pointRecommendDAO.addRecommendPoint(recommendList); } @@ -700,10 +700,10 @@ public class PointServiceImpl implements PointService { @Override public Integer updateWantShopNum(UpdateWantShopNumRequest request) { LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId()); - if(Objects.isNull(lineInfo)){ + if (Objects.isNull(lineInfo)) { throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST); } - if(!WorkflowStageEnum.INTENT.getCode().equals(lineInfo.getWorkflowStage())){ + if (!WorkflowStageEnum.INTENT.getCode().equals(lineInfo.getWorkflowStage())) { throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_MODIFY_WANT_SHOP_NUM); } LineInfoDO updateLine = new LineInfoDO(); @@ -716,7 +716,7 @@ public class PointServiceImpl implements PointService { public PageInfo getTodoList(PointTodoPageRequest request) { Page pointPage = pointTodoInfoDAO.getUserTodoList(request); List resultList = new ArrayList<>(); - if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){ + if (Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())) { List regionIds = pointPage.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList()); List developmentManagers = pointPage.stream().map(PointInfoDO::getDevelopmentManager).distinct().collect(Collectors.toList()); Map userNameMap = enterpriseUserDAO.getUserNameMap(developmentManagers); @@ -732,7 +732,7 @@ public class PointServiceImpl implements PointService { public PageInfo getLineRecommendPointPage(MiniPointPageRequest request) { Page pointPage = pointRecommendDAO.getLineRecommendPointPage(request); List resultList = new ArrayList<>(); - if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){ + if (Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())) { List regionIds = pointPage.getResult().stream().map(MiniPointPageDTO::getRegionId).distinct().collect(Collectors.toList()); Map regionNameMap = regionService.getBelongWarRegionNameMap(regionIds); resultList = MiniPointPageVO.convertVO(pointPage, regionNameMap); @@ -747,27 +747,27 @@ public class PointServiceImpl implements PointService { public Integer lineSelectPoint(SelectPointRequest request) { Long pointId = request.getPointId(), shopId = request.getShopId(), lineId = request.getLineId(); String lockKey = MessageFormat.format(POINT_SELECT_KEY, enterpriseId, pointId); - if(!redisUtilPool.setNxExpire(lockKey, JSONObject.toJSONString(request), 30*1000)){ + if (!redisUtilPool.setNxExpire(lockKey, JSONObject.toJSONString(request), 30 * 1000)) { throw new ServiceException(ErrorCodeEnum.POINT_IS_LOCK); } try { ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId); - if(Objects.isNull(shopInfo)){ + if (Objects.isNull(shopInfo)) { throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST); } - if(!ShopStageEnum.SHOP_STAGE_1.getShopStage().equals(shopInfo.getShopStage())){ + if (!ShopStageEnum.SHOP_STAGE_1.getShopStage().equals(shopInfo.getShopStage())) { throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_NOT_OPERATE); } - if(Objects.nonNull(shopInfo.getPointId())){ + if (Objects.nonNull(shopInfo.getPointId())) { throw new ServiceException(ErrorCodeEnum.SHOP_IS_SELECTED); } PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); - if(Objects.isNull(pointInfo)){ + if (Objects.isNull(pointInfo)) { throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST); } - if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){ - if(lineId.equals(pointInfo.getLineId())){ - throw new ServiceException(ErrorCodeEnum.POINT_ALREADY_SELECT); + if (SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())) { + if (lineId.equals(pointInfo.getLineId())) { + throw new ServiceException(ErrorCodeEnum.POINT_ALREADY_SELECT); } throw new ServiceException(ErrorCodeEnum.POINT_IS_SELECTED); } @@ -791,7 +791,7 @@ public class PointServiceImpl implements PointService { pointDetailInfoDAO.updatePointDetailInfo(updateDetail); List updateStatusList = new ArrayList<>(); //如果铺位是已审核 则进入上传租赁合同状态 - if(PointStatusEnum.POINT_STATUS_5.getCode().equals(pointInfo.getPointStatus())){ + if (PointStatusEnum.POINT_STATUS_5.getCode().equals(pointInfo.getPointStatus())) { selectStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_12; updateStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_20); Map templateParam = new HashMap<>(); @@ -799,11 +799,11 @@ public class PointServiceImpl implements PointService { } updateStatusList.add(selectStatus); shopStageInfoDAO.batchUpdateShopStageStatus(shopId, updateStatusList); - if (selectStatus.equals( ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_11)){ + if (selectStatus.equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_11)) { LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId); HashMap map = new HashMap<>(); - map.put("pointName",pointInfo.getPointName()) ; - map.put("pointAddress",pointInfo.getAddress()); + map.put("pointName", pointInfo.getPointName()); + map.put("pointAddress", pointInfo.getAddress()); commonService.sendQWMessage(Collections.singletonList(shopInfo.getInvestmentManager()), MessageEnum.MESSAGE_13, map); @@ -815,9 +815,10 @@ public class PointServiceImpl implements PointService { redisUtilPool.delKey(lockKey); } } + @Override @Transactional(rollbackFor = Exception.class) - public Integer lineRejectPoint(RejectPointRequest request){ + public Integer lineRejectPoint(RejectPointRequest request) { return pointRecommendDAO.rejectPoint(request.getShopId(), request.getPointId(), request.getReason()); } @@ -827,14 +828,14 @@ public class PointServiceImpl implements PointService { public Long miniAddPointDetailInfo(MiniAddPointRequest request) { Long lineId = request.getCurLineId(); LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId); - if(Objects.isNull(lineInfo)){ + if (Objects.isNull(lineInfo)) { throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST); } ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); - if(Objects.isNull(shopInfo)){ + if (Objects.isNull(shopInfo)) { throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST); } - if(Objects.nonNull(shopInfo.getPointId())){ + if (Objects.nonNull(shopInfo.getPointId())) { throw new ServiceException(ErrorCodeEnum.SHOP_IS_SELECTED); } PointDetailInfoDO pointDetailInfo = MiniAddPointRequest.convertDO(request); @@ -868,9 +869,9 @@ public class PointServiceImpl implements PointService { updatePoint.setShopId(shopInfo.getId()); pointInfoDAO.updatePointInfo(updatePoint); HashMap map = new HashMap<>(); - map.put("partnerUsername",lineInfo.getUsername()); - map.put("partnerMobile",lineInfo.getMobile()); - map.put("pointName",pointInfo.getPointName()) ; + map.put("partnerUsername", lineInfo.getUsername()); + map.put("partnerMobile", lineInfo.getMobile()); + map.put("pointName", pointInfo.getPointName()); commonService.sendQWMessage(Collections.singletonList(shopInfo.getInvestmentManager()), MessageEnum.MESSAGE_51, map); @@ -878,25 +879,25 @@ public class PointServiceImpl implements PointService { } @Override - public Integer uploadRentContract(AddRentContractRequest request){ - if(!request.check()){ + public Integer uploadRentContract(AddRentContractRequest request) { + if (!request.check()) { throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); } Long pointId = request.getPointId(), shopId = request.getShopId(); - if(Objects.isNull(pointId) && Objects.nonNull(shopId)){ + if (Objects.isNull(pointId) && Objects.nonNull(shopId)) { ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId); pointId = shopInfo.getPointId(); } - if(Objects.nonNull(pointId) && Objects.isNull(shopId)){ + if (Objects.nonNull(pointId) && Objects.isNull(shopId)) { PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId); shopId = pointInfo.getShopId(); } ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_2); - if(Objects.isNull(shopSubStageInfo)){ + if (Objects.isNull(shopSubStageInfo)) { throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_ERROR); } List operateStatusList = Lists.newArrayList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_20.getShopSubStageStatus(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_22.getShopSubStageStatus()); - if(!operateStatusList.contains(shopSubStageInfo.getShopSubStageStatus())){ + if (!operateStatusList.contains(shopSubStageInfo.getShopSubStageStatus())) { throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_NOT_OPERATE); } //是否存在租赁合同 @@ -904,16 +905,16 @@ public class PointServiceImpl implements PointService { ShopRentInfoDO shopRentInfo = AddRentContractRequest.convertDO(request); shopRentInfo.setShopId(shopId); shopRentInfo.setPointId(pointId); - if(Objects.isNull(rentContract)){ + if (Objects.isNull(rentContract)) { shopRentInfoDAO.addShopRentInfo(shopRentInfo); - }else{ + } else { shopRentInfo.setId(rentContract.getId()); shopRentInfoDAO.updateRentContract(shopRentInfo); } LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopSubStageInfo.getLineId()); HashMap map = new HashMap<>(); - map.put("partnerUsername",lineInfo.getUsername()); - map.put("partnerMobile",lineInfo.getMobile()); + map.put("partnerUsername", lineInfo.getUsername()); + map.put("partnerMobile", lineInfo.getMobile()); commonService.sendQWMessage(Collections.singletonList(lineInfo.getInvestmentManager()), MessageEnum.MESSAGE_15, map); @@ -923,7 +924,7 @@ public class PointServiceImpl implements PointService { @Override public ShopRentInfoVO getRentContractDetail(Long shopId) { ShopRentInfoDO rentContract = shopRentInfoDAO.getRentContractByShopId(shopId); - if(Objects.isNull(rentContract)){ + if (Objects.isNull(rentContract)) { return null; } ShopRentInfoVO result = ShopRentInfoVO.build(rentContract); @@ -931,7 +932,7 @@ public class PointServiceImpl implements PointService { result.setStatus(shopSubStageInfo.getShopSubStageStatus()); boolean isAudit = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_22.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus()) || ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus()); - if(Objects.nonNull(shopSubStageInfo.getAuditId()) && isAudit){ + if (Objects.nonNull(shopSubStageInfo.getAuditId()) && isAudit) { //当前是审核过的状态才获取原因 ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(shopSubStageInfo.getAuditId()); result.setAuditInfo(AuditInfoVO.convertVO(auditInfo)); @@ -948,14 +949,14 @@ public class PointServiceImpl implements PointService { public Integer auditRentContract(AuditRentContractRequest request) { Long shopId = request.getShopId(); ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); - if(Objects.isNull(shopInfo)){ + if (Objects.isNull(shopInfo)) { throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST); } - if(!ShopStageEnum.SHOP_STAGE_1.getShopStage().equals(shopInfo.getShopStage())){ + if (!ShopStageEnum.SHOP_STAGE_1.getShopStage().equals(shopInfo.getShopStage())) { throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_NOT_OPERATE); } ShopStageInfoDO shopStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_2); - if (!shopStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21.getShopSubStageStatus())){ + if (!shopStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21.getShopSubStageStatus())) { throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE); } LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId()); @@ -966,10 +967,10 @@ public class PointServiceImpl implements PointService { Long auditId = shopAuditInfoDAO.addAuditInfo(AuditRentContractRequest.convert(request, AuditTypeEnum.UPLOAD_RENT_CONTRACT)); ShopSubStageStatusEnum subStageStatus = AuditResultTypeEnum.PASS.getCode().equals(request.getResultType()) ? ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23 : ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_22; - if(AuditResultTypeEnum.REJECT.getCode().equals(request.getResultType())){ + if (AuditResultTypeEnum.REJECT.getCode().equals(request.getResultType())) { //commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.RENT_CONTRACT_AUDIT_FAIL, null); } - if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23.equals(subStageStatus)){ + if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23.equals(subStageStatus)) { //审核通过铺位变为已签约 PointInfoDO updatePoint = new PointInfoDO(); updatePoint.setId(shopInfo.getPointId()); @@ -980,17 +981,17 @@ public class PointServiceImpl implements PointService { updateShop.setShopStage(ShopStageEnum.SHOP_STAGE_2.getShopStage()); List roleList = Arrays.asList(UserRoleEnum.THEATER_MANAGER, UserRoleEnum.OPERATIONS_MANAGER, UserRoleEnum.REGION_MANAGER); String shopManagerUserId = sysRoleService.getUserIdByRegionIdWithRolePriority(shopInfo.getRegionId(), roleList); - if(StringUtils.isBlank(shopManagerUserId)){ + if (StringUtils.isBlank(shopManagerUserId)) { shopManagerUserId = userAuthMappingService.getShopManagerUserId(); } updateShop.setShopManagerUserId(shopManagerUserId); shopInfoDAO.updateShopInfo(updateShop); //发送工作通知 Map requestMap = new HashMap<>(); - requestMap.put("partnerName",lineInfo.getUsername()); - requestMap.put("partnerMobile",lineInfo.getMobile()); - requestMap.put("lineId",String.valueOf(lineInfo.getId())); - requestMap.put("shopId",String.valueOf(shopId)); + requestMap.put("partnerName", lineInfo.getUsername()); + requestMap.put("partnerMobile", lineInfo.getMobile()); + requestMap.put("lineId", String.valueOf(lineInfo.getId())); + requestMap.put("shopId", String.valueOf(shopId)); // if (Objects.nonNull(shopInfo.getShopName())) { // requestMap.put("storeName",shopInfo.getShopName()); // commonService.sendMessage(Arrays.asList(lineInfo.getInvestmentManager()),MessageEnum.MESSAGE_16,requestMap); @@ -1004,18 +1005,18 @@ public class PointServiceImpl implements PointService { } @Override - public Integer updateRentContract(UpdateRentContractRequest request){ - if(!request.check()){ + public Integer updateRentContract(UpdateRentContractRequest request) { + if (!request.check()) { throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); } ShopRentInfoDO shopRentInfo = UpdateRentContractRequest.convertDO(request); ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_2); - if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_22.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){ + if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_22.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())) { shopStageInfoDAO.updateShopStageAndAuditInfo(shopRentInfo.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21, null); LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopSubStageInfo.getLineId()); HashMap map = new HashMap<>(); - map.put("partnerUsername",lineInfo.getUsername()); - map.put("partnerMobile",lineInfo.getMobile()); + map.put("partnerUsername", lineInfo.getUsername()); + map.put("partnerMobile", lineInfo.getMobile()); commonService.sendQWMessage(Collections.singletonList(lineInfo.getInvestmentManager()), MessageEnum.MESSAGE_15, map); @@ -1031,7 +1032,7 @@ public class PointServiceImpl implements PointService { request.setPageSize(pageSize); Page pointPage = pointTodoInfoDAO.getUserTodoList(request); List resultList = new ArrayList<>(); - if(Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())){ + if (Objects.nonNull(pointPage) && CollectionUtils.isNotEmpty(pointPage.getResult())) { List regionIds = pointPage.stream().map(PointInfoDO::getRegionId).distinct().collect(Collectors.toList()); List pointIds = pointPage.stream().map(PointInfoDO::getId).collect(Collectors.toList()); //获取提交时间 @@ -1048,17 +1049,17 @@ public class PointServiceImpl implements PointService { public PageInfo getRentContractToDoPage(String userId, Integer pageNumber, Integer pageSize) { Page todoPage = shopStageInfoDAO.getRentContractToDoPage(userId, pageNumber, pageSize); List resultList = null; - if(Objects.nonNull(todoPage) && CollectionUtils.isNotEmpty(todoPage.getResult())){ + if (Objects.nonNull(todoPage) && CollectionUtils.isNotEmpty(todoPage.getResult())) { List shopIds = todoPage.getResult().stream().map(RentInfoToDoVO::getShopId).collect(Collectors.toList()); List shopList = shopInfoDAO.getShopListByIds(shopIds); - Map shopPointMap = shopList.stream().collect(Collectors.toMap(k->k.getId(), Function.identity())); + Map shopPointMap = shopList.stream().collect(Collectors.toMap(k -> k.getId(), Function.identity())); List regionIds = shopList.stream().map(ShopInfoDO::getRegionId).distinct().collect(Collectors.toList()); List pointIds = shopList.stream().map(ShopInfoDO::getPointId).collect(Collectors.toList()); List pointList = pointInfoDAO.getPointListByIds(pointIds); - Map pointMap = ListUtils.emptyIfNull(pointList).stream().collect(Collectors.toMap(k->k.getId(), Function.identity())); + Map pointMap = ListUtils.emptyIfNull(pointList).stream().collect(Collectors.toMap(k -> k.getId(), Function.identity())); Map regionNameMap = regionService.getBelongWarRegionNameMap(regionIds); List rentContractList = shopRentInfoDAO.getRentContractByShopIds(shopIds); - Map rentContractSubmitTimeMap = ListUtils.emptyIfNull(rentContractList).stream().collect(Collectors.toMap(k->k.getShopId(), v->v.getCreateTime())); + Map rentContractSubmitTimeMap = ListUtils.emptyIfNull(rentContractList).stream().collect(Collectors.toMap(k -> k.getShopId(), v -> v.getCreateTime())); resultList = RentInfoToDoVO.convert(todoPage, shopPointMap, pointMap, regionNameMap, rentContractSubmitTimeMap); } PageInfo resultPage = new PageInfo(todoPage); @@ -1071,55 +1072,55 @@ public class PointServiceImpl implements PointService { public Boolean linePointToShopPoint(Long lineId) { //查询所有的推荐 如果传入的lineId 则查询该线索的所有推荐 List allRecommendPointList = pointRecommendDAO.getAllRecommendPointList(lineId); - if (CollectionUtils.isEmpty(allRecommendPointList)){ + if (CollectionUtils.isEmpty(allRecommendPointList)) { return Boolean.TRUE; } List recommendList = new ArrayList<>(); List updateList = new ArrayList<>(); allRecommendPointList.forEach(recommend -> { //如果是待选择 - if(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(recommend.getStatus())|| - PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5.getCode().equals(recommend.getStatus())|| - PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_6.getCode().equals(recommend.getStatus())){ + if (PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1.getCode().equals(recommend.getStatus()) || + PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5.getCode().equals(recommend.getStatus()) || + PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_6.getCode().equals(recommend.getStatus())) { //将单条加盟商数据 分配到各个门店商 Long tempLineId = recommend.getLineId(); List shopList = shopInfoDAO.getShopList(tempLineId); for (ShopInfoDO shopInfoDO : shopList) { PointRecommendDO tempPointRecommendDO = new PointRecommendDO(); - BeanUtil.copyProperties(recommend,tempPointRecommendDO); + BeanUtil.copyProperties(recommend, tempPointRecommendDO); tempPointRecommendDO.setShopId(shopInfoDO.getId()); recommendList.add(tempPointRecommendDO); } } //已选 已被他人选择 - if(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(recommend.getStatus())){ + if (PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_2.getCode().equals(recommend.getStatus())) { //查询该加盟商选择的这个店 ShopInfoDO shopInfoByPointId = shopInfoDAO.getShopInfoByPointId(recommend.getLineId(), recommend.getPointId()); recommend.setShopId(shopInfoByPointId.getId()); updateList.add(recommend); } - if(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(recommend.getStatus())){ + if (PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_3.getCode().equals(recommend.getStatus())) { List recommendPointListByPointId = pointRecommendDAO.getRecommendPointListByPointId(recommend.getPointId()); - for (PointRecommendDO pointRecommendDO: recommendPointListByPointId) { + for (PointRecommendDO pointRecommendDO : recommendPointListByPointId) { //表示当前门店已选址 - if (pointRecommendDO.getLineId().equals(recommend.getLineId())){ + if (pointRecommendDO.getLineId().equals(recommend.getLineId())) { continue; } List shopList = shopInfoDAO.getShopList(pointRecommendDO.getLineId()); for (ShopInfoDO shopInfoDO : shopList) { PointRecommendDO tempPointRecommendDO = new PointRecommendDO(); - BeanUtil.copyProperties(recommend,tempPointRecommendDO); + BeanUtil.copyProperties(recommend, tempPointRecommendDO); tempPointRecommendDO.setShopId(shopInfoDO.getId()); recommendList.add(tempPointRecommendDO); } } } }); - if (CollectionUtils.isNotEmpty(updateList)){ + if (CollectionUtils.isNotEmpty(updateList)) { pointRecommendDAO.batchUpdateShopId(updateList); } - if (CollectionUtils.isNotEmpty(recommendList)){ + if (CollectionUtils.isNotEmpty(recommendList)) { log.info("linePointToShopPoint recommendList:{}", JSONObject.toJSONString(recommendList)); pointRecommendDAO.addRecommendPoint(recommendList); } @@ -1131,7 +1132,7 @@ public class PointServiceImpl implements PointService { List roleIds = new ArrayList<>(); //审核人 Pair, List> firstApproval = getUserIdsAndPositionIds(auditSetting.getFirstApproval()); - if(CollectionUtils.isNotEmpty(firstApproval.getValue())){ + if (CollectionUtils.isNotEmpty(firstApproval.getValue())) { roleIds.addAll(firstApproval.getValue()); } List resultList = new ArrayList<>(); @@ -1139,7 +1140,7 @@ public class PointServiceImpl implements PointService { List firstApprovalUserIds = getUserIdsByPositionIds(firstApproval, userIdsMap); resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_0.getCode(), PointAuditRecordDO.SUBMIT_TASK, Boolean.FALSE, Arrays.asList(developmentManager))); //todo 缺少兜底人 - if(CollectionUtils.isNotEmpty(firstApprovalUserIds)){ + if (CollectionUtils.isNotEmpty(firstApprovalUserIds)) { resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_1.getCode(), PointAuditRecordDO.RECEIVE_TASK, Boolean.TRUE, firstApprovalUserIds)); } return resultList; @@ -1150,7 +1151,7 @@ public class PointServiceImpl implements PointService { * @param requests * @return */ - private Pair, List> getUserIdsAndPositionIds(List requests){ + private Pair, List> getUserIdsAndPositionIds(List requests) { List positionIds = ListUtils.emptyIfNull(requests).stream().filter(o -> "position".equals(o.getType())).map(UserAndPositionRequest::getValue).collect(Collectors.toList()); List userIds = ListUtils.emptyIfNull(requests).stream().filter(o -> "person".equals(o.getType())).map(UserAndPositionRequest::getValue).collect(Collectors.toList()); return Pair.of(userIds, positionIds); @@ -1164,13 +1165,13 @@ public class PointServiceImpl implements PointService { */ private List getUserIdsByPositionIds(Pair, List> userIdsAndPositionIds, Map> userIdsMap) { Set userIds = new HashSet<>(); - if(CollectionUtils.isNotEmpty(userIdsAndPositionIds.getKey())){ + if (CollectionUtils.isNotEmpty(userIdsAndPositionIds.getKey())) { userIds.addAll(userIdsAndPositionIds.getKey()); } - if(CollectionUtils.isNotEmpty(userIdsAndPositionIds.getValue())){ + if (CollectionUtils.isNotEmpty(userIdsAndPositionIds.getValue())) { userIdsAndPositionIds.getValue().forEach(positionId -> { List userIdList = userIdsMap.get(positionId); - if(CollectionUtils.isNotEmpty(userIdList)){ + if (CollectionUtils.isNotEmpty(userIdList)) { userIds.addAll(userIdList); } }); @@ -1178,14 +1179,14 @@ public class PointServiceImpl implements PointService { return new ArrayList<>(userIds); } - private PointAuditRecordDO getNextAuditRecord(Integer currentNodeNo, Map auditRecordMap){ + private PointAuditRecordDO getNextAuditRecord(Integer currentNodeNo, Map auditRecordMap) { List nextNodeNoList = NodeNoEnum.getNextNodeNoList(currentNodeNo); - if(CollectionUtils.isEmpty(nextNodeNoList)){ + if (CollectionUtils.isEmpty(nextNodeNoList)) { return null; } for (NodeNoEnum nodeNoEnum : nextNodeNoList) { PointAuditRecordDO pointAuditRecord = auditRecordMap.get(nodeNoEnum.getCode()); - if(Objects.nonNull(pointAuditRecord)){ + if (Objects.nonNull(pointAuditRecord)) { return pointAuditRecord; } } From cc34f3b5f66c2845e12c6f4d26d09be68d695bd8 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 31 Mar 2025 16:19:17 +0800 Subject: [PATCH 09/11] fix --- .../com/cool/store/enums/point/ShopSubStageEnum.java | 10 ++++++++++ .../src/main/resources/mapper/ShopStageInfoMapper.xml | 2 +- .../com/cool/store/service/impl/ShopServiceImpl.java | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/point/ShopSubStageEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/point/ShopSubStageEnum.java index 408c6869d..4a631e943 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/point/ShopSubStageEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/point/ShopSubStageEnum.java @@ -63,6 +63,16 @@ public enum ShopSubStageEnum { this.planCompleteDays = planCompleteDays; } + public static Integer getTotalStageIsLocationAndPreparation() { + int total=0; + for (ShopSubStageEnum shopStageEnum : ShopSubStageEnum.values()) { + if (shopStageEnum.getShopStageEnum().getShopStage().equals(ShopStageEnum.SHOP_STAGE_1.getShopStage()) + ||shopStageEnum.getShopStageEnum().getShopStage().equals(ShopStageEnum.SHOP_STAGE_2.getShopStage())) { + total++; + } + } + } + public static List getShopStageEnum(Integer shopStage) { List resultList = new ArrayList<>(); for (ShopSubStageEnum shopStageEnum : ShopSubStageEnum.values()) { diff --git a/coolstore-partner-dao/src/main/resources/mapper/ShopStageInfoMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/ShopStageInfoMapper.xml index 7d4e122bb..d1fa69bd7 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/ShopStageInfoMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/ShopStageInfoMapper.xml @@ -415,6 +415,6 @@ from xfsg_shop_stage_info where - shop_id = #{shopId} and deleted = 0 and is_terminated = 1 + shop_id = #{shopId} and deleted = 0 and is_terminated = 1 and shop_stage in (1,2) \ No newline at end of file diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java index e4df4987a..fdc6ad087 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java @@ -432,7 +432,7 @@ public class ShopServiceImpl implements ShopService { throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); } Integer completionCount = shopStageInfoDAO.getCompletionCount(shopId); - if (completionCount.equals(ShopSubStageEnum.values().length)) { + if (completionCount.equals(ShopSubStageEnum.getTotalStageIsLocationAndPreparation())) { shopInfo.setShopStatus(ShopStatusEnum.DONE.getCode()); } else { shopInfo.setShopStatus(ShopStatusEnum.ING.getCode()); From 01933a6d18455bc059481d9fa9c4fd918dc95db3 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Mon, 31 Mar 2025 16:21:23 +0800 Subject: [PATCH 10/11] fix --- .../main/java/com/cool/store/enums/point/ShopSubStageEnum.java | 1 + 1 file changed, 1 insertion(+) diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/point/ShopSubStageEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/point/ShopSubStageEnum.java index 4a631e943..a99ce4c3b 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/point/ShopSubStageEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/point/ShopSubStageEnum.java @@ -71,6 +71,7 @@ public enum ShopSubStageEnum { total++; } } + return total; } public static List getShopStageEnum(Integer shopStage) { From e4da6acf5ee45bbb1fca2ee267c3e8a96cd492f6 Mon Sep 17 00:00:00 2001 From: "shuo.wang" Date: Tue, 1 Apr 2025 16:02:41 +0800 Subject: [PATCH 11/11] fix --- .../java/com/cool/store/service/impl/ShopServiceImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java index fdc6ad087..387c2d6c2 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/ShopServiceImpl.java @@ -175,7 +175,7 @@ public class ShopServiceImpl implements ShopService { @Override public List getShopStageInfo(Long shopId, Integer shopStage) { ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId); - if (Objects.isNull(shopInfo)){ + if (Objects.isNull(shopInfo)) { throw new ServiceException(ErrorCodeEnum.SHOP_ID_NOT_EXIST); } if (Objects.nonNull(shopStage)) { @@ -199,7 +199,7 @@ public class ShopServiceImpl implements ShopService { @Transactional(rollbackFor = Exception.class) public Integer deleteShop(DeleteShopRequest request) { ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId()); - if (shopInfo==null){ + if (shopInfo == null) { throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST); } // if (Objects.nonNull(shopInfo)) { @@ -218,7 +218,9 @@ public class ShopServiceImpl implements ShopService { // pointRecommendDAO.updateRecommendStatus(shopInfo.getPointId(), PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_1, Arrays.asList(PointRecommendStatusEnum.POINT_RECOMMEND_STATUS_5)); // } LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfo.getLineId()); - lineInfoDO.setWantShopNum(lineInfoDO.getWantShopNum() - 1); + if (lineInfoDO.getWantShopNum() > 1) { + lineInfoDO.setWantShopNum(lineInfoDO.getWantShopNum() - 1); + } lineInfoDO.setUpdateTime(new Date()); lineInfoDO.setUpdateUserId(request.getUserId()); lineInfoDAO.updateLineInfo(lineInfoDO);