Commit 0f13b09c authored by neo.wang's avatar neo.wang

Merge branch 'dev_neo2' into 'dev'

Dev neo2

See merge request root/atms!21
parents 88969d81 d44953b1
package pwc.taxtech.atms.constant;
public class VatErpImportValidation {
public static final String CompanyBalanceTbName = "CompanyBalance";
public static final String CustBalanceTb = "CustBalance";
public static final String BalanceTb = "Balance";
public static final String AccountRemapTb = "AccountRemap";
public static final String VoucherTbName = "Voucher";
}
package pwc.taxtech.atms.constant.enums;
public enum EnumTbImportType {
Import(0),
CoverImport(1),
AddImport(2);
private Integer code;
EnumTbImportType(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
package pwc.taxtech.atms.constant.enums;
public enum EnumValidationType {
TrialBalance (0),
InputVoice (1),
OutputVoice (2),
ErpDuplicate (3), //重复数据
ErpBasicCheck (4),//基础数据校验
ErpCorrect (5),//数据正确性
JournalEntry (6),
InputVoiceItem (7),
CustomInvoice (8),
AccountMapping (9),
InvoiceMapping (10),
VoucherMapping (11);
private Integer code;
EnumValidationType(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
package pwc.taxtech.atms.constant.enums;
public enum ProjectImportDataType {
AuditAdjust(1), //审计调整
CustomInvoice(2), //海关清单
JournalEntry(3), //序时账
ErpData(4), //财务数据
InputInvoice(5), //进项发票
InvoiceMapping(6), //发票对应
OutputInvoice(7), //销项发票
TrialBalance(8), //试算平衡表
VoucherMapping(9); //凭证对应
private Integer code;
ProjectImportDataType(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
package pwc.taxtech.atms.constant.enums;
public enum ServiceType {
Administration(1), //后台admin
VAT(2),//增值税申报分析
AM(3),//电子税务管理
FDD(4),//财务尽职调查
Dashboard(5),//税务管理平台
CIT(6),// 企业所得税
TCS(7);//电子税务审计
private Integer code;
ServiceType(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
package pwc.taxtech.atms.controller;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto;
import pwc.taxtech.atms.dto.vat.QueryImportType;
import pwc.taxtech.atms.service.IdentityService;
import pwc.taxtech.atms.service.ProjectInfoService;
import java.util.List;
@RestController
@RequestMapping("/api/v1/ProjectInfo")
public class ProjectInfoController {
@Autowired
private ProjectInfoService projectInfoService;
@Autowired
private IdentityService identityService;
@ApiOperation(value = "isProjectImportedData", notes = "")
@RequestMapping(value = "isProjectImportedData/{projectId}/{serviceType}/{importTypeId}", method = RequestMethod.GET)
public @ResponseBody
OperationResultDto<Boolean> isProjectImportedData(@PathVariable String projectId, @PathVariable Integer serviceType,
@PathVariable Integer importTypeId) {
return projectInfoService.isProjectImportedData(projectId, serviceType, importTypeId);
}
@ApiOperation(value = "isProjectImportedData", notes = "")
@RequestMapping(value = "isProjectImportedData/{projectId}/{importTypeId}", method = RequestMethod.GET)
public @ResponseBody
OperationResultDto<Boolean> isProjectImportedData(@PathVariable String projectId, @PathVariable Integer importTypeId) {
return projectInfoService.isProjectImportedData(projectId, importTypeId);
}
@ApiOperation(value = "getProjectImportType", notes = "")
@RequestMapping(value = "getProjectImportType", method = RequestMethod.GET)
public OperationResultDto<List<PeriodInfoDto>> getProjectImportType(@RequestBody QueryImportType queryImportType) {
return projectInfoService.getProjectImportType(queryImportType.getProjectId(), queryImportType.getPeriods(),
queryImportType.getServiceTypeId()
, identityService.getIdentityUser().getID());
}
}
\ No newline at end of file
package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
......@@ -10,6 +11,14 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vat.ClearTableDto;
import pwc.taxtech.atms.dto.vat.ImportBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceFilter;
import pwc.taxtech.atms.service.DataImportService;
import pwc.taxtech.atms.service.ICitTBDataImportService;
import pwc.taxtech.atms.service.IdentityService;
import pwc.taxtech.atms.vat.service.TBDataImportService;
import java.math.BigDecimal;
......@@ -23,6 +32,13 @@ public class TBDataImportController {
@Autowired
TBDataImportService tbDataImportService;
@Autowired
private ICitTBDataImportService citTbDataImport;
@Autowired
private DataImportService dataImportService;
@Autowired
private IdentityService identityService;
@RequestMapping(value = "GetBalanceDataForDisplay", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public String getBalanceDataForDisplay(@RequestBody JSONObject param) {
......@@ -357,5 +373,19 @@ public class TBDataImportController {
return balanceList;
}
@ApiOperation(value = "clearTableByPeriods", notes = "")
@RequestMapping(value = "clearTableByPeriods", method = RequestMethod.POST)
public OperationResultDto<Boolean> clearTableByPeriods(@RequestBody ClearTableDto clearTb) {
return citTbDataImport.clearTableByPeriods(clearTb.getPeriods());
}
@ApiOperation(value = "ImportBalance", notes = "")
@RequestMapping(value = "ImportBalance", method = RequestMethod.POST)
public OperationResultDto importBalanceList(@RequestBody ImportBalanceDto importDto) {
return dataImportService.importTrialBalance(importDto.getBalanceList(), importDto.getImportType(),
importDto.getServiceTypeId(),
identityService.getIdentityUser().getID()
);
}
}
package pwc.taxtech.atms.dao;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.constant.VatErpImportValidation;
@Mapper
public interface CitTBDataImportMapper extends MyMapper {
@Delete("<script>" +
"<if test=\"tbName =='"+VatErpImportValidation.CompanyBalanceTbName+"' \">" +
" DELETE FROM #{tbName} WHERE PeriodId = #{period}" +
"</if>" +
"<if test=\"tbName =='"+VatErpImportValidation.CustBalanceTb+"' \">" +
" DELETE FROM #{tbName} WHERE PeriodId >= #{period}" +
"</if>" +
"</script>")
Integer deleteByPeriod(@Param("period") Integer period, @Param("tbName") String tbName);
@Delete("<script>DELETE FROM #{tbName} <if test=\"period != null\"> WHERE Period =#{period} </if></script>")
Integer deleteByNameAndPeriod(@Param("tbName") String tbName,@Param("period") Integer period);
}
package pwc.taxtech.atms.dao;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import pwc.taxtech.atms.MyMapper;
@Mapper
public interface DataImportMapper extends MyMapper {
@Delete("DELETE FROM #{tbName} WHERE Period =#{period}")
Integer deleteByNameAndPeriod(@Param("tbName") String tbName, @Param("period") Integer period);
@Update("TRUNCATE TABLE #{tbName}")
Integer truncateByName(@Param("tbName") String tbName);
@Delete("DELETE FROM ValidationInfo WHERE PeriodId = #{period}and ImportTypeId=#{typeId} ")
void deleteTbValidation(@Param("period") int period, @Param("typeId") Integer typeId);
}
......@@ -4,6 +4,14 @@ import java.util.Map;
public class OperationResultDto<T> extends OperationResultBase {
public static final OperationResultDto<Boolean> SUCCESS_EMPTY = new OperationResultDto<>();
static {
SUCCESS_EMPTY.setResult(true);
SUCCESS_EMPTY.setData(true);
SUCCESS_EMPTY.setResultMsg("");
}
private Map<String, String> errors;
private T data;
......@@ -65,4 +73,12 @@ public class OperationResultDto<T> extends OperationResultBase {
this.data = data;
}
public static OperationResultDto<Boolean> errorFor(String reason) {
OperationResultDto<Boolean> resultDto = new OperationResultDto<>();
resultDto.setResult(false);
resultDto.setData(false);
resultDto.setResultMsg(reason);
return resultDto;
}
}
package pwc.taxtech.atms.dto.taxadmin;
import java.util.Date;
public class DataImportedStatusDto {
private String id;
private String projectId;
private String dbName;
private String organizationId;
private Integer year;
private Integer period;
private Integer dataType;
private Integer totalCount;
private Integer exceptionCount;
private Integer successedCount;
private Date startTime;
private Date endTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getDbName() {
return dbName;
}
public void setDbName(String dbName) {
this.dbName = dbName;
}
public String getOrganizationId() {
return organizationId;
}
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
public Integer getDataType() {
return dataType;
}
public void setDataType(Integer dataType) {
this.dataType = dataType;
}
public Integer getTotalCount() {
return totalCount;
}
public void setTotalCount(Integer totalCount) {
this.totalCount = totalCount;
}
public Integer getExceptionCount() {
return exceptionCount;
}
public void setExceptionCount(Integer exceptionCount) {
this.exceptionCount = exceptionCount;
}
public Integer getSuccessedCount() {
return successedCount;
}
public void setSuccessedCount(Integer successedCount) {
this.successedCount = successedCount;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
}
package pwc.taxtech.atms.dto.taxadmin;
public class PeriodInfoDto {
private String iD;
private String projectID;
private Integer period;
private Integer status;
private String creatorID;
private String projectInfo;
private Integer importType;
private Integer serviceType;
public String getiD() {
return iD;
}
public void setiD(String iD) {
this.iD = iD;
}
public String getProjectID() {
return projectID;
}
public void setProjectID(String projectID) {
this.projectID = projectID;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getCreatorID() {
return creatorID;
}
public void setCreatorID(String creatorID) {
this.creatorID = creatorID;
}
public String getProjectInfo() {
return projectInfo;
}
public void setProjectInfo(String projectInfo) {
this.projectInfo = projectInfo;
}
public Integer getImportType() {
return importType;
}
public void setImportType(Integer importType) {
this.importType = importType;
}
public Integer getServiceType() {
return serviceType;
}
public void setServiceType(Integer serviceType) {
this.serviceType = serviceType;
}
}
package pwc.taxtech.atms.dto.vat;
import java.util.List;
public class ClearTableDto {
private List<Integer> periods;
public List<Integer> getPeriods() {
return periods;
}
public void setPeriods(List<Integer> periods) {
this.periods = periods;
}
}
package pwc.taxtech.atms.dto.vat;
public class CompanyBalanceDto {
private String balanceId;
private Integer periodId;
private String acctCode;
private String customerCode;
private Integer begDebitBal;
private Integer begCreditBal;
private Integer begBal;
private Integer endBal;
private Integer endDebitBal;
private Integer endCreditBal;
private Integer debitBal;
private Integer creditBal;
private Integer monthId;
public String getBalanceId() {
return balanceId;
}
public void setBalanceId(String balanceId) {
this.balanceId = balanceId;
}
public Integer getPeriodId() {
return periodId;
}
public void setPeriodId(Integer periodId) {
this.periodId = periodId;
}
public String getAcctCode() {
return acctCode;
}
public void setAcctCode(String acctCode) {
this.acctCode = acctCode;
}
public String getCustomerCode() {
return customerCode;
}
public void setCustomerCode(String customerCode) {
this.customerCode = customerCode;
}
public Integer getBegDebitBal() {
return begDebitBal;
}
public void setBegDebitBal(Integer begDebitBal) {
this.begDebitBal = begDebitBal;
}
public Integer getBegCreditBal() {
return begCreditBal;
}
public void setBegCreditBal(Integer begCreditBal) {
this.begCreditBal = begCreditBal;
}
public Integer getBegBal() {
return begBal;
}
public void setBegBal(Integer begBal) {
this.begBal = begBal;
}
public Integer getEndBal() {
return endBal;
}
public void setEndBal(Integer endBal) {
this.endBal = endBal;
}
public Integer getEndDebitBal() {
return endDebitBal;
}
public void setEndDebitBal(Integer endDebitBal) {
this.endDebitBal = endDebitBal;
}
public Integer getEndCreditBal() {
return endCreditBal;
}
public void setEndCreditBal(Integer endCreditBal) {
this.endCreditBal = endCreditBal;
}
public Integer getDebitBal() {
return debitBal;
}
public void setDebitBal(Integer debitBal) {
this.debitBal = debitBal;
}
public Integer getCreditBal() {
return creditBal;
}
public void setCreditBal(Integer creditBal) {
this.creditBal = creditBal;
}
public Integer getMonthId() {
return monthId;
}
public void setMonthId(Integer monthId) {
this.monthId = monthId;
}
}
package pwc.taxtech.atms.dto.vat;
import java.util.List;
public class ImportBalanceDto {
private List<CompanyBalanceDto> balanceList;
private Integer importType;
private Integer serviceTypeId;
private List<Integer> periods;
public List<CompanyBalanceDto> getBalanceList() {
return balanceList;
}
public void setBalanceList(List<CompanyBalanceDto> balanceList) {
this.balanceList = balanceList;
}
public Integer getImportType() {
return importType;
}
public void setImportType(Integer importType) {
this.importType = importType;
}
public Integer getServiceTypeId() {
return serviceTypeId;
}
public void setServiceTypeId(Integer serviceTypeId) {
this.serviceTypeId = serviceTypeId;
}
public List<Integer> getPeriods() {
return periods;
}
public void setPeriods(List<Integer> periods) {
this.periods = periods;
}
}
package pwc.taxtech.atms.dto.vat;
import java.util.List;
public class QueryImportType {
private Integer serviceTypeId;
private List<Integer> periods;
private String projectId;
private Integer importTypeId;
public Integer getServiceTypeId() {
return serviceTypeId;
}
public void setServiceTypeId(Integer serviceTypeId) {
this.serviceTypeId = serviceTypeId;
}
public List<Integer> getPeriods() {
return periods;
}
public void setPeriods(List<Integer> periods) {
this.periods = periods;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public Integer getImportTypeId() {
return importTypeId;
}
public void setImportTypeId(Integer importTypeId) {
this.importTypeId = importTypeId;
}
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vat.CompanyBalanceDto;
import java.util.List;
public interface DataImportService {
OperationResultDto importTrialBalance(List<CompanyBalanceDto> balanceList, Integer importType, Integer serviceTypeId, String id);
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.OperationResultDto;
import java.util.List;
public interface ICitTBDataImportService {
OperationResultDto<Boolean> clearTableByPeriods(List<Integer> periods);
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto;
import java.util.List;
public interface ProjectInfoService {
OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer serviceType, Integer importTypeId);
OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer importTypeId);
OperationResultDto<List<PeriodInfoDto>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id);
}
package pwc.taxtech.atms.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.constant.enums.EnumValidationType;
import pwc.taxtech.atms.constant.enums.ProjectImportDataType;
import pwc.taxtech.atms.constant.enums.ServiceType;
import pwc.taxtech.atms.dao.DataImportMapper;
import pwc.taxtech.atms.dao.EnterpriseAccountMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.DataImportedStatusDto;
import pwc.taxtech.atms.dto.vat.CompanyBalanceDto;
import pwc.taxtech.atms.entitiy.EnterpriseAccountExample;
import pwc.taxtech.atms.entitiy.Project;
import pwc.taxtech.atms.entitiy.ProjectExample;
import pwc.taxtech.atms.service.DataImportService;
import pwc.taxtech.atms.vat.dao.CompanyBalanceMapper;
import pwc.taxtech.atms.vat.entity.CompanyBalance;
import pwc.taxtech.atms.vat.entity.CompanyBalanceExample;
import java.util.Date;
import java.util.List;
@Service
public class DataImportServiceImpl implements DataImportService {
private static final String PROJECT_DB_NAME = "test_db";//TODO:fixed use init db
private static final String COMPANY_BALANCE_TABLE = "CompanyBalance";
private static final String BALANCE_TABLE = "Balance";
private static final int FIRST_OR_DEFAULT = 0;
@Autowired
private DataImportMapper mapper;
@Autowired
private CompanyBalanceMapper companyBalanceMapper;
@Autowired
private ProjectMapper projectMapper;
@Autowired
private EnterpriseAccountMapper enterpriseAccountMapper;
@Override
public OperationResultDto importTrialBalance(List<CompanyBalanceDto> balanceList, Integer importType,
Integer serviceTypeId, String userID) {
OperationResultDto result = new OperationResultDto();
if (serviceTypeId == ServiceType.VAT.getCode().intValue()) {
int period = balanceList.get(0).getPeriodId().intValue();
DataImportedStatusDto dataImportedStatus = new DataImportedStatusDto();
dataImportedStatus.setPeriod(period);
dataImportedStatus.setDbName(PROJECT_DB_NAME);
dataImportedStatus.setDataType(ProjectImportDataType.TrialBalance.getCode());
dataImportedStatus.setStartTime(new Date());
//覆盖导入之前删除数据
if (importType == EnumTbImportType.CoverImport.getCode()) {
clearTableData(period, COMPANY_BALANCE_TABLE);
}
// var sqlhelper = new SqlHelper(_projectDbConnstring);
// var companyBalance = ServiceHelper.ToDataTable(balanceList);
// sqlhelper.SqlBulkCopyInsert(_companyBalancetable, companyBalance, 10000);
// sqlhelper.Close();
//TODO: sql bulk copy insert tobe impl(neo)
//SynAccountFromTaxAdmin(period, userID);
Boolean isSuccess = refreshTrialBalance(period, serviceTypeId, userID);
result.setResult(isSuccess);
}else if(serviceTypeId == ServiceType.CIT.getCode()){//TODO import cit (neo)
}
return result;
}
private Boolean refreshTrialBalance(int period, Integer serviceTypeId, String userID) {
CompanyBalanceExample companyBalanceExample = new CompanyBalanceExample();
companyBalanceExample.createCriteria().andPeriodIdEqualTo(period);
List<CompanyBalance> list = companyBalanceMapper.selectByExample(companyBalanceExample);
if (list != null && !list.isEmpty()) {
//同步账套 TODO: sync admin db and project db(neo)
synAccountFromTaxAdmin(period, userID);
//先删除数据
clearTableData(period, BALANCE_TABLE);
mapper.deleteTbValidation(period, EnumValidationType.TrialBalance.getCode());
}
return true;
}
private void synAccountFromTaxAdmin(int period, String userID) {
ProjectExample example = new ProjectExample();
example.createCriteria().andDbNameEqualTo(PROJECT_DB_NAME);
List<Project> plist = projectMapper.selectByExample(example);
if (plist != null && !plist.isEmpty()) {
Project pFirst = plist.get(FIRST_OR_DEFAULT);
if (pFirst.getEnterpriseAccountSetID() != null && !pFirst.getEnterpriseAccountSetID().isEmpty()) {
String easId = pFirst.getEnterpriseAccountSetID();
EnterpriseAccountExample accountExample = new EnterpriseAccountExample();
accountExample.createCriteria().andEnterpriseAccountSetIDEqualTo(easId);
}
}
}
private void clearTableData(int period, String companyBalanceTable) {
if (period > 0) {
mapper.deleteByNameAndPeriod(companyBalanceTable, period);
} else {
mapper.truncateByName(companyBalanceTable);
}
}
}
package pwc.taxtech.atms.service.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.VatErpImportValidation;
import pwc.taxtech.atms.dao.CitTBDataImportMapper;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.ICitTBDataImportService;
import java.util.List;
@Service
public class ICitTBDataImportServiceImpl implements ICitTBDataImportService {
private static Logger LOGGER = LoggerFactory.getLogger(ICitTBDataImportServiceImpl.class);
@Autowired
CitTBDataImportMapper citTBDataImportMapper;
@Override
public OperationResultDto<Boolean> clearTableByPeriods(List<Integer> periods) {
return clearTableByPeriods(periods, true);
}
public OperationResultDto<Boolean> clearTableByPeriods(List<Integer> periods, Boolean isClearTb) {
try {
periods.forEach(period -> {
clearCustTable(period, VatErpImportValidation.CompanyBalanceTbName);
if (isClearTb) {
clearCustTable(period, VatErpImportValidation.CustBalanceTb);
}
clearCustTable(period, VatErpImportValidation.BalanceTb);
clearVoucherTable(period);
clearRemapTable(period);
});
return OperationResultDto.SUCCESS_EMPTY;
}catch (Exception e){
LOGGER.error("ClearTableByPeriods method error",e);
return OperationResultDto.errorFor(e.getMessage());
}
}
private void clearRemapTable(Integer period) {
citTBDataImportMapper.deleteByNameAndPeriod(VatErpImportValidation.AccountRemapTb, isImportByPeriod(period) ? period : null);
}
private void clearVoucherTable(Integer period) {
citTBDataImportMapper.deleteByNameAndPeriod(VatErpImportValidation.VoucherTbName, isImportByPeriod(period) ? period : null);
}
//清除试算平衡相关的Table
private void clearCustTable(Integer period, String tbName) {
if (isImportByPeriod(period) && !tbName.equals(VatErpImportValidation.BalanceTb))
if (tbName.equals(VatErpImportValidation.CompanyBalanceTbName) || tbName.equals(VatErpImportValidation.CustBalanceTb))
citTBDataImportMapper.deleteByPeriod(period, tbName);
else citTBDataImportMapper.deleteByNameAndPeriod(tbName, null);
}
private Boolean isImportByPeriod(int period) {
return period >= 0;
}
}
......@@ -9,6 +9,6 @@ import pwc.taxtech.atms.service.IdentityService;
public class IdentityServiceImpl implements IdentityService {
@Override
public UserDto getIdentityUser() {
return AppCachePool.getCachedUser("cach_test");//TODO:should fixed use session username
return AppCachePool.getCachedUser("cach_test");//TODO:should fixed use session username(neo)
}
}
package pwc.taxtech.atms.service.impl;
import org.apache.log4j.lf5.LogLevel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.PeriodInfoMapper;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto;
import pwc.taxtech.atms.entitiy.PeriodInfo;
import pwc.taxtech.atms.entitiy.PeriodInfoExample;
import pwc.taxtech.atms.service.ProjectInfoService;
import sun.rmi.runtime.Log;
import java.util.List;
@Service
public class ProjectInfoServiceImpl implements ProjectInfoService {
private static final Logger LOGGER = LoggerFactory.getLogger(ProjectServiceImpl.class);
@Autowired
private PeriodInfoMapper periodInfoMapper;
@Override
public OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer serviceType, Integer importTypeId) {
try {
PeriodInfoExample example = new PeriodInfoExample();
PeriodInfoExample.Criteria criteria = example.createCriteria().andProjectIDEqualTo(projectId).andImportTypeEqualTo(importTypeId);
if (serviceType != null) criteria.andServiceTypeEqualTo(serviceType);
List<PeriodInfo> piList = periodInfoMapper.selectByExample(example);
OperationResultDto<Boolean> ord = new OperationResultDto<>();
ord.setResult(piList != null & !piList.isEmpty());
ord.setData(ord.getResult());
return ord;
} catch (Exception e) {
LOGGER.warn("IsProjectImportedData method error", e);
OperationResultDto<Boolean> ord = new OperationResultDto<>();
ord.setResult(false);
ord.setData(false);
return ord;
}
}
@Override
public OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer importTypeId) {
return isProjectImportedData(projectId, null, importTypeId);
}
@Override
public OperationResultDto<List<PeriodInfoDto>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id) {
return null;
}
}
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