Commit 585706d3 by hzc

数据填报数据抽取

parent 1f85b706
......@@ -577,25 +577,27 @@ public class DataEnterCtrl {
@PostMapping("findOldValueToEdit")
public List<TaskIndValue> findOldValueToEdit(@RequestBody List<TaskIndValue> values,@RequestParam("taskId") String taskId) {
Set<String> indIds = new HashSet<>();
Set<String> objIds = new HashSet<>();
for (TaskIndValue value : values) {
indIds.add(value.getIndId());
objIds.add(value.getObjId());
}
//通过指标id和单位id去查填报值
Map<String,Object> maps = new HashMap<>();
maps.put("indIds",indIds);
maps.put("objIds",objIds);
//taskid不能保存、、要换
List<TaskIndValueTmp> tmpValues= taskService.findOldValueToEdit(taskId);
for (TaskIndValue value : values) {
for (TaskIndValueTmp tmpValue : tmpValues) {
if(value.getIndId().equals(tmpValue.getIndId())
&&value.getObjId().equals(tmpValue.getObjId())){
value.setIndLastValue(tmpValue.getIndLastValue());
value.setIndValue(tmpValue.getIndValue());
if(values.size()>0){
Set<String> indIds = new HashSet<>();
Set<String> objIds = new HashSet<>();
for (TaskIndValue value : values) {
indIds.add(value.getIndId());
objIds.add(value.getObjId());
}
//通过指标id和单位id去查填报值
Map<String,Object> maps = new HashMap<>();
maps.put("indIds",indIds);
maps.put("objIds",objIds);
maps.put("valueTime",values.get(0).getValueTime());
//taskid不能保存、、要换
List<TaskIndValueTmp> tmpValues= taskService.findOldValueToEdit(maps);
for (TaskIndValue value : values) {
for (TaskIndValueTmp tmpValue : tmpValues) {
if(value.getIndId().equals(tmpValue.getIndId())
&&value.getObjId().equals(tmpValue.getObjId())){
value.setIndLastValue(tmpValue.getIndLastValue());
value.setIndValue(tmpValue.getIndValue());
}
}
}
}
......
......@@ -4,6 +4,9 @@ import com.keymobile.indicators.model.entity.dataenter.TaskIndValueTmp;
import org.apache.ibatis.annotations.Mapper;
import tk.mybatis.mapper.common.BaseMapper;
import java.util.List;
import java.util.Map;
/**
* TODO
*
......@@ -13,4 +16,12 @@ import tk.mybatis.mapper.common.BaseMapper;
*/
@Mapper
public interface TaskIndValueTmpMapper extends BaseMapper<TaskIndValueTmp> {
/**
* 查询临时表数据-用途:填报时可以填充值(参考
* @Param maps.put(" indIds ", indIds);
* maps.put("objIds",objIds);
* @Date 2021/1/8 15:32
* @Author hzc
**/
List<TaskIndValueTmp> selectByIndsAndObjs(Map<String, Object> maps);
}
......@@ -8,6 +8,7 @@ import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
* 任务相关服务接口
......@@ -223,9 +224,10 @@ public interface TaskService {
/**
* 查询临时表数据-用途:填报时可以填充值(参考
* @Param [taskId]
* @Param maps.put(" indIds ", indIds);
* maps.put("objIds",objIds);
* @Date 2021/1/8 15:32
* @Author hzc
**/
List<TaskIndValueTmp> findOldValueToEdit(String taskId);
List<TaskIndValueTmp> findOldValueToEdit(Map<String,Object> maps);
}
......@@ -913,15 +913,14 @@ public class TaskServiceImpl implements TaskService {
}
/**
* 查询临时表数据-用途:填报时可以填充值(参考
* @Param [taskId]
* @Param maps.put(" indIds ", indIds);
* maps.put("objIds",objIds);
* @Date 2021/1/8 15:32
* @Author hzc
**/
@Override
public List<TaskIndValueTmp> findOldValueToEdit(String taskId) {
TaskIndValueTmp taskIndValueTmpSql = new TaskIndValueTmp();
taskIndValueTmpSql.setTaskId(taskId);
return taskIndValueTmpMapper.select(taskIndValueTmpSql);
public List<TaskIndValueTmp> findOldValueToEdit(Map<String,Object> maps) {
return taskIndValueTmpMapper.selectByIndsAndObjs(maps);
}
/**
......
......@@ -119,6 +119,16 @@ public class ShortboardRuleService {
fromJson(shortboardRule.getShortboardItemJson(), new TypeToken<List<ShortboardItem>>(){}.getType());
for(ShortboardItem shortboardItem : shortboardItems) {
shortboardType.append(shortboardItem.getType()).append(";");//拼接短板类型
if("1".equals(driveIndDef.getIndRule())){
//指标反向时把最大值和最小值互换
if("2".equals(shortboardItem.getType())){
shortboardItem.setCalType("1");
}else if("1".equals(shortboardItem.getType())){
shortboardItem.setCalType("2");
}
}
List<DriveIndCalResultDef> driveIndCalResults = this.selectShortboardObj(
shortboardItem, shortBoardWarnData.getCompareObjs(), driveId, shortBoardWarnData.getDate(), shortBoardWarnData.getCode());
if(status==0) {
......@@ -239,11 +249,20 @@ public class ShortboardRuleService {
paramMap.put("date", date);
paramMap.put("code", code);
paramMap.put("compareObjs", compareObjs);
paramMap.put("dateMark",date);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObjIn(paramMap);
//反向
if("1".equals(driveIndDef.getIndRule())){
//大于变小于
if("0".equals(shortboardItem.getCalType())){
shortboardItem.setCalType("1");
}else{
shortboardItem.setCalType("0");
}
}
for(DriveIndCalResultDef calResult : calResults) {
//判断规则选择是大于还是小于
if("0".equals(shortboardItem.getCalType())) {//大于
......@@ -346,6 +365,7 @@ public class ShortboardRuleService {
paramMap.put("date", date);
paramMap.put("code", code);
paramMap.put("compareObjs", compareObjs);
paramMap.put("dateMark",date);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObjIn(paramMap);
//获取排名第一的最大值
......@@ -395,6 +415,7 @@ public class ShortboardRuleService {
paramMap.put("date", date);
paramMap.put("code", code);
paramMap.put("compareObjs", compareObjs);
paramMap.put("dateMark",date);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObjIn(paramMap);//根据考核指标id,日期和对标对象获取对标结果
//获取最小值
......@@ -448,6 +469,7 @@ public class ShortboardRuleService {
paramMap.put("date", date);
paramMap.put("code", code);
paramMap.put("compareObjs", compareObjs);
paramMap.put("dateMark",date);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObjIn(paramMap);//根据考核指标id,日期和对标对象获取对标结果
if(!calResults.isEmpty()) {
......@@ -480,14 +502,28 @@ public class ShortboardRuleService {
List<DriveIndCalResultDef> realCalResults = new ArrayList<>();
//根据考核指标id获取考核指标
DriveIndDef driveIndDef = driveIndDefService.getById(driveId);
//反向
if("1".equals(driveIndDef.getIndRule())){
//大于变小于
if("0".equals(shortboardItem.getCalType())){
shortboardItem.setCalType("1");
}else{
shortboardItem.setCalType("0");
}
}
if(driveIndDef!=null) {
for(String compareObj : compareObjs) {
//获取本期
// DriveIndCalResultDef currentIndCalResult = driveIndCalResultDefMapper.
// findByIndIdAndDateAndCompareObj(driveId,date,compareObj,code);
DriveIndCalResultDef currentIndCalResult = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObj(driveId,date,compareObj,code);
findByIndIdAndDateAndCompareObjAndCompareCatalog(driveId,date,compareObj,code,null,date);
//获取同期
// DriveIndCalResultDef sameIndCalResult = driveIndCalResultDefMapper.
// findByIndIdAndDateAndCompareObj(driveId,(date-100),compareObj,code);
DriveIndCalResultDef sameIndCalResult = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObj(driveId,(date-100),compareObj,code);
findByIndIdAndDateAndCompareObjAndCompareCatalog(driveId,(date-100),compareObj,code,null,date);
if(currentIndCalResult!=null && sameIndCalResult!=null) {
if(!"NaN".equals(currentIndCalResult.getValue()) &&
!"Infinite".equals(currentIndCalResult.getValue())) {
......
......@@ -199,10 +199,7 @@ public class CalculateUtils {
return calValue;
}
/**
* 2020-11-17取消特殊处理。排名123的全部显示出来
*user@hzc
* */
//根据地区特定顺序处理并列排名情况
public static Map<String,Object> rankByObjSort(Map<String,Integer> rankMap,Map<String,Integer> objSort){
//
......
......@@ -43,8 +43,10 @@
ind_id = #{indId} and
compare_obj = #{compareObj} and
date = #{date} and
code = #{code} and
compare_catalog = #{compareCatalog} and
code = #{code} and
<if test="compareCatalog !=null">
compare_catalog = #{compareCatalog} and
</if>
date_mark = #{dateMark}
</select>
......@@ -187,9 +189,11 @@
where
ind_id = #{indId} and
date = #{date} and
code = #{code} and
compare_catalog = #{compareCatalog} and
date_mark = #{dateMark} and
code = #{code} and
<if test="compareCatalog!=null">
compare_catalog = #{compareCatalog} and
</if>
date_mark = #{dateMark} and
compare_obj in
<foreach item="id" collection="compareObjs" open="(" close=")" separator=",">
#{id}
......
<?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.keymobile.indicators.model.mapper.indicators.TaskIndValueTmpMapper">
<select id="getByTaskId" parameterType="java.lang.String" resultType="com.keymobile.indicators.model.entity.dataenter.TaskIndValueTmp" >
select *
from data_enter_task_ind_val_tmp
where ind_id in
<foreach collection="indIds" item="indId" open="(" close=")" separator=",">
{indId}
</foreach>
and obj_id in
<foreach collection="objIds" item="objId" open="(" close=")" separator=",">
{objId}
</foreach>
and value_time = #{valueTime}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment