Commit 8c5779b1 authored by wujiang's avatar wujiang

提交代码

parent 75689568
...@@ -182,7 +182,9 @@ public class HygfIcbcRecordDTO { ...@@ -182,7 +182,9 @@ public class HygfIcbcRecordDTO {
@ApiModelProperty (value = "代扣金额") @ApiModelProperty (value = "代扣金额")
private Double paymentAmount; private Double paymentAmount;
@ApiModelProperty (value = "代扣时间") @ApiModelProperty (value = "代扣时间")
private String paymentTime; private String paymentTime;
@ApiModelProperty (value = "银行卡类型")
private String type;
} }
\ No newline at end of file
...@@ -48,4 +48,6 @@ public class HygfIcbcRecordQueryDTO { ...@@ -48,4 +48,6 @@ public class HygfIcbcRecordQueryDTO {
private Integer offset; private Integer offset;
private List<String> ids; private List<String> ids;
private String type;
} }
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.boot.module.hygf.api.dto
*
* @author yangyang
* @version v1.0
* @date 2024/7/18 14:36
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HygfIcbcSignProtocolDTO {
String phone;
String mediumId;
String verifyCode;
String sendNo;
String srVid;
boolean cancel=false;
}
...@@ -117,4 +117,7 @@ public class HygfIcbcRecord extends BaseEntity { ...@@ -117,4 +117,7 @@ public class HygfIcbcRecord extends BaseEntity {
*/ */
@TableField("amos_user_id") @TableField("amos_user_id")
private String amosUserId; private String amosUserId;
@TableField("type")
private String type;
} }
\ No newline at end of file
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
icbc.out_user_id as outUserId, icbc.out_user_id as outUserId,
icbc.protocol_status, icbc.protocol_status,
icbc.medium_id, icbc.medium_id,
icbc.type,
ph.rec_date, ph.rec_date,
ph.regional_companies_name as regionalCompaniesName, ph.regional_companies_name as regionalCompaniesName,
ph.regional_companies_code as regionalCompaniesCode, ph.regional_companies_code as regionalCompaniesCode,
...@@ -142,6 +143,9 @@ ...@@ -142,6 +143,9 @@
<if test="param.addressName != null and param.addressName != ''"> <if test="param.addressName != null and param.addressName != ''">
AND ph.project_address LIKE CONCAT('%', #{param.addressName}, '%') AND ph.project_address LIKE CONCAT('%', #{param.addressName}, '%')
</if> </if>
<if test="param.type != null and param.type != ''">
AND icbc.type LIKE CONCAT('%', #{param.type}, '%')
</if>
<if test="param != null"> <if test="param != null">
<if test="param.openAccountStatus != null and param.openAccountStatus != ''"> <if test="param.openAccountStatus != null and param.openAccountStatus != ''">
<if test="param.openAccountStatus != '00'"> <if test="param.openAccountStatus != '00'">
......
...@@ -4,10 +4,7 @@ import com.icbc.api.response.JftApiUserEntrustopenacctQueryResponseV1; ...@@ -4,10 +4,7 @@ import com.icbc.api.response.JftApiUserEntrustopenacctQueryResponseV1;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits; import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.FinancingRectificationOrderDto; import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.dto.HouseholdContractDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordQueryDTO;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HygfIcbcServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HygfIcbcServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -157,7 +154,34 @@ public class HygfIcbcController extends BaseController { ...@@ -157,7 +154,34 @@ public class HygfIcbcController extends BaseController {
@GetMapping(value = "/exportExcel") @GetMapping(value = "/exportExcel")
@UserLimits @UserLimits
public void exportData( HttpServletResponse response,HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) { public void exportData( HttpServletResponse response,HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
hygfIcbcService.exportExcel(response,hygfIcbcRecordQueryDTO); hygfIcbcService.exportExcel(response,hygfIcbcRecordQueryDTO);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "签约代扣验证码", notes = "签约代扣验证码")
@GetMapping(value = "/signVerifyCode")
public ResponseModel<Object> signVerifyCode(@RequestParam(required = true) String phone,@RequestParam(required = true) String mediumId ) {
return ResponseHelper.buildResponse( hygfIcbcService.signVerifyCode(phone,mediumId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "POST",value = "签约代扣协议", notes = "签约代扣协议")
@PostMapping(value = "/signProtocol")
public ResponseModel<Object> signProtocol(@RequestBody HygfIcbcSignProtocolDTO hygfIcbcSignProtocolDTO){
return ResponseHelper.buildResponse(hygfIcbcService.signProtocol(hygfIcbcSignProtocolDTO));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "查询代扣协议", notes = "查询代扣协议")
@GetMapping(value = "/signQuery")
public ResponseModel<Object> signQuery(String busiCode){
return ResponseHelper.buildResponse(hygfIcbcService.signQuery(busiCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "余额查询", notes = "余额查询")
@GetMapping(value = "/balanceQuery")
public ResponseModel<Object> balanceQuery(String mediumId){
return ResponseHelper.buildResponse(hygfIcbcService.balanceQuery(mediumId));
}
} }
...@@ -4,6 +4,9 @@ import java.io.PrintWriter; ...@@ -4,6 +4,9 @@ import java.io.PrintWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64; import java.util.Base64;
import java.util.Calendar; import java.util.Calendar;
...@@ -24,11 +27,13 @@ import javax.servlet.http.HttpServletResponse; ...@@ -24,11 +27,13 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.icbc.api.request.*;
import com.icbc.api.response.*;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil; import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.hygf.api.dto.HistoryPeasantHouseholdDto; import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordExportDTO;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationEngineeringInfo; import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationEngineeringInfo;
import com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationEngineeringInfoMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationEngineeringInfoMapper;
...@@ -47,14 +52,9 @@ import com.icbc.api.DefaultIcbcClient; ...@@ -47,14 +52,9 @@ import com.icbc.api.DefaultIcbcClient;
import com.icbc.api.IcbcApiException; import com.icbc.api.IcbcApiException;
import com.icbc.api.IcbcConstants; import com.icbc.api.IcbcConstants;
import com.icbc.api.UiIcbcClient; import com.icbc.api.UiIcbcClient;
import com.icbc.api.request.JftApiUserEntrustopenacctQueryRequestV1;
import com.icbc.api.request.JftUiUserEntrustopenacctSubmitRequestV1;
import com.icbc.api.response.JftApiUserEntrustopenacctQueryResponseV1;
import com.icbc.api.utils.IcbcSignature; import com.icbc.api.utils.IcbcSignature;
import com.icbc.api.utils.WebUtils; import com.icbc.api.utils.WebUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.IcbcEnum; import com.yeejoin.amos.boot.module.hygf.api.Enum.IcbcEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordDTO;
import com.yeejoin.amos.boot.module.hygf.api.dto.HygfIcbcRecordQueryDTO;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfIcbcRecord; import com.yeejoin.amos.boot.module.hygf.api.entity.HygfIcbcRecord;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfIcbcRequest; import com.yeejoin.amos.boot.module.hygf.api.entity.HygfIcbcRequest;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold; import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
...@@ -74,11 +74,11 @@ import lombok.extern.slf4j.Slf4j; ...@@ -74,11 +74,11 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbcRecord, HygfIcbcRecordMapper> public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbcRecord, HygfIcbcRecordMapper>
implements IHygfIcbcService { implements IHygfIcbcService {
private static final String trxChannel = "05"; // 05表示小程序 private static final String trxChannel = "05"; // 05表示小程序
// 正式环境 // 正式环境
// private static final String APP_ID = "11000000000000028870"; // private static final String APP_ID = "11000000000000028870";
// private static final String corpNo = "020240710000001169"; // private static final String corpNo = "020240710000001169";
// private static final String MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAlcIeANdqipul3/qAIRlknSacHiFCMzLzUJisGcr9ipm3p2rir8WDsac2MxgtUt+f89SGNoWyjv4q0/QAKQQTd5U3KuGAksCJLBGVibuFe7G7YGYVezUksjvocvp8GIinCIkzq67KL2SOpGXAu3s+282rx8AxdTZA/EhXQvbORbWz5+DamyY+wS7Maa8KmIOb6WZPtiXgENZxDHAafrqW8Gt1BnVfJNf5yS5J9Wl+LcR1EPvi5iH8dSIdn1ZMVupoREjV/DvItSogVehsqTRZWuekAo2xH9YEli1UMG/l3deViRn/A4VmPPzdv0xXpn/yO+OTjWez+KmSmJfAZXBvAgMBAAECggEABRYviWFWTz8X+1qeIDI/nHO2KFt3X2tAxkJztd/8h5PYmYw3e4NPATp5Ayp4UgIlW/ExxNW91EiImBL/F939eJIpA8sDJ8U4hqb+U+fOZyksOZnDOIAHmE+I24vl588yFM9Z6F55gGeeDVJ0SZHqIG/nz8i339aLt02yj3N6V1peQugBP6L9arcD+gVu4F70whkqW+lHBK/WzX1OazqEx3Ip175jqzi9/0vO/h/kqnGGXuMi2VeuAPsa+d0a6lf/FScxqCt3t6dCkJ5DPA1MCj81dPi5ZfCM/vE0N8I6LEV+RyC7bb4YVO/PoicFjb2j8vfLvldOUrsvkNH51dZusQKBgQDpMHacOBpIuVzEFfNtS9SgA96cUV6NCSmHoQppJ/p9xKzY4DpcqoOCIBT4WCvVe6PeN5mrjzt8Q5gJWxiq0tVgIF9k8GjLmuiJ2v4Qh8aUmlRwn0T0DYiX/Y7uzX+pRlkpoKrSktlTOT9vmGwZDGDk0h2+H3hZ3YQEucfA6bhHmQKBgQDTbHrbr1WsUR9lrdLaGi/Uphpl3BXLuCnJXav3yIZOktO5V68MfPZXLP7aaNtbK3n0YHD+Uv8wpHBBSWQYjVYlGdvlniA/W1pr73GZJECFfS1BmmFC4GG3E92D5IkmrcPlUuz8XxKrlwHnfW1F0MoDvhp930vS0tS6u+WYTt9dRwKBgCeEQPVkRIACeYf5OFFTQmsDfNv8pgs8fD8xuTPsxHQ/uhLenMVLWBHbIfKb7oG0/CYSQgZitW/vfHpJZ7q7E9HAaqoOW5P1YmbKJ7fhanOQW7LiKqs5B+bJ30j0piendkCpq4kXvaBu2SMuL1NnV5wvRz8K0jhYY6DxYrp8YPAxAoGAZxWTaZ25tgTvvBHeprzx6Ur7wAJpFiU7KpVjjbLV2WW5mbro/LvJGIQ11qQdn/w4wDBtp3MsPblPimWQSnBPOlO7Zd+NdZbDJbFfv/1vACcic8Qj/AmPW0ZyUSaSwKskwqGGLx7j6Yn9QbNkHhBJDz4XiJvhSm/FjS6kKXj7a20CgYEArnEiPmL5g1Ca/qKK9ql8Q6P9gipIfGGpaFu23y0trbcFpVn8Oos/ic0Jgw4Xiz+rqvb6bW2V6lqBJ+9/kdn0i7zlZxKNpYsW2xFgi04OU3d5HkGL16Y1rpqMYYEhjFaOIn7J8P046UYR99yaybgQd18TE6oFrX8OL5uY8M4ge4Y="; // private static final String MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAlcIeANdqipul3/qAIRlknSacHiFCMzLzUJisGcr9ipm3p2rir8WDsac2MxgtUt+f89SGNoWyjv4q0/QAKQQTd5U3KuGAksCJLBGVibuFe7G7YGYVezUksjvocvp8GIinCIkzq67KL2SOpGXAu3s+282rx8AxdTZA/EhXQvbORbWz5+DamyY+wS7Maa8KmIOb6WZPtiXgENZxDHAafrqW8Gt1BnVfJNf5yS5J9Wl+LcR1EPvi5iH8dSIdn1ZMVupoREjV/DvItSogVehsqTRZWuekAo2xH9YEli1UMG/l3deViRn/A4VmPPzdv0xXpn/yO+OTjWez+KmSmJfAZXBvAgMBAAECggEABRYviWFWTz8X+1qeIDI/nHO2KFt3X2tAxkJztd/8h5PYmYw3e4NPATp5Ayp4UgIlW/ExxNW91EiImBL/F939eJIpA8sDJ8U4hqb+U+fOZyksOZnDOIAHmE+I24vl588yFM9Z6F55gGeeDVJ0SZHqIG/nz8i339aLt02yj3N6V1peQugBP6L9arcD+gVu4F70whkqW+lHBK/WzX1OazqEx3Ip175jqzi9/0vO/h/kqnGGXuMi2VeuAPsa+d0a6lf/FScxqCt3t6dCkJ5DPA1MCj81dPi5ZfCM/vE0N8I6LEV+RyC7bb4YVO/PoicFjb2j8vfLvldOUrsvkNH51dZusQKBgQDpMHacOBpIuVzEFfNtS9SgA96cUV6NCSmHoQppJ/p9xKzY4DpcqoOCIBT4WCvVe6PeN5mrjzt8Q5gJWxiq0tVgIF9k8GjLmuiJ2v4Qh8aUmlRwn0T0DYiX/Y7uzX+pRlkpoKrSktlTOT9vmGwZDGDk0h2+H3hZ3YQEucfA6bhHmQKBgQDTbHrbr1WsUR9lrdLaGi/Uphpl3BXLuCnJXav3yIZOktO5V68MfPZXLP7aaNtbK3n0YHD+Uv8wpHBBSWQYjVYlGdvlniA/W1pr73GZJECFfS1BmmFC4GG3E92D5IkmrcPlUuz8XxKrlwHnfW1F0MoDvhp930vS0tS6u+WYTt9dRwKBgCeEQPVkRIACeYf5OFFTQmsDfNv8pgs8fD8xuTPsxHQ/uhLenMVLWBHbIfKb7oG0/CYSQgZitW/vfHpJZ7q7E9HAaqoOW5P1YmbKJ7fhanOQW7LiKqs5B+bJ30j0piendkCpq4kXvaBu2SMuL1NnV5wvRz8K0jhYY6DxYrp8YPAxAoGAZxWTaZ25tgTvvBHeprzx6Ur7wAJpFiU7KpVjjbLV2WW5mbro/LvJGIQ11qQdn/w4wDBtp3MsPblPimWQSnBPOlO7Zd+NdZbDJbFfv/1vACcic8Qj/AmPW0ZyUSaSwKskwqGGLx7j6Yn9QbNkHhBJDz4XiJvhSm/FjS6kKXj7a20CgYEArnEiPmL5g1Ca/qKK9ql8Q6P9gipIfGGpaFu23y0trbcFpVn8Oos/ic0Jgw4Xiz+rqvb6bW2V6lqBJ+9/kdn0i7zlZxKNpYsW2xFgi04OU3d5HkGL16Y1rpqMYYEhjFaOIn7J8P046UYR99yaybgQd18TE6oFrX8OL5uY8M4ge4Y=";
...@@ -89,390 +89,390 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc ...@@ -89,390 +89,390 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
// private static final String OUT_VENDOR_ID = "071301"; // private static final String OUT_VENDOR_ID = "071301";
// private static final String PROJECT_ID = "PJ14001401B000160171"; // private static final String PROJECT_ID = "PJ14001401B000160171";
// 测试环境 // 测试环境
@Value("${hygf.icbc.appId}") @Value("${hygf.icbc.appId}")
private String APP_ID; private String APP_ID;
@Value("${hygf.icbc.corpNo}") @Value("${hygf.icbc.corpNo}")
private String corpNo; private String corpNo;
@Value("${hygf.icbc.myPrivateKey}") @Value("${hygf.icbc.myPrivateKey}")
private String MY_PRIVATE_KEY; private String MY_PRIVATE_KEY;
@Value("${hygf.icbc.serviceUrl}") @Value("${hygf.icbc.serviceUrl}")
private String serviceUrl; private String serviceUrl;
@Value("${hygf.icbc.aesKey}") @Value("${hygf.icbc.aesKey}")
private String AES_Key; private String AES_Key;
@Value("${hygf.icbc.camsPublicKey}") @Value("${hygf.icbc.camsPublicKey}")
private String CAMS_PUBLIC_KEY; private String CAMS_PUBLIC_KEY;
@Value("${hygf.icbc.apigwPublicKey}") @Value("${hygf.icbc.apigwPublicKey}")
private String APIGW_PUBLIC_KEY; private String APIGW_PUBLIC_KEY;
@Value("${hygf.icbc.outVendorId}") @Value("${hygf.icbc.outVendorId}")
private String OUT_VENDOR_ID; private String OUT_VENDOR_ID;
@Value("${hygf.icbc.projectId}") @Value("${hygf.icbc.projectId}")
private String PROJECT_ID; private String PROJECT_ID;
/** /**
* 协议总限额 * 协议总限额
*/ */
@Value("${hygf.icbc.protocolLimitAmount:2500000000}") @Value("${hygf.icbc.protocolLimitAmount:2500000000}")
private String protocolLimitAmount; private String protocolLimitAmount;
/** /**
* 单笔限额 * 单笔限额
*/ */
@Value("${hygf.icbc.trxLmtAmt:10000000}") @Value("${hygf.icbc.trxLmtAmt:10000000}")
private String trxLmtAmt; private String trxLmtAmt;
/** /**
* 日累计限额 * 日累计限额
*/ */
@Value("${hygf.icbc.dayLmtAmt:20000000}") @Value("${hygf.icbc.dayLmtAmt:20000000}")
private String dayLmtAmt; private String dayLmtAmt;
@Value("${hygf.icbc.loanTotalAmt:0}") @Value("${hygf.icbc.loanTotalAmt:0}")
private String loanTotalAmt; private String loanTotalAmt;
/** /**
* 合作方接收结果通知 URL * 合作方接收结果通知 URL
*/ */
@Value("${hygf.icbc.callbackUrl:}") @Value("${hygf.icbc.callbackUrl:}")
private String callbackUrl; private String callbackUrl;
@Resource(type = PeasantHouseholdServiceImpl.class) @Resource(type = PeasantHouseholdServiceImpl.class)
private PeasantHouseholdServiceImpl peasantHouseholdService; private PeasantHouseholdServiceImpl peasantHouseholdService;
@Resource(type = HygfIcbcRecordMapper.class) @Resource(type = HygfIcbcRecordMapper.class)
private HygfIcbcRecordMapper hygfIcbcRecordMapper; private HygfIcbcRecordMapper hygfIcbcRecordMapper;
@Resource(type = HouseholdContractMapper.class) @Resource(type = HouseholdContractMapper.class)
private HouseholdContractMapper householdContractMapper; private HouseholdContractMapper householdContractMapper;
@Resource(type = PowerStationEngineeringInfoMapper.class) @Resource(type = PowerStationEngineeringInfoMapper.class)
private PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper; private PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Resource(type = HygfIcbcRequestMapper.class) @Resource(type = HygfIcbcRequestMapper.class)
private HygfIcbcRequestMapper hygfIcbcRequestMapper; private HygfIcbcRequestMapper hygfIcbcRequestMapper;
public void icbcRegisterWalletUrl(HttpServletRequest req, HttpServletResponse resp) { public void icbcRegisterWalletUrl(HttpServletRequest req, HttpServletResponse resp) {
try { try {
UiIcbcClient client = new UiIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY, UiIcbcClient client = new UiIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,
IcbcConstants.CHARSET_UTF8); IcbcConstants.CHARSET_UTF8);
String userId = req.getParameter("userId"); String userId = req.getParameter("userId");
// String userId = "071301"; // String userId = "071301";
JftUiUserEntrustopenacctSubmitRequestV1 request = new JftUiUserEntrustopenacctSubmitRequestV1(); JftUiUserEntrustopenacctSubmitRequestV1 request = new JftUiUserEntrustopenacctSubmitRequestV1();
request.setServiceUrl(serviceUrl + "/ui/jft/ui/user/entrustopenacct/submit/V1"); request.setServiceUrl(serviceUrl + "/ui/jft/ui/user/entrustopenacct/submit/V1");
JftUiUserEntrustopenacctSubmitRequestV1.JftUiUserEntrustopenacctSubmitRequestV1Biz bizContent = new JftUiUserEntrustopenacctSubmitRequestV1.JftUiUserEntrustopenacctSubmitRequestV1Biz(); JftUiUserEntrustopenacctSubmitRequestV1.JftUiUserEntrustopenacctSubmitRequestV1Biz bizContent = new JftUiUserEntrustopenacctSubmitRequestV1.JftUiUserEntrustopenacctSubmitRequestV1Biz();
bizContent.setAppId(APP_ID); bizContent.setAppId(APP_ID);
bizContent.setCorpNo(corpNo); bizContent.setCorpNo(corpNo);
bizContent.setOutUserId(userId); // 用户唯一id bizContent.setOutUserId(userId); // 用户唯一id
bizContent.setCorpSerno(UUID.randomUUID().toString()); bizContent.setCorpSerno(UUID.randomUUID().toString());
bizContent.setTrxChannel(trxChannel); bizContent.setTrxChannel(trxChannel);
bizContent.setSignProtocol("1"); // 是否对接缴费代扣流程 bizContent.setSignProtocol("1"); // 是否对接缴费代扣流程
bizContent.setOutVendorId(OUT_VENDOR_ID); // 企业外系统编号 bizContent.setOutVendorId(OUT_VENDOR_ID); // 企业外系统编号
bizContent.setProjectId(PROJECT_ID); // 缴费项目编号 bizContent.setProjectId(PROJECT_ID); // 缴费项目编号
bizContent.setBusiCode(userId); // 缴费编号 bizContent.setBusiCode(userId); // 缴费编号
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Date date = new Date();// 当前时间 Date date = new Date();// 当前时间
calendar.setTime(date); calendar.setTime(date);
int year = 26;// 26年 int year = 26;// 26年
calendar.add(Calendar.YEAR, year);// 在年份增加 calendar.add(Calendar.YEAR, year);// 在年份增加
Date newDate = calendar.getTime(); Date newDate = calendar.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String formattedDate = formatter.format(newDate); String formattedDate = formatter.format(newDate);
bizContent.setProtocolEndDate(formattedDate); // 协议到期日 bizContent.setProtocolEndDate(formattedDate); // 协议到期日
bizContent.setProtocolLimitAmount(protocolLimitAmount); // 协议累计额 bizContent.setProtocolLimitAmount(protocolLimitAmount); // 协议累计额
JSONObject templateParams = new JSONObject(); JSONObject templateParams = new JSONObject();
templateParams.put("prtl_enddate", formattedDate);// 协议到期日 templateParams.put("prtl_enddate", formattedDate);// 协议到期日
templateParams.put("loan_total_amt", loanTotalAmt);// 贷款限额(单位:分) templateParams.put("loan_total_amt", loanTotalAmt);// 贷款限额(单位:分)
templateParams.put("trx_lmt_amt", trxLmtAmt);// 单笔限额(单位:分) templateParams.put("trx_lmt_amt", trxLmtAmt);// 单笔限额(单位:分)
templateParams.put("day_lmt_amt", dayLmtAmt);// 日累计限额(单位:分) templateParams.put("day_lmt_amt", dayLmtAmt);// 日累计限额(单位:分)
bizContent.setTemplateParams(templateParams.toJSONString()); bizContent.setTemplateParams(templateParams.toJSONString());
bizContent.setCallbackUrl(callbackUrl); bizContent.setCallbackUrl(callbackUrl);
bizContent.setCamsPublicKey(CAMS_PUBLIC_KEY); bizContent.setCamsPublicKey(CAMS_PUBLIC_KEY);
request.setBizContent(bizContent); request.setBizContent(bizContent);
// 调用工行 SDK,生成自动提交表单,将用户跳转到收方入驻页面 // 调用工行 SDK,生成自动提交表单,将用户跳转到收方入驻页面
log.info("聚富通委托代扣签约同步开户页面接口V1, 入参 => {}", JSON.toJSONString(request)); log.info("聚富通委托代扣签约同步开户页面接口V1, 入参 => {}", JSON.toJSONString(request));
//添加上送日志存储 //添加上送日志存储
HygfIcbcRequest hygfIcbcRequest = new HygfIcbcRequest(); HygfIcbcRequest hygfIcbcRequest = new HygfIcbcRequest();
hygfIcbcRequest.setPhase("请求"); hygfIcbcRequest.setPhase("请求");
hygfIcbcRequest.setContent(JSONObject.toJSONString(request)); hygfIcbcRequest.setContent(JSONObject.toJSONString(request));
hygfIcbcRequest.setRecDate(new Date()); hygfIcbcRequest.setRecDate(new Date());
hygfIcbcRequestMapper.insert(hygfIcbcRequest); hygfIcbcRequestMapper.insert(hygfIcbcRequest);
String form = client.buildPostForm(request); String form = client.buildPostForm(request);
log.info("聚富通委托代扣签约同步开户页面接口V1, 响应 => {}", form); log.info("聚富通委托代扣签约同步开户页面接口V1, 响应 => {}", form);
resp.setHeader("Content-Type", "text/html;charset=" + IcbcConstants.CHARSET_UTF8); resp.setHeader("Content-Type", "text/html;charset=" + IcbcConstants.CHARSET_UTF8);
PrintWriter out = resp.getWriter(); PrintWriter out = resp.getWriter();
out.write("<html>"); out.write("<html>");
out.write("<head>"); out.write("<head>");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=" + IcbcConstants.CHARSET_UTF8 out.write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=" + IcbcConstants.CHARSET_UTF8
+ "\">"); + "\">");
out.write("</head>"); out.write("</head>");
out.write("<body>"); out.write("<body>");
out.write(form); out.write(form);
out.write("</body>"); out.write("</body>");
out.write("</html>"); out.write("</html>");
} catch (IcbcApiException e) { } catch (IcbcApiException e) {
log.error("聚富通委托代扣签约同步开户页面接口V1, error => ", e); log.error("聚富通委托代扣签约同步开户页面接口V1, error => ", e);
throw new BadRequest(e.getErrMsg()); throw new BadRequest(e.getErrMsg());
} catch (Exception e) { } catch (Exception e) {
log.error("聚富通委托代扣签约同步开户页面接口V1, error => ", e); log.error("聚富通委托代扣签约同步开户页面接口V1, error => ", e);
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
public JftApiUserEntrustopenacctQueryResponseV1 getHygfIcbcWalletInfo(String userId) { public JftApiUserEntrustopenacctQueryResponseV1 getHygfIcbcWalletInfo(String userId) {
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY, DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,
IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES, IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES,
AES_Key, "", ""); AES_Key, "", "");
JftApiUserEntrustopenacctQueryRequestV1 request = new JftApiUserEntrustopenacctQueryRequestV1(); JftApiUserEntrustopenacctQueryRequestV1 request = new JftApiUserEntrustopenacctQueryRequestV1();
request.setServiceUrl(serviceUrl + "/api/jft/api/user/entrustopenacct/query/V1"); request.setServiceUrl(serviceUrl + "/api/jft/api/user/entrustopenacct/query/V1");
JftApiUserEntrustopenacctQueryRequestV1.JftApiUserEntrustopenacctQueryRequestV1Biz bizContent = new JftApiUserEntrustopenacctQueryRequestV1.JftApiUserEntrustopenacctQueryRequestV1Biz(); JftApiUserEntrustopenacctQueryRequestV1.JftApiUserEntrustopenacctQueryRequestV1Biz bizContent = new JftApiUserEntrustopenacctQueryRequestV1.JftApiUserEntrustopenacctQueryRequestV1Biz();
bizContent.setAppId(APP_ID); bizContent.setAppId(APP_ID);
bizContent.setOutVendorId(OUT_VENDOR_ID); bizContent.setOutVendorId(OUT_VENDOR_ID);
bizContent.setOutUserId(userId); bizContent.setOutUserId(userId);
bizContent.setProjectId(PROJECT_ID); bizContent.setProjectId(PROJECT_ID);
bizContent.setBusiCode(userId); bizContent.setBusiCode(userId);
request.setBizContent(bizContent); request.setBizContent(bizContent);
JftApiUserEntrustopenacctQueryResponseV1 response; JftApiUserEntrustopenacctQueryResponseV1 response;
try { try {
log.info("聚富通委托代扣签约同步开户结果查询数据接口V1, => 入参: {}", JSON.toJSONString(request)); log.info("聚富通委托代扣签约同步开户结果查询数据接口V1, => 入参: {}", JSON.toJSONString(request));
response = client.execute(request, System.currentTimeMillis() + ""); response = client.execute(request, System.currentTimeMillis() + "");
log.info("聚富通委托代扣签约同步开户结果查询数据接口V1, => 响应: {}", JSON.toJSONString(response)); log.info("聚富通委托代扣签约同步开户结果查询数据接口V1, => 响应: {}", JSON.toJSONString(response));
if (response.isSuccess()) { if (response.isSuccess()) {
return response; return response;
} else { } else {
// 失败 // 失败
throw new BadRequest(response.getReturnMsg()); throw new BadRequest(response.getReturnMsg());
} }
} catch (IcbcApiException e) { } catch (IcbcApiException e) {
e.printStackTrace(); e.printStackTrace();
log.error("聚富通委托代扣签约同步开户结果查询数据接口V1 error => ", e); log.error("聚富通委托代扣签约同步开户结果查询数据接口V1 error => ", e);
throw new BadRequest(e.getErrMsg()); throw new BadRequest(e.getErrMsg());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("聚富通委托代扣签约同步开户结果查询数据接口V1 error => ", e); log.error("聚富通委托代扣签约同步开户结果查询数据接口V1 error => ", e);
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
/** /**
* 户用光伏开户签约异步通知使用 * 户用光伏开户签约异步通知使用
* *
* @param request request * @param request request
* @param response response * @param response response
* @return {@link Object} * @return {@link Object}
* @throws @author yangyang * @throws @author yangyang
* @date 2024/7/18 20:15 * @date 2024/7/18 20:15
*/ */
public Object registerWalletCallback(HttpServletRequest request, HttpServletResponse response) throws Exception { public Object registerWalletCallback(HttpServletRequest request, HttpServletResponse response) throws Exception {
log.info("户用光伏开户签约异步通知, => 验签"); log.info("户用光伏开户签约异步通知, => 验签");
String returnJson; String returnJson;
// 网关公钥 // 网关公钥
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
String api = request.getParameter("api"); String api = request.getParameter("api");
String from = request.getParameter("from"); String from = request.getParameter("from");
String app_id = request.getParameter("app_id"); String app_id = request.getParameter("app_id");
String charset = request.getParameter("charset"); String charset = request.getParameter("charset");
String format = request.getParameter("format"); String format = request.getParameter("format");
String encrypt_type = request.getParameter("encrypt_type"); String encrypt_type = request.getParameter("encrypt_type");
String timestamp = request.getParameter("timestamp"); String timestamp = request.getParameter("timestamp");
String biz_content = request.getParameter("biz_content"); String biz_content = request.getParameter("biz_content");
String sign_type = request.getParameter("sign_type"); String sign_type = request.getParameter("sign_type");
String sign = request.getParameter("sign"); String sign = request.getParameter("sign");
params.put("from", from); params.put("from", from);
params.put("api", api); params.put("api", api);
params.put("app_id", app_id); params.put("app_id", app_id);
params.put("charset", charset); params.put("charset", charset);
params.put("format", format); params.put("format", format);
params.put("encrypt_type", encrypt_type); params.put("encrypt_type", encrypt_type);
params.put("timestamp", timestamp); params.put("timestamp", timestamp);
// params.put("biz_content", // params.put("biz_content",
// "{\"busiCode\":\"11098243\",\"return_msg\":\"success\",\"outUserId\":\"11098243\",\"custName\":\"5p2O5Y2r5Lic\",\"marketingStaffId\":\"\",\"newPayAcc\":\"NjIxNDc2MTUwMjYwMjc5MDc4OQ==\",\"signEntrsutPrtlSucceedFlag\":\"1\",\"certNo\":\"MjI5MDA1MTk3MzEwMjUwMjFY\",\"appId\":\"11000000000000028870\",\"msg_id\":\"20240814190453416\",\"projectId\":\"PJ140014023565102203\",\"openAccoutSucceedFlag\":\"02\",\"return_code\":0}"); // "{\"busiCode\":\"11098243\",\"return_msg\":\"success\",\"outUserId\":\"11098243\",\"custName\":\"5p2O5Y2r5Lic\",\"marketingStaffId\":\"\",\"newPayAcc\":\"NjIxNDc2MTUwMjYwMjc5MDc4OQ==\",\"signEntrsutPrtlSucceedFlag\":\"1\",\"certNo\":\"MjI5MDA1MTk3MzEwMjUwMjFY\",\"appId\":\"11000000000000028870\",\"msg_id\":\"20240814190453416\",\"projectId\":\"PJ140014023565102203\",\"openAccoutSucceedFlag\":\"02\",\"return_code\":0}");
params.put("biz_content", biz_content); params.put("biz_content", biz_content);
params.put("sign_type", sign_type);// 目前上行网关签名暂时仅支持RSA params.put("sign_type", sign_type);// 目前上行网关签名暂时仅支持RSA
params.put("sign", sign); params.put("sign", sign);
HygfIcbcRequest hygfIcbcRequest = new HygfIcbcRequest(); HygfIcbcRequest hygfIcbcRequest = new HygfIcbcRequest();
hygfIcbcRequest.setPhase("验签"); hygfIcbcRequest.setPhase("验签");
hygfIcbcRequest.setContent(JSONObject.toJSONString(params)); hygfIcbcRequest.setContent(JSONObject.toJSONString(params));
hygfIcbcRequest.setRecDate(new Date()); hygfIcbcRequest.setRecDate(new Date());
hygfIcbcRequestMapper.insert(hygfIcbcRequest); hygfIcbcRequestMapper.insert(hygfIcbcRequest);
try { try {
boolean verifyFlag = verifySignData(request, "/hygf/icbc/notify"); boolean verifyFlag = verifySignData(request, "/hygf/icbc/notify");
if (verifyFlag) { if (verifyFlag) {
// 验签成功 // 验签成功
hygfIcbcRequest.setPhase("查询"); hygfIcbcRequest.setPhase("查询");
hygfIcbcRequestMapper.updateById(hygfIcbcRequest); hygfIcbcRequestMapper.updateById(hygfIcbcRequest);
// String biz_content = request.getParameter("biz_content"); // String biz_content = request.getParameter("biz_content");
String decode = URLDecoder.decode(biz_content, "utf-8"); String decode = URLDecoder.decode(biz_content, "utf-8");
Map<String, String> data = JSONObject.parseObject(decode, Map.class); Map<String, String> data = JSONObject.parseObject(decode, Map.class);
log.debug("解密后参数:{}", data);// 进行自己的处理,此处默认处理成功,返回通知方成功,return_code=0 log.debug("解密后参数:{}", data);// 进行自己的处理,此处默认处理成功,返回通知方成功,return_code=0
// 其中certNo、custName、newPayAcc字段进行了base64编码,可以调用示例代码中的base64Decode进行解码 // 其中certNo、custName、newPayAcc字段进行了base64编码,可以调用示例代码中的base64Decode进行解码
// String custName = base64Decode(data.get("custName")); // String custName = base64Decode(data.get("custName"));
String certNo = base64Decode(data.get("certNo")); String certNo = base64Decode(data.get("certNo"));
String newPayAcc = base64Decode(data.get("newPayAcc")); String newPayAcc = base64Decode(data.get("newPayAcc"));
String outUserId = data.get("outUserId"); String outUserId = data.get("outUserId");
String projectId = data.get("projectId"); String projectId = data.get("projectId");
String openAccoutSucceedFlag = data.get("openAccoutSucceedFlag"); String openAccoutSucceedFlag = data.get("openAccoutSucceedFlag");
String signEntrsutPrtlSucceedFlag = data.get("signEntrsutPrtlSucceedFlag"); String signEntrsutPrtlSucceedFlag = data.get("signEntrsutPrtlSucceedFlag");
JftApiUserEntrustopenacctQueryResponseV1 hygfIcbcWalletInfo = this.getHygfIcbcWalletInfo(outUserId); JftApiUserEntrustopenacctQueryResponseV1 hygfIcbcWalletInfo = this.getHygfIcbcWalletInfo(outUserId);
// region 保存数据 // region 保存数据
HygfIcbcRecord hygfIcbcRecord = this.lambdaQuery().eq(HygfIcbcRecord::getAmosUserId, outUserId) HygfIcbcRecord hygfIcbcRecord = this.lambdaQuery().eq(HygfIcbcRecord::getAmosUserId, outUserId)
.last(" limit 1").one(); .last(" limit 1").one();
if (hygfIcbcRecord == null) { if (hygfIcbcRecord == null) {
hygfIcbcRecord = new HygfIcbcRecord(); hygfIcbcRecord = new HygfIcbcRecord();
} }
PeasantHousehold peasantHousehold = peasantHouseholdService.lambdaQuery() PeasantHousehold peasantHousehold = peasantHouseholdService.lambdaQuery()
.select(PeasantHousehold::getTelephone).eq(PeasantHousehold::getAmosUserId, outUserId) .select(PeasantHousehold::getTelephone).eq(PeasantHousehold::getAmosUserId, outUserId)
.last("limit 1").one(); .last("limit 1").one();
hygfIcbcRecord.setPhone(peasantHousehold != null ? peasantHousehold.getTelephone() : ""); hygfIcbcRecord.setPhone(peasantHousehold != null ? peasantHousehold.getTelephone() : "");
hygfIcbcRecord.setMediumId(newPayAcc); hygfIcbcRecord.setMediumId(newPayAcc);
hygfIcbcRecord.setProjectId(projectId); hygfIcbcRecord.setProjectId(projectId);
hygfIcbcRecord.setOpenAccountStatus(openAccoutSucceedFlag); hygfIcbcRecord.setOpenAccountStatus(openAccoutSucceedFlag);
hygfIcbcRecord.setSignEntrsutPrtlStatus(signEntrsutPrtlSucceedFlag); hygfIcbcRecord.setSignEntrsutPrtlStatus(signEntrsutPrtlSucceedFlag);
hygfIcbcRecord.setCustName(peasantHousehold.getOwnersName()); hygfIcbcRecord.setCustName(peasantHousehold.getOwnersName());
hygfIcbcRecord.setIdCard(certNo); hygfIcbcRecord.setIdCard(certNo);
hygfIcbcRequest.setPhase("组装"); hygfIcbcRequest.setPhase("组装");
hygfIcbcRequest.setException(data.get("custName") + " -> " + peasantHousehold.getOwnersName()); hygfIcbcRequest.setException(data.get("custName") + " -> " + peasantHousehold.getOwnersName());
hygfIcbcRequestMapper.updateById(hygfIcbcRequest); hygfIcbcRequestMapper.updateById(hygfIcbcRequest);
if (hygfIcbcWalletInfo != null) { if (hygfIcbcWalletInfo != null) {
hygfIcbcRecord.setCustName(hygfIcbcWalletInfo.getCustName()); hygfIcbcRecord.setCustName(hygfIcbcWalletInfo.getCustName());
hygfIcbcRecord.setIdCard(hygfIcbcWalletInfo.getCertNo()); hygfIcbcRecord.setIdCard(hygfIcbcWalletInfo.getCertNo());
hygfIcbcRecord.setProtocolStatus(hygfIcbcWalletInfo.getProtocolStatus()); hygfIcbcRecord.setProtocolStatus(hygfIcbcWalletInfo.getProtocolStatus());
hygfIcbcRecord.setProtocolStartTime(hygfIcbcWalletInfo.getProtocolStartDate()); hygfIcbcRecord.setProtocolStartTime(hygfIcbcWalletInfo.getProtocolStartDate());
hygfIcbcRecord.setProtocolEndTime(hygfIcbcWalletInfo.getProtocolEndDate()); hygfIcbcRecord.setProtocolEndTime(hygfIcbcWalletInfo.getProtocolEndDate());
hygfIcbcRecord.setTrxLimitAmount(hygfIcbcWalletInfo.getTrxLimitAmount()); hygfIcbcRecord.setTrxLimitAmount(hygfIcbcWalletInfo.getTrxLimitAmount());
hygfIcbcRecord.setDayLimitAmount(hygfIcbcWalletInfo.getDayLimitAmount()); hygfIcbcRecord.setDayLimitAmount(hygfIcbcWalletInfo.getDayLimitAmount());
hygfIcbcRecord.setProtocolLimitAmount(hygfIcbcWalletInfo.getProtocolLimitAmount()); hygfIcbcRecord.setProtocolLimitAmount(hygfIcbcWalletInfo.getProtocolLimitAmount());
hygfIcbcRecord.setAppId(hygfIcbcWalletInfo.getAppId()); hygfIcbcRecord.setAppId(hygfIcbcWalletInfo.getAppId());
hygfIcbcRecord.setOutUserId(hygfIcbcWalletInfo.getOutUserId()); hygfIcbcRecord.setOutUserId(hygfIcbcWalletInfo.getOutUserId());
hygfIcbcRecord.setOutVendorId(hygfIcbcWalletInfo.getOutVendorId()); hygfIcbcRecord.setOutVendorId(hygfIcbcWalletInfo.getOutVendorId());
} }
// hygfIcbcRecord.setDiscardStatus(); // hygfIcbcRecord.setDiscardStatus();
hygfIcbcRecord.setAmosUserId(outUserId); hygfIcbcRecord.setAmosUserId(outUserId);
hygfIcbcRecord.setRecDate(new Date()); hygfIcbcRecord.setRecDate(new Date());
hygfIcbcRecord.setType("二类卡");
hygfIcbcRequest.setPhase("入库");
hygfIcbcRequestMapper.updateById(hygfIcbcRequest); hygfIcbcRequest.setPhase("入库");
hygfIcbcRequestMapper.updateById(hygfIcbcRequest);
this.saveOrUpdate(hygfIcbcRecord);
// endregion this.saveOrUpdate(hygfIcbcRecord);
String copReturnCode = "0";// 通知合作方接收成功的返回码,固定 // endregion
String copReturnMsg = "success";// 合作方的返回信息,固定 String copReturnCode = "0";// 通知合作方接收成功的返回码,固定
String copReturnMsg = "success";// 合作方的返回信息,固定
hygfIcbcRequest.setPhase("加签返回");
hygfIcbcRequestMapper.updateById(hygfIcbcRequest); hygfIcbcRequest.setPhase("加签返回");
returnJson = sign(request, copReturnCode, copReturnMsg); hygfIcbcRequestMapper.updateById(hygfIcbcRequest);
log.info("通知响应json结果:{}", returnJson); returnJson = sign(request, copReturnCode, copReturnMsg);
return returnJson; log.info("通知响应json结果:{}", returnJson);
} else {// 验签失败 return returnJson;
hygfIcbcRequest.setPhase("验签失败"); } else {// 验签失败
hygfIcbcRequestMapper.updateById(hygfIcbcRequest); hygfIcbcRequest.setPhase("验签失败");
hygfIcbcRequestMapper.updateById(hygfIcbcRequest);
String copReturnCode = "‐12345";
String copReturnMsg = "icbc jft sign not pass."; String copReturnCode = "‐12345";
returnJson = sign(request, copReturnCode, copReturnMsg); String copReturnMsg = "icbc jft sign not pass.";
log.error("通知响应json结果:{}", returnJson); returnJson = sign(request, copReturnCode, copReturnMsg);
log.error("通知响应json结果:{}", returnJson);
}
} catch (Exception e) { }
log.error("户用光伏开户签约异步通知, => error:", e); } catch (Exception e) {
log.error("户用光伏开户签约异步通知, => error:", e);
hygfIcbcRequest.setException(JSONObject.toJSONString(e));
hygfIcbcRequest.setException(JSONObject.toJSONString(e));
hygfIcbcRequestMapper.updateById(hygfIcbcRequest);
String copReturnCode = "‐1"; hygfIcbcRequestMapper.updateById(hygfIcbcRequest);
String copReturnMsg = "icbc jft error"; String copReturnCode = "‐1";
returnJson = sign(request, copReturnCode, copReturnMsg); String copReturnMsg = "icbc jft error";
} returnJson = sign(request, copReturnCode, copReturnMsg);
return returnJson; }
} return returnJson;
}
public HygfIcbcRecordDTO getObject(String amosUserId) {
HygfIcbcRecord hygfIcbcRecord = this.lambdaQuery().eq(HygfIcbcRecord::getAmosUserId, amosUserId).last("limit 1") public HygfIcbcRecordDTO getObject(String amosUserId) {
.one(); HygfIcbcRecord hygfIcbcRecord = this.lambdaQuery().eq(HygfIcbcRecord::getAmosUserId, amosUserId).last("limit 1")
HygfIcbcRecordDTO hygfIcbcRecordDTO = new HygfIcbcRecordDTO(); .one();
if (hygfIcbcRecord == null) { HygfIcbcRecordDTO hygfIcbcRecordDTO = new HygfIcbcRecordDTO();
PeasantHousehold peasantHousehold = peasantHouseholdService.lambdaQuery() if (hygfIcbcRecord == null) {
.select(PeasantHousehold::getTelephone, PeasantHousehold::getOwnersName, PeasantHousehold peasantHousehold = peasantHouseholdService.lambdaQuery()
PeasantHousehold::getIdCard) .select(PeasantHousehold::getTelephone, PeasantHousehold::getOwnersName,
.eq(PeasantHousehold::getAmosUserId, amosUserId).last("limit 1").one(); PeasantHousehold::getIdCard)
.eq(PeasantHousehold::getAmosUserId, amosUserId).last("limit 1").one();
hygfIcbcRecordDTO.setCustName(peasantHousehold.getOwnersName());
hygfIcbcRecordDTO.setIdCard(peasantHousehold.getIdCard()); hygfIcbcRecordDTO.setCustName(peasantHousehold.getOwnersName());
hygfIcbcRecordDTO.setPhone(peasantHousehold.getTelephone()); hygfIcbcRecordDTO.setIdCard(peasantHousehold.getIdCard());
hygfIcbcRecordDTO.setOpenAccountStatus(IcbcEnum.OpenAccountState.INITIAL.getCode()); hygfIcbcRecordDTO.setPhone(peasantHousehold.getTelephone());
hygfIcbcRecordDTO.setOpenAccountStatusName(IcbcEnum.OpenAccountState.getNameByCode( hygfIcbcRecordDTO.setOpenAccountStatus(IcbcEnum.OpenAccountState.INITIAL.getCode());
IcbcEnum.OpenAccountState.INITIAL.getCode(), IcbcEnum.OpenAccountState.INITIAL.getName())); hygfIcbcRecordDTO.setOpenAccountStatusName(IcbcEnum.OpenAccountState.getNameByCode(
} else if (IcbcEnum.OpenAccountState.FAIL.getCode().equals(hygfIcbcRecord.getOpenAccountStatus())) { IcbcEnum.OpenAccountState.INITIAL.getCode(), IcbcEnum.OpenAccountState.INITIAL.getName()));
Bean.toModel(hygfIcbcRecord, hygfIcbcRecordDTO); } else if (IcbcEnum.OpenAccountState.FAIL.getCode().equals(hygfIcbcRecord.getOpenAccountStatus())) {
PeasantHousehold peasantHousehold = peasantHouseholdService.lambdaQuery() Bean.toModel(hygfIcbcRecord, hygfIcbcRecordDTO);
.select(PeasantHousehold::getTelephone, PeasantHousehold::getOwnersName, PeasantHousehold peasantHousehold = peasantHouseholdService.lambdaQuery()
PeasantHousehold::getIdCard) .select(PeasantHousehold::getTelephone, PeasantHousehold::getOwnersName,
.eq(PeasantHousehold::getAmosUserId, amosUserId).last("limit 1").one(); PeasantHousehold::getIdCard)
.eq(PeasantHousehold::getAmosUserId, amosUserId).last("limit 1").one();
hygfIcbcRecordDTO.setCustName(peasantHousehold.getOwnersName());
hygfIcbcRecordDTO.setIdCard(peasantHousehold.getIdCard()); hygfIcbcRecordDTO.setCustName(peasantHousehold.getOwnersName());
hygfIcbcRecordDTO.setPhone(peasantHousehold.getTelephone()); hygfIcbcRecordDTO.setIdCard(peasantHousehold.getIdCard());
hygfIcbcRecordDTO.setOpenAccountStatusName(IcbcEnum.OpenAccountState.getNameByCode( hygfIcbcRecordDTO.setPhone(peasantHousehold.getTelephone());
hygfIcbcRecordDTO.getOpenAccountStatus(), IcbcEnum.OpenAccountState.INITIAL.getName())); hygfIcbcRecordDTO.setOpenAccountStatusName(IcbcEnum.OpenAccountState.getNameByCode(
hygfIcbcRecordDTO.setProtocolStatusName( hygfIcbcRecordDTO.getOpenAccountStatus(), IcbcEnum.OpenAccountState.INITIAL.getName()));
IcbcEnum.ProtocolStatus.getNameByCode(hygfIcbcRecordDTO.getProtocolStatus(), "")); hygfIcbcRecordDTO.setProtocolStatusName(
} else { IcbcEnum.ProtocolStatus.getNameByCode(hygfIcbcRecordDTO.getProtocolStatus(), ""));
Bean.toModel(hygfIcbcRecord, hygfIcbcRecordDTO); } else {
hygfIcbcRecordDTO.setOpenAccountStatusName(IcbcEnum.OpenAccountState.getNameByCode( Bean.toModel(hygfIcbcRecord, hygfIcbcRecordDTO);
hygfIcbcRecordDTO.getOpenAccountStatus(), IcbcEnum.OpenAccountState.INITIAL.getName())); hygfIcbcRecordDTO.setOpenAccountStatusName(IcbcEnum.OpenAccountState.getNameByCode(
hygfIcbcRecordDTO.setProtocolStatusName( hygfIcbcRecordDTO.getOpenAccountStatus(), IcbcEnum.OpenAccountState.INITIAL.getName()));
IcbcEnum.ProtocolStatus.getNameByCode(hygfIcbcRecordDTO.getProtocolStatus(), "")); hygfIcbcRecordDTO.setProtocolStatusName(
} IcbcEnum.ProtocolStatus.getNameByCode(hygfIcbcRecordDTO.getProtocolStatus(), ""));
List<String> amosUserIds = Arrays.asList(amosUserId); }
List<PeasantHousehold> peasantHouseholds = peasantHouseholdService.lambdaQuery() List<String> amosUserIds = Arrays.asList(amosUserId);
.in(PeasantHousehold::getAmosUserId, amosUserIds).list(); List<PeasantHousehold> peasantHouseholds = peasantHouseholdService.lambdaQuery()
Map<String, List<PeasantHousehold>> peasantHouseholdMap = peasantHouseholds.stream() .in(PeasantHousehold::getAmosUserId, amosUserIds).list();
.collect(Collectors.groupingBy(PeasantHousehold::getAmosUserId));// 根据农户 ID 分组 Map<String, List<PeasantHousehold>> peasantHouseholdMap = peasantHouseholds.stream()
List<PeasantHousehold> peasantHouseholdList = peasantHouseholdMap.get(amosUserId); .collect(Collectors.groupingBy(PeasantHousehold::getAmosUserId));// 根据农户 ID 分组
List<PeasantHousehold> peasantHouseholdList = peasantHouseholdMap.get(amosUserId);
if (peasantHouseholdList != null && peasantHouseholdList.size() > 0) {
peasantHouseholdList.forEach(e -> { if (peasantHouseholdList != null && peasantHouseholdList.size() > 0) {
if (e.getSurveyInformationId() != null) { peasantHouseholdList.forEach(e -> {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo())); if (e.getSurveyInformationId() != null) {
e.setRealScale(powerStationEngineeringInfoMapper e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo()));
.getRealScaleByPeasantHouseholdNo(e.getPeasantHouseholdNo())); e.setRealScale(powerStationEngineeringInfoMapper
} .getRealScaleByPeasantHouseholdNo(e.getPeasantHouseholdNo()));
}); }
} });
}
hygfIcbcRecordDTO.setPeasantHouseholds(
Bean.toModels(peasantHouseholdList, HygfIcbcRecordDTO.IcbcPeasantHousehold.class)); hygfIcbcRecordDTO.setPeasantHouseholds(
return hygfIcbcRecordDTO; Bean.toModels(peasantHouseholdList, HygfIcbcRecordDTO.IcbcPeasantHousehold.class));
} return hygfIcbcRecordDTO;
}
public List<HygfIcbcRecordDTO> listObject(HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.listObject(hygfIcbcRecordQueryDTO); public List<HygfIcbcRecordDTO> listObject(HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
return toModels(list); List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.listObject(hygfIcbcRecordQueryDTO);
} return toModels(list);
}
public Map<String, Object> queryForPage(int current, int size, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
PageHelper.startPage(current, size); public Map<String, Object> queryForPage(int current, int size, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.pageList(hygfIcbcRecordQueryDTO); PageHelper.startPage(current, size);
List<HygfIcbcRecordDTO> list = hygfIcbcRecordMapper.pageList(hygfIcbcRecordQueryDTO);
PageInfo<HygfIcbcRecordDTO> page = new PageInfo(list); PageInfo<HygfIcbcRecordDTO> page = new PageInfo(list);
Page<HygfIcbcRecordDTO> pagenew = new Page<>(); Page<HygfIcbcRecordDTO> pagenew = new Page<>();
pagenew.setCurrent(current); pagenew.setCurrent(current);
pagenew.setTotal(page.getTotal()); pagenew.setTotal(page.getTotal());
pagenew.setSize(size); pagenew.setSize(size);
pagenew.setRecords(toModels(page.getList())); pagenew.setRecords(toModels(page.getList()));
Map<String, Object> resultMap = BeanUtil.beanToMap(pagenew); Map<String, Object> resultMap = BeanUtil.beanToMap(pagenew);
List<HygfIcbcRecordDTO> list1 = hygfIcbcRecordMapper.pageListSum(hygfIcbcRecordQueryDTO); List<HygfIcbcRecordDTO> list1 = hygfIcbcRecordMapper.pageListSum(hygfIcbcRecordQueryDTO);
double sum = list1.stream().filter(e->null != e.getPaymentAmount()).mapToDouble(HygfIcbcRecordDTO::getPaymentAmount).sum(); double sum = list1.stream().filter(e -> null != e.getPaymentAmount()).mapToDouble(HygfIcbcRecordDTO::getPaymentAmount).sum();
resultMap.put("paymentAmountAll",sum); resultMap.put("paymentAmountAll", sum);
return resultMap; return resultMap;
// ======================================================統計錯誤================================================================= // ======================================================統計錯誤=================================================================
// // PageHelper.startPage(current, size); // // PageHelper.startPage(current, size);
...@@ -491,208 +491,455 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc ...@@ -491,208 +491,455 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
// page.setTotal(total); // page.setTotal(total);
// page.setRecords(toModels(list)); // page.setRecords(toModels(list));
// return page; // return page;
} }
private List<HygfIcbcRecordDTO> toModels(List<HygfIcbcRecordDTO> hygfIcbcRecords) { private List<HygfIcbcRecordDTO> toModels(List<HygfIcbcRecordDTO> hygfIcbcRecords) {
if (CollectionUtils.isEmpty(hygfIcbcRecords)) { if (CollectionUtils.isEmpty(hygfIcbcRecords)) {
return Collections.emptyList(); return Collections.emptyList();
} }
List<String> amosUserIds = hygfIcbcRecords.stream().map(HygfIcbcRecordDTO::getAmosUserId) List<String> amosUserIds = hygfIcbcRecords.stream().map(HygfIcbcRecordDTO::getAmosUserId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<PeasantHousehold> peasantHouseholds = peasantHouseholdService.lambdaQuery() List<PeasantHousehold> peasantHouseholds = peasantHouseholdService.lambdaQuery()
.select(PeasantHousehold::getAmosUserId, PeasantHousehold::getRegionalCompaniesName, .select(PeasantHousehold::getAmosUserId, PeasantHousehold::getRegionalCompaniesName,
PeasantHousehold::getOwnersName, PeasantHousehold::getIdCard, PeasantHousehold::getTelephone) PeasantHousehold::getOwnersName, PeasantHousehold::getIdCard, PeasantHousehold::getTelephone)
.in(PeasantHousehold::getAmosUserId, amosUserIds).list(); .in(PeasantHousehold::getAmosUserId, amosUserIds).list();
Map<String, List<PeasantHousehold>> PeasantHouseholdMap = peasantHouseholds.stream() Map<String, List<PeasantHousehold>> PeasantHouseholdMap = peasantHouseholds.stream()
.collect(Collectors.groupingBy(PeasantHousehold::getAmosUserId));// 根据农户 ID 分组 .collect(Collectors.groupingBy(PeasantHousehold::getAmosUserId));// 根据农户 ID 分组
return hygfIcbcRecords.stream().map(hygfIcbcRecordDTO -> { return hygfIcbcRecords.stream().map(hygfIcbcRecordDTO -> {
hygfIcbcRecordDTO.setOpenAccountStatusName(IcbcEnum.OpenAccountState.getNameByCode( hygfIcbcRecordDTO.setOpenAccountStatusName(IcbcEnum.OpenAccountState.getNameByCode(
hygfIcbcRecordDTO.getOpenAccountStatus(), IcbcEnum.OpenAccountState.INITIAL.getName())); hygfIcbcRecordDTO.getOpenAccountStatus(), IcbcEnum.OpenAccountState.INITIAL.getName()));
hygfIcbcRecordDTO.setProtocolStatusName( hygfIcbcRecordDTO.setProtocolStatusName(
IcbcEnum.ProtocolStatus.getNameByCode(hygfIcbcRecordDTO.getProtocolStatus(), "")); IcbcEnum.ProtocolStatus.getNameByCode(hygfIcbcRecordDTO.getProtocolStatus(), ""));
List<PeasantHousehold> peasantHouseholdList = PeasantHouseholdMap.get(hygfIcbcRecordDTO.getAmosUserId()); List<PeasantHousehold> peasantHouseholdList = PeasantHouseholdMap.get(hygfIcbcRecordDTO.getAmosUserId());
// if (IcbcEnum.OpenAccountState.FAIL.getCode().equals(hygfIcbcRecordDTO.getOpenAccountStatus())) { // if (IcbcEnum.OpenAccountState.FAIL.getCode().equals(hygfIcbcRecordDTO.getOpenAccountStatus())) {
// hygfIcbcRecordDTO.setCustName(peasantHouseholds.get(0).getOwnersName()); // hygfIcbcRecordDTO.setCustName(peasantHouseholds.get(0).getOwnersName());
// hygfIcbcRecordDTO.setIdCard(peasantHouseholds.get(0).getIdCard()); // hygfIcbcRecordDTO.setIdCard(peasantHouseholds.get(0).getIdCard());
// hygfIcbcRecordDTO.setPhone(peasantHouseholds.get(0).getTelephone()); // hygfIcbcRecordDTO.setPhone(peasantHouseholds.get(0).getTelephone());
// } // }
if (!CollectionUtils.isEmpty(peasantHouseholdList)) { if (!CollectionUtils.isEmpty(peasantHouseholdList)) {
// 根据区域经销商名称去重 // 根据区域经销商名称去重
List<HygfIcbcRecordDTO.IcbcPeasantHousehold> icbcPeasantHouseholds = Bean.toModels(peasantHouseholdList, List<HygfIcbcRecordDTO.IcbcPeasantHousehold> icbcPeasantHouseholds = Bean.toModels(peasantHouseholdList,
HygfIcbcRecordDTO.IcbcPeasantHousehold.class); HygfIcbcRecordDTO.IcbcPeasantHousehold.class);
hygfIcbcRecordDTO.setPeasantHouseholds(icbcPeasantHouseholds.stream() hygfIcbcRecordDTO.setPeasantHouseholds(icbcPeasantHouseholds.stream()
.filter(distinctByKey(HygfIcbcRecordDTO.IcbcPeasantHousehold::getRegionalCompaniesName)) .filter(distinctByKey(HygfIcbcRecordDTO.IcbcPeasantHousehold::getRegionalCompaniesName))
.collect(Collectors.toList())); .collect(Collectors.toList()));
} }
return hygfIcbcRecordDTO; return hygfIcbcRecordDTO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
/** /**
* 验签方法 * 验签方法
* *
* @param request * @param request
* @param path * @param path
* @return * @return
* @throws Exception * @throws Exception
*/ */
private boolean verifySignData(HttpServletRequest request, String path) throws Exception { private boolean verifySignData(HttpServletRequest request, String path) throws Exception {
// 网关公钥 // 网关公钥
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
String api = request.getParameter("api"); String api = request.getParameter("api");
String from = request.getParameter("from"); String from = request.getParameter("from");
String app_id = request.getParameter("app_id"); String app_id = request.getParameter("app_id");
String charset = request.getParameter("charset"); String charset = request.getParameter("charset");
String format = request.getParameter("format"); String format = request.getParameter("format");
String encrypt_type = request.getParameter("encrypt_type"); String encrypt_type = request.getParameter("encrypt_type");
String timestamp = request.getParameter("timestamp"); String timestamp = request.getParameter("timestamp");
String biz_content = request.getParameter("biz_content"); String biz_content = request.getParameter("biz_content");
String sign_type = request.getParameter("sign_type"); String sign_type = request.getParameter("sign_type");
String sign = request.getParameter("sign"); String sign = request.getParameter("sign");
log.info( log.info(
"户用光伏开户签约异步通知, 入参,from:[[{}]], api:[[{}]], app_id:[[{}]], charset:[[{}]], format:[[{}]], encrypt_type:[[{}]], timestamp:[[{}]], biz_content:[[{}]], sign_type:[[{}]], sign:[[{}]]", "户用光伏开户签约异步通知, 入参,from:[[{}]], api:[[{}]], app_id:[[{}]], charset:[[{}]], format:[[{}]], encrypt_type:[[{}]], timestamp:[[{}]], biz_content:[[{}]], sign_type:[[{}]], sign:[[{}]]",
from, api, app_id, charset, format, encrypt_type); from, api, app_id, charset, format, encrypt_type);
params.put("from", from); params.put("from", from);
params.put("api", api); params.put("api", api);
params.put("app_id", app_id); params.put("app_id", app_id);
params.put("charset", charset); params.put("charset", charset);
params.put("format", format); params.put("format", format);
params.put("encrypt_type", encrypt_type); params.put("encrypt_type", encrypt_type);
params.put("timestamp", timestamp); params.put("timestamp", timestamp);
params.put("biz_content", biz_content); params.put("biz_content", biz_content);
params.put("sign_type", sign_type);// 目前上行网关签名暂时仅支持RSA params.put("sign_type", sign_type);// 目前上行网关签名暂时仅支持RSA
/********** 验证工行上行网关RSA签名 **********/ /********** 验证工行上行网关RSA签名 **********/
String signStr = WebUtils.buildOrderedSignStr(path, params); String signStr = WebUtils.buildOrderedSignStr(path, params);
log.info("验签入参,signStr:[[{}]], sign_type:[[{}]], APIGW_PUBLIC_KEY: [[{}]],charset:[[{}]],sign:[[{}]]", signStr, log.info("验签入参,signStr:[[{}]], sign_type:[[{}]], APIGW_PUBLIC_KEY: [[{}]],charset:[[{}]],sign:[[{}]]", signStr,
sign_type, APIGW_PUBLIC_KEY, charset, sign); sign_type, APIGW_PUBLIC_KEY, charset, sign);
boolean flag = IcbcSignature.verify(signStr, sign_type, APIGW_PUBLIC_KEY, charset, sign); boolean flag = IcbcSignature.verify(signStr, sign_type, APIGW_PUBLIC_KEY, charset, sign);
log.info("验签结果:[[{}]]", flag); log.info("验签结果:[[{}]]", flag);
return flag; return flag;
} }
/** /**
* 加签方法 * 加签方法
* *
* @param request * @param request
* @param copReturnCode * @param copReturnCode
* @param copReturnMsg * @param copReturnMsg
* @return * @return
* @throws Exception * @throws Exception
*/ */
private String sign(HttpServletRequest request, String copReturnCode, String copReturnMsg) throws Exception { private String sign(HttpServletRequest request, String copReturnCode, String copReturnMsg) throws Exception {
String msg_id = new SimpleDateFormat("yyyyMMdd").format(new Date()) String msg_id = new SimpleDateFormat("yyyyMMdd").format(new Date())
+ new SimpleDateFormat("HHmmss").format(new Date()); + new SimpleDateFormat("HHmmss").format(new Date());
String responseBizContent = "{\"return_code\":\"" + copReturnCode + "\",\"return_msg\":\"" + copReturnMsg + "\"" String responseBizContent = "{\"return_code\":\"" + copReturnCode + "\",\"return_msg\":\"" + copReturnMsg + "\""
+ ",\"msg_id\":\"" + msg_id + "\"}"; + ",\"msg_id\":\"" + msg_id + "\"}";
String charset = request.getParameter("charset");// 调用过程使用的编码格式 String charset = request.getParameter("charset");// 调用过程使用的编码格式
/********** /**********
* 商户对消息返回响应进行签名,签名方式需与在API平台登记APP的sign_type保持一致(目前基本都是RSA2) * 商户对消息返回响应进行签名,签名方式需与在API平台登记APP的sign_type保持一致(目前基本都是RSA2)
**********/ **********/
// String signType = IcbcConstants.SIGN_TYPE_RSA2; // String signType = IcbcConstants.SIGN_TYPE_RSA2;
String signType = IcbcConstants.SIGN_TYPE_RSA; String signType = IcbcConstants.SIGN_TYPE_RSA;
String signStr = "\"response_biz_content\":" + responseBizContent + "," + "\"sign_type\":" + "\"" + signType String signStr = "\"response_biz_content\":" + responseBizContent + "," + "\"sign_type\":" + "\"" + signType
+ "\""; + "\"";
String signParam = IcbcSignature.sign(signStr, signType, MY_PRIVATE_KEY, charset); String signParam = IcbcSignature.sign(signStr, signType, MY_PRIVATE_KEY, charset);
String returnJson = "{\"response_biz_content\":" + responseBizContent + ",\"sign_type\":\"" + signType + "\"" String returnJson = "{\"response_biz_content\":" + responseBizContent + ",\"sign_type\":\"" + signType + "\""
+ ",\"sign\":\"" + signParam + "\"}"; + ",\"sign\":\"" + signParam + "\"}";
return returnJson; return returnJson;
} }
/** /**
* base64Decode * base64Decode
* *
* @param str * @param str
* @return * @return
* @throws UnsupportedEncodingException * @throws UnsupportedEncodingException
*/ */
public String base64Decode(String str) throws UnsupportedEncodingException { public String base64Decode(String str) throws UnsupportedEncodingException {
if (str == null || "".equals(str)) { if (str == null || "".equals(str)) {
return ""; return "";
} }
char[] ch = str.toCharArray(); char[] ch = str.toCharArray();
byte[] bt = Base64.getDecoder().decode(String.valueOf(ch)); byte[] bt = Base64.getDecoder().decode(String.valueOf(ch));
return new String(bt, "UTF-8"); return new String(bt, "UTF-8");
} }
public static <T> Predicate<T> distinctByKey(Function<? super T, Object> distinctField) { public static <T> Predicate<T> distinctByKey(Function<? super T, Object> distinctField) {
Map<Object, Boolean> distinctMap = new ConcurrentHashMap<>(); Map<Object, Boolean> distinctMap = new ConcurrentHashMap<>();
return object -> distinctMap.putIfAbsent(distinctField.apply(object), Boolean.TRUE) == null; return object -> distinctMap.putIfAbsent(distinctField.apply(object), Boolean.TRUE) == null;
} }
public String repair(String userId) { public String repair(String userId) {
JftApiUserEntrustopenacctQueryResponseV1 hygfIcbcWalletInfo = getHygfIcbcWalletInfo(userId); JftApiUserEntrustopenacctQueryResponseV1 hygfIcbcWalletInfo = getHygfIcbcWalletInfo(userId);
PeasantHousehold peasantHousehold = peasantHouseholdService.lambdaQuery().select(PeasantHousehold::getTelephone) PeasantHousehold peasantHousehold = peasantHouseholdService.lambdaQuery().select(PeasantHousehold::getTelephone)
.eq(PeasantHousehold::getAmosUserId, userId).last("limit 1").one(); .eq(PeasantHousehold::getAmosUserId, userId).last("limit 1").one();
HygfIcbcRecord hygfIcbcRecord = this.lambdaQuery().eq(HygfIcbcRecord::getAmosUserId, userId).last(" limit 1") HygfIcbcRecord hygfIcbcRecord = this.lambdaQuery().eq(HygfIcbcRecord::getAmosUserId, userId).last(" limit 1")
.one(); .one();
if (hygfIcbcRecord == null) { if (hygfIcbcRecord == null) {
hygfIcbcRecord = new HygfIcbcRecord(); hygfIcbcRecord = new HygfIcbcRecord();
} }
if (hygfIcbcWalletInfo != null) { if (hygfIcbcWalletInfo != null) {
hygfIcbcRecord.setPhone(peasantHousehold != null ? peasantHousehold.getTelephone() : ""); hygfIcbcRecord.setPhone(peasantHousehold != null ? peasantHousehold.getTelephone() : "");
hygfIcbcRecord.setMediumId(hygfIcbcWalletInfo.getMediumId()); hygfIcbcRecord.setMediumId(hygfIcbcWalletInfo.getMediumId());
hygfIcbcRecord.setProjectId("PJ140014023565102203"); hygfIcbcRecord.setProjectId("PJ140014023565102203");
hygfIcbcRecord.setOpenAccountStatus(hygfIcbcWalletInfo.getOpenacctStatus()); hygfIcbcRecord.setOpenAccountStatus(hygfIcbcWalletInfo.getOpenacctStatus());
hygfIcbcRecord.setSignEntrsutPrtlStatus("1"); hygfIcbcRecord.setSignEntrsutPrtlStatus("1");
hygfIcbcRecord.setCustName(hygfIcbcWalletInfo.getCustName()); hygfIcbcRecord.setCustName(hygfIcbcWalletInfo.getCustName());
hygfIcbcRecord.setIdCard(hygfIcbcWalletInfo.getCertNo()); hygfIcbcRecord.setIdCard(hygfIcbcWalletInfo.getCertNo());
hygfIcbcRecord.setProtocolStatus(hygfIcbcWalletInfo.getProtocolStatus()); hygfIcbcRecord.setProtocolStatus(hygfIcbcWalletInfo.getProtocolStatus());
hygfIcbcRecord.setProtocolStartTime(hygfIcbcWalletInfo.getProtocolStartDate()); hygfIcbcRecord.setProtocolStartTime(hygfIcbcWalletInfo.getProtocolStartDate());
hygfIcbcRecord.setProtocolEndTime(hygfIcbcWalletInfo.getProtocolEndDate()); hygfIcbcRecord.setProtocolEndTime(hygfIcbcWalletInfo.getProtocolEndDate());
hygfIcbcRecord.setTrxLimitAmount(hygfIcbcWalletInfo.getTrxLimitAmount()); hygfIcbcRecord.setTrxLimitAmount(hygfIcbcWalletInfo.getTrxLimitAmount());
hygfIcbcRecord.setDayLimitAmount(hygfIcbcWalletInfo.getDayLimitAmount()); hygfIcbcRecord.setDayLimitAmount(hygfIcbcWalletInfo.getDayLimitAmount());
hygfIcbcRecord.setProtocolLimitAmount(hygfIcbcWalletInfo.getProtocolLimitAmount()); hygfIcbcRecord.setProtocolLimitAmount(hygfIcbcWalletInfo.getProtocolLimitAmount());
hygfIcbcRecord.setAppId(hygfIcbcWalletInfo.getAppId()); hygfIcbcRecord.setAppId(hygfIcbcWalletInfo.getAppId());
hygfIcbcRecord.setOutUserId(hygfIcbcWalletInfo.getOutUserId()); hygfIcbcRecord.setOutUserId(hygfIcbcWalletInfo.getOutUserId());
hygfIcbcRecord.setOutVendorId(hygfIcbcWalletInfo.getOutVendorId()); hygfIcbcRecord.setOutVendorId(hygfIcbcWalletInfo.getOutVendorId());
} else { } else {
return "开卡信息不存在"; return "开卡信息不存在";
} }
// hygfIcbcRecord.setDiscardStatus(); // hygfIcbcRecord.setDiscardStatus();
hygfIcbcRecord.setAmosUserId(userId); hygfIcbcRecord.setAmosUserId(userId);
hygfIcbcRecord.setRecDate(new Date()); hygfIcbcRecord.setRecDate(new Date());
this.saveOrUpdate(hygfIcbcRecord); this.saveOrUpdate(hygfIcbcRecord);
return "success"; return "success";
} }
public Map<String,Long> exportTotal(String developerCode, String regionalCompaniesCode, String province, String city, String district){ public Map<String, Long> exportTotal(String developerCode, String regionalCompaniesCode, String province, String city, String district) {
List<HygfIcbcRecordExportDTO> dtos = hygfIcbcRecordMapper.exportTotal(developerCode, regionalCompaniesCode, province, city, district); List<HygfIcbcRecordExportDTO> dtos = hygfIcbcRecordMapper.exportTotal(developerCode, regionalCompaniesCode, province, city, district);
Map<String, Long> collect = dtos.stream() Map<String, Long> collect = dtos.stream()
.collect(Collectors.groupingBy(HygfIcbcRecordExportDTO::getOpenAccountStatus, Collectors.counting())); .collect(Collectors.groupingBy(HygfIcbcRecordExportDTO::getOpenAccountStatus, Collectors.counting()));
String[] strings = {"开户失败","开户成功","未开户"}; String[] strings = {"开户失败", "开户成功", "未开户"};
List<String> names = Arrays.asList(strings); List<String> names = Arrays.asList(strings);
for (String name : names) { for (String name : names) {
if (!collect.keySet().contains(name)) { if (!collect.keySet().contains(name)) {
collect.put(name,0L); collect.put(name, 0L);
} }
} }
// 根据 openAccountStatus 分组统计 // 根据 openAccountStatus 分组统计
return collect; return collect;
} }
public void exportData(HttpServletResponse response,String developerCode, String regionalCompaniesCode, String province, String city, String district){ public void exportData(HttpServletResponse response, String developerCode, String regionalCompaniesCode, String province, String city, String district) {
List<HygfIcbcRecordExportDTO> dtos = hygfIcbcRecordMapper.exportTotal(developerCode, regionalCompaniesCode, province, city, district); List<HygfIcbcRecordExportDTO> dtos = hygfIcbcRecordMapper.exportTotal(developerCode, regionalCompaniesCode, province, city, district);
if (CollectionUtil.isNotEmpty(dtos)){ if (CollectionUtil.isNotEmpty(dtos)) {
ExcelUtil.createTemplate(response,"开卡统计","开卡统计",dtos, HygfIcbcRecordExportDTO.class,null,false); ExcelUtil.createTemplate(response, "开卡统计", "开卡统计", dtos, HygfIcbcRecordExportDTO.class, null, false);
} }
} }
public void exportExcel(HttpServletResponse response, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO){ public void exportExcel(HttpServletResponse response, HygfIcbcRecordQueryDTO hygfIcbcRecordQueryDTO) {
List<HygfIcbcRecordExportDTO> hygfIcbcRecordExportDTOS = hygfIcbcRecordMapper.paymentAmountExport(hygfIcbcRecordQueryDTO); List<HygfIcbcRecordExportDTO> hygfIcbcRecordExportDTOS = hygfIcbcRecordMapper.paymentAmountExport(hygfIcbcRecordQueryDTO);
if (CollectionUtil.isNotEmpty(hygfIcbcRecordExportDTOS)){ if (CollectionUtil.isNotEmpty(hygfIcbcRecordExportDTOS)) {
ExcelUtil.createTemplate(response,"账号信息","账号信息",hygfIcbcRecordExportDTOS, HygfIcbcRecordExportDTO.class,null,false); ExcelUtil.createTemplate(response, "账号信息", "账号信息", hygfIcbcRecordExportDTOS, HygfIcbcRecordExportDTO.class, null, false);
} }
} }
public Object signVerifyCode(String phone, String mediumId) {
// PeasantHousehold peasantHousehold=peasantHouseholdService
// .getOne(new LambdaQueryWrapper<PeasantHousehold>().eq(PeasantHousehold::getTelephone,phone).last("LIMIT 1"));
// if(peasantHousehold==null)
// {
// return "农户不存在";
// }
PeasantHousehold peasantHousehold = new PeasantHousehold();
peasantHousehold.setAmosUserId("890728");
peasantHousehold.setOwnersName("吴江");
peasantHousehold.setIdCard("61010319890728203X");
String apiUrl = serviceUrl + "/api/jft/api/user/entrust/send/verify/code/V1";
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,
IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES,
AES_Key, "", "");
JftUserEntrustprtlMobileVerifyRequestV1 request = new
JftUserEntrustprtlMobileVerifyRequestV1();
//4、根据测试环境和生产环境替换相应ip和端口
request.setServiceUrl(apiUrl);
//5、请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值
JftUserEntrustprtlMobileVerifyRequestV1.JftUserEntrustprtlMobileVerifyRequestV1Biz bizContent = new
JftUserEntrustprtlMobileVerifyRequestV1.JftUserEntrustprtlMobileVerifyRequestV1Biz();
bizContent.setAppId(APP_ID);
bizContent.setOutVendorId(OUT_VENDOR_ID);
bizContent.setMobile(phone);
bizContent.setAccountName(peasantHousehold.getOwnersName());
bizContent.setAccountNo(mediumId);
bizContent.setIdType("0");
bizContent.setIdNo(peasantHousehold.getIdCard());
bizContent.setTrxType("01");
bizContent.setProjectId(PROJECT_ID);
bizContent.setTextSerno("09");
bizContent.setProtocolLimitAmount("20000000");//单位分,不要带小数,非必输
//bizContent.setSmsNote("自定义备注内容");//短信会显示:XXXXXXXX,备注:自定义备注内容
request.setBizContent(bizContent);
JftUserEntrustprtlMobileVerifyResponseV1 response = null;
try {
log.info("聚富通委托代扣签约验证码, 入参 => {}", JSON.toJSONString(request));
response = (JftUserEntrustprtlMobileVerifyResponseV1)
client.execute(request, System.currentTimeMillis() + "");
log.info("聚富通委托代扣签约验证码, 出参 => {}", JSON.toJSONString(response));
//msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一
if (response.isSuccess()) {
//6、业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据
System.out.println("ReturnCode:" + response.getReturnCode());
System.out.println("response:" + response);
} else {
//失败
System.out.println("ReturnCode:" + response.getReturnCode());
System.out.println("ReturnMsg:" + response.getReturnMsg());
}
} catch (IcbcApiException e) {
e.printStackTrace();
}
return response;
}
public Object signProtocol(HygfIcbcSignProtocolDTO hygfIcbcSignProtocolDTO) {
// PeasantHousehold peasantHousehold=peasantHouseholdService
// .getOne(new LambdaQueryWrapper<PeasantHousehold>().eq(PeasantHousehold::getTelephone,hygfIcbcSignProtocolDTO.getPhone()).last("LIMIT 1"));
// if(peasantHousehold==null)
// {
// return "农户不存在";
// }
PeasantHousehold peasantHousehold = new PeasantHousehold();
peasantHousehold.setAmosUserId("890728");
peasantHousehold.setOwnersName("吴江");
peasantHousehold.setIdCard("61010319890728203X");
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,
IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES,
AES_Key, "", "");
JftUserEntrustprtlMngRequestV1 request = new JftUserEntrustprtlMngRequestV1();
//4、根据测试环境和生产环境替换相应ip和端口######8
// 请求示例委托代扣协议签约示例
//String apiUrl=serviceUrl+"/api/jft/api/vendor/rescind/user/protocol/V1";
String apiUrl = serviceUrl + "/api/jft/api/user/entrust/protocol/mng/V1";
request.setServiceUrl(apiUrl);
//5、请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值
JftUserEntrustprtlMngRequestV1.JftUserEntrustprtlMngRequestV1Biz bizContent = new JftUserEntrustprtlMngRequestV1.JftUserEntrustprtlMngRequestV1Biz();
bizContent.setAppId(APP_ID);
bizContent.setOutVendorId(OUT_VENDOR_ID);
bizContent.setSrVid(hygfIcbcSignProtocolDTO.getSrVid());
if (hygfIcbcSignProtocolDTO.isCancel())//0签约 2解约
{
bizContent.setDealFlag("2");
} else {
bizContent.setDealFlag("0");
}
bizContent.setProjectId(PROJECT_ID);
bizContent.setBusiCode(peasantHousehold.getAmosUserId());
bizContent.setBankNo("102");//102默认工行
bizContent.setAccountNo(hygfIcbcSignProtocolDTO.getMediumId());
bizContent.setAccountName(peasantHousehold.getOwnersName());
bizContent.setMobile(hygfIcbcSignProtocolDTO.getPhone());
bizContent.setVerifyCode(hygfIcbcSignProtocolDTO.getVerifyCode());
bizContent.setSendNo(hygfIcbcSignProtocolDTO.getSendNo());
bizContent.setIdType("0");
bizContent.setIdNo(peasantHousehold.getIdCard());
LocalDate today = LocalDate.now();
LocalDate nextYearToday = today.plusYears(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = nextYearToday.format(formatter);
bizContent.setProtocolEndDate(formattedDate);
bizContent.setProtocolLimitAmount("20000000");
//bizContent.setCvn2("463");
//bizContent.setExpired("2002");
bizContent.setBankFlag("0");//0工行卡 1其他行卡
//bizContent.setQueryItem1("");
//bizContent.setQueryItem15("");
request.setBizContent(bizContent);
JftUserEntrustprtlMngResponseV1 response = null;
try {
response = (JftUserEntrustprtlMngResponseV1) client.execute(request,
System.currentTimeMillis() + "");
//msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一
if (response.isSuccess()) {
//6、业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据
System.out.println("ReturnCode:" + response.getReturnCode());
System.out.println("response:" + response);
if (hygfIcbcSignProtocolDTO.isCancel())//0签约 2解约
{
this.remove(new LambdaQueryWrapper<HygfIcbcRecord>().eq(HygfIcbcRecord::getAmosUserId,peasantHousehold.getAmosUserId()));
} else {
HygfIcbcRecord hygfIcbcRecord = new HygfIcbcRecord();
hygfIcbcRecord.setPhone(hygfIcbcSignProtocolDTO.getPhone());
hygfIcbcRecord.setMediumId(hygfIcbcSignProtocolDTO.getMediumId());
hygfIcbcRecord.setProjectId(PROJECT_ID);
hygfIcbcRecord.setOpenAccountStatus("02");
hygfIcbcRecord.setSignEntrsutPrtlStatus("1");
hygfIcbcRecord.setCustName(peasantHousehold.getOwnersName());
hygfIcbcRecord.setIdCard(peasantHousehold.getIdCard());
hygfIcbcRecord.setType("一类卡");
hygfIcbcRecord.setAppId(APP_ID);
hygfIcbcRecord.setOutVendorId(OUT_VENDOR_ID);
hygfIcbcRecord.setOutUserId(peasantHousehold.getAmosUserId());
hygfIcbcRecord.setAmosUserId(peasantHousehold.getAmosUserId());
this.saveOrUpdate(hygfIcbcRecord);
JftUserEntrustprtlQueryResponseV1 prt = (JftUserEntrustprtlQueryResponseV1) signQuery(peasantHousehold.getAmosUserId());
if(prt.isSuccess()&&prt.getReturnCode()==0)
{
hygfIcbcRecord.setProtocolStatus(prt.getPrtlStatus());
hygfIcbcRecord.setProtocolStartTime(prt.getPrtlStartDate());
hygfIcbcRecord.setProtocolEndTime(prt.getPrtlEndDate());
hygfIcbcRecord.setTrxLimitAmount(String.valueOf(prt.getTrxLmtAmt()));
hygfIcbcRecord.setDayLimitAmount(String.valueOf(prt.getDayLmtAmt()));
hygfIcbcRecord.setProtocolLimitAmount(String.valueOf(prt.getPrtlLmtAmt()));
}
this.saveOrUpdate(hygfIcbcRecord);
}
} else {
//失败
System.out.println("ReturnCode:" + response.getReturnCode());
System.out.println("ReturnMsg:" + response.getReturnMsg());
}
} catch (IcbcApiException e) {
e.printStackTrace();
}
return response;
}
public Object signQuery(String busiCode) {
String apiUrl = serviceUrl + "/api/jft/api/user/entrust/protocol/query/V1";
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,
IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES,
AES_Key, "", "");
JftUserEntrustprtlQueryRequestV1 request = new JftUserEntrustprtlQueryRequestV1();
//4、根据测试环境和生产环境替换相应ip和端口
request.setServiceUrl(apiUrl);
//5、请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值
JftUserEntrustprtlQueryRequestV1.JftUserEntrustprtlQueryRequestV1Biz bizContent = new JftUserEntrustprtlQueryRequestV1.JftUserEntrustprtlQueryRequestV1Biz();
bizContent.setAppId(APP_ID);
bizContent.setOutVendorId(OUT_VENDOR_ID);
bizContent.setChannelType("303");//303-手机,302-pc
bizContent.setBizZone("00200");//00200(需要和分行人员确定)
LocalDateTime today = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = today.format(formatter);
bizContent.setTrxDate(formattedDate);
DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("HH:mm:ss");
String formattedTime = today.format(formatter2);
bizContent.setTrxTime(formattedTime);
bizContent.setProjectId(PROJECT_ID);
bizContent.setBusiCode(busiCode);
//bizContent.setNewPayAcc("9558870200001260273");
//bizContent.setQueryItem1("");
//bizContent.setQueryItem15("");
request.setBizContent(bizContent);
JftUserEntrustprtlQueryResponseV1 response = null;
try {
response = (JftUserEntrustprtlQueryResponseV1)
client.execute(request, System.currentTimeMillis() + "");
//msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一
if (response.isSuccess()) {
//6、业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据
System.out.println("ReturnCode:" + response.getReturnCode());
System.out.println("response:" + response);
} else {//失败
System.out.println("ReturnCode:" + response.getReturnCode());
System.out.println("ReturnMsg:" + response.getReturnMsg());
}
} catch (IcbcApiException e) {
e.printStackTrace();
}
return response;
}
public Object balanceQuery(String mediumId) {
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,
IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES,
AES_Key, "", "");
SettlementAccountBalanceQueryRequestV1 request = new SettlementAccountBalanceQueryRequestV1();
String apiUrl = serviceUrl + "/api/settlement/account/balance/V1/query";
request.setServiceUrl(apiUrl);
SettlementAccountBalanceQueryRequestV1.SettlementAccountBalanceQueryRequestV1Biz bizContent = new SettlementAccountBalanceQueryRequestV1.SettlementAccountBalanceQueryRequestV1Biz();
bizContent.setCorpNo("88888888");//合作方机构编号
LocalDateTime today = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String formattedDate = today.format(formatter);
bizContent.setTrxAccDate(formattedDate);
DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("HH:mm:ss");
String formattedTime = today.format(formatter2);
bizContent.setTrxAccTime(formattedTime);
bizContent.setCorpSerno(String.valueOf(System.currentTimeMillis()));//合作方交易单号
bizContent.setCorpDate(formattedDate);//合作方工作日期
bizContent.setOutServiceCode("querybalance");//外部服务代码
bizContent.setMediumId(mediumId);//工行联名卡号
bizContent.setCcy(1);//市种
//bizContent.setSecretKey("h8zujhDntpKRohwFmGXcnXygNjJHRObyUVG3183u0dXI2fRgCXeDED9z0w5d02JucVy7vZ190d7CSUxI2/sVon6dPklVoaquVElgKRUPlr6D/cqLu25K7h]3Pt/u0nx4gF/ykm0/IB2gs0rs/sp0Zw==");
request.setBizContent(bizContent);
SettlementAccountBalanceQueryResponseV1 response = null;
try {
response = client.execute(request, "msgId");
if (response.isSuccess() && response.getReturnCode() == 0) {
//业务成功处理
System.out.println(response.getAccountBalance());//
System.out.println(response.getHoldBalance());//
} else {
// 失败
System.err.println(response.getReturnCode());//
System.err.println(response.getReturnMsg());//
}
} catch (IcbcApiException e) {
throw new RuntimeException(e);
}
return response;
}
} }
\ No newline at end of file
...@@ -1048,6 +1048,7 @@ public class LargeScreenImpl { ...@@ -1048,6 +1048,7 @@ public class LargeScreenImpl {
// 全国场站功率和曲线 // 全国场站功率和曲线
@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
@PostConstruct
public void getDetailsWindSpeedAlldataqgsh() { public void getDetailsWindSpeedAlldataqgsh() {
getDetailsWindSpeedAlldataqg(); getDetailsWindSpeedAlldataqg();
} }
...@@ -1099,16 +1100,28 @@ public class LargeScreenImpl { ...@@ -1099,16 +1100,28 @@ public class LargeScreenImpl {
activePowerListGF = indicatorDataMapper activePowerListGF = indicatorDataMapper
.selectDataByequipmentIndexNameAndtimeqgNew(CommonConstans.taiheActivePowerPoint, gfGatewayIds); .selectDataByequipmentIndexNameAndtimeqgNew(CommonConstans.taiheActivePowerPoint, gfGatewayIds);
} }
System.out.println(JSON.toJSONString(activePowerListFD)); System.out.println(JSON.toJSONString(activePowerListGF));
for (int i = 0; i < activePowerListFD.size(); i++) { for (int i = 0; i < activePowerListGF.size(); i++) {
IndicatorData indicatorData = activePowerListFD.get(i); IndicatorData indicatorData =new IndicatorData();
IndicatorData indicatorData2 = activePowerListGF.get(i); indicatorData.setValueF(0.0f);
time.add(cn.hutool.core.date.DateUtil.format(indicatorData.getCreatedTime(), "HH:mm")); if(activePowerListFD.size()>i)
{
indicatorData = activePowerListFD.get(i);
}else
{
//indicatorData.setValueF((float) (Math.random() * 5));
}
IndicatorData indicatorData2 =new IndicatorData();
indicatorData2.setValueF(0.0f);
if(activePowerListGF.size()>i)
{
indicatorData2 = activePowerListGF.get(i);
}
time.add(cn.hutool.core.date.DateUtil.format(indicatorData2.getCreatedTime(), "HH:mm"));
// Double vl= indicatorData.getValueF()+indicatorData2.getValueF() * // Double vl= indicatorData.getValueF()+indicatorData2.getValueF() *
// CommonConstans.kwToMv; // CommonConstans.kwToMv;
Double vl = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF())) Double vl = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()))
+ Double.valueOf(String.format(CommonConstans.Twodecimalplaces, + Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData2.getValueF() * CommonConstans.kwToMv));
indicatorData2.getValueF() * CommonConstans.kwToMv));
values.add(String.format(CommonConstans.Twodecimalplaces, vl)); values.add(String.format(CommonConstans.Twodecimalplaces, vl));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment