Browse Source

代码修改提交

wangchangsheng 1 year ago
parent
commit
f76669c898

+ 10 - 0
ims-common/src/main/java/com/ims/common/utils/StringUtils.java

@@ -8,6 +8,7 @@ import java.math.RoundingMode;
 import java.util.Collection;
 import java.util.Map;
 import java.util.UUID;
+import java.util.regex.Pattern;
 
 public class StringUtils{
 	/** 空字符串 */
@@ -505,6 +506,15 @@ public class StringUtils{
 	}
 
 
+	/**
+	 * 判断字符串是否为数字
+	 * @param str
+	 * @return
+	 */
+	public static boolean  isNumber(String str) {
+		Pattern pattern = Pattern.compile("-?[0-9]+.?[0-9]*");
+		return pattern.matcher(str).matches();
+	}
 
 
 }

+ 2 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/dao/OrganizationEvaluationInfoMapper.java

@@ -24,7 +24,8 @@ public interface OrganizationEvaluationInfoMapper extends BaseMapper<Organizatio
 
 	List<OrganizationEvaluationInfoResDTO> selectListEvaluationInfoId(@Param("organizationEvaluationId") String organizationEvaluationId,
 																	  @Param("dept") String dept,
-																	  @Param("optionCode") String optionCode);
+																	  @Param("optionCode") String optionCode,
+																	  @Param("organizationId") String organizationId);
 
 	List<OrganizationEvaluationInfo> selectByEvaluationInfoId(@Param("organizationEvaluationId") String organizationEvaluationId);
 

+ 2 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/dao/ResponsibilityIndicatorInfoMapper.java

@@ -20,7 +20,8 @@ public interface ResponsibilityIndicatorInfoMapper extends BaseMapper<Responsibi
 
 	List<ResponsibilityIndicatorInfoResDTO> listByresponsibilityId(@Param("deptResponsibilityIds") List<String> deptResponsibilityIds,
 																   @Param("dept") String dept,
-																   @Param("optionCode") String optionCode);
+																   @Param("optionCode") String optionCode,
+																   @Param("organizationId") String organizationId);
 
 
 

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

@@ -12,4 +12,6 @@ public class MyuserResDTO extends Myuser {
 	private static final long serialVersionUID = 1L;
 
 	private OrganizationStructure unitOrg;
+
+	private OrganizationStructure deptOrg;
 }

+ 14 - 3
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationInfoServiceImpl.java

@@ -55,21 +55,26 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 		if(null == myuser){
 			throw new CustomException("暂无权限");
 		}
+		String organizationId = "";
+		boolean updateMark = false;
 		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();
+//				dept = myuser.getDeptName();
+				organizationId = myuser.getUnitId();
 			} else if (Constant.SUB_BRANCH.contains(type)) {
 				dept = "";
 			} else if (myuser.getLoginName().equals("admin")) {
 				dept = "";
+				updateMark= true;
 			} else {
 				throw new CustomException("暂无权限");
 			}
 		}
-		List<OrganizationEvaluationInfoResDTO> list = baseMapper.selectListEvaluationInfoId(organizationEvaluationId,dept,"");//默认获取指定的怎目标
+		List<OrganizationEvaluationInfoResDTO> list = baseMapper.selectListEvaluationInfoId(organizationEvaluationId,dept,"",organizationId);//默认获取指定的怎目标
+		boolean finalUpdateMark = updateMark;
 		list.stream().forEach(i->{
-			i.setUpdateMark(i.getDeptName().equals(myuser.getDeptName()));
+			i.setUpdateMark(i.getDeptName().equals(myuser.getDeptOrg().getShortName()));
 		});
 		Map<String  ,List<OrganizationEvaluationInfoResDTO>> map  = list.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getIsQuantified));
 		map.put("quantifiedList", map.remove("是"));
@@ -84,7 +89,13 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 
 			if (null != entity && null != entity.getId() && !"".equals(entity.getId().trim())) {
 				OrganizationEvaluationInfo info = baseMapper.selectById(entity.getId());
+
 				info.setQuantifiedValue(entity.getQuantifiedValue());//量化值
+				if("JKF".equals(info.getOptionCode())){//加扣分
+					if(StringUtils.isNumber(entity.getNonQuantifiedValue())){
+						info.setQuantifiedValue(Double.valueOf(entity.getNonQuantifiedValue()));
+					}
+				}
 				info.setNonQuantifiedValue(entity.getNonQuantifiedValue());//非量化值
 				info.setUpdateTime(new Date());//更新时间
 				info.setUpdateBy(entity.getUpdateBy());//更新者

+ 61 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationServiceImpl.java

@@ -142,7 +142,7 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 	public boolean saveOrUpdate(OrganizationEvaluation entity) {
 		//获取指定部门的规则
 		List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.listByIsCheck(entity.getOrganizationType(), entity.getCheckCycle(), true, false);
-		if (!"YDKP".equals(entity.getCheckCycle()) && (null == list || list.size() <= 0)) {
+		if (!"JDKP".equals(entity.getCheckCycle()) && (null == list || list.size() <= 0)) {
 			throw new CustomException("不存在单位权重配置");
 		}
 		//获取组织id;
@@ -207,6 +207,66 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 		return b;
 	}
 
+
+
+	public boolean saveOrUpdate2(OrganizationEvaluation entity) {
+		//获取指定部门的规则
+		List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.listByIsCheck(entity.getOrganizationType(), entity.getCheckCycle(), true, false);
+		if (!"JDKP".equals(entity.getCheckCycle()) && (null == list || list.size() <= 0)) {
+			throw new CustomException("不存在单位权重配置");
+		}
+		//获取组织id;
+		List<String> organizationIds = list.stream().map(OrganizationEvaluationRule::getOrganizationId).collect(Collectors.toList());
+		List<String> organizationNames = list.stream().map(OrganizationEvaluationRule::getOrganizationName).collect(Collectors.toList());
+		List<String> evaluationRuleIds = list.stream().map(OrganizationEvaluationRule::getId).collect(Collectors.toList());
+
+		StringBuilder responsibilityCode = new StringBuilder();
+		responsibilityCode.append(entity.getOrganizationType()).append("_");
+		responsibilityCode.append(entity.getCheckCycle()).append("_");
+
+		//判断该是否存在目标责任书
+		List<OrganizationEvaluation> oriList = new ArrayList<>();
+		if ("JDKP".equals(entity.getCheckCycle())) {
+			Date newDate = DateUtils.toDate(entity.getYear() + "-" + entity.getMonth() + "-01");
+			String season = String.valueOf(DateUtils.getSeason(newDate));//获取季度
+			String month = String.valueOf(Integer.valueOf(entity.getMonth()) * Integer.valueOf(season));//季度考评
+			oriList = list("", entity.getCheckCycle(), entity.getYear(), month);
+			List<OrganizationEvaluation> count = list("", entity.getCheckCycle(), entity.getYear(), "");
+			responsibilityCode.append(entity.getYear()).append("_").append(month).append("_");
+			responsibilityCode.append(StringUtils.addZeroForStr(String.valueOf(count.size()+1), 4, "l"));
+		}
+
+
+		if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
+			if (null != oriList && oriList.size() > 0) {
+				throw new CustomException("此单位在该阶段已存在目标责任书");
+			}
+			//保存目标责任书
+			entity.setOrganizationEvaluationCode(responsibilityCode.toString().toLowerCase());
+
+			entity.setOrganizationId(String.join(",", organizationIds));//考评组织ID
+			entity.setOrganizationName(String.join(",", organizationNames));
+			entity.setOrganizationEvaluationRuleId(String.join(",", evaluationRuleIds));
+			entity.setStage("流程未启动");
+			entity.setCreateTime(new Date());
+		} else {
+			OrganizationEvaluation update = baseMapper.selectById(entity.getId());
+			if (null != oriList && oriList.size() > 1 && !update.getId().equals(oriList.get(0).getId())) {
+				throw new CustomException("编辑记录未找到");
+			}
+			if (!"流程未启动".equals(update.getStage())) {
+				throw new CustomException("流程已启动不允许修改");
+			}
+			entity.setOrganizationId(String.join(",", organizationIds));//考评组织ID
+			entity.setOrganizationName(String.join(",", organizationNames));
+			entity.setOrganizationEvaluationRuleId(String.join(",", evaluationRuleIds));
+			entity.setUpdateTime(new Date());
+		}
+		boolean b = super.saveOrUpdate(entity);
+		return b;
+	}
+
+
 	@Transactional
 	@Override
 	public boolean generateUnitEvaluationInfo(List<String> ids) {

+ 8 - 3
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/ResponsibilityIndicatorInfoServiceImpl.java

@@ -15,6 +15,7 @@ import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
 import com.ims.eval.service.IResponsibilityIndicatorInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ims.eval.service.IUserService;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -47,20 +48,24 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
 		if(null == myuser){
 			throw new CustomException("暂无权限");
 		}
-
+		String organizationId = "";
+		boolean updateMark = false;
 		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();
+//				dept = myuser.getDeptName();
+				organizationId = myuser.getUnitId();
 			} else if (Constant.SUB_BRANCH.contains(type)) {
 				dept = "";
 			} else if (myuser.getLoginName().equals("admin")) {
 				dept = "";
+				updateMark= true;
 			} else {
 				throw new CustomException("暂无权限");
 			}
 		}
-		List<ResponsibilityIndicatorInfoResDTO> list = baseMapper.listByresponsibilityId(deptResponsibilityIds,dept,"ZRMB");//默认获取指定的怎目标
+		List<ResponsibilityIndicatorInfoResDTO> list = baseMapper.listByresponsibilityId(deptResponsibilityIds,dept,"ZRMB",organizationId);//默认获取指定的怎目标
+		boolean finalUpdateMark = updateMark;
 		list.stream().forEach(i->{
 			i.setUpdateMark(i.getDeptName().equals(myuser.getDeptName()));
 		});

+ 5 - 1
ims-service/ims-eval/src/main/resources/mappers/OrganizationEvaluationInfoMapper.xml

@@ -71,10 +71,14 @@
                 and  dd.key_name = #{dept}
             </if>
 
+            <if test="organizationId !=null and organizationId !=''">
+                and  oer.organization_id = #{organizationId}
+            </if>
+
             and id.option_code not in ('CZ','CZMAX','CZMIN')
         </where>
 
-        order by dd.key_name,id.child_name desc
+        order by oer.organization_id,i.id,id.child_code,id.option_code desc
 
     </select>
 

+ 7 - 1
ims-service/ims-eval/src/main/resources/mappers/ResponsibilityIndicatorInfoMapper.xml

@@ -67,9 +67,15 @@
             </if>
 
 
+            <if test="organizationId !=null and organizationId !=''">
+                and  oer.organization_id = #{organizationId}
+            </if>
+
+
+
         </where>
 
-        order by ri.option_code desc
+        order by oer.organization_id,i.id desc
 
     </select>