yuansh пре 1 недеља
родитељ
комит
b9a73e1bc6

+ 152 - 114
srm-module-code/src/main/java/com/cuidian/srm/baseCode/controller/BaseProductArchiveController.java

@@ -10,6 +10,9 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.query.QueryRuleEnum;
@@ -39,125 +42,160 @@ import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
- /**
+/**
  * @Description: 产品档案
  * @Author: jeecg-boot
- * @Date:   2024-11-05
+ * @Date: 2024-11-05
  * @Version: V1.0
  */
-@Api(tags="产品档案")
+@Api(tags = "产品档案")
 @RestController
 @RequestMapping("/baseCode/baseProductArchive")
 @Slf4j
 public class BaseProductArchiveController extends JeecgController<BaseProductArchive, IBaseProductArchiveService> {
-	@Autowired
-	private IBaseProductArchiveService baseProductArchiveService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param baseProductArchive
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "产品档案分页列表查询")
-	@ApiOperation(value="产品档案分页列表查询", notes="产品档案分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<BaseProductArchive>> queryPageList(BaseProductArchive baseProductArchive,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
+    @Autowired
+    private IBaseProductArchiveService baseProductArchiveService;
+    @Autowired
+    private ISerialPatternService serialPatternService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param baseProductArchive
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "产品档案分页列表查询")
+    @ApiOperation(value = "产品档案分页列表查询", notes = "产品档案分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BaseProductArchive>> queryPageList(BaseProductArchive baseProductArchive,
+                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                           HttpServletRequest req) {
         QueryWrapper<BaseProductArchive> queryWrapper = QueryGenerator.initQueryWrapper(baseProductArchive, req.getParameterMap());
-		Page<BaseProductArchive> page = new Page<BaseProductArchive>(pageNo, pageSize);
-		IPage<BaseProductArchive> pageList = baseProductArchiveService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param baseProductArchive
-	 * @return
-	 */
-	@AutoLog(value = "产品档案添加")
-	@ApiOperation(value="产品档案添加", notes="产品档案添加")
-	@RequiresPermissions("baseCode:base_product_archive:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody BaseProductArchive baseProductArchive) {
-		baseProductArchiveService.save(baseProductArchive);
-		return Result.OK("添加成功!");
-	}
-	
-	/**
-	 *  编辑
-	 *
-	 * @param baseProductArchive
-	 * @return
-	 */
-	@AutoLog(value = "产品档案编辑")
-	@ApiOperation(value="产品档案编辑", notes="产品档案编辑")
-	@RequiresPermissions("baseCode:base_product_archive:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody BaseProductArchive baseProductArchive) {
-		baseProductArchiveService.updateById(baseProductArchive);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "产品档案通过id删除")
-	@ApiOperation(value="产品档案通过id删除", notes="产品档案通过id删除")
-	@RequiresPermissions("baseCode:base_product_archive:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		baseProductArchiveService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "产品档案批量删除")
-	@ApiOperation(value="产品档案批量删除", notes="产品档案批量删除")
-	@RequiresPermissions("baseCode:base_product_archive:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.baseProductArchiveService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "产品档案通过id查询")
-	@ApiOperation(value="产品档案通过id查询", notes="产品档案通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<BaseProductArchive> queryById(@RequestParam(name="id",required=true) String id) {
-		BaseProductArchive baseProductArchive = baseProductArchiveService.getById(id);
-		if(baseProductArchive==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(baseProductArchive);
-	}
+        Page<BaseProductArchive> page = new Page<BaseProductArchive>(pageNo, pageSize);
+        IPage<BaseProductArchive> pageList = baseProductArchiveService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param baseProductArchive
+     * @return
+     */
+    @AutoLog(value = "产品档案添加")
+    @ApiOperation(value = "产品档案添加", notes = "产品档案添加")
+    @RequiresPermissions("baseCode:base_product_archive:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody BaseProductArchive baseProductArchive) {
+
+        String code = baseProductArchive.getCode();
+        if (StringUtils.isNotBlank(code)) {
+
+            QueryWrapper<BaseProductArchive> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("code", code);
+            queryWrapper.eq("del_flag", "0");
+
+            List<BaseProductArchive> list = baseProductArchiveService.list(queryWrapper);
+            if (list.size() != 0) {
+                return Result.error("产品档案编码重复,请修改!");
+            }
+        } else {
+
+            Result<String> result = serialPatternService.getNextSerial("base_product_archive", "code");
+            if (!result.isSuccess()) {
+                return result;
+            }
+            baseProductArchive.setCode(result.getMessage());
+        }
+
+        baseProductArchiveService.save(baseProductArchive);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param baseProductArchive
+     * @return
+     */
+    @AutoLog(value = "产品档案编辑")
+    @ApiOperation(value = "产品档案编辑", notes = "产品档案编辑")
+    @RequiresPermissions("baseCode:base_product_archive:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody BaseProductArchive baseProductArchive) {
+
+        String code = baseProductArchive.getCode();
+        QueryWrapper<BaseProductArchive> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("code", code);
+        queryWrapper.eq("del_flag", "0");
+        queryWrapper.notIn("id", baseProductArchive.getId());
+
+        List<BaseProductArchive> list = baseProductArchiveService.list(queryWrapper);
+        if (list.size() != 0) {
+            return Result.error("产品档案编码重复,请修改!");
+        }
+
+        baseProductArchiveService.updateById(baseProductArchive);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "产品档案通过id删除")
+    @ApiOperation(value = "产品档案通过id删除", notes = "产品档案通过id删除")
+    @RequiresPermissions("baseCode:base_product_archive:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        baseProductArchiveService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "产品档案批量删除")
+    @ApiOperation(value = "产品档案批量删除", notes = "产品档案批量删除")
+    @RequiresPermissions("baseCode:base_product_archive:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.baseProductArchiveService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "产品档案通过id查询")
+    @ApiOperation(value = "产品档案通过id查询", notes = "产品档案通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BaseProductArchive> queryById(@RequestParam(name = "id", required = true) String id) {
+        BaseProductArchive baseProductArchive = baseProductArchiveService.getById(id);
+        if (baseProductArchive == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(baseProductArchive);
+    }
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param baseProductArchive
-    */
+     * 导出excel
+     *
+     * @param request
+     * @param baseProductArchive
+     */
     @RequiresPermissions("baseCode:base_product_archive:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, BaseProductArchive baseProductArchive) {
@@ -165,12 +203,12 @@ public class BaseProductArchiveController extends JeecgController<BaseProductArc
     }
 
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("baseCode:base_product_archive:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

+ 151 - 114
srm-module-code/src/main/java/com/cuidian/srm/baseCode/controller/BaseProductClassController.java

@@ -13,6 +13,8 @@ import javax.servlet.http.HttpServletResponse;
 
 import com.cuidian.srm.baseCode.entity.BaseProductClass;
 import com.cuidian.srm.baseCode.service.IBaseProductClassService;
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.query.QueryRuleEnum;
@@ -40,125 +42,160 @@ import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
- /**
+/**
  * @Description: 产品分类
  * @Author: jeecg-boot
- * @Date:   2024-11-05
+ * @Date: 2024-11-05
  * @Version: V1.0
  */
-@Api(tags="产品分类")
+@Api(tags = "产品分类")
 @RestController
 @RequestMapping("/baseCode/baseProductClass")
 @Slf4j
 public class BaseProductClassController extends JeecgController<BaseProductClass, IBaseProductClassService> {
-	@Autowired
-	private IBaseProductClassService baseProductClassService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param baseProductClass
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "产品分类-分页列表查询")
-	@ApiOperation(value="产品分类-分页列表查询", notes="产品分类-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<BaseProductClass>> queryPageList(BaseProductClass baseProductClass,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
+    @Autowired
+    private IBaseProductClassService baseProductClassService;
+    @Autowired
+    private ISerialPatternService serialPatternService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param baseProductClass
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "产品分类-分页列表查询")
+    @ApiOperation(value = "产品分类-分页列表查询", notes = "产品分类-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BaseProductClass>> queryPageList(BaseProductClass baseProductClass,
+                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                         HttpServletRequest req) {
         QueryWrapper<BaseProductClass> queryWrapper = QueryGenerator.initQueryWrapper(baseProductClass, req.getParameterMap());
-		Page<BaseProductClass> page = new Page<BaseProductClass>(pageNo, pageSize);
-		IPage<BaseProductClass> pageList = baseProductClassService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param baseProductClass
-	 * @return
-	 */
-	@AutoLog(value = "产品分类-添加")
-	@ApiOperation(value="产品分类-添加", notes="产品分类-添加")
-	@RequiresPermissions("baseCode:base_product_class:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody BaseProductClass baseProductClass) {
-		baseProductClassService.save(baseProductClass);
-		return Result.OK("添加成功!");
-	}
-	
-	/**
-	 *  编辑
-	 *
-	 * @param baseProductClass
-	 * @return
-	 */
-	@AutoLog(value = "产品分类-编辑")
-	@ApiOperation(value="产品分类-编辑", notes="产品分类-编辑")
-	@RequiresPermissions("baseCode:base_product_class:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody BaseProductClass baseProductClass) {
-		baseProductClassService.updateById(baseProductClass);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "产品分类-通过id删除")
-	@ApiOperation(value="产品分类-通过id删除", notes="产品分类-通过id删除")
-	@RequiresPermissions("baseCode:base_product_class:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		baseProductClassService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "产品分类-批量删除")
-	@ApiOperation(value="产品分类-批量删除", notes="产品分类-批量删除")
-	@RequiresPermissions("baseCode:base_product_class:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.baseProductClassService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "产品分类-通过id查询")
-	@ApiOperation(value="产品分类-通过id查询", notes="产品分类-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<BaseProductClass> queryById(@RequestParam(name="id",required=true) String id) {
-		BaseProductClass baseProductClass = baseProductClassService.getById(id);
-		if(baseProductClass==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(baseProductClass);
-	}
+        Page<BaseProductClass> page = new Page<BaseProductClass>(pageNo, pageSize);
+        IPage<BaseProductClass> pageList = baseProductClassService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param baseProductClass
+     * @return
+     */
+    @AutoLog(value = "产品分类-添加")
+    @ApiOperation(value = "产品分类-添加", notes = "产品分类-添加")
+    @RequiresPermissions("baseCode:base_product_class:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody BaseProductClass baseProductClass) {
+
+        String code = baseProductClass.getCode();
+        if (StringUtils.isNotBlank(code)) {
+
+            QueryWrapper<BaseProductClass> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("code", code);
+            queryWrapper.eq("del_flag", "0");
+
+            List<BaseProductClass> list = baseProductClassService.list(queryWrapper);
+            if (list.size() != 0) {
+                return Result.error("产品分类编码重复,请修改!");
+            }
+        } else {
+
+            Result<String> result = serialPatternService.getNextSerial("cusp_intermediator", "code");
+            if (!result.isSuccess()) {
+                return result;
+            }
+            baseProductClass.setCode(result.getMessage());
+        }
+
+        baseProductClassService.save(baseProductClass);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param baseProductClass
+     * @return
+     */
+    @AutoLog(value = "产品分类-编辑")
+    @ApiOperation(value = "产品分类-编辑", notes = "产品分类-编辑")
+    @RequiresPermissions("baseCode:base_product_class:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody BaseProductClass baseProductClass) {
+
+        String code = baseProductClass.getCode();
+        QueryWrapper<BaseProductClass> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("code", code);
+        queryWrapper.eq("del_flag", "0");
+        queryWrapper.notIn("id", baseProductClass.getId());
+
+        List<BaseProductClass> list = baseProductClassService.list(queryWrapper);
+        if (list.size() != 0) {
+            return Result.error("产品分类编码重复,请修改!");
+        }
+
+        baseProductClassService.updateById(baseProductClass);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "产品分类-通过id删除")
+    @ApiOperation(value = "产品分类-通过id删除", notes = "产品分类-通过id删除")
+    @RequiresPermissions("baseCode:base_product_class:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        baseProductClassService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "产品分类-批量删除")
+    @ApiOperation(value = "产品分类-批量删除", notes = "产品分类-批量删除")
+    @RequiresPermissions("baseCode:base_product_class:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.baseProductClassService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "产品分类-通过id查询")
+    @ApiOperation(value = "产品分类-通过id查询", notes = "产品分类-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BaseProductClass> queryById(@RequestParam(name = "id", required = true) String id) {
+        BaseProductClass baseProductClass = baseProductClassService.getById(id);
+        if (baseProductClass == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(baseProductClass);
+    }
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param baseProductClass
-    */
+     * 导出excel
+     *
+     * @param request
+     * @param baseProductClass
+     */
     @RequiresPermissions("baseCode:base_product_class:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, BaseProductClass baseProductClass) {
@@ -166,12 +203,12 @@ public class BaseProductClassController extends JeecgController<BaseProductClass
     }
 
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("baseCode:base_product_class:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

+ 153 - 114
srm-module-code/src/main/java/com/cuidian/srm/baseCode/controller/BaseProjectArchiveController.java

@@ -10,6 +10,10 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import com.cuidian.srm.baseCode.entity.BaseProductArchive;
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.query.QueryRuleEnum;
@@ -39,125 +43,160 @@ import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
- /**
+/**
  * @Description: 项目档案
  * @Author: jeecg-boot
- * @Date:   2024-11-05
+ * @Date: 2024-11-05
  * @Version: V1.0
  */
-@Api(tags="项目档案")
+@Api(tags = "项目档案")
 @RestController
 @RequestMapping("/baseCode/baseProjectArchive")
 @Slf4j
 public class BaseProjectArchiveController extends JeecgController<BaseProjectArchive, IBaseProjectArchiveService> {
-	@Autowired
-	private IBaseProjectArchiveService baseProjectArchiveService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param baseProjectArchive
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "项目档案-分页列表查询")
-	@ApiOperation(value="项目档案-分页列表查询", notes="项目档案-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<BaseProjectArchive>> queryPageList(BaseProjectArchive baseProjectArchive,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
+    @Autowired
+    private IBaseProjectArchiveService baseProjectArchiveService;
+    @Autowired
+    private ISerialPatternService serialPatternService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param baseProjectArchive
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "项目档案-分页列表查询")
+    @ApiOperation(value = "项目档案-分页列表查询", notes = "项目档案-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BaseProjectArchive>> queryPageList(BaseProjectArchive baseProjectArchive,
+                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                           HttpServletRequest req) {
         QueryWrapper<BaseProjectArchive> queryWrapper = QueryGenerator.initQueryWrapper(baseProjectArchive, req.getParameterMap());
-		Page<BaseProjectArchive> page = new Page<BaseProjectArchive>(pageNo, pageSize);
-		IPage<BaseProjectArchive> pageList = baseProjectArchiveService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param baseProjectArchive
-	 * @return
-	 */
-	@AutoLog(value = "项目档案-添加")
-	@ApiOperation(value="项目档案-添加", notes="项目档案-添加")
-	@RequiresPermissions("baseCode:base_project_archive:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody BaseProjectArchive baseProjectArchive) {
-		baseProjectArchiveService.save(baseProjectArchive);
-		return Result.OK("添加成功!");
-	}
-	
-	/**
-	 *  编辑
-	 *
-	 * @param baseProjectArchive
-	 * @return
-	 */
-	@AutoLog(value = "项目档案-编辑")
-	@ApiOperation(value="项目档案-编辑", notes="项目档案-编辑")
-	@RequiresPermissions("baseCode:base_project_archive:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody BaseProjectArchive baseProjectArchive) {
-		baseProjectArchiveService.updateById(baseProjectArchive);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "项目档案-通过id删除")
-	@ApiOperation(value="项目档案-通过id删除", notes="项目档案-通过id删除")
-	@RequiresPermissions("baseCode:base_project_archive:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		baseProjectArchiveService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "项目档案-批量删除")
-	@ApiOperation(value="项目档案-批量删除", notes="项目档案-批量删除")
-	@RequiresPermissions("baseCode:base_project_archive:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.baseProjectArchiveService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "项目档案-通过id查询")
-	@ApiOperation(value="项目档案-通过id查询", notes="项目档案-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<BaseProjectArchive> queryById(@RequestParam(name="id",required=true) String id) {
-		BaseProjectArchive baseProjectArchive = baseProjectArchiveService.getById(id);
-		if(baseProjectArchive==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(baseProjectArchive);
-	}
+        Page<BaseProjectArchive> page = new Page<BaseProjectArchive>(pageNo, pageSize);
+        IPage<BaseProjectArchive> pageList = baseProjectArchiveService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param baseProjectArchive
+     * @return
+     */
+    @AutoLog(value = "项目档案-添加")
+    @ApiOperation(value = "项目档案-添加", notes = "项目档案-添加")
+    @RequiresPermissions("baseCode:base_project_archive:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody BaseProjectArchive baseProjectArchive) {
+
+        String code = baseProjectArchive.getCode();
+        if (StringUtils.isNotBlank(code)) {
+
+            QueryWrapper<BaseProjectArchive> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("code", code);
+            queryWrapper.eq("del_flag", "0");
+
+            List<BaseProjectArchive> list = baseProjectArchiveService.list(queryWrapper);
+            if (list.size() != 0) {
+                return Result.error("项目档案编码重复,请修改!");
+            }
+        } else {
+
+            Result<String> result = serialPatternService.getNextSerial("base_project_archive", "code");
+            if (!result.isSuccess()) {
+                return result;
+            }
+            baseProjectArchive.setCode(result.getMessage());
+        }
+
+        baseProjectArchiveService.save(baseProjectArchive);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param baseProjectArchive
+     * @return
+     */
+    @AutoLog(value = "项目档案-编辑")
+    @ApiOperation(value = "项目档案-编辑", notes = "项目档案-编辑")
+    @RequiresPermissions("baseCode:base_project_archive:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody BaseProjectArchive baseProjectArchive) {
+
+        String code = baseProjectArchive.getCode();
+        QueryWrapper<BaseProjectArchive> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("code", code);
+        queryWrapper.eq("del_flag", "0");
+        queryWrapper.notIn("id", baseProjectArchive.getId());
+
+        List<BaseProjectArchive> list = baseProjectArchiveService.list(queryWrapper);
+        if (list.size() != 0) {
+            return Result.error("产品档案编码重复,请修改!");
+        }
+
+        baseProjectArchiveService.updateById(baseProjectArchive);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "项目档案-通过id删除")
+    @ApiOperation(value = "项目档案-通过id删除", notes = "项目档案-通过id删除")
+    @RequiresPermissions("baseCode:base_project_archive:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        baseProjectArchiveService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "项目档案-批量删除")
+    @ApiOperation(value = "项目档案-批量删除", notes = "项目档案-批量删除")
+    @RequiresPermissions("baseCode:base_project_archive:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.baseProjectArchiveService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "项目档案-通过id查询")
+    @ApiOperation(value = "项目档案-通过id查询", notes = "项目档案-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BaseProjectArchive> queryById(@RequestParam(name = "id", required = true) String id) {
+        BaseProjectArchive baseProjectArchive = baseProjectArchiveService.getById(id);
+        if (baseProjectArchive == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(baseProjectArchive);
+    }
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param baseProjectArchive
-    */
+     * 导出excel
+     *
+     * @param request
+     * @param baseProjectArchive
+     */
     @RequiresPermissions("baseCode:base_project_archive:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, BaseProjectArchive baseProjectArchive) {
@@ -165,12 +204,12 @@ public class BaseProjectArchiveController extends JeecgController<BaseProjectArc
     }
 
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("baseCode:base_project_archive:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

+ 154 - 115
srm-module-code/src/main/java/com/cuidian/srm/baseCode/controller/BaseShipArchiveController.java

@@ -10,6 +10,10 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import com.cuidian.srm.baseCode.entity.BaseProductArchive;
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.query.QueryRuleEnum;
@@ -39,131 +43,166 @@ import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 
- /**
+/**
  * @Description: 船舶档案
  * @Author: jeecg-boot
- * @Date:   2024-11-05
+ * @Date: 2024-11-05
  * @Version: V1.0
  */
-@Api(tags="船舶档案")
+@Api(tags = "船舶档案")
 @RestController
 @RequestMapping("/baseCode/baseShipArchive")
 @Slf4j
 public class BaseShipArchiveController extends JeecgController<BaseShipArchive, IBaseShipArchiveService> {
-	@Autowired
-	private IBaseShipArchiveService baseShipArchiveService;
-	
-	/**
-	 * 分页列表查询
-	 *
-	 * @param baseShipArchive
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "船舶档案-分页列表查询")
-	@ApiOperation(value="船舶档案-分页列表查询", notes="船舶档案-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<BaseShipArchive>> queryPageList(BaseShipArchive baseShipArchive,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
+    @Autowired
+    private IBaseShipArchiveService baseShipArchiveService;
+    @Autowired
+    private ISerialPatternService serialPatternService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param baseShipArchive
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "船舶档案-分页列表查询")
+    @ApiOperation(value = "船舶档案-分页列表查询", notes = "船舶档案-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BaseShipArchive>> queryPageList(BaseShipArchive baseShipArchive,
+                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                        HttpServletRequest req) {
         // 自定义查询规则
         Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
         // 自定义多选的查询规则为:LIKE_WITH_OR
         customeRuleMap.put("status", QueryRuleEnum.LIKE_WITH_OR);
         customeRuleMap.put("shipType", QueryRuleEnum.LIKE_WITH_OR);
         customeRuleMap.put("shipFactory", QueryRuleEnum.LIKE_WITH_OR);
-        QueryWrapper<BaseShipArchive> queryWrapper = QueryGenerator.initQueryWrapper(baseShipArchive, req.getParameterMap(),customeRuleMap);
-		Page<BaseShipArchive> page = new Page<BaseShipArchive>(pageNo, pageSize);
-		IPage<BaseShipArchive> pageList = baseShipArchiveService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-	
-	/**
-	 *   添加
-	 *
-	 * @param baseShipArchive
-	 * @return
-	 */
-	@AutoLog(value = "船舶档案-添加")
-	@ApiOperation(value="船舶档案-添加", notes="船舶档案-添加")
-	@RequiresPermissions("baseCode:base_ship_archive:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody BaseShipArchive baseShipArchive) {
-		baseShipArchiveService.save(baseShipArchive);
-		return Result.OK("添加成功!");
-	}
-	
-	/**
-	 *  编辑
-	 *
-	 * @param baseShipArchive
-	 * @return
-	 */
-	@AutoLog(value = "船舶档案-编辑")
-	@ApiOperation(value="船舶档案-编辑", notes="船舶档案-编辑")
-	@RequiresPermissions("baseCode:base_ship_archive:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody BaseShipArchive baseShipArchive) {
-		baseShipArchiveService.updateById(baseShipArchive);
-		return Result.OK("编辑成功!");
-	}
-	
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "船舶档案-通过id删除")
-	@ApiOperation(value="船舶档案-通过id删除", notes="船舶档案-通过id删除")
-	@RequiresPermissions("baseCode:base_ship_archive:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		baseShipArchiveService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-	
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "船舶档案-批量删除")
-	@ApiOperation(value="船舶档案-批量删除", notes="船舶档案-批量删除")
-	@RequiresPermissions("baseCode:base_ship_archive:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.baseShipArchiveService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-	
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "船舶档案-通过id查询")
-	@ApiOperation(value="船舶档案-通过id查询", notes="船舶档案-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<BaseShipArchive> queryById(@RequestParam(name="id",required=true) String id) {
-		BaseShipArchive baseShipArchive = baseShipArchiveService.getById(id);
-		if(baseShipArchive==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(baseShipArchive);
-	}
+        QueryWrapper<BaseShipArchive> queryWrapper = QueryGenerator.initQueryWrapper(baseShipArchive, req.getParameterMap(), customeRuleMap);
+        Page<BaseShipArchive> page = new Page<BaseShipArchive>(pageNo, pageSize);
+        IPage<BaseShipArchive> pageList = baseShipArchiveService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param baseShipArchive
+     * @return
+     */
+    @AutoLog(value = "船舶档案-添加")
+    @ApiOperation(value = "船舶档案-添加", notes = "船舶档案-添加")
+    @RequiresPermissions("baseCode:base_ship_archive:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody BaseShipArchive baseShipArchive) {
+//
+//        String code = baseShipArchive.getImo();
+//        if (StringUtils.isNotBlank(code)) {
+//
+//            QueryWrapper<BaseShipArchive> queryWrapper = new QueryWrapper();
+//            queryWrapper.eq("imo", code);
+//            queryWrapper.eq("del_flag", "0");
+//
+//            List<BaseShipArchive> list = baseShipArchiveService.list(queryWrapper);
+//            if (list.size() != 0) {
+//                return Result.error("imo编码重复,请修改!");
+//            }
+//        } else {
+//
+//            Result<String> result = serialPatternService.getNextSerial("base_ship_archive", "imo");
+//            if (!result.isSuccess()) {
+//                return result;
+//            }
+//            baseShipArchive.setImo(result.getMessage());
+//        }
+
+        baseShipArchiveService.save(baseShipArchive);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param baseShipArchive
+     * @return
+     */
+    @AutoLog(value = "船舶档案-编辑")
+    @ApiOperation(value = "船舶档案-编辑", notes = "船舶档案-编辑")
+    @RequiresPermissions("baseCode:base_ship_archive:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody BaseShipArchive baseShipArchive) {
+
+        String code = baseShipArchive.getImo();
+        QueryWrapper<BaseShipArchive> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("imo", code);
+        queryWrapper.eq("del_flag", "0");
+        queryWrapper.notIn("id", baseShipArchive.getId());
+
+        List<BaseShipArchive> list = baseShipArchiveService.list(queryWrapper);
+        if (list.size() != 0) {
+            return Result.error("imo编码重复,请修改!");
+        }
+
+        baseShipArchiveService.updateById(baseShipArchive);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "船舶档案-通过id删除")
+    @ApiOperation(value = "船舶档案-通过id删除", notes = "船舶档案-通过id删除")
+    @RequiresPermissions("baseCode:base_ship_archive:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        baseShipArchiveService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "船舶档案-批量删除")
+    @ApiOperation(value = "船舶档案-批量删除", notes = "船舶档案-批量删除")
+    @RequiresPermissions("baseCode:base_ship_archive:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.baseShipArchiveService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "船舶档案-通过id查询")
+    @ApiOperation(value = "船舶档案-通过id查询", notes = "船舶档案-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BaseShipArchive> queryById(@RequestParam(name = "id", required = true) String id) {
+        BaseShipArchive baseShipArchive = baseShipArchiveService.getById(id);
+        if (baseShipArchive == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(baseShipArchive);
+    }
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param baseShipArchive
-    */
+     * 导出excel
+     *
+     * @param request
+     * @param baseShipArchive
+     */
     @RequiresPermissions("baseCode:base_ship_archive:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, BaseShipArchive baseShipArchive) {
@@ -171,12 +210,12 @@ public class BaseShipArchiveController extends JeecgController<BaseShipArchive,
     }
 
     /**
-      * 通过excel导入数据
-    *
-    * @param request
-    * @param response
-    * @return
-    */
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
     @RequiresPermissions("baseCode:base_ship_archive:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {

+ 7 - 6
srm-module-code/src/main/java/com/cuidian/srm/baseCode/entity/BaseProductArchive.java

@@ -67,6 +67,7 @@ public class BaseProductArchive implements Serializable {
 	/**产品分类*/
 	@Excel(name = "分类(class)", width = 15)
     @ApiModelProperty(value = "产品分类")
+    @Dict(dictTable = "base_product_class", dicText = "name", dicCode = "id")
     private String classId;
 	/**编码*/
 	@Excel(name = "编码(code)", width = 15)
@@ -97,15 +98,15 @@ public class BaseProductArchive implements Serializable {
     @ApiModelProperty(value = "规格")
     private String specifications;
 	/**备件号*/
-//	@Excel(name = "备件号", width = 15)
+	@Excel(name = "备件号(part no)", width = 15)
     @ApiModelProperty(value = "备件号")
     private String partno;
 	/**订货号*/
-//	@Excel(name = "订货号", width = 15)
+	@Excel(name = "订货号(订货号)", width = 15)
     @ApiModelProperty(value = "订货号")
     private String orderno;
 	/**图号*/
-//	@Excel(name = "图号", width = 15)
+	@Excel(name = "图号(drawing no)", width = 15)
     @ApiModelProperty(value = "图号")
     private String drawingno;
 	/**税率*/
@@ -113,7 +114,7 @@ public class BaseProductArchive implements Serializable {
     @ApiModelProperty(value = "税率")
     private Double taxRate;
 	/**计量单位*/
-	@Excel(name = "计量单位(measurementunit)", width = 15)
+	@Excel(name = "计量单位(measurement unit)", width = 15)
     @ApiModelProperty(value = "计量单位")
     private String measurementUnit;
 	/**有害物质(1-是,0-否)*/
@@ -125,11 +126,11 @@ public class BaseProductArchive implements Serializable {
     @ApiModelProperty(value = "虚拟产品(1-是,0-否)")
     private Integer virtualProduct;
 	/**返佣(1-是,0-否)*/
-//	@Excel(name = "返佣(1-是,0-否)", width = 15)
+	@Excel(name = "返佣(commissionRebate)", width = 15)
     @ApiModelProperty(value = "返佣(1-是,0-否)")
     private Integer commissionRebate;
 	/**备注*/
-//	@Excel(name = "备注", width = 15)
+	@Excel(name = "备注", width = 15)
     @ApiModelProperty(value = "备注")
     private String notes;
 }

+ 40 - 1
srm-module-code/src/main/java/com/cuidian/srm/cuspCode/controller/CuspCustomerProfileController.java

@@ -13,6 +13,9 @@ import java.util.HashMap;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.cuidian.srm.baseCode.entity.BaseProductArchive;
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import org.apache.commons.lang.StringUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -61,7 +64,9 @@ public class CuspCustomerProfileController {
 	private ICuspCustomerProfileService cuspCustomerProfileService;
 	@Autowired
 	private ICuspCustomerProfileManService cuspCustomerProfileManService;
-	
+	@Autowired
+	private ISerialPatternService serialPatternService;
+
 	/**
 	 * 分页列表查询
 	 *
@@ -100,6 +105,28 @@ public class CuspCustomerProfileController {
     @RequiresPermissions("cuspCode:cusp_customer_profile:add")
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody CuspCustomerProfilePage cuspCustomerProfilePage) {
+
+		String code = cuspCustomerProfilePage.getCode();
+		if (StringUtils.isNotBlank(code)) {
+
+			QueryWrapper<CuspCustomerProfile> queryWrapper = new QueryWrapper();
+			queryWrapper.eq("code", code);
+			queryWrapper.eq("del_flag", "0");
+
+			List<CuspCustomerProfile> list = cuspCustomerProfileService.list(queryWrapper);
+			if (list.size() != 0) {
+				return Result.error("客户档案编码重复,请修改!");
+			}
+		} else {
+
+			Result<String> result = serialPatternService.getNextSerial("cusp_customer_profile", "code");
+			if (!result.isSuccess()) {
+				return result;
+			}
+			cuspCustomerProfilePage.setCode(result.getMessage());
+		}
+
+
 		CuspCustomerProfile cuspCustomerProfile = new CuspCustomerProfile();
 		BeanUtils.copyProperties(cuspCustomerProfilePage, cuspCustomerProfile);
 		cuspCustomerProfileService.saveMain(cuspCustomerProfile, cuspCustomerProfilePage.getCuspCustomerProfileManList());
@@ -123,6 +150,18 @@ public class CuspCustomerProfileController {
 		if(cuspCustomerProfileEntity==null) {
 			return Result.error("未找到对应数据");
 		}
+
+		String code = cuspCustomerProfile.getCode();
+		QueryWrapper<CuspCustomerProfile> queryWrapper = new QueryWrapper();
+		queryWrapper.eq("code", code);
+		queryWrapper.eq("del_flag", "0");
+		queryWrapper.notIn("id", cuspCustomerProfile.getId());
+
+		List<CuspCustomerProfile> list = cuspCustomerProfileService.list(queryWrapper);
+		if (list.size() != 0) {
+			return Result.error("客户档案编码重复,请修改!");
+		}
+
 		cuspCustomerProfileService.updateMain(cuspCustomerProfile, cuspCustomerProfilePage.getCuspCustomerProfileManList());
 		return Result.OK("编辑成功!");
 	}

+ 32 - 4
srm-module-code/src/main/java/com/cuidian/srm/cuspCode/controller/CuspIntermediatorController.java

@@ -11,7 +11,9 @@ import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.cuidian.srm.baseCode.entity.BaseProductArchive;
 import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.query.QueryRuleEnum;
@@ -91,11 +93,25 @@ public class CuspIntermediatorController extends JeecgController<CuspIntermediat
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody CuspIntermediator cuspIntermediator) {
 
-		Result<String> result = serialPatternService.getNextSerial("cusp_intermediator","code");
-		if (!result.isSuccess()){
-			return result;
+		String code = cuspIntermediator.getCode();
+		if (StringUtils.isNotBlank(code)) {
+
+			QueryWrapper<CuspIntermediator> queryWrapper = new QueryWrapper();
+			queryWrapper.eq("code", code);
+			queryWrapper.eq("del_flag", "0");
+
+			List<CuspIntermediator> list = cuspIntermediatorService.list(queryWrapper);
+			if (list.size() != 0) {
+				return Result.error("中间人编码重复,请修改!");
+			}
+		} else {
+
+			Result<String> result = serialPatternService.getNextSerial("cusp_intermediator", "code");
+			if (!result.isSuccess()) {
+				return result;
+			}
+			cuspIntermediator.setCode(result.getMessage());
 		}
-		cuspIntermediator.setCode(result.getMessage());
 
 		cuspIntermediatorService.save(cuspIntermediator);
 		return Result.OK("添加成功!");
@@ -112,6 +128,18 @@ public class CuspIntermediatorController extends JeecgController<CuspIntermediat
 	@RequiresPermissions("cuspCode:cusp_intermediator:edit")
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
 	public Result<String> edit(@RequestBody CuspIntermediator cuspIntermediator) {
+
+		String code = cuspIntermediator.getCode();
+		QueryWrapper<CuspIntermediator> queryWrapper = new QueryWrapper();
+		queryWrapper.eq("code", code);
+		queryWrapper.eq("del_flag", "0");
+		queryWrapper.notIn("id", cuspIntermediator.getId());
+
+		List<CuspIntermediator> list = cuspIntermediatorService.list(queryWrapper);
+		if (list.size() != 0) {
+			return Result.error("中间人编码重复,请修改!");
+		}
+
 		cuspIntermediatorService.updateById(cuspIntermediator);
 		return Result.OK("编辑成功!");
 	}

+ 40 - 1
srm-module-code/src/main/java/com/cuidian/srm/cuspCode/controller/CuspSupplierEvaluationController.java

@@ -13,6 +13,9 @@ import java.util.HashMap;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.cuidian.srm.baseCode.entity.BaseProductArchive;
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import org.apache.commons.lang.StringUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -61,7 +64,9 @@ public class CuspSupplierEvaluationController {
 	private ICuspSupplierEvaluationService cuspSupplierEvaluationService;
 	@Autowired
 	private ICuspSupplierEvaluationScoreService cuspSupplierEvaluationScoreService;
-	
+	 @Autowired
+	 private ISerialPatternService serialPatternService;
+
 	/**
 	 * 分页列表查询
 	 *
@@ -101,6 +106,28 @@ public class CuspSupplierEvaluationController {
     @RequiresPermissions("cuspCode:cusp_supplier_evaluation:add")
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody CuspSupplierEvaluationPage cuspSupplierEvaluationPage) {
+
+
+		String code = cuspSupplierEvaluationPage.getBillCode();
+		if (StringUtils.isNotBlank(code)) {
+
+			QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper();
+			queryWrapper.eq("bill_code", code);
+			queryWrapper.eq("del_flag", "0");
+
+			List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
+			if (list.size() != 0) {
+				return Result.error("供应商考评编码重复,请修改!");
+			}
+		} else {
+
+			Result<String> result = serialPatternService.getNextSerial("cusp_supplier_evaluation", "bill_code");
+			if (!result.isSuccess()) {
+				return result;
+			}
+			cuspSupplierEvaluationPage.setBillCode(result.getMessage());
+		}
+
 		CuspSupplierEvaluation cuspSupplierEvaluation = new CuspSupplierEvaluation();
 		BeanUtils.copyProperties(cuspSupplierEvaluationPage, cuspSupplierEvaluation);
 		cuspSupplierEvaluationService.saveMain(cuspSupplierEvaluation, cuspSupplierEvaluationPage.getCuspSupplierEvaluationScoreList());
@@ -124,6 +151,18 @@ public class CuspSupplierEvaluationController {
 		if(cuspSupplierEvaluationEntity==null) {
 			return Result.error("未找到对应数据");
 		}
+
+		String code = cuspSupplierEvaluation.getBillCode();
+		QueryWrapper<CuspSupplierEvaluation> queryWrapper = new QueryWrapper();
+		queryWrapper.eq("bill_code", code);
+		queryWrapper.eq("del_flag", "0");
+		queryWrapper.notIn("id", cuspSupplierEvaluation.getId());
+
+		List<CuspSupplierEvaluation> list = cuspSupplierEvaluationService.list(queryWrapper);
+		if (list.size() != 0) {
+			return Result.error("供应商考评编码重复,请修改!");
+		}
+
 		cuspSupplierEvaluationService.updateMain(cuspSupplierEvaluation, cuspSupplierEvaluationPage.getCuspSupplierEvaluationScoreList());
 		return Result.OK("编辑成功!");
 	}

+ 41 - 1
srm-module-code/src/main/java/com/cuidian/srm/cuspCode/controller/CuspSupplierProfileController.java

@@ -13,6 +13,9 @@ import java.util.HashMap;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import com.cuidian.srm.cuspCode.entity.CuspCustomerProfile;
+import org.apache.commons.lang.StringUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -65,7 +68,9 @@ public class CuspSupplierProfileController {
 	private ICuspSupplierProfileManService cuspSupplierProfileManService;
 	@Autowired
 	private ICuspSupplierProfileQualificationService cuspSupplierProfileQualificationService;
-	
+	 @Autowired
+	 private ISerialPatternService serialPatternService;
+
 	/**
 	 * 分页列表查询
 	 *
@@ -108,6 +113,29 @@ public class CuspSupplierProfileController {
     @RequiresPermissions("cuspCode:cusp_supplier_profile:add")
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody CuspSupplierProfilePage cuspSupplierProfilePage) {
+
+
+		String code = cuspSupplierProfilePage.getCode();
+		if (StringUtils.isNotBlank(code)) {
+
+			QueryWrapper<CuspSupplierProfile> queryWrapper = new QueryWrapper();
+			queryWrapper.eq("code", code);
+			queryWrapper.eq("del_flag", "0");
+
+			List<CuspSupplierProfile> list = cuspSupplierProfileService.list(queryWrapper);
+			if (list.size() != 0) {
+				return Result.error("供应商档案编码重复,请修改!");
+			}
+		} else {
+
+			Result<String> result = serialPatternService.getNextSerial("cusp_supplier_profile", "code");
+			if (!result.isSuccess()) {
+				return result;
+			}
+			cuspSupplierProfilePage.setCode(result.getMessage());
+		}
+
+
 		CuspSupplierProfile cuspSupplierProfile = new CuspSupplierProfile();
 		BeanUtils.copyProperties(cuspSupplierProfilePage, cuspSupplierProfile);
 		cuspSupplierProfileService.saveMain(cuspSupplierProfile, cuspSupplierProfilePage.getCuspSupplierProfileManList(),cuspSupplierProfilePage.getCuspSupplierProfileQualificationList());
@@ -131,6 +159,18 @@ public class CuspSupplierProfileController {
 		if(cuspSupplierProfileEntity==null) {
 			return Result.error("未找到对应数据");
 		}
+
+		String code = cuspSupplierProfile.getCode();
+		QueryWrapper<CuspSupplierProfile> queryWrapper = new QueryWrapper();
+		queryWrapper.eq("code", code);
+		queryWrapper.eq("del_flag", "0");
+		queryWrapper.notIn("id", cuspSupplierProfile.getId());
+
+		List<CuspSupplierProfile> list = cuspSupplierProfileService.list(queryWrapper);
+		if (list.size() != 0) {
+			return Result.error("供应商档案编码重复,请修改!");
+		}
+
 		cuspSupplierProfileService.updateMain(cuspSupplierProfile, cuspSupplierProfilePage.getCuspSupplierProfileManList(),cuspSupplierProfilePage.getCuspSupplierProfileQualificationList());
 		return Result.OK("编辑成功!");
 	}

+ 27 - 1
srm-module-code/src/main/java/com/cuidian/srm/saleCode/controller/SaleRfpController.java

@@ -10,6 +10,10 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import com.cuidian.srm.baseCode.entity.BaseProductArchive;
+import com.cuidian.srm.baseCode.service.ISerialPatternService;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.query.QueryRuleEnum;
@@ -52,7 +56,8 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 public class SaleRfpController extends JeecgController<SaleRfp, ISaleRfpService> {
 	@Autowired
 	private ISaleRfpService saleRfpService;
-	
+	 @Autowired
+	 private ISerialPatternService serialPatternService;
 	/**
 	 * 分页列表查询
 	 *
@@ -86,6 +91,27 @@ public class SaleRfpController extends JeecgController<SaleRfp, ISaleRfpService>
 	@RequiresPermissions("saleCode:sale_rfp:add")
 	@PostMapping(value = "/add")
 	public Result<String> add(@RequestBody SaleRfp saleRfp) {
+
+		String code = saleRfp.getBillCode();
+		if (StringUtils.isNotBlank(code)) {
+
+			QueryWrapper<SaleRfp> queryWrapper = new QueryWrapper();
+			queryWrapper.eq("bill_code", code);
+			queryWrapper.eq("del_flag", "0");
+
+			List<SaleRfp> list = saleRfpService.list(queryWrapper);
+			if (list.size() != 0) {
+				return Result.error("招标书编码重复,请修改!");
+			}
+		} else {
+
+			Result<String> result = serialPatternService.getNextSerial("sale_rfp", "bill_code");
+			if (!result.isSuccess()) {
+				return result;
+			}
+			saleRfp.setBillCode(result.getMessage());
+		}
+
 		saleRfpService.save(saleRfp);
 		return Result.OK("添加成功!");
 	}