Commit ab3d984d authored by 5359's avatar 5359

中登网开发

parent e34160ab
......@@ -18,7 +18,7 @@ import java.util.Date;
@ExtensionAttribute(disable = true)
@Table(name = "HLS_WS_REQUESTS")
public class HlsWsRequests extends BaseDTO {
public class HlsWsRequests {
@Id
@GeneratedValue
......
......@@ -7,6 +7,7 @@ import com.hand.app.zhongDengWang.dto.FndZhongDengLines;
import com.hand.app.zhongDengWang.dto.FndZhongDengBatch;
import com.hand.app.zhongDengWang.dto.HlsWsRequests;
import com.hand.app.zhongDengWang.service.IZdwWsRequestsService;
import com.hand.app.zhongDengWang.mapper.HlsWsRequestsMapper;
import com.hand.app.zhongDengWang.service.IFndZhongDengLinesService;
import com.hand.app.zhongDengWang.mapper.ZdwLoginTokenInterfaceMapper;
import com.hand.app.zhongDengWang.mapper.FndZhongDengLinesMapper;
......@@ -44,6 +45,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
@Autowired
IZdwWsRequestsService zdwWsRequestsService;
@Autowired
HlsWsRequestsMapper hlsWsRequestsMapper;
@Autowired
FndAtmAttachmentMapper fndAtmAttachmentMapper;
@Autowired
FndZhongDengBatchMapper fndZhongDengBatchMapper;
......@@ -119,16 +122,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
hlsWsRequests.setRequestDate(new Date());
hlsWsRequests.setRequestWsdlUrl(wsdlUrl);
hlsWsRequests.setFunctionName("INIT_REGISTER");
hlsWsRequests.setReturnStatus("1");
hlsWsRequests.setRequestClob(requestClob);
hlsWsRequests.setStatusDate(new Date());
hlsWsRequests.setParameterType("XML");
hlsWsRequests.setPkValue(pkValue);
hlsWsRequestsMapper.insertSelective(hlsWsRequests);
return hlsWsRequests;
}
public JSONObject registerInit(String registerTypeBz, String platformAuthCode, String loginToken, String xmlFileName, String xmlFileContent) {
public JSONObject registerInit(String registerTypeBz, String platformAuthCode, String loginToken, String xmlFileName, String xmlFileContent, Long lineId) {
JSONObject resultJson = new JSONObject();
......@@ -136,6 +139,7 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
String encryLoginToken = "";
String attachmentZipPath = "";
String encryPlatformAuthCode = "";
HlsWsRequests hlsWsRequests = new HlsWsRequests();
try {
/*SM2算法加密*/
......@@ -143,15 +147,19 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
encryXmlFileContent = SM2Utils.encryptByKeyStr(xmlFileContent, clientKey);
encryPlatformAuthCode = SM2Utils.encryptByKeyStr(platformAuthCode, clientKey);
WSInitRegisterServiceService service = new WSInitRegisterServiceService();
WSInitRegisterService reg = service.getWSInitRegisterServicePort();
// WSInitRegisterServiceService service = new WSInitRegisterServiceService();
// WSInitRegisterService reg = service.getWSInitRegisterServicePort();
/*插入接口日志表*/
byte[] returns = reg.initRegister(registerTypeBz.getBytes(), encryPlatformAuthCode.getBytes(), encryLoginToken.getBytes(), xmlFileName.getBytes(), encryXmlFileContent.getBytes(), ClientUtils.getAttachmentZip(attachmentZipPath));
// byte[] returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>RegInfoError:100_001</error>\n</errors>\n</feedback>\n".getBytes();
// hlsWsRequests = createRequestLog(service.getWSDLDocumentLocation().toString(), xmlFileContent, lineId);
hlsWsRequests = createRequestLog("https://ws.zhongdengwang.org.cn/mfrs_ws_test/services/InitRegisterService?wsdl", xmlFileContent, lineId);
// byte[] returns = reg.initRegister(registerTypeBz.getBytes(), encryPlatformAuthCode.getBytes(), encryLoginToken.getBytes(), xmlFileName.getBytes(), encryXmlFileContent.getBytes(), ClientUtils.getAttachmentZip(attachmentZipPath));
byte[] returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>RegInfoError:100_001</error>\n</errors>\n</feedback>\n".getBytes();
resultJson.put("code", "0");
resultJson.put("info", new String(returns));
hlsWsRequests.setReturnStatus("S");
hlsWsRequests.setResponseClob(new String(returns));
System.out.println("dddd" + new String(returns));
} catch (Exception e) {
......@@ -159,8 +167,11 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
e.printStackTrace();
resultJson.put("code", "-1");
resultJson.put("info", e.getMessage());
hlsWsRequests.setReturnStatus("E");
hlsWsRequests.setResponsedDate(new Date());
}
hlsWsRequestsMapper.updateByPrimaryKeySelective(hlsWsRequests);
return resultJson;
}
......@@ -211,9 +222,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
fndZhongDengLines.setLineId(batch.getLineId());
fndZhongDengLines = fndZhongDengLinesMapper.selectByPrimaryKey(fndZhongDengLines);
if (Objects.nonNull(fndZhongDengLines)) {
if (Objects.nonNull(fndZhongDengLines) && "UPING".equalsIgnoreCase(fndZhongDengLines.getUpStatus())) {
String xmlFileContent = "";
String encryXmlFileContent = "";
String attachmentZipPath = "";
try {
String registerResult = "";
......@@ -229,28 +239,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
/*解析xml文件内容*/
xmlFileContent = new String(ClientUtils.getxmlFileContent(fndAtmAttachmentDto.getFilePath()));
/*SM2算法加密*/
// loginToken = SM2Utils.encryptByKeyStr(loginToken, clientKey);
// encryXmlFileContent = SM2Utils.encryptByKeyStr(xmlFileContent, clientKey);
// platformAuthCode = SM2Utils.encryptByKeyStr(platformAuthCode, clientKey);
// WSInitRegisterServiceService service = new WSInitRegisterServiceService();
// WSInitRegisterService reg = service.getWSInitRegisterServicePort();
/*插入接口日志表*/
HlsWsRequests hlsWsRequests = createRequestLog("https://ws.zhongdengwang.org.cn/mfrs_ws_test/services/InitRegisterService?wsdl", xmlFileContent, batch.getLineId());
// byte[] returns = reg.initRegister(fndZhongDengLines.getTypebz().getBytes(), platformAuthCode.getBytes(), loginToken.getBytes(), fndAtmAttachmentDto.getFileName().getBytes(), encryXmlFileContent.getBytes(), ClientUtils.getAttachmentZip(attachmentZipPath));
// if ("INIT".equalsIgnoreCase(fndZhongDengLines.getUpStage())) {
//resultJson = registerInit(fndZhongDengLines.getTypebz(), platformAuthCode, loginToken, fndAtmAttachmentDto.getFileName(), xmlFileContent);
// }
if ("INIT".equalsIgnoreCase(fndZhongDengLines.getUpStage())) {
resultJson = registerInit(fndZhongDengLines.getTypebz(), platformAuthCode, loginToken, fndAtmAttachmentDto.getFileName(), xmlFileContent, fndZhongDengLines.getLineId());
}
String returns = "";
// if ("0".equalsIgnoreCase(resultJson.getString("code"))) {
// returns = resultJson.getString("info");
// } else {
// returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>\n" + resultJson.getString("info") + "</error>\n</errors>\n</feedback>\n";
// }
returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>RegInfoError:100_001</error>\n</errors>\n</feedback>\n";
hlsWsRequests.setResponseClob(returns);
if ("0".equalsIgnoreCase(resultJson.getString("code"))) {
returns = resultJson.getString("info");
} else {
returns = "<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>\n" + resultJson.getString("info") + "</error>\n</errors>\n</feedback>\n";
}
/*解析接口返回结果*/
returnJson = XML.toJSONObject(returns);
......@@ -264,15 +262,12 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
fndZhongDengLines.setAuthorizationCode(authorizationCode);
fndZhongDengLines.setUpStatus("SUCCESS");
fndZhongDengLines.setReturnMsg("上报成功");
hlsWsRequests.setReturnStatus("SUCCESS");
/*失败*/
} else {
error = returnJson.getJSONObject("feedback").getString("errors");
fndZhongDengLines.setUpStatus("FAIL");
fndZhongDengLines.setReturnMsg(error);
hlsWsRequests.setReturnStatus("FAIL");
}
hlsWsRequests.setResponsedDate(new Date());
fndZhongDengLines.setUpDate(new Date());
fndZhongDengLines.set__status(DTOStatus.UPDATE);
......
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