Commit f6962817 authored by chase's avatar chase

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents 4b212884 2e39bfb5
......@@ -11,6 +11,7 @@ public class ErrorMessage {
public static final String NoSelectSheet = "NoSelectSheet";
public static final String DIDNOTSELECTPERIOD = "You should select period!";
public static final String ImportFailed = "ImportFailed!";
public static final String ExportFailed = "ExportFailed!";
......
......@@ -135,6 +135,17 @@ public class DateUtils {
return period;
}
/**
* 将yyyy- 等字符串转换为区间格式 yyyy
* @param dateStr
* @return
*/
public static Integer strToPeriodY(String dateStr) {
dateStr = dateStr.replace(" ","");
Integer period = Integer.valueOf(dateStr.substring(0, 4));
return period;
}
/**
* 将yyyymm 字符串转换为区间格式 yyyyMM
......
package pwc.taxtech.atms.constant;
/**
* @Auther: Gary J Li
* @Date: 27/02/2019 20:47
* @Description:
*/
public final class ExportTemplatePathConstant {
public static final String INVOICES_RECORD = "/vat_excel_template/invoice_record.xlsx";
public static final String CASH_FLOW = "/vat_excel_template/cash_flow.xlsx";
public static final String CERTIFIED_INVOICES_LIST = "/vat_excel_template/certified_invoices_list.xlsx";
public static final String RED_LETTER_INFO_TAB = "/vat_excel_template/red_letter_info_tab.xlsx";
public static final String COUPA_PURCHASING_REPORT = "/vat_excel_template/coupa_purchasing_report.xlsx";
public static final String INVOICE_DATA = "/vat_excel_template/invoice_data.xlsx";
}
package pwc.taxtech.atms.constant.enums;
public enum EnumCitImportType {
Undefined(0),
JournalAdjust(1),
TrialBalance (2),
DraftAccountMapping (3),
BalanceSheetPrcAdjust (4),
ProfitPrcAdjust (5),
EAMAssetsDisposal (6),
SalaryAdvance (7)
;
private Integer code;
EnumCitImportType(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
public static EnumCitImportType valueOf(Integer value) {
for (EnumCitImportType item : EnumCitImportType.values()) {
if (item.getCode().equals(value)) {
return item;
}
}
return null;
}
}
package pwc.taxtech.atms.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entity.CitAssetGroupResult;
import pwc.taxtech.atms.entity.CitAssetsList;
import pwc.taxtech.atms.service.impl.AssetListServiceImpl;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
/**
* @Description 资产相关Controller
* @Author zhikai.z.wei
*/
@RestController
@RequestMapping("/api/v1/asset/")
public class AssetListController {
private static Logger logger = LoggerFactory.getLogger(AssetListController.class);
@Autowired
private AssetListServiceImpl assetListService;
/**
*
* @return
*/
@RequestMapping(value = "/getAssetListData", method = RequestMethod.GET)
public @ResponseBody
ApiResultDto getAssetListData(){
logger.info("获取所有资产清单");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData("");
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
apiResultDto.setData("");
return apiResultDto;
}
}
/**
* 根据资产类别(固定资产、长期待摊、无形资产)查询出结果
* @param assetType
* @return
*/
@RequestMapping(value = "/getAssetResultList", method = RequestMethod.GET)
public @ResponseBody ApiResultDto getAssetResultList(Integer assetType, @RequestParam String projectId, @RequestParam Integer taxAccountCompare){
logger.info("根据资产类别获取资产清单");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetListService.getAssetResultList(assetType,projectId,taxAccountCompare));
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
*
* @return
*/
@RequestMapping(value = "/getAssetGroupResultData", method = RequestMethod.GET)
public @ResponseBody ApiResultDto getAssetGroupResultData(@RequestParam String projectId){
logger.info("获取资产类别");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetListService.getAssetGroupResultData(projectId));
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 获取资产一级分类
* @return
*/
@RequestMapping(value = "/getAssetGroupListData", method = RequestMethod.GET)
public @ResponseBody ApiResultDto getAssetGroupListData(){
logger.info("获取资产一级分类");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetListService.getAssetGroupListData());
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 获取资产二级分类
* @return
*/
@RequestMapping(value = "/getAssetDetailGroupListData", method = RequestMethod.GET)
public @ResponseBody ApiResultDto getAssetDetailGroupListData(){
logger.info("根据资产二级分类");
ApiResultDto apiResultDto = new ApiResultDto();
try{
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetListService.getAssetDetailGroupListData());
return apiResultDto;
}catch(Exception e){
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 当保留差异全选或全反选选项变化时进行批量修改
* @param assetType
* @param projectId
* @param isRetain
* @return
*/
@RequestMapping(value="batchUpdateIsRetain",method = RequestMethod.POST)
public ApiResultDto batchUpdateIsRetain(Integer assetType, @RequestParam String projectId, @RequestParam Integer isRetain){
assetListService.batchUpdateIsRetain(assetType,projectId, isRetain);
return null;
}
/**
* 保存资产分类(当对资产类别进行二级分类匹配完成后点击确定按钮所走的方法)
* @param assetGroupResults
* @param saveGroupType
* @param projectId
* @return
*/
@RequestMapping(value="saveAssetGroupInfo",method = RequestMethod.POST)
public ApiResultDto saveAssetGroupInfo(@RequestBody List<CitAssetGroupResult> assetGroupResults,
@RequestParam Integer saveGroupType,
@RequestParam String projectId){
return assetListService.saveAssetGroupInfo(assetGroupResults, saveGroupType, projectId);
}
/**
* 当资产清单Grid编辑进行保存所走的方法
* @param citAssetsLists
* @param projectId
* @return
*/
@RequestMapping(value="updateAssetResultList",method = RequestMethod.POST)
public ApiResultDto updateAssetResultList(@RequestBody List<CitAssetsList> citAssetsLists,
@RequestParam String projectId){
ApiResultDto apiResultDto = new ApiResultDto();
assetListService.updateAssetResultList(citAssetsLists,projectId);
apiResultDto.setCode(1);
apiResultDto.setMessage("资产修改成功");
return apiResultDto;
}
/**
* CIT资产文件导入
* @return
*/
@RequestMapping(value = "/assetsImport", method = RequestMethod.POST)
public @ResponseBody
ApiResultDto assetsImport(@RequestParam MultipartFile file,
@RequestParam String filename,
@RequestParam String tempFileName,
@RequestParam String projectId){
logger.info("CIT资产导入");
ApiResultDto apiResultDto = new ApiResultDto();
try{
if (file == null || file.getSize() <= 0) {
apiResultDto.setCode(-1);
apiResultDto.setMessage("没有获取到文件");
logger.warn("没有获取到文件");
return apiResultDto;
}
logger.debug("file name: " + file.getOriginalFilename());
InputStream input = null;
try {
input = file.getInputStream();
//调用资产导入业务逻辑
OperationResultDto assetsImportResult = assetListService.assetsImport(input, file.getOriginalFilename(), projectId);
//判断是否导入成功,若成功获取资产类别并返回页面
if(assetsImportResult.getResult() != null && !assetsImportResult.getResult()){
apiResultDto.setData(assetListService.getAssetGroupResultData(projectId));
}
} catch (IOException e) {
apiResultDto.setCode(-2);
apiResultDto.setMessage("获取文件流失败");
logger.warn("获取文件流失败");
return apiResultDto;
}
apiResultDto.setCode(1);
apiResultDto.setMessage("资产导入成功");
return apiResultDto;
}catch (Exception e){
logger.error("资产导入失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("资产导入失败");
return apiResultDto;
}
}
}
package pwc.taxtech.atms.controller;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.AssetDetailGroupDto;
import pwc.taxtech.atms.dto.AssetDetailGroupStringDto;
import pwc.taxtech.atms.entity.AssetDetailGroup;
import pwc.taxtech.atms.entity.AssetGroup;
import pwc.taxtech.atms.service.impl.AssetGroupServiceImpl;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description 资产相关Controller
* @Author zhikai.z.wei
*/
@RestController
@RequestMapping("/api/v1/asset/")
public class AssetMappingController {
private static Logger logger = LoggerFactory.getLogger(AssetMappingController.class);
@Autowired
private AssetGroupServiceImpl assetGroupService;
/**
* 获取各种资产(固定资产、长期待摊、无形资产)二级分类
* @return ApiResultDto
*/
@RequestMapping(value="getAllAssetDetailGroup",method= RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ApiResultDto getAllAssetDetailGroup(){
ApiResultDto apiResultDto = new ApiResultDto();
try{
Map<String, List> assetsMap = new HashMap<String, List>();
logger.info("获取各种类型资产二级分类");
//获取资产一级分类相关数据
List<AssetGroup> allAssetGroup = assetGroupService.getAllAssetGroup();
//获取固定资产
// List<AssetDetailGroup> fixedAssetDetailGroups = assetGroupService.getAllFixedAssetDetailGroup();
//获取长期待摊
List<AssetDetailGroup> longTermPendingDetailGroups = assetGroupService.getAllLongTermPendingDetailGroup();
//获取无形资产
List<AssetDetailGroup> intangibleAssetDetailGroups = assetGroupService.getAllIntangibleAssetsDetailGroup();
assetsMap.put("allAssetGroup",allAssetGroup);
// assetsMap.put("1",fixedAssetDetailGroups);
assetsMap.put("2",longTermPendingDetailGroups);
assetsMap.put("3",intangibleAssetDetailGroups);
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(assetsMap);
logger.info("获取资产二级分类成功");
return apiResultDto;
}catch(Exception e){
logger.error("获取资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 获取固定资产二级分类
* @return ApiResultDtoaddAssetDetailGroup
*/
@RequestMapping(value="getFixedAssetDetailGroup",method= RequestMethod.POST)
public @ResponseBody
ApiResultDto getAllFixedAssetDetailGroup(@RequestBody AssetDetailGroupDto assetDetailGroupDto){
logger.info("获取固定资产二级分类,参数:"+assetDetailGroupDto);
ApiResultDto apiResultDto = new ApiResultDto();
try{
PageInfo<AssetDetailGroupStringDto> detailGroups = assetGroupService.getAllFixedAssetDetailGroup(assetDetailGroupDto);
Long countAssetByType = assetGroupService.countAssetByType(assetDetailGroupDto.getAssetGroupType());
Map map = new HashMap();
map.put("detailGroup",detailGroups);
map.put("totalItem",countAssetByType);
apiResultDto.setCode(1);
apiResultDto.setMessage("获取成功");
apiResultDto.setData(map);
logger.info("获取固定资产二级分类成功");
return apiResultDto;
}catch(Exception e){
logger.error("获取固定资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("获取失败");
return apiResultDto;
}
}
/**
* 新增资产二级分类
* @return
*/
@RequestMapping(value="addAssetDetailGroup",method = RequestMethod.POST)
public ApiResultDto addAssetDetailGroup(@RequestBody AssetDetailGroupDto assetDetailGroupDto){
logger.info("新增资产二级分类");
ApiResultDto apiResultDto = new ApiResultDto();
if(assetDetailGroupDto ==null ){
apiResultDto.setCode(0);
apiResultDto.setMessage("传参为空!");
return apiResultDto;
}
try{
assetDetailGroupDto.setAssetGroupId(assetGroupService.getAssetGroupByType(assetDetailGroupDto.getAssetGroupType()).get(0).getId());
int i = assetGroupService.addFixedAssetDetailGroup(assetDetailGroupDto);
apiResultDto.setCode(1);
apiResultDto.setMessage("新增成功");
apiResultDto.setData(i);
return apiResultDto;
}catch(Exception e){
logger.error("新增固定资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("新增失败");
return apiResultDto;
}
}
/**
* 编辑固定资产二级分类
* @return
*/
@RequestMapping(value="editAssetDetailGroup",method= RequestMethod.POST)
public ApiResultDto editAssetDetailGroup(@RequestBody AssetDetailGroupDto assetDetailGroupDto){
logger.info("编辑资产二级分类");
ApiResultDto apiResultDto = new ApiResultDto();
try{
int i = assetGroupService.editFixedAssetDetailGroup(assetDetailGroupDto);
apiResultDto.setCode(1);
apiResultDto.setMessage("编辑成功");
apiResultDto.setData(i);
return apiResultDto;
}catch(Exception e){
logger.error("编辑资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("编辑失败");
return apiResultDto;
}
}
/**
* 删除固定资产二级分类
* @return
*/
@RequestMapping(value="deleteAssetDetailGroup",method= RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ApiResultDto deleteAssetDetailGroup(Long id){
logger.info("删除资产二级分类");
ApiResultDto apiResultDto = new ApiResultDto();
try{
int i = assetGroupService.deleteFixedAssetDetailGroup(id);
apiResultDto.setCode(1);
apiResultDto.setMessage("删除成功");
apiResultDto.setData(i);
return apiResultDto;
}catch(Exception e){
logger.error("删除资产二级分类失败,错误信息如下:");
e.printStackTrace();
apiResultDto.setCode(0);
apiResultDto.setMessage("删除失败");
return apiResultDto;
}
}
}
package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.constant.enums.EnumCitImportType;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.impl.CitImportExcelServiceImpl;
import java.io.InputStream;
import java.util.List;
import static pwc.taxtech.atms.constant.enums.EnumCitImportType.JournalAdjust;
/**
* @Description 资产相关Controller
* @Author zhikai.z.wei
*/
@RestController
@RequestMapping("/api/v1/citImport/")
public class CitImportExcelController {
private static Logger logger = LoggerFactory.getLogger(CitImportExcelController.class);
@Autowired
private CitImportExcelServiceImpl citImportExcelService;
@RequestMapping(value = "/citImportExcel", method = RequestMethod.POST)
public @ResponseBody
OperationResultDto citImportExcel(@RequestParam MultipartFile file, @RequestParam(required = false) String orgIds,
@RequestParam String periodDate,
@RequestParam Integer importType,
@RequestParam Integer importFileType){
logger.info("CIT调整版日记账导入");
OperationResultDto opeResultDto = new OperationResultDto();
try{
if (file == null || file.getSize() <= 0) {
opeResultDto.setResult(false);
opeResultDto.setResultMsg("没有获取到文件");
logger.warn("没有获取到文件");
return opeResultDto;
}
logger.debug("file name: " + file.getOriginalFilename());
List<String> orgList = (List<String>) JSONArray.parse(orgIds);
opeResultDto = citImportExcelService.citImportExcel(file, orgList, file.getOriginalFilename(), periodDate, importType, importFileType);
return opeResultDto;
}catch (Exception e){
logger.error("资产导入失败,错误信息如下:");
e.printStackTrace();
opeResultDto.setResult(false);
opeResultDto.setResultMsg("资产导入失败");
return opeResultDto;
}
}
/**
* CIT调整版日记账导入
* @return
*/
// @RequestMapping(value = "/journalAdjustImport", method = RequestMethod.POST)
// public @ResponseBody
// ApiResultDto journalAdjustImport(@RequestParam MultipartFile file,@RequestParam String periodDate,@RequestParam Integer importType){
// logger.info("CIT调整版日记账导入");
// ApiResultDto apiResultDto = new ApiResultDto();
// try{
// if (file == null || file.getSize() <= 0) {
// apiResultDto.setCode(-1);
// apiResultDto.setMessage("没有获取到文件");
// logger.warn("没有获取到文件");
// return apiResultDto;
// }
// logger.debug("file name: " + file.getOriginalFilename());
// InputStream input = null;
//
// input = file.getInputStream();
// //调用资产导入业务逻辑
// citImportExcelService.importJournalAdjust(input, file.getOriginalFilename(), periodDate, importType);
//
// apiResultDto.setCode(1);
// apiResultDto.setMessage("资产导入成功");
// return apiResultDto;
// }catch (Exception e){
// logger.error("资产导入失败,错误信息如下:");
// e.printStackTrace();
// apiResultDto.setCode(0);
// apiResultDto.setMessage("资产导入失败");
// return apiResultDto;
// }
// }
/**
* 获取导入的调整日记账版本
* @return
*/
@RequestMapping(value = "/getJournalAdjust", method = RequestMethod.GET)
public ApiResultDto getJournalAdjust(){
logger.info("获取CIT调整版日记账");
ApiResultDto apiResultDto = new ApiResultDto();
apiResultDto.setCode(1);
apiResultDto.setData(citImportExcelService.getJournalAdjust());
return apiResultDto;
}
/**
* 根据导入类型获取导入记录
* @param type
* @return
*/
@RequestMapping(value = "/getCitDataImportLog", method = RequestMethod.GET)
public ApiResultDto getCitDataImportLog(Integer type){
logger.info("获取CIT调整版日记账");
ApiResultDto apiResultDto = new ApiResultDto();
apiResultDto.setCode(1);
apiResultDto.setData(citImportExcelService.getCitDataImportLog(type));
return apiResultDto;
}
}
......@@ -9,6 +9,7 @@ import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.dpo.PagingDto;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.dataimport.DataImportParam;
import pwc.taxtech.atms.dto.dataimport.DataProcessParam;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceParam;
......@@ -218,6 +219,12 @@ public class DataImportController extends BaseController {
return new CamelPagingResultDto<>(dataImportService.displayImportLog(param));
}
@ResponseBody
@RequestMapping(value = "displayProcessLog", method = RequestMethod.POST)
public CamelPagingResultDto<DataValidateLogDto> displayProcessLog(@RequestBody DataProcessParam param) {
return new CamelPagingResultDto<>(dataImportService.displayProcessLog(param));
}
@ResponseBody
@RequestMapping(value = "callExtractFinancialData", method = RequestMethod.POST)
public OperationResultDto callExtractFinancialData(@RequestBody DataExtractParam dataExtractParam) {
......
......@@ -187,4 +187,42 @@ public class DataPreviewController extends BaseController {
logger.error(String.format("下载科目余额表-生成文件异常:%s",e.getMessage()));
}
}
@RequestMapping(value = "exportIRData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadIRQueryData(@RequestBody InvoiceRecordParam param, HttpServletResponse response) {
logger.debug("enter downloadIRQueryData");
String fileName="testFile";
dataPreviewSerivceImpl.exportInvoiceRecordList(response, param, fileName);
}
@RequestMapping(value = "exportCILData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadCILQueryData(@RequestBody CertifiedInvoicesListParam param, HttpServletResponse response) {
logger.debug("enter downloadCILQueryData");
String fileName="testFile";
dataPreviewSerivceImpl.exportCILList(response, param, fileName);
}
@RequestMapping(value = "exportRLITData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadRLITQueryData(@RequestBody RedLetterInfoTableParam param, HttpServletResponse response) {
logger.debug("enter downloadRLITQueryData");
String fileName="testFile";
dataPreviewSerivceImpl.exportRLITList(response, param, fileName);
}
@RequestMapping(value = "exportCPRData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadCPRQueryData(@RequestBody CoupaPurchasingReportParam param, HttpServletResponse response) {
logger.debug("enter downloadCPRQueryData");
String fileName="testFile";
dataPreviewSerivceImpl.exportCPRList(response, param, fileName);
}
@RequestMapping(value = "exportIDData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadIDQueryData(@RequestBody InvoiceDataParam param, HttpServletResponse response) {
logger.debug("enter downloadIDQueryData");
String fileName="testFile";
dataPreviewSerivceImpl.exportIDList(response, param, fileName);
}
}
......@@ -13,6 +13,7 @@ import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.ServletContextAware;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.constant.enums.EnumCitImportType;
import pwc.taxtech.atms.constant.enums.EnumImportType;
import pwc.taxtech.atms.dpo.TemplateUniqDto;
import pwc.taxtech.atms.dto.*;
......@@ -44,7 +46,7 @@ import java.util.List;
@RestController
@RequestMapping(value = "api/v1/template")
public class TemplateController extends BaseController implements ServletContextAware {
public class TemplateController extends BaseController{
private ServletContext servletContext;
......@@ -238,16 +240,19 @@ public class TemplateController extends BaseController implements ServletContext
}
@RequestMapping(value = "file/downloadTemplate", method = RequestMethod.GET)
public void fileDownload(@RequestParam Integer fileType,HttpServletResponse response){
public void fileDownload(@RequestParam Integer fileType, @RequestParam(required=false) Integer serviceType, HttpServletResponse response){
//获取网站部署路径(通过ServletContext对象),用于确定下载文件位置,从而实现下载
String path = servletContext.getRealPath("/")+"\\WEB-INF\\classes";
String fileName = getFileName(fileType);
String fileName = "";
if(serviceType == null){
fileName = getFileName(fileType);
}else{
fileName = getCitFileName(fileType);
}
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName="+fileName+".xlsx");
ServletOutputStream out;
File file = new File(path + "\\document\\DataImport\\" + fileName+".xlsx");
try {
FileInputStream inputStream = new FileInputStream(file);
InputStream inputStream = this.getClass().getResourceAsStream("/document/DataImport/" + fileName+".xlsx");
out = response.getOutputStream();
int b = 0;
byte[] buffer = new byte[512];
......@@ -288,9 +293,23 @@ public class TemplateController extends BaseController implements ServletContext
return null;
}
@Override
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
private String getCitFileName(Integer fileType) {
if(EnumCitImportType.JournalAdjust.getCode().equals(fileType)){
return EnumCitImportType.JournalAdjust.name();
}else if(EnumCitImportType.TrialBalance.getCode().equals(fileType)){
return EnumCitImportType.TrialBalance.name();
}else if(EnumCitImportType.DraftAccountMapping.getCode().equals(fileType)){
return EnumCitImportType.DraftAccountMapping.name();
}else if(EnumCitImportType.BalanceSheetPrcAdjust.getCode().equals(fileType)){
return EnumCitImportType.BalanceSheetPrcAdjust.name();
}else if(EnumCitImportType.ProfitPrcAdjust.getCode().equals(fileType)){
return EnumCitImportType.ProfitPrcAdjust.name();
}else if(EnumCitImportType.EAMAssetsDisposal.getCode().equals(fileType)){
return EnumCitImportType.EAMAssetsDisposal.name();
}else if(EnumCitImportType.SalaryAdvance.getCode().equals(fileType)){
return EnumCitImportType.SalaryAdvance.name();
}
return null;
}
}
......@@ -156,4 +156,17 @@ public class TemplateGroupController {
return OperationResultDto.error(ErrorMessage.SystemError);
}
@RequestMapping(value = "withoutTemplate", method = RequestMethod.POST)
public @ResponseBody OperationResultDto withoutTemplate(@RequestBody TemplateGroupDto templateGroupDto) {
try {
templateGroupService.addTemplateGroupWithoutTemplate(templateGroupDto);
return OperationResultDto.success();
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
} catch (Exception e) {
logger.error("withoutTemplate error.", e);
}
return OperationResultDto.error(ErrorMessage.SystemError);
}
}
package pwc.taxtech.atms.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import java.io.Serializable;
import java.util.Date;
/**
* AssetDetailGroupDto AssetDetailGroup页面Dto
*
* @author zhikai.z.wei
* @date 2019/1/25
*/
public class AssetDetailGroupDto implements Serializable{
@JsonSerialize(using = PwCIdSerialize.class)
private Long id;
@JsonSerialize(using = PwCIdSerialize.class)
private Long assetGroupId;
private String detailGroupName;
private Integer assetGroupType;
private Integer groupYear;
private Date createTime;
private Date updateTime;
private Integer detailGroupType;
private String keyValues;
/**
*
* 扩展属性,当前页码
*
*/
private Integer pageIndex;
/**
*
* 扩展属性,当前页所展示的数量
*
*/
private Integer pageSize;
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
@JsonSerialize(using = PwCIdSerialize.class)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getAssetGroupId() {
return assetGroupId;
}
public void setAssetGroupId(Long assetGroupId) {
this.assetGroupId = assetGroupId;
}
public String getDetailGroupName() {
return detailGroupName;
}
public void setDetailGroupName(String detailGroupName) {
this.detailGroupName = detailGroupName == null ? null : detailGroupName.trim();
}
public Integer getAssetGroupType() {
return assetGroupType;
}
public void setAssetGroupType(Integer assetGroupType) {
this.assetGroupType = assetGroupType;
}
public Integer getGroupYear() {
return groupYear;
}
public void setGroupYear(Integer groupYear) {
this.groupYear = groupYear;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getDetailGroupType() {
return detailGroupType;
}
public void setDetailGroupType(Integer detailGroupType) {
this.detailGroupType = detailGroupType;
}
public String getKeyValues() {
return keyValues;
}
public void setKeyValues(String keyValues) {
this.keyValues = keyValues == null ? null : keyValues.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", assetGroupId=").append(assetGroupId);
sb.append(", detailGroupName=").append(detailGroupName);
sb.append(", assetGroupType=").append(assetGroupType);
sb.append(", groupYear=").append(groupYear);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", detailGroupType=").append(detailGroupType);
sb.append(", keyValues=").append(keyValues);
sb.append("]");
return sb.toString();
}
}
package pwc.taxtech.atms.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import java.io.Serializable;
import java.util.Date;
/**
* AssetDetailGroupDto AssetDetailGroup页面Dto
*
* @author zhikai.z.wei
* @date 2019/1/25
*/
public class AssetDetailGroupStringDto implements Serializable{
private String id;
private String assetGroupId;
private String detailGroupName;
private Integer assetGroupType;
private Integer groupYear;
private Date createTime;
private Date updateTime;
private Integer detailGroupType;
private String keyValues;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAssetGroupId() {
return assetGroupId;
}
public void setAssetGroupId(String assetGroupId) {
this.assetGroupId = assetGroupId;
}
/**
*
* 扩展属性,当前页码
*
*/
private Integer pageIndex;
/**
*
* 扩展属性,当前页所展示的数量
*
*/
private Integer pageSize;
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public String getDetailGroupName() {
return detailGroupName;
}
public void setDetailGroupName(String detailGroupName) {
this.detailGroupName = detailGroupName == null ? null : detailGroupName.trim();
}
public Integer getAssetGroupType() {
return assetGroupType;
}
public void setAssetGroupType(Integer assetGroupType) {
this.assetGroupType = assetGroupType;
}
public Integer getGroupYear() {
return groupYear;
}
public void setGroupYear(Integer groupYear) {
this.groupYear = groupYear;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getDetailGroupType() {
return detailGroupType;
}
public void setDetailGroupType(Integer detailGroupType) {
this.detailGroupType = detailGroupType;
}
public String getKeyValues() {
return keyValues;
}
public void setKeyValues(String keyValues) {
this.keyValues = keyValues == null ? null : keyValues.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", assetGroupId=").append(assetGroupId);
sb.append(", detailGroupName=").append(detailGroupName);
sb.append(", assetGroupType=").append(assetGroupType);
sb.append(", groupYear=").append(groupYear);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", detailGroupType=").append(detailGroupType);
sb.append(", keyValues=").append(keyValues);
sb.append("]");
return sb.toString();
}
}
package pwc.taxtech.atms.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCIdSerialize;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
import java.util.Date;
/**
*
* This class was generated by MyBatis Generator.
* This class corresponds to the database table asset_group
*
* @mbg.generated do_not_delete_during_merge
*/
public class AssetGroupDto implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.id
*
* @mbg.generated
*/
@JsonSerialize(using = PwCIdSerialize.class)
private Long id;
/**
* Database Column Remarks:
* 资产分类一级分类名称
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.asset_group_name
*
* @mbg.generated
*/
private String assetGroupName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.update_time
*
* @mbg.generated
*/
private Date updateTime;
/**
* Database Column Remarks:
* 资产一级分类的类型代码
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column asset_group.asset_group_type
*
* @mbg.generated
*/
private Integer assetGroupType;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table asset_group
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.id
*
* @return the value of asset_group.id
*
* @mbg.generated
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.id
*
* @param id the value for asset_group.id
*
* @mbg.generated
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.asset_group_name
*
* @return the value of asset_group.asset_group_name
*
* @mbg.generated
*/
public String getAssetGroupName() {
return assetGroupName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.asset_group_name
*
* @param assetGroupName the value for asset_group.asset_group_name
*
* @mbg.generated
*/
public void setAssetGroupName(String assetGroupName) {
this.assetGroupName = assetGroupName == null ? null : assetGroupName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.create_time
*
* @return the value of asset_group.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.create_time
*
* @param createTime the value for asset_group.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.update_time
*
* @return the value of asset_group.update_time
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.update_time
*
* @param updateTime the value for asset_group.update_time
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column asset_group.asset_group_type
*
* @return the value of asset_group.asset_group_type
*
* @mbg.generated
*/
public Integer getAssetGroupType() {
return assetGroupType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column asset_group.asset_group_type
*
* @param assetGroupType the value for asset_group.asset_group_type
*
* @mbg.generated
*/
public void setAssetGroupType(Integer assetGroupType) {
this.assetGroupType = assetGroupType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table asset_group
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", assetGroupName=").append(assetGroupName);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", assetGroupType=").append(assetGroupType);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package pwc.taxtech.atms.dto.dataimport;
import pwc.taxtech.atms.dto.input.CamelPagingDto;
public class DataProcessParam {
private CamelPagingDto pageInfo;
//后续添加查询条件
public CamelPagingDto getPageInfo() {
return this.pageInfo;
}
public void setPageInfo(CamelPagingDto pageInfo) {
this.pageInfo = pageInfo;
}
}
......@@ -764,6 +764,17 @@ public class JournalEntryQueryDto {
*/
private Date updateTime;
/**
* Database Column Remarks:
* 税务系统期间 yyyyMM
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column journal_entry.tms_period
*
* @mbg.generated
*/
private Integer tmsPeriod;
public Long getId() {
return id;
}
......@@ -1315,4 +1326,12 @@ public class JournalEntryQueryDto {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getTmsPeriod() {
return tmsPeriod;
}
public void setTmsPeriod(Integer tmsPeriod) {
this.tmsPeriod = tmsPeriod;
}
}
......@@ -48,6 +48,17 @@ public class OrganizationAccountingRateDto implements Serializable {
*/
private Integer period;
/**
* Database Column Remarks:
* 来源
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column organization_accounting_rate.source
*
* @mbg.generated
*/
private String source;
/**
* Database Column Remarks:
* 汇率类型
......@@ -216,6 +227,30 @@ public class OrganizationAccountingRateDto implements Serializable {
this.period = period;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column organization_accounting_rate.source
*
* @return the value of organization_accounting_rate.source
*
* @mbg.generated
*/
public String getSource() {
return source;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column organization_accounting_rate.source
*
* @param source the value for organization_accounting_rate.source
*
* @mbg.generated
*/
public void setSource(String source) {
this.source = source == null ? null : source.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column organization_accounting_rate.convertion_type
......@@ -423,6 +458,7 @@ public class OrganizationAccountingRateDto implements Serializable {
sb.append(", id=").append(id);
sb.append(", organizationId=").append(organizationId);
sb.append(", period=").append(period);
sb.append(", source=").append(source);
sb.append(", convertionType=").append(convertionType);
sb.append(", currencyFrom=").append(currencyFrom);
sb.append(", currencyTo=").append(currencyTo);
......
......@@ -20,6 +20,28 @@ public class CashFlowDto implements Serializable {
@JsonSerialize(using = PwCIdSerialize.class)
private Long id;
/**
* Database Column Remarks:
* 机构id
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.organization_id
*
* @mbg.generated
*/
private String organizationId;
/**
* Database Column Remarks:
* 卡片id
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.project_id
*
* @mbg.generated
*/
private String projectId;
/**
* Database Column Remarks:
* 数据日期
......@@ -42,6 +64,17 @@ public class CashFlowDto implements Serializable {
*/
private String source;
/**
* Database Column Remarks:
* 税务系统期间 yyyyMM
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.tms_period
*
* @mbg.generated
*/
private Integer tmsPeriod;
/**
* Database Column Remarks:
* 期间 YYYY-MM
......@@ -91,7 +124,7 @@ public class CashFlowDto implements Serializable {
* 账套币种
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.edger_currency_code
* This field corresponds to the database column cash_flow.ledger_currency_code
*
* @mbg.generated
*/
......@@ -133,7 +166,7 @@ public class CashFlowDto implements Serializable {
/**
* Database Column Remarks:
* 频度(固定值M,
仅期间(月度含13期)报表数据)
仅期间(月度含13期)报表数据)
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.frequency
......@@ -236,6 +269,54 @@ public class CashFlowDto implements Serializable {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column cash_flow.organization_id
*
* @return the value of cash_flow.organization_id
*
* @mbg.generated
*/
public String getOrganizationId() {
return organizationId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column cash_flow.organization_id
*
* @param organizationId the value for cash_flow.organization_id
*
* @mbg.generated
*/
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId == null ? null : organizationId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column cash_flow.project_id
*
* @return the value of cash_flow.project_id
*
* @mbg.generated
*/
public String getProjectId() {
return projectId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column cash_flow.project_id
*
* @param projectId the value for cash_flow.project_id
*
* @mbg.generated
*/
public void setProjectId(String projectId) {
this.projectId = projectId == null ? null : projectId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column cash_flow.date
......@@ -284,6 +365,30 @@ public class CashFlowDto implements Serializable {
this.source = source == null ? null : source.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column cash_flow.tms_period
*
* @return the value of cash_flow.tms_period
*
* @mbg.generated
*/
public Integer getTmsPeriod() {
return tmsPeriod;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column cash_flow.tms_period
*
* @param tmsPeriod the value for cash_flow.tms_period
*
* @mbg.generated
*/
public void setTmsPeriod(Integer tmsPeriod) {
this.tmsPeriod = tmsPeriod;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column cash_flow.period
......@@ -382,9 +487,9 @@ public class CashFlowDto implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column cash_flow.edger_currency_code
* This method returns the value of the database column cash_flow.ledger_currency_code
*
* @return the value of cash_flow.edger_currency_code
* @return the value of cash_flow.ledger_currency_code
*
* @mbg.generated
*/
......@@ -394,9 +499,9 @@ public class CashFlowDto implements Serializable {
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column cash_flow.edger_currency_code
* This method sets the value of the database column cash_flow.ledger_currency_code
*
* @param ledgerCurrencyCode the value for cash_flow.edger_currency_code
* @param ledgerCurrencyCode the value for cash_flow.ledger_currency_code
*
* @mbg.generated
*/
......@@ -657,8 +762,11 @@ public class CashFlowDto implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", organizationId=").append(organizationId);
sb.append(", projectId=").append(projectId);
sb.append(", date=").append(date);
sb.append(", source=").append(source);
sb.append(", tmsPeriod=").append(tmsPeriod);
sb.append(", period=").append(period);
sb.append(", status=").append(status);
sb.append(", ledgerId=").append(ledgerId);
......
......@@ -160,6 +160,17 @@ public class JournalEntryDto implements Serializable {
*/
private String postedStatus;
/**
* Database Column Remarks:
* 税务系统期间 yyyyMM
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column journal_entry.tms_period
*
* @mbg.generated
*/
private Integer tmsPeriod;
/**
* Database Column Remarks:
* 会计期间 yyyymm
......@@ -1096,6 +1107,30 @@ public class JournalEntryDto implements Serializable {
this.postedStatus = postedStatus == null ? null : postedStatus.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column journal_entry.tms_period
*
* @return the value of journal_entry.tms_period
*
* @mbg.generated
*/
public Integer getTmsPeriod() {
return tmsPeriod;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column journal_entry.tms_period
*
* @param tmsPeriod the value for journal_entry.tms_period
*
* @mbg.generated
*/
public void setTmsPeriod(Integer tmsPeriod) {
this.tmsPeriod = tmsPeriod;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column journal_entry.period
......@@ -2465,6 +2500,7 @@ public class JournalEntryDto implements Serializable {
sb.append(", lineNum=").append(lineNum);
sb.append(", approvalStatus=").append(approvalStatus);
sb.append(", postedStatus=").append(postedStatus);
sb.append(", tmsPeriod=").append(tmsPeriod);
sb.append(", period=").append(period);
sb.append(", accountingDate=").append(accountingDate);
sb.append(", journalSource=").append(journalSource);
......
......@@ -212,6 +212,9 @@ public class JournalEntryExportDto {
@ExcelCell(index=64)
private Date lateUpdatedDate;
@ExcelCell(index=65)
private Integer tmsPeriod;
private Date createTime;
private Date updateTime;
......
......@@ -50,6 +50,28 @@ public class RedLetterInfoTableDto implements Serializable {
*/
private String projectId;
/**
* Database Column Remarks:
* 税务系统期间
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column red_letter_info_table.tms_period
*
* @mbg.generated
*/
private Integer tmsPeriod;
/**
* Database Column Remarks:
* 填开日期 yyyyMM 对应期间
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column red_letter_info_table.fill_in_date
*
* @mbg.generated
*/
private Integer fillInDate;
/**
* Database Column Remarks:
* 主体编号
......@@ -83,17 +105,6 @@ public class RedLetterInfoTableDto implements Serializable {
*/
private String redLetterInvoiceInfoTableNum;
/**
* Database Column Remarks:
* 填开日期 yyyyMM
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column red_letter_info_table.fill_in_date
*
* @mbg.generated
*/
private Integer fillInDate;
/**
* Database Column Remarks:
* 销方税号
......@@ -284,6 +295,54 @@ public class RedLetterInfoTableDto implements Serializable {
this.projectId = projectId == null ? null : projectId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column red_letter_info_table.tms_period
*
* @return the value of red_letter_info_table.tms_period
*
* @mbg.generated
*/
public Integer getTmsPeriod() {
return tmsPeriod;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column red_letter_info_table.tms_period
*
* @param tmsPeriod the value for red_letter_info_table.tms_period
*
* @mbg.generated
*/
public void setTmsPeriod(Integer tmsPeriod) {
this.tmsPeriod = tmsPeriod;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column red_letter_info_table.fill_in_date
*
* @return the value of red_letter_info_table.fill_in_date
*
* @mbg.generated
*/
public Integer getFillInDate() {
return fillInDate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column red_letter_info_table.fill_in_date
*
* @param fillInDate the value for red_letter_info_table.fill_in_date
*
* @mbg.generated
*/
public void setFillInDate(Integer fillInDate) {
this.fillInDate = fillInDate;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column red_letter_info_table.subject_num
......@@ -356,30 +415,6 @@ public class RedLetterInfoTableDto implements Serializable {
this.redLetterInvoiceInfoTableNum = redLetterInvoiceInfoTableNum == null ? null : redLetterInvoiceInfoTableNum.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column red_letter_info_table.fill_in_date
*
* @return the value of red_letter_info_table.fill_in_date
*
* @mbg.generated
*/
public Integer getFillInDate() {
return fillInDate;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column red_letter_info_table.fill_in_date
*
* @param fillInDate the value for red_letter_info_table.fill_in_date
*
* @mbg.generated
*/
public void setFillInDate(Integer fillInDate) {
this.fillInDate = fillInDate;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column red_letter_info_table.sales_tax_number
......@@ -635,10 +670,11 @@ public class RedLetterInfoTableDto implements Serializable {
sb.append(", id=").append(id);
sb.append(", organizationId=").append(organizationId);
sb.append(", projectId=").append(projectId);
sb.append(", tmsPeriod=").append(tmsPeriod);
sb.append(", fillInDate=").append(fillInDate);
sb.append(", subjectNum=").append(subjectNum);
sb.append(", subjectName=").append(subjectName);
sb.append(", redLetterInvoiceInfoTableNum=").append(redLetterInvoiceInfoTableNum);
sb.append(", fillInDate=").append(fillInDate);
sb.append(", salesTaxNumber=").append(salesTaxNumber);
sb.append(", salespersonName=").append(salespersonName);
sb.append(", totalAmount=").append(totalAmount);
......
package pwc.taxtech.atms.dto.vatdto.excelheader;
public class CertifiedInvoicesListHeader {
private String taxPayerNumber;
private Integer period;
private String unit;
public String getTaxPayerNumber() {
return taxPayerNumber;
}
public void setTaxPayerNumber(String taxPayerNumber) {
this.taxPayerNumber = taxPayerNumber;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
}
package pwc.taxtech.atms.dto.vatdto.excelheader;
public class InvoiceDataHeader {
private String taxPayerNumber;
private Integer period;
public String getTaxPayerNumber() {
return taxPayerNumber;
}
public void setTaxPayerNumber(String taxPayerNumber) {
this.taxPayerNumber = taxPayerNumber;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
}
package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.AssetDetailGroupMapper;
import pwc.taxtech.atms.dao.AssetGroupMapper;
import pwc.taxtech.atms.dto.AssetDetailGroupDto;
import pwc.taxtech.atms.dto.AssetDetailGroupStringDto;
import pwc.taxtech.atms.entity.AssetDetailGroup;
import pwc.taxtech.atms.entity.AssetDetailGroupExample;
import pwc.taxtech.atms.entity.AssetGroup;
import pwc.taxtech.atms.entity.AssetGroupExample;
import java.util.*;
/**
* @Author zhikai.z.wei
* 资产分类service
*/
@Service
public class AssetGroupServiceImpl extends BaseService {
private static Logger logger = LoggerFactory.getLogger(AssetGroupServiceImpl.class);
@Autowired
private AssetDetailGroupMapper assetDetailGroupMapper;
@Autowired
private AssetGroupMapper assetGroupMapper;
@Autowired
private FileService fileService;
/**
获取资产一级分类相关数据
*/
public List<AssetGroup> getAllAssetGroup() throws Exception {
logger.debug("获取资产一级分类相关数据");
AssetGroupExample assetGroupExample = new AssetGroupExample();
return assetGroupMapper.selectByExample(assetGroupExample);
}
/**
获取固定资产全部二级分类
*/
public PageInfo<AssetDetailGroupStringDto> getAllFixedAssetDetailGroup(AssetDetailGroupDto assetDetailGroupDto) throws Exception {
logger.debug("获取固定资产全部二级分类");
AssetDetailGroupExample assetDetailGroupExample = new AssetDetailGroupExample();
AssetDetailGroupExample.Criteria criteria = assetDetailGroupExample.createCriteria();
//detail_group_name 表中asset_group_type 1:固定资产
criteria.andAssetGroupTypeEqualTo(assetDetailGroupDto.getAssetGroupType());
assetDetailGroupExample.setOrderByClause("id asc");
PageHelper.startPage(assetDetailGroupDto.getPageIndex(), assetDetailGroupDto.getPageSize());
List<AssetDetailGroup> assetDetailGroups = assetDetailGroupMapper.selectByExample(assetDetailGroupExample);
//当时用分页包装数据后,不能对Long类型的字段进行序列化,仍会导致到前台精度缺失,
// 创建一个全为String的实体,并进行复制
List<AssetDetailGroupStringDto> assetDetailGroupDtos = new ArrayList<>();
for (AssetDetailGroup assetDetailGroup:assetDetailGroups){
AssetDetailGroupStringDto stringDto = new AssetDetailGroupStringDto();
//相同类型及字段进行copy
BeanUtils.copyProperties(assetDetailGroup,stringDto);
//把Long类型数据转为String并赋给新的实体
stringDto.setId(assetDetailGroup.getId().toString());
stringDto.setAssetGroupId(assetDetailGroup.getAssetGroupId().toString());
assetDetailGroupDtos.add(stringDto);
}
// assetDetailGroups.stream().forEach(assetDetailGroup -> {
// AssetDetailGroupStringDto stringDto = new AssetDetailGroupStringDto();
// //相同类型及字段进行copy
// BeanUtils.copyProperties(assetDetailGroup,stringDto);
// //把Long类型数据转为String并赋给新的实体
// stringDto.setId(assetDetailGroup.getId().toString());
// stringDto.setAssetGroupId(assetDetailGroup.getAssetGroupId().toString());
// assetDetailGroupDtos.add(stringDto);
// });
// BeanUtils.copyProperties(assetDetailGroups,assetDetailGroupDtos);
// PageInfo<AssetDetailGroup> pageInfo = new PageInfo<>(assetDetailGroups);
PageInfo<AssetDetailGroupStringDto> pageInfoStringDto = new PageInfo<AssetDetailGroupStringDto>(assetDetailGroupDtos);
// BeanUtils.copyProperties(pageInfo,pageInfoStringDto);
return pageInfoStringDto;
}
/**
获取长期待摊全部二级分类
*/
public List<AssetDetailGroup> getAllLongTermPendingDetailGroup() throws Exception {
logger.debug("获取长期待摊全部二级分类");
AssetDetailGroupExample assetDetailGroupExample = new AssetDetailGroupExample();
AssetDetailGroupExample.Criteria criteria = assetDetailGroupExample.createCriteria();
//detail_group_name 表中asset_group_type 2:长期待摊
criteria.andAssetGroupTypeEqualTo(2);
return assetDetailGroupMapper.selectByExample(assetDetailGroupExample);
}
/**
获取无形资产全部二级分类
*/
public List<AssetDetailGroup> getAllIntangibleAssetsDetailGroup() throws Exception {
logger.debug("获取无形资产全部二级分类");
AssetDetailGroupExample assetDetailGroupExample = new AssetDetailGroupExample();
AssetDetailGroupExample.Criteria criteria = assetDetailGroupExample.createCriteria();
//detail_group_name 表中asset_group_type 3:无形资产
criteria.andAssetGroupTypeEqualTo(3);
return assetDetailGroupMapper.selectByExample(assetDetailGroupExample);
}
/**
根据资产类型得到其总数
*/
public Long countAssetByType(Integer assetGroupType) throws Exception {
return assetDetailGroupMapper.countAssetByType(assetGroupType);
}
/**
通过一级分类的类型获取一级分类的ID
*/
public List<AssetGroup> getAssetGroupByType(Integer type) throws Exception {
logger.debug("通过一级分类的类型获取一级分类的ID");
AssetGroupExample assetGroupExample = new AssetGroupExample();
AssetGroupExample.Criteria criteria = assetGroupExample.createCriteria();
criteria.andAssetGroupTypeEqualTo(type);
List<AssetGroup> assetGroups = assetGroupMapper.selectByExample(assetGroupExample);
//判断查询出的List是否为null或者为空,
// 若为其中一种,则创建对象并add进入list中,一面controller取用报空指针异常
if(assetGroups == null || assetGroups.size()==0){
AssetGroup assetGroup = new AssetGroup();
assetGroups = new ArrayList<>();
assetGroups.add(assetGroup);
}
return assetGroups;
}
/**
新增固定资产二级分类
*/
public int addFixedAssetDetailGroup(AssetDetailGroupDto assetDetailGroupDto) throws Exception {
logger.debug("新增固定资产二级分类");
AssetDetailGroup assetDetailGroup = new AssetDetailGroup();
//把页面Dto的值赋给entity
BeanUtils.copyProperties(assetDetailGroupDto,assetDetailGroup);
assetDetailGroup.setId(idService.nextId());
assetDetailGroup.setCreateTime(new Date());
assetDetailGroup.setUpdateTime(new Date());
return assetDetailGroupMapper.insertSelective(assetDetailGroup);
}
/**
编辑固定资产二级分类
*/
public int editFixedAssetDetailGroup(AssetDetailGroupDto assetDetailGroupDto) throws Exception {
logger.debug("编辑固定资产二级分类");
AssetDetailGroup assetDetailGroup = new AssetDetailGroup();
//把页面Dto的值赋给entity
BeanUtils.copyProperties(assetDetailGroupDto,assetDetailGroup);
//81407534426099710 81407534426099710
assetDetailGroup.setUpdateTime(new Date());
return assetDetailGroupMapper.updateByPrimaryKeySelective(assetDetailGroup);
}
/**
新增固定资产二级分类
*/
public int deleteFixedAssetDetailGroup(Long id) throws Exception {
logger.debug("删除固定资产二级分类");
return assetDetailGroupMapper.deleteByPrimaryKey(id);
}
}
package pwc.taxtech.atms.service.impl;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* @author ZhiKai Z Wei
*/
public class CitCommonUtil {
/**
* 计算当前系统时间期间,返回yyyy格式
* @return
*/
public static Integer getPeriod(){
//计算当前系统时间的期间
Calendar now = Calendar.getInstance();
StringBuilder sb = new StringBuilder();
sb.append(now.get(Calendar.YEAR));
// if(now.get(Calendar.MONTH) + 1 < 10){
// sb.append(0);
// }
// sb.append(now.get(Calendar.MONTH) + 1);
return Integer.valueOf(sb.toString());
}
/**
* 导入Excel时根据单元格类型获取单元格的值
* @param cell
* @return
*/
public static Object getValue(Cell cell) {
Object obj = null;
//判断单元格是否为null,若为null则直接返回,以防在获取枚举类型时报空指针异常
if(cell == null){
return obj;
}
switch (cell.getCellTypeEnum()) {
case BOOLEAN:
obj = cell.getBooleanCellValue();
break;
case ERROR:
obj = cell.getErrorCellValue();
break;
case NUMERIC:
//日期格式在获取枚举类型时也为NUMERIC,此时要做日期和数据的区分,并对时间做统一的格式转换
if(HSSFDateUtil.isCellDateFormatted(cell)){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
obj = sdf.format(cell.getDateCellValue());
break;
}
obj = cell.getNumericCellValue();
break;
case STRING:
obj = cell.getStringCellValue();
break;
default:
break;
}
return obj;
}
}
......@@ -79,5 +79,33 @@ public class CommonDocumentHelper {
return os;
}
public OutputStream toXlsxFileUsingJxls(List<?> list, String excelTemplatePathInClassPath) {
//InputStream is = Streams.fileIn(excelTemplatePathInClassPath);
InputStream is = this.getClass().getResourceAsStream(excelTemplatePathInClassPath);
OutputStream os = new ByteArrayOutputStream();
Context context = new Context();
context.putVar("list", list);
context.putVar("REPORT_DATE", new Date());
JxlsHelper jxlsHelper = JxlsHelper.getInstance();
Transformer transformer = jxlsHelper.createTransformer(is, os);
JexlExpressionEvaluator evaluator = (JexlExpressionEvaluator) transformer.getTransformationConfig()
.getExpressionEvaluator();
// evaluator.getJexlEngine().setSilent(true); // 设置静默模式,不报警告
Map<String, Object> funcs = new HashMap<String, Object>();
funcs.put("myutils", new JxlsUtils());
evaluator.getJexlEngine().setFunctions(funcs);
// jxlsHelper.setUseFastFormulaProcessor(false); //与统计函数有关
try {
jxlsHelper.processTemplate(context, transformer);
} catch (IOException e) {
logger.error("error when calling processTemplate:" + e, e);
throw Lang.wrapThrow(e);
} finally {
Streams.safeClose(is);
Streams.safeClose(os);
}
return os;
}
}
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment