压缩包导入,详情修改 #346

Merged
wangqiong123 merged 1 commits from wq into dev 2024-04-29 08:52:36 +00:00
7 changed files with 132 additions and 77 deletions
@@ -6,6 +6,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.validation.Validator; import javax.validation.Validator;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.mapper.*; import com.ruoyi.system.mapper.*;
@@ -259,6 +260,13 @@ public class SysUserServiceImpl implements ISysUserService {
@Override @Override
@Transactional @Transactional
public AjaxResult insertUser(SysUser user) { public AjaxResult insertUser(SysUser user) {
// 校验手机号是否重复
if(StrUtil.isNotEmpty(user.getPhonenumber())){
if(userMapper.checkPhoneUnique(user.getPhonenumber())!=null){
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
}
}
Long deptId = user.getDeptId(); Long deptId = user.getDeptId();
Long[] postIds = user.getPostIds(); Long[] postIds = user.getPostIds();
if (deptId != null) { if (deptId != null) {
@@ -296,6 +304,11 @@ public class SysUserServiceImpl implements ISysUserService {
*/ */
@Override @Override
public boolean registerUser(SysUser user) { public boolean registerUser(SysUser user) {
if(StrUtil.isNotEmpty(user.getPhonenumber())){
if(userMapper.checkPhoneUnique(user.getPhonenumber())!=null){
throw new ServiceException("注册用户'" + user.getUserName() + "'失败,手机号码已存在");
}
}
return userMapper.insertUser(user) > 0; return userMapper.insertUser(user) > 0;
} }
@@ -524,6 +537,11 @@ public class SysUserServiceImpl implements ISysUserService {
BeanValidators.validateWithException(validator, user); BeanValidators.validateWithException(validator, user);
user.setPassword(SecurityUtils.encryptPassword(password)); user.setPassword(SecurityUtils.encryptPassword(password));
user.setCreateBy(operName); user.setCreateBy(operName);
if(StrUtil.isNotEmpty(user.getPhonenumber())){
if(userMapper.checkPhoneUnique(user.getPhonenumber())!=null){
throw new ServiceException("导入用户'" + user.getUserName() + "'失败,手机号码已存在");
}
}
userMapper.insertUser(user); userMapper.insertUser(user);
successNum++; successNum++;
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功"); successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
@@ -218,6 +218,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
*/ */
@Override @Override
public List<CaseApplication> selectCaseApplicationListByRole(CaseApplication caseApplication) { public List<CaseApplication> selectCaseApplicationListByRole(CaseApplication caseApplication) {
// todo 案件列表查询Bug修复,需要看见已办案件
// 获取登录用户 // 获取登录用户
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser(); SysUser user = loginUser.getUser();
@@ -236,7 +237,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if (StrUtil.isEmpty(role.getRoleName())) { if (StrUtil.isEmpty(role.getRoleName())) {
continue; continue;
} }
// 超级管理员和仲裁委(部门长)案件,可查看所有案件 √ // 超级管理员和仲裁委(部门长)案件,可查看所有案件
if ("超级管理员".equals(role.getRoleName()) if ("超级管理员".equals(role.getRoleName())
) { ) {
List<CaseApplication> caseApplicationlist = caseApplicationMapper.selectAdminCaseApplicationList(caseApplication); List<CaseApplication> caseApplicationlist = caseApplicationMapper.selectAdminCaseApplicationList(caseApplication);
@@ -2265,7 +2266,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setCaseAppliId(caseApplication.getId()); caseAffiliate.setCaseAppliId(caseApplication.getId());
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliatListeselect != null) { if (caseAffiliatListeselect != null) {
caseAffiliatListeselect=new ArrayList<>(caseAffiliatListeselect.stream().collect(Collectors.toMap(CaseAffiliate::getContactTelphone ,Function.identity(), (k1, k2) -> k1)).values());
for (int i = 0; i < caseAffiliatListeselect.size(); i++) { for (int i = 0; i < caseAffiliatListeselect.size(); i++) {
CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i); CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i);
int identityType = caseAffiliateselect.getIdentityType(); int identityType = caseAffiliateselect.getIdentityType();
@@ -2315,6 +2316,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if (CollectionUtil.isEmpty(caseAffiliates)) { if (CollectionUtil.isEmpty(caseAffiliates)) {
return "申请人、被申请人不存在"; return "申请人、被申请人不存在";
} }
caseAffiliates=new ArrayList<>(caseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getContactTelphone ,Function.identity(), (k1, k2) -> k1)).values());
CaseApplication caseApplication = new CaseApplication(); CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(messageVO.getId()); caseApplication.setId(messageVO.getId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
@@ -3628,7 +3630,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setCaseAppliId(caseApplication.getId()); caseAffiliate.setCaseAppliId(caseApplication.getId());
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliatListeselect != null) { if (caseAffiliatListeselect != null) {
for (int j = 0; j < caseAffiliatListeselect.size(); j++) { for (int j = 0; j < caseAffiliatListeselect.size(); j++) {
CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(j); CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(j);
int identityType = caseAffiliateselect.getIdentityType(); int identityType = caseAffiliateselect.getIdentityType();
@@ -150,11 +150,10 @@ public class CaseZipImportImpl {
String caseNum = "zc" + currentDay; String caseNum = "zc" + currentDay;
maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum, caseNum.length()); maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum, caseNum.length());
// 抓取内容 // 抓取内容
Map<String, String> fatchMap = new HashMap<>();
// 从抓取规则表取字段和字典表取基本字段,字典表的字段名塞到基本表,is_default=1自定义字段塞到columnValue // 从抓取规则表取字段和字典表取基本字段,字典表的字段名塞到基本表,is_default=1自定义字段塞到columnValue
// 抓取规则,0-内置字段,1-自定义字段 // 抓取规则,0-内置字段,1-自定义字段
Map<String, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName)); Map<String, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName));
File directory = new File(targetPath); File directory = new File(targetPath);
if (!directory.exists()) { if (!directory.exists()) {
throw new ServiceException("文件不存在"); throw new ServiceException("文件不存在");
@@ -163,19 +162,26 @@ public class CaseZipImportImpl {
if (!directory.isDirectory() || directory.listFiles() == null) { if (!directory.isDirectory() || directory.listFiles() == null) {
throw new ServiceException("未找到文件夹"); throw new ServiceException("未找到文件夹");
} }
Integer batchNumber = caseApplicationMapper.selectBatchNumberLike();
AtomicInteger maxBatchNumber = new AtomicInteger();
if (batchNumber == null) {
maxBatchNumber.set(1);
} else {
maxBatchNumber.set(batchNumber+1);
}
File[] files = directory.listFiles(); File[] files = directory.listFiles();
// List<CaseApplication> caseApplications = new ArrayList<>();
// for (File file1 : files) {
// if (file1.isDirectory() && file1.listFiles() != null) {
//
// for (File file2 : file1.listFiles()) {
// CaseApplication caseApplication = buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, deptMap, SecurityUtils.getLoginUser());
// if (caseApplication != null) {
// caseApplications.add(caseApplication);
// }
// }
// }
// }
// if(caseApplications.size()>0){
// return success("导入成功");
// }
CaseZipImportTask caseZipImportTask = null; CaseZipImportTask caseZipImportTask = null;
try { try {
caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser(),maxBatchNumber.get()); caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser());
} catch (Exception e) { } catch (Exception e) {
return error("导入失败"); return error("导入失败");
} }
@@ -193,12 +199,23 @@ public class CaseZipImportImpl {
} }
@Transactional @Transactional
public CaseApplication buildCaseInfo(File file, Long templateId, List<FatchRule> fatchRuleList, Map<String, List<FatchRule>> fatchRuleMap, Map<String, String> fatchMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, Map<String, Long> deptMap,LoginUser loginUser, Integer maxBatchNumber) { public CaseApplication buildCaseInfo(File file, Long templateId, List<FatchRule> fatchRuleList, Map<String, List<FatchRule>> fatchRuleMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, Map<String, Long> deptMap,LoginUser loginUser) {
// fileMap<caseId, List<File>> // fileMap<caseId, List<File>>
Map<String, String> fatchMap = new HashMap<>();
Integer batchNumber = caseApplicationMapper.selectBatchNumberLike();
AtomicInteger maxBatchNumber = new AtomicInteger();
if (batchNumber == null) {
maxBatchNumber.set(1);
} else {
maxBatchNumber.set(batchNumber+1);
}
Map<String, String> fileMap = findFile(file, fatchRuleList); Map<String, String> fileMap = findFile(file, fatchRuleList);
if (fileMap != null && fileMap.size()> 0) { if (fileMap != null && fileMap.size()> 0) {
// 根据抓取规则循环抓取 // 根据抓取规则循环抓取
for (Map.Entry<String, List<FatchRule>> entry : fatchRuleMap.entrySet()) { for (Map.Entry<String, List<FatchRule>> entry : fatchRuleMap.entrySet()) {
System.out.println("根据抓取规则循环抓取======"+entry.getKey());
getFatchContent(fileMap, entry.getKey(), fatchMap, entry.getValue()); getFatchContent(fileMap, entry.getKey(), fatchMap, entry.getValue());
} }
@@ -250,7 +267,7 @@ public class CaseZipImportImpl {
caseApplication.setCaseAppliId(caseApplication.getId()); caseApplication.setCaseAppliId(caseApplication.getId());
// 设置批号 // 设置批号
caseApplication.setBatchNumber(maxBatchNumber); caseApplication.setBatchNumber(maxBatchNumber.get());
// 设置编号 // 设置编号
String maxCaseNumStr = generateCaseNum(); String maxCaseNumStr = generateCaseNum();
caseApplication.setCaseNum(maxCaseNumStr); caseApplication.setCaseNum(maxCaseNumStr);
@@ -315,7 +332,9 @@ public class CaseZipImportImpl {
sysDeptMapper.batchSave(sysDepts); sysDeptMapper.batchSave(sysDepts);
} }
if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) { if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) {
caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates()); caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
} }
@@ -331,25 +350,25 @@ public class CaseZipImportImpl {
// 新增日志 // 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser); CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
// 发送短信 // 发送短信
if (CollectionUtil.isNotEmpty(smsRequestList)) { // if (CollectionUtil.isNotEmpty(smsRequestList)) {
Map<Long, SmsSendRecord> sendRecordMap = null; // Map<Long, SmsSendRecord> sendRecordMap = null;
if (CollectionUtil.isNotEmpty(smsSendRecordList)) { // if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity())); // sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) { // for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
Boolean aBoolean = SmsUtils.sendSms(request); // Boolean aBoolean = SmsUtils.sendSms(request);
if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) { // if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
if (aBoolean) { // if (aBoolean) {
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1); // sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
} else { // } else {
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0); // sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
} // }
} // }
} // }
smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList); // smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
} // }
//
//
} // }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("导入失败,请检查抓取规则是否正确"); throw new RuntimeException("导入失败,请检查抓取规则是否正确");
@@ -844,27 +863,27 @@ public class CaseZipImportImpl {
insertAgentUserRole(agentUser, roleId, userRoleList); insertAgentUserRole(agentUser, roleId, userRoleList);
} }
if (addUsers != null) { // if (addUsers != null) {
SysUser finalAgentUser = agentUser; // SysUser finalAgentUser = agentUser;
if (CollectionUtil.isNotEmpty(smsRequestList) && smsRequestList.stream().noneMatch(smsSendRecord -> smsSendRecord.getPhone().equals(finalAgentUser.getPhonenumber()))) { // if (CollectionUtil.isNotEmpty(smsRequestList) && smsRequestList.stream().noneMatch(smsSendRecord -> smsSendRecord.getPhone().equals(finalAgentUser.getPhonenumber()))) {
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); // SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1956159"); // request.setTemplateId("1956159");
request.setPhone(agentUser.getPhonenumber()); // request.setPhone(agentUser.getPhonenumber());
request.setTemplateParamSet(new String[]{agentUser.getNickName()}); // request.setTemplateParamSet(new String[]{agentUser.getNickName()});
smsRequestList.add(request); // smsRequestList.add(request);
SmsSendRecord smsSendRecord = new SmsSendRecord(); // SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseApplication.getId()); // smsSendRecord.setCaseId(caseApplication.getId());
smsSendRecord.setCaseNum(caseApplication.getCaseNum()); // smsSendRecord.setCaseNum(caseApplication.getCaseNum());
smsSendRecord.setPhone(request.getPhone()); // smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date()); // smsSendRecord.setSendTime(new Date());
String content = "尊敬的" + agentUser.getNickName() + ",您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信"; // String content = "尊敬的" + agentUser.getNickName() + ",您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信";
smsSendRecord.setSendContent(content); // smsSendRecord.setSendContent(content);
// smsSendRecord.setCreateBy(getUsername()); // // smsSendRecord.setCreateBy(getUsername());
smsSendRecords.add(smsSendRecord); // smsSendRecords.add(smsSendRecord);
} // }
//
//
} // }
} }
break; break;
@@ -25,27 +25,25 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
private CaseZipImportImpl caseZipImportImpl; private CaseZipImportImpl caseZipImportImpl;
private Long templateId; private Long templateId;
private List<FatchRule> fatchRuleList; private List<FatchRule> fatchRuleList;
private Map<String, String> fatchMap;
private Map<String, List<FatchRule>> fatchRuleMap; private Map<String, List<FatchRule>> fatchRuleMap;
private Map<String, SysUser> userMap; private Map<String, SysUser> userMap;
private List<SysDictData> dictDataList; private List<SysDictData> dictDataList;
private File[] files; private File[] files;
private Map<String, Long> deptMap; private Map<String, Long> deptMap;
private LoginUser loginUser; private LoginUser loginUser;
private Integer maxBatchNumber;
public CaseZipImportTask(CaseZipImportImpl caseZipImportImpl, Long templateId, List<FatchRule> fatchRuleList, Map<String, String> fatchMap, Map<String, List<FatchRule>> fatchRuleMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, File[] files, Map<String, Long> deptMap, LoginUser loginUser,Integer maxBatchNumber) {
public CaseZipImportTask(CaseZipImportImpl caseZipImportImpl, Long templateId, List<FatchRule> fatchRuleList, Map<String, List<FatchRule>> fatchRuleMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, File[] files, Map<String, Long> deptMap, LoginUser loginUser) {
this.caseZipImportImpl = caseZipImportImpl; this.caseZipImportImpl = caseZipImportImpl;
this.templateId = templateId; this.templateId = templateId;
this.fatchRuleList = fatchRuleList; this.fatchRuleList = fatchRuleList;
this.fatchMap = fatchMap;
this.fatchRuleMap = fatchRuleMap; this.fatchRuleMap = fatchRuleMap;
this.userMap = userMap; this.userMap = userMap;
this.dictDataList = dictDataList; this.dictDataList = dictDataList;
this.files = files; this.files = files;
this.deptMap = deptMap; this.deptMap = deptMap;
this.loginUser = loginUser; this.loginUser = loginUser;
this.maxBatchNumber = maxBatchNumber;
} }
@Override @Override
@@ -56,7 +54,7 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
if (file1.isDirectory() && file1.listFiles() != null) { if (file1.isDirectory() && file1.listFiles() != null) {
for (File file2 : file1.listFiles()) { for (File file2 : file1.listFiles()) {
CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser,maxBatchNumber); CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, deptMap, loginUser);
if (caseApplication != null) { if (caseApplication != null) {
caseApplications.add(caseApplication); caseApplications.add(caseApplication);
} }
@@ -115,13 +115,24 @@ public class OCRUtils {
if (StrUtil.isEmpty(ocrText) || CollectionUtil.isEmpty(fatchRules)) { if (StrUtil.isEmpty(ocrText) || CollectionUtil.isEmpty(fatchRules)) {
return; return;
} }
// 将识别后的字符串英文标点符号全部转为中文标点符号
String ocrTextReplace = ocrText.replace(",", ",")
// .replace(".", "。")
.replace(":", ":").replace(";", ";").replace("?", "?").replace("!", "!").replace("(", "(")
.replace(")", ")").replace("[", "【").replace("]", "】").replace("{", "{").replace("}", "}")
.replace("<", "《").replace(">", "》").replace("|", "|").replace("\\", "\").replace("_", "_")
.replace("-", "-").replace("+", "+").replace("=", "=").replace("~", "~").replace("`", "`")
.replace("^", "^").replace("$", "¥").replace("@", "@").replace("#", "#").replace("%", "%")
.replace("&", "&").replace("*", "*").replace("(", "(").replace(")", ")").replace("{", "{")
.replace("}", "}").replace("[", "【").replace("]", "】").replace("<", "《").replace(">", "》")
.replace("|", "|").replace("\\", "\").replace("_", "_");
for (FatchRule fatchRule : fatchRules) { for (FatchRule fatchRule : fatchRules) {
// 从后往前抓取 // 从后往前抓取
if (fatchRule.getFatchOrder() != null && fatchRule.getFatchOrder() == 1) { if (fatchRule.getFatchOrder() != null && fatchRule.getFatchOrder() == 1) {
reverseSubstringText(ocrText, fatchRule, fatchMap,null); reverseSubstringText(ocrTextReplace, fatchRule, fatchMap,null);
} else { } else {
// 从前往后抓取 // 从前往后抓取
substringText(ocrText, fatchRule, fatchMap,null); substringText(ocrTextReplace, fatchRule, fatchMap,null);
} }
} }
@@ -37,19 +37,24 @@
</resultMap> </resultMap>
<select id="selectCaseAffiliate" parameterType="CaseAffiliate" resultMap="CaseAffiliateResult"> <select id="selectCaseAffiliate" parameterType="CaseAffiliate" resultMap="CaseAffiliateResult">
select distinct (c.id), select c.id,
c.case_appli_id, c.identity_type,c.application_organ_id,c.application_organ_name,c.name,c.identity_num,c.contact_telphone, c.case_appli_id, c.identity_type,c.application_organ_id,c.application_organ_name,c.name,c.identity_num,c.contact_telphone,
c.contact_address,c.work_address,c.work_telphone ,c.name_agent,c.identity_num_agent,c.contact_telphone_agent, c.contact_address,c.work_address,c.work_telphone ,c.name_agent,c.identity_num_agent,c.contact_telphone_agent,
c.comp_legal_person,c.comp_legalper_post,c.respon_sex ,c.respon_birth, c.comp_legal_person,c.comp_legalper_post,c.respon_sex ,c.respon_birth,
c.residen_affili,appli_agent_title, c.residen_affili,appli_agent_title,
c.contact_address_agent,c.email, c.send_email,c.track_num,c.applicant_agent_user_id,c.agent_email,s.user_id c.contact_address_agent,c.email, c.send_email,c.track_num,c.applicant_agent_user_id,c.agent_email,s.user_id
from case_affiliate c from case_affiliate c
left join sys_user s on c.identity_num=s.id_card left JOIN (
<where> SELECT phonenumber,user_id, ROW_NUMBER() OVER(PARTITION BY phonenumber ORDER BY user_id ASC) as rn
<if test="caseAppliId != null "> FROM sys_user
AND c.case_appli_id = #{caseAppliId} ) s ON c.contact_telphone = s.phonenumber
</if> WHERE
</where> s.rn = 1
<if test="caseAppliId != null ">
AND c.case_appli_id = #{caseAppliId}
</if>
</select> </select>
<select id="selectCaseAffiliateByCaseIds" resultMap="CaseAffiliateResult"> <select id="selectCaseAffiliateByCaseIds" resultMap="CaseAffiliateResult">
select (c.id), select (c.id),
@@ -59,15 +64,18 @@
c.residen_affili,appli_agent_title, c.residen_affili,appli_agent_title,
c.contact_address_agent,c.email, c.send_email,c.track_num,c.applicant_agent_user_id,c.agent_email,s.user_id c.contact_address_agent,c.email, c.send_email,c.track_num,c.applicant_agent_user_id,c.agent_email,s.user_id
from case_affiliate c from case_affiliate c
left join sys_user s on c.identity_num=s.id_card left JOIN (
<where> SELECT phonenumber,user_id, ROW_NUMBER() OVER(PARTITION BY phonenumber ORDER BY user_id ASC) as rn
<if test="ids != null "> FROM sys_user
case_appli_id in ) s ON c.contact_telphone = s.phonenumber
WHERE
s.rn = 1
<if test="ids != null ">
and case_appli_id in
<foreach collection="ids" item="item" open="(" separator="," close=")"> <foreach collection="ids" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
</where>
</select> </select>
<select id="selectCaseAffiliateByIdentityType" resultMap="CaseAffiliateResult"> <select id="selectCaseAffiliateByIdentityType" resultMap="CaseAffiliateResult">
select c.* select c.*
@@ -1379,7 +1379,7 @@
from reserved_conference ; from reserved_conference ;
</select> </select>
<select id="selectBatchNumberLike" resultType="java.lang.Integer"> <select id="selectBatchNumberLike" resultType="java.lang.Integer">
select max(batch_number) as maxBatchNumber select max(batch_number+0) as maxBatchNumber
from case_application ; from case_application ;
</select> </select>