增加查询获取验收列表详情接口

This commit is contained in:
shuo.wang
2024-05-11 19:37:47 +08:00
parent be7d3481ea
commit d1fcdf8ec0
10 changed files with 140 additions and 76 deletions

View File

@@ -256,5 +256,13 @@ public class ShopStageInfoDAO {
ShopSubStageEnum shopSubStageEnum = ShopSubStageEnum.SHOP_STAGE_16;
return shopStageInfoMapper.getShopCountByLineIdAndStageStatus(lineId, shopSubStageEnum.getShopStageEnum().getShopStage(), shopSubStageEnum.getShopSubStage(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_00.getShopSubStageStatus());
}
/**
* @Auther: wangshuo
* @Date: 2024/5/11
* @description:获取处于a阶段或b阶段和c阶段的
*/
public List<ShopStageInfoDO> getSubStageListBySubStageStatus(ShopSubStageStatusEnum a,ShopSubStageStatusEnum b, ShopSubStageStatusEnum c){
return shopStageInfoMapper.getSubStageListBySubStageStatus(a.getShopSubStageStatus(),b.getShopSubStageStatus(),c.getShopSubStageStatus());
}
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.mapper;
import com.cool.store.dto.Preparation.ScheduleDTO;
import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.vo.shop.RentInfoToDoVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
@@ -134,4 +135,10 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
* @return
*/
Integer getShopCountByLineIdAndStageStatus(@Param("lineId")Long lineId, @Param("shopStage") Integer shopStage, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus);
/**
* @Auther: wangshuo
* @Date: 2024/5/11
* @description:获取处于a阶段或b阶段和c阶段的
*/
List<ShopStageInfoDO> getSubStageListBySubStageStatus(@Param("subStageStatusA")Integer subStageStatusA,@Param("subStageStatusB")Integer subStageStatusB,@Param("subStageStatusC")Integer subStageStatusC );
}

View File

@@ -24,13 +24,14 @@
<result column="plan_acceptance_time" jdbcType="TIMESTAMP" property="planAcceptanceTime"/>
<result column="actual_acceptance_time" jdbcType="TIMESTAMP" property="actualAcceptanceTime"/>
<result column="booking_user" jdbcType="VARCHAR" property="bookingUser"/>
<result column="plan_exit_time" jdbcType="TIMESTAMP" property="planExitTime"/>
</resultMap>
<sql id="baseColumn">
id
,shop_id,actual_entry_time,planned_completion_time,planned_start_time,decoration_planned_completion_time,
decoration_planned_start_time,construction_completion_time,engineering_acceptance_signatures,
operations_acceptance_signatures,partner_acceptance_signatures,
create_time,update_time,deleted,plan_acceptance_time,actual_acceptance_time,booking_user
create_time,update_time,deleted,plan_acceptance_time,actual_acceptance_time,booking_user,plan_exit_time
</sql>
<update id="updateByShopIDSelective">
update xfsg_acceptance_info
@@ -77,6 +78,9 @@
<if test="bookingUser !=null ">
booking_user =#{bookingUser},
</if>
<if test="planExitTime !=null">
plan_exit_time =#{planExitTime}
</if>
</set>
where shop_id = #{shopId}
</update>

View File

@@ -54,25 +54,25 @@
<update id="batchUpdate">
update xfsg_assessment_data
<set>
qualified = CASE id
qualified = CASE template_id
<foreach collection="AssessmentDataDOS" separator=" " item="item">
WHEN #{item.id} THEN #{item.qualified}
WHEN #{item.templateId} THEN #{item.qualified}
</foreach>
END,
reason = CASE id
reason = CASE template_id
<foreach collection="AssessmentDataDOS" separator=" " item="item">
WHEN #{item.id} THEN #{item.reason}
WHEN #{item.templateId} THEN #{item.reason}
</foreach>
END,
comments = CASE id
comments = CASE template_id
<foreach collection="AssessmentDataDOS" separator=" " item="item">
WHEN #{item.id} THEN #{item.comments}
WHEN #{item.templateId} THEN #{item.comments}
</foreach>
END
</set>
where id in (
where template_id in (
<foreach collection="AssessmentDataDOS" item="item" separator=",">
#{item.id}
#{item.templateId}
</foreach>
)
</update>

View File

@@ -265,4 +265,18 @@
<select id="getShopCountByLineIdAndStageStatus" resultType="integer">
select count(1) from xfsg_shop_stage_info where shop_stage = #{shopStage} and shop_sub_stage = #{shopSubStage} and shop_sub_stage_status = #{shopSubStageStatus} and line_id = #{lineId}
</select>
<select id="getSubStageListBySubStageStatus" resultType="com.cool.store.entity.ShopStageInfoDO">
select *
from xfsg_shop_stage_info
where 1=1
<if test="subStageStatusA !=null">
or shop_sub_stage_status = #{subStageStatusA}
</if>
<if test="subStageStatusB !=null">
or shop_sub_stage_status = #{subStageStatusB}
</if>
<if test="subStageStatusC !=null">
and shop_sub_stage_status = #{subStageStatusC}
</if>
</select>
</mapper>

View File

@@ -1,4 +1,5 @@
package com.cool.store.entity;
import java.util.Date;
import javax.persistence.*;
@@ -82,20 +83,37 @@ public class AcceptanceInfoDO {
/**
* 是否删除0.否 1.是
*/
@Column(name = "deleted")
private Boolean deleted;
/**
* 计划验收时间
*/
@Column(name = "plan_acceptance_time")
private Date planAcceptanceTime;
/**
* 实际验收时间
*/
@Column(name = "actual_acceptance_time")
private Date actualAcceptanceTime;
/**
* 预约人
*/
@Column(name = "booking_user")
private String bookingUser;
/**
*计划撤场时间
*/
@Column(name = "plan_exit_time")
private Date planExitTime;
public Date getPlanExitTime() {
return planExitTime;
}
public void setPlanExitTime(Date planExitTime) {
this.planExitTime = planExitTime;
}
public Date getPlanAcceptanceTime() {
return planAcceptanceTime;

View File

@@ -285,6 +285,7 @@ public class DecorationServiceImpl implements DecorationService {
name.add(CommonConstants.EIGHT_DAY);
name.add(CommonConstants.WITHDRAWAL);
ConstructionScheduleDTO approach = new ConstructionScheduleDTO();
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoDAO.selectByShopId(shopId);
ConstructionScheduleDTO constructionSage = new ConstructionScheduleDTO();
for (ConstructionScheduleDTO constructionScheduleDTO : constructionSchedule) {
if (name.contains(constructionScheduleDTO.getName())) {
@@ -292,27 +293,35 @@ public class DecorationServiceImpl implements DecorationService {
if (constructionScheduleDTO.getName().equals(CommonConstants.APPROACH)) {
approach = constructionScheduleDTO;
}
//计划撤场时间
if (constructionScheduleDTO.getName().equals(CommonConstants.WITHDRAWAL)) {
ConstructionScheduleDTO withdrawal = constructionScheduleDTO;
if (Objects.nonNull(acceptanceInfoDO)) {
Date date = CoolDateUtils.parseDate(withdrawal.getPlanBeginDate(), CoolDateUtils.DATE_FORMAT_DAY);
acceptanceInfoDO.setPlanExitTime(date);
}
}
}
if (constructionScheduleDTO.getName().equals(CommonConstants.CONSTRUCTION_PHASE)) {
constructionSage = constructionScheduleDTO;
}
}
//设置进场时间xfsg_acceptance_info
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoDAO.selectByShopId(shopId);
if (Objects.nonNull(acceptanceInfoDO) && StringUtils.isNotEmpty(approach.getActualBeginDate())) {
Date date = CoolDateUtils.parseDate(approach.getActualBeginDate(), CoolDateUtils.DATE_FORMAT_DAY);
acceptanceInfoDO.setActualEntryTime(date);
}
//施工完成时间,计划开始和完成时间 //
if (StringUtils.isNotEmpty(constructionSage.getActualEndDate())) {
if (Objects.nonNull(acceptanceInfoDO) && StringUtils.isNotEmpty(constructionSage.getActualEndDate())) {
Date date = CoolDateUtils.parseDate(constructionSage.getActualEndDate(), CoolDateUtils.DATE_FORMAT_DAY);
acceptanceInfoDO.setConstructionCompletionTime(date);
}
if (StringUtils.isNotEmpty(constructionSage.getPlanBeginDate())) {
if (Objects.nonNull(acceptanceInfoDO) && StringUtils.isNotEmpty(constructionSage.getPlanBeginDate())) {
Date date = CoolDateUtils.parseDate(constructionSage.getPlanBeginDate(), CoolDateUtils.DATE_FORMAT_DAY);
acceptanceInfoDO.setPlannedStartTime(date);
}
if (StringUtils.isNotEmpty(constructionSage.getPlanEndDate())) {
if (Objects.nonNull(acceptanceInfoDO) && StringUtils.isNotEmpty(constructionSage.getPlanEndDate())) {
Date date = CoolDateUtils.parseDate(constructionSage.getPlanEndDate(), CoolDateUtils.DATE_FORMAT_DAY);
acceptanceInfoDO.setPlannedCompletionTime(date);
}
@@ -545,15 +554,15 @@ public class DecorationServiceImpl implements DecorationService {
public fitmentCheckVO getAcceptanceDetail(Long shopId, LoginUserInfo user) {
fitmentCheckVO fitmentCheckVO = new fitmentCheckVO();
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (Objects.isNull(shopInfo)){
log.error("店铺信息不存在 shopId:{}",shopId);
if (Objects.isNull(shopInfo)) {
log.error("店铺信息不存在 shopId:{}", shopId);
return null;
}
//招商经理选址人员拓展经理id
Long lineId = shopInfo.getLineId();
LineInfoDO lineInfo = lineInfoMapper.getByLineId(lineId);
if (Objects.isNull(lineInfo)){
log.error("线索信息不存在 shopId:{}",shopId);
if (Objects.isNull(lineInfo)) {
log.error("线索信息不存在 shopId:{}", shopId);
return null;
}
//招商name

View File

@@ -2,6 +2,7 @@ package com.cool.store.utils.poi;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.jetbrains.annotations.NotNull;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
@@ -223,4 +224,17 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
return new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS).format(new Date(time));
}
/**
*
* @Date: 2024/5/11
* @description:获取X天后的时间 LocalDate
*/
public static LocalDate getPlusFDays(Date date, Integer days) {
Instant instant = date.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDate localDate = instant.atZone(zone).toLocalDate();
LocalDate datePlusFDays = localDate.plusDays(days);
return datePlusFDays;
}
}

View File

@@ -6,7 +6,9 @@ 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.request.xfsgFirstOrderListRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.xfsgFirstOderListResponse;
import com.cool.store.service.ShopService;
import com.cool.store.service.impl.CommonService;
import lombok.extern.slf4j.Slf4j;

View File

@@ -178,7 +178,6 @@ public class XxlJobHandler {
* @description: 每天更新装修阶段进场时间等,至预约状态
*/
@XxlJob("fitmentAcceptanceHandler")
@Transactional(rollbackFor = Exception.class)
public void fitmentAcceptanceHandler() {
log.info("----定时任务每天更新装修阶段进场时间,施工完成时间等,至预约状态----");
boolean hasNext = true;
@@ -186,17 +185,18 @@ public class XxlJobHandler {
int pageSize = 50;
while (hasNext) {
PageHelper.startPage(pageNum, pageSize);
//获取表中进场时间为空的店铺
List<AcceptanceInfoDO> acceptanceList = acceptanceInfoDAO.selectByEntryTimeNull();
if (CollectionUtils.isEmpty(acceptanceList)) {
//获取表中处于施工中或施工完成阶段并且三方验收未预约的
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStageListBySubStageStatus(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_111,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120);
if (CollectionUtils.isEmpty(subStageList)) {
log.info("------定时任务结束调用鲜丰获取进场时间结束------");
return;
}
int flag = CommonConstants.ZERO;
for (AcceptanceInfoDO acceptanceInfoDO : acceptanceList) {
for (ShopStageInfoDO shopStageInfoDO : subStageList) {
int flag = CommonConstants.ZERO;
while (flag < CommonConstants.TWO) {
try {
Long shopId = acceptanceInfoDO.getShopId();
Long shopId = shopStageInfoDO.getShopId();
//施工子阶段
List<ConstructionScheduleDTO> construction = decorationService.getConstruction(shopId);
Map<String, ConstructionScheduleDTO> constructionMap = construction.stream().
@@ -206,22 +206,22 @@ public class XxlJobHandler {
if (Objects.nonNull(approach)) {
Date date = CoolDateUtils.parseDate(approach.getActualBeginDate(), CoolDateUtils.DATE_FORMAT_DAY);
if (Objects.nonNull(date)) {
Result result = getResult(date,CommonConstants.FOUR);
if (result.datePlusDays.equals(result.localDate)) {
//三方验收带预约
LocalDate plusFDays = DateUtils.getPlusFDays(date, CommonConstants.FOUR);
//小于等于当前时间
if (plusFDays.isEqual(LocalDate.now()) || plusFDays.isBefore(LocalDate.now())) {
//三方验收待预约
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_120);
}
}
}
break;
} catch (Exception e) {
log.error("定时任务设置进场时间失败,shopId:{}", acceptanceInfoDO.getShopId());
log.error("定时任务设置进场时间失败,shopId:{}", shopStageInfoDO.getShopId());
flag++;
}
}
flag = CommonConstants.ZERO;
}
hasNext = acceptanceList.size() >= pageSize;
hasNext = subStageList.size() >= pageSize;
pageNum++;
}
log.info("------定时任务结束调用鲜丰获取进场时间结束------");
@@ -257,17 +257,22 @@ public class XxlJobHandler {
try {
Date approach = acceptanceInfoDO.getActualEntryTime();
if (Objects.nonNull(approach)) {
Result result = getResult(approach,CommonConstants.FOUR);
if (result.datePlusDays.equals(result.localDate)) {
LocalDate plusFDays = DateUtils.getPlusFDays(approach, CommonConstants.FOUR);
if (plusFDays.equals(LocalDate.now())) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
EnterpriseUserDO userByRoleEnumAndRegionId = userAuthMappingService
.getUserByRoleEnumAndRegionId(UserRoleEnum.ENGINEER_DEP_SUPERVISOR, shopInfo.getRegionId());
if (StringUtils.isBlank(userByRoleEnumAndRegionId.getUserId())) {
log.error("定时任务三方验收待预约钉钉通知,工程监理id为空,shopId:#{}", acceptanceInfoDO.getShopId());
break;
}
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;
@@ -284,24 +289,6 @@ 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
@@ -334,42 +321,40 @@ public class XxlJobHandler {
try {
Date approach = acceptanceInfoDO.getActualEntryTime();
if (Objects.nonNull(approach)) {
Result result = getResult(approach,CommonConstants.SIX);//7 day
if (result.datePlusDays.equals(result.localDate)) {
LocalDate plusFDays = DateUtils.getPlusFDays(approach, CommonConstants.SIX);//7 day
if (plusFDays.equals(LocalDate.now())) {
//三方验收带预约
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(acceptanceInfoDO.getShopId());
//加盟商手机号
Long lineId = shopInfo.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
if (Objects.isNull(lineInfo) && StringUtils.isNull(lineInfo.getMobile())) {
log.error("定时任务三方验收预约短信通知:加盟商手机号为空,shopId:#{}", acceptanceInfoDO.getShopId());
break;
}
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);
//获取计划撤场时间
Date planExitTime = acceptanceInfoDO.getPlanExitTime();
//获取施工阶段计划完成时间
ConstructionScheduleDTO constructionInfo = decorationService.getConstructionInfo(acceptanceInfoDO.getShopId());
Date decorationEndTime = acceptanceInfoDO.getDecorationPlannedCompletionTime();
//获取计划验收时间
String palnAcceptanceTime = CoolDateUtils.DateFormat(acceptanceInfoDO.getPlanAcceptanceTime(), CoolDateUtils.DATE_FORMAT_SEC);
//区域监理name
String supervisorName = enterpriseUserDAO.getUserName(supervisor.getUserId());
String planAcceptanceTime = CoolDateUtils.DateFormat(acceptanceInfoDO.getPlanAcceptanceTime(), CoolDateUtils.DATE_FORMAT_SEC);
//区域监理手机号
String mobile = supervisor.getMobile();
Map<String, String> messageMap = new HashMap<>();
if (Objects.nonNull(withdrawal) && withdrawal.getPlanEndDate() != null) {
messageMap.put("demolitionPlanTime", withdrawal.getPlanEndDate());
if (Objects.nonNull(planExitTime)) {
String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, planExitTime);
messageMap.put("demolitionPlanTime", date);
} else {
if (Objects.nonNull(constructionInfo)) {
messageMap.put("demolitionPlanTime", constructionInfo.getPlanEndDate());
if (Objects.nonNull(decorationEndTime)) {
String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, decorationEndTime);
messageMap.put("demolitionPlanTime", date);
}
}
messageMap.put("palnAcceptanceTime", palnAcceptanceTime);
messageMap.put("supervisionName", supervisorName);
messageMap.put("palnAcceptanceTime", planAcceptanceTime);
messageMap.put("supervisionName", supervisor.getName());
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);
}
}
@@ -422,14 +407,17 @@ public class XxlJobHandler {
Date approach = acceptance.getActualEntryTime();
Long shopId = acceptance.getShopId();
if (Objects.nonNull(approach)) {
Result result = getResult(approach,CommonConstants.SIX);//7天
if (result.datePlusDays.equals(result.localDate)) {
LocalDate plusFDays = DateUtils.getPlusFDays(approach, CommonConstants.SIX);//7天
if (plusFDays.equals(LocalDate.now())) {
ShopStageInfoDO stageInfoDO = lineIdMap.get(shopId);
ShopInfoDO shopInfoDO = shopIdMap.get(shopId);
if (StringUtils.isBlank(shopInfoDO.getSupervisorUserId())){
log.error("定时任务三方待验收钉钉通知,督导id为空,shopId:{}", shopId);
}
Long lineId = stageInfoDO.getLineId();
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(lineId);
Map<String, String> messageMap = new HashMap<>();
messageMap.put("storeName",shopInfoDO.getShopName());
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);