|
|
@@ -2,6 +2,7 @@ package com.goafanti.order.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -14,12 +15,16 @@ import com.goafanti.common.bo.Error;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.dao.NewOrderChangeMapper;
|
|
|
import com.goafanti.common.dao.OrderChangeLogMapper;
|
|
|
+import com.goafanti.common.dao.OrderRefundInvoiceMapper;
|
|
|
+import com.goafanti.common.dao.TOrderBillNewMapper;
|
|
|
import com.goafanti.common.dao.TOrderDunMapper;
|
|
|
+import com.goafanti.common.dao.TOrderInvoiceMapper;
|
|
|
import com.goafanti.common.dao.TOrderLogMapper;
|
|
|
import com.goafanti.common.dao.TOrderNewMapper;
|
|
|
import com.goafanti.common.dao.TOrderTaskMapper;
|
|
|
import com.goafanti.common.error.BusinessException;
|
|
|
import com.goafanti.common.model.OrderChangeLog;
|
|
|
+import com.goafanti.common.model.OrderRefundInvoice;
|
|
|
import com.goafanti.common.model.TOrderDun;
|
|
|
import com.goafanti.common.model.TOrderNew;
|
|
|
import com.goafanti.common.model.NewOrderChange;
|
|
|
@@ -29,7 +34,10 @@ import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.JDBCIdGenerator;
|
|
|
import com.goafanti.core.mybatis.page.Pagination;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
+import com.goafanti.order.bo.BillBo;
|
|
|
+import com.goafanti.order.bo.InvoiceBo;
|
|
|
import com.goafanti.order.bo.NewOrderChangeBo;
|
|
|
+import com.goafanti.order.bo.OrderChangeBo;
|
|
|
import com.goafanti.order.bo.OrderChangeLogBo;
|
|
|
import com.goafanti.order.bo.TOrderLogBo;
|
|
|
import com.goafanti.order.bo.TOrderTaskBo;
|
|
|
@@ -50,6 +58,12 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
@Autowired
|
|
|
private TOrderTaskMapper tOrderTaskMapper;
|
|
|
@Autowired
|
|
|
+ private TOrderBillNewMapper tOrderBillNewMapper;
|
|
|
+ @Autowired
|
|
|
+ private TOrderInvoiceMapper tOrderInvoiceMapper;
|
|
|
+ @Autowired
|
|
|
+ private OrderRefundInvoiceMapper orderRefundInvoiceMapper;
|
|
|
+ @Autowired
|
|
|
private OrderService orderService;
|
|
|
@Autowired
|
|
|
private JDBCIdGenerator idGenerator;
|
|
|
@@ -57,18 +71,22 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public int addOrderChange(NewOrderChangeBo t) {
|
|
|
+ public int addOrderChange(NewOrderChangeBo t,String startRemarks) {
|
|
|
TOrderNew ton=new TOrderNew();
|
|
|
ton.setOrderNo(t.getOrderNo());
|
|
|
ton.setDeleteSign(2);//将订单置为锁定
|
|
|
t.setProcessState(1);//设置营销管理员来审核
|
|
|
tOrderNewMapper.updateByPrimaryKeySelective(ton);
|
|
|
+ BigDecimal invoiceAmount=tOrderInvoiceMapper.conutAmountByOrderNo(t.getOrderNo());
|
|
|
+ t.setInvoiceAmount(invoiceAmount);//开票金额
|
|
|
+ BigDecimal paymentAmount=tOrderBillNewMapper.conutAmountByOrderNo(t.getOrderNo());
|
|
|
+ t.setPaymentAmount(paymentAmount);//收款金额
|
|
|
newOrderChangeMapper.insertSelective(t);
|
|
|
NewOrderChangeBo ncb=newOrderChangeMapper.selectByorderNo(t.getOrderNo());
|
|
|
OrderChangeLog ocl=new OrderChangeLog();
|
|
|
ocl.setAuditor(TokenManager.getAdminId());
|
|
|
ocl.setOrderNo(t.getOrderNo());
|
|
|
- ocl.setRemarks("发起了订单变更");
|
|
|
+ ocl.setRemarks(startRemarks);
|
|
|
ocl.setChangeId(ncb.getId());
|
|
|
ocl.setStatus(0);
|
|
|
orderChangeLogMapper.insertSelective(ocl);
|
|
|
@@ -85,7 +103,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
return nb;
|
|
|
}
|
|
|
@Override
|
|
|
- public int pushOrderChangeAudit(String orderNo, String remarks, Integer status,Integer processState) {
|
|
|
+ public int pushOrderChangeAudit(String orderNo, String remarks, Integer status,Integer processState,Integer rejectState) {
|
|
|
NewOrderChangeBo nb=newOrderChangeMapper.selectByorderNo(orderNo);
|
|
|
if (processState==null||(nb.getProcessState()!=9&&processState !=nb.getProcessState()) ) {
|
|
|
throw new BusinessException(new Error( "变更流程与您所操作流程不匹配","变更流程与您所操作流程不匹配"));
|
|
|
@@ -96,10 +114,10 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
//2通过 3驳回
|
|
|
if (status==2) {
|
|
|
//变更类型 0退单退款 1项目及金额变更 2仅项目变更 3仅金额变更 4重报 5赠送
|
|
|
- if(nb.getType()==0){
|
|
|
+ if(nb.getType() !=null){
|
|
|
if (nb.getChangeAmount().compareTo(new BigDecimal("0.2"))<0) {//小于则总裁通过,大于则董事长
|
|
|
if(nb.getProcessState()==7) {//项目变更通过
|
|
|
- changgeAdopt(nb);
|
|
|
+ //changgeAdopt(nb); 取消订单变更完成
|
|
|
}else if(nb.getProcessState()==1){
|
|
|
nb.setProcessState(3);
|
|
|
}else{
|
|
|
@@ -107,21 +125,23 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
}
|
|
|
}else {
|
|
|
if(nb.getProcessState()==8) {//项目变更通过
|
|
|
- changgeAdopt(nb);
|
|
|
+ //changgeAdopt(nb); 取消订单变更完成
|
|
|
}else if(nb.getProcessState()==1){
|
|
|
nb.setProcessState(3);
|
|
|
} else{
|
|
|
nb.setProcessState(nb.getProcessState()+1);
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
- if(nb.getProcessState()==9) {changgeAdopt(nb);}//项目变更通过
|
|
|
+ }/*else {
|
|
|
+ if(nb.getProcessState()==9) {
|
|
|
+ //changgeAdopt(nb); 取消订单变更完成
|
|
|
+ }
|
|
|
//流程状态 0营销员 1营销管理员 2技术员 3技术经理 4技术总监 5财务专员(退单) 6财务总监 7总裁 8董事长 9 财务专员(非退单)
|
|
|
if (nb.getProcessState()==1) nb.setProcessState(7);
|
|
|
else if (nb.getProcessState()==7)nb.setProcessState(9);
|
|
|
- }
|
|
|
+ }*/ //去掉第二条线
|
|
|
}else {
|
|
|
- nb.setProcessState(0);
|
|
|
+ nb.setProcessState(rejectState);
|
|
|
nb.setStatus(3);//订单变更设置为驳回
|
|
|
}
|
|
|
OrderChangeLog ocl=new OrderChangeLog();
|
|
|
@@ -256,6 +276,33 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
}
|
|
|
return newOrderChangeMapper.updateByPrimaryKeySelective(noc);
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public int addOrderRefundInvoice(OrderRefundInvoice o) {
|
|
|
+ o.setCreateTime(new Date());
|
|
|
+ return orderRefundInvoiceMapper.insertSelective(o);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public int deleteOrderRefundInvoice(Integer id) {
|
|
|
+ return orderRefundInvoiceMapper.deleteByPrimaryKey(id);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public List<OrderRefundInvoice> listOrderRefundInvoice(String orderNo) {
|
|
|
+ return orderRefundInvoiceMapper.selectByorderNo(orderNo);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public int pushCompleteOrderChange(NewOrderChangeBo nb) {
|
|
|
+ changgeAdopt(nb);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> listOrderInvoiceAndBill(String orderNo) {
|
|
|
+ Map<String, Object> map=new HashMap<>();
|
|
|
+ List<BillBo>list=tOrderBillNewMapper.selectByOrderNo(orderNo);
|
|
|
+ List<InvoiceBo>list2=tOrderInvoiceMapper.selectByOrderNo(orderNo);
|
|
|
+ map.put("bill", list);
|
|
|
+ map.put("invoice", list2);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|