Quellcode durchsuchen

合作方新增编辑

shixr vor 1 Jahr
Ursprung
Commit
42f19b6868

+ 44 - 3
src/main/java/com/kexun/controller/CooperatorController.java

@@ -3,12 +3,11 @@ package com.kexun.controller;
 //import ch.qos.logback.core.rolling.helper.FileStoreUtil;
 //import ch.qos.logback.core.util.FileUtil;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.kexun.common.utils.Result;
-import com.kexun.entity.CooperatorField;
-import com.kexun.entity.CooperatorInfo;
-import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.*;
 import com.kexun.service.CooperatorService;
 import lombok.extern.java.Log;
 import org.apache.commons.lang.StringUtils;
@@ -16,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
 import java.util.List;
 
 /*
@@ -44,6 +45,46 @@ public class CooperatorController {
         return Result.success("ok",resJson);
     }
 
+    // 新增合作方
+    @PostMapping("add")
+    public Result cooperatorAdd(@RequestBody String json)
+    {
+        JSONObject req = JSON.parseObject(json);
+        CooperatorInfo cooperatorInfo = new CooperatorInfo();
+        cooperatorInfo.setCooperatorName(req.getString("cooperator_name"));
+        cooperatorInfo.setCorpCertificateNum(req.getString("corp_certificate_num"));
+        cooperatorInfo.setCorpCertificateType(req.getString("corp_certificate_type"));
+        cooperatorInfo.setTemplateNo(req.getString("field_template_no"));
+        Calendar calendar= Calendar.getInstance();
+        SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
+        cooperatorInfo.setCreateTime(dateFormat.format(calendar.getTime()));
+        // System.out.println(dateFormat.format(calendar.getTime()));
+        CooperatorService.save(cooperatorInfo);
+
+        return Result.success();
+    }
+
+    @PostMapping("edit")
+    public Result cooperatorEdit(@RequestBody String json)
+    {
+        JSONObject req = JSON.parseObject(json);
+        long cooperatorId=Long.valueOf(req.getString("cooperator_id")) ;
+//        System.out.println(cooperatorId);
+        CooperatorInfo cooperatorInfo = CooperatorService.findByID(cooperatorId);
+
+        cooperatorInfo.setCooperatorName(req.getString("cooperator_name"));
+        cooperatorInfo.setCorpCertificateNum(req.getString("corp_certificate_num"));
+        cooperatorInfo.setCorpCertificateType(req.getString("corp_certificate_type"));
+
+        Calendar calendar= Calendar.getInstance();
+        SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
+        cooperatorInfo.setUpdateTime(dateFormat.format(calendar.getTime()));
+
+        CooperatorService.updateById(cooperatorInfo);
+
+        return Result.success();
+    }
+
 //    @GetMapping("findCooperatorListByName")
 //    public Result findCooperatorListByName(String partnerName) {
 //

+ 46 - 0
src/main/java/com/kexun/controller/FieldTemplateController.java

@@ -0,0 +1,46 @@
+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.CooperatorField;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.FieldTemplate;
+import com.kexun.service.CooperatorService;
+import com.kexun.service.FieldTemplateService;
+import com.kexun.service.UserFieldService;
+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/fieldtemplate")
+@Log
+public class FieldTemplateController {
+
+    @Autowired
+    private FieldTemplateService FieldTemplateService;
+
+    // 获取字段模版信息
+    @GetMapping("fieldTemplateList")
+    public Result fieldTemplateList() {
+        JSONObject resJson=new JSONObject();
+        List<FieldTemplate> list= FieldTemplateService.list();
+        resJson.put("field_template_list",list);
+        System.out.println(list);
+
+        return Result.success("ok",resJson);
+    }
+
+
+
+}

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

@@ -465,7 +465,6 @@ public class ModelController {
         JSONObject resJson=new JSONObject();
 
         JSONObject req = JSON.parseObject(json);
-
         //user_name+model_name就是文件名
         String model_name=req.getString("modelName");
         String user_name=sysUser.getUserName();

+ 5 - 0
src/main/java/com/kexun/entity/CooperatorField.java

@@ -1,6 +1,7 @@
 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;
 
@@ -9,6 +10,10 @@ import java.io.Serializable;
 @Data
 public class CooperatorField implements Serializable {
 
+
+    @TableId(value = "id")
+    private Long id;
+
     @TableField(value = "field_no")
     private String fieldNo;
 

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

@@ -1,5 +1,6 @@
 package com.kexun.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -14,12 +15,26 @@ import java.io.Serializable;
 @Data
 public class CooperatorInfo implements Serializable {
 
+//    @TableId(value = "id" , type = IdType.AUTO)
+//    @TableField(value = "id")
+    private Long id;
+
+//    @TableId(value = "cooperator_num" , type = IdType.AUTO)
     @TableField(value = "cooperator_num")
     private String cooperatorNum;
 
     @TableField(value = "cooperator_name")
     private String cooperatorName;
 
+    @TableField(value = "corp_certificate_type")
+    private String corpCertificateType;
+
+    @TableField(value = "corp_certificate_num")
+    private String corpCertificateNum;
+
+    @TableField(value = "template_no")
+    private String templateNo;
+
     @TableField(value = "field_count")
     private String fieldCount;
 
@@ -29,6 +44,12 @@ public class CooperatorInfo implements Serializable {
     @TableField(value = "create_time")
     private String createTime;
 
+    @TableField(value = "update_by")
+    private String updateBy;
+
+    @TableField(value = "update_time")
+    private String updateTime;
+
 
 
 

+ 27 - 0
src/main/java/com/kexun/entity/FieldTemplate.java

@@ -0,0 +1,27 @@
+package com.kexun.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+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(value = "field_template")
+@Data
+public class FieldTemplate implements Serializable {
+
+    @TableId(value = "id" , type = IdType.AUTO)
+    private Long id;
+
+    @TableField(value = "template_no")
+    private String templateNo;
+
+    @TableField(value = "template_name")
+    private String templateName;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+}

+ 21 - 0
src/main/java/com/kexun/mapper/FieldTemplateMapper.java

@@ -0,0 +1,21 @@
+package com.kexun.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.FieldTemplate;
+
+import java.util.List;
+
+/**
+ * @Entity com.kexun.entity.PartnerInfo
+ */
+public interface FieldTemplateMapper extends BaseMapper<FieldTemplate> {
+
+
+}
+
+
+
+

+ 1 - 0
src/main/java/com/kexun/service/CooperatorService.java

@@ -17,4 +17,5 @@ public interface CooperatorService extends IService<CooperatorInfo> {
 //    List<CooperatorField> findCooperatorFieldByNum(String cooperatorNum);
     List<CooperatorField> findCooperatorFieldByNum();
     List<CooperatorProduct> findCooperatorProductByNum();
+    CooperatorInfo findByID(long id);
 }

+ 15 - 0
src/main/java/com/kexun/service/FieldTemplateService.java

@@ -0,0 +1,15 @@
+package com.kexun.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.kexun.entity.FieldTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *
+ */
+
+public interface FieldTemplateService extends IService<FieldTemplate> {
+
+}

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.kexun.entity.CooperatorField;
 import com.kexun.entity.CooperatorInfo;
 import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.UserField;
 import com.kexun.mapper.CooperatorMapper;
 import com.kexun.service.CooperatorService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +44,12 @@ public class CooperatorServiceImpl extends ServiceImpl<CooperatorMapper, Coopera
         return l;
     }
 
+    @Override
+    public CooperatorInfo findByID(long id) {
+        QueryWrapper<CooperatorInfo> wrapper=new QueryWrapper<CooperatorInfo>().eq("id",id);
+        return getOne(wrapper);
+    }
+
 }
 
 

+ 29 - 0
src/main/java/com/kexun/service/impl/FieldTemplateServiceImpl.java

@@ -0,0 +1,29 @@
+package com.kexun.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kexun.entity.CooperatorField;
+import com.kexun.entity.CooperatorInfo;
+import com.kexun.entity.CooperatorProduct;
+import com.kexun.entity.FieldTemplate;
+import com.kexun.mapper.CooperatorMapper;
+import com.kexun.mapper.FieldTemplateMapper;
+import com.kexun.service.CooperatorService;
+import com.kexun.service.FieldTemplateService;
+import org.springframework.stereotype.Service;
+
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ *
+ */
+@Service
+public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, FieldTemplate> implements FieldTemplateService {
+
+}
+
+
+
+

+ 16 - 0
src/main/resources/mapper/FieldTemplateMapper.xml

@@ -0,0 +1,16 @@
+<?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.FieldTemplateMapper">
+
+    <resultMap id="BaseResultMap" type="com.kexun.entity.FieldTemplate">
+        <id property="id" column="id" jdbcType="BIGINT"/>
+        <result property="templateNo" column="template_no" jdbcType="VARCHAR"/>
+        <result property="templateNum" column="template_name" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,template_no,template_name
+    </sql>
+</mapper>