Browse Source

Merge branch 'test3' into test2

anderx 10 months ago
parent
commit
6c775099e6

+ 1 - 0
src/main/java/com/goafanti/common/enums/NoticeStatus.java

@@ -93,6 +93,7 @@ public enum NoticeStatus {
 	PUBLIC_MAX_DURATION_YES(83,"公出时长审核通过"),
 	PUBLIC_MAX_DURATION_NO(84,"公出时长审核驳回"),
 	CLUE_USER_RELEASE(85,"线索客户丢失"),
+	ORDER_CANCELLATION_AMOUNT_RETURN(86,"订单取消金额返回"),
 	OTHER(0, "其他");
 
 	private NoticeStatus(Integer code, String desc) {

+ 32 - 0
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -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);
 		}

+ 6 - 4
src/main/java/com/goafanti/order/service/impl/OrderReceivablesServiceImpl.java

@@ -98,10 +98,6 @@ public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceiva
 				tr.setStatus(ReceivablesStatus.DDYC.getCode());
 				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
 				continue;
-			}else if(t.getDeleteSign()==2||t.getDeleteSign()==3) {
-				tr.setStatus(ReceivablesStatus.BGSD.getCode());
-				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
-				continue;
 			}else if(!tr.getCorporateName().equals(t.getUserName())) {
 				tr.setStatus(ReceivablesStatus.MCYC.getCode());
 				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
@@ -111,6 +107,12 @@ public class OrderReceivablesServiceImpl extends BaseMybatisDao<TemporaryReceiva
 				temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
 				continue;
 			}
+			 //锁定订单不再限制
+//			 else if(t.getDeleteSign()==2||t.getDeleteSign()==3) {
+//				 tr.setStatus(ReceivablesStatus.BGSD.getCode());
+//				 temporaryReceivablesMapper.updateByPrimaryKeySelective(tr);
+//				 continue;
+//			 }
 			//计算收款结果
 			BigDecimal bd = bill.add(tr.getAmount());
 			//判断表中数据