shc 3 лет назад
Родитель
Сommit
9d2cbc1c8c

+ 14 - 14
hnqz-common/hnqz-common-ding/src/main/java/com/qunzhixinxi/hnqz/common/ding/entity/EmployPayRequest.java

@@ -12,7 +12,8 @@ import java.util.List;
 import java.util.Map;
 
 @Data
-public class EmployPayRequest extends CommonRequest{
+@Deprecated
+public class EmployPayRequest extends CommonRequest {
 
 	private static final String PATH = "/oapi/v1/employ/freelances/pay";
 
@@ -20,15 +21,14 @@ public class EmployPayRequest extends CommonRequest{
 	/**
 	 * bizType
 	 *	79 软件开发服务
-		66 信息系统服务
-		77 技术咨询划服务
-		30 市场推广服务
-		70 其他咨询服务
-		203 现场辅助服务
+	 66 信息系统服务
+	 77 技术咨询划服务
+	 30 市场推广服务
+	 70 其他咨询服务
+	 203 现场辅助服务
 	 **/
 
 	/**
-	 *
 	 * @param config
 	 * @param subjectName
 	 * @param statementNo
@@ -44,12 +44,12 @@ public class EmployPayRequest extends CommonRequest{
 			Integer bizType,
 			List list) {
 
-		Map<String,Object> map = new HashMap<>();
-		map.put("subjectName",subjectName);
-		map.put("statementNo",statementNo);
-		map.put("statementName",statementName);
-		map.put("bizType",bizType);
-		map.put("freelances",list);
+		Map<String, Object> map = new HashMap<>();
+		map.put("subjectName", subjectName);
+		map.put("statementNo", statementNo);
+		map.put("statementName", statementName);
+		map.put("bizType", bizType);
+		map.put("freelances", list);
 		String bodyStr = JsonUtils.serializer(map);
 		String serviceSign = null;
 		try {
@@ -61,7 +61,7 @@ public class EmployPayRequest extends CommonRequest{
 		}
 
 		this.body = bodyStr;
-		this.sign = new AccessSign(config.getAppId(),serviceSign);
+		this.sign = new AccessSign(config.getAppId(), serviceSign);
 		this.queryUrl = String.format("%s%s", config.getQueryUrl(), PATH);
 	}
 

+ 70 - 0
hnqz-common/hnqz-common-ding/src/main/java/com/qunzhixinxi/hnqz/common/ding/entity/EmployPayRequestV2.java

@@ -0,0 +1,70 @@
+package com.qunzhixinxi.hnqz.common.ding.entity;
+
+
+import com.qunzhixinxi.hnqz.common.ding.config.DingConfig;
+import com.qunzhixinxi.hnqz.common.ding.sign.AccessSign;
+import com.qunzhixinxi.hnqz.common.ding.utils.JsonUtils;
+import com.qunzhixinxi.hnqz.common.ding.utils.SignUtils;
+import lombok.Data;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class EmployPayRequestV2 extends CommonRequest {
+
+	private static final String PATH = "/oapi/v2/employ/freelances/pay";
+
+
+	/**
+	 * bizType
+	 *	79 软件开发服务
+	 66 信息系统服务
+	 77 技术咨询划服务
+	 30 市场推广服务
+	 70 其他咨询服务
+	 203 现场辅助服务
+	 **/
+
+	/**
+	 * @param config
+	 * @param subjectName
+	 * @param statementNo
+	 * @param statementName
+	 * @param bizType
+	 * @param list
+	 */
+	public EmployPayRequestV2(
+			DingConfig config,
+			String subjectName,
+			String statementNo,
+			String statementName,
+			Integer bizType,
+			List list) {
+
+		Map<String, Object> map = new HashMap<>();
+		map.put("subjectName", subjectName);
+		map.put("statementNo", statementNo);
+		map.put("statementName", statementName);
+		map.put("bizType", bizType);
+		map.put("statementTaskDesc","根据要求,通过在线平台完成学术推广活动");
+		map.put("statementTaskSettlementRules","完成不同任务获得不同任务积分,根据不同任务给与0~30000积分,每个积分兑换0.5~2元,按次数结算");
+		map.put("freelances", list);
+		String bodyStr = JsonUtils.serializer(map);
+		String serviceSign = null;
+		try {
+			//签名
+			serviceSign = SignUtils.serviceSign(PATH, config.getAppSecret(),
+					"POST", new HashMap<>(), bodyStr.getBytes());
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		this.body = bodyStr;
+		this.sign = new AccessSign(config.getAppId(), serviceSign);
+		this.queryUrl = String.format("%s%s", config.getQueryUrl(), PATH);
+	}
+
+
+}

+ 44 - 6
hnqz-common/hnqz-common-ding/src/main/java/com/qunzhixinxi/hnqz/common/ding/service/DingService.java

@@ -82,13 +82,51 @@ public class DingService {
 	 * "amount": "0.22"
 	 * }
 	 */
-	public EmployPayResponse pay(DingConfig config,String subjectName,
-							   String statementNo,
-							   String statementName,
-							   Integer bizType,
-							   List list) {
+	// @Deprecated
+	// public EmployPayResponse pay(DingConfig config,String subjectName,
+	// 						   String statementNo,
+	// 						   String statementName,
+	// 						   Integer bizType,
+	// 						   List list) {
+	//
+	// 	EmployPayRequest request = new EmployPayRequest(config, subjectName,
+	// 			statementNo,
+	// 			statementName,
+	// 			bizType,
+	// 			list);
+	// 	log.info("人力家请求报文: {}",request.getBody());
+	// 	String json = HttpClientUtils.doPost(request);
+	// 	log.info("人力家返回数据: {}", json);
+	// 	EmployPayResponse response = JsonUtils.deserializer(json, EmployPayResponse.class);
+	// 	if (!response.isSuccess()) {
+	// 		log.error("结算单推送失败, code: {}, message: {}", response.getCode(), response.getMsg());
+	// 	}
+	// 	return response;
+	// }
 
-		EmployPayRequest request = new EmployPayRequest(config, subjectName,
+	/**
+	 * 子账户余额查询
+	 *
+	 * @param subjectName   结算主体
+	 * @param statementNo   结算单id
+	 * @param statementName 结算单名称
+	 * @param bizType       业务类型
+	 * @param list
+	 * @return 示例:
+	 * {
+	 * "name": "张三",
+	 * "mobile": "15000998877",
+	 * "idCard": "350198765623418765"
+	 * "amount": "0.22"
+	 * }
+	 */
+	public EmployPayResponse payV2(DingConfig config,String subjectName,
+								 String statementNo,
+								 String statementName,
+								 Integer bizType,
+								 List list) {
+
+		EmployPayRequestV2 request = new EmployPayRequestV2(config, subjectName,
 				statementNo,
 				statementName,
 				bizType,

+ 1 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmSettlementController.java

@@ -199,7 +199,7 @@ public class WmSettlementController {
 		String statementName = "9月15日市场推广服务费用结算";
 		Integer bizType = 30;
 
-		return R.ok(dingService.pay(config, subjectName, statementNo, statementName, bizType, list));
+		return R.ok(dingService.payV2(config, subjectName, statementNo, statementName, bizType, list));
 	}
 
 	@Autowired

+ 5 - 5
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmPayOffServiceImpl.java

@@ -770,7 +770,7 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
 				jsdMap.put("name", sysUser.getRealname());
 				jsdList.add(jsdMap);
 
-				EmployPayResponse employPayResponse = dingService.pay(config, subjectName,
+				EmployPayResponse employPayResponse = dingService.payV2(config, subjectName,
 						note.getSettleNo(), input.getScorePackageName(),
 						input.getInvoiceCategory(), jsdList);
 
@@ -1015,7 +1015,7 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
 				jsdMap.put("name", sysUser.getRealname());
 				jsdList.add(jsdMap);
 
-				EmployPayResponse employPayResponse = dingService.pay(config, subjectName,
+				EmployPayResponse employPayResponse = dingService.payV2(config, subjectName,
 						note.getSettleNo(), input.getScorePackageName(),
 						input.getInvoiceCategory(), jsdList);
 
@@ -1148,7 +1148,7 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
 				jsdMap.put("name", importUser.getImportName());
 				jsdList.add(jsdMap);
 
-				EmployPayResponse employPayResponse = dingService.pay(config, subjectName,
+				EmployPayResponse employPayResponse = dingService.payV2(config, subjectName,
 						note.getSettleNo(), input.getScorePackageName(),
 						input.getInvoiceCategory(), jsdList);
 
@@ -1315,7 +1315,7 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
 			jsdMap.put("name", sysUser.getRealname());
 			jsdList.add(jsdMap);
 
-			EmployPayResponse employPayResponse = dingService.pay(config, subjectName,
+			EmployPayResponse employPayResponse = dingService.payV2(config, subjectName,
 					note.getSettleNo(), wmScorePackage.getScorePackageName(),
 					note.getInvoiceType(), jsdList);
 
@@ -1485,7 +1485,7 @@ public class WmPayOffServiceImpl extends ServiceImpl<WmPayOffMapper, WmPayOff> i
 			jsdMap.put("name", importUser.getImportName());
 			jsdList.add(jsdMap);
 
-			EmployPayResponse employPayResponse = dingService.pay(config, subjectName,
+			EmployPayResponse employPayResponse = dingService.payV2(config, subjectName,
 					note.getSettleNo(), wmScorePackage.getScorePackageName(),
 					note.getInvoiceType(), jsdList);
 

+ 1 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmScorePackageSettleNoteServiceImpl.java

@@ -791,7 +791,7 @@ public class WmScorePackageSettleNoteServiceImpl extends ServiceImpl<WmScorePack
 		jsdMap.put("name", sysUser.getRealname());
 		jsdList.add(jsdMap);
 
-		EmployPayResponse employPayResponse = dingService.pay(config, subjectName,
+		EmployPayResponse employPayResponse = dingService.payV2(config, subjectName,
 				note.getSettleNo(), wmScorePackage.getScorePackageName(),
 				note.getInvoiceType(), jsdList);