|
@@ -11,6 +11,7 @@ import com.gree.mall.manager.commonmapper.PolicyCMapper;
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
import com.gree.mall.manager.logic.common.CommonLogic;
|
|
import com.gree.mall.manager.plus.entity.*;
|
|
import com.gree.mall.manager.plus.entity.*;
|
|
import com.gree.mall.manager.plus.service.*;
|
|
import com.gree.mall.manager.plus.service.*;
|
|
|
|
+import com.gree.mall.manager.utils.StringUtil;
|
|
import com.gree.mall.manager.utils.email.EmailUtilsNew;
|
|
import com.gree.mall.manager.utils.email.EmailUtilsNew;
|
|
import com.gree.mall.manager.utils.excel.ExcelUtils;
|
|
import com.gree.mall.manager.utils.excel.ExcelUtils;
|
|
import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
import com.gree.mall.manager.zfire.bean.ZfireParamBean;
|
|
@@ -240,7 +241,7 @@ public class AgreementLogic {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-/* if (mailboxSendRecord.getPolicyType().equals("IN")) {
|
|
|
|
|
|
+ if (mailboxSendRecord.getPolicyType().equals("IN")) {
|
|
|
|
|
|
//发邮件
|
|
//发邮件
|
|
try {
|
|
try {
|
|
@@ -251,28 +252,86 @@ public class AgreementLogic {
|
|
mailboxSendRecord.setSendStatus("NO");
|
|
mailboxSendRecord.setSendStatus("NO");
|
|
mailboxSendRecord.updateById();
|
|
mailboxSendRecord.updateById();
|
|
}
|
|
}
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void sendEmailFileIn(List<MailboxSendRecordPolicy> mailboxSendRecordPolicies, MailboxSendRecord mailboxSendRecord, Mailbox mailbox) {
|
|
|
|
+ String[] titles = new String[]{"序号","网点编号","网点名称","服务人员编号","服务人员名称","联系电话","身份证号码","保单名称","缴费金额",
|
|
|
|
+ "生效日期","截止日期","所属一级网点编号","所属一级网点编号","代买单位"};
|
|
|
|
+ List<List<Object>> rows = new ArrayList<>();
|
|
|
|
+ for(int i = 0;i < mailboxSendRecordPolicies.size();i++) {
|
|
|
|
+ MailboxSendRecordPolicy record = mailboxSendRecordPolicies.get(i);
|
|
|
|
+ List<Object> row = new ArrayList<>();
|
|
|
|
+ row.add(i + 1);
|
|
|
|
+ row.add(record.getWebsitId());
|
|
|
|
+ row.add(record.getWebsitName());
|
|
|
|
+ if (StringUtil.isEmpty(record.getReplaceName()))
|
|
|
|
+ row.add("新增");
|
|
|
|
+ else
|
|
|
|
+ row.add("替换");
|
|
|
|
+ row.add(record.getPolicyName());
|
|
|
|
+ row.add("居民身份证");
|
|
|
|
+ row.add(record.getPolicyIdcard());
|
|
|
|
+ if (!StringUtil.isEmpty(record.getReplaceName())){
|
|
|
|
+ row.add(record.getReplaceName());
|
|
|
|
+ row.add("居民身份证");
|
|
|
|
+ row.add(record.getReplaceIdcard());
|
|
|
|
+ }
|
|
|
|
+ rows.add(row);
|
|
|
|
+ }
|
|
|
|
+ // 获取资源文件存放路径,用于临时存放生成的excel文件
|
|
|
|
+ String path = "/tmp";
|
|
|
|
+ if(active.equals("dev")) {
|
|
|
|
+ path = Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath();
|
|
|
|
+ }
|
|
|
|
+ // 文件名:采用UUID,防止多线程同时生成导致的文件重名
|
|
|
|
+ String filePath = String.format("%s-%s.xlsx",path,mailboxSendRecord.getSendBatch()+"-雇主险");
|
|
|
|
+ ExcelData excelData = new ExcelData();
|
|
|
|
+ excelData.setTitles(Arrays.asList(titles));
|
|
|
|
+ ExcelUtils.createExcel(filePath,excelData);
|
|
|
|
+ File excel = new File(filePath);
|
|
|
|
+
|
|
|
|
+ //发送邮箱
|
|
|
|
+ EmailUtilsNew emailUtilsNew = new EmailUtilsNew(mailboxSendRecord.getSendMailbox(), mailbox.getSendPassword());
|
|
|
|
+
|
|
|
|
+ //分发邮件
|
|
|
|
+
|
|
|
|
+ for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
|
|
|
|
+ emailUtilsNew.send(s,mailbox.getSendPassword(),"雇主险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
|
|
|
|
+ +mailbox.getSendName()+"保险人员名单详情见附件",filePath);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //删除该文件
|
|
|
|
+ excel.delete();
|
|
|
|
+ }
|
|
|
|
+
|
|
private void sendEmailFileEm(List<MailboxSendRecordPolicy> mailboxSendRecordPolicies, MailboxSendRecord mailboxSendRecord, Mailbox mailbox) throws IOException {
|
|
private void sendEmailFileEm(List<MailboxSendRecordPolicy> mailboxSendRecordPolicies, MailboxSendRecord mailboxSendRecord, Mailbox mailbox) throws IOException {
|
|
|
|
|
|
- String[] titles = new String[]{"序号","网点编号","网点名称","保险类型","被保险人姓名","被保险人证件类型","被保险人证件号码"};
|
|
|
|
|
|
+ String[] titles = new String[]{"序号","网点编号","网点名称","保险类型","被保险人姓名","被保险人证件类型","被保险人证件号码",
|
|
|
|
+ "被替换人姓名","被替换人证件类型","被替换人证件号码"};
|
|
List<List<Object>> rows = new ArrayList<>();
|
|
List<List<Object>> rows = new ArrayList<>();
|
|
- for(int i = 0;i < mailboxSendRecordPolicies.size();i++){
|
|
|
|
|
|
+ for(int i = 0;i < mailboxSendRecordPolicies.size();i++) {
|
|
MailboxSendRecordPolicy record = mailboxSendRecordPolicies.get(i);
|
|
MailboxSendRecordPolicy record = mailboxSendRecordPolicies.get(i);
|
|
List<Object> row = new ArrayList<>();
|
|
List<Object> row = new ArrayList<>();
|
|
- row.add(i+1);
|
|
|
|
- row.add(mailbox.getSendName());
|
|
|
|
- row.add(record.getPolicyNumber());
|
|
|
|
|
|
+ row.add(i + 1);
|
|
row.add(record.getWebsitId());
|
|
row.add(record.getWebsitId());
|
|
row.add(record.getWebsitName());
|
|
row.add(record.getWebsitName());
|
|
- row.add("新增");
|
|
|
|
|
|
+ if (StringUtil.isEmpty(record.getReplaceName()))
|
|
|
|
+ row.add("新增");
|
|
|
|
+ else
|
|
|
|
+ row.add("替换");
|
|
row.add(record.getPolicyName());
|
|
row.add(record.getPolicyName());
|
|
row.add("居民身份证");
|
|
row.add("居民身份证");
|
|
row.add(record.getPolicyIdcard());
|
|
row.add(record.getPolicyIdcard());
|
|
|
|
+ if (!StringUtil.isEmpty(record.getReplaceName())){
|
|
|
|
+ row.add(record.getReplaceName());
|
|
|
|
+ row.add("居民身份证");
|
|
|
|
+ row.add(record.getReplaceIdcard());
|
|
|
|
+ }
|
|
rows.add(row);
|
|
rows.add(row);
|
|
}
|
|
}
|
|
// 获取资源文件存放路径,用于临时存放生成的excel文件
|
|
// 获取资源文件存放路径,用于临时存放生成的excel文件
|
|
@@ -281,7 +340,7 @@ public class AgreementLogic {
|
|
path = Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath();
|
|
path = Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath();
|
|
}
|
|
}
|
|
// 文件名:采用UUID,防止多线程同时生成导致的文件重名
|
|
// 文件名:采用UUID,防止多线程同时生成导致的文件重名
|
|
- String filePath = String.format("%s-%s.xlsx",path,mailboxSendRecord.getSendBatch()+"-意外险");
|
|
|
|
|
|
+ String filePath = String.format("%s-%s.xlsx",path,mailboxSendRecord.getSendBatch()+"-雇主险");
|
|
ExcelData excelData = new ExcelData();
|
|
ExcelData excelData = new ExcelData();
|
|
excelData.setTitles(Arrays.asList(titles));
|
|
excelData.setTitles(Arrays.asList(titles));
|
|
ExcelUtils.createExcel(filePath,excelData);
|
|
ExcelUtils.createExcel(filePath,excelData);
|
|
@@ -293,7 +352,7 @@ public class AgreementLogic {
|
|
//分发邮件
|
|
//分发邮件
|
|
|
|
|
|
for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
|
|
for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
|
|
- emailUtilsNew.send(s,mailbox.getSendPassword(),"意外险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
|
|
|
|
|
|
+ emailUtilsNew.send(s,mailbox.getSendPassword(),"雇主险-"+mailboxSendRecord.getSendBatch()+"-"+mailbox.getSendName(),"你好,以下是"+ DateUtil.format(new Date(),"yyyy-MM-dd")
|
|
+mailbox.getSendName()+"保险人员名单详情见附件",filePath);
|
|
+mailbox.getSendName()+"保险人员名单详情见附件",filePath);
|
|
}
|
|
}
|
|
|
|
|