This commit is contained in:
lvleigang 2024-10-18 08:52:18 +08:00
commit ef957a0055
25 changed files with 1409 additions and 33 deletions

View File

@ -0,0 +1,152 @@
package com.hzya.frame.plugin.a8bill.plugin;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
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;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
/**
* @Description OA付款申请审批完成后传u8c
* @Author xiangerlin
* @Date 2024/10/9 14:19
**/
public class PayReqSyncU8CPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private INingboBankPluginService ningboBankPluginService;
@Resource
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Autowired
private IPayBillPluginInitializerDao payBillDao;
@Value("${OA.data_source_code}")
private String oa_data_source_code;
/***
* 插件初始化方法
* @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 "PayReqSyncU8CPlugin";
}
/****
* 插件的名称
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginName() {
return "付款申请审批结果传U8C";
}
/****
* 插件的显示值
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginLabel() {
return "付款申请审批结果传U8C";
}
/***
* 插件类型 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 {
logger.info("======开始执行付款申请审批结果传U8C========");
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(), JSONObject.class);
String integration_task_living_details_id = requestJsonObj.getString("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
if (StrUtil.isNotEmpty(integration_task_living_details_id)) {
oldMsg = taskLivingDetailsService.get(integration_task_living_details_id);
}
String rootAppPk = oldMsg.getRootAppPk();
try {
StringBuffer sb = new StringBuffer();
if (StrUtil.isNotEmpty(rootAppPk)) {
sb.append(" and id = '" + rootAppPk + "'");
}else {
sb.append("and finishedflag = '1' and pushState is null");
}
PayBillEntity oaBillEntity = new PayBillEntity();
oaBillEntity.setDataSourceCode(oa_data_source_code);
StringBuffer stringBuffer = new StringBuffer();
//付款单
stringBuffer.append("SELECT * from v_hzya_payres_u8c WHERE 1= 1 ");
stringBuffer.append(sb.toString());
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(), oaBillEntity);
for (HashMap<String, Object> hashMap : hashMaps) {
JSONObject main = new JSONObject();
for (String key : hashMap.keySet()) {
main.put(key, hashMap.get(key));
}
ningboBankPluginService.updateU8CStatus(main,integration_task_living_details_id);
}
} catch (Exception e) {
logger.info("获取OA数据失败" + e.getMessage());
e.printStackTrace();
}
return BaseResult.getSuccessMessageEntity(getPluginName()+"执行成功");
}
}

View File

@ -53,8 +53,8 @@ public interface INingboBankPluginService {
/**
* 更新u8c单据状态
* @param billCode oa单据编号
* @param dwbm 公司编码
* @param jsonObject
* @param integration_task_living_details_id 重试id
*/
void updateU8CStatus(String billCode,String dwbm);
void updateU8CStatus(JSONObject jsonObject,String integration_task_living_details_id);
}

View File

@ -157,8 +157,6 @@ private IFormmain0044Service formmain0044Service;
//修改推送状态防止重复推送
oaBillEntity.setSql(str);
payBillDao.updateStateForId(str,oaBillEntity);
//更新u8c付款单状态
updateU8CStatus(main.getString("serialNo"),main.getString("dwbm"));
}catch (Exception e){
logger.info("宁波银行付款接口调用出错:{}",e);
}
@ -386,25 +384,94 @@ private IFormmain0044Service formmain0044Service;
/**
* 更新u8c单据状态
* @param billCode oa单据编号
* @param dwbm 公司编码
* @param main
*/
@Override
public void updateU8CStatus(String billCode,String dwbm) {
public void updateU8CStatus(JSONObject main,String integration_task_living_details_id) {
String billCode = main.getString("serialNo");
String dwbm = main.getString("dwbm");
String state = main.getString("state");
String userCode = main.getString("userCode");
String id = main.getString("id");
if (StrUtil.isNotEmpty(billCode)){
PayBillEntity oaBillEntity = new PayBillEntity();
oaBillEntity.setDataSourceCode(oa_data_source_code);
String str = "update formmain_0058 set field0072 = 'N' where id = "+id;
try {
JSONObject param = new JSONObject();
param.put("billno",billCode);
param.put("corpcode",dwbm);
param.put("billType","paybill");
param.put("userCode","hzya");
param.put("ckeckResult","Y");
param.put("ckeckNote","审批通过");
String s = executeEsb(param.toString(), "8000350060","800035");
System.out.println("调用U8C付款单审批返回参数"+s);
logger.info("调用U8C付款单审批返回参数:{}",s);
param.put("userCode",userCode);
param.put("ckeckResult","3".equals(state) ? "Y" :"N");
param.put("ckeckNote",getStateName(state));
String result = executeEsb(param.toString(), "8000350060","800035");
logger.info("调用U8C付款单审批返回参数:{}",result);
//保存日志
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
taskLivingDetail.setCreate_time(new Date());
taskLivingDetail.setModify_time(new Date());
taskLivingDetail.setRootAppPk(id);
taskLivingDetail.setRootAppBill(main.getString("serialNo"));
taskLivingDetail.setPluginId("PayReqSyncU8CPlugin");
taskLivingDetail.setRootAppNewData(param.toString());
taskLivingDetail.setNewTransmitInfo(result);
taskLivingDetail.setNewPushDate(new Date());
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getBoolean("flag");
//保存日志
saveLog(integration_task_living_details_id,flag,taskLivingDetail);
//更新oa表单推送状态
if (flag){
str = "update formmain_0058 set field0072 = 'Y' where id = "+id;
}
}catch (Exception e){
logger.error("执行U8C付款单审批接口出错:{}",e);
}
//修改推送状态防止重复推送
oaBillEntity.setSql(str);
try {
payBillDao.updateStateForId(str,oaBillEntity);
} catch (Exception e) {
logger.error("执行U8C付款单审批接口后更新OA单据状态出错:{}",e);
}
}
}
//审批状态对应的中文
private String getStateName(String state){
if ("3".equals(state)){
return "审批通过";
}else if ("1".equals(state)){
return "流程终止";
}else if ("2".equals(state)){
return "流程撤销";
}
return "审批通过";
}
public void saveLog(String integration_task_living_details_id, Boolean flag, IntegrationTaskLivingDetailsEntity taskLivingDetail){
try {
//判断成功调用这个方法
if (StrUtil.isEmpty(integration_task_living_details_id)){
if (flag){
taskLivingDetailsService.saveLogToSuccess(taskLivingDetail);
}else {
//失败 调用这个方法
taskLivingDetailsService.saveLogToFail(taskLivingDetail);
}
}else {
taskLivingDetail.setId(integration_task_living_details_id);
if (flag){
//如果是重试 成功调这个方法
taskLivingDetailsService.saveLogFailToSuccess(taskLivingDetail);
}else {
//如果是重试 失败调这个方法
taskLivingDetailsService.updateLogFailToSuccess(taskLivingDetail);
}
}
}catch (Exception e){
logger.error("保存日志出错:{}",e);
}
}
private static String getAccLogXmlTemplate(){
// return "<forms version=\"2.1\"><formExport><summary id=\"1828182906863371818\" name=\"formmain_0044\"/><definitions><column id=\"field0001\" type=\"0\" name=\"我方账号\" isNullable=\"false\" length=\"200\"/><column id=\"field0017\" type=\"0\" name=\"我方开户行\" isNullable=\"false\" length=\"200\"/><column id=\"field0024\" type=\"0\" name=\"我方户名\" isNullable=\"false\" length=\"200\"/><column id=\"field0029\" type=\"0\" name=\"客户方账号\" isNullable=\"false\" length=\"200\"/><column id=\"field0022\" type=\"0\" name=\"客户方户名\" isNullable=\"false\" length=\"2000\"/><column id=\"field0030\" type=\"0\" name=\"客户方开户行\" isNullable=\"false\" length=\"500\"/><column id=\"field0018\" type=\"2\" name=\"交易日期\" isNullable=\"false\" length=\"255\"/><column id=\"field0019\" type=\"0\" name=\"交易流水号\" isNullable=\"false\" length=\"100\"/><column id=\"field0020\" type=\"4\" name=\"收款金额\" isNullable=\"false\" length=\"20\"/><column id=\"field0021\" type=\"0\" name=\"摘要\" isNullable=\"false\" length=\"500\"/><column id=\"field0025\" type=\"0\" name=\"银行类型\" isNullable=\"false\" length=\"100\"/><column id=\"field0026\" type=\"0\" name=\"银行流水号\" isNullable=\"false\" length=\"100\"/><column id=\"field0027\" type=\"0\" name=\"币种\" isNullable=\"false\" length=\"100\"/><column id=\"field0028\" type=\"0\" name=\"用途\" isNullable=\"false\" length=\"800\"/><column id=\"field0031\" type=\"0\" name=\"关联客户号\" isNullable=\"false\" length=\"100\"/><column id=\"field0032\" type=\"0\" name=\"客商编号\" isNullable=\"false\" length=\"100\"/><column id=\"field0033\" type=\"0\" name=\"交易代码\" isNullable=\"false\" length=\"100\"/><column id=\"field0034\" type=\"0\" name=\"客商名称\" isNullable=\"false\" length=\"100\"/><column id=\"field0035\" type=\"0\" name=\"对账码\" isNullable=\"false\" length=\"100\"/><column id=\"field0036\" type=\"0\" name=\"备注\" isNullable=\"false\" length=\"800\"/><column id=\"field0037\" type=\"0\" name=\"ERP业务参考号\" isNullable=\"false\" length=\"100\"/><column id=\"field0038\" type=\"0\" name=\"币种ID\" isNullable=\"false\" length=\"100\"/><column id=\"field0039\" type=\"0\" name=\"币种编码\" isNullable=\"false\" length=\"100\"/><column id=\"field0040\" type=\"0\" name=\"控制只关联1次\" isNullable=\"false\" length=\"100\"/><column id=\"field0044\" type=\"4\" name=\"收款剩余金额\" isNullable=\"false\" length=\"20\"/><column id=\"field0045\" type=\"0\" name=\"收款完成情况\" isNullable=\"false\" length=\"100\"/><column id=\"field0046\" type=\"4\" name=\"是否收款完成\" isNullable=\"false\" length=\"20\"/></definitions><values><column name=\"我方账号\"><value><![CDATA[{}]]></value></column><column name=\"我方开户行\"><value><![CDATA[{}]]></value></column><column name=\"我方户名\"><value><![CDATA[{}]]></value></column><column name=\"客户方账号\"><value><![CDATA[{}]]></value></column><column name=\"客户方户名\"><value><![CDATA[{}]]></value></column><column name=\"客户方开户行\"><value><![CDATA[{}]]></value></column><column name=\"交易日期\"><value><![CDATA[{}]]></value></column><column name=\"交易流水号\"><value><![CDATA[{}]]></value></column><column name=\"收款金额\"><value><![CDATA[{}]]></value></column><column name=\"摘要\"><value><![CDATA[{}]]></value></column><column name=\"银行类型\"><value><![CDATA[{}]]></value></column><column name=\"银行流水号\"><value><![CDATA[{}]]></value></column><column name=\"币种\"><value><![CDATA[{}]]></value></column><column name=\"用途\"><value><![CDATA[{}]]></value></column><column name=\"关联客户号\"><value><![CDATA[{}]]></value></column><column name=\"客商编号\"><value><![CDATA[{}]]></value></column><column name=\"交易代码\"><value><![CDATA[{}]]></value></column><column name=\"客商名称\"><value><![CDATA[{}]]></value></column><column name=\"对账码\"><value><![CDATA[{}]]></value></column><column name=\"备注\"><value><![CDATA[{}]]></value></column><column name=\"ERP业务参考号\"><value><![CDATA[{}]]></value></column><column name=\"币种ID\"><value><![CDATA[{}]]></value></column><column name=\"币种编码\"><value><![CDATA[{}]]></value></column><column name=\"控制只关联1次\"><value><![CDATA[{}]]></value></column><column name=\"收款剩余金额\"><value><![CDATA[{}]]></value></column><column name=\"收款完成情况\"><value><![CDATA[{}]]></value></column><column name=\"是否收款完成\"><value><![CDATA[{}]]></value></column></values><subForms/></formExport></forms>";
return "<forms version=\"2.1\"><formExport><summary id=\"1828182906863371818\" name=\"formmain_0044\"/><definitions><column id=\"field0001\" type=\"0\" name=\"我方账号\" isNullable=\"false\" length=\"200\"/><column id=\"field0017\" type=\"0\" name=\"我方开户行\" isNullable=\"false\" length=\"200\"/><column id=\"field0024\" type=\"0\" name=\"我方户名\" isNullable=\"false\" length=\"200\"/><column id=\"field0029\" type=\"0\" name=\"客户方账号\" isNullable=\"false\" length=\"200\"/><column id=\"field0022\" type=\"0\" name=\"客户方户名\" isNullable=\"false\" length=\"2000\"/><column id=\"field0030\" type=\"0\" name=\"客户方开户行\" isNullable=\"false\" length=\"500\"/><column id=\"field0018\" type=\"2\" name=\"交易日期\" isNullable=\"false\" length=\"255\"/><column id=\"field0019\" type=\"0\" name=\"交易流水号\" isNullable=\"false\" length=\"100\"/><column id=\"field0020\" type=\"4\" name=\"收款金额\" isNullable=\"false\" length=\"20\"/><column id=\"field0021\" type=\"0\" name=\"摘要\" isNullable=\"false\" length=\"500\"/><column id=\"field0025\" type=\"0\" name=\"银行类型\" isNullable=\"false\" length=\"100\"/><column id=\"field0026\" type=\"0\" name=\"银行流水号\" isNullable=\"false\" length=\"100\"/><column id=\"field0027\" type=\"0\" name=\"币种\" isNullable=\"false\" length=\"100\"/><column id=\"field0028\" type=\"0\" name=\"用途\" isNullable=\"false\" length=\"800\"/><column id=\"field0036\" type=\"0\" name=\"备注\" isNullable=\"false\" length=\"800\"/><column id=\"field0039\" type=\"0\" name=\"币种编码\" isNullable=\"false\" length=\"100\"/></definitions><values><column name=\"我方账号\"><value><![CDATA[{}]]></value></column><column name=\"我方开户行\"><value><![CDATA[{}]]></value></column><column name=\"我方户名\"><value><![CDATA[{}]]></value></column><column name=\"客户方账号\"><value><![CDATA[{}]]></value></column><column name=\"客户方户名\"><value><![CDATA[{}]]></value></column><column name=\"客户方开户行\"><value><![CDATA[{}]]></value></column><column name=\"交易日期\"><value><![CDATA[{}]]></value></column><column name=\"交易流水号\"><value><![CDATA[{}]]></value></column><column name=\"收款金额\"><value><![CDATA[{}]]></value></column><column name=\"摘要\"><value><![CDATA[{}]]></value></column><column name=\"银行类型\"><value><![CDATA[{}]]></value></column><column name=\"银行流水号\"><value><![CDATA[{}]]></value></column><column name=\"币种\"><value><![CDATA[{}]]></value></column><column name=\"用途\"><value><![CDATA[{}]]></value></column><column name=\"备注\"><value><![CDATA[{}]]></value></column><column name=\"币种编码\"><value><![CDATA[{}]]></value></column></values><subForms/></formExport></forms>";

View File

@ -0,0 +1,98 @@
package com.hzya.frame.plugin.u8c.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.u8c.service.ISalesBillingService;
import com.hzya.frame.u8c.sosale.service.ISoSaleService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
public class SaleConPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(SaleConPluginInitializer.class);
@Autowired
private ISoSaleService soSaleService;
/***
* 插件初始化方法
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 10:48
* @Param []
* @return void
**/
@Override
public void 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 "SaleConPlugin";
}
/****
* 插件的名称
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginName() {
return "U8C销售合同同步OA销售合同";
}
/****
* 插件的显示值
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginLabel() {
return "U8C销售合同同步OA销售合同插件";
}
/***
* 插件类型 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 {
return soSaleService.getU8cSaleToOa(requestJson);
}
}

View File

@ -29,7 +29,9 @@ public class SalesBillingServiceImpl implements ISalesBillingService {
private IU8cSalesBillingService iu8cSalesBillingService;
private final String appId = "800035";
private final String apiCode = "8000350047";
//这个接口调错了要用开发的那个审批接口
//private final String apiCode = "8000350047";
private final String apiCode = "8000350060";
private final String publicKey = "ZJYATW/MfYZX7zF0eAh4DJXbyTLwUtwSoSz5Y/o1ksAaN/dCe7eDIk+3zDUT+v578prj";
private final String secretKey = "+5BUkLQh3iX3VHgEt5bE2IPh+ZeebGvDaEspsvVu739Ar6sFnwg+fpPod4t6XhoTj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=";
@ -131,6 +133,16 @@ public class SalesBillingServiceImpl implements ISalesBillingService {
data.put("queryinfo", queryinfo);
data.put("approveinfo", approveinfo);
params = data.toJSONString();
//用新的审批接口
JSONObject jsonObject = new JSONObject();
jsonObject.put("billno",entity.getCode());
jsonObject.put("corpcode",entity.getCorp());
jsonObject.put("billType","saleinvoice");
jsonObject.put("userCode","15715849962");
jsonObject.put("ckeckResult","Y");
jsonObject.put("ckeckNote","审批通过");
params = jsonObject.toString();
return params;
}
@ -143,7 +155,7 @@ public class SalesBillingServiceImpl implements ISalesBillingService {
.put("secretKey", secretKey)
.put("appId", appId)
.build();
String res = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(header).body(params).timeout(60000).execute().body();
String res = HttpRequest.post("http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(header).body(params).timeout(60000).execute().body();
return res;
}
}

View File

@ -6,4 +6,5 @@
<bean name="ningboBankPayResultPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.NingboBankPayResultPluginInitializer" />
<bean name="ningboBankTTPayPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.NingboBankTTPayPluginInitializer" />
<bean name="ningboBankTTPayResultPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.NingboBankTTPayResultPluginInitializer" />
<bean name="payReqSyncU8CPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.PayReqSyncU8CPluginInitializer" />
</beans>

View File

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

View File

@ -75,7 +75,7 @@ public class temButtom {
@Test
public void updateU8CTest(){
try {
ningboBankPluginService.updateU8CStatus("FK2409190002","001");
//ningboBankPluginService.updateU8CStatus("FK2409190002","001","3");
}catch (Exception ex){
ex.printStackTrace();
}

View File

@ -59,12 +59,12 @@ public class ReceiptForServiceImpl extends BaseService<ReceiptForEntity,String>
//如果是重推是否通过entity传入的id只能查到一条数据
//entity.setId("-8845102890648320822");
List<ReceiptForEntity> receiptList = receiptForDao.getOaReceipt(entity);
logger.info("收款单查询数据{}",JSONObject.toJSONString(receiptList));
if(CollectionUtils.isNotEmpty(receiptList)){
for(ReceiptForEntity rec : receiptList){
try{
logger.info("组装数据");
JSONObject main = bindingAdd(rec);
logger.info("收款认领单推送数据:"+main.toString());
String result = BipUtil.sendOaToU8c(main.toString(),"8000350034");
logger.info("收款认领单推送结果:"+result);
@ -113,6 +113,7 @@ public class ReceiptForServiceImpl extends BaseService<ReceiptForEntity,String>
receiptForDao.updateState(rec);
//
} catch (Exception e) {
logger.info("收款单执行失败1"+e);
logger.info("收款单执行失败"+e.getMessage());
e.printStackTrace();
}

View File

@ -206,4 +206,58 @@ public class RestUtil {
}
return null;
}
public static String sendU8CToOA(String parm, String apiCode,String userCode){
String baseUrl = "http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface";
System.out.println("推送参数"+parm);
//获取OAtoken
JSONObject tokenObj = new JSONObject();
tokenObj.put("password","2cdd6cfc-5b87-47d1-aaea-756a55f6b5a6");
tokenObj.put("userName","restUser");
tokenObj.put("loginName",userCode);
tokenObj.put("loginName","yuqh");
String token = getOaTokenForEsb(tokenObj.toString(),"");
if(StrUtil.isNotEmpty(token)){
tokenObj = JSON.parseObject(token);
token = tokenObj.getString("id");
}
String result = HttpRequest.post(baseUrl)
.header("appId", "800034")//头信息多个头信息多次调用此方法即可
.header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
.header("token", token)//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYA0iD/DtdYCBYE1AqHlz4All0gLb96p8G1xNjdGz4tDZlCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "nL860JIPqIuB0jUsJE5RZLcyZfi8ArRSz6rk0h69TDbkf3Qq0Jstwk9FIgbGa6ejj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
return analytic(result);
}
return null;
}
public static String getOaTokenForEsb(String parm, String apiCode){
String baseUrl = "http://127.0.0.1:8901/kangarooDataCenterV3/entranceController/externalCallInterface";
System.out.println("推送参数"+parm);
String result = HttpRequest.post(baseUrl)
.header("appId", "800034")//头信息多个头信息多次调用此方法即可
.header("apiCode", "8000340000")//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYA0iD/DtdYCBYE1AqHlz4All0gLb96p8G1xNjdGz4tDZlCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "nL860JIPqIuB0jUsJE5RZLcyZfi8ArRSz6rk0h69TDbkf3Qq0Jstwk9FIgbGa6ejj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
return analytic(result);
}
return null;
}
public static String analytic(String parm){
JSONObject main = JSON.parseObject(parm);
return main.getString("attribute");
}
}

View File

@ -122,7 +122,7 @@ public class LoginServiceImpl implements ILoginService {
List<SysOrganEntity> sysOrganEntities = sysOrganDao.queryUserCompany(sysOrganEntity);
//返回值
JSONObject res = new JSONObject();
res.put("token", token);
res.put("zt-token", token);
res.put("userInfo", sysUserEntity);
res.put("company", sysOrganEntities);

View File

@ -22,7 +22,7 @@
formmain_0049.field0045 as corp, -- 公司编码
CONVERT(varchar,formmain_0049.start_date, 23) as dateBegin,-- 单据开始日期
CONVERT(varchar,formmain_0049.modify_date, 23) as dateEnd, -- 单据结束日期
'15639671252' as approvid, -- 审批人
'15715849962' as approvid, -- 审批人
CONVERT(varchar,formmain_0049.modify_date, 23) as approvedate, -- 审核时间
case when COL_SUMMARY.STATE = '1' then 'R' when COL_SUMMARY.STATE = '3' then 'Y' ELSE 'Y' END as status, -- 审批状态Y通过N不通过R驳回
'已阅' as note -- 批语

View File

@ -0,0 +1,36 @@
package com.hzya.frame.u8c.sosale.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
import java.util.List;
/**
* 脚本表(u8c_sales_billing: table)表数据库访问层
*
* @author makejava
* @since 2024-08-02 11:07:43
*/
public interface ISoSaleDao extends IBaseDao<SoSaleEntity, String> {
/**
*
* @content 获取U8C主表数据
* @className: Administrator
* @author laborer
* @date 2024-10-16 15:30
*
*/
List<SoSaleEntity> getU8cSale(SoSaleEntity entity);
/**
*
* @content 修改推送状态
* @className: Administrator
* @author laborer
* @date 2024-10-16 16:00
*
*/
int updateState(SoSaleEntity sale);
}

View File

@ -0,0 +1,28 @@
package com.hzya.frame.u8c.sosale.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity;
import java.util.List;
/**
* 脚本表(u8c_sales_billing: table)表数据库访问层
*
* @author makejava
* @since 2024-08-02 11:07:43
*/
public interface ISoSaleLineDao extends IBaseDao<SoSaleLineEntity, String> {
/**
*
* @content 获取U8C明细数据
* @className: Administrator
* @author laborer
* @date 2024-10-16 15:52
*
*/
List<SoSaleLineEntity> getU8cSaleLine(SoSaleLineEntity line);
}

View File

@ -0,0 +1,32 @@
package com.hzya.frame.u8c.sosale.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.u8c.sosale.dao.ISoSaleDao;
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository(value = "SoSaleDaoImpl")
public class SoSaleDaoImpl extends MybatisGenericDao<SoSaleEntity, String> implements ISoSaleDao {
/**
*
* @content 获取UC8C销售订单表头数据
* @className: Administrator
* @author laborer
* @date 2024-10-16 15:30
*
*/
@DS("#entity.dataSourceCode")
@Override
public List<SoSaleEntity> getU8cSale(SoSaleEntity entity) {
return (List<SoSaleEntity>) super.selectList("com.hzya.frame.u8c.sosale.dao.impl.SoSaleDaoImpl.querySaleMain",entity);
}
@DS("#entity.dataSourceCode")
@Override
public int updateState(SoSaleEntity entity) {
return super.update("com.hzya.frame.u8c.sosale.dao.impl.SoSaleDaoImpl.updateState",entity);
}
}

View File

@ -0,0 +1,21 @@
package com.hzya.frame.u8c.sosale.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.u8c.sosale.dao.ISoSaleDao;
import com.hzya.frame.u8c.sosale.dao.ISoSaleLineDao;
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository(value = "SoSaleLineDaoImpl")
public class SoSaleLineDaoImpl extends MybatisGenericDao<SoSaleLineEntity, String> implements ISoSaleLineDao {
@DS("#entity.dataSourceCode")
@Override
public List<SoSaleLineEntity> getU8cSaleLine(SoSaleLineEntity entity) {
return (List<SoSaleLineEntity>) super.selectList("com.hzya.frame.u8c.sosale.dao.impl.SoSaleLineDaoImpl.querySaleLine", entity);
}
}

View File

@ -0,0 +1,245 @@
package com.hzya.frame.u8c.sosale.entity;
import com.hzya.frame.web.entity.BaseEntity;
import java.util.List;
public class SoSaleEntity extends BaseEntity {
private String csaleId;//销售订单主表ID
private String billCode;//单据编号
private String state;
private String vreceiptcode;// 单据编号
private String user_code; // 审核人编码
private String user_name; // 审核人名称
private String dapprovedate; // 审核日期
private String custcode;// 客户编码
private String custname;// 客户名称
private String vsalestrucode;// 销售组织编码
private String vsalestruname;// 销售组织名称
private String bodycode; // 库存组织编码
private String bodyname; // 库存组织名称
private String creceiptcustomerid ;// 收货单位
private String shcode;// 收货单位编码
private String shname;// 收货单位名称
private String creceiptcorpid ;// 开票单位
private String kpcode;// 开票单位编码
private String kpname;// 开票单位名称
private String ctransmodeid;// 运输方式
private String busicode;//业务类型编码
private String businame;//业务类型名称
private String vnote;// 备注
private String unitname;//
private String unitcode;//
public String getUnitname() {
return unitname;
}
public void setUnitname(String unitname) {
this.unitname = unitname;
}
public String getUnitcode() {
return unitcode;
}
public void setUnitcode(String unitcode) {
this.unitcode = unitcode;
}
public String getVreceiptcode() {
return vreceiptcode;
}
public void setVreceiptcode(String vreceiptcode) {
this.vreceiptcode = vreceiptcode;
}
public String getUser_code() {
return user_code;
}
public void setUser_code(String user_code) {
this.user_code = user_code;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getDapprovedate() {
return dapprovedate;
}
public void setDapprovedate(String dapprovedate) {
this.dapprovedate = dapprovedate;
}
public String getCustcode() {
return custcode;
}
public void setCustcode(String custcode) {
this.custcode = custcode;
}
public String getCustname() {
return custname;
}
public void setCustname(String custname) {
this.custname = custname;
}
public String getVsalestrucode() {
return vsalestrucode;
}
public void setVsalestrucode(String vsalestrucode) {
this.vsalestrucode = vsalestrucode;
}
public String getVsalestruname() {
return vsalestruname;
}
public void setVsalestruname(String vsalestruname) {
this.vsalestruname = vsalestruname;
}
public String getBodycode() {
return bodycode;
}
public void setBodycode(String bodycode) {
this.bodycode = bodycode;
}
public String getBodyname() {
return bodyname;
}
public void setBodyname(String bodyname) {
this.bodyname = bodyname;
}
public String getCreceiptcustomerid() {
return creceiptcustomerid;
}
public void setCreceiptcustomerid(String creceiptcustomerid) {
this.creceiptcustomerid = creceiptcustomerid;
}
public String getShcode() {
return shcode;
}
public void setShcode(String shcode) {
this.shcode = shcode;
}
public String getShname() {
return shname;
}
public void setShname(String shname) {
this.shname = shname;
}
public String getCreceiptcorpid() {
return creceiptcorpid;
}
public void setCreceiptcorpid(String creceiptcorpid) {
this.creceiptcorpid = creceiptcorpid;
}
public String getKpcode() {
return kpcode;
}
public void setKpcode(String kpcode) {
this.kpcode = kpcode;
}
public String getKpname() {
return kpname;
}
public void setKpname(String kpname) {
this.kpname = kpname;
}
public String getCtransmodeid() {
return ctransmodeid;
}
public void setCtransmodeid(String ctransmodeid) {
this.ctransmodeid = ctransmodeid;
}
public String getBusicode() {
return busicode;
}
public void setBusicode(String busicode) {
this.busicode = busicode;
}
public String getBusiname() {
return businame;
}
public void setBusiname(String businame) {
this.businame = businame;
}
public String getVnote() {
return vnote;
}
public void setVnote(String vnote) {
this.vnote = vnote;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
private List<SoSaleLineEntity>saleLineList;
public List<SoSaleLineEntity> getSaleLineList() {
return saleLineList;
}
public void setSaleLineList(List<SoSaleLineEntity> saleLineList) {
this.saleLineList = saleLineList;
}
public String getCsaleId() {
return csaleId;
}
public void setCsaleId(String csaleId) {
this.csaleId = csaleId;
}
public String getBillCode() {
return billCode;
}
public void setBillCode(String billCode) {
this.billCode = billCode;
}
}

View File

@ -0,0 +1,82 @@
<?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.u8c.sosale.dao.impl.SoSaleDaoImpl">
<resultMap id="get-SoSaleEntity-result" type="com.hzya.frame.u8c.sosale.entity.SoSaleEntity" >
<result property="vreceiptcode" column="vreceiptcode" jdbcType="VARCHAR"/>
<result property="user_code" column="user_code" jdbcType="VARCHAR"/>
<result property="user_name" column="user_name" jdbcType="VARCHAR"/>
<result property="dapprovedate" column="dapprovedate" jdbcType="VARCHAR"/>
<result property="custcode" column="custcode" jdbcType="VARCHAR"/>
<result property="custname" column="custname" jdbcType="VARCHAR"/>
<result property="vsalestrucode" column="vsalestrucode" jdbcType="VARCHAR"/>
<result property="vsalestruname" column="vsalestruname" jdbcType="VARCHAR"/>
<result property="bodycode" column="bodycode" jdbcType="VARCHAR"/>
<result property="bodyname" column="bodyname" jdbcType="VARCHAR"/>
<result property="shcode" column="shcode" jdbcType="VARCHAR"/>
<result property="shname" column="shname" jdbcType="VARCHAR"/>
<result property="kpcode" column="kpcode" jdbcType="VARCHAR"/>
<result property="kpname" column="kpname" jdbcType="VARCHAR"/>
<result property="busicode" column="busicode" jdbcType="VARCHAR"/>
<result property="businame" column="businame" jdbcType="VARCHAR"/>
<result property="vnote" column="vnote" jdbcType="VARCHAR"/>
<result property="csaleId" column="csaleid" jdbcType="VARCHAR"/>
<result property="unitcode" column="unitcode" jdbcType="VARCHAR"/>
<result property="unitname" column="unitname" jdbcType="VARCHAR"/>
<result property="billCode" column="bill_code" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<!-- 分页查询列表 采用like格式 -->
<select id="querySaleMain" resultType="com.hzya.frame.u8c.sosale.entity.SoSaleEntity" parameterType = "com.hzya.frame.u8c.sosale.entity.SoSaleEntity">
select
corp.unitcode,
corp.unitname,
csaleid,-- 单据编号
vreceiptcode as bill_code,-- 单据编号
sm_user.user_code, -- 审核人编码
sm_user.user_name, -- 审核人名称
dapprovedate, -- 审核日期
cubas.custcode,-- 客户编码
cubas.custname,-- 客户名称
vsalestrucode,-- 销售组织编码
vsalestruname,-- 销售组织名称
calbody.bodycode, -- 库存组织编码
calbody.bodyname, -- 库存组织名称
creceiptcustomerid ,-- 收货单位
cubas1.custcode as shcode,-- 收货单位编码
cubas1.custname as shname,-- 收货单位名称
creceiptcorpid ,-- 开票单位
cubas2.custcode as kpcode,-- 开票单位编码
cubas2.custname as kpname,-- 开票单位名称
ctransmodeid,-- 运输方式
busicode,--业务类型编码
businame,--业务类型名称
main.vnote-- 备注
from so_sale main
left join sm_user sm_user on main.capproveid = sm_user.cuserid
left join bd_cumandoc bd_cum on main.ccustomerid = bd_cum.pk_cumandoc
left join bd_cubasdoc cubas on bd_cum.pk_cubasdoc = cubas.pk_cubasdoc
left join bd_salestru bd_salees on main.csalecorpid = bd_salees.csalestruid
left join bd_calbody calbody on main.ccalbodyid = calbody.pk_calbody
left join bd_busitype busi on cbiztype = busi.pk_busitype
left join bd_cumandoc bd_cum1 on main.creceiptcustomerid = bd_cum1.pk_cumandoc
left join bd_cubasdoc cubas1 on bd_cum1.pk_cubasdoc = cubas1.pk_cubasdoc
left join bd_cumandoc bd_cum2 on main.creceiptcorpid = bd_cum2.pk_cumandoc
left join bd_cubasdoc cubas2 on bd_cum2.pk_cubasdoc = cubas2.pk_cubasdoc
left join bd_corp corp on corp.pk_corp = main.pk_corp
where vdef1 is null
and capproveid is not null
<if test="csaleId!=null and csaleId!=''"> and csaleid = #{csaleId} </if>
</select>
<update id="updateState" parameterType="com.hzya.frame.u8c.sosale.entity.SoSaleEntity">
update so_sale set
vdef1 = #{state}
where csaleid = #{csaleId}
</update>
</mapper>

View File

@ -0,0 +1,143 @@
package com.hzya.frame.u8c.sosale.entity;
import com.hzya.frame.web.entity.BaseEntity;
public class SoSaleLineEntity extends BaseEntity {
private String csaleId;//销售订单主表ID
private String cinvbasdocid;
private String invcode;
private String invname;
private String invspec;
private String invtype;
private String measname ;
private String nnumber;// 数量
private String noriginalcurprice;// 无税单价
private String ntaxrate; // 税率
private String noriginalcurtaxprice; // 含税单价
private String noriginalcurmny; // 无税金额
private String noriginalcursummny; // 价税合计
private String blargessflag; // 是否赠品
private String frownote;
public String getCinvbasdocid() {
return cinvbasdocid;
}
public void setCinvbasdocid(String cinvbasdocid) {
this.cinvbasdocid = cinvbasdocid;
}
public String getInvcode() {
return invcode;
}
public void setInvcode(String invcode) {
this.invcode = invcode;
}
public String getInvname() {
return invname;
}
public void setInvname(String invname) {
this.invname = invname;
}
public String getInvspec() {
return invspec;
}
public void setInvspec(String invspec) {
this.invspec = invspec;
}
public String getInvtype() {
return invtype;
}
public void setInvtype(String invtype) {
this.invtype = invtype;
}
public String getMeasname() {
return measname;
}
public void setMeasname(String measname) {
this.measname = measname;
}
public String getNnumber() {
return nnumber;
}
public void setNnumber(String nnumber) {
this.nnumber = nnumber;
}
public String getNoriginalcurprice() {
return noriginalcurprice;
}
public void setNoriginalcurprice(String noriginalcurprice) {
this.noriginalcurprice = noriginalcurprice;
}
public String getNtaxrate() {
return ntaxrate;
}
public void setNtaxrate(String ntaxrate) {
this.ntaxrate = ntaxrate;
}
public String getNoriginalcurtaxprice() {
return noriginalcurtaxprice;
}
public void setNoriginalcurtaxprice(String noriginalcurtaxprice) {
this.noriginalcurtaxprice = noriginalcurtaxprice;
}
public String getNoriginalcurmny() {
return noriginalcurmny;
}
public void setNoriginalcurmny(String noriginalcurmny) {
this.noriginalcurmny = noriginalcurmny;
}
public String getNoriginalcursummny() {
return noriginalcursummny;
}
public void setNoriginalcursummny(String noriginalcursummny) {
this.noriginalcursummny = noriginalcursummny;
}
public String getBlargessflag() {
return blargessflag;
}
public void setBlargessflag(String blargessflag) {
this.blargessflag = blargessflag;
}
public String getFrownote() {
return frownote;
}
public void setFrownote(String frownote) {
this.frownote = frownote;
}
public String getCsaleId() {
return csaleId;
}
public void setCsaleId(String csaleId) {
this.csaleId = csaleId;
}
}

View File

@ -0,0 +1,53 @@
<?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.u8c.sosale.dao.impl.SoSaleLineDaoImpl">
<resultMap id="get-SoSaleLineEntity-result" type="com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity" >
<result property="csaleid" column="csaleid" jdbcType="VARCHAR"/>
<result property="cinvbasdocid" column="cinvbasdocid" jdbcType="VARCHAR"/>
<result property="invcode" column="invcode" jdbcType="VARCHAR"/>
<result property="invname" column="invname" jdbcType="VARCHAR"/>
<result property="invspec" column="invspec" jdbcType="VARCHAR"/>
<result property="invtype" column="invtype" jdbcType="VARCHAR"/>
<result property="measname" column="measname" jdbcType="VARCHAR"/>
<result property="nnumber" column="nnumber" jdbcType="VARCHAR"/>
<result property="noriginalcurprice" column="noriginalcurprice" jdbcType="VARCHAR"/>
<result property="ntaxrate" column="ntaxrate" jdbcType="VARCHAR"/>
<result property="noriginalcurtaxprice" column="noriginalcurtaxprice" jdbcType="VARCHAR"/>
<result property="noriginalcurmny" column="noriginalcurmny" jdbcType="VARCHAR"/>
<result property="blargessflag" column="blargessflag" jdbcType="VARCHAR"/>
<result property="frownote" column="frownote" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<!-- 分页查询列表 采用like格式 -->
<select id="querySaleLine" resultType="com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity" parameterType = "com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity">
select
csaleid,
cinvbasdocid,
basdoc.invcode,
basdoc.invname,
basdoc.invspec,
basdoc.invtype,
measdoc.measname ,
nnumber,-- 数量
noriginalcurprice,-- 无税单价
ntaxrate, -- 税率
noriginalcurtaxprice, -- 含税单价
noriginalcurmny, -- 无税金额
noriginalcursummny, -- 价税合计
case
when blargessflag ='N' then '否'
when blargessflag ='Y' then '是'
else blargessflag end as blargessflag, -- 是否赠品
frownote
from so_saleorder_b order_b
left join bd_invbasdoc basdoc on order_b.cinvbasdocid = basdoc.pk_invbasdoc
left join bd_measdoc measdoc on measdoc.pk_measdoc = basdoc.pk_measdoc
<if test="csaleId!=null and csaleId!=''"> where csaleid = #{csaleId} </if>
</select>
</mapper>

View File

@ -0,0 +1,22 @@
package com.hzya.frame.u8c.sosale.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import java.util.List;
public interface ISoSaleService extends IBaseService<SoSaleEntity, String> {
/**
*
* @content 获取U8C销售订单同步OA销售合同
* @className: Administrator
* @author laborer
* @date 2024-10-16 15:22
*
*/
JsonResultEntity getU8cSaleToOa(JSONObject requestJson);
}

View File

@ -0,0 +1,328 @@
package com.hzya.frame.u8c.sosale.service.impl;
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.bip.v3.v2207.util.BipUtil;
import com.hzya.frame.seeyon.util.RestUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.u8c.sosale.dao.ISoSaleDao;
import com.hzya.frame.u8c.sosale.dao.ISoSaleLineDao;
import com.hzya.frame.u8c.sosale.entity.SoSaleEntity;
import com.hzya.frame.u8c.sosale.entity.SoSaleLineEntity;
import com.hzya.frame.u8c.sosale.service.ISoSaleService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service(value = "SoSaleServiceImpl")
public class SoSaleServiceImpl extends BaseService<SoSaleEntity, String> implements ISoSaleService {
Logger logger = LoggerFactory.getLogger(SoSaleServiceImpl.class);
@Autowired
private ISoSaleDao u8cSaleDao;
@Autowired
private ISoSaleLineDao saleLineDao;
@Autowired
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
/**
*
* @content 获取U8C销售订单同步OA销售合同
* @className: Administrator
* @author laborer
* @date 2024-10-16 15:22
*
*/
@Override
public JsonResultEntity getU8cSaleToOa(JSONObject requestJson) {
//获取重推信息id并记录日志
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
String interId = requestJsonObj.getString("integration_task_living_details_id");
logger.info("U8C销售订单推送OA重推解析后"+requestJsonObj.toString());
logger.info("U8C销售订单推送OA重新执行的任务主键"+interId);
//更换数据源
JsonResultEntity resultEntity = new JsonResultEntity();
SoSaleEntity entity = new SoSaleEntity();
requestJson.put("db_code","dongjinU8C");
entity.setDataSourceCode(requestJson.getString("db_code"));
//根据重推信息id查询该条重推记录信息
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
if(StrUtil.isNotEmpty(interId)){
oldMsg = taskLivingDetailsService.get(interId);
}
String rootAppPk = oldMsg.getRootAppPk();
entity.setId(rootAppPk);
StrUtil.isEmpty(rootAppPk);//entity.setQueryState("查询");
//如果是重推是否通过entity传入的id只能查到一条数据
//entity.setId("-8845102890648320822");
List<SoSaleEntity> soleList = u8cSaleDao.getU8cSale(entity);
logger.info("销售订单查询数据{}",JSONObject.toJSONString(soleList));
if(CollectionUtils.isNotEmpty(soleList)){
soleList.forEach(sale -> {
try{
//获取明细数据进行拼接
String csaleId = sale.getCsaleId();
if(!StrUtil.isEmpty(csaleId)){
SoSaleLineEntity line = new SoSaleLineEntity();
line.setCsaleId(csaleId);
line.setDataSourceCode(requestJson.getString("db_code"));
List<SoSaleLineEntity> lineList = saleLineDao.getU8cSaleLine(line);
logger.info("销售订单明细查询数据{}",JSONObject.toJSONString(lineList));
sale.setSaleLineList(lineList);
logger.info("组装数据");
JSONObject main = bindingAdd(sale);
logger.info("销售订单推送数据:"+main.toString());
String result = RestUtil.sendU8CToOA(main.toString(),"8000340003",sale.getUser_code());
logger.info("销售订单推送结果:"+result);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(sale.getCsaleId());
logDetails.setRootAppBill(sale.getBillCode());
logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(sale));
logDetails.setPluginId("SaleConPlugin");
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getString("code").equals("0");
if(flag){
// 推送成功更新状态
sale.setState("Y");
}else{
// 推送失败
sale.setState("N");
}
sale.setDataSourceCode(requestJson.getString("db_code"));
try{
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);
}
}
}catch (Exception e){
logger.info("保存日志失败"+e.getMessage());
u8cSaleDao.updateState(sale);
e.printStackTrace();
}
u8cSaleDao.updateState(sale);
}
} catch (Exception e) {
logger.info("销售订单执行失败"+e.getMessage());
e.printStackTrace();
}
});
}
return new JsonResultEntity("成功",true,resultEntity);
}
/**
*
* @content 组装销售订单数据
* @className: Administrator
* @author laborer
* @date 2024-10-16 15:34
*
*/
private JSONObject bindingAdd(SoSaleEntity rec) {
JSONObject main = new JSONObject();
main.put("formCode","formmain_0047");
// main.put("loginName",rec.getUser_code());
main.put("loginName","yuqh");
main.put("rightId","-8974880151631871438.3094438342688065626");
JSONArray dataList = new JSONArray();
JSONObject dataListObj = new JSONObject();
JSONObject masterTable = new JSONObject();
JSONArray subTables = new JSONArray();
dataListObj.put("masterTable", masterTable);
masterTable.put("name","formmain_0047");
JSONObject record = new JSONObject();
record.put("id","-4921737319255610298");
JSONArray fields = new JSONArray();
JSONObject field0001 = new JSONObject();//单据号
field0001.put("showValue",rec.getBillCode());
field0001.put("name","field0001");
field0001.put("value",rec.getBillCode());
fields.add(field0001);
JSONObject field0004 = new JSONObject();//单据日期
field0004.put("showValue",rec.getDapprovedate());
field0004.put("name","field0004");
field0004.put("value",rec.getDapprovedate());
fields.add(field0004);
JSONObject field0033 = new JSONObject();//合同编号
field0033.put("showValue",rec.getBillCode());
field0033.put("name","field0033");
field0033.put("value",rec.getBillCode());
fields.add(field0033);
JSONObject field0014 = new JSONObject();//客户名称
field0014.put("showValue",rec.getCustname());
field0014.put("name","field0014");
field0014.put("value",rec.getBillCode());
fields.add(field0014);
JSONObject field0045 = new JSONObject();//客户编码
field0045.put("showValue",rec.getCustcode());
field0045.put("name","field0045");
field0045.put("value",rec.getCustcode());
fields.add(field0045);
JSONObject field0005 = new JSONObject();//销售组织
field0005.put("showValue",rec.getVsalestruname());
field0005.put("name","field0005");
field0005.put("value",rec.getBillCode());
fields.add(field0005);
JSONObject field0006 = new JSONObject();//库存组织
field0006.put("showValue",rec.getBodyname());
field0006.put("name","field0006");
field0006.put("value",rec.getBodyname());
fields.add(field0006);
JSONObject field0007 = new JSONObject();//收货单位
field0007.put("showValue",rec.getShname());
field0007.put("name","field0007");
field0007.put("value",rec.getShname());
fields.add(field0007);
JSONObject field0009 = new JSONObject();//开票单位
field0009.put("showValue",rec.getKpname());
field0009.put("name","field0009");
field0009.put("value",rec.getKpname());
fields.add(field0009);
JSONObject field0013 = new JSONObject();//业务流程
field0013.put("showValue",rec.getBusiname());
field0013.put("name","field0013");
field0013.put("value",rec.getBusiname());
fields.add(field0013);
JSONObject field0018 = new JSONObject();//备注
field0018.put("showValue",rec.getVnote());
field0018.put("name","field0018");
field0018.put("value",rec.getVnote());
fields.add(field0018);
record.put("fields",fields);
masterTable.put("record",record);
if(CollectionUtils.isNotEmpty(rec.getSaleLineList())){
rec.getSaleLineList().forEach(line->{
JSONObject subTablesObj = new JSONObject();
JSONArray records = new JSONArray();
JSONObject field0020 = new JSONObject();//存货编号
field0020.put("showValue",line.getInvcode());
field0020.put("name","field0020");
field0020.put("value",line.getInvcode());
records.add(field0020);
JSONObject field0021 = new JSONObject();//存货名称
field0021.put("showValue",line.getInvname());
field0021.put("name","field0021");
field0021.put("value",line.getInvname());
records.add(field0021);
JSONObject field0022 = new JSONObject();//规格
field0022.put("showValue",line.getInvspec());
field0022.put("name","field0022");
field0022.put("value",line.getInvspec());
records.add(field0022);
JSONObject field0023 = new JSONObject();//型号
field0023.put("showValue",line.getInvtype());
field0023.put("name","field0023");
field0023.put("value",line.getInvtype());
records.add(field0023);
JSONObject field0024 = new JSONObject();//单位
field0024.put("showValue",line.getMeasname());
field0024.put("name","field0024");
field0024.put("value",line.getMeasname());
records.add(field0024);
JSONObject field0025 = new JSONObject();//数量
field0025.put("showValue",line.getNnumber());
field0025.put("name","field0025");
field0025.put("value",line.getNnumber());
records.add(field0025);
JSONObject field0026 = new JSONObject();//无税单价
field0026.put("showValue",line.getNoriginalcurprice());
field0026.put("name","field0026");
field0026.put("value",line.getNoriginalcurprice());
records.add(field0026);
JSONObject field0027 = new JSONObject();//税率
field0027.put("showValue",line.getNtaxrate());
field0027.put("name","field0027");
field0027.put("value",line.getNtaxrate());
records.add(field0027);
JSONObject field0028 = new JSONObject();//含税单价
field0028.put("showValue",line.getNoriginalcurtaxprice());
field0028.put("name","field0028");
field0028.put("value",line.getNoriginalcurtaxprice());
records.add(field0028);
JSONObject field0029 = new JSONObject();//无税金额
field0029.put("showValue",line.getNoriginalcurmny());
field0029.put("name","field0029");
field0029.put("value",line.getNoriginalcurmny());
records.add(field0029);
JSONObject field0030 = new JSONObject();//价税合计
field0030.put("showValue",line.getNoriginalcursummny());
field0030.put("name","field0030");
field0030.put("value",line.getNoriginalcursummny());
records.add(field0030);
JSONObject field0031 = new JSONObject();//是否赠品
field0031.put("showValue",line.getBlargessflag());
field0031.put("name","field0031");
field0031.put("value",line.getBlargessflag());
records.add(field0031);
JSONObject field0032 = new JSONObject();//合同编号
field0032.put("showValue",line.getFrownote());
field0032.put("name","field0032");
field0032.put("value",line.getFrownote());
records.add(field0032);
subTablesObj.put("name","formson_0048");
subTablesObj.put("records",records);
subTables.add(subTablesObj);
});
}
dataListObj.put("subTables", subTables);
dataList.add(dataListObj);
main.put("dataList",dataList);
return main;
}
}

View File

@ -128,8 +128,8 @@ public class EntranceServiceImpl implements IEntranceService {
//}
// 接口权限验证 结束
} catch (NotLoginException e) {
logger.error("token无效");
return BaseResult.getFailureMessageEntity("token无效");
logger.error("zt-token无效");
return BaseResult.getFailureMessageEntity("zt-token无效");
}
}
JSONObject jsonObject = new JSONObject();

View File

@ -63,13 +63,13 @@ public class ExceptionController {
if (notLoginException.getType().equals(NotLoginException.NOT_TOKEN)) {
message = "未提供token";
} else if (notLoginException.getType().equals(NotLoginException.INVALID_TOKEN)) {
message = "token无效";
message = "zt-token无效";
} else if (notLoginException.getType().equals(NotLoginException.TOKEN_TIMEOUT)) {
message = "token已过期";
message = "zt-token已过期";
} else if (notLoginException.getType().equals(NotLoginException.BE_REPLACED)) {
message = "token已被顶下线";
message = "zt-token已被顶下线";
} else if (notLoginException.getType().equals(NotLoginException.KICK_OUT)) {
message = "token已被踢下线";
message = "zt-token已被踢下线";
} else {
message = "当前会话未登录";
}

View File

@ -18,7 +18,7 @@ public class SaTokenConfigure {
@Primary
public SaTokenConfig getSaTokenConfigPrimary() {
SaTokenConfig config = new SaTokenConfig();
config.setTokenName("token"); // token名称 (同时也是cookie名称)
config.setTokenName("zt-token"); // token名称 (同时也是cookie名称)
config.setTimeout(30 * 24 * 60 * 60); // token有效期单位s 默认30天
config.setActivityTimeout(-1); // token临时有效期 (指定时间内无操作就视为token过期) 单位:
config.setIsConcurrent(true); // 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)