Browse Source

压缩包导入,详情修改

18792927508 2 years ago
parent
commit
0e215afa39

+ 18
- 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java View File

@@ -6,6 +6,7 @@ import java.util.List;
6 6
 import java.util.stream.Collectors;
7 7
 import javax.validation.Validator;
8 8
 
9
+import cn.hutool.core.util.StrUtil;
9 10
 import com.ruoyi.common.core.domain.AjaxResult;
10 11
 import com.ruoyi.common.core.domain.entity.SysDept;
11 12
 import com.ruoyi.system.mapper.*;
@@ -259,6 +260,13 @@ public class SysUserServiceImpl implements ISysUserService {
259 260
     @Override
260 261
     @Transactional
261 262
     public AjaxResult insertUser(SysUser user) {
263
+        // 校验手机号是否重复
264
+        if(StrUtil.isNotEmpty(user.getPhonenumber())){
265
+            if(userMapper.checkPhoneUnique(user.getPhonenumber())!=null){
266
+                return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
267
+            }
268
+        }
269
+
262 270
         Long deptId = user.getDeptId();
263 271
         Long[] postIds = user.getPostIds();
264 272
         if (deptId != null) {
@@ -296,6 +304,11 @@ public class SysUserServiceImpl implements ISysUserService {
296 304
      */
297 305
     @Override
298 306
     public boolean registerUser(SysUser user) {
307
+        if(StrUtil.isNotEmpty(user.getPhonenumber())){
308
+            if(userMapper.checkPhoneUnique(user.getPhonenumber())!=null){
309
+               throw new ServiceException("注册用户'" + user.getUserName() + "'失败,手机号码已存在");
310
+            }
311
+        }
299 312
         return userMapper.insertUser(user) > 0;
300 313
     }
301 314
 
@@ -524,6 +537,11 @@ public class SysUserServiceImpl implements ISysUserService {
524 537
                     BeanValidators.validateWithException(validator, user);
525 538
                     user.setPassword(SecurityUtils.encryptPassword(password));
526 539
                     user.setCreateBy(operName);
540
+                    if(StrUtil.isNotEmpty(user.getPhonenumber())){
541
+                        if(userMapper.checkPhoneUnique(user.getPhonenumber())!=null){
542
+                            throw new ServiceException("导入用户'" + user.getUserName() + "'失败,手机号码已存在");
543
+                        }
544
+                    }
527 545
                     userMapper.insertUser(user);
528 546
                     successNum++;
529 547
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");

+ 4
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java View File

@@ -218,6 +218,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
218 218
      */
219 219
     @Override
220 220
     public List<CaseApplication> selectCaseApplicationListByRole(CaseApplication caseApplication) {
221
+        // todo 案件列表查询Bug修复,需要看见已办案件
221 222
         // 获取登录用户
222 223
         LoginUser loginUser = getLoginUser();
223 224
         SysUser user = loginUser.getUser();
@@ -236,7 +237,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
236 237
                 if (StrUtil.isEmpty(role.getRoleName())) {
237 238
                     continue;
238 239
                 }
239
-                // 超级管理员和仲裁委(部门长)案件,可查看所有案件
240
+                // 超级管理员和仲裁委(部门长)案件,可查看所有案件
240 241
                 if ("超级管理员".equals(role.getRoleName())
241 242
                 ) {
242 243
                     List<CaseApplication> caseApplicationlist = caseApplicationMapper.selectAdminCaseApplicationList(caseApplication);
@@ -2265,7 +2266,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2265 2266
         caseAffiliate.setCaseAppliId(caseApplication.getId());
2266 2267
         List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
2267 2268
         if (caseAffiliatListeselect != null) {
2268
-
2269
+            caseAffiliatListeselect=new ArrayList<>(caseAffiliatListeselect.stream().collect(Collectors.toMap(CaseAffiliate::getContactTelphone ,Function.identity(), (k1, k2) -> k1)).values());
2269 2270
             for (int i = 0; i < caseAffiliatListeselect.size(); i++) {
2270 2271
                 CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i);
2271 2272
                 int identityType = caseAffiliateselect.getIdentityType();
@@ -2315,6 +2316,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
2315 2316
         if (CollectionUtil.isEmpty(caseAffiliates)) {
2316 2317
             return "申请人、被申请人不存在";
2317 2318
         }
2319
+        caseAffiliates=new ArrayList<>(caseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getContactTelphone ,Function.identity(), (k1, k2) -> k1)).values());
2318 2320
         CaseApplication caseApplication = new CaseApplication();
2319 2321
         caseApplication.setId(messageVO.getId());
2320 2322
         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
@@ -3628,7 +3630,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
3628 3630
         caseAffiliate.setCaseAppliId(caseApplication.getId());
3629 3631
         List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
3630 3632
         if (caseAffiliatListeselect != null) {
3631
-
3632 3633
             for (int j = 0; j < caseAffiliatListeselect.size(); j++) {
3633 3634
                 CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(j);
3634 3635
                 int identityType = caseAffiliateselect.getIdentityType();

+ 72
- 53
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java View File

@@ -150,11 +150,10 @@ public class CaseZipImportImpl {
150 150
         String caseNum = "zc" + currentDay;
151 151
         maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum, caseNum.length());
152 152
         // 抓取内容
153
-        Map<String, String> fatchMap = new HashMap<>();
153
+
154 154
         //  从抓取规则表取字段和字典表取基本字段,字典表的字段名塞到基本表,is_default=1自定义字段塞到columnValue
155 155
         // 抓取规则,0-内置字段,1-自定义字段
156 156
         Map<String, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName));
157
-
158 157
         File directory = new File(targetPath);
159 158
         if (!directory.exists()) {
160 159
             throw new ServiceException("文件不存在");
@@ -163,19 +162,26 @@ public class CaseZipImportImpl {
163 162
         if (!directory.isDirectory() || directory.listFiles() == null) {
164 163
             throw new ServiceException("未找到文件夹");
165 164
         }
166
-    Integer batchNumber = caseApplicationMapper.selectBatchNumberLike();
167
-        AtomicInteger maxBatchNumber = new AtomicInteger();
168
-    if (batchNumber == null) {
169
-        maxBatchNumber.set(1);
170
-
171
-    } else {
172
-        maxBatchNumber.set(batchNumber+1);
173 165
 
174
-    }
175 166
     File[] files = directory.listFiles();
167
+//    List<CaseApplication> caseApplications = new ArrayList<>();
168
+//    for (File file1 : files) {
169
+//        if (file1.isDirectory() && file1.listFiles() != null) {
170
+//
171
+//            for (File file2 : file1.listFiles()) {
172
+//                CaseApplication caseApplication = buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, deptMap,  SecurityUtils.getLoginUser());
173
+//                if (caseApplication != null) {
174
+//                    caseApplications.add(caseApplication);
175
+//                }
176
+//            }
177
+//        }
178
+//    }
179
+//    if(caseApplications.size()>0){
180
+//        return success("导入成功");
181
+//    }
176 182
     CaseZipImportTask caseZipImportTask = null;
177 183
     try {
178
-        caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser(),maxBatchNumber.get());
184
+        caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList,  fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser());
179 185
     } catch (Exception e) {
180 186
         return error("导入失败");
181 187
     }
@@ -193,12 +199,23 @@ public class CaseZipImportImpl {
193 199
 
194 200
     }
195 201
     @Transactional
196
-    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) {
202
+    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) {
197 203
         // fileMap<caseId, List<File>>
204
+        Map<String, String> fatchMap = new HashMap<>();
205
+        Integer batchNumber = caseApplicationMapper.selectBatchNumberLike();
206
+        AtomicInteger maxBatchNumber = new AtomicInteger();
207
+        if (batchNumber == null) {
208
+            maxBatchNumber.set(1);
209
+
210
+        } else {
211
+            maxBatchNumber.set(batchNumber+1);
212
+
213
+        }
198 214
         Map<String, String> fileMap = findFile(file, fatchRuleList);
199 215
         if (fileMap != null && fileMap.size()> 0) {
200 216
             // 根据抓取规则循环抓取
201 217
             for (Map.Entry<String, List<FatchRule>> entry : fatchRuleMap.entrySet()) {
218
+                System.out.println("根据抓取规则循环抓取======"+entry.getKey());
202 219
                 getFatchContent(fileMap, entry.getKey(), fatchMap, entry.getValue());
203 220
             }
204 221
 
@@ -250,7 +267,7 @@ public class CaseZipImportImpl {
250 267
                 caseApplication.setCaseAppliId(caseApplication.getId());
251 268
 
252 269
                 // 设置批号
253
-                caseApplication.setBatchNumber(maxBatchNumber);
270
+                caseApplication.setBatchNumber(maxBatchNumber.get());
254 271
                 // 设置编号
255 272
                 String maxCaseNumStr = generateCaseNum();
256 273
                 caseApplication.setCaseNum(maxCaseNumStr);
@@ -315,7 +332,9 @@ public class CaseZipImportImpl {
315 332
                             sysDeptMapper.batchSave(sysDepts);
316 333
 
317 334
                         }
335
+
318 336
                         if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) {
337
+
319 338
                             caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
320 339
                             caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
321 340
                         }
@@ -331,25 +350,25 @@ public class CaseZipImportImpl {
331 350
                         // 新增日志
332 351
                         CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
333 352
                         // 发送短信
334
-                        if (CollectionUtil.isNotEmpty(smsRequestList)) {
335
-                            Map<Long, SmsSendRecord> sendRecordMap = null;
336
-                            if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
337
-                                sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
338
-                                for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
339
-                                    Boolean aBoolean = SmsUtils.sendSms(request);
340
-                                    if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
341
-                                        if (aBoolean) {
342
-                                            sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
343
-                                        } else {
344
-                                            sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
345
-                                        }
346
-                                    }
347
-                                }
348
-                                smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
349
-                            }
350
-
351
-
352
-                        }
353
+//                        if (CollectionUtil.isNotEmpty(smsRequestList)) {
354
+//                            Map<Long, SmsSendRecord> sendRecordMap = null;
355
+//                            if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
356
+//                                sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
357
+//                                for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
358
+//                                    Boolean aBoolean = SmsUtils.sendSms(request);
359
+//                                    if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
360
+//                                        if (aBoolean) {
361
+//                                            sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
362
+//                                        } else {
363
+//                                            sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
364
+//                                        }
365
+//                                    }
366
+//                                }
367
+//                                smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
368
+//                            }
369
+//
370
+//
371
+//                        }
353 372
                     } catch (Exception e) {
354 373
                         e.printStackTrace();
355 374
                         throw new RuntimeException("导入失败,请检查抓取规则是否正确");
@@ -844,27 +863,27 @@ public class CaseZipImportImpl {
844 863
                         insertAgentUserRole(agentUser, roleId, userRoleList);
845 864
 
846 865
                     }
847
-                    if (addUsers != null) {
848
-                        SysUser finalAgentUser = agentUser;
849
-                        if (CollectionUtil.isNotEmpty(smsRequestList) && smsRequestList.stream().noneMatch(smsSendRecord -> smsSendRecord.getPhone().equals(finalAgentUser.getPhonenumber()))) {
850
-                            SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
851
-                            request.setTemplateId("1956159");
852
-                            request.setPhone(agentUser.getPhonenumber());
853
-                            request.setTemplateParamSet(new String[]{agentUser.getNickName()});
854
-                            smsRequestList.add(request);
855
-                            SmsSendRecord smsSendRecord = new SmsSendRecord();
856
-                            smsSendRecord.setCaseId(caseApplication.getId());
857
-                            smsSendRecord.setCaseNum(caseApplication.getCaseNum());
858
-                            smsSendRecord.setPhone(request.getPhone());
859
-                            smsSendRecord.setSendTime(new Date());
860
-                            String content = "尊敬的" + agentUser.getNickName() + ",您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信";
861
-                            smsSendRecord.setSendContent(content);
862
-                          //  smsSendRecord.setCreateBy(getUsername());
863
-                            smsSendRecords.add(smsSendRecord);
864
-                        }
865
-
866
-
867
-                    }
866
+//                    if (addUsers != null) {
867
+//                        SysUser finalAgentUser = agentUser;
868
+//                        if (CollectionUtil.isNotEmpty(smsRequestList) && smsRequestList.stream().noneMatch(smsSendRecord -> smsSendRecord.getPhone().equals(finalAgentUser.getPhonenumber()))) {
869
+//                            SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
870
+//                            request.setTemplateId("1956159");
871
+//                            request.setPhone(agentUser.getPhonenumber());
872
+//                            request.setTemplateParamSet(new String[]{agentUser.getNickName()});
873
+//                            smsRequestList.add(request);
874
+//                            SmsSendRecord smsSendRecord = new SmsSendRecord();
875
+//                            smsSendRecord.setCaseId(caseApplication.getId());
876
+//                            smsSendRecord.setCaseNum(caseApplication.getCaseNum());
877
+//                            smsSendRecord.setPhone(request.getPhone());
878
+//                            smsSendRecord.setSendTime(new Date());
879
+//                            String content = "尊敬的" + agentUser.getNickName() + ",您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信";
880
+//                            smsSendRecord.setSendContent(content);
881
+//                          //  smsSendRecord.setCreateBy(getUsername());
882
+//                            smsSendRecords.add(smsSendRecord);
883
+//                        }
884
+//
885
+//
886
+//                    }
868 887
 
869 888
                 }
870 889
                 break;

+ 4
- 6
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java View File

@@ -25,27 +25,25 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
25 25
     private CaseZipImportImpl caseZipImportImpl;
26 26
     private Long templateId;
27 27
     private List<FatchRule> fatchRuleList;
28
-    private Map<String, String> fatchMap;
29 28
     private Map<String, List<FatchRule>> fatchRuleMap;
30 29
     private Map<String, SysUser> userMap;
31 30
     private List<SysDictData> dictDataList;
32 31
     private File[] files;
33 32
     private Map<String, Long> deptMap;
34 33
     private LoginUser loginUser;
35
-    private Integer maxBatchNumber;
36 34
 
37
-    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) {
35
+
36
+    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) {
38 37
         this.caseZipImportImpl = caseZipImportImpl;
39 38
         this.templateId = templateId;
40 39
         this.fatchRuleList = fatchRuleList;
41
-        this.fatchMap = fatchMap;
42 40
         this.fatchRuleMap = fatchRuleMap;
43 41
         this.userMap = userMap;
44 42
         this.dictDataList = dictDataList;
45 43
         this.files = files;
46 44
         this.deptMap = deptMap;
47 45
         this.loginUser = loginUser;
48
-        this.maxBatchNumber = maxBatchNumber;
46
+
49 47
     }
50 48
 
51 49
     @Override
@@ -56,7 +54,7 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
56 54
                 if (file1.isDirectory() && file1.listFiles() != null) {
57 55
 
58 56
                     for (File file2 : file1.listFiles()) {
59
-                        CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser,maxBatchNumber);
57
+                        CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, deptMap, loginUser);
60 58
                         if (caseApplication != null) {
61 59
                             caseApplications.add(caseApplication);
62 60
                         }

+ 13
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/OCRUtils.java View File

@@ -115,13 +115,24 @@ public class OCRUtils {
115 115
         if (StrUtil.isEmpty(ocrText) || CollectionUtil.isEmpty(fatchRules)) {
116 116
             return;
117 117
         }
118
+        // 将识别后的字符串英文标点符号全部转为中文标点符号
119
+        String ocrTextReplace = ocrText.replace(",", ",")
120
+//                .replace(".", "。")
121
+                .replace(":", ":").replace(";", ";").replace("?", "?").replace("!", "!").replace("(", "(")
122
+                .replace(")", ")").replace("[", "【").replace("]", "】").replace("{", "{").replace("}", "}")
123
+                .replace("<", "《").replace(">", "》").replace("|", "|").replace("\\", "\").replace("_", "_")
124
+                .replace("-", "-").replace("+", "+").replace("=", "=").replace("~", "~").replace("`", "`")
125
+                .replace("^", "^").replace("$", "¥").replace("@", "@").replace("#", "#").replace("%", "%")
126
+                .replace("&", "&").replace("*", "*").replace("(", "(").replace(")", ")").replace("{", "{")
127
+                .replace("}", "}").replace("[", "【").replace("]", "】").replace("<", "《").replace(">", "》")
128
+                .replace("|", "|").replace("\\", "\").replace("_", "_");
118 129
         for (FatchRule fatchRule : fatchRules) {
119 130
             // 从后往前抓取
120 131
             if (fatchRule.getFatchOrder() != null && fatchRule.getFatchOrder() == 1) {
121
-                reverseSubstringText(ocrText, fatchRule, fatchMap,null);
132
+                reverseSubstringText(ocrTextReplace, fatchRule, fatchMap,null);
122 133
             } else {
123 134
                 // 从前往后抓取
124
-                substringText(ocrText, fatchRule, fatchMap,null);
135
+                substringText(ocrTextReplace, fatchRule, fatchMap,null);
125 136
 
126 137
             }
127 138
         }

+ 20
- 12
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml View File

@@ -37,19 +37,24 @@
37 37
     </resultMap>
38 38
 
39 39
     <select id="selectCaseAffiliate" parameterType="CaseAffiliate" resultMap="CaseAffiliateResult">
40
-        select distinct (c.id),
40
+        select c.id,
41 41
         c.case_appli_id, c.identity_type,c.application_organ_id,c.application_organ_name,c.name,c.identity_num,c.contact_telphone,
42 42
         c.contact_address,c.work_address,c.work_telphone ,c.name_agent,c.identity_num_agent,c.contact_telphone_agent,
43 43
         c.comp_legal_person,c.comp_legalper_post,c.respon_sex ,c.respon_birth,
44 44
         c.residen_affili,appli_agent_title,
45 45
         c.contact_address_agent,c.email, c.send_email,c.track_num,c.applicant_agent_user_id,c.agent_email,s.user_id
46 46
         from case_affiliate c
47
-        left join sys_user s on c.identity_num=s.id_card
48
-        <where>
49
-            <if test="caseAppliId != null ">
50
-                AND c.case_appli_id = #{caseAppliId}
51
-            </if>
52
-        </where>
47
+        left JOIN  (
48
+        SELECT phonenumber,user_id, ROW_NUMBER() OVER(PARTITION BY phonenumber ORDER BY user_id ASC) as rn
49
+        FROM sys_user
50
+        ) s  ON c.contact_telphone = s.phonenumber
51
+        WHERE
52
+        s.rn = 1
53
+
54
+        <if test="caseAppliId != null ">
55
+            AND c.case_appli_id = #{caseAppliId}
56
+        </if>
57
+
53 58
     </select>
54 59
     <select id="selectCaseAffiliateByCaseIds" resultMap="CaseAffiliateResult">
55 60
         select (c.id),
@@ -59,15 +64,18 @@
59 64
         c.residen_affili,appli_agent_title,
60 65
         c.contact_address_agent,c.email, c.send_email,c.track_num,c.applicant_agent_user_id,c.agent_email,s.user_id
61 66
         from case_affiliate c
62
-        left join sys_user s on c.identity_num=s.id_card
63
-        <where>
64
-            <if test="ids != null ">
65
-                case_appli_id in
67
+        left JOIN  (
68
+        SELECT phonenumber,user_id, ROW_NUMBER() OVER(PARTITION BY phonenumber ORDER BY user_id ASC) as rn
69
+        FROM sys_user
70
+        ) s  ON c.contact_telphone = s.phonenumber
71
+        WHERE
72
+        s.rn = 1
73
+        <if test="ids != null ">
74
+                and case_appli_id in
66 75
                 <foreach collection="ids" item="item" open="(" separator="," close=")">
67 76
                     #{item}
68 77
                 </foreach>
69 78
             </if>
70
-        </where>
71 79
     </select>
72 80
     <select id="selectCaseAffiliateByIdentityType"  resultMap="CaseAffiliateResult">
73 81
         select c.*

+ 1
- 1
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml View File

@@ -1379,7 +1379,7 @@
1379 1379
         from reserved_conference ;
1380 1380
     </select>
1381 1381
     <select id="selectBatchNumberLike" resultType="java.lang.Integer">
1382
-        select max(batch_number) as maxBatchNumber
1382
+        select max(batch_number+0) as maxBatchNumber
1383 1383
         from case_application ;
1384 1384
     </select>
1385 1385