#add 根据统一社会代码和年份查下该企业的营收和税收
parent
d7a3e0971f
commit
9a5206b202
|
@ -4,24 +4,28 @@ package org.sk.module.data.api.finance;
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.sk.module.data.api.finance.dto.FinanceRespDTO;
|
||||
import org.sk.module.data.enums.ApiConstants;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务:财务数据")
|
||||
public interface FinanceApi {
|
||||
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/finance";
|
||||
|
||||
@GetMapping(PREFIX + "/get")
|
||||
@PostMapping(PREFIX + "/get")
|
||||
@Operation(summary = "获取财务信息")
|
||||
@Parameter(name = "creditCode", description = "统一身份认证编码", example = "91340104MA2TK61Q1R", required = true)
|
||||
CommonResult<FinanceRespDTO> getDept(@RequestParam("creditCode") String creditCode);
|
||||
@Parameters({
|
||||
@Parameter(name = "creditCode", description = "统一身份认证编码", example = "SEX", required = true),
|
||||
@Parameter(name = "year", description = "年份", example = "2022", required = true)
|
||||
})
|
||||
CommonResult<FinanceRespDTO> getFinanceInfo(@RequestParam("creditCode") String creditCode,
|
||||
@RequestParam("year") String year);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,17 +4,25 @@ package org.sk.module.data.api.finance.dto;
|
|||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "RPC 服务 - 财务数据 Response DTO")
|
||||
@Data
|
||||
public class FinanceRespDTO {
|
||||
|
||||
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "企业")
|
||||
private String comName;
|
||||
|
||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "社会统一信用代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "008x")
|
||||
private String creditCode;
|
||||
|
||||
@Schema(description = "营收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "23.10")
|
||||
private BigDecimal Income;
|
||||
|
||||
@Schema(description = "税收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
|
||||
private BigDecimal tax;
|
||||
|
||||
@Schema(description = "年份", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022")
|
||||
private String year;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
package org.sk.module.data.api.finance;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import org.sk.module.data.api.finance.dto.FinanceRespDTO;
|
||||
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||
import org.sk.module.data.service.finance.FinanceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class FinanceApiImpl implements FinanceApi {
|
||||
|
||||
|
||||
@Autowired
|
||||
private FinanceService financeService;
|
||||
|
||||
@Override
|
||||
public CommonResult<FinanceRespDTO> getDept(String creditCode) {
|
||||
return null;
|
||||
public CommonResult<FinanceRespDTO> getFinanceInfo(String creditCode, String deptCode) {
|
||||
FinanceBO result = financeService.getFinanceByCreditCodeAndYear(creditCode, deptCode);
|
||||
return success(BeanUtils.toBean(result, FinanceRespDTO.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package org.sk.module.data.dal.bo.finance;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class FinanceBO {
|
||||
|
||||
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "企业")
|
||||
private String comName;
|
||||
|
||||
@Schema(description = "社会统一信用代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "008x")
|
||||
private String creditCode;
|
||||
|
||||
@Schema(description = "营收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "23.10")
|
||||
private BigDecimal Income;
|
||||
|
||||
@Schema(description = "税收(万)", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
|
||||
private BigDecimal tax;
|
||||
|
||||
@Schema(description = "年份", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022")
|
||||
private String year;
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.sk.module.data.dal.mapper.finance;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||
|
||||
@Mapper
|
||||
public interface FinanceMapper {
|
||||
|
||||
/**
|
||||
* 根据社会统一信用代码和年份查下企业营收和税收
|
||||
* @param creditCode 社会统一信用代码
|
||||
* @param year 年份
|
||||
* @return FinanceBO
|
||||
*/
|
||||
FinanceBO getFinanceByCreditCodeAndYear(@Param("creditCode") String creditCode, @Param("year") String year);
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
package org.sk.module.data.service.finance;
|
||||
|
||||
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||
|
||||
public interface FinanceService {
|
||||
|
||||
|
||||
|
||||
|
||||
FinanceBO getFinanceByCreditCodeAndYear(String creditCode, String year);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,24 @@
|
|||
package org.sk.module.data.service.finance;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||
import org.sk.module.data.dal.mapper.finance.FinanceMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class FinanceServiceImpl implements FinanceService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private FinanceMapper financeMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public FinanceBO getFinanceByCreditCodeAndYear(String creditCode, String year) {
|
||||
if (StringUtils.isBlank(creditCode) || StringUtils.isBlank(year)) {
|
||||
return new FinanceBO();
|
||||
}
|
||||
return financeMapper.getFinanceByCreditCodeAndYear(creditCode, year);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?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="org.sk.module.data.dal.mapper.finance.FinanceMapper">
|
||||
|
||||
<select id="getFinanceByCreditCodeAndYear" resultType="org.sk.module.data.dal.bo.finance.FinanceBO">
|
||||
select
|
||||
a.comName,
|
||||
a.creditCode,
|
||||
a.Income,
|
||||
(b.valueAddTax + b.corporateIncomeTax)/ 10000 'tax',
|
||||
a.nd 'year'
|
||||
from com_operate_info_year a
|
||||
left join com_pay_taxs_all b on a.creditCode = b.creditCode and b.mouth = '12' and a.nd = b.year
|
||||
where a.creditCode = ${creditCode} and a.nd = ${year}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue