diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java index 68c34830cf..0d0824fdfd 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActInfoDTO.java @@ -209,4 +209,8 @@ public class LatestActInfoDTO implements Serializable { */ private String delFlag; + /** + * 数据库新增ACT_INFO_ID字段,act_info.id + */ + private String actInfoId; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java index d29b3460e2..06208c4564 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java @@ -32,6 +32,11 @@ public class RePublishFormDTO implements Serializable { @Size(min=1,message = "活动详情不能为空",groups = {AddUserShowGroup.class}) private List actContent; + /** + * 发布之前,如果点击了预览,此列有值 + */ + private String actDraftId; + /** * 活动id */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml index 361df3c0cb..cab00271a7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-heart-server: container_name: epmet-heart-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.34 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.35 ports: - "8111:8111" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-heart/epmet-heart-server/pom.xml b/epmet-module/epmet-heart/epmet-heart-server/pom.xml index 5acb62bf73..44cedf7a6f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/pom.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.34 + 0.0.35 com.epmet epmet-heart diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java index caf1adf16f..958598534d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java @@ -22,6 +22,7 @@ import com.epmet.dto.result.work.ActPreviewResultDTO; import com.epmet.dto.result.work.LatestDraftActInfoResultDTO; import com.epmet.entity.LatestActInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 最近一次编辑的活动信息 @@ -67,4 +68,14 @@ public interface LatestActInfoDao extends BaseDao { * @Date 2020/7/27 17:10 **/ int updateToDelById(String id); + + /** + * @return int + * @param actDraftId + * @param actInfoId + * @author yinzuomei + * @description + * @Date 2020/8/4 15:26 + **/ + int updateActInfoId(@Param("actDraftId") String actDraftId, @Param("actInfoId") String actInfoId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java index df12c12dc0..706cf0668b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActInfoEntity.java @@ -178,5 +178,8 @@ public class LatestActInfoEntity extends BaseEpmetEntity { * 审核开关:1报名人员需要人工审核0不需要 */ private Boolean auditSwitch; - + /** + * 数据库新增ACT_INFO_ID字段,act_info.id + */ + private String actInfoId; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java index 0375e16a36..e622f5f9fb 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java @@ -165,6 +165,11 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { logger.info("修改活动草稿actDraftId",formDTO.getActDraftId()); latestActInfoDTO.setId(formDTO.getActDraftId()); } + //如果是重新编辑活动进来的,保存草稿的时候,记录活动id的关系 + if(StringUtils.isNotBlank(formDTO.getActId())){ + logger.info("重新编辑活动act_id="+formDTO.getActId()); + latestActInfoDTO.setActInfoId(formDTO.getActId()); + } latestActInfoDTO.setCustomerId(formDTO.getCustomerId()); //活动标题 latestActInfoDTO.setTitle(formDTO.getTitle()); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 02e047bf58..1936de361d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -93,6 +93,9 @@ public class WorkActServiceImpl implements WorkActService { private ActGrantPointLogDao actGrantPointLogDao; @Autowired private UserKindnessTimeLogDao userKindnessTimeLogDao; + @Autowired + private LatestActInfoDao latestActInfoDao; + /** * @return void * @author yinzuomei @@ -151,7 +154,11 @@ public class WorkActServiceImpl implements WorkActService { logger.info("发布活动,审核成功"); actInfoDao.insert(actInfoEntity); - + //如果用户之前点击了预览,需要去更新草稿表里的act_info_id,记录草稿和活动的关系 + if(StringUtils.isNotBlank(formDTO.getActDraftId())){ + logger.info("更新latest_act_info表的act_info_id字段"); + latestActInfoDao.updateActInfoId(formDTO.getActDraftId(),actInfoEntity.getId()); + } List actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); for(ActContentEntity actContentEntity:actContentEntityList){ actContentDao.insert(actContentEntity); @@ -1216,6 +1223,10 @@ public class WorkActServiceImpl implements WorkActService { /*if(rePublishFormDTO.getNoticePassedPeople()){ this.noticePassedPeople(originalActInfo,newActInfoEntity); }*/ + //如果用户在重新发布之前点击了预览,需要去更新草稿表里的act_info_id,记录草稿和活动的关系 + if(StringUtils.isNotBlank(rePublishFormDTO.getActDraftId())){ + latestActInfoDao.updateActInfoId(rePublishFormDTO.getActDraftId(),newActInfoEntity.getId()); + } return publishActResultDTO; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql index 7cc204d675..dcfead8989 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql @@ -11,7 +11,7 @@ Target Server Version : 50728 File Encoding : 65001 - Date: 31/07/2020 17:50:23 + Date: 04/08/2020 15:40:16 */ SET NAMES utf8mb4; @@ -420,6 +420,7 @@ CREATE TABLE `latest_act_info` ( `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人', `UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间', `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标识', + `ACT_INFO_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'act_info.id', PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '最近一次编辑的活动信息' ROW_FORMAT = Compact; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml index a2e33b2245..f0904b26a4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml @@ -39,6 +39,7 @@ + @@ -50,6 +51,7 @@ WHERE lai.DEL_FLAG = '0' AND lai.CREATED_BY = #{userId} + AND (lai.act_info_id is null or trim(lai.act_info_id) ='') @@ -123,4 +125,11 @@ update latest_act_info set DEL_FLAG='1' where id=#{id} + + + + UPDATE latest_act_info + SET ACT_INFO_ID = #{actInfoId} + WHERE id = #{actDraftId} + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml index 91855e43fd..235d235ed8 100644 --- a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-point-server: container_name: epmet-point-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.24 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.27 ports: - "8112:8112" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index c1a57a5cad..674089633b 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.0.24 + 0.0.27 epmet-point com.epmet diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index 5eb5aaefbd..780a68019c 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java @@ -195,14 +195,22 @@ public class PointRuleServiceImpl extends BaseServiceImpl> customerListResult = operCrmOpenFeignClient.getAllCustomerList(); + log.info("initPointRule operCrmOpenFeignClient.getAllCustomerList result:{}",JSON.toJSONString(customerListResult)); if (!customerListResult.success() || CollectionUtils.isEmpty(customerListResult.getData())) { - log.error("获取所有客户列表失败"); + throw new RenException("获取所有客户列表失败"); } List customerDTOList = customerListResult.getData(); List ruleDefaultEntities = pointRuleDefaultDao.selectList(null); + if (CollectionUtils.isEmpty(ruleDefaultEntities)) { + log.warn("initPointRule pointRuleDefaultDao.selectList return empty"); + throw new RenException("获取默认规则失败"); + } List haveInitCustomerIds = baseDao.selectCustomerIds(); + if (haveInitCustomerIds == null) { + haveInitCustomerIds = new ArrayList<>(); + } List insertList = new ArrayList<>(); - ruleDefaultEntities.forEach(defaultRule -> { + for (PointRuleDefaultEntity defaultRule : ruleDefaultEntities) { for (CustomerDTO customerDTO : customerDTOList) { if (haveInitCustomerIds.contains(customerDTO.getId())) { continue; @@ -211,7 +219,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl 4.0.0 - 0.0.99 + 0.0.100 com.epmet diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java index 21e369aec9..e697eb7515 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -82,4 +82,8 @@ public interface PaConstant { * 更新客户Id信息失败 */ String UPDATE_CUSTOMER_EXCEPTION = "更新客户Id信息失败"; + /** + * 更新客户初始化状态失败 + */ + String UPDATE_ISINITIALIZE_EXCEPTION = "更新客户初始化状态失败"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java index 8ff724fb1d..09c2429eba 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java @@ -90,6 +90,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl page(Map params) { @@ -533,6 +535,15 @@ public class PaCustomerServiceImpl extends BaseServiceImpl%s", paCustomer.getId())); + throw new RenException(PaConstant.UPDATE_ISINITIALIZE_EXCEPTION); + } + } } \ No newline at end of file