Commit 779395ff by hzc

修改试运行清表逻辑

parent 5ebd189e
......@@ -93,7 +93,7 @@ public class DriveIndCalResultCtrl {
public void deleteCompareUnitData(@RequestParam List<String> compareIds,
@RequestParam Integer currentDate,@RequestParam Integer sameDate,
@RequestParam String code) {
driveIndCalResultService.deleteCompareUnitData(compareIds, currentDate, sameDate, code);
driveIndCalResultService.deleteCompareUnitData(compareIds, currentDate, sameDate, code,"1");
}
......
package com.keymobile.indicators.model.mapper.testrun;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -25,4 +26,6 @@ public interface TestDriveIndCalResultDefMapper extends BaseMapper<TestDriveIndC
public void batchSave(@Param("datas")List<TestDriveIndCalResultDef> datas);
//批量修改
public void batchUpdate(@Param("datas")List<TestDriveIndCalResultDef> datas);
void deleteByCompareIdInAndDateIn(Map<String, Object> param2);
}
package com.keymobile.indicators.model.mapper.testrun;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -17,4 +18,6 @@ public interface TestObjScoreCalResultMapper extends BaseMapper<TestObjScoreCalR
public void batchSave(@Param("datas")List<TestObjScoreCalResult> datas);
public void batchUpdate(@Param("datas")List<TestObjScoreCalResult> datas);
void deleteByCompareIdInAndDateIn(Map<String, Object> param2);
}
......@@ -516,6 +516,7 @@ public class TaskServiceImpl implements TaskService {
for (TaskIndicator indicator : needSumInds) {
for (AuthModel model : models) {
TaskIndValue value = new TaskIndValue();
value.setId(IdWorker.getStrId());
value.setIndId(indicator.getIndId());
value.setIndName(indicator.getIndName());
value.setValueTime(task.getValueTime());
......
......@@ -6,6 +6,8 @@ import java.util.List;
import java.util.Map;
import com.keymobile.indicators.model.entity.indicators.CompareUnitCalLog;
import com.keymobile.indicators.model.mapper.testrun.TestDriveIndCalResultDefMapper;
import com.keymobile.indicators.model.mapper.testrun.TestObjScoreCalResultMapper;
import com.keymobile.indicators.utils.SystemUserUtil;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
......@@ -41,6 +43,12 @@ public class DriveIndCalResultService {
@Autowired
private CompareUnitCalLogService compareUnitCalLogService;
@Autowired
private TestDriveIndCalResultDefMapper testDriveIndCalResultDefMapper;
@Autowired
private TestObjScoreCalResultMapper testObjScoreCalResultMapper;
public int saveOrUpdate(DriveIndCalResultDef driveIndCalResult) {
if(driveIndCalResult.getId()==null) {
driveIndCalResultDefMapper.insert(driveIndCalResult);
......@@ -107,7 +115,7 @@ public class DriveIndCalResultService {
sameDate = date;
}
//对标运算前先删除相关旧数据
this.deleteCompareUnitData(compareIds, currentDate, sameDate, code);
this.deleteCompareUnitData(compareIds, currentDate, sameDate, code,isTest);
Thread.sleep(3000);
//新增运行日志记录
......@@ -136,7 +144,7 @@ public class DriveIndCalResultService {
//删除对应对标单元的数据,便于重新计算
public void deleteCompareUnitData(List<String> compareIds,
Integer currentDate,Integer sameDate,String code) {
Integer currentDate,Integer sameDate,String code,String isTest) {
if(StringUtils.isNotBlank(code) && !compareIds.isEmpty() &&
currentDate!=null && sameDate!=null) {
List<Integer> param1Dates = new ArrayList<>();
......@@ -154,11 +162,19 @@ public class DriveIndCalResultService {
param2.put("compareIds", compareIds);
param2.put("dates", param2Dates);
if("1".equals(isTest)){
//删除数据
reportOneMapper.deleteByCompareIdInAndDateIn(param1);
reportTwoMapper.deleteByCompareIdInAndDateIn(param1);
driveIndCalResultDefMapper.deleteByCompareIdInAndDateIn(param2);
objScoreCalResultMapper.deleteByCompareIdInAndDateIn(param2);
}else if("0".equals(isTest)){
testDriveIndCalResultDefMapper.deleteByCompareIdInAndDateIn(param2);
testObjScoreCalResultMapper.deleteByCompareIdInAndDateIn(param2);
}
}
}
......
package com.keymobile.indicators.utils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -206,8 +199,36 @@ 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){
//
// Map<String,Object> result = new HashMap<>();
// Iterator<Integer> iterator = rankMap.values().iterator();
// int firstValue = 0;
// int nextValue = 0;
// int row=0;
// if(iterator.hasNext()){
// firstValue = iterator.next();
// row++;
// }
// while (iterator.hasNext()){
// nextValue = iterator.next();
// if(Math.abs(firstValue-nextValue)>2){
// break;
// }else{
// row++;
// }
// }
// result.put("rankNum", row);
// result.put("rankMap", rankMap);
// return result;
////
////
////
Map<String,Object> result = new HashMap<>();
//排名分类
Map<Integer,List<String>> rankClassifyMap = new LinkedHashMap<>();//修改为插入顺序的map
......@@ -261,6 +282,7 @@ public class CalculateUtils {
result.put("rankMap", rankMap);
}
return result;
}
private static Comparator<Map.Entry> comparatorByValueAsc = (Map.Entry o1, Map.Entry o2) -> {
......
......@@ -105,4 +105,20 @@
where id = ${val.id}
</foreach>
</update>
<delete id="deleteByCompareIdInAndDateIn" parameterType="map">
delete
from
test_drive_ind_cal_result_def
where
code = #{code} and
compare_id in
<foreach item="compareId" collection="compareIds" open="(" close=")" separator=",">
#{compareId}
</foreach>
and
date in
<foreach item="date" collection="dates" open="(" close=")" separator=",">
#{date}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -61,4 +61,20 @@
where id = ${val.id}
</foreach>
</update>
<delete id="deleteByCompareIdInAndDateIn" parameterType="map">
delete
from
test_obj_score_cal_result
where
code = #{code} and
compare_id in
<foreach item="compareId" collection="compareIds" open="(" close=")" separator=",">
#{compareId}
</foreach>
and
date in
<foreach item="date" collection="dates" open="(" close=")" separator=",">
#{date}
</foreach>
</delete>
</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