U8接口业务新增

This commit is contained in:
yuqh 2025-03-05 15:52:27 +08:00
parent bc422469a7
commit 7de3720668
23 changed files with 1219 additions and 523 deletions

View File

@ -1,5 +1,5 @@
server:
port: 8901
port: 9999
servlet:
context-path: /kangarooDataCenterV3
localIP: 127.0.0.1

View File

@ -2,5 +2,5 @@
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="byName">
<bean name="mdmCustomerInitializer" class="com.hzya.frame.plugin.masterData.plugin.MdmPluginInitializer" />
<bean name="MdmTestPluginInitializer" class="com.hzya.frame.plugin.masterData.plugin.MdmTestPluginInitializer" />
<!--<bean name="MdmTestPluginInitializer" class="com.hzya.frame.plugin.masterData.plugin.MdmTestPluginInitializer" />-->
</beans>

View File

@ -186,7 +186,7 @@ public class temButtom {
public void test01() {
String a = AESUtil.encrypt("hzya@1314");
System.out.println(a);
String b = AESUtil.decrypt("62e4295b615a30dbf3b8ee96f41c820b");
String b = AESUtil.decrypt("ac58037088328bef497114ce83c895d3");
System.out.println(b);
}

View File

@ -93,6 +93,18 @@ public class BipV32207ServiceImpl extends BaseService<BipSupplierEntity, String>
} catch (Exception e) {
return BaseResult.getFailureMessageEntity("获取token失败");
}
JSONObject jsonobj = new JSONObject();
try {
boolean flag = jsonobj.getBoolean("flag");
if(flag){
//修改状态成功了
}else{
//修改状态失败了
}
} catch (Exception e) {
//修改状态失败了
logger.error("接口失败"+e.getMessage());
}
// 账套编码
paramMap.put("biz_center", busi_center);
// 签名

View File

@ -62,7 +62,15 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
// applicationCache.get()
// logger.info("入参数据"+jsonObject.toString());
String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间
// 创建 Calendar 实例
Date now = json.getDate("startTime");
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
// 向前偏移两分钟
calendar.add(Calendar.MINUTE, -2);
Date twoMinutesAgo = calendar.getTime();
String startTime = DateUtil.format(twoMinutesAgo,"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间
String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的结束时间
// logger.info("本次任务查询区间开始时间:{} 结束时间:{}",startTime,endTime);
String tableName = "";

View File

@ -47,8 +47,8 @@
,sts
,org_id
,company_id
,dd_user_id
,wx_user_id
-- ,dd_user_id
-- ,wx_user_id
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-SysUserEntity-result">
@ -72,7 +72,7 @@
,a.org_id
,a.company_id
,p.person_Name
,a.wx_user_id
-- ,a.wx_user_id
,a.dd_user_id
from
sys_user a

View File

@ -3,6 +3,7 @@ package com.hzya.frame.u8.delivery.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity;
import com.hzya.frame.u8.util.U8ResultEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
@ -26,4 +27,23 @@ public interface IDeliveryOrderService extends IBaseService<DeliveryOrderEntity,
*/
JsonResultEntity editDelivery(JSONObject parm);
/**
*
* @content 发货单-新增
* @className: Administrator
* @author laborer
* @date 2025-02-24 14:33
*
*/
U8ResultEntity addDelivery(JSONObject parm);
/**
*
* @content 发货单-关闭
* @className: Administrator
* @author laborer
* @date 2025-02-24 14:33
*
*/
U8ResultEntity Close(JSONObject parm);
}

View File

@ -1,19 +1,33 @@
package com.hzya.frame.u8.delivery.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.crm.util.CrmUtil;
import com.hzya.frame.u8.delivery.dao.IDeliveryOrderDao;
import com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity;
import com.hzya.frame.u8.delivery.service.IDeliveryOrderService;
import com.hzya.frame.u8.saleinv.dao.ISaleInvDao;
import com.hzya.frame.u8.saleinv.entity.SaleInvEntity;
import com.hzya.frame.u8.util.BaseU8Result;
import com.hzya.frame.u8.util.U8ResultEntity;
import com.hzya.frame.u8.util.U8Util;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
/**
* @Description U8发货单
* @Author xiangerlin
@ -21,7 +35,10 @@ import org.springframework.stereotype.Service;
**/
@Service(value = "DeliveryOrderServiceImpl")
public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,String> implements IDeliveryOrderService {
Logger logger = LogManager.getLogger(getClass());
@Autowired
private ISaleInvDao saleInvDao;
private IDeliveryOrderDao deliveryOrderDao;
@Autowired
@ -55,7 +72,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
switch (AccId){
case "001":
AccId = "UFDATA_001_2023";
break;
break;
case "002":
AccId = "UFDATA_002_2024";
break;
@ -69,7 +86,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
AccId = "UFDATA_201_2023";
break;
default:
return BaseResult.getFailureMessageEntity("传入正确的账套号");
return BaseResult.getFailureMessageEntity("传入正确的账套号");
}
@ -88,4 +105,444 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
return BaseResult.getSuccessMessageEntity("更新成功");
}
/**
*
* @content 发货单新增
* @className: Administrator
* @author laborer
* @date 2025-02-24 14:34
*
*/
@Override
public U8ResultEntity addDelivery(JSONObject parm) {
String billCode = "";
String dlId = "";
String AccId = "";
try {
JSONObject jsonObject = parm.getJSONObject("jsonStr");
logger.info("接收到的参数"+jsonObject.toString());
StringBuffer resultStr = new StringBuffer();//回传json
String billid = jsonObject.getString("billid");
if(StrUtil.isEmpty(billid)){
return BaseU8Result.getFailureMessageEntity("请传入第三方唯一标识");
}
AccId = jsonObject.getString("AccId");
if(StrUtil.isEmpty(AccId)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
String AccCode = U8Util.accMap.get(AccId);
if(StrUtil.isEmpty(AccCode)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
JSONObject jHead = jsonObject.getJSONObject("head");
//业务类型
String cbustype = jHead.getString("cbustype");
if(StrUtil.isEmpty(cbustype)){
jHead.put("cbustype","普通销售");
}
//销售类型
String cvouchtype = jHead.getString("cvouchtype");
if(StrUtil.isEmpty(cvouchtype)){
jHead.put("cvouchtype","05");
}
//日期
String ddate = jHead.getString("ddate");
if(StrUtil.isEmpty(ddate)){
jHead.put("ddate", DateUtil.format(new Date(),"yyyy-MM-dd"));
}
//单据模版号
String ivtid = jHead.getString("ivtid");
if(StrUtil.isEmpty(ivtid)){
jHead.put("ivtid","71");
}
//税率
String itaxrate = jHead.getString("itaxrate");
if(StrUtil.isEmpty(itaxrate)){
jHead.put("itaxrate","13");
}
//汇率
String iexchrate = jHead.getString("iexchrate");
if(StrUtil.isEmpty(iexchrate)){
jHead.put("iexchrate","1");
}
//币种
String cexch_name = jHead.getString("cexch_name");
if(StrUtil.isEmpty(cexch_name)){
jHead.put("cexch_name","人民币");
}
//是否立账单据 bcredit 0
String bcredit = jHead.getString("bcredit");
if(StrUtil.isEmpty(bcredit)){
jHead.put("bcredit","0");
}
//流程id iflowid 0
String iflowid = jHead.getString("iflowid");
if(StrUtil.isEmpty(iflowid)){
jHead.put("iflowid","0");
}
//签回损失生成 bsigncreate 0
String bsigncreate = jHead.getString("bsigncreate");
if(StrUtil.isEmpty(bsigncreate)){
jHead.put("bsigncreate","0");
}
//现款结算 bcashsale
String bcashsale = jHead.getString("bcashsale");
if(StrUtil.isEmpty(bcashsale)){
jHead.put("bcashsale","0");
}
//必有定金 bmustbook 0
String bmustbook = jHead.getString("bmustbook");
if(StrUtil.isEmpty(bmustbook)){
jHead.put("bmustbook","0");
}
//存货选项切换 baccswitchflag 0
String baccswitchflag = jHead.getString("baccswitchflag");
if(StrUtil.isEmpty(baccswitchflag)){
jHead.put("baccswitchflag","0");
}
//todo 发货单表头必输项
String[] MustInputCode = new String[] { "cvouchtype", "cstcode", "ddate", "breturnflag", "cdepcode" };
String[] MustInputName = new String[] { "单据类型编码", "销售类型编码 ", "单据日期", "退货标识0发货1退货", "部门编码" };
//根据当前单据类型 所需参数判断是否传入该参数没有传入
for (int i = 0; i < MustInputCode.length; i++)
{
if (StrUtil.isEmpty(jHead.getString(MustInputCode[i]))) {
resultStr.append("请输入:" + MustInputCode[i] + "(" + MustInputName[i] + ")") ;
}
}
//如果有错误信息则返回错误信息
if(StrUtil.isNotEmpty(resultStr.toString())){
return BaseU8Result.getFailureMessageEntity(resultStr.toString());
}
//校验发货单是否存在 CRM cdefine10是唯一的
String cDLCodeIsExist = "select cDefine10,cDLCode from "+AccCode+".dbo.DispatchList where cDefine10 = '"+jHead.getString("cdefine10")+"'";
//查询银行账户列表
SaleInvEntity U8Obj = new SaleInvEntity();
U8Obj.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> hashMaps = saleInvDao.getU8BillData(cDLCodeIsExist,U8Obj);
if(CollectionUtils.isNotEmpty(hashMaps)){
return BaseU8Result.getFailureMessageEntity("发货通知单号已存在!对应发货单号为:"+jHead.getString("cdefine10"));
}
//todo 发货单表体
JSONArray body = new JSONArray();
JSONArray jBody = jsonObject.getJSONArray("body");
for (int i = 0; i < jBody.size(); i++) {
JSONObject jBodyObj = jBody.getJSONObject(i);
//验证数据如果为空则返回报错信息
String[] MustInputCodes = new String[] { "iquantity", "cinvcode","inum" };
String[] MustInputNames = new String[] { "数量", "存货编码","辅计量单位数量" };
for (int j = 0; j < MustInputCodes.length; j++){
if (StrUtil.isEmpty(MustInputCodes[j])){
resultStr.append("请输入:" + MustInputCodes[j] + "(" + MustInputNames[j] + "),错误行:" + (i + 1)) ;
}
}
//获取计量单位组信息
String sqlUnit = "select b.cInvCName,a.* from "+AccCode+".dbo.Inventory a left join "+AccCode+".dbo.InventoryClass b on b.cInvCCode = a.cInvCCode " +
"where cInvCode='"+jBodyObj.getString("cinvcode")+"'";
SaleInvEntity U8Body = new SaleInvEntity();
U8Body.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> U8BodyHashMaps = saleInvDao.getU8BillData(sqlUnit,U8Body);
if(CollectionUtils.isEmpty(U8BodyHashMaps)){
resultStr.append("存货编码不存在[" + jBodyObj.getString("cinvcode")+ "],行:"+i + 1+"" );
}
//存货信息
HashMap<String, Object> inv= U8BodyHashMaps.get(0);
//必须传下面参数不然CO会报错
jBodyObj.put("cgroupcode",inv.get("cGroupCode"));
jBodyObj.put("igrouptype",inv.get("iGroupType"));
jBodyObj.put("ccomunitcode",inv.get("cComUnitCode"));
//默认项 在第三方调用不传输数据情况下 则默认以下数据
// 买赠类型
String cdefine22 = jBodyObj.getString("cdefine22");
if(StrUtil.isEmpty(cdefine22)){
jBodyObj.put("cdefine22","正常");
}
//累计出库数量 (似乎有这个bug不传这个参数累计出库数量会和发货数量一致导致发货单关闭反正加上没坏处)
jBodyObj.put("fOutQuantity","0.00");
//工厂编码
jBodyObj.put("cfactorycode","001");
//退补数量 tbquantity
String tbquantity = jBodyObj.getString("tbquantity");
if(StrUtil.isEmpty(tbquantity)){
jBodyObj.put("tbquantity","0");
}
//零售单价 fsalecost
String fsalecost = jBodyObj.getString("fsalecost");
if(StrUtil.isEmpty(fsalecost)){
jBodyObj.put("fsalecost","0");
}
//零售金额 fsaleprice
String fsaleprice = jBodyObj.getString("fsaleprice");
if(StrUtil.isEmpty(fsaleprice)){
jBodyObj.put("fsaleprice","0");
}
//客户最低售价 fcusminprice
String fcusminprice = jBodyObj.getString("fcusminprice");
if(StrUtil.isEmpty(fcusminprice)){
jBodyObj.put("fcusminprice","0");
}
//有效期推算方式 iexpiratdatecalcu
String iexpiratdatecalcu = jBodyObj.getString("iexpiratdatecalcu");
if(StrUtil.isEmpty(iexpiratdatecalcu)){
jBodyObj.put("iexpiratdatecalcu","0");
}
//需要签回 bneedsign
String bneedsign = jBodyObj.getString("bneedsign");
if(StrUtil.isEmpty(bneedsign)){
jBodyObj.put("bneedsign","0");
}
//报价含税标识 bsaleprice
String bsaleprice = jBodyObj.getString("bsaleprice");
if(StrUtil.isEmpty(bsaleprice)){
jBodyObj.put("bsaleprice","1");
}
//是否赠品 bgift
String bgift = jBodyObj.getString("bgift");
if(StrUtil.isEmpty(bgift)){
jBodyObj.put("bgift","0");
}
//行号 irowno
jBodyObj.put("irowno",i+1);
// 金额计算
//原币折扣金额
BigDecimal idiscount = StrUtil.isNotEmpty(jBodyObj.getString("idiscount")) ? jBodyObj.getBigDecimal("idiscount") : new BigDecimal(0);
BigDecimal iquantity = jBodyObj.getBigDecimal("iquantity");//数量
BigDecimal isum = jBodyObj.getBigDecimal("isum");//价税合计
BigDecimal itaxrate_b = jBodyObj.getBigDecimal("itaxrate");//税率
BigDecimal nflat = jHead.getBigDecimal("iexchrate");//汇率
BigDecimal iTaxUnitPrice = isum.divide(iquantity,6); //原币含税单价
JSONObject ae = new JSONObject();
//工具类编写金额信息进行计算
U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 6);
jBodyObj.put("iquotedprice",ae.getString("TaxPrice")) ;
jBodyObj.put("itaxunitprice",ae.getString("TaxPrice")) ;//原币含税单价
jBodyObj.put("isum",ae.getString("Sum"));//价税合计
jBodyObj.put("iunitprice",ae.getString("UnitPrice")) ;//原币不含税单价
jBodyObj.put("imoney",ae.getString("Money"));//原货不含税金额
jBodyObj.put("itax",ae.getString("Tax"));//原币税额
jBodyObj.put("inatunitprice",ae.getString("NatUnitPrice"));//本币含税单价
jBodyObj.put("inatmoney",ae.getString("NatMoney"));//本币含税金额
jBodyObj.put("inattax",ae.getString("NatTax"));//本币税额
jBodyObj.put("inatsum",ae.getString("NatSum"));//本币含税金额
String kl = jBodyObj.getString("kl");
String kl2 = jBodyObj.getString("kl2");
if(StrUtil.isEmpty(kl)){
jBodyObj.put("kl","100");
}
if(StrUtil.isEmpty(kl2)){
jBodyObj.put("kl2","100");
}
// todo 行上如果存在折扣额需要生成一行折扣商品行
if (idiscount.compareTo(BigDecimal.ZERO) != 0){
jBodyObj.put("idiscount",0);
JSONObject discountObj = new JSONObject();
String sqlType = "select * from HzyaDataInteractionPlatform_KJS..Base_DispatchList_VoucherType where voucherType = '"+cdefine22+"'";
SaleInvEntity erdt = new SaleInvEntity();
erdt.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> erdtMap = saleInvDao.getU8BillData(sqlType,erdt);
if(CollectionUtils.isEmpty(erdtMap)){
return BaseU8Result.getFailureMessageEntity("查询发货单类型对照表失败:"+cdefine22);
}
JSONObject dt1 = new JSONObject(erdtMap.get(0));
String cinvcode = dt1.getString("cInvCode");
discountObj.put("cdefine22","返利");
discountObj.put("cinvcode",cinvcode);
discountObj.put("iquantity",0);
discountObj.put("inum",0);
discountObj.put("isum",idiscount.multiply(new BigDecimal(-1)));
ae = U8Util.CalculationSum(discountObj.getBigDecimal("isum"), new BigDecimal(-1), nflat, itaxrate_b, 6);
discountObj.put("itaxunitprice",0);//原币含税单价
discountObj.put("isum",ae.getString("Sum")) ;//价税合计
discountObj.put("iunitprice",0);//原币不含税单价
discountObj.put("imoney",ae.getString("Money"));//原货不含税金额
discountObj.put("itax",ae.getString("Tax")) ;//原币税额
discountObj.put("inatunitprice",0);//本币含税单价
discountObj.put("inatmoney",ae.getString("NatMoney")) ;//本币含税金额
discountObj.put("inattax",ae.getString("NatTax")) ;//本币税额
discountObj.put("inatsum",ae.getString("NatSum")) ;//本币含税金额
discountObj.put("itaxrate",ae.getString("PerTaxRate")) ;//税率
discountObj.put("iquotedprice",0) ;//报价
discountObj.put("idiscount",0) ;//原币折扣额
discountObj.put("inatdiscount",0);//本币折扣额
discountObj.put("kl",100) ;//扣率1
discountObj.put("kl2",100) ;//扣率2
discountObj.put("irowno",jBody.size() + 1) ;//行号
if ("98".equals(cinvcode)){
cinvcode = "9800";
}else if ("99".equals(cinvcode)){
String cinvccode = dt1.getString("cInvCCode");
String cinvcname = dt1.getString("cInvCName");
//白酒
String startStr = "050201";
String endStr = "050205";
// 将字符串转换为整数
Integer targetNumber = null;
Integer startNumber = null;
Integer endNumber = null;
try {
targetNumber = Integer.valueOf(cinvccode);
startNumber = Integer.valueOf(startStr);
endNumber = Integer.valueOf(endStr);
} catch (NumberFormatException e) {
return BaseU8Result.getFailureMessageEntity("查询发货单类型对照表失败:"+cdefine22);
}
if(targetNumber >= startNumber && targetNumber <= endNumber){
cinvcode = "9902";
}else{
cinvcode = "9900";
}
String sqlInv = " select * from "+AccCode+".dbo.Inventory where cInvCode = '"+cinvcode+"' ";
erdt.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> erdtInvMap = saleInvDao.getU8BillData(sqlInv,erdt);
if(CollectionUtils.isEmpty(erdtInvMap)){
return BaseU8Result.getFailureMessageEntity("查询存货失败::"+cinvcode);
}
JSONObject dt2 = new JSONObject(erdtInvMap.get(0));
discountObj.put("cinvcode",dt2.getString("cInvCode"));
discountObj.put("cinvname",dt2.getString("cInvName"));
discountObj.put("cgroupcode",dt2.getString("cGroupCode"));
discountObj.put("igrouptype",dt2.getString("iGroupType"));
discountObj.put("cunitid",dt2.getString("cComunitCode"));
body.add(discountObj) ;
}
}
body.add(jBodyObj) ;
}
JSONObject main = new JSONObject();
main.put("head",jHead);
main.put("billid",billid);
main.put("AccId",AccId);
main.put("head",jHead);
main.put("body",body);
main.put("domPosition",new ArrayList<>());
//如果有错误信息则返回错误信息
if(StrUtil.isNotEmpty(resultStr.toString())){
return BaseU8Result.getSuccessMessageEntity(resultStr.toString());
}
logger.info("发货单新增推送U8"+main.toString());
String result = U8Util.sengBillToU8(main.toString(), "8000110015");
logger.info("发货单新增推送U8结果"+result);
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getBoolean("success");
logger.info(resultObj.toString());
if(!flag){
return BaseU8Result.getFailureMessageEntity("新增失败:::"+resultObj.getString("message"));
}else{
billCode = resultObj.getString("message");
//新增成功之后调用审核接口进行审核
//通过返回的编码获取发货单主键
String dlSql = "select DLID from "+AccCode+".dbo.DispatchList where cDLCode = '"+billCode+"' ";
SaleInvEntity erdt = new SaleInvEntity();
erdt.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> dlMap = saleInvDao.getU8BillData(dlSql,erdt);
if(CollectionUtils.isEmpty(dlMap)){
return BaseU8Result.getFailureMessageEntity("查询发货单主键失败::"+billCode);
}
JSONObject dt3 = new JSONObject(dlMap.get(0));
dlId = dt3.getString("DLID");
//审核
JSONObject audit = new JSONObject();
audit.put("billid", UUID.randomUUID());
audit.put("AccId", AccId);
audit.put("cVoucherId", dlId);
logger.info("发货单审核:"+main.toString());
String resultAudit = U8Util.sengBillToU8(audit.toString(), "8000110016");
logger.info("发货单审核结果:"+result);
JSONObject resultObjA = JSON.parseObject(resultAudit);
boolean flagAudit = resultObjA.getBoolean("success");
// logger.info(resultObj.toString());
if(!flagAudit){
//如果审核失败需要调用删除接口回滚单据
JSONObject delete = new JSONObject();
delete.put("billid", UUID.randomUUID());
delete.put("AccId", AccId);
delete.put("cVoucherId", dlId);
//删除
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110017");
//删除之后直接返回失败信息
return BaseU8Result.getFailureMessageEntity("新增正常但审核失败:::"+resultObjA.getString("message"));
}
}
// {"code":1,"success":"true","message":"2012502250010"}
return BaseU8Result.getSuccessMessageEntity(resultObj.getString("message"));
} catch (Exception e) {
//如果进入异常并且单据主键不为空也同样删除单据进行回滚
JSONObject delete = new JSONObject();
delete.put("billid", UUID.randomUUID());
delete.put("AccId", AccId);
delete.put("cVoucherId", dlId);
//删除
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110017");
//删除之后直接返回失败信息
logger.info("新增失败:"+e.getMessage());
return BaseU8Result.getFailureMessageEntity("新增失败请联系U8管理员");
}
// return BaseU8Result.getSuccessMessageEntity("更新成功");
}
/**
*
* @content 发货单-关闭
* @className: Administrator
* @author laborer
* @date 2025-02-24 14:33
*
*/
@Override
public U8ResultEntity Close(JSONObject parm) {
String billCode = "";
String dlId = "";
String AccId = "";
try {
JSONObject jsonObject = parm.getJSONObject("jsonStr");
logger.info("接收到的参数"+jsonObject.toString());
StringBuffer resultStr = new StringBuffer();//回传json
String billid = jsonObject.getString("billid");
if(StrUtil.isEmpty(billid)){
return BaseU8Result.getFailureMessageEntity("请传入第三方唯一标识");
}
AccId = jsonObject.getString("AccId");
if(StrUtil.isEmpty(AccId)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
String AccCode = U8Util.accMap.get(AccId);
if(StrUtil.isEmpty(AccCode)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
String cdlcode = jsonObject.getString("cdlcode");
if(StrUtil.isEmpty(cdlcode)){
return BaseU8Result.getFailureMessageEntity("发货单号不能为空");
}
String ccloser = jsonObject.getString("ccloser");
if(StrUtil.isEmpty(ccloser)){
return BaseU8Result.getFailureMessageEntity("关闭人不能为空");
}
//判断当前单据是否审核
String sqlIsAudit = "select DLID,cVerifier from DispatchList where cDLCode = '"+cdlcode+"'";
SaleInvEntity erdt = new SaleInvEntity();
List<HashMap<String, Object>> dlMap = saleInvDao.getU8BillData(sqlIsAudit,erdt);
if(CollectionUtils.isEmpty(dlMap)){
return BaseU8Result.getFailureMessageEntity("单据不存在::"+cdlcode);
}
JSONObject dt = new JSONObject(dlMap.get(0));
String cVerifier = dt.getString("cVerifier");
if(StrUtil.isEmpty(cVerifier)){
return BaseU8Result.getFailureMessageEntity("未审核不允许关闭:"+cdlcode);
}
//验证书库数量
} catch (Exception e) {
logger.info("关闭失败:"+e.getMessage());
return BaseU8Result.getFailureMessageEntity("关闭失败请联系U8管理员");
}
return null;
}
}

View File

@ -14,68 +14,8 @@
</sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherin.entity.OtherInDetailEntity">
select * from (
select
'001' as AccId,
'UFDATA_001_2023' as AccCode,
body.cinvcode,
body.iquantity,
TransVouchs.irowno as itvrowno,
body.irowno,
body.id as id
from UFDATA_001_2023.dbo.RdRecords08 body
left join UFDATA_001_2023.dbo.TransVouchs on body.iTrIds = TransVouchs.autoID
union all
select
'002' as AccId,
'UFDATA_002_2024' as AccCode,
body.cinvcode,
body.iquantity,
TransVouchs.irowno as itvrowno,
body.irowno,
body.id as id
from UFDATA_002_2024.dbo.RdRecords08 body
left join UFDATA_002_2024.dbo.TransVouchs on body.iTrIds = TransVouchs.autoID
union all
select
'004' as AccId,
'UFDATA_004_2024' as AccCode,
body.cinvcode,
body.iquantity,
TransVouchs.irowno as itvrowno,
body.irowno,
body.id as id
from UFDATA_004_2024.dbo.RdRecords08 body
left join UFDATA_004_2024.dbo.TransVouchs on body.iTrIds = TransVouchs.autoID
union all
select
'005' as AccId,
'UFDATA_005_2024' as AccCode,
body.cinvcode,
body.iquantity,
TransVouchs.irowno as itvrowno,
body.irowno,
body.id as id
from UFDATA_005_2024.dbo.RdRecords08 body
left join UFDATA_005_2024.dbo.TransVouchs on body.iTrIds = TransVouchs.autoID
union all
select
'201' as AccId,
'UFDATA_201_2023' as AccCode,
body.cinvcode,
body.iquantity,
TransVouchs.irowno as itvrowno,
body.irowno,
body.id as id
from UFDATA_201_2023.dbo.RdRecords08 body
left join UFDATA_201_2023.dbo.TransVouchs on body.iTrIds = TransVouchs.autoID
)m1
select * from kjs_external.dbo.v_hzya_otherin_details

View File

@ -19,87 +19,7 @@
</sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherin.entity.OtherInEntity">
select * from (
select
'001' as AccId,
'UFDATA_001_2023' as AccCode,
id,
'1001'+CAST( id AS VARCHAR(100)) as ids,
ccode,
cbuscode,
crdcode,
cwhcode,
cmaker,
ccuscode,
cHandler,
sync_flag
from UFDATA_001_2023.dbo.RdRecord08
union all
select
'002' as AccId,
'UFDATA_002_2024' as AccCode,
id,
'1002'+CAST( id AS VARCHAR(100)) as ids,
ccode,
cbuscode,
crdcode,
cwhcode,
cmaker,
ccuscode,
cHandler,
sync_flag
from UFDATA_002_2024.dbo.RdRecord08
union all
select
'004' as AccId,
'UFDATA_004_2024' as AccCode,
id,
'1004'+CAST( id AS VARCHAR(100)) as ids,
ccode,
cbuscode,
crdcode,
cwhcode,
cmaker,
ccuscode,
cHandler,
sync_flag
from UFDATA_004_2024.dbo.RdRecord08
union all
select
'005' as AccId,
'UFDATA_005_2024' as AccCode,
id,
'1005'+CAST( id AS VARCHAR(100)) as ids,
ccode,
cbuscode,
crdcode,
cwhcode,
cmaker,
ccuscode,
cHandler,
sync_flag
from UFDATA_005_2024.dbo.RdRecord08
union all
select
'201' as AccId,
'UFDATA_201_2023' as AccCode,
id,
'1201'+CAST( id AS VARCHAR(100)) as ids,
ccode,
cbuscode,
crdcode,
cwhcode,
cmaker,
ccuscode,
cHandler,
sync_flag
from UFDATA_201_2023.dbo.RdRecord08
)m1 where cHandler is not null and sync_flag is null and AccId = '201'
select * from kjs_external.dbo.v_hzya_other_in
<if test="ids != null and ids != ''">and ids = #{ids} </if>
</select>

View File

@ -19,95 +19,7 @@
</sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity">
select *from (
select
'001' as AccId,
'UFDATA_001_2023' as AccCode,
d.cInvCode as cinvcode,
d.cInvName as cinvname,
c.iquantity as iquantity,
e.cDLCode as cdlcode,
c.iNum as inum,
a.iAmount_f as iAmount_f,
a.cLink
from UFDATA_001_2023.dbo.Ap_Vouchs a
LEFT JOIN UFDATA_001_2023.dbo.Ap_Vouch b on a.cLink = b.cLink
LEFT JOIN UFDATA_001_2023.dbo.DispatchLists c on a.cDefine25 = c.iDLsID
left join UFDATA_001_2023.dbo.DispatchList e on c.DLID = e.DLID
LEFT JOIN UFDATA_001_2023.dbo.inventory d on c.cInvCode = d.cInvCode
where b.cVouchType = 'R0' and b.cDigest = '押金单' and a.cDefine25 is not null
union all
select
'002' as AccId,
'UFDATA_002_2024' as AccCode,
d.cInvCode as cinvcode,
d.cInvName as cinvname,
c.iquantity as iquantity,
e.cDLCode as cdlcode,
c.iNum as inum,
a.iAmount_f as iAmount_f,
a.cLink
from UFDATA_002_2024.dbo.Ap_Vouchs a
LEFT JOIN UFDATA_002_2024.dbo.Ap_Vouch b on a.cLink = b.cLink
LEFT JOIN UFDATA_002_2024.dbo.DispatchLists c on a.cDefine25 = c.iDLsID
left join UFDATA_002_2024.dbo.DispatchList e on c.DLID = e.DLID
LEFT JOIN UFDATA_002_2024.dbo.inventory d on c.cInvCode = d.cInvCode
where b.cVouchType = 'R0' and b.cDigest = '押金单' and a.cDefine25 is not null
union all
select
'004' as AccId,
'UFDATA_004_2024' as AccCode,
d.cInvCode as cinvcode,
d.cInvName as cinvname,
c.iquantity as iquantity,
e.cDLCode as cdlcode,
c.iNum as inum,
a.iAmount_f as iAmount_f,
a.cLink
from UFDATA_004_2024.dbo.Ap_Vouchs a
LEFT JOIN UFDATA_004_2024.dbo.Ap_Vouch b on a.cLink = b.cLink
LEFT JOIN UFDATA_004_2024.dbo.DispatchLists c on a.cDefine25 = c.iDLsID
left join UFDATA_004_2024.dbo.DispatchList e on c.DLID = e.DLID
LEFT JOIN UFDATA_004_2024.dbo.inventory d on c.cInvCode = d.cInvCode
where b.cVouchType = 'R0' and b.cDigest = '押金单' and a.cDefine25 is not null
union all
select
'005' as AccId,
'UFDATA_005_2024' as AccCode,
d.cInvCode as cinvcode,
d.cInvName as cinvname,
c.iquantity as iquantity,
e.cDLCode as cdlcode,
c.iNum as inum,
a.iAmount_f as iAmount_f,
a.cLink
from UFDATA_005_2024.dbo.Ap_Vouchs a
LEFT JOIN UFDATA_005_2024.dbo.Ap_Vouch b on a.cLink = b.cLink
LEFT JOIN UFDATA_005_2024.dbo.DispatchLists c on a.cDefine25 = c.iDLsID
left join UFDATA_005_2024.dbo.DispatchList e on c.DLID = e.DLID
LEFT JOIN UFDATA_005_2024.dbo.inventory d on c.cInvCode = d.cInvCode
where b.cVouchType = 'R0' and b.cDigest = '押金单' and a.cDefine25 is not null
union all
select
'201' as AccId,
'UFDATA_201_2023' as AccCode,
d.cInvCode as cinvcode,
d.cInvName as cinvname,
c.iquantity as iquantity,
e.cDLCode as cdlcode,
c.iNum as inum,
a.iAmount_f as iAmount_f,
a.cLink
from UFDATA_201_2023.dbo.Ap_Vouchs a
LEFT JOIN UFDATA_201_2023.dbo.Ap_Vouch b on a.cLink = b.cLink
LEFT JOIN UFDATA_201_2023.dbo.DispatchLists c on a.cDefine25 = c.iDLsID
left join UFDATA_201_2023.dbo.DispatchList e on c.DLID = e.DLID
LEFT JOIN UFDATA_201_2023.dbo.inventory d on c.cInvCode = d.cInvCode
where b.cVouchType = 'R0' and b.cDigest = '押金单' and a.cDefine25 is not null
)m1
select * from kjs_external.dbo.v_hzya_other_receipt_details
where cLink = #{cLink} and AccId = #{AccId}

View File

@ -22,6 +22,15 @@ public class OtherReceiptEntity extends BaseEntity {
private String syncFlag;
private String cLink;
private String state;
private String cDigest;
public String getcDigest() {
return cDigest;
}
public void setcDigest(String cDigest) {
this.cDigest = cDigest;
}
public String getState() {
return state;

View File

@ -9,87 +9,14 @@
<result property="ids" column="ids" />
<result property="syncFlag" column="sync_flag" />
<result property="cLink" column="cLink" />
<result property="cDigest" column="cDigest" />
</resultMap>
<sql id="OtherReceiptEntity_Base_Column_List">
</sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity">
select * from (
select
'001' as AccId,
'UFDATA_001_2023' as AccCode,
'1001'+CAST( cLink AS VARCHAR(100)) as ids,
cLink,
cVouchID as cvouchid,
cDwCode as cCusCode,
sync_flag,
cCheckMan
from UFDATA_001_2023.dbo.Ap_Vouch
where cVouchType = 'R0' and cDigest = '押金单'
UNION ALL
select
'002' as AccId,
'UFDATA_002_2024' as AccCode,
'1002'+CAST( cLink AS VARCHAR(100)) as ids,
cLink,
cVouchID as cvouchid,
cDwCode as cCusCode,
sync_flag,
cCheckMan
from UFDATA_002_2024.dbo.Ap_Vouch
where cVouchType = 'R0' and cDigest = '押金单'
UNION ALL
select
'004' as AccId,
'UFDATA_004_2024' as AccCode,
'1004'+CAST( cLink AS VARCHAR(100)) as ids,
cLink,
cVouchID as cvouchid,
cDwCode as cCusCode,
sync_flag,
cCheckMan
from UFDATA_004_2024.dbo.Ap_Vouch
where cVouchType = 'R0' and cDigest = '押金单'
UNION ALL
select
'005' as AccId,
'UFDATA_005_2024' as AccCode,
'1005'+CAST( cLink AS VARCHAR(100)) as ids,
cLink,
cVouchID as cvouchid,
cDwCode as cCusCode,
sync_flag,
cCheckMan
from UFDATA_005_2024.dbo.Ap_Vouch
where cVouchType = 'R0' and cDigest = '押金单'
UNION ALL
select
'201' as AccId,
'UFDATA_201_2023' as AccCode,
'1201'+CAST( cLink AS VARCHAR(100)) as ids,
cLink,
cVouchID as cvouchid,
cDwCode as cCusCode,
sync_flag,
cCheckMan
from UFDATA_201_2023.dbo.Ap_Vouch
where cVouchType = 'R0' and cDigest = '押金单'
)m1 where cCusCode not in ('001','002','004','005') and cCheckMan is not null and AccId = '201' and sync_flag is null
select * from kjs_external.dbo.v_hzya_other_receipt
<if test="ids != null and ids != ''">and ids = #{ids} </if>
</select>

View File

@ -170,6 +170,8 @@ public class OtherReceiptServiceImpl extends BaseService<OtherReceiptEntity,Stri
main.put("LoginDate", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
JSONObject head = new JSONObject();
head.put("cvouchid",sale.getCvouchid());
head.put("cCusCode",sale.getcCusCode());
head.put("cDigest",sale.getcDigest());
head.put("syncFlag","");
JSONArray body = new JSONArray();
main.put("head",head);

View File

@ -21,113 +21,7 @@
</sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.receipt.entity.ReceiptEntity">
select * from (
select
'001' as AccId,
'UFDATA_001_2023' as AccCode,
head.iID,
'1001'+CAST( head.iID AS VARCHAR(100)) as ids,
head.cvouchid,
head.dvouchdate,
customer.ccuscode,
customer.ccusname,
case
when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan
from UFDATA_001_2023.dbo.Ap_CloseBill head
left join UFDATA_001_2023.dbo.customer customer on cDwCode = customer.ccuscode
left join UFDATA_001_2023.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
UNION ALL
select
'002' as AccId,
'UFDATA_002_2024' as AccCode,
head.iID,
'1002'+CAST( head.iID AS VARCHAR(100)) as ids,
head.cvouchid,
head.dvouchdate,
customer.ccuscode,
customer.ccusname,
case
when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan
from UFDATA_002_2024.dbo.Ap_CloseBill head
left join UFDATA_002_2024.dbo.customer customer on cDwCode = customer.ccuscode
left join UFDATA_002_2024.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
UNION ALL
select
'004' as AccId,
'UFDATA_004_2024' as AccCode,
head.iID,
'1004'+CAST( head.iID AS VARCHAR(100)) as ids,
head.cvouchid,
head.dvouchdate,
customer.ccuscode,
customer.ccusname,
case
when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan
from UFDATA_004_2024.dbo.Ap_CloseBill head
left join UFDATA_004_2024.dbo.customer customer on cDwCode = customer.ccuscode
left join UFDATA_004_2024.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
UNION ALL
select
'005' as AccId,
'UFDATA_005_2024' as AccCode,
head.iID,
'1005'+CAST( head.iID AS VARCHAR(100)) as ids,
head.cvouchid,
head.dvouchdate,
customer.ccuscode,
customer.ccusname,
case
when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan
from UFDATA_005_2024.dbo.Ap_CloseBill head
left join UFDATA_005_2024.dbo.customer customer on cDwCode = customer.ccuscode
left join UFDATA_005_2024.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
UNION ALL
select
'201' as AccId,
'UFDATA_201_2023' as AccCode,
head.iID,
'1201'+CAST( head.iID AS VARCHAR(100)) as ids,
head.cvouchid,
head.dvouchdate,
customer.ccuscode,
customer.ccusname,
case
when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan
from UFDATA_201_2023.dbo.Ap_CloseBill head
left join UFDATA_201_2023.dbo.customer customer on cDwCode = customer.ccuscode
left join UFDATA_201_2023.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
)m1 where cCusCode not in ('001','002','004','005') and cCheckMan is not null and sync_flag is null and AccId = '201'
select * from kjs_external.dbo.v_hzya_receipt
<if test="ids != null and ids != ''">and ids = #{ids} </if>
</select>

View File

@ -3,6 +3,7 @@ package com.hzya.frame.u8.saleinv.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.u8.saleinv.entity.SaleInvEntity;
import java.util.HashMap;
import java.util.List;
/**
@ -34,4 +35,14 @@ public interface ISaleInvDao extends IBaseDao<SaleInvEntity,String> {
*/
int updateState(SaleInvEntity entity);
/**
*
* @content 通用获取OA数据接口
* @author laborer
* @date 2024/7/10 0010 16:06
*
*/
List<HashMap<String, Object>> getU8BillData(String str , SaleInvEntity entity)throws Exception;
}

View File

@ -2,10 +2,13 @@ package com.hzya.frame.u8.saleinv.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.execsql.service.IExecSqlService;
import com.hzya.frame.u8.saleinv.dao.ISaleInvDao;
import com.hzya.frame.u8.saleinv.entity.SaleInvEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
/**
@ -18,6 +21,8 @@ import java.util.List;
*/
@Repository(value = "SaleInvDaoImpl")
public class SaleInvDaoImpl extends MybatisGenericDao<SaleInvEntity,String> implements ISaleInvDao {
@Autowired
private IExecSqlService execSqlService;
@DS("#entity.dataSourceCode")
@Override
@ -29,4 +34,9 @@ public class SaleInvDaoImpl extends MybatisGenericDao<SaleInvEntity,String> impl
public int updateState(SaleInvEntity entity) {
return super.update("com.hzya.frame.u8.saleinv.dao.impl.SaleInvDaoImpl.entity_update", entity);
}
@DS("#entity.dataSourceCode")
@Override
public List<HashMap<String, Object>> getU8BillData(String str, SaleInvEntity entity)throws Exception {
return execSqlService.execSelectSql(str, "");
}
}

View File

@ -3,6 +3,7 @@ package com.hzya.frame.u8.saleout.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.u8.saleout.entity.SaleOutEntity;
import com.hzya.frame.u8.util.U8ResultEntity;
/**
*
@ -23,4 +24,15 @@ public interface ISaleOutService extends IBaseService<SaleOutEntity,String> {
*/
void getU8SaleOutToCrm(JSONObject requestJson);
/**
*
* @content 销售出库-新增
* @className: Administrator
* @author laborer
* @date 2025-02-24 14:33
*
*/
U8ResultEntity addSaleOut(JSONObject parm);
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.u8.saleout.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
@ -11,12 +12,17 @@ import com.hzya.frame.crm.util.CrmUtil;
import com.hzya.frame.seeyon.util.RestUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.u8.saleinv.dao.ISaleInvDao;
import com.hzya.frame.u8.saleinv.entity.SaleInvEntity;
import com.hzya.frame.u8.saleout.dao.ISaleOutDao;
import com.hzya.frame.u8.saleout.dao.ISaleOutDetailDao;
import com.hzya.frame.u8.saleout.dao.impl.SaleOutDetailDaoImpl;
import com.hzya.frame.u8.saleout.entity.SaleOutDetailEntity;
import com.hzya.frame.u8.saleout.entity.SaleOutEntity;
import com.hzya.frame.u8.saleout.service.ISaleOutService;
import com.hzya.frame.u8.util.BaseU8Result;
import com.hzya.frame.u8.util.U8ResultEntity;
import com.hzya.frame.u8.util.U8Util;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
@ -25,7 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
@ -38,6 +48,8 @@ import java.util.List;
*/
@Service(value = "SaleOutServiceImpl")
public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implements ISaleOutService {
@Autowired
private ISaleInvDao saleInvDao;
Logger logger = LogManager.getLogger(getClass());
@Autowired
private ISaleOutDao saleOutDao;
@ -145,7 +157,9 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
}
}
/**
/**
*
* @content 保存日志信息
* @className: Administrator
@ -211,4 +225,280 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
main.put("body",body);
return main;
}
/**
*
* @content 销售出库-新增
* @className: Administrator
* @author laborer
* @date 2025-02-26 14:39
*
*/
@Override
public U8ResultEntity addSaleOut(JSONObject parm) {
String billCode = "";
String dlId = "";
String AccId = "";
JSONObject jsonObject = parm.getJSONObject("jsonStr");
logger.info("接收到的参数"+jsonObject.toString());
StringBuffer resultStr = new StringBuffer();//回传json
try {
String billid = jsonObject.getString("billid");
if(StrUtil.isEmpty(billid)){
return BaseU8Result.getFailureMessageEntity("请传入第三方唯一标识");
}
// AccId = jsonObject.getString("AccId");
// if(StrUtil.isEmpty(AccId)){
// return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
// }
// String AccCode = U8Util.accMap.get(AccId);
// if(StrUtil.isEmpty(AccCode)){
// return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
// }
JSONObject jHead = jsonObject.getJSONObject("head");
//todo 发货单表头必输项
String[] MustInputCode = new String[] { "cbuscode", "crdcode", "cwhcode", "cmaker"};
String[] MustInputName = new String[] { "发货单号", "收发类别", "仓库", "制单人"};
//根据当前单据类型 所需参数判断是否传入该参数没有传入
for (int i = 0; i < MustInputCode.length; i++)
{
if (StrUtil.isEmpty(jHead.getString(MustInputCode[i]))) {
resultStr.append("请输入:" + MustInputCode[i] + "(" + MustInputName[i] + ")") ;
}
}
//如果有错误信息则返回错误信息
if(StrUtil.isNotEmpty(resultStr.toString())){
return BaseU8Result.getFailureMessageEntity(resultStr.toString());
}
String sqlAccId = "select * from [kjs_external].[dbo].[v_dispatchlist_forout] where cDLCode = '"+jHead.getString("cbuscode")+"'";
//查询账套中的发货单信息
SaleInvEntity U8Obj = new SaleInvEntity();
U8Obj.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> hashMaps = saleInvDao.getU8BillData(sqlAccId,U8Obj);
if(CollectionUtils.isEmpty(hashMaps) || hashMaps.size() > 1){
return BaseU8Result.getFailureMessageEntity("发货单不存在,或存在多个发货单号为:"+jHead.getString("cbuscode"));
}
HashMap<String, Object> cbusc= hashMaps.get(0);
AccId = String.valueOf(cbusc.get("zhangtao"));
if(StrUtil.isEmpty(AccId)){
return BaseU8Result.getFailureMessageEntity("获取账套号有误,请联系管理员"+AccId);
}
String AccCode = U8Util.accMap.get(AccId);
if(StrUtil.isEmpty(AccCode)){
return BaseU8Result.getFailureMessageEntity("获取账套号有误,请联系管理员");
}
//发货退货单主表@
//发货退货单主表
String sqlSelDisList = "select DLID as 'dlid',DLID as 'cdlcode' ,cDLCode as 'cbuscode' ,cDepCode as 'cdepcode' ,cPersonCode as 'cpersoncode' ,cCusCode as 'ccuscode'," +
"cCusCode as 'cinvoicecompany',cSTCode as 'cstcode ,'32' as 'cvouchtype' ,'普通销售' as 'cbustype' ,'发货单' as 'csource' ,GETDATE() as 'ddate' ,'form WMS' as 'cmemo'," +
"case when bReturnFlag = 1 then '多组织-红字采购入库' else '多组织-采购订单' end as 'cdefine1' " +
"from "+AccCode+".dbo.DispatchList " +
"where cDLCode = '"+jHead.getString("cbuscode")+"'";
List<HashMap<String, Object>> selDisListMap = saleInvDao.getU8BillData(sqlSelDisList,U8Obj);
if(CollectionUtils.isEmpty(selDisListMap) ){
return BaseU8Result.getFailureMessageEntity("发货单主表查询失败"+jHead.getString("cbuscode"));
}
HashMap<String, Object> selDis= hashMaps.get(0);
if(StrUtil.isEmpty(jHead.getString("dlid"))){
jHead.put("dlid",selDis.get("dlid"));
}
if(StrUtil.isEmpty(jHead.getString("cdlcode"))){
jHead.put("cdlcode",selDis.get("cdlcode"));
}
if(StrUtil.isEmpty(jHead.getString("cbuscode"))){
jHead.put("cbuscode",selDis.get("cbuscode"));
}
if(StrUtil.isEmpty(jHead.getString("cdepcode"))){
jHead.put("cdepcode",selDis.get("cdepcode"));
}
if(StrUtil.isEmpty(jHead.getString("cpersoncode"))){
jHead.put("cpersoncode",selDis.get("cpersoncode"));
}
if(StrUtil.isEmpty(jHead.getString("ccuscode"))){
jHead.put("ccuscode",selDis.get("ccuscode"));
}
if(StrUtil.isEmpty(jHead.getString("cinvoicecompany"))){
jHead.put("cinvoicecompany",selDis.get("cinvoicecompany"));
}
if(StrUtil.isEmpty(jHead.getString("cinvoicecompany"))){
jHead.put("cinvoicecompany",selDis.get("cinvoicecompany"));
}
if(StrUtil.isEmpty(jHead.getString("cvouchtype"))){
jHead.put("cvouchtype",selDis.get("cvouchtype"));
}
if(StrUtil.isEmpty(jHead.getString("cbustype"))){
jHead.put("cbustype",selDis.get("cbustype"));
}
if(StrUtil.isEmpty(jHead.getString("csource"))){
jHead.put("csource",selDis.get("csource"));
}
if(StrUtil.isEmpty(jHead.getString("ddate"))){
jHead.put("ddate",selDis.get("ddate"));
}
if(StrUtil.isEmpty(jHead.getString("cmemo"))){
jHead.put("cmemo",selDis.get("cmemo"));
}
if(StrUtil.isEmpty(jHead.getString("cdefine1"))){
jHead.put("cdefine1",selDis.get("cdefine1"));
}
//表体
JSONArray body = new JSONArray();
JSONArray jBody = jsonObject.getJSONArray("body");
for (int i = 0; i < jBody.size(); i++) {
JSONObject jBodyObj = jBody.getJSONObject(i);
if(StrUtil.isEmpty(jBodyObj.getString("cinvcode"))){
resultStr.append("材料编码不能为空 行:"+i+1) ;
//如果有错误信息则返回错误信息
if(StrUtil.isNotEmpty(resultStr.toString())){
return BaseU8Result.getFailureMessageEntity(resultStr.toString());
}
}
if(StrUtil.isEmpty(jBodyObj.getString("iquantity"))){
resultStr.append("数量不能为空 行:"+i+1) ;
//如果有错误信息则返回错误信息
if(StrUtil.isNotEmpty(resultStr.toString())){
return BaseU8Result.getFailureMessageEntity(resultStr.toString());
}
}
if("0".equals(jBodyObj.getString("iquantity"))){
resultStr.append("数量不能为0 行:"+i+1) ;
//如果有错误信息则返回错误信息
if(StrUtil.isNotEmpty(resultStr.toString())){
return BaseU8Result.getFailureMessageEntity(resultStr.toString());
}
}
//发货退货单子表@
String sqlSelDisLists = " select idlsid from "+AccCode+".dbo.DispatchList dl left join "+AccCode+".dbo.DispatchLists dls on dls.DLID = dl.DLID " +
"where cDLCode = '"+jBodyObj.getString("cbdlcode")+"" +
"' and cInvCode = '"+jBodyObj.getString("cinvcode")+"" +
"' and irowno = '"+jBodyObj.getString("cdblrowno")+"'";
List<HashMap<String, Object>> selDisDetailsListMap = saleInvDao.getU8BillData(sqlSelDisLists,U8Obj);
if(CollectionUtils.isEmpty(selDisDetailsListMap) ){
return BaseU8Result.getFailureMessageEntity("发货单子表查询失败"+jHead.getString("cbuscode")+"发货单表体存货"+jBodyObj.getString("cinvcode")+"行号"+jBodyObj.getString("cdblrowno")+"不存在");
}
HashMap<String, Object> selDisDetails= hashMaps.get(0);
if(StrUtil.isEmpty(jBodyObj.getString("idlsid"))){
jBodyObj.put("idlsid",selDisDetails.get("idlsid"));
}
//获取辅计量单位
String dtInvSql = "select cInvCode,cInvName,cInvStd,Inv.cComUnitCode,cInvCCode,iChangRate, cPUComUnitCode,cSAComUnitCode,cProductUnit,cSTComUnitCode " +
"from "+AccCode+".dbo.Inventory Inv " +
"left join "+AccCode+".dbo.ComputationUnit Com On Inv.cComUnitCode = Com.cComUnitCode " +
"where cInvCode='" + jBodyObj.getString("cinvcode") +"'";
List<HashMap<String, Object>> dtInv = saleInvDao.getU8BillData(dtInvSql,U8Obj);
if(CollectionUtils.isEmpty(dtInv) ){
return BaseU8Result.getFailureMessageEntity("ERP没有该物料请检查行号"+i+1);
}
HashMap<String, Object> dtInvObj= dtInv.get(0);
//存在辅计量单位则 计算件数 =数量/换算率
if(StrUtil.isNotEmpty(String.valueOf(dtInvObj.get("cSTComUnitCode")))){
jBodyObj.put("cassunit",dtInvObj.get("cSTComUnitCode"));
String sqlCassUnit = "select * from "+AccCode+".dbo.ComputationUnit where cComUnitCode='" +dtInvObj.get("cSTComUnitCode")+"'";
List<HashMap<String, Object>> dtUnit = saleInvDao.getU8BillData(sqlCassUnit,U8Obj);
if(CollectionUtils.isEmpty(dtUnit) ){
return BaseU8Result.getFailureMessageEntity("查询单位失败,请检查,行号:"+i+1);
}
HashMap<String, Object> dtUnitObj= dtUnit.get(0);
jBodyObj.put("iinvexchrate",dtUnitObj.get("iChangRate"));
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(dtUnitObj.get("iChangRate"))),6, RoundingMode.HALF_UP));
}
jBodyObj.put("irowno",i+1);
//默认字段
//是否需要开票
if(StrUtil.isEmpty(jBodyObj.getString("bneedbill"))){
jBodyObj.put("bneedbill",1);
}
//是否存货核算开票
if(StrUtil.isEmpty(jBodyObj.getString("bIAcreatebill"))){
jBodyObj.put("bIAcreatebill",0);
}
//是否销售出库开票
if(StrUtil.isEmpty(jBodyObj.getString("bsaleoutcreatebill"))){
jBodyObj.put("bsaleoutcreatebill",0);
}
//存货是05分类下的且没有供应商存货调价单就报错
if(!"001".equals(AccId)){
String sqlInv = " select cInvCCode from "+AccCode+".dbo.Inventory where cInvCode = '"+jBodyObj.getString("cinvcode")+"' and cInvCCode like '05%' ";
List<HashMap<String, Object>> dtInvSu = saleInvDao.getU8BillData(sqlInv,U8Obj);
if(CollectionUtils.isNotEmpty(dtInvSu) ){
String sqlVenPrice = "select * " +
"from "+AccCode+".dbo.Ven_Inv_Price " +
"where cVenCode = '001' and cInvCode = '"+jBodyObj.getString("cinvcode")+"' " +
"and dEnableDate <= convert(varchar,getdate(),23) " +
"and ISNULL(dDisableDate,'9999-12-31') > convert(varchar,getdate(),23) " +
"order by dEnableDate ";
List<HashMap<String, Object>> dtVenPrice = saleInvDao.getU8BillData(sqlVenPrice,U8Obj);
if(CollectionUtils.isEmpty(dtVenPrice)){
return BaseU8Result.getFailureMessageEntity("存货:"+jBodyObj.getString("cinvcode")+"供应商001供应商存货调价单不存在");
}
}
}
body.add(jBodyObj);
}
JSONObject main = new JSONObject();
main.put("head",jHead);
main.put("billid",billid);
main.put("AccId",AccId);
main.put("head",jHead);
main.put("body",body);
main.put("domPosition",new ArrayList<>());
logger.info("销售出库单新增推送U8"+main.toString());
String result = U8Util.sengBillToU8(main.toString(), "8000110021");
logger.info("销售出库单新增推送U8结果"+result);
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getBoolean("success");
logger.info(resultObj.toString());
if(!flag){
return BaseU8Result.getFailureMessageEntity("新增失败:::"+resultObj.getString("message"));
}else{
billCode = resultObj.getString("message");
//审核
JSONObject audit = new JSONObject();
audit.put("billid", UUID.randomUUID());
audit.put("AccId", AccId);
audit.put("cVoucherId", billCode);
logger.info("销售出库单审核:"+main.toString());
String resultAudit = U8Util.sengBillToU8(audit.toString(), "8000110022");
logger.info("销售出库单审核结果:"+result);
JSONObject resultObjA = JSON.parseObject(resultAudit);
boolean flagAudit = resultObjA.getBoolean("success");
// logger.info(resultObj.toString());
if(!flagAudit){
//如果审核失败需要调用删除接口回滚单据
JSONObject delete = new JSONObject();
delete.put("billid", UUID.randomUUID());
delete.put("AccId", AccId);
delete.put("cVoucherId", billCode);
//删除
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110023");
//删除之后直接返回失败信息
return BaseU8Result.getFailureMessageEntity("新增正常但审核失败:::"+resultObjA.getString("message"));
}
}
return BaseU8Result.getSuccessMessageEntity(resultObj.getString("message"));
} catch (Exception e) {
//如果审核失败需要调用删除接口回滚单据
JSONObject delete = new JSONObject();
delete.put("billid", UUID.randomUUID());
delete.put("AccId", AccId);
delete.put("cVoucherId", billCode);
//删除
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110023");
logger.info("新增失败:"+e.getMessage());
return BaseU8Result.getFailureMessageEntity("新增失败请联系U8管理员");
}
}
}

View File

@ -0,0 +1,118 @@
package com.hzya.frame.u8.util;
import com.alibaba.fastjson.JSON;
/**
* @Content定义全局
* @Author 👻👻👻👻👻👻👻👻👻👻 gjh
* @Date 2022-12-06 9:54
* @Version 1.0
*/
public class BaseU8Result {
/**
* 请求失败
*
* @param message 提示信息
* @return
*/
public static U8ResultEntity getFailureMessageEntity(String message) {
return new U8ResultEntity(message, false,"500");
}
/**
* 请求失败
*
* @param message 提示信息
* @return
*/
public static U8ResultEntity getFailureMessageEntity(String message, Object mo) {
return new U8ResultEntity(message,false,"500", mo);
}
/***
* @Content:请求失败
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2022-12-06 11:00
* @Param [message, type, status, mo]
* @return com.hzya.frame.web.entity.U8ResultEntity
**/
public static U8ResultEntity getFailureMessageEntity(String message, String status) {
return new U8ResultEntity(message, false, status);
}
/***
* @Content:请求失败
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2022-12-06 11:00
* @Param [message, type, status, mo]
* @return com.hzya.frame.web.entity.U8ResultEntity
**/
public static U8ResultEntity getFailureMessageEntity(String message, String status,Object mo) {
return new U8ResultEntity(message, false, status,mo);
}
/**
* 请求成功
*
* @param message 提示消息
* @return
*/
public static U8ResultEntity getSuccessMessageEntity(String message) {
return new U8ResultEntity(message,true,"200");
}
/**
* 请求成功
*
* @param type 类型
* @param message 提示消息
* @param mo 返回对象
* @return
*/
public static String getSuccessMessageEntityByStringResult(String message, String type, Object mo) {
return JSON.toJSONString(new U8ResultEntity(message, true,type, mo));
}
/**
* 请求成功
*
* @param message 提示消息
* @return
*/
public static String getSuccessMessageEntityByStringResult(String message) {
return JSON.toJSONString( new U8ResultEntity( message,true));
}
/****
* @Content: 返回失败结果返回的是字符串格式
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2020-11-23 18:41
* @Param [message, type]
* @return java.lang.String
**/
public static String getFailureMessageEntityByString(String message) {
return JSON.toJSONString(new U8ResultEntity( message,false));
}
/**
* 请求失败
*
* @param type 类型
* @param message 提示信息
* @return
*/
public static String getFailureMessageEntityByString(String message, String type, Object mo) {
return JSON.toJSONString(new U8ResultEntity(message,false , type, mo));
}
/**
* 请求成功
* @return
*/
public static U8ResultEntity getSuccessMessageEntity(Object obj) {
return new U8ResultEntity("成功",true,"200" ,obj);
}
public static U8ResultEntity getSuccessMessageEntity(String message, Object mo) {
return new U8ResultEntity(message,true,"200" ,mo);
}
}

View File

@ -0,0 +1,91 @@
package com.hzya.frame.u8.util;
/**
*
* @author 郭军辉
*
* 2016年12月14日下午5:21:35
*/
public class U8ResultEntity {
/** 提示信息 */
private String message;
/** 返回类型 */
private String type;
/** 是否成功 true成功 false失败 */
private boolean success;
/** 状态码*/
private String code;
/** request 域放的对象 */
private Object data;
public String getmessage() {
return message;
}
public void setmessage(String message) {
this.message = message;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean issuccess() {
return success;
}
public void setsuccess(boolean success) {
this.success = success;
}
public Object getdata() {
return data;
}
public void setdata(Object data) {
this.data = data;
}
public U8ResultEntity(String message, boolean success, Object data) {
super();
this.message = message;
this.success = success;
this.data = data;
}
public U8ResultEntity(String message, boolean success, String code) {
this.message = message;
this.success = success;
this.code = code;
}
public U8ResultEntity(String message, boolean success, String code, Object data) {
this.message = message;
this.success = success;
this.code = code;
this.data = data;
}
public U8ResultEntity(String message, boolean success) {
super();
this.message = message;
this.success = success;
}
public U8ResultEntity() {
super();
}
public String getcode() {
return code;
}
public void setcode(String code) {
this.code = code;
}
}

View File

@ -2,18 +2,32 @@ package com.hzya.frame.u8.util;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.u8.dto.U8ResponseDTO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.Map;
/**
* @Description
* @Author xiangerlin
* @Date 2024/5/14 15:30
**/
public class U8Util {
public static Map<String,String> accMap = new HashMap<String,String>(){
{
put("001","UFDATA_001_2023");
put("002","UFDATA_002_2024");
put("004","UFDATA_004_2023");
put("005","UFDATA_005_2023");
put("201","UFDATA_201_2023");
}
};
static Logger logger = LogManager.getLogger(U8Util.class);
//获取token
@ -31,4 +45,53 @@ public class U8Util {
return token;
}
public static String sengBillToU8(String parm, String apiCode){
String baseUrl = "http://127.0.0.1:9990/kangarooDataCenterV3/entranceController/externalCallInterface";
System.out.println("推送参数"+parm);
String result = HttpRequest.post(baseUrl)
.header("appId", "800011")//头信息多个头信息多次调用此方法即可
.header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
return analytic(result);
}
return null;
}
public static String analytic(String parm){
JSONObject main = JSON.parseObject(parm);
return main.getString("attribute");
}
public static JSONObject CalculationSum(BigDecimal iSum, BigDecimal iQuantity, BigDecimal nflat, BigDecimal iPerTaxRate, int iLenDecimal){
JSONObject ae = new JSONObject();
ae.put("iSum",iSum);
ae.put("iQuantity",iQuantity);
ae.put("nflat",nflat);
ae.put("iPerTaxRate",iPerTaxRate);
ae.put("iLenDecimal",iLenDecimal);
ae.put("TaxPrice",iSum.divide(iQuantity,6, RoundingMode.HALF_UP));
ae.put("Money",iSum.divide(new BigDecimal(1).add(iPerTaxRate.multiply(new BigDecimal(0.01))),2)) ;
ae.put("UnitPrice",ae.getBigDecimal("Money").divide(iQuantity,6, RoundingMode.HALF_UP));
ae.put("NatSum",iSum.multiply(nflat));
ae.put("NatUnitPrice",ae.getBigDecimal("UnitPrice").multiply(nflat));
ae.put("NatMoney",ae.getBigDecimal("Money").multiply(nflat)) ;
ae.put("NatTaxPrice",ae.getBigDecimal("TaxPrice").multiply(nflat));
ae.put("Sum",ae.getBigDecimal("iSum").setScale(2)) ;
ae.put("UnitPrice",ae.getBigDecimal("UnitPrice").setScale(iLenDecimal));
ae.put("Money",ae.getBigDecimal("Money").setScale(2));
ae.put("NatTaxPrice",ae.getBigDecimal("NatTaxPrice").setScale(iLenDecimal)) ;
ae.put("NatSum",ae.getBigDecimal("NatSum").setScale(2));
ae.put("NatUnitPrice",ae.getBigDecimal("NatUnitPrice").setScale(iLenDecimal));
ae.put("NatMoney",ae.getBigDecimal("NatMoney").setScale(2));
ae.put("Tax",ae.getBigDecimal("Sum").subtract(ae.getBigDecimal("Money")));
ae.put("NatTax",ae.getBigDecimal("NatSum").subtract(ae.getBigDecimal("NatMoney")));
return ae;
}
}

View File

@ -20,103 +20,103 @@ import java.util.List;
*/
public class Tetst01 {
//产品号
private static String productID = "tmsReport";
//服务号
private static String serviceID = "queryAccDetail";
@Test
public void trxParseTest(){
String str = "{\n" +
" \"Data\": {\n" +
" \"retCode\": \"0000\",\n" +
" \"retMsg\": \"查询成功\",\n" +
" \"pageSize\": \"50\",\n" +
" \"currentPage\": \"1\",\n" +
" \"totalPage\": \"1\",\n" +
" \"totalSize\": \"4\",\n" +
" \"list\": [{\n" +
" \"bankAcc\": \"53170122000051772\",\n" +
" \"bankSubAcc\": \"\",\n" +
" \"accName\": \"宁波富市智梵织焦投资有限公司\",\n" +
" \"bankName\": \"宁波银行股份有限公司江北支行\",\n" +
" \"oppAccNo\": \"\",\n" +
" \"oppAccBank\": \"\",\n" +
" \"cdSign\": \"0\",\n" +
" \"cdSignName\": \"\",\n" +
" \"amt\": \"999999.00\",\n" +
" \"bal\": \"51643875.40\",\n" +
" \"transTime\": \"2024-05-04 09:13:18\",\n" +
" \"subSerialNo\": \"3200000021\",\n" +
" \"serialNo\": \"\",\n" +
" \"curCode\": \"01\",\n" +
" \"uses\": \"\",\n" +
" \"abs\": \"现金存入\",\n" +
" \"voucherNo\": \"12405044020000446120240504\",\n" +
" \"bifCode\": \"9038\",\n" +
" \"bankType\": \"宁波银行\",\n" +
" \"oppBankType\": \"\",\n" +
" \"isForIndividual\": \"0\",\n" +
" \"serialId\": \"445439D1462C3600F9235B9C2BEF48E6\",\n" +
" \"bankSerialId\": \"124050440200004461\",\n" +
" \"groupTrans\": \"\",\n" +
" \"capitalTrans\": \"\",\n" +
" \"postScript\": \"\",\n" +
" \"accType\": \"\",\n" +
" \"accTypeName\": \"\",\n" +
" \"cashTfrFlg\": \"现金\",\n" +
" \"chinaDevelopBankNo\": \"\",\n" +
" \"chinaDevelopAccType\": \"\",\n" +
" \"payBillCode\": \"\",\n" +
" \"alipayBaseOrderNumber\": \"\",\n" +
" \"alipayBusinessDescription\": \"\",\n" +
" \"labelValue1\": \"\",\n" +
" \"labelValue2\": \"\",\n" +
" \"labelValue3\": \"\",\n" +
" \"labelValue4\": \"\",\n" +
" \"downloadNo\": \"\",\n" +
" \"sortRule\": \"202405043200000021202405040000647193\",\n" +
" \"orderNo\": \"202405040000647193\",\n" +
" \"alipayTradeName\": \"\",\n" +
" \"matchCode\": \"5317012200005177220240504999999.0012405044020000446120240504\",\n" +
" \"receiptInfo\": \"\",\n" +
" \"billNum\": \"\",\n" +
" \"recTime\": \"2024-05-04 09:48:47\"\n" +
" }]\n" +
" }\n" +
"}";
AccTrxResponse accTrxResponse = AccTrxResponse.valueOf(str);
System.out.println("1111");
}
/**
* 宁波银行交易明细
*/
@Test
public void queryAccDetail(){
JSONObject jsonObject = new JSONObject();
JSONObject data = new JSONObject();
data.put("custId", "0000070401");//客户号
List<String> strs = (List<String>) Convert.toList("123456");
JSONArray jsonArray = new JSONArray();
for(String str :strs){
str = StringUtils.deleteWhitespace(str);
jsonArray.add(str);
}
data.put("bankAccList", jsonArray);
data.put("beginDate", DateUtil.today());//开始日期
data.put("endDate", DateUtil.today());//结束日期
data.put("pageSize", "1000");//每页条数
data.put("currentPage", 1);//当前页数
data.put("queryType", "0");//查询方式0-分页查询
data.put("cdSign","0");//收支方向0收入1支出
jsonObject.put("Data", data);
String param = jsonObject.toString();
System.out.println(param);
try {
//String res = OpenSDK.send(productID, serviceID, jsonObject.toJSONString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
//
// //产品号
// private static String productID = "tmsReport";
// //服务号
// private static String serviceID = "queryAccDetail";
//
// @Test
// public void trxParseTest(){
// String str = "{\n" +
// " \"Data\": {\n" +
// " \"retCode\": \"0000\",\n" +
// " \"retMsg\": \"查询成功\",\n" +
// " \"pageSize\": \"50\",\n" +
// " \"currentPage\": \"1\",\n" +
// " \"totalPage\": \"1\",\n" +
// " \"totalSize\": \"4\",\n" +
// " \"list\": [{\n" +
// " \"bankAcc\": \"53170122000051772\",\n" +
// " \"bankSubAcc\": \"\",\n" +
// " \"accName\": \"宁波富市智梵织焦投资有限公司\",\n" +
// " \"bankName\": \"宁波银行股份有限公司江北支行\",\n" +
// " \"oppAccNo\": \"\",\n" +
// " \"oppAccBank\": \"\",\n" +
// " \"cdSign\": \"0\",\n" +
// " \"cdSignName\": \"\",\n" +
// " \"amt\": \"999999.00\",\n" +
// " \"bal\": \"51643875.40\",\n" +
// " \"transTime\": \"2024-05-04 09:13:18\",\n" +
// " \"subSerialNo\": \"3200000021\",\n" +
// " \"serialNo\": \"\",\n" +
// " \"curCode\": \"01\",\n" +
// " \"uses\": \"\",\n" +
// " \"abs\": \"现金存入\",\n" +
// " \"voucherNo\": \"12405044020000446120240504\",\n" +
// " \"bifCode\": \"9038\",\n" +
// " \"bankType\": \"宁波银行\",\n" +
// " \"oppBankType\": \"\",\n" +
// " \"isForIndividual\": \"0\",\n" +
// " \"serialId\": \"445439D1462C3600F9235B9C2BEF48E6\",\n" +
// " \"bankSerialId\": \"124050440200004461\",\n" +
// " \"groupTrans\": \"\",\n" +
// " \"capitalTrans\": \"\",\n" +
// " \"postScript\": \"\",\n" +
// " \"accType\": \"\",\n" +
// " \"accTypeName\": \"\",\n" +
// " \"cashTfrFlg\": \"现金\",\n" +
// " \"chinaDevelopBankNo\": \"\",\n" +
// " \"chinaDevelopAccType\": \"\",\n" +
// " \"payBillCode\": \"\",\n" +
// " \"alipayBaseOrderNumber\": \"\",\n" +
// " \"alipayBusinessDescription\": \"\",\n" +
// " \"labelValue1\": \"\",\n" +
// " \"labelValue2\": \"\",\n" +
// " \"labelValue3\": \"\",\n" +
// " \"labelValue4\": \"\",\n" +
// " \"downloadNo\": \"\",\n" +
// " \"sortRule\": \"202405043200000021202405040000647193\",\n" +
// " \"orderNo\": \"202405040000647193\",\n" +
// " \"alipayTradeName\": \"\",\n" +
// " \"matchCode\": \"5317012200005177220240504999999.0012405044020000446120240504\",\n" +
// " \"receiptInfo\": \"\",\n" +
// " \"billNum\": \"\",\n" +
// " \"recTime\": \"2024-05-04 09:48:47\"\n" +
// " }]\n" +
// " }\n" +
// "}";
// AccTrxResponse accTrxResponse = AccTrxResponse.valueOf(str);
// System.out.println("1111");
// }
// /**
// * 宁波银行交易明细
// */
// @Test
// public void queryAccDetail(){
// JSONObject jsonObject = new JSONObject();
// JSONObject data = new JSONObject();
// data.put("custId", "0000070401");//客户号
// List<String> strs = (List<String>) Convert.toList("123456");
// JSONArray jsonArray = new JSONArray();
// for(String str :strs){
// str = StringUtils.deleteWhitespace(str);
// jsonArray.add(str);
// }
// data.put("bankAccList", jsonArray);
// data.put("beginDate", DateUtil.today());//开始日期
// data.put("endDate", DateUtil.today());//结束日期
// data.put("pageSize", "1000");//每页条数
// data.put("currentPage", 1);//当前页数
// data.put("queryType", "0");//查询方式0-分页查询
// data.put("cdSign","0");//收支方向0收入1支出
// jsonObject.put("Data", data);
// String param = jsonObject.toString();
// System.out.println(param);
// try {
// //String res = OpenSDK.send(productID, serviceID, jsonObject.toJSONString());
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
}