企业申报数据明细查询 (下架)

This commit is contained in:
钱涛 2024-06-24 17:02:53 +08:00
parent bae85b761c
commit d0da02119d
9 changed files with 0 additions and 237 deletions

View File

@ -95,11 +95,6 @@ public class SzyhApiConstant {
*/ */
public static final String QUERY_DECLARE_STATUS = "/gateway/iit/report/queryDeclarationRecord"; public static final String QUERY_DECLARE_STATUS = "/gateway/iit/report/queryDeclarationRecord";
/**
* 企业申报数据明细查询
*/
public static final String QUERY_COMPANY_INCOMES = "/gateway/iit/report/getCompanyIncomes";
/** /**
* 获取流量统计情况 * 获取流量统计情况
*/ */
@ -152,10 +147,6 @@ public class SzyhApiConstant {
* 刷新缴款状态 * 刷新缴款状态
*/ */
public static final String GET_SYNC_WITHHOLDING_FEEDBACK = "gateway/iit/payment/getSyncWithholdingFeedback"; public static final String GET_SYNC_WITHHOLDING_FEEDBACK = "gateway/iit/payment/getSyncWithholdingFeedback";
/**
* 企业申报数据明细查询
*/
public static final String GET_COMPANY_INCOMES = "gateway/iit/report/getCompanyIncomes";
/** /**
* 个人养老金下载 * 个人养老金下载

View File

@ -112,12 +112,4 @@ public interface AddUpSituationService {
* @date 2022/10/31 14:00 * @date 2022/10/31 14:00
*/ */
AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam); AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam);
/**
* 在线获取实际累计已预扣预缴税额
*
* @param param
* @return
*/
Map<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param);
} }

View File

@ -4,7 +4,6 @@ import com.engine.salary.common.YearMonthRange;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclareRecordParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO; import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.PageInfo;
@ -80,13 +79,6 @@ public interface TaxDeclareRecordService {
*/ */
void save(TaxDeclarationSaveParam saveParam); void save(TaxDeclarationSaveParam saveParam);
/**
* 税局端申报明细查询
*
*/
String queryCompanyIncomes(TaxDeclareRecordParam taxDeclareRecordParam);
/** /**
* 刷新数据 * 刷新数据
* *

View File

@ -1245,152 +1245,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
} }
@Override
public Map<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param) {
SalaryAssert.notNull(param.getDeclareMonth(), SalaryI18nUtil.getI18nLabel(100586, "税款所属期必传"));
// 获取接口配置
TaxDeclarationApiConfigPO apiConfig = getTaxDeclarationApiConfigService(user).getConfig(true);
// 获取包装类
AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper = getAddUpDeductionOnlineRequestWrapper(null, apiConfig);
// 获取报税信息
List<TaxAgentTaxReturnPO> taxReturnPOList = getTaxAgentTaxReturnService(user).getByTaxAgentIds(requestWrapper.getTaxAgentMap().keySet());
List<TaxAgentTaxReturnPO> failReturnPOList = taxReturnPOList.stream().filter(e -> !TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(e.getCheckStatus())).collect(Collectors.toList());
SalaryAssert.isFalse(taxReturnPOList.size() == failReturnPOList.size(), SalaryI18nUtil.getI18nLabel(183781, "企业未通过验证,暂时无法获取累计专项附加扣除数据,请先在【个税扣缴义务人】菜单验证企业报税信息"));
Map<String, Object> result = new HashMap<>(1);
if (!failReturnPOList.isEmpty()) {
String failTaxAgentNames = failReturnPOList.stream().map(e -> requestWrapper.getTaxAgentMap().get(e.getTaxAgentId())).collect(Collectors.joining(""));
result.put("msg", String.format(SalaryI18nUtil.getI18nLabel(183782, "%s未通过登记验证无法在线获取数据"), failTaxAgentNames));
}
// 获取报送成功的人员名单
Map<Long, List<EmployeeDeclarePO>> taxAgentEmpDeclareMap = getEmpDeclareMap(requestWrapper.getTaxAgentMap().keySet(), param.getDeclareMonth());
// 开始请求接口获取数据
getQuerySpecialAmountBodies(param, requestWrapper, taxAgentEmpDeclareMap, taxReturnPOList);
return result;
}
private void getQuerySpecialAmountBodies(AddUpDeductionMonthTaxAgentParam param,
AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper requestWrapper,
Map<Long, List<EmployeeDeclarePO>> taxAgentEmployeeDeclareMap,
List<TaxAgentTaxReturnPO> taxReturnPOList) {
List<AddUpSituation> updateList = new ArrayList<>();
List<AddUpSituation> insertList = new ArrayList<>();
for (TaxAgentTaxReturnPO returnPO : taxReturnPOList) {
if (!TaxAgentTaxReturnStatusEnum.SUCCESS.getValue().equals(returnPO.getCheckStatus())) {
continue;
}
// 发起请求
String taxAgentName = requestWrapper.getTaxAgentMap().get(returnPO.getTaxAgentId());
List<EmployeeDeclarePO> declarePOList = taxAgentEmployeeDeclareMap.getOrDefault(returnPO.getTaxAgentId(), new ArrayList<>());
if (declarePOList.isEmpty()) {
log.info("该主体下没有报送成功的人员,主体名称:{}", taxAgentName);
continue;
}
List<AddUpSituation> poList = getAddUpSituationMapper().listSome((AddUpSituation.builder().taxYearMonth(param.getDeclareMonth()).taxAgentId(returnPO.getTaxAgentId()).build()));
encryptUtil.decryptList(poList, AddUpSituation.class);
Map<String, AddUpSituation> poMap = SalaryEntityUtil.convert2Map(poList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId());
// 内部员工身份证信息
List<Long> employeeIds = SalaryEntityUtil.properties(requestWrapper.getSalaryArchiveList(), SalaryArchivePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).listByIds(employeeIds);
Map<String, DataCollectionEmployee> simpleUserInfoMap = SalaryEntityUtil.convert2Map(simpleUserInfos, DataCollectionEmployee::getIdNo);
for (int i = 1; true; i++) {
GetCompanyIncomesResponse queryResponse = getCompanyIncomes(returnPO, taxAgentName, param, requestWrapper.getApiConfig(), i);
// 校验请求结果
String responseCode = Optional.ofNullable(queryResponse)
.map(GetCompanyIncomesResponse::getHead)
.map(SzyhResponseHead::getCode)
.orElse(null);
List<GetCompanyIncomesResponse.Detail> details = Optional.ofNullable(queryResponse)
.map(GetCompanyIncomesResponse::getBody)
.map(GetCompanyIncomesResponse.Body::getSfmx)
.orElse(null);
if (!SzyhApiConstant.SUCCESS_CODE.equals(responseCode)) {
log.info("getCompanyIncomes error{}", JSON.toJSONString(queryResponse));
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试"));
}
if (CollectionUtils.isEmpty(details)) {
break;
}
Date now = new Date();
for (GetCompanyIncomesResponse.Detail detail : details) {
DataCollectionEmployee simpleUserInfo = simpleUserInfoMap.get(detail.getZjhm());
Long employeeId = Optional.ofNullable(simpleUserInfo)
.map(DataCollectionEmployee::getEmployeeId)
.orElse(0L);
if (poMap.containsKey(returnPO.getTaxAgentId() + "-" + employeeId)) {
AddUpSituation po = poMap.get(returnPO.getTaxAgentId() + "-" + employeeId);
po.setUpdateTime(now);
po.setActualAddUpAdvanceTax(detail.getKjse());
po.setTaxAdjustment(SalaryEntityUtil.string2BigDecimalDefault0(detail.getKjse()).subtract(SalaryEntityUtil.string2BigDecimalDefault0(po.getAddUpAdvanceTax())).toString());
updateList.add(po);
} else {
AddUpSituation po = new AddUpSituation();
// po.setId(IdGenerator.generate());
po.setCreateTime(now);
po.setUpdateTime(now);
po.setCreator(requestWrapper.getCurrentEmployeeId());
po.setDeleteType(NumberUtils.INTEGER_ZERO);
po.setTenantKey(requestWrapper.getTenantKey());
po.setYear(param.getDeclareMonth().getYear());
po.setTaxYearMonth(param.getDeclareMonth());
po.setEmployeeType(0);
po.setTaxAgentId(returnPO.getTaxAgentId());
po.setEmployeeId(employeeId);
po.setAddUpIncome("0");
po.setAddUpSubtraction("0");
po.setAddUpSocialSecurityTotal("0");
po.setAddUpAccumulationFundTotal("0");
po.setAddUpEnterpriseAndOther("0");
po.setAddUpOtherDeduction("0");
po.setAddUpTaxExemptIncome("0");
po.setAddUpAllowedDonation("0");
po.setAddUpTaxSavings("0");
po.setAddUpAdvanceTax("0");
po.setAddUpTaxableIncome("0");
po.setActualAddUpAdvanceTax(detail.getKjse());
po.setTaxAdjustment(detail.getKjse());
insertList.add(po);
}
}
}
}
if (!insertList.isEmpty()) {
List<List<AddUpSituation>> insertPartition = Lists.partition(insertList, 50);
insertPartition.forEach(list -> {
list = encryptUtil.encryptList(list, AddUpSituation.class);
getAddUpSituationMapper().insertData(list);
});
}
if (!updateList.isEmpty()) {
List<List<AddUpSituation>> updatePartition = Lists.partition(updateList, 50);
updatePartition.forEach(list -> {
list = encryptUtil.encryptList(list, AddUpSituation.class);
getAddUpSituationMapper().updateData(list);
});
}
}
private GetCompanyIncomesResponse getCompanyIncomes(TaxAgentTaxReturnPO returnPO,
String taxAgentName,
AddUpDeductionMonthTaxAgentParam param,
TaxDeclarationApiConfigPO apiConfig,
Integer pageNo) {
String url = apiConfig.getHost() + SzyhApiConstant.GET_COMPANY_INCOMES;
Map<String, Object> requestParam = DataCollectionBO.getApiBaseQueryParams(returnPO, taxAgentName, SalaryDateUtil.getFormatYYYYMM(param.getDeclareMonth()));
requestParam.put("pageSize", 1000);
requestParam.put("pageNo", pageNo);
requestParam.put("reportType", 1);
String reqJson = JsonUtil.toJsonString(requestParam);
log.info("getCompanyIncomes params --- \n{}\n", reqJson);
Map<String, String> params = new HashMap<>(1);
Map<String, String> header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret());
// 开始请求
String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE);
log.info("getCompanyIncomes res --- {}", res);
return JsonUtil.parseObject(res, GetCompanyIncomesResponse.class);
}
private AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper getAddUpDeductionOnlineRequestWrapper(List<AddUpDeductionRequestPO> requestPOList, TaxDeclarationApiConfigPO apiConfig) { private AddUpDeductionServiceImpl.AddUpDeductionOnlineRequestWrapper getAddUpDeductionOnlineRequestWrapper(List<AddUpDeductionRequestPO> requestPOList, TaxDeclarationApiConfigPO apiConfig) {
boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution(); boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution();
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());

View File

@ -1116,31 +1116,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
return res; return res;
} }
@Override
public String queryCompanyIncomes(TaxDeclareRecordParam taxDeclareRecordParam) {
ValidUtil.doValidator(taxDeclareRecordParam);
TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(taxDeclareRecordParam.getTaxDeclareRecordId());
TaxDeclarationApiConfigPO apiConfig = taxDeclareRequest.getTaxDeclarationApiConfig();
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord();
Map<String, Object> requestParam = taxDeclareRequest.getRequestParam();
// 税款所属期
requestParam.put("skssq", SalaryDateUtil.getFormatYYYYMM(taxDeclareRecord.getTaxCycle()));
// 报表类型
requestParam.put("reportType", taxDeclareRecordParam.getReportType());
// 页码
requestParam.put("pageNo", "1");
// 每页数量
requestParam.put("pageSize", "3000");
// 请求
String reqJson = JsonUtil.toJsonString(requestParam);
String url = apiConfig.getHost() + SzyhApiConstant.QUERY_COMPANY_INCOMES;
Map<String, String> params = new HashMap<>(1);
Map<String, String> header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret());
String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE);
log.info("税局端申报明细查询返回数据:" + res);
return res;
}
@Override @Override

View File

@ -356,19 +356,4 @@ public class AddUpSituationController {
map.put("importParam", importParam); map.put("importParam", importParam);
return new ResponseResult<AddUpSituationImportParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::preview, importParam); return new ResponseResult<AddUpSituationImportParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::preview, importParam);
} }
/**
* 在线获取实际累计已预扣预缴税额
*
* @param param 前端请求参数
* @return WeaResult 接口返回信息
*/
@POST
@Path("/online/actualAddUpAdvanceTax")
@Produces(MediaType.APPLICATION_JSON)
public String onlineRequest(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody AddUpDeductionMonthTaxAgentParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AddUpDeductionMonthTaxAgentParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::onlineRequest, param);
}
} }

View File

@ -319,20 +319,6 @@ public class TaxDeclarationController {
return new ResponseResult<Long, String>(user).run(getTaxDeclareRecordWrapper(user)::queryDeclareStatus, taxDeclareRecordParam.getTaxDeclareRecordId()); return new ResponseResult<Long, String>(user).run(getTaxDeclareRecordWrapper(user)::queryDeclareStatus, taxDeclareRecordParam.getTaxDeclareRecordId());
} }
/**
* 税局端申报明细查询
*
* @param taxDeclareRecordParam 查询申报明细参数
* @return
*/
@POST
@Path("/queryCompanyIncomes")
@Produces(MediaType.APPLICATION_JSON)
public String queryCompanyIncomes(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclareRecordParam taxDeclareRecordParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxDeclareRecordParam, String>(user).run(getTaxDeclareRecordWrapper(user)::queryCompanyIncomes,taxDeclareRecordParam);
}
/** /**
* 刷新数据 * 刷新数据

View File

@ -166,8 +166,4 @@ public class AddUpSituationWrapper extends Service {
public AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam) { public AddUpSituationRecordDTO getAddUpSituation(AddUpSituationParam addUpSituationParam) {
return getAddUpSituationService(user).getAddUpSituation(addUpSituationParam); return getAddUpSituationService(user).getAddUpSituation(addUpSituationParam);
} }
public Map<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param) {
return getAddUpSituationService(user).onlineRequest(param);
}
} }

View File

@ -642,15 +642,6 @@ public class TaxDeclareRecordWrapper extends Service {
return getTaxDeclareRecordService(user).queryDeclareStatus(id); return getTaxDeclareRecordService(user).queryDeclareStatus(id);
} }
/**
* 税局端申报明细查询
*
* @return
*/
public String queryCompanyIncomes(TaxDeclareRecordParam taxDeclareRecordParam) {
return getTaxDeclareRecordService(user).queryCompanyIncomes(taxDeclareRecordParam);
}
/** /**
* 刷新数据 * 刷新数据