Просмотр исходного кода

网点管理增加保险和签约合同所需字段

FengChaoYu 6 месяцев назад
Родитель
Сommit
5013f987c7

+ 23 - 0
mall-server-api/src/main/java/com/gree/mall/manager/enums/WebsitAttrEnum.java

@@ -0,0 +1,23 @@
+package com.gree.mall.manager.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.gree.mall.manager.enums.base.BaseEnum;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@Getter
+@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
+public enum WebsitAttrEnum implements BaseEnum {
+    SELF("SELF","自建网点"),
+    MAJOR("MAJOR","第三方专业网点"),
+    MERCHANT("MERCHANT","第三方经销商家网点"),
+    ;
+
+    @EnumValue
+    @JsonValue
+    private final String key;
+    private final String remark;
+
+}

+ 100 - 12
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminWebsitLogic.java

@@ -12,6 +12,7 @@ import com.gree.mall.manager.bean.admin.reqDto.AdminUserAddReqBean;
 import com.gree.mall.manager.bean.workorder.AdminWebsitList;
 import com.gree.mall.manager.constant.Constant;
 import com.gree.mall.manager.enums.ExamineStatusEnum;
+import com.gree.mall.manager.enums.WebsitAttrEnum;
 import com.gree.mall.manager.enums.admin.AdminWebsitTypeEnum;
 import com.gree.mall.manager.enums.material.WebsitGoodsTypeEnum;
 import com.gree.mall.manager.exception.RemoteServiceException;
@@ -183,11 +184,12 @@ public class AdminWebsitLogic {
         adminWebsit.setCompanyWechatId(parent.getCompanyWechatId());
         adminWebsit.setCompanyWechatName(parent.getCompanyWechatName());
 
+        adminWebsit.setType(AdminWebsitTypeEnum.C.getKey());
         if (parent.getType().equals(AdminWebsitTypeEnum.A.getKey())) {
-            adminWebsit.setWebsitId(IdWorker.getIdStr());
             adminWebsit.setType(AdminWebsitTypeEnum.B.getKey());
-        } else if (parent.getType().equals(AdminWebsitTypeEnum.B.getKey())) {
-            adminWebsit.setType(AdminWebsitTypeEnum.C.getKey());
+            adminWebsit.setWebsitId(IdWorker.getIdStr());
+        } else if (parent.getType().equals(AdminWebsitTypeEnum.B.getKey())
+                && org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getWebsitId())) {
             String websitId = commonLogic.getIncrKeyValue(adminWebsit.getCompanyWechatId(), "WEBSIT_ID", "A",6);
             adminWebsit.setWebsitId(websitId);
         }
@@ -316,6 +318,73 @@ public class AdminWebsitLogic {
         if (count > 0) {
             throw new RemoteServiceException("名称已存在");
         }
+
+        if (adminWebsit.getType().equals(AdminWebsitTypeEnum.C.getKey())) {
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getBelongCompany())
+                    || org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getBelongCompanyCode()) ) {
+                throw new RemoteServiceException("所属公司不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getAttr())) {
+                throw new RemoteServiceException("网点属性不能为空");
+            }
+
+            if (Objects.isNull(adminWebsit.getLevel())) {
+                throw new RemoteServiceException("级别不能为空");
+            }
+
+            if (adminWebsit.getAttr().equals(WebsitAttrEnum.SELF.getKey())
+                    && org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getPayInsureCodeId())) {
+                throw new RemoteServiceException("保险支付商户不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getInsureType())) {
+                throw new RemoteServiceException("保险类型不能为空");
+            }
+
+            if (!adminWebsit.getInsureType().contains("意外险")) {
+                throw new RemoteServiceException("意外险不能为空");
+            }
+
+            if (!adminWebsit.getInsureType().contains("雇主险")) {
+                if (!adminWebsit.getInsureType().contains("工伤险")) {
+                    throw new RemoteServiceException("雇主险,工伤险必选一个");
+                }
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getLegalName())) {
+                throw new RemoteServiceException("企业法人不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getLegalMobile())) {
+                throw new RemoteServiceException("法人手机不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getLegalIdCard())) {
+                throw new RemoteServiceException("法人身份证不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getWebsitPhone())) {
+                throw new RemoteServiceException("办公电话不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getAddress())) {
+                throw new RemoteServiceException("地址不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getOpenBank())) {
+                throw new RemoteServiceException("开户银行不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getBankAccount())) {
+                throw new RemoteServiceException("银行账号不能为空");
+            }
+
+            if (org.apache.commons.lang3.StringUtils.isBlank(adminWebsit.getEmail())) {
+                throw new RemoteServiceException("电子邮箱不能为空");
+            }
+        }
+
     }
 
     /**
@@ -326,14 +395,14 @@ public class AdminWebsitLogic {
 
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
 
-        Integer count = adminWebsitService.lambdaQuery()
-                .ne(AdminWebsit::getWebsitId, adminWebsit.getWebsitId())
-                .eq(StringUtils.isNotBlank(adminUser.getCompanyWechatId()), AdminWebsit::getCompanyWechatId, adminUser.getCompanyWechatId())
-                .eq(AdminWebsit::getName, adminWebsit.getName())
-                .count();
-        if (count > 0) {
-            throw new RemoteServiceException("名称已存在");
-        }
+//        Integer count = adminWebsitService.lambdaQuery()
+//                .ne(AdminWebsit::getWebsitId, adminWebsit.getWebsitId())
+//                .eq(StringUtils.isNotBlank(adminUser.getCompanyWechatId()), AdminWebsit::getCompanyWechatId, adminUser.getCompanyWechatId())
+//                .eq(AdminWebsit::getName, adminWebsit.getName())
+//                .count();
+//        if (count > 0) {
+//            throw new RemoteServiceException("名称已存在");
+//        }
         if (adminWebsit.getParentId().equals("0")) {
             throw new RemoteServiceException("请选择上级");
         }
@@ -356,7 +425,26 @@ public class AdminWebsitLogic {
             adminWebsit.setType(AdminWebsitTypeEnum.C.getKey());
         }
 
-        adminWebsit.updateById();
+        this.checkWebsitIdAndName(adminWebsit, adminUser, false);
+
+        if (adminUser.getType().equals(0)) {
+            // 网点仅可改联系人、联系电话、地址信息,其他字段都不允许修改,只能由商户账号才有权限修改
+            AdminWebsit websit = new AdminWebsit();
+            websit.setWebsitId(adminWebsit.getWebsitId())
+                    .setLinkName(adminWebsit.getLinkName())
+                    .setLinkMobile(adminWebsit.getLinkMobile())
+                    .setWebsitPhone(adminWebsit.getWebsitPhone())
+                    .setLegalName(adminWebsit.getLegalName())
+                    .setLegalMobile(adminWebsit.getLegalMobile())
+                    .setLegalIdCard(adminWebsit.getLegalIdCard())
+                    .setOpenBank(adminWebsit.getOpenBank())
+                    .setBankAccount(adminWebsit.getBankAccount())
+                    .setEmail(adminWebsit.getEmail())
+                    .setAddress(adminWebsit.getAddress());
+            websit.updateById();
+        } else {
+            adminWebsit.updateById();
+        }
 
         adminDeptWebsitService.lambdaUpdate().eq(AdminDeptWebsit::getWebsitId, adminWebsit.getWebsitId())
                 .set(AdminDeptWebsit::getWebsitName, adminWebsit.getName()).update();