|
|
@@ -541,7 +541,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
&& tOrder.getOrderStatus() != OrderState.SELLER_CANCEL_AFTER_SIGN.getCode()){
|
|
|
flag = false;
|
|
|
}
|
|
|
- if(flag && tOrder.getActuallyTotalAmount().doubleValue() == 0){
|
|
|
+ if(flag && tOrder.getActuallyTotalAmount().doubleValue() == 0
|
|
|
+ && tOrder.getDeleteSign() == DeleteStatus.UNDELETE.getCode()){
|
|
|
active.setApplyRevoke(true); //作废
|
|
|
}else{
|
|
|
active.setApplyRevoke(false); //作废
|
|
|
@@ -554,7 +555,17 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
flag = true;
|
|
|
if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode())
|
|
|
flag = false;
|
|
|
- active.setApplySign(flag);
|
|
|
+ active.setApplySign(flag); //签单
|
|
|
+ if(tOrder.getDeleteSign() == DeleteStatus.UNDELETE.getCode()){
|
|
|
+ active.setApplyLock(true);
|
|
|
+ }else{
|
|
|
+ active.setApplyLock(false);
|
|
|
+ }
|
|
|
+ if(tOrder.getDeleteSign() == DeleteStatus.LOCKING.getCode()){
|
|
|
+ active.setApplyUnLock(true);
|
|
|
+ }else{
|
|
|
+ active.setApplyUnLock(false);
|
|
|
+ }
|
|
|
return active;
|
|
|
}
|
|
|
|
|
|
@@ -852,13 +863,15 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()) {
|
|
|
throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, orderNo, ""));
|
|
|
} else {
|
|
|
+ Date signTime = new Date();
|
|
|
tOrder.setSignFirstPayment(new BigDecimal(signFirstPayment));
|
|
|
tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
|
|
|
tOrder.setOrderStage(OrderStage.SIGNED.getCode());
|
|
|
tOrder.setOrderStatus(OrderState.ALREADY_SIGN.getCode());
|
|
|
tOrder.setProjectStage(ProjectStage.WAIT_SET_UP.getCode());
|
|
|
tOrder.setApproval(Integer.valueOf(approval));
|
|
|
- tOrder.setUpdateTime(new Date());
|
|
|
+ tOrder.setUpdateTime(signTime);
|
|
|
+ tOrder.setSignTime(signTime);
|
|
|
tOrderMapper.updateByPrimaryKeySelective(tOrder);
|
|
|
}
|
|
|
return 1;
|
|
|
@@ -1089,7 +1102,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
String depIds,Integer approvalHistory, Integer pageNo, Integer pageSize) {
|
|
|
Map<String,Object> params = disposeParams(bo,startDate,endDate);
|
|
|
if(StringUtils.isNotBlank(depIds)) {
|
|
|
- params.put("depIds", depIds);
|
|
|
+ params.put("depIds", "'" + depIds + "'");
|
|
|
}else{
|
|
|
if(!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.APPROVAL_DECISION))
|
|
|
return new Pagination<OrderListBo>();
|
|
|
@@ -1097,6 +1110,12 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
if(approvalHistory != null){
|
|
|
params.put("approvalHistory", approvalHistory);
|
|
|
}
|
|
|
+ if(StringUtils.isNotBlank(bo.getBuyerName())) params.put("buyerName", bo.getBuyerName());
|
|
|
+ if(bo.getOrderType() != null) params.put("orderType", bo.getOrderType());
|
|
|
+ if(bo.getOrderChannel() != null) params.put("orderChannel", bo.getOrderChannel());
|
|
|
+ if(bo.getOrderStatus() != null) params.put("orderStatus", bo.getOrderStatus());
|
|
|
+ if(StringUtils.isNotBlank(startDate)) params.put("startDate", startDate);
|
|
|
+ if(StringUtils.isNotBlank(endDate)) params.put("endDate", endDate);
|
|
|
return (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount",
|
|
|
params, pageNo, pageSize);
|
|
|
}
|
|
|
@@ -1125,9 +1144,16 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
- public Pagination<OrderListBo> listPublicOrder(Integer pageNo, Integer pageSize) {
|
|
|
+ public Pagination<OrderListBo> selectPublicOrder(OrderListBo bo,String startDate,String endDate,Integer pageNo, Integer pageSize) {
|
|
|
+ Map<String, Object> params = new HashMap<String,Object>();
|
|
|
+ if(StringUtils.isNotBlank(bo.getBuyerName())) params.put("buyerName", bo.getBuyerName());
|
|
|
+ if(bo.getOrderType() != null) params.put("orderType", bo.getOrderType());
|
|
|
+ if(bo.getOrderChannel() != null) params.put("orderChannel", bo.getOrderChannel());
|
|
|
+ if(bo.getOrderStatus() != null) params.put("orderStatus", bo.getOrderStatus());
|
|
|
+ if(StringUtils.isNotBlank(startDate)) params.put("startDate", startDate);
|
|
|
+ if(StringUtils.isNotBlank(endDate)) params.put("endDate", endDate);
|
|
|
return (Pagination<OrderListBo>)findPage("selectPublicOrderByPage","selectPublicOrderCount",
|
|
|
- null, pageNo, pageSize);
|
|
|
+ params, pageNo, pageSize);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1259,7 +1285,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
bill.setConfirmSign(AuditState.AUDIT_FAIL.getCode());
|
|
|
bill.setDeleteSign(Boolean.TRUE);
|
|
|
}
|
|
|
- tOrderBillMapper.updateByPrimaryKey(bill);
|
|
|
+ tOrderBillMapper.updateByPrimaryKeySelective(bill);
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
@@ -1276,12 +1302,11 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
bill.setRemarks(remarks);
|
|
|
- tOrderBillMapper.updateByPrimaryKey(bill);
|
|
|
- return 1;
|
|
|
+ return tOrderBillMapper.updateByPrimaryKeySelective(bill);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int approvalServiceOrder(String orderNo, Integer confirm) {
|
|
|
+ public int updateApprovalServiceOrder(String orderNo, Integer confirm) {
|
|
|
TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
|
|
|
checkOrder(tOrder);
|
|
|
if(tOrder.getOrderStatus() != OrderState.ALREADY_SIGN.getCode()
|
|
|
@@ -1322,7 +1347,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public int setUpProject(String orderNo, String signDate, String signComment) {
|
|
|
+ public int updateSetUpProject(String orderNo, String signDate, String signComment) {
|
|
|
TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
|
|
|
checkOrder(tOrder);
|
|
|
boolean flag = false;
|
|
|
@@ -1344,8 +1369,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
List<ContractTask> taskList = new ArrayList<>();
|
|
|
ContractTask task = null;
|
|
|
Date createTime = new Date();
|
|
|
- String contractId = UUID.randomUUID().toString(); //合同ID
|
|
|
Contract contract = new Contract();
|
|
|
+ String contractId = UUID.randomUUID().toString().replace("-", "");
|
|
|
contract.setId(contractId);
|
|
|
contract.setCreateTime(createTime);
|
|
|
contract.setType(tOrder.getOrderType());
|
|
|
@@ -1353,6 +1378,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
contract.setOrderNo(orderNo);
|
|
|
contract.setStatus(ProjectStage.ALREADY_SET_UP.getCode());
|
|
|
contract.setUid(tOrder.getBuyerId());
|
|
|
+ contract.setCreater(TokenManager.getAdminId());
|
|
|
+ contract.setPrincipal(tOrder.getTechnicianId()); //暂不确定
|
|
|
contractMapper.insert(contract);
|
|
|
for(TOrderDetail orderDetail: detailList){
|
|
|
for(int i=0; i<orderDetail.getCommodityQuantity();i++){
|
|
|
@@ -1370,7 +1397,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
taskList.add(task);
|
|
|
}
|
|
|
}
|
|
|
- contractMapper.batchInsertContractTask(taskList);
|
|
|
+ contractMapper.batchInsert(taskList);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@@ -1405,4 +1432,47 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
|
|
|
return tOrderMapper.updateByPrimaryKeySelective(tOrder);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int updateLockOrRevokeOrder(String orderNo, Integer operatorType) {
|
|
|
+ TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
|
|
|
+ if(tOrder != null){
|
|
|
+ if(operatorType == 0){ //锁定
|
|
|
+ if(tOrder.getDeleteSign() != DeleteStatus.UNDELETE.getCode())
|
|
|
+ throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
|
|
|
+ tOrder.setDeleteSign(DeleteStatus.LOCKING.getCode());
|
|
|
+ }else if(operatorType == 1){ //解锁
|
|
|
+ if(tOrder.getDeleteSign() != DeleteStatus.LOCKING.getCode())
|
|
|
+ throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
|
|
|
+ tOrder.setDeleteSign(DeleteStatus.UNDELETE.getCode());
|
|
|
+ }else if(operatorType == 2){ //作废
|
|
|
+ if(tOrder.getDeleteSign() != DeleteStatus.UNDELETE.getCode())
|
|
|
+ throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
|
|
|
+ if(tOrder.getActuallyTotalAmount().doubleValue() > 0){
|
|
|
+ throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
|
|
|
+ }
|
|
|
+ if(tOrder.getOrderStatus() != OrderState.BUYER_CANCEL_AFTER_SIGN.getCode()
|
|
|
+ && tOrder.getOrderStatus() != OrderState.BUYER_CANCEL_BEFORE_SIGN.getCode()
|
|
|
+ && tOrder.getOrderStatus() != OrderState.SELLER_CANCEL_AFTER_SIGN.getCode()
|
|
|
+ && tOrder.getOrderStatus() != OrderState.SELLER_REFUSE_BEFORE_SIGNL.getCode())
|
|
|
+ throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
|
|
|
+ tOrder.setDeleteSign(DeleteStatus.DELETED.getCode());
|
|
|
+ }else if(operatorType == 3){ //签单前取消订单
|
|
|
+ boolean flag = true;
|
|
|
+ if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ if(tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()
|
|
|
+ && tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_LAST_BALANCE.getCode()
|
|
|
+ && tOrder.getLiquidationStatus() != LiquidationState.ALREADY_PAY.getCode()){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ if(!flag)
|
|
|
+ throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
|
|
|
+ tOrder.setOrderStatus(OrderState.SELLER_REFUSE_BEFORE_SIGNL.getCode());
|
|
|
+ }
|
|
|
+ tOrderMapper.updateByPrimaryKey(tOrder);
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
}
|