فهرست منبع

2022年11月23 18:12

wangzhuo 3 سال پیش
والد
کامیت
7619a35101

+ 16 - 3
blade-service-api/blade-client-api/src/main/java/org/springblade/client/feign/IWechatClient.java

@@ -19,14 +19,27 @@ public interface IWechatClient {
 
 	String API_PREFIX = "/client";
 	String API_NEW_PUSH = "/newPush";
+	String BID_WINNING_PUSH = "/bidWinningPush";
 
 	/**
-	 * 推送消息
+	 * 发布标书推送消息
 	 */
 	@GetMapping(API_NEW_PUSH)
 	String newsPush(@RequestParam("unionId") String unionId,
 					@RequestParam("contractNo") String contractNo,
-					@RequestParam("harbor") String harbor,
-					@RequestParam("cargoInformation") String cargoInformation,
+					@RequestParam("departureHarbor") String departureHarbor,
+					@RequestParam("objectiveHarbor") String objectiveHarbor,
+					@RequestParam("boxTypeQuantity") String boxTypeQuantity,
 					@RequestParam("loadingTime") String  loadingTime);
+
+	/**
+	 * 中标推送消息
+	 */
+	@GetMapping(BID_WINNING_PUSH)
+	String bidWinningPush(@RequestParam("unionId") String unionId,
+					@RequestParam("contractNo") String contractNo,
+					@RequestParam("departureHarbor") String departureHarbor,
+					@RequestParam("objectiveHarbor") String objectiveHarbor,
+					@RequestParam("boxTypeQuantity") String boxTypeQuantity,
+					@RequestParam("offer") String offer);
 }

+ 5 - 0
blade-service-api/blade-purchase-sales-api/src/main/java/org/springblade/purchase/sales/vo/SalesDetailsVo.java

@@ -110,4 +110,9 @@ public class SalesDetailsVo implements Serializable {
 
 	//判断是否是app
 	private String IsItAnApp;
+
+	/**
+	 * 收货日期
+	 */
+	private String freightTime;
 }

+ 8 - 0
blade-service-api/trade-purchase-api/src/main/java/com/trade/purchase/extra/feign/IClaimClient.java

@@ -1,5 +1,6 @@
 package com.trade.purchase.extra.feign;
 
+import com.trade.purchase.extra.entity.Claim;
 import org.springblade.core.tool.api.R;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -18,6 +19,7 @@ public interface IClaimClient {
 	String PASS_CHECK = API_PREFIX + "/pass-check";
 	String PASS_CANCEL = API_PREFIX + "/pass-cancel";
 	String UNDER_REVIEW = API_PREFIX + "/under-review";
+	String GET_CLAIM_ITEM = API_PREFIX + "/detail";
 
 	/**
 	 * 审核通过
@@ -46,4 +48,10 @@ public interface IClaimClient {
 	@PostMapping(UNDER_REVIEW)
 	R underReview(@RequestParam("id") Long id);
 
+	/**
+	 *
+	 */
+	@PostMapping(GET_CLAIM_ITEM)
+	R<Claim> getClaimItem(@RequestParam("claim") Claim claim);
+
 }

+ 25 - 0
blade-service/blade-check/src/main/java/org/springblade/check/controller/AuditProecessController.java

@@ -22,6 +22,9 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.trade.purchase.extra.entity.Claim;
+import com.trade.purchase.extra.entity.ClaimItem;
+import com.trade.purchase.extra.feign.IClaimClient;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -91,6 +94,8 @@ public class AuditProecessController extends BladeController {
 
 	private final ITradingBoxClient tradingBoxClient;//买,卖箱(吉永)
 
+	private final IClaimClient claimClient;//费用报销
+
 	/**
 	 * 分页 审批流记录
 	 */
@@ -475,4 +480,24 @@ public class AuditProecessController extends BladeController {
 		}
 	}
 
+	@GetMapping("/getByClaimItemList")
+	@ApiOperationSupport(order = 12)
+	@ApiOperation(value = "费用报销详情", notes = "传入srcBillId")
+	public R getByClaimItemList(@RequestParam(value = "srcBillId") Long srcBillId) {
+		Claim claim = new Claim();
+		claim.setId(srcBillId);
+		claim.setTenantId(AuthUtil.getTenantId());
+		R<Claim> claimR = claimClient.getClaimItem(claim);
+		if (ObjectUtils.isNotNull(claimR)) {
+			List<ClaimItem> list = claimR.getData().getItemList();
+			if (ObjectUtil.isNotEmpty(list)){
+				return R.data(list);
+			}else {
+				return R.success("暂无数据");
+			}
+		} else {
+			return R.success("暂无数据");
+		}
+	}
+
 }

+ 65 - 8
blade-service/blade-client/src/main/java/org/springblade/client/wechat/feign/WechatClient.java

@@ -35,16 +35,20 @@ public class WechatClient implements IWechatClient {
 	private static final String appSecret = "50e84930675a0c06057d45a6d64ec548";
 	// 小程序的appId以及appSecret
 	private static final String APP_ID = "wx0a0feca24b695636";
+	// 发布标书模板id
+	private static final String RELEASE_TEMPLATE_ID = "zllS4ifXuLivuaMw13TlcySE1wxERDfY3Tru412ZM70";
+	// 中标模板id
+	private static final String WINNING_TEMPLATE_ID = "x_oQaCsWi0n9hq3MNpd8hRvXqB8sc2E_DzIbrk1IRs0";
 
 
 	/**
-	 * 发送模板消息
+	 * 发布标书发送模板消息
 	 *
 	 * @param unionId  接收此消息的openId
 	 * @return 结果
 	 */
 	@Override
-	public String newsPush(String unionId, String contractNo, String harbor, String cargoInformation, String loadingTime) {
+	public String newsPush(String unionId, String contractNo, String departureHarbor, String objectiveHarbor,String boxTypeQuantity, String loadingTime) {
 		//获得token
 		Map<String,String> tokenMap = this.getToken();
 		//获得用户列表
@@ -64,18 +68,71 @@ public class WechatClient implements IWechatClient {
 				wxMpService.setWxMpConfigStorage(wxStorage);
 
 				List<WxMpTemplateData> data = Arrays.asList(
-					new WxMpTemplateData("first", "[提醒]您有新的竞价消息,请尽快报价,过期作废"),
-					new WxMpTemplateData("keyword1", "发布"),
-					new WxMpTemplateData("keyword2", contractNo),
-					new WxMpTemplateData("keyword3", harbor),
-					new WxMpTemplateData("keyword4", cargoInformation),
+					new WxMpTemplateData("first", "您收到一条新的标书,请及时处理!"),
+					new WxMpTemplateData("keyword1", contractNo),
+					new WxMpTemplateData("keyword2", departureHarbor),
+					new WxMpTemplateData("keyword3", objectiveHarbor),
+					new WxMpTemplateData("keyword4", boxTypeQuantity),
 					new WxMpTemplateData("keyword5", loadingTime),
 					new WxMpTemplateData("remark", "感谢您的使用。")
 				);
 				//2,推送消息
 				WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
 					.toUser(openid)//要推送的用户openid
-					.templateId("Ad7zPbJWk4P44J2muNTDJCHwbxr5trgfPeHLq4oklRE")//模版id
+					.templateId(RELEASE_TEMPLATE_ID)//发布标书模版id
+					.miniProgram(new WxMpTemplateMessage.MiniProgram(APP_ID, "pages/index"))
+					.data(data)
+					.build();
+				try {
+					wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
+				} catch (Exception e) {
+					System.out.println("推送失败:" + e.getMessage());
+					e.printStackTrace();
+				}
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * 中标发送模板消息
+	 *
+	 * @param unionId  接收此消息的openId
+	 * @return 结果
+	 */
+	@Override
+	public String bidWinningPush(String unionId, String contractNo, String departureHarbor, String objectiveHarbor,String boxTypeQuantity, String offer) {
+		//获得token
+		Map<String,String> tokenMap = this.getToken();
+		//获得用户列表
+		Map<String, Object> openIdMap = this.getUserOpenId(tokenMap.get("accessToken"));
+		List<String> openIdsList = (List<String>) openIdMap.get("openIds");
+		//获得用户unionId
+		for (int i = 0; i < openIdsList.size(); i++ ){
+			String openid = openIdsList.get(i);
+			//获得unionId
+			Map<String, String > userMap = this.getUserInfo(tokenMap.get("accessToken"),openid);
+			if (userMap.get("unionid").equals(unionId)){
+				//1,配置
+				WxMpInMemoryConfigStorage wxStorage = new WxMpInMemoryConfigStorage();
+				wxStorage.setAppId(appId);
+				wxStorage.setSecret(appSecret);
+				WxMpService wxMpService = new WxMpServiceImpl();
+				wxMpService.setWxMpConfigStorage(wxStorage);
+
+				List<WxMpTemplateData> data = Arrays.asList(
+					new WxMpTemplateData("first", "恭喜中标,合作愉快!"),
+					new WxMpTemplateData("keyword1", contractNo),
+					new WxMpTemplateData("keyword2", departureHarbor),
+					new WxMpTemplateData("keyword3", objectiveHarbor),
+					new WxMpTemplateData("keyword4", boxTypeQuantity),
+					new WxMpTemplateData("keyword5", offer),
+					new WxMpTemplateData("remark", "感谢您的使用。")
+				);
+				//2,推送消息
+				WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
+					.toUser(openid)//要推送的用户openid
+					.templateId(WINNING_TEMPLATE_ID)//中标模版id
 					.miniProgram(new WxMpTemplateMessage.MiniProgram(APP_ID, "pages/index"))
 					.data(data)
 					.build();

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

@@ -690,14 +690,12 @@ ORDER BY
 
     <select id="salesCommission" resultType="org.springblade.purchase.sales.vo.SalesDetailsVo">
         SELECT
-            bo.id as orderId,
-            boi.id as itemsId,
-            bgd.brand as brand,
-            bo.saleman as salesName,
-            bo.create_time as careteTime,
-            bgd.size as specs,
-            boi.Actual_quantity as quantity,
-            zboi.price_type as priceType
+            bgd.brand AS brand,
+            bo.saleman AS salesName,
+            DATE_FORMAT( bo.create_time, '%Y-%m' ) AS careteTime,
+            bgd.size AS specs,
+            SUM( boi.Actual_quantity ) AS quantity,
+            zboi.price_type AS priceType
         FROM business_delivery bo
         LEFT JOIN business_delivery_items boi on boi.pid = bo.id
         LEFT JOIN basic_goods_desc bgd on bgd.id = boi.item_id
@@ -719,18 +717,23 @@ ORDER BY
                 and bo.create_time &lt;= #{detailsVo.endCreateTime}
             </if>
         </where>
-        GROUP BY bgd.brand,bo.saleman,bgd.size,zboi.price_type
-        order BY bo.create_time,bo.saleman desc
+        GROUP BY
+            bgd.brand,
+            bo.saleman,
+            bgd.size,
+            zboi.price_type,
+            DATE_FORMAT( bo.create_time, '%Y-%m' )
+        order BY bo.saleman desc
     </select>
 
     <select id="salesCommissionList" resultType="org.springblade.purchase.sales.excel.SalesCommissionExcel">
         SELECT
-        bgd.brand as brand,
-        bo.saleman as salesName,
-        bo.create_time as careteTime,
-        bgd.size as specs,
-        boi.Actual_quantity as quantity,
-        zboi.price_type as priceType
+            bgd.brand AS brand,
+            bo.saleman AS salesName,
+            DATE_FORMAT( bo.create_time, '%Y-%m' ) AS careteTime,
+            bgd.size AS specs,
+            SUM( boi.Actual_quantity ) AS quantity,
+            zboi.price_type AS priceType
         FROM business_delivery bo
         LEFT JOIN business_delivery_items boi on boi.pid = bo.id
         LEFT JOIN basic_goods_desc bgd on bgd.id = boi.item_id
@@ -752,7 +755,13 @@ ORDER BY
                 and bo.create_time &lt;= #{detailsVo.endCreateTime}
             </if>
         </where>
-        order by bo.create_time desc
+        GROUP BY
+            bgd.brand,
+            bo.saleman,
+            bgd.size,
+            zboi.price_type,
+            DATE_FORMAT( bo.create_time, '%Y-%m' )
+        order BY bo.saleman desc
     </select>
 
     <select id="monthSales"  resultType="BigDecimal">

+ 28 - 8
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/BidingItemsServiceImpl.java

@@ -25,6 +25,8 @@ import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
@@ -200,22 +202,37 @@ public class BidingItemsServiceImpl extends ServiceImpl<BidingItemsMapper, Bidin
 		if (items == null){
 			throw new SecurityException("数据异常");
 		}
-		items.setStatus(6);
-		baseMapper.updateById(items);
+
+		LambdaQueryWrapper<Biding> bidingLambdaQueryWrapper = new LambdaQueryWrapper<>();
+		bidingLambdaQueryWrapper.eq(Biding::getId, items.getPid());
+		bidingLambdaQueryWrapper.eq(Biding::getIsDeleted, 0);
+		Biding biding = bidingMapper.selectOne(bidingLambdaQueryWrapper);
+
+		if(ObjectUtil.isEmpty(biding)){
+			throw new SecurityException("单据数据异常");
+		}
+
+		//起运港
+		String departureHarbor = biding.getDepartureHarbor();
+		//目的港
+		String objectiveHarbor = biding.getObjectiveHarbor();
+		//箱型箱量
+		String boxTypeQuantity = biding.getBoxTypeQuantity();
+		//报价
+		String offer = items.getShippingCompany() + " " + items.getSeaFreight();
 
 		//获得代理信息
 		LambdaQueryWrapper<BidingAgent> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(BidingAgent::getTenantId, AuthUtil.getTenantId());
 		lambdaQueryWrapper.eq(BidingAgent::getIsDeleted,0);
-		lambdaQueryWrapper.eq(BidingAgent::getPid, items);
+		lambdaQueryWrapper.eq(BidingAgent::getPid, items.getPid());
 		lambdaQueryWrapper.in(BidingAgent::getAgentId, items.getCorpsAttnId());
 		BidingAgent bidingAgent = bidingAgentMapper.selectOne(lambdaQueryWrapper);
 
 		if (ObjectUtil.isNotEmpty(bidingAgent)){
 			//根据代理客户的客户联系人进行消息推送
 			//获得所有代理客户
-
-			/*CorpsDesc corpsDesc = corpsDescClient.getCorpId(bidingAgent.getAgentId());
+			CorpsDesc corpsDesc = corpsDescClient.getCorpId(items.getCorpsAttnId());
 			//获得客户的所有客户联系人
 			List<CorpsAttn> attnList = corpsAttnClient.getAttn(corpsDesc.getId());
 			attnList.forEach(corpsAttn -> {
@@ -223,15 +240,18 @@ public class BidingItemsServiceImpl extends ServiceImpl<BidingItemsMapper, Bidin
 				R<User> user = userClient.userInfoById(corpsAttn.getUserId());
 				if (ObjectUtil.isNotEmpty(user)){
 					if (ObjectUtil.isNotEmpty(user.getData().getUnionId())){
-						*//*String msg = wechatClient.newsPush(user.getData().getUnionId(),
-							salesBiding.getContractNo(), harbor, salesBiding.getCargoInformation(),loadingTime);*//*
+						wechatClient.bidWinningPush(user.getData().getUnionId(),
+							biding.getContractNo(), departureHarbor, objectiveHarbor, boxTypeQuantity, offer);
 					}
 				}
-			});*/
+			});
 
 			//更新代理明细信息
 			bidingAgent.setStatus(6);
 			bidingAgentMapper.updateById(bidingAgent);
 		}
+
+		//items.setStatus(6);
+		baseMapper.updateById(items);
 	}
 }

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

@@ -270,10 +270,14 @@ public class BidingServiceImpl extends ServiceImpl<BidingMapper, Biding> impleme
 		}
 
 		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-		//路线
-		String harbor = salesBiding.getDepartureHarbor() + "至" + salesBiding.getObjectiveHarbor();
+		//起运港
+		String departureHarbor = salesBiding.getDepartureHarbor();
+		//目的港
+		String objectiveHarbor = salesBiding.getObjectiveHarbor();
 		//装柜时间
 		String loadingTime = dateFormat.format(salesBiding.getLoadingTime());
+		//箱型箱量
+		String boxTypeQuantity = salesBiding.getBoxTypeQuantity();
 
 		//根据代理客户的客户联系人进行消息推送
 		//获得所有代理客户
@@ -289,7 +293,7 @@ public class BidingServiceImpl extends ServiceImpl<BidingMapper, Biding> impleme
 				if (ObjectUtil.isNotEmpty(user.getData())){
 					if (ObjectUtil.isNotEmpty(user.getData().getUnionId())){
 						wechatClient.newsPush(user.getData().getUnionId(),
-							salesBiding.getContractNo(), harbor, salesBiding.getCargoInformation(),loadingTime);
+							salesBiding.getContractNo(), departureHarbor, objectiveHarbor, boxTypeQuantity, loadingTime);
 					}
 				}
 			});

+ 25 - 8
blade-service/trade-finance/src/main/java/org/springblade/finance/mapper/AccMapper.xml

@@ -59,20 +59,37 @@
     <select id="selBillBalance" resultMap="accResultMap">
         SELECT
             BCD.cname AS corpName,
-            SUM(FC.Amount) as amount,
-            SUM(FC.Settlement_Amount) AS settlementAmount,
-            SUM(FC.Amount) - SUM(FC.Settlement_Amount) as balance
+            IFNULL( BC.amount, 0 ) AS amount,
+            IFNULL( BC.settlementAmount, 0 ) AS settlementAmount,
+            IFNULL( (SUM( FC.Amount ) - SUM( FC.Settlement_Amount )), 0 )AS balance
         FROM finance_acc FC
         LEFT JOIN basic_corps_desc BCD ON BCD.id = FC.Corpid
+        LEFT JOIN (
+            SELECT
+                FC.Corpid AS corpId,
+                SUM( FC.Amount ) AS amount,
+                SUM( FC.Settlement_Amount ) AS settlementAmount
+            FROM finance_acc FC
+            <where>
+                FC.tenant_id = #{acc.tenantId}
+                and FC.is_deleted = 0
+                and FC.bill_type = #{acc.billType}
+                <if test="acc.createStartDate !=null and acc.createStartDate != ''">
+                    AND FC.create_time &gt;= #{acc.createStartDate}
+                </if>
+                <if test="acc.createEndDate !=null and acc.createEndDate != ''">
+                    AND FC.create_time &lt;= #{acc.createEndDate}
+                </if>
+            </where>
+            GROUP BY
+            FC.Corpid
+        ) BC ON BC.corpId = FC.Corpid
         <where>
             FC.tenant_id = #{acc.tenantId}
             and FC.is_deleted = 0
             and FC.bill_type = #{acc.billType}
-            <if test="acc.createStartDate !=null and acc.createStartDate != ''">
-                AND create_time &gt;= #{acc.createStartDate}
-            </if>
-            <if test="acc.createEndDate !=null and acc.createEndDate != ''">
-                AND create_time &lt;= #{acc.createEndDate}
+            <if test="acc.corpId != null and acc.corpId != ''">
+                and FC.Corpid = #{acc.corpId}
             </if>
         </where>
         GROUP BY FC.Corpid