领悦 凭证推送temp
This commit is contained in:
parent
ab3b3cc3b2
commit
42267abe79
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.salary.entity.ly.dto;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamOmitField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -19,13 +18,13 @@ import java.util.List;
|
|||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias( "voucher_head")
|
||||
@XStreamAlias("voucher_head")
|
||||
public class LyNCVoucher {
|
||||
|
||||
/**
|
||||
* 凭证主键 如果没有那就是新增,有就是修改 可空
|
||||
*/
|
||||
@XStreamOmitField
|
||||
@XStreamAlias("pk_voucher")
|
||||
private String pkVoucher;
|
||||
|
||||
/**
|
||||
|
|
@ -82,6 +81,9 @@ public class LyNCVoucher {
|
|||
@XStreamAlias("pk_org")
|
||||
private String pkOrg;
|
||||
|
||||
@XStreamAlias("discardflag")
|
||||
private String discardflag;
|
||||
|
||||
/**
|
||||
* 所集团 如果不输集团取当前登陆集团
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,12 +34,78 @@ public class LyNCVoucherDetail {
|
|||
@XStreamAlias("explanation")
|
||||
private String explanation;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@XStreamAlias("price")
|
||||
private String price;
|
||||
|
||||
/**
|
||||
* 折本汇率
|
||||
*/
|
||||
@XStreamAlias("excrate2")
|
||||
private String excrate2;
|
||||
|
||||
/**
|
||||
* 借方数量
|
||||
*/
|
||||
@XStreamAlias("debitquantity")
|
||||
private String debitquantity;
|
||||
|
||||
/**
|
||||
* 原币借方金额
|
||||
*/
|
||||
@XStreamAlias("debitamount")
|
||||
private String debitamount;
|
||||
|
||||
/**
|
||||
* 本币借方金额
|
||||
*/
|
||||
@XStreamAlias("localdebitamount")
|
||||
private String localdebitamount;
|
||||
|
||||
/**
|
||||
* 集团本币借方金额
|
||||
*/
|
||||
@XStreamAlias("groupdebitamount")
|
||||
private String groupdebitamount;
|
||||
|
||||
/**
|
||||
* 全局本币借方金额
|
||||
*/
|
||||
@XStreamAlias("globaldebitamount")
|
||||
private String globaldebitamount;
|
||||
|
||||
/**
|
||||
* 贷方数量 可空
|
||||
*/
|
||||
@XStreamAlias("creditquantity")
|
||||
private String creditquantity;
|
||||
|
||||
/**
|
||||
* 原币贷方金额 可空
|
||||
*/
|
||||
@XStreamAlias("creditamount")
|
||||
private String creditamount;
|
||||
|
||||
/**
|
||||
* 本币贷方金额 可空
|
||||
*/
|
||||
@XStreamAlias("localcreditamount")
|
||||
private String localcreditamount;
|
||||
|
||||
/**
|
||||
* 集团本币贷方金额
|
||||
*/
|
||||
@XStreamAlias("groupcreditamount")
|
||||
private String groupcreditamount;
|
||||
|
||||
/**
|
||||
* 全局本币贷方金额
|
||||
*/
|
||||
@XStreamAlias("globalcreditamount")
|
||||
private String globalcreditamount;
|
||||
|
||||
/**
|
||||
* 币种 非空
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.engine.salary.entity.ly.dto;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName LyVoucher
|
||||
* @date 2024/08/27 16:14
|
||||
* @description
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LyNCVoucherHead {
|
||||
|
||||
@XStreamAlias("voucher_head")
|
||||
private LyNCVoucher voucherHead;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.engine.salary.entity.ly.dto;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName LyVoucher
|
||||
* @date 2024/08/27 16:14
|
||||
* @description
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("ufinterface")
|
||||
public class LyNCVoucherReturn {
|
||||
|
||||
@XStreamAlias("sendresult")
|
||||
private LyNCVoucherReturnSendResult sendresult;
|
||||
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String billtype;
|
||||
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String filename;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String successful;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.engine.salary.entity.ly.dto;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName LyVoucher
|
||||
* @date 2024/08/27 16:14
|
||||
* @description
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LyNCVoucherReturnSendResult {
|
||||
|
||||
@XStreamAlias("bdocid")
|
||||
private String bdocid;
|
||||
|
||||
@XStreamAlias("filename")
|
||||
private String filename;
|
||||
|
||||
@XStreamAlias("resultcode")
|
||||
private String resultcode;
|
||||
|
||||
@XStreamAlias("resultdescription")
|
||||
private String resultdescription;
|
||||
|
||||
@XStreamAlias("content")
|
||||
private String content;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.engine.salary.entity.ly.dto;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @ClassName LyVoucher
|
||||
* @date 2024/08/27 16:14
|
||||
* @description
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XStreamAlias("ufinterface")
|
||||
public class LyNCVoucherUfinterface {
|
||||
|
||||
@XStreamAlias("voucher")
|
||||
private LyNCVoucherHead voucher;
|
||||
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String account;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String billtype;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String businessunitcode;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String filename;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String groupcode;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String isexchange;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String orgcode;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String receiver;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String replace;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String roottag;
|
||||
|
||||
@XStreamAsAttribute
|
||||
private String sender;
|
||||
}
|
||||
|
|
@ -6,10 +6,7 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.hrm.DeptInfo;
|
||||
import com.engine.salary.entity.hrm.SubCompanyInfo;
|
||||
import com.engine.salary.entity.ly.dto.LyFzhsBrowser;
|
||||
import com.engine.salary.entity.ly.dto.LyFzhsInfo;
|
||||
import com.engine.salary.entity.ly.dto.LyPzPreview;
|
||||
import com.engine.salary.entity.ly.dto.LyVoucherDetailDTO;
|
||||
import com.engine.salary.entity.ly.dto.*;
|
||||
import com.engine.salary.entity.ly.param.*;
|
||||
import com.engine.salary.entity.ly.po.*;
|
||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||
|
|
@ -31,10 +28,15 @@ import com.engine.salary.util.db.IdGenerator;
|
|||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.engine.salary.util.xml.XStreamUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
|
@ -696,6 +698,183 @@ public class LyPZServiceImpl extends Service implements LyPZService {
|
|||
private void pushVoucher(LyVoucherPushParam pushParam) {
|
||||
pushParam.setStatus(NumberUtils.INTEGER_ONE);
|
||||
pushParam.setPushMsg("推送成功");
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
|
||||
LyNCVoucher lyNCVoucher = new LyNCVoucher();
|
||||
// 凭证类别 非空 (凭证类别)
|
||||
lyNCVoucher.setPkVouchertype("01");
|
||||
// 会计年度 非空
|
||||
lyNCVoucher.setYear(String.valueOf(cal.get(Calendar.YEAR)));
|
||||
// 来源系统 非空 只支持模块编号
|
||||
lyNCVoucher.setPkSystem("GL");
|
||||
// 凭证类型值 0:正常凭证 3:数量调整凭证 不可空
|
||||
lyNCVoucher.setVoucherkind("0");
|
||||
// 核算账簿 非空 (账簿_财务核算账簿)
|
||||
lyNCVoucher.setPkAccountingbook("201-0003");
|
||||
// 会计期间 非空
|
||||
lyNCVoucher.setPeriod("02");
|
||||
// 制单日期 非空
|
||||
lyNCVoucher.setPrepareddate("2024-02-22 00:00:00");
|
||||
// 制单人 非空 (用户)
|
||||
lyNCVoucher.setPkPrepared("fw");
|
||||
//所属组织 非空 (组织)
|
||||
lyNCVoucher.setPkOrg("101");
|
||||
lyNCVoucher.setDiscardflag("N");
|
||||
|
||||
|
||||
List<LyVoucherDetailPushParam> jfDetailList = new ArrayList<>();
|
||||
List<LyVoucherDetailPushParam> dfDetailList = new ArrayList<>();
|
||||
pushParam.getDetails().stream().forEach(detail -> {
|
||||
if ((StringUtils.isNotBlank(detail.getJfValue())) && (!"0.00".equals(detail.getJfValue()))) {
|
||||
jfDetailList.add(detail);
|
||||
} else {
|
||||
dfDetailList.add(detail);
|
||||
}
|
||||
});
|
||||
ArrayList<LyNCVoucherDetail> lyNCVoucherDetailList = new ArrayList<>();
|
||||
// 借方分录
|
||||
for (int i = 0; i < jfDetailList.size(); i++) {
|
||||
LyVoucherDetailPushParam detailParam = jfDetailList.get(i);
|
||||
LyNCVoucherDetail lyNCVoucherDetail = new LyNCVoucherDetail();
|
||||
// 分录号 非空
|
||||
lyNCVoucherDetail.setDetailindex(String.valueOf(i+1));
|
||||
// 摘要 非空
|
||||
lyNCVoucherDetail.setExplanation(detailParam.getZy());
|
||||
// 折本汇率
|
||||
lyNCVoucherDetail.setExcrate2("1");
|
||||
// 原币借方金额
|
||||
lyNCVoucherDetail.setDebitamount(detailParam.getJfValue());
|
||||
// 本币借方金额 可空
|
||||
lyNCVoucherDetail.setLocaldebitamount(detailParam.getJfValue());
|
||||
// 币种 非空
|
||||
lyNCVoucherDetail.setPkCurrtype("CNY");
|
||||
// 科目 非空
|
||||
String kjkm = detailParam.getKjkm();
|
||||
String kjkmbm = kjkm.split("\\\\")[0];
|
||||
lyNCVoucherDetail.setPkAccasoa(kjkmbm);
|
||||
// 辅助核算
|
||||
List<LyNCVoucherAss> lyNCVoucherAssList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(detailParam.getFzhsXmqs())) {
|
||||
LyNCVoucherAss ass = new LyNCVoucherAss();
|
||||
ass.setPkChecktype("");
|
||||
ass.setPkCheckvalue(detailParam.getFzhsXmqs());
|
||||
lyNCVoucherAssList.add(ass);
|
||||
}
|
||||
if (StringUtils.isNotBlank(detailParam.getFzhsFwlb())) {
|
||||
LyNCVoucherAss ass = new LyNCVoucherAss();
|
||||
ass.setPkChecktype("");
|
||||
ass.setPkCheckvalue(detailParam.getFzhsFwlb());
|
||||
lyNCVoucherAssList.add(ass);
|
||||
}
|
||||
if (StringUtils.isNotBlank(detailParam.getFzhsSllb())) {
|
||||
LyNCVoucherAss ass = new LyNCVoucherAss();
|
||||
ass.setPkChecktype("");
|
||||
ass.setPkCheckvalue(detailParam.getFzhsSllb());
|
||||
lyNCVoucherAssList.add(ass);
|
||||
}
|
||||
if (StringUtils.isNotBlank(detailParam.getFzhsKs())) {
|
||||
LyNCVoucherAss ass = new LyNCVoucherAss();
|
||||
ass.setPkChecktype("");
|
||||
ass.setPkCheckvalue(detailParam.getFzhsKs());
|
||||
lyNCVoucherAssList.add(ass);
|
||||
}
|
||||
lyNCVoucherDetail.setAss(lyNCVoucherAssList);
|
||||
lyNCVoucherDetailList.add(lyNCVoucherDetail);
|
||||
}
|
||||
|
||||
// 贷方分录
|
||||
for (int i = 0; i < dfDetailList.size(); i++) {
|
||||
LyVoucherDetailPushParam detailParam = dfDetailList.get(i);
|
||||
LyNCVoucherDetail lyNCVoucherDetail = new LyNCVoucherDetail();
|
||||
// 分录号 非空
|
||||
lyNCVoucherDetail.setDetailindex(lyNCVoucherDetailList.size() + String.valueOf(i+1));
|
||||
// 摘要 非空
|
||||
lyNCVoucherDetail.setExplanation(detailParam.getZy());
|
||||
// 折本汇率
|
||||
lyNCVoucherDetail.setExcrate2("1");
|
||||
// 原币借方金额
|
||||
lyNCVoucherDetail.setCreditamount(detailParam.getDfValue());
|
||||
// 本币借方金额 可空
|
||||
lyNCVoucherDetail.setLocalcreditamount(detailParam.getDfValue());
|
||||
// 币种 非空
|
||||
lyNCVoucherDetail.setPkCurrtype("CNY");
|
||||
// 科目 非空
|
||||
String kjkm = detailParam.getKjkm();
|
||||
String kjkmbm = kjkm.split("\\\\")[0];
|
||||
lyNCVoucherDetail.setPkAccasoa(kjkmbm);
|
||||
// 辅助核算
|
||||
List<LyNCVoucherAss> lyNCVoucherAssList = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(detailParam.getFzhsXmqs())) {
|
||||
LyNCVoucherAss ass = new LyNCVoucherAss();
|
||||
ass.setPkChecktype("");
|
||||
ass.setPkCheckvalue(detailParam.getFzhsXmqs());
|
||||
lyNCVoucherAssList.add(ass);
|
||||
}
|
||||
if (StringUtils.isNotBlank(detailParam.getFzhsFwlb())) {
|
||||
LyNCVoucherAss ass = new LyNCVoucherAss();
|
||||
ass.setPkChecktype("");
|
||||
ass.setPkCheckvalue(detailParam.getFzhsFwlb());
|
||||
lyNCVoucherAssList.add(ass);
|
||||
}
|
||||
if (StringUtils.isNotBlank(detailParam.getFzhsSllb())) {
|
||||
LyNCVoucherAss ass = new LyNCVoucherAss();
|
||||
ass.setPkChecktype("");
|
||||
ass.setPkCheckvalue(detailParam.getFzhsSllb());
|
||||
lyNCVoucherAssList.add(ass);
|
||||
}
|
||||
if (StringUtils.isNotBlank(detailParam.getFzhsKs())) {
|
||||
LyNCVoucherAss ass = new LyNCVoucherAss();
|
||||
ass.setPkChecktype("");
|
||||
ass.setPkCheckvalue(detailParam.getFzhsKs());
|
||||
lyNCVoucherAssList.add(ass);
|
||||
}
|
||||
lyNCVoucherDetail.setAss(lyNCVoucherAssList);
|
||||
lyNCVoucherDetailList.add(lyNCVoucherDetail);
|
||||
}
|
||||
lyNCVoucher.setDetails(lyNCVoucherDetailList);
|
||||
LyNCVoucherHead voucherHead = new LyNCVoucherHead();
|
||||
voucherHead.setVoucherHead(lyNCVoucher);
|
||||
|
||||
LyNCVoucherUfinterface lyNCVoucherUfinterface = new LyNCVoucherUfinterface();
|
||||
lyNCVoucherUfinterface.setVoucher(voucherHead);
|
||||
lyNCVoucherUfinterface.setAccount("develop");
|
||||
lyNCVoucherUfinterface.setBilltype("vouchergl");
|
||||
lyNCVoucherUfinterface.setBusinessunitcode("develop");
|
||||
lyNCVoucherUfinterface.setFilename("");
|
||||
lyNCVoucherUfinterface.setGroupcode("");
|
||||
lyNCVoucherUfinterface.setIsexchange("");
|
||||
lyNCVoucherUfinterface.setOrgcode("");
|
||||
lyNCVoucherUfinterface.setReceiver("0001121000000000JIYO");
|
||||
lyNCVoucherUfinterface.setReplace("");
|
||||
lyNCVoucherUfinterface.setRoottag("");
|
||||
lyNCVoucherUfinterface.setSender("OA");
|
||||
|
||||
String xml = "<?xml version=\"1.0\" encoding='UTF-8'?>" + XStreamUtil.marshal(lyNCVoucherUfinterface);
|
||||
System.out.println(xml);
|
||||
|
||||
|
||||
HttpClient httpClient = new HttpClient();
|
||||
PostMethod httpPost = new PostMethod("http://172.18.0.10:8090/service/XChangeServlet?account=002&groupcode=leading");
|
||||
httpPost.setRequestHeader("content-type", "application/json;charset=utf-8");
|
||||
|
||||
String result = "";
|
||||
try {
|
||||
RequestEntity entity = new StringRequestEntity(xml, "application/json", "UTF-8");
|
||||
httpPost.setRequestEntity(entity);
|
||||
httpClient.executeMethod(httpPost);
|
||||
result = httpPost.getResponseBodyAsString();
|
||||
System.out.println(result);
|
||||
LyNCVoucherReturn lyNCVoucherReturn = XStreamUtil.unmarshal(LyNCVoucherReturn.class, result);
|
||||
System.out.println(lyNCVoucherReturn);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("d");
|
||||
}
|
||||
throw new SalaryRunTimeException("hi");
|
||||
|
||||
|
||||
// test 生成xml
|
||||
// List<LyVoucherAss> assList = new ArrayList<>();
|
||||
// assList.add(LyVoucherAss.builder()
|
||||
|
|
|
|||
|
|
@ -65,4 +65,7 @@ public class XStreamUtil {
|
|||
public static String marshal(Object o){
|
||||
return marshal(o, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue