3 次代碼提交 a4b1fde46e ... 79ab9f9bf1

作者 SHA1 備註 提交日期
  Danj0rr 79ab9f9bf1 设置模型编号默认值 11 月之前
  Danj0rr 466aacaedb 产品新增判断产品编号是否存在 11 月之前
  Danj0rr 29bd338c14 合作方新增判断证件类型和证件号码重复 11 月之前

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

+ 11 - 0
src/main/java/com/kexun/controller/CooperatorProductController.java

@@ -120,6 +120,17 @@ public class CooperatorProductController {
 //        return Result.success("ok", result);
 //    }
 
+    @PostMapping("checkDupProdNum")
+    public  Result checkDupProdNum(@RequestBody String json)
+    {
+        JSONObject req = JSON.parseObject(json);
+        List<CooperatorProduct> dupCooperatorProductInfo=CooperatorProductService.getProductByProductNum(req.getString("product_num"));
+        if(!dupCooperatorProductInfo.isEmpty()){
+            return Result.error("合作方产品编号重复!");
+        }
+        return Result.success();
+    }
+
     // 申请合作产品
     @PostMapping("apply")
     public Result cooperatorProductApply(@RequestBody String json)

+ 2 - 1
src/main/java/com/kexun/controller/ModelController.java

@@ -59,7 +59,8 @@ public class ModelController {
     public Result getModelNo(){
         JSONObject resJson = new JSONObject();
         String model_no=userModelService.getModelNo();
-
+        if (model_no==null)
+            model_no="0";
         System.out.println(model_no);
 
         resJson.put("model_no", model_no);