产品CRM税务接口API接入标准规范1.0

This commit is contained in:
ZZM 2025-07-31 16:21:59 +08:00
parent 39229c50aa
commit da4a7059f7
43 changed files with 329 additions and 194 deletions

View File

@ -38,11 +38,11 @@ public class CrmNsrzgController {
return R.ok(nsrzg);
}
@PostMapping("/queryByDjxh/{djxh}")
@PostMapping("/queryByDjxh")
@ApiOperation("根据Djxh查询")
public Result<CrmNsrzg> queryByDjxh(@PathVariable("djxh") String djxh){
CrmNsrzg nsrzg = crmNsrzgService.getNsrzgByDjxh(djxh);
return R.ok(nsrzg);
public Result<List<CrmNsrzg>> queryByDjxh(@RequestBody CrmSyncNsrzgDTO crmSyncNsrzgDTO) throws Exception {
List<CrmNsrzg> nsrzgs = crmNsrzgService.queryByDjxh(crmSyncNsrzgDTO);
return R.ok(nsrzgs);
}
@PostMapping("/syncDataByDjxh")

View File

@ -6,7 +6,7 @@ import com.kakarote.core.common.R;
import com.kakarote.core.common.Result;
import com.kakarote.crm.entity.DTO.CrmSyncQycbrsDTO;
import com.kakarote.crm.entity.PO.CrmQycbrs;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.service.ICrmQycbrsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -41,14 +41,15 @@ public class CrmQycbrsController {
}
@PostMapping("/queryByNsrsbhAndTime")
public Result<List<CrmQycbrs>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeVO vo) {
public Result<List<CrmQycbrs>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeDTO vo) {
List<CrmQycbrs> qycbrsList = crmQycbrsService.getQycbrsListByNsrsbhAndTime(vo);
return R.ok(qycbrsList);
}
@PostMapping("/queryByDjxhAndTime")
public Result<List<CrmQycbrs>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeVO vo) {
List<CrmQycbrs> qycbrsList = crmQycbrsService.getQycbrsListByDjxhAndTime(vo);
@ApiOperation("根据登记序号和月份(选填)查询")
public Result<List<CrmQycbrs>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeDTO dto) throws Exception {
List<CrmQycbrs> qycbrsList = crmQycbrsService.queryByDjxhAndTime(dto);
return R.ok(qycbrsList);
}

View File

@ -5,7 +5,7 @@ import com.kakarote.core.common.R;
import com.kakarote.core.common.Result;
import com.kakarote.crm.entity.DTO.CrmSyncQyfxmxDTO;
import com.kakarote.crm.entity.PO.CrmQyfxmx;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.service.ICrmQyfxmxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -39,16 +39,16 @@ public class CrmQyfxmxController {
}
@PostMapping("/queryByNsrsbhAndTime")
@ApiOperation("根据登记序号和月份(选填)查询")
public Result<List<CrmQyfxmx>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeVO vo){
@ApiOperation("根据纳税人识别号和月份(选填)查询")
public Result<List<CrmQyfxmx>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeDTO vo){
List<CrmQyfxmx> qyfxmxList = crmQyfxmxService.getQyfxmxListByNsrsbhAndTime(vo);
return R.ok(qyfxmxList);
}
@PostMapping("/queryByDjxhAndTime")
@ApiOperation("根据登记序号和月份(选填)查询")
public Result<List<CrmQyfxmx>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeVO vo){
List<CrmQyfxmx> qyfxmxList = crmQyfxmxService.getQyfxmxListByDjxhAndTime(vo);
@ApiOperation("根据登记序号和评价年度(选填)查询")
public Result<List<CrmQyfxmx>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeDTO dto) throws Exception {
List<CrmQyfxmx> qyfxmxList = crmQyfxmxService.queryByDjxhAndTime(dto);
return R.ok(qyfxmxList);
}

View File

@ -1,12 +1,13 @@
package com.kakarote.crm.controller;
import cn.hutool.core.date.DateUtil;
import com.kakarote.core.common.ParamAspect;
import com.kakarote.core.common.R;
import com.kakarote.core.common.Result;
import com.kakarote.crm.entity.DTO.CrmSyncQyjxfpAndQyxxfpDTO;
import com.kakarote.crm.entity.PO.CrmQyjxfp;
import com.kakarote.crm.entity.VO.CrmMergeListVO;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.service.ICrmQyjxfpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -25,7 +26,8 @@ public class CrmQyjxfpController {
@PostMapping("/syncDataByShxydm")
@ApiOperation("根据社会信用代码同步WebService数据至数据库")
public Result<CrmMergeListVO> syncDataByShxydm(@RequestBody CrmSyncQyjxfpAndQyxxfpDTO dto) throws Exception {
CrmMergeListVO crmMergeListVO = crmQyjxfpService.syncDataByShxydm(dto);
String year = String.valueOf(DateUtil.thisYear());
CrmMergeListVO crmMergeListVO = crmQyjxfpService.syncDataByShxydm(dto,year);
return R.ok(crmMergeListVO);
}
@ -40,15 +42,15 @@ public class CrmQyjxfpController {
@PostMapping("/queryMergeListByNsrsbhAndTime")
@ApiOperation("通过纳税人识别号和年度(选填),查询企业进项发票和企业销项发票信息列表")
public Result queryMergeListByNsrsbhAndTime(@RequestBody CrmParamAndTimeVO vo){
public Result queryMergeListByNsrsbhAndTime(@RequestBody CrmParamAndTimeDTO vo){
CrmMergeListVO mergeList = crmQyjxfpService.getMergeListByNsrsbhAndTime(vo);
return R.ok(mergeList);
}
@PostMapping("/queryMergeListByShxydmAndTime")
@ApiOperation("通过纳税人识别号和年度(选填),查询企业进项发票和企业销项发票信息列表")
public Result queryMergeListByShxydmAndTime(@RequestBody CrmParamAndTimeVO vo){
CrmMergeListVO mergeList = crmQyjxfpService.getMergeListByShxydmAndTime(vo);
@ApiOperation("通过社会信用代码和年度(选填),查询企业进项发票和企业销项发票信息列表")
public Result queryMergeListByShxydmAndTime(@RequestBody CrmParamAndTimeDTO dto) throws Exception {
CrmMergeListVO mergeList = crmQyjxfpService.queryMergeListByShxydmAndTime(dto);
return R.ok(mergeList);
}

View File

@ -6,7 +6,7 @@ import com.kakarote.core.common.R;
import com.kakarote.core.common.Result;
import com.kakarote.crm.entity.DTO.CrmSyncDataQynsrdjDTO;
import com.kakarote.crm.entity.PO.CrmQynsrdj;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.service.ICrmQynsrdjService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -43,15 +43,15 @@ public class CrmQynsrdjController {
@PostMapping("/queryByNsrsbhAndTime")
@ApiOperation("根据纳税人识别号和评价年度(选填)查询")
public Result<List<CrmQynsrdj>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeVO vo) {
public Result<List<CrmQynsrdj>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeDTO vo) {
List<CrmQynsrdj> qynsrdjList = crmQynsrdjService.getQynsrdjListByNsrsbhAndTime(vo);
return R.ok(qynsrdjList);
}
@PostMapping("/queryByDjxhAndTime")
@ApiOperation("根据登记序号和评价年度(选填)查询")
public Result<List<CrmQynsrdj>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeVO vo) {
List<CrmQynsrdj> qynsrdjList = crmQynsrdjService.getQynsrdjListByDjxhAndTime(vo);
public Result<CrmQynsrdj> queryByDjxhAndTime(@RequestBody CrmParamAndTimeDTO dto) throws Exception {
CrmQynsrdj qynsrdjList = crmQynsrdjService.queryByDjxhAndTime(dto);
return R.ok(qynsrdjList);
}

View File

@ -5,7 +5,7 @@ import com.kakarote.core.common.R;
import com.kakarote.core.common.Result;
import com.kakarote.crm.entity.DTO.CrmSyncQysdsndsbDTO;
import com.kakarote.crm.entity.PO.CrmQysdsndsb;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.service.ICrmQysdsndsbService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -42,15 +42,15 @@ public class CrmQysdsndsbController {
@PostMapping("/queryByNsrsbhAndTime")
@ApiOperation("根据纳税人识别号和年度(选填)查询")
public Result<List<CrmQysdsndsb>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeVO vo) {
public Result<List<CrmQysdsndsb>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeDTO vo) {
List<CrmQysdsndsb> qysdsndsbList = crmQysdsndsbService.getQysdsndsbListByNsrsbhAndTime(vo);
return R.ok(qysdsndsbList);
}
@PostMapping("/queryByDjxhAndTime")
@ApiOperation("根据登记序号和年度(选填)查询")
public Result<List<CrmQysdsndsb>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeVO vo) {
List<CrmQysdsndsb> qysdsndsbList = crmQysdsndsbService.getQysdsndsbListByDjxhAndTime(vo);
public Result<List<CrmQysdsndsb>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeDTO dto) throws Exception {
List<CrmQysdsndsb> qysdsndsbList = crmQysdsndsbService.queryByDjxhAndTime(dto);
return R.ok(qysdsndsbList);
}

View File

@ -5,7 +5,7 @@ import com.kakarote.core.common.ParamAspect;
import com.kakarote.core.common.R;
import com.kakarote.core.common.Result;
import com.kakarote.crm.entity.PO.CrmQysfl;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.service.ICrmQysflService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -33,14 +33,14 @@ public class CrmQysflController {
@PostMapping("/queryByDjxhAndTime")
@ApiOperation("根据登记序号和评价年度(选填)查询")
public Result<List<CrmQysfl>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeVO vo){
public Result<List<CrmQysfl>> queryByDjxhAndTime(@RequestBody CrmParamAndTimeDTO vo){
List<CrmQysfl> qysflList = crmQysflService.getQysflByDjxhAndTimeList(vo);
return R.ok(qysflList);
}
@PostMapping("/queryByNsrsbhAndTime")
@ApiOperation("根据纳税人识别号和评价年度(选填)查询")
public Result<List<CrmQysfl>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeVO vo){
public Result<List<CrmQysfl>> queryByNsrsbhAndTime(@RequestBody CrmParamAndTimeDTO vo){
List<CrmQysfl> qysflList = crmQysflService.getQysflByNsrsbhAndTimeList(vo);
return R.ok(qysflList);
}

View File

@ -38,11 +38,11 @@ public class CrmSwjgController {
return R.ok(swjg);
}
@PostMapping("/queryBySwjgDm/{swjgDm}")
@ApiOperation("根据swjgDm查询")
public Result<CrmSwjg> queryBySwjgDm(@PathVariable("swjgDm") String swjgDm) {
CrmSwjg swjg = crmSwjgService.getSwjgBySwjgDm(swjgDm);
return R.ok(swjg);
@PostMapping("/queryBySwjgDmAndSjSwjgDm")
@ApiOperation("根据swjgDm和sjswjgdm查询")
public Result<List<CrmSwjg>> queryBySwjgDmAndSjSwjgDm(@RequestBody CrmSyncSwjgDTO crmSyncSwjgDTO) throws Exception {
List<CrmSwjg> swjgs = crmSwjgService.queryBySwjgDmAndSjSwjgDm(crmSyncSwjgDTO);
return R.ok(swjgs);
}
@PostMapping("/add")

View File

@ -1,9 +1,9 @@
package com.kakarote.crm.entity.VO;
package com.kakarote.crm.entity.DTO;
import lombok.Data;
@Data
public class CrmParamAndTimeVO {
public class CrmParamAndTimeDTO {
/**
* 根据接口不同param可能是djxh也可能是shxydm

View File

@ -2,11 +2,13 @@ package com.kakarote.crm.entity.DTO;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Getter
@Setter
@Accessors(chain = true)
public class CrmSyncDataQynsrdjDTO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -2,11 +2,13 @@ package com.kakarote.crm.entity.DTO;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Getter
@Setter
@Accessors(chain = true)
public class CrmSyncQycbrsDTO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -1,9 +1,11 @@
package com.kakarote.crm.entity.DTO;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(chain = true)
public class CrmSyncQyfxmxDTO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -2,11 +2,13 @@ package com.kakarote.crm.entity.DTO;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Getter
@Setter
@Accessors(chain = true)
public class CrmSyncQyjxfpAndQyxxfpDTO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -2,10 +2,12 @@ package com.kakarote.crm.entity.DTO;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Getter
@Setter
@Accessors(chain = true)
public class CrmSyncQysdsndsbDTO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -2,12 +2,14 @@ package com.kakarote.crm.entity.DTO;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Getter
@Setter
@Accessors(chain = true)
public class CrmSyncSwjgDTO implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -38,7 +38,6 @@ public class CrmNsrzg implements Serializable {
/**
* 登记序号
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String djxh;
/**

View File

@ -32,7 +32,6 @@ public class CrmQycbrs implements Serializable {
/**
* 月份
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String yf;
/**
@ -68,6 +67,5 @@ public class CrmQycbrs implements Serializable {
/**
* 登记序号
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String djxh;
}

View File

@ -31,10 +31,9 @@ public class CrmQyfxmx implements Serializable {
private Integer qyzbmxId;
/**
* 月份
* 评价年度
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String yf;
private String pjnd;
/**
* 风险指标代码
@ -75,7 +74,6 @@ public class CrmQyfxmx implements Serializable {
/**
* 登记序号
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String djxh;
/**

View File

@ -34,7 +34,6 @@ public class CrmQyjxfp implements Serializable {
/**
* 年度
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String nd;
/**
@ -61,7 +60,6 @@ public class CrmQyjxfp implements Serializable {
/**
* 社会信用代码
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String shxydm;
/**

View File

@ -32,13 +32,11 @@ public class CrmQynsrdj implements Serializable {
/**
* 登记序号
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String djxh;
/**
* 评价年度
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String pjnd;
/**

View File

@ -33,13 +33,11 @@ public class CrmQysdsndsb implements Serializable {
/**
* 登记序号
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String djxh;
/**
* 年度
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String nd;
/**

View File

@ -33,7 +33,6 @@ public class CrmQyxxfp implements Serializable {
/**
* 年度
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String nd;
/**
@ -74,7 +73,6 @@ public class CrmQyxxfp implements Serializable {
/**
* 社会信用代码
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String shxydm;
/**

View File

@ -38,7 +38,6 @@ public class CrmSwjg implements Serializable {
/**
* 税务机关代码
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String swjgDm;
/**
@ -50,7 +49,6 @@ public class CrmSwjg implements Serializable {
/**
* 上级税务机关代码
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String sjswjgDm;
/**

View File

@ -4,10 +4,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.kakarote.crm.entity.PO.CrmQyjxfp;
import com.kakarote.crm.entity.PO.CrmQyxxfp;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
public class CrmMergeListVO {
//企业进项发票集合

View File

@ -3,7 +3,7 @@
<mapper namespace="com.kakarote.crm.mapper.CrmQyfxmxMapper">
<resultMap id="BaseResultMap" type="com.kakarote.crm.entity.PO.CrmQyfxmx">
<result column="qyzbmx_id" jdbcType="INTEGER" property="qyzbmxId" />
<result column="yf" jdbcType="VARCHAR" property="yf" />
<result column="pjnd" jdbcType="VARCHAR" property="pjnd" />
<result column="fxzb_dm" jdbcType="VARCHAR" property="fxzbDm" />
<result column="fxms" jdbcType="VARCHAR" property="fxms" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />

View File

@ -2,6 +2,8 @@ package com.kakarote.crm.service;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.DTO.CrmSyncNsrzgDTO;
import com.kakarote.crm.entity.PO.CrmNsrzg;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
public interface ICrmNsrzgService extends BaseService<CrmNsrzg> {
@ -47,10 +49,10 @@ public interface ICrmNsrzgService extends BaseService<CrmNsrzg> {
/**
* 根据登记序号查询纳税人资格信息
* @param djxh
* @param crmSyncNsrzgDTO
* @return
*/
CrmNsrzg getNsrzgByDjxh(String djxh);
List<CrmNsrzg> queryByDjxh(CrmSyncNsrzgDTO crmSyncNsrzgDTO) throws Exception;
/**
* 根据登记序号查询纳税人资格信息(WebService)

View File

@ -3,7 +3,7 @@ package com.kakarote.crm.service;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.DTO.CrmSyncQycbrsDTO;
import com.kakarote.crm.entity.PO.CrmQycbrs;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import java.util.List;
@ -46,14 +46,14 @@ public interface ICrmQycbrsService extends BaseService<CrmQycbrs> {
* @param vo
* @return
*/
List<CrmQycbrs> getQycbrsListByNsrsbhAndTime(CrmParamAndTimeVO vo);
List<CrmQycbrs> getQycbrsListByNsrsbhAndTime(CrmParamAndTimeDTO vo);
/**
* 根据登记序号和月份(选填)查询企业参保人数信息列表
* @param vo
* @param dto
* @return
*/
List<CrmQycbrs> getQycbrsListByDjxhAndTime(CrmParamAndTimeVO vo);
List<CrmQycbrs> queryByDjxhAndTime(CrmParamAndTimeDTO dto) throws Exception;
/**
* 根据登记序号和月份(选填)查询企业参保人数信息列表(WebService)

View File

@ -3,7 +3,7 @@ package com.kakarote.crm.service;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.DTO.CrmSyncQyfxmxDTO;
import com.kakarote.crm.entity.PO.CrmQyfxmx;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import java.util.List;
@ -47,14 +47,14 @@ public interface ICrmQyfxmxService extends BaseService<CrmQyfxmx> {
* @param vo
* @return
*/
List<CrmQyfxmx> getQyfxmxListByNsrsbhAndTime(CrmParamAndTimeVO vo);
List<CrmQyfxmx> getQyfxmxListByNsrsbhAndTime(CrmParamAndTimeDTO vo);
/**
* 通过登记序号和月份(选填)查询企业风险明细信息列表
* @param vo
* @param dto
* @return
*/
List<CrmQyfxmx> getQyfxmxListByDjxhAndTime(CrmParamAndTimeVO vo);
List<CrmQyfxmx> queryByDjxhAndTime(CrmParamAndTimeDTO dto) throws Exception;
/**

View File

@ -4,7 +4,7 @@ import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.DTO.CrmSyncQyjxfpAndQyxxfpDTO;
import com.kakarote.crm.entity.PO.CrmQyjxfp;
import com.kakarote.crm.entity.VO.CrmMergeListVO;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import java.util.List;
@ -48,20 +48,20 @@ public interface ICrmQyjxfpService extends BaseService<CrmQyjxfp> {
* @param vo
* @return
*/
CrmMergeListVO getMergeListByNsrsbhAndTime(CrmParamAndTimeVO vo);
CrmMergeListVO getMergeListByNsrsbhAndTime(CrmParamAndTimeDTO vo);
/**
* 通过社会信用代码和年度(选填),查询企业进项发票和企业销项发票信息列表
* @param vo
* @param dto
* @return
*/
CrmMergeListVO getMergeListByShxydmAndTime(CrmParamAndTimeVO vo);
CrmMergeListVO queryMergeListByShxydmAndTime(CrmParamAndTimeDTO dto) throws Exception;
/**
* 通过社会信用代码,查询企业进项发票和企业销项发票信息列表(WebService)
* @param dto
* @return
*/
CrmMergeListVO syncDataByShxydm(CrmSyncQyjxfpAndQyxxfpDTO dto) throws Exception;
CrmMergeListVO syncDataByShxydm(CrmSyncQyjxfpAndQyxxfpDTO dto,String nd) throws Exception;
}

View File

@ -3,7 +3,7 @@ package com.kakarote.crm.service;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.DTO.CrmSyncDataQynsrdjDTO;
import com.kakarote.crm.entity.PO.CrmQynsrdj;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import java.util.List;
@ -47,14 +47,14 @@ public interface ICrmQynsrdjService extends BaseService<CrmQynsrdj> {
* @param vo
* @return
*/
List<CrmQynsrdj> getQynsrdjListByNsrsbhAndTime(CrmParamAndTimeVO vo);
List<CrmQynsrdj> getQynsrdjListByNsrsbhAndTime(CrmParamAndTimeDTO vo);
/**
* 根据登记序号和评价年度(选填)查询
* @param vo
* @param dto
* @return
*/
List<CrmQynsrdj> getQynsrdjListByDjxhAndTime(CrmParamAndTimeVO vo);
CrmQynsrdj queryByDjxhAndTime(CrmParamAndTimeDTO dto) throws Exception;
/**
* 根据登记序号和评价年度查询

View File

@ -4,7 +4,7 @@ package com.kakarote.crm.service;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.DTO.CrmSyncQysdsndsbDTO;
import com.kakarote.crm.entity.PO.CrmQysdsndsb;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import java.util.List;
@ -49,14 +49,14 @@ public interface ICrmQysdsndsbService extends BaseService<CrmQysdsndsb> {
* @param vo
* @return
*/
List<CrmQysdsndsb> getQysdsndsbListByNsrsbhAndTime(CrmParamAndTimeVO vo);
List<CrmQysdsndsb> getQysdsndsbListByNsrsbhAndTime(CrmParamAndTimeDTO vo);
/**
* 根据登记序号和年度查询年度(选填)申报信息列表
* @param vo
* @param dto
* @return
*/
List<CrmQysdsndsb> getQysdsndsbListByDjxhAndTime(CrmParamAndTimeVO vo);
List<CrmQysdsndsb> queryByDjxhAndTime(CrmParamAndTimeDTO dto) throws Exception;
/**

View File

@ -2,7 +2,7 @@ package com.kakarote.crm.service;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.PO.CrmQysfl;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import java.util.List;
@ -46,12 +46,12 @@ public interface ICrmQysflService extends BaseService<CrmQysfl> {
* @param vo
* @return
*/
List<CrmQysfl> getQysflByNsrsbhAndTimeList(CrmParamAndTimeVO vo);
List<CrmQysfl> getQysflByNsrsbhAndTimeList(CrmParamAndTimeDTO vo);
/**
* 根据登记序号和月份(月份)
* @param vo
* @return
*/
List<CrmQysfl> getQysflByDjxhAndTimeList(CrmParamAndTimeVO vo);
List<CrmQysfl> getQysflByDjxhAndTimeList(CrmParamAndTimeDTO vo);
}

View File

@ -2,40 +2,40 @@ package com.kakarote.crm.service;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.PO.CrmQyxxfp;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import java.util.List;
public interface ICrmQyxxfpService extends BaseService<CrmQyxxfp> {
/**
* 通过id获得企业所得税年度申报信息
* 通过id获得企业企业销项发票信息
*/
CrmQyxxfp getQyxxfp(Integer qyxxfpId);
/**
* 插入企业所得税年度申报信息
* 插入企业企业销项发票信息
* @param crmQyxxfp
* @return
*/
int insertQyxxfp(CrmQyxxfp crmQyxxfp);
/**
* 更新企业所得税年度申报信息
* 更新企业企业销项发票信息
* @param crmQyxxfp
* @return
*/
int updateQyxxfp(CrmQyxxfp crmQyxxfp);
/**
* 删除企业所得税年度申报信息
* 删除企业企业销项发票信息
* @param qyxxfpId
* @return
*/
int deleteQyxxfp(String qyxxfpId);
/**
* 查询企业所得税年度申报信息列表
* 查询企业企业销项发票信息列表
* @param crmQyxxfp
* @return
*/
@ -47,12 +47,12 @@ public interface ICrmQyxxfpService extends BaseService<CrmQyxxfp> {
* @param vo
* @return
*/
List<CrmQyxxfp> getQyxxfpListByNsrsbhAndTime(CrmParamAndTimeVO vo);
List<CrmQyxxfp> getQyxxfpListByNsrsbhAndTime(CrmParamAndTimeDTO vo);
/**
* 通过社会信用代码和年度(选填)查询企业销项发票信息
* @param vo
* @return
*/
List<CrmQyxxfp> getQyxxfpListByShxydmAndTime(CrmParamAndTimeVO vo);
List<CrmQyxxfp> getQyxxfpListByShxydmAndTime(CrmParamAndTimeDTO vo);
}

View File

@ -43,11 +43,11 @@ public interface ICrmSwjgService extends BaseService<CrmSwjg> {
/**
* 根据swjgDm查询税务机关信息
* @param swjgDm
* 根据swjgDm和sjswjgdm(选填)查询
* @param crmSyncSwjgDTO
* @return
*/
CrmSwjg getSwjgBySwjgDm(String swjgDm);
List<CrmSwjg> queryBySwjgDmAndSjSwjgDm(CrmSyncSwjgDTO crmSyncSwjgDTO) throws Exception;
/**
* 根据税务机构代码同步WebService数据至数据库

View File

@ -2,6 +2,7 @@ package com.kakarote.crm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kakarote.core.security.EncryptionService;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.crm.entity.DTO.CrmSyncNsrzgDTO;
import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
@ -19,6 +20,7 @@ import com.kakarote.crm.webService.util.XmlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Service
@ -34,6 +36,9 @@ public class CrmNsrzgServiceImpl extends BaseServiceImpl<CrmNsrzgMapper, CrmNsrz
@Autowired
private TaxWebServiceConfig config;
@Autowired
EncryptionService encryptionService;
@Override
public CrmNsrzg getNsrzg(Integer nsrdjzgId) {
return crmNsrzgMapper.selectById(nsrdjzgId);
@ -78,11 +83,19 @@ public class CrmNsrzgServiceImpl extends BaseServiceImpl<CrmNsrzgMapper, CrmNsrz
}
@Override
public CrmNsrzg getNsrzgByDjxh(String djxh) {
public List<CrmNsrzg> queryByDjxh(CrmSyncNsrzgDTO crmSyncNsrzgDTO) throws Exception {
return crmNsrzgMapper.selectOne(new QueryWrapper<CrmNsrzg>()
String djxh = crmSyncNsrzgDTO.getDjxh();
CrmNsrzg crmNsrzg = crmNsrzgMapper.selectOne(new QueryWrapper<CrmNsrzg>()
.eq("djxh", djxh)
);
if (crmNsrzg != null) {
return Collections.singletonList(crmNsrzg);
}
return syncDataByDjxh(crmSyncNsrzgDTO);
}
@Override

View File

@ -1,5 +1,6 @@
package com.kakarote.crm.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kakarote.core.servlet.BaseServiceImpl;
@ -7,7 +8,7 @@ import com.kakarote.crm.entity.DTO.CrmSyncQycbrsDTO;
import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
import com.kakarote.crm.entity.PO.CrmQycbrs;
import com.kakarote.crm.entity.PO.CrmQyjbxx;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.mapper.CrmQycbrsMapper;
import com.kakarote.crm.mapper.CrmQyjbxxMapper;
import com.kakarote.crm.service.ICrmQycbrsService;
@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Service
@ -62,24 +64,35 @@ public class CrmQycbrsServiceImpl extends BaseServiceImpl<CrmQycbrsMapper, CrmQy
}
@Override
public List<CrmQycbrs> getQycbrsListByDjxhAndTime(CrmParamAndTimeVO vo) {
public List<CrmQycbrs> queryByDjxhAndTime(CrmParamAndTimeDTO dto) throws Exception {
QueryWrapper<CrmQycbrs> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", vo.getParam());
String effectiveMonth;
if (vo.getTime() != null && !vo.getTime().isEmpty()) {
wrapper.eq("yf", vo.getTime());
CrmQycbrs qycbrs = crmQycbrsMapper.selectOne(wrapper);
return qycbrs != null ?
Collections.singletonList(qycbrs) :
Collections.emptyList();
if (dto.getTime() != null && !dto.getTime().isEmpty()) {
effectiveMonth = dto.getTime();
}else {
effectiveMonth = DateUtil.format(new Date(), "yyyyMM");
}
return crmQycbrsMapper.selectList(wrapper);
QueryWrapper<CrmQycbrs> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", dto.getParam());
wrapper.eq("yf", effectiveMonth);
List<CrmQycbrs> crmQycbrs = crmQycbrsMapper.selectList(wrapper);
if (crmQycbrs != null && !crmQycbrs.isEmpty()) {
return crmQycbrs;
}
CrmSyncQycbrsDTO crmSyncQycbrsDTO = new CrmSyncQycbrsDTO()
.setDjxh(dto.getParam())
.setYf(effectiveMonth);
return syncDataByDjxhAndYf(crmSyncQycbrsDTO);
}
@Override
public List<CrmQycbrs> getQycbrsListByNsrsbhAndTime(CrmParamAndTimeVO vo) {
public List<CrmQycbrs> getQycbrsListByNsrsbhAndTime(CrmParamAndTimeDTO vo) {
CrmQyjbxx crmQyjbxx = crmQyjbxxMapper.selectOne(new QueryWrapper<CrmQyjbxx>()
.select("djxh")
@ -134,6 +147,8 @@ public class CrmQycbrsServiceImpl extends BaseServiceImpl<CrmQycbrsMapper, CrmQy
List<CrmQycbrs> qycbrsList = dto.getData();
qycbrsList.forEach(qycbrs -> {
qycbrs.setDjxh(crmSyncQycbrsDTO.getDjxh());
qycbrs.setYf(crmSyncQycbrsDTO.getYf());
crmQycbrsMapper.insert(qycbrs);
});

View File

@ -10,7 +10,8 @@ import com.kakarote.crm.entity.DTO.CrmSyncQyfxmxDTO;
import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
import com.kakarote.crm.entity.PO.CrmQyfxmx;
import com.kakarote.crm.entity.PO.CrmQyjbxx;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.entity.PO.CrmQynsrdj;
import com.kakarote.crm.mapper.CrmQyfxmxMapper;
import com.kakarote.crm.mapper.CrmQyjbxxMapper;
import com.kakarote.crm.service.ICrmQyfxmxService;
@ -90,20 +91,32 @@ public class CrmQyfxmxServiceImpl extends BaseServiceImpl<CrmQyfxmxMapper, CrmQy
}
@Override
public List<CrmQyfxmx> getQyfxmxListByDjxhAndTime(CrmParamAndTimeVO vo) {
public List<CrmQyfxmx> queryByDjxhAndTime(CrmParamAndTimeDTO dto) throws Exception {
QueryWrapper<CrmQyfxmx> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", vo.getParam());
String effectiveYear;
if (vo.getTime() != null && !vo.getTime().isEmpty()) {
wrapper.eq("yf", vo.getTime());
CrmQyfxmx qyfxmx = crmQyfxmxMapper.selectOne(wrapper);
return qyfxmx != null ?
Collections.singletonList(qyfxmx) :
Collections.emptyList();
// 时间参数的选择
if (dto.getTime() != null && !dto.getTime().isEmpty()) {
effectiveYear = dto.getTime();
} else {
effectiveYear = String.valueOf(DateUtil.thisYear());
}
return crmQyfxmxMapper.selectList(wrapper);
QueryWrapper<CrmQyfxmx> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", dto.getParam());
wrapper.eq("pjnd", effectiveYear);
List<CrmQyfxmx> crmQyfxmxes = crmQyfxmxMapper.selectList(wrapper);
if (crmQyfxmxes != null && !crmQyfxmxes.isEmpty()) {
return crmQyfxmxes;
}
CrmSyncQyfxmxDTO crmSyncQyfxmxDTO = new CrmSyncQyfxmxDTO()
.setDjxh(dto.getParam())
.setPjnd(effectiveYear);
return syncDataByDjxhAndPjnd(crmSyncQyfxmxDTO);
}
@Override
@ -147,6 +160,8 @@ public class CrmQyfxmxServiceImpl extends BaseServiceImpl<CrmQyfxmxMapper, CrmQy
List<CrmQyfxmx> qyfxmxLsit = dto.getData();
qyfxmxLsit.forEach(qyfxmx -> {
qyfxmx.setPjnd(crmSyncQyfxmxDTO.getPjnd());
qyfxmx.setDjxh(crmSyncQyfxmxDTO.getDjxh());
crmQyfxmxMapper.insert(qyfxmx);
});
@ -154,7 +169,7 @@ public class CrmQyfxmxServiceImpl extends BaseServiceImpl<CrmQyfxmxMapper, CrmQy
}
@Override
public List<CrmQyfxmx> getQyfxmxListByNsrsbhAndTime(CrmParamAndTimeVO vo) {
public List<CrmQyfxmx> getQyfxmxListByNsrsbhAndTime(CrmParamAndTimeDTO vo) {
CrmQyjbxx crmQyjbxx = crmQyjbxxMapper.selectOne(new QueryWrapper<CrmQyjbxx>()
.select("djxh")

View File

@ -1,6 +1,10 @@
package com.kakarote.crm.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.crm.entity.BO.CrmAddMergeListBO;
@ -10,9 +14,10 @@ import com.kakarote.crm.entity.PO.CrmQyjbxx;
import com.kakarote.crm.entity.PO.CrmQyjxfp;
import com.kakarote.crm.entity.PO.CrmQyxxfp;
import com.kakarote.crm.entity.VO.CrmMergeListVO;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.mapper.CrmQyjbxxMapper;
import com.kakarote.crm.mapper.CrmQyjxfpMapper;
import com.kakarote.crm.mapper.CrmQyxxfpMapper;
import com.kakarote.crm.service.ICrmQyjxfpService;
import com.kakarote.crm.service.ICrmQyxxfpService;
import com.kakarote.crm.util.AecUtils;
@ -21,10 +26,13 @@ import com.kakarote.crm.webService.config.TaxWebServiceConfig;
import com.kakarote.crm.webService.entity.Body;
import com.kakarote.crm.webService.util.WebServiceUtil;
import com.kakarote.crm.webService.util.XmlService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
public class CrmQyjxfpServiceImpl extends BaseServiceImpl<CrmQyjxfpMapper, CrmQyjxfp> implements ICrmQyjxfpService {
@ -32,6 +40,9 @@ public class CrmQyjxfpServiceImpl extends BaseServiceImpl<CrmQyjxfpMapper, CrmQy
@Autowired
private CrmQyjxfpMapper crmQyjxfpMapper;
@Autowired
private CrmQyxxfpMapper crmQyxxfpMapper;
@Autowired
private ICrmQyxxfpService crmQyxxfpService;
@ -98,42 +109,35 @@ public class CrmQyjxfpServiceImpl extends BaseServiceImpl<CrmQyjxfpMapper, CrmQy
}
@Override
public CrmMergeListVO getMergeListByShxydmAndTime(CrmParamAndTimeVO vo) {
public CrmMergeListVO queryMergeListByShxydmAndTime(CrmParamAndTimeDTO dto) throws Exception {
CrmMergeListVO mergeListVO = new CrmMergeListVO();
String effectiveYear = StrUtil.isNotEmpty(dto.getTime()) ?
dto.getTime() :
String.valueOf(DateUtil.thisYear());
QueryWrapper<CrmQyjxfp> wrapper = new QueryWrapper<>();
wrapper.eq("shxydm", vo.getParam());
// 查询两个数据集
List<CrmQyjxfp> jxfpList = executeQuery(crmQyjxfpMapper, dto.getParam(), effectiveYear);
List<CrmQyxxfp> xxfpList = executeQuery(crmQyxxfpMapper, dto.getParam(), effectiveYear);
System.out.println(vo.getTime());
// 根据时间条件处理进项发票查询
if (vo.getTime() != null && !vo.getTime().isEmpty()) {
// 添加时间条件
wrapper.eq("nd", vo.getTime());
CrmQyjxfp qyjxfp = crmQyjxfpMapper.selectOne(wrapper);
mergeListVO.setJxfpList(qyjxfp != null ?
Collections.singletonList(qyjxfp) :
Collections.emptyList());
} else {
// 无时间条件时直接查询列表
mergeListVO.setJxfpList(crmQyjxfpMapper.selectList(wrapper));
// 只有当两个列表都有数据时才返回结果
if (CollUtil.isNotEmpty(jxfpList) && CollUtil.isNotEmpty(xxfpList)) {
return new CrmMergeListVO()
.setJxfpList(jxfpList)
.setXxfpList(xxfpList);
}
// 处理销项发票查询
List<CrmQyxxfp> qyxxfpList = crmQyxxfpService.getQyxxfpListByShxydmAndTime(vo);
mergeListVO.setXxfpList(qyxxfpList);
return mergeListVO;
return syncDataByShxydm(new CrmSyncQyjxfpAndQyxxfpDTO().setShxydm(dto.getParam()),effectiveYear);
}
/**
* 通过社会信用代码和年度(选填),查询企业进项发票和企业销项发票信息列表
* @param vo
* @return
*/
@Override
public CrmMergeListVO getMergeListByNsrsbhAndTime(CrmParamAndTimeVO vo) {
public CrmMergeListVO getMergeListByNsrsbhAndTime(CrmParamAndTimeDTO vo) {
CrmMergeListVO mergeListVO = new CrmMergeListVO();
@ -174,7 +178,7 @@ public class CrmQyjxfpServiceImpl extends BaseServiceImpl<CrmQyjxfpMapper, CrmQy
}
@Override
public CrmMergeListVO syncDataByShxydm(CrmSyncQyjxfpAndQyxxfpDTO dto) throws Exception {
public CrmMergeListVO syncDataByShxydm(CrmSyncQyjxfpAndQyxxfpDTO dto,String nd) throws Exception {
Body object = new Body();
object.setSid("JXSW.DZSWJ.CSXT.CXFPHZXX");
@ -197,25 +201,60 @@ public class CrmQyjxfpServiceImpl extends BaseServiceImpl<CrmQyjxfpMapper, CrmQy
System.out.println ("respJson = " + respJson);
CrmWebServiceResponseDTO<CrmAddMergeListBO> responseDTO = JsonUtil.toObject(respJson, new TypeReference<CrmWebServiceResponseDTO<CrmAddMergeListBO>>() {});
CrmWebServiceResponseDTO<CrmAddMergeListBO> responseDTO = JsonUtil.toObject(
respJson,
new TypeReference<CrmWebServiceResponseDTO<CrmAddMergeListBO>>() {}
);
CrmAddMergeListBO mergeListBO = responseDTO.getData();
List<CrmQyjxfp> jxhzList = mergeListBO.getJxhzList();
List<CrmQyxxfp> xxhzList = mergeListBO.getXxhzList();
// 查询两个数据集
List<CrmQyjxfp> jxfpList = executeQuery(crmQyjxfpMapper, dto.getShxydm(), nd);
List<CrmQyxxfp> xxfpList = executeQuery(crmQyxxfpMapper, dto.getShxydm(), nd);
jxhzList.forEach(qyjxfp -> {
crmQyjxfpMapper.insert(qyjxfp);
});
// 处理进项发票
List<CrmQyjxfp> qyjxfpList;
if (jxfpList.isEmpty()){
qyjxfpList = mergeListBO.getJxhzList()
.stream()
.filter(crmQyjxfp -> {
if (Objects.equals(crmQyjxfp.getNd(), nd)) {
crmQyjxfp.setShxydm(dto.getShxydm());
crmQyjxfpMapper.insert(crmQyjxfp);
return true;
}
return false;
})
.collect(Collectors.toList());
} else {
qyjxfpList = jxfpList;
}
xxhzList.forEach(qyxxfp -> {
crmQyxxfpService.insertQyxxfp(qyxxfp);
});
// 处理销项发票
List<CrmQyxxfp> qyxxfpList;
if (xxfpList.isEmpty()){
qyxxfpList = mergeListBO.getXxhzList()
.stream()
.filter(crmQyxxfp -> {
if (Objects.equals(crmQyxxfp.getNd(), nd)) {
crmQyxxfp.setShxydm(dto.getShxydm());
crmQyxxfpMapper.insert(crmQyxxfp);
return true;
}
return false;
}).collect(Collectors.toList());
} else {
qyxxfpList = xxfpList;
}
CrmMergeListVO mergeListVO = new CrmMergeListVO();
mergeListVO.setJxfpList(jxhzList);
mergeListVO.setXxfpList(xxhzList);
return new CrmMergeListVO()
.setJxfpList(qyjxfpList)
.setXxfpList(qyxxfpList);
}
return mergeListVO;
private <T> List<T> executeQuery(BaseMapper<T> mapper, String shxydm, String year) {
QueryWrapper<T> wrapper = new QueryWrapper<>();
wrapper.eq("shxydm", shxydm).eq("nd", year);
return mapper.selectList(wrapper);
}
}

View File

@ -1,12 +1,13 @@
package com.kakarote.crm.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.crm.entity.DTO.CrmSyncDataQynsrdjDTO;
import com.kakarote.crm.entity.PO.CrmQyjbxx;
import com.kakarote.crm.entity.PO.CrmQynsrdj;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
import com.kakarote.crm.mapper.CrmQyjbxxMapper;
import com.kakarote.crm.mapper.CrmQynsrdjMapper;
@ -63,7 +64,7 @@ public class CrmQynsrdjServiceImpl extends BaseServiceImpl<CrmQynsrdjMapper, Crm
}
@Override
public List<CrmQynsrdj> getQynsrdjListByNsrsbhAndTime(CrmParamAndTimeVO vo){
public List<CrmQynsrdj> getQynsrdjListByNsrsbhAndTime(CrmParamAndTimeDTO vo){
CrmQyjbxx crmQyjbxx = crmQyjbxxMapper.selectOne(new QueryWrapper<CrmQyjbxx>()
.select("djxh")
@ -117,6 +118,8 @@ public class CrmQynsrdjServiceImpl extends BaseServiceImpl<CrmQynsrdjMapper, Crm
CrmWebServiceResponseDTO<CrmQynsrdj> dto = JsonUtil.toObject(respJson, new TypeReference<CrmWebServiceResponseDTO<CrmQynsrdj>>() {});
CrmQynsrdj crmQynsrdj = dto.getData();
crmQynsrdj.setPjnd(crmSyncDataQynsrdjDTO.getPjnd());
crmQynsrdj.setDjxh(crmSyncDataQynsrdjDTO.getDjxh());
crmQynsrdjMapper.insert(crmQynsrdj);
@ -124,21 +127,31 @@ public class CrmQynsrdjServiceImpl extends BaseServiceImpl<CrmQynsrdjMapper, Crm
}
@Override
public List<CrmQynsrdj> getQynsrdjListByDjxhAndTime(CrmParamAndTimeVO vo) {
public CrmQynsrdj queryByDjxhAndTime(CrmParamAndTimeDTO dto) throws Exception {
QueryWrapper<CrmQynsrdj> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", vo.getParam());
String effectiveYear;
// 当时间参数存在时添加时间条件并返回单条结果
if (vo.getTime() != null && !vo.getTime().isEmpty()) {
wrapper.eq("pjnd", vo.getTime());
CrmQynsrdj entity = crmQynsrdjMapper.selectOne(wrapper);
return entity != null ?
Collections.singletonList(entity) :
Collections.emptyList();
// 时间参数的选择
if (dto.getTime() != null && !dto.getTime().isEmpty()) {
effectiveYear = dto.getTime();
} else {
effectiveYear = String.valueOf(DateUtil.thisYear());
}
// 无时间参数时返回匹配的所有记录
return crmQynsrdjMapper.selectList(wrapper);
QueryWrapper<CrmQynsrdj> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", dto.getParam());
wrapper.eq("pjnd", effectiveYear);
CrmQynsrdj qynsrdj = crmQynsrdjMapper.selectOne(wrapper);
if (qynsrdj != null) {
return qynsrdj;
}
CrmSyncDataQynsrdjDTO syncDataQynsrdjDTO = new CrmSyncDataQynsrdjDTO()
.setDjxh(dto.getParam())
.setPjnd(effectiveYear);
return syncDataByDjxhAndPjnd(syncDataQynsrdjDTO);
}
}

View File

@ -1,14 +1,16 @@
package com.kakarote.crm.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.crm.entity.DTO.CrmSyncDataQynsrdjDTO;
import com.kakarote.crm.entity.DTO.CrmSyncQysdsndsbDTO;
import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
import com.kakarote.crm.entity.PO.CrmQyjbxx;
import com.kakarote.crm.entity.PO.CrmQysdsndsb;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.mapper.CrmQyjbxxMapper;
import com.kakarote.crm.mapper.CrmQysdsndsbMapper;
import com.kakarote.crm.service.ICrmQysdsndsbService;
@ -63,24 +65,35 @@ public class CrmQysdsndsbServiceImpl extends BaseServiceImpl<CrmQysdsndsbMapper,
}
@Override
public List<CrmQysdsndsb> getQysdsndsbListByDjxhAndTime(CrmParamAndTimeVO vo) {
public List<CrmQysdsndsb> queryByDjxhAndTime(CrmParamAndTimeDTO dto) throws Exception {
QueryWrapper<CrmQysdsndsb> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", vo.getParam());
String effectiveYear;
if (vo.getTime() != null && !vo.getTime().isEmpty()) {
wrapper.eq("nd", vo.getTime());
CrmQysdsndsb qysdsndsb = crmQysdsndsbMapper.selectOne(wrapper);
return qysdsndsb != null ?
Collections.singletonList(qysdsndsb) :
Collections.emptyList();
if (dto.getTime() != null && !dto.getTime().isEmpty()) {
effectiveYear = dto.getTime();
}else {
effectiveYear = String.valueOf(DateUtil.thisYear());
}
return crmQysdsndsbMapper.selectList(wrapper);
QueryWrapper<CrmQysdsndsb> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", dto.getParam());
wrapper.eq("nd", effectiveYear);
List<CrmQysdsndsb> qysdsndsbList = crmQysdsndsbMapper.selectList(wrapper);
if (qysdsndsbList != null && !qysdsndsbList.isEmpty()) {
return qysdsndsbList;
}
CrmSyncQysdsndsbDTO crmSyncQysdsndsbDTO = new CrmSyncQysdsndsbDTO()
.setDjxh(dto.getParam())
.setNd(effectiveYear);
return syncDataByDjxhAndNd(crmSyncQysdsndsbDTO);
}
@Override
public List<CrmQysdsndsb> getQysdsndsbListByNsrsbhAndTime(CrmParamAndTimeVO vo) {
public List<CrmQysdsndsb> getQysdsndsbListByNsrsbhAndTime(CrmParamAndTimeDTO vo) {
CrmQyjbxx crmQyjbxx = crmQyjbxxMapper.selectOne(new QueryWrapper<CrmQyjbxx>()
.select("djxh")
@ -135,6 +148,8 @@ public class CrmQysdsndsbServiceImpl extends BaseServiceImpl<CrmQysdsndsbMapper,
List<CrmQysdsndsb> crmQysdsndsbList = dto.getData();
crmQysdsndsbList.forEach(crmQysdsndsb -> {
crmQysdsndsb.setDjxh(crmSyncQysdsndsbDTO.getDjxh());
crmQysdsndsb.setNd(crmSyncQysdsndsbDTO.getNd());
crmQysdsndsbMapper.insert(crmQysdsndsb);
} );

View File

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.crm.entity.PO.CrmQyjbxx;
import com.kakarote.crm.entity.PO.CrmQysfl;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.mapper.CrmQyjbxxMapper;
import com.kakarote.crm.mapper.CrmQysflMapper;
import com.kakarote.crm.service.ICrmQysflService;
@ -50,7 +50,7 @@ public class CrmQysflServiceImpl extends BaseServiceImpl<CrmQysflMapper, CrmQysf
}
@Override
public List<CrmQysfl> getQysflByDjxhAndTimeList(CrmParamAndTimeVO vo) {
public List<CrmQysfl> getQysflByDjxhAndTimeList(CrmParamAndTimeDTO vo) {
QueryWrapper<CrmQysfl> wrapper = new QueryWrapper<>();
wrapper.eq("djxh", vo.getParam());
@ -67,7 +67,7 @@ public class CrmQysflServiceImpl extends BaseServiceImpl<CrmQysflMapper, CrmQysf
}
@Override
public List<CrmQysfl> getQysflByNsrsbhAndTimeList(CrmParamAndTimeVO vo) {
public List<CrmQysfl> getQysflByNsrsbhAndTimeList(CrmParamAndTimeDTO vo) {
CrmQyjbxx crmQyjbxx = crmQyjbxxMapper.selectOne(new QueryWrapper<CrmQyjbxx>()
.select("djxh")

View File

@ -3,9 +3,8 @@ package com.kakarote.crm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.crm.entity.PO.CrmQyjbxx;
import com.kakarote.crm.entity.PO.CrmQyjxfp;
import com.kakarote.crm.entity.PO.CrmQyxxfp;
import com.kakarote.crm.entity.VO.CrmParamAndTimeVO;
import com.kakarote.crm.entity.DTO.CrmParamAndTimeDTO;
import com.kakarote.crm.mapper.CrmQyjbxxMapper;
import com.kakarote.crm.mapper.CrmQyxxfpMapper;
import com.kakarote.crm.service.ICrmQyxxfpService;
@ -51,7 +50,7 @@ public class CrmQyxxfpServiceImpl extends BaseServiceImpl<CrmQyxxfpMapper, CrmQy
}
@Override
public List<CrmQyxxfp> getQyxxfpListByShxydmAndTime(CrmParamAndTimeVO vo) {
public List<CrmQyxxfp> getQyxxfpListByShxydmAndTime(CrmParamAndTimeDTO vo) {
QueryWrapper<CrmQyxxfp> wrapper = new QueryWrapper<>();
wrapper.eq("shxydm", vo.getParam());
@ -68,7 +67,7 @@ public class CrmQyxxfpServiceImpl extends BaseServiceImpl<CrmQyxxfpMapper, CrmQy
}
@Override
public List<CrmQyxxfp> getQyxxfpListByNsrsbhAndTime(CrmParamAndTimeVO vo) {
public List<CrmQyxxfp> getQyxxfpListByNsrsbhAndTime(CrmParamAndTimeDTO vo) {
CrmQyjbxx crmQyjbxx = crmQyjbxxMapper.selectOne(new QueryWrapper<CrmQyjbxx>()
.select("shxydm")

View File

@ -16,6 +16,8 @@ import com.kakarote.crm.webService.util.WebServiceUtil;
import com.kakarote.crm.webService.util.XmlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Service
@ -89,9 +91,29 @@ public class CrmSwjgServiceImpl extends BaseServiceImpl<CrmSwjgMapper, CrmSwjg>
}
@Override
public CrmSwjg getSwjgBySwjgDm(String swjgDm) {
QueryWrapper<CrmSwjg> crmSwjgQueryWrapper = new QueryWrapper<>();
crmSwjgQueryWrapper.eq("swjg_dm", swjgDm);
return crmSwjgMapper.selectOne(crmSwjgQueryWrapper);
public List<CrmSwjg> queryBySwjgDmAndSjSwjgDm(CrmSyncSwjgDTO crmSyncSwjgDTO) throws Exception {
String swjgdm = crmSyncSwjgDTO.getSwjgdm();
String sjswjgdm = crmSyncSwjgDTO.getSjswjgdm();
// 构建基础查询条件
QueryWrapper<CrmSwjg> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("swjg_dm", swjgdm);
// 添加可选条件
if (sjswjgdm != null && !sjswjgdm.isEmpty()) {
queryWrapper.eq("sjswjg_dm", sjswjgdm);
}
// 尝试查询
CrmSwjg crmSwjg = crmSwjgMapper.selectOne(queryWrapper);
// 查询成功时返回单元素列表
if (crmSwjg != null) {
return Collections.singletonList(crmSwjg);
}
// 查询失败时尝试同步
return syncDataBySwjgDmAndSjswjgDm(crmSyncSwjgDTO);
}
}