!2 #add 根据统一社会代码和年份查下该企业的营收��
Merge pull request !2 from 远浪/auto-8863816-master-7a42c291-1pull/178/head
commit
74cec466b5
|
@ -4,6 +4,7 @@ package org.sk.module.data.api.finance;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.sk.module.data.api.finance.dto.FinanceRespDTO;
|
import org.sk.module.data.api.finance.dto.FinanceRespDTO;
|
||||||
import org.sk.module.data.enums.ApiConstants;
|
import org.sk.module.data.enums.ApiConstants;
|
||||||
|
@ -15,13 +16,16 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@Tag(name = "RPC 服务:财务数据")
|
@Tag(name = "RPC 服务:财务数据")
|
||||||
public interface FinanceApi {
|
public interface FinanceApi {
|
||||||
|
|
||||||
|
|
||||||
String PREFIX = ApiConstants.PREFIX + "/finance";
|
String PREFIX = ApiConstants.PREFIX + "/finance";
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/get")
|
@GetMapping(PREFIX + "/getInfo")
|
||||||
@Operation(summary = "获取财务信息")
|
@Operation(summary = "获取财务信息")
|
||||||
@Parameter(name = "creditCode", description = "统一身份认证编码", example = "91340104MA2TK61Q1R", required = true)
|
@Parameters({
|
||||||
CommonResult<FinanceRespDTO> getDept(@RequestParam("creditCode") String creditCode);
|
@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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Schema(description = "RPC 服务 - 财务数据 Response DTO")
|
@Schema(description = "RPC 服务 - 财务数据 Response DTO")
|
||||||
@Data
|
@Data
|
||||||
public class FinanceRespDTO {
|
public class FinanceRespDTO {
|
||||||
|
|
||||||
|
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "企业")
|
||||||
|
private String comName;
|
||||||
|
|
||||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "社会统一信用代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "008x")
|
||||||
private Long id;
|
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;
|
package org.sk.module.data.api.finance;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
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.api.finance.dto.FinanceRespDTO;
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
import org.sk.module.data.service.finance.FinanceService;
|
import org.sk.module.data.service.finance.FinanceService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@Validated
|
@Validated
|
||||||
public class FinanceApiImpl implements FinanceApi {
|
public class FinanceApiImpl implements FinanceApi {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FinanceService financeService;
|
private FinanceService financeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<FinanceRespDTO> getDept(String creditCode) {
|
public CommonResult<FinanceRespDTO> getFinanceInfo(String creditCode, String deptCode) {
|
||||||
return null;
|
FinanceBO result = financeService.getFinanceByCreditCodeAndYear(creditCode, deptCode);
|
||||||
|
return success(BeanUtils.toBean(result, FinanceRespDTO.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,40 @@
|
||||||
package org.sk.module.data.controller.finance;
|
package org.sk.module.data.controller.finance;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
|
import org.sk.module.data.dal.param.finance.FinanceParam;
|
||||||
|
import org.sk.module.data.dal.vo.FinanceVO;
|
||||||
|
import org.sk.module.data.service.finance.FinanceService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/finance")
|
@RequestMapping("/finance")
|
||||||
public class FinanceController {
|
public class FinanceController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FinanceService financeService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
public String get() {
|
public String get() {
|
||||||
return "hello wzc";
|
return "hello wzc";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getFinanceInfo")
|
||||||
|
public CommonResult<FinanceVO> getFinanceInfo(@Valid @RequestBody FinanceParam financeParam) {
|
||||||
|
|
||||||
|
FinanceBO result = financeService.getFinanceByCreditCodeAndYear(financeParam.getCreditCode(),
|
||||||
|
financeParam.getYear());
|
||||||
|
|
||||||
|
return CommonResult.success(BeanUtils.toBean(result, FinanceVO.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);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.sk.module.data.dal.param.finance;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Schema(description = "财务数据 Request VO")
|
||||||
|
@Data
|
||||||
|
public class FinanceParam {
|
||||||
|
|
||||||
|
@NotBlank(message = "社会统一代码不能为空")
|
||||||
|
private String creditCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "年份不能为空")
|
||||||
|
private String year;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.sk.module.data.dal.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FinanceVO {
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
|
@ -1,10 +1,11 @@
|
||||||
package org.sk.module.data.service.finance;
|
package org.sk.module.data.service.finance;
|
||||||
|
|
||||||
|
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||||
|
|
||||||
public interface FinanceService {
|
public interface FinanceService {
|
||||||
|
|
||||||
|
|
||||||
|
FinanceBO getFinanceByCreditCodeAndYear(String creditCode, String year);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,24 @@
|
||||||
package org.sk.module.data.service.finance;
|
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;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class FinanceServiceImpl implements FinanceService {
|
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