Compare commits
4 Commits
0836261a05
...
f0e99efd26
Author | SHA1 | Date |
---|---|---|
ic_excellent | f0e99efd26 | |
ic_excellent | 25c729783d | |
ic_excellent | dedfee53c1 | |
ic_excellent | 098c568713 |
|
@ -44,22 +44,23 @@ public class ReportService {
|
||||||
String endDate = Util.null2String(param.get("endDate"));
|
String endDate = Util.null2String(param.get("endDate"));
|
||||||
//航班车次
|
//航班车次
|
||||||
String flightAndTrain = Util.null2String(param.get("flightAndTrain"));
|
String flightAndTrain = Util.null2String(param.get("flightAndTrain"));
|
||||||
String whereSql = "";
|
String whereSql = " and (frhsz = 0 or frhsz is null) ";
|
||||||
if(!"".equals(beginDate) && !"".equals(endDate)){
|
if(!"".equals(beginDate) && !"".equals(endDate)){
|
||||||
whereSql += " and (dlsk1 between #{param.beginDate} and #{param.endDate} )";
|
whereSql += " and (dlsk1 between #{param.beginDate} and #{param.endDate} )";
|
||||||
}else {
|
|
||||||
param.put("today", TimeUtil.getCurrentDateString());
|
|
||||||
whereSql += " and dlsk1 >= #{param.today} ";
|
|
||||||
}
|
}
|
||||||
if(!"".equals(registrationPeople)){
|
if(!"".equals(registrationPeople)){
|
||||||
whereSql += " and dyjbr = #{param.registrationPeople} ";
|
whereSql += " and dyjbr = #{param.registrationPeople} ";
|
||||||
}
|
}
|
||||||
if(!"".equals(flightAndTrain)){
|
if(!"".equals(flightAndTrain)){
|
||||||
whereSql += " and hbcc = #{param.flightAndTrain} ";
|
whereSql += " and hbcc like '%"+flightAndTrain+"%' ";
|
||||||
}
|
}
|
||||||
if(!"".equals(project)){
|
if(!"".equals(project)){
|
||||||
//whereSql += " and exits (select 1 from uf_zwfwdjjmb_dt1 where mainid = main.id and ysdx = #{param.project}) ";
|
//whereSql += " and exits (select 1 from uf_zwfwdjjmb_dt1 where mainid = main.id and ysdx = #{param.project}) ";
|
||||||
whereSql += " and exits (select 1 from uf_zwfwdjjmb_dt1 where mainid = main.id and wb like '%$t{param.project}%') ";
|
whereSql += " and exits (select 1 from uf_zwfwdjjmb_dt1 where mainid = main.id and wb like '%"+project+"%') ";
|
||||||
|
}
|
||||||
|
if(("".equals(beginDate) || "".equals(endDate)) && "".equals(registrationPeople) && "".equals(flightAndTrain)){
|
||||||
|
param.put("today", TimeUtil.getCurrentDateString());
|
||||||
|
whereSql += " and dlsk1 >= #{param.today} ";
|
||||||
}
|
}
|
||||||
whereSql = whereSql.replaceFirst(" and "," where ");
|
whereSql = whereSql.replaceFirst(" and "," where ");
|
||||||
return whereSql;
|
return whereSql;
|
||||||
|
|
|
@ -20,7 +20,7 @@ public interface GenerateMapper {
|
||||||
* @return 更新结果
|
* @return 更新结果
|
||||||
*/
|
*/
|
||||||
@Update("update uf_contract_num_log set workflow_info = #{workflowInfo},file_info = #{fileInfo},detail_id = #{detailId}," +
|
@Update("update uf_contract_num_log set workflow_info = #{workflowInfo},file_info = #{fileInfo},detail_id = #{detailId}," +
|
||||||
"row_id = #{rowId},contract_name = #{contractName},contract_num = #{contractNum},flow_num = #{flowNum},contract_month = #{contractMonth} where id = #{dataId}")
|
"row_id = #{rowId},contract_name = #{contractName},contract_num = #{contractNum},flow_num = #{flowNum},contract_month = #{contractMonth},contract_year = #{contractYear} where id = #{dataId}")
|
||||||
boolean updateContractLog(Map<String,Object> param);
|
boolean updateContractLog(Map<String,Object> param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,8 +34,8 @@ public interface GenerateMapper {
|
||||||
* <h2>查询最大的流水号</h2>
|
* <h2>查询最大的流水号</h2>
|
||||||
* @return 最大的流水号
|
* @return 最大的流水号
|
||||||
*/
|
*/
|
||||||
@Select("select max(flow_num) from uf_contract_num_log where contract_month = #{month}")
|
@Select("select max(flow_num) from uf_contract_num_log where contract_month = #{month} and contract_year = {year}")
|
||||||
int getMaxFlowByMonth(@ParamMapper("month")int month);
|
int getMaxFlowByMonth(@ParamMapper("month")int month,@ParamMapper("year")int year);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>删除编号信息</h2>
|
* <h2>删除编号信息</h2>
|
||||||
|
|
|
@ -32,8 +32,9 @@ public class GenerateContractNoService {
|
||||||
public String generateCode(Map<String,Object> param){
|
public String generateCode(Map<String,Object> param){
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
int month = calendar.get(Calendar.MONTH);
|
int month = calendar.get(Calendar.MONTH);
|
||||||
|
int year = calendar.get(Calendar.YEAR);
|
||||||
//int maxFlow = generateMapper.getMaxFlow();
|
//int maxFlow = generateMapper.getMaxFlow();
|
||||||
int maxFlow = generateMapper.getMaxFlowByMonth(month);
|
int maxFlow = generateMapper.getMaxFlowByMonth(month,year);
|
||||||
maxFlow = Math.max(maxFlow,0);
|
maxFlow = Math.max(maxFlow,0);
|
||||||
maxFlow++;
|
maxFlow++;
|
||||||
String contractNo = "";
|
String contractNo = "";
|
||||||
|
@ -52,6 +53,7 @@ public class GenerateContractNoService {
|
||||||
param.put("contractNum",contractNo);
|
param.put("contractNum",contractNo);
|
||||||
param.put("flowNum",maxFlow);
|
param.put("flowNum",maxFlow);
|
||||||
param.put("contractMonth",month);
|
param.put("contractMonth",month);
|
||||||
|
param.put("contractYear",year);
|
||||||
boolean updateFlag = generateMapper.updateContractLog(param);
|
boolean updateFlag = generateMapper.updateContractLog(param);
|
||||||
Util.rebuildModeDataShareByAsync(1,TABLE_NAME,dataId);
|
Util.rebuildModeDataShareByAsync(1,TABLE_NAME,dataId);
|
||||||
if(updateFlag){
|
if(updateFlag){
|
||||||
|
|
|
@ -27,6 +27,9 @@ public class SyncAccountInfoFromSapJob extends BaseCronJob {
|
||||||
|
|
||||||
private final static String JobName = " SyncAccountInfoFromSapJob ";
|
private final static String JobName = " SyncAccountInfoFromSapJob ";
|
||||||
|
|
||||||
|
/** 模块id */
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
private String interfaceName;
|
private String interfaceName;
|
||||||
|
|
||||||
private String theNearPeriod;
|
private String theNearPeriod;
|
||||||
|
@ -122,7 +125,7 @@ public class SyncAccountInfoFromSapJob extends BaseCronJob {
|
||||||
periodBalance.setEvCurrency(Util.null2String(balanceResponse.getString("EvCurrency")));
|
periodBalance.setEvCurrency(Util.null2String(balanceResponse.getString("EvCurrency")));
|
||||||
periodBalance.setGlAccount(glAccount);
|
periodBalance.setGlAccount(glAccount);
|
||||||
|
|
||||||
periodBalance.save(periodBalance, 52, "uf_period_balance");
|
periodBalance.save(periodBalance, Util.getIntValue(this.modelId), "uf_period_balance");
|
||||||
|
|
||||||
// String result = "";
|
// String result = "";
|
||||||
//// String url = "http://127.0.0.1/uapws/service/nc65to63projectsysplugin";//这是接口地址,注意去掉.wsdl,否则会报错
|
//// String url = "http://127.0.0.1/uapws/service/nc65to63projectsysplugin";//这是接口地址,注意去掉.wsdl,否则会报错
|
||||||
|
|
|
@ -32,8 +32,19 @@ public class SyncAccountStatementJob extends BaseCronJob {
|
||||||
|
|
||||||
private String interfaceName;
|
private String interfaceName;
|
||||||
|
|
||||||
|
/** 模块id */
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
private final static String JobName = " SyncAccountStatementJob ";
|
private final static String JobName = " SyncAccountStatementJob ";
|
||||||
|
|
||||||
|
public String getModelId() {
|
||||||
|
return modelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModelId(String modelId) {
|
||||||
|
this.modelId = modelId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getInterfaceName() {
|
public String getInterfaceName() {
|
||||||
return interfaceName;
|
return interfaceName;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +264,7 @@ public class SyncAccountStatementJob extends BaseCronJob {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dayBalance.save(dayBalance, 50, "uf_bank_day_balance");
|
dayBalance.save(dayBalance, Util.getIntValue(this.modelId), "uf_bank_day_balance");
|
||||||
logger.writeLog(JobName + " result dayBalance: " + dayBalance.toString());
|
logger.writeLog(JobName + " result dayBalance: " + dayBalance.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import org.dom4j.DocumentHelper;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
import weaver.general.BaseBean;
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Time;
|
||||||
|
import weaver.general.TimeUtil;
|
||||||
import weaver.general.Util;
|
import weaver.general.Util;
|
||||||
import weaver.interfaces.schedule.BaseCronJob;
|
import weaver.interfaces.schedule.BaseCronJob;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -29,6 +31,9 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
|
||||||
|
|
||||||
BaseBean logger = new BaseBean();
|
BaseBean logger = new BaseBean();
|
||||||
|
|
||||||
|
/** 模块id */
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
private String interfaceName;
|
private String interfaceName;
|
||||||
|
|
||||||
/** 同步开始日期 */
|
/** 同步开始日期 */
|
||||||
|
@ -125,9 +130,13 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
|
||||||
xmlParams.put("actacn", actacn);
|
xmlParams.put("actacn", actacn);
|
||||||
//xmlParams.put("from", "20220919");
|
//xmlParams.put("from", "20220919");
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.set(Calendar.DAY_OF_MONTH, -1);
|
cal.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
String from = !"".equals(Util.null2String(this.fromDate)) ? this.fromDate : ZennerUtil.parseToDateString(cal.getTime(), ZennerUtil.formatYYYYMMDD_NoSplit);
|
String to = !"".equals(Util.null2String(this.fromDate)) ? this.fromDate : ZennerUtil.parseToDateString(cal.getTime(), ZennerUtil.formatYYYYMMDD_NoSplit);
|
||||||
String to = !"".equals(Util.null2String(this.toDate)) ? this.toDate : ZennerUtil.parseToDateString(new Date(), ZennerUtil.formatYYYYMMDD_NoSplit);
|
cal.add(Calendar.DAY_OF_MONTH,-1);
|
||||||
|
String from = !"".equals(Util.null2String(this.toDate))
|
||||||
|
? this.toDate
|
||||||
|
: ZennerUtil.parseToDateString(cal.getTime(), ZennerUtil.formatYYYYMMDD_NoSplit);
|
||||||
|
//String to = !"".equals(Util.null2String(this.toDate)) ? this.toDate : ZennerUtil.parseToDateString(new Date(), ZennerUtil.formatYYYYMMDD_NoSplit);
|
||||||
xmlParams.put("from", from);
|
xmlParams.put("from", from);
|
||||||
xmlParams.put("to", to);
|
xmlParams.put("to", to);
|
||||||
xmlParams.put("amountFrom", "1");
|
xmlParams.put("amountFrom", "1");
|
||||||
|
@ -354,7 +363,7 @@ public class SyncAccountTradeInfoJob extends BaseCronJob {
|
||||||
logger.writeLog(JobName + " result tradeInfoList size: " + tradeInfoList.size());
|
logger.writeLog(JobName + " result tradeInfoList size: " + tradeInfoList.size());
|
||||||
for (TradeInfo tradeInfo : tradeInfoList){
|
for (TradeInfo tradeInfo : tradeInfoList){
|
||||||
if (!"".equals(tradeInfo.getIbknum())){
|
if (!"".equals(tradeInfo.getIbknum())){
|
||||||
tradeInfo.save(tradeInfo, 51, "uf_bank_trade_info");
|
tradeInfo.save(tradeInfo, Util.getIntValue(this.modelId), "uf_bank_trade_info");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package weaver.bokang.xiao.zxyh.depart_sync.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Depart 类是表示部门信息的实体类。
|
||||||
|
*
|
||||||
|
* @Author 肖博亢
|
||||||
|
* @Date 2023/7/21 11:11
|
||||||
|
* @Description 此类用于封装部门信息,用于数据同步。
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@XmlRootElement(name = "dept")
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class Depart {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门名称
|
||||||
|
*/
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
|
private int deptId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统类型
|
||||||
|
*/
|
||||||
|
private String systemType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统编码
|
||||||
|
*/
|
||||||
|
private String systemCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务名称
|
||||||
|
*/
|
||||||
|
private String businessName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务ID
|
||||||
|
*/
|
||||||
|
private String businessId;
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package weaver.bokang.xiao.zxyh.depart_sync.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DepartVO 类是用于传递部门信息的实体类。
|
||||||
|
*
|
||||||
|
* @Author 肖博亢
|
||||||
|
* @Date 2023/7/21 11:10
|
||||||
|
* @Description 此类用于封装发送部门信息的数据。
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@XmlRootElement(name = "root")
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class DepartVO {
|
||||||
|
/**
|
||||||
|
* 发送者名称
|
||||||
|
*/
|
||||||
|
private String sender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收者名称
|
||||||
|
*/
|
||||||
|
private String receiver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传输数据
|
||||||
|
*/
|
||||||
|
private String trans;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易流水号
|
||||||
|
*/
|
||||||
|
private String serials;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回代码
|
||||||
|
*/
|
||||||
|
private String retCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回信息
|
||||||
|
*/
|
||||||
|
private String retmsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否成功
|
||||||
|
*/
|
||||||
|
private boolean success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码
|
||||||
|
*/
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门列表
|
||||||
|
*/
|
||||||
|
@XmlElementWrapper(name = "deptList")
|
||||||
|
private List<Depart> dept;
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package weaver.bokang.xiao.zxyh.depart_sync.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SendDTO 类是用于传递数据的实体类。
|
||||||
|
*
|
||||||
|
* @Author 肖博亢
|
||||||
|
* @Date 2023/7/21 11:10
|
||||||
|
* @Description 此类用于封装发送数据的信息。
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@XmlRootElement(name = "root")
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class SendDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送者名称
|
||||||
|
*/
|
||||||
|
private String sender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收者名称
|
||||||
|
*/
|
||||||
|
private String receiver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传输数据
|
||||||
|
*/
|
||||||
|
private String trans;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易流水号
|
||||||
|
*/
|
||||||
|
private String serials;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统编码
|
||||||
|
*/
|
||||||
|
private String systemCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送类型
|
||||||
|
*/
|
||||||
|
private String sendType;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package weaver.bokang.xiao.zxyh.depart_sync.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
import weaver.bokang.xiao.zxyh.depart_sync.entity.Depart;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SyncMapper
|
||||||
|
* @Author 肖博亢
|
||||||
|
* @Date 2023/7/21 11:09
|
||||||
|
* @Description <h1></h1>
|
||||||
|
**/
|
||||||
|
@SqlMapper
|
||||||
|
public interface SyncMapper {
|
||||||
|
|
||||||
|
@Select("select * from uf_depart_info")
|
||||||
|
List<Depart> queryDepartList();
|
||||||
|
|
||||||
|
@BatchUpdate("update uf_depart_info set dept_name = #{item.deptName}, dept_id = #{item.deptId}, system_type = #{item.systemType}, system_code = #{item.systemCode}, " +
|
||||||
|
" business_name= #{item.businessName}, business_id = #{item.businessId} " +
|
||||||
|
"where id = #{item.id}")
|
||||||
|
boolean updateDepart(@BatchSqlArgs List<Depart> departList);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package weaver.bokang.xiao.zxyh.depart_sync.schedule;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.action.CusBaseCronJob;
|
||||||
|
import aiyh.utils.annotation.ActionDesc;
|
||||||
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import lombok.Setter;
|
||||||
|
import weaver.bokang.xiao.zxyh.depart_sync.entity.Depart;
|
||||||
|
import weaver.bokang.xiao.zxyh.depart_sync.entity.DepartVO;
|
||||||
|
import weaver.bokang.xiao.zxyh.depart_sync.entity.SendDTO;
|
||||||
|
import weaver.bokang.xiao.zxyh.depart_sync.mapper.SyncMapper;
|
||||||
|
import weaver.general.TimeUtil;
|
||||||
|
import weaver.xiao.commons.utils.RequestUtil;
|
||||||
|
import weaver.xiao.commons.utils.VerifyUtil;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName DepartSyncSchedule
|
||||||
|
* @Author 肖博亢
|
||||||
|
* @Date 2023/7/21 11:07
|
||||||
|
* @Description <h1></h1>
|
||||||
|
**/
|
||||||
|
@Setter
|
||||||
|
@ActionDesc(value = "同步总行部门信息", author = "bokang.xiao")
|
||||||
|
public class DepartSyncSchedule extends CusBaseCronJob {
|
||||||
|
|
||||||
|
@RequiredMark("发送请求地址")
|
||||||
|
@PrintParamMark
|
||||||
|
private String sendUrl;
|
||||||
|
|
||||||
|
@RequiredMark("部门模块ID")
|
||||||
|
@PrintParamMark
|
||||||
|
private String departModeId;
|
||||||
|
|
||||||
|
@RequiredMark("发送者名称")
|
||||||
|
@PrintParamMark
|
||||||
|
private String sender;
|
||||||
|
|
||||||
|
@RequiredMark("接收者名称")
|
||||||
|
@PrintParamMark
|
||||||
|
private String receiver;
|
||||||
|
|
||||||
|
@RequiredMark("传输数据")
|
||||||
|
@PrintParamMark
|
||||||
|
private String trans;
|
||||||
|
|
||||||
|
@RequiredMark("系统编码")
|
||||||
|
@PrintParamMark
|
||||||
|
private String systemCode;
|
||||||
|
|
||||||
|
@RequiredMark("发送类型")
|
||||||
|
@PrintParamMark
|
||||||
|
private String sendType;
|
||||||
|
|
||||||
|
private final SyncMapper syncMapper = Util.getMapper(SyncMapper.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCode() throws IOException {
|
||||||
|
try {
|
||||||
|
List<Depart> sourceDepartList = syncMapper.queryDepartList();
|
||||||
|
Map<Integer, Integer> departMap = new HashMap<>();
|
||||||
|
if(Objects.nonNull(sourceDepartList) && !sourceDepartList.isEmpty()) {
|
||||||
|
departMap = sourceDepartList.stream().collect(Collectors.toMap(Depart::getDeptId, Depart::getId));
|
||||||
|
}
|
||||||
|
log.info("sync depart departMap ==>"+JSON.toJSONString(departMap));
|
||||||
|
SendDTO sendDTO = SendDTO.builder()
|
||||||
|
.sendType(this.sendType)
|
||||||
|
.sender(this.sender)
|
||||||
|
.receiver(this.receiver)
|
||||||
|
.trans(this.trans)
|
||||||
|
.systemCode(this.systemCode)
|
||||||
|
.serials(this.sender + TimeUtil.getFormartString(new Date(),"yyyyMMddHHmmSSsss")).build();
|
||||||
|
log.info("sendDTO =>"+sendDTO);
|
||||||
|
String sendXml = VerifyUtil.beanToXml(sendDTO);
|
||||||
|
log.info("depart req param ==>"+sendXml);
|
||||||
|
String resultXml = RequestUtil.sendToTPCG2(sendXml, sendUrl);
|
||||||
|
if (!"".equals(resultXml)) {
|
||||||
|
DepartVO departVO = VerifyUtil.xmlStrToObject(DepartVO.class, resultXml);
|
||||||
|
log.info("depart List ==>"+ JSON.toJSONString(departVO));
|
||||||
|
if(!departVO.isSuccess()){
|
||||||
|
log.error("请求不成功");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Depart> departList = departVO.getDept();
|
||||||
|
if(Objects.nonNull(departList) && !departList.isEmpty()){
|
||||||
|
List<Integer> dataIdList = new ArrayList<>();
|
||||||
|
for (Depart depart : departList) {
|
||||||
|
if(departMap.containsKey(depart.getDeptId())){
|
||||||
|
depart.setId(departMap.get(depart.getDeptId()));
|
||||||
|
}else {
|
||||||
|
int dataId = Util.getModeDataId("uf_depart_info", Util.getIntValue(departModeId), 1);
|
||||||
|
depart.setId(dataId);
|
||||||
|
dataIdList.add(dataId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
syncMapper.updateDepart(departList);
|
||||||
|
Util.rebuildModeDataShareByAsyncList(1,Util.getIntValue(departModeId),dataIdList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("同步发生异常 ==>"+ Util.getErrString(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package weaver.xiao.commons.utils;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.client.methods.*;
|
import org.apache.http.client.methods.*;
|
||||||
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.ContentType;
|
||||||
|
@ -13,12 +14,13 @@ import org.apache.http.util.EntityUtils;
|
||||||
import weaver.wechat.request.HttpManager;
|
import weaver.wechat.request.HttpManager;
|
||||||
import weaver.xiao.commons.exception.RequestException;
|
import weaver.xiao.commons.exception.RequestException;
|
||||||
import weaver.zwl.common.ToolUtil;
|
import weaver.zwl.common.ToolUtil;
|
||||||
|
import weaver.zwl.common.logging.Logger;
|
||||||
|
import weaver.zwl.common.logging.LoggerFactory;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import java.io.IOException;
|
import java.io.*;
|
||||||
import java.io.InputStream;
|
import java.net.URL;
|
||||||
import java.io.PrintWriter;
|
import java.net.URLConnection;
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -30,6 +32,8 @@ import java.util.Map;
|
||||||
|
|
||||||
public class RequestUtil {
|
public class RequestUtil {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger();
|
||||||
|
|
||||||
public static <T> T apiRequest(RequestBaseInfo requestInfo, Class<T> tClass){
|
public static <T> T apiRequest(RequestBaseInfo requestInfo, Class<T> tClass){
|
||||||
|
|
||||||
Map<String,String> headers = requestInfo.getHeaders();
|
Map<String,String> headers = requestInfo.getHeaders();
|
||||||
|
@ -135,6 +139,50 @@ public class RequestUtil {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String sendToTPCG2(String xml, String URL) {
|
||||||
|
byte[] data = xml.getBytes();
|
||||||
|
InputStream instr = null;
|
||||||
|
String res = "";
|
||||||
|
try {
|
||||||
|
logger.info("--- 开始调用外联平台接口 url => " + URL + " ---");
|
||||||
|
java.net.URL url = new URL(URL);
|
||||||
|
URLConnection urlCon = url.openConnection();
|
||||||
|
int time = 180000;
|
||||||
|
urlCon.setConnectTimeout(time);
|
||||||
|
urlCon.setReadTimeout(time);
|
||||||
|
urlCon.setDoOutput(true);
|
||||||
|
urlCon.setDoInput(true);
|
||||||
|
urlCon.setUseCaches(false);
|
||||||
|
urlCon.setRequestProperty("content-Type", "application/xml");
|
||||||
|
urlCon.setRequestProperty("charset", "utf-8");
|
||||||
|
DataOutputStream printout = new DataOutputStream(
|
||||||
|
urlCon.getOutputStream());
|
||||||
|
printout.write(data);
|
||||||
|
printout.flush();
|
||||||
|
printout.close();
|
||||||
|
instr = urlCon.getInputStream();
|
||||||
|
byte[] bis = IOUtils.toByteArray(instr);
|
||||||
|
res = new String(bis, StandardCharsets.UTF_8);
|
||||||
|
if ("".equals(res.trim())) {
|
||||||
|
throw new RuntimeException("调用 " +URL + " 接口响应为空!");
|
||||||
|
}
|
||||||
|
logger.info("外联平台返回信息 => " + res);
|
||||||
|
return res;
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.info("异常[" + e.getMessage() + "]");
|
||||||
|
throw new RuntimeException(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (instr != null) {
|
||||||
|
instr.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String serializableUrl(String url,Map<String,Object> params){
|
public static String serializableUrl(String url,Map<String,Object> params){
|
||||||
if(params == null || params.isEmpty()){
|
if(params == null || params.isEmpty()){
|
||||||
return url;
|
return url;
|
||||||
|
|
|
@ -130,6 +130,27 @@ public class VerifyUtil {
|
||||||
return xmlStr;
|
return xmlStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> String beanToXml(T t){
|
||||||
|
String xmlStr = "";
|
||||||
|
try {
|
||||||
|
//1、创建上下文
|
||||||
|
JAXBContext context = JAXBContext.newInstance(t.getClass());
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
//2、创建Marshaller 这个是用于转换成xml的
|
||||||
|
Marshaller marshaller = context.createMarshaller();
|
||||||
|
//3、设置marshaller的属性
|
||||||
|
//JAXB_FORMATTED_OUTPUT:格式化
|
||||||
|
//JAXB_ENCODING:编码格式
|
||||||
|
// marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
||||||
|
//4、将实体类读取到writer中
|
||||||
|
marshaller.marshal(t, writer);
|
||||||
|
xmlStr = writer.toString();
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("java bean 转换 xml异常 ==>"+LogUtil.getExceptionStr(e));
|
||||||
|
}
|
||||||
|
return xmlStr;
|
||||||
|
}
|
||||||
|
|
||||||
public static String mapToXml(Map<String, Object> map) {
|
public static String mapToXml(Map<String, Object> map) {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append("\n").append("<root>").append("\n");
|
stringBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append("\n").append("<root>").append("\n");
|
||||||
|
|
|
@ -56,6 +56,7 @@ import weaver.bokang.xiao.zscq.action.StatusChangeAction;
|
||||||
import weaver.bokang.xiao.zscq.config.service.ModeChangeService;
|
import weaver.bokang.xiao.zscq.config.service.ModeChangeService;
|
||||||
import weaver.bokang.xiao.zscq.store.TableNameStore;
|
import weaver.bokang.xiao.zscq.store.TableNameStore;
|
||||||
import weaver.bokang.xiao.zxyh.RepeatSubmitAction;
|
import weaver.bokang.xiao.zxyh.RepeatSubmitAction;
|
||||||
|
import weaver.bokang.xiao.zxyh.depart_sync.schedule.DepartSyncSchedule;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
import weaver.general.StaticObj;
|
import weaver.general.StaticObj;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
@ -85,7 +86,7 @@ public class NormalTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWord(){
|
public void testWord(){
|
||||||
GenerateFileUtil.createCronJobDocument(SyncTeachDataSchedule.class);
|
GenerateFileUtil.createCronJobDocument(DepartSyncSchedule.class);
|
||||||
//GenerateFileUtil.createActionDocument(DataPushAction.class);
|
//GenerateFileUtil.createActionDocument(DataPushAction.class);
|
||||||
//GenerateFileUtil.createActionDocument(DateFieldUpdateAction.class);
|
//GenerateFileUtil.createActionDocument(DateFieldUpdateAction.class);
|
||||||
}
|
}
|
||||||
|
@ -122,11 +123,28 @@ public class NormalTest extends BaseTest {
|
||||||
examineSchedule.runCode();
|
examineSchedule.runCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDatea(){
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.add(Calendar.DAY_OF_MONTH,-1);
|
||||||
|
// 获取修改后的日期并赋值给 from
|
||||||
|
String to = new SimpleDateFormat("yyyyMMdd").format(cal.getTime());
|
||||||
|
// 将日期减一天
|
||||||
|
cal.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
|
||||||
|
// 获取修改后的日期并赋值给 to
|
||||||
|
String from = new SimpleDateFormat("yyyyMMdd").format(cal.getTime());
|
||||||
|
|
||||||
|
System.out.println("From: " + from);
|
||||||
|
System.out.println("To: " + to);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testResponseSync(){
|
public void testResponseSync(){
|
||||||
ParseTest parseTest = new ParseTest();
|
ParseTest parseTest = new ParseTest();
|
||||||
Map<String, Object> resultData = parseTest.getResultData();
|
Map<String, Object> resultData = parseTest.getResultData();
|
||||||
System.out.println(JSON.toJSONString(resultData));
|
System.out.println(JSON.toJSONString(resultData));
|
||||||
|
|
||||||
//ResponseMappingDeal responseMappingDeal = new ResponseMappingDeal();
|
//ResponseMappingDeal responseMappingDeal = new ResponseMappingDeal();
|
||||||
//responseMappingDeal.doResponseSync("test1",resultData);
|
//responseMappingDeal.doResponseSync("test1",resultData);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue