Merge remote-tracking branch 'origin/cc_partner_init' into cc_partner_init

This commit is contained in:
bianyadong
2024-05-11 16:13:35 +08:00
26 changed files with 555 additions and 113 deletions

View File

@@ -39,7 +39,7 @@ public class PCOpenNewShopController {
}
@ApiOperation("获取详情")
@PostMapping("/getOpenNewShopRecordDetail")
@GetMapping("/getOpenNewShopRecordDetail")
public ResponseResult<PartnerOpenNewShopDetailVO> getOpenNewShopRecordDetail(@RequestParam("recordId") Long recordId) {
return ResponseResult.success(openNewShopService.getOpenNewShopRecordDetail(recordId));
}

View File

@@ -18,6 +18,7 @@ import com.cool.store.response.ResponseResult;
import com.cool.store.service.*;
import com.cool.store.vo.OpeningOperationPlanListVO;
import com.cool.store.vo.OpeningOperationPlanVO;
import com.cool.store.vo.shop.ShopStageInfoVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -52,7 +53,11 @@ public class PCOpenPreparationController {
public ResponseResult<Boolean> flush(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(openingOperationPlanService.flush(shopId));
}
@ApiOperation("获取鲜丰订货金状态")
@GetMapping("/getStatus")
public ResponseResult<Boolean> getStatus(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(openingOperationPlanService.getStatus(shopId));
}
@PostMapping("/openingOperationPlan/submit")
@ApiOperation("提交开业运营方案")
public ResponseResult submitPlan(@RequestBody OpeningOperationPlanRequest request) {

View File

@@ -5,6 +5,7 @@ import com.cool.store.dao.*;
import com.cool.store.entity.*;
import com.cool.store.enums.MessageEnum;
import com.cool.store.enums.SMSMsgEnum;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ShopService;
import com.cool.store.service.impl.CommonService;
@@ -29,7 +30,10 @@ public class PCTestController {
private ShopService shopService;
@Resource
private LineInterviewDAO lineInterviewDAO;
static String url = "https://hzly.cloudcubic.net/ajaxHandle/synchronization/JCallBackSynchronizationHandler.ashx?action=app&controller=GetProjectDetails&projectid=";
@Resource
private HttpRestTemplateService httpRestTemplateService;
@GetMapping("/sendMessage")
public ResponseResult<Boolean> sendMessage(@RequestParam("lineId")Long lineId, @RequestParam("pointId")Long pointId, @RequestParam MessageEnum messageEnum){
@@ -71,4 +75,5 @@ public class PCTestController {
shopService.initShop(lineInfo);
return ResponseResult.success(Boolean.FALSE);
}
}

View File

@@ -1,19 +1,13 @@
package com.cool.store.controller.webc;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.request.AuditOpenNewShopRequest;
import com.cool.store.request.PartnerOpenNewShopPageRequest;
import com.cool.store.request.SubmitOpenNewShopRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.OpenNewShopService;
import com.cool.store.vo.PartnerOpenNewShopDetailVO;
import com.cool.store.vo.PartnerOpenNewShopPageVO;
import com.github.pagehelper.PageInfo;
import com.cool.store.vo.IsSubmitOpenNewShopVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -40,10 +34,10 @@ public class MiniOpenNewShopController {
return ResponseResult.success(openNewShopService.submitOpenNewShop(request));
}
@ApiOperation("获取待审核的状态")
@GetMapping("/getWaitAuditOpenNewShopRecord")
public ResponseResult<PartnerOpenNewShopDetailVO> getWaitAuditOpenNewShopRecord() {
return ResponseResult.success(openNewShopService.getWaitAuditOpenNewShopRecord(PartnerUserHolder.getUser().getLineId()));
@ApiOperation("获取是否可提交开新店申请")
@GetMapping("/isSubmitOpenNewShop")
public ResponseResult<IsSubmitOpenNewShopVO> isSubmitOpenNewShop() {
return ResponseResult.success(openNewShopService.isSubmitOpenNewShop(PartnerUserHolder.getUser().getLineId()));
}
}

View File

@@ -30,6 +30,7 @@ import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -205,12 +206,8 @@ public class XxlJobHandler {
if (Objects.nonNull(approach)) {
Date date = CoolDateUtils.parseDate(approach.getActualBeginDate(), CoolDateUtils.DATE_FORMAT_DAY);
if (Objects.nonNull(date)) {
Instant instant = date.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.FOUR); // 5天
LocalDate now = LocalDate.now();
if (datePlusFiveDays.equals(now)) {
Result result = getResult(date,CommonConstants.FOUR);
if (result.datePlusDays.equals(result.localDate)) {
//三方验收带预约
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120);
}
@@ -243,7 +240,6 @@ public class XxlJobHandler {
int pageNum = 1;
int pageSize = 50;
while (hasNext) {
//TODO
PageHelper.startPage(pageNum, pageSize);
//获取为带预约状态的
List<ShopStageInfoDO> shopIdListByStageStatus = shopStageInfoDAO.
@@ -254,27 +250,33 @@ public class XxlJobHandler {
}
List<Long> shopIds = shopIdListByStageStatus.stream().filter(o -> o.getShopId() != null).map(o -> o.getShopId()).collect(Collectors.toList());
List<AcceptanceInfoDO> acceptanceInfoDOS = acceptanceInfoDAO.selectByShopIds(shopIds);
int flag = CommonConstants.ZERO;
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceInfoDOS) {
//进场时间
Date approach = acceptanceInfoDO.getActualEntryTime();
if (Objects.nonNull(approach)) {
Instant instant = approach.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.FOUR); // 5天
if (datePlusFiveDays.equals(localDate)) {
//三方验收带预约
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
EnterpriseUserDO userByRoleEnumAndRegionId = userAuthMappingService
.getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
Map<String, String> messageMap = new HashMap<>();
messageMap.put("storeName", shopInfo.getShopName());
messageMap.put("partnerUsername", lineInfo.getUsername());
messageMap.put("partnerMobile", lineInfo.getMobile());
commonService.sendMessage(Arrays.asList(userByRoleEnumAndRegionId.getUserId()), MessageEnum.MESSAGE_24, messageMap);
while (flag < CommonConstants.TWO) {
try {
Date approach = acceptanceInfoDO.getActualEntryTime();
if (Objects.nonNull(approach)) {
Result result = getResult(approach,CommonConstants.FOUR);
if (result.datePlusDays.equals(result.localDate)) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
EnterpriseUserDO userByRoleEnumAndRegionId = userAuthMappingService
.getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(shopInfo.getLineId());
Map<String, String> messageMap = new HashMap<>();
messageMap.put("storeName", shopInfo.getShopName());
messageMap.put("partnerUsername", lineInfo.getUsername());
messageMap.put("partnerMobile", lineInfo.getMobile());
commonService.sendMessage(Arrays.asList(userByRoleEnumAndRegionId.getUserId()), MessageEnum.MESSAGE_24, messageMap);
}
}
break;
} catch (Exception e) {
log.error("------定时任务三方验收待预约钉钉通知失败,shopId:{}", acceptanceInfoDO.getShopId());
flag++;
}
}
flag = CommonConstants.ZERO;
}
hasNext = shopIdListByStageStatus.size() >= pageSize;
pageNum++;
@@ -282,10 +284,29 @@ public class XxlJobHandler {
}
private static @NotNull Result getResult(Date date,Integer days) {
Instant instant = date.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(days); // 5天
Result result = new Result(localDate, datePlusFiveDays);
return result;
}
private static class Result {
public final LocalDate localDate;
public final LocalDate datePlusDays;
public Result(LocalDate localDate, LocalDate datePlusDays) {
this.localDate = localDate;
this.datePlusDays = datePlusDays;
}
}
/**
* @Auther: wangshuo
* @Date: 2024/5/7
* @description:三方验收预约短信通知+7day
* @description:三方验收预约短信通知,进场时间+7天的1800发送短信到加盟商
*/
@XxlJob("threeAcceptanceMessage")
public void threeAcceptanceMessage() {
@@ -307,31 +328,67 @@ public class XxlJobHandler {
Map<Long, ShopStageInfoDO> lineIdMap = ShopStageInfoList.stream().filter(o -> o.getLineId() != null)
.collect(Collectors.toMap(ShopStageInfoDO::getLineId, Function.identity()));
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds);
int flag = CommonConstants.ZERO;
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceList) {
while (flag < CommonConstants.TWO) {
try {
Date approach = acceptanceInfoDO.getActualEntryTime();
if (Objects.nonNull(approach)) {
Result result = getResult(approach,CommonConstants.SIX);//7 day
if (result.datePlusDays.equals(result.localDate)) {
//三方验收带预约
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
EnterpriseUserDO supervisor = userAuthMappingService
.getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
//获取撤场计划完成时间
List<ConstructionScheduleDTO> construction = decorationService.getConstruction(acceptanceInfoDO.getShopId());
Map<String, ConstructionScheduleDTO> map = construction.stream()
.filter(o -> StringUtils.isNoneBlank(o.getName()))
.collect(Collectors.toMap(ConstructionScheduleDTO::getName, dto -> dto));
ConstructionScheduleDTO withdrawal = map.get(CommonConstants.WITHDRAWAL);
//获取施工阶段计划完成时间
ConstructionScheduleDTO constructionInfo = decorationService.getConstructionInfo(acceptanceInfoDO.getShopId());
//获取计划验收时间
String palnAcceptanceTime = CoolDateUtils.DateFormat(acceptanceInfoDO.getPlanAcceptanceTime(), CoolDateUtils.DATE_FORMAT_SEC);
//区域监理name
String supervisorName = enterpriseUserDAO.getUserName(supervisor.getUserId());
//区域监理手机号
String mobile = supervisor.getMobile();
Map<String, String> messageMap = new HashMap<>();
if (Objects.nonNull(withdrawal) && withdrawal.getPlanEndDate() != null) {
messageMap.put("demolitionPlanTime", withdrawal.getPlanEndDate());
} else {
for (AcceptanceInfoDO acceptance : acceptanceList) {
Date approach = acceptance.getActualEntryTime();
if (Objects.nonNull(approach)) {
Instant instant = approach.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.SIX); // 7天
if (datePlusFiveDays.equals(localDate)) {
ShopStageInfoDO stageInfoDO = lineIdMap.get(acceptance.getShopId());
if (Objects.nonNull(stageInfoDO)) {
Long lineId = stageInfoDO.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
Map<String, String> templateParam = new HashMap<>();
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, null);
if (Objects.nonNull(constructionInfo)) {
messageMap.put("demolitionPlanTime", constructionInfo.getPlanEndDate());
}
}
messageMap.put("palnAcceptanceTime", palnAcceptanceTime);
messageMap.put("supervisionName", supervisorName);
messageMap.put("supervisionMobile", mobile);
//加盟商手机号
ShopStageInfoDO stageInfoDO = lineIdMap.get(acceptanceInfoDO.getShopId());
Long lineId = stageInfoDO.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, messageMap);
}
}
break;
} catch (Exception e) {
log.error("定时任务三方验收预约短信通知失败 shopId:{}", acceptanceInfoDO.getShopId());
flag++;
}
}
flag = CommonConstants.ZERO;
}
hasNext = ShopStageInfoList.size() >= pageSize;
pageNum++;
}
XxlJobHelper.handleSuccess();
}
/**
* @Auther: wangshuo
* @Date: 2024/5/7
@@ -339,7 +396,7 @@ public class XxlJobHandler {
*/
@XxlJob("waitThreeAcceptanceMessage")
public void waitThreeAcceptanceMessage() {
log.info("------定时任务三方待验收通知-----");
log.info("------定时任务三方待验收钉钉通知-----");
boolean hasNext = true;
int pageNum = 1;
int pageSize = 50;
@@ -349,7 +406,7 @@ public class XxlJobHandler {
List<ShopStageInfoDO> ShopStageInfoList = shopStageInfoDAO.
getShopIdListByStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121.getShopSubStageStatus());
if (CollectionUtils.isEmpty(ShopStageInfoList)) {
log.info("------定时任务结束三方验收预约短信通知------");
log.info("------定时任务结束三方验收钉钉通知------");
return;
}
List<Long> shopIds = ShopStageInfoList.stream().filter(o -> o.getShopId() != null)
@@ -357,21 +414,26 @@ public class XxlJobHandler {
Map<Long, ShopStageInfoDO> lineIdMap = ShopStageInfoList.stream().filter(o -> o.getLineId() != null)
.collect(Collectors.toMap(ShopStageInfoDO::getLineId, Function.identity()));
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByShopIds(shopIds);
List<ShopInfoDO> shopListByIds = shopInfoDAO.getShopListByIds(shopIds);
Map<Long, ShopInfoDO> shopIdMap = shopListByIds.stream().filter(o -> o.getId() != null)
.collect(Collectors.toMap(ShopInfoDO::getId, Function.identity()));
for (AcceptanceInfoDO acceptance : acceptanceList) {
//进场时间
Date approach = acceptance.getActualEntryTime();
Long shopId = acceptance.getShopId();
if (Objects.nonNull(approach)) {
Instant instant = approach.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFiveDays = localDate.plusDays(CommonConstants.SIX); // 7天
if (datePlusFiveDays.equals(localDate)) {
ShopStageInfoDO stageInfoDO = lineIdMap.get(acceptance.getShopId());
if (Objects.nonNull(stageInfoDO)) {
Long lineId = stageInfoDO.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.THREE_ACCEPTANCE_WAIT, null);
}
Result result = getResult(approach,CommonConstants.SIX);//7天
if (result.datePlusDays.equals(result.localDate)) {
ShopStageInfoDO stageInfoDO = lineIdMap.get(shopId);
ShopInfoDO shopInfoDO = shopIdMap.get(shopId);
Long lineId = stageInfoDO.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
Map<String, String> messageMap = new HashMap<>();
messageMap.put("storeName",shopInfoDO.getShopName());
messageMap.put("partnerUsername", lineInfo.getUsername());
messageMap.put("partnerMobile", lineInfo.getMobile());
commonService.sendMessage(Arrays.asList(shopInfoDO.getSupervisorUserId()), MessageEnum.MESSAGE_25, messageMap);
}
}
}