浏览代码

合作方新增判断证件类型和证件号码重复

Danj0rr 11 月之前
父节点
当前提交
29bd338c14
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/main/java/com/kexun/controller/CooperatorController.java

+ 5 - 5
src/main/java/com/kexun/controller/CooperatorController.java

@@ -97,19 +97,19 @@ public class CooperatorController {
     {
         JSONObject req = JSON.parseObject(json);
         String cooperator_name=req.getString("cooperator_name");
-        CooperatorInfo dupCooperatorInfo= CooperatorService.findByCooperatorNum(cooperator_name);
-        if (dupCooperatorInfo!=null){
+
+
+        List<CooperatorInfo> dupNumCooperatorInfo=CooperatorService.findByCorpCertificateNumAndType(req.getString("corpCertificateNum"),req.getString("corp_certificate_type"));
+        if (!dupNumCooperatorInfo.isEmpty())
             return Result.error("合作方已存在!");
-        }
 
+        System.out.println(req.getString("corp_certificate_type"));
         CooperatorInfo cooperatorInfo = new CooperatorInfo();
         cooperatorInfo.setCooperatorName(req.getString("cooperator_name"));
         long time1 = System.currentTimeMillis();
         cooperatorInfo.setCooperatorNum(Long.toString(time1));
         cooperatorInfo.setCorpCertificateNum(req.getString("corpCertificateNum"));
         cooperatorInfo.setCorpCertificateType(req.getString("corp_certificate_type"));
-//        long time1 = System.currentTimeMillis();
-//        cooperatorInfo.setCooperatorNum(Long.toString(time1));
         cooperatorInfo.setTemplateId(req.getString("field_template_id"));
         Calendar calendar= Calendar.getInstance();
         SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :HH:mm:ss");