Commit f754e8b8 authored by zhkwei's avatar zhkwei

Merge remote-tracking branch 'origin/dev_mysql' into dev_mysql

parents 8de05bb1 57228a73
......@@ -4,6 +4,7 @@ public class ErrorMessageCN {
public static final String NoCompanyError = "未映射到主体";
public static final String ExistDataPeriodsError = "存在非选择期间数据";
public static final String InconsistentPeriod = "单表中期间不一致";
public static final String DONOTSELECTPERIOD = "未选择期间";
}
......@@ -109,6 +109,32 @@ public class DateUtils {
return dateString;
}
/**
* 将短时间格式字符串转换为区间格式 yyyyMM
*
* @param dateDate
* @return
*/
public static Integer dateToPeriod(java.util.Date dateDate) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMM");
Integer period = Integer.valueOf(formatter.format(dateDate));
return period;
}
/**
* 将yyyy-mm yyyy - mm等字符串转换为区间格式 yyyyMM
*
* @param dateStr
* @return
*/
public static Integer strToPeriod(String dateStr) {
dateStr = dateStr.replace(" ","");
Integer period = Integer.valueOf(dateStr.substring(0, 4) + dateStr.substring(5, 7));
return period;
}
/**
* 将短时间格式字符串转换为时间 yyyy-MM-dd
*
......
......@@ -3,7 +3,10 @@ package pwc.taxtech.atms.constant.enums;
public enum EnumImportType {
Undefined(0),
ProfitLoss(1),
BalanceSheet(2);
BalanceSheet(2),
RedLetterInfoTable(3),
AdjustmentTable(4)
;
private Integer code;
......
......@@ -55,15 +55,14 @@ public class DataImportController extends BaseController {
if (null == file) {
return OperationResultDto.error(ErrorMessage.NoFile);
}
dataImportService.importPLExcelFile(file, periodDate,importType);
return OperationResultDto.success();
return dataImportService.importPLExcelFile(file, periodDate,importType);
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
} catch (Exception e) {
logger.error("importTemplateGroupExcelFile error.", e);
}
logger.error("importPLExcelFile error.", e);
return OperationResultDto.error(ErrorMessage.SystemError);
}
}
@ResponseBody
@RequestMapping(value = "BSExcelFile", method = RequestMethod.POST)
......@@ -76,10 +75,42 @@ public class DataImportController extends BaseController {
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
} catch (Exception e) {
logger.error("importTemplateGroupExcelFile error.", e);
logger.error("importBSExcelFile error.", e);
return OperationResultDto.error(ErrorMessage.SystemError);
}
}
@ResponseBody
@RequestMapping(value = "RLITExcelFile", method = RequestMethod.POST)
public OperationResultDto importRLITExcelFile(@RequestParam MultipartFile file,@RequestParam String periodDate,@RequestParam Integer importType) {
try {
if (null == file) {
return OperationResultDto.error(ErrorMessage.NoFile);
}
return dataImportService.importRLITExcelFile(file, periodDate,importType);
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
} catch (Exception e) {
logger.error("importRLITExcelFile error.", e);
return OperationResultDto.error(ErrorMessage.SystemError);
}
}
@ResponseBody
@RequestMapping(value = "ATExcelFile", method = RequestMethod.POST)
public OperationResultDto importATExcelFile(@RequestParam MultipartFile file,@RequestParam String periodDate,@RequestParam Integer importType) {
try {
if (null == file) {
return OperationResultDto.error(ErrorMessage.NoFile);
}
return dataImportService.importATExcelFile(file, periodDate,importType);
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
} catch (Exception e) {
logger.error("importATExcelFile error.", e);
return OperationResultDto.error(ErrorMessage.SystemError);
}
}
@ResponseBody
@RequestMapping(value = "displayImportLog", method = RequestMethod.GET)
......
......@@ -38,6 +38,17 @@ public class DataImportLogDto implements Serializable {
*/
private String organizationId;
/**
* Database Column Remarks:
* 纳税人识别号
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column data_import_log.taxpayer_id_num
*
* @mbg.generated
*/
private String taxpayerIdNum;
/**
* Database Column Remarks:
* 导入类型。0-未定义,1-利润表,2-资产负债表
......@@ -170,6 +181,18 @@ public class DataImportLogDto implements Serializable {
*/
private String errorMsg;
/**
* Database Column Remarks:
* 记录条数
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column data_import_log.record_size
*
* @mbg.generated
*/
private Integer recordSize;
/**
* Database Column Remarks:
* 创建时间
......@@ -584,6 +607,22 @@ public class DataImportLogDto implements Serializable {
this.updateTime = updateTime;
}
public String getTaxpayerIdNum() {
return taxpayerIdNum;
}
public void setTaxpayerIdNum(String taxpayerIdNum) {
this.taxpayerIdNum = taxpayerIdNum;
}
public Integer getRecordSize() {
return recordSize;
}
public void setRecordSize(Integer recordSize) {
this.recordSize = recordSize;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table data_import_log
......
......@@ -4,7 +4,6 @@ import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -13,6 +12,7 @@ import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.config.SystemConfig;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.message.ErrorMessageCN;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.EnumImportType;
import pwc.taxtech.atms.constant.enums.EnumTbImportType;
......@@ -32,6 +32,7 @@ import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@Service
......@@ -65,6 +66,10 @@ public class DataImportService extends BaseService {
private BalanceSheetFinalMapper balanceSheetFinalMapper;
@Resource
private ProfitLossStatementFinalMapper profitLossStatementFinalMapper;
@Resource
private RedLetterInfoTableMapper redLetterInfoTableMapper;
@Resource
private AdjustmentTableMapper adjustmentTableMapper;
/**
* TB表查询
......@@ -197,52 +202,54 @@ public class DataImportService extends BaseService {
* 1、存在非选择期间数据
* 2、未映射到主体
*/
public void importPLExcelFile(MultipartFile file, String periodDate, Integer importType) throws ServiceException {
public OperationResultDto importPLExcelFile(MultipartFile file, String periodDate, Integer importType) throws ServiceException {
try {
InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream);
if(StringUtils.isBlank(periodDate)||"null".equals(periodDate)){
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessage.DIDNOTSELECTPERIOD);
}
int res = 0;
List<DataImportLog> dataImportLogs = Lists.newArrayList();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
if (null == sheet.getRow(0).getCell(4)) {
break;
}
if (isSheetEmpty(sheet)) continue;
List<ProfitLossStatement> pls = Lists.newArrayList();
String companyCode = sheet.getRow(5).getCell(1).getStringCellValue();
OrganizationExample example = new OrganizationExample();
example.createCriteria().andCodeEqualTo(companyCode);
List<Organization> organizations = organizationMapper.selectByExample(example);
String orgId = "";
String taxPayerId = "";
if (organizations.size() > 0) {
orgId = organizations.get(0).getId();
taxPayerId = StringUtils.isNotEmpty(organizations.get(0).getLegalCode()) ?
organizations.get(0).getLegalCode() : organizations.get(0).getTaxPayerNumber();
}
String periodStr = sheet.getRow(2).getCell(2).getStringCellValue().substring(3);
String companyName = sheet.getRow(4).getCell(1).getStringCellValue();
String fileType = sheet.getRow(0).getCell(2).getStringCellValue();
Integer period = Integer.valueOf(periodStr.substring(0, 4) + periodStr.substring(5, 7));
periodDate=periodDate.replace(" ","");
Integer tmsPeriod = Integer.valueOf(periodDate.substring(0, 4) + periodDate.substring(5, 7));
DataImportLog dataImportLog = generalDataImportLog(companyCode, orgId,
EnumImportType.ProfitLoss.getCode(),Integer.valueOf(periodStr.substring(0, 4)),
Integer.valueOf(periodDate.substring(5, 7)),Integer.valueOf(periodStr.substring(5, 7)),
Integer period = DateUtils.strToPeriod(periodStr);
Integer tmsPeriod = DateUtils.strToPeriod(periodDate);
DataImportLog dataImportLog = generalDataImportLog(companyCode, orgId, taxPayerId,
EnumImportType.ProfitLoss.getCode(), Integer.valueOf(periodStr.substring(0, 4)),
Integer.valueOf(periodDate.substring(5, 7)), Integer.valueOf(periodStr.substring(5, 7)),
companyName, fileType);
if (organizations.size() < 1) {
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.NoCompanyError);
dataImportLogMapper.insertSelective(dataImportLog);
break;
} else {
orgId = organizations.get(0).getId();
dataImportLogs.add(dataImportLog);
continue;
}
// 所选期间与导入文件期间不相等 且非 所选期间12期导入文件为13期
boolean isThirteenPeriod = period / 1000 != 13 && tmsPeriod != 12;
if (!tmsPeriod.equals(period) && isThirteenPeriod) {
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.ExistDataPeriodsError);
dataImportLogMapper.insertSelective(dataImportLog);
break;
dataImportLogs.add(dataImportLog);
continue;
}
String currencyCode = sheet.getRow(5).getCell(0).getStringCellValue().replace(" ", "").substring(3);
......@@ -295,19 +302,21 @@ public class DataImportService extends BaseService {
ProfitLossStatementExample profitLossStatementExample = new ProfitLossStatementExample();
profitLossStatementExample.createCriteria().andOrganizationIdEqualTo(orgId).andPeriodEqualTo(period);
profitLossStatementMapper.deleteByExample(profitLossStatementExample);
if(profitLossStatementFinalMapper.countByExample(profitLossStatementExample)>0){
if (profitLossStatementFinalMapper.countByExample(profitLossStatementExample) > 0) {
profitLossStatementFinalMapper.deleteByExample(profitLossStatementExample);
}
}
profitLossStatementManualMapper.insertBatch(pls);
profitLossStatementFinalMapper.insertBatch(pls);
dataImportLog.setRecordSize(pls.size());
dataImportLog.setImportResult(true);
res += dataImportLogMapper.insertSelective(dataImportLog);
dataImportLogs.add(dataImportLog);
}
}
if(res<1){
throw new ServiceException(ErrorMessage.ImportFailed);
if (addDataImportLog(dataImportLogs) < 1) {
return OperationResultDto.error(ErrorMessage.ImportFailed);
}
return OperationResultDto.success();
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
......@@ -316,10 +325,11 @@ public class DataImportService extends BaseService {
}
}
private DataImportLog generalDataImportLog(String companyCode,String orgId,Integer type,Integer periodYear,
Integer tmsPeriodMonth,Integer periodMonth,String companyName, String fileType) {
private DataImportLog generalDataImportLog(String companyCode, String orgId, String taxPayerId, Integer type, Integer periodYear,
Integer tmsPeriodMonth, Integer periodMonth, String companyName, String fileType) {
DataImportLog dataImportLog = new DataImportLog();
dataImportLog.setId(idService.nextId());
dataImportLog.setTaxpayerIdNum(taxPayerId);
dataImportLog.setType(type);
dataImportLog.setOrganizationId(orgId);
dataImportLog.setCompanyCode(companyCode);
......@@ -330,6 +340,7 @@ public class DataImportService extends BaseService {
dataImportLog.setPeriodMonth(periodMonth);
dataImportLog.setPeriodStatus("人工导入");
dataImportLog.setOperator(authUserHelper.getCurrentAuditor().get());
dataImportLog.setImportResult(true);
return dataImportLog;
}
......@@ -349,15 +360,13 @@ public class DataImportService extends BaseService {
try {
InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream);
int res = 0;
if(StringUtils.isBlank(periodDate)||"null".equals(periodDate)){
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DONOTSELECTPERIOD);
}
List<DataImportLog> dataImportLogs = Lists.newArrayList();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
if (null == sheet.getRow(0).getCell(4)) {
break;
}
if (isSheetEmpty(sheet)) continue;
List<BalanceSheet> bls = Lists.newArrayList();
String companyName = sheet.getRow(5).getCell(1).getStringCellValue();
OrganizationExample example = new OrganizationExample();
......@@ -366,33 +375,36 @@ public class DataImportService extends BaseService {
String orgId = "";
String companyCode = "";
String taxPayerId = "";
if (organizations.size() > 0) {
orgId = organizations.get(0).getId();
companyCode = organizations.get(0).getCode();
taxPayerId = StringUtils.isNotEmpty(organizations.get(0).getLegalCode()) ?
organizations.get(0).getLegalCode() : organizations.get(0).getTaxPayerNumber();
}
String periodStr = sheet.getRow(2).getCell(2).getStringCellValue().substring(3);
String fileType = sheet.getRow(0).getCell(2).getStringCellValue();
Integer period = Integer.valueOf(periodStr.substring(0, 4) + periodStr.substring(5, 7));
periodDate=periodDate.replace(" ","");
Integer tmsPeriod = Integer.valueOf(periodDate.substring(0, 4) + periodDate.substring(5, 7));
DataImportLog dataImportLog = generalDataImportLog(companyCode,orgId,
EnumImportType.BalanceSheet.getCode(),Integer.valueOf(periodStr.substring(0, 4)),
Integer.valueOf(periodDate.substring(5, 7)),Integer.valueOf(periodStr.substring(5, 7)),
Integer period = DateUtils.strToPeriod(periodStr);
Integer tmsPeriod = DateUtils.strToPeriod(periodDate);
DataImportLog dataImportLog = generalDataImportLog(companyCode, orgId, taxPayerId,
EnumImportType.BalanceSheet.getCode(), Integer.valueOf(periodStr.substring(0, 4)),
Integer.valueOf(periodDate.substring(5, 7)), Integer.valueOf(periodStr.substring(5, 7)),
companyName, fileType);
if (organizations.size() < 1) {
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.NoCompanyError);
dataImportLogMapper.insertSelective(dataImportLog);
break;
dataImportLogs.add(dataImportLog);
continue;
}
// 所选期间与导入文件期间不相等 且非 所选期间12期导入文件为13期
boolean isThirteenPeriod = period / 1000 != 13 && tmsPeriod != 12;
if (!tmsPeriod.equals(period) && isThirteenPeriod) {
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.ExistDataPeriodsError);
dataImportLogMapper.insertSelective(dataImportLog);
break;
dataImportLogs.add(dataImportLog);
continue;
}
String currencyCode = sheet.getRow(5).getCell(0).getStringCellValue().replace(" ", "").substring(3);
String dataDateStr = sheet.getRow(0).getCell(4).getStringCellValue().substring(3).replace(" ", "");
......@@ -443,17 +455,18 @@ public class DataImportService extends BaseService {
BalanceSheetExample balanceSheetExample = new BalanceSheetExample();
balanceSheetExample.createCriteria().andOrganizationIdEqualTo(orgId).andPeriodEqualTo(period);
balanceSheetMapper.deleteByExample(balanceSheetExample);
if(balanceSheetManualMapper.countByExample(balanceSheetExample)>0){
if (balanceSheetManualMapper.countByExample(balanceSheetExample) > 0) {
balanceSheetManualMapper.deleteByExample(balanceSheetExample);
}
}
balanceSheetMapper.insertBatch(bls);
balanceSheetManualMapper.insertBatch(bls);
dataImportLog.setRecordSize(bls.size());
dataImportLog.setImportResult(true);
res+=dataImportLogMapper.insertSelective(dataImportLog);
dataImportLogs.add(dataImportLog);
}
}
if(res<1){
if (addDataImportLog(dataImportLogs) < 1) {
return OperationResultDto.error(ErrorMessage.SystemError);
}
return OperationResultDto.success();
......@@ -465,14 +478,272 @@ public class DataImportService extends BaseService {
}
}
public OperationResultDto importRLITExcelFile(MultipartFile file, String periodDate, Integer importType) throws ServiceException{
try {
InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream);
int isSuccess = 0;
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DONOTSELECTPERIOD);
}
Integer tmsPeriod = DateUtils.strToPeriod(periodDate);
List<DataImportLog> dataImportLogs = Lists.newArrayList();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
if (isSheetEmpty(sheet)) continue;
List<RedLetterInfoTable> rlits = generalRLITs(sheet);
if (rlits.size() < 1) continue;
// 根据主体分组处理
Map<String, List<RedLetterInfoTable>> atsGroupRes =
rlits.stream().collect(Collectors.groupingBy(RedLetterInfoTable::getSubjectNum));
atsGroupRes.forEach((k, v) -> processRlits(k, v, isSuccess,tmsPeriod, importType,dataImportLogs));
}
addDataImportLog(dataImportLogs);
if (isSuccess < 1) {
return OperationResultDto.error(ErrorMessage.ImportFailed);
}
return OperationResultDto.success();
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
logger.error("importRLITExcelFile error.", e);
throw new ServiceException(ErrorMessage.SystemError);
}
}
private void processRlits(String companyCode, List<RedLetterInfoTable> rlits,int isSuccess,
Integer tmsPeriod, Integer importType,List<DataImportLog> dataImportLogs ) {
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andCodeEqualTo(companyCode);
Integer period = rlits.get(0).getFillInDate();
List<Organization> orgs = organizationMapper.selectByExample(organizationExample);
DataImportLog dataImportLog = generalDataImportLog(rlits.get(0).getSubjectNum(),"", "",
EnumImportType.RedLetterInfoTable.getCode(), period/100,
tmsPeriod%100, period%100,
rlits.get(0).getSubjectName(), "");
dataImportLog.setRecordSize(rlits.size());
if(orgs.size()<1){
dataImportLog.setErrorMsg(ErrorMessageCN.NoCompanyError);
dataImportLog.setImportResult(false);
dataImportLogs.add(dataImportLog);
return;
}
dataImportLog.setOrganizationId(orgs.get(0).getId());
dataImportLog.setTaxpayerIdNum(StringUtils.isNotEmpty(orgs.get(0).getLegalCode()) ?
orgs.get(0).getLegalCode() : orgs.get(0).getTaxPayerNumber());
for (RedLetterInfoTable rlit : rlits) {
// 校验该主体导入所有记录区间是否一致
if (!rlit.getFillInDate().equals(period)) {
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.InconsistentPeriod);
break;
}
if (!rlit.getFillInDate().equals(tmsPeriod)) {
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.ExistDataPeriodsError);
break;
}
if (EnumTbImportType.CoverImport.getCode().equals(importType)) {
RedLetterInfoTableExample redLetterInfoTableExample = new RedLetterInfoTableExample();
redLetterInfoTableExample.createCriteria().andSubjectNumEqualTo(rlit.getSubjectNum()).andFillInDateEqualTo(rlit.getFillInDate());
redLetterInfoTableMapper.deleteByExample(redLetterInfoTableExample);
}
}
// 1、记录数据导入记录与数据处理校验记录
isSuccess += redLetterInfoTableMapper.insertBatch(rlits);
dataImportLogs.add(dataImportLog);
}
public OperationResultDto importATExcelFile(MultipartFile file, String periodDate, Integer importType) throws ServiceException {
try {
InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream);
int isSuccess = 0;
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
throw new ServiceException(ErrorMessageCN.DONOTSELECTPERIOD);
}
Integer tmsPeriod = DateUtils.strToPeriod(periodDate);
List<DataImportLog> dataImportLogs = Lists.newArrayList();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i);
if (isSheetEmpty(sheet)) continue;
List<AdjustmentTable> ats = generalATs(sheet);
if (ats.size() < 1) continue;
// 根据主体分组处理
Map<String, List<AdjustmentTable>> atsGroupRes =
ats.stream().collect(Collectors.groupingBy(AdjustmentTable::getSegment1));
atsGroupRes.forEach((k, v) -> processAts(k, v, isSuccess,tmsPeriod, importType,dataImportLogs));
}
addDataImportLog(dataImportLogs);
if (isSuccess < 1) {
return OperationResultDto.error(ErrorMessage.ImportFailed);
}
return OperationResultDto.success();
} catch (ServiceException e) {
throw e;
} catch (Exception e) {
logger.error("importATExcelFile error.", e);
throw new ServiceException(ErrorMessage.SystemError);
}
}
private void processAts(String companyCode, List<AdjustmentTable> ats,int isSuccess,
Integer tmsPeriod, Integer importType,List<DataImportLog> dataImportLogs) {
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andCodeEqualTo(companyCode);
List<Organization> orgs = organizationMapper.selectByExample(organizationExample);
DataImportLog dataImportLog = generalDataImportLog(ats.get(0).getSegment1(),"", "",
EnumImportType.AdjustmentTable.getCode(), ats.get(0).getPeriod()/100,
tmsPeriod%100, ats.get(0).getPeriod()%100,
ats.get(0).getSegment1Name(), "");
dataImportLog.setRecordSize(ats.size());
if(orgs.size()<1){
dataImportLog.setErrorMsg(ErrorMessageCN.NoCompanyError);
dataImportLog.setImportResult(false);
dataImportLogs.add(dataImportLog);
return;
}
dataImportLog.setOrganizationId(orgs.get(0).getId());
dataImportLog.setTaxpayerIdNum(StringUtils.isNotEmpty(orgs.get(0).getLegalCode()) ?
orgs.get(0).getLegalCode() : orgs.get(0).getTaxPayerNumber());
Integer period1 = ats.get(0).getPeriod();
for (AdjustmentTable at : ats) {
// 校验该主体导入所有记录区间是否一致
if (!at.getPeriod().equals(period1)) {
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.InconsistentPeriod);
break;
}
if (!at.getPeriod().equals(tmsPeriod)) {
dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.ExistDataPeriodsError);
break;
}
if (EnumTbImportType.CoverImport.getCode().equals(importType)) {
AdjustmentTableExample adjustmentTableExample = new AdjustmentTableExample();
adjustmentTableExample.createCriteria().andSegment1EqualTo(at.getSegment1()).andPeriodEqualTo(at.getPeriod());
adjustmentTableMapper.deleteByExample(adjustmentTableExample);
}
}
// 1、记录数据导入记录与数据处理校验记录
isSuccess += adjustmentTableMapper.insertBatch(ats);
dataImportLogs.add(dataImportLog);
}
private List<RedLetterInfoTable> generalRLITs(Sheet sheet) {
List<RedLetterInfoTable> rlits = Lists.newArrayList();
for (int j = 1; j <= sheet.getLastRowNum(); j++) {
RedLetterInfoTable rlit = new RedLetterInfoTable();
Long plId = idService.nextId();
Row row = sheet.getRow(j);
if (null == row.getCell(0)) {
continue;
}
rlit.setId(plId);
rlit.setSubjectNum(getCellStringValue(row.getCell(0)));
rlit.setSubjectName(getCellStringValue(row.getCell(1)));
rlit.setRedLetterInvoiceInfoTableNum(getCellStringValue(row.getCell(2)));
rlit.setFillInDate(DateUtils.dateToPeriod(row.getCell(3).getDateCellValue()));
rlit.setSalesTaxNumber(getCellStringValue(row.getCell(4)));
rlit.setSalespersonName(getCellStringValue(row.getCell(5)));
rlit.setTotalAmount(getCellBigDecimalValue(row.getCell(6)));
rlit.setTotalTaxAmount(getCellBigDecimalValue(row.getCell(7)));
rlit.setApplicationDescription(getCellStringValue(row.getCell(8)));
rlit.setApplicantManager(getCellStringValue(row.getCell(9)));
rlit.setInvoiceCode(getCellStringValue(row.getCell(10)));
rlit.setInvoiceNumber(getCellStringValue(row.getCell(11)));
rlits.add(rlit);
}
return rlits;
}
private List<AdjustmentTable> generalATs(Sheet sheet) {
List<AdjustmentTable> ats = Lists.newArrayList();
for (int j = 1; j <= sheet.getLastRowNum(); j++) {
AdjustmentTable at = new AdjustmentTable();
Long plId = idService.nextId();
Row row = sheet.getRow(j);
if (null == row.getCell(0)) {
continue;
}
at.setId(plId);
String periodStr = getCellStringValue(row.getCell(0));
Integer period = Integer.valueOf(periodStr.substring(0,4)+periodStr.substring(5,7));
at.setPeriod(period);
at.setSegment1(getCellStringValue(row.getCell(1)));
at.setSegment2(getCellStringValue(row.getCell(2)));
at.setSegment3(getCellStringValue(row.getCell(3)));
at.setSegment4(getCellStringValue(row.getCell(4)));
at.setSegment5(getCellStringValue(row.getCell(5)));
at.setSegment6(getCellStringValue(row.getCell(6)));
at.setSegment7(getCellStringValue(row.getCell(7)));
at.setSegment8(getCellStringValue(row.getCell(8)));
at.setSegment9(getCellStringValue(row.getCell(9)));
at.setSegment10(getCellStringValue(row.getCell(10)));
at.setSegment1Name(getCellStringValue(row.getCell(11)));
at.setSegment2Name(getCellStringValue(row.getCell(12)));
at.setSegment3Name(getCellStringValue(row.getCell(13)));
at.setSegment4Name(getCellStringValue(row.getCell(14)));
at.setSegment5Name(getCellStringValue(row.getCell(15)));
at.setSegment6Name(getCellStringValue(row.getCell(16)));
at.setSegment7Name(getCellStringValue(row.getCell(17)));
at.setSegment8Name(getCellStringValue(row.getCell(18)));
at.setSegment9Name(getCellStringValue(row.getCell(19)));
at.setSegment10Name(getCellStringValue(row.getCell(20)));
at.setPeriodDrBeq(getCellBigDecimalValue(row.getCell(21)));
at.setPeriodCrBeq(getCellBigDecimalValue(row.getCell(22)));
at.setEndBalBeq(getCellBigDecimalValue(row.getCell(23)));
ats.add(at);
}
return ats;
}
private String getCellStringValue(Cell cell) {
if (cell.getCellTypeEnum().equals(CellType.STRING)) {
return cell.getStringCellValue();
} else if(cell.getCellTypeEnum().equals(CellType.NUMERIC)) {
return String.valueOf(cell.getNumericCellValue());
}
logger.warn("获取单元格数据类型未匹配");
return null;
}
private BigDecimal getCellBigDecimalValue(Cell cell) {
if (cell.getCellTypeEnum().equals(CellType.STRING)) {
return new BigDecimal(cell.getStringCellValue());
} else if(cell.getCellTypeEnum().equals(CellType.NUMERIC)) {
return new BigDecimal(cell.getNumericCellValue());
}
logger.warn("获取单元格数据类型未匹配");
return null;
}
private int addDataImportLog(List<DataImportLog> dataImportLogs) {
dataImportLogMapper.displayOld(dataImportLogs.get(0).getType());
int res = 0;
for (DataImportLog dataImportLog : dataImportLogs) {
res += dataImportLogMapper.insertSelective(dataImportLog);
}
return res;
}
public List<DataImportLogDto> displayImportLog(Integer type) {
List<DataImportLogDto> dataImportLogDtos = Lists.newArrayList();
DataImportLogExample dataImportLogExample = new DataImportLogExample();
if(EnumImportType.Undefined.getCode().equals(type)){
dataImportLogExample.setOrderByClause("update_time desc");
}else{
dataImportLogExample.createCriteria().andTypeEqualTo(type);
dataImportLogExample.setOrderByClause("update_time desc limit 1");
dataImportLogExample.createCriteria().andTypeEqualTo(type).andDisplayEqualTo(true);
dataImportLogExample.setOrderByClause("update_time desc");
}
dataImportLogMapper.selectByExample(dataImportLogExample).forEach( dil ->{
DataImportLogDto dataImportLogDto = new DataImportLogDto();
......@@ -481,4 +752,12 @@ public class DataImportService extends BaseService {
});
return dataImportLogDtos;
}
private boolean isSheetEmpty(Sheet sheet) {
if (null == sheet.getRow(0).getCell(0)) {
return true;
}
return false;
}
}
......@@ -41,7 +41,17 @@
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<!--<table tableName="profit_loss_statement_manual" domainObjectName="ProfitLossStatementManual">
<table tableName="red_letter_info_table" domainObjectName="RedLetterInfoTable">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--<table tableName="adjustment_table" domainObjectName="AdjustmentTable">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="profit_loss_statement_manual" domainObjectName="ProfitLossStatementManual">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
......@@ -54,14 +64,14 @@
<table tableName="profit_loss_statement_final" domainObjectName="ProfitLossStatementFinal">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>-->
</table>
<table tableName="balance_sheet_final" domainObjectName="BalanceSheetFinal">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--<table tableName="profit_loss_statement" domainObjectName="ProfitLossStatement">
<table tableName="profit_loss_statement" domainObjectName="ProfitLossStatement">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
......
......@@ -105,4 +105,6 @@ public interface DataImportLogMapper extends MyMapper {
* @mbg.generated
*/
int updateByPrimaryKey(DataImportLog record);
int displayOld(@Param("type") Integer type);
}
\ No newline at end of file
......@@ -33,6 +33,17 @@ public class DataImportLog extends BaseEntity implements Serializable {
*/
private String organizationId;
/**
* Database Column Remarks:
* 纳税人识别号
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column data_import_log.taxpayer_id_num
*
* @mbg.generated
*/
private String taxpayerIdNum;
/**
* Database Column Remarks:
* 导入类型。0-未定义,1-利润表,2-资产负债表
......@@ -165,6 +176,28 @@ public class DataImportLog extends BaseEntity implements Serializable {
*/
private String errorMsg;
/**
* Database Column Remarks:
* 记录条数
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column data_import_log.record_size
*
* @mbg.generated
*/
private Integer recordSize;
/**
* Database Column Remarks:
* 是否为最新导入记录。0-不是,1-是 。写入新提交记录时更新旧的为0
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column data_import_log.display
*
* @mbg.generated
*/
private Boolean display;
/**
* Database Column Remarks:
* 创建时间
......@@ -243,6 +276,30 @@ public class DataImportLog extends BaseEntity implements Serializable {
this.organizationId = organizationId == null ? null : organizationId.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column data_import_log.taxpayer_id_num
*
* @return the value of data_import_log.taxpayer_id_num
*
* @mbg.generated
*/
public String getTaxpayerIdNum() {
return taxpayerIdNum;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column data_import_log.taxpayer_id_num
*
* @param taxpayerIdNum the value for data_import_log.taxpayer_id_num
*
* @mbg.generated
*/
public void setTaxpayerIdNum(String taxpayerIdNum) {
this.taxpayerIdNum = taxpayerIdNum == null ? null : taxpayerIdNum.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column data_import_log.type
......@@ -531,6 +588,54 @@ public class DataImportLog extends BaseEntity implements Serializable {
this.errorMsg = errorMsg == null ? null : errorMsg.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column data_import_log.record_size
*
* @return the value of data_import_log.record_size
*
* @mbg.generated
*/
public Integer getRecordSize() {
return recordSize;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column data_import_log.record_size
*
* @param recordSize the value for data_import_log.record_size
*
* @mbg.generated
*/
public void setRecordSize(Integer recordSize) {
this.recordSize = recordSize;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column data_import_log.display
*
* @return the value of data_import_log.display
*
* @mbg.generated
*/
public Boolean getDisplay() {
return display;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column data_import_log.display
*
* @param display the value for data_import_log.display
*
* @mbg.generated
*/
public void setDisplay(Boolean display) {
this.display = display;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column data_import_log.create_time
......@@ -593,6 +698,7 @@ public class DataImportLog extends BaseEntity implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", organizationId=").append(organizationId);
sb.append(", taxpayerIdNum=").append(taxpayerIdNum);
sb.append(", type=").append(type);
sb.append(", companyCode=").append(companyCode);
sb.append(", companyName=").append(companyName);
......@@ -605,6 +711,8 @@ public class DataImportLog extends BaseEntity implements Serializable {
sb.append(", operateTime=").append(operateTime);
sb.append(", importResult=").append(importResult);
sb.append(", errorMsg=").append(errorMsg);
sb.append(", recordSize=").append(recordSize);
sb.append(", display=").append(display);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append("]");
......
......@@ -325,6 +325,76 @@ public class DataImportLogExample {
return (Criteria) this;
}
public Criteria andTaxpayerIdNumIsNull() {
addCriterion("taxpayer_id_num is null");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumIsNotNull() {
addCriterion("taxpayer_id_num is not null");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumEqualTo(String value) {
addCriterion("taxpayer_id_num =", value, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumNotEqualTo(String value) {
addCriterion("taxpayer_id_num <>", value, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumGreaterThan(String value) {
addCriterion("taxpayer_id_num >", value, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumGreaterThanOrEqualTo(String value) {
addCriterion("taxpayer_id_num >=", value, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumLessThan(String value) {
addCriterion("taxpayer_id_num <", value, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumLessThanOrEqualTo(String value) {
addCriterion("taxpayer_id_num <=", value, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumLike(String value) {
addCriterion("taxpayer_id_num like", value, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumNotLike(String value) {
addCriterion("taxpayer_id_num not like", value, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumIn(List<String> values) {
addCriterion("taxpayer_id_num in", values, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumNotIn(List<String> values) {
addCriterion("taxpayer_id_num not in", values, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumBetween(String value1, String value2) {
addCriterion("taxpayer_id_num between", value1, value2, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTaxpayerIdNumNotBetween(String value1, String value2) {
addCriterion("taxpayer_id_num not between", value1, value2, "taxpayerIdNum");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
......@@ -1105,6 +1175,126 @@ public class DataImportLogExample {
return (Criteria) this;
}
public Criteria andRecordSizeIsNull() {
addCriterion("record_size is null");
return (Criteria) this;
}
public Criteria andRecordSizeIsNotNull() {
addCriterion("record_size is not null");
return (Criteria) this;
}
public Criteria andRecordSizeEqualTo(Integer value) {
addCriterion("record_size =", value, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeNotEqualTo(Integer value) {
addCriterion("record_size <>", value, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeGreaterThan(Integer value) {
addCriterion("record_size >", value, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeGreaterThanOrEqualTo(Integer value) {
addCriterion("record_size >=", value, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeLessThan(Integer value) {
addCriterion("record_size <", value, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeLessThanOrEqualTo(Integer value) {
addCriterion("record_size <=", value, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeIn(List<Integer> values) {
addCriterion("record_size in", values, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeNotIn(List<Integer> values) {
addCriterion("record_size not in", values, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeBetween(Integer value1, Integer value2) {
addCriterion("record_size between", value1, value2, "recordSize");
return (Criteria) this;
}
public Criteria andRecordSizeNotBetween(Integer value1, Integer value2) {
addCriterion("record_size not between", value1, value2, "recordSize");
return (Criteria) this;
}
public Criteria andDisplayIsNull() {
addCriterion("display is null");
return (Criteria) this;
}
public Criteria andDisplayIsNotNull() {
addCriterion("display is not null");
return (Criteria) this;
}
public Criteria andDisplayEqualTo(Boolean value) {
addCriterion("display =", value, "display");
return (Criteria) this;
}
public Criteria andDisplayNotEqualTo(Boolean value) {
addCriterion("display <>", value, "display");
return (Criteria) this;
}
public Criteria andDisplayGreaterThan(Boolean value) {
addCriterion("display >", value, "display");
return (Criteria) this;
}
public Criteria andDisplayGreaterThanOrEqualTo(Boolean value) {
addCriterion("display >=", value, "display");
return (Criteria) this;
}
public Criteria andDisplayLessThan(Boolean value) {
addCriterion("display <", value, "display");
return (Criteria) this;
}
public Criteria andDisplayLessThanOrEqualTo(Boolean value) {
addCriterion("display <=", value, "display");
return (Criteria) this;
}
public Criteria andDisplayIn(List<Boolean> values) {
addCriterion("display in", values, "display");
return (Criteria) this;
}
public Criteria andDisplayNotIn(List<Boolean> values) {
addCriterion("display not in", values, "display");
return (Criteria) this;
}
public Criteria andDisplayBetween(Boolean value1, Boolean value2) {
addCriterion("display between", value1, value2, "display");
return (Criteria) this;
}
public Criteria andDisplayNotBetween(Boolean value1, Boolean value2) {
addCriterion("display not between", value1, value2, "display");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
......
......@@ -8,6 +8,7 @@
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="taxpayer_id_num" jdbcType="VARCHAR" property="taxpayerIdNum" />
<result column="type" jdbcType="TINYINT" property="type" />
<result column="company_code" jdbcType="VARCHAR" property="companyCode" />
<result column="company_name" jdbcType="VARCHAR" property="companyName" />
......@@ -20,6 +21,8 @@
<result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" />
<result column="import_result" jdbcType="BIT" property="importResult" />
<result column="error_msg" jdbcType="VARCHAR" property="errorMsg" />
<result column="record_size" jdbcType="INTEGER" property="recordSize" />
<result column="display" jdbcType="BIT" property="display" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
......@@ -94,9 +97,9 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, organization_id, type, company_code, company_name, file_type, period_year, tms_period_month,
period_month, period_status, operator, operate_time, import_result, error_msg, create_time,
update_time
id, organization_id, taxpayer_id_num, type, company_code, company_name, file_type,
period_year, tms_period_month, period_month, period_status, operator, operate_time,
import_result, error_msg, record_size, display, create_time, update_time
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.entity.DataImportLogExample" resultMap="BaseResultMap">
<!--
......@@ -149,17 +152,19 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into data_import_log (id, organization_id, type,
company_code, company_name, file_type,
period_year, tms_period_month, period_month,
period_status, operator, operate_time,
import_result, error_msg, create_time,
insert into data_import_log (id, organization_id, taxpayer_id_num,
type, company_code, company_name,
file_type, period_year, tms_period_month,
period_month, period_status, operator,
operate_time, import_result, error_msg,
record_size, display, create_time,
update_time)
values (#{id,jdbcType=BIGINT}, #{organizationId,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT},
#{companyCode,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR},
#{periodYear,jdbcType=INTEGER}, #{tmsPeriodMonth,jdbcType=TINYINT}, #{periodMonth,jdbcType=TINYINT},
#{periodStatus,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR}, #{operateTime,jdbcType=TIMESTAMP},
#{importResult,jdbcType=BIT}, #{errorMsg,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
values (#{id,jdbcType=BIGINT}, #{organizationId,jdbcType=VARCHAR}, #{taxpayerIdNum,jdbcType=VARCHAR},
#{type,jdbcType=TINYINT}, #{companyCode,jdbcType=VARCHAR}, #{companyName,jdbcType=VARCHAR},
#{fileType,jdbcType=VARCHAR}, #{periodYear,jdbcType=INTEGER}, #{tmsPeriodMonth,jdbcType=TINYINT},
#{periodMonth,jdbcType=TINYINT}, #{periodStatus,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR},
#{operateTime,jdbcType=TIMESTAMP}, #{importResult,jdbcType=BIT}, #{errorMsg,jdbcType=VARCHAR},
#{recordSize,jdbcType=INTEGER}, #{display,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.entity.DataImportLog">
......@@ -175,6 +180,9 @@
<if test="organizationId != null">
organization_id,
</if>
<if test="taxpayerIdNum != null">
taxpayer_id_num,
</if>
<if test="type != null">
type,
</if>
......@@ -211,6 +219,12 @@
<if test="errorMsg != null">
error_msg,
</if>
<if test="recordSize != null">
record_size,
</if>
<if test="display != null">
display,
</if>
<if test="createTime != null">
create_time,
</if>
......@@ -225,6 +239,9 @@
<if test="organizationId != null">
#{organizationId,jdbcType=VARCHAR},
</if>
<if test="taxpayerIdNum != null">
#{taxpayerIdNum,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=TINYINT},
</if>
......@@ -261,6 +278,12 @@
<if test="errorMsg != null">
#{errorMsg,jdbcType=VARCHAR},
</if>
<if test="recordSize != null">
#{recordSize,jdbcType=INTEGER},
</if>
<if test="display != null">
#{display,jdbcType=BIT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
......@@ -292,6 +315,9 @@
<if test="record.organizationId != null">
organization_id = #{record.organizationId,jdbcType=VARCHAR},
</if>
<if test="record.taxpayerIdNum != null">
taxpayer_id_num = #{record.taxpayerIdNum,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=TINYINT},
</if>
......@@ -328,6 +354,12 @@
<if test="record.errorMsg != null">
error_msg = #{record.errorMsg,jdbcType=VARCHAR},
</if>
<if test="record.recordSize != null">
record_size = #{record.recordSize,jdbcType=INTEGER},
</if>
<if test="record.display != null">
display = #{record.display,jdbcType=BIT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
......@@ -347,6 +379,7 @@
update data_import_log
set id = #{record.id,jdbcType=BIGINT},
organization_id = #{record.organizationId,jdbcType=VARCHAR},
taxpayer_id_num = #{record.taxpayerIdNum,jdbcType=VARCHAR},
type = #{record.type,jdbcType=TINYINT},
company_code = #{record.companyCode,jdbcType=VARCHAR},
company_name = #{record.companyName,jdbcType=VARCHAR},
......@@ -359,6 +392,8 @@
operate_time = #{record.operateTime,jdbcType=TIMESTAMP},
import_result = #{record.importResult,jdbcType=BIT},
error_msg = #{record.errorMsg,jdbcType=VARCHAR},
record_size = #{record.recordSize,jdbcType=INTEGER},
display = #{record.display,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
......@@ -375,6 +410,9 @@
<if test="organizationId != null">
organization_id = #{organizationId,jdbcType=VARCHAR},
</if>
<if test="taxpayerIdNum != null">
taxpayer_id_num = #{taxpayerIdNum,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=TINYINT},
</if>
......@@ -411,6 +449,12 @@
<if test="errorMsg != null">
error_msg = #{errorMsg,jdbcType=VARCHAR},
</if>
<if test="recordSize != null">
record_size = #{recordSize,jdbcType=INTEGER},
</if>
<if test="display != null">
display = #{display,jdbcType=BIT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
......@@ -427,6 +471,7 @@
-->
update data_import_log
set organization_id = #{organizationId,jdbcType=VARCHAR},
taxpayer_id_num = #{taxpayerIdNum,jdbcType=VARCHAR},
type = #{type,jdbcType=TINYINT},
company_code = #{companyCode,jdbcType=VARCHAR},
company_name = #{companyName,jdbcType=VARCHAR},
......@@ -439,6 +484,8 @@
operate_time = #{operateTime,jdbcType=TIMESTAMP},
import_result = #{importResult,jdbcType=BIT},
error_msg = #{errorMsg,jdbcType=VARCHAR},
record_size = #{recordSize,jdbcType=INTEGER},
display = #{display,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.dao.DataImportLogMapper">
<update id="displayOld" parameterType="java.lang.Integer">
update data_import_log
set display = 0
where
type = #{type,jdbcType=TINYINT}
and display = 1
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.AdjustmentTableMapper">
<insert id="insertBatch" parameterType="java.util.List">
insert into adjustment_table
(<include refid="Base_Column_List"/>)
values
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">#{item.id,jdbcType=BIGINT},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.organizationId != null">#{item.organizationId,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.period != null">#{item.period,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.segment1 != null">#{item.segment1,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment2 != null">#{item.segment2,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment3 != null">#{item.segment3,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment4 != null">#{item.segment4,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment5 != null">#{item.segment5,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment6 != null">#{item.segment6,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment7 != null">#{item.segment7,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment8 != null">#{item.segment8,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment9 != null">#{item.segment9,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment10 != null">#{item.segment10,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment1Name != null">#{item.segment1Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment2Name != null">#{item.segment2Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment3Name != null">#{item.segment3Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment4Name != null">#{item.segment4Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment5Name != null">#{item.segment5Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment6Name != null">#{item.segment6Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment7Name != null">#{item.segment7Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment8Name != null">#{item.segment8Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment9Name != null">#{item.segment9Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.segment10Name != null">#{item.segment10Name,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.periodDrBeq != null">#{item.periodDrBeq,jdbcType=DECIMAL},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.periodCrBeq != null">#{item.periodCrBeq,jdbcType=DECIMAL},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.endBalBeq != null">#{item.endBalBeq,jdbcType=VARCHAR},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.createTime != null">#{item.createTime,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.updateTime != null">#{item.updateTime,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
</trim>
</foreach>;
SELECT 1 FROM DUAL;
</insert>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.RedLetterInfoTableMapper">
<insert id="insertBatch" parameterType="java.util.List">
insert into red_letter_info_table
(<include refid="Base_Column_List"/>)
values
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">#{item.id,jdbcType=BIGINT},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.organizationId != null">#{item.organizationId,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.subjectNum != null">#{item.subjectNum,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.subjectName != null">#{item.subjectName,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.redLetterInvoiceInfoTableNum != null">#{item.redLetterInvoiceInfoTableNum,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.fillInDate != null">#{item.fillInDate,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.salesTaxNumber != null">#{item.salesTaxNumber,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.salespersonName != null">#{item.salespersonName,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.totalAmount != null">#{item.totalAmount,jdbcType=DECIMAL},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.totalTaxAmount != null">#{item.totalTaxAmount,jdbcType=DECIMAL},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.applicationDescription != null">#{item.applicationDescription,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.applicantManager != null">#{item.applicantManager,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.invoiceCode != null">#{item.invoiceCode,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.invoiceNumber != null">#{item.invoiceNumber,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.createTime != null">#{item.createTime,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.updateTime != null">#{item.updateTime,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
</trim>
</foreach>;
SELECT 1 FROM DUAL;
</insert>
</mapper>
\ No newline at end of file
......@@ -31,7 +31,7 @@
"BusinessUnitID": "Business Unit",
"BusinessUnitLog": "日志-事业部",
"ByYear": "By Year",
"YearPeriod": "年度",
"YearPeriod": "Year Period",
"Cancel": "Cancel",
"CancelMapping": "Cancel mapping",
"CellPosition": "Cell at: ",
......@@ -302,7 +302,7 @@
"modifyReason": "Modification Reason",
"originalAmount": "Orginal Amount",
"settings": "Configurations management",
"RecordSize": "记录条数",
"RecordSize": "Record Size",
"TaxPayerIdNum": "纳税人识别号",
......
......@@ -356,8 +356,8 @@
"ComfirmToReMap": "该企业科目已对应了标准科目,确定要重新对应并覆盖已有对应关系吗?",
"CommissionableStore": "Commissionable Store",
"CommonFail": "System error, please contact system administrator",
"CompanyCode": "公司代码",
"CompanyName": "公司名称",
"CompanyCode": "Company Code",
"CompanyName": "Company Name",
"CompanyTaxID": "Company Tax ID",
"CompanyVATIDTaxIDPlaceholder": "Please Input Seven-Digit Tax Identification Number",
"CompanyVATIDTaxIDRequire": "Please Input Company VAT ID!",
......@@ -1819,7 +1819,7 @@
"ImportBalanceSheet": "Import BS",
"CoverImportBalanceSheet": "Overwrite import BS",
"AddImportBalanceSheet": "Expand import BS",
"TMSPeriod": "TMS Period",
"~MustBeEndOneApp": "I Must be the End One, please!"
}
\ No newline at end of file
......@@ -2064,6 +2064,7 @@
"ImportBalanceSheet": "导入资产负债表",
"CoverImportBalanceSheet": "覆盖导入资产负债表",
"AddImportBalanceSheet": "追加导入资产负债表",
"TMSPeriod": "税务系统期间",
"~MustBeEndOneApp": "我必须是最后一个!"
......
commonModule.controller('importATController', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'vatImportService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService'
, 'projectService', 'vatCommonService',
function ($scope, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, vatImportService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService
, projectService, vatCommonService) {
'use strict';
var successCount = 0;
var uploadUrl = apiInterceptor.vatWebApiHostUrl + '/FileUpload/NewFile';
var resumable = true;
var comment = vatSessionService.project.name + " " + vatSessionService.project.year + "年" + vatSessionService.month + "月";
var servicePeriods = [];
$scope.period = $scope.periodId;
$scope.moduleid = enums.vatModuleEnum.Import_TrialBalance;
$scope.chunkSize = 100000;
$scope.success = false;
$scope.showErrorTable = false;
$scope.showInitTable = false;
$scope.showImportTable = false
$scope.isSelectPeriod = true;
$scope.isShowImportTotalBtn = true;
$scope.projectID = vatSessionService.project.id;
$scope.startRowNum = 2;
$scope.validationType = 0;
$scope.sheetData = { sheetNameList: [], dataList: [], selectedSheetIndex: 0 };
$scope.sheetInfo = { selectedSheetName: '', selectedSheetIndex: 0 };
$scope.balanceInputList = [];
$scope.toInputList = [];
$scope.importEnum = { Import: 0, CoverImport: 1, AddImport: 2 }; //导入方式
$scope.selectedPeriod = null;
$scope.showTotalSecondRow = false;
$scope.importPLExcelFile = apiInterceptor.webApiHostUrl + '/DataImport/PLExcelFile';
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth();
$scope.selectedDate = new Date(vatSessionService.year, vatSessionService.month - 1, 1);
$scope.startDate = new Date(year - 20, 1, 1);
$scope.endDate = new Date(year + 20, 1, 1);
$scope.viewMode = 1;
$scope.dateFormat = $translate.instant('dateFormat4YearMonth');
$scope.importExcelFile = null;
$scope.UploadPeriodTime = null;
//写日志
var logDto = {
ID: '',
OperationName: '',
ModuleID: $scope.moduleid,
OperationObject: $translate.instant('ProfitAndLossStatement'),
OperationType: '',
OperationContent: '',
OriginalState: '',
UpdateState: '',
CreatorID: vatSessionService.logUser.ID,
Comment: comment,
IP: '',
Period: $scope.period,
};
//初始化ack-pagination
$scope.pagingOptions = {
pageIndex: 1, //当前页码
totalItems: 0, //总数据
totalPages: 10, //总页数
maxSize: 5, //分页数字的限制。
pageSize: constant.page.pageSizeArrary[3], //每页多少条数据,100条
pageSizeString: constant.page.pageSizeArrary[3].toString(),
firstPage: $translate.instant('PagingFirstPage'),
previousPage: $translate.instant('PagingPreviousPage'),
nextPage: $translate.instant('PagingNextPage'),
lastPage: $translate.instant('PagingLastPage'),
};
//初始化查询参数
$scope.queryParams = {
pageInfo: {
totalCount: 0,
pageIndex: 0,
pageSize: 0,
totalPage: 0,
},
periodId: $scope.period,
serviceTypeId: $scope.serviceTypeId,
projectId: $scope.projectID
};
$scope.totalData = {
totalNumber: 0,
begDebitTotal: 0,
begCreditTotal: 0,
endDebitTotal: 0,
endCreditTotal: 0,
begBalTotal: 0,
endBalTotal: 0,
debitTotal: 0,
creditTotal: 0,
};
//分页获取数据
$scope.eventService = {
refreshInvoiceDataGrid: function () {
$log.debug("refreshInvoiceDataGrid");
}
};
//转换没有选中的列值
var undefinedStringToNull = function (i, stringName) {
var data = $scope.sheetData.dataList[i][$.inArray($translate.instant(stringName), $scope.selectedMappingList)];
if (_.isUndefined(data)) {
return null;
}
else {
if (PWC.isNullOrEmpty(data)) {
return "";
}
else {
return data;
}
}
}
//转换没有选中的列值
var undefinedNumToNull = function (i, stringName) {
var data = $scope.sheetData.dataList[i][$.inArray($translate.instant(stringName), $scope.selectedMappingList)];
if (_.isUndefined(data)) {
return null;
}
else {
if (PWC.isNullOrEmpty(data)) {
return 0;
}
else {
return data;
}
}
}
//验证每行数据类型
var valueTypeValidation = function (balanceinputlist) {
return true; //todo:[validation] to skip data validation (neo)
var AccountCodeOverLengthMsg = '';
var AccountCodeNullMsg = '';
var PeriodMsg = '';
var BegDebitBalMsg = '';
var BegCreditBalMsg = '';
var DebitBalMsg = '';
var CreditBalMsg = '';
var EndDebitBalMsg = '';
var EndCreditBalMsg = '';
var BegBalMsg = '';
var EndBalMsg = '';
var NumlengthMsg = '';
var AccountCodeOverLengthCount = 0;
var AccountCodeNullCount = 0;
var PeriodCount = 0;
var BegDebitBalCount = 0;
var BegCreditBalCount = 0;
var DebitBalCount = 0;
var CreditBalCount = 0;
var EndDebitBalCount = 0;
var EndCreditBalCount = 0;
var BegBalCount = 0;
var EndBalCount = 0;
var NumLengthCount = 0;
//验证前,将错误数据清空
$scope.errorMsgMap = [];
for (var i = 0; i < balanceinputlist.length; i++) {
var m = balanceinputlist[i];
if (PWC.isNullOrEmpty(m.AcctCode)) {
AccountCodeNullMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('AccountCodeNullMag') + '<br />';
AccountCodeNullCount++;
}
if (m.AcctCode !== null && m.AcctCode.length > 50) {
AccountCodeOverLengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('AccountCodeOverLengthMag') + '<br />';
AccountCodeOverLengthCount++;
}
if (m.MonthId !== null) {
if (!PWC.isInteger(m.MonthId)) {
PeriodMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('PeriodErrorMag') + '<br />';
PeriodCount++;
}
else if (PWC.isInteger(m.MonthId) && (parseInt(m.MonthId) < 1 || parseInt(m.MonthId) > 12)) {
NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('PeriodId') + $translate.instant('PeriodOverLengthMsg') + '<br />';
NumLengthCount++;
}
}
if (m.BegDebitBal !== null) {
if (isNaN(parseFloat(m.BegDebitBal))) {
BegDebitBalMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('BegDebitBalMsg') + '<br />';
BegDebitBalCount++;
}
//else if (parseFloat(m.BegDebitBal) < constant.startNum || parseFloat(m.BegDebitBal) > constant.endNum) {
// NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('BegDebitBal') + $translate.instant('NumOverLengthMsg') + '<br />';
// NumLengthCount++;
//}
else {
m.BegDebitBal = PWC.round(m.BegDebitBal, 2);
}
}
if (m.BegCreditBal !== null) {
if (isNaN(parseFloat(m.BegCreditBal))) {
BegCreditBalMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('BegCreditBalMsg') + '<br />';
BegCreditBalCount++;
}
//else if (parseFloat(m.BegCreditBal) < constant.startNum || parseFloat(m.BegCreditBal) > constant.endNum) {
// NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('BegCreditBal') + $translate.instant('NumOverLengthMsg') + '<br />';
// NumLengthCount++;
//}
else {
m.BegCreditBal = PWC.round(m.BegCreditBal, 2);
}
}
if (m.DebitBal !== null) {
if (isNaN(parseFloat(m.DebitBal))) {
DebitBalMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('DebitBalMsg') + '<br />';
DebitBalCount++;
}
//else if (parseFloat(m.DebitBal) < constant.startNum || parseFloat(m.DebitBal) > constant.endNum) {
// NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('DebitBal') + $translate.instant('NumOverLengthMsg') + '<br />';
// NumLengthCount++;
//}
else {
m.DebitBal = PWC.round(m.DebitBal, 2);
}
}
if (m.CreditBal !== null) {
if (isNaN(parseFloat(m.CreditBal))) {
CreditBalMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('CreditBalMsg') + '<br />';
CreditBalCount++;
}
//else if (parseFloat(m.CreditBal) < constant.startNum || parseFloat(m.CreditBal) > constant.endNum) {
// NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('CreditBal') + $translate.instant('NumOverLengthMsg') + '<br />';
// NumLengthCount++;
//}
else {
m.CreditBal = PWC.round(m.CreditBal, 2);
}
}
if (m.EndDebitBal !== null) {
if (isNaN(parseFloat(m.EndDebitBal))) {
EndDebitBalMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('EndDebitBalMsg') + '<br />';
EndDebitBalCount++;
}
//else if (parseFloat(m.EndDebitBal) < constant.startNum || parseFloat(m.EndDebitBal) > constant.endNum) {
// NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('EndDebitBal') + $translate.instant('NumOverLengthMsg') + '<br />';
// NumLengthCount++;
//}
else {
m.EndDebitBal = PWC.round(m.EndDebitBal, 2);
}
}
if (m.EndCreditBal !== null) {
if (isNaN(parseFloat(m.EndCreditBal))) {
EndCreditBalMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('EndCreditBalMsg') + '<br />';
EndCreditBalCount++;
}
//else if (parseFloat(m.EndCreditBal) < constant.startNum || parseFloat(m.EndCreditBal) > constant.endNum) {
// NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('EndCreditBal') + $translate.instant('NumOverLengthMsg') + '<br />';
// NumLengthCount++;
//}
else {
m.EndCreditBal = PWC.round(m.EndCreditBal, 2);
}
}
if (m.BegBal !== null) {
if (isNaN(parseFloat(m.BegBal))) {
BegBalMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('BegBalMsg') + '<br />';
BegBalCount++;
}
//else if (parseFloat(m.BegBal) < constant.startNum || parseFloat(m.BegBal) > constant.endNum) {
// NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('BegBal') + $translate.instant('NumOverLengthMsg') + '<br />';
// NumLengthCount++;
//}
else {
m.BegBal = PWC.round(m.BegBal, 2);
}
}
if (m.EndBal !== null) {
if (isNaN(parseFloat(m.EndBal))) {
EndBalMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('EndBalMsg') + '<br />';
EndBalCount++;
}
//else if (parseFloat(m.EndBal) < constant.startNum || parseFloat(m.EndBal) > constant.endNum) {
// NumlengthMsg += $translate.instant('LineNum') + ':' + m.SeqNum + ',' + $translate.instant('EndBal') + $translate.instant('NumOverLengthMsg') + '<br />';
// NumLengthCount++;
//}
else {
m.EndBal = PWC.round(m.EndBal, 2);
}
}
}
if (AccountCodeNullMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('AccountCodeNullType'),
'errorCount': AccountCodeNullCount,
'errorContent': AccountCodeNullMsg
});
}
if (AccountCodeOverLengthMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('AccountCodeOverLengthType'),
'errorCount': AccountCodeOverLengthCount,
'errorContent': AccountCodeOverLengthMsg
});
}
if (NumLengthCount > 0) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('NumOutRangeErrorType'),
'errorCount': NumLengthCount,
'errorContent': NumlengthMsg
});
}
if (PeriodMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('PeriodErrorType'),
'errorCount': PeriodCount,
'errorContent': PeriodMsg
});
}
if (BegDebitBalMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('BegDebitBalType'),
'errorCount': BegDebitBalCount,
'errorContent': BegDebitBalMsg
});
}
if (BegCreditBalMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('BegCreditBalType'),
'errorCount': BegCreditBalCount,
'errorContent': BegCreditBalMsg
});
}
if (CreditBalMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('CreditBalType'),
'errorCount': CreditBalCount,
'errorContent': CreditBalMsg
});
}
if (DebitBalMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('DebitBalType'),
'errorCount': DebitBalCount,
'errorContent': DebitBalMsg
});
}
if (EndDebitBalMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('EndDebitBalType'),
'errorCount': EndDebitBalCount,
'errorContent': EndDebitBalMsg
});
}
if (EndCreditBalMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('EndCreditBalType'),
'errorCount': EndCreditBalCount,
'errorContent': EndCreditBalMsg
});
}
if (BegBalMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('BegBalType'),
'errorCount': BegBalCount,
'errorContent': BegBalMsg
});
}
if (EndBalMsg) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('EndBalType'),
'errorCount': EndBalCount,
'errorContent': EndBalMsg
});
}
if ($scope.errorMsgMap.length > 0) {
$('#errorListModal').modal('show');
return false;
}
return true;
};
//验证是否选中了正确的列名
var validationColumnMapping = function () {
$scope.errorMsgMap = [];
//0.判断选择的开始导入行是否大于实际数据行
if (PWC.isNullOrEmpty($scope.startRowNum)) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('StartRowError'),
'errorCount': 1,
'errorContent': $translate.instant('StartRowNull')
});
}
if (parseInt($scope.startRowNum) > $scope.sheetData.dataList.length) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('StartRowError'),
'errorCount': 1,
'errorContent': $translate.instant('StartRowNumberCheckMsg')
});
}
//1.科目代码必选
if ($scope.selectedMappingList.indexOf($translate.instant('AccountCode')) === -1) {
//errorMsg += $translate.instant('NoAccountCode') + '\n';
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('NoAccountCode')
});
}
//借方期初,贷方期初同时必选
if (($scope.selectedMappingList.indexOf($translate.instant('BegDebitBal')) === -1 &&
$scope.selectedMappingList.indexOf($translate.instant('BegCreditBal')) !== -1)
|| ($scope.selectedMappingList.indexOf($translate.instant('BegDebitBal')) !== -1 &&
$scope.selectedMappingList.indexOf($translate.instant('BegCreditBal')) === -1)) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('Condition1')
});
}
//借方发生额,贷方发生额同时必选
if (($scope.selectedMappingList.indexOf($translate.instant('DebitBal')) === -1 &&
$scope.selectedMappingList.indexOf($translate.instant('CreditBal')) !== -1)
|| ($scope.selectedMappingList.indexOf($translate.instant('DebitBal')) !== -1 &&
$scope.selectedMappingList.indexOf($translate.instant('CreditBal')) === -1)) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('Condition6')
});
}
//借方期末,贷方期末同时必选
if (($scope.selectedMappingList.indexOf($translate.instant('EndDebitBal')) === -1 &&
$scope.selectedMappingList.indexOf($translate.instant('EndCreditBal')) !== -1)
|| ($scope.selectedMappingList.indexOf($translate.instant('EndDebitBal')) !== -1 &&
$scope.selectedMappingList.indexOf($translate.instant('EndCreditBal')) === -1)) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('Condition7')
});
}
//2.期初余额必选或者(借方期初,贷方期初)必选
if (!($scope.selectedMappingList.indexOf($translate.instant('BegBal')) !== -1 ||
$scope.selectedMappingList.indexOf($translate.instant('BegDebitBal')) !== -1 &&
$scope.selectedMappingList.indexOf($translate.instant('BegCreditBal')) !== -1)) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('Condition2')
});
}
//3.(借方发生额,贷方发生额)或者(借方期末,贷方期末)或者 期末余额 必选
if (!($scope.selectedMappingList.indexOf($translate.instant('DebitBal')) !== -1
&& $scope.selectedMappingList.indexOf($translate.instant('CreditBal')) !== -1
|| $scope.selectedMappingList.indexOf($translate.instant('EndDebitBal')) !== -1
&& $scope.selectedMappingList.indexOf($translate.instant('EndCreditBal')) !== -1
|| $scope.selectedMappingList.indexOf($translate.instant('EndBal')) !== -1)
) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('Condition3')
});
}
//4.期初余额与借方期初,贷方期初不能同时选
if ($scope.selectedMappingList.indexOf($translate.instant('BegBal')) !== -1 &&
$scope.selectedMappingList.indexOf($translate.instant('BegDebitBal')) !== -1 &&
$scope.selectedMappingList.indexOf($translate.instant('BegCreditBal')) !== -1) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('Condition4')
});
}
//5.期末余额与借方期末,贷方期末不能同时选
if ($scope.selectedMappingList.indexOf($translate.instant('EndBal')) !== -1 &&
$scope.selectedMappingList.indexOf($translate.instant('EndDebitBal')) !== -1 &&
$scope.selectedMappingList.indexOf($translate.instant('EndCreditBal')) !== -1) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('Condition5')
});
}
//6. CIT时期间必须
if ($scope.serviceTypeId === constant.serviceType.CIT
&& $scope.selectedMappingList.indexOf($translate.instant('PeriodId')) === -1) {
$scope.errorMsgMap.push(
{
'errorType': $translate.instant('SelectColumnError'),
'errorCount': 1,
'errorContent': $translate.instant('PeriodColumnRequired')
});
}
if ($scope.errorMsgMap.length > 0) {
$('#errorListModal').modal('show');
return false;
}
return true;
}
//验证数据
var validationTbData = function () {
var defer = $q.defer();
$scope.balanceInputList = [];
for (var i = $scope.startRowNum - 1; i < $scope.sheetData.dataList.length; i++) {
var balanceDto = {
'SeqNum': i + 1,
'BalanceId': PWC.newGuid(),
'PeriodId': undefinedStringToNull(i, 'PeriodId'),
'AcctCode': undefinedStringToNull(i, 'AccountCode'),
'CustomerCode': undefinedStringToNull(i, 'CustomerCode'),
'MonthId': undefinedStringToNull(i, 'PeriodId'),
'BegDebitBal': undefinedNumToNull(i, 'BegDebitBal'),
'BegCreditBal': undefinedNumToNull(i, 'BegCreditBal'),
'DebitBal': undefinedNumToNull(i, 'DebitBal'),
'CreditBal': undefinedNumToNull(i, 'CreditBal'),
'EndDebitBal': undefinedNumToNull(i, 'EndDebitBal'),
'EndCreditBal': undefinedNumToNull(i, 'EndCreditBal'),
'BegBal': undefinedNumToNull(i, 'BegBal'),
'EndBal': undefinedNumToNull(i, 'EndBal'),
};
$scope.balanceInputList.push(balanceDto);
}
if ($scope.serviceTypeId === constant.serviceType.CIT+"") {
$scope.isSelectPeriod = $scope.balanceInputList[0].MonthId !== null ? true : false;
var isOk = valueTypeValidation($scope.balanceInputList);
defer.resolve(isOk);
return defer.promise;
}
else if ($scope.serviceTypeId === constant.serviceType.VAT+"") {
if ($scope.balanceInputList[0].MonthId === null) {//没有选中月份,默认导入所有期间
$scope.isSelectPeriod = false;
swal({
title: "warning!",
text: $translate.instant('NoPeriod'),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
$timeout(function () {
if (isConfirm) {
var isok = valueTypeValidation($scope.balanceInputList);
defer.resolve(isok);
}
else {
defer.resolve(false);
}
}, 300);
});
return defer.promise;
}
else {
$scope.isSelectPeriod = true;
var isSame = true;
$scope.balanceInputList.forEach(function (m) {
if (m.MonthId !== m.PeriodId.toString()) {
isSame = false;
}
});
if (isSame === false) { //是否只导入当前月份数据
swal({
title: "warning!",
text: $translate.instant('PeriodDifferenceTip'),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
$timeout(function () {
if (isConfirm) {
var isOk = valueTypeValidation($scope.balanceInputList);
defer.resolve(isOk);
}
else {
defer.resolve(false);
}
}, 300);
});
return defer.promise;
}
else {
var isOk = valueTypeValidation($scope.balanceInputList);
defer.resolve(isOk);
return defer.promise;
}
}
}
};
//根据PeriodId过滤数据
var filterImportData = function (m) {
var filterData = false;
if ($scope.serviceTypeId === constant.serviceType.VAT+"") {
filterData = m.MonthId === m.PeriodId
&& m.PeriodId === $scope.period.toString();
} else if ($scope.serviceTypeId === constant.serviceType.CIT+"") {
filterData = m.MonthId === m.PeriodId;
}
return filterData;
};
//导入事件
var doUploadPL = function (importType) {
debugger;
var impExl = $scope.importExcelFile;
var deferred = $q.defer();
var token = $('input[name="__RequestVerificationToken"]').val();
if (!impExl) {
SweetAlert.warning($translate.instant('PleaseSelectFileFirst'));
return;
}
//列名对应验证
/*if (validationColumnMapping()) {
//数据类型验证
validationTbData().then(function (isSuccess) {
if (isSuccess) {
});
}*/
logDto.ID = PWC.newGuid();
logDto.CreateTime = new Date();
logDto.UpdateTime = new Date();
logDto.OperationContent = $scope.fileName;
if (importType === $scope.importEnum.Import) {
logDto.OperationName = $translate.instant('ImportTrialBalance');
logDto.OperationType = enums.vatLogOperationTypeEnum.Import;
}
else if (importType === $scope.importEnum.CoverImport) {
logDto.OperationName = $translate.instant('CoverImportTrialBalance');
logDto.OperationType = enums.vatLogOperationTypeEnum.CoverImport;
}
else if (importType === $scope.importEnum.AddImport) {
logDto.OperationName = $translate.instant('AddImportTrialBalance');
logDto.OperationType = enums.vatLogOperationTypeEnum.AddImport;
}
var period = $scope.UploadPeriodTime;
Upload.upload({
url: $scope.importPLExcelFile,
data: {
periodDate : period
},
file: impExl,
headers: {
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
__RequestVerificationToken: token,
withCredentials: true
},
__RequestVerificationToken: token,
withCredentials: true
}).then(function(resp) {
var ret = resp.data;
$('#busy-indicator-container').hide();
deferred.resolve();
if (ret.result) {
// 导入成功
// todo ImportPLStatusGridSource Change
logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto);
SweetAlert.error($translate.instant('ImportFail'));
} else {
logDto.UpdateState = $translate.instant('ImportFail');
vatOperationLogService.addOperationLog(logDto);
SweetAlert.error($translate.instant('ImportFail'));
}
}, function(resp) {
deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') {
SweetAlert.warning($translate.instant('HttpRequestValidationException'));
} else {
SweetAlert.warning('SaveFail');
}
logDto.UpdateState = $translate.instant('ImportFail');
vatOperationLogService.addOperationLog(logDto);
SweetAlert.error($translate.instant('ImportFail'));
console.log('Error status: ' + resp.status);
}, function(evt) {
deferred.resolve();
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
$log.debug('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
});
};
//显示图标
var errorLevelToString = function (errorLevel) {
if (errorLevel === 0) {
return '/app-resources/images/vat/error.png';
}
if (errorLevel === 1) {
return '/app-resources/images/vat/warning.png';
}
if (errorLevel === 2) {
return '/app-resources/images/vat/tips.png';
}
else {
return '/app-resources/images/vat/tips.png';
}
}
//刷新操作
var refreshTbData = function () {
logDto.ID = PWC.newGuid();
logDto.CreateTime = new Date();
logDto.UpdateTime = new Date();
logDto.OperationContent = '';
logDto.OperationName = $translate.instant('RefreshValidationData');
logDto.OperationType = enums.vatLogOperationTypeEnum.Refresh;
refreshByService.callRefresh($scope.serviceTypeId, enums.optionType.Refresh);
};
var getGridHeight = function () {
if ($scope.isLoadComplete) {
return { height: ($('.balance-ouput-grid-wrapper').height()) + "px" };
}
else {
return { height: 0 + "px" };
}
};
var getErrorGridHeight = function () {
if ($scope.isLoadComplete) {
var y = $("#error-info-wrapper").height();
// Enough space
if (y > constant.UIGrid.gapHeight) {
y = y - constant.UIGrid.gapHeight;
return { height: y + "px" };
} else {
return { height: '0px' };
}
}
return {};
};
var loadImportPLStatusInfoDatagrid = function () {
$scope.importPLStatusGridOptions = {
bindingOptions: {
dataSource: 'ImportPLStatusGridSource'
},
showBorders: true,
columns: [{
dataField: "id",
visible: false,
allowHeaderFiltering: false,
caption: $translate.instant('id')
}, {
dataField: "taxpayerIdNum",
width: '10%',
allowHeaderFiltering: false,
caption: $translate.instant('TaxpayerIdNum')
}, {
dataField: "companyCode",
allowHeaderFiltering: false,
caption: $translate.instant('CompanyCode'),
width: '15%'
}, {
dataField: "companyName",
allowHeaderFiltering: false,
width: '15%',
caption: $translate.instant('CompanyName')
}, {
dataField: "yearPeriod",
allowHeaderFiltering: false,
width: '20%',
caption: $translate.instant('YearPeriod')
}, {
dataField: "period",
allowHeaderFiltering: false,
width: '20%',
caption: $translate.instant('Period')
}, {
dataField: "recordSize",
allowHeaderFiltering: false,
width: '10%',
caption: $translate.instant('RecordSize')
}, {
dataField: "status",
allowHeaderFiltering: false,
width: '10%',
caption: $translate.instant('Status')
}
],
onContentReady: function (e) {
$scope.accountingRateListInstance = e.component;
var totalCount = e.component.totalCount();
if (totalCount > 0) {
$scope.totalCount = totalCount;
}
},
loadPanel: {
enabled: false
},
selection: {
mode: "single"
},
grouping: {
autoExpandAll: false
},
allowColumnResizing: true,
columnAutoWidth: true,
showRowLines: true,
showColumnLines: true,
rowAlternationEnabled: true, //单双行颜色
noDataText: $translate.instant('NoDataText'),
selectAllText: $translate.instant('SelectAll'),
headerFilter: {
visible: false,
texts: {
cancel: $translate.instant('Cancel'),
ok: $translate.instant('Confirm'),
emptyValue: $translate.instant('Empty'),
selectAllText: $translate.instant('SelectAll')
}
}
};
};
var getImportPLStatus = function () {
orgExtraService.getAccountingRateListByOrgId(orgId).success(function (data) {
if (data) {
$scope.ImportPLStatusGridSource = data;
for (var i = 1; i <= $scope.AccountingRateGridSource.length; i++) {
$scope.AccountingRateGridSource[i - 1].index = i;
}
}
});
};
var initImportPLStatusFromDB = function () {
getImportPLStatus();
};
//获取验证信息
var GetValidationList = function () {
vatImportService.getServiceValidationList($scope.validationType, $scope.period, $scope.serviceTypeId, $scope.projectID).success(function (data) {
if (data.length > 0) {
var index = 1;
data.forEach(function (v) {
v.index = index++;
});
$scope.errorList = data;
$scope.gridOptionsErrorMsg.data = data;
showErrTab();
$scope.toggleErrorTab();
$scope.showErrorTable = true;
}
else {
$scope.errorList = [];
$scope.gridOptionsErrorMsg.data = [];
$scope.showErrorTable = false;
$scope.ImportErrorTab = false;
$scope.ImportErrorTag = false;
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
}
//显示验证信息
var toggleErrorTab = function () {
$scope.ImportErrorTag = !$scope.ImportErrorTag;
// topIcon and content-resize gapBottom 15px
if (!$scope.ImportErrorTag) {
setErrorWrapCssDefault();
} else {
if (parseInt($('#content-resizer').css('bottom')) < 100) {
$('#content-resizer').css('bottom', '150px');
$('#topIcon').css({ bottom: '-381px' });
$('.error-info-wrapper').css('height', '150px');
}
}
};
var setErrorWrapCssDefault = function () {
$('#content-resizer').css('bottom', '0px');
$('#topIcon').css({ bottom: '-501px' });
$('.error-info-wrapper').css('height', '0px');
};
var showErrTab = function() {
$scope.ImportErrorTab = true;
$scope.ImportErrorTag = true;
$scope.errorMsg = $translate.instant('ImportErrorMsg').formatObj({ "NumberOfError": $scope.errorList.length });
};
//加载文档后操作
var initImportFile = function (fileName) {
var arr = fileName.name.split('.');
if (arr[arr.length - 1] !== 'xls' && arr[arr.length - 1] !== 'xlsx') {
SweetAlert.warning($translate.instant('ImportFileInvalidType'));
return;
}
$scope.fileName = fileName.name;
//初始化数据
$scope.selectedMappingList = [];
$scope.ImportErrorTab = false;
$scope.ImportErrorTag = false;
}
//日志
var showOperateLogPop = function () {
$scope.isShowLog = true;
};
var initPagingControl = function (totalItemsCount) {
$scope.pagingOptions.totalItems = totalItemsCount;
};
// 检查用户机构权限
var checkUserOrganizationPermissionList = function () {
var list = [];
var userManageTemp = constant.vatPermission.dataImport.balanceSheet;
list.push(userManageTemp.importCode);
$scope.hasImportPermission = false;
$scope.$root.checkUserOrganizationPermissionList(list).success(function (data) {
$scope.hasImportPermission = data[userManageTemp.importCode];
});
};
//控制明细信息中删除权限
var getUserPermission = function () {
var list = [];
var code = constant.vatPermission.dataImport.balanceSheet.importCode;
list.push(code);
$scope.$root.checkUserOrganizationPermissionList(list).success(function (data) {
$scope.hasEditPermission = data[code];
});
};
var setButtonWrapStyle = function () {
if ($scope.fileName) {
return { width: "100%" };
}
};
//显示期间选择弹出框
var showPeriodDrapDown = function () {
$scope.modalInstance = $uibModal.open({
animation: false,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: 'tb-model-period-dropdown.html',
scope: $scope,
windowClass: "tb-model-period-dropdow-popup"
});
$scope.closePeriodSelectModal = function () {
$scope.modalInstance.dismiss('cancel');
};
$scope.selectBox = {
simple: {
dataSource: $scope.tbPeriods,
displayExpr: "Period",
valueExpr: "ID",
searchEnabled: false,
placeholder: $translate.instant('PleaseSelectPeriod'),
noDataText: $translate.instant('NoDataToDispaly'),
maxLength: 2,
onSelectionChanged: function (e) {
$scope.selectedPeriod = e.selectedItem.Period;
}
}
};
vatImportService.getTBImportedPeriods($scope.projectID, $scope.serviceTypeId).success(function (data) {
if (data) {
$scope.tbPeriods = [];
var id = 1;
$.each(data, function (index, item) {
var periodDto = { ID: -1, Period: -1 };
periodDto.ID = id++;
periodDto.Period = item;
$scope.tbPeriods.push(periodDto);
});
$("#tbPeriodSelectBox").dxSelectBox("instance").option("dataSource", $scope.tbPeriods);
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
};
var setGridStyle = function () {
if ($scope.showTotalSecondRow) {
return { 'margin-top': '60px' }
}
else {
return { 'margin-top': '55px' }
}
};
var refreshByService = {
//VAT刷新数据,重新计算
vatRefresh: function (operation) {
vatImportService.refreshTrialBalance($scope.period, $scope.serviceTypeId).success(function (data) {
if (data === true) {
refreshByService.refreshSuccess(operation);
}
else {
refreshByService.refreshFail();
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
},
//CIT刷新数据,重新计算
citRefresh: function (operation) {
vatImportService.getTBImportedPeriods($scope.projectID, $scope.serviceTypeId).success(function (data) {
if (!_.isUndefined(data)) {
var citImportedPeriods = [];
var id = 1;
$.each(data, function (index, item) {
citImportedPeriods.push(item);
});
var importDto = { periods: citImportedPeriods, serviceTypeId: $scope.serviceTypeId };
vatImportService.refreshTrialBalancePeriods(importDto)
.success(function (data) {
if (data) {
refreshByService.refreshSuccess(operation);
}
else {
refreshByService.refreshFail();
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
}
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
})
},
//只获取TB数据,不计算
refreshSuccess: function (operation) {
var successMsg = "";
if (operation === enums.optionType.DeleteDuplicate) {
$('#duplicatedValidationModal').modal('hide');
successMsg = $translate.instant('DeleteSuccess');
}
if (operation === enums.optionType.Refresh) {
logDto.UpdateState = $translate.instant('RefreshSuccess');
vatOperationLogService.addOperationLog(logDto);
successMsg = $translate.instant('RefreshSuccess');
}
if (operation === enums.optionType.Clear) {
logDto.UpdateState = $translate.instant('ClearSuccess');
vatOperationLogService.addOperationLog(logDto);
successMsg = $translate.instant('ClearSuccess');
}
if (operation === enums.optionType.Import) {
logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto);
successMsg = $translate.instant('ImportSuccess');
}
SweetAlert.success(successMsg);
initImportPLStatusFromDB();
},
refreshFail: function () {
logDto.UpdateState = $translate.instant('RefreshTbFail');
vatOperationLogService.addOperationLog(logDto);
SweetAlert.warning($translate.instant('RefreshTbFail'));
},
callRefresh: function (serviceTypeId, operation) {
if (serviceTypeId === constant.serviceType.VAT) {
refreshByService.vatRefresh(operation);
}
if (serviceTypeId === constant.serviceType.CIT) {
refreshByService.citRefresh(operation);
}
},
};
var initDatePicker = function () {
var ele1 = $("#periodDatepicker");
ele1.datepicker({
startDate: $scope.startDate,
endDate: $scope.endDate,
viewMode: $scope.viewMode,
minViewMode: $scope.viewMode,
autoclose: true, //选中之后自动隐藏日期选择框
clearBtn: true, //清除按钮
todayBtn: false, //今日按钮
format: $scope.dateFormat //日期格式,详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
});
ele1.datepicker("setDate", $scope.selectedDate);
};
//开始
(function initialize() {
$log.debug('ImportTBController.ctor()...');
checkUserOrganizationPermissionList();
$scope.doUploadPL = doUploadPL;
$scope.refreshTbData = refreshTbData;
$scope.initPagingControl = initPagingControl;
$scope.setButtonWrapStyle = setButtonWrapStyle;
$scope.errorLevelToString = errorLevelToString;
$scope.getGridHeight = getGridHeight;
$scope.getErrorGridHeight = getErrorGridHeight;
$scope.toggleErrorTab = toggleErrorTab;
$scope.showOperateLogPop = showOperateLogPop;
$scope.setGridStyle = setGridStyle;
getUserPermission();
loadImportPLStatusInfoDatagrid();
initDatePicker();
$scope.$watch('fileNameWrapper', function (newValue, oldValue) {
if (newValue !== null && newValue !== oldValue) {
initImportFile(newValue);
}
});
$timeout(function () {
$scope.isLoadComplete = true;
}, 500);
})();
}
]);
\ No newline at end of file
<div class="import-adjust-table">
<!--标题-->
<div class="nav-wrapper">
<div class="nav-header" translate="AdjustmentTableTitle"></div>
<div class="alert alert-warning" style="width:400px;margin-bottom:5px;" ng-show="ImportErrorTab" ng-click="toggleErrorTab()">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>{{errorMsg}}
</div>
<div class="pull-right operation-wrapper">
<span ng-click="refreshTbData()" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" ng-if="showInitTable"><i class="fa fa-refresh" aria-hidden="true"></i>{{'Refresh' | translate}}</span>&nbsp;&nbsp;
<span ng-click="clearTbData()" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" ng-if="showInitTable && hasImportPermission"><i class="fa fa-trash-o" aria-hidden="true"></i>{{'ClearAll' | translate}}</span>&nbsp;&nbsp;
<span ng-click="showOperateLogPop()"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'Remarks' | translate}}</span>
</div>
</div>
<!--导航栏-->
<div id="tab_total">
<form class="form-inline" id="navigationForm" name="navigationForm">
<div class="form-group" ng-style="setButtonWrapStyle()">
<div class="import-wrapper">
<span class="text-bold" translate="InvoiceQJ"></span>:
<div class="period-picker" style="margin-left:10px">
<input type="text" id="periodDatepicker" class="datepicker imp-subheader" style="width:120px;"
readonly="readonly" ng-model="UploadPeriodTime"/>
<i class="fa fa-calendar imp-subheader red-color" style="width:20px;"></i>
</div>
<button type="button" atms-permission permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
ngf-select="" type="file" ng-model="importExcelFile" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" style="margin-right:10px;margin-left:30px">
{{'SelectFile' | translate}}
</button>
<div ng-show="fileName" style="display:inline-block">
<span title="{{fileName}}">{{'FileName' | translate}}{{fileName | limitString:10}}</span>&nbsp;&nbsp;&nbsp;&nbsp;|
<span translate="WorkSheet"></span>
<div class="ui-select-no-border">
<ui-select ng-model="sheetInfo.selectedSheetName" on-select="changeSheet($item)" search-enabled="false" style="width:120px;">
<ui-select-match placeholder="{{'SelectASheet' | translate}}">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="sheetName in sheetData.sheetNameList | propsFilter: {name: $select.search}">
<div title="{{sheetName.name}}" ng-bind-html="sheetName.name | limitString:9"></div>
</ui-select-choices>
</ui-select>
</div>
&nbsp;&nbsp;&nbsp;&nbsp;|
<span translate="StartRowNum"></span>
<input id="StartRowNum" ng-model="startRowNum" type="text" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" />
</div>
<button type="button" atms-permission permission-control-type="ngIf"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="TemplateBtn"
ng-click="downloadTemplate()"></button>
<button type="button" atms-permission permission-control-type="ngIf"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="AddImportBtn"
ng-click="doUploadPL(importEnum.AddImport)"></button>
<button type="button" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="CoverImportBtn"
ng-click="doUploadPL(importEnum.CoverImport)"></button>
<div class="btn-wrapper" ng-if="!isShowImportTotalBtn">
<button class="btn btn-vat-primary" atms-permission permission-control-type="ngIf"
permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
translate="ConverImportBtn"
ng-click="doUploadTbResult(importEnum.CoverImport)"></button>|
<button class="btn btn-vat-primary" atms-permission permission-control-type="ngIf"
permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
translate="AddImportBtn" ng-click="doUploadTbResult(importEnum.AddImport)"></button>
</div>
</div>
</div>
<!--分页栏-->
<!--<div class="form-group page-form-group" ng-show="!fileName">
<div class="page-footer">
<ack-pagination page-options="pagingOptions" refresh-table="eventService.refreshInvoiceDataGrid()" hide-page-size-selector="false"></ack-pagination>
</div>
</div>-->
</form>
<div class="dt-init-wrapper">
<div class="dx-viewport grid-container">
<div id="importPLStatusGridContainer" dx-data-grid="importPLStatusGridOptions"
style="margin-top: 30px;">
</div>
</div>
</div>
<div class="error-info-wrapper" id="error-info-wrapper" ng-show="showErrorTable">
<div ui-grid="gridOptionsErrorMsg" style="width:100%;" ng-style="getErrorGridHeight()"></div>
</div>
<div>
<div ng-show="showErrorTable" id="content-resizer"
resizer="horizontal"
resizer-height="6"
bottom-min="0"
bottom-max="400"
resizer-top="#balance-ouput-grid-wrapper"
resizer-bottom="#error-info-wrapper">
<div id="topIcon" ng-click="toggleErrorTab()">
<img src="../../../../app-resources/images/collapse.png" />
</div>
</div>
</div>
</div>
<!--期间验证明细-->
<div class="period-validation-modal">
<div class="modal fade" id="periodValidationModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width: 75%; height: 200px;" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">
{{'ErrorDetails' | translate}}
</div>
</div>
<div class="modal-body">
<div style="border: 1px solid #959595; text-align: center;" id="gridPeriodValidation" dx-data-grid="gridPeriodOptions"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" data-dismiss="modal"></button>
</div>
</div>
</div>
</div>
</div>
<!--重复验证明细-->
<div class="duplicate-validation-modal">
<div class="modal fade" id="duplicatedValidationModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width: 75%; height: 200px;" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">
{{'ErrorDetails' | translate}}
</div>
</div>
<div class="modal-body">
<div style="border: 1px solid #959595; text-align: center; " id="gridDuplicatedValidation" dx-data-grid="gridDuplicatedOptions"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" translate="BtnDelete" ng-click="deleteDupData()" ng-disabled="!hasEditPermission"></button>
<button type="button" class="btn btn-customer" translate="ButtonCancel" data-dismiss="modal"></button>
</div>
</div>
</div>
</div>
</div>
<!--错误验证信息-->
<div class="error-list-modal">
<div class="modal fade" id="errorListModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" style="width: 720px; height: 200px;" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">
{{'ImportErrorPopUpTitle' | translate}}
</div>
</div>
<div class="modal-body">
{{'ImportErrorPopUpErrorDetail' | translate}}:
<br />
<table>
<thead>
<tr>
<th width="10%" style="text-align:center;">{{'ImportErrorPopUpNoCol' | translate}}</th>
<th width="20%">{{'ImportErrorPopUpErrorTypeCol' | translate}}</th>
<th width="10%" style="text-align:center;">{{'ImportErrorPopUpErrorCountCol' | translate}}</th>
<th width="6%">{{'ImportErrorPopUpErrorDescCol' | translate}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="error in errorMsgMap track by $index">
<td width="10%" style="text-align:center;">{{$index + 1}}</td>
<td width="20%">{{error.errorType}}</td>
<td width="10%" style="text-align:center;">{{error.errorCount}}</td>
<td width="60%" ng-bind-html="error.errorContent"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" translate="Confirm" data-dismiss="modal"></button>
</div>
</div>
</div>
</div>
</div>
<!-- 期间选择弹出框 -->
<script type="text/ng-template" id="tb-model-period-dropdown.html" class="tb-model-period-dropdow-popup">
<div class="modal-header">
<div class="modal-title" style="margin-bottom:10px">
{{remarksTitle}}<i class="fa fa-times" aria-hidden="true" style="float: right; font-size: 11px; color: #CF2D1B" ng-click="closePeriodSelectModal()"></i>
</div>
</div>
<div class="modal-body">
<div class="form-group">
<div>
<div id="tbPeriodSelectBox" dx-select-box="selectBox.simple"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" ng-click="deleteTbData()">{{'Confirm' | translate}}</button>
</div>
</script>
<vat-operate-log period="period" module-type="moduleid" is-show="isShowLog"></vat-operate-log>
</div>
commonModule.directive('importAdjustmentTable', ['$log',
function ($log) {
'use strict';
return {
restrict: 'E',
templateUrl: '/app/common/controls/import/import-adjust-table/import-adjust-table.html' + '?_=' + Math.random(),
scope: {
serviceTypeId: "=?",
periodId: "=?"
},
controller: 'importATController',
link: function (scope, element) {
$('.main-contents')[0].style.width = "260px";
$('.main-contents')[0].style.float = "left";
$('.main-contents')[0].style.styleFloat = "left";
$('.main-contents')[0].style.cssFloat = "left";
}
};
}
]);
\ No newline at end of file
@import "~/app-resources/less/theme.less";
.import-adjust-table {
/*background-color: @color-white;*/
padding-left: 20px;
/*min-height: 800px;*/
height: 96%;
.nav-wrapper {
/*padding-bottom: 5px;
border-bottom: 1px solid #DBD8D3;*/
.nav-header {
height: 54px;
line-height: 54px;
font-family: "Microsoft YaHei Bold", "Microsoft YaHei Regular", "Microsoft YaHei";
font-weight: 700;
font-style: normal;
font-size: 15px;
color: #333;
display: inline-block;
}
.nav-tab {
span {
display: inline-block;
height: 34px;
line-height: 34px;
padding: 0 10px;
background-color: #B90808;
color: #FFF;
font-family: "Microsoft YaHei";
font-weight: 400;
font-style: normal;
font-size: 14px;
cursor: pointer;
}
.active {
background-color: #F91000;
}
}
.alert-warning {
background-color: #FDE2DE;
cursor: pointer;
}
.alert {
color: #CF2D1B;
font-weight: bold;
display: inline-block;
padding: 5px;
margin-left: 60px;
margin-bottom: 0px;
i {
font-size: 20px;
vertical-align: middle;
margin-right: 5px;
}
}
.operation-wrapper {
margin: 15px 25px 10px 10px;
span {
cursor: pointer;
}
}
}
.dropdown-common() {
display: inline-block;
.select-button {
background-color: #F5F5F5;
padding: 6px 0;
width: 100px;
}
.caret {
margin-top: 8px;
}
.dropdown-menu {
min-width: 100px;
li {
text-align: center;
min-height: 0px;
height: 30px;
line-height: 30px;
color: #000;
font-weight: normal;
&:hover {
background-color: #F91000;
color: #FFF;
}
}
}
}
#tab_total {
display: block;
height: calc(~'100% - 40px');
position: relative;
.import-wrapper {
span {
margin-left: 10px;
color: #333;
font-family: "Microsoft YaHei";
font-style: normal;
font-size: 14px;
font-weight: bold;
}
.period-picker {
width: 150px;
border: 1px solid #c7c5c0;
display: inline-block;
line-height: 20px;
margin-top: 7px;
}
.imp-subheader {
display: inline-block;
font-size: 15px;
height: 30px;
line-height: 30px;
vertical-align: middle;
border: none;
select {
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
background: transparent;
}
}
.dropdown {
.dropdown-common();
}
input {
width: 50px;
outline: none;
border-radius: 3px;
border: 1px solid #3c3a36;
padding: 2px;
text-align: center;
}
> button:last-child {
float: right;
margin-right: 20px;
}
.btn-wrapper {
border-radius: 5px;
background-color: #e0301e;
color: #FFF;
display: inline-block;
float: right;
margin-right: 10px;
.btn-vat-primary {
min-width: 80px;
}
}
}
.dt-init-wrapper {
margin: 60px 0;
max-width: 99%;
height: calc(~'100% - 25px');
position: relative;
.dropdown {
.dropdown-common();
i {
color: #F85550;
}
}
.importPLStatusGridContainer {
height: calc(~'100% - 30px');
overflow: hidden;
position: absolute;
top: 0;
bottom: 136px; /* 130 + 6 */
left: 0;
right: 0;
background-color: #FFF;
}
}
.error-info-wrapper {
position: absolute;
height: 150px;
bottom: 0;
left: 0;
right: 0;
overflow: hidden;
background-color: #FFF;
margin-left: -40px;
}
#content-resizer {
width: 110%;
position: absolute;
height: 4px;
bottom: 150px;
left: 0;
right: 0;
background-color: red;
cursor: n-resize;
margin-left: -40px;
#topIcon {
cursor: pointer;
margin-top: -19px;
width: 38px;
margin-left: 46%;
z-index: 999;
bottom: -381px;
text-align: center;
display: block !important;
}
}
.dt-import-wrapper {
margin: 60px 0;
max-width: 99%;
overflow: auto;
height: calc(~"100% - 35px");
.dropdown {
.dropdown-common();
i {
color: #F85550;
}
}
}
}
.error-list-modal {
.modal-title {
color: #FF0000;
}
.modal-body {
max-height: 300px;
overflow-y: auto;
table {
border: 1px solid #CCC;
thead tr th {
height: 30px;
border: 1px solid #CCC;
}
tbody tr td {
height: 25px;
border: 1px solid #CCC;
}
}
}
.modal-footer {
text-align: center;
}
}
#tab_detail {
display: none;
}
/*覆写ack-pagination.less中:.page-size, .pagination 中的margin演示 */
.page-form-group{
float:right;
.page-size{
margin:0;
}
.pagination {
margin:0;
}
}
}
.tb-model-period-dropdow-popup {
width: 400px;
height: 500px;
position: fixed;
top: 25%;
left: 40%;
.modal-dialog {
width: 100%;
height: 90%;
margin: 20px auto;
.modal-content {
width: 100%;
.modal-body {
height: 90%;
}
}
}
}
#totalWrapper {
margin: 5px 10px 10px -10px;
width: 100%;
padding-left: 10px;
font-family: Microsoft YaHei;
font-size: 13px;
float:right;
.total_span{
color: #B4122A !important;
background-color:#ddd !important;
font-size: 12px !important;
font-weight:bold !important;
border-radius:10px !important;
padding-left: 8px !important;
padding-right: 8px !important;
}
.total-column{
width:15%;
float:left;
padding-left: 15px;
}
}
\ No newline at end of file
......@@ -729,12 +729,9 @@
$('#busy-indicator-container').hide();
deferred.resolve();
if (ret.result) {
// 导入成功
// todo ImportPLStatusGridSource Change
logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto);
SweetAlert.error($translate.instant('ImportSuccess'));
SweetAlert.success($translate.instant('ImportSuccess'));
} else {
if (ret.resultMsg && ret.resultMsg.length > 0) {
SweetAlert.warning($translate.instant(ret.resultMsg));
......@@ -744,7 +741,7 @@
logDto.UpdateState = $translate.instant('ImportFail');
vatOperationLogService.addOperationLog(logDto);
}
getImportBSStatus();
}, function(resp) {
deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') {
......@@ -829,7 +826,7 @@
caption: $translate.instant('id')
}, {
dataField: "taxpayerIdNum",
width: '10%',
width: '15%',
allowHeaderFiltering: false,
caption: $translate.instant('TaxpayerIdNum')
}, {
......@@ -840,27 +837,32 @@
}, {
dataField: "companyName",
allowHeaderFiltering: false,
width: '15%',
width: '27%',
caption: $translate.instant('CompanyName')
}, {
dataField: "yearPeriod",
dataField: "periodYear",
allowHeaderFiltering: false,
width: '20%',
width: '7%',
caption: $translate.instant('YearPeriod')
}, {
dataField: "period",
dataField: "periodMonth",
allowHeaderFiltering: false,
width: '20%',
width: '8%',
caption: $translate.instant('TMSPeriod')
}, {
dataField: "periodMonth",
allowHeaderFiltering: false,
width: '5%',
caption: $translate.instant('Period')
}, {
dataField: "recordSize",
allowHeaderFiltering: false,
width: '10%',
width: '8%',
caption: $translate.instant('RecordSize')
}, {
dataField: "status",
dataField: "errorMsg",
allowHeaderFiltering: false,
width: '10%',
width: '15%',
caption: $translate.instant('Status')
}
],
......@@ -897,10 +899,11 @@
}
}
};
getImportBSStatus();
};
var getImportPLStatus = function () {
orgExtraService.getAccountingRateListByOrgId(orgId).success(function (data) {
var getImportBSStatus = function () {
vatImportService.displayImportLog(constant.importFileType.balanceSheet).success(function (data) {
if (data) {
$scope.ImportPLStatusGridSource = data;
for (var i = 1; i <= $scope.AccountingRateGridSource.length; i++) {
......@@ -911,7 +914,7 @@
};
var initImportPLStatusFromDB = function () {
getImportPLStatus();
getImportBSStatus();
};
//获取验证信息
......@@ -1222,7 +1225,7 @@
loadImportPLStatusInfoDatagrid();
initDatePicker();
$scope.$watch('fileNameWrapper', function (newValue, oldValue) {
$scope.$watch('importExcelFile', function (newValue, oldValue) {
if (newValue !== null && newValue !== oldValue) {
initImportFile(newValue);
}
......
<div class="import-balance-sheet">
<!--标题-->
<div class="nav-wrapper">
<div class="nav-header" ="OffBalanceSheetTitle"></div>
<div class="nav-header" translate="OffBalanceSheetTitle"></div>
<div class="alert alert-warning" style="width:400px;margin-bottom:5px;" ng-show="ImportErrorTab" ng-click="toggleErrorTab()">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>{{errorMsg}}
</div>
<div class="pull-right operation-wrapper">
<span ng-click="refreshTbData()" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" ng-if="showInitTable"><i class="fa fa-refresh" aria-hidden="true"></i>{{'Refresh' | translate}}</span>&nbsp;&nbsp;
<span ng-click="clearTbData()" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" ng-if="showInitTable && hasImportPermission"><i class="fa fa-trash-o" aria-hidden="true"></i>{{'ClearAll' | translate}}</span>&nbsp;&nbsp;
<span ng-click="showOperateLogPop()"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'Remarks' | translate}}</span>
</div>
</div>
<!--导航栏-->
<div id="tab_total">
<form class="form-inline" id="navigationForm" name="navigationForm">
<div class="form-group" ng-style="setButtonWrapStyle()">
<div class="import-wrapper">
<span class="text-bold" translate="InvoiceQJ"></span>:
<div class="period-picker" style="margin-left:10px">
<input type="text" id="periodDatepicker" class="datepicker imp-subheader" style="width:120px;"
readonly="readonly" ng-model="UploadPeriodTime"/>
<i class="fa fa-calendar imp-subheader red-color" style="width:20px;"></i>
</div>
<div ng-show="fileName" style="display:inline-block">
<span title="{{fileName}}">{{'FileName' | translate}}{{fileName | limitString:10}}</span>
</div>
<button type="button" atms-permission permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
ngf-select="" type="file" ng-model="importExcelFile" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" style="margin-right:10px;margin-left:30px">
{{'SelectFile' | translate}}
</button>
<div ng-show="fileName" style="display:inline-block">
<span title="{{fileName}}">{{'FileName' | translate}}{{fileName | limitString:10}}</span>&nbsp;&nbsp;&nbsp;&nbsp;|
<span translate="WorkSheet"></span>
<div class="ui-select-no-border">
<ui-select ng-model="sheetInfo.selectedSheetName" on-select="changeSheet($item)" search-enabled="false" style="width:120px;">
<ui-select-match placeholder="{{'SelectASheet' | translate}}">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="sheetName in sheetData.sheetNameList | propsFilter: {name: $select.search}">
<div title="{{sheetName.name}}" ng-bind-html="sheetName.name | limitString:9"></div>
</ui-select-choices>
</ui-select>
</div>
&nbsp;&nbsp;&nbsp;&nbsp;|
<span translate="StartRowNum"></span>
<input id="StartRowNum" ng-model="startRowNum" type="text" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" />
</div>
<button type="button" atms-permission permission-control-type="ngIf"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="TemplateBtn"
......
......@@ -729,9 +729,6 @@
$('#busy-indicator-container').hide();
deferred.resolve();
if (ret.result) {
// 导入成功
// todo ImportPLStatusGridSource Change
logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess'));
......@@ -744,6 +741,7 @@
logDto.UpdateState = $translate.instant('ImportFail');
vatOperationLogService.addOperationLog(logDto);
}
getImportPLStatus();
}, function(resp) {
deferred.resolve();
......@@ -829,7 +827,7 @@
caption: $translate.instant('id')
}, {
dataField: "taxpayerIdNum",
width: '10%',
width: '15%',
allowHeaderFiltering: false,
caption: $translate.instant('TaxpayerIdNum')
}, {
......@@ -840,27 +838,32 @@
}, {
dataField: "companyName",
allowHeaderFiltering: false,
width: '15%',
width: '27%',
caption: $translate.instant('CompanyName')
}, {
dataField: "yearPeriod",
dataField: "periodYear",
allowHeaderFiltering: false,
width: '20%',
width: '5%',
caption: $translate.instant('YearPeriod')
}, {
dataField: "period",
dataField: "periodMonth",
allowHeaderFiltering: false,
width: '10%',
caption: $translate.instant('TMSPeriod')
}, {
dataField: "periodMonth",
allowHeaderFiltering: false,
width: '20%',
width: '5%',
caption: $translate.instant('Period')
}, {
dataField: "recordSize",
allowHeaderFiltering: false,
width: '10%',
width: '8%',
caption: $translate.instant('RecordSize')
}, {
dataField: "status",
dataField: "errorMsg",
allowHeaderFiltering: false,
width: '10%',
width: '15%',
caption: $translate.instant('Status')
}
],
......@@ -897,14 +900,15 @@
}
}
};
getImportPLStatus();
};
var getImportPLStatus = function () {
vatImportService.displayImportLog(constant.importFileType.profitLoss).success(function (data) {
if (data) {
$scope.ImportPLStatusGridSource = data;
for (var i = 1; i <= $scope.AccountingRateGridSource.length; i++) {
$scope.AccountingRateGridSource[i - 1].index = i;
for (var i = 1; i <= $scope.ImportPLStatusGridSource.length; i++) {
$scope.ImportPLStatusGridSource[i - 1].index = i;
}
}
});
......@@ -1222,7 +1226,7 @@
loadImportPLStatusInfoDatagrid();
initDatePicker();
$scope.$watch('fileNameWrapper', function (newValue, oldValue) {
$scope.$watch('importExcelFile', function (newValue, oldValue) {
if (newValue !== null && newValue !== oldValue) {
initImportFile(newValue);
}
......
......@@ -5,49 +5,26 @@
<div class="alert alert-warning" style="width:400px;margin-bottom:5px;" ng-show="ImportErrorTab" ng-click="toggleErrorTab()">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>{{errorMsg}}
</div>
<div class="pull-right operation-wrapper">
<span ng-click="refreshTbData()" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" ng-if="showInitTable"><i class="fa fa-refresh" aria-hidden="true"></i>{{'Refresh' | translate}}</span>&nbsp;&nbsp;
<span ng-click="clearTbData()" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" ng-if="showInitTable && hasImportPermission"><i class="fa fa-trash-o" aria-hidden="true"></i>{{'ClearAll' | translate}}</span>&nbsp;&nbsp;
<span ng-click="showOperateLogPop()"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'Remarks' | translate}}</span>
</div>
</div>
<!--导航栏-->
<div id="tab_total">
<form class="form-inline" id="navigationForm" name="navigationForm">
<div class="form-group" ng-style="setButtonWrapStyle()">
<div class="import-wrapper">
<span class="text-bold" translate="InvoiceQJ"></span>:
<div class="period-picker" style="margin-left:10px">
<input type="text" id="periodDatepicker" class="datepicker imp-subheader" style="width:120px;"
readonly="readonly" ng-model="UploadPeriodTime"/>
<i class="fa fa-calendar imp-subheader red-color" style="width:20px;"></i>
</div>
<div ng-show="fileName" style="display:inline-block">
<span title="{{fileName}}">{{'FileName' | translate}}{{fileName | limitString:10}}</span>
</div>
<button type="button" atms-permission permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
ngf-select="" type="file" ng-model="importExcelFile" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" style="margin-right:10px;margin-left:30px">
{{'SelectFile' | translate}}
</button>
<div ng-show="fileName" style="display:inline-block">
<span title="{{fileName}}">{{'FileName' | translate}}{{fileName | limitString:10}}</span>&nbsp;&nbsp;&nbsp;&nbsp;|
<span translate="WorkSheet"></span>
<div class="ui-select-no-border">
<ui-select ng-model="sheetInfo.selectedSheetName" on-select="changeSheet($item)" search-enabled="false" style="width:120px;">
<ui-select-match placeholder="{{'SelectASheet' | translate}}">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="sheetName in sheetData.sheetNameList | propsFilter: {name: $select.search}">
<div title="{{sheetName.name}}" ng-bind-html="sheetName.name | limitString:9"></div>
</ui-select-choices>
</ui-select>
</div>
&nbsp;&nbsp;&nbsp;&nbsp;|
<span translate="StartRowNum"></span>
<input id="StartRowNum" ng-model="startRowNum" type="text" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" />
</div>
<button type="button" atms-permission permission-control-type="ngIf"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="TemplateBtn"
......
......@@ -19,7 +19,7 @@
$scope.success = false;
$scope.showErrorTable = false;
$scope.showInitTable = false;
$scope.showImportTable = false
$scope.showImportTable = false;
$scope.isSelectPeriod = true;
$scope.isShowImportTotalBtn = true;
$scope.projectID = vatSessionService.project.id;
......@@ -33,7 +33,7 @@
$scope.selectedPeriod = null;
$scope.showTotalSecondRow = false;
$scope.importPLExcelFile = apiInterceptor.webApiHostUrl + '/DataImport/PLExcelFile';
$scope.importRLITExcelFile = apiInterceptor.webApiHostUrl + '/DataImport/RLITExcelFile';
var date = new Date();
......@@ -55,7 +55,7 @@
ID: '',
OperationName: '',
ModuleID: $scope.moduleid,
OperationObject: $translate.instant('ProfitAndLossStatement'),
OperationObject: $translate.instant('redLetterInformationTable'),
OperationType: '',
OperationContent: '',
OriginalState: '',
......@@ -672,13 +672,10 @@
//导入事件
var doUploadPL = function (importType) {
debugger;
var impExl = $scope.importExcelFile;
var deferred = $q.defer();
var token = $('input[name="__RequestVerificationToken"]').val();
if (!impExl) {
SweetAlert.warning($translate.instant('PleaseSelectFileFirst'));
return;
......@@ -697,24 +694,23 @@
logDto.UpdateTime = new Date();
logDto.OperationContent = $scope.fileName;
if (importType === $scope.importEnum.Import) {
logDto.OperationName = $translate.instant('ImportTrialBalance');
logDto.OperationName = $translate.instant('ImportProfitLoss');
logDto.OperationType = enums.vatLogOperationTypeEnum.Import;
}
else if (importType === $scope.importEnum.CoverImport) {
logDto.OperationName = $translate.instant('CoverImportTrialBalance');
} else if (importType === $scope.importEnum.CoverImport) {
logDto.OperationName = $translate.instant('CoverImportProfitLoss');
logDto.OperationType = enums.vatLogOperationTypeEnum.CoverImport;
}
else if (importType === $scope.importEnum.AddImport) {
logDto.OperationName = $translate.instant('AddImportTrialBalance');
} else if (importType === $scope.importEnum.AddImport) {
logDto.OperationName = $translate.instant('AddImportProfitLoss');
logDto.OperationType = enums.vatLogOperationTypeEnum.AddImport;
}
var period = $scope.UploadPeriodTime;
Upload.upload({
url: $scope.importPLExcelFile,
url: $scope.importRLITExcelFile,
data: {
periodDate : period
periodDate : period,
importType : importType
},
file: impExl,
headers: {
......@@ -730,17 +726,19 @@
$('#busy-indicator-container').hide();
deferred.resolve();
if (ret.result) {
// 导入成功
// todo ImportPLStatusGridSource Change
logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto);
SweetAlert.error($translate.instant('ImportFail'));
SweetAlert.success($translate.instant('ImportSuccess'));
} else {
if (ret.resultMsg && ret.resultMsg.length > 0) {
SweetAlert.warning($translate.instant(ret.resultMsg));
}else{
SweetAlert.error($translate.instant('ImportFailed'));
}
logDto.UpdateState = $translate.instant('ImportFail');
vatOperationLogService.addOperationLog(logDto);
SweetAlert.error($translate.instant('ImportFail'));
}
getImportRLITStatus();
}, function(resp) {
deferred.resolve();
......@@ -812,11 +810,11 @@
return {};
};
var loadImportPLStatusInfoDatagrid = function () {
var loadImportRLITStatusInfoDatagrid = function () {
$scope.importPLStatusGridOptions = {
$scope.importRLITStatusGridOptions = {
bindingOptions: {
dataSource: 'ImportPLStatusGridSource'
dataSource: 'ImportRLITStatusGridSource'
},
showBorders: true,
columns: [{
......@@ -826,7 +824,7 @@
caption: $translate.instant('id')
}, {
dataField: "taxpayerIdNum",
width: '10%',
width: '15%',
allowHeaderFiltering: false,
caption: $translate.instant('TaxpayerIdNum')
}, {
......@@ -837,27 +835,32 @@
}, {
dataField: "companyName",
allowHeaderFiltering: false,
width: '15%',
width: '27%',
caption: $translate.instant('CompanyName')
}, {
dataField: "yearPeriod",
dataField: "periodYear",
allowHeaderFiltering: false,
width: '20%',
width: '5%',
caption: $translate.instant('YearPeriod')
}, {
dataField: "period",
dataField: "periodMonth",
allowHeaderFiltering: false,
width: '10%',
caption: $translate.instant('TMSPeriod')
}, {
dataField: "periodMonth",
allowHeaderFiltering: false,
width: '20%',
width: '5%',
caption: $translate.instant('Period')
}, {
dataField: "recordSize",
allowHeaderFiltering: false,
width: '10%',
width: '8%',
caption: $translate.instant('RecordSize')
}, {
dataField: "status",
dataField: "errorMsg",
allowHeaderFiltering: false,
width: '10%',
width: '15%',
caption: $translate.instant('Status')
}
],
......@@ -894,21 +897,22 @@
}
}
};
getImportRLITStatus();
};
var getImportPLStatus = function () {
orgExtraService.getAccountingRateListByOrgId(orgId).success(function (data) {
var getImportRLITStatus = function () {
vatImportService.displayImportLog(constant.importFileType.redLetterInfoTable).success(function (data) {
if (data) {
$scope.ImportPLStatusGridSource = data;
for (var i = 1; i <= $scope.AccountingRateGridSource.length; i++) {
$scope.AccountingRateGridSource[i - 1].index = i;
$scope.ImportRLITStatusGridSource = data;
for (var i = 1; i <= $scope.ImportRLITStatusGridSource.length; i++) {
$scope.ImportRLITStatusGridSource[i - 1].index = i;
}
}
});
};
var initImportPLStatusFromDB = function () {
getImportPLStatus();
getImportRLITStatus();
};
//获取验证信息
......@@ -1216,10 +1220,10 @@
getUserPermission();
loadImportPLStatusInfoDatagrid();
loadImportRLITStatusInfoDatagrid();
initDatePicker();
$scope.$watch('fileNameWrapper', function (newValue, oldValue) {
$scope.$watch('importExcelFile', function (newValue, oldValue) {
if (newValue !== null && newValue !== oldValue) {
initImportFile(newValue);
}
......
......@@ -5,49 +5,26 @@
<div class="alert alert-warning" style="width:400px;margin-bottom:5px;" ng-show="ImportErrorTab" ng-click="toggleErrorTab()">
<i class="fa fa-exclamation-circle" aria-hidden="true"></i>{{errorMsg}}
</div>
<div class="pull-right operation-wrapper">
<span ng-click="refreshTbData()" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" ng-if="showInitTable"><i class="fa fa-refresh" aria-hidden="true"></i>{{'Refresh' | translate}}</span>&nbsp;&nbsp;
<span ng-click="clearTbData()" atms-permission permission-control-type="ngIf" permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}" ng-if="showInitTable && hasImportPermission"><i class="fa fa-trash-o" aria-hidden="true"></i>{{'ClearAll' | translate}}</span>&nbsp;&nbsp;
<span ng-click="showOperateLogPop()"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'Remarks' | translate}}</span>
</div>
</div>
<!--导航栏-->
<div id="tab_total">
<form class="form-inline" id="navigationForm" name="navigationForm">
<div class="form-group" ng-style="setButtonWrapStyle()">
<div class="import-wrapper">
<span class="text-bold" translate="InvoiceQJ"></span>:
<div class="period-picker" style="margin-left:10px">
<input type="text" id="periodDatepicker" class="datepicker imp-subheader" style="width:120px;"
readonly="readonly" ng-model="UploadPeriodTime"/>
<i class="fa fa-calendar imp-subheader red-color" style="width:20px;"></i>
</div>
<div ng-show="fileName" style="display:inline-block">
<span title="{{fileName}}">{{'FileName' | translate}}{{fileName | limitString:10}}</span>
</div>
<button type="button" atms-permission permission-code="{{$root.vatPermission.dataImport.balanceSheet.importCode}}"
ngf-select="" type="file" ng-model="importExcelFile" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" style="margin-right:10px;margin-left:30px">
{{'SelectFile' | translate}}
</button>
<div ng-show="fileName" style="display:inline-block">
<span title="{{fileName}}">{{'FileName' | translate}}{{fileName | limitString:10}}</span>&nbsp;&nbsp;&nbsp;&nbsp;|
<span translate="WorkSheet"></span>
<div class="ui-select-no-border">
<ui-select ng-model="sheetInfo.selectedSheetName" on-select="changeSheet($item)" search-enabled="false" style="width:120px;">
<ui-select-match placeholder="{{'SelectASheet' | translate}}">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="sheetName in sheetData.sheetNameList | propsFilter: {name: $select.search}">
<div title="{{sheetName.name}}" ng-bind-html="sheetName.name | limitString:9"></div>
</ui-select-choices>
</ui-select>
</div>
&nbsp;&nbsp;&nbsp;&nbsp;|
<span translate="StartRowNum"></span>
<input id="StartRowNum" ng-model="startRowNum" type="text" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" />
</div>
<button type="button" atms-permission permission-control-type="ngIf"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="TemplateBtn"
......@@ -87,7 +64,7 @@
<div class="dt-init-wrapper">
<div class="dx-viewport grid-container">
<div id="importPLStatusGridContainer" dx-data-grid="importPLStatusGridOptions"
<div id="importRLITStatusGridContainer" dx-data-grid="importRLITStatusGridOptions"
style="margin-top: 30px;">
</div>
</div>
......
......@@ -188,7 +188,7 @@
}
}
.importPLStatusGridContainer {
.importRLITStatusGridContainer {
height: calc(~'100% - 30px');
overflow: hidden;
position: absolute;
......
......@@ -1410,7 +1410,9 @@ constant.DepreciationMethodList = [
constant.importFileType = {
undefined: 0,
profitLoss: 1,
balanceSheet: 2
balanceSheet: 2,
redLetterInfoTable: 3,
adjustmentTable: 4
}
......
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