From 85d772e4be8fa6b97e6f56fdd194ddbabbdf1643 Mon Sep 17 00:00:00 2001 From: kane Date: Tue, 6 Jun 2023 18:57:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8F=91=E7=A5=A8=E4=BA=A4=E4=BB=98?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/InvoiceAddController.java | 6 +- .../platform/InvoiceDeliveryController.java | 36 ++++ .../constant/InvoiceAllYhdjConstants.java | 20 ++ .../common/constant/WebServiceConstant.java | 5 + .../platform/domain/InvoiceDelivery.java | 179 ++++++++++++++++++ .../{domain => }/dto/BillInfoDetailPDTO.java | 2 +- .../{domain => }/dto/BillInfoPDTO.java | 2 +- .../platform/dto/InvoiceDeliveryDTO.java | 36 ++++ .../dto/InvoiceDeliveryJsonDataDTO.java | 35 ++++ .../platform/mapper/CompanyServiceMapper.java | 17 ++ .../mapper/InvoiceDeliveryMapper.java | 22 +++ .../service/InvoiceDeliveryService.java | 22 +++ .../impl/InvoiceDeliveryServiceImpl.java | 179 ++++++++++++++++++ .../platform/{domain => }/vo/BillInfoPVO.java | 4 +- .../platform/mapper/CompanyServiceMapper.xml | 16 ++ .../platform/mapper/InvoiceDeliveryMapper.xml | 11 ++ 16 files changed, 584 insertions(+), 8 deletions(-) create mode 100644 jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceDeliveryController.java create mode 100644 jianshui-common/src/main/java/com/jianshui/common/constant/InvoiceAllYhdjConstants.java create mode 100644 jianshui-platform/src/main/java/com/jianshui/platform/domain/InvoiceDelivery.java rename jianshui-platform/src/main/java/com/jianshui/platform/{domain => }/dto/BillInfoDetailPDTO.java (95%) rename jianshui-platform/src/main/java/com/jianshui/platform/{domain => }/dto/BillInfoPDTO.java (97%) create mode 100644 jianshui-platform/src/main/java/com/jianshui/platform/dto/InvoiceDeliveryDTO.java create mode 100644 jianshui-platform/src/main/java/com/jianshui/platform/dto/InvoiceDeliveryJsonDataDTO.java create mode 100644 jianshui-platform/src/main/java/com/jianshui/platform/mapper/CompanyServiceMapper.java create mode 100644 jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java create mode 100644 jianshui-platform/src/main/java/com/jianshui/platform/service/InvoiceDeliveryService.java create mode 100644 jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java rename jianshui-platform/src/main/java/com/jianshui/platform/{domain => }/vo/BillInfoPVO.java (95%) create mode 100644 jianshui-platform/src/main/resources/com/jianshui/platform/mapper/CompanyServiceMapper.xml create mode 100644 jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml diff --git a/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceAddController.java b/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceAddController.java index fa08900..031b1ae 100644 --- a/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceAddController.java +++ b/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceAddController.java @@ -1,10 +1,8 @@ package com.jianshui.web.controller.platform; -import cn.hutool.json.JSON; import com.jianshui.common.core.controller.BaseController; -import com.jianshui.common.core.domain.AjaxResult; -import com.jianshui.platform.domain.dto.BillInfoPDTO; -import com.jianshui.platform.domain.vo.BillInfoPVO; +import com.jianshui.platform.dto.BillInfoPDTO; +import com.jianshui.platform.vo.BillInfoPVO; import io.swagger.annotations.*; import org.springframework.web.bind.annotation.*; diff --git a/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceDeliveryController.java b/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceDeliveryController.java new file mode 100644 index 0000000..c5fe3c9 --- /dev/null +++ b/jianshui-admin/src/main/java/com/jianshui/web/controller/platform/InvoiceDeliveryController.java @@ -0,0 +1,36 @@ +package com.jianshui.web.controller.platform; + +import com.jianshui.invoice.domain.dto.HXResponse; +import com.jianshui.platform.dto.InvoiceDeliveryJsonDataDTO; +import com.jianshui.platform.service.InvoiceDeliveryService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Author: xingze + * @Description: 发票交付 + * @CreateTime: 2023-06-06 10:27 + * @Version: 1.0 + **/ +@Api(tags={"发票交付"},value = "发票交付") +@RestController +@RequestMapping("/platForm") +public class InvoiceDeliveryController { + + @Autowired + private InvoiceDeliveryService invoiceDeliveryService; + + @ApiOperation("发票交付") + @PostMapping("/invoiceDelivery") + public Object invoiceDelivery(@RequestBody List dtos){ + HXResponse response = invoiceDeliveryService.invoiceDelivery(dtos); + return response; + } +} diff --git a/jianshui-common/src/main/java/com/jianshui/common/constant/InvoiceAllYhdjConstants.java b/jianshui-common/src/main/java/com/jianshui/common/constant/InvoiceAllYhdjConstants.java new file mode 100644 index 0000000..fb643d8 --- /dev/null +++ b/jianshui-common/src/main/java/com/jianshui/common/constant/InvoiceAllYhdjConstants.java @@ -0,0 +1,20 @@ +package com.jianshui.common.constant; + +/** + * @Author: xinzge + * @Description: 用户登记信息常量类 + * @CreateTime: 2023-06-06 13:35 + * @Version: 1.0 + **/ +public class InvoiceAllYhdjConstants { + /** + * 异步 + */ + public final static String ASYNC = "true"; + + /** + * 同步 + */ + public final static String SYNC = "false"; + +} diff --git a/jianshui-common/src/main/java/com/jianshui/common/constant/WebServiceConstant.java b/jianshui-common/src/main/java/com/jianshui/common/constant/WebServiceConstant.java index d2620ba..ff5743f 100644 --- a/jianshui-common/src/main/java/com/jianshui/common/constant/WebServiceConstant.java +++ b/jianshui-common/src/main/java/com/jianshui/common/constant/WebServiceConstant.java @@ -103,6 +103,11 @@ public class WebServiceConstant { */ public final static String CXLZFPKHCJE = "cxlzfpkhcje"; + /** + * 发票交付 + */ + public final static String INVOIVEDELIVERY = "fpjf"; + diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/domain/InvoiceDelivery.java b/jianshui-platform/src/main/java/com/jianshui/platform/domain/InvoiceDelivery.java new file mode 100644 index 0000000..427c529 --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/domain/InvoiceDelivery.java @@ -0,0 +1,179 @@ +package com.jianshui.platform.domain; + +import com.jianshui.common.annotation.Excel; +import com.jianshui.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 发票交付对象 invoice_delivery + * + * @author jianshui + * @date 2023-06-06 + */ +public class InvoiceDelivery extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 办税人身份证号 */ + @Excel(name = "办税人身份证号") + private String bsrysfzjhm; + + /** 地区编码 */ + @Excel(name = "地区编码") + private String dqbm; + + /** 交付类型0-邮箱 1-短信 */ + @Excel(name = "交付类型0-邮箱 1-短信") + private String jflx; + + /** 发票号码 */ + @Excel(name = "发票号码") + private String fphm; + + /** 购买方联系电话 */ + @Excel(name = "购买方联系电话") + private String gmflxdh; + + /** 购买方邮箱 */ + @Excel(name = "购买方邮箱") + private String gmfyx; + + /** 纳税人识别号 */ + @Excel(name = "纳税人识别号") + private String nsrsbh; + + /** 请求状态0-成功,1-失败 */ + @Excel(name = "请求状态0-成功,1-失败") + private String status; + + /** 请求通道0-大象,1-数科 */ + @Excel(name = "请求通道0-大象,1-数科") + private String type; + + /** 创建人id */ + @Excel(name = "创建人id") + private Long clerk; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setBsrysfzjhm(String bsrysfzjhm) + { + this.bsrysfzjhm = bsrysfzjhm; + } + + public String getBsrysfzjhm() + { + return bsrysfzjhm; + } + public void setDqbm(String dqbm) + { + this.dqbm = dqbm; + } + + public String getDqbm() + { + return dqbm; + } + public void setJflx(String jflx) + { + this.jflx = jflx; + } + + public String getJflx() + { + return jflx; + } + public void setFphm(String fphm) + { + this.fphm = fphm; + } + + public String getFphm() + { + return fphm; + } + public void setGmflxdh(String gmflxdh) + { + this.gmflxdh = gmflxdh; + } + + public String getGmflxdh() + { + return gmflxdh; + } + public void setGmfyx(String gmfyx) + { + this.gmfyx = gmfyx; + } + + public String getGmfyx() + { + return gmfyx; + } + public void setNsrsbh(String nsrsbh) + { + this.nsrsbh = nsrsbh; + } + + public String getNsrsbh() + { + return nsrsbh; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setClerk(Long clerk) + { + this.clerk = clerk; + } + + public Long getClerk() + { + return clerk; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("bsrysfzjhm", getBsrysfzjhm()) + .append("dqbm", getDqbm()) + .append("jflx", getJflx()) + .append("fphm", getFphm()) + .append("gmflxdh", getGmflxdh()) + .append("gmfyx", getGmfyx()) + .append("nsrsbh", getNsrsbh()) + .append("status", getStatus()) + .append("type", getType()) + .append("clerk", getClerk()) + .append("createTime", getCreateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/domain/dto/BillInfoDetailPDTO.java b/jianshui-platform/src/main/java/com/jianshui/platform/dto/BillInfoDetailPDTO.java similarity index 95% rename from jianshui-platform/src/main/java/com/jianshui/platform/domain/dto/BillInfoDetailPDTO.java rename to jianshui-platform/src/main/java/com/jianshui/platform/dto/BillInfoDetailPDTO.java index d384ff8..197b2bc 100644 --- a/jianshui-platform/src/main/java/com/jianshui/platform/domain/dto/BillInfoDetailPDTO.java +++ b/jianshui-platform/src/main/java/com/jianshui/platform/dto/BillInfoDetailPDTO.java @@ -1,4 +1,4 @@ -package com.jianshui.platform.domain.dto; +package com.jianshui.platform.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/domain/dto/BillInfoPDTO.java b/jianshui-platform/src/main/java/com/jianshui/platform/dto/BillInfoPDTO.java similarity index 97% rename from jianshui-platform/src/main/java/com/jianshui/platform/domain/dto/BillInfoPDTO.java rename to jianshui-platform/src/main/java/com/jianshui/platform/dto/BillInfoPDTO.java index 5013da7..a1e5bef 100644 --- a/jianshui-platform/src/main/java/com/jianshui/platform/domain/dto/BillInfoPDTO.java +++ b/jianshui-platform/src/main/java/com/jianshui/platform/dto/BillInfoPDTO.java @@ -1,4 +1,4 @@ -package com.jianshui.platform.domain.dto; +package com.jianshui.platform.dto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/dto/InvoiceDeliveryDTO.java b/jianshui-platform/src/main/java/com/jianshui/platform/dto/InvoiceDeliveryDTO.java new file mode 100644 index 0000000..736242c --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/dto/InvoiceDeliveryDTO.java @@ -0,0 +1,36 @@ +package com.jianshui.platform.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * @Author: xingze + * @Description: 发票交付类 + * @CreateTime: 2023-06-06 10:32 + * @Version: 1.0 + **/ +@ApiModel("发票交付") +@Data +public class InvoiceDeliveryDTO { + @NotEmpty + @ApiModelProperty(value = "true") + private String async; + + @NotEmpty + @ApiModelProperty(value = "办税人身份证号") + private String bsrysfzjhm; + + @NotEmpty + @ApiModelProperty(value = "*地区编码(参考码表)") + private String dqbm; + + @NotEmpty + @ApiModelProperty(value = "*纳税人识别号") + private String nsrsbh; + + private InvoiceDeliveryJsonDataDTO jsonData; +} diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/dto/InvoiceDeliveryJsonDataDTO.java b/jianshui-platform/src/main/java/com/jianshui/platform/dto/InvoiceDeliveryJsonDataDTO.java new file mode 100644 index 0000000..23f48a5 --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/dto/InvoiceDeliveryJsonDataDTO.java @@ -0,0 +1,35 @@ +package com.jianshui.platform.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; + +/** + * @Author: xingze + * @Description: 发票交付JsonData实体类 + * @CreateTime: 2023-06-06 10:35 + * @Version: 1.0 + **/ +@ApiModel("发票交付JsonData") +@Data +public class InvoiceDeliveryJsonDataDTO { + + @NotEmpty + @ApiModelProperty("交付类型") + private String jflx; + + @NotEmpty + @ApiModelProperty("发票号码") + private String fphm; + + @NotEmpty + @ApiModelProperty("购买方联系电话") + private String gmflxdh; + + @NotEmpty + @ApiModelProperty("购买方邮箱") + private String gmfyx; +} diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/mapper/CompanyServiceMapper.java b/jianshui-platform/src/main/java/com/jianshui/platform/mapper/CompanyServiceMapper.java new file mode 100644 index 0000000..f438b25 --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/mapper/CompanyServiceMapper.java @@ -0,0 +1,17 @@ +package com.jianshui.platform.mapper; + +import com.jianshui.common.core.domain.entity.Companyservice; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @Author: xingze + * @Description: 企业信息持久层 + * @CreateTime: 2023-06-06 12:05 + * @Version: 1.0 + **/ +@Mapper +public interface CompanyServiceMapper { + + Companyservice findByCompanyId(@Param("companyId") Long companyId); +} diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java b/jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java new file mode 100644 index 0000000..a8f275f --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java @@ -0,0 +1,22 @@ +package com.jianshui.platform.mapper; + +import com.jianshui.platform.domain.InvoiceDelivery; +import com.jianshui.platform.dto.InvoiceDeliveryDTO; +import org.apache.ibatis.annotations.Mapper; + +/** + * @Author: xinzge + * @Description: 发票交付持久层 + * @CreateTime: 2023-06-06 14:33 + * @Version: 1.0 + **/ +@Mapper +public interface InvoiceDeliveryMapper { + + /** + * 功能描述: 新增发票交付 + * @param invoiceDelivery 发票交付信息 + * @return : void + */ + void insertInvoiceDelivery(InvoiceDelivery invoiceDelivery); +} diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/service/InvoiceDeliveryService.java b/jianshui-platform/src/main/java/com/jianshui/platform/service/InvoiceDeliveryService.java new file mode 100644 index 0000000..d338cb5 --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/service/InvoiceDeliveryService.java @@ -0,0 +1,22 @@ +package com.jianshui.platform.service; + +import com.jianshui.invoice.domain.dto.HXResponse; +import com.jianshui.platform.dto.InvoiceDeliveryJsonDataDTO; + +import java.util.List; + +/** + * @Author: xinzge + * @Description: 发票交付service接口 + * @CreateTime: 2023-06-06 10:29 + * @Version: 1.0 + **/ +public interface InvoiceDeliveryService { + + /** + * 功能描述: 发票交付 + * @param dtos 多张(单张)交付信息 + * @return : com.jianshui.invoice.domain.dto.HXResponse + */ + HXResponse invoiceDelivery(List dtos); +} diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java b/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java new file mode 100644 index 0000000..e482e15 --- /dev/null +++ b/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java @@ -0,0 +1,179 @@ +package com.jianshui.platform.service.impl; + +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.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.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.platform.domain.InvoiceDelivery; +import com.jianshui.platform.dto.InvoiceDeliveryDTO; +import com.jianshui.platform.dto.InvoiceDeliveryJsonDataDTO; +import com.jianshui.platform.mapper.CompanyServiceMapper; +import com.jianshui.platform.mapper.InvoiceDeliveryMapper; +import com.jianshui.platform.service.InvoiceDeliveryService; +import com.jianshui.system.domain.InvoiceAllApiLog; +import com.jianshui.system.domain.InvoiceAllYhdj; +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 java.util.Date; +import java.util.List; + +/** + * @Author: xingze + * @Description: 发票交付业务实现类 + * @CreateTime: 2023-06-06 10:33 + * @Version: 1.0 + **/ +@Service +@Slf4j +public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService { + @Autowired + private SysUserMapper sysUserMapper; + @Autowired + private CompanyServiceMapper companyServiceMapper; + @Autowired + private InvoiceAllYhdjMapper yhdjMapper; + @Autowired + private InvoiceDeliveryMapper invoiceDeliveryMapper; + + @Autowired + private InvoiceAllApiLogMapper allApiLogMapper; + + /** + * 功能描述: 发票交付 + * @param dtos 多张(单张)交付信息 + * @return : com.jianshui.invoice.domain.dto.HXResponse + */ + @Override + public HXResponse invoiceDelivery(List dtos) { + //判空 + if (dtos.isEmpty()){ + return new HXResponse("传入信息为空,请检查信息!"); + } + //获取用户id + Long userId = SecurityUtils.getUserId(); + //根据用户id获取用户信息 + SysUser sysUser = sysUserMapper.selectUserById(userId); + //根据企业id获取企业信息 + Companyservice companyservice = companyServiceMapper.findByCompanyId(sysUser.getCompanyId()); + //获取登记用户信息 + InvoiceAllYhdj userInfo = getUserInfo(companyservice); + if (BeanUtil.isEmpty(userInfo)) { + return new HXResponse("未查询到登记信息!"); + } + //封装上游接口实体类 + InvoiceDeliveryDTO invoiceDeliveryDTO = new InvoiceDeliveryDTO(); + invoiceDeliveryDTO.setAsync(InvoiceAllYhdjConstants.SYNC); + invoiceDeliveryDTO.setBsrysfzjhm(userInfo.getBsrysfzjhm()); + invoiceDeliveryDTO.setDqbm(userInfo.getDqbm()); + invoiceDeliveryDTO.setNsrsbh(userInfo.getNsrsbh()); + //校验 + ValidateUtils.validate(invoiceDeliveryDTO); + ValidateUtils.validate(dtos); + InvoiceDelivery invoiceDelivery = new InvoiceDelivery(); + for (InvoiceDeliveryJsonDataDTO dto : dtos) { + invoiceDeliveryDTO.setJsonData(dto); + //发送请求获取结果 + JSONObject result = null; + try { + //发送请求 + result = ApiHttp.request(WebServiceConstant.INVOIVEDELIVERY, WebServiceConstant.URL, JSONUtil.parseObj(BeanToMapUtils.fastJsonBean2Map(invoiceDeliveryDTO)), companyservice); + //结果解析 + 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() : ""; + if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { + //存入调用日志表 + 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()); + allApiLogMapper.insertInvoiceAllApiLog(allApiLog); + //封装实体类 + BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery); + invoiceDelivery.setJflx(dto.getJflx()); + invoiceDelivery.setFphm(dto.getFphm()); + invoiceDelivery.setGmflxdh(dto.getGmflxdh()); + invoiceDelivery.setGmfyx(dto.getGmfyx()); + invoiceDelivery.setStatus("0"); + invoiceDelivery.setType("1"); + invoiceDelivery.setClerk(sysUser.getUserId()); + invoiceDelivery.setCreateTime(new Date()); + //将数据存入业务表 + invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery); + } else { + return new HXResponse(msg); + } + } catch (Exception e) { + e.printStackTrace(); + log.error("【金四服务类】【金财数科】【申请红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); + //封装实体类 + BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery); + invoiceDelivery.setJflx(dto.getJflx()); + invoiceDelivery.setFphm(dto.getFphm()); + invoiceDelivery.setGmflxdh(dto.getGmflxdh()); + invoiceDelivery.setGmfyx(dto.getGmfyx()); + invoiceDelivery.setStatus("1"); + invoiceDelivery.setType("1"); + invoiceDelivery.setClerk(sysUser.getUserId()); + invoiceDelivery.setCreateTime(new Date()); + //将数据存入业务表 + invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery); + return new HXResponse("发票支付接口异常"); + } + } + return new HXResponse("0000", "处理成功"); + } + + + /** + * 获取登记用户信息 + */ + public InvoiceAllYhdj getUserInfo(Companyservice companyservice) { + + String identity = companyservice.getIdentity(); + String sellertax = companyservice.getSellertax(); + + String key = WebServiceConstant.TOKEN_KEY + sellertax + "_"+ identity; + + RedisCache redisCache = SpringUtils.getBean(RedisCache.class); + cn.hutool.json.JSONObject yhdjObj = redisCache.getCacheObject(key); + + if(JSONUtil.isNull(yhdjObj)){ + // 查询用户登记参数 + QueryWrapper yhdjQueryWrapper = new QueryWrapper<>(); + yhdjQueryWrapper.eq("nsrsbh", sellertax); + yhdjQueryWrapper.eq("identity", identity); + InvoiceAllYhdj invoiceAllYhdj = yhdjMapper.selectOne(yhdjQueryWrapper); + + cn.hutool.json.JSONObject obj = JSONUtil.parseObj(invoiceAllYhdj); + Long exprieTime = System.currentTimeMillis(); // 过期时间 + obj.put("exprieTime", exprieTime); + redisCache.setCacheObject(key, obj); + + yhdjObj = obj; + } + + return BeanUtil.copyProperties(yhdjObj,InvoiceAllYhdj.class); + } +} diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/domain/vo/BillInfoPVO.java b/jianshui-platform/src/main/java/com/jianshui/platform/vo/BillInfoPVO.java similarity index 95% rename from jianshui-platform/src/main/java/com/jianshui/platform/domain/vo/BillInfoPVO.java rename to jianshui-platform/src/main/java/com/jianshui/platform/vo/BillInfoPVO.java index 7ef8527..18bbcdd 100644 --- a/jianshui-platform/src/main/java/com/jianshui/platform/domain/vo/BillInfoPVO.java +++ b/jianshui-platform/src/main/java/com/jianshui/platform/vo/BillInfoPVO.java @@ -1,6 +1,6 @@ -package com.jianshui.platform.domain.vo; +package com.jianshui.platform.vo; -import com.jianshui.platform.domain.dto.BillInfoDetailPDTO; +import com.jianshui.platform.dto.BillInfoDetailPDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/CompanyServiceMapper.xml b/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/CompanyServiceMapper.xml new file mode 100644 index 0000000..3169b2e --- /dev/null +++ b/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/CompanyServiceMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml b/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml new file mode 100644 index 0000000..10ec39d --- /dev/null +++ b/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml @@ -0,0 +1,11 @@ + + + + + + insert into invoice_delivery(bsrysfzjhm,dqbm,jflx,fphm,gmflxdh,gmfyx,nsrsbh) + values (#{bsrysfzjhm},#{dqbm},#{jflx},#{fphm},#{gmflxdh},#{gmfyx},#{nsrsbh}) + + \ No newline at end of file From ff4540a390ee7ca07440be1f45e8bc8b55ad53fd Mon Sep 17 00:00:00 2001 From: kane Date: Wed, 7 Jun 2023 08:51:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8F=91=E7=A5=A8=E4=BA=A4=E4=BB=98?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=911?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/InvoiceDeliveryMapper.java | 67 ++++++++--- .../impl/InvoiceDeliveryServiceImpl.java | 24 ++-- .../platform/mapper/InvoiceDeliveryMapper.xml | 108 +++++++++++++++++- 3 files changed, 169 insertions(+), 30 deletions(-) diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java b/jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java index a8f275f..5d6968d 100644 --- a/jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java +++ b/jianshui-platform/src/main/java/com/jianshui/platform/mapper/InvoiceDeliveryMapper.java @@ -1,22 +1,63 @@ package com.jianshui.platform.mapper; + import com.jianshui.platform.domain.InvoiceDelivery; -import com.jianshui.platform.dto.InvoiceDeliveryDTO; -import org.apache.ibatis.annotations.Mapper; + +import java.util.List; /** - * @Author: xinzge - * @Description: 发票交付持久层 - * @CreateTime: 2023-06-06 14:33 - * @Version: 1.0 - **/ -@Mapper -public interface InvoiceDeliveryMapper { + * 发票交付Mapper接口 + * + * @author jianshui + * @date 2023-06-06 + */ +public interface InvoiceDeliveryMapper +{ + /** + * 查询发票交付 + * + * @param id 发票交付主键 + * @return 发票交付 + */ + public InvoiceDelivery selectInvoiceDeliveryById(Long id); + + /** + * 查询发票交付列表 + * + * @param invoiceDelivery 发票交付 + * @return 发票交付集合 + */ + public List selectInvoiceDeliveryList(InvoiceDelivery invoiceDelivery); + + /** + * 新增发票交付 + * + * @param invoiceDelivery 发票交付 + * @return 结果 + */ + public int insertInvoiceDelivery(InvoiceDelivery invoiceDelivery); + + /** + * 修改发票交付 + * + * @param invoiceDelivery 发票交付 + * @return 结果 + */ + public int updateInvoiceDelivery(InvoiceDelivery invoiceDelivery); + + /** + * 删除发票交付 + * + * @param id 发票交付主键 + * @return 结果 + */ + public int deleteInvoiceDeliveryById(Long id); /** - * 功能描述: 新增发票交付 - * @param invoiceDelivery 发票交付信息 - * @return : void + * 批量删除发票交付 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 */ - void insertInvoiceDelivery(InvoiceDelivery invoiceDelivery); + public int deleteInvoiceDeliveryByIds(Long[] ids); } diff --git a/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java b/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java index e482e15..e82590d 100644 --- a/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java +++ b/jianshui-platform/src/main/java/com/jianshui/platform/service/impl/InvoiceDeliveryServiceImpl.java @@ -122,23 +122,23 @@ public class InvoiceDeliveryServiceImpl implements InvoiceDeliveryService { //将数据存入业务表 invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery); } else { + //封装实体类 + BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery); + invoiceDelivery.setJflx(dto.getJflx()); + invoiceDelivery.setFphm(dto.getFphm()); + invoiceDelivery.setGmflxdh(dto.getGmflxdh()); + invoiceDelivery.setGmfyx(dto.getGmfyx()); + invoiceDelivery.setStatus("1"); + invoiceDelivery.setType("1"); + invoiceDelivery.setClerk(sysUser.getUserId()); + invoiceDelivery.setCreateTime(new Date()); + //将数据存入业务表 + invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery); return new HXResponse(msg); } } catch (Exception e) { e.printStackTrace(); log.error("【金四服务类】【金财数科】【申请红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); - //封装实体类 - BeanUtils.copyProperties(invoiceDeliveryDTO, invoiceDelivery); - invoiceDelivery.setJflx(dto.getJflx()); - invoiceDelivery.setFphm(dto.getFphm()); - invoiceDelivery.setGmflxdh(dto.getGmflxdh()); - invoiceDelivery.setGmfyx(dto.getGmfyx()); - invoiceDelivery.setStatus("1"); - invoiceDelivery.setType("1"); - invoiceDelivery.setClerk(sysUser.getUserId()); - invoiceDelivery.setCreateTime(new Date()); - //将数据存入业务表 - invoiceDeliveryMapper.insertInvoiceDelivery(invoiceDelivery); return new HXResponse("发票支付接口异常"); } } diff --git a/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml b/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml index 10ec39d..9ca368e 100644 --- a/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml +++ b/jianshui-platform/src/main/resources/com/jianshui/platform/mapper/InvoiceDeliveryMapper.xml @@ -1,11 +1,109 @@ +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + + + + + + + + + + + + + - - insert into invoice_delivery(bsrysfzjhm,dqbm,jflx,fphm,gmflxdh,gmfyx,nsrsbh) - values (#{bsrysfzjhm},#{dqbm},#{jflx},#{fphm},#{gmflxdh},#{gmfyx},#{nsrsbh}) + + select id, bsrysfzjhm, dqbm, jflx, fphm, gmflxdh, gmfyx, nsrsbh, status, type, clerk, create_time, remark from invoice_delivery + + + + + + + + insert into invoice_delivery + + bsrysfzjhm, + dqbm, + jflx, + fphm, + gmflxdh, + gmfyx, + nsrsbh, + status, + type, + clerk, + create_time, + remark, + + + #{bsrysfzjhm}, + #{dqbm}, + #{jflx}, + #{fphm}, + #{gmflxdh}, + #{gmfyx}, + #{nsrsbh}, + #{status}, + #{type}, + #{clerk}, + #{createTime}, + #{remark}, + + + + update invoice_delivery + + bsrysfzjhm = #{bsrysfzjhm}, + dqbm = #{dqbm}, + jflx = #{jflx}, + fphm = #{fphm}, + gmflxdh = #{gmflxdh}, + gmfyx = #{gmfyx}, + nsrsbh = #{nsrsbh}, + status = #{status}, + type = #{type}, + clerk = #{clerk}, + create_time = #{createTime}, + remark = #{remark}, + + where id = #{id} + + + + delete from invoice_delivery where id = #{id} + + + + delete from invoice_delivery where id in + + #{id} + + \ No newline at end of file