|
@@ -488,6 +488,7 @@ public class TmstruckTimeTaskResultServiceImpl implements ITmstruckTimeTaskResul
|
|
@Override
|
|
@Override
|
|
public int modifyTimeTaskResult(Map<String, Object> mapValue) throws Exception {
|
|
public int modifyTimeTaskResult(Map<String, Object> mapValue) throws Exception {
|
|
String orderNumber =(String) mapValue.get("orderNumber");
|
|
String orderNumber =(String) mapValue.get("orderNumber");
|
|
|
|
+ int i=0;
|
|
Date resultTimeNew = null;
|
|
Date resultTimeNew = null;
|
|
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
String resultTime1 = (String) mapValue.get("resultTime");
|
|
String resultTime1 = (String) mapValue.get("resultTime");
|
|
@@ -499,9 +500,11 @@ public class TmstruckTimeTaskResultServiceImpl implements ITmstruckTimeTaskResul
|
|
long resultTime;
|
|
long resultTime;
|
|
BigDecimal resultValueNew=null;
|
|
BigDecimal resultValueNew=null;
|
|
BigDecimal resultTimeEnd=null;
|
|
BigDecimal resultTimeEnd=null;
|
|
|
|
+ TmstruckTimeTaskResult tmstruckTimeTaskResult=new TmstruckTimeTaskResult();
|
|
//查找计时开始时间
|
|
//查找计时开始时间
|
|
List<Map<String, Object>> startTimeTaskIdList = tmstruckTimeTaskResultMapper.getStartTimeTask(mapValue);
|
|
List<Map<String, Object>> startTimeTaskIdList = tmstruckTimeTaskResultMapper.getStartTimeTask(mapValue);
|
|
Map<String,Object> map = tmstruckTimeTaskResultMapper.getResultValue(orderNumber);
|
|
Map<String,Object> map = tmstruckTimeTaskResultMapper.getResultValue(orderNumber);
|
|
|
|
+ BigDecimal orderId =DataChange.dataToBigDecimal(map.get("orderId"));
|
|
BigDecimal timeTaskResultId = DataChange.dataToBigDecimal(map.get("timeTaskResultId"));
|
|
BigDecimal timeTaskResultId = DataChange.dataToBigDecimal(map.get("timeTaskResultId"));
|
|
BigDecimal resultValue =DataChange.dataToBigDecimal(map.get("resultValue"));
|
|
BigDecimal resultValue =DataChange.dataToBigDecimal(map.get("resultValue"));
|
|
if (startTimeTaskIdList.size() != 1) {
|
|
if (startTimeTaskIdList.size() != 1) {
|
|
@@ -510,8 +513,8 @@ public class TmstruckTimeTaskResultServiceImpl implements ITmstruckTimeTaskResul
|
|
} else {
|
|
} else {
|
|
Map<String, Object> stringObjectMap = startTimeTaskIdList.get(0);
|
|
Map<String, Object> stringObjectMap = startTimeTaskIdList.get(0);
|
|
//获取计时总时长的实绩id
|
|
//获取计时总时长的实绩id
|
|
-
|
|
|
|
Date resultTimeOld =(Date)stringObjectMap.get("resultTime");
|
|
Date resultTimeOld =(Date)stringObjectMap.get("resultTime");
|
|
|
|
+ BigDecimal timeTaskResultIdStart = DataChange.dataToBigDecimal(stringObjectMap.get("timeTaskResultId"));
|
|
if (DataChange.dataToBigDecimal(mapValue.get("resultType")).intValue()==1) {
|
|
if (DataChange.dataToBigDecimal(mapValue.get("resultType")).intValue()==1) {
|
|
//修改计时开始时间
|
|
//修改计时开始时间
|
|
//获取修改之前的计时开始时间,如果修改之前的计时开始时间大于修改之后的修改时间就date(resultTimeOld)-date(resultTimeNew)
|
|
//获取修改之前的计时开始时间,如果修改之前的计时开始时间大于修改之后的修改时间就date(resultTimeOld)-date(resultTimeNew)
|
|
@@ -528,6 +531,9 @@ public class TmstruckTimeTaskResultServiceImpl implements ITmstruckTimeTaskResul
|
|
resultTimeEnd = new BigDecimal(resultTime / (1000 * 60));
|
|
resultTimeEnd = new BigDecimal(resultTime / (1000 * 60));
|
|
resultValueNew = resultValue.subtract(resultTimeEnd);
|
|
resultValueNew = resultValue.subtract(resultTimeEnd);
|
|
}
|
|
}
|
|
|
|
+ tmstruckTimeTaskResult.setTimeTaskResultId(timeTaskResultIdStart);
|
|
|
|
+ tmstruckTimeTaskResult.setResultTime(resultTimeNew);
|
|
|
|
+ i+= tmstruckTimeTaskResultMapper.updateByPrimaryKeySelective(tmstruckTimeTaskResult);
|
|
}else if (DataChange.dataToBigDecimal(mapValue.get("resultType")).intValue()==3){
|
|
}else if (DataChange.dataToBigDecimal(mapValue.get("resultType")).intValue()==3){
|
|
//修改计时结束时间
|
|
//修改计时结束时间
|
|
//获取修改之后的计时结束时间,如果修改之前的计时结束时间大于修改之后的修改时间就date(resultTimeOld)-date(resultTimeNew)
|
|
//获取修改之后的计时结束时间,如果修改之前的计时结束时间大于修改之后的修改时间就date(resultTimeOld)-date(resultTimeNew)
|
|
@@ -543,20 +549,60 @@ public class TmstruckTimeTaskResultServiceImpl implements ITmstruckTimeTaskResul
|
|
resultTime = resultTimeNew.getTime() - resultTimeOld.getTime();
|
|
resultTime = resultTimeNew.getTime() - resultTimeOld.getTime();
|
|
System.out.println(resultTime);
|
|
System.out.println(resultTime);
|
|
resultTimeEnd = new BigDecimal(resultTime / (1000 * 60));
|
|
resultTimeEnd = new BigDecimal(resultTime / (1000 * 60));
|
|
|
|
+ //新的计时时长
|
|
resultValueNew=resultValue.add(resultTimeEnd);
|
|
resultValueNew=resultValue.add(resultTimeEnd);
|
|
}
|
|
}
|
|
|
|
+ tmstruckTimeTaskResult.setTimeTaskResultId(timeTaskResultIdStart);
|
|
|
|
+ tmstruckTimeTaskResult.setResultTime(resultTimeNew);
|
|
|
|
+ i+= tmstruckTimeTaskResultMapper.updateByPrimaryKeySelective(tmstruckTimeTaskResult);
|
|
}else {
|
|
}else {
|
|
throw new Exception("暂停时长不支持修改");
|
|
throw new Exception("暂停时长不支持修改");
|
|
}
|
|
}
|
|
- TmstruckTimeTaskResult tmstruckTimeTaskResult=new TmstruckTimeTaskResult();
|
|
|
|
- tmstruckTimeTaskResult.setTimeTaskResultId(timeTaskResultId);
|
|
|
|
- tmstruckTimeTaskResult.setResultTime(resultTimeNew);
|
|
|
|
- tmstruckTimeTaskResult.setInsertUpdateRemark("管理员进行修改");
|
|
|
|
- tmstruckTimeTaskResult.setUpdateTime(new Date());
|
|
|
|
- tmstruckTimeTaskResult.setResultValue(resultValueNew);
|
|
|
|
- tmstruckTimeTaskResult.setUpdateUsername("admin");
|
|
|
|
- tmstruckTimeTaskResultMapper.updateByPrimaryKeySelective(tmstruckTimeTaskResult);
|
|
|
|
|
|
+ TmstruckTimeTaskResult tmstruckTimeTaskResult1=new TmstruckTimeTaskResult();
|
|
|
|
+ tmstruckTimeTaskResult1.setTimeTaskResultId(timeTaskResultId);
|
|
|
|
+ Map<String, Object> requirementInfo = tmstruckTimeTaskResultMapper.getRequirementInfo(orderId);
|
|
|
|
+ String capacityTypeName =(String) requirementInfo.get("capacityTypeName");
|
|
|
|
+ if (capacityTypeName.contains("吊车")) {
|
|
|
|
+ //100吨以下
|
|
|
|
+ if (resultValueNew==null){
|
|
|
|
+ throw new Exception("请确认是否修改了计时开始/结束时间");
|
|
|
|
+ }
|
|
|
|
+ BigDecimal hours=new BigDecimal(resultValueNew.intValue() / 60);
|
|
|
|
+ BigDecimal minutes=new BigDecimal(resultValueNew.intValue()%60);
|
|
|
|
+ int hour = Integer.parseInt(String.valueOf(hours));
|
|
|
|
+ if (TwoHour.contains(capacityTypeName)) {
|
|
|
|
+ //判断是否小于2个小时
|
|
|
|
+ if (hour<2&&hour>0){
|
|
|
|
+ //设置为两个小时
|
|
|
|
+ tmstruckTimeTaskResult1.setResultAboutTime(2+"小时");
|
|
|
|
+ }else {
|
|
|
|
+ //设置实际作业时长-dateTime3
|
|
|
|
+ tmstruckTimeTaskResult1.setResultAboutTime(hour+"小时"+minutes+"分钟");
|
|
|
|
+ }
|
|
|
|
+ //如果为100吨以上吊车
|
|
|
|
+ }else if (FourHour.contains(capacityTypeName)){
|
|
|
|
+ //1、如实际使用时间不足4小时按照(使用时间+4小时)进行最终结算
|
|
|
|
+ if (hour<0) {
|
|
|
|
+ tmstruckTimeTaskResult1.setResultAboutTime("4小时");
|
|
|
|
+ }
|
|
|
|
+ else if (hour<4&&hour>=0){
|
|
|
|
+ //计算小时和分钟
|
|
|
|
+ tmstruckTimeTaskResult1.setResultAboutTime(4+hours.intValue()+"小时"+minutes+"分钟");
|
|
|
|
+ }else if (hour>=4&&hour<8){
|
|
|
|
+ //2、如实际使用时间超出4小时加上车辆往返时间4小时超过8小时的按8小时计算
|
|
|
|
+ tmstruckTimeTaskResult1.setResultAboutTime(8+"小时");
|
|
|
|
+ }else if (hour>=8){
|
|
|
|
+ tmstruckTimeTaskResult1.setResultAboutTime(hours+"小时"+minutes+"分钟");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ tmstruckTimeTaskResult1.setInsertUpdateRemark("管理员修改时间");
|
|
|
|
+ tmstruckTimeTaskResult1.setUpdateTime(new Date());
|
|
|
|
+ tmstruckTimeTaskResult1.setResultValue(resultValueNew);
|
|
|
|
+ tmstruckTimeTaskResult1.setUpdateUsername("admin");
|
|
|
|
+ i+=tmstruckTimeTaskResultMapper.updateByPrimaryKeySelective(tmstruckTimeTaskResult1);
|
|
}
|
|
}
|
|
- return 1;
|
|
|
|
|
|
+ return i;
|
|
}
|
|
}
|
|
}
|
|
}
|