Bladeren bron

2022年11月11 19:08

wangzhuo 3 jaren geleden
bovenliggende
commit
e38d8725bf

+ 2 - 0
blade-auth/src/main/java/org/springblade/auth/service/BladeUserDetailsServiceImpl.java

@@ -71,6 +71,7 @@ public class BladeUserDetailsServiceImpl implements UserDetailsService {
 		String password = request.getParameter(TokenUtil.PASSWORD_KEY);
 		String grantType = request.getParameter(TokenUtil.GRANT_TYPE_KEY);
 		String openId = request.getParameter(TokenUtil.OPEN_ID);
+		String unionId = request.getParameter(TokenUtil.UNION_ID);
 
 		//判断租户号是否为空  为空查询数据库赋值
 		if (ObjectUtils.isNull(headerTenant) && ObjectUtils.isNull(paramTenant)) {
@@ -92,6 +93,7 @@ public class BladeUserDetailsServiceImpl implements UserDetailsService {
 				}
 			}*/
 			user.setOpenId(openId);
+			user.setUnionId(unionId);
 			userClient.updateOpenId(user);
 
 			headerTenant = user.getTenantId();

+ 1 - 0
blade-auth/src/main/java/org/springblade/auth/utils/TokenUtil.java

@@ -83,6 +83,7 @@ public class TokenUtil {
 	public final static String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
 	public final static String PHONE_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber";
 	public final static String OPEN_ID = "open_id";
+	public final static String UNION_ID = "union_id";
 
 	private static BladeTenantProperties tenantProperties;
 

+ 5 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java

@@ -114,6 +114,11 @@ public class User extends TenantEntity {
 	private String openId;
 
 	/**
+	 * 微信开放平台唯一标识
+	 */
+	private String unionId;
+
+	/**
 	 * 发送次数
 	 */
 	private Integer timesSending;

+ 1 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.java

@@ -260,7 +260,7 @@ public interface OrderMapper extends BaseMapper<Order> {
 	List<OrderStatisticsVo> salesmanProfit(IPage<OrderStatisticsVo> page, @Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand, @Param("chargeMember") String chargeMember);
 
 	/**
-	 * 业务员利润导出
+	 * 业务员利润统计导出
 	 */
 	List<SalesmanProfitExcel> salesmanProfitExport(@Param("statisticsVo") OrderStatisticsVo statisticsVo, @Param("brand") String brand, @Param("chargeMember") String chargeMember);
 

+ 15 - 14
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml

@@ -1509,7 +1509,7 @@ ORDER BY
         SELECT
         BO.charge_member as chargeMember,
         SUM(BOI.quantity) AS quantity,
-        SUM(BO.gross_profit) AS grossProfit,
+        SUM(BO.debit_amount) - SUM(BOI.purchaseAmount) AS grossProfit,
         SUM(BO.debit_amount) AS amount
         FROM
         business_order BO
@@ -1517,7 +1517,8 @@ ORDER BY
         SELECT
         pid,
         item_id,
-        IFNULL( SUM( actual_quantity ), 0 ) AS quantity
+        IFNULL( SUM( actual_quantity ), 0 ) AS quantity,
+        IFNULL( sum( actual_quantity * purchase_amount ), 0 ) AS purchaseAmount
         FROM
         business_order_items
         WHERE is_deleted = 0
@@ -1562,7 +1563,7 @@ ORDER BY
             SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
             SUM(BO.predict_ocean_freight) AS predictOceanFreight,
             SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
-            (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
+            FORMAT(( SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) ) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
         FROM
             business_order BO
         LEFT JOIN (
@@ -1615,7 +1616,7 @@ ORDER BY
         SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
         SUM(BO.predict_ocean_freight) AS predictOceanFreight,
         SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
-        (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
+        FORMAT(( SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) ) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
         FROM
         business_order BO
         LEFT JOIN (
@@ -1668,7 +1669,7 @@ ORDER BY
             SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
             SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
             SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
-            (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
+            FORMAT((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
         FROM
         business_order BO
         LEFT JOIN (
@@ -1719,7 +1720,7 @@ ORDER BY
         SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
         SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
         SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) - SUM( BO.predict_ocean_freight ) AS netGrossProfit,
-        (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
+        FORMAT((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
         FROM
         business_order BO
         LEFT JOIN (
@@ -1767,12 +1768,12 @@ ORDER BY
             SUM( BOI.purchaseAmount ) AS purchaseAmount,
             SUM( BOI.quantity ) AS quantity,
             SUM( BO.this_used_profit ) AS thisUsedProfit,
-            ( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ) AS price,
-            ((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ) AS singleGrossProfit,
+            FORMAT(( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ),2) AS price,
+            FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ),2) AS singleGrossProfit,
             SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
             SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )  AS netGrossProfit,
             (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit )) AS grossProfit,
-            ((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
+            FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
         FROM
             business_order BO
                 LEFT JOIN (
@@ -1818,12 +1819,12 @@ ORDER BY
         SUM( BOI.purchaseAmount ) AS purchaseAmount,
         SUM( BOI.quantity ) AS quantity,
         SUM( BO.this_used_profit ) AS thisUsedProfit,
-        ( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ) AS price,
-        SUM( BO.gross_profit ) + (-SUM( BO.this_used_profit )) / SUM( BOI.quantity ) AS singleGrossProfit,
+        FORMAT(( SUM( BO.debit_amount ) / SUM( BOI.quantity ) ),2) AS price,
+        FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BOI.quantity ),2) AS singleGrossProfit,
         SUM( BO.predict_ocean_freight ) AS predictOceanFreight,
-        SUM( BO.gross_profit )  AS netGrossProfit,
-        SUM( BO.gross_profit ) + (-SUM( BO.this_used_profit )) AS grossProfit,
-        (SUM( BO.gross_profit ) + (-SUM( BO.this_used_profit ))) / SUM( BO.debit_amount ) * 100 AS grossProfitRate
+        SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )  AS netGrossProfit,
+        (SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit )) AS grossProfit,
+        FORMAT(((SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount )) + (-SUM( BO.this_used_profit ))) / SUM( BO.debit_amount ) * 100,2) AS grossProfitRate
         FROM
         business_order BO
         LEFT JOIN (

+ 3 - 3
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/BidingServiceImpl.java

@@ -286,15 +286,15 @@ public class BidingServiceImpl extends ServiceImpl<BidingMapper, Biding> impleme
 				//获得用户信息
 				R<User> user = userClient.userInfoById(corpsAttn.getUserId());
 				if (ObjectUtil.isNotEmpty(user)){
-					if (ObjectUtil.isNotEmpty(user.getData().getOpenId())){
-						String msg = wechatClient.newsPush(user.getData().getOpenId(), loadingTime, details, number);
+					if (ObjectUtil.isNotEmpty(user.getData().getUnionId())){
+						String msg = wechatClient.newsPush(user.getData().getUnionId(), loadingTime, details, number);
 						System.out.println("msg====="+msg);
 					}
 				}
 			});
 		});*/
 
-		//salesBiding.setStatus(4);
+		salesBiding.setStatus(4);
 		baseMapper.updateById(salesBiding);
 	}