Forráskód Böngészése

用户加入是否绑定供应商

wangliang 1 éve
szülő
commit
d66fe9f65c

+ 38 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/dto/UserDto.java

@@ -3,6 +3,9 @@ package com.qmth.sop.business.bean.dto;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.enums.GenderEnum;
+import com.qmth.sop.common.enums.RoleTypeEnum;
+import com.qmth.sop.common.enums.UserRoleEnum;
+import org.springframework.util.CollectionUtils;
 
 import java.io.Serializable;
 import java.util.List;
@@ -33,6 +36,41 @@ public class UserDto implements Serializable {
     private String genderStr;
     private List<RoleDto> roles;
 
+    Boolean bandSupplier = false;
+
+    UserRoleEnum roleEnum;
+
+    public Boolean getBandSupplier() {
+        if (!CollectionUtils.isEmpty(roles)) {
+            int count = (int) roles.stream().filter(s -> {
+                if (s.getType() == RoleTypeEnum.DEVICE_DELIVERY) {
+                    this.roleEnum = Objects.nonNull(roleEnum) ? UserRoleEnum.THIRD_PMO_AND_DEVICE_DELIVERY : UserRoleEnum.DEVICE_DELIVERY;
+                } else if (s.getType() == RoleTypeEnum.THIRD_PMO) {
+                    this.roleEnum = Objects.nonNull(roleEnum) ? UserRoleEnum.THIRD_PMO_AND_DEVICE_DELIVERY : UserRoleEnum.THIRD_PMO;
+                }
+                return Objects.nonNull(this.roleEnum) ? true : false;
+            }).count();
+            if (count > 0) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+        return bandSupplier;
+    }
+
+    public UserRoleEnum getRoleEnum() {
+        return roleEnum;
+    }
+
+    public void setRoleEnum(UserRoleEnum roleEnum) {
+        this.roleEnum = roleEnum;
+    }
+
+    public void setBandSupplier(Boolean bandSupplier) {
+        this.bandSupplier = bandSupplier;
+    }
+
     public String getGenderStr() {
         if (Objects.nonNull(this.gender)) {
             return this.gender.getTitle();

+ 9 - 1
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -2387,4 +2387,12 @@ SET code='DATE', `type`='FORM', form_id='device_in_time', form_name='device_in_t
 WHERE id=86;
 UPDATE t_d_form_widget
 SET code='DEVICE_IN_TABLE', `type`='FORM', form_id='device_in_table', form_name='device_in_table', title='设备入库表格', input_type='STRING', required=1, readable=0, writable=1, visable=1, `scale`=NULL, `length`=NULL, binding=NULL, data_grid=NULL, tips=NULL, format=NULL, span=12, sub_title=NULL, `options`=NULL, flow_type='OFFICE_SOP_FLOW', form_setup=8, handle=0, form_group=NULL, role_type=NULL, create_id=1, create_time=1
-WHERE id=87;
+WHERE id=87;
+
+UPDATE sys_privilege
+SET name='初始化密码', url='InitPwd', `type`='LINK', parent_id=15, `sequence`=3, property='AUTH', related='18', enable=1, default_auth=0, front_display=1
+WHERE id=17;
+
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(3068, '绑定供应商', 'bandSupplier', 'LINK', 15, 4, 'AUTH', NULL, 1, 0, 1);

+ 27 - 0
sop-common/src/main/java/com/qmth/sop/common/enums/UserRoleEnum.java

@@ -0,0 +1,27 @@
+package com.qmth.sop.common.enums;
+
+/**
+ * @Description: 用户角色枚举
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2023/12/1
+ */
+public enum UserRoleEnum {
+
+    THIRD_PMO("乙方PMO"),
+
+    DEVICE_DELIVERY("设备发货员"),
+
+    THIRD_PMO_AND_DEVICE_DELIVERY("乙方PMO、设备发货员");
+
+    private final String title;
+
+    UserRoleEnum(String title) {
+        this.title = title;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+}