Compare commits

...

15 Commits

  1. 5
      order-management-common/src/main/java/com/dxhy/order/model/sk/fg/SpFpXeMxDto.java
  2. 20
      order-management-consumer/pom.xml
  3. 30
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/bigdata/util/ProXml.java
  4. 236
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/jdjos/service/impl/PushInvoiceToJdJosServiceImpl.java
  5. 30
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/jdjos/utils/ProXml.java
  6. 73
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/controller/InvoiceReceiveController.java
  7. 14
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/model/PushTicketModel.java
  8. 7
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/manager/service/impl/PushInvoiceServiceImpl.java
  9. 38
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/HomeBoardServiceImpl.java
  10. 2
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/MakeOutAnInvoiceServiceImpl.java
  11. 2
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/OrderInfoServiceImpl.java
  12. 33
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/service/impl/FangGeInterfaceServiceImpl.java
  13. 866
      order-management-consumer/src/main/java/com/dxhy/order/consumer/utils/DateUtils.java
  14. 17
      order-management-invoice/src/main/java/com/dxhy/order/invoice/config/InvoiceConfig.java
  15. 19
      order-management-invoice/src/main/java/com/dxhy/order/invoice/module/fangge/service/impl/FangGeServiceImpl.java
  16. 2
      order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/dao/OrderInvoiceInfoMapper.java
  17. 1
      order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/OrderInvoiceInfoService.java
  18. 5
      order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/impl/OrderInvoiceInfoServiceImpl.java
  19. 29
      order-management-invoice/src/main/java/com/dxhy/order/invoice/module/invoice/service/impl/UnifyServiceImpl.java
  20. 12
      order-management-invoice/src/main/resources/mybatis/mapper/OrderInvoiceInfoMapper.xml

@ -35,6 +35,11 @@ public class SpFpXeMxDto implements Serializable {
*/
private String cpyqylx;
/**
* 二手车标识
*/
private String escbs;
/**
* 发票种类明细
*/

@ -464,11 +464,11 @@
<!-- 京东宙斯对接SDK -->
<dependency>
<groupId>com.jd</groupId>
<artifactId>open-api-sdk</artifactId>
<version>2.2</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.jd</groupId>-->
<!--<artifactId>open-api-sdk</artifactId>-->
<!--<version>2.2</version>-->
<!--</dependency>-->
<!-- 京东宙斯对接SDK依赖包 -->
<!-- 大数据服务依赖包 -->
<dependency>
@ -478,11 +478,11 @@
</dependency>
<!-- 京东宙斯对接SDK依赖包 -->
<!-- 大数据服务依赖包 -->
<dependency>
<groupId>com.aisino</groupId>
<artifactId>aisinoutils</artifactId>
<version>1.0</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.aisino</groupId>-->
<!--<artifactId>aisinoutils</artifactId>-->
<!--<version>1.0</version>-->
<!--</dependency>-->
<!-- 京东宙斯对接SDK依赖包 -->
<!-- 大数据服务依赖包 -->
<dependency>

@ -10,7 +10,7 @@
package com.dxhy.order.consumer.modules.bigdata.util;
import com.aisino.common.util.XMLShellFactory;
//import com.aisino.common.util.XMLShellFactory;
import com.dxhy.order.constant.ConfigureConstant;
import com.dxhy.order.utils.Base64Encoding;
import com.dxhy.order.utils.GbkUtil;
@ -214,7 +214,7 @@ public class ProXml {
public static String makeFirstLayerXml(BigDataGlobalInfo glo, Object reqObj, String encryptCode) {
BigDataReturnStateInfo rs = ProXml.getReturnStateInfo(XmlPar.BUSI_SSUCCESS, "");
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLShellFactory.newInstance().saveXml(out, reqObj);
// XMLShellFactory.newInstance().saveXml(out, reqObj);
BigDataData data = ProXml.getData(out, encryptCode, false);
return ProXml.getXml(glo, rs, data);
}
@ -266,25 +266,25 @@ public class ProXml {
/**
* <p>获取二层协议中的协议对象</p>
*
* @param xml
* @param
* @return
* @throws Exception List
* @author: jerome.wang
* @date: Created on 2016-5-11 下午02:33:25
*/
@SuppressWarnings("AlibabaUndefineMagicConstant")
public static List getDataRoot(String xml) throws Exception {
String xmlRootStart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <ROOT>";
String xmlRootEnd = "</ROOT>";
if (xml.startsWith("<?xml")) {
XMLShellFactory factory = XMLShellFactory.newInstance();
return (List) factory.generateDomainObject(xml).get(0);
} else {
XMLShellFactory factory = XMLShellFactory.newInstance();
return (List) factory.generateDomainObject(xmlRootStart + xml + xmlRootEnd).get(0);
}
}
// public static List getDataRoot(String xml) throws Exception {
// String xmlRootStart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <ROOT>";
// String xmlRootEnd = "</ROOT>";
// if (xml.startsWith("<?xml")) {
// XMLShellFactory factory = XMLShellFactory.newInstance();
// return (List) factory.generateDomainObject(xml).get(0);
// } else {
// XMLShellFactory factory = XMLShellFactory.newInstance();
// return (List) factory.generateDomainObject(xmlRootStart + xml + xmlRootEnd).get(0);
// }
//
// }
/**
* <p>获取一层协议的data对象</p>

@ -22,19 +22,19 @@ import com.dxhy.order.consumer.modules.jdjos.utils.ProXml;
import com.dxhy.order.invoice.config.InvoiceConfig;
import com.dxhy.order.invoice.module.invoice.model.FileDownLoad;
import com.dxhy.order.invoice.module.invoice.service.OrderInvoiceInfoService;
import com.jd.open.api.sdk.DefaultJdClient;
import com.jd.open.api.sdk.JdClient;
import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.request.updateStateAndLimitMoney.BushuJiChuVo;
import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.request.updateStateAndLimitMoney.BushuZhuangtaiXianeChangeParm;
import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.request.updateStateAndLimitMoney.XianEVo;
import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.response.updateStateAndLimitMoney.DxCommonData;
import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.response.updateStateAndLimitMoney.DxReturnStateInfo;
import com.jd.open.api.sdk.request.e_invoice.JosReceiveInvoiceStateRequest;
import com.jd.open.api.sdk.request.e_invoice.ReceiveInvoicePdfRequest;
import com.jd.open.api.sdk.request.e_invoice.UpdateStateAndLimitMoneyRequest;
import com.jd.open.api.sdk.response.e_invoice.JosReceiveInvoiceStateResponse;
import com.jd.open.api.sdk.response.e_invoice.ReceiveInvoicePdfResponse;
import com.jd.open.api.sdk.response.e_invoice.UpdateStateAndLimitMoneyResponse;
//import com.jd.open.api.sdk.DefaultJdClient;
//import com.jd.open.api.sdk.JdClient;
//import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.request.updateStateAndLimitMoney.BushuJiChuVo;
//import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.request.updateStateAndLimitMoney.BushuZhuangtaiXianeChangeParm;
//import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.request.updateStateAndLimitMoney.XianEVo;
//import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.response.updateStateAndLimitMoney.DxCommonData;
//import com.jd.open.api.sdk.domain.e_invoice.IvcPopEnterpriseJsfService.response.updateStateAndLimitMoney.DxReturnStateInfo;
//import com.jd.open.api.sdk.request.e_invoice.JosReceiveInvoiceStateRequest;
//import com.jd.open.api.sdk.request.e_invoice.ReceiveInvoicePdfRequest;
//import com.jd.open.api.sdk.request.e_invoice.UpdateStateAndLimitMoneyRequest;
//import com.jd.open.api.sdk.response.e_invoice.JosReceiveInvoiceStateResponse;
//import com.jd.open.api.sdk.response.e_invoice.ReceiveInvoicePdfResponse;
//import com.jd.open.api.sdk.response.e_invoice.UpdateStateAndLimitMoneyResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
@ -139,17 +139,17 @@ public class PushInvoiceToJdJosServiceImpl implements PushInvoiceToJdJosService
String pushXml = ProXml.makeFirstLayerXml(new JdJosGlobalInfo(), fpjgxx, ConfigurerInfo.ENCRYPTCODE_0);
JdClient client = new DefaultJdClient(openApiConfig.getJdJosUrl(), "", openApiConfig.getJdJosAppKey(), openApiConfig.getJdJosAppSecret());
ReceiveInvoicePdfRequest request = new ReceiveInvoicePdfRequest();
log.info("{}推送京东宙斯接口,请求参数:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(pushXml));
request.setInvoiceXml(pushXml);
try {
final DateTime begin = DateTime.now();
ReceiveInvoicePdfResponse response = client.execute(request);
log.info("(pushInvoice)流水号:{},返回报文:{}, 耗时{}毫秒", fpjgxx.getFPQQLSH(), JsonUtils.getInstance().toJsonString(response), new Duration(begin, DateTime.now()).getMillis());
} catch (Exception e) {
log.error("(pushInvoice)流水号:{},推送京东jos失败,异常信息:{}", fpjgxx.getFPQQLSH(), e);
}
// JdClient client = new DefaultJdClient(openApiConfig.getJdJosUrl(), "", openApiConfig.getJdJosAppKey(), openApiConfig.getJdJosAppSecret());
// ReceiveInvoicePdfRequest request = new ReceiveInvoicePdfRequest();
// log.info("{}推送京东宙斯接口,请求参数:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(pushXml));
// request.setInvoiceXml(pushXml);
// try {
// final DateTime begin = DateTime.now();
// ReceiveInvoicePdfResponse response = client.execute(request);
// log.info("(pushInvoice)流水号:{},返回报文:{}, 耗时{}毫秒", fpjgxx.getFPQQLSH(), JsonUtils.getInstance().toJsonString(response), new Duration(begin, DateTime.now()).getMillis());
// } catch (Exception e) {
// log.error("(pushInvoice)流水号:{},推送京东jos失败,异常信息:{}", fpjgxx.getFPQQLSH(), e);
// }
return R.ok();
}
@ -162,37 +162,37 @@ public class PushInvoiceToJdJosServiceImpl implements PushInvoiceToJdJosService
try {
JdClient client = new DefaultJdClient(openApiConfig.getJdJosUrl(), "", openApiConfig.getJdJosAppKey(), openApiConfig.getJdJosAppSecret());
JosReceiveInvoiceStateRequest josReceiveInvoiceStateRequest = new JosReceiveInvoiceStateRequest();
josReceiveInvoiceStateRequest.setExpand12("");
josReceiveInvoiceStateRequest.setExpand1("");
josReceiveInvoiceStateRequest.setBusinessId(fpFailTsMqData.getDdh());
josReceiveInvoiceStateRequest.setResultCode(fpFailTsMqData.getDdzt());
josReceiveInvoiceStateRequest.setReqNo(fpFailTsMqData.getFpqqlsh());
josReceiveInvoiceStateRequest.setSource(1);
josReceiveInvoiceStateRequest.setResultMessage(fpFailTsMqData.getDdztxx());
josReceiveInvoiceStateRequest.setTimestamp(DateUtil.now());
log.info("{}推送京东宙斯接口,请求参数:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(josReceiveInvoiceStateRequest));
try {
final DateTime begin = DateTime.now();
JosReceiveInvoiceStateResponse response = client.execute(josReceiveInvoiceStateRequest);
log.info("{}流水号:{},返回报文:{}, 耗时{}毫秒",LOGGER_MSG, fpFailTsMqData.getFpqqlsh(), JsonUtils.getInstance().toJsonString(response), new Duration(begin, DateTime.now()).getMillis());
if(ObjectUtil.isNotNull(response) && StringUtils.isNotBlank(response.getReturnMsg())){
Map map = JsonUtils.getInstance().parseObject(response.getReturnMsg(), Map.class);
if(ConfigureConstant.STRING_0000.equals(map.get(ConfigureConstant.CODE))){
log.info("{}流水号:{},推送宙斯成功,返回报文:{}",LOGGER_MSG, fpFailTsMqData.getFpqqlsh(), response.getReturnMsg());
return R.ok();
}else {
return R.error(map.get("errorMessage"));
}
}else {
return R.error(response.getMsg());
}
} catch (Exception e) {
log.error("{}流水号:{},推送京东jos失败,异常信息:{}",LOGGER_MSG, fpFailTsMqData.getFpqqlsh(), e);
}
// JdClient client = new DefaultJdClient(openApiConfig.getJdJosUrl(), "", openApiConfig.getJdJosAppKey(), openApiConfig.getJdJosAppSecret());
// JosReceiveInvoiceStateRequest josReceiveInvoiceStateRequest = new JosReceiveInvoiceStateRequest();
// josReceiveInvoiceStateRequest.setExpand12("");
// josReceiveInvoiceStateRequest.setExpand1("");
// josReceiveInvoiceStateRequest.setBusinessId(fpFailTsMqData.getDdh());
// josReceiveInvoiceStateRequest.setResultCode(fpFailTsMqData.getDdzt());
// josReceiveInvoiceStateRequest.setReqNo(fpFailTsMqData.getFpqqlsh());
// josReceiveInvoiceStateRequest.setSource(1);
// josReceiveInvoiceStateRequest.setResultMessage(fpFailTsMqData.getDdztxx());
// josReceiveInvoiceStateRequest.setTimestamp(DateUtil.now());
//
// log.info("{}推送京东宙斯接口,请求参数:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(josReceiveInvoiceStateRequest));
// try {
// final DateTime begin = DateTime.now();
// JosReceiveInvoiceStateResponse response = client.execute(josReceiveInvoiceStateRequest);
// log.info("{}流水号:{},返回报文:{}, 耗时{}毫秒",LOGGER_MSG, fpFailTsMqData.getFpqqlsh(), JsonUtils.getInstance().toJsonString(response), new Duration(begin, DateTime.now()).getMillis());
// if(ObjectUtil.isNotNull(response) && StringUtils.isNotBlank(response.getReturnMsg())){
//
// Map map = JsonUtils.getInstance().parseObject(response.getReturnMsg(), Map.class);
// if(ConfigureConstant.STRING_0000.equals(map.get(ConfigureConstant.CODE))){
// log.info("{}流水号:{},推送宙斯成功,返回报文:{}",LOGGER_MSG, fpFailTsMqData.getFpqqlsh(), response.getReturnMsg());
// return R.ok();
// }else {
// return R.error(map.get("errorMessage"));
// }
// }else {
// return R.error(response.getMsg());
// }
// } catch (Exception e) {
// log.error("{}流水号:{},推送京东jos失败,异常信息:{}",LOGGER_MSG, fpFailTsMqData.getFpqqlsh(), e);
// }
} catch (Exception e) {
log.warn("{}推送京东宙斯失败发票数据异常:{}!", LOGGER_MSG,e);
@ -209,69 +209,69 @@ public class PushInvoiceToJdJosServiceImpl implements PushInvoiceToJdJosService
try {
JdClient client = new DefaultJdClient(openApiConfig.getJdJosUrl(), "", openApiConfig.getJdJosAppKey(), openApiConfig.getJdJosAppSecret());
UpdateStateAndLimitMoneyRequest updateStateAndLimitMoneyRequest = new UpdateStateAndLimitMoneyRequest();
BushuZhuangtaiXianeChangeParm bushuZhuangtaiXianeChangeParm = new BushuZhuangtaiXianeChangeParm();
bushuZhuangtaiXianeChangeParm.setNSRMC(jdwjMqData.getNSRMC());
bushuZhuangtaiXianeChangeParm.setBSZT(jdwjMqData.getBSZT());
bushuZhuangtaiXianeChangeParm.setQYID(jdwjMqData.getQYID());
bushuZhuangtaiXianeChangeParm.setTSLX(jdwjMqData.getTSLX());
bushuZhuangtaiXianeChangeParm.setNSRSBH(jdwjMqData.getNSRSBH());
bushuZhuangtaiXianeChangeParm.setBSZTDM(jdwjMqData.getBSZTDM());
bushuZhuangtaiXianeChangeParm.setSouceId(jdwjMqData.getSouceId());
bushuZhuangtaiXianeChangeParm.setType(jdwjMqData.getType());
List<BushuJiChuVo> bushuJiChuVoList = new ArrayList<>();
if(ObjectUtil.isNotEmpty(jdwjMqData.getSBJCXX())){
for (SBJCXXDTO sbjcxx : jdwjMqData.getSBJCXX()) {
BushuJiChuVo bushuJiChuVo = new BushuJiChuVo();
List<XianEVo> xianEVoList = new ArrayList<>();
if(ObjectUtil.isNotEmpty(sbjcxx.getFPLXDMXX())){
for (FPLXDMXXDTO fplxdmxx : sbjcxx.getFPLXDMXX()) {
XianEVo xianEVo = new XianEVo();
xianEVo.setFPLXDM(CommonUtils.transFplxdm(fplxdmxx.getFPLXDM()));
xianEVo.setDZKPXE(fplxdmxx.getDZKPXE());
xianEVoList.add(xianEVo);
}
}
bushuJiChuVo.setJQBH(sbjcxx.getJQBH());
bushuJiChuVo.setFPLXDMXX(xianEVoList);
bushuJiChuVoList.add(bushuJiChuVo);
}
}
bushuZhuangtaiXianeChangeParm.setSBJCXX(bushuJiChuVoList);
updateStateAndLimitMoneyRequest.setParam1(bushuZhuangtaiXianeChangeParm);
log.info("{}推送京东宙斯部署状态数据接口,请求参数:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(updateStateAndLimitMoneyRequest));
try {
final DateTime begin = DateTime.now();
UpdateStateAndLimitMoneyResponse response = client.execute(updateStateAndLimitMoneyRequest);
log.info("{}推送京东宙斯部署状态数据接口,返回报文:{}, 耗时{}毫秒",LOGGER_MSG, JsonUtils.getInstance().toJsonString(response), new Duration(begin, DateTime.now()).getMillis());
if(ObjectUtil.isNotNull(response)){
DxCommonData returnType = response.getReturnType();
if(ObjectUtil.isNotNull(returnType)){
DxReturnStateInfo returnStateInfo = returnType.getReturnStateInfo();
if(ObjectUtil.isNotNull(returnStateInfo)){
if(ConfigureConstant.STRING_000000.equals(returnStateInfo.getReturnCode())){
return R.error(returnStateInfo.getReturnCode(),returnStateInfo.getReturnMessage());
}else {
return R.error(returnStateInfo.getReturnCode(),returnStateInfo.getReturnMessage());
}
}
}
}
} catch (Exception e) {
log.error("{}推送京东宙斯部署状态数据接口,推送京东jos失败,异常信息:{}",LOGGER_MSG, e);
}
// JdClient client = new DefaultJdClient(openApiConfig.getJdJosUrl(), "", openApiConfig.getJdJosAppKey(), openApiConfig.getJdJosAppSecret());
// UpdateStateAndLimitMoneyRequest updateStateAndLimitMoneyRequest = new UpdateStateAndLimitMoneyRequest();
// BushuZhuangtaiXianeChangeParm bushuZhuangtaiXianeChangeParm = new BushuZhuangtaiXianeChangeParm();
// bushuZhuangtaiXianeChangeParm.setNSRMC(jdwjMqData.getNSRMC());
// bushuZhuangtaiXianeChangeParm.setBSZT(jdwjMqData.getBSZT());
// bushuZhuangtaiXianeChangeParm.setQYID(jdwjMqData.getQYID());
// bushuZhuangtaiXianeChangeParm.setTSLX(jdwjMqData.getTSLX());
// bushuZhuangtaiXianeChangeParm.setNSRSBH(jdwjMqData.getNSRSBH());
// bushuZhuangtaiXianeChangeParm.setBSZTDM(jdwjMqData.getBSZTDM());
// bushuZhuangtaiXianeChangeParm.setSouceId(jdwjMqData.getSouceId());
// bushuZhuangtaiXianeChangeParm.setType(jdwjMqData.getType());
//
// List<BushuJiChuVo> bushuJiChuVoList = new ArrayList<>();
// if(ObjectUtil.isNotEmpty(jdwjMqData.getSBJCXX())){
// for (SBJCXXDTO sbjcxx : jdwjMqData.getSBJCXX()) {
// BushuJiChuVo bushuJiChuVo = new BushuJiChuVo();
// List<XianEVo> xianEVoList = new ArrayList<>();
// if(ObjectUtil.isNotEmpty(sbjcxx.getFPLXDMXX())){
// for (FPLXDMXXDTO fplxdmxx : sbjcxx.getFPLXDMXX()) {
// XianEVo xianEVo = new XianEVo();
// xianEVo.setFPLXDM(CommonUtils.transFplxdm(fplxdmxx.getFPLXDM()));
// xianEVo.setDZKPXE(fplxdmxx.getDZKPXE());
//
// xianEVoList.add(xianEVo);
// }
// }
//
// bushuJiChuVo.setJQBH(sbjcxx.getJQBH());
// bushuJiChuVo.setFPLXDMXX(xianEVoList);
//
// bushuJiChuVoList.add(bushuJiChuVo);
// }
//
// }
//
//
// bushuZhuangtaiXianeChangeParm.setSBJCXX(bushuJiChuVoList);
//
// updateStateAndLimitMoneyRequest.setParam1(bushuZhuangtaiXianeChangeParm);
//
// log.info("{}推送京东宙斯部署状态数据接口,请求参数:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(updateStateAndLimitMoneyRequest));
// try {
// final DateTime begin = DateTime.now();
// UpdateStateAndLimitMoneyResponse response = client.execute(updateStateAndLimitMoneyRequest);
// log.info("{}推送京东宙斯部署状态数据接口,返回报文:{}, 耗时{}毫秒",LOGGER_MSG, JsonUtils.getInstance().toJsonString(response), new Duration(begin, DateTime.now()).getMillis());
//
// if(ObjectUtil.isNotNull(response)){
// DxCommonData returnType = response.getReturnType();
// if(ObjectUtil.isNotNull(returnType)){
// DxReturnStateInfo returnStateInfo = returnType.getReturnStateInfo();
// if(ObjectUtil.isNotNull(returnStateInfo)){
// if(ConfigureConstant.STRING_000000.equals(returnStateInfo.getReturnCode())){
// return R.error(returnStateInfo.getReturnCode(),returnStateInfo.getReturnMessage());
// }else {
// return R.error(returnStateInfo.getReturnCode(),returnStateInfo.getReturnMessage());
// }
// }
// }
// }
//
// } catch (Exception e) {
// log.error("{}推送京东宙斯部署状态数据接口,推送京东jos失败,异常信息:{}",LOGGER_MSG, e);
// }
} catch (Exception e) {
log.warn("{}推送京东宙斯部署状态数据接口,异常:{}!", LOGGER_MSG,e);

@ -10,7 +10,7 @@
package com.dxhy.order.consumer.modules.jdjos.utils;
import com.aisino.common.util.XMLShellFactory;
//import com.aisino.common.util.XMLShellFactory;
import com.dxhy.order.constant.ConfigureConstant;
import com.dxhy.order.utils.Base64Encoding;
import com.dxhy.order.utils.GbkUtil;
@ -214,7 +214,7 @@ public class ProXml {
public static String makeFirstLayerXml(JdJosGlobalInfo glo, Object reqObj, String encryptCode) {
JdJosReturnStateInfo rs = ProXml.getReturnStateInfo(XmlPar.BUSI_SSUCCESS, "");
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLShellFactory.newInstance().saveXml(out, reqObj);
//XMLShellFactory.newInstance().saveXml(out, reqObj);
JdJosData data = ProXml.getData(out, encryptCode, false);
return ProXml.getXml(glo, rs, data);
}
@ -266,25 +266,25 @@ public class ProXml {
/**
* <p>获取二层协议中的协议对象</p>
*
* @param xml
* @param
* @return
* @throws Exception List
* @author: jerome.wang
* @date: Created on 2016-5-11 下午02:33:25
*/
@SuppressWarnings("AlibabaUndefineMagicConstant")
public static List getDataRoot(String xml) throws Exception {
String xmlRootStart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <ROOT>";
String xmlRootEnd = "</ROOT>";
if (xml.startsWith("<?xml")) {
XMLShellFactory factory = XMLShellFactory.newInstance();
return (List) factory.generateDomainObject(xml).get(0);
} else {
XMLShellFactory factory = XMLShellFactory.newInstance();
return (List) factory.generateDomainObject(xmlRootStart + xml + xmlRootEnd).get(0);
}
}
// public static List getDataRoot(String xml) throws Exception {
// String xmlRootStart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <ROOT>";
// String xmlRootEnd = "</ROOT>";
// if (xml.startsWith("<?xml")) {
// XMLShellFactory factory = XMLShellFactory.newInstance();
// return (List) factory.generateDomainObject(xml).get(0);
// } else {
// XMLShellFactory factory = XMLShellFactory.newInstance();
// return (List) factory.generateDomainObject(xmlRootStart + xml + xmlRootEnd).get(0);
// }
//
// }
/**
* <p>获取一层协议的data对象</p>

@ -8,9 +8,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
import com.dxhy.order.baseservice.constant.OrderEnum;
import com.dxhy.order.constant.*;
import com.dxhy.order.consumer.modules.manager.model.PushTicketModel;
import com.dxhy.order.consumer.modules.manager.model.dto.ManualPushInvoiceDTO;
import com.dxhy.order.consumer.modules.ticketpool.service.PushTicketPoolService;
import com.dxhy.order.consumer.openapi.protocol.v4.order.*;
import com.dxhy.order.consumer.openapi.protocol.v6.order.*;
import com.dxhy.order.consumer.utils.DateUtils;
import com.dxhy.order.exception.OrderReceiveException;
import com.dxhy.order.model.*;
import com.dxhy.order.model.newsk.invoiceissue.*;
@ -93,6 +96,9 @@ public class InvoiceReceiveController {
@Resource
private SimsBackService simsBackService;
@Resource
private PushTicketPoolService pushTicketPoolService;
/**
* 接收底层发票推送的接口
*/
@ -498,6 +504,73 @@ public class InvoiceReceiveController {
}
}
/**
* 发票手动回推企业
*/
@ApiOperation(value = "批量推送票池", notes = "开票结果接收-推送票池")
@PostMapping("/batchPushInvoice")
@SysLog(operation = "手动推送发票数据", operationDesc = "手动推送发票数据", key = "推送发票")
public R batchPushInvoice( @ApiParam(name = "pushTicketModel", value = "推送票池实体", required = true) @RequestBody PushTicketModel pushTicketModel) {
R r;
try {
if (pushTicketModel == null || StringUtils.isBlank(pushTicketModel.getPushType())) {
return R.error(OrderInfoContentEnum.INVOICE_PARAM_ERROR);
}
if (pushTicketModel.getPushType().equals("1")){
//按照发票号码和发票代码进行推送
if (StringUtils.isBlank(pushTicketModel.getFpdm())){
R.error("发票代码不能为空");
}
if (StringUtils.isBlank(pushTicketModel.getFphm())){
R.error("发票号码不能为空");
}
if (StringUtils.isBlank(pushTicketModel.getNsrsbh())){
R.error("纳税人识别号不能为空");
}
return pushTicketPoolService.pushTicketPool(pushTicketModel.getFpdm(), pushTicketModel.getFphm(), pushTicketModel.getNsrsbh());
}else if (pushTicketModel.getPushType().equals("2")){
if (StringUtils.isBlank(pushTicketModel.getStartTime())){
R.error("开始时间不能为空");
}
if (StringUtils.isBlank(pushTicketModel.getEndTime())){
R.error("结束时间不能为空");
}
String startTime = DateUtils.getMorning(DateUtils.strToDate(pushTicketModel.getStartTime()));
String endTime = DateUtils.getNight(DateUtils.strToDate(pushTicketModel.getEndTime()));
List<OrderInvoiceInfo> invoiceInfos = orderInvoiceInfoService.selectOrderInvoiceInfoByTime(startTime, endTime);
if (invoiceInfos != null && invoiceInfos.size() > 0){
for (OrderInvoiceInfo invoiceInfo : invoiceInfos) {
pushTicketPoolService.pushTicketPool(invoiceInfo.getFpdm(), invoiceInfo.getFphm(), invoiceInfo.getXhfNsrsbh());
}
}
return R.ok();
}
return R.error("不存在的推送方式");
} catch (Exception e) {
log.error("{}批量推送票池:{}", LOGGER_MSG, e);
return R.error();
}
}
private List<DdfpzxxBO> convetDdfpzxxBO(List<QdInvoicePushBackRequest> qdInvoicePushBackRequestList){
List<DdfpzxxBO> ddfpzxxList = new ArrayList<>(qdInvoicePushBackRequestList.size());
qdInvoicePushBackRequestList.forEach(invoiceIssueRequest -> {

@ -0,0 +1,14 @@
package com.dxhy.order.consumer.modules.manager.model;
import lombok.Data;
@Data
public class PushTicketModel {
private String nsrsbh;
private String fpdm;
private String fphm;
private String fpqqlsh;
private String pushType;
private String endTime;
private String startTime;
}

@ -246,6 +246,13 @@ public class PushInvoiceServiceImpl implements PushInvoiceService {
try {
if (StringUtils.isNotBlank(commonTsMqData.getFpTsMqData().getFphm())) {
pushTicketPoolService.pushTicketPool(commonTsMqData.getFpTsMqData().getFpdm(), commonTsMqData.getFpTsMqData().getFphm(), commonTsMqData.getNsrsbh());
}else {
if (StringUtils.isNotBlank(commonTsMqData.getFpTsMqData().getFpqqlsh())){
OrderInvoiceInfo orderInvoiceInfo = orderInvoiceInfoService.selectOrderInvoiceInfoByFpqqlsh(commonTsMqData.getFpTsMqData().getFpqqlsh(), shList);
if (StringUtils.isNotBlank(orderInvoiceInfo.getFphm())){
pushTicketPoolService.pushTicketPool(orderInvoiceInfo.getFpdm(), orderInvoiceInfo.getFphm(), commonTsMqData.getNsrsbh());
}
}
}
} catch (Exception e) {

@ -157,37 +157,37 @@ public class HomeBoardServiceImpl implements HomeBoardService {
String currDateStr = DateUtil.format(currDate, ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
if (StringUtils.equals(ConfigureConstant.STRING_0, queryType)) {
//本月开票数据
DateTime beginOfMonth = DateUtil.beginOfMonth(currDate);
String beginOfMonthStr = DateUtil.formatDateTime(beginOfMonth);
startTime = com.aisino.common.util.DateUtil.parse(beginOfMonthStr,
ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
endTime = com.aisino.common.util.DateUtil.parse(currDateStr,
ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
// DateTime beginOfMonth = DateUtil.beginOfMonth(currDate);
// String beginOfMonthStr = DateUtil.formatDateTime(beginOfMonth);
// startTime = com.aisino.common.util.DateUtil.parse(beginOfMonthStr,
// ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
// endTime = com.aisino.common.util.DateUtil.parse(currDateStr,
// ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
} else if (StringUtils.equals(ConfigureConstant.STRING_1, queryType)) {
//本季度开票数据
DateTime beginOfQuarter = DateUtil.beginOfQuarter(currDate);
String beginOfQuarterStr = DateUtil.formatDateTime(beginOfQuarter);
startTime = com.aisino.common.util.DateUtil.parse(beginOfQuarterStr,
ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
endTime = com.aisino.common.util.DateUtil.parse(currDateStr,
ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
// startTime = com.aisino.common.util.DateUtil.parse(beginOfQuarterStr,
// ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
// endTime = com.aisino.common.util.DateUtil.parse(currDateStr,
// ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
} else if (StringUtils.equals(ConfigureConstant.STRING_2, queryType)) {
//累计开票数据
endTime = com.aisino.common.util.DateUtil.parse(currDateStr,
ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
// endTime = com.aisino.common.util.DateUtil.parse(currDateStr,
// ConfigureConstant.DATE_FORMAT_DATE_Y_M_DH_M_S);
} else {
throw new OrderReceiveException(ConfigureConstant.STRING_9999, "查询类型不合法,只能是0:本月,1:本季度,2:累计");
}
List<String> shList = Lists.newArrayList(kpsjBO.getNsrsbh());
List<String> entList = Lists.newArrayList(kpsjBO.getEntId());
KpsjVO kpsjVO = new KpsjVO();
InvoiceCount invoiceCount = invoiceCountService.countInvoiceInfoByTime(startTime, endTime, shList, entList);
if (Objects.isNull(invoiceCount)) {
throw new OrderReceiveException(ConfigureConstant.STRING_9999, "未查询到相关开票数据!");
}
kpsjVO.setKpl(Integer.parseInt(invoiceCount.getCount()));
kpsjVO.setHjje(invoiceCount.getHjje());
kpsjVO.setHjse(invoiceCount.getHjse());
// InvoiceCount invoiceCount = invoiceCountService.countInvoiceInfoByTime(startTime, endTime, shList, entList);
// if (Objects.isNull(invoiceCount)) {
// throw new OrderReceiveException(ConfigureConstant.STRING_9999, "未查询到相关开票数据!");
// }
// kpsjVO.setKpl(Integer.parseInt(invoiceCount.getCount()));
// kpsjVO.setHjje(invoiceCount.getHjje());
// kpsjVO.setHjse(invoiceCount.getHjse());
return kpsjVO;
}

@ -616,7 +616,7 @@ public class MakeOutAnInvoiceServiceImpl implements MakeOutAnInvoiceService {
//方格开票特殊处理
if (CommonUtils.judgeIsFgTerminalOld(terminalCode,fgSkKpShList,sh) && (OrderInfoEnum.ORDER_INVOICE_TYPE_12.getKey().equals(orderInfo.getFpzlDm())||OrderInfoEnum.ORDER_INVOICE_TYPE_42.getKey().equals(orderInfo.getFpzlDm()))) {
if (CommonUtils.judgeIsFgTerminalOld(terminalCode,fgSkKpShList,sh)) {
for (List<InvoiceBatchRequestItem> invoiceBatchRequestItem1 : insertBatchItem) {
for (InvoiceBatchRequestItem batchRequestItem : invoiceBatchRequestItem1) {
/**

@ -1885,7 +1885,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
errorMsgList.append(preStr).append("数据删除失败").append("\r\n");
continue;
}
baseService.deleteOperateStatus(fpqqlsh);
// baseService.deleteOperateStatus(fpqqlsh);
} catch (Exception e) {
log.error("{}数据删除失败:{}", LOGGER_MSG, e);

@ -215,6 +215,7 @@ public class FangGeInterfaceServiceImpl implements FangGeInterfaceService {
OrderInfoJdcVO orderInfoJdc = orderInfoJdcService.queryOrderInfoJdcByOrderId(info.getOrderInfoId());
if (null != orderInfoJdc) {
FgJdctxxBO fgJdctxxBO = BeanTransitionUtils.transitionJdcfgOrderInvoiceHead(orderInfoJdc);
fgJdctxxBO.setJDCFPBZ("3");
fgCommonOrder.setJDCTXX(fgJdctxxBO);
}
//查询二手车订单数据
@ -2241,7 +2242,22 @@ public class FangGeInterfaceServiceImpl implements FangGeInterfaceService {
if (OrderInfoEnum.TAX_EQUIPMENT_C48.getKey().equals(terminalCode) || OrderInfoEnum.TAX_EQUIPMENT_D60.getKey().equals(terminalCode)) {
terminalCode = OrderInfoEnum.TAX_EQUIPMENT_FGHX.getKey();
}
SqZcxxResponse sqZcxxResponse = HttpInvoiceRequestUtilFg.sqZcxx(invoiceConfig.configSqZcxxFg(), sqZcxxParam, terminalCode);
String fgSkKpShList = baseServiceConfig.getFgSkKpShList();
String url = invoiceConfig.configSqZcxxFg();
if (StringUtils.isNotBlank(fgSkKpShList) && StringUtils.isNotBlank(sqZcxxParam.getNSRSBH())) {
String[] fgSkKpList = fgSkKpShList.split(ConfigureConstant.STRING_POINT2);
for (String fgSkKp : fgSkKpList) {
if (sqZcxxParam.getNSRSBH().equals(fgSkKp)) {
url = invoiceConfig.configSqZcxxFgJDC();
}
}
}
SqZcxxResponse sqZcxxResponse = HttpInvoiceRequestUtilFg.sqZcxx(url, sqZcxxParam, terminalCode);
if (ConfigureConstant.STRING_0000.equals(sqZcxxResponse.getCode())) {
//注册成功,返回注册码
String zcm = "";
@ -2341,7 +2357,20 @@ public class FangGeInterfaceServiceImpl implements FangGeInterfaceService {
}
// 调用税控接口,同步税盘信息
ResponseBaseBean result = HttpInvoiceRequestUtilFg.tbSpxx(invoiceConfig.configTbSpxxFg(), tbSpxxParam, taxEquipmentInfo.getSksbCode());
String url = invoiceConfig.configTbSpxxFg();
String fgSkKpShList = baseServiceConfig.getFgSkKpShList();
if (StringUtils.isNotBlank(fgSkKpShList) && StringUtils.isNotBlank(nsrsbh)) {
String[] fgSkKpList = fgSkKpShList.split(ConfigureConstant.STRING_POINT2);
for (String fgSkKp : fgSkKpList) {
if (nsrsbh.equals(fgSkKp)) {
url = invoiceConfig.configTbSpxxFgJDC();
}
}
}
ResponseBaseBean result = HttpInvoiceRequestUtilFg.tbSpxx(url, tbSpxxParam, taxEquipmentInfo.getSksbCode());
if (OrderInfoContentEnum.INVOICE_STAT_SUCCESS.getKey().equals(result.getCode())) {
//同步信息成功
log.info("同步税盘信息成功");

@ -0,0 +1,866 @@
package com.dxhy.order.consumer.utils;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author jiaohongyang
*/
@SuppressWarnings({"AlibabaLowerCamelCaseVariableNaming", "AlibabaUndefineMagicConstant"})
public class DateUtils {
public static final String YYYYMMDD = "yyyyMMdd";
/**
* 获取现在时间,这个好用
*
* 返回长时间格式 yyyy-MM-dd HH:mm:ss
*/
public static Date getSqlDate() {
return new java.sql.Date(System.currentTimeMillis());
}
/**
* 获取现在时间
*
* 返回长时间格式 yyyy-MM-dd HH:mm:ss
*/
public static Date getSqlDateLong() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(0);
return formatter.parse(dateString, pos);
}
/**
* 获取现在时间
*
* 返回长时间格式 yyyy-MM-dd HH:mm:ss
*/
public static Date getNowDate() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
return formatter.parse(dateString, pos);
}
/**
* 获取现在时间
*
* 返回短时间格式 yyyy-MM-dd
*/
public static Date getNowDateShort() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
return formatter.parse(dateString, pos);
}
/**
* 获取现在时间
*
* 返回字符串格式 yyyy-MM-dd HH:mm:ss
*/
public static String getStringDate() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter.format(currentTime);
}
/**
* 获取现在时间
*
* 返回短时间字符串格式yyyy-MM-dd
*/
public static String getStringDateShort() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
return formatter.format(currentTime);
}
/**
* 获取时间 小时:; HH:mm:ss
*
*
*/
public static String getTimeShort() {
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
Date currentTime = new Date();
return formatter.format(currentTime);
}
/**
* 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
*
* @param strDate
* 日期
*
*/
public static Date strToDateLong(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ParsePosition pos = new ParsePosition(0);
return formatter.parse(strDate, pos);
}
/**
* 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss
*
* @param dateDate
* 日期
*
*/
public static String dateToStrLong(Date dateDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter.format(dateDate);
}
/**
* 将短时间格式时间转换为字符串 yyyy-MM-dd
*
* @param dateDate
* 日期
*
*/
public static String dateToStr(Date dateDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
return formatter.format(dateDate);
}
public static String dateToStr(Date dateDate, String format) {
SimpleDateFormat formatter = new SimpleDateFormat(format);
return formatter.format(dateDate);
}
/**
* 日期格式化到月份
*
* @param dateDate
* 日期
*
*/
public static String dateToMonthStr(Date dateDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
return formatter.format(dateDate);
}
/**
* 将短时间格式字符串转换为时间 yyyy-MM-dd
*
* @param strDate
* 日期
*
*/
public static Date strToDate(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
return formatter.parse(strDate, pos);
}
/**
* @param strDate
* 日期
*
*/
public static Date strToDateChina(String strDate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
ParsePosition pos = new ParsePosition(0);
return sdf.parse(strDate, pos);
}
/**
* 得到现在时间
*
*
*/
public static Date getNow() {
return new Date();
}
/**
* 提取一个月中的最后一天
*
* @param day
* 日期
*
*/
public static Date getLastDate(long day) {
Date date = new Date();
long date3Hm = date.getTime() - 3600000 * 34 * day;
return new Date(date3Hm);
}
/**
* 得到现在时间
*
* 字符串 yyyyMMdd HHmmss
*/
public static String getStringToday() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
return formatter.format(currentTime);
}
/**
* 得到现在小时
*/
public static String getHour() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String hour;
hour = dateString.substring(11, 13);
return hour;
}
/**
* 得到现在分钟
*
*
*/
public static String getTime() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
String min;
min = dateString.substring(14, 16);
return min;
}
/**
* 根据用户传入的时间表示格式返回当前时间的格式 如果是yyyyMMdd注意字母y不能大写
*
* @param sformat
* yyyyMMddhhmmss
*
*/
public static String getUserDate(String sformat) {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(sformat);
return formatter.format(currentTime);
}
/**
* 二个小时时间间的差值,必须保证二个时间都是"HH:MM"的格式返回字符型的分钟
*/
public static String getTwoHour(String st1, String st2) {
String[] kk;
String[] jj;
kk = st1.split(":");
jj = st2.split(":");
if (Integer.parseInt(kk[0]) < Integer.parseInt(jj[0])) {
return "0";
} else {
double y = Double.parseDouble(kk[0]) + Double.parseDouble(kk[1]) / 60;
double u = Double.parseDouble(jj[0]) + Double.parseDouble(jj[1]) / 60;
if ((y - u) > 0) {
return y - u + "";
} else {
return "0";
}
}
}
/**
* 得到二个日期间的间隔天数
*/
public static String getTwoDay(String sj1, String sj2) {
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
long day;
try {
Date date = myFormatter.parse(sj1);
Date mydate = myFormatter.parse(sj2);
day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
} catch (Exception e) {
return "";
}
return day + "";
}
/**
* 时间前推或后推分钟,其中JJ表示分钟.
*/
public static String getPreTime(String sj1, String jj) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String mydate1 = "";
try {
Date date1 = format.parse(sj1);
long time = (date1.getTime() / 1000) + Integer.parseInt(jj) * 60;
date1.setTime(time * 1000);
mydate1 = format.format(date1);
} catch (Exception ignored) {
}
return mydate1;
}
/**
* 得到一个时间延后或前移几天的时间,nowdate为时间,delay为前移或后延的天数
*
* @param nowdate
* 日期
* @param delay
* 日期
*/
public static String getNextDay(String nowdate, String delay) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String mdate;
Date d = strToDate(nowdate);
long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60;
d.setTime(myTime * 1000);
mdate = format.format(d);
return mdate;
} catch (Exception e) {
return "";
}
}
/**
* 判断是否润年 详细设计 1.被400整除是闰年否则 2.不能被4整除则不是闰年 3.能被4整除同时不能被100整除则是闰年 3.能被4整除同时能被100整除则不是闰年
*
* @param ddate
* 日期
*
*/
public static boolean isLeapYear(String ddate) {
Date d = strToDate(ddate);
GregorianCalendar gc = (GregorianCalendar)Calendar.getInstance();
gc.setTime(d);
int year = gc.get(Calendar.YEAR);
if ((year % 400) == 0) {
return true;
} else if ((year % 4) == 0) {
return (year % 100) != 0;
} else {
return false;
}
}
/**
* 返回美国时间格式 26 Apr 2006
*
* @param str
* 日期
*
*/
public static String getEDate(String str) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(str, pos);
String j = strtodate.toString();
String[] k = j.split(" ");
return k[2] + k[1].toUpperCase() + k[5].substring(2, 4);
}
/**
* 获取一个月的最后一天
*
* @param dat
* 日期
*
*/
public static String getEndDateOfMonth(String dat) {
String str = dat.substring(0, 8);
String month = dat.substring(5, 7);
int mon = Integer.parseInt(month);
if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) {
str += "31";
} else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) {
str += "30";
} else {
if (isLeapYear(dat)) {
str += "29";
} else {
str += "28";
}
}
return str;
}
/**
* 判断二个时间是否在同一个周
*
* @param date1
* 日期
* @param date2
* 日期
*
*/
public static boolean isSameWeekDates(Date date1, Date date2) {
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
cal1.setTime(date1);
cal2.setTime(date2);
int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
if (0 == subYear) {
return cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR);
} else if (1 == subYear && Calendar.DECEMBER == cal2.get(Calendar.MONTH)) {
// 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周
return cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR);
} else if (-1 == subYear && Calendar.DECEMBER == cal1.get(Calendar.MONTH)) {
return cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR);
}
return false;
}
/**
* 产生周序列,即得到当前时间所在的年度是第几周
*
*
*/
public static String getSeqWeek() {
Calendar c = Calendar.getInstance(Locale.CHINA);
String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
if (week.length() == 1) {
week = "0" + week;
}
String year = Integer.toString(c.get(Calendar.YEAR));
return year + week;
}
/**
* 获得一个日期所在的周的星期几的日期如要找出2002年2月3日所在周的星期一是几号
*
* @param sdate
* 日期
* @param num
* 星期
*
*/
public static String getWeek(String sdate, String num) {
// 再转换为时间
Date dd = strToDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(dd);
// 返回星期一所在的日期
if ("1".equals(num)) {
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
// 返回星期二所在的日期
} else if ("2".equals(num)) {
c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
} else if ("3".equals(num)) {
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
} else if ("4".equals(num)) {
c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
} else if ("5".equals(num)) {
c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
} else if ("6".equals(num)) {
c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
} else if ("0".equals(num)) {
c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
}
return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
}
/**
* 根据一个日期返回是星期几的字符串
*
* @param sdate
* 日期
*
*/
public static String getWeek(String sdate) {
// 再转换为时间
Date date = strToDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
// hour中存的就是星期几了,其范围 1~7
return new SimpleDateFormat("EEEE").format(c.getTime());
}
public static String getWeekStr(String sdate) {
String str;
str = getWeek(sdate);
switch (str) {
case "1":
str = "星期日";
break;
case "2":
str = "星期一";
break;
case "3":
str = "星期二";
break;
case "4":
str = "星期三";
break;
case "5":
str = "星期四";
break;
case "6":
str = "星期五";
break;
case "7":
str = "星期六";
break;
default:
break;
}
return str;
}
/**
* 两个时间之间的天数
*
* @param date1
* 日期
* @param date2
* 日期
*
*/
public static long getDays(String date1, String date2) {
if (date1 == null || "".equals(date1)) {
return 0;
}
if (date2 == null || "".equals(date2)) {
return 0;
}
// 转换为标准时间
SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
Date mydate = null;
try {
date = myFormatter.parse(date1);
mydate = myFormatter.parse(date2);
} catch (Exception ignored) {
}
assert mydate != null;
return (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
}
/**
* 形成如下的日历 根据传入的一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 星期六 下面是当月的各个时间 此函数返回该日历第一行星期日所在的日期
*
* @param sdate
* 日期
*
*/
public static String getNowMonth(String sdate) {
// 取该时间所在月的一号
sdate = sdate.substring(0, 8) + "01";
// 得到这个月的1号是星期几
Date date = strToDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
int u = c.get(Calendar.DAY_OF_WEEK);
return getNextDay(sdate, (1 - u) + "");
}
/**
* 取得数据库主键 生成格式为yyyymmddhhmmss+k位随机数
*
* @param k
* 表示是取几位随机数可以自己定
*/
public static String getNo(int k) {
return getUserDate("yyyyMMddhhmmss") + getRandom(k);
}
/**
* 返回一个随机数
*
* @param i
* 随机数
*
*/
public static String getRandom(int i) {
Random jjj = new Random();
if (i == 0) {
return "";
}
StringBuilder jj = new StringBuilder();
for (int k = 0; k < i; k++) {
jj.append(jjj.nextInt(9));
}
return jj.toString();
}
/**
* @param date
* 日期
*/
public static boolean RightDate(String date) {
SimpleDateFormat sdf;;
if (date == null) {
return true;
}
if (date.length() > 10) {
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
} else {
sdf = new SimpleDateFormat("yyyy-MM-dd");
}
try {
sdf.parse(date);
} catch (ParseException pe) {
return true;
}
return false;
}
/**
* //nd=1表示返回的值中包含年度 //yf=1表示返回的值中包含月份 //rq=1表示返回的值中包含日期 //format表示返回的格式 1 以年月日中文返回 2 以横线-返回 // 3 以斜线/返回 4
* 以缩写不带其它符号形式返回 // 5 以点号.返回
*/
public static String getStringDateMonth(String sdate, String nd, String yf, String rq, String format) {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
// 年份
String s_nd = dateString.substring(0, 4);
// 月份
String s_yf = dateString.substring(5, 7);
// 日期
String s_rq = dateString.substring(8, 10);
String sreturn = "";
// 处理空值情况
if (sdate == null || "".equals(sdate) || RightDate(sdate)) {
if ("1".equals(nd)) {
sreturn = s_nd;
// 处理间隔符
if ("1".equals(format)) {
sreturn = sreturn + "年";
} else if ("2".equals(format)) {
sreturn = sreturn + "-";
} else if ("3".equals(format)) {
sreturn = sreturn + "/";
} else if ("5".equals(format)) {
sreturn = sreturn + ".";
}
}
// 处理月份
if ("1".equals(yf)) {
sreturn = sreturn + s_yf;
if ("1".equals(format)) {
sreturn = sreturn + "月";
} else if ("2".equals(format)) {
sreturn = sreturn + "-";
} else if ("3".equals(format)) {
sreturn = sreturn + "/";
} else if ("5".equals(format)) {
sreturn = sreturn + ".";
}
}
// 处理日期
if ("1".equals(rq)) {
sreturn = sreturn + s_rq;
if ("1".equals(format)) {
sreturn = sreturn + "日";
}
}
} else {
// 不是空值,也是一个合法的日期值,则先将其转换为标准的时间格式
// 年份
s_nd = sdate.substring(0, 4);
// 月份
s_yf = sdate.substring(5, 7);
// 日期
s_rq = sdate.substring(8, 10);
if ("1".equals(nd)) {
sreturn = s_nd;
// 处理间隔符
if ("1".equals(format)) {
sreturn = sreturn + "年";
} else if ("2".equals(format)) {
sreturn = sreturn + "-";
} else if ("3".equals(format)) {
sreturn = sreturn + "/";
} else if ("5".equals(format)) {
sreturn = sreturn + ".";
}
}
// 处理月份
if ("1".equals(yf)) {
sreturn = sreturn + s_yf;
if ("1".equals(format)) {
sreturn = sreturn + "月";
} else if ("2".equals(format)) {
sreturn = sreturn + "-";
} else if ("3".equals(format)) {
sreturn = sreturn + "/";
} else if ("5".equals(format)) {
sreturn = sreturn + ".";
}
}
// 处理日期
if ("1".equals(rq)) {
sreturn = sreturn + s_rq;
if ("1".equals(format)) {
sreturn = sreturn + "日";
}
}
}
return sreturn;
}
public static String getNextMonthDay(String sdate, int m) {
sdate = getOKDate(sdate);
int year = Integer.parseInt(sdate.substring(0, 4));
int month = Integer.parseInt(sdate.substring(5, 7));
month = month + m;
if (month < 0) {
month = month + 12;
year = year - 1;
} else if (month > 12) {
month = month - 12;
year = year + 1;
}
String smonth = "";
if (month < 10) {
smonth = "0" + month;
} else {
smonth = "" + month;
}
return year + "-" + smonth + "-10";
}
public static String getOKDate(String sdate) {
if (sdate == null || "".equals(sdate)) {
return getStringDateShort();
}
if (RightDate(sdate)) {
sdate = getStringDateShort();
}
// 将“/”转换为“-”
sdate = sdate.replace("/", "-");
// 如果只有8位长度,则要进行转换
if (sdate.length() == 8) {
sdate = sdate.substring(0, 4) + "-" + sdate.substring(4, 6) + "-" + sdate.substring(6, 8);
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition pos = new ParsePosition(0);
Date strtodate = formatter.parse(sdate, pos);
return formatter.format(strtodate);
}
/**
* 获取某年第一天日期
*
* @param year
* 年份 Date
*/
public static Date getYearFirst(int year) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
return calendar.getTime();
}
/**
* 获取某年最后一天日期
*
* @param year
* 年份 Date
*/
public static Date getYearLast(int year) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, year);
calendar.roll(Calendar.DAY_OF_YEAR, -1);
return calendar.getTime();
}
/**
* 将短时间格式时间转换为字符串 yyyy-MM-dd
*
*
*/
public static String getNowYyyyMmDd() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
return formatter.format(new Date());
}
/**
* 格式化时间为 yyyy-MM-dd 00:00:00
*
*
* @throws ParseException
*/
public static String getMorning(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return dateFormat.format(calendar.getTime());
}
/**
* 格式化时间为 yyyy-MM-dd 23:59:59
*
* @param date
*
*/
public static String getNight(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
return dateFormat.format(calendar.getTime());
}
/**
* 属期相关日期没-
*
* @param strDate
*
*/
public static Date strToDatePeriod(String strDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
ParsePosition pos = new ParsePosition(0);
return formatter.parse(strDate, pos);
}
/**
* yyyyMMdd ת yyyy-MM-dd
*
* @param strDate
*
*/
public static String strToStrDate(String strDate) {
String strtostr = "";
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat formatter2 = new SimpleDateFormat("yyyyMMdd");
Date date = formatter2.parse(strDate);
strtostr = formatter.format(date);
} catch (ParseException e) {
e.printStackTrace();
}
return strtostr;
}
/**
* yyyy-MM-dd ת yyyyMMdd
*
* @param strDate
*
*/
public static String strToStrDate2(String strDate) {
String strtostr = "";
try {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat formatter2 = new SimpleDateFormat("yyyyMMdd");
Date date = formatter.parse(strDate);
strtostr = formatter2.format(date);
} catch (ParseException e) {
e.printStackTrace();
}
return strtostr;
}
public static String getNowTimeStamp() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
return formatter.format(currentTime);
}
}

@ -31,6 +31,9 @@ public class InvoiceConfig {
@Value("${order.url.A9}")
private String interfaceA9BusinessUrl;
@Value("${order.url.jdc}")
private String interfaceJdcBusinessUrl;
/**
* 预览pdf水印
*/
@ -385,6 +388,10 @@ public class InvoiceConfig {
return interfaceA9BusinessUrl + "/invoice/business/v1.0/queryNsrXnsbxx";
}
public String configQueryNsrXnsbxxJDC() {
return interfaceJdcBusinessUrl + "/invoice/business/v1.0/queryNsrXnsbxx";
}
/**
* 打印机列表查询
*
@ -537,6 +544,10 @@ public class InvoiceConfig {
return interfaceA9BusinessUrl + "/invoice/business/v1.0/tbSpxx";
}
public String configTbSpxxFgJDC() {
return interfaceJdcBusinessUrl + "/invoice/business/v1.0/tbSpxx";
}
/**
* 调用税控生成pdf地址
*
@ -554,6 +565,9 @@ public class InvoiceConfig {
public String configSqZcxxFg() {
return interfaceA9BusinessUrl + "/invoice/business/v1.0/sqZcxx";
}
public String configSqZcxxFgJDC() {
return interfaceJdcBusinessUrl + "/invoice/business/v1.0/sqZcxx";
}
/**
* 调用获取pdf地址
@ -1207,4 +1221,7 @@ public class InvoiceConfig {
}
public String configGetDiscInfoFgJDC() {
return interfaceJdcBusinessUrl + "/invoice/business/v1.0/queryDiscinfo";
}
}

@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import com.dxhy.order.baseservice.config.BaseServiceConfig;
import com.dxhy.order.constant.*;
import com.dxhy.order.model.InvoicePrintInfo;
import com.dxhy.order.model.OrderInvoiceInfo;
@ -74,6 +75,9 @@ public class FangGeServiceImpl implements FangGeService {
@Resource
private FangGeService fangGeService;
@Resource
private BaseServiceConfig baseServiceConfig;
@Override
public void updateUploadRedInvoice(SpecialInvoiceReversalEntity entity) {
specialInvoiceReversalMapper.updateByPrimaryKeySelective(entity);
@ -279,7 +283,20 @@ public class FangGeServiceImpl implements FangGeService {
spxxParams.add(spxxParam);
tbSpxxParam.setJSPXX(spxxParams);
// 调用税控接口,同步税盘信息
HttpInvoiceRequestUtilFg.tbSpxx(invoiceConfig.configTbSpxxFg(), tbSpxxParam, OrderInfoEnum.TAX_EQUIPMENT_FGHX.getKey());
String url = invoiceConfig.configTbSpxxFg();
String fgSkKpShList = baseServiceConfig.getFgSkKpShList();
if (StringUtils.isNotBlank(fgSkKpShList) && StringUtils.isNotBlank(xhfNsrsbh)) {
String[] fgSkKpList = fgSkKpShList.split(ConfigureConstant.STRING_POINT2);
for (String fgSkKp : fgSkKpList) {
if (xhfNsrsbh.equals(fgSkKp)) {
url = invoiceConfig.configTbSpxxFgJDC();
}
}
}
HttpInvoiceRequestUtilFg.tbSpxx(url, tbSpxxParam, OrderInfoEnum.TAX_EQUIPMENT_FGHX.getKey());
registrationCode.setSpzt(spzt);
saveCodeToRedis(registrationCode);
log.warn("{}同步税盘状态成功,当前税盘状态为:{}(0:在线,1:离线),税号:{},机器编号:{}", LOGGER_MSG, spzt, xhfNsrsbh, jqbh);

@ -276,4 +276,6 @@ public interface OrderInvoiceInfoMapper {
* @return : int
*/
int updateOrderInvoiceInfoById(@Param("orderInvoiceInfo") OrderInvoiceInfo orderInvoiceInfo);
List<OrderInvoiceInfo> selectOrderInvoiceInfoByTime(@Param("startTime") String startTime, @Param("endTime") String endTime);
}

@ -292,6 +292,7 @@ public interface OrderInvoiceInfoService {
R stageRedInvoiceData(RedInvoiceStageReqPo redInvoiceSaveReqPo);
List<OrderInvoiceInfo> selectOrderInvoiceInfoByTime(String startTime, String endTime);
/**

@ -1776,6 +1776,11 @@ public class OrderInvoiceInfoServiceImpl implements OrderInvoiceInfoService {
return R.ok();
}
@Override
public List<OrderInvoiceInfo> selectOrderInvoiceInfoByTime(String startTime, String endTime) {
return orderInvoiceInfoMapper.selectOrderInvoiceInfoByTime(startTime,endTime);
}
public boolean getBzhStatus(String bzdh,String clint){
//拼凑报文
IsInput isInput = new IsInput();

@ -239,7 +239,20 @@ public class UnifyServiceImpl implements UnifyService {
cpybs = "";
}
sldRequest.setCpybs(cpybs);
NsrXnsbxxs nsrXnsbxxs = HttpInvoiceRequestUtil.queryNsrXnsbxx(invoiceConfig.configQueryNsrXnsbxx(), sldRequest, terminalCode);
String realUrl = invoiceConfig.configQueryNsrXnsbxx();
String fgSkKpShList = baseServiceConfig.getFgSkKpShList();
if (StringUtils.isNotBlank(fgSkKpShList) && StringUtils.isNotBlank(nsrsbh)) {
String[] fgSkKpList = fgSkKpShList.split(ConfigureConstant.STRING_POINT2);
for (String fgSkKp : fgSkKpList) {
if (nsrsbh.equals(fgSkKp)) {
realUrl = invoiceConfig.configQueryNsrXnsbxxJDC();
}
}
}
NsrXnsbxxs nsrXnsbxxs = HttpInvoiceRequestUtil.queryNsrXnsbxx(realUrl, sldRequest, terminalCode);
if (ObjectUtil.isNotEmpty(nsrXnsbxxs) && ObjectUtil.isNotEmpty(nsrXnsbxxs.getContent())) {
convertToNewTaxFjh(resultList, nsrXnsbxxs.getContent(), nsrsbh, terminalCode);
}
@ -747,8 +760,19 @@ public class UnifyServiceImpl implements UnifyService {
fgJspxxReqEntity.setJsplx(jspxx);
fgJspxxReqEntity.setFpzlDm(fpzldm);
String url = invoiceConfig.configGetDiscInfoFg();
if (StringUtils.isNotBlank(fgSkKpShList) && StringUtils.isNotBlank(nsrsbh)) {
String[] fgSkKpList = fgSkKpShList.split(ConfigureConstant.STRING_POINT2);
for (String fgSkKp : fgSkKpList) {
if (nsrsbh.equals(fgSkKp)) {
url = invoiceConfig.configGetDiscInfoFgJDC();
}
}
}
SpFpXeDto spFpXeDto = HttpInvoiceRequestUtilFg.querySpZlXeByNsrsbh(
invoiceConfig.configGetDiscInfoFg(), fgJspxxReqEntity, terminalCode);
url, fgJspxxReqEntity, terminalCode);
List<TaxpayerMachineInfo> taxpayerMachineInfoList = new ArrayList<>();
if (ObjectUtil.isNotNull(spFpXeDto)) {
if (ConfigureConstant.STRING_0000.equals(spFpXeDto.getCode()) && ObjectUtil.isNotNull(spFpXeDto.getData())) {
@ -760,6 +784,7 @@ public class UnifyServiceImpl implements UnifyService {
taxpayerMachineInfo.setJQBH(fpXeMxDto.getJqbh());
taxpayerMachineInfo.setSPMC(fpXeMxDto.getJqbh());
taxpayerMachineInfo.setCPYBS(fpXeMxDto.getCpyqylx());
taxpayerMachineInfo.setESCBS(fpXeMxDto.getEscbs());
List<InvoiceType> invoiceTypeList = new ArrayList<>();
if (ObjectUtil.isNotEmpty(fpXeMxDto.getInvoicetypedetails())) {

@ -2381,4 +2381,16 @@
order_invoice_info where order_info_id=#{orderInfoId}
</select>
<resultMap id="pushNeedInfo" type="com.dxhy.order.model.OrderInvoiceInfo">
<result column="fpdm" property="fpdm" />
<result column="fphm" property="fphm"/>
<result column="xhf_nsrsbh" property="xhfNsrsbh"/>
</resultMap>
<select id="selectOrderInvoiceInfoByTime" resultMap="pushNeedInfo">
select fphm,fpdm,xhf_nsrsbh
from order_invoice_info
where kprq between #{startTime} and #{endTime}
</select>
</mapper>

Loading…
Cancel
Save