|
|
@@ -63,32 +63,35 @@ public class DispatchServiceImpl implements DispatchService {
|
|
|
@Override
|
|
|
public CommRes updDispatch(Dispatch dispatch) {
|
|
|
try {
|
|
|
- dispatchMapper.updDispatch(dispatch);
|
|
|
-
|
|
|
- //添加收货的时间/时长
|
|
|
+ //查询添加收货的时间/时长
|
|
|
Dispatch dispatch1 = dispatchMapper.getDispatch(dispatch);
|
|
|
+ if (dispatch1 != null){
|
|
|
+ dispatchMapper.updDispatch(dispatch);
|
|
|
+ SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date star = dft.parse(dispatch1.getScrq());//开始时间
|
|
|
+ Date endDay = dft.parse(dispatch1.getFinalTime());//结束时间
|
|
|
+ Long starTime=star.getTime();
|
|
|
+ Long endTime=endDay.getTime();
|
|
|
+ Long num=endTime-starTime;//时间戳相差的毫秒数
|
|
|
+ String nums = String.valueOf(num/24/60/60/1000);
|
|
|
+ System.out.println("相差天数为:"+nums);//除以一天的毫秒数
|
|
|
|
|
|
- SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Date star = dft.parse(dispatch1.getScrq());//开始时间
|
|
|
- Date endDay = dft.parse(dispatch1.getFinalTime());//结束时间
|
|
|
- Long starTime=star.getTime();
|
|
|
- Long endTime=endDay.getTime();
|
|
|
- Long num=endTime-starTime;//时间戳相差的毫秒数
|
|
|
- String nums = String.valueOf(num/24/60/60/1000);
|
|
|
- System.out.println("相差天数为:"+nums);//除以一天的毫秒数
|
|
|
-
|
|
|
- //改变时间
|
|
|
- Client client = new Client();
|
|
|
- client.setCode(dispatch1.getCustomer());
|
|
|
- client.setDays(nums);
|
|
|
- Client client1 = clientMapper.getClient(client);
|
|
|
+ //改变时间
|
|
|
+ Client client = new Client();
|
|
|
+ client.setCode(dispatch1.getCustomer());
|
|
|
+ client.setDays(nums);
|
|
|
+ Client client1 = clientMapper.getClient(client);
|
|
|
|
|
|
- if (client1 == null){
|
|
|
- //添加
|
|
|
- clientMapper.addClient(client);
|
|
|
+ if (client1 == null){
|
|
|
+ //添加
|
|
|
+ clientMapper.addClient(client);
|
|
|
+ }else {
|
|
|
+ //修改
|
|
|
+ clientMapper.updClient(client);
|
|
|
+ }
|
|
|
+ return CommRes.success(null);
|
|
|
}else {
|
|
|
- //修改
|
|
|
- clientMapper.updClient(client);
|
|
|
+ return CommRes.fail("未查询到发货单信息");
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|