add 每月1号发送会员到期通知
This commit is contained in:
@@ -68,3 +68,10 @@ INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `com
|
||||
INSERT INTO sys_dict_item ( id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time ) VALUES ( '1767089980854767618', '1435541165297995778', '打包项目', '8', '', 8, 1, 'chh', '2024-03-11 15:27:37' )
|
||||
-- 字典来款用途新增打包
|
||||
INSERT INTO sys_dict_item ( id, dict_id, item_text, item_value, description, sort_order, status, create_by, create_time ) VALUES ( '1767090351832567809', '1431145150766923778', '打包', '22', '', 22, 1, 'chh', '2024-03-11 15:29:05' )
|
||||
# 会员到期提醒消息模板
|
||||
INSERT INTO sys_sms_template ( id, template_code, template_name, template_content, template_type, recipient, create_by, create_time ) VALUES ( '1767384966368137217', 'GL_16_HTTZ_EXPIRE', '15', '<p>【中汽标协】尊敬的会员朋友,您的会员权限将于${expiredDay}到期,请及时续费,以免影响您的会员权益。</p>', '2,3', '1', 'LKGLZ', '2024-03-12 10:59:47' );
|
||||
# 处理历史数据
|
||||
update income_payments.tb_member_project_subitem tmps
|
||||
left join standards_association.tb_member_info tmi on tmps.company_name = tmi.company_name
|
||||
set tmps.effective_date = tmi.effective_date, tmps.invalidation_date = tmi.invalidation_date
|
||||
where 1=1;
|
||||
+5
-2
@@ -10,7 +10,9 @@ import org.apache.commons.lang3.StringUtils;
|
||||
* @Exception
|
||||
*/
|
||||
public enum ManagementMessageEnums {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
MSG1("GL_1_HTTZ_CREATE_PROJECT","项目通知","projectName"),// 查看详情,projectName
|
||||
MSG2("GL_2_HTTZ_SUBMIT","合同通知","contractNum,contractName"),// 跳转到合同的详情页面,contractNum,contractName
|
||||
MSG3("GL_3_HTTZ_AUDIT","合同通知","contractNum,contractName"),//跳转到合同的详情页面,contractNum,contractName
|
||||
@@ -26,7 +28,8 @@ public enum ManagementMessageEnums {
|
||||
MSG13("GL_13_YJTZ_PJ_CREATE","邮寄通知","projectName"),//查看该项目详情, projectName
|
||||
MSG14("GL_14_YJTZ_HT_CREATE","邮寄通知","contractName,contractNum"),//跳转到合同的详情页面, contractNum,contractName
|
||||
MSG15("GL_15_XMTZ_UPLOAD_VOUCHER","项目通知","projectName"),//审核弹窗 projectName
|
||||
MSG16("GL_16_HTTZ_HT_CANCELLATION","合同通知","contractNum,contractName");//合同详情页面
|
||||
MSG16("GL_16_HTTZ_HT_CANCELLATION","合同通知","contractNum,contractName"),//合同详情页面
|
||||
MSG17("GL_16_HTTZ_EXPIRE","会员到期通知","expiredDay");//会员到期通知
|
||||
|
||||
private String code;
|
||||
|
||||
|
||||
+3
@@ -101,6 +101,9 @@ public class SendMessageServiceImpl implements SendMessageService {
|
||||
// 1短信 2邮件 3系统
|
||||
// 发送邮件 true
|
||||
String fromUser = sendMessageDTO.getFromUser();
|
||||
if (StringUtils.isBlank(fromUser)){
|
||||
fromUser = env.getProperty("message.systemEmailUser");
|
||||
}
|
||||
Integer sendEmailFlag = sendMessageDTO.getSendEmailFlag();
|
||||
LoginUser loginUser = sysBaseAPI.getUserByName(fromUser);
|
||||
if(templateType.contains(ProjectCommon.MESSAGE_TYPE2) && !CommonConstant.DEL_FLAG_0.equals(sendEmailFlag)){
|
||||
|
||||
+1
@@ -100,6 +100,7 @@
|
||||
LEFT JOIN tb_member_project tmp on tmp.id = tmps.project_id
|
||||
<where>
|
||||
tmps.company_id = #{companyId}
|
||||
and tmps.effective_date is not null
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
+2
@@ -386,6 +386,8 @@ public class TbMemberProjectSubitemServiceImpl extends ServiceImpl<TbMemberProje
|
||||
tbMemberProjectSubitem.setContractNum(memberProjectSubitem.getContractNum());
|
||||
tbMemberProjectSubitem.setChargeNoticeNo(memberProjectSubitem.getChargeNoticeNo());
|
||||
tbMemberProjectSubitem.setChargeNoticeId(memberProjectSubitem.getChargeNoticeId());
|
||||
tbMemberProjectSubitem.setInvalidationDate(memberProjectSubitem.getInvalidationDate());
|
||||
tbMemberProjectSubitem.setEffectiveDate(memberProjectSubitem.getEffectiveDate());
|
||||
tbMemberProjectSubitem.setRemark(memberProjectSubitem.getRemark());
|
||||
return tbMemberProjectSubitem;
|
||||
|
||||
|
||||
@@ -1,19 +1,36 @@
|
||||
package com.jero.quartz.job;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.dto.SendMessageDTO;
|
||||
import com.jero.common.enums.ManagementMessageEnums;
|
||||
import com.jero.common.service.SendMessageService;
|
||||
import com.jero.common.util.PasswordUtil;
|
||||
import com.jero.company.entity.PayContactsManagement;
|
||||
import com.jero.company.service.IPayContactsManagementService;
|
||||
import com.jero.contract.common.PayIncomeContractCommon;
|
||||
import com.jero.member.entity.TbMemberProject;
|
||||
import com.jero.member.entity.TbMemberProjectSubitem;
|
||||
import com.jero.member.service.ITbMemberProjectService;
|
||||
import com.jero.member.service.ITbMemberProjectSubitemService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新建标协会员项目定时任务
|
||||
* 标协会员到期提醒定时任务
|
||||
* @author liJiaRao
|
||||
* @date 2021-09-10 15:47
|
||||
*/
|
||||
@@ -21,8 +38,46 @@ import java.util.Date;
|
||||
public class MemberProjectJob implements Job{
|
||||
@Resource
|
||||
private ITbMemberProjectService memberProjectService;
|
||||
@Resource
|
||||
private ITbMemberProjectSubitemService memberProjectSubitemService;
|
||||
@Resource
|
||||
private SendMessageService sendMessageService;
|
||||
@Resource
|
||||
private IPayContactsManagementService payContactsManagementService;
|
||||
public static String FORMAT = "yyyy年MM月";
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
|
||||
DateTime offset = DateUtil.date().offset(DateField.MONTH, 3);
|
||||
int year = offset.year();
|
||||
int month = offset.month();
|
||||
QueryWrapper<TbMemberProjectSubitem> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("MONTH(invalidation_date)",month)
|
||||
.eq("YEAR(invalidation_date)",year);
|
||||
List<TbMemberProjectSubitem> list = memberProjectSubitemService.list(wrapper);
|
||||
for (TbMemberProjectSubitem tbMemberProjectSubitem : list) {
|
||||
String companyId = tbMemberProjectSubitem.getCompanyId();
|
||||
TbMemberProjectSubitem takeEffectInfo = memberProjectSubitemService.getTakeEffectInfo(companyId);
|
||||
if (!takeEffectInfo.getId().equals(tbMemberProjectSubitem.getId())) {
|
||||
continue;
|
||||
}
|
||||
String liaisonManId = tbMemberProjectSubitem.getLiaisonManId();
|
||||
PayContactsManagement p = payContactsManagementService.getById(liaisonManId);
|
||||
// 发送消息
|
||||
SendMessageDTO sendMessageDTO = new SendMessageDTO();
|
||||
if(!StringUtils.isBlank(p.getEmail())){
|
||||
sendMessageDTO.setEmail(PasswordUtil.decrypt(p.getEmail()));
|
||||
}
|
||||
if(!StringUtils.isEmpty(p.getPhone())){
|
||||
sendMessageDTO.setPhone(PasswordUtil.decrypt(p.getPhone()));
|
||||
sendMessageDTO.setToUser(PasswordUtil.decrypt(p.getPhone()));
|
||||
}
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("expiredDay",offset.toString(FORMAT));
|
||||
sendMessageDTO.setFromUser(null);
|
||||
sendMessageDTO.setTemplateCode(ManagementMessageEnums.MSG17.getCode());
|
||||
sendMessageDTO.setTemplateParam(map);
|
||||
sendMessageService.SendMessageService(sendMessageDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user