Commit 585706d3 by hzc

数据填报数据抽取

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