Merge remote-tracking branch 'origin/release' into release

release
zhenghaiyang@ele-cloud.com 2 years ago
commit 75805c5acb
  1. 6
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/config/BaseServiceConfig.java
  2. 1
      order-management-common/src/main/java/com/dxhy/order/constant/OrderInfoEnum.java
  3. 27
      order-management-consumer/src/main/java/com/dxhy/order/consumer/dao/GsClientMapper.java
  4. 103
      order-management-consumer/src/main/java/com/dxhy/order/consumer/handle/GetGsClientTask.java
  5. 16
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java
  6. 19
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/model/GsClient.java
  7. 111
      order-management-consumer/src/main/resources/mybatis/mapper/GsClientMapper.xml

@ -277,6 +277,12 @@ public class BaseServiceConfig{
@Value("${order.openApiNew.apiUrl:}") @Value("${order.openApiNew.apiUrl:}")
private String openApiNewApiUrl; private String openApiNewApiUrl;
/**
* 调用山能PO url
*/
@Value("${order.push.po.url:}")
private String poUrl;
/** /**
* 调用山能PO username * 调用山能PO username
*/ */

@ -1254,6 +1254,7 @@ public enum OrderInfoEnum {
INTERFACE_BUSINESS_ID_FPKJTS("FI843","发票开具回推"), INTERFACE_BUSINESS_ID_FPKJTS("FI843","发票开具回推"),
INTERFACE_BUSINESS_ID_FPKJ("FI840","发票开具"), INTERFACE_BUSINESS_ID_FPKJ("FI840","发票开具"),
INTERFACE_BUSINESS_ID_FPZFTS("FI844","发票作废回推"), INTERFACE_BUSINESS_ID_FPZFTS("FI844","发票作废回推"),
INTERFACE_BUSINESS_ID_GSCLIENT("FI846","获取公司client"),
INTERFACE_BUSINESS_ID_DDZTGX("FI841","订单状态更新"), INTERFACE_BUSINESS_ID_DDZTGX("FI841","订单状态更新"),
INTERFACE_BUSINESS_ID_JXTBSHUJU("FI847","自动认证"), INTERFACE_BUSINESS_ID_JXTBSHUJU("FI847","自动认证"),
INTERFACE_BUSINESS_ID_JXSZC("FI849","进项税转出"), INTERFACE_BUSINESS_ID_JXSZC("FI849","进项税转出"),

@ -0,0 +1,27 @@
package com.dxhy.order.consumer.dao;
import com.dxhy.order.consumer.modules.order.model.GsClient;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface GsClientMapper {
int deleteByPrimaryKey(Integer id);
int deleteAll();
int insert(GsClient record);
int insertSelective(GsClient record);
int insertList(@Param("list") List<GsClient> recordList);
GsClient selectByPrimaryKey(Integer id);
List<GsClient> selectByGsdm(String gsdm);
int updateByPrimaryKeySelective(GsClient record);
int updateByPrimaryKey(GsClient record);
}

@ -0,0 +1,103 @@
package com.dxhy.order.consumer.handle;
import cn.hutool.core.util.ObjectUtil;
import com.dxhy.order.baseservice.config.BaseServiceConfig;
import com.dxhy.order.constant.OrderInfoContentEnum;
import com.dxhy.order.constant.OrderInfoEnum;
import com.dxhy.order.consumer.dao.GsClientMapper;
import com.dxhy.order.consumer.modules.order.model.GsClient;
import com.dxhy.order.consumer.modules.order.service.OrderCommonService;
import com.dxhy.order.consumer.openapi.protocol.po.EsOutput;
import com.dxhy.order.consumer.openapi.protocol.po.IsInput;
import com.dxhy.order.consumer.openapi.protocol.po.PoCommonRequestParam;
import com.dxhy.order.consumer.openapi.protocol.po.PoCommonResponseParam;
import com.dxhy.order.utils.HttpUtils;
import com.dxhy.order.utils.JsonUtils;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 从SAP拉取公司client
*/
@Slf4j
@Component
@JobHandler(value = "/getGsClient")
public class GetGsClientTask extends IJobHandler {
private static final String LOGGER_MSG = "(SAP获取公司client)";
@Resource
private BaseServiceConfig baseServiceConfig;
@Resource
private OrderCommonService apiInvoiceCommonMapperService;
@Resource
private GsClientMapper gsClientMapper;
@Override
public ReturnT<String> execute(String s) {
try {
log.debug("{}任务开始", LOGGER_MSG);
long startTime = System.currentTimeMillis();
List<GsClient> list = new ArrayList<>();
String poClient = baseServiceConfig.getPoClient();
String[] clientSplit = poClient.split(",");
for(int i=0;i<clientSplit.length;i++){
String client = clientSplit[i];
IsInput isInput = new IsInput();
isInput.setSYSID(OrderInfoEnum.SYS_SIGN_FP.getKey());
isInput.setIFYWID(OrderInfoEnum.INTERFACE_BUSINESS_ID_GSCLIENT.getKey());
isInput.setBSKEY(apiInvoiceCommonMapperService.getGenerateShotKey());
isInput.setZORG("");
isInput.setZFILED5(client);
isInput.setZDATA("");
PoCommonRequestParam poCommonRequestParam = new PoCommonRequestParam();
poCommonRequestParam.setIS_INPUT(isInput);
String param = JsonUtils.getInstance().toJsonString(poCommonRequestParam);
log.info("{}获取公司client入参:{}",LOGGER_MSG,param);
String result = HttpUtils.sendPo(baseServiceConfig.getPoUrl(), param,baseServiceConfig.getPoUserName(),baseServiceConfig.getPoPassword());
log.info("{}获取公司client出参:{}",LOGGER_MSG,result);
PoCommonResponseParam poCommonResponseParam = JsonUtils.getInstance().parseObject(result, PoCommonResponseParam.class);
EsOutput es_output = poCommonResponseParam.getES_OUTPUT();
String ztype = es_output.getZTYPE();
String zmessage = es_output.getZMESSAGE();
Object zdata = es_output.getZDATA();
if(OrderInfoContentEnum.INVOICE_ERROR_CODE_OP_S.getKey().equals(ztype)){
List<Map<String,String>> gsClientList = JsonUtils.getInstance().parseObject(zdata.toString(), List.class);
gsClientList.stream().forEach(f -> {
GsClient gsClient = new GsClient();
gsClient.setGsdm(ObjectUtil.isNull(f.get("BUKRS"))?"":f.get("BUKRS").toString());
gsClient.setGsmc(ObjectUtil.isNull(f.get("BUTXT"))?"":f.get("BUTXT").toString());
gsClient.setClient(ObjectUtil.isNull(f.get("MANDT"))?"":f.get("MANDT").toString());
gsClient.setCreateTime(new Date());
list.add(gsClient);
});
}else {
log.error("{}client:{},获取公司client出错:{}",LOGGER_MSG,client,zmessage);
}
}
log.info("{}删除gs_client表数据",LOGGER_MSG);
gsClientMapper.deleteAll();
log.info("{}插入gs_client表",LOGGER_MSG);
gsClientMapper.insertList(list);
long endTime = System.currentTimeMillis();
log.debug("{}任务结束,耗时:{}", LOGGER_MSG, endTime - startTime);
} catch (Exception e) {
log.error("{}定时任务执行异常:{}", LOGGER_MSG, e);
return FAIL;
}
return SUCCESS;
}
}

@ -12,6 +12,7 @@ import com.dxhy.order.baseservice.module.thirdservice.redis.service.RedisService
import com.dxhy.order.baseservice.module.thirdservice.simsback.service.SimsBackService; import com.dxhy.order.baseservice.module.thirdservice.simsback.service.SimsBackService;
import com.dxhy.order.constant.*; import com.dxhy.order.constant.*;
import com.dxhy.order.consumer.config.OpenApiConfig; import com.dxhy.order.consumer.config.OpenApiConfig;
import com.dxhy.order.consumer.dao.GsClientMapper;
import com.dxhy.order.consumer.model.protocol.CommonResponse; import com.dxhy.order.consumer.model.protocol.CommonResponse;
import com.dxhy.order.consumer.model.protocol.ResponseData; import com.dxhy.order.consumer.model.protocol.ResponseData;
import com.dxhy.order.consumer.model.protocol.ResponseStatus; import com.dxhy.order.consumer.model.protocol.ResponseStatus;
@ -19,6 +20,7 @@ import com.dxhy.order.consumer.modules.jdjos.service.PushInvoiceToJdJosService;
import com.dxhy.order.consumer.modules.manager.model.OpenTextResult; import com.dxhy.order.consumer.modules.manager.model.OpenTextResult;
import com.dxhy.order.consumer.modules.manager.service.PushInvoiceService; import com.dxhy.order.consumer.modules.manager.service.PushInvoiceService;
import com.dxhy.order.consumer.modules.manager.service.QuickCodeInfoService; import com.dxhy.order.consumer.modules.manager.service.QuickCodeInfoService;
import com.dxhy.order.consumer.modules.order.model.GsClient;
import com.dxhy.order.consumer.modules.order.service.OrderCommonService; import com.dxhy.order.consumer.modules.order.service.OrderCommonService;
import com.dxhy.order.consumer.modules.order.service.OrderInfoService; import com.dxhy.order.consumer.modules.order.service.OrderInfoService;
import com.dxhy.order.consumer.modules.order.service.OrderItemInfoService; import com.dxhy.order.consumer.modules.order.service.OrderItemInfoService;
@ -157,6 +159,9 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
@Resource @Resource
private BaseServiceConfig baseServiceConfig; private BaseServiceConfig baseServiceConfig;
@Resource
private GsClientMapper gsClientMapper;
private final static Map smMap = new HashMap() {{ private final static Map smMap = new HashMap() {{
put(new BigDecimal("0"), "X0"); put(new BigDecimal("0"), "X0");
put(new BigDecimal("0.16"), "X1"); put(new BigDecimal("0.16"), "X1");
@ -388,7 +393,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
Map<String, String> requestMap = commonDisposeService.getRequestParameter(pushInfo.getNsrsbh(), pushInfo.getZipCode(), pushInfo.getEncryptCode(), content, pushInfo.getPushUrl(), pushInfo.getInterfaceType(), pushInfo.getVersionIdent()); Map<String, String> requestMap = commonDisposeService.getRequestParameter(pushInfo.getNsrsbh(), pushInfo.getZipCode(), pushInfo.getEncryptCode(), content, pushInfo.getPushUrl(), pushInfo.getInterfaceType(), pushInfo.getVersionIdent());
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){ if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){
fptsParam = convertToYwxtParam(fpTsMqData,xtly,content,baseServiceConfig.getPoClient()); fptsParam = convertToYwxtParam(fpTsMqData,xtly,content);
}else { }else {
fptsParam = JsonUtils.getInstance().toJsonString(requestMap); fptsParam = JsonUtils.getInstance().toJsonString(requestMap);
} }
@ -955,7 +960,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
return content; return content;
} }
public String convertToYwxtParam(CommonTsMqData fpTsMqData,String xtly,String content,String poClient){ public String convertToYwxtParam(CommonTsMqData fpTsMqData,String xtly,String content){
String ywxtParam = ""; String ywxtParam = "";
@ -964,6 +969,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
OrderInvoiceInfo orderInvoiceInfo1 = new OrderInvoiceInfo(); OrderInvoiceInfo orderInvoiceInfo1 = new OrderInvoiceInfo();
orderInvoiceInfo1.setFpqqlsh(orderProcessInfo.getFpqqlsh()); orderInvoiceInfo1.setFpqqlsh(orderProcessInfo.getFpqqlsh());
OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfo(orderInvoiceInfo1, null); OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfo(orderInvoiceInfo1, null);
List<GsClient> gsClients = gsClientMapper.selectByGsdm(orderProcessInfo.getGsdm());
//发票开具推送 //发票开具推送
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){ if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){
@ -1025,7 +1031,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
isInput.setIFYWID(OrderInfoEnum.INTERFACE_BUSINESS_ID_FPKJTS.getKey()); isInput.setIFYWID(OrderInfoEnum.INTERFACE_BUSINESS_ID_FPKJTS.getKey());
isInput.setBSKEY(apiInvoiceCommonMapperService.getGenerateShotKey()); isInput.setBSKEY(apiInvoiceCommonMapperService.getGenerateShotKey());
isInput.setZORG(""); isInput.setZORG("");
isInput.setZFILED5(poClient); isInput.setZFILED5(gsClients.size()>0?gsClients.get(0).getClient():"");
mainList.add(fpkjtsReqSap); mainList.add(fpkjtsReqSap);
String jsonString = JsonUtils.getInstance().toJsonString(mainList); String jsonString = JsonUtils.getInstance().toJsonString(mainList);
isInput.setZDATA(jsonString); isInput.setZDATA(jsonString);
@ -1036,6 +1042,8 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
} }
}else if(OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_2.getKey().equals(fpTsMqData.getPushType())){ }else if(OrderInfoEnum.INTERFACE_TYPE_INVOICE_PUSH_STATUS_2.getKey().equals(fpTsMqData.getPushType())){
OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfoByFpdmAndFphm(fpTsMqData.getZfTsMqData().getFpdm(), fpTsMqData.getZfTsMqData().getFphm(), null); OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfoByFpdmAndFphm(fpTsMqData.getZfTsMqData().getFpdm(), fpTsMqData.getZfTsMqData().getFphm(), null);
OrderProcessInfo orderProcessInfo = orderProcessService.selectByOrderId(orderInvoiceInfo.getOrderInfoId(), null);
List<GsClient> gsClients = gsClientMapper.selectByGsdm(orderProcessInfo.getGsdm());
//发票作废推送 //发票作废推送
if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){ if(OrderInfoEnum.SYS_SOURCE_SAP.getKey().equals(xtly)){
ZffptsV5 zffptsV5 = JsonUtils.getInstance().parseObject(content, ZffptsV5.class); ZffptsV5 zffptsV5 = JsonUtils.getInstance().parseObject(content, ZffptsV5.class);
@ -1051,7 +1059,7 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
isInput.setIFYWID(OrderInfoEnum.INTERFACE_BUSINESS_ID_FPZFTS.getKey()); isInput.setIFYWID(OrderInfoEnum.INTERFACE_BUSINESS_ID_FPZFTS.getKey());
isInput.setBSKEY(apiInvoiceCommonMapperService.getGenerateShotKey()); isInput.setBSKEY(apiInvoiceCommonMapperService.getGenerateShotKey());
isInput.setZORG(""); isInput.setZORG("");
isInput.setZFILED5(poClient); isInput.setZFILED5(gsClients.size()>0?gsClients.get(0).getClient():"");
zfList.add(fpzftsReqSap); zfList.add(fpzftsReqSap);
String jsonString = JsonUtils.getInstance().toJsonString(zfList); String jsonString = JsonUtils.getInstance().toJsonString(zfList);
isInput.setZDATA(jsonString); isInput.setZDATA(jsonString);

@ -0,0 +1,19 @@
package com.dxhy.order.consumer.modules.order.model;
import lombok.Data;
import java.util.Date;
@Data
public class GsClient {
private Integer id;
private String gsdm;
private String gsmc;
private String client;
private Date createTime;
}

@ -0,0 +1,111 @@
<?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.dxhy.order.consumer.dao.GsClientMapper" >
<resultMap id="BaseResultMap" type="com.dxhy.order.consumer.modules.order.model.GsClient" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="gsdm" property="gsdm" jdbcType="VARCHAR" />
<result column="gsmc" property="gsmc" jdbcType="VARCHAR" />
<result column="client" property="client" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, gsdm, gsmc, client, create_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from gs_client
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByGsdm" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from gs_client
where gsdm = #{gsdm,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from gs_client
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteAll" >
delete from gs_client
</delete>
<insert id="insert" parameterType="com.dxhy.order.consumer.modules.order.model.GsClient" >
insert into gs_client (id, gsdm, gsmc,
client, create_time)
values (#{id,jdbcType=INTEGER}, #{gsdm,jdbcType=VARCHAR}, #{gsmc,jdbcType=VARCHAR},
#{client,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.dxhy.order.consumer.modules.order.model.GsClient" >
insert into gs_client
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="gsdm != null" >
gsdm,
</if>
<if test="gsmc != null" >
gsmc,
</if>
<if test="client != null" >
client,
</if>
<if test="createTime != null" >
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="gsdm != null" >
#{gsdm,jdbcType=VARCHAR},
</if>
<if test="gsmc != null" >
#{gsmc,jdbcType=VARCHAR},
</if>
<if test="client != null" >
#{client,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.dxhy.order.consumer.modules.order.model.GsClient" >
update gs_client
<set >
<if test="gsdm != null" >
gsdm = #{gsdm,jdbcType=VARCHAR},
</if>
<if test="gsmc != null" >
gsmc = #{gsmc,jdbcType=VARCHAR},
</if>
<if test="client != null" >
client = #{client,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.dxhy.order.consumer.modules.order.model.GsClient" >
update gs_client
set gsdm = #{gsdm,jdbcType=VARCHAR},
gsmc = #{gsmc,jdbcType=VARCHAR},
client = #{client,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="insertList" parameterType="java.util.List" useGeneratedKeys="false">
insert into gs_client (gsdm,gsmc,client,create_time)
values
<foreach collection="list" item="item" index="index"
separator=",">
(#{item.gsdm,jdbcType=VARCHAR}, #{item.gsmc,jdbcType=VARCHAR},
#{item.client,jdbcType=VARCHAR},#{item.createTime,jdbcType=TIMESTAMP})
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save