1、新增凭证收回功能。
This commit is contained in:
parent
42470bce8a
commit
f7b681e421
|
@ -52,12 +52,74 @@ public class CoreController extends DefaultController {
|
||||||
Set<String> set = new LinkedHashSet<>(Arrays.asList(split));
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(split));
|
||||||
String[] uniqueArray = set.toArray(new String[0]);
|
String[] uniqueArray = set.toArray(new String[0]);
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
int j=0;
|
||||||
|
StringBuffer cgsb = new StringBuffer();
|
||||||
|
StringBuffer sbsb = new StringBuffer();
|
||||||
|
|
||||||
for (String s : uniqueArray) {
|
for (String s : uniqueArray) {
|
||||||
createVoucherVO.setBill_code(s);
|
try {
|
||||||
coreService.generateVoucher(createVoucherVO);
|
createVoucherVO.setBill_code(s);
|
||||||
|
coreService.generateVoucher(createVoucherVO);
|
||||||
|
j++;
|
||||||
|
cgsb.append("单据号:");
|
||||||
|
cgsb.append(s).append(";");
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
i++;
|
||||||
|
sbsb.append("单据号:").append(s);
|
||||||
|
sbsb.append("失败原因:").append(e.getMessage()).append(";");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i==0){
|
||||||
|
return getSuccessMessageEntity("生成成功。"+cgsb);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
return getFailureMessageEntity("生成成功:"+j+"条。:"+cgsb+"\n失败:"+i+"条,失败原因:"+sbsb);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return getFailureMessageEntity(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/backVoucher", method = RequestMethod.POST)
|
||||||
|
public JsonResultEntity backVoucher(@RequestBody CreateVoucherVO createVoucherVO){
|
||||||
|
try {
|
||||||
|
|
||||||
|
String billCodes = createVoucherVO.getBill_code();
|
||||||
|
String[] split = billCodes.split(",");
|
||||||
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(split));
|
||||||
|
String[] uniqueArray = set.toArray(new String[0]);
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
int j=0;
|
||||||
|
StringBuffer cgsb = new StringBuffer().append("单据号:");
|
||||||
|
StringBuffer sbsb = new StringBuffer();
|
||||||
|
for (String s : uniqueArray) {
|
||||||
|
try {
|
||||||
|
createVoucherVO.setBill_code(s);
|
||||||
|
coreService.backVoucher(createVoucherVO);
|
||||||
|
j++;
|
||||||
|
cgsb.append("单据号:");
|
||||||
|
cgsb.append(s).append(";");
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
i++;
|
||||||
|
sbsb.append("单据号:").append(s);
|
||||||
|
sbsb.append("失败原因:").append(e.getMessage()).append(";");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i==0){
|
||||||
|
return getSuccessMessageEntity("删除成功。"+cgsb);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
return getFailureMessageEntity("删除成功:"+j+"条。:"+cgsb+"\n失败:"+i+"条,失败原因:"+sbsb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getSuccessMessageEntity("生成成功");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return getFailureMessageEntity(e.getMessage());
|
return getFailureMessageEntity(e.getMessage());
|
||||||
|
|
|
@ -13,4 +13,6 @@ public interface ICoreService {
|
||||||
void generateVoucher(CreateVoucherVO createVoucherVO)throws Exception;
|
void generateVoucher(CreateVoucherVO createVoucherVO)throws Exception;
|
||||||
|
|
||||||
List<Map<String, Object>> queryDataByMdmId(CreateVoucherVO createVoucherVO);
|
List<Map<String, Object>> queryDataByMdmId(CreateVoucherVO createVoucherVO);
|
||||||
|
|
||||||
|
void backVoucher(CreateVoucherVO createVoucherVO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package com.hzya.frame.voucher.ae.generate.core.service.impl;
|
package com.hzya.frame.voucher.ae.generate.core.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
||||||
|
@ -12,6 +15,12 @@ import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao;
|
||||||
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
||||||
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao;
|
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao;
|
||||||
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
|
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
|
||||||
|
import com.hzya.frame.sysnew.person.dao.ISysPersonDao;
|
||||||
|
import com.hzya.frame.sysnew.person.entity.SysPersonEntity;
|
||||||
|
import com.hzya.frame.sysnew.user.dao.ISysUserDao;
|
||||||
|
import com.hzya.frame.sysnew.user.entity.SysUserEntity;
|
||||||
|
import com.hzya.frame.voucher.ae.generate.core.vo.*;
|
||||||
|
import com.hzya.frame.voucher.utils.Attribute;
|
||||||
import com.hzya.frame.voucher.utils.PushU8CUtil;
|
import com.hzya.frame.voucher.utils.PushU8CUtil;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.dao.IAeConfBdAccsubjDao;
|
import com.hzya.frame.voucher.ae.comf.bd.dao.IAeConfBdAccsubjDao;
|
||||||
import com.hzya.frame.voucher.ae.comf.bd.dao.IAeConfBdOrgBookVODao;
|
import com.hzya.frame.voucher.ae.comf.bd.dao.IAeConfBdOrgBookVODao;
|
||||||
|
@ -41,14 +50,14 @@ import com.hzya.frame.voucher.ae.comf.template.entity.AeConfVoucherTemplateTypeE
|
||||||
import com.hzya.frame.voucher.ae.comf.template.service.IAeConfVoucherTemplateService;
|
import com.hzya.frame.voucher.ae.comf.template.service.IAeConfVoucherTemplateService;
|
||||||
import com.hzya.frame.voucher.ae.generate.core.dao.ICoreDao;
|
import com.hzya.frame.voucher.ae.generate.core.dao.ICoreDao;
|
||||||
import com.hzya.frame.voucher.ae.generate.core.service.ICoreService;
|
import com.hzya.frame.voucher.ae.generate.core.service.ICoreService;
|
||||||
import com.hzya.frame.voucher.ae.generate.core.vo.CreateVoucherVO;
|
|
||||||
import com.hzya.frame.voucher.ae.generate.core.vo.VoucherData;
|
|
||||||
import com.hzya.frame.voucher.ae.push.dao.IAePushVoucherLogDao;
|
import com.hzya.frame.voucher.ae.push.dao.IAePushVoucherLogDao;
|
||||||
import com.hzya.frame.voucher.ae.push.dao.IAePushVoucherLogDetailsDao;
|
import com.hzya.frame.voucher.ae.push.dao.IAePushVoucherLogDetailsDao;
|
||||||
import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogDetailsEntity;
|
import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogDetailsEntity;
|
||||||
import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogEntity;
|
import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogEntity;
|
||||||
import com.hzya.frame.voucher.utils.ZTResult;
|
import com.hzya.frame.voucher.utils.ZTResult;
|
||||||
import org.apache.commons.collections.map.HashedMap;
|
import org.apache.commons.collections.map.HashedMap;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -68,6 +77,9 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
public class ICoreServiceImpl implements ICoreService {
|
public class ICoreServiceImpl implements ICoreService {
|
||||||
|
|
||||||
|
Logger logger = LoggerFactory.getLogger(ICoreServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICoreDao coreDao;
|
private ICoreDao coreDao;
|
||||||
|
|
||||||
|
@ -112,6 +124,11 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAePushVoucherLogDao aePushVoucherLogDao;
|
private IAePushVoucherLogDao aePushVoucherLogDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserDao sysUserDao;
|
||||||
|
@Autowired
|
||||||
|
private ISysPersonDao sysPersonDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PushU8CUtil pushU8CUtil;
|
private PushU8CUtil pushU8CUtil;
|
||||||
|
|
||||||
|
@ -265,9 +282,22 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
vouche.setAccbookCode(orgBookVO.getGlorgbookcode());
|
vouche.setAccbookCode(orgBookVO.getGlorgbookcode());
|
||||||
vouche.setAccbookName(orgBookVO.getGlorgbookname());
|
vouche.setAccbookName(orgBookVO.getGlorgbookname());
|
||||||
|
|
||||||
//pk_prepared;//制单人编码
|
//pk_prepared;//制单人编码--登陆人
|
||||||
vouche.setPk_prepared("tbadmin");
|
SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
|
||||||
vouche.setPrepared("tbadmin");
|
String token = tokenInfo.getTokenValue();
|
||||||
|
Object loginIdByToken = StpUtil.getLoginIdByToken(token);
|
||||||
|
System.out.println(loginIdByToken);
|
||||||
|
SysUserEntity sysUserEntity = new SysUserEntity();
|
||||||
|
sysUserEntity.setId(String.valueOf(loginIdByToken));
|
||||||
|
List<SysUserEntity> userEntityList = sysUserDao.query(sysUserEntity);
|
||||||
|
String personId = userEntityList.get(0).getPersonId();
|
||||||
|
SysPersonEntity sysPersonEntity = new SysPersonEntity();
|
||||||
|
sysPersonEntity.setId(personId);
|
||||||
|
List<SysPersonEntity> personEntityList = sysPersonDao.query(sysPersonEntity);
|
||||||
|
System.out.println(personEntityList.get(0).getMobilePhone());
|
||||||
|
|
||||||
|
vouche.setPk_prepared(personEntityList.get(0).getMobilePhone());
|
||||||
|
vouche.setPrepared(personEntityList.get(0).getMobilePhone());
|
||||||
|
|
||||||
//pk_vouchertype;//凭证类别简称
|
//pk_vouchertype;//凭证类别简称
|
||||||
BdVoucherTypeVO voucherTypeVO = queryGlOrgBookShortNameByVoucherTypeId(aeConfVoucherTemplate.getVoucherTypeId());
|
BdVoucherTypeVO voucherTypeVO = queryGlOrgBookShortNameByVoucherTypeId(aeConfVoucherTemplate.getVoucherTypeId());
|
||||||
|
@ -601,12 +631,14 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
vouche.setDetails(details);
|
vouche.setDetails(details);
|
||||||
voucher.add(vouche);
|
voucher.add(vouche);
|
||||||
|
|
||||||
|
//重新组装参数
|
||||||
|
List<VoucherData.Voucher> resultVoucher = reassemblyParam(voucher);
|
||||||
|
|
||||||
String data="{\"voucher\":";
|
String data="{\"voucher\":";
|
||||||
data+=JSONUtil.toJsonStr(voucher)+"}";
|
data+=JSONUtil.toJsonStr(resultVoucher)+"}";
|
||||||
|
|
||||||
//8000630001:凭证新增
|
//8000630001:凭证新增
|
||||||
//8000630002:凭证删除
|
//8000630002:凭证删除
|
||||||
//推送U8C-新增凭证
|
|
||||||
ZTResult ztResult = null;
|
ZTResult ztResult = null;
|
||||||
try {
|
try {
|
||||||
ztResult = pushU8CUtil.pushByCode("8000630001", data);
|
ztResult = pushU8CUtil.pushByCode("8000630001", data);
|
||||||
|
@ -614,13 +646,23 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Assert.state(false,"推送U8C失败,失败原因:{}",e.getMessage());
|
Assert.state(false,"推送U8C失败,失败原因:{}",e.getMessage());
|
||||||
}
|
}
|
||||||
System.out.println(ztResult);
|
String flag = ztResult.getFlag();
|
||||||
|
if("false".equals(flag)){
|
||||||
|
Assert.state(false,"推送U8C报错,报错原因:{},报错明细:{}。",ztResult.getAttribute().getErrormsg(),JSONUtil.toJsonStr(ztResult.getAttribute()));
|
||||||
|
}
|
||||||
|
Attribute attribute = ztResult.getAttribute();
|
||||||
|
|
||||||
|
U8CVoucherVO u8CVoucherVO = resultDataHandle(attribute.getData());
|
||||||
|
System.out.println(u8CVoucherVO);
|
||||||
|
//凭证号
|
||||||
|
String voucherNo = u8CVoucherVO.getNo();
|
||||||
|
|
||||||
|
|
||||||
//记录日志
|
//记录日志,并回写凭证号
|
||||||
// saveLog("Y",createVoucherVO.getBill_code(),null,createVoucherVO.getMdmId(),voucher);
|
saveLog("Y",createVoucherVO.getBill_code(),null,createVoucherVO.getMdmId(),voucher,voucherNo);
|
||||||
//
|
|
||||||
// updateBillStatusYByBillCodeMdmId(mdmModuleDb.getDbName(),createVoucherVO.getBill_code());
|
//更新单据状态
|
||||||
|
updateBillStatusYByBillCodeMdmId(mdmModuleDb.getDbName(),createVoucherVO.getBill_code(),"Y");
|
||||||
}
|
}
|
||||||
// else {//按类型生成不同的凭证
|
// else {//按类型生成不同的凭证
|
||||||
// //根据凭证类型分组 账簿主键+凭证类别+模板id
|
// //根据凭证类型分组 账簿主键+凭证类别+模板id
|
||||||
|
@ -895,6 +937,8 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将res转换后给str
|
* 将res转换后给str
|
||||||
*/
|
*/
|
||||||
|
@ -2194,8 +2238,9 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
* @param templateTypeId 模板id
|
* @param templateTypeId 模板id
|
||||||
* @param mdmId 档案id
|
* @param mdmId 档案id
|
||||||
* @param voucherList
|
* @param voucherList
|
||||||
|
* @param voucherNo 生成的凭证号
|
||||||
*/
|
*/
|
||||||
public void saveLog(String status,String billCode,String templateTypeId,String mdmId,List<VoucherData.Voucher> voucherList){
|
public void saveLog(String status,String billCode,String templateTypeId,String mdmId,List<VoucherData.Voucher> voucherList,String voucherNo){
|
||||||
for (VoucherData.Voucher voucher : voucherList) {
|
for (VoucherData.Voucher voucher : voucherList) {
|
||||||
System.out.println(voucher);
|
System.out.println(voucher);
|
||||||
System.out.println(voucher.getDetails());
|
System.out.println(voucher.getDetails());
|
||||||
|
@ -2209,9 +2254,7 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
voucherLogEntity.setGlOrgbookCode(voucher.getAccbookCode());//账簿
|
voucherLogEntity.setGlOrgbookCode(voucher.getAccbookCode());//账簿
|
||||||
voucherLogEntity.setGlOrgbookName(voucher.getAccbookName());//账簿
|
voucherLogEntity.setGlOrgbookName(voucher.getAccbookName());//账簿
|
||||||
voucherLogEntity.setVoucherTypeName(voucher.getVouchertype_name());//凭证类别
|
voucherLogEntity.setVoucherTypeName(voucher.getVouchertype_name());//凭证类别
|
||||||
|
voucherLogEntity.setVoucherNo(voucherNo);//凭证号
|
||||||
//凭证号
|
|
||||||
|
|
||||||
voucherLogEntity.setAbstractStr(voucher.getDetails().get(0).getExplanation());//摘要
|
voucherLogEntity.setAbstractStr(voucher.getDetails().get(0).getExplanation());//摘要
|
||||||
|
|
||||||
//借方金额计算
|
//借方金额计算
|
||||||
|
@ -2400,7 +2443,7 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
* billstatus
|
* billstatus
|
||||||
* 生成凭证成功:更新业务单据状态
|
* 生成凭证成功:更新业务单据状态
|
||||||
*/
|
*/
|
||||||
public void updateBillStatusYByBillCodeMdmId(String dbName,String billCode){
|
public void updateBillStatusYByBillCodeMdmId(String dbName,String billCode,String billStatus){
|
||||||
try{
|
try{
|
||||||
Assert.notNull(billCode,"业务单据号不能为空");
|
Assert.notNull(billCode,"业务单据号不能为空");
|
||||||
Assert.notNull(dbName,"业务表名称不能为空");
|
Assert.notNull(dbName,"业务表名称不能为空");
|
||||||
|
@ -2409,11 +2452,169 @@ public class ICoreServiceImpl implements ICoreService {
|
||||||
mdmDBQueryVO.setTablename(dbName);
|
mdmDBQueryVO.setTablename(dbName);
|
||||||
mdmDBQueryVO.setProp7("bill_code");
|
mdmDBQueryVO.setProp7("bill_code");
|
||||||
mdmDBQueryVO.setPropValue7(billCode);
|
mdmDBQueryVO.setPropValue7(billCode);
|
||||||
mdmDBQueryVO.setBillstatus("Y");
|
mdmDBQueryVO.setBillstatus(billStatus);
|
||||||
mdmDBQueryVODAO.updateBillStatusYByBillCodeMdmId(mdmDBQueryVO);
|
mdmDBQueryVODAO.updateBillStatusYByBillCodeMdmId(mdmDBQueryVO);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对其业务参数,重新组装单单据
|
||||||
|
* @param voucher
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<VoucherData.Voucher> reassemblyParam(List<VoucherData.Voucher> voucher) {
|
||||||
|
List<VoucherData.Voucher> resultVoucher =new LinkedList<>();
|
||||||
|
for (VoucherData.Voucher vou : voucher) {
|
||||||
|
VoucherData.Voucher resuVoucher = new VoucherData.Voucher();
|
||||||
|
resuVoucher.setPk_corp(vou.getCorp_code());//公司
|
||||||
|
resuVoucher.setPk_glorgbook(vou.getAccbookCode());//账簿
|
||||||
|
resuVoucher.setPk_prepared(vou.getPk_prepared());//制单人
|
||||||
|
resuVoucher.setPk_vouchertype(vou.getVouchertype_shortname());//类别
|
||||||
|
resuVoucher.setPrepareddate(vou.getPrepareddate());//日期
|
||||||
|
|
||||||
|
//分录
|
||||||
|
List<VoucherData.Voucher.Detail> details =new LinkedList<>();
|
||||||
|
for (VoucherData.Voucher.Detail detail : vou.getDetails()) {
|
||||||
|
VoucherData.Voucher.Detail det = new VoucherData.Voucher.Detail();
|
||||||
|
det.setPk_accsubj(detail.getAccountCode());//科目 pk_accsubj
|
||||||
|
det.setPk_currtype(detail.getCurrtypeCode());//币种编码 pk_currtype
|
||||||
|
det.setExplanation(detail.getExplanation());//摘要 explanation
|
||||||
|
det.setDebitquantity(detail.getDebitquantity());//借方数量 debitquantity
|
||||||
|
det.setDebitamount(detail.getDebitamount());//原币借方金额 debitamount
|
||||||
|
det.setLocaldebitamount(detail.getLocaldebitamount());//本币借方金额 localdebitamount
|
||||||
|
det.setCreditquantity(detail.getCreditquantity());//贷方数量 creditquantity
|
||||||
|
det.setCreditamount(detail.getCreditamount());//原币贷方金额 creditamount
|
||||||
|
det.setLocalcreditamount(detail.getLocalcreditamount());//本币贷方金额 localcreditamount
|
||||||
|
|
||||||
|
List<VoucherData.Voucher.Detail.Ass> ass =new LinkedList<>();
|
||||||
|
if(detail.getAss()!=null){
|
||||||
|
//辅助核算
|
||||||
|
for (VoucherData.Voucher.Detail.Ass as : detail.getAss()) {
|
||||||
|
VoucherData.Voucher.Detail.Ass a = new VoucherData.Voucher.Detail.Ass();
|
||||||
|
a.setChecktypecode(as.getChecktypecode());//辅助核算类型编码 checktypecode
|
||||||
|
a.setCheckvaluecode(as.getCheckvaluecode());//辅助核算的值编码 checkvaluecode
|
||||||
|
ass.add(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//现金流映射
|
||||||
|
|
||||||
|
det.setAss(ass);
|
||||||
|
details.add(det);
|
||||||
|
}
|
||||||
|
resuVoucher.setDetails(details);
|
||||||
|
resultVoucher.add(resuVoucher);
|
||||||
|
}
|
||||||
|
return resultVoucher;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收回凭证
|
||||||
|
* 1、根据单号查ae_push_voucher_log
|
||||||
|
* @param createVoucherVO
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void backVoucher(CreateVoucherVO createVoucherVO) {
|
||||||
|
String mdmId = createVoucherVO.getMdmId();
|
||||||
|
String billCode = createVoucherVO.getBill_code();
|
||||||
|
Assert.notNull(mdmId,"mdmId不能为空!");
|
||||||
|
Assert.notNull(billCode,"bill_code不能为空!");
|
||||||
|
AePushVoucherLogEntity aePushVoucherLogEntity = new AePushVoucherLogEntity();
|
||||||
|
aePushVoucherLogEntity.setMdmId(mdmId);
|
||||||
|
aePushVoucherLogEntity.setBill_code(billCode);
|
||||||
|
List<AePushVoucherLogEntity> aePushVoucherLogEntityList = aePushVoucherLogDao.query(aePushVoucherLogEntity);
|
||||||
|
if(aePushVoucherLogEntityList.size()==0){
|
||||||
|
Assert.state(false,"没有找到对应的凭证生成记录");
|
||||||
|
}
|
||||||
|
if(aePushVoucherLogEntityList.size()>1){
|
||||||
|
Assert.state(false,"查询到凭证生成记录不唯一,请检查。");
|
||||||
|
}
|
||||||
|
|
||||||
|
AePushVoucherLogEntity aePushVoucherLog = aePushVoucherLogEntityList.get(0);
|
||||||
|
|
||||||
|
U8CBackVoucherVO u8CBackVoucherVO = new U8CBackVoucherVO();
|
||||||
|
u8CBackVoucherVO.setPk_glorgbook(aePushVoucherLog.getGlOrgbookCode());//pk_glorgbook
|
||||||
|
u8CBackVoucherVO.setPrepareddate_from(aePushVoucherLog.getBillDate());//prepareddate_from
|
||||||
|
u8CBackVoucherVO.setPrepareddate_to(aePushVoucherLog.getBillDate());//prepareddate_to
|
||||||
|
u8CBackVoucherVO.setNo_from(aePushVoucherLog.getVoucherNo());//no_from
|
||||||
|
u8CBackVoucherVO.setNo_to(aePushVoucherLog.getVoucherNo());//no_to
|
||||||
|
System.out.println(u8CBackVoucherVO);
|
||||||
|
|
||||||
|
//8000630001:凭证新增
|
||||||
|
//8000630002:凭证删除
|
||||||
|
ZTResult ztResult = null;
|
||||||
|
String data=JSONUtil.toJsonStr(u8CBackVoucherVO);
|
||||||
|
try {
|
||||||
|
ztResult = pushU8CUtil.pushByCode("8000630002", data);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
Assert.state(false,"推送U8C失败,失败原因:{}",e.getMessage());
|
||||||
|
}
|
||||||
|
String flag = ztResult.getFlag();
|
||||||
|
if("false".equals(flag)){
|
||||||
|
Assert.state(false,"推送U8C报错,报错原因:{},报错明细:{}。",ztResult.getAttribute().getErrormsg(),JSONUtil.toJsonStr(ztResult.getAttribute()));
|
||||||
|
}
|
||||||
|
Attribute attribute = ztResult.getAttribute();
|
||||||
|
// U8CDeleteVoucherVO u8CDeleteVoucherVO = resultDataHandleDelVoucher(attribute.getData());
|
||||||
|
// System.out.println(u8CDeleteVoucherVO);
|
||||||
|
|
||||||
|
|
||||||
|
//更新单据状态。
|
||||||
|
System.out.println(mdmId);
|
||||||
|
System.out.println(billCode);
|
||||||
|
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
|
||||||
|
mdmModuleDbEntity.setMdmId(mdmId);
|
||||||
|
mdmModuleDbEntity.setDbType("1");
|
||||||
|
List<MdmModuleDbEntity> mdmModuleDbEntityList = mdmModuleDbDao.query(mdmModuleDbEntity);
|
||||||
|
if(mdmModuleDbEntityList.size()==0||mdmModuleDbEntityList.size()>1){
|
||||||
|
Assert.state(false,"根据mdmId:{},查询原始表失败。",mdmId);
|
||||||
|
}
|
||||||
|
String dbName = mdmModuleDbEntityList.get(0).getDbName();
|
||||||
|
updateBillStatusYByBillCodeMdmId(dbName,billCode,"N");
|
||||||
|
|
||||||
|
//删除推送日志以及明细。
|
||||||
|
String aePushVoucherLogId = aePushVoucherLog.getId();
|
||||||
|
AePushVoucherLogEntity deleteLogEntity = new AePushVoucherLogEntity();
|
||||||
|
deleteLogEntity.setId(aePushVoucherLogId);
|
||||||
|
aePushVoucherLogDao.logicRemove(deleteLogEntity);
|
||||||
|
|
||||||
|
AePushVoucherLogDetailsEntity logDetails = new AePushVoucherLogDetailsEntity();
|
||||||
|
logDetails.setVoucherId(Long.valueOf(aePushVoucherLogId));
|
||||||
|
logDetailsDao.logicRemove(logDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private U8CVoucherVO resultDataHandle(String resultData) {
|
||||||
|
try {
|
||||||
|
if (resultData != null && !"".equals(resultData)) {
|
||||||
|
if (resultData.contains("[")) {
|
||||||
|
resultData = resultData.substring(1, resultData.length() - 1);
|
||||||
|
}
|
||||||
|
return JSON.parseObject(resultData, U8CVoucherVO.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("解析返回参数失败的错误", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private U8CDeleteVoucherVO resultDataHandleDelVoucher(String resultData) {
|
||||||
|
try {
|
||||||
|
if (resultData != null && !"".equals(resultData)) {
|
||||||
|
if (resultData.contains("[")) {
|
||||||
|
resultData = resultData.substring(1, resultData.length() - 1);
|
||||||
|
}
|
||||||
|
return JSON.parseObject(resultData, U8CDeleteVoucherVO.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("解析返回参数失败的错误", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.hzya.frame.voucher.ae.generate.core.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zydd on 2025-08-15 15:02
|
||||||
|
* 凭证删除VO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class U8CBackVoucherVO {
|
||||||
|
private String pk_glorgbook;
|
||||||
|
private String prepareddate_from;
|
||||||
|
private String prepareddate_to;
|
||||||
|
private String no_from;
|
||||||
|
private String no_to;
|
||||||
|
private String page_now = "1";
|
||||||
|
private String page_size = "1";
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.hzya.frame.voucher.ae.generate.core.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zydd on 2025-08-15 15:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class U8CDeleteVoucherVO {
|
||||||
|
private String status;
|
||||||
|
private String data;
|
||||||
|
private String taskNumber;
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.hzya.frame.voucher.ae.generate.core.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zydd on 2025-08-15 09:57
|
||||||
|
* U8C凭证返回信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class U8CVoucherVO {
|
||||||
|
private String pkGlorgbook; // 账簿主键
|
||||||
|
private String glorgbookCode; // 账簿编码
|
||||||
|
private String glorgbookName; // 账簿名称
|
||||||
|
private String pkVoucher; // 凭证主键
|
||||||
|
private String no; // 凭证号
|
||||||
|
private String year; // 会计年度
|
||||||
|
private String period; // 会计期间
|
||||||
|
private String preparedDate; // 制单日期
|
||||||
|
private String pkPrepared; // 制单人主键
|
||||||
|
private String preparedCode; // 制单人编码
|
||||||
|
private String preparedName; // 制单人姓名
|
||||||
|
private String pkVouchertype; // 凭证类型主键
|
||||||
|
private String vouchertypeCode; // 凭证类型编码
|
||||||
|
private String vouchertypeName; // 凭证类型名称
|
||||||
|
private String explanation; // 摘要
|
||||||
|
private Double totalDebit; // 借方合计
|
||||||
|
private Double totalCredit; // 贷方合计
|
||||||
|
private String pkSystem; // 系统主键
|
||||||
|
private Boolean signflag; // 是否已签章
|
||||||
|
private Boolean discardflag; // 是否作废
|
||||||
|
private List<Detail> detail; // 分录明细
|
||||||
|
private String pkCorp; // 公司主键
|
||||||
|
private String corpCode; // 公司编码
|
||||||
|
private String corpName; // 公司名称
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Detail{
|
||||||
|
private String pkDetail; // 分录主键
|
||||||
|
private String pkVoucher; // 所属凭证主键
|
||||||
|
private String detailIndex; // 分录行号
|
||||||
|
private String explanation; // 摘要
|
||||||
|
private String pkAccsubj; // 会计科目主键
|
||||||
|
private String accsubjCode; // 会计科目编码
|
||||||
|
private String accsubjName; // 会计科目名称
|
||||||
|
private String pkCurrtype; // 币种主键
|
||||||
|
private String currtypeCode; // 币种编码
|
||||||
|
private String currtypeName; // 币种名称
|
||||||
|
private Double price; // 单价
|
||||||
|
private Double excrate1; // 汇率
|
||||||
|
private Double debitquantity; // 借方数量
|
||||||
|
private Double debitamount; // 借方原币金额
|
||||||
|
private Double localdebitamount; // 借方本位币金额
|
||||||
|
private Double creditquantity; // 贷方数量
|
||||||
|
private Double creditamount; // 贷方原币金额
|
||||||
|
private Double localcreditamount; // 贷方本位币金额
|
||||||
|
private List<Ass> ass; // 辅助核算项
|
||||||
|
@Data
|
||||||
|
public class Ass {
|
||||||
|
private String pkChecktype; // 核算类型主键
|
||||||
|
private String checktypecode; // 核算类型编码
|
||||||
|
private String pkCheckvalue; // 核算值主键
|
||||||
|
private String checkvaluecode; // 核算值编码
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
package com.hzya.frame.voucher.ae.push.controller;
|
package com.hzya.frame.voucher.ae.push.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.hzya.frame.mdm.entity.MdmViewVo;
|
import com.hzya.frame.mdm.entity.MdmViewVo;
|
||||||
import com.hzya.frame.voucher.ae.generate.core.service.ICoreService;
|
import com.hzya.frame.voucher.ae.generate.core.service.ICoreService;
|
||||||
|
@ -9,12 +12,14 @@ import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogDetailsEntity;
|
||||||
import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogEntity;
|
import com.hzya.frame.voucher.ae.push.entity.AePushVoucherLogEntity;
|
||||||
import com.hzya.frame.voucher.ae.push.service.IAePushVoucherLogService;
|
import com.hzya.frame.voucher.ae.push.service.IAePushVoucherLogService;
|
||||||
import com.hzya.frame.web.action.DefaultController;
|
import com.hzya.frame.web.action.DefaultController;
|
||||||
|
import com.hzya.frame.web.action.WebContext;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class PushU8CUtil {
|
||||||
httpPost.setHeader("password", password);
|
httpPost.setHeader("password", password);
|
||||||
httpPost.setHeader("trantype", "code");
|
httpPost.setHeader("trantype", "code");
|
||||||
httpPost.setHeader("system", system);
|
httpPost.setHeader("system", system);
|
||||||
httpPost.setHeader("needStackTrace", "Y");
|
// httpPost.setHeader("needStackTrace", "Y");
|
||||||
|
|
||||||
//中台
|
//中台
|
||||||
httpPost.setHeader("publicKey", PUBLIC_KEY);
|
httpPost.setHeader("publicKey", PUBLIC_KEY);
|
||||||
|
|
Loading…
Reference in New Issue