Преглед изворни кода

Merge branch 'information-27' into dev

# Conflicts:
#	netflix-common/src/main/java/com/cyksj/common/constant/Constant.java
#	netflix-service/src/main/java/com/cyksj/service/template/impl/TemplateCommonServiceImpl.java
zoujiajian пре 2 година
родитељ
комит
9adef60dd3

+ 2 - 2
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -265,7 +265,7 @@ public interface Constant {
 
 	BigDecimal TWO_THOUSAND = BigDecimal.valueOf(200000);
 
-	String ACCOUNT_PWD_UPDATE_SYS_MSG_NOTIFY = "您购买的%s,密码已修改";
+	String ACCOUNT_PWD_UPDATE_SYS_MSG_NOTIFY = "您购买的%s账号,密码已修改";
 
-	String ACCOUNT_SET_SYS_MSG_NOTIFY = "您购买的%s,账号已配置";
+	String ACCOUNT_SET_SYS_MSG_NOTIFY = "您购买的%s账号,账号已配置";
 }

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/mapper/UserSysMsgNotifyMapper.java

@@ -17,5 +17,5 @@ import java.util.List;
 public interface UserSysMsgNotifyMapper extends BaseMapper<UserSysMsgNotify> {
 	void recordUserAccountUpdateSysMsg(@Param("goodsId") Long goodsId, @Param("skuId") Long skuId, @Param("list") List<GroupsRelationView> relations, @Param("account") String account, @Param("msg") String msg);
 
-	void recordUserAccountSetSysMsg(@Param("goodsId") Long goodsId, @Param("skuId") Long skuId, @Param("collect") List<GroupsRelation> collect, @Param("account") String account, @Param("msg") String msg);
+	void recordUserAccountSetSysMsg(@Param("goodsId") Long goodsId, @Param("skuId") Long skuId, @Param("list") List<GroupsRelation> collect, @Param("account") String account, @Param("msg") String msg);
 }

+ 2 - 2
netflix-dao/src/main/resources/mapper/UserSysMsgNotifyMapper.xml

@@ -7,7 +7,7 @@
         insert into
         user_sys_msg_notify(`goods_id`,`sku_id`,`user_id`,`relation_id`,`account`,`msg`,`created_time`,`update_time`)
         values
-        <foreach collection="userSet" item="item" separator=",">
+        <foreach collection="list" item="item" separator=",">
             (#{goodsId},#{skuId},#{item.userId},#{item.id},#{account},#{msg},now(),now())
         </foreach>
     </insert>
@@ -16,7 +16,7 @@
         insert into
         user_sys_msg_notify(`goods_id`,`sku_id`,`user_id`,`relation_id`,`account`,`msg`,`created_time`,`update_time`)
         values
-        <foreach collection="userSet" item="item" separator=",">
+        <foreach collection="list" item="item" separator=",">
             (#{goodsId},#{skuId},#{item.userId},#{item.id},#{account},#{msg},now(),now())
         </foreach>
     </insert>

+ 28 - 28
netflix-service/src/main/java/com/cyksj/service/template/impl/TemplateCommonServiceImpl.java

@@ -212,36 +212,36 @@ public class TemplateCommonServiceImpl implements TemplateCommonService {
 
 	@Override
 	public void sendAccountTemplateMsg(Account account) throws Exception {
-		if (!EnvCommonService.active.equals(envCommonService.getEnv())) {
-			List<GroupsRelationView> relations = beanSearcher.searchList(GroupsRelationView.class, MapUtils.builder()
-					.field(GroupsRelationView::getAccountId, account.getId())
-					.field(GroupsRelationView::getStatus, "validity")
-					.build());
-			if (CollUtil.isEmpty(relations)) {
+		boolean isPrd = envCommonService.isPrdEnv();
+		List<GroupsRelationView> relations = beanSearcher.searchList(GroupsRelationView.class, MapUtils.builder()
+				.field(GroupsRelationView::getAccountId, account.getId())
+				.field(GroupsRelationView::getStatus, "validity")
+				.build());
+		if (CollUtil.isEmpty(relations)) {
+			return;
+		}
+		Boolean isPrdEnv = envCommonService.isPrdEnv();
+		GoodsDon goodsDon = goodsDonMapper.selectById(account.getGoodsId());
+		String title = goodsDon != null ? goodsDon.getTitle() : "车票";
+		DateTime now = DateTime.now();
+		log.info("开始发送账号修改密码模板消息,大小:{}", relations.size());
+		Long skuId = relations.get(0).getSkuId();
+		userSysMsgNotifyService.recordUserAccountUpdateSysMsg(account.getGoodsId(), skuId, relations, account.getAccount(), goodsDon.getTitle());
+		for (GroupsRelationView relation : relations) {
+			if (relation.getExpiryTime() == null) {
 				return;
 			}
-			Boolean isPrdEnv = envCommonService.isPrdEnv();
-			GoodsDon goodsDon = goodsDonMapper.selectById(account.getGoodsId());
-			String title = goodsDon != null ? goodsDon.getTitle() : "车票";
-			DateTime now = DateTime.now();
-			log.info("开始发送账号修改密码模板消息,大小:{}", relations.size());
-			Long skuId = relations.get(0).getSkuId();
-			userSysMsgNotifyService.recordUserAccountUpdateSysMsg(account.getGoodsId(), skuId, relations, account.getAccount(), goodsDon.getTitle());
-			for (GroupsRelationView relation : relations) {
-				if (relation.getExpiryTime() == null) {
-					return;
-				}
-				//账号有效期小于5天的人,不发账号替换/改密码短信提醒
-				if (now.after(DateUtil.offsetDay(relation.getExpiryTime(), -5))) {
-					return;
-				}
-				//去掉GPT过滤平台
-				if (Constant.CHANGE_ACCOUNT_PWD_FILTER_GIDS.get(1) == account.getGoodsId()) {
-					return;
-				}
-				if (relation.getUserId() != 0 && isPrdEnv && relation.getYhsId() == 0) {
-					smsService.sendSmsToRelationUser(relation.getUserId(), Constant.CHANGE_GROUPS_TRIPS_ACCOUNT, title);
-				}
+			//账号有效期小于5天的人,不发账号替换/改密码短信提醒
+			if (now.after(DateUtil.offsetDay(relation.getExpiryTime(), -5))) {
+				return;
+			}
+			//去掉GPT过滤平台
+			if (Constant.CHANGE_ACCOUNT_PWD_FILTER_GIDS.get(1) == account.getGoodsId()) {
+				return;
+			}
+			if (relation.getUserId() != 0 && isPrdEnv && relation.getYhsId() == 0 && isPrd) {
+				String msg = String.format(Constant.CHANGE_GROUPS_TRIPS_ACCOUNT, title);
+				smsService.sendSmsToRelationUser(relation.getUserId(), msg);
 			}
 		}
 	}

+ 2 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -510,7 +510,7 @@ public class CmsAccountController {
     @PutMapping("/update")
     @SaCheckPermission("account:update")
     @Log(module = "平台管理/编辑账号", businessType = BusinessType.PUT, isSaveRequestData = true)
-    public Result<String> update(@RequestBody Account account){
+    public Result<String> update(@RequestBody Account account) throws Exception {
 	    Account db = accountService.getById(account.getId());
 	    if (db == null) {
 		    throw BusinessRuntimeException.getInstance("该账号不存在");
@@ -576,6 +576,7 @@ public class CmsAccountController {
 		    //清除gpt token
 		    redisService.del(RedisKey.CHATGPT_ACCESS_TOKEN + dbAccount);
 		    redisService.del(RedisService.key.CHAT_GPT_TOKEN_EXCEPTION_KEY.getName() + dbAccount);
+		    templateCommonService.sendAccountTemplateMsg(account);
 	    }
 	    //时间有效
 	    if (account.getExpiryTime() != null && account.getExpiryTime().after(DateTime.now())) {