Browse Source

Merge remote-tracking branch 'origin/develop' into develop

zishan-an 1 year ago
parent
commit
8bb685d45f

+ 1 - 1
src/main/java/com/kexun/common/User.java

@@ -57,7 +57,7 @@ public class User {
         if(model_list!=null) {
             for (int i = 0; i < model_list.size(); i++) {
                 model_name.add(model_list.get(i).getModelName());
-                model_state.add(model_list.get(i).getModelState());
+                model_state.add(model_list.get(i).getStatus());
             }
         }
         UserField userField=userFieldServices.findByUserName(user_name);

+ 59 - 55
src/main/java/com/kexun/controller/FileUploadController.java

@@ -49,22 +49,24 @@ public class FileUploadController {
     @Value("${config.fileupload.warpath}")
     private String warPath;
 
-//上传用户模型及审批结果
+    //上传用户模型及审批结果
     @PostMapping("/fileupload")
     @ResponseBody
     public Result upload2(@RequestParam Integer index, @RequestParam MultipartFile chunk, @RequestParam String name, @RequestParam Integer chunksLength, @RequestParam String uid
-    , @RequestParam String model_name, @RequestParam String model_type, @RequestParam String output_list, SysUser sysUser
-                          ) throws IOException {
+            , @RequestParam String model_name, @RequestParam String model_type, @RequestParam String output_list, SysUser sysUser
+    ) throws IOException {
         int type=Integer.parseInt(model_type);
-         if(type==1 || type==2)
+        if(type==1 || type==2)
         {
             String filename = name.split("\\.")[0];
             String filefmt = name.split("\\.")[1];
             String fullFileName = String.join("-", new String[] {filename, uid, index + "", "." + filefmt});
             log.info("filename:" + fullFileName);
             File dir = new File(fileuploadPath+ "/" +sysUser.getUserName()+"/");
+
             if (!dir.exists())
                 dir.mkdirs();
+
             File file = new File(fileuploadPath + "/" +sysUser.getUserName()+"/"+ fullFileName);
             FileCopyUtils.copy(chunk.getInputStream(), new FileOutputStream(file));
             FileUploadUtil.put(uid, index, chunksLength, fullFileName, fileuploadPath+ "/" +sysUser.getUserName()+"/");
@@ -81,76 +83,78 @@ public class FileUploadController {
             }
 
             //审批
-            UserApproval approval=new UserApproval();
-            approval.setUserName(sysUser.getUserName());
-            approval.setApprovalId((long) 1);
-            approval.setData(model_name);
-            userApprovalService.save(approval);
+//            UserApproval approval=new UserApproval();
+//            approval.setUserName(sysUser.getUserName());
+//            approval.setApprovalId((long) 1);
+//            approval.setData(model_name);
+//            userApprovalService.save(approval);
 
 
             //model 数据库连接接口
             String userName=sysUser.getUserName();
             UserModel new_model=new UserModel();
-            new_model.setUserName(userName);
+            new_model.setCreateBy(userName);
             new_model.setModelName(model_name);
             new_model.setModelType(type);
-            new_model.setModelState("审批中");
-            new_model.setOtherData(name);
-            new_model.setOutputList(output_list);
+            new_model.setStatus("暂停使用");
+//            new_model.setOtherData(name);
+//            new_model.setOutputList(output_list);
+            new_model.setFilePath(fileuploadPath + "/" +sysUser.getUserName()+"/"+ fullFileName);
             userModelService.save(new_model);
 
-            }
-            else
-            {
-                // http请求
-                String filename = name.split("\\.")[0];
-                String filefmt = name.split("\\.")[1];
-                String fullFileName = String.join("-", new String[] {filename, uid, index + "", "." + filefmt});
-                log.info("filename:" + fullFileName);
-                File dir = new File(warPath);
-                if (!dir.exists())
-                    dir.mkdirs();
-                File file = new File(warPath + "/" + fullFileName);
-                FileCopyUtils.copy(chunk.getInputStream(), new FileOutputStream(file));
-                FileUploadUtil.put(uid, index, chunksLength, fullFileName, warPath);
-                // 检测所有文件是否上传完成
-                boolean isAllChunksUploaded = FileUploadUtil.isAllChunksUploaded(uid);
-                //当前步骤这一步一定完成
-                try {
-                    if (isAllChunksUploaded) {
-                        FileUploadUtil.mergeChunks(name, uid);
-                    }
-                } catch (Exception ex) {
-                    ex.printStackTrace();
-                    throw new RuntimeException(ex.getMessage());
+        }
+        else
+        {
+            // http请求
+            String filename = name.split("\\.")[0];
+            String filefmt = name.split("\\.")[1];
+            String fullFileName = String.join("-", new String[] {filename, uid, index + "", "." + filefmt});
+            log.info("filename:" + fullFileName);
+            File dir = new File(warPath);
+            if (!dir.exists())
+                dir.mkdirs();
+            File file = new File(warPath + "/" + fullFileName);
+            FileCopyUtils.copy(chunk.getInputStream(), new FileOutputStream(file));
+            FileUploadUtil.put(uid, index, chunksLength, fullFileName, warPath);
+            // 检测所有文件是否上传完成
+            boolean isAllChunksUploaded = FileUploadUtil.isAllChunksUploaded(uid);
+            //当前步骤这一步一定完成
+            try {
+                if (isAllChunksUploaded) {
+                    FileUploadUtil.mergeChunks(name, uid);
                 }
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                throw new RuntimeException(ex.getMessage());
+            }
 
-                //审批
-                UserApproval approval=new UserApproval();
-                approval.setUserName(sysUser.getUserName());
-                approval.setApprovalId((long) 1);
+            //审批
+            UserApproval approval=new UserApproval();
+            approval.setUserName(sysUser.getUserName());
+            approval.setApprovalId((long) 1);
 
 
-                approval.setData(model_name.split(";")[0]);
+            approval.setData(model_name.split(";")[0]);
 
-                String url_address=model_name.split(";")[1];
+            String url_address=model_name.split(";")[1];
 
-                userApprovalService.save(approval);
+            userApprovalService.save(approval);
 
 
 
 
-                String userName=sysUser.getUserName();
-                UserModel new_model=new UserModel();
-                new_model.setUserName(userName);
-                new_model.setModelName(model_name);
-                new_model.setModelType(type);
-                new_model.setModelState("审批中");
-                new_model.setOtherData(name);
-                new_model.setOutputList(output_list);
-                userModelService.save(new_model);
-            }
-            return  Result.success();
+            String userName=sysUser.getUserName();
+            UserModel new_model=new UserModel();
+            new_model.setCreateBy(userName);
+            new_model.setModelName(model_name);
+            new_model.setModelType(type);
+            new_model.setStatus("暂停使用");
+//                new_model.setOtherData(name);
+//                new_model.setOutputList(output_list);
+            new_model.setFilePath(warPath + "/" + fullFileName);
+            userModelService.save(new_model);
+        }
+        return  Result.success();
     }
 
     @GetMapping("/get")

+ 19 - 19
src/main/java/com/kexun/controller/ModelController.java

@@ -432,12 +432,12 @@ public class ModelController {
         //写入数据库
         String userName=sysUser.getUserName();
         UserModel new_model=new UserModel();
-        new_model.setUserName(userName);
+        new_model.setCreateBy(userName);
         new_model.setModelName(model_name);
         new_model.setModelType(0);
-        new_model.setModelState("审批中");
-        new_model.setFieldCombine("暂未指定");
-        new_model.setSelectData(model_data);
+        new_model.setStatus("审批中");
+//        new_model.setFieldCombine("暂未指定");
+        new_model.setModelRule(model_data);
         userModelService.save(new_model);
 
 
@@ -500,7 +500,7 @@ public class ModelController {
         String file_name=sysUser.getUserName()+"_"+model_name;
         jsonFile.writerFile(model_json,file_name);
         model.setModelName(model_name);
-        model.setModelState("审批中");
+        model.setStatus("审批中");
         //重新审批
         UserApproval approval=new UserApproval();
         approval.setUserName(sysUser.getUserName());
@@ -524,7 +524,7 @@ public class ModelController {
         long id= Long.parseLong(req.getString("modelid"));
         String productNum=req.getString("productnum");
         UserModel model=userModelService.findByID(id);
-        model.setProductNum(productNum);
+        model.setModelNo(productNum);
         userModelService.updateById(model);
         return Result.success();
 
@@ -539,7 +539,7 @@ public class ModelController {
         String modelName=req.getString("model_name");
         UserField field=userFieldService.findByFieldCombine(field_combine);
         UserModel model = userModelService.findByModelName(modelName);
-        model.setFieldCombine(field_combine);
+//        model.setFieldCombine(field_combine);
         field.setModelName(modelName);
         userModelService.updateById(model);
         userFieldService.updateById(field);
@@ -574,7 +574,7 @@ public class ModelController {
         System.out.println(id);
         UserModel model=userModelService.findByID(id);
 
-        model.setModelState(state);
+        model.setStatus(state);
 
         userModelService.updateById(model);
 
@@ -588,13 +588,13 @@ public class ModelController {
         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);
-        }
+//        if(fieldCombine.equals("暂未指定")){
+//
+//        }else{
+//            UserField field=userFieldService.findByFieldCombine(fieldCombine);
+//            field.setModelName("暂未指定");
+//            userFieldService.updateById(field);
+//        }
 
 
         userModelService.removeModelByID(id);
@@ -631,8 +631,8 @@ public class ModelController {
             }
             else if(model.getModelType()==1 || model.getModelType()==2)
             {
-                res.put("output_list",model.getOutputList());
-                res.put("other_data",model.getOtherData());
+                //res.put("output_list",model.getOutputList());
+                //res.put("other_data",model.getOtherData());
 
             }
             return Result.success("ok",res);
@@ -671,7 +671,7 @@ public class ModelController {
             {
                 UserModel model=userModelService.findByUserAndModel(user_name,model_name);
                 if(model!=null) {
-                    model.setModelState("审核通过");
+                    model.setStatus("审核通过");
                     userModelService.updateById(model);
                 }
             }
@@ -680,7 +680,7 @@ public class ModelController {
                 int reason=jsonrq.getInteger("reason");
                 UserModel model = userModelService.findByUserAndModel(user_name, model_name);
                 if(model!=null) {
-                    model.setModelState("审核不通过:"+reason_list[reason]);
+                    model.setStatus("审核不通过:"+reason_list[reason]);
                     userModelService.updateById(model);
                 }
             }

+ 3 - 0
src/main/java/com/kexun/entity/CooperatorProduct.java

@@ -22,6 +22,9 @@ public class CooperatorProduct implements Serializable {
 
     private transient String modelName;
 
+    @TableField(value = "cooperator_num")
+    private String cooperatorNum;
+
     @TableField(value = "cooperator_name")
     private String cooperatorName;
 

+ 23 - 18
src/main/java/com/kexun/entity/UserModel.java

@@ -7,32 +7,31 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.Date;
 
-@TableName(value = "user_model")
+@TableName(value = "model")
 @Data
 public class UserModel implements Serializable {
     @JsonSerialize(using = ToStringSerializer.class)
     @TableId(value = "id")
     private Long id;
 
-    @TableField(value = "user_name")
-    private String userName;
+    @TableField(value = "create_by")
+    private String createBy;
 
     @TableField(value = "model_name")
     private String modelName;
 
-    @TableField(value = "field_combine")
-    private String fieldCombine;
+//    @TableField(value = "field_combine")
+//    private String fieldCombine;
 
+    @TableField(value = "model_no")
+    private String modelNo;
 
+    @TableField(value = "status")
+    private String status;
 
-    @TableField(value = "product_num")
-    private String productNum;
-
-    @TableField(value = "model_state")
-    private String modelState;
-
-//    0  自定义模型
+    //    0  自定义模型
 //    1  jar包
 //    2  python包
 //    3  http服务
@@ -40,14 +39,20 @@ public class UserModel implements Serializable {
     private int modelType;
 
 
-    @TableField(value = "other_data")
-    private String otherData;
+//    @TableField(value = "other_data")
+//    private String otherData;
+
+//    @TableField(value = "output_list")
+//    private String outputList;
+
+    @TableField(value = "model_rule")
+    private String modelRule;
 
-    @TableField(value = "output_list")
-    private String outputList;
+    @TableField(value = "file_path")
+    private String filePath;
 
-    @TableField(value = "select_data")
-    private String selectData;
+    @TableField(value = "create_time")
+    private String createTime;
 
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;

+ 0 - 7
src/main/java/com/kexun/service/impl/ModelDefineServiceImpl.java

@@ -1,18 +1,11 @@
 package com.kexun.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kexun.entity.CooperatorField;
-import com.kexun.entity.CooperatorProduct;
 import com.kexun.entity.ModelDefine;
-import com.kexun.mapper.CooperatorProductMapper;
 import com.kexun.mapper.ModelDefineMapper;
-import com.kexun.service.CooperatorProductService;
 import com.kexun.service.ModelDefineService;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
-import java.util.List;
-
 /**
  *
  */

+ 3 - 3
src/main/java/com/kexun/service/impl/UserModelServiceImpl.java

@@ -10,13 +10,13 @@ import org.springframework.stereotype.Service;
 import java.util.List;
 @Service
 public class UserModelServiceImpl extends ServiceImpl<UserModelMapper,UserModel>
-    implements UserModelService
+        implements UserModelService
 {
 
     @Override
     public List<UserModel> findByUserName(String user_name) {
 
-        QueryWrapper<UserModel> wrapper=new QueryWrapper<UserModel>().eq("user_name",user_name);
+        QueryWrapper<UserModel> wrapper=new QueryWrapper<UserModel>().eq("create_by",user_name);
         List<UserModel> model_list=list(wrapper);
         return model_list;
     }
@@ -34,7 +34,7 @@ public class UserModelServiceImpl extends ServiceImpl<UserModelMapper,UserModel>
 
     public UserModel findByUserAndModel(String user_name,String model_name)
     {
-        QueryWrapper<UserModel> wrapper=new QueryWrapper<UserModel>().eq("user_name",user_name);
+        QueryWrapper<UserModel> wrapper=new QueryWrapper<UserModel>().eq("create_by",user_name);
         wrapper.eq("model_name",model_name);
         return getOne(wrapper);
 

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

@@ -22,7 +22,7 @@ spring:
         max-idle: 8
         max-wait: -1ms
         min-idle: 0
-#    password: 123456
+    #    password: 123456
     port: 6379
     timeout: 15000ms
   datasource:
@@ -91,11 +91,11 @@ xxl:
       address:
       ### 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
       ip:
-        ### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
+      ### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
       port: 18888
-        ### 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
+      ### 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
       logpath: /Users/lgs/work/code/logs/xxl-job/
-        ### 执行器日志保存天数 [选填] :值大于3时生效,启用执行器Log文件定期清理功能,否则不生效;
+      ### 执行器日志保存天数 [选填] :值大于3时生效,启用执行器Log文件定期清理功能,否则不生效;
       logretentiondays: 7
       ### 执行器通讯TOKEN [选填]:非空时启用;
     accessToken: default_token

+ 38 - 36
src/main/resources/mapper/CooperatorProductMapper.xml

@@ -5,45 +5,47 @@
 <mapper namespace="com.kexun.mapper.CooperatorProductMapper">
 
     <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"/>
+        <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>
 
 
     <select id="Query" resultType="com.kexun.entity.CooperatorProduct">
-    SELECT DISTINCT
-           prd_product.product_num,
-           prd_product.product_name,
-           prd_product.product_status,
-            prd_product.cooperator_name,
-           prd_product.create_time,
-           model.model_name as modelName
-       FROM
-           prd_product
-               LEFT JOIN model ON model.model_no = prd_product.model_id
+        SELECT DISTINCT
+        prd_product.product_num,
+        prd_product.product_name,
+        prd_product.product_status,
+        prd_product.cooperator_num,
+        prd_product.cooperator_name,
+        prd_product.create_time,
+        prd_product.model_id,
+        model.model_name as modelName
+        FROM
+        prd_product
+        LEFT JOIN model ON model.model_no = prd_product.model_id
     </select>
 
     <select id="fieldQuery" resultType="com.kexun.entity.CooperatorField">
         SELECT DISTINCT
-            field_define.field_no,
-            field_define.`name`,
-            field_define.name_zh,
-            field_define.type,
-            field_define.create_time
+        field_define.field_no,
+        field_define.`name`,
+        field_define.name_zh,
+        field_define.type,
+        field_define.create_time
         FROM
-            field_define
-                LEFT JOIN product_field_ref ON product_field_ref.field_no = field_define.field_no
+        field_define
+        LEFT JOIN product_field_ref ON product_field_ref.field_no = field_define.field_no
         WHERE product_field_ref.product_num = #{productNum}
     </select>
 
@@ -62,15 +64,15 @@
     </select>
     <select id="findCooperatorFieldsQuery" resultType="com.kexun.entity.CooperatorField">
         SELECT DISTINCT
-            field_define.field_no,
-            field_define.`name`,
-            field_define.name_zh,
-            field_define.type,
-            field_define.create_time
+        field_define.field_no,
+        field_define.`name`,
+        field_define.name_zh,
+        field_define.type,
+        field_define.create_time
         FROM
-            field_define
-                RIGHT JOIN field_template_ref ON field_template_ref.field_no = field_define.field_no
-                LEFT JOIN cooperator_info ON cooperator_info.template_no=field_template_ref.template_no
+        field_define
+        RIGHT JOIN field_template_ref ON field_template_ref.field_no = field_define.field_no
+        LEFT JOIN cooperator_info ON cooperator_info.template_no=field_template_ref.template_no
         WHERE cooperator_info.cooperator_name = #{cooperatorName}
     </select>
 

+ 11 - 9
src/main/resources/mapper/UserModelMapper.xml

@@ -6,21 +6,23 @@
 
     <resultMap id="BaseResultMap" type="com.kexun.entity.UserModel">
         <id property="id" column="id" jdbcType="BIGINT"/>
-        <result property="userName" column="user_name" jdbcType="VARCHAR"/>
+        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
         <result property="modelName" column="model_name" jdbcType="VARCHAR"/>
-        <result property="fieldCombine" column="field_combine" jdbcType="VARCHAR"/>
-        <result property="productNum" column="product_num" jdbcType="VARCHAR"/>
-        <result property="modelState" column="model_state" jdbcType="VARCHAR"/>
+        <!--        <result property="fieldCombine" column="field_combine" jdbcType="VARCHAR"/>-->
+        <result property="modelNo" column="model_no" jdbcType="VARCHAR"/>
+        <result property="status" column="status" jdbcType="VARCHAR"/>
         <result property="modelType" column="model_type" jdbcType="BIGINT"/>
-        <result property="otherData" column="other_data" jdbcType="VARCHAR"/>
-        <result property="outputList" column="output_list" jdbcType="VARCHAR"/>
-        <result property="selectData" column="select_data" jdbcType="VARCHAR"/>
+        <!--        <result property="otherData" column="other_data" jdbcType="VARCHAR"/>-->
+        <!--        <result property="outputList" column="output_list" jdbcType="VARCHAR"/>-->
+        <result property="modelRule" column="model_rule" jdbcType="VARCHAR"/>
+        <result property="filePath" column="file_path" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
 
 
     </resultMap>
 
     <sql id="Base_Column_List">
-        id,user_name,model_name,field_combine,
-        product_num,model_state,model_type,other_data,output_list,select_data
+        id,create_by,model_name,
+        model_no,status,model_type,model_rule,file_path,create_time
     </sql>
 </mapper>