发票交付接口完善

beta-enc
kane 2 years ago
parent 5b9fe60009
commit 27e927dae8
  1. 7
      jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceDeliveryController.java
  2. 16
      jianshui-platform/src/main/java/com/jianshui/platform/domain/InvoiceDelivery.java
  3. 6
      jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java
  4. 4
      jianshui-platform/src/main/java/com/jianshui/platform/service/InvoiceDeliveryService.java
  5. 42
      jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java
  6. 7
      jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml

@ -1,6 +1,6 @@
package com.jianshui.web.controller.platform;
import com.jianshui.invoice.domain.dto.HXResponse;
import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.platform.dto.InvoiceDeliveryJsonDataDTO;
import com.jianshui.platform.service.InvoiceDeliveryService;
import io.swagger.annotations.Api;
@ -29,8 +29,7 @@ public class InvoiceDeliveryController {
@ApiOperation("发票交付")
@PostMapping("/delivery")
public Object invoiceDelivery(@RequestBody List<InvoiceDeliveryJsonDataDTO> dtos){
HXResponse response = invoiceDeliveryService.invoiceDelivery(dtos);
return response;
public AjaxResult invoiceDelivery(@RequestBody List<InvoiceDeliveryJsonDataDTO> dtos){
return invoiceDeliveryService.invoiceDelivery(dtos);
}
}

@ -9,7 +9,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* 发票交付对象 invoice_delivery
*
* @author jianshui
* @date 2023-06-06
* @date 2023-06-08
*/
public class InvoiceDelivery extends BaseEntity
{
@ -58,6 +58,10 @@ public class InvoiceDelivery extends BaseEntity
@Excel(name = "创建人id")
private Long clerk;
/** 订单来源(1-模板导入,2-API调用,3-手工录入,4-扫码开票) */
@Excel(name = "订单来源", readConverterExp = "订单来源(1-模板导入,2-API调用,3-手工录入,4-扫码开票)")
private String source;
public void setId(Long id)
{
this.id = id;
@ -157,6 +161,15 @@ public class InvoiceDelivery extends BaseEntity
{
return clerk;
}
public void setSource(String source)
{
this.source = source;
}
public String getSource()
{
return source;
}
@Override
public String toString() {
@ -174,6 +187,7 @@ public class InvoiceDelivery extends BaseEntity
.append("clerk", getClerk())
.append("createTime", getCreateTime())
.append("remark", getRemark())
.append("source", getSource())
.toString();
}
}

@ -1,15 +1,13 @@
package com.jianshui.platform.mapper;
import com.jianshui.platform.domain.InvoiceDelivery;
import java.util.List;
import com.jianshui.platform.domain.InvoiceDelivery;
/**
* 发票交付Mapper接口
*
* @author jianshui
* @date 2023-06-06
* @date 2023-06-08
*/
public interface InvoiceDeliveryMapper
{

@ -1,6 +1,6 @@
package com.jianshui.platform.service;
import com.jianshui.invoice.domain.dto.HXResponse;
import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.platform.dto.InvoiceDeliveryJsonDataDTO;
import java.util.List;
@ -18,5 +18,5 @@ public interface InvoiceDeliveryService {
* @param dtos 多张单张交付信息
* @return : com.jianshui.invoice.domain.dto.HXResponse
*/
HXResponse invoiceDelivery(List<InvoiceDeliveryJsonDataDTO> dtos);
AjaxResult invoiceDelivery(List<InvoiceDeliveryJsonDataDTO> dtos);
}

@ -4,40 +4,31 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jianshui.common.constant.InvoiceAllYhdjConstants;
import com.jianshui.common.constant.WebServiceConstant;
import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.common.core.domain.entity.Companyservice;
import com.jianshui.common.core.domain.entity.SysUser;
import com.jianshui.common.core.redis.RedisCache;
import com.jianshui.common.utils.BeanToMapUtils;
import com.jianshui.common.utils.InvoiceUtils;
import com.jianshui.common.utils.SecurityUtils;
import com.jianshui.common.utils.ValidateUtils;
import com.jianshui.common.utils.jcsk.ApiHttp;
import com.jianshui.common.utils.spring.SpringUtils;
import com.jianshui.invoice.domain.dto.HXResponse;
import com.jianshui.invoice.enums.ChannelSource;
import com.jianshui.platform.domain.InvoiceDelivery;
import com.jianshui.platform.dto.InvoiceDeliveryDTO;
import com.jianshui.platform.dto.InvoiceDeliveryJsonDataDTO;
import com.jianshui.platform.mapper.InvoiceDeliveryMapper;
import com.jianshui.platform.service.InvoiceDeliveryService;
import com.jianshui.platform.utils.InvoiceAllYhdjUtils;
import com.jianshui.system.domain.InvoiceAllApiLog;
import com.jianshui.system.domain.InvoiceAllYhdj;
import com.jianshui.system.mapper.CompanyserviceMapper;
import com.jianshui.system.mapper.InvoiceAllApiLogMapper;
import com.jianshui.system.mapper.InvoiceAllYhdjMapper;
import com.jianshui.system.mapper.SysUserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* @Author: xingze
@ -56,8 +47,6 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
@Autowired
private InvoiceDeliveryMapper invoiceDeliveryMapper;
@Autowired
private InvoiceAllApiLogMapper allApiLogMapper;
/**
* 功能描述: 发票交付
@ -65,7 +54,7 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
* @return : com.jianshui.invoice.domain.dto.HXResponse
*/
@Override
public HXResponse invoiceDelivery(List<InvoiceDeliveryJsonDataDTO> dtos) {
public AjaxResult invoiceDelivery(List<InvoiceDeliveryJsonDataDTO> dtos) {
//获取用户id
Long userId = SecurityUtils.getUserId();
//根据用户id获取用户信息
@ -76,7 +65,7 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
InvoiceAllYhdjUtils invoiceAllYhdjUtils = new InvoiceAllYhdjUtils();
InvoiceAllYhdj userInfo = invoiceAllYhdjUtils.getUserInfo(companyservice);
if (BeanUtil.isEmpty(userInfo)) {
return new HXResponse("未查询到登记信息!");
return AjaxResult.error("未查询到登记信息!");
}
//封装上游接口实体类
InvoiceDeliveryDTO invoiceDeliveryDTO = new InvoiceDeliveryDTO();
@ -99,15 +88,6 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
String code = result.get("code") != null ? result.get("code").toString() : "";
String msg = result.get("msg") != null ? result.get("msg").toString() : "";
String data = result.get("data") != null ? result.get("data").toString() : "";
//封装调用日志
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog();
allApiLog.setUrl(WebServiceConstant.INVOIVEDELIVERY);
allApiLog.setSendMsg(invoiceDeliveryDTO.toString());
allApiLog.setResultMsg(JSONUtil.toJsonStr(result));
allApiLog.setCompany(companyservice.getSellertax());
allApiLog.setIdentityId(companyservice.getIdentity());
allApiLog.setCreateTime(new Date());
allApiLog.setRequestId(UUID.randomUUID().toString());
//封装实体类
BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery);
invoiceDelivery.setJflx(dto.getJflx());
@ -117,27 +97,25 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService {
invoiceDelivery.setType("1");
invoiceDelivery.setClerk(sysUser.getUserId());
invoiceDelivery.setCreateTime(new Date());
invoiceDelivery.setSource(ChannelSource.PLATFORM.getCode());
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) {
//存入调用日志表
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
//将数据存入业务表
invoiceDelivery.setStatus("0");
invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery);
} else {
//存入日志调用表
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
//将数据存入业务表
invoiceDelivery.setStatus("1");
invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery);
return new HXResponse(msg);
log.error("【发票交付】API请求异常,外部报文返回code非0000。错误id{},错误信息:{}", invoiceDelivery.getId(),msg);
return AjaxResult.error(msg);
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【申请红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("发票支付接口异常");
log.error("【发票交付】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return AjaxResult.error("发票支付接口异常");
}
}
return new HXResponse("0000", "处理成功");
return AjaxResult.success("0000", "处理成功");
}
}

@ -18,10 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="clerk" column="clerk" />
<result property="createTime" column="create_time" />
<result property="remark" column="remark" />
<result property="source" column="source" />
</resultMap>
<sql id="selectInvoiceDeliveryVo">
select id, bsrysfzjhm, dqbm, jflx, fphm, gmflxdh, gmfyx, nsrsbh, status, type, clerk, create_time, remark from invoice_delivery
select id, bsrysfzjhm, dqbm, jflx, fphm, gmflxdh, gmfyx, nsrsbh, status, type, clerk, create_time, remark, source from invoice_delivery
</sql>
<select id="selectInvoiceDeliveryList" parameterType="InvoiceDelivery" resultMap="InvoiceDeliveryResult">
@ -37,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="clerk != null "> and clerk = #{clerk}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
</where>
</select>
@ -60,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="clerk != null">clerk,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if>
<if test="source != null and source != ''">source,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bsrysfzjhm != null and bsrysfzjhm != ''">#{bsrysfzjhm},</if>
@ -74,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="clerk != null">#{clerk},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if>
<if test="source != null and source != ''">#{source},</if>
</trim>
</insert>
@ -92,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="clerk != null">clerk = #{clerk},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="source != null and source != ''">source = #{source},</if>
</trim>
where id = #{id}
</update>

Loading…
Cancel
Save