From a3da542b5683c924679cf60d6e9818554e143063 Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Wed, 4 Sep 2024 16:16:35 +0800 Subject: [PATCH] =?UTF-8?q?u8c=E5=B0=81=E8=A3=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Encapsulation/dao/IEncapsulationDao.java | 19 + .../dao/impl/EncapsulationDaoImpl.java | 32 + .../entity/EncapsulationEntity.java | 33 + .../entity/EncapsulationEntity.xml | 16 + .../service/IEncapsulationService.java | 95 +++ .../service/impl/EncapsulationImpl.java | 587 ++++++++++++++++++ 6 files changed, 782 insertions(+) create mode 100644 service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/IEncapsulationDao.java create mode 100644 service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/impl/EncapsulationDaoImpl.java create mode 100644 service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.java create mode 100644 service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.xml create mode 100644 service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/IEncapsulationService.java create mode 100644 service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/impl/EncapsulationImpl.java diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/IEncapsulationDao.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/IEncapsulationDao.java new file mode 100644 index 00000000..77f0a933 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/IEncapsulationDao.java @@ -0,0 +1,19 @@ +package com.hzya.frame.u8c.Encapsulation.dao; + + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8c.Encapsulation.entity.EncapsulationEntity; + +import java.util.List; + +/** + * (bd_corp: table)表数据库访问层 + * + * @author makejava + * @since 2023-09-06 14:47:17 + */ +public interface IEncapsulationDao extends IBaseDao { + + List queryCgrkddh(EncapsulationEntity encapsulationEntity); +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/impl/EncapsulationDaoImpl.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/impl/EncapsulationDaoImpl.java new file mode 100644 index 00000000..eff12797 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/dao/impl/EncapsulationDaoImpl.java @@ -0,0 +1,32 @@ +package com.hzya.frame.u8c.Encapsulation.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.grpU8.dictAcctSubj.entity.DictAcctSubjEntity; +import com.hzya.frame.grpU8.dictAcctSubj.entity.DictAcctSubjEntityVo; +import com.hzya.frame.u8c.Encapsulation.dao.IEncapsulationDao; +import com.hzya.frame.u8c.Encapsulation.entity.EncapsulationEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +/** + * (BdCorp)表数据库访问层 + * + * @author makejava + * @since 2023-09-06 14:47:17 + */ +@Repository("encapsulationDaoImpl") +public class EncapsulationDaoImpl extends MybatisGenericDao implements IEncapsulationDao { + + @DS("#entity.dataSourceCode") + @Override + public List queryCgrkddh(EncapsulationEntity entity) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryCgrkddh", entity); + return o; + } + + +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.java new file mode 100644 index 00000000..98b01fb5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.java @@ -0,0 +1,33 @@ +package com.hzya.frame.u8c.Encapsulation.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * (BdCorp)实体类 + * + * @author makejava + * @since 2023-09-06 14:47:18 + */ +public class EncapsulationEntity extends BaseEntity { + //单据号 + private String code; + //单据类型 + private String type; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} + diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.xml b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.xml new file mode 100644 index 00000000..f911f81e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/entity/EncapsulationEntity.xml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/IEncapsulationService.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/IEncapsulationService.java new file mode 100644 index 00000000..ab1e0f09 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/IEncapsulationService.java @@ -0,0 +1,95 @@ +package com.hzya.frame.u8c.Encapsulation.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8c.Encapsulation.entity.EncapsulationEntity; + +/** + * (BdCorp)表服务接口 + * + * @author makejava + * @since 2023-09-06 14:47:18 + */ +public interface IEncapsulationService extends IBaseService { + /** + * @Author lvleigang + * @Description 采购订单删除接口 + * 0、根据采购订单号查询入库单号,1、库存采购入库单取消签字,2、库存采购入库单删除,3、采购订单弃审,4、采购订单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object purchaseOrderDelete(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 采购入库单删除接口 + * 1、库存采购入库单取消签字,2、库存采购入库单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object purchaseWarehousingDelete(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 销售订单删除接口 + * 0、根据销售钉订单号查询出销售出库单号,1、库存销售出库单取消签字,2、库存销售出库单删除,3、销售订单取消审批,4、销售订单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object salesOrderDelete(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 调拨订单删除接口 + * 0、根据调拨订单号查询调拨入库,调拨出库单据,1、库存调拨出库取消签字 2、库存调拨出库删除 3、调拨入库取消签字 4、调拨入库删除 5、调拨订单弃审 6、调拨订单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object transferOrderDelete(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 产成品入库删除接口 + * 1、库存产成品入库单取消签字 2、库存产成品入库单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object finishedProductsAreStoredDelete(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 材料出库删除接口 + * 1、库存材料出库取消签字 2、库存材料出库单删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object materialDeliveryDelete(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 其他出库单删除接口 + * 1、库存其他出库取消签字 2、库存其他出库删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object otherWarehouseOrdersDelete(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 其他入库单删除接口 + * 1、库存其他入库单取消签字. 2、库存其他入库删除 + * @Date 9:44 上午 2024/9/4 + * @param jsonObject + * @return java.lang.Object + **/ + Object otherWarehouseReceiptDelete(JSONObject jsonObject); + + +} diff --git a/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/impl/EncapsulationImpl.java b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/impl/EncapsulationImpl.java new file mode 100644 index 00000000..07339ebb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/u8c/Encapsulation/service/impl/EncapsulationImpl.java @@ -0,0 +1,587 @@ +package com.hzya.frame.u8c.Encapsulation.service.impl; + +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.sysnew.application.service.impl.ApplicationCache; +import com.hzya.frame.u8c.Encapsulation.dao.IEncapsulationDao; +import com.hzya.frame.u8c.Encapsulation.entity.EncapsulationEntity; +import com.hzya.frame.u8c.Encapsulation.service.IEncapsulationService; +import com.hzya.frame.web.entity.BaseResult; +import org.apache.http.HttpEntity; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.List; + +/** + * (BdCorp)表服务实现类 + * + * @author makejava + * @since 2023-09-06 14:47:18 + */ +@Service("encapsulationImpl") +public class EncapsulationImpl extends BaseService implements IEncapsulationService { + + private IEncapsulationDao encapsulationDao; + + @Autowired + public void setEncapsulationDao(IEncapsulationDao dao) { + this.encapsulationDao = dao; + this.dao = dao; + } + + @Value("${zt.url}") + private String ztUrl; + private final Object lock = new Object(); + + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 采购订单删除接口 + * 0、根据采购订单号查询入库单号,1、库存采购入库单取消签字,2、库存采购入库单删除,3、采购订单弃审,4、采购订单删除 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object purchaseOrderDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + + //获取单号和时间 + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("CgrkUnapproveApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存采购入库单取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("CgrkDeleteApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存采购入库单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("CgddUnapproveApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购订单弃审接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("CgddDeleteApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购订单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + //根据采购订单号查询入库单号 + EncapsulationEntity encapsulationEntity = new EncapsulationEntity(); + encapsulationEntity.setCode(jsonObject.getString("code")); + encapsulationEntity.setDataSourceCode(jsonObject.getString("dataSourceCode")); + encapsulationEntity.setType("21"); + List encapsulationEntities = encapsulationDao.queryCgrkddh(encapsulationEntity); + if (encapsulationEntities != null && encapsulationEntities.size() == 1) { + String cgrkdqxqz = getsendBody("1", jsonObject, encapsulationEntities.get(0).getCode()); + //执行库存采购入库单取消签字接口 + boolean cgrkdqxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("CgrkUnapproveApi"), jsonObject.getString("CgrkUnapproveApi").substring(6), cgrkdqxqz); + if (cgrkdqxqzflag) { + String cgrkdsc = getsendBody("2", jsonObject, encapsulationEntities.get(0).getCode()); + //执行库存采购入库单删除 + boolean cgrkdscfiag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("CgrkDeleteApi"), jsonObject.getString("CgrkDeleteApi").substring(6), cgrkdsc); + if (cgrkdscfiag) { + String cgddqs = getsendBody("3", jsonObject, null); + //执行采购订单弃审, + boolean cgddqsflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("CgddUnapproveApi"), jsonObject.getString("CgddUnapproveApi").substring(6), cgddqs); + if (cgddqsflag) { + String cgddsc = getsendBody("4", jsonObject, null); + //执行采购订单删除 + boolean cgddscflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("CgddUnapproveApi"), jsonObject.getString("CgddUnapproveApi").substring(6), cgddsc); + if (cgddscflag) { + returnObject.put("status", "success"); + returnObject.put("errormsg", "采购订单删除成功"); + return returnObject; + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购订单删除失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购订单弃审失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购入库单删除失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购入库单取消签字失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "查到多条采购入库单"); + return returnObject; + } + } + + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 采购入库单删除接口 + * 1、库存采购入库单取消签字,2、库存采购入库单删除 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object purchaseWarehousingDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + + //获取单号和时间 + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("CgrkUnapproveApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存采购入库单取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("CgrkDeleteApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存采购入库单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + String cgrkdqxqz = getsendBody("1", jsonObject, jsonObject.getString("code")); + //执行库存采购入库单取消签字接口 + boolean cgrkdqxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("CgrkUnapproveApi"), jsonObject.getString("CgrkUnapproveApi").substring(6), cgrkdqxqz); + if (cgrkdqxqzflag) { + String cgrkdsc = getsendBody("2", jsonObject, jsonObject.getString("code")); + //执行库存采购入库单删除接口 + boolean cgrkdscfiag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("CgrkDeleteApi"), jsonObject.getString("CgrkDeleteApi").substring(6), cgrkdsc); + if (cgrkdscfiag) { + returnObject.put("status", "success"); + returnObject.put("errormsg", "采购入库单删除成功"); + return returnObject; + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购入库单删除失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "采购入库单取消签字失败"); + return returnObject; + } + } + + /** + * @param object + * @return java.lang.Object + * @Author lvleigang + * @Description 销售订单删除接口 + * 0、根据销售钉订单号查询出销售出库单号,1、库存销售出库单取消签字,2、库存销售出库单删除,3、销售订单取消审批,4、销售订单删除 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object salesOrderDelete(JSONObject object) { + JSONObject returnObject = new JSONObject(); + + //获取单号和时间 + JSONObject jsonObject = getData("jsonStr", object, JSONObject.class); + //判断是否存在参数 + if (!checkStr(jsonObject.getString("code"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("corp"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "公司为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_begin"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据开始日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("date_end"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "单据结束日期为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("coperator"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "操作员为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("kcxsckdUnapproveApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存销售出库单取消签字接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("kcxsckDeleteApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存销售出库单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("xsddUnapproveApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "销售订单取消审批接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("xsddDeleteApi"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "销售订单删除接口编号为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("dataSourceCode"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "数据源编码为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("publicKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "publicKey为空"); + return returnObject; + } + if (!checkStr(jsonObject.getString("secretKey"))) { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "secretKey为空"); + return returnObject; + } + //根据销售钉订单号查询出销售出库单号 + EncapsulationEntity encapsulationEntity = new EncapsulationEntity(); + encapsulationEntity.setCode(jsonObject.getString("code")); + encapsulationEntity.setDataSourceCode(jsonObject.getString("dataSourceCode")); + encapsulationEntity.setType("30"); + List encapsulationEntities = encapsulationDao.queryCgrkddh(encapsulationEntity); + if (encapsulationEntities != null && encapsulationEntities.size() == 1) { + String cgrkdqxqz = getsendBody("5", jsonObject, encapsulationEntities.get(0).getCode()); + //库存销售出库单取消签字, + boolean cgrkdqxqzflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("kcxsckdUnapproveApi"), jsonObject.getString("kcxsckdUnapproveApi").substring(6), cgrkdqxqz); + if (cgrkdqxqzflag) { + String cgrkdsc = getsendBody("2", jsonObject, encapsulationEntities.get(0).getCode()); + //库存销售出库单删除 + boolean cgrkdscfiag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("kcxsckDeleteApi"), jsonObject.getString("kcxsckDeleteApi").substring(6), cgrkdsc); + if (cgrkdscfiag) { + String cgddqs = getsendBody("3", jsonObject, null); + //销售订单取消审批,, + boolean cgddqsflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("xsddUnapproveApi"), jsonObject.getString("xsddUnapproveApi").substring(6), cgddqs); + if (cgddqsflag) { + String cgddsc = getsendBody("4", jsonObject, null); + //销售订单删除 + boolean cgddscflag = sendPost(jsonObject.getString("publicKey"), jsonObject.getString("secretKey"), jsonObject.getString("xsddDeleteApi"), jsonObject.getString("xsddDeleteApi").substring(6), cgddsc); + if (cgddscflag) { + returnObject.put("status", "success"); + returnObject.put("errormsg", "销售订单删除成功"); + return returnObject; + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "销售订单删除失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "销售订单取消审批失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存销售出库单删除失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "库存销售出库单取消签字失败"); + return returnObject; + } + } else { + returnObject.put("status", "falied"); + returnObject.put("errormsg", "查到多条销售出库单"); + return returnObject; + } + } + + /** + * @param jsonObject + * @return java.lang.Object + * @Author lvleigang + * @Description 调拨订单删除接口 + * 0、根据调拨订单号查询调拨入库,调拨出库单据,1、库存调拨出库取消签字 2、库存调拨出库删除 3、调拨入库取消签字 4、调拨入库删除 5、调拨订单弃审 6、调拨订单删除 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object transferOrderDelete(JSONObject jsonObject) { + return null; + } + + /** + * @param jsonObject + * @return java.lang.Object + * @Author lvleigang + * @Description 产成品入库删除接口 + * 1、库存产成品入库单取消签字 2、库存产成品入库单删除 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object finishedProductsAreStoredDelete(JSONObject jsonObject) { + return null; + } + + /** + * @param jsonObject + * @return java.lang.Object + * @Author lvleigang + * @Description 材料出库删除接口 + * 1、库存材料出库取消签字 2、库存材料出库单删除 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object materialDeliveryDelete(JSONObject jsonObject) { + return null; + } + + /** + * @param jsonObject + * @return java.lang.Object + * @Author lvleigang + * @Description 其他出库单删除接口 + * 1、库存其他出库取消签字 2、库存其他出库删除 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object otherWarehouseOrdersDelete(JSONObject jsonObject) { + return null; + } + + /** + * @param jsonObject + * @return java.lang.Object + * @Author lvleigang + * @Description 其他入库单删除接口 + * 1、库存其他入库单取消签字. 2、库存其他入库删除 + * @Date 9:44 上午 2024/9/4 + **/ + @Override + public Object otherWarehouseReceiptDelete(JSONObject jsonObject) { + return null; + } + + + //拼装数据 + private String getsendBody(String type, JSONObject object, String code) { + JSONObject jsonObject1 = new JSONObject(); + + switch (type) { + case "1": //库存采购入库单取消签字 + JSONObject unsignInfo = new JSONObject(); + unsignInfo.put("coperator", object.getString("coperator")); + JSONObject queryInfo = new JSONObject(); + queryInfo.put("date_end", object.getString("date_end")); + queryInfo.put("date_begin", object.getString("date_begin")); + queryInfo.put("corp", object.getString("corp")); + queryInfo.put("billcode", code); + jsonObject1.put("unsignInfo", unsignInfo); + jsonObject1.put("queryInfo", queryInfo); + break; + case "2": //库存采购入库单删除 + JSONObject unsignInfo2 = new JSONObject(); + unsignInfo2.put("coperator", object.getString("coperator")); + JSONObject queryInfo2 = new JSONObject(); + queryInfo2.put("date_end", object.getString("date_end")); + queryInfo2.put("date_begin", object.getString("date_begin")); + queryInfo2.put("corp", object.getString("corp")); + queryInfo2.put("billcode", code); + jsonObject1.put("deleteInfo", unsignInfo2); + jsonObject1.put("queryInfo", queryInfo2); + break; + case "3": //采购订单弃审 + JSONObject unsignInfo3 = new JSONObject(); + unsignInfo3.put("approvid", object.getString("coperator")); + JSONObject queryInfo3 = new JSONObject(); + queryInfo3.put("date_end", object.getString("date_end")); + queryInfo3.put("date_begin", object.getString("date_begin")); + queryInfo3.put("corp", object.getString("corp")); + queryInfo3.put("code", object.getString("code")); + jsonObject1.put("approveinfo", unsignInfo3); + jsonObject1.put("queryinfo", queryInfo3); + break; + case "4": //采购订单删除 + JSONObject unsignInfo4 = new JSONObject(); + unsignInfo4.put("coperator", object.getString("coperator")); + JSONObject queryInfo4 = new JSONObject(); + queryInfo4.put("date_end", object.getString("date_end")); + queryInfo4.put("date_begin", object.getString("date_begin")); + queryInfo4.put("corp", object.getString("corp")); + queryInfo4.put("code", object.getString("code")); + jsonObject1.put("deleteinfo", unsignInfo4); + jsonObject1.put("queryinfo", queryInfo4); + break; + default: + } + return jsonObject1.toJSONString(); + } + + /** + * @param publicKey + * @param secretKey + * @param apiCode + * @param appId + * @param bodys + * @return java.lang.String + * @Author lvleigang + * @Description 发送接口 + * @Date 3:05 下午 2024/9/4 + **/ + private boolean sendPost(String publicKey, String secretKey, String apiCode, String appId, String bodys) { + StringBuilder returnBody = new StringBuilder(); + Integer outTime = 6000; + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpPost post = new HttpPost(ztUrl); + CloseableHttpResponse response = null; + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build(); + post.setConfig(requestConfig);//设置请求参数【超时时间】 + post.setHeader("publicKey", publicKey); + post.setHeader("secretKey", secretKey); + post.setHeader("apiCode", apiCode); + post.setHeader("appId", appId); + + try { + if (bodys != null && !"".equals(bodys)) { + ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8")); + entity.setContentType("application/json"); + post.setEntity(entity); + } + response = closeableHttpClient.execute(post); + + HttpEntity entity = response.getEntity(); + synchronized (lock) { + returnBody.append(EntityUtils.toString(entity, "UTF-8")); + } + logger.info("返回结果:" + returnBody); + } catch (Exception e) { + logger.error("请求错误:" + e.getMessage()); + returnBody.append(e.getMessage()); + } finally { + try { + // 关闭响应对象 + if (response != null) { + response.close(); + } + // 关闭响应对象 + if (closeableHttpClient != null) { + closeableHttpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + + if (returnBody != null && !"".equals(returnBody)) { + if (JSONUtil.isTypeJSON(returnBody.toString())) { + JSONObject jsonObject1 = JSONObject.parseObject(returnBody.toString()); + if (jsonObject1.getString("status") != null && "200".equals(jsonObject1.getString("status"))) { + return true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + + +}