Browse Source

bug修改

zishan-an 1 year ago
parent
commit
c9398fe823

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

@@ -37,9 +37,12 @@ public class CooperatorController {
     private CooperatorService CooperatorService;
     private CooperatorService CooperatorService;
 
 
     // 获取合作方信息
     // 获取合作方信息
-    @GetMapping("cooperatorList")
-    public Result cooperatorList(@RequestParam int pageNum) {
-        int pageSize = 10;
+    @RequestMapping("cooperatorList")
+
+    public Result cooperatorList(@RequestBody String json) {
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         JSONObject resJson=new JSONObject();
         JSONObject resJson=new JSONObject();
         List<CooperatorInfo> list= CooperatorService.selectPage();
         List<CooperatorInfo> list= CooperatorService.selectPage();

+ 6 - 3
src/main/java/com/kexun/controller/CooperatorProductController.java

@@ -28,9 +28,12 @@ public class CooperatorProductController {
     private CooperatorProductService CooperatorProductService;
     private CooperatorProductService CooperatorProductService;
 
 
     // 获取合作产品信息
     // 获取合作产品信息
-    @GetMapping("cooperatorProductList")
-    public Result cooperatorProductList(@RequestParam int pageNum) {
-        int pageSize = 10;
+    @RequestMapping("cooperatorProductList")
+
+    public Result cooperatorProductList(@RequestBody String json) {
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         JSONObject resJson=new JSONObject();
         JSONObject resJson=new JSONObject();
         List<CooperatorProduct> list=CooperatorProductService.selectPage();
         List<CooperatorProduct> list=CooperatorProductService.selectPage();

+ 13 - 6
src/main/java/com/kexun/controller/FieldDefineController.java

@@ -1,6 +1,7 @@
 package com.kexun.controller;
 package com.kexun.controller;
 
 
 
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
@@ -55,8 +56,10 @@ public class FieldDefineController {
 
 
     @RequestMapping("/fieldListNew")
     @RequestMapping("/fieldListNew")
     @ResponseBody
     @ResponseBody
-    public Result findAll(@RequestParam int pageNum){
-        int pageSize = 10;
+    public Result findAll(@RequestBody String json){
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         List<FieldDefineEntity> list = fieldDefineService.selectPage();
         List<FieldDefineEntity> list = fieldDefineService.selectPage();
 
 
@@ -78,8 +81,10 @@ public class FieldDefineController {
 
 
     @RequestMapping("/fieldListBase")
     @RequestMapping("/fieldListBase")
     @ResponseBody
     @ResponseBody
-    public Result fieldListBase(@RequestParam int pageNum){
-        int pageSize = 10;
+    public Result fieldListBase(@RequestBody String json){
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         List<FieldDefineEntity> list = fieldDefineService.selectPage();
         List<FieldDefineEntity> list = fieldDefineService.selectPage();
 
 
@@ -95,8 +100,10 @@ public class FieldDefineController {
 
 
     @RequestMapping("/fieldListDerive")
     @RequestMapping("/fieldListDerive")
     @ResponseBody
     @ResponseBody
-    public Result fieldListDerive(@RequestParam int pageNum){
-        int pageSize = 10;
+    public Result fieldListDerive(@RequestBody String json){
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
 
 
         List<FieldDefineEntity> list2 = fieldDefineService.selectPage2();
         List<FieldDefineEntity> list2 = fieldDefineService.selectPage2();

+ 7 - 3
src/main/java/com/kexun/controller/FieldTemplateController.java

@@ -1,6 +1,7 @@
 package com.kexun.controller;
 package com.kexun.controller;
 
 
 
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
@@ -58,8 +59,11 @@ public class FieldTemplateController {
 
 
     @RequestMapping("/findAll")
     @RequestMapping("/findAll")
     @ResponseBody
     @ResponseBody
-    public Result findAll(@RequestParam int pageNum){
-        int pageSize = 10;
+    public Result findAll(@RequestBody String json){
+        JSONObject req = JSON.parseObject(json);
+        int pageNum = req.getIntValue("pageNum");
+        int pageSize = req.getIntValue("pageSize");
+
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         PageHelper.startPage(pageNum, pageSize);//设置分页信息
         List<FieldTemplateEntity> list = fieldTemplateService.selectPage();
         List<FieldTemplateEntity> list = fieldTemplateService.selectPage();
         PageInfo pageInfo=new PageInfo(list);
         PageInfo pageInfo=new PageInfo(list);
@@ -113,7 +117,7 @@ public class FieldTemplateController {
     public Result update(@RequestBody FiledTemplateUpdateRO filedTemplateUpdateRO) {
     public Result update(@RequestBody FiledTemplateUpdateRO filedTemplateUpdateRO) {
         Result result = new Result();
         Result result = new Result();
         if (null != filedTemplateUpdateRO.getId()) {
         if (null != filedTemplateUpdateRO.getId()) {
-            fieldTemplateService.saveOrUpdate(filedTemplateUpdateRO);
+            fieldTemplateService.newUpdate(filedTemplateUpdateRO);
         } else {
         } else {
             return Result.error(-1, "id不存在");
             return Result.error(-1, "id不存在");
         }
         }

+ 1 - 1
src/main/java/com/kexun/service/FieldTemplateService.java

@@ -37,7 +37,7 @@ public interface FieldTemplateService extends IService<FieldTemplateEntity> {
      * 修改
      * 修改
      * @param filedTemplateUpdateRO
      * @param filedTemplateUpdateRO
      */
      */
-    void saveOrUpdate(FiledTemplateUpdateRO filedTemplateUpdateRO);
+    void newUpdate(FiledTemplateUpdateRO filedTemplateUpdateRO);
 
 
     /**
     /**
      * 修改
      * 修改

+ 8 - 16
src/main/java/com/kexun/service/impl/FieldTemplateServiceImpl.java

@@ -107,7 +107,7 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
                 fieldTemplateRefList.add(fieldTemplateRefEntity);
                 fieldTemplateRefList.add(fieldTemplateRefEntity);
             }
             }
             for (int i=0;i<fieldSelected2.size();i++){
             for (int i=0;i<fieldSelected2.size();i++){
-                Long fid = Long.parseLong(fieldSelected.get(i));
+                Long fid = Long.parseLong(fieldSelected2.get(i));
                 FieldDefineEntity fieldDefine = fieldDefineService.findByID(fid);
                 FieldDefineEntity fieldDefine = fieldDefineService.findByID(fid);
                 FieldTemplateRefEntity fieldTemplateRefEntity = new FieldTemplateRefEntity();
                 FieldTemplateRefEntity fieldTemplateRefEntity = new FieldTemplateRefEntity();
                 fieldTemplateRefEntity.setIsDeleted(false);
                 fieldTemplateRefEntity.setIsDeleted(false);
@@ -141,23 +141,15 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
      * @param filedTemplateUpdateRO
      * @param filedTemplateUpdateRO
      */
      */
     @Override
     @Override
-    public void saveOrUpdate(FiledTemplateUpdateRO filedTemplateUpdateRO) {
+    public void newUpdate(FiledTemplateUpdateRO filedTemplateUpdateRO) {
         Long id = filedTemplateUpdateRO.getId();
         Long id = filedTemplateUpdateRO.getId();
-        FieldTemplateEntity templateEntity = getById(id);
-        FieldTemplateEntity FieldTemplateEntity = new FieldTemplateEntity();
-        List<FiledUpdateRO> filedList = filedTemplateUpdateRO.getFieldSelected();
-        System.out.println(filedList);
-        if (null != templateEntity) {
-            BeanUtils.copyProperties(filedTemplateUpdateRO,FieldTemplateEntity);
-
-            updateById(FieldTemplateEntity);
-        }else {
-            long time1 = System.currentTimeMillis();
-            filedTemplateUpdateRO.setTemplateNo(Long.toString(time1));
-            BeanUtils.copyProperties(filedTemplateUpdateRO,FieldTemplateEntity);
-            save(FieldTemplateEntity);
+        FieldTemplateEntity fieldTemplateEntity = new FieldTemplateEntity();
+        fieldTemplateEntity.setTemplateNo(filedTemplateUpdateRO.getTemplateNo());
+        fieldTemplateEntity.setTemplateName(filedTemplateUpdateRO.getTemplateName());
+        BeanUtils.copyProperties(filedTemplateUpdateRO,fieldTemplateEntity);
+        updateById(fieldTemplateEntity);
+
         }
         }
-    }
 
 
     /**
     /**
      * 修改模板
      * 修改模板