Browse Source

Merge remote-tracking branch 'origin/master'

‘xugp 1 year ago
parent
commit
630671f914

+ 28 - 0
ims-common/src/main/java/com/ims/common/utils/Constant.java

@@ -0,0 +1,28 @@
+package com.ims.common.utils;
+
+public class Constant {
+
+	/**
+	 * 子分公司
+	 */
+	public static final String SUB_BRANCH = "130,140,150,160";
+
+	/**
+	 * 三级单位
+	 */
+	public static final String  THREE  = "3,70,80,90";
+
+
+
+	/**
+	 * 四级单位
+	 */
+	public static final String  FOUR  = "100,110,120";
+
+
+
+
+
+
+
+}

+ 77 - 79
ims-service/ims-eval/src/main/java/com/ims/eval/entity/Myuser.java

@@ -21,88 +21,86 @@ public class Myuser extends Model {
     private static final long serialVersionUID = 1L;
 
     private String id;
-//
-//    private String name;
-//
-////    private String mainPosName;
-//
+
+    private String name;
+
+//    private String mainPosName;
+
     private String deptName;
 
-	private OrganizationStructure unitOrg;
-//
-//    private String orgId;
-////
-////    private String orgName;
-////
-//    private String unitId;
-//
-//    private String unitName;
-//
-//    private Boolean admin;
-//
-//    private Integer age;
-//
-//    private String companyId;
-//
-//    private String createBy;
-//
-//    private String createDate;
-//
-//    private String dbName;
-//
-//    private String delFlag;
-//
-//    private String deptId;
-//
-//    private String education;
-//
-//    private String email;
-//
-//    private String faceimageUrl;
-//
-//    private String gender;
-//
-//    private String isNewRecord;
-//
-//    private String loginFlag;
-//
-//    private String loginIp;
-//
+    private String orgId;
+
+    private String orgName;
+
+    private String unitId;
+
+    private String unitName;
+
+    private Boolean admin;
+
+    private Integer age;
+
+    private String companyId;
+
+    private String createBy;
+
+    private String createDate;
+
+    private String dbName;
+
+    private String delFlag;
+
+    private String deptId;
+
+    private String education;
+
+    private String email;
+
+    private String faceimageUrl;
+
+    private String gender;
+
+    private String isNewRecord;
+
+    private String loginFlag;
+
+    private String loginIp;
+
     private String loginName;
-//
-//    private String mainPosCode;
-//
-//    private String mainposId;
-//
-//    private String mobile;
-//
-//    private String nation;
-//
-//    private String no;
-//
-//    private String oldLoginIp;
-//
-//    private double partyCost;
-//
-//    private String phone;
-//
-//    private String photo;
-//
-//    private String posCode;
-//
-//    private String remarks;
-//
-//    private String residence;
-//
-//    private String roleNames;
-//
-//    private String token;
-//
-//    private String updateBy;
-//
-//    private Date updateDate;
-//
-//    private String userType;
+
+    private String mainPosCode;
+
+    private String mainposId;
+
+    private String mobile;
+
+    private String nation;
+
+    private String no;
+
+    private String oldLoginIp;
+
+    private double partyCost;
+
+    private String phone;
+
+    private String photo;
+
+    private String posCode;
+
+    private String remarks;
+
+    private String residence;
+
+    private String roleNames;
+
+    private String token;
+
+    private String updateBy;
+
+    private Date updateDate;
+
+    private String userType;
 
 
 }

+ 15 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/response/MyuserResDTO.java

@@ -0,0 +1,15 @@
+package com.ims.eval.entity.dto.response;
+
+import com.ims.eval.entity.Myuser;
+import com.ims.eval.entity.OrganizationStructure;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel(value="user", description="user")
+public class MyuserResDTO extends Myuser {
+
+	private static final long serialVersionUID = 1L;
+
+	private OrganizationStructure unitOrg;
+}

+ 3 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/service/IUserService.java

@@ -3,6 +3,7 @@ package com.ims.eval.service;
 import com.alibaba.fastjson.JSONObject;
 import com.ims.eval.entity.Myuser;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ims.eval.entity.dto.response.MyuserResDTO;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -43,14 +44,14 @@ public interface IUserService extends IService<Myuser> {
 	 * @param code
 	 * @return
 	 */
-	Myuser getSysUser(String code);
+	MyuserResDTO getSysUser(String code);
 
 	/**
 	 * 根据头信息
 	 * @param request
 	 * @return
 	 */
-	Myuser getSysUser(HttpServletRequest request);
+	MyuserResDTO getSysUser(HttpServletRequest request);
 
 
 

+ 15 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationInfoServiceImpl.java

@@ -1,11 +1,13 @@
 package com.ims.eval.service.impl;
 
+import com.ims.common.utils.Constant;
 import com.ims.common.utils.StringUtils;
 import com.ims.eval.config.CustomException;
 import com.ims.eval.entity.IndicatorDictionary;
 import com.ims.eval.entity.Myuser;
 import com.ims.eval.entity.OrganizationEvaluationInfo;
 import com.ims.eval.dao.OrganizationEvaluationInfoMapper;
+import com.ims.eval.entity.dto.response.MyuserResDTO;
 import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
 import com.ims.eval.service.ICalculateIndicatorItemInfoService;
 import com.ims.eval.service.IIndicatorDictionaryService;
@@ -49,11 +51,22 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 	@Override
 	public Map finishValueList(String organizationEvaluationId, String dept, HttpServletRequest request) {
 
-		Myuser myuser = userService.getSysUser(request);
+		MyuserResDTO myuser = userService.getSysUser(request);
 		if(null == myuser){
 			throw new CustomException("暂无权限");
 		}
-
+		if (null != myuser.getUnitOrg() && null != myuser.getUnitOrg().getParentIds()) {
+			String type = myuser.getUnitOrg().getType();
+			if (Constant.THREE.contains(type) || Constant.FOUR.contains(type)) {
+				dept = myuser.getDeptName();
+			} else if (Constant.SUB_BRANCH.contains(type)) {
+				dept = "";
+			} else if (myuser.getLoginName().equals("admin")) {
+				dept = "";
+			} else {
+				throw new CustomException("暂无权限");
+			}
+		}
 		List<OrganizationEvaluationInfoResDTO> list = baseMapper.selectListEvaluationInfoId(organizationEvaluationId,dept,"");//默认获取指定的怎目标
 		list.stream().forEach(i->{
 			i.setUpdateMark(i.getDeptName().equals(myuser.getDeptName()));

+ 4 - 4
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationStructureServiceImpl.java

@@ -39,10 +39,10 @@ public class OrganizationStructureServiceImpl extends ServiceImpl<OrganizationSt
 	@Override
 	public List<OrganizationStructure> getTree(String id, Integer num, String type1) {
 
-		if (null != type1 && type1.length()>0){
-			type = type1;
-		}
-
+//		if (null != type1 && type1.length()>0){
+//
+//		}
+		type = type1;
 		if(null != list && list.size()>0){
 			return list;
 		}

+ 14 - 7
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/ResponsibilityIndicatorInfoServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ims.eval.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ims.common.utils.Constant;
 import com.ims.common.utils.StringUtils;
 import com.ims.eval.config.CustomException;
 import com.ims.eval.entity.DataDictionary;
@@ -9,6 +10,7 @@ import com.ims.eval.entity.ResponsibilityIndicatorInfo;
 import com.ims.eval.dao.ResponsibilityIndicatorInfoMapper;
 import com.ims.eval.entity.dto.request.IndicatorDictionaryDTO;
 import com.ims.eval.entity.dto.request.ResponsibilityIndicatorInfoUpdateDTO;
+import com.ims.eval.entity.dto.response.MyuserResDTO;
 import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
 import com.ims.eval.service.IResponsibilityIndicatorInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -41,17 +43,22 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
 	@Override
 	public Map<String ,List<ResponsibilityIndicatorInfoResDTO>> planValueList(List<String> deptResponsibilityIds, String dept, HttpServletRequest request) {
 
-		Myuser myuser = userService.getSysUser(request);
+		MyuserResDTO myuser = userService.getSysUser(request);
 		if(null == myuser){
 			throw new CustomException("暂无权限");
 		}
-		if(null != myuser.getUnitOrg() && null != myuser.getUnitOrg().getParentIds()){
-			String strparentIds = myuser.getUnitOrg().getParentIds();
-			strparentIds = StringUtils.trimstart(strparentIds,",");
-			strparentIds = StringUtils.trimend(strparentIds,",");
-			List<String> parentIds = Arrays.asList(strparentIds.split(","));
-			parentIds.size();
 
+		if (null != myuser.getUnitOrg() && null != myuser.getUnitOrg().getParentIds()) {
+			String type = myuser.getUnitOrg().getType();
+			if (Constant.THREE.contains(type) || Constant.FOUR.contains(type)) {
+				dept = myuser.getDeptName();
+			} else if (Constant.SUB_BRANCH.contains(type)) {
+				dept = "";
+			} else if (myuser.getLoginName().equals("admin")) {
+				dept = "";
+			} else {
+				throw new CustomException("暂无权限");
+			}
 		}
 		List<ResponsibilityIndicatorInfoResDTO> list = baseMapper.listByresponsibilityId(deptResponsibilityIds,dept,"ZRMB");//默认获取指定的怎目标
 		list.stream().forEach(i->{

+ 5 - 4
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/UserServiceImpl.java

@@ -8,6 +8,7 @@ import com.ims.eval.config.CustomException;
 import com.ims.eval.config.ImaConfig;
 import com.ims.eval.entity.Myuser;
 import com.ims.eval.dao.UserMapper;
+import com.ims.eval.entity.dto.response.MyuserResDTO;
 import com.ims.eval.entity.flow.FlowResult;
 import com.ims.eval.feign.RemoteServiceBuilder;
 import com.ims.eval.service.IUserService;
@@ -87,21 +88,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, Myuser> implements
 	}
 
 	@Override
-	public Myuser getSysUser(String code) {
+	public MyuserResDTO getSysUser(String code) {
 		Object json = remoteServiceBuilder.getGatewayUrl().getSysUser(code);
-		Myuser user = JSON.parseObject(json.toString(), Myuser.class);
+		MyuserResDTO user = JSON.parseObject(json.toString(), MyuserResDTO.class);
 		return user;
 	}
 
 	@Override
-	public Myuser getSysUser(HttpServletRequest request) {
+	public MyuserResDTO getSysUser(HttpServletRequest request) {
 
 		if(null == request.getHeader("code")){
 			throw new CustomException("请求鉴权信息为空");
 		}
 		String code = request.getHeader("code");
 		JSONObject json = remoteServiceBuilder.getGatewayUrl().getSysUser(code);
-		Myuser user =JSONObject.parseObject(json.getJSONObject("data").toJSONString(),Myuser.class);
+		MyuserResDTO user =JSONObject.parseObject(json.getJSONObject("data").toJSONString(), MyuserResDTO.class);
 		return user;
 	}