Ver Fonte

提交代码

ioioio há 3 anos atrás
pai
commit
f5f14174c6

+ 3 - 1
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/BasicCorpsProfitChange.java

@@ -19,6 +19,8 @@ package org.springblade.client.entity;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.io.Serializable;
+import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import io.swagger.annotations.ApiModel;
@@ -88,7 +90,7 @@ public class BasicCorpsProfitChange implements Serializable {
 	* 创建时间
 	*/
 		@ApiModelProperty(value = "创建时间")
-		private LocalDateTime createTime;
+		private Date createTime;
 	/**
 	* 修改人
 	*/

+ 1 - 1
blade-service/blade-check/src/main/java/org/springblade/check/service/impl/AuditProecessServiceImpl.java

@@ -666,7 +666,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
 				R r = orderCheckClient.passCheck(auditProecess.getSrcBillId());
 				if(!r.isSuccess())
 				{
-					throw new SecurityException("修改财务数据失败");
+					throw new SecurityException(r.getMsg());
 				}
 
 

+ 1 - 0
blade-service/blade-client/src/main/java/org/springblade/client/message/controller/MessageController.java

@@ -89,6 +89,7 @@ public class MessageController extends BladeController {
 		messageLambdaQueryWrapper
 			.like(Message::getToUserId, AuthUtil.getUserId())
 			.eq(Message::getTenantId,AuthUtil.getTenantId())
+			.orderByDesc(Message::getCreateTime)
 		         .orderByAsc(Message::getIsRead);
 
 		List<Message> list = messageService.list(messageLambdaQueryWrapper);

+ 38 - 9
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

@@ -615,10 +615,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		order.setStatus(3);
 		baseMapper.updateById(order);
 
+		//不需要计算返利
+		if((order.getThisUsedProfit()==null|| order.getThisUsedProfit().compareTo(new BigDecimal("0"))==0) && (order.getCreateProfit()==null|| order.getCreateProfit().compareTo(new BigDecimal("0"))==0))
+		{
+			return;
+		}
 		//检查是否使用返利,如果使用返利
 		BasicCorpsProfitChange basicCorpsProfitChange=new BasicCorpsProfitChange();
+		basicCorpsProfitChange.setCorpId(order.getCorpId());
 		basicCorpsProfitChange.setOrderId(order.getId());
 		basicCorpsProfitChange.setOrderNo(order.getOrderNo());
+		basicCorpsProfitChange.setCreateTime(new Date());
+		basicCorpsProfitChange.setCreateUser(AuthUtil.getUserId());
+		//有返利
 		if(order.getThisUsedProfit()!=null && order.getThisUsedProfit().compareTo(BigDecimal.ZERO)==1)
 		{
 			//增加客户的总返利
@@ -629,10 +638,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 			basicCorpsProfitChange.setChangeSurplusProfit(order.getThisUsedProfit().negate());
 		}
 		//检查是否含有产生返利,如果有, 需要增加客户的本月待到账返利
-		if(order.getCreateProfit()!=null && order.getCreateProfit().compareTo(BigDecimal.ZERO)==1)
+		 if(order.getCreateProfit()!=null && order.getCreateProfit().compareTo(BigDecimal.ZERO)==1)
 		{
-			//增加客户的月返利
-			basicCorpsProfitChange.setChangeMonthProfit(order.getCreateProfit());
+				//增加客户的月返利
+				basicCorpsProfitChange.setChangeMonthProfit(order.getCreateProfit());
+
 		}
 		//新增返利变动记录
 		R save = corpsProfitChangeClient.save(basicCorpsProfitChange);
@@ -640,18 +650,34 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		{
 			throw new SecurityException("保存返利变动记录失败");
 		}
-
-
+		//修改客户返利
 		R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(order.getCorpId());
 		if(!corpMessage.isSuccess()||corpMessage.getData()==null)
 		{
 			throw new SecurityException("未查到客户记录");
 		}
 		CorpsDesc corpsDesc = corpMessage.getData();
-		corpsDesc.setProfitReturn(basicCorpsProfitChange.getChangeProfitReturn()==null?BigDecimal.ZERO.add(corpsDesc.getProfitReturn()):basicCorpsProfitChange.getChangeProfitReturn().add(corpsDesc.getProfitReturn()));
-		corpsDesc.setUsedProfit(basicCorpsProfitChange.getChangeUsedProfit()==null?BigDecimal.ZERO.add(corpsDesc.getUsedProfit()):basicCorpsProfitChange.getChangeUsedProfit().add(corpsDesc.getUsedProfit()));
-		corpsDesc.setSurplusProfit(basicCorpsProfitChange.getChangeSurplusProfit()==null?BigDecimal.ZERO.add(corpsDesc.getSurplusProfit()):basicCorpsProfitChange.getChangeSurplusProfit().add(corpsDesc.getSurplusProfit()));
-		corpsDesc.setMonthProfit(basicCorpsProfitChange.getChangeMonthProfit()==null?BigDecimal.ZERO.add(corpsDesc.getMonthProfit()):basicCorpsProfitChange.getChangeMonthProfit().add(corpsDesc.getMonthProfit()));
+		corpsDesc.setProfitReturn(basicCorpsProfitChange.getChangeProfitReturn()==null?new BigDecimal("0").add(corpsDesc.getProfitReturn()):basicCorpsProfitChange.getChangeProfitReturn().add(corpsDesc.getProfitReturn()));
+		corpsDesc.setUsedProfit(basicCorpsProfitChange.getChangeUsedProfit()==null?new BigDecimal("0").add(corpsDesc.getUsedProfit()):basicCorpsProfitChange.getChangeUsedProfit().add(corpsDesc.getUsedProfit()));
+		corpsDesc.setSurplusProfit(basicCorpsProfitChange.getChangeSurplusProfit()==null?new BigDecimal("0").add(corpsDesc.getSurplusProfit()):basicCorpsProfitChange.getChangeSurplusProfit().add(corpsDesc.getSurplusProfit()));
+		corpsDesc.setMonthProfit(basicCorpsProfitChange.getChangeMonthProfit()==null?new BigDecimal("0").add(corpsDesc.getMonthProfit()):basicCorpsProfitChange.getChangeMonthProfit().add(corpsDesc.getMonthProfit()));
+
+		if(corpsDesc.getProfitReturn().compareTo(new BigDecimal("0"))==-1)
+		{
+             throw new SecurityException("修改客户返利失败:总返利不能为负数");
+		}
+		if(corpsDesc.getUsedProfit().compareTo(new BigDecimal("0"))==-1)
+		{
+			throw new SecurityException("修改客户返利失败:已用返利不能为负数");
+		}
+		if(corpsDesc.getSurplusProfit().compareTo(new BigDecimal("0"))==-1)
+		{
+			throw new SecurityException("修改客户返利失败:可用返利不能为负数");
+		}
+		if(corpsDesc.getMonthProfit().compareTo(new BigDecimal("0"))==-1)
+		{
+			throw new SecurityException("修改客户返利失败:本月待到账返利不能为负数");
+		}
 		//更新客户返利情况
 		R corpsUpdate = corpsDescClient.corpsUpdate(corpsDesc);
 		if(!corpsUpdate.isSuccess())
@@ -659,6 +685,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 			throw new SecurityException("更新客户返利信息失败");
 		}
 
+
+
+
 	}
 
 	@Override