根据统一社会信用代码 和年份查询收入财务信息 ,取并集, 年份可为空
parent
74cec466b5
commit
446d48edef
|
@ -3,8 +3,10 @@ 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 cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||
import org.sk.module.data.dal.param.finance.FinanceParam;
|
||||
import org.sk.module.data.dal.param.finance.IncomeAndTaxParam;
|
||||
import org.sk.module.data.dal.vo.FinanceVO;
|
||||
import org.sk.module.data.service.finance.FinanceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/finance")
|
||||
|
@ -37,4 +40,15 @@ public class FinanceController {
|
|||
|
||||
return CommonResult.success(BeanUtils.toBean(result, FinanceVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据统一社会信用代码和年份查询企业收入和税收
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
||||
@GetMapping("/getIncomeAndTax")
|
||||
public CommonResult<List<FinanceVO>> getIncomeAndTax(@Valid @RequestBody IncomeAndTaxParam param) {
|
||||
return CommonResult.success(financeService.getIncomeAndTax(param));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FinanceMapper {
|
||||
|
||||
|
@ -14,4 +16,7 @@ public interface FinanceMapper {
|
|||
* @return FinanceBO
|
||||
*/
|
||||
FinanceBO getFinanceByCreditCodeAndYear(@Param("creditCode") String creditCode, @Param("year") String year);
|
||||
|
||||
|
||||
List<FinanceBO> getIncomeAndTax(@Param("creditCodes")List<String> creditCodes, @Param("year") String year);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package org.sk.module.data.dal.param.finance;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 财务数据入参
|
||||
*/
|
||||
@Data
|
||||
public class IncomeAndTaxParam {
|
||||
|
||||
/**
|
||||
* 社会统一代码
|
||||
*/
|
||||
@NotBlank(message = "社会统一代码不能为空")
|
||||
private String creditCodes;
|
||||
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
private String year;
|
||||
|
||||
}
|
|
@ -1,11 +1,21 @@
|
|||
package org.sk.module.data.service.finance;
|
||||
|
||||
import org.sk.module.data.dal.bo.finance.FinanceBO;
|
||||
import org.sk.module.data.dal.param.finance.IncomeAndTaxParam;
|
||||
import org.sk.module.data.dal.vo.FinanceVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FinanceService {
|
||||
|
||||
|
||||
FinanceBO getFinanceByCreditCodeAndYear(String creditCode, String year);
|
||||
|
||||
/**
|
||||
* 根据 creditCode 和 year 查询财务信息
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<FinanceVO> getIncomeAndTax(IncomeAndTaxParam param);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
package org.sk.module.data.service.finance;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
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.sk.module.data.dal.param.finance.IncomeAndTaxParam;
|
||||
import org.sk.module.data.dal.vo.FinanceVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@DS("master")
|
||||
public class FinanceServiceImpl implements FinanceService {
|
||||
|
||||
|
||||
|
@ -21,4 +30,13 @@ public class FinanceServiceImpl implements FinanceService {
|
|||
}
|
||||
return financeMapper.getFinanceByCreditCodeAndYear(creditCode, year);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FinanceVO> getIncomeAndTax(IncomeAndTaxParam param) {
|
||||
String[] split = param.getCreditCodes().split(",");
|
||||
List<FinanceBO> financeBOList = financeMapper.getIncomeAndTax(Arrays.asList(split), param.getYear());
|
||||
List<FinanceVO> financeVOList = new ArrayList<>();
|
||||
BeanUtils.copyProperties(financeBOList, financeVOList);
|
||||
return financeVOList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ knife4j:
|
|||
|
||||
# MyBatis Plus 的配置项
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:mappers/**/*Mapper.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||
global-config:
|
||||
|
|
Loading…
Reference in New Issue