Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

‘xugp 1 vuosi sitten
vanhempi
commit
12e6abc9d4
25 muutettua tiedostoa jossa 626 lisäystä ja 35 poistoa
  1. 136 0
      ims-common/src/main/java/com/ims/common/utils/DoubleUtils.java
  2. 5 0
      ims-service/ims-eval/src/main/java/com/ims/eval/cache/CacheContext.java
  3. 8 10
      ims-service/ims-eval/src/main/java/com/ims/eval/controller/EvaluateReportController.java
  4. 1 4
      ims-service/ims-eval/src/main/java/com/ims/eval/controller/EvaluateReportInfoController.java
  5. 21 0
      ims-service/ims-eval/src/main/java/com/ims/eval/controller/OrganizationEvaluationController.java
  6. 8 0
      ims-service/ims-eval/src/main/java/com/ims/eval/dao/EvaluationScoreCountMapper.java
  7. 4 0
      ims-service/ims-eval/src/main/java/com/ims/eval/dao/OrganizationEvaluationMapper.java
  8. 19 0
      ims-service/ims-eval/src/main/java/com/ims/eval/entity/custom/IsOkAction.java
  9. 60 0
      ims-service/ims-eval/src/main/java/com/ims/eval/entity/custom/Opinion.java
  10. 17 0
      ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/response/OrganizationEvaluationResDTO.java
  11. 26 0
      ims-service/ims-eval/src/main/java/com/ims/eval/entity/flow/FlowResult.java
  12. 3 0
      ims-service/ims-eval/src/main/java/com/ims/eval/service/IDeptResponsibilityService.java
  13. 3 1
      ims-service/ims-eval/src/main/java/com/ims/eval/service/IEvaluateReportInfoService.java
  14. 6 1
      ims-service/ims-eval/src/main/java/com/ims/eval/service/IEvaluateReportService.java
  15. 3 0
      ims-service/ims-eval/src/main/java/com/ims/eval/service/IEvaluationScoreCountService.java
  16. 12 0
      ims-service/ims-eval/src/main/java/com/ims/eval/service/IOrganizationEvaluationService.java
  17. 65 0
      ims-service/ims-eval/src/main/java/com/ims/eval/service/custom/WorkflowService.java
  18. 8 0
      ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/DeptResponsibilityServiceImpl.java
  19. 7 5
      ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluateReportInfoServiceImpl.java
  20. 134 12
      ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluateReportServiceImpl.java
  21. 6 0
      ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluatioinScoreCountServiceImpl.java
  22. 21 0
      ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationServiceImpl.java
  23. 37 0
      ims-service/ims-eval/src/main/resources/mappers/EvaluationScoreCountMapper.xml
  24. 2 2
      ims-service/ims-eval/src/main/resources/mappers/OrganizationEvaluationInfoMapper.xml
  25. 14 0
      ims-service/ims-eval/src/main/resources/mappers/OrganizationEvaluationMapper.xml

+ 136 - 0
ims-common/src/main/java/com/ims/common/utils/DoubleUtils.java

@@ -0,0 +1,136 @@
+package com.ims.common.utils;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author : wang
+ * @Date: 2023-03-26
+ * @Description :
+ */
+public class DoubleUtils {
+
+    /**
+     * 保留两位小数
+     * @param number
+     * @param precision
+     * @return
+     */
+    public static double keepPrecision(double number, int precision) {
+        BigDecimal bg = new BigDecimal(number);
+        return bg.setScale(precision, BigDecimal.ROUND_HALF_UP).doubleValue();
+    }
+
+
+    /**
+     * double保留小数点位数,四舍五入
+     * 比如处理价格等数据
+     * @param d 要处理的double值
+     * @param n 要保留的位数
+     * @return
+     */
+    public static double getRoundingNum(double d , int n) {
+        BigDecimal b = new BigDecimal(String.valueOf(d));
+        b = b.divide(BigDecimal.ONE, n, BigDecimal.ROUND_HALF_UP);
+        return b.doubleValue();
+    }
+    /**
+     *
+     * @param numA 数字A
+     * @param numB 数字B
+     * @param operate 运算符
+     * @return
+     */
+    public static double GetResult(double numA, double numB, String operate){
+        double res = 0;
+        BigDecimal bigA = new BigDecimal(Double.toString(numA));
+        BigDecimal bigB = new BigDecimal(Double.toString(numB));
+        switch (operate) {
+
+            case "+":
+                res = bigA.add(bigB).doubleValue();
+                break;
+            case "-":
+                res = bigA.subtract(bigB).doubleValue();
+                break;
+            case "*":
+                res = bigA.multiply(bigB).doubleValue();
+                break;
+            case "/":
+                res = bigA.divide(bigB,2,BigDecimal.ROUND_HALF_UP).doubleValue();
+                break;
+            default :
+                System.out.println("运算符不合法~");
+                break;
+        }
+        return res;
+    }
+
+
+    public static Double sum(Double ...in){
+        Double result = 0.0;
+        for (int i = 0; i < in.length; i++){
+            result = result+(ifNullSet0(in[i]));
+        }
+        return result;
+    }
+
+    public static String hb(String ...in){
+        String result = "";
+        for (int i = 0; i < in.length; i++){
+            result = result+in[i];
+        }
+        return result;
+    }
+
+    public static Integer sum(Integer ...in) {
+        Integer result = 0;
+        for (int i = 0; i < in.length; i++){
+            result = result+(ifNullSet0(in[i]));
+        }
+        return result;
+    }
+
+    public static Double max(Double ...in){
+        Double result = 0.0;
+        for (int i = 0; i < in.length; i++){
+            if (result<ifNullSet0(in[i])){
+                result=ifNullSet0(in[i]);
+            }
+        }
+        return result;
+    }
+
+    public static Double min(Double ...in){
+        Double result = 0.0;
+        for (int i = 0; i < in.length; i++){
+            if (i==0){
+                result=ifNullSet0(in[0]);
+            }
+            if (result>ifNullSet0(in[i])){
+                result=ifNullSet0(in[i]);
+            }
+        }
+        return result;
+    }
+    public static Double ave(Double ...in){
+        if(in.length==0){
+            return 0.0;
+        }else{
+            return sum(in)/in.length;
+        }
+
+    }
+    public static Double ifNullSet0(Double in) {
+        if (in != null) {
+            return in;
+        }
+        return 0.0;
+    }
+
+    public static Integer ifNullSet0(Integer in) {
+        if (in != null) {
+            return in;
+        }
+        return 0;
+    }
+}

+ 5 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/cache/CacheContext.java

@@ -52,6 +52,8 @@ public class CacheContext implements CommandLineRunner {
 	//生产经营业务分类
 	public static List<BinSection> bsnList = new ArrayList<>();
 
+	public static Map<String, BinSection> bsnIdObject = new HashMap<>();
+
 
 
 
@@ -123,6 +125,9 @@ public class CacheContext implements CommandLineRunner {
 
 		bsnList = binSectionService.list().stream().filter(t->!t.getDelFlag()).collect(Collectors.toList());
 		bsnList.sort(Comparator.comparing(BinSection::getOrderNum));
+		bsnList.stream().forEach(d -> {
+			bsnIdObject.put(d.getId(), d);
+		});
 	}
 
 

+ 8 - 10
ims-service/ims-eval/src/main/java/com/ims/eval/controller/EvaluateReportController.java

@@ -8,11 +8,7 @@ import com.ims.eval.entity.Indicator;
 import com.ims.eval.entity.dto.result.R;
 import com.ims.eval.service.IEvaluateReportService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -37,12 +33,14 @@ public class EvaluateReportController {
 	 * 生成考评报告
 	 *
 	 * @param organizationEvaluationId 组织考评主键
+	 * @param backroll                 重算表示
 	 * @return
 	 */
 	//@ImsPreAuth("eval:dataDictionary:view")
-	@GetMapping(value = "generateEvaluateReport")
-	public R generateEvaluateReport(@RequestParam(value = "organizationEvaluationId", required = false) String organizationEvaluationId) {
-		boolean b = evaluateReportService.generateEvaluateReport(organizationEvaluationId);
+	@PostMapping(value = "generateEvaluateReport")
+	public R generateEvaluateReport(@RequestParam(value = "organizationEvaluationId", required = false) String organizationEvaluationId,
+									@RequestParam(value = "backroll", required = false) boolean backroll) {
+		boolean b = evaluateReportService.generateEvaluateReport(organizationEvaluationId,backroll);
 		return R.ok().data(b);
 	}
 
@@ -54,7 +52,7 @@ public class EvaluateReportController {
 	 * @param pageSize
 	 * @param id                       主键
 	 * @param evaluateReportName       报告名称
-	 * @param binSection			   业务版块
+	 * @param binSection               业务版块
 	 * @param organizationEvaluationId 考评记录id
 	 * @param organizationType         考评类别(单位、部门)
 	 * @param checkCycle               周期
@@ -74,7 +72,7 @@ public class EvaluateReportController {
 				  @RequestParam(value = "checkCycle", required = false) String checkCycle,
 				  @RequestParam(value = "year", required = false) String year,
 				  @RequestParam(value = "month", required = false) String month) {
-		IPage<EvaluateReport> list = evaluateReportService.list(pageNum, pageSize, id, evaluateReportName, binSection,  organizationEvaluationId, organizationType, checkCycle, year, month);
+		IPage<EvaluateReport> list = evaluateReportService.list(pageNum, pageSize, id, evaluateReportName, binSection, organizationEvaluationId, organizationType, checkCycle, year, month);
 		return R.ok().data(list);
 	}
 

+ 1 - 4
ims-service/ims-eval/src/main/java/com/ims/eval/controller/EvaluateReportInfoController.java

@@ -1,9 +1,6 @@
 package com.ims.eval.controller;
 
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ims.eval.entity.EvaluateReport;
-import com.ims.eval.entity.EvaluateReportInfo;
 import com.ims.eval.entity.dto.result.R;
 import com.ims.eval.service.IEvaluateReportInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,7 +39,7 @@ public class EvaluateReportInfoController {
 	//@ImsPreAuth("eval:dataDictionary:view")
 	@GetMapping(value = "list")
 	public R list(@RequestParam(value = "evaluateReportId", required = true) String evaluateReportId) {
-		Map<String,List<Map>> list = evaluateReportInfoService.listByReportId(evaluateReportId);
+		Map<String,List<Map>> list = evaluateReportInfoService.mapByReportId(evaluateReportId);
 		return R.ok().data(list);
 	}
 

+ 21 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/controller/OrganizationEvaluationController.java

@@ -4,6 +4,7 @@ package com.ims.eval.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ims.eval.config.CustomException;
 import com.ims.eval.entity.OrganizationEvaluation;
+import com.ims.eval.entity.dto.response.OrganizationEvaluationResDTO;
 import com.ims.eval.entity.dto.result.R;
 import com.ims.eval.service.IOrganizationEvaluationService;
 import io.swagger.annotations.ApiOperation;
@@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -192,4 +194,23 @@ public class OrganizationEvaluationController {
 	}
 
 
+	/**
+	 *
+	 * @param id 目标责任书id
+	 * @return
+	 */
+	//@ImsPreAuth("eval:organizationEvaluation:view")
+	@GetMapping(value = "getByidAndInfo")
+	public R planValueList(
+		@RequestParam(value = "id", required = false) String  id,
+		@RequestParam(value = "dept", required = false) String dept) {
+		OrganizationEvaluationResDTO resDTO = organizationEvaluationService.getByidAndInfo(id, dept);
+		return R.ok().data(resDTO);
+	}
+
+
+
+
+
+
 }

+ 8 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/dao/EvaluationScoreCountMapper.java

@@ -3,6 +3,9 @@ package com.ims.eval.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ims.eval.entity.BinSection;
 import com.ims.eval.entity.EvaluationScoreCount;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -14,4 +17,9 @@ import com.ims.eval.entity.EvaluationScoreCount;
  */
 public interface EvaluationScoreCountMapper extends BaseMapper<EvaluationScoreCount> {
 
+
+	List<EvaluationScoreCount> selelctListByEvaluationRuleId(@Param("organizationEvaluationId") String organizationEvaluationId,
+															 @Param("organizationEvaluationRuleId") String organizationEvaluationRuleId,
+															 @Param("binStage") String binStage);
+
 }

+ 4 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/dao/OrganizationEvaluationMapper.java

@@ -2,6 +2,8 @@ package com.ims.eval.dao;
 
 import com.ims.eval.entity.OrganizationEvaluation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ims.eval.entity.dto.response.OrganizationEvaluationResDTO;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface OrganizationEvaluationMapper extends BaseMapper<OrganizationEvaluation> {
 
+	OrganizationEvaluationResDTO selectById(@Param("id")String id);
+
 }

+ 19 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/custom/IsOkAction.java

@@ -50,4 +50,23 @@ public class IsOkAction {
 	 */
 	private String iamCode;
 
+
+	/**
+	 * 流程key
+	 */
+	private String defKey;
+
+	/**
+	 * 业务id
+	 */
+	private String bizKey;
+
+	/**
+	 * 节点名称
+	 */
+	private String  taskName;
+
+
+
+
 }

+ 60 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/custom/Opinion.java

@@ -0,0 +1,60 @@
+package com.ims.eval.entity.custom;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class Opinion {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * id
+	 */
+	private String id;
+
+	/**
+	 * 状态
+	 */
+	private String status;
+
+	/**
+	 * 时间
+	 */
+	private Date approveTime;
+
+	/**
+	 * 流程实例id
+	 */
+	private String taskName;
+
+	/**
+	 * 流程发起意见
+	 */
+	private String opinion;
+
+	/**
+	 * 驳回到的节点(自由驳回时生效)
+	 */
+	private String destination;
+
+	/**
+	 * 编码
+	 */
+	private String iamCode;
+
+
+	/**
+	 * 流程key
+	 */
+	private String defKey;
+
+	/**
+	 * 业务id
+	 */
+	private String bizKey;
+
+
+
+}

+ 17 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/response/OrganizationEvaluationResDTO.java

@@ -0,0 +1,17 @@
+package com.ims.eval.entity.dto.response;
+
+import com.ims.eval.entity.OrganizationEvaluation;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+
+@Data
+@ApiModel(value = "考评明细响应类", description = "考评明细响应类")
+public class OrganizationEvaluationResDTO  extends OrganizationEvaluation {
+
+	//明细
+	Map<String, List<OrganizationEvaluationInfoResDTO>> map;
+}

+ 26 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/flow/FlowResult.java

@@ -0,0 +1,26 @@
+package com.ims.eval.entity.flow;
+
+import lombok.Data;
+
+@Data
+public class FlowResult {
+	private static final long serialVersionUID = 6131673218827464899L;
+
+	/**
+	 * 本次调用是否成功
+	 */
+	private Boolean isOk;
+
+	/**
+	 * 操作提示信息
+	 */
+	private String msg;
+
+
+	/**
+	 * 状态码
+	 */
+	private String code;
+
+
+}

+ 3 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/IDeptResponsibilityService.java

@@ -32,4 +32,7 @@ public interface IDeptResponsibilityService extends IService<DeptResponsibility>
 	List<Map> targetValueeport(String id, String dept, HttpServletRequest request);
 
 
+	boolean editState(String id,String state);
+
+
 }

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

@@ -19,6 +19,8 @@ import java.util.Map;
  */
 public interface IEvaluateReportInfoService extends IService<EvaluateReportInfo> {
 
-	Map<String,List<Map>> listByReportId(String evaluateReportId);
+	Map<String,List<Map>> mapByReportId(String evaluateReportId);
+
+	List<EvaluateReportInfo> listByReportId(String evaluateReportId);
 
 }

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

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ims.eval.entity.EvaluateReport;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -14,8 +16,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IEvaluateReportService extends IService<EvaluateReport> {
 
-	boolean generateEvaluateReport(String organizationEvaluationId);
+	boolean generateEvaluateReport(String organizationEvaluationId,boolean backroll);
 
 	IPage<EvaluateReport> list(Integer pageNum,Integer pageSize, String id,String evaluateReportName,String  binSection, String organizationEvaluationId, String organizationType,String  checkCycle, String year,String  month);
 
+
+	List<EvaluateReport> list(String organizationEvaluationId,String binSection);
+
 }

+ 3 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/IEvaluationScoreCountService.java

@@ -17,4 +17,7 @@ import java.util.List;
 public interface IEvaluationScoreCountService extends IService<EvaluationScoreCount> {
 
 
+
+	List<EvaluationScoreCount> getListByEvaluationRuleId(String organizationEvaluationId,String organizationEvaluationRuleId,String binStage);
+
 }

+ 12 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/IOrganizationEvaluationService.java

@@ -1,11 +1,16 @@
 package com.ims.eval.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ims.eval.entity.DeptResponsibility;
 import com.ims.eval.entity.OrganizationEvaluation;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ims.eval.entity.dto.response.OrganizationEvaluationResDTO;
+import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -34,4 +39,11 @@ public interface IOrganizationEvaluationService extends IService<OrganizationEva
 	List<OrganizationEvaluation> list(String organizationId, String checkCycle, String year, String month);
 
 
+	boolean editState(String id, String state);
+
+
+	OrganizationEvaluationResDTO getByidAndInfo(String id, String dept);
+
+
+
 }

+ 65 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/custom/WorkflowService.java

@@ -5,8 +5,13 @@ import com.alibaba.fastjson.JSONObject;
 import com.ims.eval.config.ImaConfig;
 import com.ims.eval.entity.custom.DoAction;
 import com.ims.eval.entity.custom.IsOkAction;
+import com.ims.eval.entity.custom.Menu;
 import com.ims.eval.entity.custom.TodoTask;
+import com.ims.eval.entity.flow.FlowResult;
+import com.ims.eval.service.IDeptResponsibilityService;
+import com.ims.eval.service.IOrganizationEvaluationService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.ibatis.annotations.Case;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.*;
 import org.springframework.stereotype.Service;
@@ -14,6 +19,7 @@ import org.springframework.web.client.RestTemplate;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 
 
@@ -35,6 +41,12 @@ public class WorkflowService {
 	@Autowired
 	private ImaConfig imaConfig;
 
+	@Autowired
+	private IDeptResponsibilityService deptResponsibilityService;
+
+	@Autowired
+	private IOrganizationEvaluationService organizationEvaluationService;
+
 
 
 	/**
@@ -117,6 +129,15 @@ public class WorkflowService {
 		ResponseEntity<String> responseEntity2 = restTemplate.exchange("http://10.65.78.23:8080/bpm/task/doAction", HttpMethod.POST,param,String.class);
 		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
 		if(200== responseEntity2.getStatusCodeValue()){
+
+			FlowResult result = JSON.parseObject(responseEntity2.getBody()).toJavaObject(FlowResult.class);
+			if(result.getIsOk()){
+				boolean biz = updateWorkflowState(isOkAction.getInstanceId(),isOkAction.getDefKey(),isOkAction.getBizKey(),isOkAction.getTaskName());
+				if(biz){
+					log.info("状态修改成功");
+				}
+			}
+
 			return JSON.parseObject(responseEntity2.getBody());
 		}
 		return null;
@@ -148,4 +169,48 @@ public class WorkflowService {
 	}
 
 
+
+
+	/**
+	 * 获取流程意见
+	 * @param instId
+	 * @param iamCode
+	 * @param request
+	 * @return
+	 */
+	public JSONObject getOpinion(String instId,String iamCode, HttpServletRequest request){
+		HttpHeaders headers = new HttpHeaders();
+		headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
+		headers.add("Blade-Auth", request.getHeader("Blade-Auth"));
+		headers.add("code", request.getHeader("code"));
+
+		HttpEntity<Map> param = new HttpEntity<>(null, headers);
+		ResponseEntity<String> responseEntity2 = restTemplate.postForEntity("http://10.65.78.23:8080/bpm/instance/getOpinion??instId={1}&iamCode={2}",
+			param, String.class, instId, iamCode);
+
+		log.info("\n code:{}\n header:{}\n body:{}\n", responseEntity2.getStatusCodeValue(), responseEntity2.getHeaders(), responseEntity2.getBody());
+		if(200== responseEntity2.getStatusCodeValue()){
+			return JSON.parseObject(responseEntity2.getBody());
+		}
+		return null;
+	}
+
+	private boolean updateWorkflowState(String instanceId, String defKey, String bizKey,String taskName) {
+
+		switch (defKey) {
+			case "dwkpmbqd"://单位考评目标启动
+				deptResponsibilityService.editState(bizKey,taskName);
+				break;
+			case "yddwkplc"://月度单位考评流程
+				organizationEvaluationService.editState(bizKey,taskName);
+				break;
+			case "dwkpmbxd"://单位考评目标修订
+
+				break;
+		}
+		return true;
+
+	}
+
+
 }

+ 8 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/DeptResponsibilityServiceImpl.java

@@ -250,6 +250,14 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
 		return null;
 	}
 
+	@Override
+	public boolean editState(String id, String state) {
+		DeptResponsibility responsibility = baseMapper.selectById(id);
+		responsibility.setStage(state);
+		boolean b = super.saveOrUpdate(responsibility);
+		return b;
+	}
+
 	@Transactional
 	@Override
 	public boolean saveOrUpdate(DeptResponsibility entity) {

+ 7 - 5
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluateReportInfoServiceImpl.java

@@ -30,7 +30,7 @@ import java.util.stream.Collectors;
 public class EvaluateReportInfoServiceImpl extends ServiceImpl<EvaluateReportInfoMapper, EvaluateReportInfo> implements IEvaluateReportInfoService {
 
 	@Override
-	public Map<String,List<Map>> listByReportId(String evaluateReportId) {
+	public Map<String,List<Map>> mapByReportId(String evaluateReportId) {
 
 
 		Map<String,List<Map>> datemap = new LinkedHashMap<>();
@@ -42,10 +42,6 @@ public class EvaluateReportInfoServiceImpl extends ServiceImpl<EvaluateReportInf
 
 		Map<String, List<EvaluateReportInfo>> map = list.stream().collect(Collectors.groupingBy(ord -> ord.getOrganizationId() + "," + ord.getOrganizationName()));
 
-
-
-
-
 		map.forEach((k, v) -> {
 			String[] zb = k.split(",");
 			if(listtitle.size()<=0){
@@ -78,4 +74,10 @@ public class EvaluateReportInfoServiceImpl extends ServiceImpl<EvaluateReportInf
 		datemap.put("body",listmap);
 		return datemap;
 	}
+
+	@Override
+	public List<EvaluateReportInfo> listByReportId(String evaluateReportId) {
+		List<EvaluateReportInfo> list = baseMapper.selectListByReportId(evaluateReportId);
+		return list;
+	}
 }

+ 134 - 12
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluateReportServiceImpl.java

@@ -1,18 +1,22 @@
 package com.ims.eval.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ims.common.utils.DoubleUtils;
+import com.ims.common.utils.StringUtils;
+import com.ims.eval.cache.CacheContext;
 import com.ims.eval.config.CustomException;
-import com.ims.eval.entity.EvaluateReport;
+import com.ims.eval.entity.*;
 import com.ims.eval.dao.EvaluateReportMapper;
-import com.ims.eval.entity.Indicator;
-import com.ims.eval.entity.OrganizationEvaluation;
-import com.ims.eval.service.IEvaluateReportService;
+import com.ims.eval.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ims.eval.service.IOrganizationEvaluationRuleService;
-import com.ims.eval.service.IOrganizationEvaluationService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -32,27 +36,132 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
 
 	@Autowired
 	private IOrganizationEvaluationRuleService organizationEvaluationRuleService;
+
+	@Autowired
+	private IEvaluateRuleService evaluateRuleService;
+
+
+
+	@Autowired
+	private IEvaluationScoreCountService evaluationScoreCountService;
+
+	@Autowired
+	private IEvaluateReportInfoService evaluateReportInfoService;
+
+
 	//考评结果报告
 	//按照业务类型生成
 	//业务阶综合展示
 
+	@Transactional
 	@Override
-	public boolean generateEvaluateReport(String organizationEvaluationId) {
+	public boolean generateEvaluateReport(String organizationEvaluationId,boolean backroll) {
+
+
+		EvaluateReport evaluateReport = new EvaluateReport();
 		OrganizationEvaluation evaluation = organizationEvaluationService.getById(organizationEvaluationId);
 		if (null == evaluation) {
 			throw new CustomException("没有此靠考评");
 		}
 
 		//获取到对应组织考评规则
-		String evaluationRuleIds = evaluation.getOrganizationEvaluationRuleId();
-		if (null == evaluationRuleIds || evaluationRuleIds.length() <= 0) {
+		String evaluationRuleId = evaluation.getOrganizationEvaluationRuleId();
+		if (null == evaluationRuleId || evaluationRuleId.length() <= 0) {
 			throw new CustomException("组织考评id为空");
 		}
 
-		//
-//		organizationEvaluationRuleService.listByIds();
+		//获取单位配置规则
+		List<String> evaluationRuleIds = Arrays.asList(evaluationRuleId.split(","));
+		List<OrganizationEvaluationRule> evaluationRuleList = organizationEvaluationRuleService.listByIds(evaluationRuleIds);
 
-		return false;
+		//按业务吧板块分类
+		Map<String, List<OrganizationEvaluationRule>> binSectionmap = evaluationRuleList.stream().collect(Collectors.groupingBy(OrganizationEvaluationRule::getBinSection));
+		for(Map.Entry<String, List<OrganizationEvaluationRule>> rulemap :binSectionmap.entrySet()){
+			//各板块明细存储
+			List<EvaluateReportInfo> evaluateRuleInfoList = new ArrayList<>();
+			//遍历各单位考评规则
+			for(OrganizationEvaluationRule rule :rulemap.getValue()){
+
+				StringBuilder reportName = new StringBuilder();
+				if ("NDKP".equals(evaluation.getCheckCycle())) {
+					reportName.append("年度");
+				}
+				if ("JDKP".equals(evaluation.getCheckCycle())) {
+					reportName.append("季度");
+				}
+				if ("YDKP".equals(evaluation.getCheckCycle())) {
+					reportName.append("月度");
+				}
+				reportName.append(CacheContext.bsnIdObject.get(rule.getBinSection()).getSectionName());
+				if ("DWKP".equals(evaluation.getOrganizationType())) {
+					reportName.append("单位");
+				}
+				if ("BNMKP".equals(evaluation.getOrganizationType())) {
+					reportName.append("部门");
+				}
+				reportName.append("综合考核评分汇总表");
+
+				evaluateReport.setEvaluateReportName(reportName.toString());
+				evaluateReport.setOrganizationEvaluationId(evaluation.getId());
+				evaluateReport.setBinSection(rulemap.getKey());
+				evaluateReport.setOrganizationType(evaluation.getOrganizationType());
+				evaluateReport.setCheckCycle(evaluation.getCheckCycle());
+				evaluateReport.setYear(evaluation.getYear());
+				evaluateReport.setMonth(evaluation.getMonth());
+				evaluateReport.setCreateTime(new Date());
+				evaluateReport.setCreateBy("");//人员
+
+				List<EvaluateReport> oriReports  = list(evaluation.getId(),rulemap.getKey());
+				if(oriReports.size()>0 && !backroll){
+					throw new CustomException("综合考核评分汇总已生成");
+				} else {
+					for (EvaluateReport r : oriReports) {
+						boolean b = super.removeById(r.getId());
+						if (!b) {
+							throw new CustomException("综合考核评分汇总重算失败");
+						}
+						List<EvaluateReportInfo> infolist = evaluateReportInfoService.listByReportId(r.getId());
+						if (null != infolist && infolist.size() > 0) {
+							List<String> infolistIds = infolist.stream().map(EvaluateReportInfo::getId).collect(Collectors.toList());
+							b = evaluateReportInfoService.removeByIds(infolistIds);
+							if (!b) {
+								throw new CustomException("综合考核评分汇总重算失败");
+							}
+						}
+					}
+				}
+				boolean b = super.saveOrUpdate(evaluateReport);
+
+				if(!b){
+					throw new CustomException("综合考核评分汇总表存储失败");
+				}
+
+				//获取考评股则
+				List<String> evaluateRuleIdList = Arrays.asList(rule.getEvaluateRuleId().split(","));
+				rule.getId();//单位考评规则
+				List<EvaluateRule> evaluateRuleList = evaluateRuleService.listByIds(evaluateRuleIdList);
+				for(EvaluateRule rule1 : evaluateRuleList){
+					List<EvaluationScoreCount> scoreCount =  evaluationScoreCountService.getListByEvaluationRuleId(organizationEvaluationId,rule.getId(),rule1.getBinStage());
+					double scor =  scoreCount.stream().mapToDouble(EvaluationScoreCount::getScore).sum();
+					EvaluateReportInfo reportInfo =  new EvaluateReportInfo();
+					reportInfo.setEvaluateReportId(evaluateReport.getId());
+					reportInfo.setOrganizationId(rule.getOrganizationId());
+					reportInfo.setOrganizationName(rule.getOrganizationName());
+					reportInfo.setBinStage(rule1.getBinStage());
+					reportInfo.setScore(DoubleUtils.keepPrecision(scor,2));
+					reportInfo.setDiscountScore(1.0);
+					evaluateRuleInfoList.add(reportInfo);
+				}
+			}
+			for(EvaluateReportInfo info:evaluateRuleInfoList){
+				boolean b = evaluateReportInfoService.saveOrUpdate(info);
+				if(!b){
+					throw new CustomException("综合考核评分汇总明细存储失败");
+				}
+			}
+		}
+
+		return true;
 	}
 
 	@Override
@@ -70,4 +179,17 @@ public class EvaluateReportServiceImpl extends ServiceImpl<EvaluateReportMapper,
 
 		return list;
 	}
+
+	@Override
+	public List<EvaluateReport> list(String organizationEvaluationId, String binSection) {
+		QueryWrapper<EvaluateReport> qw = new QueryWrapper<>();
+		if (StringUtils.isNotEmpty(organizationEvaluationId)) {
+			qw.lambda().eq(EvaluateReport::getOrganizationEvaluationId,organizationEvaluationId);
+		}
+		if (StringUtils.isNotEmpty(binSection)) {
+			qw.lambda().eq(EvaluateReport::getBinSection,binSection);
+		}
+		List<EvaluateReport> list = baseMapper.selectList(qw);
+		return list;
+	}
 }

+ 6 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluatioinScoreCountServiceImpl.java

@@ -26,4 +26,10 @@ import java.util.List;
 public class EvaluatioinScoreCountServiceImpl extends ServiceImpl<EvaluationScoreCountMapper, EvaluationScoreCount> implements IEvaluationScoreCountService {
 
 
+
+	@Override
+	public List<EvaluationScoreCount> getListByEvaluationRuleId(String organizationEvaluationId, String organizationEvaluationRuleId, String binStage) {
+		List<EvaluationScoreCount> list = baseMapper.selelctListByEvaluationRuleId(organizationEvaluationId, organizationEvaluationRuleId, binStage);
+		return list;
+	}
 }

+ 21 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationServiceImpl.java

@@ -10,6 +10,8 @@ import com.ims.eval.dao.ResponsibilityIndicatorInfoMapper;
 import com.ims.eval.entity.*;
 import com.ims.eval.dao.OrganizationEvaluationMapper;
 import com.ims.eval.entity.dto.response.IndicatorResDTO;
+import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
+import com.ims.eval.entity.dto.response.OrganizationEvaluationResDTO;
 import com.ims.eval.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -466,6 +468,25 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 		return list;
 	}
 
+	@Override
+	public boolean editState(String id, String state) {
+		OrganizationEvaluation evaluation = baseMapper.selectById(id);
+		evaluation.setStage(state);
+		boolean b = super.saveOrUpdate(evaluation);
+		return b;
+	}
+
+	@Override
+	public OrganizationEvaluationResDTO getByidAndInfo(String id, String dept) {
+		OrganizationEvaluationResDTO resDTO = baseMapper.selectById(id);
+		Map<String  ,List<OrganizationEvaluationInfoResDTO>> map  = organizationEvaluationInfoService.finishValueList(id,dept);
+		if(null != resDTO){
+			resDTO.setMap(map);
+		}
+		return resDTO;
+	}
+
+
 
 	@Transactional
 	@Override

+ 37 - 0
ims-service/ims-eval/src/main/resources/mappers/EvaluationScoreCountMapper.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ims.eval.dao.EvaluationScoreCountMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.ims.eval.entity.EvaluationScoreCount">
+        <id column="id" property="id" />
+        <result column="organization_evaluation_id" property="organizationEvaluationId" />
+        <result column="indicator_id" property="indicatorId" />
+        <result column="score" property="score" />
+        <result column="organization_evaluation_rule_id" property="organizationEvaluationRuleId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, organization_evaluation_id, indicator_id, score, organization_evaluation_rule_id
+    </sql>
+
+    <select id="selelctListByEvaluationRuleId" resultType="com.ims.eval.entity.EvaluationScoreCount">
+        select c.*
+        from evaluation_score_count c
+        LEFT JOIN indicator i on  c.indicator_id = i.id
+        <where>
+            <if test="organizationEvaluationId !=null and organizationEvaluationId !=''">
+                AND c.organization_evaluation_id = #{organizationEvaluationId}
+            </if>
+            <if test="organizationEvaluationRuleId !=null and organizationEvaluationRuleId !=''">
+                AND c.organization_evaluation_rule_id = #{organizationEvaluationRuleId}
+            </if>
+
+            <if test="binStage !=null and binStage !=''">
+                AND i.bin_stage = #{binStage}
+            </if>
+        </where>
+    </select>
+
+</mapper>

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

@@ -66,10 +66,10 @@
                 and  dd.key_name = #{dept}
             </if>
 
-
+            and id.option_code not in ('CZ','CZMAX','CZMIN')
         </where>
 
-        order by ei.option_code desc
+        order by dd.key_name,id.child_name desc
 
     </select>
 

+ 14 - 0
ims-service/ims-eval/src/main/resources/mappers/OrganizationEvaluationMapper.xml

@@ -34,5 +34,19 @@
     <sql id="Base_Column_List">
         id, organization_evaluation_code, organization_name, organization_id, organization_type, check_cycle, year, month, organization_evaluation_rule_id, begin_date, end_date, stage, des, create_time, create_by, update_time, update_by, review_people, review_people_time, review_opinion, final_review_people, final_review_people_time, final_review_opinion, remark
     </sql>
+    <select id="selectById" resultType="com.ims.eval.entity.dto.response.OrganizationEvaluationResDTO">
+        SELECT
+        *
+        FROM
+        organization_evaluation o
+
+        <where>
+            <if test="id !=null and id !=''">
+                AND o.id = #{id}
+            </if>
+
+        </where>
+
+    </select>
 
 </mapper>