风险报告使用情况
This commit is contained in:
parent
b1b058a32a
commit
1a95c9284e
|
|
@ -0,0 +1,34 @@
|
|||
package com.kakarote.crm.controller;
|
||||
|
||||
import com.kakarote.core.common.R;
|
||||
import com.kakarote.core.common.Result;
|
||||
import com.kakarote.crm.entity.PO.CrmUsageReport;
|
||||
import com.kakarote.crm.entity.VO.CrmQueryUsageReportVO;
|
||||
import com.kakarote.crm.service.ICrmUsageReportService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/crmUsageReport")
|
||||
@Api(tags = "使用报告")
|
||||
public class CrmUsageReportController {
|
||||
|
||||
@Autowired
|
||||
private ICrmUsageReportService crmUsageReportService;
|
||||
|
||||
@PostMapping("/queryReportScreenings")
|
||||
@ApiOperation("查询报告筛查次数")
|
||||
public Result<Integer> queryReportScreenings(@RequestBody CrmQueryUsageReportVO vo) throws IOException {
|
||||
return R.ok(crmUsageReportService.queryReportScreenings(vo));
|
||||
}
|
||||
|
||||
@PostMapping("/findUsageReportByNsrsbhOrNsrmc")
|
||||
@ApiOperation("查询报告筛查次数")
|
||||
public Result<CrmUsageReport> findUsageReportByNsrsbhOrNsrmc(@RequestBody CrmQueryUsageReportVO vo) throws IOException {
|
||||
return R.ok(crmUsageReportService.findUsageReportByNsrsbhOrNsrmc(vo));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.kakarote.crm.entity.DTO;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
@Data
|
||||
public class CrmHttpResponseDTO<T> {
|
||||
|
||||
private int code;
|
||||
private String msg;
|
||||
private T data;
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.kakarote.crm.entity.PO;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("wk_crm_usage_report")
|
||||
@ApiModel(value="CrmUsageReport", description="使用报告")
|
||||
public class CrmUsageReport implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
|
||||
/**
|
||||
* 产品使用状况:0。未使用;1.使用
|
||||
*/
|
||||
private Integer usageStatus;
|
||||
|
||||
/**
|
||||
* 产品注册时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date registrationTime;
|
||||
|
||||
/**
|
||||
* 是否点击深度报告:0。已点击;1.未点击
|
||||
*/
|
||||
private Integer clickedDeepReport;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.kakarote.crm.entity.VO;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
public class CrmQueryUsageReportVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 纳税人识别号
|
||||
*/
|
||||
private String nsrsbh;
|
||||
|
||||
/**
|
||||
* 纳税人名称
|
||||
*/
|
||||
private String nsrmc;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.kakarote.crm.mapper;
|
||||
|
||||
import com.kakarote.core.servlet.BaseMapper;
|
||||
import com.kakarote.crm.entity.PO.CrmUsageReport;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CrmUsageReportMapper extends BaseMapper<CrmUsageReport> {
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.kakarote.crm.mapper.CrmUsageReportMapper">
|
||||
<resultMap id="BaseResultMap" type="com.kakarote.crm.entity.PO.CrmUsageReport">
|
||||
<result column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="usage_status" jdbcType="INTEGER" property="usageStatus" />
|
||||
<result column="clicked_deep_report" jdbcType="INTEGER" property="clickedDeepReport" />
|
||||
<result column="registration_time" jdbcType="TIMESTAMP" property="registrationTime" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.kakarote.crm.service;
|
||||
|
||||
import com.kakarote.core.servlet.BaseService;
|
||||
import com.kakarote.crm.entity.PO.CrmUsageReport;
|
||||
import com.kakarote.crm.entity.VO.CrmQueryUsageReportVO;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface ICrmUsageReportService extends BaseService<CrmUsageReport> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询报告筛选次数
|
||||
* @return
|
||||
*/
|
||||
int queryReportScreenings(CrmQueryUsageReportVO vo) throws IOException;
|
||||
|
||||
/**
|
||||
* 根据纳税人识别号或者纳税人名称,查询产品使用情况,产品注册时间,是否点击深度查询报告
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
CrmUsageReport findUsageReportByNsrsbhOrNsrmc(CrmQueryUsageReportVO vo) throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.kakarote.crm.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.gson.Gson;
|
||||
import com.kakarote.core.servlet.BaseServiceImpl;
|
||||
import com.kakarote.crm.entity.DTO.CrmHttpResponseDTO;
|
||||
import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
|
||||
import com.kakarote.crm.entity.PO.CrmQyfxmx;
|
||||
import com.kakarote.crm.entity.PO.CrmUsageReport;
|
||||
import com.kakarote.crm.entity.VO.CrmQueryUsageReportVO;
|
||||
import com.kakarote.crm.mapper.CrmUsageReportMapper;
|
||||
import com.kakarote.crm.service.ICrmUsageReportService;
|
||||
import com.kakarote.crm.util.JsonUtil;
|
||||
import com.kakarote.crm.util.OkHttpClientUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class CrmUsageReportServiceImpl extends BaseServiceImpl<CrmUsageReportMapper, CrmUsageReport> implements ICrmUsageReportService {
|
||||
|
||||
@Autowired
|
||||
private CrmUsageReportMapper crmUsageReportMapper;
|
||||
|
||||
@Value("${app.REPORT_SCREENINGS_URL}")
|
||||
private String REPORT_SCREENINGS_URL;
|
||||
|
||||
@Value("${app.FIND_REPORT_URL}")
|
||||
private String FIND_REPORT_URL;
|
||||
|
||||
private String getUrl1() {
|
||||
return REPORT_SCREENINGS_URL;
|
||||
}
|
||||
|
||||
private String getUrl2() {
|
||||
return FIND_REPORT_URL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int queryReportScreenings(CrmQueryUsageReportVO vo) throws IOException {
|
||||
|
||||
String requestJson = JSONUtil.toJsonStr(vo);
|
||||
String responseJson = OkHttpClientUtil.post(getUrl1(), requestJson);
|
||||
|
||||
CrmHttpResponseDTO<String> dto = JsonUtil.toObject(
|
||||
responseJson,
|
||||
new TypeReference<CrmHttpResponseDTO<String>>() {}
|
||||
);
|
||||
|
||||
return Convert.toInt(dto.getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CrmUsageReport findUsageReportByNsrsbhOrNsrmc(CrmQueryUsageReportVO vo) throws IOException {
|
||||
|
||||
String requestJson = JSONUtil.toJsonStr(vo);
|
||||
String responseJson = OkHttpClientUtil.post(getUrl2(), requestJson);
|
||||
|
||||
System.out.println(responseJson);
|
||||
|
||||
CrmHttpResponseDTO<CrmUsageReport> dto = JsonUtil.toObject(
|
||||
responseJson,
|
||||
new TypeReference<CrmHttpResponseDTO<CrmUsageReport>>() {}
|
||||
);
|
||||
|
||||
CrmUsageReport report = dto.getData();
|
||||
|
||||
if (report.getUsageStatus() != 0) {
|
||||
crmUsageReportMapper.insert(report);
|
||||
}
|
||||
|
||||
return report;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue