Commit 14566827 authored by 胡建龙's avatar 胡建龙

[fix]账户查询接口

parent 0383ca92
package com.chinapay.dto;
import com.hand.hap.mybatis.annotation.ExtensionAttribute;
import com.hand.hap.system.dto.BaseDTO;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
/*
* @create 2022/12/26
* @since 1.0.0
*/
@Table(name = "hls_ebank_ccb_account")
@ExtensionAttribute(disable = true)
public class HlsEbankCcbAccount extends BaseDTO {
@Id
@GeneratedValue
private Long recordId;
private String accountNo;
private String accName;
private String stt;
private Double accBalance;
private String corId;
private String mainAccount;
private Long subAccNum;
private String mainFlag;
public Long getRecordId() {
return recordId;
}
public void setRecordId(Long recordId) {
this.recordId = recordId;
}
public String getAccountNo() {
return accountNo;
}
public void setAccountNo(String accountNo) {
this.accountNo = accountNo;
}
public String getAccName() {
return accName;
}
public void setAccName(String accName) {
this.accName = accName;
}
public String getStt() {
return stt;
}
public void setStt(String stt) {
this.stt = stt;
}
public Double getAccBalance() {
return accBalance;
}
public void setAccBalance(Double accBalance) {
this.accBalance = accBalance;
}
public String getCorId() {
return corId;
}
public void setCorId(String corId) {
this.corId = corId;
}
public String getMainAccount() {
return mainAccount;
}
public void setMainAccount(String mainAccount) {
this.mainAccount = mainAccount;
}
public Long getSubAccNum() {
return subAccNum;
}
public void setSubAccNum(Long subAccNum) {
this.subAccNum = subAccNum;
}
public String getMainFlag() {
return mainFlag;
}
public void setMainFlag(String mainFlag) {
this.mainFlag = mainFlag;
}
}
package com.chinapay.mapper;
import com.chinapay.dto.HclcCupSignInfo;
import com.chinapay.dto.HlsEbankCcbAccount;
import com.chinapay.dto.HlsEbankCcbTransaction;
import com.hand.hap.mybatis.common.Mapper;
public interface HlsEbankCcbAccountMapper extends Mapper<HlsEbankCcbAccount> {
Long queryByAccountNo(HlsEbankCcbAccount hlsEbankCcbAccount);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chinapay.mapper.HlsEbankCcbAccountMapper">
<select id="queryByAccountNo" resultType="java.lang.Long">
select heca.record_id from hls_ebank_ccb_account heca where heca.account_no = #{accountNo}
</select>
</mapper>
\ No newline at end of file
package com.chinapay.service;
import com.chinapay.dto.HlsEbankCcbAccount;
import com.hand.hap.core.ProxySelf;
import com.hand.hap.system.service.IBaseService;
public interface IHlsEbankCcbAccountService extends IBaseService<HlsEbankCcbAccount>, ProxySelf<IHlsEbankCcbAccountService> {
}
package com.chinapay.service.impl;
import com.chinapay.dto.HlsEbankCcbAccount;
import com.chinapay.service.IHlsEbankCcbAccountService;
import com.hand.hap.system.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class HlsEbankCcbAccountServiceImpl extends BaseServiceImpl<HlsEbankCcbAccount> implements IHlsEbankCcbAccountService{
}
...@@ -32,7 +32,8 @@ public class PingAnController extends BaseController { ...@@ -32,7 +32,8 @@ public class PingAnController extends BaseController {
@RequestMapping("/bedl/SubAcctMaintenance") @RequestMapping("/bedl/SubAcctMaintenance")
@ResponseBody @ResponseBody
public JSONObject bindSubAccount(HttpServletRequest request,@RequestBody(required = true) JSONObject reqParams){ public JSONObject bindSubAccount(HttpServletRequest request,@RequestBody(required = true) JSONObject reqParams){
return pingAnService.invoke("bedl/SubAcctMaintenance",reqParams); IRequest iRequest = createRequestContext(request);
return pingAnService.invoke(iRequest,"bedl/SubAcctMaintenance",reqParams);
} }
@ApiModelProperty("近期明细查询(BEDL_C00602)") @ApiModelProperty("近期明细查询(BEDL_C00602)")
...@@ -57,6 +58,16 @@ public class PingAnController extends BaseController { ...@@ -57,6 +58,16 @@ public class PingAnController extends BaseController {
public JSONObject downloadDetail(HttpServletRequest request,@RequestBody(required = true) JSONObject reqParams){ public JSONObject downloadDetail(HttpServletRequest request,@RequestBody(required = true) JSONObject reqParams){
IRequest iRequest = createRequestContext(request); IRequest iRequest = createRequestContext(request);
reqParams.put("Account",ApiUtils.AcctNo); reqParams.put("Account",ApiUtils.AcctNo);
return pingAnService.invoke("bedl/DetailReportQueryNew", reqParams); return pingAnService.invoke(iRequest,"bedl/DetailReportQueryNew", reqParams);
} }
@ApiModelProperty("智能清分台账编码关系查询(BEDL_C001)")
@RequestMapping("/bedl/PrimaryAcctRelationshipQuery")
@ResponseBody
public JSONObject queryAccount(HttpServletRequest request,@RequestBody(required = true) JSONObject reqParams){
IRequest iRequest = createRequestContext(request);
return pingAnService.queryAccount(iRequest,"bedl/PrimaryAcctRelationshipQuery", reqParams);
}
} }
...@@ -8,9 +8,11 @@ import java.util.HashMap; ...@@ -8,9 +8,11 @@ import java.util.HashMap;
public interface PingAnService { public interface PingAnService {
JSONObject invoke(String interfaceName, JSONObject params); JSONObject invoke(IRequest iRequest,String interfaceName, JSONObject params);
JSONObject detailNotify(IRequest iRequest, JSONObject data); JSONObject detailNotify(IRequest iRequest, JSONObject data);
public JSONObject preInvoke(IRequest iRequest, String interfaceName, JSONObject params); public JSONObject preInvoke(IRequest iRequest, String interfaceName, JSONObject params);
JSONObject queryAccount(IRequest iRequest,String interfaceName, JSONObject params);
} }
...@@ -4,8 +4,11 @@ import com.alibaba.fastjson.JSON; ...@@ -4,8 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.chinapay.comm.Constants; import com.chinapay.comm.Constants;
import com.chinapay.dto.HlsEbankCcbAccount;
import com.chinapay.dto.HlsEbankCcbTransaction; import com.chinapay.dto.HlsEbankCcbTransaction;
import com.chinapay.mapper.HlsEbankCcbAccountMapper;
import com.chinapay.mapper.HlsEbankCcbTransactionMapper; import com.chinapay.mapper.HlsEbankCcbTransactionMapper;
import com.chinapay.service.IHlsEbankCcbAccountService;
import com.chinapay.service.IHlsEbankCcbTransactionService; import com.chinapay.service.IHlsEbankCcbTransactionService;
import com.chinapay.service.impl.HlsEbankCcbTransactionServiceImpl; import com.chinapay.service.impl.HlsEbankCcbTransactionServiceImpl;
import com.chinapay.util.StringUtil; import com.chinapay.util.StringUtil;
...@@ -55,6 +58,10 @@ public class PingAnServiceImpl implements PingAnService { ...@@ -55,6 +58,10 @@ public class PingAnServiceImpl implements PingAnService {
private HlsEbankCcbTransactionMapper hlsEbankCcbTransactionMapper; private HlsEbankCcbTransactionMapper hlsEbankCcbTransactionMapper;
@Autowired @Autowired
private DataSourceTransactionManager transactionManager; private DataSourceTransactionManager transactionManager;
@Autowired
private IHlsEbankCcbAccountService hlsEbankCcbAccountService;
@Autowired
private HlsEbankCcbAccountMapper hlsEbankCcbAccountMapper;
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
...@@ -81,7 +88,7 @@ public class PingAnServiceImpl implements PingAnService { ...@@ -81,7 +88,7 @@ public class PingAnServiceImpl implements PingAnService {
* @return * @return
*/ */
@Override @Override
public JSONObject invoke(String interfaceName, JSONObject params) { public JSONObject invoke(IRequest iRequest,String interfaceName, JSONObject params) {
JSONObject responseData = new JSONObject(); JSONObject responseData = new JSONObject();
// JSONObject requestBody = ApiUtils.getBaseReqBody(); // JSONObject requestBody = ApiUtils.getBaseReqBody();
JSONObject requestBody = baseReqBody.clone(); JSONObject requestBody = baseReqBody.clone();
...@@ -111,6 +118,9 @@ public class PingAnServiceImpl implements PingAnService { ...@@ -111,6 +118,9 @@ public class PingAnServiceImpl implements PingAnService {
case "bedl/DetailReportQueryNew": case "bedl/DetailReportQueryNew":
hlsWsRequests.setFunctionName("pingAn_DetailReportQueryNew"); hlsWsRequests.setFunctionName("pingAn_DetailReportQueryNew");
break; break;
case "bedl/PrimaryAcctRelationshipQuery":
hlsWsRequests.setFunctionName("pingAn_QueryAccount");
break;
} }
responseData.put("data", res); responseData.put("data", res);
// 具体业务是否请求成功判定,目前观察成功请求可能没有Code值 // 具体业务是否请求成功判定,目前观察成功请求可能没有Code值
...@@ -301,13 +311,43 @@ public class PingAnServiceImpl implements PingAnService { ...@@ -301,13 +311,43 @@ public class PingAnServiceImpl implements PingAnService {
String isEnd = "N"; String isEnd = "N";
while ("N".equalsIgnoreCase(isEnd)) { while ("N".equalsIgnoreCase(isEnd)) {
params.put("PageNo", ++pageNo); params.put("PageNo", ++pageNo);
JSONObject res = invoke(interfaceName, params); JSONObject res = invoke(iRequest, interfaceName, params);
isEnd = res.getString("isEnd");
// 对当前查询到的数据进行存表 // 对当前查询到的数据进行存表
JSONObject data = res.getJSONObject("data"); JSONObject data = res.getJSONObject("data");
JSONArray arr = data.getJSONArray("list"); if (Objects.nonNull(data)){
if (Objects.nonNull(arr)) { isEnd = data.getString("isEnd");
batchSaveTransactionByC00602(iRequest, arr); JSONArray arr = data.getJSONArray("list");
if (Objects.nonNull(arr)) {
batchSaveTransactionByC00602(iRequest, arr);
}
}else{
responseData.put(Constants.RESP_CODE, "1111");
responseData.put("respMsg", "查询出错");
break;
}
}
responseData.put(Constants.RESP_CODE, "0000");
responseData.put("respMsg", "请求成功");
return responseData;
}
@Override
public JSONObject queryAccount(IRequest iRequest, String interfaceName, JSONObject params) {
JSONObject responseData = new JSONObject();
int pageNo = 0;
String isEnd = "N";
while ("N".equalsIgnoreCase(isEnd)) {
params.put("PageNo", ++pageNo);
JSONObject res = invoke(iRequest, interfaceName, params);
// 对当前查询到的数据进行存表
JSONObject data = res.getJSONObject("data");
if (Objects.nonNull(data)){
isEnd = data.getString("isEnd");
batchSaveAccount(iRequest, data);
}else{
responseData.put(Constants.RESP_CODE, "1111");
responseData.put("respMsg", "查询出错");
break;
} }
} }
responseData.put(Constants.RESP_CODE, "0000"); responseData.put(Constants.RESP_CODE, "0000");
...@@ -362,4 +402,29 @@ public class PingAnServiceImpl implements PingAnService { ...@@ -362,4 +402,29 @@ public class PingAnServiceImpl implements PingAnService {
} }
} }
} }
private void batchSaveAccount(IRequest iRequest, JSONObject data){
JSONArray list = data.getJSONArray("list");
if (Objects.nonNull(list)){
for (int i = 0; i < list.size(); i++) {
JSONObject item = list.getJSONObject(i);
HlsEbankCcbAccount hlsEbankCcbAccount = new HlsEbankCcbAccount();
hlsEbankCcbAccount.setAccountNo(item.getString("SubAccountNo"));
Long recordId = hlsEbankCcbAccountMapper.queryByAccountNo(hlsEbankCcbAccount);
hlsEbankCcbAccount.setSubAccNum(data.getLong("SubAccNum"));
hlsEbankCcbAccount.setStt(item.getString("SubStt"));
hlsEbankCcbAccount.setAccBalance(item.getDouble("SubAccBalance"));
if (Objects.nonNull(recordId)){
hlsEbankCcbAccount.setRecordId(recordId);
hlsEbankCcbAccountService.updateByPrimaryKeySelective(iRequest,hlsEbankCcbAccount);
}else{
hlsEbankCcbAccount.setMainAccount(data.getString("MainAccount"));
hlsEbankCcbAccount.setCorId(data.getString("CorId"));
hlsEbankCcbAccount.setAccName(item.getString("SubAccName"));
hlsEbankCcbAccountService.insertSelective(iRequest,hlsEbankCcbAccount);
}
}
}
}
} }
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