Browse Source

合作方

shixr 1 năm trước cách đây
mục cha
commit
c27b21f4f5

+ 1 - 1
src/main/java/com/kexun/config/XxlJobConfig.java

@@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration;
  * @author lgs
  * @date 2023/05/04
  */
-@Configuration
+//@Configuration
 @Slf4j
 public class XxlJobConfig {
 

+ 87 - 0
src/main/java/com/kexun/controller/CooperatorController.java

@@ -0,0 +1,87 @@
+package com.kexun.controller;
+
+//import ch.qos.logback.core.rolling.helper.FileStoreUtil;
+//import ch.qos.logback.core.util.FileUtil;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.kexun.common.utils.Result;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.service.CooperatorInfoService;
+import lombok.extern.java.Log;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/*
+新添加
+ * 目标:合作方相关操作接口
+ * 目前:目前只有增、查合作方,
+ 此外,由组合字段过滤到模型进行逻辑判断的整体的解析逻辑打通还需改动
+ */
+
+@RestController
+@RequestMapping("/admin/partner")
+@Log
+public class CooperatorController {
+
+    @Autowired
+    private CooperatorInfoService CooperatorInfoService;
+
+    // 获取合作方信息
+    @GetMapping("cooperatorList")
+    public Result cooperatorList() {
+        JSONObject resJson=new JSONObject();
+        List<CooperatorInfo> list=CooperatorInfoService.list();
+        resJson.put("cooperator_List",list);
+
+        return Result.success("ok",resJson);
+
+    }
+
+    @GetMapping("list")
+    public Result list(String partnerName) {
+        QueryWrapper<CooperatorInfo> w = new QueryWrapper<>();
+        if (!StringUtils.isEmpty(partnerName)) {
+            w.like("partner_name", partnerName);
+        }
+
+        List<CooperatorInfo> list = CooperatorInfoService.list(w);
+        return Result.success("ok", list);
+    }
+
+    @PostMapping("partnerAdd")
+    @Transactional
+    public Result add(@RequestBody JSONObject param) {
+//        String partnerName = param.getString("partnerName");
+//        String contactName = param.getString("contactName");
+//        String mobileNo = param.getString("mobileNo");
+//        String rate1 = param.getString("rate1");
+//        String queryNumber1 = param.getString("queryNumber1");
+//        String rate2 = param.getString("rate2");
+//        String queryNumber2 = param.getString("queryNumber2");
+//        String rate3 = param.getString("rate3");
+//        String queryNumber3 = param.getString("queryNumber3");
+//        String isEnable = param.getString("isEnable");
+//        PartnerInfo partnerInfo = new PartnerInfo();
+//        partnerInfo.setPartnerName(partnerName);
+//        partnerInfo.setContactName(contactName);
+//        partnerInfo.setMobileNo(mobileNo);
+//        partnerInfo.setRate1(rate1);
+//        partnerInfo.setQueryNumber1(queryNumber1);
+//        partnerInfo.setRate2(rate2);
+//        partnerInfo.setQueryNumber2(queryNumber2);
+//        partnerInfo.setRate3(rate3);
+//        partnerInfo.setQueryNumber3(queryNumber3);
+//        Date date = new Date();
+//        partnerInfo.setCreateTime(date.toString());
+//        partnerInfo.setIsEnable(isEnable);
+//        PartnerInfoService.save(partnerInfo);
+
+        return Result.success();
+    }
+
+}

+ 723 - 726
src/main/java/com/kexun/controller/ModelController.java

@@ -1,726 +1,723 @@
-package com.kexun.controller;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.kexun.common.JsonFile;
-import com.kexun.common.utils.Result;
-import com.kexun.entity.*;
-import com.kexun.service.*;
-//import com.sun.xml.internal.bind.v2.TODO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.io.*;
-import java.util.*;
-
-/*
- * 目标:实现对字段组合,用户自定义模型的全部操作
- * 目前:原有功能都已实现,新添加的对字段组合过滤后得到的字段进行模型的逻辑判断功能尚缺
- */
-
-@RestController
-@RequestMapping("admin/model")
-public class ModelController {
-
-    @Autowired
-    private SysRoleRightsService sysRoleRightsService;
-
-    @Autowired
-    private SysRoleService sysRoleService;
-    @Autowired
-    private SysRightsService sysRightsService;
-    @Autowired
-    private SysUserService sysUserService;
-    @Autowired
-    private UserInfoService userInfoService;
-    @Autowired
-    private UserModelService userModelService;
-    @Autowired
-    private UserApprovalService userApprovalService;
-    @Autowired
-    private UserFieldService userFieldService;
-    @Autowired
-    private CustomizedModelService customizedModelService;
-    @Autowired
-    private FilterResultService parseResultService;
-
-
-    private JsonFile jsonFile=new JsonFile();
-
-    //给模型复核员提供模型复核
-    @GetMapping("listUser")
-    public Result listUser(SysUser sysUser)
-    {
-        QueryWrapper<SysUser> w = new QueryWrapper<>();
-        w.eq("role_id",4);
-        List<SysUser> list=sysUserService.list(w);
-        List<JSONObject> user_list =new ArrayList<>();
-        for(int i=0;i<list.size();i++)
-        {
-            String user_name=list.get(i).getUserName();
-            JSONObject user_json=new JSONObject();
-            List<UserModel> model_list=userModelService.findByUserName(user_name);
-            UserField userField=userFieldService.findByUserName(user_name);
-
-            user_json.put("userName",user_name);
-            user_json.put("modelList",model_list);
-            user_json.put("userField",userField);
-            user_list.add(user_json);
-        }
-        return Result.success("ok",user_list);
-    }
-
-
-
-
-
-    @GetMapping("getApproval")
-    public Result getApproval()
-    {
-        JSONObject resJson=new JSONObject();
-        List<UserApproval> approval_list=userApprovalService.list();
-        resJson.put("approval_list",approval_list);
-        return Result.success("ok",resJson);
-
-    }
-    /**
-     * 读取json文件,返回json串
-     * @param fileName
-     * @return
-     */
-    public static String readJsonFile(String fileName) {
-        String jsonStr = "";
-        try {
-            File jsonFile = new File(fileName);
-            FileReader fileReader = new FileReader(jsonFile);
-
-            Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
-            int ch = 0;
-            StringBuffer sb = new StringBuffer();
-            while ((ch = reader.read()) != -1) {
-                sb.append((char) ch);
-            }
-
-            fileReader.close();
-            reader.close();
-            jsonStr = sb.toString();
-            return jsonStr;
-        } catch (IOException e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-    private static String getType(Object a) {
-        return a.getClass().toString();
-    }
-
-    //上传字段组合
-    @PostMapping("addField")
-    public Result addField(@RequestBody String json,SysUser sysUser) throws IOException {
-        JSONObject req = JSON.parseObject(json);
-
-        String field_combine=req.getString("fieldcombine");
-
-        //添加异常判断,重名模型名?,yuan尚未实现,先忽略掉
-//        JSONObject resJson = new JSONObject();
-//        if(userModelService.findByUserAndModel(sysUser.getUserName(),field_combine)!=null) {
-//            resJson.put("state", 0);
-//            return Result.success("ok",resJson);
-//        }
-//        //非重名
-//        resJson.put("state", 1);
-
-//        此为自定义字段组合所需数据
-        String userName=req.getString("username");
-        String fieldData=req.getString("fielddata");
-//        String fieldCombine = req.getString("fieldcombine");
-        String fieldRemark = req.getString("remark");
-//        customizedModel.setModelName(modelName);
-//        customizedModel.setFieldClass("自定义模型");
-//        customizedModel.setIdList(fieldData);
-//        customizedModel.setCreatedBy(userName);
-//        customizedModel.setModelRemark(modelRemark);
-//        customizedModelService.save(customizedModel);
-
-        //yuan 将自定义字段加到customizedModel表中,还是启用customizedModel表,只给user_field表插入数据
-        UserField yUserField = new UserField();
-        yUserField.setFieldCombine(field_combine);
-        yUserField.setFieldRemark(fieldRemark);
-        yUserField.setUserName(userName);
-        yUserField.setFieldData(fieldData);
-        yUserField.setFieldState("审批中");
-        yUserField.setModelName("暂未指定");
-        userFieldService.save(yUserField);
-
-// 好像是初始的字段组合过滤逻辑,现在应该是弃用了
-//        String pate="朱家铎_410922199111210030_255632073002334212.txt";
-//        String Path="D:/jin_rong/test_data"+"/"+pate;
-//
-//        String s = readJsonFile(Path);
-//        JSONObject field_json = JSON.parseObject(s);
-//
-//
-//        JSONObject filter_json = JSON.parseObject(fieldData);
-//        JSONObject filter_dict = new JSONObject();
-//
-//        Iterator iter1 = filter_json.entrySet().iterator();
-//        while (iter1.hasNext()) {
-//            JSONObject field_dict = new JSONObject();
-//
-//            Map.Entry entry = (Map.Entry) iter1.next();
-//            String temp = entry.getValue().toString();
-//            temp = temp.substring(1,temp.length()-1);
-//            String[] strarray=temp.split(",");
-//
-//            for (int i = 0; i < strarray.length; i++){
-//                strarray[i] = strarray[i].substring(1,strarray[i].length()-1);
-//                field_dict.put(strarray[i], (field_json.getJSONObject(entry.getKey().toString())).getString(strarray[i]));
-//            }
-//
-//            filter_dict.put(entry.getKey().toString(),field_dict);
-//        }
-//        //System.out.println(filter_dict.toString());
-//
-//        FileOutputStream fileOutputStream = null;
-//        File file = new File("D:/jin_rong/test_data/result.json");
-//        if(!file.exists()){
-//            file.createNewFile();
-//        }
-//        fileOutputStream = new FileOutputStream(file);
-//        fileOutputStream.write(filter_dict.toString().getBytes("utf-8"));
-//        fileOutputStream.flush();
-//        fileOutputStream.close();
-
-// 此段代码注掉是因为新增字段组合有一个审批字段,默认为审批通过,但是新增的话会更新为审核中yuan
-
-//        UserField userField=userFieldService.findByUserName(userName);
-//        if(userField==null)
-//        {
-//            UserField new_field=new UserField();
-//            new_field.setUserName(userName);
-//            new_field.setFieldData(fieldData);
-//            new_field.setFieldState("审批中");
-//            userFieldService.save(new_field);
-//        }
-//        else
-//        {
-//            userField.setFieldData(fieldData);
-//            userField.setFieldState("审批中");
-//            userFieldService.updateById(userField);
-//        }
-//yuan
-        UserApproval approval=new UserApproval();
-        approval.setUserName(sysUser.getUserName());
-        approval.setApprovalId((long) 2);
-        approval.setData(field_combine);
-        approval.setFieldData(fieldData);
-        userApprovalService.save(approval);
-
-        return Result.success();
-
-    }
-
-    //yuan 前端获取user_field表的信息,但是在获取id时,会进行四舍五入操作导致id错误,因此通过字段组合名更新
-    @GetMapping("fieldCombineList")
-    public Result fieldCombineList() {
-        JSONObject resJson=new JSONObject();
-        List<UserField> list=userFieldService.list();
-        resJson.put("field_combine_list",list);
-        return Result.success("ok",resJson);
-
-    }
-    // sxr
-    @PostMapping("updateFieldCombineList")
-    public Result updateFieldCombineList(@RequestBody String json,SysUser sysUser) {
-        JSONObject req = JSON.parseObject(json);
-
-        long fieldId=Long.valueOf(req.getString("fieldId")) ;
-        String fieldCombine=req.getString("fieldCombine");
-        String choseData=req.getString("choseData");
-
-        UserField userField = userFieldService.findByID(fieldId);
-        userField.setFieldCombine(fieldCombine);
-        userField.setFieldData(choseData);
-        userFieldService.updateById(userField);
-        // TODO userApprovalService表更新 id需要改
-
-        return Result.success();
-    }
-
-    // sxr
-    @GetMapping("getFieldById")
-    public Result getFieldById(Long fieldId) {
-        System.out.println( fieldId);
-        JSONObject result = new JSONObject();
-        UserField userField = userFieldService.findByID(fieldId);
-
-        result.put("fieldCombine", userField.getFieldCombine());
-        //System.out.println(userField.getFieldCombine());
-
-        JSONObject fieldDateJson = new JSONObject();
-        String fieldData = userField.getFieldData();
-        fieldData = fieldData.substring(1,fieldData.length()-1);
-        String[] temp = fieldData.split("]");
-        for(int i=0;i< temp.length;i++)
-        {
-            System.out.println(temp[i]);
-            String key="";
-            if(i==0){  key = temp[i].split(":")[0].substring(1, temp[i].split(":")[0].length()-1);}
-            else{  key = temp[i].split(":")[0].substring(2, temp[i].split(":")[0].length()-1);}
-            String valuetmp[] = (temp[i].split(":")[1].substring(1).split(","));
-            String value[] = {};
-            for(int j=0;j<valuetmp.length;j++)
-            {
-
-                System.out.println( valuetmp[j]);
-                System.out.println(valuetmp[j].length());
-
-                valuetmp[j] = valuetmp[j].substring(1,valuetmp[j].length()-1);
-            }
-
-            fieldDateJson.put(key, valuetmp);
-
-        }
-        System.out.println(fieldDateJson);
-        result.put("fieldData",fieldDateJson);
-//        System.out.println(userField.getFieldData());
-        return Result.success("ok", result);
-    }
-
-
-    //过滤操作,也被弃用了
-//    @PostMapping("parse")
-//    public Result parse(@RequestBody String json) throws IOException {
-//        JSONObject req = JSON.parseObject(json);
-//        ParseResult parseResult = new ParseResult();
-////        此为自定义模型所需数据
-//        String fmodelName=req.getString("fmodelName");
-//        String createdBy=req.getString("createdBy");
-//        String idList=req.getString("idList");
-//        parseResult.setFmodelName(fmodelName);
-//        parseResult.setCreatedBy(createdBy);
-//
-//        //表示一个文件路径
-//        File file = new File("D:/jin_rong/todo/execed_txt");
-//        //用数组把文件夹下的文件存起来
-//        File[] files = file.listFiles();
-//        int l = files.length;
-//        System.out.println(l);
-//        String pates[] = new String[l];
-//        //foreach遍历数组
-//        for (int j=0;j<l;j++){
-//            pates[j] = files[j].getName();
-//            String pate=pates[j];
-//            String Path="D:/jin_rong/todo/execed_txt"+"/"+pate;
-//            String pathFilter = new String();
-//            pathFilter = "D:/jin_rong/test_data/logic/"+pate;
-//            parseResult.setReportName(pate);
-//            String s = readJsonFile(Path);
-//            JSONObject field_json = JSON.parseObject(s);
-//
-//
-//            JSONObject filter_json = JSON.parseObject(idList);
-//            JSONObject filter_dict = new JSONObject();
-//
-//            Iterator iter1 = filter_json.entrySet().iterator();
-//            while (iter1.hasNext()) {
-//                JSONObject field_dict = new JSONObject();
-//
-//                Map.Entry entry = (Map.Entry) iter1.next();
-//                String temp = entry.getValue().toString();
-//                temp = temp.substring(1,temp.length()-1);
-//                String[] strarray=temp.split(",");
-//
-//                for (int i = 0; i < strarray.length; i++){
-//                    strarray[i] = strarray[i].substring(1,strarray[i].length()-1);
-//                    field_dict.put(strarray[i], (field_json.getJSONObject(entry.getKey().toString())).getString(strarray[i]));
-//                }
-//
-//                filter_dict.put(entry.getKey().toString(),field_dict);
-//            }
-//            parseResult.setResultInfo(filter_dict.toString());
-//            parseResultService.save(parseResult);
-//
-//            FileOutputStream fileOutputStream = null;
-//
-//
-//            File fileFilter = new File(pathFilter);
-//            if(!fileFilter.exists()){
-//                fileFilter.createNewFile();
-//            }
-//            fileOutputStream = new FileOutputStream(fileFilter);
-//            fileOutputStream.write(filter_dict.toString().getBytes("utf-8"));
-//            fileOutputStream.flush();
-//            fileOutputStream.close();
-//
-//        }
-//
-//
-//        //System.out.println(filter_dict.toString());
-//
-//        return Result.success();
-//
-//    }
-
-    @GetMapping("getField")
-    public Result getField(SysUser sysUser)
-    {
-        JSONObject resJson = new JSONObject();
-        String userName=sysUser.getUserName();
-        UserField userField=userFieldService.findByUserName(userName);
-        if(userField==null)
-        {
-            resJson.put("fieldData","暂无申请字段");
-            resJson.put("fieldState","未配置字段");
-        }
-        else
-        {
-            resJson.put("fieldData",userField.getFieldData());
-            resJson.put("fieldState",userField.getFieldState());
-        }
-        return Result.success("ok",resJson);
-    }
-
-    @PostMapping("getFieldByName")
-    public Result getFieldByName(@RequestBody String json)
-    {
-        JSONObject req=JSON.parseObject(json);
-        JSONObject resJson = new JSONObject();
-        String userName= req.getString("username");
-        UserField userField=userFieldService.findByUserName(userName);
-        if(userField==null)
-        {
-            resJson.put("fieldData","暂无申请字段");
-            resJson.put("fieldState","未配置字段");
-        }
-        else
-        {
-            resJson.put("fieldData",userField.getFieldData());
-            resJson.put("fieldState",userField.getFieldState());
-        }
-        return Result.success("ok",resJson);
-    }
-
-
-    //新增自定义模型
-    @PostMapping("addModel")
-    public Result addModel(@RequestBody String json,SysUser sysUser) throws IOException {
-        //获取用户模型,并按json文件保存
-        JSONObject req = JSON.parseObject(json);
-        String model_name=req.getString("modelname");
-        JSONObject resJson = new JSONObject();
-        //添加异常判断,重名模型名?
-        if(userModelService.findByUserAndModel(sysUser.getUserName(),model_name)!=null) {
-            resJson.put("state", 0);
-            return Result.success("ok",resJson);
-        }
-        //非重名
-        resJson.put("state", 1);
-
-        String model_data=req.getString("modeldata");
-        JSONObject model_json=JSON.parseObject(model_data);
-
-//        String select_data = model_json.getJSONArray("select_data").toString();
-
-        String file_name=sysUser.getUserName()+"_"+model_name;
-        jsonFile.writerFile(model_json,file_name);
-
-        //  这个地方应该先加到审批页面上
-        UserApproval approval=new UserApproval();
-        approval.setUserName(sysUser.getUserName());
-        approval.setApprovalId((long) 1);
-        approval.setData(model_name);
-        userApprovalService.save(approval);
-        //写入数据库
-        String userName=sysUser.getUserName();
-        UserModel new_model=new UserModel();
-        new_model.setUserName(userName);
-        new_model.setModelName(model_name);
-        new_model.setModelType(0);
-        new_model.setModelState("审批中");
-        new_model.setFieldCombine("暂未指定");
-        new_model.setSelectData(model_data);
-        userModelService.save(new_model);
-
-
-        return Result.success("ok",resJson);
-
-    }
-    //列举usermodel
-    @GetMapping("getUserModel")
-    public Result getUserModel(SysUser sysUser)
-    {
-        JSONObject resJson=new JSONObject();
-        List<UserModel> model_list=userModelService.findByUserName(sysUser.getUserName());
-//        System.out.println(model_list.get(0).getId());
-        resJson.put("modelData", model_list);
-
-        return Result.success("ok",resJson);
-
-
-    }
-    //    获取当前模型
-    @PostMapping("getModelByName")
-    public Result getModelByName(@RequestBody String json,SysUser sysUser)
-    {
-
-        JSONObject resJson=new JSONObject();
-
-        JSONObject req = JSON.parseObject(json);
-
-        //user_name+model_name就是文件名
-        String model_name=req.getString("modelName");
-        String user_name=sysUser.getUserName();
-        //读取对应文件
-        JSONObject model=jsonFile.ReadJson(user_name+"_"+model_name);
-        System.out.println(model);
-
-//        resJson.put("model", model);
-
-        return Result.success("ok",resJson);
-
-    }
-
-
-    @PostMapping("changeModelByID")
-    public Result changeModelByID(@RequestBody String json,SysUser sysUser) throws IOException {
-        //获取参数
-        JSONObject resJson=new JSONObject();
-        JSONObject req=JSON.parseObject(json);
-        String model_name=req.getString("modelname");
-        String model_data=req.getString("modeldata");
-        long id=Long.parseLong( req.getString("modelid"));
-//        System.out.println(id);
-//        System.out.println(req.getString("modelid"));
-        UserModel model=userModelService.findByID(id);
-
-        //删除旧模型(文件)
-        String old_name=model.getModelName();
-
-
-        //新模型写入
-        JSONObject model_json=JSON.parseObject(model_data);
-        String file_name=sysUser.getUserName()+"_"+model_name;
-        jsonFile.writerFile(model_json,file_name);
-        model.setModelName(model_name);
-        model.setModelState("审批中");
-        //重新审批
-        UserApproval approval=new UserApproval();
-        approval.setUserName(sysUser.getUserName());
-        approval.setApprovalId((long) 1);
-        approval.setData(model_name);
-        userApprovalService.save(approval);
-
-        userModelService.updateById(model);
-
-
-
-        return Result.success();
-
-    }
-
-    //修改产品号
-    @PostMapping("changeProduct")
-    public Result changeProduct(@RequestBody String json,SysUser sysUser)
-    {
-        JSONObject req=JSON.parseObject(json);
-        long id= Long.parseLong(req.getString("modelid"));
-        String productNum=req.getString("productnum");
-        UserModel model=userModelService.findByID(id);
-        model.setProductNum(productNum);
-        userModelService.updateById(model);
-        return Result.success();
-
-    }
-
-    //yuan修改组合对应模型号
-    @PostMapping("combineReleModel")
-    public Result combineReleModel(@RequestBody String json,SysUser sysUser)
-    {
-        JSONObject req=JSON.parseObject(json);
-        String field_combine=req.getString("field_combine");
-        String modelName=req.getString("model_name");
-        UserField field=userFieldService.findByFieldCombine(field_combine);
-        UserModel model = userModelService.findByModelName(modelName);
-        model.setFieldCombine(field_combine);
-        field.setModelName(modelName);
-        userModelService.updateById(model);
-        userFieldService.updateById(field);
-        return Result.success();
-    }
-
-    //sxr编辑字段
-//    @PostMapping("combineFieldModel")
-//    public Result combineFieldModel(@RequestBody String json,SysUser sysUser)
-//    {
-//        JSONObject req=JSON.parseObject(json);
-//        String field_id=req.getString("field_id");
-//        String field_name=req.getString("field_name");
-//        String selected_field_data=req.getString("selected_field_data");
-//        String modelName=req.getString("model_name");
-//        UserField field=userFieldService.findByFieldCombine(field_combine);
-//        field.setModelName(modelName);
-//        userFieldService.updateById(field);
-//        return Result.success();
-//    }
-
-
-    //这个接口是将模型从审核通过/暂停改为上线
-//    审批中/已上线/审核通过/暂停使用
-    @PostMapping("changeState")
-    public Result changeState(@RequestBody String json,SysUser sysUser)
-    {
-        JSONObject req=JSON.parseObject(json);
-        long id= Long.parseLong(req.getString("modelid"));
-        String state=req.getString("modelstate");
-
-        System.out.println(id);
-        UserModel model=userModelService.findByID(id);
-
-        model.setModelState(state);
-
-        userModelService.updateById(model);
-
-        return Result.success();
-
-    }
-
-    @PostMapping("deleteModel")
-    public Result deleteModel(@RequestBody String json,SysUser sysUser)
-    {
-        JSONObject req=JSON.parseObject(json);
-        long id= Long.parseLong(req.getString("modelid"));
-        String fieldCombine = req.getString("fieldCombine");
-        if(fieldCombine.equals("暂未指定")){
-
-        }else{
-            UserField field=userFieldService.findByFieldCombine(fieldCombine);
-            field.setModelName("暂未指定");
-            userFieldService.updateById(field);
-        }
-
-
-        userModelService.removeModelByID(id);
-        return Result.success();
-
-    }
-
-    // 获取审核模块的详情,主要是模型详情
-    @PostMapping("getDetails")
-    public Result getDetails(@RequestBody String json)
-    {
-        JSONObject jsonrq=JSON.parseObject(json);
-        int type=jsonrq.getInteger("type");
-        if(type==1)
-        {
-            //首先获取对应模型
-            JSONObject res = new JSONObject();
-            String user_name=jsonrq.getString("username");
-            String model_name=jsonrq.getString("modelname");
-            UserModel model=userModelService.findByUserAndModel(user_name,model_name);
-            if(model==null)   return Result.error();
-            //模型类型
-            res.put("model_type",model.getModelType());
-            if(model.getModelType()==0) {//自定义模型
-                JSONObject model_data = jsonFile.ReadJson(user_name + "_" + model_name);
-                if (model_data != null) {
-                    res.put("error_code", 0);
-                    res.put("model_data", model_data);
-                } else {
-                    res.put("error_code", 1);
-                    res.put("error_info", "模型不存在!");
-
-                }
-            }
-            else if(model.getModelType()==1 || model.getModelType()==2)
-            {
-                res.put("output_list",model.getOutputList());
-                res.put("other_data",model.getOtherData());
-
-            }
-            return Result.success("ok",res);
-        }
-        else if(type==2)
-        {
-            //字段信息 直接获取 不用这一步
-//            JSONObject res = new JSONObject();
-//            String user_name=jsonrq.getString("username");
-//            String field_data=jsonrq.getString("modelname");
-
-        }
-        else
-        {
-
-        }
-        return Result.success();
-    }
-
-    @PostMapping("doApproval")
-    public Result doApproval(@RequestBody String json)
-    {
-        String reason_list[]={"错误字段选择","错误模型逻辑","其他"};
-        JSONObject jsonrq=JSON.parseObject(json);
-        int type=jsonrq.getInteger("type");
-        long id= Long.parseLong(jsonrq.getString("id"));
-
-        if(type==1)
-        {
-            JSONObject res = new JSONObject();
-            String user_name=jsonrq.getString("username");
-            String model_name=jsonrq.getString("data");
-            int pass=jsonrq.getInteger("pass");
-            //通过
-            if(pass==1)
-            {
-                UserModel model=userModelService.findByUserAndModel(user_name,model_name);
-                if(model!=null) {
-                    model.setModelState("审核通过");
-                    userModelService.updateById(model);
-                }
-            }
-            //不通过
-            else {
-                int reason=jsonrq.getInteger("reason");
-                UserModel model = userModelService.findByUserAndModel(user_name, model_name);
-                if(model!=null) {
-                    model.setModelState("审核不通过:"+reason_list[reason]);
-                    userModelService.updateById(model);
-                }
-            }
-        }
-        else if(type==2)
-        {
-            String user_name=jsonrq.getString("username");
-            String user_field=jsonrq.getString("data");
-            int pass=jsonrq.getInteger("pass");
-
-            System.out.println("审核了字段");
-            System.out.println(user_name);
-            if(pass==1)
-            {
-                UserField userField=userFieldService.findByFieldCombine(user_field);
-                if(userField!=null) {
-                    userField.setFieldState("审核通过");
-                    userFieldService.updateById(userField);
-                }
-
-            }
-            else {
-                UserField userField=userFieldService.findByUserName(user_name);
-                if(userField!=null) {
-                    userField.setFieldState("审核不通过");
-                    userFieldService.updateById(userField);
-                }
-            }
-        }
-        else
-        {
-
-        }
-        System.out.println(id);
-        userApprovalService.removeById(id);
-        return Result.success();
-    }
-
-}
+package com.kexun.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.kexun.common.JsonFile;
+import com.kexun.common.utils.Result;
+import com.kexun.entity.*;
+import com.kexun.service.*;
+//import com.sun.xml.internal.bind.v2.TODO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.*;
+import java.util.*;
+
+/*
+ * 目标:实现对字段组合,用户自定义模型的全部操作
+ * 目前:原有功能都已实现,新添加的对字段组合过滤后得到的字段进行模型的逻辑判断功能尚缺
+ */
+
+@RestController
+@RequestMapping("admin/model")
+public class ModelController {
+
+    @Autowired
+    private SysRoleRightsService sysRoleRightsService;
+
+    @Autowired
+    private SysRoleService sysRoleService;
+    @Autowired
+    private SysRightsService sysRightsService;
+    @Autowired
+    private SysUserService sysUserService;
+    @Autowired
+    private UserInfoService userInfoService;
+    @Autowired
+    private UserModelService userModelService;
+    @Autowired
+    private UserApprovalService userApprovalService;
+    @Autowired
+    private UserFieldService userFieldService;
+    @Autowired
+    private CustomizedModelService customizedModelService;
+    @Autowired
+    private FilterResultService parseResultService;
+
+
+    private JsonFile jsonFile=new JsonFile();
+
+    //给模型复核员提供模型复核
+    @GetMapping("listUser")
+    public Result listUser(SysUser sysUser)
+    {
+        QueryWrapper<SysUser> w = new QueryWrapper<>();
+        w.eq("role_id",4);
+        List<SysUser> list=sysUserService.list(w);
+        List<JSONObject> user_list =new ArrayList<>();
+        for(int i=0;i<list.size();i++)
+        {
+            String user_name=list.get(i).getUserName();
+            JSONObject user_json=new JSONObject();
+            List<UserModel> model_list=userModelService.findByUserName(user_name);
+            UserField userField=userFieldService.findByUserName(user_name);
+
+            user_json.put("userName",user_name);
+            user_json.put("modelList",model_list);
+            user_json.put("userField",userField);
+            user_list.add(user_json);
+        }
+        return Result.success("ok",user_list);
+    }
+
+
+    @GetMapping("getApproval")
+    public Result getApproval()
+    {
+        JSONObject resJson=new JSONObject();
+        List<UserApproval> approval_list=userApprovalService.list();
+        resJson.put("approval_list",approval_list);
+        return Result.success("ok",resJson);
+
+    }
+    /**
+     * 读取json文件,返回json串
+     * @param fileName
+     * @return
+     */
+    public static String readJsonFile(String fileName) {
+        String jsonStr = "";
+        try {
+            File jsonFile = new File(fileName);
+            FileReader fileReader = new FileReader(jsonFile);
+
+            Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
+            int ch = 0;
+            StringBuffer sb = new StringBuffer();
+            while ((ch = reader.read()) != -1) {
+                sb.append((char) ch);
+            }
+
+            fileReader.close();
+            reader.close();
+            jsonStr = sb.toString();
+            return jsonStr;
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+    private static String getType(Object a) {
+        return a.getClass().toString();
+    }
+
+    //上传字段组合
+    @PostMapping("addField")
+    public Result addField(@RequestBody String json,SysUser sysUser) throws IOException {
+        JSONObject req = JSON.parseObject(json);
+
+        String field_combine=req.getString("fieldcombine");
+
+        //添加异常判断,重名模型名?,yuan尚未实现,先忽略掉
+//        JSONObject resJson = new JSONObject();
+//        if(userModelService.findByUserAndModel(sysUser.getUserName(),field_combine)!=null) {
+//            resJson.put("state", 0);
+//            return Result.success("ok",resJson);
+//        }
+//        //非重名
+//        resJson.put("state", 1);
+
+//        此为自定义字段组合所需数据
+        String userName=req.getString("username");
+        String fieldData=req.getString("fielddata");
+//        String fieldCombine = req.getString("fieldcombine");
+        String fieldRemark = req.getString("remark");
+//        customizedModel.setModelName(modelName);
+//        customizedModel.setFieldClass("自定义模型");
+//        customizedModel.setIdList(fieldData);
+//        customizedModel.setCreatedBy(userName);
+//        customizedModel.setModelRemark(modelRemark);
+//        customizedModelService.save(customizedModel);
+
+        //yuan 将自定义字段加到customizedModel表中,还是启用customizedModel表,只给user_field表插入数据
+        UserField yUserField = new UserField();
+        yUserField.setFieldCombine(field_combine);
+        yUserField.setFieldRemark(fieldRemark);
+        yUserField.setUserName(userName);
+        yUserField.setFieldData(fieldData);
+        yUserField.setFieldState("审批中");
+        yUserField.setModelName("暂未指定");
+        userFieldService.save(yUserField);
+
+// 好像是初始的字段组合过滤逻辑,现在应该是弃用了
+//        String pate="朱家铎_410922199111210030_255632073002334212.txt";
+//        String Path="D:/jin_rong/test_data"+"/"+pate;
+//
+//        String s = readJsonFile(Path);
+//        JSONObject field_json = JSON.parseObject(s);
+//
+//
+//        JSONObject filter_json = JSON.parseObject(fieldData);
+//        JSONObject filter_dict = new JSONObject();
+//
+//        Iterator iter1 = filter_json.entrySet().iterator();
+//        while (iter1.hasNext()) {
+//            JSONObject field_dict = new JSONObject();
+//
+//            Map.Entry entry = (Map.Entry) iter1.next();
+//            String temp = entry.getValue().toString();
+//            temp = temp.substring(1,temp.length()-1);
+//            String[] strarray=temp.split(",");
+//
+//            for (int i = 0; i < strarray.length; i++){
+//                strarray[i] = strarray[i].substring(1,strarray[i].length()-1);
+//                field_dict.put(strarray[i], (field_json.getJSONObject(entry.getKey().toString())).getString(strarray[i]));
+//            }
+//
+//            filter_dict.put(entry.getKey().toString(),field_dict);
+//        }
+//        //System.out.println(filter_dict.toString());
+//
+//        FileOutputStream fileOutputStream = null;
+//        File file = new File("D:/jin_rong/test_data/result.json");
+//        if(!file.exists()){
+//            file.createNewFile();
+//        }
+//        fileOutputStream = new FileOutputStream(file);
+//        fileOutputStream.write(filter_dict.toString().getBytes("utf-8"));
+//        fileOutputStream.flush();
+//        fileOutputStream.close();
+
+// 此段代码注掉是因为新增字段组合有一个审批字段,默认为审批通过,但是新增的话会更新为审核中yuan
+
+//        UserField userField=userFieldService.findByUserName(userName);
+//        if(userField==null)
+//        {
+//            UserField new_field=new UserField();
+//            new_field.setUserName(userName);
+//            new_field.setFieldData(fieldData);
+//            new_field.setFieldState("审批中");
+//            userFieldService.save(new_field);
+//        }
+//        else
+//        {
+//            userField.setFieldData(fieldData);
+//            userField.setFieldState("审批中");
+//            userFieldService.updateById(userField);
+//        }
+//yuan
+        UserApproval approval=new UserApproval();
+        approval.setUserName(sysUser.getUserName());
+        approval.setApprovalId((long) 2);
+        approval.setData(field_combine);
+        approval.setFieldData(fieldData);
+        userApprovalService.save(approval);
+
+        return Result.success();
+
+    }
+
+    //yuan 前端获取user_field表的信息,但是在获取id时,会进行四舍五入操作导致id错误,因此通过字段组合名更新
+    @GetMapping("fieldCombineList")
+    public Result fieldCombineList() {
+        JSONObject resJson=new JSONObject();
+        List<UserField> list=userFieldService.list();
+        resJson.put("field_combine_list",list);
+        return Result.success("ok",resJson);
+
+    }
+    // sxr
+    @PostMapping("updateFieldCombineList")
+    public Result updateFieldCombineList(@RequestBody String json,SysUser sysUser) {
+        JSONObject req = JSON.parseObject(json);
+
+        long fieldId=Long.valueOf(req.getString("fieldId")) ;
+        String fieldCombine=req.getString("fieldCombine");
+        String choseData=req.getString("choseData");
+
+        UserField userField = userFieldService.findByID(fieldId);
+        userField.setFieldCombine(fieldCombine);
+        userField.setFieldData(choseData);
+        userFieldService.updateById(userField);
+        // TODO userApprovalService表更新 id需要改
+
+        return Result.success();
+    }
+
+    // sxr
+    @GetMapping("getFieldById")
+    public Result getFieldById(Long fieldId) {
+        System.out.println( fieldId);
+        JSONObject result = new JSONObject();
+        UserField userField = userFieldService.findByID(fieldId);
+
+        result.put("fieldCombine", userField.getFieldCombine());
+        //System.out.println(userField.getFieldCombine());
+
+        JSONObject fieldDateJson = new JSONObject();
+        String fieldData = userField.getFieldData();
+        fieldData = fieldData.substring(1,fieldData.length()-1);
+        String[] temp = fieldData.split("]");
+        for(int i=0;i< temp.length;i++)
+        {
+            System.out.println(temp[i]);
+            String key="";
+            if(i==0){  key = temp[i].split(":")[0].substring(1, temp[i].split(":")[0].length()-1);}
+            else{  key = temp[i].split(":")[0].substring(2, temp[i].split(":")[0].length()-1);}
+            String valuetmp[] = (temp[i].split(":")[1].substring(1).split(","));
+            String value[] = {};
+            for(int j=0;j<valuetmp.length;j++)
+            {
+
+                System.out.println( valuetmp[j]);
+                System.out.println(valuetmp[j].length());
+
+                valuetmp[j] = valuetmp[j].substring(1,valuetmp[j].length()-1);
+            }
+
+            fieldDateJson.put(key, valuetmp);
+
+        }
+        System.out.println(fieldDateJson);
+        result.put("fieldData",fieldDateJson);
+//        System.out.println(userField.getFieldData());
+        return Result.success("ok", result);
+    }
+
+
+    //过滤操作,也被弃用了
+//    @PostMapping("parse")
+//    public Result parse(@RequestBody String json) throws IOException {
+//        JSONObject req = JSON.parseObject(json);
+//        ParseResult parseResult = new ParseResult();
+////        此为自定义模型所需数据
+//        String fmodelName=req.getString("fmodelName");
+//        String createdBy=req.getString("createdBy");
+//        String idList=req.getString("idList");
+//        parseResult.setFmodelName(fmodelName);
+//        parseResult.setCreatedBy(createdBy);
+//
+//        //表示一个文件路径
+//        File file = new File("D:/jin_rong/todo/execed_txt");
+//        //用数组把文件夹下的文件存起来
+//        File[] files = file.listFiles();
+//        int l = files.length;
+//        System.out.println(l);
+//        String pates[] = new String[l];
+//        //foreach遍历数组
+//        for (int j=0;j<l;j++){
+//            pates[j] = files[j].getName();
+//            String pate=pates[j];
+//            String Path="D:/jin_rong/todo/execed_txt"+"/"+pate;
+//            String pathFilter = new String();
+//            pathFilter = "D:/jin_rong/test_data/logic/"+pate;
+//            parseResult.setReportName(pate);
+//            String s = readJsonFile(Path);
+//            JSONObject field_json = JSON.parseObject(s);
+//
+//
+//            JSONObject filter_json = JSON.parseObject(idList);
+//            JSONObject filter_dict = new JSONObject();
+//
+//            Iterator iter1 = filter_json.entrySet().iterator();
+//            while (iter1.hasNext()) {
+//                JSONObject field_dict = new JSONObject();
+//
+//                Map.Entry entry = (Map.Entry) iter1.next();
+//                String temp = entry.getValue().toString();
+//                temp = temp.substring(1,temp.length()-1);
+//                String[] strarray=temp.split(",");
+//
+//                for (int i = 0; i < strarray.length; i++){
+//                    strarray[i] = strarray[i].substring(1,strarray[i].length()-1);
+//                    field_dict.put(strarray[i], (field_json.getJSONObject(entry.getKey().toString())).getString(strarray[i]));
+//                }
+//
+//                filter_dict.put(entry.getKey().toString(),field_dict);
+//            }
+//            parseResult.setResultInfo(filter_dict.toString());
+//            parseResultService.save(parseResult);
+//
+//            FileOutputStream fileOutputStream = null;
+//
+//
+//            File fileFilter = new File(pathFilter);
+//            if(!fileFilter.exists()){
+//                fileFilter.createNewFile();
+//            }
+//            fileOutputStream = new FileOutputStream(fileFilter);
+//            fileOutputStream.write(filter_dict.toString().getBytes("utf-8"));
+//            fileOutputStream.flush();
+//            fileOutputStream.close();
+//
+//        }
+//
+//
+//        //System.out.println(filter_dict.toString());
+//
+//        return Result.success();
+//
+//    }
+
+    @GetMapping("getField")
+    public Result getField(SysUser sysUser)
+    {
+        JSONObject resJson = new JSONObject();
+        String userName=sysUser.getUserName();
+        UserField userField=userFieldService.findByUserName(userName);
+        if(userField==null)
+        {
+            resJson.put("fieldData","暂无申请字段");
+            resJson.put("fieldState","未配置字段");
+        }
+        else
+        {
+            resJson.put("fieldData",userField.getFieldData());
+            resJson.put("fieldState",userField.getFieldState());
+        }
+        return Result.success("ok",resJson);
+    }
+
+    @PostMapping("getFieldByName")
+    public Result getFieldByName(@RequestBody String json)
+    {
+        JSONObject req=JSON.parseObject(json);
+        JSONObject resJson = new JSONObject();
+        String userName= req.getString("username");
+        UserField userField=userFieldService.findByUserName(userName);
+        if(userField==null)
+        {
+            resJson.put("fieldData","暂无申请字段");
+            resJson.put("fieldState","未配置字段");
+        }
+        else
+        {
+            resJson.put("fieldData",userField.getFieldData());
+            resJson.put("fieldState",userField.getFieldState());
+        }
+        return Result.success("ok",resJson);
+    }
+
+
+    //新增自定义模型
+    @PostMapping("addModel")
+    public Result addModel(@RequestBody String json,SysUser sysUser) throws IOException {
+        //获取用户模型,并按json文件保存
+        JSONObject req = JSON.parseObject(json);
+        String model_name=req.getString("modelname");
+        JSONObject resJson = new JSONObject();
+        //添加异常判断,重名模型名?
+        if(userModelService.findByUserAndModel(sysUser.getUserName(),model_name)!=null) {
+            resJson.put("state", 0);
+            return Result.success("ok",resJson);
+        }
+        //非重名
+        resJson.put("state", 1);
+
+        String model_data=req.getString("modeldata");
+        JSONObject model_json=JSON.parseObject(model_data);
+
+//        String select_data = model_json.getJSONArray("select_data").toString();
+
+        String file_name=sysUser.getUserName()+"_"+model_name;
+        jsonFile.writerFile(model_json,file_name);
+
+        //  这个地方应该先加到审批页面上
+        UserApproval approval=new UserApproval();
+        approval.setUserName(sysUser.getUserName());
+        approval.setApprovalId((long) 1);
+        approval.setData(model_name);
+        userApprovalService.save(approval);
+        //写入数据库
+        String userName=sysUser.getUserName();
+        UserModel new_model=new UserModel();
+        new_model.setUserName(userName);
+        new_model.setModelName(model_name);
+        new_model.setModelType(0);
+        new_model.setModelState("审批中");
+        new_model.setFieldCombine("暂未指定");
+        new_model.setSelectData(model_data);
+        userModelService.save(new_model);
+
+
+        return Result.success("ok",resJson);
+
+    }
+    //列举usermodel
+    @GetMapping("getUserModel")
+    public Result getUserModel(SysUser sysUser)
+    {
+        JSONObject resJson=new JSONObject();
+        List<UserModel> model_list=userModelService.findByUserName(sysUser.getUserName());
+//        System.out.println(model_list.get(0).getId());
+        resJson.put("modelData", model_list);
+
+        return Result.success("ok",resJson);
+
+
+    }
+    //    获取当前模型
+    @PostMapping("getModelByName")
+    public Result getModelByName(@RequestBody String json,SysUser sysUser)
+    {
+
+        JSONObject resJson=new JSONObject();
+
+        JSONObject req = JSON.parseObject(json);
+
+        //user_name+model_name就是文件名
+        String model_name=req.getString("modelName");
+        String user_name=sysUser.getUserName();
+        //读取对应文件
+        JSONObject model=jsonFile.ReadJson(user_name+"_"+model_name);
+        System.out.println(model);
+
+//        resJson.put("model", model);
+
+        return Result.success("ok",resJson);
+
+    }
+
+
+    @PostMapping("changeModelByID")
+    public Result changeModelByID(@RequestBody String json,SysUser sysUser) throws IOException {
+        //获取参数
+        JSONObject resJson=new JSONObject();
+        JSONObject req=JSON.parseObject(json);
+        String model_name=req.getString("modelname");
+        String model_data=req.getString("modeldata");
+        long id=Long.parseLong( req.getString("modelid"));
+//        System.out.println(id);
+//        System.out.println(req.getString("modelid"));
+        UserModel model=userModelService.findByID(id);
+
+        //删除旧模型(文件)
+        String old_name=model.getModelName();
+
+
+        //新模型写入
+        JSONObject model_json=JSON.parseObject(model_data);
+        String file_name=sysUser.getUserName()+"_"+model_name;
+        jsonFile.writerFile(model_json,file_name);
+        model.setModelName(model_name);
+        model.setModelState("审批中");
+        //重新审批
+        UserApproval approval=new UserApproval();
+        approval.setUserName(sysUser.getUserName());
+        approval.setApprovalId((long) 1);
+        approval.setData(model_name);
+        userApprovalService.save(approval);
+
+        userModelService.updateById(model);
+
+
+
+        return Result.success();
+
+    }
+
+    //修改产品号
+    @PostMapping("changeProduct")
+    public Result changeProduct(@RequestBody String json,SysUser sysUser)
+    {
+        JSONObject req=JSON.parseObject(json);
+        long id= Long.parseLong(req.getString("modelid"));
+        String productNum=req.getString("productnum");
+        UserModel model=userModelService.findByID(id);
+        model.setProductNum(productNum);
+        userModelService.updateById(model);
+        return Result.success();
+
+    }
+
+    //yuan修改组合对应模型号
+    @PostMapping("combineReleModel")
+    public Result combineReleModel(@RequestBody String json,SysUser sysUser)
+    {
+        JSONObject req=JSON.parseObject(json);
+        String field_combine=req.getString("field_combine");
+        String modelName=req.getString("model_name");
+        UserField field=userFieldService.findByFieldCombine(field_combine);
+        UserModel model = userModelService.findByModelName(modelName);
+        model.setFieldCombine(field_combine);
+        field.setModelName(modelName);
+        userModelService.updateById(model);
+        userFieldService.updateById(field);
+        return Result.success();
+    }
+
+    //sxr编辑字段
+//    @PostMapping("combineFieldModel")
+//    public Result combineFieldModel(@RequestBody String json,SysUser sysUser)
+//    {
+//        JSONObject req=JSON.parseObject(json);
+//        String field_id=req.getString("field_id");
+//        String field_name=req.getString("field_name");
+//        String selected_field_data=req.getString("selected_field_data");
+//        String modelName=req.getString("model_name");
+//        UserField field=userFieldService.findByFieldCombine(field_combine);
+//        field.setModelName(modelName);
+//        userFieldService.updateById(field);
+//        return Result.success();
+//    }
+
+
+    //这个接口是将模型从审核通过/暂停改为上线
+//    审批中/已上线/审核通过/暂停使用
+    @PostMapping("changeState")
+    public Result changeState(@RequestBody String json,SysUser sysUser)
+    {
+        JSONObject req=JSON.parseObject(json);
+        long id= Long.parseLong(req.getString("modelid"));
+        String state=req.getString("modelstate");
+
+        System.out.println(id);
+        UserModel model=userModelService.findByID(id);
+
+        model.setModelState(state);
+
+        userModelService.updateById(model);
+
+        return Result.success();
+
+    }
+
+    @PostMapping("deleteModel")
+    public Result deleteModel(@RequestBody String json,SysUser sysUser)
+    {
+        JSONObject req=JSON.parseObject(json);
+        long id= Long.parseLong(req.getString("modelid"));
+        String fieldCombine = req.getString("fieldCombine");
+        if(fieldCombine.equals("暂未指定")){
+
+        }else{
+            UserField field=userFieldService.findByFieldCombine(fieldCombine);
+            field.setModelName("暂未指定");
+            userFieldService.updateById(field);
+        }
+
+
+        userModelService.removeModelByID(id);
+        return Result.success();
+
+    }
+
+    // 获取审核模块的详情,主要是模型详情
+    @PostMapping("getDetails")
+    public Result getDetails(@RequestBody String json)
+    {
+        JSONObject jsonrq=JSON.parseObject(json);
+        int type=jsonrq.getInteger("type");
+        if(type==1)
+        {
+            //首先获取对应模型
+            JSONObject res = new JSONObject();
+            String user_name=jsonrq.getString("username");
+            String model_name=jsonrq.getString("modelname");
+            UserModel model=userModelService.findByUserAndModel(user_name,model_name);
+            if(model==null)   return Result.error();
+            //模型类型
+            res.put("model_type",model.getModelType());
+            if(model.getModelType()==0) {//自定义模型
+                JSONObject model_data = jsonFile.ReadJson(user_name + "_" + model_name);
+                if (model_data != null) {
+                    res.put("error_code", 0);
+                    res.put("model_data", model_data);
+                } else {
+                    res.put("error_code", 1);
+                    res.put("error_info", "模型不存在!");
+
+                }
+            }
+            else if(model.getModelType()==1 || model.getModelType()==2)
+            {
+                res.put("output_list",model.getOutputList());
+                res.put("other_data",model.getOtherData());
+
+            }
+            return Result.success("ok",res);
+        }
+        else if(type==2)
+        {
+            //字段信息 直接获取 不用这一步
+//            JSONObject res = new JSONObject();
+//            String user_name=jsonrq.getString("username");
+//            String field_data=jsonrq.getString("modelname");
+
+        }
+        else
+        {
+
+        }
+        return Result.success();
+    }
+
+    @PostMapping("doApproval")
+    public Result doApproval(@RequestBody String json)
+    {
+        String reason_list[]={"错误字段选择","错误模型逻辑","其他"};
+        JSONObject jsonrq=JSON.parseObject(json);
+        int type=jsonrq.getInteger("type");
+        long id= Long.parseLong(jsonrq.getString("id"));
+
+        if(type==1)
+        {
+            JSONObject res = new JSONObject();
+            String user_name=jsonrq.getString("username");
+            String model_name=jsonrq.getString("data");
+            int pass=jsonrq.getInteger("pass");
+            //通过
+            if(pass==1)
+            {
+                UserModel model=userModelService.findByUserAndModel(user_name,model_name);
+                if(model!=null) {
+                    model.setModelState("审核通过");
+                    userModelService.updateById(model);
+                }
+            }
+            //不通过
+            else {
+                int reason=jsonrq.getInteger("reason");
+                UserModel model = userModelService.findByUserAndModel(user_name, model_name);
+                if(model!=null) {
+                    model.setModelState("审核不通过:"+reason_list[reason]);
+                    userModelService.updateById(model);
+                }
+            }
+        }
+        else if(type==2)
+        {
+            String user_name=jsonrq.getString("username");
+            String user_field=jsonrq.getString("data");
+            int pass=jsonrq.getInteger("pass");
+
+            System.out.println("审核了字段");
+            System.out.println(user_name);
+            if(pass==1)
+            {
+                UserField userField=userFieldService.findByFieldCombine(user_field);
+                if(userField!=null) {
+                    userField.setFieldState("审核通过");
+                    userFieldService.updateById(userField);
+                }
+
+            }
+            else {
+                UserField userField=userFieldService.findByUserName(user_name);
+                if(userField!=null) {
+                    userField.setFieldState("审核不通过");
+                    userFieldService.updateById(userField);
+                }
+            }
+        }
+        else
+        {
+
+        }
+        System.out.println(id);
+        userApprovalService.removeById(id);
+        return Result.success();
+    }
+
+}

+ 0 - 77
src/main/java/com/kexun/controller/PartnerController.java

@@ -1,77 +0,0 @@
-package com.kexun.controller;
-
-//import ch.qos.logback.core.rolling.helper.FileStoreUtil;
-//import ch.qos.logback.core.util.FileUtil;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.kexun.common.utils.Result;
-import com.kexun.entity.PartnerInfo;
-import com.kexun.service.PartnerInfoService;
-import lombok.extern.java.Log;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Date;
-import java.util.List;
-
-/*
-新添加
- * 目标:合作方相关操作接口
- * 目前:目前只有增、查合作方,
- 此外,由组合字段过滤到模型进行逻辑判断的整体的解析逻辑打通还需改动
- */
-
-@RestController
-@RequestMapping("/admin/partner")
-@Log
-public class PartnerController {
-
-    @Autowired
-    private PartnerInfoService PartnerInfoService;
-
-    @GetMapping("list")
-    public Result list(String partnerName) {
-        QueryWrapper<PartnerInfo> w = new QueryWrapper<>();
-        if (!StringUtils.isEmpty(partnerName)) {
-            w.like("partner_name", partnerName);
-        }
-
-        List<PartnerInfo> list = PartnerInfoService.list(w);
-        return Result.success("ok", list);
-    }
-
-    @PostMapping("partnerAdd")
-    @Transactional
-    public Result add(@RequestBody JSONObject param) {
-        String partnerName = param.getString("partnerName");
-        String contactName = param.getString("contactName");
-        String mobileNo = param.getString("mobileNo");
-        String rate1 = param.getString("rate1");
-        String queryNumber1 = param.getString("queryNumber1");
-        String rate2 = param.getString("rate2");
-        String queryNumber2 = param.getString("queryNumber2");
-        String rate3 = param.getString("rate3");
-        String queryNumber3 = param.getString("queryNumber3");
-        String isEnable = param.getString("isEnable");
-        PartnerInfo partnerInfo = new PartnerInfo();
-        partnerInfo.setPartnerName(partnerName);
-        partnerInfo.setContactName(contactName);
-        partnerInfo.setMobileNo(mobileNo);
-        partnerInfo.setRate1(rate1);
-        partnerInfo.setQueryNumber1(queryNumber1);
-        partnerInfo.setRate2(rate2);
-        partnerInfo.setQueryNumber2(queryNumber2);
-        partnerInfo.setRate3(rate3);
-        partnerInfo.setQueryNumber3(queryNumber3);
-        Date date = new Date();
-        partnerInfo.setCreateTime(date.toString());
-        partnerInfo.setIsEnable(isEnable);
-        PartnerInfoService.save(partnerInfo);
-
-        return Result.success();
-    }
-
-}

+ 37 - 0
src/main/java/com/kexun/entity/CooperatorInfo.java

@@ -0,0 +1,37 @@
+package com.kexun.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @TableName partner_info
+ */
+@TableName(value = "cooperator_info")
+@Data
+public class CooperatorInfo implements Serializable {
+
+    @TableField(value = "cooperator_num")
+    private String cooperatorNum;
+
+    @TableField(value = "cooperator_name")
+    private String cooperatorName;
+
+    @TableField(value = "field_count")
+    private String fieldCount;
+
+    @TableField(value = "model_count")
+    private String modelCount;
+
+    @TableField(value = "create_time")
+    private String createTime;
+
+
+
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 0 - 85
src/main/java/com/kexun/entity/PartnerInfo.java

@@ -1,85 +0,0 @@
-package com.kexun.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @TableName partner_info
- */
-@TableName(value = "partner_info")
-@Data
-public class PartnerInfo implements Serializable {
-    /**
-     * 模型名
-     */
-    @TableField(value = "partner_name")
-    private String partnerName;
-    /**
-     * 类别名
-     */
-    @TableField(value = "contact_name")
-    private String contactName;
-
-    /**
-     * 所选字段列表
-     */
-    @TableField(value = "mobile_no")
-    private String mobileNo;
-
-    /**
-     * 插入数据者
-     */
-    @TableField(value = "rate_1")
-    private String rate1;
-
-    /**
-     * 读数据者
-     */
-    @TableField(value = "query_number1")
-    private String queryNumber1;
-
-    /**
-     * 插入数据者
-     */
-    @TableField(value = "rate_2")
-    private String rate2;
-
-    /**
-     * 读数据者
-     */
-    @TableField(value = "query_number2")
-    private String queryNumber2;
-
-    /**
-     * 插入数据者
-     */
-    @TableField(value = "rate_3")
-    private String rate3;
-
-    /**
-     * 读数据者
-     */
-    @TableField(value = "query_number3")
-    private String queryNumber3;
-
-    /**
-     * 更新数据者
-     */
-    @TableField(value = "create_time")
-    private String createTime;
-
-    /**
-     * 删除数据者
-     */
-    @TableField(value = "is_enable")
-    private String isEnable;
-
-
-
-    @TableField(exist = false)
-    private static final long serialVersionUID = 1L;
-}

+ 16 - 16
src/main/java/com/kexun/mapper/PartnerInfoMapper.java → src/main/java/com/kexun/mapper/CooperatorInfoMapper.java

@@ -1,16 +1,16 @@
-package com.kexun.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.kexun.entity.PartnerInfo;
-
-/**
- * @Entity com.kexun.entity.PartnerInfo
- */
-public interface PartnerInfoMapper extends BaseMapper<PartnerInfo> {
-
-
-}
-
-
-
-
+package com.kexun.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.kexun.entity.CooperatorInfo;
+
+/**
+ * @Entity com.kexun.entity.PartnerInfo
+ */
+public interface CooperatorInfoMapper extends BaseMapper<CooperatorInfo> {
+
+
+}
+
+
+
+

+ 11 - 0
src/main/java/com/kexun/service/CooperatorInfoService.java

@@ -0,0 +1,11 @@
+package com.kexun.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.kexun.entity.CooperatorInfo;
+
+/**
+ *
+ */
+public interface CooperatorInfoService extends IService<CooperatorInfo> {
+}

+ 0 - 11
src/main/java/com/kexun/service/PartnerInfoService.java

@@ -1,11 +0,0 @@
-package com.kexun.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import com.kexun.entity.PartnerInfo;
-
-/**
- *
- */
-public interface PartnerInfoService extends IService<PartnerInfo> {
-}

+ 20 - 0
src/main/java/com/kexun/service/impl/CooperatorInfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.kexun.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.mapper.CooperatorInfoMapper;
+import com.kexun.service.CooperatorInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ */
+@Service
+public class CooperatorInfoServiceImpl extends ServiceImpl<CooperatorInfoMapper, CooperatorInfo>
+    implements CooperatorInfoService {
+
+}
+
+
+
+

+ 0 - 20
src/main/java/com/kexun/service/impl/PartnerInfoServiceImpl.java

@@ -1,20 +0,0 @@
-package com.kexun.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kexun.entity.PartnerInfo;
-import com.kexun.mapper.PartnerInfoMapper;
-import com.kexun.service.PartnerInfoService;
-import org.springframework.stereotype.Service;
-
-/**
- *
- */
-@Service
-public class PartnerInfoServiceImpl extends ServiceImpl<PartnerInfoMapper, PartnerInfo>
-    implements PartnerInfoService {
-
-}
-
-
-
-

+ 3 - 3
src/main/resources/application.yml

@@ -27,10 +27,10 @@ spring:
     timeout: 15000ms
   datasource:
     driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://39.101.189.130:33306/cr_loan?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false
+    url: jdbc:mysql://39.101.189.130:33306/cr_loan?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true
     type: com.alibaba.druid.pool.DruidDataSource
-    username: root
-    password: wdshy1gxf
+    username: credit
+    password: 1q2w3e4r
     # 初始化大小,最小,最大
     initialSize: 5
     minIdle: 5

+ 29 - 29
src/main/resources/mapper/PartnerInfoMapper.xml

@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.kexun.mapper.PartnerInfoMapper">
-
-    <resultMap id="BaseResultMap" type="com.kexun.entity.PartnerInfo">
-            <result property="partnerName" column="partner_name" jdbcType="VARCHAR"/>
-            <result property="contactName" column="contact_name" jdbcType="VARCHAR"/>
-            <result property="mobileNo" column="mobile_no" jdbcType="VARCHAR"/>
-            <result property="rate1" column="rate_1" jdbcType="VARCHAR"/>
-            <result property="queryNumber1" column="query_number1" jdbcType="VARCHAR"/>
-            <result property="rate2" column="rate_2" jdbcType="VARCHAR"/>
-            <result property="queryNumber2" column="query_number2" jdbcType="VARCHAR"/>
-            <result property="rate3" column="rate_3" jdbcType="VARCHAR"/>
-            <result property="queryNumber3" column="query_number3" jdbcType="VARCHAR"/>
-            <result property="createTime" column="create_time" jdbcType="VARCHAR"/>
-            <result property="isEnable" column="is_enable" jdbcType="VARCHAR"/>
-
-
-    </resultMap>
-
-    <sql id="Base_Column_List">partner_name,
-        contact_name,mobile_no,rate_1,
-        query_number1,rate_2,query_number2,
-        rate_3,query_number3,
-        create_time,is_enable
-    </sql>
-</mapper>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.kexun.mapper.CooperatorInfoMapper">
+
+    <resultMap id="BaseResultMap" type="com.kexun.entity.CooperatorInfo">
+            <result property="partnerName" column="partner_name" jdbcType="VARCHAR"/>
+            <result property="contactName" column="contact_name" jdbcType="VARCHAR"/>
+            <result property="mobileNo" column="mobile_no" jdbcType="VARCHAR"/>
+            <result property="rate1" column="rate_1" jdbcType="VARCHAR"/>
+            <result property="queryNumber1" column="query_number1" jdbcType="VARCHAR"/>
+            <result property="rate2" column="rate_2" jdbcType="VARCHAR"/>
+            <result property="queryNumber2" column="query_number2" jdbcType="VARCHAR"/>
+            <result property="rate3" column="rate_3" jdbcType="VARCHAR"/>
+            <result property="queryNumber3" column="query_number3" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="VARCHAR"/>
+            <result property="isEnable" column="is_enable" jdbcType="VARCHAR"/>
+
+
+    </resultMap>
+
+    <sql id="Base_Column_List">partner_name,
+        contact_name,mobile_no,rate_1,
+        query_number1,rate_2,query_number2,
+        rate_3,query_number3,
+        create_time,is_enable
+    </sql>
+</mapper>