Browse Source

Merge remote-tracking branch 'origin/master'

‘xugp 2 years ago
parent
commit
beb87ea830

+ 18 - 4
ims-service/ims-eval/src/main/java/com/ims/eval/controller/ResponsibilityIndicatorInfoController.java

@@ -1,9 +1,7 @@
 package com.ims.eval.controller;
 
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ims.eval.config.CustomException;
-import com.ims.eval.entity.Indicator;
 import com.ims.eval.entity.ResponsibilityIndicatorInfo;
 import com.ims.eval.entity.dto.request.ResponsibilityIndicatorInfoUpdateDTO;
 import com.ims.eval.entity.dto.result.R;
@@ -41,13 +39,29 @@ public class ResponsibilityIndicatorInfoController {
 	 */
 	//@ImsPreAuth("eval:responsibilityIndicatorInfo:view")
 	@GetMapping(value = "planValueList")
-	public R listByresponsibilityIds(
+	public R planValueList(
 				  @RequestParam(value = "deptResponsibilityIds", required = false) List<String> deptResponsibilityIds,
 				  @RequestParam(value = "dept", required = false) String dept) {
-		Map list = responsibilityIndicatorInfoService.listByresponsibilityId(deptResponsibilityIds, dept);
+		Map list = responsibilityIndicatorInfoService.planValueList(deptResponsibilityIds, dept);
 		return R.ok().data(list);
 	}
 
+
+	/**
+	 *
+	 * @param deptResponsibilityIds 目标责任书id
+	 * @return
+	 */
+	//@ImsPreAuth("eval:responsibilityIndicatorInfo:view")
+	@GetMapping(value = "finishValueList")
+	public R finishValueList(
+		@RequestParam(value = "deptResponsibilityIds", required = false) List<String> deptResponsibilityIds,
+		@RequestParam(value = "dept", required = false) String dept) {
+		Map list = responsibilityIndicatorInfoService.planValueList(deptResponsibilityIds, dept);
+		return R.ok().data(list);
+	}
+
+
 	/**
 	 * 添加
 	 *

+ 6 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/DeptResponsibility.java

@@ -41,6 +41,12 @@ public class DeptResponsibility extends Model {
 	private String organizationName;
 
 
+	/**
+	 * 考评类别(单位、部门)
+	 */
+	private String organizationType;
+
+
     /**
      * 周期单位
      */

+ 4 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/service/IDeptResponsibilityService.java

@@ -3,6 +3,7 @@ package com.ims.eval.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ims.eval.entity.DeptResponsibility;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -18,8 +19,9 @@ public interface IDeptResponsibilityService extends IService<DeptResponsibility>
 
 	IPage<DeptResponsibility> list(Integer pageNum, Integer pageSize, String id, String cycleUnit, String checkCycle, String beginDate, String endDate, String stage, String createBy, String year, String month);
 
-	List<DeptResponsibility> list( String organizationId, String checkCycle,  String year, String month);
-
+	List<DeptResponsibility> list(String organizationId, String checkCycle, String year, String month);
 
 	boolean generateResponsibility(String orgEvalRuleId);
+
+	boolean saveOrUpdate2(DeptResponsibility entity);
 }

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/IOrganizationEvaluationRuleService.java

@@ -24,6 +24,6 @@ public interface IOrganizationEvaluationRuleService extends IService<Organizatio
 
 	IPage<OrganizationEvaluationRule> list2( Integer pageNum, Integer pageSize, String id, String organizationName, String organizationId, String organizationType, String binSection, String binStage, String evaluationCycle);
 
-//	List<OrganizationEvaluationRule> listBy(String organizationId, String organizationType, String binSection, String binStage, String evaluationCycle,String year,String month);
+	List<OrganizationEvaluationRule> listByIsCheck(String organizationType,String evaluationCycle,Boolean isCheck,Boolean delFlag);
 
 }

+ 3 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/IResponsibilityIndicatorInfoService.java

@@ -21,7 +21,9 @@ import java.util.Map;
 public interface IResponsibilityIndicatorInfoService extends IService<ResponsibilityIndicatorInfo> {
 
 
-	Map<String  ,List<ResponsibilityIndicatorInfoResDTO>> listByresponsibilityId(List<String> deptResponsibilityIds, String dept);
+	Map<String  ,List<ResponsibilityIndicatorInfoResDTO>> planValueList(List<String> deptResponsibilityIds, String dept);
+
+	Map<String  ,List<ResponsibilityIndicatorInfoResDTO>> finishValueList(List<String> deptResponsibilityIds, String dept);
 
 
 	boolean saveOrUpdateDto(ResponsibilityIndicatorInfoUpdateDTO infoUpdateDTO);

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

@@ -243,6 +243,64 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
 	@Transactional
 	@Override
 	public boolean saveOrUpdate(DeptResponsibility entity) {
+		//获取指定部门的规则
+		List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.listByIsCheck(entity.getOrganizationType(),entity.getCheckCycle(), true, false);
+		if (null == list || list.size() <= 0) {
+			throw new CustomException("不存在单位权重配置");
+		}
+		//获取组织id;
+		List<String> organizationIds = list.stream().map(OrganizationEvaluationRule::getOrganizationId).collect(Collectors.toList());
+
+		StringBuilder responsibilityCode = new StringBuilder();
+		responsibilityCode.append(entity.getOrganizationType()).append("_");
+		responsibilityCode.append(entity.getCheckCycle()).append("_");
+
+		//判断该是否存在目标责任书
+		List<DeptResponsibility> oriList = new ArrayList<>();
+		if ("NDKP".equals(entity.getCheckCycle())) {
+			oriList = list("", entity.getCheckCycle(), entity.getYear(), "");
+			responsibilityCode.append(entity.getYear()).append("_");
+		}
+		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);
+			responsibilityCode.append(entity.getYear()).append("_").append(month).append("_");
+		}
+		if ("YDKP".equals(entity.getCheckCycle())) {
+			oriList = list("", entity.getCheckCycle(), entity.getYear(), entity.getMonth());
+			responsibilityCode.append(entity.getYear()).append("_").append(entity.getMonth()).append("_");
+		}
+		responsibilityCode.append(DateUtils.toDate(new Date()));
+
+		if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
+			if (null != oriList && oriList.size() > 0) {
+				throw new CustomException("此单位在该阶段已存在目标责任书");
+			}
+			//保存目标责任书
+			entity.setResponsibilityCode(responsibilityCode.toString());
+			entity.setOrganizationId(organizationIds.toString());//考评组织ID
+			entity.setStage("流程未启动");
+			entity.setCreateTime(new Date());
+		} else {
+			DeptResponsibility 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(organizationIds.toString());//考评组织ID
+			entity.setUpdateTime(new Date());
+		}
+		boolean b = super.saveOrUpdate(entity);
+		return b;
+	}
+
+	@Transactional
+	@Override
+	public boolean saveOrUpdate2(DeptResponsibility entity) {
 
 		//获取指定部门的规则
 		OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(entity.getOrganizationEvaluationRuleId());
@@ -302,10 +360,19 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
 	@Override
 	public List<DeptResponsibility> list(String organizationId, String checkCycle, String year, String month) {
 		QueryWrapper<DeptResponsibility> qw = new QueryWrapper<>();
-		qw.lambda().eq(DeptResponsibility::getOrganizationId, organizationId);
-		qw.lambda().eq(DeptResponsibility::getCheckCycle, checkCycle);
-		qw.lambda().eq(DeptResponsibility::getYear, year);
-		qw.lambda().in(DeptResponsibility::getYear, month);
+		if (StringUtils.isNotEmpty(organizationId)) {
+			qw.lambda().eq(DeptResponsibility::getOrganizationId, organizationId);
+		}
+
+		if (StringUtils.isNotEmpty(checkCycle)) {
+			qw.lambda().eq(DeptResponsibility::getCheckCycle, checkCycle);
+		}
+		if (StringUtils.isNotEmpty(year)) {
+			qw.lambda().eq(DeptResponsibility::getYear, year);
+		}
+		if (StringUtils.isNotEmpty(month)) {
+			qw.lambda().in(DeptResponsibility::getMonth, month);
+		}
 		List<DeptResponsibility> list = baseMapper.selectList(qw);
 		return list;
 	}

+ 32 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationRuleServiceImpl.java

@@ -150,6 +150,38 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
 	}
 
 
+	@Override
+	public List<OrganizationEvaluationRule> listByIsCheck(String organizationType,String evaluationCycle, Boolean isCheck, Boolean delFlag) {
+
+		if (StringUtils.isEmpty(organizationType) || StringUtils.isEmpty(evaluationCycle)) {
+			throw new CustomException("获取考评配置时,考评类型为空");
+		}
+
+		QueryWrapper<OrganizationEvaluationRule> qw = new QueryWrapper<>();
+
+
+		if (StringUtils.isNotEmpty(organizationType)) {
+			qw.lambda().eq(OrganizationEvaluationRule::getOrganizationType, organizationType);
+		}
+
+		if (StringUtils.isNotEmpty(evaluationCycle)) {
+			qw.lambda().eq(OrganizationEvaluationRule::getEvaluationCycle, evaluationCycle);
+		}
+
+		if (null != isCheck) {
+			qw.lambda().eq(OrganizationEvaluationRule::getIsCheck, isCheck);
+		}
+
+		if (null != delFlag) {
+			qw.lambda().eq(OrganizationEvaluationRule::getDelFlag, delFlag);
+		}
+
+		List<OrganizationEvaluationRule> list = baseMapper.selectList(qw);
+		return list;
+	}
+
+
+
 	@Transactional
 	@Override
 	public boolean saveOrUpdate(OrganizationEvaluationRule entity) {

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

@@ -31,7 +31,7 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
 
 
 	@Override
-	public Map<String  ,List<ResponsibilityIndicatorInfoResDTO>> listByresponsibilityId(List<String> deptResponsibilityIds, String dept) {
+	public Map<String  ,List<ResponsibilityIndicatorInfoResDTO>> planValueList(List<String> deptResponsibilityIds, String dept) {
 		List<ResponsibilityIndicatorInfoResDTO> list = baseMapper.listByresponsibilityId(deptResponsibilityIds,dept,"JHZ");
 
 		Map<String  ,List<ResponsibilityIndicatorInfoResDTO>> map  = list.stream().collect(Collectors.groupingBy(ResponsibilityIndicatorInfoResDTO::getIsQuantified));
@@ -41,6 +41,13 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
 
 	}
 
+	@Override
+	public Map<String, List<ResponsibilityIndicatorInfoResDTO>> finishValueList(List<String> deptResponsibilityIds, String dept) {
+
+
+		return null;
+	}
+
 
 	@Transactional
 	@Override