申报自检结果:改版
This commit is contained in:
parent
f225657b9a
commit
24a411b396
|
|
@ -32,8 +32,8 @@ public class CrmSbzjjgController {
|
|||
|
||||
@PostMapping("/accountQuery")
|
||||
@ApiOperation("户次查询")
|
||||
public Result<CrmAccountQueryResponseVO> accountQuery(@RequestBody CrmAccountQueryRequestVO crmAccountQueryRequestVO) {
|
||||
CrmAccountQueryResponseVO crmAccountQueryResponseVO = crmSbzjjgService.accountQuery(crmAccountQueryRequestVO);
|
||||
public Result<List<Map<String,Object>>> accountQuery(@RequestBody CrmAccountQueryRequestVO crmAccountQueryRequestVO) {
|
||||
List<Map<String,Object>> crmAccountQueryResponseVO = crmSbzjjgService.accountQuery(crmAccountQueryRequestVO);
|
||||
return R.ok(crmAccountQueryResponseVO);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ public class CrmAccountQueryRequestVO extends PageEntity implements Serializable
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// 主管税务机关代码(必填)
|
||||
private String zgswjg;
|
||||
// 市级税务机关代码
|
||||
private String sjSwjgdm;
|
||||
|
||||
// 主管税务所(分局)代码
|
||||
private String zgsws;
|
||||
// 区县税务机关代码(主管税务机关)
|
||||
private String qxSwjgdm;
|
||||
|
||||
// 征收项目
|
||||
private String zsxm;
|
||||
|
|
@ -32,6 +32,9 @@ public class CrmAccountQueryRequestVO extends PageEntity implements Serializable
|
|||
// 自检指标
|
||||
private String zjzbmc;
|
||||
|
||||
//自检指标代码
|
||||
private String zjzbdm;
|
||||
|
||||
// 税收管理员
|
||||
private String ssgly;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
package com.kakarote.crm.entity.VO;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class CrmAccountQueryResponseVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 税务机关:1.主管税务局,2.主管税务所
|
||||
*/
|
||||
private String swjg;
|
||||
|
||||
/**
|
||||
* 税务机关代码
|
||||
*/
|
||||
private String swjgDm;
|
||||
|
||||
/**
|
||||
* 上级税务机关代码
|
||||
*/
|
||||
private String sjSwjgDm;
|
||||
|
||||
/**
|
||||
* 申报自检户次
|
||||
*/
|
||||
private Integer sbzjhc;
|
||||
|
||||
/**
|
||||
* 无需处理户次
|
||||
*/
|
||||
private Integer wxclhc;
|
||||
|
||||
/**
|
||||
* 检测通过户次
|
||||
*/
|
||||
private Integer jctghc;
|
||||
|
||||
/**
|
||||
* 未更正户次
|
||||
*/
|
||||
private Integer wgzhc;
|
||||
|
||||
/**
|
||||
* 已更正(问题未解决)户次
|
||||
*/
|
||||
private Integer ybtse1;
|
||||
|
||||
/**
|
||||
* 已更正(问题已解决)户次
|
||||
*/
|
||||
private Integer ybtse2;
|
||||
|
||||
/**
|
||||
* 补正税款金额
|
||||
*/
|
||||
private Double bzskje;
|
||||
|
||||
/**
|
||||
* 税务所的统计结果
|
||||
*/
|
||||
List<CrmAccountQueryResponseVO> children;
|
||||
}
|
||||
|
|
@ -13,8 +13,11 @@ public class CrmRankByEnterpriseRiskRequestVO extends PageEntity implements Seri
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// 主管税务机关
|
||||
private String zgswjg;
|
||||
// 市级税务机关
|
||||
private String sjSwjgdm;
|
||||
|
||||
// 区县税务机关
|
||||
private String qxSwjgdm;
|
||||
|
||||
// 自检日期起
|
||||
private String zjrqq;
|
||||
|
|
|
|||
|
|
@ -13,13 +13,16 @@ import java.util.Map;
|
|||
@Mapper
|
||||
public interface CrmSbzjjgMapper extends BaseMapper<CrmSbzjjg> {
|
||||
|
||||
CrmAccountQueryResponseVO accountQuery(@Param("vo") CrmAccountQueryRequestVO crmAccountQueryRequestVO);
|
||||
List<Map<String,Object>> accountQuery(@Param("vo") CrmAccountQueryRequestVO crmAccountQueryRequestVO,
|
||||
@Param("fuzzy") String fuzzy);
|
||||
|
||||
List<CrmSbzjjg> accountQueryDetail(@Param("vo") CrmAccountQueryRequestVO crmAccountQueryRequestVO,
|
||||
@Param("fuzzy") String fuzzy,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
List<Map<String,Object>> rankByEnterpriseRisk(@Param("vo") CrmRankByEnterpriseRiskRequestVO crmRankByEnterpriseRiskRequestVO,
|
||||
@Param("fuzzy") String fuzzy,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
|
|
@ -40,5 +43,5 @@ public interface CrmSbzjjgMapper extends BaseMapper<CrmSbzjjg> {
|
|||
|
||||
List<String> fuzzyQueryByKeyWord(@Param("keyword") String keyword);
|
||||
|
||||
List<Map<String, Object>> batchCheckExists(@Param("batchEntities") List<CrmSbzjjg> batchEntities);
|
||||
List<CrmSbzjjg> batchCheckExists(@Param("batchEntities") List<CrmSbzjjg> batchEntities);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,40 +37,46 @@
|
|||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<select id="accountQuery" resultType="com.kakarote.crm.entity.VO.CrmAccountQueryResponseVO">
|
||||
<select id="accountQuery" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
COUNT(*) AS sbzjhc,
|
||||
COUNT(CASE WHEN zjztmc IN ('无需处理') THEN 1 END) AS wxclhc,
|
||||
COUNT(CASE WHEN zjztmc IN ('检查通过') THEN 1 END) AS jctghc,
|
||||
COUNT(CASE WHEN zjztmc IN ('未更正') THEN 1 END) AS wgzhc,
|
||||
COUNT(CASE WHEN zjztmc IN ('已更正,问题未解决') THEN 1 END) AS ybtse1,
|
||||
COUNT(CASE WHEN zjztmc IN ('已更正,问题已解决') THEN 1 END) AS ybtse2,
|
||||
SUM(COALESCE(bzskje, 0)) AS bzskje
|
||||
<if test="(vo.sjSwjgdm == null or vo.sjSwjgdm == '') or (vo.qxSwjgdm != null and vo.qxSwjgdm != '')">
|
||||
zgswjgmc as swjgmc,
|
||||
</if>
|
||||
COUNT(*) AS sbzjhc,
|
||||
COUNT(CASE WHEN zjztmc IN ('无需处理') THEN 1 END) AS wxclhc,
|
||||
COUNT(CASE WHEN zjztmc IN ('检查通过') THEN 1 END) AS jctghc,
|
||||
COUNT(CASE WHEN zjztmc IN ('未更正') THEN 1 END) AS wgzhc,
|
||||
COUNT(CASE WHEN zjztmc IN ('已更正,问题未解决') THEN 1 END) AS ybtse1,
|
||||
COUNT(CASE WHEN zjztmc IN ('已更正,问题已解决') THEN 1 END) AS ybtse2,
|
||||
SUM(COALESCE(bzskje, 0)) AS bzskje
|
||||
FROM wk_crm_sbzjjg
|
||||
WHERE 1=1
|
||||
<if test="vo.zsxm != null and vo.zsxm != ''">
|
||||
<if test="vo.zsxm != null and vo.zsxm != ''">
|
||||
AND zsxm_dm = #{vo.zsxm}
|
||||
</if>
|
||||
<if test="vo.yzpzlx != null and vo.yzpzlx != ''">
|
||||
AND yzpzzl_dm = #{vo.yzpzlx}
|
||||
</if>
|
||||
<if test="vo.zjzbmc != null and vo.zjzbmc != ''">
|
||||
AND zjzbmc = #{vo.zjzbmc}
|
||||
</if>
|
||||
<if test="vo.ssgly != null and vo.ssgly != ''">
|
||||
AND ssgly = #{vo.ssgly}
|
||||
</if>
|
||||
<if test="vo.sbrqq != null and vo.sbrqq != '' and vo.sbrqz != null and vo.sbrqz != ''">
|
||||
AND zxsbrq BETWEEN #{vo.sbrqq} AND #{vo.sbrqz}
|
||||
</if>
|
||||
<if test="vo.zjrqq != null and vo.zjrqq != '' and vo.zjrqz != null and vo.zjrqz != ''">
|
||||
AND zjrq BETWEEN #{vo.zjrqq} AND #{vo.zjrqz}
|
||||
</if>
|
||||
<if test="vo.zgswjg != null and vo.zgswjg != ''">
|
||||
AND zgswjg_dm = #{vo.zgswjg}
|
||||
</if>
|
||||
<if test="vo.zgsws != null and vo.zgsws != ''">
|
||||
AND zgswjgkfj_dm = #{vo.zgsws}
|
||||
<if test="vo.yzpzlx != null and vo.yzpzlx != ''">
|
||||
AND yzpzzl_dm = #{vo.yzpzlx}
|
||||
</if>
|
||||
<if test="vo.zjzbmc != null and vo.zjzbmc != ''">
|
||||
AND zjzbmc = #{vo.zjzbmc}
|
||||
</if>
|
||||
<if test="vo.ssgly != null and vo.ssgly != ''">
|
||||
AND ssgly = #{vo.ssgly}
|
||||
</if>
|
||||
<if test="vo.sbrqq != null and vo.sbrqq != '' and vo.sbrqz != null and vo.sbrqz != ''">
|
||||
AND zxsbrq BETWEEN #{vo.sbrqq} AND #{vo.sbrqz}
|
||||
</if>
|
||||
<if test="vo.zjrqq != null and vo.zjrqq != '' and vo.zjrqz != null and vo.zjrqz != ''">
|
||||
AND zjrq BETWEEN #{vo.zjrqq} AND #{vo.zjrqz}
|
||||
</if>
|
||||
<if test="(vo.sjSwjgdm != null and vo.sjSwjgdm != '') and (vo.qxSwjgdm == null or vo.qxSwjgdm == '')">
|
||||
AND zgswjg_dm LIKE CONCAT(#{fuzzy}, '%')
|
||||
</if>
|
||||
<if test="vo.qxSwjgdm != null and vo.qxSwjgdm != ''">
|
||||
AND zgswjg_dm = #{vo.qxSwjgdm}
|
||||
</if>
|
||||
<if test="(vo.sjSwjgdm == null or vo.sjSwjgdm == '') or (vo.qxSwjgdm != null and vo.qxSwjgdm != '')">
|
||||
GROUP BY zgswjgmc
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
|
@ -95,11 +101,11 @@
|
|||
<if test="vo.zjrqq != null and vo.zjrqq != '' and vo.zjrqz != null and vo.zjrqz != ''">
|
||||
AND zjrq BETWEEN #{vo.zjrqq} AND #{vo.zjrqz}
|
||||
</if>
|
||||
<if test="vo.zgswjg != null and vo.zgswjg != ''">
|
||||
AND zgswjg_dm = #{vo.zgswjg}
|
||||
<if test="vo.qxSwjgdm != null and vo.qxSwjgdm != ''">
|
||||
AND zgswjg_dm = #{vo.qxSwjgdm}
|
||||
</if>
|
||||
<if test="vo.zgsws != null and vo.zgsws != ''">
|
||||
AND zgswjgkfj_dm = #{vo.zgsws}
|
||||
<if test="(vo.sjSwjgdm != null and vo.sjSwjgdm != '') and (vo.qxSwjgdm == null or vo.qxSwjgdm == '')">
|
||||
AND zgswjg_dm LIKE CONCAT(#{fuzzy}, '%')
|
||||
</if>
|
||||
<choose>
|
||||
<when test="vo.detailType == 'jctghc'">
|
||||
|
|
@ -129,7 +135,7 @@
|
|||
<select id="rankByEnterpriseRisk" resultType="java.util.HashMap">
|
||||
SELECT * from (
|
||||
SELECT nsrmc as dwmc,zgswjgmc as zgswjg,COUNT(DISTINCT zjzbmc) AS fxzbNum FROM wk_crm_sbzjjg
|
||||
WHERE zgswjg_dm = #{vo.zgswjg} AND zjztmc != '检查通过'
|
||||
WHERE zjztmc != '检查通过'
|
||||
<if test="vo.wgy != null and vo.wgy != ''">
|
||||
AND ssgly = #{vo.wgy}
|
||||
</if>
|
||||
|
|
@ -139,6 +145,14 @@
|
|||
<if test="vo.zjrqz != null and vo.zjrqz != ''">
|
||||
AND zjrq <= #{vo.zjrqz}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="(vo.sjSwjgdm != null and vo.sjSwjgdm != '') and (vo.qxSwjgdm == null or vo.qxSwjgdm == '')">
|
||||
AND zgswjg_dm LIKE CONCAT(#{fuzzy}, '%')
|
||||
</when>
|
||||
<when test="vo.qxSwjgdm != null and vo.qxSwjgdm != ''">
|
||||
AND zgswjg_dm = #{vo.qxSwjgdm}
|
||||
</when>
|
||||
</choose>
|
||||
GROUP BY nsrmc, zgswjgmc
|
||||
ORDER BY fxzbNum DESC
|
||||
LIMIT #{vo.yjzb}
|
||||
|
|
@ -151,7 +165,7 @@
|
|||
|
||||
<select id="rankByEnterpriseRiskDetail" resultType="String">
|
||||
SELECT DISTINCT zjzbmc FROM wk_crm_sbzjjg
|
||||
WHERE zgswjg_dm = #{vo.zgswjg} AND zjztmc != '检查通过' AND nsrmc = #{vo.dwmc}
|
||||
WHERE zjztmc != '检查通过' AND nsrmc = #{vo.dwmc}
|
||||
<if test="vo.wgy != null and vo.wgy != ''">
|
||||
AND ssgly = #{vo.wgy}
|
||||
</if>
|
||||
|
|
@ -275,13 +289,27 @@
|
|||
LIMIT 10
|
||||
</select>
|
||||
|
||||
<select id="batchCheckExists" resultType="java.util.Map">
|
||||
<select id="batchCheckExists" resultType="com.kakarote.crm.entity.PO.CrmSbzjjg">
|
||||
SELECT * FROM wk_crm_sbzjjg
|
||||
WHERE
|
||||
(nsrsbh, skssqq, skssqz, zjzbmc, zjrq, zjztmc, scsbrq ,zxsbrq) IN
|
||||
<foreach collection="batchEntities" item="item" separator=",">
|
||||
(#{item.nsrsbh},#{item.skssqq},#{item.skssqz},#{item.zjzbmc},#{item.zjrq},#{item.zjztmc},#{item.scsbrq},#{item.zxsbrq})
|
||||
</foreach>
|
||||
<where>
|
||||
<if test="batchEntities != null and batchEntities.size() > 0">
|
||||
(nsrsbh, zgswjgmc, skssqq, skssqz, zjzbmc, zjrq, zjztmc) IN
|
||||
<foreach collection="batchEntities" item="item" open="(" separator="," close=")">
|
||||
(
|
||||
#{item.nsrsbh},
|
||||
#{item.zgswjgmc},
|
||||
#{item.skssqq},
|
||||
#{item.skssqz},
|
||||
#{item.zjzbmc},
|
||||
#{item.zjrq},
|
||||
#{item.zjztmc}
|
||||
)
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="batchEntities == null or batchEntities.size() == 0">
|
||||
1=0
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public interface ICrmSbzjjgService extends BaseService<CrmSbzjjg> {
|
|||
/**
|
||||
* 户次查询
|
||||
*/
|
||||
CrmAccountQueryResponseVO accountQuery(CrmAccountQueryRequestVO crmAccountQueryRequestVO);
|
||||
List<Map<String,Object>> accountQuery(CrmAccountQueryRequestVO crmAccountQueryRequestVO);
|
||||
|
||||
/**
|
||||
* 户次查询明细
|
||||
|
|
|
|||
|
|
@ -29,4 +29,9 @@ public interface IZjzbdmVoService extends BaseService<ZjzbdmVo> {
|
|||
*/
|
||||
Integer queryZbIdByName(String name);
|
||||
|
||||
/**
|
||||
* 通过指标代码获取指标名称
|
||||
*/
|
||||
String queryZbNameByZbDm(String zbDm);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
package com.kakarote.crm.service.impl;
|
||||
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
|
|
@ -10,20 +9,20 @@ import com.kakarote.crm.entity.PO.*;
|
|||
import com.kakarote.crm.entity.VO.*;
|
||||
import com.kakarote.crm.mapper.*;
|
||||
import com.kakarote.crm.service.*;
|
||||
import com.kakarote.crm.webService.service.NsrdjxxService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import static jdk.nashorn.internal.runtime.ScriptRuntime.safeToString;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
|
@ -32,15 +31,9 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
@Autowired
|
||||
private CrmSbzjjgMapper crmSbzjjgMapper;
|
||||
|
||||
@Autowired
|
||||
private CrmSwjgDmMapper crmSwjgDmMapper;
|
||||
|
||||
@Autowired
|
||||
private CrmSwjgMapper crmSwjgMapper;
|
||||
|
||||
@Autowired
|
||||
private CrmQyjbxxMapper crmQyjbxxMapper;
|
||||
|
||||
@Autowired
|
||||
private ICrmDjzclxService crmDjzclxService;
|
||||
|
||||
|
|
@ -59,66 +52,73 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
@Autowired
|
||||
private IZjzbdmVoService zjzbdmVoService;
|
||||
|
||||
@Autowired
|
||||
private NsrdjxxService nsrdjxxService;
|
||||
|
||||
@Override
|
||||
public CrmAccountQueryResponseVO accountQuery(CrmAccountQueryRequestVO crmAccountQueryRequestVO) {
|
||||
CrmAccountQueryResponseVO parent = crmSbzjjgMapper.accountQuery(crmAccountQueryRequestVO);
|
||||
// 如果传入了下级税务机关
|
||||
if (crmAccountQueryRequestVO.getZgsws() != null && !crmAccountQueryRequestVO.getZgsws().isEmpty()) {
|
||||
public List<Map<String,Object>> accountQuery(CrmAccountQueryRequestVO crmAccountQueryRequestVO) {
|
||||
|
||||
if (crmAccountQueryRequestVO.getZjzbdm() != null && !crmAccountQueryRequestVO.getZjzbdm().isEmpty()) {
|
||||
crmAccountQueryRequestVO.setZjzbmc(zjzbdmVoService.queryZbNameByZbDm(crmAccountQueryRequestVO.getZjzbdm()));
|
||||
}
|
||||
|
||||
List<Map<String, Object>> list;
|
||||
//如果只传入了市级税务机关,则取税务机关代码的前五位进行模糊查询
|
||||
if ((crmAccountQueryRequestVO.getSjSwjgdm() != null && !crmAccountQueryRequestVO.getSjSwjgdm().isEmpty())
|
||||
&& (crmAccountQueryRequestVO.getQxSwjgdm() == null || crmAccountQueryRequestVO.getQxSwjgdm().isEmpty())) {
|
||||
String fuzzy = crmAccountQueryRequestVO.getSjSwjgdm().substring(0, 5);
|
||||
list = crmSbzjjgMapper.accountQuery(crmAccountQueryRequestVO, fuzzy);
|
||||
// 添加市级税务机关名称
|
||||
CrmSwjg swjg = new LambdaQueryChainWrapper<>(crmSwjgMapper)
|
||||
.eq(CrmSwjg::getSwjgDm, crmAccountQueryRequestVO.getZgsws())
|
||||
.eq(CrmSwjg::getSwjgDm, crmAccountQueryRequestVO.getSjSwjgdm())
|
||||
.last("limit 1")
|
||||
.one();
|
||||
parent.setSwjg(swjg.getSwjgmc());
|
||||
parent.setSwjgDm(swjg.getSwjgDm());
|
||||
parent.setSjSwjgDm(swjg.getSjswjgDm());
|
||||
return parent;
|
||||
list.get(0).put("swjgmc", swjg.getSwjgmc());
|
||||
list.get(0).put("swjgdm", swjg.getSwjgDm());
|
||||
return list;
|
||||
} else {
|
||||
// 获取主管税务机关名称
|
||||
String name = new LambdaQueryChainWrapper<>(crmSwjgDmMapper)
|
||||
.eq(CrmSwjgDm::getSwjgDm, crmAccountQueryRequestVO.getZgswjg())
|
||||
.last("limit 1")
|
||||
.one().getSwjgMc();
|
||||
// 设置主管税务机关
|
||||
parent.setSwjg(name);
|
||||
// 设置主管税务机关代码
|
||||
parent.setSwjgDm(crmAccountQueryRequestVO.getZgswjg());
|
||||
// 获取下级税务机关信息
|
||||
List<CrmSwjg> swjgs = new LambdaQueryChainWrapper<>(crmSwjgMapper)
|
||||
.eq(CrmSwjg::getSjswjgDm, crmAccountQueryRequestVO.getZgswjg())
|
||||
.list();
|
||||
// 对下级税务机关进行户次查询
|
||||
swjgs.forEach(swjg -> {
|
||||
crmAccountQueryRequestVO.setZgsws(swjg.getSwjgDm());
|
||||
CrmAccountQueryResponseVO child = crmSbzjjgMapper.accountQuery(crmAccountQueryRequestVO);
|
||||
if (child != null && child.getSbzjhc() != 0) {
|
||||
child.setSwjg(swjg.getSwjgmc());
|
||||
child.setSwjgDm(swjg.getSwjgDm());
|
||||
child.setSjSwjgDm(swjg.getSjswjgDm());
|
||||
// 确保children列表不为null
|
||||
if (parent.getChildren() == null) {
|
||||
parent.setChildren(new ArrayList<>()); // 初始化列表
|
||||
}
|
||||
parent.getChildren().add(child);
|
||||
}
|
||||
list = crmSbzjjgMapper.accountQuery(crmAccountQueryRequestVO,null);
|
||||
list.forEach(map->{
|
||||
CrmSwjg swjg = new LambdaQueryChainWrapper<>(crmSwjgMapper)
|
||||
.eq(CrmSwjg::getSwjgmc, map.get("swjgmc"))
|
||||
.last("limit 1")
|
||||
.one();
|
||||
map.put("swjgmdm", swjg.getSwjgDm());
|
||||
});
|
||||
return parent;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePage<CrmSbzjjg> accountQueryDetail(CrmAccountQueryRequestVO crmAccountQueryRequestVO) {
|
||||
|
||||
if (crmAccountQueryRequestVO.getZjzbdm() != null && !crmAccountQueryRequestVO.getZjzbdm().isEmpty()) {
|
||||
crmAccountQueryRequestVO.setZjzbmc(zjzbdmVoService.queryZbNameByZbDm(crmAccountQueryRequestVO.getZjzbdm()));
|
||||
}
|
||||
|
||||
Integer offset = (crmAccountQueryRequestVO.getPage() - 1) * crmAccountQueryRequestVO.getLimit();
|
||||
crmAccountQueryRequestVO.setOffset(offset);
|
||||
|
||||
List<CrmSbzjjg> crmSbzjjgs = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO,null,null);
|
||||
List<CrmSbzjjg> crmSbzjjgs;
|
||||
List<CrmSbzjjg> pageList;
|
||||
|
||||
List<CrmSbzjjg> pageList = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO,
|
||||
offset,
|
||||
crmAccountQueryRequestVO.getLimit());
|
||||
if (crmAccountQueryRequestVO.getSjSwjgdm() != null && !crmAccountQueryRequestVO.getSjSwjgdm().isEmpty()) {
|
||||
//如果传入了市级税务机关,则取税务机关代码的前五位进行模糊查询
|
||||
String fuzzy = crmAccountQueryRequestVO.getSjSwjgdm().substring(0, 5);
|
||||
crmSbzjjgs = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO, fuzzy, null, null);
|
||||
pageList = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO,
|
||||
fuzzy,
|
||||
offset,
|
||||
crmAccountQueryRequestVO.getLimit());
|
||||
} else {
|
||||
crmSbzjjgs = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO,null,null,null);
|
||||
pageList = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO,
|
||||
null,
|
||||
offset,
|
||||
crmAccountQueryRequestVO.getLimit());
|
||||
}
|
||||
|
||||
BasePage<CrmSbzjjg> basePage = new BasePage<>();
|
||||
|
||||
for (CrmSbzjjg crmSbzjjg : pageList) {
|
||||
basePage.getList().add(crmSbzjjg);
|
||||
}
|
||||
|
|
@ -132,29 +132,60 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
@Override
|
||||
public BasePage<Map<String,Object>> rankByEnterpriseRisk(CrmRankByEnterpriseRiskRequestVO crmRankByEnterpriseRiskRequestVO) {
|
||||
|
||||
List<Map<String,Object>> maps = crmSbzjjgMapper.rankByEnterpriseRisk(crmRankByEnterpriseRiskRequestVO,
|
||||
null,
|
||||
null);
|
||||
BasePage<Map<String,Object>> basePage = new BasePage<>();
|
||||
|
||||
Integer offset = (crmRankByEnterpriseRiskRequestVO.getPage() - 1) * crmRankByEnterpriseRiskRequestVO.getLimit();
|
||||
crmRankByEnterpriseRiskRequestVO.setOffset(offset);
|
||||
|
||||
List<Map<String,Object>> pageMap = crmSbzjjgMapper.rankByEnterpriseRisk(crmRankByEnterpriseRiskRequestVO,
|
||||
offset,
|
||||
crmRankByEnterpriseRiskRequestVO.getLimit());
|
||||
List<Map<String, Object>> maps;
|
||||
List<Map<String,Object>> pageMap;
|
||||
|
||||
BasePage<Map<String,Object>> basePage = new BasePage<>();
|
||||
// 如果没有传市级税务机关,则按照区县税务机关进行分类查询
|
||||
if (crmRankByEnterpriseRiskRequestVO.getSjSwjgdm() == null || crmRankByEnterpriseRiskRequestVO.getSjSwjgdm().isEmpty()) {
|
||||
maps = crmSbzjjgMapper.rankByEnterpriseRisk(crmRankByEnterpriseRiskRequestVO,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
pageMap = crmSbzjjgMapper.rankByEnterpriseRisk(crmRankByEnterpriseRiskRequestVO,
|
||||
null,
|
||||
offset,
|
||||
crmRankByEnterpriseRiskRequestVO.getLimit());
|
||||
} else if (crmRankByEnterpriseRiskRequestVO.getQxSwjgdm() == null || crmRankByEnterpriseRiskRequestVO.getQxSwjgdm().isEmpty()) {
|
||||
//如果传入了市级税务机关,则取税务机关代码的前五位进行模糊查询
|
||||
String fuzzy = crmRankByEnterpriseRiskRequestVO.getSjSwjgdm().substring(0, 5);
|
||||
maps = crmSbzjjgMapper.rankByEnterpriseRisk(crmRankByEnterpriseRiskRequestVO,
|
||||
fuzzy,
|
||||
null,
|
||||
null);
|
||||
pageMap = crmSbzjjgMapper.rankByEnterpriseRisk(crmRankByEnterpriseRiskRequestVO,
|
||||
fuzzy,
|
||||
offset,
|
||||
crmRankByEnterpriseRiskRequestVO.getLimit());
|
||||
} else {
|
||||
maps = crmSbzjjgMapper.rankByEnterpriseRisk(crmRankByEnterpriseRiskRequestVO,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
pageMap = crmSbzjjgMapper.rankByEnterpriseRisk(crmRankByEnterpriseRiskRequestVO,
|
||||
null,
|
||||
offset,
|
||||
crmRankByEnterpriseRiskRequestVO.getLimit());
|
||||
|
||||
}
|
||||
basePage.setList(pageMap);
|
||||
basePage.setCurrent(crmRankByEnterpriseRiskRequestVO.getPage());
|
||||
basePage.setSize(crmRankByEnterpriseRiskRequestVO.getLimit());
|
||||
basePage.setTotal(maps.size());
|
||||
|
||||
return basePage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePage<Map<String,Object>> rankByEnterpriseRiskDetail(CrmRankByEnterpriseRiskRequestVO crmRankByEnterpriseRiskRequestVO) {
|
||||
|
||||
if (crmRankByEnterpriseRiskRequestVO.getDwmc() == null || crmRankByEnterpriseRiskRequestVO.getDwmc().isEmpty()) {
|
||||
throw new RuntimeException("单位名称不能为空!");
|
||||
}
|
||||
|
||||
List<String> fxzbList = crmSbzjjgMapper.rankByEnterpriseRiskDetail(crmRankByEnterpriseRiskRequestVO,null,null);
|
||||
|
||||
Integer offset = (crmRankByEnterpriseRiskRequestVO.getPage() - 1) * crmRankByEnterpriseRiskRequestVO.getLimit();
|
||||
|
|
@ -168,14 +199,14 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
String swjgmc = new LambdaQueryChainWrapper<>(crmSwjgMapper)
|
||||
.eq(CrmSwjg::getSwjgDm, crmRankByEnterpriseRiskRequestVO.getZgswjg())
|
||||
String zgswjgmc = new LambdaQueryChainWrapper<>(crmSbzjjgMapper)
|
||||
.eq(CrmSbzjjg::getNsrmc, crmRankByEnterpriseRiskRequestVO.getDwmc())
|
||||
.last("limit 1")
|
||||
.one()
|
||||
.getSwjgmc();
|
||||
.getZgswjgmc();
|
||||
|
||||
map.put("dwmc", crmRankByEnterpriseRiskRequestVO.getDwmc());
|
||||
map.put("zjswjg", swjgmc);
|
||||
map.put("zjswjg", zgswjgmc);
|
||||
map.put("fxzbList", pageList);
|
||||
|
||||
mapList.add(map);
|
||||
|
|
@ -238,13 +269,16 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
|
||||
for (String qymc : pageList) {
|
||||
|
||||
CrmQyjbxx crmQyjbxx = new LambdaQueryChainWrapper<>(crmQyjbxxMapper)
|
||||
.eq(CrmQyjbxx::getNsrmc, qymc)
|
||||
CrmSbzjjg one = new LambdaQueryChainWrapper<>(crmSbzjjgMapper)
|
||||
.eq(CrmSbzjjg::getNsrmc, qymc)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
|
||||
CrmQyjbxx crmQyjbxx = nsrdjxxService.getNsrdjxx(one.getNsrsbh(), one.getZgswjgkfjDm());
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("qymc", qymc);
|
||||
map.put("wgy", crmRankByPointerTypeRequestVO.getWgy());
|
||||
map.put("wgy", one.getSsgly());
|
||||
if (crmQyjbxx != null) {
|
||||
map.put("qysh",crmQyjbxx.getNsrsbh());
|
||||
map.put("frxm",crmQyjbxx.getFddbrxm());
|
||||
|
|
@ -295,7 +329,7 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
if (totalCount <= 1) {
|
||||
throw new RuntimeException("Excel文件没有数据或只有表头");
|
||||
}
|
||||
int dataRowCount = totalCount - 1; // 实际数据行数
|
||||
int dataRowCount = totalCount - 1; // 出去表头,实际数据行数
|
||||
|
||||
log.info("开始导入Excel,总数据行数:{}", dataRowCount);
|
||||
|
||||
|
|
@ -321,13 +355,18 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
}
|
||||
}
|
||||
|
||||
// 去重
|
||||
//checkAndRemoveDuplicates(batchEntities);
|
||||
int batchCount = batchEntities.size();
|
||||
|
||||
// 去除数据库中的重复数据
|
||||
List<CrmSbzjjg> uniqueEntities = checkAndRemoveDuplicates(batchEntities);
|
||||
|
||||
// 分批插入
|
||||
// 插入当前批次
|
||||
batchInsert(batchEntities);
|
||||
successCount += batchEntities.size();
|
||||
if (!uniqueEntities.isEmpty()) {
|
||||
batchInsert(uniqueEntities);
|
||||
}
|
||||
successCount += uniqueEntities.size();
|
||||
skipCount += (batchCount - uniqueEntities.size());
|
||||
|
||||
// 记录进度
|
||||
log.info("已处理 {}/{} 条数据", Math.min(endRow, dataRowCount), dataRowCount);
|
||||
|
|
@ -349,13 +388,13 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
Map<String, Object> importResult = new HashMap<>();
|
||||
importResult.put("totalRows", totalCount-1);
|
||||
importResult.put("successCount", successCount);
|
||||
importResult.put("message", String.format("成功导入 %d 条数据", successCount));
|
||||
importResult.put("message", String.format("成功导入 %d 条数据,跳过 %d 条重复数据",
|
||||
successCount, skipCount));
|
||||
|
||||
return importResult;
|
||||
}
|
||||
|
||||
private void setTableMapping(ExcelReader reader) {
|
||||
|
||||
// 设置表头映射
|
||||
reader.addHeaderAlias("纳税人名称", "nsrmc");
|
||||
reader.addHeaderAlias("统一社会信用代码(纳税人识别号)", "nsrsbh");
|
||||
|
|
@ -470,9 +509,31 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
|
||||
private List<CrmSbzjjg> checkAndRemoveDuplicates(List<CrmSbzjjg> batchEntities){
|
||||
|
||||
List<Map<String, Object>> maps = crmSbzjjgMapper.batchCheckExists(batchEntities);
|
||||
System.out.println(maps.size());
|
||||
return null;
|
||||
List<CrmSbzjjg> list = crmSbzjjgMapper.batchCheckExists(batchEntities);
|
||||
|
||||
Set<String> existSet = list.stream().map(this::generateKey).collect(Collectors.toSet());
|
||||
|
||||
batchEntities.removeIf(entity -> {
|
||||
String key = generateKey(entity);
|
||||
return existSet.contains(key);
|
||||
});
|
||||
|
||||
return batchEntities;
|
||||
}
|
||||
|
||||
private String generateKey(CrmSbzjjg crmSbzjjg) {
|
||||
if (crmSbzjjg == null) {
|
||||
return null;
|
||||
}
|
||||
return String.join("|||",
|
||||
safeToString(crmSbzjjg.getNsrsbh()),
|
||||
safeToString(crmSbzjjg.getZgswjgmc()),
|
||||
safeToString(crmSbzjjg.getSkssqq()),
|
||||
safeToString(crmSbzjjg.getSkssqz()),
|
||||
safeToString(crmSbzjjg.getZjzbmc()),
|
||||
safeToString(crmSbzjjg.getZjrq()),
|
||||
safeToString(crmSbzjjg.getZjztmc())
|
||||
);
|
||||
}
|
||||
|
||||
private void batchInsert(List<CrmSbzjjg> batchEntities) {
|
||||
|
|
@ -494,7 +555,13 @@ public class CrmSbzjjgServiceImpl extends BaseServiceImpl<CrmSbzjjgMapper, CrmSb
|
|||
@Override
|
||||
public void exportExcelForSbzjjg(CrmAccountQueryRequestVO crmAccountQueryRequestVO, HttpServletResponse response) {
|
||||
|
||||
List<CrmSbzjjg> exportList = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO, null, null);
|
||||
List<CrmSbzjjg> exportList;
|
||||
if (crmAccountQueryRequestVO.getSjSwjgdm() != null && !crmAccountQueryRequestVO.getSjSwjgdm().isEmpty()) {
|
||||
String fuzzy = crmAccountQueryRequestVO.getSjSwjgdm().substring(0, 5);
|
||||
exportList = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO, fuzzy, null,null);
|
||||
} else {
|
||||
exportList = crmSbzjjgMapper.accountQueryDetail(crmAccountQueryRequestVO,null,null,null);
|
||||
}
|
||||
|
||||
if (exportList == null || exportList.isEmpty()) {
|
||||
throw new RuntimeException("没有可导出的数据");
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.kakarote.core.servlet.BaseServiceImpl;
|
|||
import com.kakarote.crm.entity.PO.CrmSwjgDm;
|
||||
import com.kakarote.crm.mapper.CrmSwjgDmMapper;
|
||||
import com.kakarote.crm.service.ICrmSwjgDmService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -13,6 +14,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CrmSwjgDmServiceImpl extends BaseServiceImpl<CrmSwjgDmMapper, CrmSwjgDm> implements ICrmSwjgDmService {
|
||||
|
||||
@Autowired
|
||||
|
|
@ -44,11 +46,15 @@ public class CrmSwjgDmServiceImpl extends BaseServiceImpl<CrmSwjgDmMapper, CrmSw
|
|||
|
||||
@Override
|
||||
public String queryCodeByName(String name) {
|
||||
return new LambdaQueryChainWrapper<>(crmSwjgDmMapper)
|
||||
CrmSwjgDm swjgDm = new LambdaQueryChainWrapper<>(crmSwjgDmMapper)
|
||||
.select(CrmSwjgDm::getSwjgDm)
|
||||
.eq(CrmSwjgDm::getSwjgMc, name)
|
||||
.last("limit 1")
|
||||
.one()
|
||||
.getSwjgDm();
|
||||
.one();
|
||||
if (swjgDm == null) {
|
||||
log.info("无法查询到相关税务机关代码:{},返回空值", name);
|
||||
return "";
|
||||
}
|
||||
return swjgDm.getSwjgDm();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,4 +218,13 @@ public class ZjzbdmVoServiceImpl extends BaseServiceImpl<ZjzbdmVoMapper, ZjzbdmV
|
|||
.one()
|
||||
.getZbId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryZbNameByZbDm(String zbDm) {
|
||||
return new LambdaQueryChainWrapper<>(zjzbdmVoMapper)
|
||||
.eq(ZjzbdmVo::getZbDm,zbDm)
|
||||
.last("limit 1")
|
||||
.one()
|
||||
.getZbmc();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue