Ver código fonte

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

Danj0rr 11 meses atrás
pai
commit
29bd338c14

+ 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");