|
@@ -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) {
|
|
|
//
|