|
|
@@ -42,6 +42,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.mail.MessagingException;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
@@ -149,6 +150,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
private TOrderPublicReleaseCountMapper tOrderPublicReleaseCountMapper;
|
|
|
@Autowired
|
|
|
private PublicConfigMapper publicConfigMapper;
|
|
|
+ @Resource
|
|
|
+ private TemporaryReceivablesMapper temporaryReceivablesMapper;
|
|
|
|
|
|
|
|
|
@Value(value = "${upload.path}")
|
|
|
@@ -1914,6 +1917,35 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
if(t.getContractNo()!=null) {
|
|
|
contractNoReplace(orderNo, t.getContractNo(),t.getOrderDep());
|
|
|
}
|
|
|
+ if(t.getSettlementAmount().compareTo(BigDecimal.ZERO) > 0){
|
|
|
+ TemporaryReceivables tr=new TemporaryReceivables();
|
|
|
+ tr.setOrderNo(orderNo);
|
|
|
+ String financeId=null;
|
|
|
+ if(t.getFinanceId()!=null){
|
|
|
+ financeId=t.getFinanceId();
|
|
|
+
|
|
|
+ }else{
|
|
|
+ OrganizationListOut out = departmentMapper.selectAllById(t.getOrderDep());
|
|
|
+ if (out.getFinanceId()!=null){
|
|
|
+ financeId=out.getFinanceId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(financeId==null){
|
|
|
+ throw new BusinessException(new Error("订单部门财务负责人为空,请修改正确在操作","订单部门财务负责人为空,请修改正确在操作"));
|
|
|
+ }
|
|
|
+ tr.setAid(financeId);
|
|
|
+ tr.setAmount(t.getSettlementAmount());
|
|
|
+ User user = userMapper.queryById(t.getBuyerId());
|
|
|
+ tr.setCorporateName(user.getNickname());
|
|
|
+ tr.setStatus(ReceivablesStatus.DDYC.getCode());
|
|
|
+ tr.setRemarks("订单作废,金额返回订单财务负责人");
|
|
|
+ Date date = new Date();
|
|
|
+ tr.setCreateTime(date);
|
|
|
+ tr.setReceivablesTime(date);
|
|
|
+ tr.setMergeStatus(0);
|
|
|
+ temporaryReceivablesMapper.insertSelective(tr);
|
|
|
+ asyncUtils.addNoticAndEmail(new Notice(financeId,NoticeStatus.ORDER_CANCELLATION_AMOUNT_RETURN.getCode(),"订单作废,金额返回订单财务负责人" ));
|
|
|
+ }
|
|
|
t.setContractNo("");
|
|
|
return tOrderNewMapper.update(t);
|
|
|
}
|