下载内置算税结果
This commit is contained in:
parent
cfa5d2840c
commit
b56cc59cde
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.engine.salary.entity.taxdeclaration.param;
|
||||||
|
|
||||||
|
import com.engine.salary.util.valid.DataCheck;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DeclareTaxResultFeedbackQueryParam {
|
||||||
|
|
||||||
|
@DataCheck(require = true, message = "个税申报记录id不能为空!")
|
||||||
|
Long id;
|
||||||
|
|
||||||
|
@DataCheck(require = true, message = "申报类型不能为空!")
|
||||||
|
Integer reportType;
|
||||||
|
|
||||||
|
String requestId;
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.engine.salary.service;
|
||||||
|
|
||||||
import com.engine.salary.common.YearMonthRange;
|
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.DeclareTaxResultFeedbackQueryParam;
|
||||||
import com.engine.salary.entity.taxdeclaration.param.GetCompanyIncomesQueryParam;
|
import com.engine.salary.entity.taxdeclaration.param.GetCompanyIncomesQueryParam;
|
||||||
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;
|
||||||
|
|
@ -142,6 +143,17 @@ public interface TaxDeclareRecordService {
|
||||||
|
|
||||||
XSSFWorkbook exportGetCompanyIncomes(GetCompanyIncomesQueryParam param);
|
XSSFWorkbook exportGetCompanyIncomes(GetCompanyIncomesQueryParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申报内置算税结果查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Object getDeclareTaxResultFeedback(Long id);
|
||||||
|
|
||||||
|
XSSFWorkbook exportGetDeclareTaxResultFeedback(DeclareTaxResultFeedbackQueryParam param);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作废
|
* 作废
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,7 @@ import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO;
|
||||||
import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO;
|
import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO;
|
||||||
import com.engine.salary.entity.taxdeclaration.bo.*;
|
import com.engine.salary.entity.taxdeclaration.bo.*;
|
||||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO;
|
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO;
|
||||||
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
|
import com.engine.salary.entity.taxdeclaration.param.*;
|
||||||
import com.engine.salary.entity.taxdeclaration.param.GetCompanyIncomesQueryParam;
|
|
||||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
|
|
||||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
|
|
||||||
import com.engine.salary.entity.taxdeclaration.po.*;
|
import com.engine.salary.entity.taxdeclaration.po.*;
|
||||||
import com.engine.salary.entity.taxdeclaration.response.CancelDeclareFeedbackResponse;
|
import com.engine.salary.entity.taxdeclaration.response.CancelDeclareFeedbackResponse;
|
||||||
import com.engine.salary.entity.taxdeclaration.response.DeclareTaxFeedbackResponse;
|
import com.engine.salary.entity.taxdeclaration.response.DeclareTaxFeedbackResponse;
|
||||||
|
|
@ -49,6 +46,7 @@ import com.engine.salary.mapper.taxdeclaration.TaxDeclareRecordMapper;
|
||||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclareStatusMapper;
|
import com.engine.salary.mapper.taxdeclaration.TaxDeclareStatusMapper;
|
||||||
import com.engine.salary.remote.tax.client.DeclareClient;
|
import com.engine.salary.remote.tax.client.DeclareClient;
|
||||||
import com.engine.salary.remote.tax.response.declare.GetCompanyIncomesResponse;
|
import com.engine.salary.remote.tax.response.declare.GetCompanyIncomesResponse;
|
||||||
|
import com.engine.salary.remote.tax.response.declare.GetDeclareTaxResultFeedbackResponse;
|
||||||
import com.engine.salary.service.*;
|
import com.engine.salary.service.*;
|
||||||
import com.engine.salary.service.factory.TaxPaymentServiceFactory;
|
import com.engine.salary.service.factory.TaxPaymentServiceFactory;
|
||||||
import com.engine.salary.util.*;
|
import com.engine.salary.util.*;
|
||||||
|
|
@ -1042,6 +1040,40 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
|
||||||
return ExcelUtil.genWorkbookV2(map);
|
return ExcelUtil.genWorkbookV2(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getDeclareTaxResultFeedback(Long id) {
|
||||||
|
TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id);
|
||||||
|
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord();
|
||||||
|
|
||||||
|
DeclareClient declareClient = new DeclareClient(taxDeclareRecord.getTaxAgentId());
|
||||||
|
GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse = declareClient.getDeclareTaxResultFeedback(taxDeclareRecord.getDeclareRequestId());
|
||||||
|
|
||||||
|
Map<String, List<List<Object>>> map = new HashMap<>();
|
||||||
|
List<TaxDeclarationPO> list = getTaxDeclarationService(user).listByTaxDeclareRecordId(id);
|
||||||
|
list.stream().map(TaxDeclarationPO::getIncomeCategory).map(IncomeCategoryEnum::parseByValue).forEach(e -> e.parseGetDeclareTaxResultFeedbackResponse(map, declareTaxResultFeedbackResponse));
|
||||||
|
return declareClient.getDeclareTaxResultFeedback(taxDeclareRecord.getDeclareRequestId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XSSFWorkbook exportGetDeclareTaxResultFeedback(DeclareTaxResultFeedbackQueryParam param) {
|
||||||
|
Long id = param.getId();
|
||||||
|
TaxDeclareRecordPO taxDeclareRecord = getById(id);
|
||||||
|
String requestId = param.getRequestId();
|
||||||
|
TaxDeclareStatusPO declareStatus = getTaxDeclareStatusService(user).getTaxDeclareStatus(id, param.getReportType());
|
||||||
|
|
||||||
|
DeclareClient declareClient = new DeclareClient(taxDeclareRecord.getTaxAgentId());
|
||||||
|
GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse = declareClient.getDeclareTaxResultFeedback(StringUtils.isEmpty(requestId) ? declareStatus.getDeclareRequestId() : requestId);
|
||||||
|
|
||||||
|
Map<String, List<List<Object>>> map = new HashMap<>();
|
||||||
|
List<TaxDeclarationPO> list = getTaxDeclarationService(user).listByTaxDeclareRecordId(id);
|
||||||
|
list.stream()
|
||||||
|
.map(TaxDeclarationPO::getIncomeCategory)
|
||||||
|
.map(IncomeCategoryEnum::parseByValue)
|
||||||
|
.filter(incomeCategoryEnum -> incomeCategoryEnum.getReportType().getValue().equals(param.getReportType()))
|
||||||
|
.collect(Collectors.toList()).forEach(e -> e.parseGetDeclareTaxResultFeedbackResponse(map, declareTaxResultFeedbackResponse));
|
||||||
|
return ExcelUtil.genWorkbookV2(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDeclare(Long id, Integer reportType) {
|
public void updateDeclare(Long id, Integer reportType) {
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,38 @@ public class TaxDeclarationController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申报内置算税结果
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/exportGetDeclareTaxResultFeedback")
|
||||||
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
public Response exportGetDeclareTaxResultFeedback(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeclareTaxResultFeedbackQueryParam param) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).exportGetDeclareTaxResultFeedback(param);
|
||||||
|
String fileName = "申报内置算税结果-" + LocalDate.now();
|
||||||
|
try {
|
||||||
|
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamingOutput output = outputStream -> {
|
||||||
|
workbook.write(outputStream);
|
||||||
|
outputStream.flush();
|
||||||
|
};
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("申报内置算税结果导出异常", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对比算税过程
|
* 对比算税过程
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -518,6 +518,15 @@ public class TaxDeclareRecordWrapper extends Service {
|
||||||
return getTaxDeclareRecordService(user).exportGetCompanyIncomes(param);
|
return getTaxDeclareRecordService(user).exportGetCompanyIncomes(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object getDeclareTaxResultFeedback(Long id) {
|
||||||
|
return getTaxDeclareRecordService(user).getDeclareTaxResultFeedback(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public XSSFWorkbook exportGetDeclareTaxResultFeedback(DeclareTaxResultFeedbackQueryParam param) {
|
||||||
|
return getTaxDeclareRecordService(user).exportGetDeclareTaxResultFeedback(param);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作废
|
* 作废
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue