ezhizao_zx 3 týždňov pred
rodič
commit
c0c43d4e69

+ 12 - 0
src/main/java/cn/ezhizao/project/business/controller/BizProductAccessoriesMaterialController.java

@@ -164,6 +164,9 @@ public class BizProductAccessoriesMaterialController extends BaseController {
                 if (productCollect.stream().anyMatch(material -> material.getProductCode() == null || material.getProductCode() == "")) {
                     throw new RuntimeException("新增失败,产品编码不能为空");
                 }
+                if (productCollect.stream().anyMatch(material -> material.getJdId() == null)) {
+                    throw new RuntimeException("新增失败,金蝶id不能为空");
+                }
                 //判断产品编码是否有重复
                 List<String> productCodes = productCollect.stream()
                         .map(BizProductAccessoriesMaterial::getProductCode)
@@ -217,6 +220,7 @@ public class BizProductAccessoriesMaterialController extends BaseController {
                             bizProduct.setCreatorCode(product.getCreatorCode() != null ? product.getCreatorCode() : "");
                             bizProduct.setMaterialNum(product.getMaterialNum() != null ? product.getMaterialNum() : "");
                             bizProduct.setIsSubclass(product.getIsSubclass() != null ? product.getIsSubclass() : 0);
+                            bizProduct.setJdId(product.getJdId() != null ? product.getJdId() : 0L);
                             productList.add(bizProduct);
                         }
                         bizProductService.saveBatch(productList);
@@ -237,6 +241,9 @@ public class BizProductAccessoriesMaterialController extends BaseController {
                 if (accessoriesCollect.stream().anyMatch(material -> material.getAccessoriesCode() == null || material.getAccessoriesCode() == "")) {
                     throw new RuntimeException("新增失败,辅料编码不能为空");
                 }
+                if (accessoriesCollect.stream().anyMatch(material -> material.getJdId() == null)) {
+                    throw new RuntimeException("新增失败,金蝶id不能为空");
+                }
                 //判断辅料编码是否有重复
                 List<String> accessoriesCodes = accessoriesCollect.stream()
                         .map(BizProductAccessoriesMaterial::getAccessoriesCode)
@@ -285,6 +292,7 @@ public class BizProductAccessoriesMaterialController extends BaseController {
                             bizAccessories.setKtyts(accessories.getKtyts() != null ? accessories.getKtyts() : 0L);
                             bizAccessories.setFacno(accessories.getFacno() != null ? accessories.getFacno() : "");
                             bizAccessories.setTenantId(accessories.getTenantId() != null ? accessories.getTenantId() : 0L);
+                            bizAccessories.setJdId(accessories.getJdId() != null ? accessories.getJdId() : 0L);
                             accessoriesList.add(bizAccessories);
                         }
                         bizAccessoriesService.saveBatch(accessoriesList);
@@ -305,6 +313,9 @@ public class BizProductAccessoriesMaterialController extends BaseController {
                 if (materialCollect.stream().anyMatch(material -> material.getMaterialCode() == null || material.getMaterialCode() == "")) {
                     throw new RuntimeException("新增失败,材料编码不能为空");
                 }
+                if (materialCollect.stream().anyMatch(material -> material.getJdId() == null)) {
+                    throw new RuntimeException("新增失败,金碟id不能为空");
+                }
                 //判断原材料编码是否有重复
                 List<String> materialCodes = materialCollect.stream()
                         .map(BizProductAccessoriesMaterial::getMaterialCode)
@@ -475,6 +486,7 @@ public class BizProductAccessoriesMaterialController extends BaseController {
                             bizMaterialBase.setDtype(material.getDtype() != null ? material.getDtype() : "");
                             bizMaterialBase.setZjbxprc(material.getZjbxprc() != null ? material.getZjbxprc() : BigDecimal.ZERO);
                             bizMaterialBase.setTenantId(material.getTenantId() != null ? material.getTenantId() : 0L);
+                            bizMaterialBase.setJdId(material.getJdId() != null ? material.getJdId() : 0L);
                             materialList.add(bizMaterialBase);
                         }
                         bizMaterialBaseService.saveBatch(materialList);

+ 59 - 68
src/main/java/cn/ezhizao/project/business/controller/SysDeptController.java

@@ -39,8 +39,7 @@ import org.springframework.web.bind.annotation.RestController;
 //@Api("部门管理")
 @RestController
 @RequestMapping("/business/dept")
-public class SysDeptController extends BaseController
-{
+public class SysDeptController extends BaseController {
     @Resource
     private ISysDeptService sysDeptService;
     @Resource
@@ -65,11 +64,11 @@ public class SysDeptController extends BaseController
 //            @ApiImplicitParam(name = "tenantId", value = "厂别ID", required = false, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
 //    })
     @GetMapping("/list")
-    public TableDataInfo list(SysDept sysDept) throws NoSuchFieldException, IllegalAccessException
-    {
+    public TableDataInfo list(SysDept sysDept) throws NoSuchFieldException, IllegalAccessException {
         List<SysDept> list = sysDeptService.getList(sysDept);
         return getDataTable(list);
     }
+
     /**
      * 新增部门
      */
@@ -87,73 +86,70 @@ public class SysDeptController extends BaseController
 //    })
     @Log(title = "部门", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody SysDept sysDept) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult add(@RequestBody SysDept sysDept) throws NoSuchFieldException, IllegalAccessException {
         //判断必填项
-        if(sysDept.getTenantId() ==null ||sysDept.getDeptName() ==null || sysDept.getDeptName() ==""||sysDept.getDeptCode() ==null || sysDept.getDeptCode() =="") {
-           return error("新增部门失败,请求必填项:厂别、部门名称、部门编码不能为空");
+        if (sysDept.getTenantId() == null || sysDept.getDeptName() == null || sysDept.getDeptName().isEmpty() || sysDept.getDeptCode() == null || sysDept.getDeptCode().isEmpty() || sysDept.getJdId() == null) {
+            return error("新增部门失败,请求必填项:金碟id、厂别、部门名称、部门编码不能为空");
         }
-        if((sysDept.getIsOutsourcing() !=null && sysDept.getIsOutsourcing() ==1) && sysDept.getSupplierId() ==null) {
+        if ((sysDept.getIsOutsourcing() != null && sysDept.getIsOutsourcing() == 1) && sysDept.getSupplierId() == null) {
             return error("新增部门失败,外协商不能为空");
         }
-        if(sysDept.getIsOutsourcing() ==null && sysDept.getSupplierId() !=null) {
+        if (sysDept.getIsOutsourcing() == null && sysDept.getSupplierId() != null) {
             return error("新增部门失败,是否外协应为是");
         }
         //是否判断,只能是null,0,1
-        if(sysDept.getIsOutsourcing() !=null && !(sysDept.getIsOutsourcing() ==0 || sysDept.getIsOutsourcing() ==1)){
+        if (sysDept.getIsOutsourcing() != null && !(sysDept.getIsOutsourcing() == 0 || sysDept.getIsOutsourcing() == 1)) {
             return error("新增部门失败,是否外协只能是0或1");
         }
-        if(sysDept.getIsWorkSection() !=null &&sysDept.getIsWorkSection() !="" && !(sysDept.getIsWorkSection().equals("0") || sysDept.getIsWorkSection().equals("1"))){
+        if (sysDept.getIsWorkSection() != null && sysDept.getIsWorkSection() != "" && !(sysDept.getIsWorkSection().equals("0") || sysDept.getIsWorkSection().equals("1"))) {
             return error("新增部门失败,是否为工段只能是0或1");
         }
-        if(sysDept.getEquimentFlag() !=null && !(sysDept.getEquimentFlag() ==0 || sysDept.getEquimentFlag() ==1)){
+        if (sysDept.getEquimentFlag() != null && !(sysDept.getEquimentFlag() == 0 || sysDept.getEquimentFlag() == 1)) {
             return error("新增部门失败,是否一机多批只能是0或1");
         }
-        if(sysDept.getIsSortPackaging() !=null && !(sysDept.getIsSortPackaging() ==0 || sysDept.getIsSortPackaging() ==1)){
+        if (sysDept.getIsSortPackaging() != null && !(sysDept.getIsSortPackaging() == 0 || sysDept.getIsSortPackaging() == 1)) {
             return error("新增部门失败,是否分选只能是0或1");
         }
         //厂别判断
         List<BizTenant> tenantList = bizTenantService.query().eq("id", sysDept.getTenantId()).list();
-        if(tenantList.isEmpty()){
+        if (tenantList.isEmpty()) {
             return error("新增部门失败,厂别不存在");
         }
         //外协商判断
-        if((sysDept.getIsOutsourcing() !=null && sysDept.getIsOutsourcing() ==1) && sysDept.getSupplierId() !=null) {
+        if ((sysDept.getIsOutsourcing() != null && sysDept.getIsOutsourcing() == 1) && sysDept.getSupplierId() != null) {
             SysDept dept = new SysDept();
             dept.setDeptId(0L);
             dept.setIsInnerOutsource(1);
             List<BizSupplier> supplierList = bizSupplierService.getListByDept(dept);
-            if(supplierList.isEmpty()){
+            if (supplierList.isEmpty()) {
                 return error("新增部门失败,外协商都被使用,请新增外协商");
-            }else{
-                if(supplierList.stream().filter(supplier -> supplier.getId().equals(sysDept.getSupplierId())).findFirst().orElse(null) == null){
+            } else {
+                if (supplierList.stream().filter(supplier -> supplier.getId().equals(sysDept.getSupplierId())).findFirst().orElse(null) == null) {
                     return error("新增部门失败,外协商已被使用,请重新选择");
                 }
             }
         }
-        if(sysDept.getParentId() == null){
+        if (sysDept.getParentId() == null) {
             sysDept.setParentId(0L);
         }
-            if (UserConstants.NOT_UNIQUE.equals(sysDeptService.checkDeptNameUnique(sysDept)))
-            {
-                return error("新增部门'" + sysDept.getDeptName() + "'失败,部门名称已存在");
-            }
-            if (UserConstants.NOT_UNIQUE.equals(sysDeptService.checkDeptCodeUnique(sysDept)))
-            {
-                return error("新增部门'" + sysDept.getDeptName() + "'失败,部门编码已存在");
-            }
-            sysDept.setCreateBy(getUsername());
-            int i = sysDeptService.insertDept(sysDept);
-            //  新增默认摆放区域信息
-            if (i > 0) {
-                BizTurnover turnover = new BizTurnover();
-                turnover.setStatus(9);
-                turnover.setCode("默认区");
-                turnover.setTenantId(sysDept.getTenantId());
-                turnover.setDeptId(sysDept.getDeptId());
-                bizTurnoverService.save(turnover);
-            }
-            return success();
+        if (UserConstants.NOT_UNIQUE.equals(sysDeptService.checkDeptNameUnique(sysDept))) {
+            return error("新增部门'" + sysDept.getDeptName() + "'失败,部门名称已存在");
+        }
+        if (UserConstants.NOT_UNIQUE.equals(sysDeptService.checkDeptCodeUnique(sysDept))) {
+            return error("新增部门'" + sysDept.getDeptName() + "'失败,部门编码已存在");
+        }
+        sysDept.setCreateBy(getUsername());
+        int i = sysDeptService.insertDept(sysDept);
+        //  新增默认摆放区域信息
+        if (i > 0) {
+            BizTurnover turnover = new BizTurnover();
+            turnover.setStatus(9);
+            turnover.setCode("默认区");
+            turnover.setTenantId(sysDept.getTenantId());
+            turnover.setDeptId(sysDept.getDeptId());
+            bizTurnoverService.save(turnover);
+        }
+        return success();
     }
 
     /**
@@ -174,59 +170,57 @@ public class SysDeptController extends BaseController
 //    })
     @Log(title = "部门", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody SysDept sysDept) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult edit(@RequestBody SysDept sysDept) throws NoSuchFieldException, IllegalAccessException {
         //判断必填项
-        if(sysDept.getDeptId() ==null) {
-            return error("修改部门失败,部门id不能为空");
+        if (sysDept.getDeptId() == null || sysDept.getJdId() == null) {
+            return error("修改部门失败,部门id、金碟id不能为空");
         }
-        if((sysDept.getIsOutsourcing() !=null && sysDept.getIsOutsourcing() ==1) && sysDept.getSupplierId() ==null) {
+        if ((sysDept.getIsOutsourcing() != null && sysDept.getIsOutsourcing() == 1) && sysDept.getSupplierId() == null) {
             return error("修改部门失败,外协商不能为空");
         }
-        if(sysDept.getIsOutsourcing() ==null && sysDept.getSupplierId() !=null) {
+        if (sysDept.getIsOutsourcing() == null && sysDept.getSupplierId() != null) {
             return error("修改部门失败,是否外协应为是");
         }
         //是否判断,只能是null,0,1
-        if(sysDept.getIsOutsourcing() !=null && !(sysDept.getIsOutsourcing() ==0 || sysDept.getIsOutsourcing() ==1)){
+        if (sysDept.getIsOutsourcing() != null && !(sysDept.getIsOutsourcing() == 0 || sysDept.getIsOutsourcing() == 1)) {
             return error("修改部门失败,是否外协只能是0或1");
         }
-        if(sysDept.getIsWorkSection() !=null && sysDept.getIsWorkSection() !="" && !(sysDept.getIsWorkSection().equals("0") || sysDept.getIsWorkSection().equals("1"))){
+        if (sysDept.getIsWorkSection() != null && sysDept.getIsWorkSection() != "" && !(sysDept.getIsWorkSection().equals("0") || sysDept.getIsWorkSection().equals("1"))) {
             return error("修改部门失败,是否为工段只能是0或1");
         }
-        if(sysDept.getEquimentFlag() !=null && !(sysDept.getEquimentFlag() ==0 || sysDept.getEquimentFlag() ==1)){
+        if (sysDept.getEquimentFlag() != null && !(sysDept.getEquimentFlag() == 0 || sysDept.getEquimentFlag() == 1)) {
             return error("修改部门失败,是否一机多批只能是0或1");
         }
-        if(sysDept.getIsSortPackaging() !=null && !(sysDept.getIsSortPackaging() ==0 || sysDept.getIsSortPackaging() ==1)){
+        if (sysDept.getIsSortPackaging() != null && !(sysDept.getIsSortPackaging() == 0 || sysDept.getIsSortPackaging() == 1)) {
             return error("修改部门失败,是否分选只能是0或1");
         }
         //厂别判断
         List<BizTenant> tenantList = bizTenantService.query().eq("id", sysDept.getTenantId()).list();
-        if(tenantList.isEmpty()){
+        if (tenantList.isEmpty()) {
             return error("修改部门失败,厂别不存在");
         }
         //外协商判断
-        if((sysDept.getIsOutsourcing() !=null && sysDept.getIsOutsourcing() ==1) && sysDept.getSupplierId() !=null) {
+        if ((sysDept.getIsOutsourcing() != null && sysDept.getIsOutsourcing() == 1) && sysDept.getSupplierId() != null) {
             SysDept dept = new SysDept();
             dept.setDeptId(0L);
             dept.setIsInnerOutsource(1);
             List<BizSupplier> supplierList = bizSupplierService.getListByDept(dept);
-            if(supplierList.isEmpty()){
+            if (supplierList.isEmpty()) {
                 return error("修改部门失败,外协商都被使用,请新增外协商");
-            }else{
-                if(supplierList.stream().filter(supplier -> supplier.getId().equals(sysDept.getSupplierId())).findFirst().orElse(null) == null){
+            } else {
+                if (supplierList.stream().filter(supplier -> supplier.getId().equals(sysDept.getSupplierId())).findFirst().orElse(null) == null) {
                     return error("修改部门失败,外协商已被使用,请重新选择");
                 }
             }
         }
-        if(sysDept.getParentId() == null){
+        if (sysDept.getParentId() == null) {
             sysDept.setParentId(0L);
         }
         if (UserConstants.NOT_UNIQUE.equals(sysDeptService.checkDeptNameUnique(sysDept))) {
             return error("修改部门'" + sysDept.getDeptName() + "'失败,部门名称已存在");
-        }else if (UserConstants.NOT_UNIQUE.equals(sysDeptService.checkDeptCodeUnique(sysDept))) {
+        } else if (UserConstants.NOT_UNIQUE.equals(sysDeptService.checkDeptCodeUnique(sysDept))) {
             return error("修改部门'" + sysDept.getDeptName() + "'失败,部门编码已存在");
-        }
-        else if (sysDept.getParentId().equals(sysDept.getDeptId())) {
+        } else if (sysDept.getParentId().equals(sysDept.getDeptId())) {
             return error("修改部门'" + sysDept.getDeptName() + "'失败,上级部门不能是自己");
         } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, sysDept.getStatus()) && sysDeptService.selectNormalChildrenDeptById(sysDept.getDeptId()) > 0) {
             return error("该部门包含未停用的子部门!");
@@ -244,20 +238,17 @@ public class SysDeptController extends BaseController
 //            @ApiImplicitParam(name = "deptId", value = "部门ID", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
 //    })
     @Log(title = "部门", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{deptId}")
-    public AjaxResult remove(@PathVariable Long deptId)
-    {
+    @DeleteMapping("/{deptId}")
+    public AjaxResult remove(@PathVariable Long deptId) {
         SysDept dept = sysDeptService.getDeptByDeptId(deptId);
-        if (dept == null){
+        if (dept == null) {
             return error("部门不存在");
         }
-        List<SysDeptUser> deptUserList = sysDeptUserService.query().in("dept_id", deptId).eq("deleted",0).list();
-        if (deptUserList.size() > 0)
-        {
+        List<SysDeptUser> deptUserList = sysDeptUserService.query().in("dept_id", deptId).eq("deleted", 0).list();
+        if (deptUserList.size() > 0) {
             return error("部门存在用户,不允许删除");
         }
-        if (sysDeptService.hasChildByDeptId(deptId))
-        {
+        if (sysDeptService.hasChildByDeptId(deptId)) {
             return warn("存在下级部门,不允许删除");
         }
         return toAjax(sysDeptService.deleteDeptById(deptId));

+ 4 - 2
src/main/java/cn/ezhizao/project/business/controller/SysUserController.java

@@ -91,8 +91,7 @@ public class SysUserController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody SysUser sysUser) throws NoSuchFieldException, IllegalAccessException
     {
-        if(sysUser.getUserName() == null || sysUser.getUserName() == ""||sysUser.getNickName() == null || sysUser.getNickName() == "" || sysUser.getUsageCompanyId() == null
-                ||sysUser.getContractCompanyId() == null ){
+        if(sysUser.getUserName() == null || sysUser.getUserName() == ""||sysUser.getNickName() == null || sysUser.getNickName() == "" || sysUser.getUsageCompanyId() == null ||sysUser.getContractCompanyId() == null || sysUser.getJdId() == null){
             return error("新增用户失败,员工姓名,员工编码,合同单位,使用单位必填项不能为空");
         }
         //判断员工状态,用户性别的值
@@ -156,6 +155,9 @@ public class SysUserController extends BaseController
         if(sysUser.getUserId() == null){
             return error("修改用户失败,用户ID不能为空");
         }
+        if(sysUser.getJdId() == null){
+            return error("修改用户失败,金碟ID不能为空");
+        }
         if(sysUser.getUserName() == ""|| sysUser.getNickName() == "" ){
             return error("修改用户失败,员工姓名,员工编码不能为空");
         }

+ 2 - 0
src/main/java/cn/ezhizao/project/business/domain/BizProductAccessoriesMaterial.java

@@ -1058,4 +1058,6 @@ public class BizProductAccessoriesMaterial extends BaseEntity
 
     private List<Long> ids;
 
+    private Long jdId;
+
 }

+ 9 - 0
src/main/java/cn/ezhizao/project/system/domain/SysUser.java

@@ -142,6 +142,7 @@ public class SysUser extends BaseEntity {
     private String deptName;
     private Long usageCompanyId;
     private String usageCompanyName;
+    private Long jdId;
 
     @TableField(exist = false)
     private List<Long> hasAddIds;
@@ -439,4 +440,12 @@ public class SysUser extends BaseEntity {
                 .append("remark", getRemark())
                 .toString();
     }
+
+    public Long getJdId() {
+        return jdId;
+    }
+
+    public void setJdId(Long jdId) {
+        this.jdId = jdId;
+    }
 }

+ 3 - 0
src/main/resources/mybatis/business/SysDeptMapper.xml

@@ -101,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="supplierId != null">supplier_id,</if>
         <if test="createBy != null and createBy != ''">create_by,</if>
         <if test="type != null ">type,</if>
+        <if test="jdId != null">jd_id,</if>
         create_time
         )values(
         <if test="deptId != null and deptId != 0">#{deptId},</if>
@@ -121,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="supplierId != null">#{supplierId},</if>
         <if test="createBy != null and createBy != ''">#{createBy},</if>
         <if test="type != null">#{type},</if>
+        <if test="jdId != null">#{jdId},</if>
         sysdate()
         )
     </insert>
@@ -145,6 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="supplierId != null">supplier_id = #{supplierId},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="type != null">type = #{type},</if>
+            <if test="jdId != null">jd_id = #{jdId}</if>
             update_time = sysdate()
         </set>
         where dept_id = #{deptId}

+ 3 - 0
src/main/resources/mybatis/system/SysUserMapper.xml

@@ -279,6 +279,7 @@
 		<if test="contractCompanyId != null and contractCompanyId != ''">contract_company_id,</if>
 		<if test="usageCompanyId != null and usageCompanyId != 0">usage_company_id,</if>
 		<if test="usageCompanyName != null and usageCompanyName != ''">usage_company_name,</if>
+		<if test="jdId != null">jd_id,</if>
 		create_time
 		)VALUES(
 		<if test="userId != null and userId != ''">#{userId},</if>
@@ -298,6 +299,7 @@
 		<if test="contractCompanyId != null and contractCompanyId != ''">#{contractCompanyId},</if>
 		<if test="usageCompanyId != null and usageCompanyId != 0">#{usageCompanyId},</if>
 		<if test="usageCompanyName != null and usageCompanyName != ''">#{usageCompanyName},</if>
+		<if test="jdId != null">#{jdId},</if>
 		sysdate()
 		)
 	</insert>
@@ -322,6 +324,7 @@
 			<if test="contractCompanyId != null and contractCompanyId != ''">contract_company_id = #{contractCompanyId},</if>
 			<if test="usageCompanyId != null and usageCompanyId != 0">usage_company_id = #{usageCompanyId},</if>
 			<if test="usageCompanyName != null and usageCompanyName != ''">usage_company_name = #{usageCompanyName},</if>
+			<if test="jdId != null">jd_id = #{jdId},</if>
 			update_time = sysdate()
 		</set>
 		WHERE user_id = #{userId}