提交 7bdc607a 作者: 轩辕玉

实现汇聚平台对账数据生成功能

实现数据写到excel文件功能
实现数据封装成XML格式功能
实现汇聚平台推送功能
上级 e499e03f
...@@ -6,7 +6,6 @@ import com.reconciliation.recfj.service.RecService; ...@@ -6,7 +6,6 @@ import com.reconciliation.recfj.service.RecService;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
/** /**
...@@ -27,4 +26,16 @@ public class RecController { ...@@ -27,4 +26,16 @@ public class RecController {
} }
return recService.createRecDataToExcel(rec); return recService.createRecDataToExcel(rec);
} }
@RequestMapping("/test_add_xml")
@ResponseBody
public ReturnValue testAddXmlToWebService() {
return recService.testAddXmlToWebService();
}
@RequestMapping("/test_delete_xml")
@ResponseBody
public ReturnValue testDelXmlToWebService() {
return recService.testDelXmlToWebService();
}
} }
package com.reconciliation.recfj.entity; package com.reconciliation.recfj.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*; import lombok.*;
...@@ -102,4 +103,10 @@ public class RecExcel { ...@@ -102,4 +103,10 @@ public class RecExcel {
*/ */
@ExcelProperty("备注") @ExcelProperty("备注")
private String remark; private String remark;
/**
* 临时字段:业务更新年月/年月日
*/
@ExcelIgnore
private String tbrq;
} }
package com.reconciliation.recfj.entity;
import lombok.Data;
/**
* @author : Fengmao
* @date : 2024-11-14
**/
@Data
public class RecXml {
private String primaryKey;
private String idxNo;
private String idxType;
private String tableName;
private String dateTime;
private String dataArea;
private String otherDim;
private String dataCount;
private String execTime;
private String maxUpdateTime;
private String remark;
private String type;
}
package com.reconciliation.recfj.mapper; package com.reconciliation.recfj.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.reconciliation.recfj.entity.RecExcel; import com.reconciliation.recfj.entity.RecExcel;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
...@@ -11,35 +12,27 @@ import java.util.List; ...@@ -11,35 +12,27 @@ import java.util.List;
* @author 史连宁 * @author 史连宁
*/ */
@Mapper @Mapper
public interface RecMapper { public interface RecMapper extends BaseMapper<RecExcel> {
@Select("<script>" + @Select("<script>" +
" select count(*) value, max(tbrq) latestUpdateDate from ${table} t " + " select count(*) value, max(tbrq) latestUpdateDate from ${table} t " +
"</script") "</script>")
List<RecExcel> getRecAll1(String table); List<RecExcel> getRecAll1(String table);
@Select("<script>" + @Select("<script>" +
" select count(*) value, max(t.tbrq) latestUpdateDate from ${table} t, ${table}_D d where t.recordid=d.recordid" + " select count(*) value, max(t.tbrq) latestUpdateDate from ${table} t, ${table}_D d where t.recordid=d.recordid" +
"</script") "</script>")
List<RecExcel> getRecAll2(String table); List<RecExcel> getRecAll2(String table);
@Select("<script>" + @Select("select count(*), tbrq from (select TO_CHAR(t.tbrq,'yyyy-MM') tbrq from ${table} t)a group by tbrq ")
" " +
"</script")
List<RecExcel> getRecMon1(String table); List<RecExcel> getRecMon1(String table);
@Select("<script>" + @Select("select count(*), tbrq from (select TO_CHAR(t.tbrq,'yyyy-MM') tbrq from ${table} t,${table}_D d where t.recordid=d.recordid)a group by tbrq")
" " +
"</script")
List<RecExcel> getRecMon2(String table); List<RecExcel> getRecMon2(String table);
@Select("<script>" + @Select("select count(*), tbrq from (select TO_CHAR(t.tbrq,'yyyy-MM-dd') tbrq from ${table} t where t.tbrq>= to_char(now() - interval '30' day,'yyyy-MM-dd') and t.tbrq < to_char(now(),'yyyy-MM-dd'))a group by tbrq")
" " +
"</script")
List<RecExcel> getRecDay1(String table); List<RecExcel> getRecDay1(String table);
@Select("<script>" + @Select("select count(*), tbrq from (select TO_CHAR(t.tbrq,'yyyy-MM-dd') tbrq from ${table} t,${table}_D d where t.recordid=d.recordid and t.tbrq>= to_char(now() - interval '30' day,'yyyy-MM-dd') and t.tbrq < to_char(now(),'yyyy-MM-dd'))a group by tbrq")
" " +
"</script")
List<RecExcel> getRecDay2(String table); List<RecExcel> getRecDay2(String table);
} }
package com.reconciliation.recfj.service;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
* @author : Fengmao
* @date : 2024-11-14
**/
@Service
public class SendWebService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Value("${api.wsdl}")
private String wsdl;
@Value("${api.userid}")
private String userid;
@Value("${api.password}")
private String password;
@Value("${api.catalogId}")
private String catalogId;
/**
* testwebservice接口测试方法
*
* @param userName 用户名
* @param passWord 密码
* @param catalogId 目录id
* @param xmlStr xml格式参数
* @param wsdl 接口wsdl
*/
public static void testWebService(String userName, String passWord, String catalogId, String xmlStr, String wsdl) {
try {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
//wsdl 为实际接口地址
org.apache.cxf.endpoint.Client client = dcf.createClient(wsdl);
//LoginByAccount 为用户身份验证接口方法名称,userName为用户名,passWord为密码
Object[] guidObjects = client.invoke("LoginByAccount", userName, passWord);
System.out.println("获取guid:" + guidObjects[0].toString());
//pushXml 为政务数据推送接口方法名称,参数个数按照接口定义进行传参,返回一个Object数组
Object[] objects = client.invoke("pushXml", guidObjects[0].toString(), catalogId, xmlStr);
//输出调用结果,Object数组第一条数据为返回结果
System.out.println("调用结果:" + objects[0].toString());
} catch (Exception e) {
e.printStackTrace();
}
}
public boolean pushXmlData(String xmlStr) {
this.logger.debug("推送的wsdl:" + wsdl);
boolean flag = false;
try {
this.logger.info("推送数据---开始");
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
//wsdl 为实际接口地址
org.apache.cxf.endpoint.Client client = dcf.createClient(wsdl);
//LoginByAccount 为用户身份验证接口方法名称,userName为用户名,passWord为密码
Object[] guidObjects = client.invoke("LoginByAccount", userid, password);
logger.info("获取guid:" + guidObjects[0].toString());
//pushXml 为政务数据推送接口方法名称,参数个数按照接口定义进行传参,返回一个Object数组
Object[] objects = client.invoke("pushXml", guidObjects[0].toString(), catalogId, xmlStr);
//输出调用结果,Object数组第一条数据为返回结果
logger.info("调用结果:" + objects[0].toString());
String pushXmlResult = objects[0].toString();
this.logger.info("调用结果:" + pushXmlResult);
} catch (Exception e) {
this.logger.info("推送数据---出错", e);
return flag;
}
this.logger.info("推送数据---结束");
return true;
}
}
<?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.reconciliation.recfj.mapper.RecMapper">
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论