Ver Fonte

2024年12月26日17:21:07

纪新园 há 1 ano atrás
pai
commit
e4d7550cf4
23 ficheiros alterados com 1249 adições e 375 exclusões
  1. 36 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/dto/CorpPointsTotal.java
  2. 10 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjGoodsDesc.java
  3. 116 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjIntegralDetail.java
  4. 10 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjShipItems.java
  5. 5 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/feign/IPJCorpClient.java
  6. 36 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/vo/PjIntegralDetailVO.java
  7. 18 12
      blade-service/blade-pay/src/main/java/org/springblade/pay/tonglianPayment/service/impl/PaymentServiceImpl.java
  8. 102 95
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/fegin/PJCorprClient.java
  9. 112 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/goods/controller/GoodsDescController.java
  10. 50 21
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java
  11. 203 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/PjIntegralDetailController.java
  12. 48 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/PjIntegralDetailMapper.java
  13. 76 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/PjIntegralDetailMapper.xml
  14. 4 8
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/IOrderService.java
  15. 50 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/IPjIntegralDetailService.java
  16. 136 156
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java
  17. 94 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/PjIntegralDetailServiceImpl.java
  18. 2 1
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/controller/ProductLaunchController.java
  19. 1 1
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/service/impl/ProductLaunchServiceImpl.java
  20. 35 4
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/settlement/service/impl/SettlementServiceImpl.java
  21. 22 24
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java
  22. 32 5
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/shoppingCart/service/impl/ShoppingCartServiceImpl.java
  23. 51 48
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/smartLargeScreenApi/service/impl/ApiServiceImpl.java

+ 36 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/dto/CorpPointsTotal.java

@@ -0,0 +1,36 @@
+package org.springblade.salesPart.dto;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+import org.springblade.salesPart.entity.PjIntegralDetail;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/12/26
+ */
+@Data
+public class CorpPointsTotal {
+
+	@ExcelProperty(value = "客户名称")
+	private String corpName;
+	@ExcelIgnore
+	private Long corpId;
+	@ExcelProperty(value = "积分有效期")
+	private Date date;
+	@ExcelProperty(value = "产生积分")
+	private BigDecimal addPoints;
+	@ExcelProperty(value = "使用积分")
+	private BigDecimal subPoints;
+	@ExcelProperty(value = "余额")
+	private BigDecimal pointsBalance;
+	@ExcelIgnore
+	private List<PjIntegralDetail> integralDetailListA;
+	@ExcelIgnore
+	private List<PjIntegralDetail> integralDetailListS;
+
+}

+ 10 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjGoodsDesc.java

@@ -242,6 +242,16 @@ public class PjGoodsDesc implements Serializable {
 	 */
 	@TableField(exist = false)
 	private BigDecimal inventory;
+	/**
+	 * 参考库存融资
+	 */
+	@TableField(exist = false)
+	private BigDecimal inventoryFinancing;
+	/**
+	 * 参考库存自有
+	 */
+	@TableField(exist = false)
+	private BigDecimal inventoryHave;
 
 	/**
 	 * 仓库

+ 116 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjIntegralDetail.java

@@ -0,0 +1,116 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 积分明细表实体类
+ *
+ * @author BladeX
+ * @since 2023-08-08
+ */
+@Data
+@TableName("business_integral_detail")
+@ApiModel(value = "IntegralDetail对象", description = "积分明细表")
+public class PjIntegralDetail implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	 * 来源id
+	 */
+	@ApiModelProperty(value = "来源id")
+	private Long srcId;
+	/**
+	 * 时间
+	 */
+	@ApiModelProperty(value = "时间")
+	private Date createTime;
+	/**
+	 * 有效期至
+	 */
+	@ApiModelProperty(value = "有效期至")
+	private Date validTo;
+	/**
+	 * 积分
+	 */
+	@ApiModelProperty(value = "积分")
+	private BigDecimal integral;
+	/**
+	 * 客户id
+	 */
+	@ApiModelProperty(value = "客户id")
+	private Long corpId;
+	/**
+	 * 备注
+	 */
+	@ApiModelProperty(value = "备注")
+	private String remarks;
+	/**
+	 * 创建人
+	 */
+	@ApiModelProperty(value = "创建人")
+	private Long createUser;
+	/**
+	 * 是否已删除(0 否 1是)
+	 */
+	@ApiModelProperty(value = "是否已删除(0 否 1是)")
+	private Integer isDeleted;
+	private String createUserName;
+	/**
+	 * 供应商名称
+	 */
+	@ApiModelProperty(value = "客户名称")
+	private String corpName;
+	/**
+	 * 类型
+	 */
+	@ApiModelProperty(value = "类型")
+	private String type;
+	/**
+	 * 来源单号
+	 */
+	@ApiModelProperty(value = "来源单号")
+	private String srcNo;
+
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+	/**
+	 * 商品名称
+	 */
+	@ApiModelProperty(value = "商品名称")
+	private String goodsName;
+	/**
+	 * 商品id
+	 */
+	@ApiModelProperty(value = "商品id")
+	private String goodsId;
+
+
+}

+ 10 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjShipItems.java

@@ -222,6 +222,16 @@ public class PjShipItems implements Serializable {
 	 */
 	@ApiModelProperty(value = "参考库存")
 	private BigDecimal inventory;
+	/**
+	 * 参考库存融资
+	 */
+	@ApiModelProperty(value = "参考库存融资")
+	private BigDecimal inventoryFinancing;
+	/**
+	 * 参考库存自有
+	 */
+	@ApiModelProperty(value = "参考库存自有")
+	private BigDecimal inventoryHave;
 
 	/**
 	 * 融资出库记录

+ 5 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/feign/IPJCorpClient.java

@@ -24,6 +24,8 @@ public interface IPJCorpClient {
 	String GET_BY_CORP = API_PREFIX + "/getByCorp";
 
 	String UPDATE_INTEGRAL_LT = API_PREFIX + "/updateIntegral";
+
+	String UPDATE_REVOKE_INTEGRAL_LT = API_PREFIX + "/updateRevokeIntegral";
 	String UPDATE_CORPS = API_PREFIX + "/updateCorps";
 
 	/**
@@ -38,6 +40,9 @@ public interface IPJCorpClient {
 	@PostMapping(UPDATE_INTEGRAL_LT)
 	R updateIntegral(@RequestBody List<PjOrder> order);
 
+	@PostMapping(UPDATE_REVOKE_INTEGRAL_LT)
+	R updateRevokeIntegral(@RequestBody List<PjOrder> order);
+
 	@PostMapping(UPDATE_CORPS)
 	R updateCorps(@RequestBody PjCorpsDesc corpsDesc);
 

+ 36 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/vo/PjIntegralDetailVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.salesPart.entity.PjIntegralDetail;
+
+/**
+ * 积分明细表视图实体类
+ *
+ * @author BladeX
+ * @since 2023-08-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "IntegralDetailVO对象", description = "积分明细表")
+public class PjIntegralDetailVO extends PjIntegralDetail {
+	private static final long serialVersionUID = 1L;
+
+}

+ 18 - 12
blade-service/blade-pay/src/main/java/org/springblade/pay/tonglianPayment/service/impl/PaymentServiceImpl.java

@@ -667,7 +667,7 @@ public class PaymentServiceImpl implements IPaymentService {
 							//给角色为财务的人发送消息
 							R<String> clientDeptIds = sysClient.getRoleIds(parametersDetails.getTenantId(), "客服");
 							if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
-								R<List<User>> userList = userClient.listUserByRoleId(clientDeptIds.getData(), parametersDetails.getTenantId(), selectOrder.getSalesCompanyId()+"");
+								R<List<User>> userList = userClient.listUserByRoleId(clientDeptIds.getData(), parametersDetails.getTenantId(), selectOrder.getSalesCompanyId() + "");
 								if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
 									for (User datum : userList.getData()) {
 										if (ObjectUtils.isNotNull(datum.getOaOpenId())) {
@@ -719,12 +719,15 @@ public class PaymentServiceImpl implements IPaymentService {
 							}
 						}
 						ipjOrderClient.updateOrder(re.getData());
-						/*R res = ipjCorpClient.updateIntegral(re.getData());
-						if (ObjectUtils.isNotNull(res) && res.isSuccess()) {
-							System.out.println("积分修改成功:" + res.getMsg());
-						} else {
-							System.out.println("积分修改失败调取接口异常");
-						}*/
+						String status = sysClient.paramServiceValue( parametersDetails.getTenantId(),"whether.calculation.integral");
+						if ("1".equals(status)) {
+							R res = ipjCorpClient.updateIntegral(re.getData());
+							if (ObjectUtils.isNotNull(res) && res.isSuccess()) {
+								System.out.println("积分修改成功:" + res.getMsg());
+							} else {
+								System.out.println("积分修改失败调取接口异常");
+							}
+						}
 						SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
 						String date1 = format.format(new Date());
 
@@ -936,11 +939,14 @@ public class PaymentServiceImpl implements IPaymentService {
 
 						}
 						ipjOrderClient.updateOrder(re.getData());
-						R res = ipjCorpClient.updateIntegral(re.getData());
-						if (ObjectUtils.isNotNull(res) && res.isSuccess()) {
-							System.out.println("积分修改成功:" + res.getMsg());
-						} else {
-							System.out.println("积分修改失败调取接口异常");
+						String status = sysClient.paramServiceValue( parametersDetails.getTenantId(),"whether.calculation.integral");
+						if ("1".equals(status)) {
+							R res = ipjCorpClient.updateIntegral(re.getData());
+							if (ObjectUtils.isNotNull(res) && res.isSuccess()) {
+								System.out.println("积分修改成功:" + res.getMsg());
+							} else {
+								System.out.println("积分修改失败调取接口异常");
+							}
 						}
 						SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
 						String date1 = format.format(new Date());

+ 102 - 95
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/fegin/PJCorprClient.java

@@ -2,22 +2,18 @@ package org.springblade.salesPart.corps.fegin;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tenant.annotation.TenantIgnore;
 import org.springblade.core.tool.api.R;
-import org.springblade.purchase.sales.entity.IntegralDetail;
-import org.springblade.purchase.sales.feign.IIntegralDetailClient;
 import org.springblade.salesPart.corps.mapper.CorpsDescMapper;
 import org.springblade.salesPart.corps.service.ICorpsAttnService;
 import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.feign.IPJCorpClient;
 import org.springblade.salesPart.goods.mapper.GoodsDescMapper;
 import org.springblade.salesPart.order.mapper.OrderItemsMapper;
-import org.springblade.system.user.entity.User;
-import org.springblade.system.user.feign.IUserClient;
+import org.springblade.salesPart.order.service.IPjIntegralDetailService;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.RestController;
 import springfox.documentation.annotations.ApiIgnore;
@@ -38,13 +34,11 @@ public class PJCorprClient implements IPJCorpClient {
 
 	private final ICorpsAttnService corpsAttnService;
 
-	private final IUserClient userClient;
-
 	private final OrderItemsMapper orderItemsMapper;
 
 	private final GoodsDescMapper goodsDescMapper;
 
-	private final IIntegralDetailClient iIntegralDetailClient;
+	private final IPjIntegralDetailService integralDetailService;
 
 
 	@Override
@@ -68,15 +62,12 @@ public class PJCorprClient implements IPJCorpClient {
 	@Transactional(rollbackFor = Exception.class)
 	@TenantIgnore
 	public R updateIntegral(List<PjOrder> orderList) {
-		List<User> users = new ArrayList<>();
-		List<IntegralDetail> integralDetailList = new ArrayList<>();
+		List<PjIntegralDetail> integralDetailList = new ArrayList<>();
 		System.out.println("=========积分修改开始==========");
 		if (!orderList.isEmpty()) {
 			System.out.println("=========订单数据==========" + orderList);
 			String tenantId = orderList.get(0).getTenantId();
 			List<PjCorpsDesc> pjCorpsDescList = new ArrayList<>();
-			List<PjCorpsDesc> referenceList = new ArrayList<>();
-			List<User> userList = new ArrayList<>();
 			List<PjGoodsDesc> pjGoodsDescList = new ArrayList<>();
 			List<Long> orderId = orderList.stream().map(PjOrder::getId).filter(Objects::nonNull).collect(Collectors.toList());
 			StringBuilder orderIds = new StringBuilder();
@@ -84,10 +75,6 @@ public class PJCorprClient implements IPJCorpClient {
 				orderIds.append(item).append(",");
 			}
 			List<PjOrderItems> orderItemsList = orderItemsMapper.selectListNotTenantId(tenantId, orderIds.substring(0, orderIds.length() - 1));
-			/*List<PjOrderItems> orderItemsList = orderItemsMapper.selectList(new LambdaQueryWrapper<PjOrderItems>()
-				.in(PjOrderItems::getPid, orderId)
-				.eq(PjOrderItems::getIsDeleted, 0)
-				.eq(PjOrderItems::getTenantId, tenantId));*/
 			System.out.println("=========订单明细数据==========" + orderItemsList);
 			if (!orderItemsList.isEmpty()) {
 				List<Long> goodsId = orderItemsList.stream().map(PjOrderItems::getGoodsId).filter(Objects::nonNull).collect(Collectors.toList());
@@ -97,11 +84,6 @@ public class PJCorprClient implements IPJCorpClient {
 						goodsIds.append(item).append(",");
 					}
 					pjGoodsDescList = goodsDescMapper.selectListNotTenantId(tenantId, goodsIds.substring(0, goodsIds.length() - 1));
-					/*pjGoodsDescList = goodsDescMapper.selectList(new LambdaQueryWrapper<PjGoodsDesc>()
-						.eq(PjGoodsDesc::getTenantId, tenantId)
-						.eq(PjGoodsDesc::getIsDeleted, 0)
-						.eq(PjGoodsDesc::getEnableOrNot, 0)
-						.in(PjGoodsDesc::getId, goodsIds.toString()));*/
 					System.out.println("=========订单明细商品数据==========" + pjGoodsDescList);
 				} else {
 					System.out.println("=========订单明细商品数据为空==========");
@@ -116,44 +98,109 @@ public class PJCorprClient implements IPJCorpClient {
 					customerIds.append(item).append(",");
 				}
 				pjCorpsDescList = corpsDescMapper.selectListNotTenantId(tenantId, customerIds.substring(0, customerIds.length() - 1));
-				/*pjCorpsDescList = corpsDescMapper.selectList(new LambdaQueryWrapper<PjCorpsDesc>()
-					.in(PjCorpsDesc::getId, customerId)
-					.eq(PjCorpsDesc::getIsDeleted, 0)
-					.eq(PjCorpsDesc::getTenantId, tenantId));*/
 				System.out.println("=========订单客户数据==========" + pjCorpsDescList);
+			}
+			for (PjOrder order : orderList) {
+				PjCorpsDesc corpsDesc = new PjCorpsDesc();
 				if (!pjCorpsDescList.isEmpty()) {
-					List<Long> referenceId = pjCorpsDescList.stream().map(PjCorpsDesc::getReferenceId).filter(Objects::nonNull).collect(Collectors.toList());
-					System.out.println("=========客户推荐人==========" + referenceId);
-					if (!referenceId.isEmpty()) {
-						StringBuilder referenceIds = new StringBuilder();
-						for (Long item : referenceId) {
-							referenceIds.append(item).append(",");
+					corpsDesc = pjCorpsDescList.stream().filter(e -> e.getId().equals(order.getCustomerId())).findFirst().orElse(null);
+				}
+				if (corpsDesc == null) {
+					throw new RuntimeException("未查到客户信息");
+				}
+				if (!orderItemsList.isEmpty()) {
+					List<PjOrderItems> list = orderItemsList.stream().filter(e -> e.getPid().equals(order.getId())).collect(Collectors.toList());
+					System.out.println("=========循环订单明细数据==========" + list);
+					if (!list.isEmpty()) {
+						List<Long> goodsIds = new ArrayList<>();
+						for (PjOrderItems e : list) {
+							if (!pjGoodsDescList.isEmpty()) {
+								PjGoodsDesc goodsDesc = pjGoodsDescList.stream().filter(item -> item.getId().equals(e.getGoodsId())).findFirst().orElse(null);
+								if (goodsDesc != null) {
+									goodsIds.add(goodsDesc.getId());
+									//客户门店积分
+									corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().add(goodsDesc.getIntegral().multiply(e.getGoodsNum())));
+								}
+							}
 						}
-						referenceList = corpsDescMapper.selectListNotTenantId(tenantId, referenceIds.substring(0, referenceIds.length() - 1));
-						/*referenceList = corpsDescMapper.selectList(new LambdaQueryWrapper<PjCorpsDesc>()
-							.in(PjCorpsDesc::getId, referenceId)
-							.eq(PjCorpsDesc::getIsDeleted, 0)
-							.eq(PjCorpsDesc::getTenantId, tenantId));*/
-						System.out.println("=========客户推荐人数据==========" + referenceList);
-					} else {
-						System.out.println("=========未找到客户推荐人数据==========");
-					}
-					List<Long> salesmanId = pjCorpsDescList.stream().map(PjCorpsDesc::getSalesmanId).filter(Objects::nonNull).collect(Collectors.toList());
-					System.out.println("=========客户业务员==========" + salesmanId);
-					if (!salesmanId.isEmpty()) {
-						StringBuilder salesmanIds = new StringBuilder();
-						for (Long item : salesmanId) {
-							salesmanIds.append(item).append(",");
+						System.out.println("=========积分处理完成数据==========");
+						corpsDescMapper.updateByIdPointsBalance(corpsDesc);
+						PjIntegralDetail integralDetail = new PjIntegralDetail();
+						integralDetail.setCreateTime(new Date());
+						integralDetail.setCreateUserName(order.getCreateUserName());
+						integralDetail.setCreateUser(order.getCreateUser());
+						integralDetail.setTenantId(tenantId);
+						integralDetail.setType("购买获取");
+						integralDetail.setSrcId(order.getId());
+						integralDetail.setSrcNo(order.getOrdNo());
+						integralDetail.setCorpId(order.getCustomerId());
+						integralDetail.setCorpName(order.getCustomerName());
+						integralDetail.setIntegral(order.getTotalMoney());
+						integralDetail.setGoodsName(order.getGoodsNameJoin());
+						StringBuilder goodsId = new StringBuilder();
+						for (Long item : goodsIds) {
+							goodsId.append(item).append(",");
 						}
-						userList = userClient.selectListNotTenantId(tenantId, salesmanIds.substring(0, salesmanIds.length() - 1));
-//						userList = userClient.userListGetByIds(salesmanId);
-						System.out.println("=========客户业务员数据==========" + userList);
+						if (goodsId.length() > 0) {
+							integralDetail.setGoodsId(goodsId.substring(0, goodsId.length() - 1));
+						}
+						integralDetailList.add(integralDetail);
 					} else {
-						System.out.println("=========未找到客户业务员数据==========");
+						System.out.println("=========循环未找到明细数据==========");
 					}
+				}
+			}
+		} else {
+			System.out.println("=========订单数据为空==========");
+		}
+		if (!integralDetailList.isEmpty()) {
+			integralDetailService.updateBatchById(integralDetailList);
+		}
+		System.out.println("=========积分修改完成数据==========");
+		return R.success("操作成功");
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@TenantIgnore
+	public R updateRevokeIntegral(List<PjOrder> orderList) {
+		List<PjIntegralDetail> integralDetailList = new ArrayList<>();
+		System.out.println("=========积分修改开始==========");
+		if (!orderList.isEmpty()) {
+			System.out.println("=========订单数据==========" + orderList);
+			String tenantId = orderList.get(0).getTenantId();
+			List<PjCorpsDesc> pjCorpsDescList = new ArrayList<>();
+			List<PjGoodsDesc> pjGoodsDescList = new ArrayList<>();
+			List<Long> orderId = orderList.stream().map(PjOrder::getId).filter(Objects::nonNull).collect(Collectors.toList());
+			StringBuilder orderIds = new StringBuilder();
+			for (Long item : orderId) {
+				orderIds.append(item).append(",");
+			}
+			List<PjOrderItems> orderItemsList = orderItemsMapper.selectListNotTenantId(tenantId, orderIds.substring(0, orderIds.length() - 1));
+			System.out.println("=========订单明细数据==========" + orderItemsList);
+			if (!orderItemsList.isEmpty()) {
+				List<Long> goodsId = orderItemsList.stream().map(PjOrderItems::getGoodsId).filter(Objects::nonNull).collect(Collectors.toList());
+				if (!goodsId.isEmpty()) {
+					StringBuilder goodsIds = new StringBuilder();
+					for (Long item : goodsId) {
+						goodsIds.append(item).append(",");
+					}
+					pjGoodsDescList = goodsDescMapper.selectListNotTenantId(tenantId, goodsIds.substring(0, goodsIds.length() - 1));
+					System.out.println("=========订单明细商品数据==========" + pjGoodsDescList);
 				} else {
-					System.out.println("=========未找到订单客户数据==========");
+					System.out.println("=========订单明细商品数据为空==========");
 				}
+			} else {
+				System.out.println("=========订单明细数据为空==========");
+			}
+			List<Long> customerId = orderList.stream().map(PjOrder::getCustomerId).filter(Objects::nonNull).collect(Collectors.toList());
+			if (!customerId.isEmpty()) {
+				StringBuilder customerIds = new StringBuilder();
+				for (Long item : customerId) {
+					customerIds.append(item).append(",");
+				}
+				pjCorpsDescList = corpsDescMapper.selectListNotTenantId(tenantId, customerIds.substring(0, customerIds.length() - 1));
+				System.out.println("=========订单客户数据==========" + pjCorpsDescList);
 			}
 			for (PjOrder order : orderList) {
 				PjCorpsDesc corpsDesc = new PjCorpsDesc();
@@ -163,15 +210,6 @@ public class PJCorprClient implements IPJCorpClient {
 				if (corpsDesc == null) {
 					throw new RuntimeException("未查到客户信息");
 				}
-				PjCorpsDesc finalCorpsDesc = corpsDesc;
-				PjCorpsDesc reference = null;
-				if (ObjectUtils.isNotNull(corpsDesc.getReferenceId()) && !referenceList.isEmpty()) {
-					reference = referenceList.stream().filter(e -> e.getId().equals(finalCorpsDesc.getReferenceId())).findFirst().orElse(null);
-				}
-				User user = null;
-				if (ObjectUtils.isNotNull(corpsDesc.getSalesmanId()) && !userList.isEmpty()) {
-					user = userList.stream().filter(e -> e.getId().equals(finalCorpsDesc.getSalesmanId())).findFirst().orElse(null);
-				}
 				if (!orderItemsList.isEmpty()) {
 					List<PjOrderItems> list = orderItemsList.stream().filter(e -> e.getPid().equals(order.getId())).collect(Collectors.toList());
 					System.out.println("=========循环订单明细数据==========" + list);
@@ -182,35 +220,19 @@ public class PJCorprClient implements IPJCorpClient {
 								PjGoodsDesc goodsDesc = pjGoodsDescList.stream().filter(item -> item.getId().equals(e.getGoodsId())).findFirst().orElse(null);
 								if (goodsDesc != null) {
 									goodsIds.add(goodsDesc.getId());
-									//业务员积分
-									if (user != null && ObjectUtils.isNotNull(goodsDesc.getSalesmanIntegral())) {
-										user.setPointsBalance(user.getPointsBalance().add(goodsDesc.getSalesmanIntegral().multiply(e.getGoodsNum())));
-									}
-									//推荐人积分
-									if (reference != null && ObjectUtils.isNotNull(goodsDesc.getReferenceIntegral())) {
-										reference.setPointsBalance(reference.getPointsBalance().add(goodsDesc.getReferenceIntegral().multiply(e.getGoodsNum())));
-									}
 									//客户门店积分
-									corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().add(goodsDesc.getIntegral().multiply(e.getGoodsNum())));
+									corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().subtract(goodsDesc.getIntegral().multiply(e.getGoodsNum())));
 								}
 							}
 						}
 						System.out.println("=========积分处理完成数据==========");
-						if (reference != null) {
-							corpsDescMapper.updateByIdPointsBalance(reference);
-//							corpsDescMapper.updateById(reference);
-						}
-						if (user != null) {
-							users.add(user);
-						}
-//						corpsDescMapper.updateById(corpsDesc);
 						corpsDescMapper.updateByIdPointsBalance(corpsDesc);
-						IntegralDetail integralDetail = new IntegralDetail();
+						PjIntegralDetail integralDetail = new PjIntegralDetail();
 						integralDetail.setCreateTime(new Date());
 						integralDetail.setCreateUserName(order.getCreateUserName());
 						integralDetail.setCreateUser(order.getCreateUser());
 						integralDetail.setTenantId(tenantId);
-						integralDetail.setType("购买获取");
+						integralDetail.setType("积分退回");
 						integralDetail.setSrcId(order.getId());
 						integralDetail.setSrcNo(order.getOrdNo());
 						integralDetail.setCorpId(order.getCustomerId());
@@ -225,12 +247,6 @@ public class PJCorprClient implements IPJCorpClient {
 							integralDetail.setGoodsId(goodsId.substring(0, goodsId.length() - 1));
 						}
 						integralDetailList.add(integralDetail);
-						/*R res = iIntegralDetailClient.submit(integralDetail);
-						if (res.isSuccess()) {
-							System.out.println("=========积分记录保存成功!" + res.getData() + "==========");
-						} else {
-							System.out.println("=========积分记录保存失败!" + res.getData() + "==========");
-						}*/
 					} else {
 						System.out.println("=========循环未找到明细数据==========");
 					}
@@ -239,17 +255,8 @@ public class PJCorprClient implements IPJCorpClient {
 		} else {
 			System.out.println("=========订单数据为空==========");
 		}
-		if (!users.isEmpty()) {
-//			userClient.updateUserBatchById(users);
-			userClient.updateByIdPointsBalance(users);
-		}
 		if (!integralDetailList.isEmpty()) {
-			R res = iIntegralDetailClient.updateBatchById(integralDetailList);
-			if (res.isSuccess()) {
-				System.out.println("=========积分记录保存成功!" + res.getData() + "==========");
-			} else {
-				System.out.println("=========积分记录保存失败!" + res.getMsg() + "==========");
-			}
+			integralDetailService.updateBatchById(integralDetailList);
 		}
 		System.out.println("=========积分修改完成数据==========");
 		return R.success("操作成功");

+ 112 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/goods/controller/GoodsDescController.java

@@ -611,6 +611,8 @@ public class GoodsDescController extends BladeController {
 				item.setSharedCompanyId(pjProductLaunch.getSalesCompanyId());
 				item.setSharedCompanyName(pjProductLaunch.getSalesCompanyName());
 				item.setInventory(pjProductLaunch.getBalanceQuantity());
+				item.setInventoryFinancing(pjProductLaunch.getBalanceQuantityFinancing());
+				item.setInventoryHave(pjProductLaunch.getBalanceQuantityHave());
 				item.setPrice(pjProductLaunch.getInventoryCostPrice());
 			}
 			String typeId = item.getGoodsTypeId();
@@ -684,4 +686,114 @@ public class GoodsDescController extends BladeController {
 		}
 		return R.data(detail);
 	}
+
+	/**
+	 * 积分商品下拉
+	 */
+	@GetMapping("/goodsPagePoints")
+	@ApiOperationSupport(order = 12)
+	@ApiOperation(value = "商品下拉", notes = "传入goods")
+	public R<IPage<PjGoodsDesc>> goodsPagePoints(PjGoodsDesc goods, Query query) {
+		LambdaQueryWrapper<PjProductLaunch> queryWrapper = new LambdaQueryWrapper<PjProductLaunch>()
+			.eq(PjProductLaunch::getIsDeleted, 0)
+			.eq(PjProductLaunch::getWhetherIntegral, 1)
+			.ne(PjProductLaunch::getInventory, 0)
+			.eq(PjProductLaunch::getUpAndDownShelves, 1);
+		queryWrapper.apply("find_in_set(sales_company_id,'" + AuthUtil.getDeptId() + "')");
+		List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(queryWrapper);
+		List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).distinct().collect(Collectors.toList());
+		PjCorpsDesc pjCorpsDesc = corpsDescService.getById(goods.getCustomId());
+		String priceSystem = "";
+		if (ObjectUtils.isNotNull(pjCorpsDesc)) {
+			priceSystem = pjCorpsDesc.getPriceSystem();
+		}
+		LambdaQueryWrapper<PjGoodsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
+			.eq(PjGoodsDesc::getIsDeleted, 0)
+			.eq(ObjectUtils.isNotNull(goods.getEnableOrNot()), PjGoodsDesc::getEnableOrNot, goods.getEnableOrNot())
+			.eq(ObjectUtils.isNotNull(goods.getBrandId()), PjGoodsDesc::getBrandId, goods.getBrandId())
+			.eq(ObjectUtils.isNotNull(goods.getSpecificationAndModel()), PjGoodsDesc::getSpecificationAndModel, goods.getSpecificationAndModel())
+			.eq(ObjectUtils.isNotNull(goods.getBrandItem()), PjGoodsDesc::getBrandItem, goods.getBrandItem())
+			.eq(ObjectUtils.isNotNull(goods.getExplosionProof()), PjGoodsDesc::getExplosionProof, goods.getExplosionProof())
+			.eq(ObjectUtils.isNotNull(goods.getOriginalFactory()), PjGoodsDesc::getOriginalFactory, goods.getOriginalFactory())
+			.eq(ObjectUtils.isNotNull(goods.getWhetherIntegral()), PjGoodsDesc::getWhetherIntegral, goods.getWhetherIntegral())//是否是积分商品
+			.eq(ObjectUtils.isNotNull(goods.getSelfRecovery()), PjGoodsDesc::getSelfRecovery, goods.getSelfRecovery())
+			.like(ObjectUtils.isNotNull(goods.getCode()), PjGoodsDesc::getCode, goods.getCode())
+		;
+		if (ObjectUtil.isNotEmpty(goods.getCname())) {//商品名称
+			lambdaQueryWrapper.and(i -> i.like(PjGoodsDesc::getCname, goods.getCname()).or().like(PjGoodsDesc::getCnameInt, goods.getCname()));
+		}
+		//指定分类为一级分类,查询此分类所有二级分类的商品
+		if (StringUtils.isNotBlank(goods.getGoodsTypeId())) {
+			Long goodsId = Long.parseLong(goods.getGoodsTypeId());
+			List<Long> goodsIdList = new ArrayList<>();
+			selectChildById(goodsId, goodsIdList);
+			goodsIdList.add(goodsId);
+
+			lambdaQueryWrapper.in(PjGoodsDesc::getGoodsTypeId, goodsIdList);
+		}
+		if (ObjectUtils.isNotNull(ids) && !ids.isEmpty()) {
+			lambdaQueryWrapper.in(PjGoodsDesc::getId, ids);
+		} else {
+			return R.data(new Page<>());
+		}
+
+		IPage<PjGoodsDesc> list = goodsDescService.page(Condition.getPage(query), lambdaQueryWrapper);
+		if (!list.getRecords().isEmpty()) {
+			String typeId = list.getRecords().stream().map(PjGoodsDesc::getGoodsTypeId).filter(Objects::nonNull).collect(Collectors.joining(","));
+			String[] split = typeId.split(",");
+			List<String> stringList = Arrays.asList(split);
+			LambdaQueryWrapper<PjGoodsType> goodsTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
+			goodsTypeLambdaQueryWrapper.in(PjGoodsType::getId, stringList);
+			List<PjGoodsType> pjGoodsTypeList = goodsDescType.list(goodsTypeLambdaQueryWrapper);
+			List<PjGoodsFiles> goodsFilesList = new ArrayList<>();
+			List<PjBrandFiles> pjBrandFilesList = new ArrayList<>();
+			List<Long> goodsId = list.getRecords().stream().map(PjGoodsDesc::getId).filter(Objects::nonNull).collect(Collectors.toList());
+			List<Long> brandIds = list.getRecords().stream().map(PjGoodsDesc::getBrandId).filter(Objects::nonNull).collect(Collectors.toList());
+			goodsFilesList = goodsFilesService.list(new LambdaQueryWrapper<PjGoodsFiles>()
+				.eq(PjGoodsFiles::getMainImage, 0)
+				.in(PjGoodsFiles::getPid, goodsId)
+				.eq(PjGoodsFiles::getTenantId, AuthUtil.getTenantId())
+				.eq(PjGoodsFiles::getIsDeleted, 0));
+			if (goodsFilesList.isEmpty()) {
+				pjBrandFilesList = brandFilesService.list(new LambdaQueryWrapper<PjBrandFiles>()
+					.eq(PjBrandFiles::getMainImage, 0)
+					.in(PjBrandFiles::getPid, brandIds)
+					.eq(PjBrandFiles::getTenantId, AuthUtil.getTenantId())
+					.eq(PjBrandFiles::getIsDeleted, 0));
+			}
+			for (PjGoodsDesc item : list.getRecords()) {
+				if (!pjProductLaunchList.isEmpty()) {
+					PjProductLaunch pjProductLaunch = pjProductLaunchList.stream().filter(e -> e.getGoodsId().equals(item.getId())).findFirst().orElse(new PjProductLaunch());
+					if ("售价1".equals(priceSystem)) {
+						item.setPrice(pjProductLaunch.getPriceOne());
+					} else if ("售价2".equals(priceSystem)) {
+						item.setPrice(pjProductLaunch.getPriceTwo());
+					} else if ("售价3".equals(priceSystem)) {
+						item.setPrice(pjProductLaunch.getPriceThree());
+					} else if ("售价4".equals(priceSystem)) {
+						item.setPrice(pjProductLaunch.getPriceFour());
+					}
+					item.setSharedCompanyId(pjProductLaunch.getSourceCompanyId());
+					item.setSharedCompanyName(pjProductLaunch.getSourceCompanyName());
+					item.setInventory(pjProductLaunch.getInventory());
+				}
+				String typeIds = item.getGoodsTypeId();
+				String[] typeIdsArry = typeIds.split(",");
+				List<String> typeList = Arrays.asList(typeIdsArry);
+				List<PjGoodsType> types = pjGoodsTypeList.stream().filter(e -> typeList.contains(e.getId() + "")).collect(Collectors.toList());
+				if (CollectionUtils.isNotEmpty(types)) {
+					List<String> typeStr = types.stream().map(PjGoodsType::getCname).collect(Collectors.toList());
+					item.setGoodsTypeName(typeStr.toString().replace("[", "").replace("]", ""));
+				}
+				List<PjGoodsFiles> goodsFilesList1 = new ArrayList<>();
+				goodsFilesList1 = goodsFilesList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
+				if (goodsFilesList1.isEmpty() && ObjectUtils.isNotNull(item.getBrandId())) {
+					goodsFilesList1 = BeanUtil.copy(pjBrandFilesList.stream().filter(e -> e.getPid().equals(item.getBrandId())).collect(Collectors.toList()), PjGoodsFiles.class);
+				}
+				item.setGoodsFilesList(goodsFilesList1);
+			}
+		}
+		return R.data(list);
+	}
 }

+ 50 - 21
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java

@@ -149,18 +149,30 @@ public class OrderController extends BladeController {
 		} else {
 			lambdaQueryWrapper.ne(ObjectUtils.isNotEmpty(order.getActualPaymentStatus()), PjOrder::getActualPaymentStatus, order.getActualPaymentStatus());//来源单号
 		}
-		if (ObjectUtils.isNull(order.getNotComplete())) {
-			if(ObjectUtils.isNotEmpty(order.getStatus())){
-				lambdaQueryWrapper.apply( "find_in_set(status,'" + order.getStatus() + "')");
-			}else{
-				lambdaQueryWrapper.apply("not find_in_set(status,'已发货,已收货,已取消')");
+		if ("JF".equals(order.getBsType())){
+			if (ObjectUtils.isNull(order.getNotComplete())) {
+				if(ObjectUtils.isNotEmpty(order.getStatus())){
+					lambdaQueryWrapper.apply( "find_in_set(status,'" + order.getStatus() + "')");
+				}else{
+					lambdaQueryWrapper.apply("not find_in_set(status,'已发货,已取消')");
+				}
+			} else {
+				lambdaQueryWrapper.apply(ObjectUtils.isNotEmpty(order.getStatus()), "find_in_set(status,'" + order.getStatus() + "')");
 			}
-		} else {
-			lambdaQueryWrapper.apply(ObjectUtils.isNotEmpty(order.getStatus()), "find_in_set(status,'" + order.getStatus() + "')");
+		}else{
+			if (ObjectUtils.isNull(order.getNotComplete())) {
+				if(ObjectUtils.isNotEmpty(order.getStatus())){
+					lambdaQueryWrapper.apply( "find_in_set(status,'" + order.getStatus() + "')");
+				}else{
+					lambdaQueryWrapper.apply("not find_in_set(status,'已发货,已收货,已取消')");
+				}
+			} else {
+				lambdaQueryWrapper.apply(ObjectUtils.isNotEmpty(order.getStatus()), "find_in_set(status,'" + order.getStatus() + "')");
+			}
+			lambdaQueryWrapper.apply("(( business_source = '外部销售' AND FIND_IN_SET( actual_payment_status, '2,3,4' ) )" +
+				" OR (business_source = '内部销售' AND FIND_IN_SET( actual_payment_status, '0,1,2,3,4' ))" +
+				" OR (business_source = '额度支付' AND FIND_IN_SET( actual_payment_status, '0,1,2,3,4' )))");
 		}
-		lambdaQueryWrapper.apply("(( business_source = '外部销售' AND FIND_IN_SET( actual_payment_status, '2,3,4' ) )" +
-			" OR (business_source = '内部销售' AND FIND_IN_SET( actual_payment_status, '0,1,2,3,4' ))" +
-			" OR (business_source = '额度支付' AND FIND_IN_SET( actual_payment_status, '0,1,2,3,4' )))");
 		lambdaQueryWrapper.orderByDesc(PjOrder::getCreateTime);
 		if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("老板")) {
 			if (AuthUtil.getUserRole().contains("业务员")) {
@@ -1015,17 +1027,6 @@ public class OrderController extends BladeController {
 	}
 
 	/**
-	 * 小程序积分兑换
-	 */
-	@PostMapping("/integralExchange")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "小程序积分兑换", notes = "传入order")
-	@RepeatSubmit
-	public R integralExchange(@Valid @RequestBody PjProductLaunch productLaunch) {
-		return orderService.integralExchange(productLaunch);
-	}
-
-	/**
 	 * 消费记录(额度支付)
 	 */
 	@GetMapping("/consumptionRecords")
@@ -1246,4 +1247,32 @@ public class OrderController extends BladeController {
 		return R.success("操作成功");
 	}
 
+	/**
+	 * 确认发货
+	 */
+	@PostMapping("/confirmShipment")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "生成出库任务", notes = "传入order")
+	@RepeatSubmit
+	public R confirmShipment(@Valid @RequestBody PjOrder order) {
+		if (order.getId() == null) {
+			throw new RuntimeException("来源信息错误");
+		}
+		return orderService.confirmShipment(order);
+	}
+
+	/**
+	 * 撤销发货
+	 */
+	@PostMapping("/cancelShipment")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "生成出库任务", notes = "传入order")
+	@RepeatSubmit
+	public R cancelShipment(@Valid @RequestBody PjOrder order) {
+		if (order.getId() == null) {
+			throw new RuntimeException("来源信息错误");
+		}
+		return orderService.cancelShipment(order);
+	}
+
 }

+ 203 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/PjIntegralDetailController.java

@@ -0,0 +1,203 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.order.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.salesPart.corps.service.ICorpsDescService;
+import org.springblade.salesPart.dto.CorpPointsTotal;
+import org.springblade.salesPart.entity.PjCorpsDesc;
+import org.springblade.salesPart.entity.PjIntegralDetail;
+import org.springblade.salesPart.order.service.IPjIntegralDetailService;
+import org.springblade.salesPart.vo.PjIntegralDetailVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 积分明细表 控制器
+ *
+ * @author BladeX
+ * @since 2023-08-08
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/integraldetailPj")
+@Api(value = "积分明细表", tags = "积分明细表接口")
+public class PjIntegralDetailController extends BladeController {
+
+	private final IPjIntegralDetailService integralDetailService;
+
+	private final ICorpsDescService corpsDescService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入integralDetail")
+	public R<PjIntegralDetail> detail(PjIntegralDetail integralDetail) {
+		PjIntegralDetail detail = integralDetailService.getOne(Condition.getQueryWrapper(integralDetail));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 积分明细表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入integralDetail")
+	public R<IPage<PjIntegralDetail>> list(PjIntegralDetail integralDetail, Query query) {
+		LambdaQueryWrapper<PjIntegralDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(PjIntegralDetail::getIsDeleted, 0)
+			.eq(PjIntegralDetail::getTenantId, AuthUtil.getTenantId())
+			.eq(PjIntegralDetail::getCorpId, integralDetail.getCorpId())
+			.apply("find_in_set(type,'" + integralDetail.getType() + "')")
+			.orderByDesc(PjIntegralDetail::getCreateTime);
+		IPage<PjIntegralDetail> pages = integralDetailService.page(Condition.getPage(query), lambdaQueryWrapper);
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 积分明细表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入integralDetail")
+	public R<IPage<PjIntegralDetailVO>> page(PjIntegralDetailVO integralDetail, Query query) {
+		IPage<PjIntegralDetailVO> pages = integralDetailService.selectIntegralDetailPage(Condition.getPage(query), integralDetail);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 积分明细表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入integralDetail")
+	public R save(@Valid @RequestBody PjIntegralDetail integralDetail) {
+		return R.status(integralDetailService.save(integralDetail));
+	}
+
+	/**
+	 * 修改 积分明细表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入integralDetail")
+	public R update(@Valid @RequestBody PjIntegralDetail integralDetail) {
+		return R.status(integralDetailService.updateById(integralDetail));
+	}
+
+	/**
+	 * 新增或修改 积分明细表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入integralDetail")
+	public R submit(@Valid @RequestBody PjIntegralDetail integralDetail) {
+		return R.status(integralDetailService.saveOrUpdate(integralDetail));
+	}
+
+
+	/**
+	 * 删除 积分明细表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(integralDetailService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+	/**
+	 * 积分兑换记录
+	 */
+	@GetMapping("/integralExchangeRecord")
+	public R<IPage<PjIntegralDetail>> integralExchangeRecord(Query query,
+															 Long corpId) {
+		if (corpId == null) {
+			if (AuthUtil.getUserRole().equals("客户")) {
+				PjCorpsDesc corpsDesc = corpsDescService.getById(corpId);
+				if (ObjectUtils.isNull(corpsDesc)) {
+					throw new RuntimeException("未查到用户信息");
+				} else {
+					corpId = corpsDesc.getId();
+				}
+			}
+		}
+		LambdaQueryWrapper<PjIntegralDetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(PjIntegralDetail::getCorpId, corpId)
+			.eq(PjIntegralDetail::getTenantId, AuthUtil.getTenantId())
+			.apply("find_in_set(type,'积分兑换')")
+			.ne(PjIntegralDetail::getIntegral, BigDecimal.ZERO);
+		IPage<PjIntegralDetail> pages = integralDetailService.page(Condition.getPage(query), lambdaQueryWrapper);
+		return R.data(pages);
+	}
+
+	/**
+	 * 客户积分
+	 */
+	@GetMapping("/integralRecord")
+	public R<IPage<CorpPointsTotal>> integralRecord(Query query, PjIntegralDetail integralDetail) {
+		IPage<CorpPointsTotal> pages = integralDetailService.integralRecord(Condition.getPage(query), integralDetail);
+		return R.data(pages);
+	}
+
+	/**
+	 * 客户积分导出
+	 */
+	@GetMapping("/corpPointsExport")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入integralDetail")
+	public void corpPointsExport(PjIntegralDetail integralDetail, HttpServletResponse response) {
+		integralDetail.setTenantId(AuthUtil.getTenantId());
+		integralDetail.setIsDeleted(0);
+		List<CorpPointsTotal> list = integralDetailService.corpPointsTotal(integralDetail);
+		ExcelUtil.export(response, "客户积分", "客户积分", list, CorpPointsTotal.class);
+	}
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/corpPointsDetail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入integralDetail")
+	public R<CorpPointsTotal> corpPointsDetail(PjIntegralDetail integralDetail) {
+		CorpPointsTotal detail = integralDetailService.corpPointsDetail(integralDetail);
+		return R.data(detail);
+	}
+
+
+}

+ 48 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/PjIntegralDetailMapper.java

@@ -0,0 +1,48 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.order.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.salesPart.dto.CorpPointsTotal;
+import org.springblade.salesPart.entity.PjIntegralDetail;
+import org.springblade.salesPart.vo.PjIntegralDetailVO;
+
+import java.util.List;
+
+/**
+ * 积分明细表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-08-08
+ */
+public interface PjIntegralDetailMapper extends BaseMapper<PjIntegralDetail> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param integralDetail
+	 * @return
+	 */
+	List<PjIntegralDetailVO> selectIntegralDetailPage(IPage page, PjIntegralDetailVO integralDetail);
+
+	List<CorpPointsTotal> integralRecord(IPage<CorpPointsTotal> page, @Param("data") PjIntegralDetail integralDetail);
+
+	List<CorpPointsTotal> corpPointsTotal(@Param("data") PjIntegralDetail integralDetail);
+}

+ 76 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/PjIntegralDetailMapper.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.salesPart.order.mapper.PjIntegralDetailMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="integralDetailResultMap" type="org.springblade.salesPart.entity.PjIntegralDetail">
+        <id column="id" property="id"/>
+        <result column="src_id" property="srcId"/>
+        <result column="create_time" property="createTime"/>
+        <result column="integral" property="integral"/>
+        <result column="corp_id" property="corpId"/>
+        <result column="remarks" property="remarks"/>
+        <result column="create_user" property="createUser"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="create_user_name" property="createUserName"/>
+        <result column="corp_name" property="corpName"/>
+        <result column="type" property="type"/>
+        <result column="src_no" property="srcNo"/>
+    </resultMap>
+
+
+    <select id="selectIntegralDetailPage" resultMap="integralDetailResultMap">
+        select * from business_integral_detail where is_deleted = 0
+    </select>
+    <select id="integralRecord" resultType="org.springblade.salesPart.dto.CorpPointsTotal">
+        SELECT
+            pcd.id AS corpId,
+            pcd.cname AS corpName,
+            pcd.points_balance AS pointsBalance,
+            sum( bidA.integral ) AS addPoints,
+            sum( bidS.integral ) AS subPoints
+        FROM
+            pjpf_corps_desc pcd
+                LEFT JOIN business_integral_detail bidA ON pcd.id = bidA.corp_id
+                AND FIND_IN_SET( bidA.type, '购买获取,撤销兑换' )
+                LEFT JOIN business_integral_detail bidS ON pcd.id = bidS.corp_id
+                AND FIND_IN_SET( bidS.type, '积分退回,积分兑换' )
+        WHERE
+            pcd.is_deleted = '0'
+          AND pcd.tenant_id = #{data.tenantId}
+          AND bidA.is_deleted = '0'
+          AND bidA.tenant_id = #{data.tenantId}
+          AND bidS.is_deleted = '0'
+          AND bidS.tenant_id = #{data.tenantId}
+        <if test="data.corpName !=null and data.corpName != ''">
+            and pcd.cname = #{data.corpName}
+        </if>
+        ORDER BY pcd.points_balance
+    </select>
+    <select id="corpPointsTotal" resultType="org.springblade.salesPart.dto.CorpPointsTotal">
+        SELECT
+        pcd.id AS corpId,
+        pcd.cname AS corpName,
+        pcd.points_balance AS pointsBalance,
+        sum( bidA.integral ) AS addPoints,
+        sum( bidS.integral ) AS subPoints
+        FROM
+        pjpf_corps_desc pcd
+        LEFT JOIN business_integral_detail bidA ON pcd.id = bidA.corp_id
+        AND FIND_IN_SET( bidA.type, '购买获取,撤销兑换' )
+        LEFT JOIN business_integral_detail bidS ON pcd.id = bidS.corp_id
+        AND FIND_IN_SET( bidS.type, '积分退回,积分兑换' )
+        WHERE
+        pcd.is_deleted = '0'
+        AND pcd.tenant_id = #{data.tenantId}
+        AND bidA.is_deleted = '0'
+        AND bidA.tenant_id = #{data.tenantId}
+        AND bidS.is_deleted = '0'
+        AND bidS.tenant_id = #{data.tenantId}
+        <if test="data.corpName !=null and data.corpName != ''">
+            and pcd.cname = #{data.corpName}
+        </if>
+        ORDER BY pcd.points_balance
+    </select>
+
+</mapper>

+ 4 - 8
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/IOrderService.java

@@ -172,14 +172,6 @@ public interface IOrderService extends IService<PjOrder> {
 	void appUpdate(PjOrder order);
 
 	/**
-	 * 小程序积分兑换
-	 *
-	 * @param order
-	 * @return
-	 */
-	R integralExchange(PjProductLaunch productLaunch);
-
-	/**
 	 * 一键采购入库
 	 *
 	 * @param order
@@ -268,4 +260,8 @@ public interface IOrderService extends IService<PjOrder> {
 	List<PjOrder> getTotalMonth(String tenantId, String year, String month);
 
     List<PjOrder> selectPjOrderList(String tenantId, String type);
+
+	R confirmShipment(PjOrder order);
+
+	R cancelShipment(PjOrder order);
 }

+ 50 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/IPjIntegralDetailService.java

@@ -0,0 +1,50 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.order.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.salesPart.dto.CorpPointsTotal;
+import org.springblade.salesPart.entity.PjIntegralDetail;
+import org.springblade.salesPart.vo.PjIntegralDetailVO;
+
+import java.util.List;
+
+/**
+ * 积分明细表 服务类
+ *
+ * @author BladeX
+ * @since 2023-08-08
+ */
+public interface IPjIntegralDetailService extends IService<PjIntegralDetail> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param integralDetail
+	 * @return
+	 */
+	IPage<PjIntegralDetailVO> selectIntegralDetailPage(IPage<PjIntegralDetailVO> page, PjIntegralDetailVO integralDetail);
+
+	IPage<CorpPointsTotal> integralRecord(IPage<CorpPointsTotal> page, PjIntegralDetail integralDetail);
+
+	List<CorpPointsTotal> corpPointsTotal(PjIntegralDetail integralDetail);
+
+	CorpPointsTotal corpPointsDetail(PjIntegralDetail integralDetail);
+}

+ 136 - 156
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java

@@ -80,6 +80,7 @@ import org.springblade.salesPart.order.mapper.OrderMapper;
 import org.springblade.salesPart.order.service.IOrderItemsService;
 import org.springblade.salesPart.order.service.IOrderRecordService;
 import org.springblade.salesPart.order.service.IOrderService;
+import org.springblade.salesPart.order.service.IPjIntegralDetailService;
 import org.springblade.salesPart.payMethod.PayService;
 import org.springblade.salesPart.productLaunch.service.IProductLaunchService;
 import org.springblade.salesPart.serial.service.IPjpfSerialService;
@@ -144,7 +145,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 	private final ShipMapper shipMapper;
 	private final IShipItemsService shipItemsService;
 	private final CorpsDescMapper corpsDescMapper;
-	private final CorpsAttnMapper corpsAttnMapper;//客户联系人
 	private final StorageDescMapper storageDescMapper;
 	private final GoodsTypeMapper goodsTypeMapper;
 	private final IStockDescService stockDescService;
@@ -156,7 +156,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 	private final ISettlementItemsService settlementItemsService;
 	private final SettlementMapper settlementMapper;
 	private final IPaymentClient paymentClient;
-	private final IIntegralDetailClient iIntegralDetailClient;
+	private final IPjIntegralDetailService integralDetailService;
 	//消息
 	private final IMessageClient messageClient;
 	/**
@@ -719,7 +719,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		if (order.getId() == null || ObjectUtils.isNotNull(order.getCustomerId())) {
 			throw new RuntimeException("缺少必要参数");
 		}
-		PjCorpsDesc corpsDesc = corpsDescMapper.selectById(order.getCustomerId());
+		/*PjCorpsDesc corpsDesc = corpsDescMapper.selectById(order.getCustomerId());
 		if (corpsDesc == null) {
 			throw new RuntimeException("未查到客户信息");
 		}
@@ -760,7 +760,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 					corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().add(goodsDesc.getIntegral().multiply(item.getGoodsNum())));
 				}
 			}
-			IntegralDetail integralDetail = new IntegralDetail();
+			PjIntegralDetail integralDetail = new PjIntegralDetail();
 			integralDetail.setCreateTime(new Date());
 			integralDetail.setCreateUserName(AuthUtil.getUserName());
 			integralDetail.setCreateUser(AuthUtil.getUserId());
@@ -778,7 +778,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			if (goodsId.length() > 0) {
 				integralDetail.setGoodsId(goodsId.substring(0, goodsId.length() - 1));
 			}
-			iIntegralDetailClient.submit(integralDetail);
+			integralDetailService.saveOrUpdate(integralDetail);
 		}
 		if (reference != null) {
 			corpsDescMapper.updateById(reference);
@@ -786,158 +786,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		if (user != null) {
 			userClient.updateUser(user);
 		}
-		corpsDescMapper.updateById(corpsDesc);
+		corpsDescMapper.updateById(corpsDesc);*/
 		baseMapper.updateById(order);
 	}
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-
-	public R integralExchange(PjProductLaunch productLaunch) {
-		PjOrder order = new PjOrder();
-		order.setBsType("XS");
-		PjCorpsDesc corpsDesc = null;
-		//根据当前登录人获得客户
-		PjCorpsAttn corpsAttn = corpsAttnMapper.selectOne(new LambdaQueryWrapper<PjCorpsAttn>()
-			.eq(PjCorpsAttn::getIsDeleted, 0)
-			.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
-			.eq(PjCorpsAttn::getUserId, AuthUtil.getUserId()));
-		if (ObjectUtil.isNotEmpty(corpsAttn)) {
-			corpsDesc = corpsDescMapper.selectById(corpsAttn.getPid());
-			if (ObjectUtil.isEmpty(corpsDesc)) {
-				throw new RuntimeException("未查到用户信息");
-			}
-		} else {
-			throw new RuntimeException("未查到用户信息");
-		}
-		//客户名称
-		order.setCustomerName(corpsDesc.getCname());
-
-		// 获取系统编号
-		String billNo = serialService.getBillNo(order.getBsType(), order.getBsType(), order.getBsType());
-		if (ObjectUtils.isNull(billNo)) {
-			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-			return R.fail(500, "生成系统编号失败");
-		}
-		if (order.getId() == null) {
-			if (ObjectUtils.isNull(order.getBillType())) {
-				if (ObjectUtils.isNotNull(order.getStorageId())) {
-					order.setBillType(0);
-					//仓库名称
-					order.setStorageName(storageDescMapper.selectById(order.getStorageId()).getCname());
-				} else {
-					order.setBillType(1);
-				}
-			}
-			order.setWhetherIntegral("1");
-			order.setBusinessSource("外部销售");
-			order.setOrdNo(billNo);
-			order.setSrcOrdNo(billNo);
-			order.setCreateTime(new Date());
-			order.setCreateUser(AuthUtil.getUserId());
-			order.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
-			order.setTenantId(AuthUtil.getTenantId());
-			order.setStatus(OrderTypeEnum.XSLR.getType());
-			order.setBusinessSource(OrderTypeEnum.WEB.getType());
-			order.setActualPaymentStatus(2);
-			baseMapper.insert(order);
-		} else {
-			order.setUpdateUser(AuthUtil.getUserId());
-			order.setUpdateTime(new Date());
-			baseMapper.updateById(order);
-		}
-		// 保存订单明细
-		//所属公司
-		R<Dept> dept = sysClient.getDept(Long.valueOf(AuthUtil.getDeptId()));
-		if (ObjectUtil.isNotEmpty(dept)) {
-			order.setSalesCompanyId(dept.getData().getId());
-			order.setSalesCompanyName(dept.getData().getFullName());
-			if (ObjectUtils.isNotNull(order.getBillType()) && 1 != order.getBillType()) {
-				order.setSharedCompanyId(dept.getData().getId());
-				order.setSharedCompanyName(dept.getData().getFullName());
-			} else {
-				order.setSharedCompanyId(order.getSharedCompanyId());
-				order.setSharedCompanyName(order.getSharedCompanyName());
-			}
-		} else {
-			throw new SecurityException("未维护所属公司");
-		}
-		if (productLaunch != null) {
-			PjOrderItems item = new PjOrderItems();
-			item.setBizType(order.getBsType());
-			item.setBillNo(order.getOrdNo());
-
-			//商品名称
-			PjGoodsDesc goodsDesc = goodsDescMapper.selectById(productLaunch.getGoodsId());
-			item.setGoodsId(productLaunch.getGoodsId());
-			item.setGoodsName(goodsDesc.getCname());
-			item.setGoodsNo(goodsDesc.getCode());
-			item.setPropertyName(goodsDesc.getSpecificationAndModel());
-			item.setPattern(goodsDesc.getBrandItem());
-			item.setGoodsDescription(goodsDesc.getGoodsDescription());
-			item.setUnits(goodsDesc.getUnit());
-			item.setBrandId(goodsDesc.getBrandId());
-			item.setBrandName(goodsDesc.getBrandName());
-
-			item.setGoodsNum(productLaunch.getGoodsNum());
-			item.setSalesCompanyId(productLaunch.getSalesCompanyId());
-			item.setSalesCompanyName(productLaunch.getSalesCompanyName());
-			item.setPrice(productLaunch.getMallPrice());
-			item.setProductLaunchId(productLaunch.getId());
-			item.setInventory(productLaunch.getInventory());
-			item.setTenantId(AuthUtil.getTenantId());
-			//计算小计
-			item.setSubTotalMoney(item.getGoodsNum().multiply(item.getPrice()).setScale(2, RoundingMode.HALF_UP));
-			if (item.getId() == null) {
-				item.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
-				item.setCreateTime(new Date());
-				item.setCreateUser(AuthUtil.getUserId());
-				item.setPid(order.getId());
-				item.setTenantId(AuthUtil.getTenantId());
-			} else {
-				item.setUpdateTime(new Date());
-				item.setUpdateUser(AuthUtil.getUserId());
-				item.setPid(order.getId());
-			}
-			orderItemsService.saveOrUpdate(item);
-			order.setGoodsNameJoin(goodsDesc.getCname());
-			order.setShortcutJoin(goodsDesc.getIntegral() + "");
-			BigDecimal totalMoney = item.getSubTotalMoney();
-			order.setNumberRows(1);//行数
-			//总数量
-			order.setGoodsTotalNum(productLaunch.getGoodsNum());
-			//总已发数量
-			order.setGoodsTotalShipNum(new BigDecimal("0"));
-			if (totalMoney.compareTo(corpsDesc.getPointsBalance()) > 0) {
-				throw new RuntimeException("积分余额不足,兑换失败");
-			} else {
-				corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().subtract(totalMoney));
-			}
-			order.setSalesAmount(totalMoney);
-			order.setTotalMoney(totalMoney);
-			IntegralDetail integralDetail = new IntegralDetail();
-			integralDetail.setCreateTime(new Date());
-			integralDetail.setCreateUserName(AuthUtil.getUserName());
-			integralDetail.setCreateUser(AuthUtil.getUserId());
-			integralDetail.setType("积分兑换");
-			integralDetail.setSrcId(order.getId());
-			integralDetail.setSrcNo(order.getOrdNo());
-			integralDetail.setCorpId(corpsDesc.getId());
-			integralDetail.setCorpName(corpsDesc.getCname());
-			integralDetail.setIntegral(order.getTotalMoney());
-			integralDetail.setGoodsName(order.getGoodsNameJoin());
-			integralDetail.setGoodsId(goodsDesc.getId() + "");
-			iIntegralDetailClient.submit(integralDetail);
-			corpsDescMapper.updateById(corpsDesc);
-			baseMapper.updateById(order);
-		} else {
-			throw new RuntimeException("缺少必要参数");
-		}
-		return R.data(order);
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
 	public R shortcutWarehousing(PjOrder order) {
 		PjOrder pjOrder = baseMapper.selectById(order.getId());
 		pjOrder.setVersion(pjOrder.getVersion() + 1);
@@ -3867,6 +3721,132 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		return baseMapper.selectPjOrderList(tenantId, type);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R confirmShipment(PjOrder order) {
+		if (!OrderTypeEnum.XCX.getType().equals(order.getBusinessSource())) {
+			PjCorpsDesc corpsDesc = corpsDescMapper.selectById(order.getCustomerId());
+			if (corpsDesc == null) {
+				throw new RuntimeException("未查到客户信息");
+			}
+			if (order.getTotalMoney().compareTo(corpsDesc.getPointsBalance()) > 0) {
+				throw new RuntimeException("积分余额不足");
+			} else {
+				corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().subtract(order.getTotalMoney()));
+				corpsDescMapper.updateById(corpsDesc);
+				PjIntegralDetail integralDetail = new PjIntegralDetail();
+				integralDetail.setSrcId(order.getId());
+				integralDetail.setSrcNo(order.getOrdNo());
+				integralDetail.setCreateTime(new Date());
+				integralDetail.setIntegral(order.getTotalMoney());
+				integralDetail.setCorpId(order.getCustomerId());
+				integralDetail.setCorpName(order.getCustomerName());
+				integralDetail.setType("积分兑换");
+				integralDetail.setTenantId(order.getTenantId());
+				integralDetail.setGoodsName(order.getGoodsNameJoin());
+				integralDetailService.saveOrUpdate(integralDetail);
+			}
+			if (CollectionUtils.isNotEmpty(order.getOrderItemsList())) {
+				List<Long> goodsId = order.getOrderItemsList().stream().map(PjOrderItems::getGoodsId).distinct().collect(Collectors.toList());
+				List<PjOrderItems> itemsList = new ArrayList<>();
+				List<PjProductLaunch> pjProductLaunchs = new ArrayList<>();
+				LambdaQueryWrapper<PjProductLaunch> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+				lambdaQueryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+					.eq(PjProductLaunch::getIsDeleted, 0)
+					.eq(PjProductLaunch::getWhetherIntegral, 1)
+					.in(PjProductLaunch::getGoodsId, goodsId);
+				List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(lambdaQueryWrapper);
+				if (pjProductLaunchList.isEmpty()) {
+					throw new RuntimeException("未查到商品对应上架库存");
+				}
+				for (PjOrderItems item : order.getOrderItemsList()) {
+					PjProductLaunch productLaunch = pjProductLaunchList.stream().filter(e -> e.getGoodsId().equals(item.getGoodsId()))
+						.findFirst().orElse(null);
+					if (productLaunch != null) {
+						if (productLaunch.getInventory().compareTo(item.getGoodsNum()) < 0) {
+							throw new RuntimeException("商品:" + item.getGoodsName() + "上架库存不足");
+						} else {
+							item.setSendNum(item.getGoodsNum());
+							productLaunch.setInventory(productLaunch.getInventory().subtract(item.getGoodsNum()));
+							itemsList.add(item);
+							pjProductLaunchs.add(productLaunch);
+						}
+					} else {
+						throw new RuntimeException("未查到商品:" + item.getGoodsName() + "上架库存");
+					}
+				}
+				orderItemsService.saveOrUpdateBatch(itemsList);
+				productLaunchService.saveOrUpdateBatch(pjProductLaunchs);
+			} else {
+				throw new RuntimeException("明细不能为空");
+			}
+		}
+		order.setStatus("已发货");
+		order.setUpdateTime(new Date());
+		order.setUpdateUserName(AuthUtil.getUserName());
+		order.setUpdateUser(AuthUtil.getUserId());
+		baseMapper.updateById(order);
+		return R.data(order);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R cancelShipment(PjOrder order) {
+		PjCorpsDesc corpsDesc = corpsDescMapper.selectById(order.getCustomerId());
+		if (corpsDesc == null) {
+			throw new RuntimeException("未查到客户信息");
+		}
+		corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().add(order.getTotalMoney()));
+		corpsDescMapper.updateById(corpsDesc);
+		PjIntegralDetail integralDetail = new PjIntegralDetail();
+		integralDetail.setSrcId(order.getId());
+		integralDetail.setSrcNo(order.getOrdNo());
+		integralDetail.setCreateTime(new Date());
+		integralDetail.setIntegral(order.getTotalMoney());
+		integralDetail.setCorpId(order.getCustomerId());
+		integralDetail.setCorpName(order.getCustomerName());
+		integralDetail.setType("撤销兑换");
+		integralDetail.setTenantId(order.getTenantId());
+		integralDetail.setGoodsName(order.getGoodsNameJoin());
+		integralDetailService.saveOrUpdate(integralDetail);
+		if (CollectionUtils.isNotEmpty(order.getOrderItemsList())) {
+			List<Long> goodsId = order.getOrderItemsList().stream().map(PjOrderItems::getGoodsId).distinct().collect(Collectors.toList());
+			List<PjOrderItems> itemsList = new ArrayList<>();
+			List<PjProductLaunch> pjProductLaunchs = new ArrayList<>();
+			LambdaQueryWrapper<PjProductLaunch> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+			lambdaQueryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+				.eq(PjProductLaunch::getIsDeleted, 0)
+				.eq(PjProductLaunch::getWhetherIntegral, 1)
+				.in(PjProductLaunch::getGoodsId, goodsId);
+			List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(lambdaQueryWrapper);
+			if (pjProductLaunchList.isEmpty()) {
+				throw new RuntimeException("未查到商品对应上架库存");
+			}
+			for (PjOrderItems item : order.getOrderItemsList()) {
+				PjProductLaunch productLaunch = pjProductLaunchList.stream().filter(e -> e.getGoodsId().equals(item.getGoodsId()))
+					.findFirst().orElse(null);
+				if (productLaunch != null) {
+					item.setSendNum(new BigDecimal("0"));
+					productLaunch.setInventory(productLaunch.getInventory().add(item.getGoodsNum()));
+					itemsList.add(item);
+					pjProductLaunchs.add(productLaunch);
+				} else {
+					throw new RuntimeException("未查到商品:" + item.getGoodsName() + "上架库存");
+				}
+			}
+			orderItemsService.saveOrUpdateBatch(itemsList);
+			productLaunchService.saveOrUpdateBatch(pjProductLaunchs);
+		} else {
+			throw new RuntimeException("明细不能为空");
+		}
+		order.setStatus("已取消");
+		order.setUpdateTime(new Date());
+		order.setUpdateUserName(AuthUtil.getUserName());
+		order.setUpdateUser(AuthUtil.getUserId());
+		baseMapper.updateById(order);
+		return R.data(order);
+	}
+
 	/**
 	 * 保存订单信息
 	 */
@@ -4437,7 +4417,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 			}
 			order.setActualPaymentStatus(3);
 			order.setPaymentAmountTl(order.getTotalMoney());
-		}else if (order.getBsType().equals(OrderTypeEnum.POINTS.getType())) {//积分
+		} else if (order.getBsType().equals(OrderTypeEnum.POINTS.getType())) {//积分
 			if (order.getId() == null) {
 				if (ObjectUtils.isNull(order.getBillType())) {
 					if (ObjectUtils.isNotNull(order.getStorageId())) {
@@ -5557,11 +5537,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 						throw new RuntimeException("退款失败!服务器错误");
 					}
 					order.setActualPaymentStatus(4);
-					IntegralDetail integralDetail = new IntegralDetail();
+					PjIntegralDetail integralDetail = new PjIntegralDetail();
 					integralDetail.setCreateTime(new Date());
 					integralDetail.setCreateUserName(AuthUtil.getUserName());
 					integralDetail.setCreateUser(AuthUtil.getUserId());
-					integralDetail.setType("退款退货");
+					integralDetail.setType("积分退回");
 					integralDetail.setSrcId(order.getId());
 					integralDetail.setSrcNo(order.getOrdNo());
 					integralDetail.setCorpId(order.getCustomerId());
@@ -5575,7 +5555,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 					if (goodsId.length() > 0) {
 						integralDetail.setGoodsId(goodsId.substring(0, goodsId.length() - 1));
 					}
-					iIntegralDetailClient.submit(integralDetail);
+					integralDetailService.saveOrUpdate(integralDetail);
 				}
 			}
 		} else {

+ 94 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/PjIntegralDetailServiceImpl.java

@@ -0,0 +1,94 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.order.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.AllArgsConstructor;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.salesPart.corps.mapper.CorpsDescMapper;
+import org.springblade.salesPart.dto.CorpPointsTotal;
+import org.springblade.salesPart.entity.PjCorpsDesc;
+import org.springblade.salesPart.entity.PjIntegralDetail;
+import org.springblade.salesPart.order.mapper.PjIntegralDetailMapper;
+import org.springblade.salesPart.order.service.IPjIntegralDetailService;
+import org.springblade.salesPart.vo.PjIntegralDetailVO;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 积分明细表 服务实现类
+ *
+ * @author BladeX
+ * @since 2023-08-08
+ */
+@Service
+@AllArgsConstructor
+public class PjIntegralDetailServiceImpl extends ServiceImpl<PjIntegralDetailMapper, PjIntegralDetail> implements IPjIntegralDetailService {
+
+	private final CorpsDescMapper corpsDescMapper;
+
+	@Override
+	public IPage<PjIntegralDetailVO> selectIntegralDetailPage(IPage<PjIntegralDetailVO> page, PjIntegralDetailVO integralDetail) {
+		return page.setRecords(baseMapper.selectIntegralDetailPage(page, integralDetail));
+	}
+
+	@Override
+	public IPage<CorpPointsTotal> integralRecord(IPage<CorpPointsTotal> page, PjIntegralDetail integralDetail) {
+		integralDetail.setTenantId(AuthUtil.getTenantId());
+		return page.setRecords(baseMapper.integralRecord(page, integralDetail));
+	}
+
+	@Override
+	public List<CorpPointsTotal> corpPointsTotal(PjIntegralDetail integralDetail) {
+		integralDetail.setTenantId(AuthUtil.getTenantId());
+		return baseMapper.corpPointsTotal(integralDetail);
+	}
+
+	@Override
+	public CorpPointsTotal corpPointsDetail(PjIntegralDetail integralDetail) {
+		CorpPointsTotal detail = new CorpPointsTotal();
+		PjCorpsDesc pjCorpsDesc = corpsDescMapper.selectById(integralDetail.getCorpId());
+		if (pjCorpsDesc == null) {
+			throw new RuntimeException("未查到客户信息");
+		}
+		detail.setCorpId(pjCorpsDesc.getId());
+		detail.setCorpName(pjCorpsDesc.getCname());
+		detail.setPointsBalance(pjCorpsDesc.getPointsBalance());
+		LambdaQueryWrapper<PjIntegralDetail> lambdaQueryWrapperA = new LambdaQueryWrapper<>();
+		lambdaQueryWrapperA.eq(PjIntegralDetail::getIsDeleted, 0)
+			.eq(PjIntegralDetail::getTenantId, AuthUtil.getTenantId())
+			.eq(PjIntegralDetail::getCorpId, integralDetail.getCorpId())
+			.apply("find_in_set(type,'购买获取,撤销兑换')")
+			.orderByDesc(PjIntegralDetail::getCreateTime);
+		List<PjIntegralDetail> integralDetailListA = baseMapper.selectList(lambdaQueryWrapperA);
+		detail.setIntegralDetailListA(integralDetailListA.isEmpty() ? new ArrayList<>() : integralDetailListA);
+		LambdaQueryWrapper<PjIntegralDetail> lambdaQueryWrapperS = new LambdaQueryWrapper<>();
+		lambdaQueryWrapperS.eq(PjIntegralDetail::getIsDeleted, 0)
+			.eq(PjIntegralDetail::getTenantId, AuthUtil.getTenantId())
+			.eq(PjIntegralDetail::getCorpId, integralDetail.getCorpId())
+			.apply("find_in_set(type,'积分退回,积分兑换')")
+			.orderByDesc(PjIntegralDetail::getCreateTime);
+		List<PjIntegralDetail> integralDetailListS = baseMapper.selectList(lambdaQueryWrapperS);
+		detail.setIntegralDetailListS(integralDetailListS.isEmpty() ? new ArrayList<>() : integralDetailListS);
+		return detail;
+	}
+
+}

+ 2 - 1
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/controller/ProductLaunchController.java

@@ -612,7 +612,7 @@ public class ProductLaunchController extends BladeController {
 		}
 		List<PjStockDesc> stockDescList = new ArrayList<>();
 		if ("1".equals(productLaunch.getWhetherIntegral())) {
-			lambdaQueryWrapper.eq(PjProductLaunch::getWhetherIntegral, productLaunch.getWhetherIntegral());
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(productLaunch.getWhetherIntegral()),PjProductLaunch::getWhetherIntegral, productLaunch.getWhetherIntegral());
 		} else {
 			String status = iSysClient.getParamService("whether.branch.management");
 			if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
@@ -627,6 +627,7 @@ public class ProductLaunchController extends BladeController {
 					}
 				}
 			}
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(productLaunch.getWhetherIntegral()),PjProductLaunch::getWhetherIntegral, productLaunch.getWhetherIntegral());
 		}
 		String status = iSysClient.getParamService("whether.zero.inventory");
 		if (ObjectUtils.isNull(status) || "0".equals(status)) {

+ 1 - 1
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/service/impl/ProductLaunchServiceImpl.java

@@ -724,7 +724,7 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
 		shoppingCart.setProductLaunchId(productLaunch.getId());
 		shoppingCart.setInventory(productLaunch.getInventory());
 		shoppingCart.setTenantId(AuthUtil.getTenantId());
-
+		shoppingCart.setWhetherIntegral(productLaunch.getWhetherIntegral());
 		if (productLaunch.getBillType() == 0) {
 			shoppingCart.setSharedCompanyId(productLaunch.getSalesCompanyId());
 			shoppingCart.setSharedCompanyName(productLaunch.getSalesCompanyName());

+ 35 - 4
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/settlement/service/impl/SettlementServiceImpl.java

@@ -21,15 +21,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
-import org.springblade.client.feign.ISerialClient;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.salesPart.accountManagement.service.IAccountManagementService;
 import org.springblade.salesPart.corps.service.ICorpsDescService;
 import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.enums.OrderTypeEnum;
+import org.springblade.salesPart.feign.IPJCorpClient;
 import org.springblade.salesPart.files.service.PjpfFilesService;
 import org.springblade.salesPart.order.service.IOrderService;
 import org.springblade.salesPart.serial.service.IPjpfSerialService;
@@ -73,6 +72,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 	 */
 	private final IPjpfSerialService serialService;
 
+	private final IPJCorpClient corpClient;
+
 	@Override
 	public IPage<SettlementVO> selectSettlementPage(IPage<SettlementVO> page, SettlementVO settlement) {
 		return page.setRecords(baseMapper.selectSettlementPage(page, settlement));
@@ -170,6 +171,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 			}
 			List<PjCorpsDesc> pjCorpsDescs = new ArrayList<>();
 			List<PjOrder> orderArrayList = new ArrayList<>();
+			List<PjOrder> orderIntegralList = new ArrayList<>();
+			List<PjOrder> orderRevokeIntegralList = new ArrayList<>();
 			BigDecimal thisAmount = new BigDecimal("0.00");
 			for (PjSettlementItems item : settlement.getSettlementItemsList()) {
 				item.setUpdateTime(new Date());
@@ -200,6 +203,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 					}
 					pjCorpsDescs.add(pjCorpsDesc);
 					pjOrder.setActualPaymentStatus(2);
+					orderIntegralList.add(pjOrder);
 				} else {
 					if ("XS".equals(item.getBusinesType()) || "CG".equals(item.getBusinesType())) {
 						if (ObjectUtils.isNotNull(pjOrder.getPaymentAmountTl())) {
@@ -216,6 +220,9 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 						thisAmount = thisAmount.add(item.getThisAmount());
 						if (pjOrder.getPaymentAmountTl().equals(pjOrder.getTotalMoney())) {
 							pjOrder.setActualPaymentStatus(2);
+							if ("XS".equals(item.getBusinesType())) {
+								orderIntegralList.add(pjOrder);
+							}
 						} else {
 							pjOrder.setActualPaymentStatus(3);
 						}
@@ -234,10 +241,13 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 						thisAmount = thisAmount.subtract(item.getThisRefundAmount());
 						if (pjOrder.getPaymentAmountTl().equals(pjOrder.getReturnsAmount())) {
 							pjOrder.setActualPaymentStatus(2);
+							if ("TKXS".equals(item.getBusinesType())) {
+								orderRevokeIntegralList.add(pjOrder);
+							}
 						} else {
 							pjOrder.setActualPaymentStatus(3);
 						}
-					}else{
+					} else {
 						throw new RuntimeException("数据错误,请删除明细重新添加");
 					}
 				}
@@ -268,6 +278,12 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 				}
 				accountManagementService.updateById(pjAccountManagement);
 			}
+			if (!orderIntegralList.isEmpty()) {
+				corpClient.updateIntegral(orderIntegralList);
+			}
+			if (!orderRevokeIntegralList.isEmpty()) {
+				corpClient.updateRevokeIntegral(orderIntegralList);
+			}
 		}
 		if ("d".equals(settlement.getDc())) {
 			settlement.setFinanceStatus(OrderTypeEnum.PAIDD.getType());
@@ -301,6 +317,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 			}
 			List<PjCorpsDesc> pjCorpsDescs = new ArrayList<>();
 			List<PjOrder> orderArrayList = new ArrayList<>();
+			List<PjOrder> orderIntegralList = new ArrayList<>();
+			List<PjOrder> orderRevokeIntegralList = new ArrayList<>();
 			BigDecimal thisAmount = new BigDecimal("0.00");
 			for (PjSettlementItems item : settlement.getSettlementItemsList()) {
 				item.setUpdateTime(new Date());
@@ -322,6 +340,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 					}
 					pjCorpsDescs.add(pjCorpsDesc);
 					pjOrder.setActualPaymentStatus(1);
+					orderRevokeIntegralList.add(pjOrder);
 				} else {
 					if ("XS".equals(item.getBusinesType()) || "CG".equals(item.getBusinesType())) {
 						if (ObjectUtils.isNotNull(pjOrder.getPaymentAmountTl())) {
@@ -335,6 +354,9 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 						} else {
 							pjOrder.setActualPaymentStatus(3);
 						}
+						if ("XS".equals(item.getBusinesType())) {
+							orderRevokeIntegralList.add(pjOrder);
+						}
 					} else if ("TKXS".equals(item.getBusinesType()) || "TKCG".equals(item.getBusinesType())) {
 						if (ObjectUtils.isNotNull(pjOrder.getPaymentAmountTl())) {
 							pjOrder.setPaymentAmountTl(pjOrder.getPaymentAmountTl().subtract(item.getThisRefundAmount()));
@@ -347,7 +369,10 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 						} else {
 							pjOrder.setActualPaymentStatus(3);
 						}
-					}else{
+						if ("TKXS".equals(item.getBusinesType())) {
+							orderIntegralList.add(pjOrder);
+						}
+					} else {
 						throw new RuntimeException("数据错误,请删除明细重新添加");
 					}
 				}
@@ -374,6 +399,12 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, PjSettl
 				}
 				accountManagementService.updateById(pjAccountManagement);
 			}
+			if (!orderRevokeIntegralList.isEmpty()) {
+				corpClient.updateRevokeIntegral(orderRevokeIntegralList);
+			}
+			if (!orderIntegralList.isEmpty()) {
+				corpClient.updateIntegral(orderIntegralList);
+			}
 		}
 		if ("d".equals(settlement.getDc())) {
 			settlement.setFinanceStatus(OrderTypeEnum.WAITPAYMENTD.getType());

+ 22 - 24
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java

@@ -1399,10 +1399,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 						if (!pjOrderItems.isEmpty()) {
 							//本次发货数量
 							BigDecimal thisSendSum = pjOrderItems.stream().map(PjOrderItems::getThisOutGoodsTotalShipNum)
-								.reduce(BigDecimal.ZERO, BigDecimal::add);
+								.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 							//本次发货金额
 							BigDecimal thisSendAmount = pjOrderItems.stream().map(PjOrderItems::getThisOutGoodsTotalShipAmount)
-								.reduce(BigDecimal.ZERO, BigDecimal::add);
+								.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 							items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().add(thisSendSum));
 							items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().add(thisSendAmount));
 							if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
@@ -2005,9 +2005,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 						.collect(Collectors.toList());
 					if (!pjOrderItems.isEmpty()) {
 						BigDecimal thisSendSum = pjOrderItems.stream().map(PjOrderItems::getThisOutGoodsTotalShipNum)
-							.reduce(BigDecimal.ZERO, BigDecimal::add);
+							.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 						BigDecimal thisSendAmount = pjOrderItems.stream().map(PjOrderItems::getThisOutGoodsTotalShipAmount)
-							.reduce(BigDecimal.ZERO, BigDecimal::add);
+							.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 						items.setOutGoodsTotalShipNum(items.getOutGoodsTotalShipNum().subtract(thisSendSum));
 						items.setOutGoodsTotalShipAmount(items.getOutGoodsTotalShipAmount().subtract(thisSendAmount));
 						if (ObjectUtils.isNotNull(items.getSalesAmount()) && new BigDecimal("0.00").compareTo(items.getSalesAmount()) != 0) {
@@ -3626,6 +3626,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			throw new RuntimeException("调入或调出仓库属性不一致,请修改");
 		}
 		if (CollectionUtils.isNotEmpty(order.getShipItemsList())) {
+			String status = sysClient.getParamService("whether.financing");
 			List<PjStockDesc> pjStockDescArrayList = new ArrayList<>();
 			List<PjStockDesc> pjStockDescList = new ArrayList<>();
 			for (PjShipItems orderItems : order.getShipItemsList()) {
@@ -3657,16 +3658,15 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 						throw new RuntimeException("库存不足,保存失败");
 					}
 					stockOneC.setBalanceQuantity(stockOneC.getBalanceQuantity().subtract(orderItems.getGoodsNum()));
-					if ("1".equals(storageDescC.getWhetherFinancing())) {
-						if (orderItems.getGoodsNum().compareTo(stockOneC.getBalanceQuantityFinancing()) > 0) {
+					if ("1".equals(status)){
+						if (orderItems.getSendNumFinancing().compareTo(stockOneC.getBalanceQuantityFinancing()) > 0) {
 							throw new RuntimeException("融资库存不足,保存失败");
 						}
-						stockOneC.setBalanceQuantityFinancing(stockOneC.getBalanceQuantityFinancing().subtract(orderItems.getGoodsNum()));
-					} else {
-						if (orderItems.getGoodsNum().compareTo(stockOneC.getBalanceQuantityHave()) > 0) {
+						stockOneC.setBalanceQuantityFinancing(stockOneC.getBalanceQuantityFinancing().subtract(orderItems.getSendNumFinancing()));
+						if (orderItems.getSendNumHave().compareTo(stockOneC.getBalanceQuantityHave()) > 0) {
 							throw new RuntimeException("自有库存不足,保存失败");
 						}
-						stockOneC.setBalanceQuantityHave(stockOneC.getBalanceQuantityHave().subtract(orderItems.getGoodsNum()));
+						stockOneC.setBalanceQuantityHave(stockOneC.getBalanceQuantityHave().subtract(orderItems.getSendNumHave()));
 					}
 					stockOneC.setStoreInventory(stockOneC.getBalanceQuantity());
 					stockOneC.setInventoryAmount(stockOneC.getInventoryAmount().subtract(orderItems.getGoodsNum()
@@ -3693,10 +3693,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				PjStockDesc stockOneR = iStockDescService.getOne(lambdaQueryWrapperR);
 				if (ObjectUtil.isNotEmpty(stockOneR)) {
 					stockOneR.setBalanceQuantity(stockOneR.getBalanceQuantity().add(orderItems.getGoodsNum()));
-					if ("1".equals(storageDescR.getWhetherFinancing())) {
-						stockOneR.setBalanceQuantityFinancing(stockOneR.getBalanceQuantityFinancing().add(orderItems.getGoodsNum()));
-					} else {
-						stockOneR.setBalanceQuantityHave(stockOneR.getBalanceQuantityHave().add(orderItems.getGoodsNum()));
+					if ("1".equals(status)) {
+						stockOneR.setBalanceQuantityFinancing(stockOneR.getBalanceQuantityFinancing().add(orderItems.getSendNumFinancing()));
+						stockOneR.setBalanceQuantityHave(stockOneR.getBalanceQuantityHave().add(orderItems.getSendNumHave()));
 					}
 					stockOneR.setStoreInventory(stockOneR.getBalanceQuantity());
 					stockOneR.setInventoryAmount(stockOneR.getInventoryAmount().add(orderItems.getGoodsNum()
@@ -3761,6 +3760,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			throw new RuntimeException("未找到调入仓库信息");
 		}
 		if (CollectionUtils.isNotEmpty(order.getShipItemsList())) {
+			String status = sysClient.getParamService("whether.financing");
 			List<PjStockDesc> pjStockDescArrayList = new ArrayList<>();
 			for (PjShipItems orderItems : order.getShipItemsList()) {
 				//获得商品
@@ -3788,10 +3788,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				PjStockDesc stockOneC = iStockDescService.getOne(lambdaQueryWrapperC);
 				if (ObjectUtil.isNotEmpty(stockOneC)) {
 					stockOneC.setBalanceQuantity(stockOneC.getBalanceQuantity().add(orderItems.getGoodsNum()));
-					if ("1".equals(storageDescR.getWhetherFinancing())) {
-						stockOneC.setBalanceQuantityFinancing(stockOneC.getBalanceQuantityFinancing().add(orderItems.getGoodsNum()));
-					} else {
-						stockOneC.setBalanceQuantityHave(stockOneC.getBalanceQuantityHave().add(orderItems.getGoodsNum()));
+					if ("1".equals(status)){
+						stockOneC.setBalanceQuantityFinancing(stockOneC.getBalanceQuantityFinancing().add(orderItems.getSendNumFinancing()));
+						stockOneC.setBalanceQuantityHave(stockOneC.getBalanceQuantityHave().add(orderItems.getSendNumHave()));
 					}
 					stockOneC.setStoreInventory(stockOneC.getBalanceQuantity());
 					stockOneC.setInventoryAmount(stockOneC.getInventoryAmount().add(orderItems.getGoodsNum()
@@ -3818,16 +3817,15 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				PjStockDesc stockOneR = iStockDescService.getOne(lambdaQueryWrapperR);
 				if (ObjectUtil.isNotEmpty(stockOneR)) {
 					stockOneR.setBalanceQuantity(stockOneR.getBalanceQuantity().subtract(orderItems.getGoodsNum()));
-					if ("1".equals(storageDescC.getWhetherFinancing())) {
-						if (orderItems.getGoodsNum().compareTo(stockOneR.getBalanceQuantityFinancing()) > 0) {
+					if ("1".equals(status)){
+						if (orderItems.getSendNumFinancing().compareTo(stockOneR.getBalanceQuantityFinancing()) > 0) {
 							throw new RuntimeException("融资库存不足,保存失败");
 						}
-						stockOneR.setBalanceQuantityFinancing(stockOneR.getBalanceQuantityFinancing().subtract(orderItems.getGoodsNum()));
-					} else {
-						if (orderItems.getGoodsNum().compareTo(stockOneR.getBalanceQuantityHave()) > 0) {
+						stockOneR.setBalanceQuantityFinancing(stockOneR.getBalanceQuantityFinancing().subtract(orderItems.getSendNumFinancing()));
+						if (orderItems.getSendNumHave().compareTo(stockOneR.getBalanceQuantityHave()) > 0) {
 							throw new RuntimeException("自有库存不足,保存失败");
 						}
-						stockOneR.setBalanceQuantityHave(stockOneR.getBalanceQuantityHave().subtract(orderItems.getGoodsNum()));
+						stockOneR.setBalanceQuantityHave(stockOneR.getBalanceQuantityHave().subtract(orderItems.getSendNumHave()));
 					}
 					stockOneR.setStoreInventory(stockOneR.getBalanceQuantity());
 					stockOneR.setInventoryAmount(stockOneR.getInventoryAmount().subtract(orderItems.getGoodsNum()

+ 32 - 5
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/shoppingCart/service/impl/ShoppingCartServiceImpl.java

@@ -24,7 +24,6 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.client.entity.Message;
 import org.springblade.client.feign.IMessageClient;
@@ -38,6 +37,7 @@ import org.springblade.salesPart.enums.OrderTypeEnum;
 import org.springblade.salesPart.goods.mapper.GoodsDescMapper;
 import org.springblade.salesPart.order.mapper.OrderItemsMapper;
 import org.springblade.salesPart.order.service.IOrderService;
+import org.springblade.salesPart.order.service.IPjIntegralDetailService;
 import org.springblade.salesPart.payMethod.PayService;
 import org.springblade.salesPart.productLaunch.mapper.ProductLaunchMapper;
 import org.springblade.salesPart.serial.service.IPjpfSerialService;
@@ -83,6 +83,8 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 	private final IMessageClient messageClient;//消息
 	private IUserClient userClient;
 
+	private final IPjIntegralDetailService integralDetailService;
+
 
 	/**
 	 * 保存修改购物车信息
@@ -294,7 +296,7 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 						order.setTotalMoney(totalMoney);
 
 						if (order.getGoodsTotalNum().compareTo(new BigDecimal(1)) == 0) {
-							String freight = sysClient.getParamServiceDWT("freight",finalCorpsDesc.getTenantId());
+							String freight = sysClient.getParamServiceDWT("freight", finalCorpsDesc.getTenantId());
 							if (ObjectUtils.isNotNull(freight)) {
 								try {
 									BigDecimal freightAmount = new BigDecimal(freight);
@@ -491,7 +493,7 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 						order.setTotalMoney(totalMoney);
 
 						if (order.getGoodsTotalNum().compareTo(new BigDecimal(1)) == 0) {
-							String freight = sysClient.getParamServiceDWT("freight",finalCorpsDesc.getTenantId());
+							String freight = sysClient.getParamServiceDWT("freight", finalCorpsDesc.getTenantId());
 							if (ObjectUtils.isNotNull(freight)) {
 								try {
 									BigDecimal freightAmount = new BigDecimal(freight);
@@ -693,7 +695,7 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 						order.setTotalMoney(totalMoney);
 
 						if (order.getGoodsTotalNum().compareTo(new BigDecimal(1)) == 0) {
-							String freight = sysClient.getParamServiceDWT("freight",finalCorpsDesc.getTenantId());
+							String freight = sysClient.getParamServiceDWT("freight", finalCorpsDesc.getTenantId());
 							if (ObjectUtils.isNotNull(freight)) {
 								try {
 									BigDecimal freightAmount = new BigDecimal(freight);
@@ -883,8 +885,9 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 					order.setRecAddress(address);
 					order.setContacts(corpsAttn.getCname());
 					order.setPhone(corpsAttn.getTel());
-					order.setBsType(OrderTypeEnum.SALES.getType());
+					order.setBsType(OrderTypeEnum.POINTS.getType());
 					order.setBusinessSource(OrderTypeEnum.XCX.getType());
+					order.setStatus("录入");
 					order.setReceivableType("网络支付");
 					orderService.save(order);
 					//保存销售明细信息
@@ -922,6 +925,9 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 							if (ObjectUtils.isNotNull(productLaunch)) {
 								if (productLaunch.getInventory().compareTo(orderItems.getGoodsNum()) < 0) {
 									throw new RuntimeException("商品:" + orderItems.getGoodsName() + "库存不足");
+								}else{
+									productLaunch.setInventory(productLaunch.getInventory().subtract(orderItems.getGoodsNum()));
+									productLaunchMapper.updateById(productLaunch);
 								}
 							}
 						});
@@ -953,6 +959,27 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, PjS
 				i++;
 			}
 			orderService.updateBatchById(pjOrderList);
+			if (amount.compareTo(corpsDesc.getPointsBalance()) > 0) {
+				throw new RuntimeException("积分余额不足");
+			} else {
+				corpsDesc.setPointsBalance(corpsDesc.getPointsBalance().subtract(amount));
+				corpsDescService.updateById(corpsDesc);
+				List<PjIntegralDetail> integralDetailList = new ArrayList<>();
+				for (PjOrder item : pjOrderList) {
+					PjIntegralDetail integralDetail = new PjIntegralDetail();
+					integralDetail.setSrcId(item.getId());
+					integralDetail.setSrcNo(item.getOrdNo());
+					integralDetail.setCreateTime(new Date());
+					integralDetail.setIntegral(item.getTotalMoney());
+					integralDetail.setCorpId(item.getCustomerId());
+					integralDetail.setCorpName(item.getCustomerName());
+					integralDetail.setType("积分兑换");
+					integralDetail.setTenantId(item.getTenantId());
+					integralDetail.setGoodsName(item.getGoodsNameJoin());
+					integralDetailList.add(integralDetail);
+				}
+				integralDetailService.saveOrUpdateBatch(integralDetailList);
+			}
 			return R.data("兑换成功");
 		} else {
 			throw new RuntimeException("请选择需要结算的商品");

+ 51 - 48
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/smartLargeScreenApi/service/impl/ApiServiceImpl.java

@@ -184,7 +184,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orderList.stream().map(PjOrder::getSalesAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
 		} else {
 			map.put("name", "");
-			map.put("value", "0.00");
+			map.put("value", 0.00);
 		}
 		mapList.add(map);
 		return mapList;
@@ -200,7 +200,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orderList.stream().map(PjOrder::getSalesAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
 		} else {
 			map.put("name", "");
-			map.put("value", "0.00");
+			map.put("value", 0.00);
 		}
 		mapList.add(map);
 		return mapList;
@@ -216,7 +216,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orderList.stream().map(PjOrder::getSalesAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
 		} else {
 			map.put("name", "");
-			map.put("value", "0.00");
+			map.put("value", 0.00);
 		}
 		mapList.add(map);
 		return mapList;
@@ -232,7 +232,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", corpsDescList.size());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -248,7 +248,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orderList.stream().map(PjOrder::getCustomerId).distinct().count());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -264,7 +264,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orderList.stream().map(PjOrder::getCustomerId).distinct().count());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -282,7 +282,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", amount.divide(goodsNum, 2, RoundingMode.HALF_UP));
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -298,7 +298,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", data);
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -315,7 +315,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", balanceQuantity);
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -334,7 +334,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orders.get(0).getGrossProfit());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -353,7 +353,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orders.get(0).getGrossProfit());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -370,7 +370,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", amount);
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -387,7 +387,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", inventoryAmount);
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -398,7 +398,7 @@ public class ApiServiceImpl implements ApiService {
 		List<Map<String, Object>> mapList = new ArrayList<>();
 		Map<String, Object> map = new HashMap<>();
 		map.put("name", "");
-		map.put("value", "0");
+		map.put("value", 0);
 		mapList.add(map);
 		return mapList;
 	}
@@ -413,7 +413,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", data);
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -429,7 +429,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orderList.size());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -445,15 +445,15 @@ public class ApiServiceImpl implements ApiService {
 			if (ObjectUtils.isNotNull(data)) {
 				BigDecimal total = new BigDecimal(data);
 				BigDecimal complete = new BigDecimal(orderList.size());
-				map.put("name", "");
-				map.put("value", complete.divide(total, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+				map.put("aims", total);
+				map.put("actual", complete);
 			} else {
-				map.put("name", "");
-				map.put("value", "100");
+				map.put("aims", 0);
+				map.put("actual", 0);
 			}
 		} else {
-			map.put("name", "");
-			map.put("value", "0");
+			map.put("aims", 0);
+			map.put("actual", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -469,7 +469,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", data);
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -485,7 +485,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orderList.stream().map(PjOrder::getGoodsTotalNum).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -501,15 +501,15 @@ public class ApiServiceImpl implements ApiService {
 			if (ObjectUtils.isNotNull(data)) {
 				BigDecimal total = new BigDecimal(data);
 				BigDecimal complete = orderList.stream().map(PjOrder::getGoodsTotalNum).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-				map.put("name", "");
-				map.put("value", complete.divide(total, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+				map.put("aims", total);
+				map.put("actual", complete);
 			} else {
-				map.put("name", "");
-				map.put("value", "100");
+				map.put("aims", 0);
+				map.put("actual", 0);
 			}
 		} else {
-			map.put("name", "");
-			map.put("value", "0");
+			map.put("aims", 0);
+			map.put("actual", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -525,7 +525,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", data);
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -541,7 +541,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orderList.stream().map(PjOrder::getCustomerId).distinct().count());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -557,15 +557,15 @@ public class ApiServiceImpl implements ApiService {
 			if (ObjectUtils.isNotNull(data)) {
 				BigDecimal total = new BigDecimal(data);
 				BigDecimal complete = new BigDecimal(orderList.stream().map(PjOrder::getCustomerId).distinct().count());
-				map.put("name", "");
-				map.put("value", complete.divide(total, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+				map.put("aims", total);
+				map.put("actual", complete);
 			} else {
-				map.put("name", "");
-				map.put("value", "100");
+				map.put("aims", 0);
+				map.put("actual", 0);
 			}
 		} else {
-			map.put("name", "");
-			map.put("value", "0");
+			map.put("aims", 0);
+			map.put("actual", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -584,7 +584,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orders.get(0).getSalesAmount());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -603,7 +603,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", orders.get(0).getSalesAmount());
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -620,7 +620,7 @@ public class ApiServiceImpl implements ApiService {
 			map.put("value", amount.divide(new BigDecimal(orderList.size()), 2, RoundingMode.HALF_UP));
 		} else {
 			map.put("name", "");
-			map.put("value", "0");
+			map.put("value", 0);
 		}
 		mapList.add(map);
 		return mapList;
@@ -646,7 +646,7 @@ public class ApiServiceImpl implements ApiService {
 			List<Integer> day = salesTrendList.stream().map(MonthlySalesTrend::getDate).distinct().collect(Collectors.toList());
 			for (Integer item : day) {
 				Map<String, Object> map = new HashMap<>();
-				map.put("x", item);
+				map.put("x", item + "");
 				map.put("y", salesTrendList.stream().filter(e -> e.getDate().equals(item))
 					.map(MonthlySalesTrend::getAmount).max(BigDecimal::compareTo));
 				map.put("z", salesTrendList.stream().filter(e -> e.getDate().equals(item))
@@ -684,9 +684,10 @@ public class ApiServiceImpl implements ApiService {
 				map.put("number", item.getNumber());
 				BigDecimal sumNumber = orderList.stream().map(PjOrder::getGoodsTotalNum).reduce(BigDecimal.ZERO, BigDecimal::add);
 				if (new BigDecimal("0.00").compareTo(sumNumber) != 0) {
-					map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+					map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP)
+						.multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP) + "%");
 				} else {
-					map.put("proportion", new BigDecimal("0"));
+					map.put("proportion", "0%");
 				}
 				mapList.add(map);
 			}
@@ -811,9 +812,10 @@ public class ApiServiceImpl implements ApiService {
 				map.put("number", item.getNumber());
 				BigDecimal sumNumber = orderItemsList.stream().map(PjOrderItems::getGoodsNum).reduce(BigDecimal.ZERO, BigDecimal::add);
 				if (new BigDecimal("0.00").compareTo(sumNumber) != 0) {
-					map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+					map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP)
+						.multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP) + "%");
 				} else {
-					map.put("proportion", new BigDecimal("0"));
+					map.put("proportion", "0%");
 				}
 				mapList.add(map);
 			}
@@ -879,9 +881,10 @@ public class ApiServiceImpl implements ApiService {
 				map.put("number", item.getNumber());
 				BigDecimal sumNumber = orderItemsList.stream().map(PjOrderItems::getGoodsNum).reduce(BigDecimal.ZERO, BigDecimal::add);
 				if (new BigDecimal("0.00").compareTo(sumNumber) != 0) {
-					map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+					map.put("proportion", item.getNumber().divide(sumNumber, 2, RoundingMode.HALF_UP)
+						.multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP) + "%");
 				} else {
-					map.put("proportion", new BigDecimal("0"));
+					map.put("proportion", "0%");
 				}
 				mapList.add(map);
 			}