|
|
|
|
@ -119,79 +119,104 @@ public class CheckoutServiceImpl implements ICheckoutService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<CheckoutEntity> findByCity(String city) throws Exception {
|
|
|
|
|
CheckoutEntity cksql = new CheckoutEntity();
|
|
|
|
|
Calendar c2 = Calendar.getInstance();
|
|
|
|
|
// 时间设置为 半年前的时间
|
|
|
|
|
c2.set(Calendar.MONTH, getMonBeforeHalfYear(c2.get(Calendar.MONTH)));
|
|
|
|
|
String time = DateForm.date2StringByDay(c2.getTime());
|
|
|
|
|
cksql.setCollectingTime(time);
|
|
|
|
|
cksql.setCityName(city);
|
|
|
|
|
|
|
|
|
|
Map<String,CheckoutEntity> resul = new HashMap<String,CheckoutEntity>();
|
|
|
|
|
Map<String,CheckoutEntity> nodata = new HashMap<String,CheckoutEntity>();
|
|
|
|
|
List<CheckoutEntity> list = preDataInfoDao.findByCity(cksql);
|
|
|
|
|
int length = list.size();
|
|
|
|
|
// 对所有数据分析
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
CheckoutEntity preDataInfo = list.get(i);
|
|
|
|
|
preDataInfo.setId(i);
|
|
|
|
|
preDataInfo.setCollUpdate(isY(preDataInfo.getCollUpdate()));
|
|
|
|
|
if (preDataInfo.getDataVersion() < 1) {
|
|
|
|
|
preDataInfo.setCollection("否");
|
|
|
|
|
public List<CheckoutEntity> findByCity(String city) throws Exception {
|
|
|
|
|
CheckoutEntity cksql = new CheckoutEntity();
|
|
|
|
|
Calendar c2 = Calendar.getInstance();
|
|
|
|
|
// 时间设置为 半年前的时间
|
|
|
|
|
c2.set(Calendar.MONTH, getMonBeforeHalfYear(c2.get(Calendar.MONTH)));
|
|
|
|
|
String time = DateForm.date2StringByDay(c2.getTime());
|
|
|
|
|
cksql.setCollectingTime(time);
|
|
|
|
|
cksql.setCityName(city);
|
|
|
|
|
|
|
|
|
|
Map<String,CheckoutEntity> resul = new HashMap<String,CheckoutEntity>();
|
|
|
|
|
Map<String,CheckoutEntity> nodata = new HashMap<String,CheckoutEntity>();
|
|
|
|
|
//冷区数据
|
|
|
|
|
List<CheckoutEntity> list = preDataInfoDao.findByCity(cksql);
|
|
|
|
|
Map<String, List<CheckoutEntity>> coolDataMap = new HashMap<String, List<CheckoutEntity>>();
|
|
|
|
|
for (CheckoutEntity checkoutEntity : list) {
|
|
|
|
|
if(null == checkoutEntity.getCollectingTime()
|
|
|
|
|
|| c2.getTime().after(DateForm.string2DateByDay(checkoutEntity.getCollectingTime()))){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
List<CheckoutEntity> tmpList = coolDataMap.get(checkoutEntity.getAreaCode()+"_"+checkoutEntity.getSysCode());
|
|
|
|
|
if (null == tmpList) {
|
|
|
|
|
tmpList = new ArrayList<CheckoutEntity>();
|
|
|
|
|
coolDataMap.put(checkoutEntity.getAreaCode()+"_"+checkoutEntity.getSysCode(),tmpList);
|
|
|
|
|
}
|
|
|
|
|
// 带数据的 系统
|
|
|
|
|
tmpList.add(checkoutEntity);
|
|
|
|
|
}
|
|
|
|
|
//热区数据
|
|
|
|
|
List<CheckoutEntity> hotDatalist = preDataInfoDao.findHotDataByCity(cksql);
|
|
|
|
|
for (CheckoutEntity checkoutEntity : hotDatalist) {
|
|
|
|
|
if (null != checkoutEntity.getCollectingTime()) {
|
|
|
|
|
//一段时间内的数据(半年)
|
|
|
|
|
if (c2.getTime().before(DateForm.string2DateByDay(checkoutEntity.getCollectingTime()))) {
|
|
|
|
|
// 带数据的 系统
|
|
|
|
|
resul.put(checkoutEntity.getAreaCode()+"_"+checkoutEntity.getSysCode()+"_"+checkoutEntity.getDataVersion(), checkoutEntity);
|
|
|
|
|
}
|
|
|
|
|
if (null != preDataInfo.getCollectingTime()) {
|
|
|
|
|
if (c2.getTime().before(DateForm.string2DateByDay(preDataInfo.getCollectingTime()))) {
|
|
|
|
|
resul.put(preDataInfo.getAreaCode()+"_"+preDataInfo.getSysCode()+"_"+preDataInfo.getDataId(), preDataInfo);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
preDataInfo.setDataId(0);
|
|
|
|
|
preDataInfo.setPath(null);
|
|
|
|
|
preDataInfo.setDataVersion(0);
|
|
|
|
|
preDataInfo.setExecResult(null);
|
|
|
|
|
preDataInfo.setExecResultLast(null);
|
|
|
|
|
preDataInfo.setPayResult(null);
|
|
|
|
|
preDataInfo.setPayResultLast(null);
|
|
|
|
|
preDataInfo.setCheckoutFlag(null);
|
|
|
|
|
preDataInfo.setCollection("否");
|
|
|
|
|
//data_id 已经为 0 (数据不存在时)
|
|
|
|
|
nodata.put(preDataInfo.getAreaCode()+"_"+preDataInfo.getSysCode(), preDataInfo);
|
|
|
|
|
}
|
|
|
|
|
// 半年之前的数据
|
|
|
|
|
else {
|
|
|
|
|
checkoutEntity.setDataId(0);
|
|
|
|
|
checkoutEntity.setPath(null);
|
|
|
|
|
checkoutEntity.setDataVersion(0);
|
|
|
|
|
checkoutEntity.setExecResult(null);
|
|
|
|
|
checkoutEntity.setExecResultLast(null);
|
|
|
|
|
checkoutEntity.setPayResult(null);
|
|
|
|
|
checkoutEntity.setPayResultLast(null);
|
|
|
|
|
checkoutEntity.setCheckoutFlag(null);
|
|
|
|
|
checkoutEntity.setCollection("否");
|
|
|
|
|
nodata.put(checkoutEntity.getAreaCode()+"_"+checkoutEntity.getSysCode()+"_"+checkoutEntity.getDataVersion(), checkoutEntity);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
nodata.put(preDataInfo.getAreaCode()+"_"+preDataInfo.getSysCode(), preDataInfo);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// DataVersion = 0
|
|
|
|
|
checkoutEntity.setCollection("否");
|
|
|
|
|
nodata.put(checkoutEntity.getAreaCode()+"_"+checkoutEntity.getSysCode()+"_"+checkoutEntity.getDataVersion(), checkoutEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 将 nodata中的 无热区数据的 系统,在冷区中查询,如果有的话,将冷区数据放入 resul中, 而没有数据的 系统 的 key放入 keyList
|
|
|
|
|
List<String> noDataKeyList = new ArrayList<String>();
|
|
|
|
|
for ( String noDataKey : nodata.keySet()) {
|
|
|
|
|
CheckoutEntity checkData = nodata.get(noDataKey);
|
|
|
|
|
String coolDataMapKey = checkData.getAreaCode()+"_"+checkData.getSysCode();
|
|
|
|
|
if (coolDataMap.containsKey(coolDataMapKey)) {
|
|
|
|
|
List<CheckoutEntity> coolDatas = coolDataMap.get(coolDataMapKey);
|
|
|
|
|
for (CheckoutEntity checkoutEntity : coolDatas) {
|
|
|
|
|
resul.put(checkoutEntity.getAreaCode()+"_"+checkoutEntity.getSysCode()+"_"+ checkoutEntity.getDataVersion(), checkoutEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<String> keyList = new ArrayList<String>();
|
|
|
|
|
//记录 不存在数据 在 nodata的 key值
|
|
|
|
|
for (String nodatakey : nodata.keySet()) {
|
|
|
|
|
keyList.add(nodatakey);
|
|
|
|
|
else {
|
|
|
|
|
//记录 不存在数据 在 nodata的 key值
|
|
|
|
|
noDataKeyList.add(noDataKey);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CheckoutEntity> resultList = new ArrayList<CheckoutEntity>();
|
|
|
|
|
for (String key : resul.keySet()) {
|
|
|
|
|
//如果有 校验失败的结果则 为否
|
|
|
|
|
CheckoutEntity tmp = resul.get(key);
|
|
|
|
|
if(!Constant.CHECKOUT_STATUS_ZERO.equals(tmp.getPayResultLast()) && !Constant.CHECKOUT_STATUS_ZERO.equals(tmp.getExecResultLast())){
|
|
|
|
|
if (Constant.CHECKOUT_STATUS_FOUR.equals(tmp.getPayResultLast()) || Constant.CHECKOUT_STATUS_FOUR.equals(tmp.getExecResultLast())) {
|
|
|
|
|
tmp.setCheckResult(Constant.ORACLE_CHECK_REULT_ONE);
|
|
|
|
|
}
|
|
|
|
|
else if(!Constant.CHECKOUT_STATUS_TWO.equals(tmp.getPayResultLast()) && !Constant.CHECKOUT_STATUS_TWO.equals(tmp.getExecResultLast())){
|
|
|
|
|
tmp.setCheckResult(Constant.ORACLE_CHECK_REULT_ZERO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<CheckoutEntity> resultList = new ArrayList<CheckoutEntity>();
|
|
|
|
|
//带数据的
|
|
|
|
|
for (String key : resul.keySet()) {
|
|
|
|
|
//如果有 校验失败的结果则 为否
|
|
|
|
|
CheckoutEntity tmp = resul.get(key);
|
|
|
|
|
if(!Constant.CHECKOUT_STATUS_ZERO.equals(tmp.getPayResultLast()) && !Constant.CHECKOUT_STATUS_ZERO.equals(tmp.getExecResultLast())){
|
|
|
|
|
if (Constant.CHECKOUT_STATUS_FOUR.equals(tmp.getPayResultLast()) || Constant.CHECKOUT_STATUS_FOUR.equals(tmp.getExecResultLast())) {
|
|
|
|
|
tmp.setCheckResult(Constant.ORACLE_CHECK_REULT_ONE);
|
|
|
|
|
}
|
|
|
|
|
resultList.add(resul.get(key));
|
|
|
|
|
for (String nodatakey : keyList) {
|
|
|
|
|
if (key.contains(nodatakey)) {
|
|
|
|
|
nodata.remove(nodatakey);
|
|
|
|
|
}
|
|
|
|
|
else if(!Constant.CHECKOUT_STATUS_TWO.equals(tmp.getPayResultLast()) && !Constant.CHECKOUT_STATUS_TWO.equals(tmp.getExecResultLast())){
|
|
|
|
|
tmp.setCheckResult(Constant.ORACLE_CHECK_REULT_ZERO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (String key : nodata.keySet()) {
|
|
|
|
|
resultList.add(nodata.get(key));
|
|
|
|
|
resultList.add(resul.get(key));
|
|
|
|
|
}
|
|
|
|
|
//无数据的 系统
|
|
|
|
|
for (String nodatakey : noDataKeyList) {
|
|
|
|
|
if (nodata.keySet().contains(nodatakey)) {
|
|
|
|
|
CheckoutEntity checkoutEntity = nodata.get(nodatakey);
|
|
|
|
|
checkoutEntity.setCollection("否");
|
|
|
|
|
resultList.add(checkoutEntity);
|
|
|
|
|
}
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, PreDataInfo> findDetail(CheckoutEntity ck)
|
|
|
|
|
|