会稽山对接CRM代码

This commit is contained in:
yuqh 2024-11-25 11:35:18 +08:00
parent b7916bbfb4
commit 4836f217a2
48 changed files with 1147 additions and 372 deletions

View File

@ -35,7 +35,7 @@ public class AccLogPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(getClass()); Logger logger = LoggerFactory.getLogger(getClass());
@Autowired @Autowired
private INingboBankPluginService ningboBankPluginService; private INingboBankPluginService ningboBankPluginService;
@Value("${OA.data_source_code}") @Value("${OA.data_source_code:}")
private String oa_data_source_code; private String oa_data_source_code;
@Autowired @Autowired
private IPayBillPluginInitializerDao payBillDao; private IPayBillPluginInitializerDao payBillDao;

View File

@ -27,7 +27,7 @@ import java.util.Map;
**/ **/
public class NingboBankPayResultPluginInitializer extends PluginBaseEntity { public class NingboBankPayResultPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(getClass()); Logger logger = LoggerFactory.getLogger(getClass());
@Value("${OA.data_source_code}") @Value("${OA.data_source_code:}")
private String oa_data_source_code; private String oa_data_source_code;
@Autowired @Autowired
private IPayBillPluginInitializerDao payBillDao; private IPayBillPluginInitializerDao payBillDao;

View File

@ -34,7 +34,7 @@ public class NingboBankTTPayPluginInitializer extends PluginBaseEntity {
private IIntegrationTaskLivingDetailsService taskLivingDetailsService; private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Autowired @Autowired
private IPayBillPluginInitializerDao payBillDao; private IPayBillPluginInitializerDao payBillDao;
@Value("${OA.data_source_code}") @Value("${OA.data_source_code:}")
private String oa_data_source_code; private String oa_data_source_code;

View File

@ -30,7 +30,7 @@ public class NingboBankTTPayResultPluginInitializer extends PluginBaseEntity {
private IIntegrationTaskLivingDetailsService taskLivingDetailsService; private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Autowired @Autowired
private IPayBillPluginInitializerDao payBillDao; private IPayBillPluginInitializerDao payBillDao;
@Value("${OA.data_source_code}") @Value("${OA.data_source_code:}")
private String oa_data_source_code; private String oa_data_source_code;

View File

@ -34,7 +34,7 @@ public class PayReqSyncU8CPluginInitializer extends PluginBaseEntity {
private IIntegrationTaskLivingDetailsService taskLivingDetailsService; private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Autowired @Autowired
private IPayBillPluginInitializerDao payBillDao; private IPayBillPluginInitializerDao payBillDao;
@Value("${OA.data_source_code}") @Value("${OA.data_source_code:}")
private String oa_data_source_code; private String oa_data_source_code;
/*** /***

View File

@ -55,7 +55,7 @@ private IFormmain0044Service formmain0044Service;
private RestUtil restUtil; private RestUtil restUtil;
@Autowired @Autowired
private INingboBankTreasuryService ningboBankTreasuryService; private INingboBankTreasuryService ningboBankTreasuryService;
@Value("${OA.data_source_code}") @Value("${OA.data_source_code:}")
private String oa_data_source_code; private String oa_data_source_code;

View File

@ -0,0 +1,106 @@
package com.hzya.frame.plugin.kjs.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.u8.otherreceipt.service.IOtherReceiptService;
import com.hzya.frame.u8.receipt.service.IReceiptService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 8:46
*
*/
public class OtherReceiptPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private IOtherReceiptService otherReceiptService;
/***
* 插件初始化方法
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 10:48
* @Param []
* @return void
**/
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
/****
* 插件销毁方法
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
/****
* 插件的ID
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginId() {
return "OtherReceiptPluginInitializer";
}
/****
* 插件的名称
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginName() {
return "其他应收单同步CRM插件";
}
/****
* 插件的显示值
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginLabel() {
return "其他应收单同步CRM插件";
}
/***
* 插件类型 1场景插件
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 14:01
* @Param []
* @return java.lang.String
**/
@Override
public String getPluginType() {
return "1";
}
/***
* 执行业务代码
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-07 11:20
* @param requestJson 执行业务代码的参数
* @return void
**/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
otherReceiptService.getU8otherReceiptToCrm(requestJson);
return BaseResult.getSuccessMessageEntity("操作成功");
}
}

View File

@ -23,7 +23,7 @@ public class SalesBillingServiceImpl implements ISalesBillingService {
Logger logger = LoggerFactory.getLogger(SalesBillingServiceImpl.class); Logger logger = LoggerFactory.getLogger(SalesBillingServiceImpl.class);
@Value("${OA.data_source_code}") @Value("${OA.data_source_code:}")
private String oa_data_source_code; private String oa_data_source_code;
@Autowired @Autowired
private IU8cSalesBillingService iu8cSalesBillingService; private IU8cSalesBillingService iu8cSalesBillingService;

View File

@ -9,4 +9,6 @@
<bean name="ReceiptPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.ReceiptPluginInitializer" /> <bean name="ReceiptPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.ReceiptPluginInitializer" />
<bean name="SaleInvPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.SaleInvPluginInitializer" /> <bean name="SaleInvPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.SaleInvPluginInitializer" />
<bean name="OtherInPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.OtherInPluginInitializer" /> <bean name="OtherInPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.OtherInPluginInitializer" />
<bean name="OtherReceiptPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.OtherReceiptPluginInitializer" />
<bean name="OtherOutPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.OtherOutPluginInitializer" />
</beans> </beans>

View File

@ -27,13 +27,13 @@ public class CrmUtil {
public static String sendU8TOCrmEsb(String parm, String apiCode){ public static String sendU8TOCrmEsb(String parm, String apiCode){
String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface"; String baseUrl = "http://127.0.0.1:9991/kangarooDataCenterV3/entranceController/externalCallInterface";
System.out.println("推送参数"+parm); System.out.println("推送参数"+parm);
String result = HttpRequest.post(baseUrl) String result = HttpRequest.post(baseUrl)
.header("appId", "800023")//头信息多个头信息多次调用此方法即可 .header("appId", "800007")//头信息多个头信息多次调用此方法即可
.header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可 .header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可 .header("publicKey", "ZJYA+1JrrKQGBuWV9n1uUejlZnxUAH0fPDywF/1U0SD3BZ1Ce7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可 .header("secretKey", "u2T1Dt5DtiXJcXZx4Y9ARQifbnEbNGorDvUGoDbV9jWsBl8lZT2+mcoQE4q097JQj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容 .body(parm)//表单内容
.timeout(20000)//超时毫秒 .timeout(20000)//超时毫秒
.execute().body(); .execute().body();

View File

@ -670,9 +670,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
} }
//递归删除树结构 1. 2.列表 //递归删除树结构 1. 2.列表
if(map.get("viewName").equals("1")){ // if(map.get("viewName").equals("1")){
return recursiveDeleteComparison(comparisonEntitiePages,comparisonEntity); // return recursiveDeleteComparison(comparisonEntitiePages,comparisonEntity);
} // }
String id = String.valueOf(comparisonEntitiePages.get(0).get("id")); String id = String.valueOf(comparisonEntitiePages.get(0).get("id"));

View File

@ -9,4 +9,14 @@ import com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity;
* @Date 2024/8/22 15:07 * @Date 2024/8/22 15:07
**/ **/
public interface IDeliveryOrderDao extends IBaseDao<DeliveryOrderEntity,String> { public interface IDeliveryOrderDao extends IBaseDao<DeliveryOrderEntity,String> {
/**
*
* @content 修改发货单状态
* @className: Administrator
* @author laborer
* @date 2024-11-18 19:48
*
*/
int updateDeliveryState( DeliveryOrderEntity entity);
} }

View File

@ -1,5 +1,6 @@
package com.hzya.frame.u8.delivery.dao.impl; package com.hzya.frame.u8.delivery.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao; import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.u8.delivery.dao.IDeliveryOrderDao; import com.hzya.frame.u8.delivery.dao.IDeliveryOrderDao;
import com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity; import com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity;
@ -12,4 +13,9 @@ import org.springframework.stereotype.Repository;
**/ **/
@Repository @Repository
public class DeliveryOrderDaoImpl extends MybatisGenericDao<DeliveryOrderEntity,String> implements IDeliveryOrderDao { public class DeliveryOrderDaoImpl extends MybatisGenericDao<DeliveryOrderEntity,String> implements IDeliveryOrderDao {
@Override
@DS("#entity.dataSourceCode")
public int updateDeliveryState( DeliveryOrderEntity entity) {
return super.update("com.hzya.frame.u8.delivery.dao.impl.DeliveryOrderDaoImpl.entity_update",entity);
}
} }

View File

@ -71,12 +71,10 @@
<!--通过主键修改方法--> <!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity"> <update id="entity_update" parameterType="com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity">
-- update ${AccCode}.dbo.DispatchList_extradefine set chdefine19 = #{frozen} UPDATE ${AccId}.dbo.DispatchList_extradefine
set chdefine19 = #{frozen}
UPDATE ${AccCode}.dbo.DispatchList_extradefine FROM ${AccId}.dbo.DispatchList_extradefine
set chdefine14 = #{frozen} JOIN ${AccId}.dbo.DispatchList ON DispatchList.dlid = DispatchList_extradefine.dlid
FROM DispatchList_extradefine
JOIN ${AccCode}.dbo.DispatchList c ON DispatchList.id = DispatchList_extradefine.id
where cdlcode = #{cdlcode} where cdlcode = #{cdlcode}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.u8.delivery.service; package com.hzya.frame.u8.delivery.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService; import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity; import com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
@ -24,5 +25,5 @@ public interface IDeliveryOrderService extends IBaseService<DeliveryOrderEntity,
* *
*/ */
JsonResultEntity editDelivery(String parm); JsonResultEntity editDelivery(JSONObject parm);
} }

View File

@ -42,11 +42,16 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
} }
@Override @Override
public JsonResultEntity editDelivery(String parm) { public JsonResultEntity editDelivery(JSONObject parm) {
JSONObject jsonObject = JSONObject.parseObject(parm); JSONObject jsonObject = parm.getJSONObject("jsonStr");
logger.info("接收到的参数"+jsonObject.toString());
// JSONObject jsonObject = JSONObject.parseObject(json);
String cdlcode = jsonObject.getString("cdlCode"); String cdlcode = jsonObject.getString("cdlCode");
logger.info("发货单号"+cdlcode);
String AccId = jsonObject.getString("AccId"); String AccId = jsonObject.getString("AccId");
logger.info("账套号"+AccId);
String frozen = jsonObject.getString("frozen"); String frozen = jsonObject.getString("frozen");
logger.info("状态"+frozen);
switch (AccId){ switch (AccId){
case "001": case "001":
AccId = "UFDATA_001_2023"; AccId = "UFDATA_001_2023";
@ -60,28 +65,27 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
case "005": case "005":
AccId = "UFDATA_005_2023"; AccId = "UFDATA_005_2023";
break; break;
case "021": case "201":
AccId = "UFDATA_201_2023"; AccId = "UFDATA_201_2023";
break; break;
default: default:
return BaseResult.getFailureMessageEntity("清传入正确的账套号"); return BaseResult.getFailureMessageEntity("清传入正确的账套号");
} }
if("frozen".equals("Y")||"frozen".equals("N")){
if(StrUtil.isEmpty(cdlcode)){
return BaseResult.getFailureMessageEntity("发货单号不能为空"); if(StrUtil.isEmpty(cdlcode)){
} return BaseResult.getFailureMessageEntity("发货单号不能为空");
if(StrUtil.isEmpty(AccId)){
return BaseResult.getFailureMessageEntity("账套号不能为空");
}
DeliveryOrderEntity entity = new DeliveryOrderEntity();
entity.setAccId(AccId);
entity.setCdlcode(cdlcode);
entity.setFrozen(frozen);
deliveryOrderDao.update("com.hzya.frame.u8.delivery.dao.impl.DeliveryOrderDaoImpl.entity_update",entity);
return BaseResult.getSuccessMessageEntity("更新成功");
}else{
return BaseResult.getFailureMessageEntity("清传入正确的状态Y=冻结 N=解冻");
} }
if(StrUtil.isEmpty(AccId)){
return BaseResult.getFailureMessageEntity("账套号不能为空");
}
DeliveryOrderEntity entity = new DeliveryOrderEntity();
entity.setAccId(AccId);
entity.setCdlcode(cdlcode);
entity.setFrozen(frozen);
entity.setDataSourceCode("YONYOUU8");
deliveryOrderDao.updateDeliveryState(entity);
return BaseResult.getSuccessMessageEntity("更新成功");
} }
} }

View File

@ -25,6 +25,15 @@ private String id;//
private String state;// private String state;//
private String AccCode;// private String AccCode;//
private String ids;// private String ids;//
private String syncFlag;//标识
public String getSyncFlag() {
return syncFlag;
}
public void setSyncFlag(String syncFlag) {
this.syncFlag = syncFlag;
}
public String getIds() { public String getIds() {
return ids; return ids;

View File

@ -11,6 +11,7 @@
<result property="AccCode" column="AccCode" /> <result property="AccCode" column="AccCode" />
<result property="id" column="id" /> <result property="id" column="id" />
<result property="ids" column="ids" /> <result property="ids" column="ids" />
<result property="syncFlag" column="sync_flag" />
</resultMap> </resultMap>
<sql id="OtherInEntity_Base_Column_List"> <sql id="OtherInEntity_Base_Column_List">
@ -30,7 +31,8 @@
cwhcode, cwhcode,
cmaker, cmaker,
ccuscode, ccuscode,
cHandler cHandler,
sync_flag
from UFDATA_001_2023.dbo.RdRecord08 from UFDATA_001_2023.dbo.RdRecord08
union all union all
@ -46,7 +48,8 @@
cwhcode, cwhcode,
cmaker, cmaker,
ccuscode, ccuscode,
cHandler cHandler,
sync_flag
from UFDATA_002_2024.dbo.RdRecord08 from UFDATA_002_2024.dbo.RdRecord08
union all union all
@ -61,7 +64,8 @@
cwhcode, cwhcode,
cmaker, cmaker,
ccuscode, ccuscode,
cHandler cHandler,
sync_flag
from UFDATA_004_2024.dbo.RdRecord08 from UFDATA_004_2024.dbo.RdRecord08
union all union all
@ -76,7 +80,8 @@
cwhcode, cwhcode,
cmaker, cmaker,
ccuscode, ccuscode,
cHandler cHandler,
sync_flag
from UFDATA_005_2024.dbo.RdRecord08 from UFDATA_005_2024.dbo.RdRecord08
union all union all
@ -91,16 +96,17 @@
cwhcode, cwhcode,
cmaker, cmaker,
ccuscode, ccuscode,
cHandler cHandler,
sync_flag
from UFDATA_201_2023.dbo.RdRecord08 from UFDATA_201_2023.dbo.RdRecord08
)m1 where cHandler is not null )m1 where cHandler is not null and sync_flag is null and AccId = '201'
<if test="ids != null and ids != ''">and ids = #{ids} </if> <if test="ids != null and ids != ''">and ids = #{ids} </if>
</select> </select>
<!--通过主键修改方法--> <!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.u8.otherin.entity.OtherInEntity"> <update id="entity_update" parameterType="com.hzya.frame.u8.otherin.entity.OtherInEntity">
update #{AccCode}.dbo.RdRecord08 set sync_flag = #{state} update ${AccCode}.dbo.RdRecord08 set sync_flag = #{state}
where id = #{id} where id = #{id}
</update> </update>
</mapper> </mapper>

View File

@ -102,10 +102,10 @@ public class OtherInServiceImpl extends BaseService<OtherInEntity,String> implem
logDetails.setNewTransmitInfo(result); logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date()); logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(sale)); logDetails.setRootAppNewData(JSON.toJSONString(sale));
logDetails.setPluginId("SaleConPlugin"); logDetails.setPluginId("OtherInPluginInitializer");
JSONObject resultObj = JSON.parseObject(result); JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getString("code").equals("0"); boolean flag = resultObj.getString("code").equals("200");
if(flag){ if(flag){
// 推送成功更新状态 // 推送成功更新状态
sale.setState("Y"); sale.setState("Y");

View File

@ -12,51 +12,7 @@
</sql> </sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherout.entity.OtherOutDetailEntity"> <select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherout.entity.OtherOutDetailEntity">
select * from ( select * from kjs_external.dbo.v_hzya_otherout_details
select
'201' as AccId,
'UFDATA_201_2023' as AccCode,
body.cinvcode,
body.iquantity
from UFDATA_201_2023.dbo.RdRecords09 body
left join UFDATA_201_2023.dbo.TransVouchs on body.iTrIds = TransVouchs.autoID
UNION ALL
select
'002' as AccId,
'UFDATA_002_2024' as AccCode,
body.cinvcode,
body.iquantity
from UFDATA_002_2024.dbo.RdRecords09 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
from UFDATA_004_2024.dbo.RdRecords09 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
from UFDATA_005_2024.dbo.RdRecords09 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
from UFDATA_201_2023.dbo.RdRecords09 body
left join UFDATA_201_2023.dbo.TransVouchs on body.iTrIds = TransVouchs.autoID
)m1
where id = #{id} and AccId = #{AccId} where id = #{id} and AccId = #{AccId}
</select>
</mapper> </mapper>

View File

@ -25,7 +25,15 @@ public class OtherOutEntity extends BaseEntity {
private List<OtherOutDetailEntity>otherOutDetailEntityList; private List<OtherOutDetailEntity>otherOutDetailEntityList;
private String AccCode;//账套编码 private String AccCode;//账套编码
private String ids;// private String ids;//
private String syncFlag;//标识
public String getSyncFlag() {
return syncFlag;
}
public void setSyncFlag(String syncFlag) {
this.syncFlag = syncFlag;
}
public String getIds() { public String getIds() {
return ids; return ids;
} }

View File

@ -11,92 +11,19 @@
<result property="AccCode" column="AccCode" /> <result property="AccCode" column="AccCode" />
<result property="id" column="id" /> <result property="id" column="id" />
<result property="ids" column="ids" /> <result property="ids" column="ids" />
<result property="syncFlag" column="sync_flag" />
</resultMap> </resultMap>
<sql id="OtherOutEntity_Base_Column_List"> <sql id="OtherOutEntity_Base_Column_List">
</sql> </sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherout.entity.OtherOutEntity"> <select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherout.entity.OtherOutEntity">
select * from ( select * from kjs_external.dbo.v_hzya_otherout
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
from UFDATA_001_2023.dbo.RdRecord09
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
from UFDATA_002_2024.dbo.RdRecord09
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
from UFDATA_004_2024.dbo.RdRecord09
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
from UFDATA_005_2024.dbo.RdRecord09
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
from UFDATA_201_2023.dbo.RdRecord09
)m1 where cHandler is not null
<if test="ids != null and ids != ''">and ids = #{ids} </if> <if test="ids != null and ids != ''">and ids = #{ids} </if>
</select> </select>
<!--通过主键修改方法--> <!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.u8.otherout.entity.OtherOutEntity"> <update id="entity_update" parameterType="com.hzya.frame.u8.otherout.entity.OtherOutEntity">
update RdRecord09 set sync_flag = #{state} update ${AccCode}.dbo.RdRecord09 set sync_flag = #{state}
where id = #{id} where id = #{id}
</update> </update>
</mapper> </mapper>

View File

@ -48,8 +48,8 @@ public class OtherOutServiceImpl extends BaseService<OtherOutEntity,String> impl
//获取重推信息id并记录日志 //获取重推信息id并记录日志
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class); JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
String interId = requestJsonObj.getString("integration_task_living_details_id"); String interId = requestJsonObj.getString("integration_task_living_details_id");
logger.info("U8销售出库单重推解析后:"+requestJsonObj.toString()); logger.info("U8其他出库单重推解析后:"+requestJsonObj.toString());
logger.info("U8销售出库单推送CRM重新执行的任务主键"+interId); logger.info("U8其他出库单推送CRM重新执行的任务主键"+interId);
//更换数据源 //更换数据源
JsonResultEntity resultEntity = new JsonResultEntity(); JsonResultEntity resultEntity = new JsonResultEntity();
@ -67,7 +67,7 @@ public class OtherOutServiceImpl extends BaseService<OtherOutEntity,String> impl
StrUtil.isEmpty(rootAppPk); StrUtil.isEmpty(rootAppPk);
//如果是重推是否通过entity传入的id只能查到一条数据 //如果是重推是否通过entity传入的id只能查到一条数据
List<OtherOutEntity> soleList = otherOutDao.getU8SaleOut(entity); List<OtherOutEntity> soleList = otherOutDao.getU8SaleOut(entity);
logger.info("销售出库查询数据{}",JSONObject.toJSONString(soleList)); logger.info("其他出库查询数据{}",JSONObject.toJSONString(soleList));
if(CollectionUtils.isNotEmpty(soleList)){ if(CollectionUtils.isNotEmpty(soleList)){
soleList.forEach(sale -> { soleList.forEach(sale -> {
try{ try{
@ -76,26 +76,26 @@ public class OtherOutServiceImpl extends BaseService<OtherOutEntity,String> impl
if(!StrUtil.isEmpty(id)){ if(!StrUtil.isEmpty(id)){
OtherOutDetailEntity line = new OtherOutDetailEntity(); OtherOutDetailEntity line = new OtherOutDetailEntity();
line.setId(id); line.setId(id);
line.setAccId(id); line.setAccId(sale.getAccId());
line.setDataSourceCode(requestJson.getString("db_code")); line.setDataSourceCode(requestJson.getString("db_code"));
List<OtherOutDetailEntity> lineList = otherOutDetailDao.getU8otherOutLine(line); List<OtherOutDetailEntity> lineList = otherOutDetailDao.getU8otherOutLine(line);
logger.info("销售出库单明细查询数据{}",JSONObject.toJSONString(lineList)); logger.info("其他出库单明细查询数据{}",JSONObject.toJSONString(lineList));
sale.setOtherOutDetailEntityList(lineList); sale.setOtherOutDetailEntityList(lineList);
logger.info("组装数据"); logger.info("组装数据");
JSONObject main = bindingAdd(sale); JSONObject main = bindingAdd(sale);
logger.info("销售出库推送数据:"+main.toString()); logger.info("其他出库推送数据:"+main.toString());
String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000070011");
logger.info("销售出库推送结果:"+result); logger.info("其他出库推送结果:"+result);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(sale.getIds()); logDetails.setRootAppPk(sale.getIds());
logDetails.setRootAppBill(sale.getCcode()); logDetails.setRootAppBill(sale.getCcode());
logDetails.setNewTransmitInfo(result); logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date()); logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(sale)); logDetails.setRootAppNewData(JSON.toJSONString(sale));
logDetails.setPluginId("SaleConPlugin"); logDetails.setPluginId("OtherOutPluginInitializer");
JSONObject resultObj = JSON.parseObject(result); JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getString("code").equals("0"); boolean flag = resultObj.getString("code").equals("200");
if(flag){ if(flag){
logDetails.setNewTransmitInfo("推送成功"); logDetails.setNewTransmitInfo("推送成功");
// 推送成功更新状态 // 推送成功更新状态
@ -115,7 +115,7 @@ public class OtherOutServiceImpl extends BaseService<OtherOutEntity,String> impl
otherOutDao.updateState(sale); otherOutDao.updateState(sale);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("销售出库执行失败"+e.getMessage()); logger.error("其他出库执行失败"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
}); });

View File

@ -0,0 +1,37 @@
package com.hzya.frame.u8.otherreceipt.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity;
import java.util.List;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
public interface IOtherReceiptDao extends IBaseDao<OtherReceiptEntity,String> {
/**
*
* @content 获取U8销售发票信息
* @className: Administrator
* @author laborer
* @date 2024-10-18 14:22
*
*/
List<OtherReceiptEntity> getU8OtherReceipt(OtherReceiptEntity entity);
/**
*
* @content 修改推送状态
* @className: Administrator
* @author laborer
* @date 2024-10-18 14:43
*
*/
int updateState(OtherReceiptEntity entity);
}

View File

@ -0,0 +1,27 @@
package com.hzya.frame.u8.otherreceipt.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity;
import java.util.List;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
public interface IOtherReceiptDetailDao extends IBaseDao<OtherReceiptDetailEntity,String> {
/**
*
* @content 获取U8销售发票明细数据
* @className: Administrator
* @author laborer
* @date 2024-10-18 14:37
*
*/
List<OtherReceiptDetailEntity> getU8OtherReceipt(OtherReceiptDetailEntity line);
}

View File

@ -0,0 +1,32 @@
package com.hzya.frame.u8.otherreceipt.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.u8.otherreceipt.dao.IOtherReceiptDao;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
@Repository(value = "OtherReceiptDaoImpl")
public class OtherReceiptDaoImpl extends MybatisGenericDao<OtherReceiptEntity,String> implements IOtherReceiptDao {
@DS("#entity.dataSourceCode")
@Override
public List<OtherReceiptEntity> getU8OtherReceipt(OtherReceiptEntity entity) {
return (List<OtherReceiptEntity>) super.selectList("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl.entity_list_base",entity);
}
@DS("#entity.dataSourceCode")
@Override
public int updateState(OtherReceiptEntity entity) {
return super.update("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl.entity_update", entity);
}
}

View File

@ -0,0 +1,26 @@
package com.hzya.frame.u8.otherreceipt.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.u8.otherreceipt.dao.IOtherReceiptDetailDao;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
@Repository(value = "OtherReceiptDetailDaoImpl")
public class OtherReceiptDetailDaoImpl extends MybatisGenericDao<OtherReceiptDetailEntity,String> implements IOtherReceiptDetailDao {
@DS("#entity.dataSourceCode")
@Override
public List<OtherReceiptDetailEntity> getU8OtherReceipt(OtherReceiptDetailEntity entity) {
return (List<OtherReceiptDetailEntity>) super.selectList("com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDetailDaoImpl.entity_list_base",entity);
}
}

View File

@ -0,0 +1,95 @@
package com.hzya.frame.u8.otherreceipt.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
public class OtherReceiptDetailEntity extends BaseEntity {
private String AccId;//
private String AccCode;//
private String cinvcode;//
private String cinvname;//
private String iquantity;//
private String cdlcode;//
private String inum;//
private String iAmount_f;//
private String cLink;//
public String getAccId() {
return AccId;
}
public void setAccId(String accId) {
AccId = accId;
}
public String getAccCode() {
return AccCode;
}
public void setAccCode(String accCode) {
AccCode = accCode;
}
public String getCinvcode() {
return cinvcode;
}
public void setCinvcode(String cinvcode) {
this.cinvcode = cinvcode;
}
public String getCinvname() {
return cinvname;
}
public void setCinvname(String cinvname) {
this.cinvname = cinvname;
}
public String getIquantity() {
return iquantity;
}
public void setIquantity(String iquantity) {
this.iquantity = iquantity;
}
public String getCdlcode() {
return cdlcode;
}
public void setCdlcode(String cdlcode) {
this.cdlcode = cdlcode;
}
public String getInum() {
return inum;
}
public void setInum(String inum) {
this.inum = inum;
}
public String getiAmount_f() {
return iAmount_f;
}
public void setiAmount_f(String iAmount_f) {
this.iAmount_f = iAmount_f;
}
public String getcLink() {
return cLink;
}
public void setcLink(String cLink) {
this.cLink = cLink;
}
}

View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDetailDaoImpl">
<resultMap id="get-entity-result" type="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity">
<result property="AccId" column="AccId" />
<result property="AccCode" column="AccCode" />
<result property="cinvcode" column="cinvcode" />
<result property="cinvname" column="cinvname" />
<result property="iquantity" column="iquantity" />
<result property="cdlcode" column="cdlcode" />
<result property="inum" column="inum" />
<result property="iAmount_f" column="iAmount_f" />
<result property="cLink" column="cLink" />
</resultMap>
<sql id="OtherReceiptDetailEntity_Base_Column_List">
</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
where cLink = #{cLink} and AccId = #{AccId}
</select>
</mapper>

View File

@ -0,0 +1,99 @@
package com.hzya.frame.u8.otherreceipt.entity;
import com.hzya.frame.web.entity.BaseEntity;
import java.util.List;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
public class OtherReceiptEntity extends BaseEntity {
private String AccId;
private String AccCode;
private String cvouchid;
private String cCusCode;
private String ids;
private String syncFlag;
private String cLink;
private String state;
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getcLink() {
return cLink;
}
public void setcLink(String cLink) {
this.cLink = cLink;
}
public String getAccId() {
return AccId;
}
public void setAccId(String accId) {
AccId = accId;
}
public String getAccCode() {
return AccCode;
}
public void setAccCode(String accCode) {
AccCode = accCode;
}
public String getCvouchid() {
return cvouchid;
}
public void setCvouchid(String cvouchid) {
this.cvouchid = cvouchid;
}
public String getcCusCode() {
return cCusCode;
}
public void setcCusCode(String cCusCode) {
this.cCusCode = cCusCode;
}
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
public String getSyncFlag() {
return syncFlag;
}
public void setSyncFlag(String syncFlag) {
this.syncFlag = syncFlag;
}
private List<OtherReceiptDetailEntity>OtherReceiptDetailEntity;
public List<com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity> getOtherReceiptDetailEntity() {
return OtherReceiptDetailEntity;
}
public void setOtherReceiptDetailEntity(List<com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity> otherReceiptDetailEntity) {
OtherReceiptDetailEntity = otherReceiptDetailEntity;
}
}

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.u8.otherreceipt.dao.impl.OtherReceiptDaoImpl">
<resultMap id="get-entity-result" type="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity">
<result property="AccId" column="AccId" />
<result property="AccCode" column="AccCode" />
<result property="cvouchid" column="cvouchid" />
<result property="cCusCode" column="cCusCode" />
<result property="ids" column="ids" />
<result property="syncFlag" column="sync_flag" />
<result property="cLink" column="cLink" />
</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
<if test="ids != null and ids != ''">and ids = #{ids} </if>
</select>
<!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity">
update ${AccCode}.dbo.Ap_Vouch set sync_flag = #{state}
where cLink = #{cLink}
</update>
</mapper>

View File

@ -0,0 +1,15 @@
package com.hzya.frame.u8.otherreceipt.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
public interface IOtherReceiptDetaiService extends IBaseService<OtherReceiptDetailEntity,String> {
}

View File

@ -0,0 +1,27 @@
package com.hzya.frame.u8.otherreceipt.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
public interface IOtherReceiptService extends IBaseService<OtherReceiptEntity,String> {
/**
*
* @content 获取其他应收单数据并推送到CRM
* @param requestJson
* @className: Administrator
* @author laborer
* @date 2024-10-18 13:48
*
*/
void getU8otherReceiptToCrm(JSONObject requestJson);
}

View File

@ -0,0 +1,23 @@
package com.hzya.frame.u8.otherreceipt.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity;
import com.hzya.frame.u8.otherreceipt.service.IOtherReceiptDetaiService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;
/**
*
* @content 销售发票
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
@Service(value = "OtherReceiptDetaiServiceImpl")
public class OtherReceiptDetaiServiceImpl extends BaseService<OtherReceiptDetailEntity,String> implements IOtherReceiptDetaiService {
Logger logger = LogManager.getLogger(getClass());
}

View File

@ -0,0 +1,194 @@
package com.hzya.frame.u8.otherreceipt.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.crm.util.CrmUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.u8.otherreceipt.dao.IOtherReceiptDao;
import com.hzya.frame.u8.otherreceipt.dao.IOtherReceiptDetailDao;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptDetailEntity;
import com.hzya.frame.u8.otherreceipt.entity.OtherReceiptEntity;
import com.hzya.frame.u8.otherreceipt.service.IOtherReceiptService;
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 javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
*
* @content 其他应收单
* @className: Administrator
* @author laborer
* @date 2024-10-18 9:27
*
*/
@Service(value = "OtherReceiptServiceImpl")
public class OtherReceiptServiceImpl extends BaseService<OtherReceiptEntity,String> implements IOtherReceiptService {
Logger logger = LogManager.getLogger(getClass());
@Autowired
private IOtherReceiptDao otherReceiptDao;
@Autowired
private IOtherReceiptDetailDao otherReceiptDetailDao;
@Resource
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Override
public void getU8otherReceiptToCrm(JSONObject requestJson) {
//获取重推信息id并记录日志
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
String interId = requestJsonObj.getString("integration_task_living_details_id");
logger.info("U8其他应收单重推解析后"+requestJsonObj.toString());
logger.info("U8其他应收单推送CRM重新执行的任务主键"+interId);
//更换数据源
JsonResultEntity resultEntity = new JsonResultEntity();
OtherReceiptEntity entity = new OtherReceiptEntity();
requestJson.put("db_code","YONYOUU8");
entity.setDataSourceCode(requestJson.getString("db_code"));
//根据重推信息id查询该条重推记录信息
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
if(StrUtil.isNotEmpty(interId)){
oldMsg = taskLivingDetailsService.get(interId);
}
String rootAppPk = oldMsg.getRootAppPk();
entity.setIds(rootAppPk);
StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询");
//如果是重推是否通过entity传入的id只能查到一条数据
//entity.setId("-8845102890648320822");
List<OtherReceiptEntity> soleList = otherReceiptDao.getU8OtherReceipt(entity);
logger.info("其他应收单查询数据{}",JSONObject.toJSONString(soleList));
if(CollectionUtils.isNotEmpty(soleList)){
soleList.forEach(sale -> {
try{
//获取明细数据进行拼接
String id = sale.getcLink();
if(!StrUtil.isEmpty(id)){
OtherReceiptDetailEntity line = new OtherReceiptDetailEntity();
logger.info("其他应收单对象{}",JSONObject.toJSONString(sale));
line.setcLink(id);
line.setAccId(sale.getAccId());
line.setDataSourceCode(requestJson.getString("db_code"));
logger.info("其他应收单明细查询{}",JSONObject.toJSONString(line));
List<OtherReceiptDetailEntity> lineList = otherReceiptDetailDao.getU8OtherReceipt(line);
logger.info("其他应收单明细查询数据{}",JSONObject.toJSONString(lineList));
sale.setOtherReceiptDetailEntity(lineList);
logger.info("组装数据");
JSONObject main = bindingAdd(sale);
logger.info("其他应收单推送数据:"+main.toString());
String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000070013");
logger.info("其他应收单推送结果:"+result);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(sale.getIds());
logDetails.setRootAppBill(sale.getCvouchid());
logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(sale));
logDetails.setPluginId("OtherReceiptPluginInitializer");
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getString("code").equals("200");
if(flag){
logDetails.setNewTransmitInfo("推送成功");
// 推送成功更新状态
sale.setState("Y");
}else{
// 推送失败
sale.setState("N");
}
sale.setDataSourceCode(requestJson.getString("db_code"));
try{
saveLog(interId, logDetails, flag);
}catch (Exception e){
logger.error("保存日志失败"+e.getMessage());
otherReceiptDao.updateState(sale);
e.printStackTrace();
}
otherReceiptDao.updateState(sale);
}
} catch (Exception e) {
logger.error("其他应收单执行失败"+e.getMessage());
e.printStackTrace();
}
});
}
}
/**
*
* @content 保存日志信息
* @className: Administrator
* @author laborer
* @date 2024-10-18 11:27
*
*/
private void saveLog(String interId, IntegrationTaskLivingDetailsEntity logDetails, boolean flag) throws Exception {
if(StrUtil.isEmpty(interId)){
if(flag){
//首推成功
taskLivingDetailsService.saveLogToSuccess(logDetails);
}else{
//首推失败
taskLivingDetailsService.saveLogToFail(logDetails);
}
}else{
logDetails.setId(interId);
if(flag){
//重推成功
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
}else{
//重推失败把失败信息更新到重推表中
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
}
}
}
/**
*
* @content 组装推送参数
* @className: Administrator
* @author laborer
* @date 2024-10-18 11:13
*
*/
private JSONObject bindingAdd(OtherReceiptEntity sale) {
JSONObject main = new JSONObject();
main.put("AccId",sale.getAccId());
main.put("billid",sale.getId());
main.put("LoginDate", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
JSONObject head = new JSONObject();
head.put("cvouchid",sale.getCvouchid());
head.put("syncFlag","");
JSONArray body = new JSONArray();
main.put("head",head);
List<OtherReceiptDetailEntity> lineList = sale.getOtherReceiptDetailEntity();
if(CollectionUtils.isNotEmpty(lineList)){
lineList.forEach(line -> {
JSONObject lineObj = new JSONObject();
lineObj.put("cinvcode",line.getCinvcode());
lineObj.put("cinvname",line.getCinvname());
lineObj.put("iquantity",line.getIquantity());
lineObj.put("inum",line.getInum());
lineObj.put("iamount_f",line.getiAmount_f());
lineObj.put("cdlcode",line.getCdlcode());
body.add(lineObj);
});
}
main.put("body",body);
return main;
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.u8.receipt.dao.impl.receiptDetailDaoImpl"> <mapper namespace="com.hzya.frame.u8.receipt.dao.impl.ReceiptDetailDaoImpl">
<resultMap id="get-entity-result" type="com.hzya.frame.u8.receipt.entity.ReceiptDetailEntity"> <resultMap id="get-entity-result" type="com.hzya.frame.u8.receipt.entity.ReceiptDetailEntity">
<result property="dlid" column="dlid" /> <result property="dlid" column="dlid" />
</resultMap> </resultMap>

View File

@ -10,7 +10,7 @@
<result property="ccusname" column="ccusname" /> <result property="ccusname" column="ccusname" />
<result property="iamount_f" column="iamount_f" /> <result property="iamount_f" column="iamount_f" />
<result property="csscode" column="csscode" /> <result property="csscode" column="csscode" />
<result property="syncFlag" column="syncFlag" /> <result property="syncFlag" column="sync_flag" />
<result property="AccId" column="AccId" /> <result property="AccId" column="AccId" />
<result property="AccCode" column="AccCode" /> <result property="AccCode" column="AccCode" />
<result property="ids" column="ids" /> <result property="ids" column="ids" />
@ -22,7 +22,7 @@
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.receipt.entity.ReceiptEntity"> <select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.receipt.entity.ReceiptEntity">
select * from ( select * from (
select select
'001' as AccId, '001' as AccId,
'UFDATA_001_2023' as AccCode, 'UFDATA_001_2023' as AccCode,
head.iID, head.iID,
@ -31,12 +31,16 @@
head.dvouchdate, head.dvouchdate,
customer.ccuscode, customer.ccuscode,
customer.ccusname, customer.ccusname,
head.iamount_f, case
head.csscode, when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
'Y' as syncFlag, when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan cCheckMan
from UFDATA_001_2023.dbo.Ap_CloseBill head 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.customer customer on cDwCode = customer.ccuscode
left join UFDATA_001_2023.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
UNION ALL UNION ALL
@ -49,12 +53,16 @@
head.dvouchdate, head.dvouchdate,
customer.ccuscode, customer.ccuscode,
customer.ccusname, customer.ccusname,
head.iamount_f, case
head.csscode, when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
'Y' as syncFlag, when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan cCheckMan
from UFDATA_002_2024.dbo.Ap_CloseBill head 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.customer customer on cDwCode = customer.ccuscode
left join UFDATA_002_2024.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
UNION ALL UNION ALL
@ -67,13 +75,16 @@
head.dvouchdate, head.dvouchdate,
customer.ccuscode, customer.ccuscode,
customer.ccusname, customer.ccusname,
head.iamount_f, case
head.csscode, when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
'Y' as syncFlag, when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan cCheckMan
from UFDATA_004_2024.dbo.Ap_CloseBill head 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.customer customer on cDwCode = customer.ccuscode
left join UFDATA_004_2024.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
UNION ALL UNION ALL
select select
@ -85,13 +96,16 @@
head.dvouchdate, head.dvouchdate,
customer.ccuscode, customer.ccuscode,
customer.ccusname, customer.ccusname,
head.iamount_f, case
head.csscode, when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
'Y' as syncFlag, when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan cCheckMan
from UFDATA_005_2024.dbo.Ap_CloseBill head 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.customer customer on cDwCode = customer.ccuscode
left join UFDATA_005_2024.dbo.SettleStyle SettleStyle on head.csscode = SettleStyle.csscode
UNION ALL UNION ALL
select select
@ -103,19 +117,23 @@
head.dvouchdate, head.dvouchdate,
customer.ccuscode, customer.ccuscode,
customer.ccusname, customer.ccusname,
head.iamount_f, case
head.csscode, when cVouchType ='49' then '-'+CAST(iamount_f AS VARCHAR(20))
'Y' as syncFlag, when cVouchType ='48' then iamount_f
end as iamount_f,
SettleStyle.cSSName as csscode,
sync_flag,
cCheckMan cCheckMan
from UFDATA_201_2023.dbo.Ap_CloseBill head 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.customer customer on cDwCode = customer.ccuscode
)m1 where cCusCode not in ('001','002','004','005') and cCheckMan is not null 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'
<if test="ids != null and ids != ''">and ids = #{ids} </if> <if test="ids != null and ids != ''">and ids = #{ids} </if>
</select> </select>
<!--通过主键修改方法--> <!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.u8.receipt.entity.ReceiptEntity"> <update id="entity_update" parameterType="com.hzya.frame.u8.receipt.entity.ReceiptEntity">
update #{AccCode}.dbo.Ap_CloseBill set sync_flag = #{state} update ${AccCode}.dbo.Ap_CloseBill set sync_flag = #{state}
where iID = #{iID} where iID = #{iID}
</update> </update>
</mapper> </mapper>

View File

@ -62,8 +62,15 @@ public class ReceiptServiceImpl extends BaseService<ReceiptEntity,String> implem
StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询"); StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询");
//如果是重推是否通过entity传入的id只能查到一条数据 //如果是重推是否通过entity传入的id只能查到一条数据
//entity.setId("-8845102890648320822"); //entity.setId("-8845102890648320822");
List<ReceiptEntity> soleList = saleOutDao.getU8Receipt(entity); List<ReceiptEntity> soleList = null;
logger.info("销售出库查询数据{}",JSONObject.toJSONString(soleList)); try {
soleList = saleOutDao.getU8Receipt(entity);
} catch (Exception e) {
logger.info("销售收款单查询失败"+e);
logger.info("销售收款单查询失败1"+e.getMessage());
throw new RuntimeException(e);
}
logger.info("销售收款单查询数据{}",JSONObject.toJSONString(soleList));
if(CollectionUtils.isNotEmpty(soleList)){ if(CollectionUtils.isNotEmpty(soleList)){
soleList.forEach(sale -> { soleList.forEach(sale -> {
try{ try{
@ -72,19 +79,19 @@ public class ReceiptServiceImpl extends BaseService<ReceiptEntity,String> implem
if(!StrUtil.isEmpty(id)){ if(!StrUtil.isEmpty(id)){
logger.info("组装数据"); logger.info("组装数据");
JSONObject main = bindingAdd(sale); JSONObject main = bindingAdd(sale);
logger.info("销售出库推送数据:"+main.toString()); logger.info("销售收款单推送数据:"+main.toString());
String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000070010");
logger.info("销售出库推送结果:"+result); logger.info("销售收款单推送结果:"+result);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(sale.getIds()); logDetails.setRootAppPk(sale.getIds());
logDetails.setRootAppBill(sale.getCvouchid()); logDetails.setRootAppBill(sale.getCvouchid());
logDetails.setNewTransmitInfo(result); logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date()); logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(sale)); logDetails.setRootAppNewData(JSON.toJSONString(sale));
logDetails.setPluginId("SaleConPlugin"); logDetails.setPluginId("ReceiptPluginInitializer");
JSONObject resultObj = JSON.parseObject(result); JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getString("code").equals("0"); boolean flag = resultObj.getString("code").equals("200");
if(flag){ if(flag){
logDetails.setNewTransmitInfo("推送成功"); logDetails.setNewTransmitInfo("推送成功");
// 推送成功更新状态 // 推送成功更新状态
@ -104,7 +111,7 @@ public class ReceiptServiceImpl extends BaseService<ReceiptEntity,String> implem
saleOutDao.updateState(sale); saleOutDao.updateState(sale);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("销售出库执行失败"+e.getMessage()); logger.error("销售收款单执行失败"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
}); });
@ -159,7 +166,7 @@ public class ReceiptServiceImpl extends BaseService<ReceiptEntity,String> implem
head.put("cvouchid",sale.getCvouchid()); head.put("cvouchid",sale.getCvouchid());
head.put("dvouchdate",sale.getDvouchdate()); head.put("dvouchdate",sale.getDvouchdate());
head.put("ccuscode",sale.getCcuscode()); head.put("ccuscode",sale.getCcuscode());
head.put("iamount",sale.getCcusname()); head.put("iamount_f",sale.getIamount_f());
head.put("csscode",sale.getCsscode()); head.put("csscode",sale.getCsscode());
head.put("syncFlag",sale.getSyncFlag()); head.put("syncFlag",sale.getSyncFlag());
main.put("head",head); main.put("head",head);

View File

@ -24,7 +24,7 @@ public class SaleInvDaoImpl extends MybatisGenericDao<SaleInvEntity,String> impl
public List<SaleInvEntity> getU8SaleInv(SaleInvEntity entity) { public List<SaleInvEntity> getU8SaleInv(SaleInvEntity entity) {
return (List<SaleInvEntity>) super.selectList("com.hzya.frame.u8.saleinv.dao.impl.SaleInvDaoImpl.entity_list_base",entity); return (List<SaleInvEntity>) super.selectList("com.hzya.frame.u8.saleinv.dao.impl.SaleInvDaoImpl.entity_list_base",entity);
} }
@DS("#entity.dataSourceCode")
@Override @Override
public int updateState(SaleInvEntity entity) { public int updateState(SaleInvEntity entity) {
return super.update("com.hzya.frame.u8.saleinv.dao.impl.SaleInvDaoImpl.entity_update", entity); return super.update("com.hzya.frame.u8.saleinv.dao.impl.SaleInvDaoImpl.entity_update", entity);

View File

@ -17,6 +17,24 @@ public class SaleInvDetailEntity extends BaseEntity {
private String SBVID;//主表主键 private String SBVID;//主表主键
private String AccCode;//账套编码 private String AccCode;//账套编码
private String AccId;//账套号 private String AccId;//账套号
private String cbdlcode;//
private String iexchsum;//
public String getIexchsum() {
return iexchsum;
}
public void setIexchsum(String iexchsum) {
this.iexchsum = iexchsum;
}
public String getCbdlcode() {
return cbdlcode;
}
public void setCbdlcode(String cbdlcode) {
this.cbdlcode = cbdlcode;
}
public String getAccCode() { public String getAccCode() {
return AccCode; return AccCode;

View File

@ -16,56 +16,8 @@
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.saleinv.entity.SaleInvDetailEntity"> <select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.saleinv.entity.SaleInvDetailEntity">
-- 销售发票子表 -- 销售发票子表
select * from (
select
'001' as AccId,
'UFDATA_001_2023' as AccCode,
cbdlcode ,
DispatchLists.iexchsum,
DispatchLists.irowno as idlrowno
from UFDATA_001_2023.dbo.SaleBillVouchs Vouchs
left join UFDATA_001_2023.dbo.DispatchLists on Vouchs.iDLsID = DispatchLists.AutoID
union all
select
'002' as AccId,
'UFDATA_002_2024' as AccCode,
cbdlcode ,
DispatchLists.iexchsum,
DispatchLists.irowno as idlrowno
from UFDATA_002_2024.dbo.SaleBillVouchs Vouchs
left join UFDATA_002_2024.dbo.DispatchLists on Vouchs.iDLsID = DispatchLists.AutoID
union all
select
'004' as AccId,
'UFDATA_004_2024' as AccCode,
cbdlcode ,
DispatchLists.iexchsum,
DispatchLists.irowno as idlrowno
from UFDATA_004_2024.dbo.SaleBillVouchs Vouchs
left join UFDATA_004_2024.dbo.DispatchLists on Vouchs.iDLsID = DispatchLists.AutoID
union all
select
'005' as AccId,
'UFDATA_005_2024' as AccCode,
cbdlcode ,
DispatchLists.iexchsum,
DispatchLists.irowno as idlrowno
from UFDATA_005_2024.dbo.SaleBillVouchs Vouchs
left join UFDATA_005_2024.dbo.DispatchLists on Vouchs.iDLsID = DispatchLists.AutoID
union all
select
'201' as AccId,
'UFDATA_201_2023' as AccCode,
cbdlcode ,
DispatchLists.iexchsum,
DispatchLists.irowno as idlrowno
from UFDATA_201_2023.dbo.SaleBillVouchs Vouchs
left join UFDATA_201_2023.dbo.DispatchLists on Vouchs.iDLsID = DispatchLists.AutoID
)m1
select * from kjs_external.dbo.v_hzya_saleinv_details
where SBVID = #{SBVID} and AccId = #{AccId} where SBVID = #{SBVID} and AccId = #{AccId}
</select> </select>

View File

@ -9,100 +9,21 @@
<result property="AccId" column="AccId" /> <result property="AccId" column="AccId" />
<result property="AccCode" column="AccCode" /> <result property="AccCode" column="AccCode" />
<result property="ids" column="ids" /> <result property="ids" column="ids" />
<result property="syncFlag" column="sync_flag" />
</resultMap> </resultMap>
<sql id="SaleInvEntity_Base_Column_List"> <sql id="SaleInvEntity_Base_Column_List">
</sql> </sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.saleinv.entity.SaleInvEntity"> <select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.saleinv.entity.SaleInvEntity">
select * from ( select * from kjs_external.dbo.v_hzya_saleinv
select
'001' as AccId,
'UFDATA_001_2023' as AccCode,
main.SBVID,
'1001'+CAST(main.SBVID AS VARCHAR(100)) as ids,
main.csbvcode,
main.ddate,
sum(line.isum) as isum,
cCusCode,
cVerifier
from UFDATA_001_2023.dbo.SaleBillVouch main
left join UFDATA_001_2023.dbo.SaleBillVouchs line on main.SBVID = line.SBVID
GROUP BY main.csbvcode,main.ddate,main.SBVID,cCusCode,
cVerifier
union all
select
'002' as AccId,
'UFDATA_002_2024' as AccCode,
main.SBVID,
'1002'+CAST(main.SBVID AS VARCHAR(100)) as ids,
main.csbvcode,
main.ddate,
sum(line.isum) as isum,
cCusCode,
cVerifier
from UFDATA_002_2024.dbo.SaleBillVouch main
left join UFDATA_002_2024.dbo.SaleBillVouchs line on main.SBVID = line.SBVID
GROUP BY main.csbvcode,main.ddate,main.SBVID,cCusCode,
cVerifier
union all
select
'004' as AccId,
'UFDATA_004_2024' as AccCode,
main.SBVID,
'1004'+CAST(main.SBVID AS VARCHAR(100)) as ids,
main.csbvcode,
main.ddate,
sum(line.isum) as isum,
cCusCode,
cVerifier
from UFDATA_004_2024.dbo.SaleBillVouch main
left join UFDATA_004_2024.dbo.SaleBillVouchs line on main.SBVID = line.SBVID
GROUP BY main.csbvcode,main.ddate,main.SBVID,cCusCode,
cVerifier
union all
select
'005' as AccId,
'UFDATA_005_2024' as AccCode,
main.SBVID,
'1005'+CAST(main.SBVID AS VARCHAR(100)) as ids,
main.csbvcode,
main.ddate,
sum(line.isum) as isum,
cCusCode,
cVerifier
from UFDATA_005_2024.dbo.SaleBillVouch main
left join UFDATA_005_2024.dbo.SaleBillVouchs line on main.SBVID = line.SBVID
GROUP BY main.csbvcode,main.ddate,main.SBVID,cCusCode,
cVerifier
union all
select
'201' as AccId,
'UFDATA_201_2023' as AccCode,
main.SBVID,
'1201'+CAST(main.SBVID AS VARCHAR(100)) as ids,
main.csbvcode,
main.ddate,
sum(line.isum) as isum,
cCusCode,
cVerifier
from UFDATA_201_2023.dbo.SaleBillVouch main
left join UFDATA_201_2023.dbo.SaleBillVouchs line on main.SBVID = line.SBVID
GROUP BY main.csbvcode,main.ddate,main.SBVID,cCusCode,
cVerifier
)m1 where cCusCode not in ('001','002','004','005') and cVerifier is not null
<if test="ids != null and ids != ''">and ids = #{ids} </if> <if test="ids != null and ids != ''">and ids = #{ids} </if>
</select> </select>
<!--通过主键修改方法--> <!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.u8.saleinv.entity.SaleInvEntity"> <update id="entity_update" parameterType="com.hzya.frame.u8.saleinv.entity.SaleInvEntity">
update #{AccCode}.dbo.SaleBillVouch set sync_flag = #{state} update ${AccCode}.dbo.SaleBillVouch set sync_flag = #{state}
where SBVID = #{SBVID} where SBVID = #{SBVID}
</update> </update>

View File

@ -78,7 +78,7 @@ public class SaleInvServiceImpl extends BaseService<SaleInvEntity,String> implem
if(!StrUtil.isEmpty(id)){ if(!StrUtil.isEmpty(id)){
SaleInvDetailEntity line = new SaleInvDetailEntity(); SaleInvDetailEntity line = new SaleInvDetailEntity();
line.setSBVID(id); line.setSBVID(id);
line.setAccId(id); line.setAccId(sale.getAccId());
line.setDataSourceCode(requestJson.getString("db_code")); line.setDataSourceCode(requestJson.getString("db_code"));
List<SaleInvDetailEntity> lineList = saleInvDetailDao.getU8InvDetail(line); List<SaleInvDetailEntity> lineList = saleInvDetailDao.getU8InvDetail(line);
logger.info("销售发票单明细查询数据{}",JSONObject.toJSONString(lineList)); logger.info("销售发票单明细查询数据{}",JSONObject.toJSONString(lineList));
@ -86,7 +86,7 @@ public class SaleInvServiceImpl extends BaseService<SaleInvEntity,String> implem
logger.info("组装数据"); logger.info("组装数据");
JSONObject main = bindingAdd(sale); JSONObject main = bindingAdd(sale);
logger.info("销售发票推送数据:"+main.toString()); logger.info("销售发票推送数据:"+main.toString());
String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000070014");
logger.info("销售发票推送结果:"+result); logger.info("销售发票推送结果:"+result);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(sale.getIds()); logDetails.setRootAppPk(sale.getIds());
@ -94,10 +94,10 @@ public class SaleInvServiceImpl extends BaseService<SaleInvEntity,String> implem
logDetails.setNewTransmitInfo(result); logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date()); logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(sale)); logDetails.setRootAppNewData(JSON.toJSONString(sale));
logDetails.setPluginId("SaleConPlugin"); logDetails.setPluginId("SaleInvPluginInitializer");
JSONObject resultObj = JSON.parseObject(result); JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getString("code").equals("0"); boolean flag = resultObj.getString("code").equals("200");
if(flag){ if(flag){
logDetails.setNewTransmitInfo("推送成功"); logDetails.setNewTransmitInfo("推送成功");
// 推送成功更新状态 // 推送成功更新状态

View File

@ -23,6 +23,6 @@ public class SaleOutDaoImpl extends MybatisGenericDao<SaleOutEntity,String> impl
@DS("#entity.dataSourceCode") @DS("#entity.dataSourceCode")
@Override @Override
public int updateState(SaleOutEntity entity) { public int updateState(SaleOutEntity entity) {
return super.update("com.hzya.frame.u8.saleout.dao.impl.SaleOutDaoImpl.entity_list_base",entity); return super.update("com.hzya.frame.u8.saleout.dao.impl.SaleOutDaoImpl.entity_update",entity);
} }
} }

View File

@ -14,65 +14,70 @@
-- 销售出库单子表 -- 销售出库单子表
select * from ( select * from (
select select
id,
'001' as AccId, '001' as AccId,
'UFDATA_001_2023' as AccCode, 'UFDATA_001_2023' as AccCode,
inv.cinvcode, inv.cinvcode,
inv.cinvname, inv.cinvname,
iquantity, iquantity,
inum, inum,
irowno as idlrowno cbdlcode as idlrowno
from UFDATA_001_2023.dbo.rdrecords32 main from UFDATA_001_2023.dbo.rdrecords32 main
left join UFDATA_001_2023.dbo.inventory inv on main.cinvcode = inv.cinvcode left join UFDATA_001_2023.dbo.inventory inv on main.cinvcode = inv.cinvcode
union all union all
select select
id,
'002' as AccId, '002' as AccId,
'UFDATA_002_2024' as AccCode, 'UFDATA_002_2024' as AccCode,
inv.cinvcode, inv.cinvcode,
inv.cinvname, inv.cinvname,
iquantity, iquantity,
inum, inum,
irowno as idlrowno cbdlcode as idlrowno
from UFDATA_002_2024.dbo.rdrecords32 main from UFDATA_002_2024.dbo.rdrecords32 main
left join UFDATA_002_2024.dbo.inventory inv on main.cinvcode = inv.cinvcode left join UFDATA_002_2024.dbo.inventory inv on main.cinvcode = inv.cinvcode
union all union all
select select
id,
'004' as AccId, '004' as AccId,
'UFDATA_004_2024' as AccCode, 'UFDATA_004_2024' as AccCode,
inv.cinvcode, inv.cinvcode,
inv.cinvname, inv.cinvname,
iquantity, iquantity,
inum, inum,
irowno as idlrowno cbdlcode as idlrowno
from UFDATA_004_2024.dbo.rdrecords32 main from UFDATA_004_2024.dbo.rdrecords32 main
left join UFDATA_004_2024.dbo.inventory inv on main.cinvcode = inv.cinvcode left join UFDATA_004_2024.dbo.inventory inv on main.cinvcode = inv.cinvcode
union all union all
select select
id,
'005' as AccId, '005' as AccId,
'UFDATA_005_2024' as AccCode, 'UFDATA_005_2024' as AccCode,
inv.cinvcode, inv.cinvcode,
inv.cinvname, inv.cinvname,
iquantity, iquantity,
inum, inum,
irowno as idlrowno cbdlcode as idlrowno
from UFDATA_005_2024.dbo.rdrecords32 main from UFDATA_005_2024.dbo.rdrecords32 main
left join UFDATA_005_2024.dbo.inventory inv on main.cinvcode = inv.cinvcode left join UFDATA_005_2024.dbo.inventory inv on main.cinvcode = inv.cinvcode
union all union all
select select
id,
'201' as AccId, '201' as AccId,
'UFDATA_201_2023' as AccCode, 'UFDATA_201_2023' as AccCode,
inv.cinvcode, inv.cinvcode,
inv.cinvname, inv.cinvname,
iquantity, iquantity,
inum, inum,
irowno as idlrowno cbdlcode as idlrowno
from UFDATA_201_2023.dbo.rdrecords32 main from UFDATA_201_2023.dbo.rdrecords32 main
left join UFDATA_201_2023.dbo.inventory inv on main.cinvcode = inv.cinvcode left join UFDATA_201_2023.dbo.inventory inv on main.cinvcode = inv.cinvcode
)m1 )m1

View File

@ -24,7 +24,24 @@ public class SaleOutEntity extends BaseEntity {
private String state;//状态 private String state;//状态
private String AccCode;//账套编码 private String AccCode;//账套编码
private String ids;// private String ids;//
private String syncFlag;//标识
private String couttype;//标识
public String getCouttype() {
return couttype;
}
public void setCouttype(String couttype) {
this.couttype = couttype;
}
public String getSyncFlag() {
return syncFlag;
}
public void setSyncFlag(String syncFlag) {
this.syncFlag = syncFlag;
}
public String getIds() { public String getIds() {
return ids; return ids;
} }

View File

@ -10,6 +10,7 @@
<result property="AccId" column="AccId" /> <result property="AccId" column="AccId" />
<result property="AccCode" column="AccCode" /> <result property="AccCode" column="AccCode" />
<result property="ids" column="ids" /> <result property="ids" column="ids" />
<result property="syncFlag" column="sync_flag" />
</resultMap> </resultMap>
<sql id="SaleOutEntity_Base_Column_List"> <sql id="SaleOutEntity_Base_Column_List">
@ -28,7 +29,7 @@
ccode, ccode,
ddate, ddate,
cCusCode, cCusCode,
cHandler cHandler,sync_flag
from UFDATA_001_2023.dbo.rdrecord32 from UFDATA_001_2023.dbo.rdrecord32
union all union all
@ -42,7 +43,7 @@
ccode, ccode,
ddate, ddate,
cCusCode, cCusCode,
cHandler cHandler,sync_flag
from UFDATA_002_2024.dbo.rdrecord32 from UFDATA_002_2024.dbo.rdrecord32
@ -57,7 +58,7 @@
ccode, ccode,
ddate, ddate,
cCusCode, cCusCode,
cHandler cHandler,sync_flag
from UFDATA_004_2024.dbo.rdrecord32 from UFDATA_004_2024.dbo.rdrecord32
@ -72,14 +73,14 @@
ccode, ccode,
ddate, ddate,
cCusCode, cCusCode,
cHandler cHandler,sync_flag
from UFDATA_005_2024.dbo.rdrecord32 from UFDATA_005_2024.dbo.rdrecord32
union all union all
select select
'1201' as AccId, '201' as AccId,
'1UFDATA_201_2023' as AccCode, 'UFDATA_201_2023' as AccCode,
'201'+CAST(id AS VARCHAR(100)) as ids, '201'+CAST(id AS VARCHAR(100)) as ids,
id, id,
cdlcode, cdlcode,
@ -87,15 +88,15 @@
ccode, ccode,
ddate, ddate,
cCusCode, cCusCode,
cHandler cHandler,sync_flag
from UFDATA_201_2023.dbo.rdrecord32 from UFDATA_201_2023.dbo.rdrecord32
)m1 where cCusCode not in ('001','002','004','005') and cHandler is not null )m1 where cCusCode not in ('001','002','004','005') and cHandler is not null and sync_flag is null and AccId = '201'
<if test="ids != null and ids != ''">and ids = #{ids} </if> <if test="ids != null and ids != ''">and ids = #{ids} </if>
</select> </select>
<!--通过主键修改方法--> <!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.u8.saleout.entity.SaleOutEntity"> <update id="entity_update" parameterType="com.hzya.frame.u8.saleout.entity.SaleOutEntity">
update #{AccCode}.dbo.rdrecords32 set sync_flag = #{state} update ${AccCode}.dbo.rdrecord32 set sync_flag = #{state}
where id = #{id} where id = #{id}
</update> </update>
</mapper> </mapper>

View File

@ -79,7 +79,14 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询"); StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询");
//如果是重推是否通过entity传入的id只能查到一条数据 //如果是重推是否通过entity传入的id只能查到一条数据
//entity.setId("-8845102890648320822"); //entity.setId("-8845102890648320822");
List<SaleOutEntity> soleList = saleOutDao.getU8SaleOut(entity); List<SaleOutEntity> soleList = null;
try {
soleList = saleOutDao.getU8SaleOut(entity);
} catch (Exception e) {
logger.info("销售出库单查询失败"+e);
logger.info("销售出库单查询失败1"+e.getMessage());
throw new RuntimeException(e);
}
logger.info("销售出库查询数据{}",JSONObject.toJSONString(soleList)); logger.info("销售出库查询数据{}",JSONObject.toJSONString(soleList));
if(CollectionUtils.isNotEmpty(soleList)){ if(CollectionUtils.isNotEmpty(soleList)){
soleList.forEach(sale -> { soleList.forEach(sale -> {
@ -89,7 +96,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
if(!StrUtil.isEmpty(id)){ if(!StrUtil.isEmpty(id)){
SaleOutDetailEntity line = new SaleOutDetailEntity(); SaleOutDetailEntity line = new SaleOutDetailEntity();
line.setId(id); line.setId(id);
line.setAccId(id); line.setAccId(sale.getAccId());
line.setDataSourceCode(requestJson.getString("db_code")); line.setDataSourceCode(requestJson.getString("db_code"));
List<SaleOutDetailEntity> lineList = saleOutDetailDao.getU8SaleOutLine(line); List<SaleOutDetailEntity> lineList = saleOutDetailDao.getU8SaleOutLine(line);
logger.info("销售出库单明细查询数据{}",JSONObject.toJSONString(lineList)); logger.info("销售出库单明细查询数据{}",JSONObject.toJSONString(lineList));
@ -97,7 +104,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
logger.info("组装数据"); logger.info("组装数据");
JSONObject main = bindingAdd(sale); JSONObject main = bindingAdd(sale);
logger.info("销售出库推送数据:"+main.toString()); logger.info("销售出库推送数据:"+main.toString());
String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000340003"); String result = CrmUtil.sendU8TOCrmEsb(main.toString(), "8000070012");
logger.info("销售出库推送结果:"+result); logger.info("销售出库推送结果:"+result);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(sale.getIds()); logDetails.setRootAppPk(sale.getIds());
@ -105,10 +112,11 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
logDetails.setNewTransmitInfo(result); logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date()); logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(sale)); logDetails.setRootAppNewData(JSON.toJSONString(sale));
logDetails.setPluginId("SaleConPlugin"); logDetails.setPluginId("SaleOutPluginInitializer");
logger.info("111111111111111111111111");
JSONObject resultObj = JSON.parseObject(result); JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getString("code").equals("0"); boolean flag = resultObj.getString("code").equals("200");
if(flag){ if(flag){
logDetails.setNewTransmitInfo("推送成功"); logDetails.setNewTransmitInfo("推送成功");
// 推送成功更新状态 // 推送成功更新状态
@ -117,6 +125,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
// 推送失败 // 推送失败
sale.setState("N"); sale.setState("N");
} }
logger.info("222222222222222222");
sale.setDataSourceCode(requestJson.getString("db_code")); sale.setDataSourceCode(requestJson.getString("db_code"));
try{ try{
saveLog(interId, logDetails, flag); saveLog(interId, logDetails, flag);
@ -125,6 +134,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
saleOutDao.updateState(sale); saleOutDao.updateState(sale);
e.printStackTrace(); e.printStackTrace();
} }
logger.info("3333333333333333333333");
saleOutDao.updateState(sale); saleOutDao.updateState(sale);
} }
} catch (Exception e) { } catch (Exception e) {