Commit d4cf5f97 authored by gary's avatar gary

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

parents 72475254 b75d1cec
...@@ -31,7 +31,7 @@ public class CitImportExcelController { ...@@ -31,7 +31,7 @@ public class CitImportExcelController {
@RequestMapping(value = "/citImportExcel", method = RequestMethod.POST) @RequestMapping(value = "/citImportExcel", method = RequestMethod.POST)
public @ResponseBody public @ResponseBody
OperationResultDto citImportExcel(@RequestParam MultipartFile file, @RequestParam String orgIds, OperationResultDto citImportExcel(@RequestParam MultipartFile file, @RequestParam(required = false) String orgIds,
@RequestParam String periodDate, @RequestParam String periodDate,
@RequestParam Integer importType, @RequestParam Integer importType,
@RequestParam Integer importFileType){ @RequestParam Integer importFileType){
......
...@@ -156,4 +156,17 @@ public class TemplateGroupController { ...@@ -156,4 +156,17 @@ public class TemplateGroupController {
return OperationResultDto.error(ErrorMessage.SystemError); return OperationResultDto.error(ErrorMessage.SystemError);
} }
@RequestMapping(value = "withoutTemplate", method = RequestMethod.POST)
public @ResponseBody OperationResultDto withoutTemplate(@RequestBody TemplateGroupDto templateGroupDto) {
try {
templateGroupService.addTemplateGroupWithoutTemplate(templateGroupDto);
return OperationResultDto.success();
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
} catch (Exception e) {
logger.error("withoutTemplate error.", e);
}
return OperationResultDto.error(ErrorMessage.SystemError);
}
} }
...@@ -25,6 +25,7 @@ import java.math.BigDecimal; ...@@ -25,6 +25,7 @@ import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class CitImportExcelServiceImpl extends BaseService { public class CitImportExcelServiceImpl extends BaseService {
...@@ -537,7 +538,7 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -537,7 +538,7 @@ public class CitImportExcelServiceImpl extends BaseService {
List<CitDataImportLog> citDataImportLogList = new ArrayList<>(); List<CitDataImportLog> citDataImportLogList = new ArrayList<>();
// Integer period = CitCommonUtil.getPeriod(); // Integer period = CitCommonUtil.getPeriod();
String companyName = CitCommonUtil.getValue(sheet.getRow(5).getCell(1)).toString(); String companyName = CitCommonUtil.getValue(sheet.getRow(5).getCell(1)).toString();
List<Organization> organizations = getOrganizationByName(companyName); List<Organization> organizations = getOrganizationByName(companyName).stream().filter(r->r.getCode()!=null&&!("".equals(r.getCode()))).collect(Collectors.toList());
String companyCode = ""; String companyCode = "";
String orgId = ""; String orgId = "";
String taxPayerId = ""; String taxPayerId = "";
...@@ -547,6 +548,7 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -547,6 +548,7 @@ public class CitImportExcelServiceImpl extends BaseService {
if(!orgList.contains(orgId)){ if(!orgList.contains(orgId)){
saveResult.setResult(false); saveResult.setResult(false);
saveResult.setData(false);
saveResult.setResultMsg(ErrorMessageCN.DoNotSelectCompany); saveResult.setResultMsg(ErrorMessageCN.DoNotSelectCompany);
return saveResult; return saveResult;
} }
...@@ -556,6 +558,7 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -556,6 +558,7 @@ public class CitImportExcelServiceImpl extends BaseService {
}else{ }else{
saveResult.setResult(false); saveResult.setResult(false);
saveResult.setData(false);
saveResult.setResultMsg(ErrorMessageCN.NoCompanyError); saveResult.setResultMsg(ErrorMessageCN.NoCompanyError);
return saveResult; return saveResult;
} }
...@@ -592,7 +595,6 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -592,7 +595,6 @@ public class CitImportExcelServiceImpl extends BaseService {
citDataImportLogList.add(citDataImportLogError); citDataImportLogList.add(citDataImportLogError);
continue; continue;
} }
System.out.println(cellValue);
citBSPrcAdjust.setBegBal(new BigDecimal(cellValue.toString().replace(",",""))); citBSPrcAdjust.setBegBal(new BigDecimal(cellValue.toString().replace(",","")));
...@@ -888,7 +890,7 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -888,7 +890,7 @@ public class CitImportExcelServiceImpl extends BaseService {
citDataImportLogList.add(citDataImportLogError); citDataImportLogList.add(citDataImportLogError);
continue; continue;
} }
String companyCode = cellValueCode.toString(); String companyCode = cellValueCode.toString().replace(".0","");
//根据code(主体)获取机构相关信息 //根据code(主体)获取机构相关信息
List<Organization> organizations = getOrganizationByCode(companyCode); List<Organization> organizations = getOrganizationByCode(companyCode);
String companyName = ""; String companyName = "";
...@@ -969,7 +971,9 @@ public class CitImportExcelServiceImpl extends BaseService { ...@@ -969,7 +971,9 @@ public class CitImportExcelServiceImpl extends BaseService {
citSalaryAdvanceMapper.deleteByExample(example); citSalaryAdvanceMapper.deleteByExample(example);
updateImportLog(EnumCitImportType.SalaryAdvance.getCode()); updateImportLog(EnumCitImportType.SalaryAdvance.getCode());
} }
int insertBatchNum = citSalaryAdvanceMapper.insertBatch(citSalaryAdvanceList); if(citSalaryAdvanceList.size()>0){
int insertBatchNum = citSalaryAdvanceMapper.insertBatch(citSalaryAdvanceList);
}
//循环遍历成功导入的数据,组装日志记录实体并放入集合 //循环遍历成功导入的数据,组装日志记录实体并放入集合
for (Map.Entry<String, Integer> entry : companySuccessMap.entrySet()) { for (Map.Entry<String, Integer> entry : companySuccessMap.entrySet()) {
......
...@@ -9,9 +9,10 @@ import org.slf4j.LoggerFactory; ...@@ -9,9 +9,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.util.BeanUtil; import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.dao.OrganizationAccountingRateMapper; import pwc.taxtech.atms.dao.OrganizationAccountingRateMapper;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.ebsdto.*; import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.entity.OrganizationAccountingRate; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.OrganizationAccountingRateExample;
import pwc.taxtech.atms.service.EbsApiService; import pwc.taxtech.atms.service.EbsApiService;
import pwc.taxtech.atms.vat.dao.*; import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.entity.*; import pwc.taxtech.atms.vat.entity.*;
...@@ -39,6 +40,10 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -39,6 +40,10 @@ public class EbsApiServiceImpl implements EbsApiService {
@Resource @Resource
private OrganizationAccountingRateMapper organizationAccountingRateMapper; private OrganizationAccountingRateMapper organizationAccountingRateMapper;
@Resource @Resource
private OrganizationMapper organizationMapper;
@Resource
private ProjectMapper projectMapper;
@Resource
private DistributedIdService distributedIdService; private DistributedIdService distributedIdService;
@Resource @Resource
private BeanUtil beanUtil; private BeanUtil beanUtil;
...@@ -230,7 +235,10 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -230,7 +235,10 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processTB(TrialBalanceQueryDto item) { private void processTB(TrialBalanceQueryDto item) {
TrialBalanceExample example = new TrialBalanceExample(); TrialBalanceExample example = new TrialBalanceExample();
example.createCriteria().andOrganizationIdEqualTo(item.getOrganizationId()).andPeriodEqualTo(item.getPeriod()); //修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andSegment1EqualTo(item.getSegment1()).andPeriodEqualTo(item.getPeriod());
List<TrialBalance> itemList = trialBalanceMapper.selectByExample(example); List<TrialBalance> itemList = trialBalanceMapper.selectByExample(example);
//唯一则更新否则插入 //唯一则更新否则插入
TrialBalance result = new TrialBalance(); TrialBalance result = new TrialBalance();
...@@ -253,7 +261,10 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -253,7 +261,10 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processCF(CashFlowQueryDto item) { private void processCF(CashFlowQueryDto item) {
CashFlowExample example = new CashFlowExample(); CashFlowExample example = new CashFlowExample();
example.createCriteria().andOrganizationIdEqualTo(item.getOrganizationId()).andPeriodEqualTo(item.getPeriod()); //修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<CashFlow> itemList = cashFlowMapper.selectByExample(example); List<CashFlow> itemList = cashFlowMapper.selectByExample(example);
//唯一则更新否则插入 //唯一则更新否则插入
CashFlow result = new CashFlow(); CashFlow result = new CashFlow();
...@@ -275,7 +286,10 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -275,7 +286,10 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processBS(BalanceSheetQueryDto item) { private void processBS(BalanceSheetQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample(); BalanceSheetExample example = new BalanceSheetExample();
example.createCriteria().andOrganizationIdEqualTo(item.getOrganizationId()).andPeriodEqualTo(item.getPeriod()); //修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example); List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
//唯一则更新否则插入 //唯一则更新否则插入
BalanceSheet result = new BalanceSheet(); BalanceSheet result = new BalanceSheet();
...@@ -295,9 +309,13 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -295,9 +309,13 @@ public class EbsApiServiceImpl implements EbsApiService {
} }
} }
private void processBSprc(BalanceSheetPrcQueryDto item) { private void processBSprc(BalanceSheetPrcQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample(); BalanceSheetExample example = new BalanceSheetExample();
example.createCriteria().andOrganizationIdEqualTo(item.getOrganizationId()).andPeriodEqualTo(item.getPeriod()); //修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example); List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
//唯一则更新否则插入 //唯一则更新否则插入
BalanceSheet result = new BalanceSheet(); BalanceSheet result = new BalanceSheet();
...@@ -319,7 +337,10 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -319,7 +337,10 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processPL(ProfitLossStatementQueryDto item) { private void processPL(ProfitLossStatementQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample(); ProfitLossStatementExample example = new ProfitLossStatementExample();
example.createCriteria().andOrganizationIdEqualTo(item.getOrganizationId()).andPeriodEqualTo(item.getPeriod()); //修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example); List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
//唯一则更新否则插入 //唯一则更新否则插入
ProfitLossStatement result = new ProfitLossStatement(); ProfitLossStatement result = new ProfitLossStatement();
...@@ -341,7 +362,10 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -341,7 +362,10 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processPLprc(ProfitLossStatementPrcQueryDto item) { private void processPLprc(ProfitLossStatementPrcQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample(); ProfitLossStatementExample example = new ProfitLossStatementExample();
example.createCriteria().andOrganizationIdEqualTo(item.getOrganizationId()).andPeriodEqualTo(item.getPeriod()); //修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example); List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
//唯一则更新否则插入 //唯一则更新否则插入
ProfitLossStatement result = new ProfitLossStatement(); ProfitLossStatement result = new ProfitLossStatement();
...@@ -363,7 +387,11 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -363,7 +387,11 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processOAR(OrganizationAccountingRateQueryDto item) { private void processOAR(OrganizationAccountingRateQueryDto item) {
OrganizationAccountingRateExample example = new OrganizationAccountingRateExample(); OrganizationAccountingRateExample example = new OrganizationAccountingRateExample();
example.createCriteria().andOrganizationIdEqualTo(item.getOrganizationId()).andPeriodEqualTo(item.getPeriod()); //修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//TODO 汇率表更新依据未知
//期间
example.createCriteria().andPeriodEqualTo(item.getPeriod());
List<OrganizationAccountingRate> itemList = organizationAccountingRateMapper.selectByExample(example); List<OrganizationAccountingRate> itemList = organizationAccountingRateMapper.selectByExample(example);
//唯一则更新否则插入 //唯一则更新否则插入
OrganizationAccountingRate result = new OrganizationAccountingRate(); OrganizationAccountingRate result = new OrganizationAccountingRate();
...@@ -386,8 +414,8 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -386,8 +414,8 @@ public class EbsApiServiceImpl implements EbsApiService {
private void populateFieldsJE(JournalEntryQueryDto item, JournalEntry result) { private void populateFieldsJE(JournalEntryQueryDto item, JournalEntry result) {
beanUtil.copyProperties(item, result); beanUtil.copyProperties(item, result);
result.setOrganizationId(trimLimit(item.getOrganizationId(), 128)); result.setOrganizationId(getOrganizationByEbsCode(item.getSegment1()).getId());
result.setProjectId(trimLimit(item.getProjectId(), 128)); result.setProjectId(getProjectByEbsCodeAndPeriod(item.getSegment1(),item.getPeriod()).getId());
result.setDate(item.getDate()); result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20)); result.setSource(trimLimit(item.getSource(), 20));
result.setLedgerId(trimLimit(item.getLedgerId(), 128)); result.setLedgerId(trimLimit(item.getLedgerId(), 128));
...@@ -463,8 +491,8 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -463,8 +491,8 @@ public class EbsApiServiceImpl implements EbsApiService {
private void populateFieldsTB(TrialBalanceQueryDto item, TrialBalance result) { private void populateFieldsTB(TrialBalanceQueryDto item, TrialBalance result) {
beanUtil.copyProperties(item, result); beanUtil.copyProperties(item, result);
result.setOrganizationId(trimLimit(item.getOrganizationId(), 128)); result.setOrganizationId(getOrganizationByEbsCode(item.getSegment1()).getId());
result.setProjectId(trimLimit(item.getProjectId(), 128)); result.setProjectId(getProjectByEbsCodeAndPeriod(item.getSegment1(),item.getPeriod()).getId());
result.setDate(item.getDate()); result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20)); result.setSource(trimLimit(item.getSource(), 20));
result.setLedgerId(trimLimit(item.getLedgerId(), 128)); result.setLedgerId(trimLimit(item.getLedgerId(), 128));
...@@ -551,7 +579,8 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -551,7 +579,8 @@ public class EbsApiServiceImpl implements EbsApiService {
private void populateFieldsCF(CashFlowQueryDto item, CashFlow result) { private void populateFieldsCF(CashFlowQueryDto item, CashFlow result) {
beanUtil.copyProperties(item, result); beanUtil.copyProperties(item, result);
result.setOrganizationId(trimLimit(item.getOrganizationId(), 128)); result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate()); result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 128)); result.setSource(trimLimit(item.getSource(), 128));
result.setTmsPeriod(item.getTmsPeriod()); result.setTmsPeriod(item.getTmsPeriod());
...@@ -578,8 +607,8 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -578,8 +607,8 @@ public class EbsApiServiceImpl implements EbsApiService {
private void populateFieldsBS(BalanceSheetQueryDto item, BalanceSheet result) { private void populateFieldsBS(BalanceSheetQueryDto item, BalanceSheet result) {
beanUtil.copyProperties(item, result); beanUtil.copyProperties(item, result);
result.setOrganizationId(trimLimit(item.getOrganizationId(), 128)); result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(trimLimit(item.getProjectId(), 128)); result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate()); result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20)); result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod()); result.setTmsPeriod(item.getTmsPeriod());
...@@ -606,8 +635,8 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -606,8 +635,8 @@ public class EbsApiServiceImpl implements EbsApiService {
private void populateFieldsBSprc(BalanceSheetPrcQueryDto item, BalanceSheet result) { private void populateFieldsBSprc(BalanceSheetPrcQueryDto item, BalanceSheet result) {
beanUtil.copyProperties(item, result); beanUtil.copyProperties(item, result);
result.setOrganizationId(trimLimit(item.getOrganizationId(), 128)); result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(trimLimit(item.getProjectId(), 128)); result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate()); result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20)); result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod()); result.setTmsPeriod(item.getTmsPeriod());
...@@ -634,8 +663,8 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -634,8 +663,8 @@ public class EbsApiServiceImpl implements EbsApiService {
private void populateFieldsPLS(ProfitLossStatementQueryDto item, ProfitLossStatement result) { private void populateFieldsPLS(ProfitLossStatementQueryDto item, ProfitLossStatement result) {
beanUtil.copyProperties(item, result); beanUtil.copyProperties(item, result);
result.setOrganizationId(trimLimit(item.getOrganizationId(), 128)); result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(trimLimit(item.getProjectId(), 128)); result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate()); result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20)); result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod()); result.setTmsPeriod(item.getTmsPeriod());
...@@ -662,8 +691,8 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -662,8 +691,8 @@ public class EbsApiServiceImpl implements EbsApiService {
private void populateFieldsPLSprc(ProfitLossStatementPrcQueryDto item, ProfitLossStatement result) { private void populateFieldsPLSprc(ProfitLossStatementPrcQueryDto item, ProfitLossStatement result) {
beanUtil.copyProperties(item, result); beanUtil.copyProperties(item, result);
result.setOrganizationId(trimLimit(item.getOrganizationId(), 128)); result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(trimLimit(item.getProjectId(), 128)); result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate()); result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20)); result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod()); result.setTmsPeriod(item.getTmsPeriod());
...@@ -690,7 +719,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -690,7 +719,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void populateFieldsOAR(OrganizationAccountingRateQueryDto item, OrganizationAccountingRate result) { private void populateFieldsOAR(OrganizationAccountingRateQueryDto item, OrganizationAccountingRate result) {
beanUtil.copyProperties(item, result); beanUtil.copyProperties(item, result);
result.setOrganizationId(trimLimit(item.getOrganizationId(), 128)); result.setOrganizationId("");
result.setPeriod(item.getPeriod()); result.setPeriod(item.getPeriod());
result.setConvertionType(trimLimit(item.getConvertionType(), 100)); result.setConvertionType(trimLimit(item.getConvertionType(), 100));
result.setCurrencyFrom(trimLimit(item.getCurrencyFrom(), 10)); result.setCurrencyFrom(trimLimit(item.getCurrencyFrom(), 10));
...@@ -700,6 +729,50 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -700,6 +729,50 @@ public class EbsApiServiceImpl implements EbsApiService {
result.setUpdateTime(new Date()); result.setUpdateTime(new Date());
} }
/**对拓展字段进行查询赋值
* 根据Ebs返回的数据机构编码查询到具体机构
* @param code
* @return
*/
private Organization getOrganizationByEbsCode(String code){
OrganizationExample example=new OrganizationExample();
example.createCriteria().andCodeEqualTo(code);
List<Organization> list=organizationMapper.selectByExample(example);
if(list.size()>0){
return list.get(0);
}
return new Organization();
}
/**
* *对拓展字段进行查询赋值
* 根据Ebs返回的数据机构编码和期间查询到具体机构,期间到年yyyy=period/100
* @param code
* @param period
* @return
*/
private Project getProjectByEbsCodeAndPeriod(String code,Integer period){
ProjectExample example=new ProjectExample();
example.createCriteria().andCodeEqualTo(code).andYearEqualTo(period);
List<Project> list=projectMapper.selectByExample(example);
if(list.size()>0){
return list.get(0);
}
return new Project();
}
/**
* 期间格式转换yyyy13均改为yyyy12
* @param period
* @return
*/
private Integer convertPeriod(Integer period){
if(period%100==13){
period--;
}
return period;
}
/** /**
* Trim字符串,并限定字符串的长度. 如果是输入值是空指针,会返回空字符串 * Trim字符串,并限定字符串的长度. 如果是输入值是空指针,会返回空字符串
*/ */
......
...@@ -38,10 +38,8 @@ import pwc.taxtech.atms.entity.TemplateGroup; ...@@ -38,10 +38,8 @@ import pwc.taxtech.atms.entity.TemplateGroup;
import pwc.taxtech.atms.entity.TemplateGroupExample; import pwc.taxtech.atms.entity.TemplateGroupExample;
import pwc.taxtech.atms.exception.ServiceException; import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper; import pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper;
import pwc.taxtech.atms.vat.entity.PeriodCellData;
import pwc.taxtech.atms.vat.entity.PeriodDataSource; import pwc.taxtech.atms.vat.entity.PeriodDataSource;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -527,6 +525,28 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -527,6 +525,28 @@ public class TemplateGroupServiceImpl extends AbstractService {
} }
@Transactional
public void addTemplateGroupWithoutTemplate(TemplateGroupDto templateGroupDto) throws ServiceException {
List<TemplateGroup> groupList = templateGroupDao.getByGroupName(templateGroupDto.getName());
if (CollectionUtils.isNotEmpty(groupList)) {
throw new ServiceException(TemplateMessage.TemplateGroupNameExist);
}
try {
TemplateGroup templateGroup=new TemplateGroup();
CommonUtils.copyProperties(templateGroupDto,templateGroup);
Long newGroupId = distributedIdService.nextId();
Date now = new Date();
templateGroup.setId(newGroupId);
templateGroup.setCreateTime(now);
templateGroup.setUpdateTime(now);
templateGroup.setName(templateGroupDto.getName());
templateGroupMapper.insertSelective(templateGroup);
} catch (Exception e) {
logger.error("addTemplateGroupWithoutTemplate error.", e);
throw new ServiceException(ErrorMessage.SystemError);
}
}
private List<CellTemplateConfig> getByTemplateId(Long id) { private List<CellTemplateConfig> getByTemplateId(Long id) {
CellTemplateConfigExample example = new CellTemplateConfigExample(); CellTemplateConfigExample example = new CellTemplateConfigExample();
CellTemplateConfigExample.Criteria criteria = example.createCriteria(); CellTemplateConfigExample.Criteria criteria = example.createCriteria();
......
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import org.junit.Test; import org.junit.Test;
import pwc.taxtech.atms.CommonIT; import pwc.taxtech.atms.CommonIT;
import pwc.taxtech.atms.dto.ebsdto.JournalEntryQueryDto; import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.service.EbsApiService; import pwc.taxtech.atms.service.EbsApiService;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -25,67 +27,271 @@ public class EbsApiServiceImplTest extends CommonIT { ...@@ -25,67 +27,271 @@ public class EbsApiServiceImplTest extends CommonIT {
journalEntryQueryDto.setOrganizationId("44250A49-F3EF-4A1E-89E0-165BB89A94D0"); journalEntryQueryDto.setOrganizationId("44250A49-F3EF-4A1E-89E0-165BB89A94D0");
journalEntryQueryDto.setProjectId("44250A49-F3EF-4A1E-89E0-165BB89A94D0"); journalEntryQueryDto.setProjectId("44250A49-F3EF-4A1E-89E0-165BB89A94D0");
journalEntryQueryDto.setDate(new Date()); journalEntryQueryDto.setDate(new Date());
journalEntryQueryDto.setSource("这是哪里"+i); journalEntryQueryDto.setSource("来源");
journalEntryQueryDto.setLedgerId("我关联谁"+i); journalEntryQueryDto.setLedgerId("账套ID");
journalEntryQueryDto.setLedgerName("我是谁"+i); journalEntryQueryDto.setLedgerName("账套名称");
journalEntryQueryDto.setCurrencyCode("123"+i); journalEntryQueryDto.setCurrencyCode("账套币种");
journalEntryQueryDto.setStatus("1"); journalEntryQueryDto.setStatus("关账标识");
journalEntryQueryDto.setHeaderId("123456789"); journalEntryQueryDto.setHeaderId("日记账头ID");
journalEntryQueryDto.setLineNum("1"); journalEntryQueryDto.setLineNum("日记账行号");
journalEntryQueryDto.setApprovalStatus("1"); journalEntryQueryDto.setApprovalStatus("审批状态");
journalEntryQueryDto.setPostedStatus("1"); journalEntryQueryDto.setPostedStatus("过账");
journalEntryQueryDto.setPeriod(0); journalEntryQueryDto.setPeriod(20180102+i);
journalEntryQueryDto.setAccountingDate(new Date()); journalEntryQueryDto.setAccountingDate(new Date());
journalEntryQueryDto.setJournalSource("setJournalSource"); journalEntryQueryDto.setJournalSource("日记账来源");
journalEntryQueryDto.setCategory("setCategory"); journalEntryQueryDto.setCategory("日记账类别");
journalEntryQueryDto.setName("setName"); journalEntryQueryDto.setName("日记账名称");
journalEntryQueryDto.setVoucherNum("setVoucherNum"); journalEntryQueryDto.setVoucherNum("凭证编号");
journalEntryQueryDto.setDescription("setDescription"); journalEntryQueryDto.setDescription("摘要");
journalEntryQueryDto.setSegment1("setSegment1"); journalEntryQueryDto.setSegment1("主体代码");
journalEntryQueryDto.setSegment2("setSegment2"); journalEntryQueryDto.setSegment2("成本中心");
journalEntryQueryDto.setSegment3(""); journalEntryQueryDto.setSegment3("科目代码");
journalEntryQueryDto.setSegment4(""); journalEntryQueryDto.setSegment4("辅助科目");
journalEntryQueryDto.setSegment5(""); journalEntryQueryDto.setSegment5("利润中心");
journalEntryQueryDto.setSegment6(""); journalEntryQueryDto.setSegment6("产品");
journalEntryQueryDto.setSegment7(""); journalEntryQueryDto.setSegment7("项目");
journalEntryQueryDto.setSegment8(""); journalEntryQueryDto.setSegment8("公司间");
journalEntryQueryDto.setSegment9(""); journalEntryQueryDto.setSegment9("备用1");
journalEntryQueryDto.setSegment10(""); journalEntryQueryDto.setSegment10("备用2");
journalEntryQueryDto.setSegment1Name(""); journalEntryQueryDto.setSegment1Name("主体说明");
journalEntryQueryDto.setSegment2Name(""); journalEntryQueryDto.setSegment2Name("成本中心说明");
journalEntryQueryDto.setSegment3Name(""); journalEntryQueryDto.setSegment3Name("科目说明");
journalEntryQueryDto.setSegment4Name(""); journalEntryQueryDto.setSegment4Name("辅助科目说明");
journalEntryQueryDto.setSegment5Name(""); journalEntryQueryDto.setSegment5Name("利润中心说明");
journalEntryQueryDto.setSegment6Name(""); journalEntryQueryDto.setSegment6Name("产品说明");
journalEntryQueryDto.setSegment7Name(""); journalEntryQueryDto.setSegment7Name("项目说明");
journalEntryQueryDto.setSegment8Name(""); journalEntryQueryDto.setSegment8Name("公司间说明");
journalEntryQueryDto.setSegment9Name(""); journalEntryQueryDto.setSegment9Name("备用1说明");
journalEntryQueryDto.setSegment10Name(""); journalEntryQueryDto.setSegment10Name("备用2说明");
journalEntryQueryDto.setJournalCurrencyCode(""); journalEntryQueryDto.setJournalCurrencyCode("币种");
journalEntryQueryDto.setSobCurrencyCode(""); journalEntryQueryDto.setSobCurrencyCode("本位币币种");
journalEntryQueryDto.setAccountedDr(new BigDecimal("0")); journalEntryQueryDto.setAccountedDr(new BigDecimal("123"));
journalEntryQueryDto.setAccountedCr(new BigDecimal("0")); journalEntryQueryDto.setAccountedCr(new BigDecimal("120.2"));
journalEntryQueryDto.setEnteredDr(new BigDecimal("0")); journalEntryQueryDto.setEnteredDr(new BigDecimal("1231.0231"));
journalEntryQueryDto.setEnteredCr(new BigDecimal("0")); journalEntryQueryDto.setEnteredCr(new BigDecimal("120.122"));
journalEntryQueryDto.setCfItem(""); journalEntryQueryDto.setCfItem("现金流量表项");
journalEntryQueryDto.setAttribute1(""); journalEntryQueryDto.setAttribute1("城市");
journalEntryQueryDto.setAttribute2(new Date()); journalEntryQueryDto.setAttribute2(new Date());
journalEntryQueryDto.setAttribute3(""); journalEntryQueryDto.setAttribute3("对方银行账号");
journalEntryQueryDto.setAttribute4(""); journalEntryQueryDto.setAttribute4("银行流水号");
journalEntryQueryDto.setAttribute5(""); journalEntryQueryDto.setAttribute5("供应商编号");
journalEntryQueryDto.setAttribute6(""); journalEntryQueryDto.setAttribute6("交易单号");
journalEntryQueryDto.setAttribute7(""); journalEntryQueryDto.setAttribute7("供应商名称");
journalEntryQueryDto.setAttribute8(""); journalEntryQueryDto.setAttribute8("接收编码");
journalEntryQueryDto.setAttribute9(""); journalEntryQueryDto.setAttribute9("制单人");
journalEntryQueryDto.setAttribute10(""); journalEntryQueryDto.setAttribute10("审核人");
journalEntryQueryDto.setAttribute11(""); journalEntryQueryDto.setAttribute11("成本中心部门描述1");
journalEntryQueryDto.setAttribute12(""); journalEntryQueryDto.setAttribute12("成本中心部门描述2");
journalEntryQueryDto.setAttribute13(""); journalEntryQueryDto.setAttribute13("成本中心部门描述3");
journalEntryQueryDto.setAttribute14(""); journalEntryQueryDto.setAttribute14("成本中心部门描述4");
journalEntryQueryDto.setAttribute15(""); journalEntryQueryDto.setAttribute15("成本中心部门描述5");
journalEntryQueryDto.setAttribute16(""); journalEntryQueryDto.setAttribute16("成本中心部门描述6");
items.add(journalEntryQueryDto); items.add(journalEntryQueryDto);
} }
ebsApiService.queryRemoteServerThenUpdateJE(items); String a=JSON.toJSONString(items);
System.out.println(a);
//ebsApiService.queryRemoteServerThenUpdateJE(items);
}
@Test
public void queryRemoteServerThenUpdateTB() {
List<TrialBalanceQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
TrialBalanceQueryDto result = new TrialBalanceQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201803);
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setCurrencyCode("账套币种");
result.setStatus("关账标识");
result.setCategory("主体性质");
result.setAccountCategory("科目性质");
result.setAcctCode1("一级科目代码");
result.setAcctName1("一级科目说明");
result.setAcctName2("二级科目说明");
result.setAcctName3("三级科目说明");
result.setSegment1("主体代码");
result.setSegment2("成本中心代码");
result.setSegment3("科目代码");
result.setSegment4("辅助科目代码");
result.setSegment5("利润中心代码");
result.setSegment6("产品代码");
result.setSegment7("项目代码");
result.setSegment8("公司间代码");
result.setSegment9("备用1代码");
result.setSegment10("备用2代码");
result.setSegment1Name("主体说明");
result.setSegment2Name("成本中心说明");
result.setSegment3Name("科目说明");
result.setSegment4Name("辅助科目说明");
result.setSegment5Name("利润中心说明");
result.setSegment6Name("产品说明");
result.setSegment7Name("项目说明");
result.setSegment8Name("公司间说明");
result.setSegment9Name("备用1说明");
result.setSegment10Name("备用2说明");
result.setBegBal(new BigDecimal("110"));
result.setPeriodDr(new BigDecimal("110"));
result.setPeriodCr(new BigDecimal("110"));
result.setEndBal(new BigDecimal("110"));
result.setQtdDr(new BigDecimal("110"));
result.setQtdCr(new BigDecimal("110"));
result.setYtdDr(new BigDecimal("110"));
result.setYtdCr(new BigDecimal("110"));
result.setBegBalBeq(new BigDecimal("110"));
result.setPeriodDrBeq(new BigDecimal("110"));
result.setPeriodCrBeq(new BigDecimal("110"));
result.setEndBalBeq(new BigDecimal("110"));
result.setQtdDrBeq(new BigDecimal("110"));
result.setQtdCrBeq(new BigDecimal("110"));
result.setYtdDrBeq(new BigDecimal("110"));
result.setYtdCrBeq(new BigDecimal("110"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateCF() {
List<CashFlowQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
CashFlowQueryDto result = new CashFlowQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201803);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目中文名称");
result.setItemName2("项目英文名称");
result.setPeriodAmt(new BigDecimal("1000.0454"));
result.setYtdAmt(new BigDecimal("1000.0454"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateBS() {
List<BalanceSheetQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
BalanceSheetQueryDto result = new BalanceSheetQueryDto();
result.setDate(new Date());
result.setPeriod(201812);
result.setStatus("关账标识");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setItemName("项目名称");
result.setEndBal(new BigDecimal("1220.2980"));
result.setBegBal(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateBSprc() {
List<BalanceSheetPrcQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
BalanceSheetPrcQueryDto result = new BalanceSheetPrcQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201804);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setEndBal(new BigDecimal("1220.2980"));
result.setBegBal(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdatePL() {
List<ProfitLossStatementQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
ProfitLossStatementQueryDto result = new ProfitLossStatementQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201904);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setPeriodAmt(new BigDecimal("1220.2980"));
result.setYtdAmt(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdatePLprc() {
List<ProfitLossStatementPrcQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
ProfitLossStatementPrcQueryDto result = new ProfitLossStatementPrcQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201905);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setPeriodAmt(new BigDecimal("1220.2980"));
result.setYtdAmt(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateOAR() {
List<OrganizationAccountingRateQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
OrganizationAccountingRateQueryDto result = new OrganizationAccountingRateQueryDto();
result.setPeriod(2018);
result.setConvertionType("汇率类型名称");
result.setCurrencyFrom("原币种");
result.setCurrencyTo("目标币种");
result.setStartDate(new Date());
result.setEndDate(new Date());
result.setRate(3.4f);
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
} }
} }
\ No newline at end of file
...@@ -106,5 +106,5 @@ public interface CitSalaryAdvanceMapper extends MyMapper { ...@@ -106,5 +106,5 @@ public interface CitSalaryAdvanceMapper extends MyMapper {
*/ */
int updateByPrimaryKey(CitSalaryAdvance record); int updateByPrimaryKey(CitSalaryAdvance record);
int insertBatch(List<CitSalaryAdvance> citSalaryAdvanceList); int insertBatch(List<CitSalaryAdvance> list);
} }
\ No newline at end of file
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<otherwise>0,</otherwise> <otherwise>0,</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.createBy != null">#{item.createdBy,jdbcType=VARCHAR},</when> <when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose> <choose>
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<otherwise>0,</otherwise> <otherwise>0,</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.createBy != null">#{item.createdBy,jdbcType=VARCHAR},</when> <when test="item.createBy != null">#{item.createBy,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose> <choose>
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
<otherwise>'',</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.poNo != null">#{item.poNo,jdbcType=INTEGER},</when> <when test="item.poNo != null">#{item.poNo,jdbcType=VARCHAR},</when>
<otherwise>0,</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose> <choose>
<when test="item.poSubjectCode != null">#{item.poSubjectCode,jdbcType=VARCHAR},</when> <when test="item.poSubjectCode != null">#{item.poSubjectCode,jdbcType=VARCHAR},</when>
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
<select id="getTemplateUniqDtosByTemplateAndTemplateGroup" parameterType="map" resultMap="TemplateUniqDto"> <select id="getTemplateUniqDtosByTemplateAndTemplateGroup" parameterType="map" resultMap="TemplateUniqDto">
SELECT SELECT
P.id as ID, P.id as ID,
p.code as Code, P.code as Code,
p.name as Name, P.name as Name,
P.report_type as ReportType, P.report_type as ReportType,
Q.id AS TEMPLATE_GROUP_ID, Q.id AS TEMPLATE_GROUP_ID,
Q.name AS TEMPLATE_GROUP_NAME, Q.name AS TEMPLATE_GROUP_NAME,
......
...@@ -120,18 +120,14 @@ ...@@ -120,18 +120,14 @@
defaultValue = find; defaultValue = find;
$scope.templateGroupId = find.id; $scope.templateGroupId = find.id;
} }
else {
$scope.curTemplateGroup = null;
}
} }
dxControl.renderTemplateGroupDropDown(templateGroupData, defaultValue); dxControl.renderTemplateGroupDropDown(templateGroupData, defaultValue);
loadReportType();
if (templateGroupData && templateGroupData.length > 0) {
loadReportType();
} else {
$('#dx-select-template-groups').dxDropDownBox('instance').option('dataSource', []);
$('#dx-select-template').dxDropDownBox('instance').option('dataSource', []);
}
}); });
} }
}; };
...@@ -147,39 +143,48 @@ ...@@ -147,39 +143,48 @@
} }
}; };
if ($scope.curTemplateGroup && $scope.curTemplateGroup.id) { if ($scope.curServiceTypeId === enums.serviceType.VAT) {
if ($scope.curServiceTypeId === enums.serviceType.CIT) { $scope.detailReportTypeList = angular.copy(defaultReportTypeOpt);
$scope.detailReportTypeList = angular.copy(defaultReportTypeOpt); var ds = _.filter(citReportTypeList, function (item) { return item.value == 1 || item.value == 3 || item.value == 4 });
$scope.detailReportTypeList.dataSource = new DevExpress.data.ArrayStore({ $scope.detailReportTypeList.dataSource = new DevExpress.data.ArrayStore({
data: citReportTypeList data: ds
}); });
$scope.detailReportTypeList.value = citReportTypeList[0].name; $scope.detailReportTypeList.value = citReportTypeList[0].name;
$('#dx-select-report-type').dxSelectBox('instance').option($scope.detailReportTypeList); $('#dx-select-report-type').dxSelectBox('instance').option($scope.detailReportTypeList);
$scope.reportType = citReportTypeList[0]; $scope.reportType = citReportTypeList[0];
listTemplates(); listTemplates();
} else if ($scope.curServiceTypeId === enums.serviceType.CF) {
$scope.detailReportTypeList = angular.copy(defaultReportTypeOpt); } else if ($scope.curServiceTypeId === enums.serviceType.CIT) {
$scope.detailReportTypeList.dataSource = new DevExpress.data.ArrayStore({ $scope.detailReportTypeList = angular.copy(defaultReportTypeOpt);
data: cfReportTypeList $scope.detailReportTypeList.dataSource = new DevExpress.data.ArrayStore({
}); data: citReportTypeList
$scope.detailReportTypeList.value = cfReportTypeList[1].name; });
$('#dx-select-report-type').dxSelectBox('instance').option($scope.detailReportTypeList); $scope.detailReportTypeList.value = citReportTypeList[0].name;
$scope.reportType = cfReportTypeList[1]; $('#dx-select-report-type').dxSelectBox('instance').option($scope.detailReportTypeList);
listTemplates(); $scope.reportType = citReportTypeList[0];
} else if ($scope.curServiceTypeId === enums.serviceType.Others) { listTemplates();
$scope.detailReportTypeList = angular.copy(defaultReportTypeOpt); } else if ($scope.curServiceTypeId === enums.serviceType.CF) {
$scope.detailReportTypeList.dataSource = new DevExpress.data.ArrayStore({ $scope.detailReportTypeList = angular.copy(defaultReportTypeOpt);
data: citReportTypeList $scope.detailReportTypeList.dataSource = new DevExpress.data.ArrayStore({
}); data: cfReportTypeList
$scope.detailReportTypeList.value = citReportTypeList[0].name; });
$('#dx-select-report-type').dxSelectBox('instance').option($scope.detailReportTypeList); $scope.detailReportTypeList.value = cfReportTypeList[1].name;
$scope.reportType = citReportTypeList[0]; $('#dx-select-report-type').dxSelectBox('instance').option($scope.detailReportTypeList);
listTemplates(); $scope.reportType = cfReportTypeList[1];
} else { listTemplates();
$('#dx-select-report-type').dxSelectBox('instance').option('dataSource', []); } else if ($scope.curServiceTypeId === enums.serviceType.Others) {
$scope.reportType = null; $scope.detailReportTypeList = angular.copy(defaultReportTypeOpt);
listTemplates(); $scope.detailReportTypeList.dataSource = new DevExpress.data.ArrayStore({
} data: citReportTypeList
});
$scope.detailReportTypeList.value = citReportTypeList[0].name;
$('#dx-select-report-type').dxSelectBox('instance').option($scope.detailReportTypeList);
$scope.reportType = citReportTypeList[0];
listTemplates();
} else {
$('#dx-select-report-type').dxSelectBox('instance').option('dataSource', []);
$scope.reportType = null;
listTemplates();
} }
}; };
...@@ -315,31 +320,41 @@ ...@@ -315,31 +320,41 @@
//加载'报表'源数据 //加载'报表'源数据
var listTemplates = function () { var listTemplates = function () {
templateGroupService.getTemplateList($scope.curTemplateGroup.id, $scope.reportType && $scope.reportType.value).success(function (templateData) { if ($scope.curTemplateGroup && $scope.curTemplateGroup.id) {
templateGroupService.getTemplateList($scope.curTemplateGroup.id, $scope.reportType && $scope.reportType.value).success(function (templateData) {
templateData = _.filter(templateData, function (row) {
return row.isActiveAssociation;
});
var defaultValue = templateData[0]; templateData = _.filter(templateData, function (row) {
if ($scope.currentTemplate && ($scope.currentTemplate.name || $scope.currentTemplate.id)) { return row.isActiveAssociation;
var find = _.find(templateData, function (row) {
return row.name === $scope.currentTemplate.name || row.id === $scope.currentTemplate;
}); });
if (find) { var defaultValue = templateData[0];
defaultValue = find; if ($scope.currentTemplate && ($scope.currentTemplate.name || $scope.currentTemplate.id)) {
var find = _.find(templateData, function (row) {
return row.name === $scope.currentTemplate.name || row.id === $scope.currentTemplate;
});
if (find) {
defaultValue = find;
}
else {
$scope.currentTemplate = null;
}
} }
}
$scope.templates = templateData; //当前组下的所有模板数据 $scope.templates = templateData; //当前组下的所有模板数据
dxControl.renderTemplateDropDown(templateData, defaultValue); dxControl.renderTemplateDropDown(templateData, defaultValue);
//配置报表下拉框 //配置报表下拉框
if (templateData && templateData.length > 0) { if (templateData && templateData.length > 0) {
$scope.ToggleSaveAs = showSavebutton(); $scope.ToggleSaveAs = showSavebutton();
} }
}); });
}
else {
$('#dx-select-template-groups').dxDropDownBox('instance').option('dataSource', []);
$scope.templates.length = 0;
$scope.currentTemplate = null;
}
}; };
//模板不是默认模板才可以编辑和保存 //模板不是默认模板才可以编辑和保存
var showSavebutton = function () { var showSavebutton = function () {
......
...@@ -28,15 +28,15 @@ ...@@ -28,15 +28,15 @@
<div class="templates-top"> <div class="templates-top">
<div class="form-group"> <div class="form-group">
<span class="tab-content-select-lable" ng-show="curServiceTypeId !=='12'">{{'IndustryColon' | translate}}</span> <span class="tab-content-select-lable" ng-show="curServiceTypeId !=='12'">{{'IndustryColon' | translate}}</span>
<div id="dx-select-industry" class="tab-content-select industry col-md-2" ng-show="curServiceTypeId !=='12'" dx-select-box="dataSourceIndustryList" <div id="dx-select-industry" class="tab-content-select industry col-md-2" ng-show="curServiceTypeId !=='12'"
dx-item-alias="itemObj"> dx-select-box="dataSourceIndustryList" dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'industryItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}"> <div data-options="dxTemplate: { name: 'industryItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}} {{itemObj.name}}
</div> </div>
</div> </div>
<span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '2'"></span> <span class="tab-content-select-lable" ng-show="curServiceTypeId === '2'">{{'Ratepayer' | translate}}:</span>
<div class="tab-content-select reportType col-md-2" id="dx-select-pay-tax-type" ng-show="curServiceTypeId === '2'" dx-select-box="dataSourcePayTaxTypeList" <div class="tab-content-select reportType col-md-2" id="dx-select-pay-tax-type" ng-show="curServiceTypeId === '2'"
dx-item-alias="itemObj"> dx-select-box="dataSourcePayTaxTypeList" dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'filingTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}"> <div data-options="dxTemplate: { name: 'filingTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}} {{itemObj.name}}
</div> </div>
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
<span class="tab-content-select-lable">{{'SelectTemplateGroup' | translate}}</span> <span class="tab-content-select-lable">{{'SelectTemplateGroup' | translate}}</span>
<div class="tab-content-select selectTemplateGroup col-md-2" id="dx-select-template-groups"> <div class="tab-content-select selectTemplateGroup col-md-2" id="dx-select-template-groups">
</div> </div>
<span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'"></span> <span class="tab-content-select-lable" translate="ReportType" ng-show="curServiceTypeId === '2' ||curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'"></span>
<div class="tab-content-select reportType col-md-2" id="dx-select-report-type" ng-show="curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'" <div class="tab-content-select reportType col-md-2" id="dx-select-report-type" ng-show="curServiceTypeId === '2' ||curServiceTypeId === '6' || curServiceTypeId === '11' || curServiceTypeId === '99'"
dx-select-box="detailReportTypeList" dx-item-alias="itemObj"> dx-select-box="detailReportTypeList" dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'reportTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}"> <div data-options="dxTemplate: { name: 'reportTypeItem' }" class="dx-item-content dx-list-item-content" title="{{itemObj.name}}">
{{itemObj.name}} {{itemObj.name}}
</div> </div>
......
...@@ -240,15 +240,15 @@ ...@@ -240,15 +240,15 @@
} }
&.reportType { &.reportType {
width: 130px; width: 120px;
} }
&.selectTemplateGroup { &.selectTemplateGroup {
width: 200px; width: 150px;
} }
&.selectReport { &.selectReport {
width: 200px; width: 150px;
} }
} }
} }
......
commonModule. commonModule.
controller('editTemplateModalController', ['$scope', '$log', '$translate', '$location', '$timeout', '$interval', '$filter', controller('editTemplateModalController', ['$scope', '$log', '$translate', '$location', '$timeout', '$interval', '$filter',
'SweetAlert', '$uibModal', 'apiInterceptor', '$q', 'Upload', 'templateGroupService', 'enums', 'SweetAlert', '$uibModal', 'apiInterceptor', '$q', 'Upload', 'templateGroupService', 'enums',
function ($scope, $log, $translate, $location, $timeout, $interval, $filter, SweetAlert, $uibModal, apiInterceptor, $q, function ($scope, $log, $translate, $location, $timeout, $interval, $filter, SweetAlert, $uibModal, apiInterceptor, $q,
Upload, templateGroupService, enums) { Upload, templateGroupService, enums) {
var thisConstant = { var thisConstant = {
sheetSelectDxID: window.PWC.newGuid(), sheetSelectDxID: window.PWC.newGuid(),
sheetDxTreeID: window.PWC.newGuid(), sheetDxTreeID: window.PWC.newGuid(),
// 查找现有报表模板 // 查找现有报表模板
findSheetDxDropID: window.PWC.newGuid(), findSheetDxDropID: window.PWC.newGuid(),
findSheetDxTreeID: window.PWC.newGuid(), findSheetDxTreeID: window.PWC.newGuid(),
searchBoxDivId: window.PWC.newGuid(), searchBoxDivId: window.PWC.newGuid(),
// get sheetName list // get sheetName list
uploadUrl: apiInterceptor.webApiHostUrl + '/templateGroup/getSheetNameList', uploadUrl: apiInterceptor.webApiHostUrl + '/templateGroup/getSheetNameList',
// resumable:true, // resumable:true,
getSheetNameListError: '获取Sheet下拉列表失败', getSheetNameListError: '获取Sheet下拉列表失败',
getSheetNameTitle: '解析Excel', getSheetNameTitle: '解析Excel',
allSheets: '所有报表', allSheets: '所有报表',
pleaseSelectFile: '请选择文件', pleaseSelectFile: '请选择文件',
pleaseSelectTemplate: '请选择报表', pleaseSelectTemplate: '请选择报表',
deleteSuccess: '删除成功', deleteSuccess: '删除成功',
// 上传报表路径 // 上传报表路径
importTemplateExcelFile: apiInterceptor.webApiHostUrl + '/templateGroup/importTemplateExcelFile', importTemplateExcelFile: apiInterceptor.webApiHostUrl + '/templateGroup/importTemplateExcelFile',
// 是否是第一次画sheet 的dropdown // 是否是第一次画sheet 的dropdown
isFirstDrawDxDropDown: true, isFirstDrawDxDropDown: true,
underLineSeparator: '_', underLineSeparator: '_',
codeReg: /^[a-zA-Z0-9\.]*$/, codeReg: /^[a-zA-Z0-9\.]*$/,
codeError: 'code必须为英文字母或者数字', codeError: 'code必须为英文字母或者数字',
}; };
var thisData = { var thisData = {
// 所有 sheet Name的数组 // 所有 sheet Name的数组
sheetNameList: [], sheetNameList: [],
// 所有sheet name 的列表[{id:1, name:'sheet名称'}] // 所有sheet name 的列表[{id:1, name:'sheet名称'}]
sheetNameObjList: [], sheetNameObjList: [],
sheetTreeView: null, sheetTreeView: null,
// dropdown的显示文字 // dropdown的显示文字
sheetText: thisConstant.allSheets, sheetText: thisConstant.allSheets,
selectSheetNameList: [], selectSheetNameList: [],
// 查找现有报表,选择的报表列表 // 查找现有报表,选择的报表列表
selectTemplateCodeList: [], selectTemplateCodeList: [],
findSheetTreeView: null findSheetTreeView: null
}; };
var thisDataService = { var thisDataService = {
newModel: function() { newModel: function() {
var editModel = {}; var editModel = {};
editModel.sheetSelectDxID = thisConstant.sheetSelectDxID; editModel.sheetSelectDxID = thisConstant.sheetSelectDxID;
editModel.templateGroupID = $scope.templateModel.templateGroupID; editModel.templateGroupID = $scope.templateModel.templateGroupID;
editModel.addExists = true; editModel.addExists = true;
editModel.findSheetDxDropID = thisConstant.findSheetDxDropID; editModel.findSheetDxDropID = thisConstant.findSheetDxDropID;
editModel.reportType = $scope.templateModel.reportType; editModel.reportType = $scope.templateModel.reportType;
return editModel; return editModel;
}, },
// 获取sheet列表 // 获取sheet列表
getSheetList: function() { getSheetList: function() {
if (!$scope.editModel || !$scope.editModel.file) { if (!$scope.editModel || !$scope.editModel.file) {
return; return;
} }
var deferred = $q.defer(); var deferred = $q.defer();
var tempFileName = PWC.newGuid() + '.dat'; var tempFileName = PWC.newGuid() + '.dat';
var token = $('input[name="__RequestVerificationToken"]').val(); var token = $('input[name="__RequestVerificationToken"]').val();
$('#busy-indicator-container').show(); $('#busy-indicator-container').show();
Upload.upload({ Upload.upload({
url: thisConstant.uploadUrl, url: thisConstant.uploadUrl,
data: { data: {
allowManual: $('#allowManual').is(':checked'), allowManual: $('#allowManual').is(':checked'),
filename: $scope.editModel.file.name, filename: $scope.editModel.file.name,
tempFileName: tempFileName, tempFileName: tempFileName,
}, },
file: $scope.editModel.file, file: $scope.editModel.file,
// resumeChunkSize: resumable ? $scope.chunkSize : null, // resumeChunkSize: resumable ? $scope.chunkSize : null,
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(), Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
__RequestVerificationToken: token, __RequestVerificationToken: token,
withCredentials: true withCredentials: true
}, },
__RequestVerificationToken: token, __RequestVerificationToken: token,
withCredentials: true withCredentials: true
}).then(function(resp) { }).then(function(resp) {
var ret = resp.data; var ret = resp.data;
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (ret.result) { if (ret.result) {
// 导入成功 // 导入成功
thisData.sheetNameList = ret.data; thisData.sheetNameList = ret.data;
thisData.sheetNameObjList = thisDataService.parseSheetNameObjList(ret.data); thisData.sheetNameObjList = thisDataService.parseSheetNameObjList(ret.data);
// thisDataService.refreshSheetNameDropDownList(thisData.sheetNameObjList); // thisDataService.refreshSheetNameDropDownList(thisData.sheetNameObjList);
thisDataService.drawSheetNameDropDownList(); thisDataService.drawSheetNameDropDownList();
} else { } else {
if (ret.resultMsg && ret.resultMsg.length > 0) { if (ret.resultMsg && ret.resultMsg.length > 0) {
SweetAlert.warning($translate.instant(ret.resultMsg)); SweetAlert.warning($translate.instant(ret.resultMsg));
} else { } else {
SweetAlert.swal({ SweetAlert.swal({
title: thisConstant.getSheetNameTitle, title: thisConstant.getSheetNameTitle,
text: thisConstant.getSheetNameListError, text: thisConstant.getSheetNameListError,
type: "info", type: "info",
showCancelButton: false, showCancelButton: false,
closeOnConfirm: false, closeOnConfirm: false,
closeOnCancel: true, closeOnCancel: true,
html: true html: true
}); });
} }
} }
}, function(resp) { }, function(resp) {
deferred.resolve(); deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') { if (resp.statusText === 'HttpRequestValidationException') {
SweetAlert.warning($translate.instant('HttpRequestValidationException')); SweetAlert.warning($translate.instant('HttpRequestValidationException'));
} else { } else {
SweetAlert.warning('SaveFail'); SweetAlert.warning('SaveFail');
} }
console.log('Error status: ' + resp.status); console.log('Error status: ' + resp.status);
}, function(evt) { }, function(evt) {
deferred.resolve(); deferred.resolve();
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
$log.debug('progress: ' + progressPercentage + '% ' + evt.config.data.file.name); $log.debug('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
}); });
}, },
// 验证Template 的code list 必须为英文字母或者数字 // 验证Template 的code list 必须为英文字母或者数字
validateTemplateCodeList: function(data) { validateTemplateCodeList: function(data) {
if (data && data.length > 0) { if (data && data.length > 0) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
if (!thisDataService.validateTemplateCode(data[i])) { if (!thisDataService.validateTemplateCode(data[i])) {
return data[i] + thisConstant.codeError; return data[i] + thisConstant.codeError;
} }
} }
} }
return null; return null;
}, },
// 验证Template 的code 必须为英文字母或者数字 // 验证Template 的code 必须为英文字母或者数字
validateTemplateCode: function(value) { validateTemplateCode: function(value) {
// body... // body...
var arr = value.split(thisConstant.underLineSeparator); var arr = value.split(thisConstant.underLineSeparator);
if (arr && arr.length > 0) { if (arr && arr.length > 0) {
// code必须为英文字母或者数字 // code必须为英文字母或者数字
if (!thisConstant.codeReg.test(arr[0])) { if (!thisConstant.codeReg.test(arr[0])) {
return false; return false;
} }
} }
return true; return true;
}, },
// 转换sheet obj List // 转换sheet obj List
parseSheetNameObjList: function(data) { parseSheetNameObjList: function(data) {
var ret = []; var ret = [];
if (data && data.length > 0) { if (data && data.length > 0) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var row = data[i]; var row = data[i];
var item = { var item = {
name: row, name: row,
}; };
item.id = row; item.id = row;
ret.push(item); ret.push(item);
} }
} }
return ret; return ret;
}, },
// 绘制sheet drop down list // 绘制sheet drop down list
drawSheetNameDropDownList: function() { drawSheetNameDropDownList: function() {
thisData.dxTreeViewDiv = '<div class="tree-view-list margin-sheet" id="' + thisConstant.sheetDxTreeID + '">'; thisData.dxTreeViewDiv = '<div class="tree-view-list margin-sheet" id="' + thisConstant.sheetDxTreeID + '">';
$("#" + thisConstant.sheetSelectDxID).dxDropDownBox({ $("#" + thisConstant.sheetSelectDxID).dxDropDownBox({
value: [], value: [],
valueExpr: "id", valueExpr: "id",
displayExpr: "name", displayExpr: "name",
// text: thisConstant.allSheets, // text: thisConstant.allSheets,
showClearButton: false, showClearButton: false,
noDataText: '', noDataText: '',
dataSource: thisData.sheetNameObjList, dropDownOptions: { maxHeight: '310px' },
contentTemplate: function(e) { dataSource: thisData.sheetNameObjList,
var value = e.component.option("value"), contentTemplate: function(e) {
$treeView = $(thisData.dxTreeViewDiv).dxTreeView({ var value = e.component.option("value"),
dataSource: e.component.option("dataSource"), $treeView = $(thisData.dxTreeViewDiv).dxTreeView({
dataStructure: "plain", dataSource: e.component.option("dataSource"),
keyExpr: "id", dataStructure: "plain",
parentIdExpr: "parentID", keyExpr: "id",
selectionMode: "multiple", parentIdExpr: "parentID",
displayExpr: "name", selectionMode: "multiple",
selectByClick: true, displayExpr: "name",
noDataText: '', selectByClick: true,
expandAllEnabled: true, noDataText: '',
selectNodesRecursive: true, expandAllEnabled: true,
showCheckBoxesMode: "selectAll", selectNodesRecursive: true,
showCheckBoxesMode: "selectAll",
selectAllText: '全部',
onSelectionChanged: function(args) { selectAllText: '全部',
var value = args.component.getSelectedNodesKeys(); onSelectionChanged: function(args) {
thisData.selectSheetNameList = value; var value = args.component.getSelectedNodesKeys();
e.component.option("value", value); thisData.selectSheetNameList = value;
} e.component.option("value", value);
}); }
});
thisData.sheetTreeView = $treeView.dxTreeView("instance");
thisData.sheetText = e.component.option("text"); thisData.sheetTreeView = $treeView.dxTreeView("instance");
thisData.sheetText = e.component.option("text");
e.component.on("valueChanged", function(args) {
e.component.on("valueChanged", function(args) {
// var value = args.value;
// syncTreeViewSelection(thisData.sheetTreeView, value); // var value = args.value;
}); // syncTreeViewSelection(thisData.sheetTreeView, value);
});
return $treeView;
} return $treeView;
}); }
}, });
},
// 上传报表
save: function(modalInstance) { // 上传报表
if (!$scope.editModel || !$scope.editModel.file) { save: function(modalInstance) {
SweetAlert.warning(thisData.pleaseSelectFile); if (!$scope.editModel || !$scope.editModel.file) {
SweetAlert.warning(thisData.pleaseSelectFile);
return; return;
} }
var deferred = $q.defer(); var deferred = $q.defer();
var tempFileName = PWC.newGuid() + '.dat'; var tempFileName = PWC.newGuid() + '.dat';
var token = $('input[name="__RequestVerificationToken"]').val(); var token = $('input[name="__RequestVerificationToken"]').val();
var json = ''; var json = '';
if (thisData.selectSheetNameList && thisData.selectSheetNameList.length > 0) { if (thisData.selectSheetNameList && thisData.selectSheetNameList.length > 0) {
var validateRet = thisDataService.validateTemplateCodeList(thisData.selectSheetNameList); var validateRet = thisDataService.validateTemplateCodeList(thisData.selectSheetNameList);
if (validateRet) { if (validateRet) {
SweetAlert.warning(validateRet); SweetAlert.warning(validateRet);
return; return;
} }
json = JSON.stringify(thisData.selectSheetNameList); json = JSON.stringify(thisData.selectSheetNameList);
} else { } else {
SweetAlert.warning(thisData.pleaseSelectTemplate); SweetAlert.warning(thisData.pleaseSelectTemplate);
return; return;
} }
// 转圈圈 // 转圈圈
$('#busy-indicator-container').show(); $('#busy-indicator-container').show();
Upload.upload({ Upload.upload({
url: thisConstant.importTemplateExcelFile, url: thisConstant.importTemplateExcelFile,
data: { data: {
templateGroupID: $scope.editModel.templateGroupID, templateGroupID: $scope.editModel.templateGroupID,
sheetList: json, sheetList: json,
allowManual: $("#allowManual").is(":checked"), allowManual: $("#allowManual").is(":checked"),
filename: $scope.editModel.file.name, filename: $scope.editModel.file.name,
tempFileName: tempFileName, tempFileName: tempFileName,
reportType: $scope.editModel.reportType defaultInput: $scope.editModel.defaultInput,
}, reportType: $scope.editModel.reportType
file: $scope.editModel.file, },
// resumeChunkSize: resumable ? $scope.chunkSize : null, file: $scope.editModel.file,
headers: { // resumeChunkSize: resumable ? $scope.chunkSize : null,
'Access-Control-Allow-Origin': '*', headers: {
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(), 'Access-Control-Allow-Origin': '*',
__RequestVerificationToken: token, Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
withCredentials: true __RequestVerificationToken: token,
}, withCredentials: true
__RequestVerificationToken: token, },
withCredentials: true __RequestVerificationToken: token,
}).then(function(resp) { withCredentials: true
var ret = resp.data; }).then(function(resp) {
$('#busy-indicator-container').hide(); var ret = resp.data;
deferred.resolve(); $('#busy-indicator-container').hide();
if (ret.result) { deferred.resolve();
// 导入成功 if (ret.result) {
// 获取name // 导入成功
var array = thisData.selectSheetNameList[0].split(thisConstant.underLineSeparator); // 获取name
var array = thisData.selectSheetNameList[0].split(thisConstant.underLineSeparator);
var resultModel = {
name: array[1] var resultModel = {
}; name: array[1]
modalInstance.close(resultModel); };
modalInstance.close(resultModel);
} else {
} else {
if (ret.resultMsg && ret.resultMsg.length > 0) {
SweetAlert.warning(ret.data + $translate.instant(ret.resultMsg)); if (ret.resultMsg && ret.resultMsg.length > 0) {
SweetAlert.warning(ret.data + $translate.instant(ret.resultMsg));
} else {
} else {
SweetAlert.swal({
title: thisConstant.getSheetNameTitle, SweetAlert.swal({
text: thisConstant.getSheetNameListError, title: thisConstant.getSheetNameTitle,
type: "info", text: thisConstant.getSheetNameListError,
showCancelButton: false, type: "info",
closeOnConfirm: false, showCancelButton: false,
closeOnCancel: true, closeOnConfirm: false,
html: true closeOnCancel: true,
}); html: true
});
}
} }
}
}, function(resp) {
deferred.resolve(); }, function(resp) {
deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') {
SweetAlert.warning($translate.instant('HttpRequestValidationException')); if (resp.statusText === 'HttpRequestValidationException') {
} else { SweetAlert.warning($translate.instant('HttpRequestValidationException'));
SweetAlert.warning($translate.instant('SaveFail')); } else {
} SweetAlert.warning($translate.instant('SaveFail'));
}
console.log('Error status: ' + resp.status);
}, function(evt) { console.log('Error status: ' + resp.status);
deferred.resolve(); }, function(evt) {
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); deferred.resolve();
$log.debug('progress: ' + progressPercentage + '% ' + evt.config.data.file.name); var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
}); $log.debug('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
}, });
saveFindAdd: function(modalInstance) { },
// body... saveFindAdd: function(modalInstance) {
if (!thisData.selectTemplateCodeList || thisData.selectTemplateCodeList.length === 0) { // body...
SweetAlert.warning(thisConstant.pleaseSelectTemplate); if (!thisData.selectTemplateCodeList || thisData.selectTemplateCodeList.length === 0) {
} SweetAlert.warning(thisConstant.pleaseSelectTemplate);
return;
var model = { }
serviceTypeID: $scope.editModel.serviceTypeID,
payTaxType: $scope.editModel.payTaxType, var model = {
reportType: $scope.editModel.reportType, serviceTypeID: $scope.editModel.serviceTypeID,
industryIDs: $scope.editModel.industryIDs, payTaxType: $scope.editModel.payTaxType,
templateGroupID: $scope.editModel.templateGroupID, reportType: $scope.editModel.reportType,
templateIdList: thisData.selectTemplateCodeList industryIDs: $scope.editModel.industryIDs,
}; templateGroupID: $scope.editModel.templateGroupID,
templateIdList: thisData.selectTemplateCodeList
};
var filterTemplate = _.filter(thisData.allTemplateList, function(row) {
return model.templateIdList.indexOf(row.id) > -1;
}); var filterTemplate = _.filter(thisData.allTemplateList, function(row) {
return model.templateIdList.indexOf(row.id) > -1;
var codeKey = _.uniq(_.pluck(filterTemplate, 'code')); });
var repeatCode = []; var codeKey = _.uniq(_.pluck(filterTemplate, 'code'));
codeKey.forEach(function(row) { var repeatCode = [];
var filter = _.filter(filterTemplate, function(t) { codeKey.forEach(function(row) {
return row === t.code;
}); var filter = _.filter(filterTemplate, function(t) {
return row === t.code;
if (filter && filter.length > 1) { });
repeatCode.push(row);
} if (filter && filter.length > 1) {
}); repeatCode.push(row);
}
if (repeatCode && repeatCode.length > 0) { });
SweetAlert.warning(repeatCode.join(',') + '代码重复');
return; if (repeatCode && repeatCode.length > 0) {
} SweetAlert.warning(repeatCode.join(',') + '代码重复');
return;
templateGroupService.addExistTemplate(model).success(function(ret) { }
console.log(ret);
if (ret.result) { templateGroupService.addExistTemplate(model).success(function(ret) {
console.log(ret);
// 选中的第一个报表 if (ret.result) {
var bindModel = _.find(thisData.allTemplateList, function(row) {
return row.templateGroupID && thisData.selectTemplateCodeList.indexOf(row.id) > -1; // 选中的第一个报表
}); var bindModel = _.find(thisData.allTemplateList, function(row) {
return row.templateGroupID && thisData.selectTemplateCodeList.indexOf(row.id) > -1;
});
thisData.resultModel = bindModel;
$scope.operateType = null;
thisData.isUpdate = true; thisData.resultModel = bindModel;
$scope.operateType = null;
modalInstance.close(bindModel); thisData.isUpdate = true;
} else {
if (ret.resultMsg && ret.resultMsg.length > 0) { modalInstance.close(bindModel);
SweetAlert.warning($translate.instant(ret.resultMsg)); } else {
if (ret.resultMsg && ret.resultMsg.length > 0) {
} else { SweetAlert.warning($translate.instant(ret.resultMsg));
SweetAlert.warning($translate.instant('SaveFail'));
} } else {
} SweetAlert.warning($translate.instant('SaveFail'));
}); }
}, }
});
// 绘制查找sheet的dropdown 列表 },
drawFindSheetDropDownList: function(data) {
// body... // 绘制查找sheet的dropdown 列表
thisData.dxTreeViewFindDiv = '<div class="tree-view-list margin-find" id="' + thisConstant.findSheetDxTreeID + '">'; drawFindSheetDropDownList: function(data) {
thisData.searchBoxDiv = '<div class="search-box" id="' + thisConstant.searchBoxDivId + '">'; // body...
thisData.dxTreeViewFindDiv = '<div class="tree-view-list margin-find" id="' + thisConstant.findSheetDxTreeID + '">';
// data.forEach(function(row){ thisData.searchBoxDiv = '<div class="search-box" id="' + thisConstant.searchBoxDivId + '">';
// row.expanded = true; // data.forEach(function(row){
// });
// row.expanded = true;
var getSearchList = function(dataSource, value) { // });
if (!value) {
return dataSource; var getSearchList = function(dataSource, value) {
} if (!value) {
return dataSource;
dataSource.forEach(function (x) { }
x.expanded = false;
}); dataSource.forEach(function (x) {
x.expanded = false;
var groupIDs = _.uniq(_.pluck(dataSource, 'parentID')); });
var group = _.filter(dataSource, function(row) {
return groupIDs.indexOf(row.id) >= 0; var groupIDs = _.uniq(_.pluck(dataSource, 'parentID'));
}); var group = _.filter(dataSource, function(row) {
return groupIDs.indexOf(row.id) >= 0;
var result = _.filter(dataSource, function(row) { });
if (!row.nameDisplay) { var result = _.filter(dataSource, function(row) {
return false;
} if (!row.nameDisplay) {
return false;
return row.nameDisplay.toLowerCase().indexOf(value.toLowerCase()) > -1; }
});
return row.nameDisplay.toLowerCase().indexOf(value.toLowerCase()) > -1;
if (result && result.length > 0) { });
var templateGroup = _.uniq(_.pluck(result, 'parentID'));
templateGroup.forEach(function(id) { if (result && result.length > 0) {
internalSearchParent(result, group, id); var templateGroup = _.uniq(_.pluck(result, 'parentID'));
}); templateGroup.forEach(function(id) {
} internalSearchParent(result, group, id);
});
return result; }
};
return result;
var internalSearchParent = function (result, group, id) { };
var find = _.find(result, function (t) {
return t.id === id; var internalSearchParent = function (result, group, id) {
}); var find = _.find(result, function (t) {
return t.id === id;
if (!find) { });
find = _.find(group, function (t) {
return t.id === id; if (!find) {
}); find = _.find(group, function (t) {
return t.id === id;
if (find) { });
if (find.parentID && !find.expanded) {
internalSearchParent(result, group, find.parentID); if (find) {
} if (find.parentID && !find.expanded) {
internalSearchParent(result, group, find.parentID);
find.expanded = true; }
result.push(find);
} find.expanded = true;
} result.push(find);
else if (find.parentID && !find.expanded) { }
internalSearchParent(result, group, find.parentID); }
} else if (find.parentID && !find.expanded) {
else { internalSearchParent(result, group, find.parentID);
find.expanded = true; }
} else {
}; find.expanded = true;
}
var searchTextChange = function(value) { };
var o = $('#' + thisConstant.findSheetDxTreeID).dxTreeView('option');
var orgList = getSearchList(thisData.allTemplateList, value); var searchTextChange = function(value) {
o.dataSource = orgList; var o = $('#' + thisConstant.findSheetDxTreeID).dxTreeView('option');
o.value = []; var orgList = getSearchList(thisData.allTemplateList, value);
$('#' + thisConstant.findSheetDxTreeID).dxTreeView('option', o); o.dataSource = orgList;
}; o.value = [];
$("#" + thisConstant.findSheetDxDropID).dxDropDownBox({ $('#' + thisConstant.findSheetDxTreeID).dxTreeView('option', o);
value: [], };
valueExpr: "id", $("#" + thisConstant.findSheetDxDropID).dxDropDownBox({
displayExpr: "nameDisplay", value: [],
// text: thisConstant.allSheets, valueExpr: "id",
showClearButton: false, displayExpr: "nameDisplay",
noDataText: '', // text: thisConstant.allSheets,
dataSource: thisData.allTemplateList, showClearButton: false,
contentTemplate: function(e) { noDataText: '',
var value = e.component.option("value"), dropDownOptions: { maxHeight: '310px' },
$treeView = $(thisData.dxTreeViewFindDiv).dxTreeView({ dataSource: thisData.allTemplateList,
dataSource: e.component.option("dataSource"), contentTemplate: function(e) {
dataStructure: "plain", var value = e.component.option("value"),
keyExpr: "id", $treeView = $(thisData.dxTreeViewFindDiv).dxTreeView({
parentIdExpr: "parentID", dataSource: e.component.option("dataSource"),
selectionMode: "multiple", dataStructure: "plain",
displayExpr: "nameDisplay", keyExpr: "id",
expandedExpr: 'expanded', parentIdExpr: "parentID",
selectByClick: true, selectionMode: "multiple",
expandAllEnabled: true, displayExpr: "nameDisplay",
selectNodesRecursive: true, expandedExpr: 'expanded',
showCheckBoxesMode: "normal", selectByClick: true,
noDataText: '', expandAllEnabled: true,
height: '300px', selectNodesRecursive: true,
value: [], showCheckBoxesMode: "normal",
itemTemplate: function(itemData, itemIndex, itemElement) { noDataText: '',
itemElement.append("<span title='" + itemData.nameDisplay + "'>" + itemData.nameDisplay + "</span>"); height: '300px',
}, value: [],
onItemSelectionChanged: function(args) { itemTemplate: function(itemData, itemIndex, itemElement) {
var value = args.component.getSelectedNodesKeys(); itemElement.append("<span title='" + itemData.nameDisplay + "'>" + itemData.nameDisplay + "</span>");
thisData.selectTemplateCodeList = value; },
e.component.option("value", value); onItemSelectionChanged: function(args) {
} var value = args.component.getSelectedNodesKeys();
}); thisData.selectTemplateCodeList = value;
e.component.option("value", value);
thisData.findSheetTreeView = $treeView.dxTreeView("instance"); }
thisData.sheetText = e.component.option("text"); });
var textBox = $(thisData.searchBoxDiv).dxTextBox({
placeholder: "搜索", thisData.findSheetTreeView = $treeView.dxTreeView("instance");
mode: "search", thisData.sheetText = e.component.option("text");
onValueChanged: function(args) { var textBox = $(thisData.searchBoxDiv).dxTextBox({
var value = args.value; placeholder: "搜索",
searchTextChange(value); mode: "search",
}, onValueChanged: function(args) {
onKeyUp: function(args) { var value = args.value;
var value = $(args.element).dxTextBox('option').text; searchTextChange(value);
searchTextChange(value); },
} onKeyUp: function(args) {
}); var value = $(args.element).dxTextBox('option').text;
searchTextChange(value);
e.component.on("valueChanged", function(args) { }
});
// var value = args.value;
// syncTreeViewSelection(thisData.sheetTreeView, value); e.component.on("valueChanged", function(args) {
});
// var value = args.value;
var wrapper = $("<div>").append(textBox).append('<br/>').append($treeView); // syncTreeViewSelection(thisData.sheetTreeView, value);
});
return wrapper;
} var wrapper = $("<div>").append(textBox).append('<br/>').append($treeView);
});
}, return wrapper;
}
// 删除系统级别的报表 });
deleteSystemTemplate: function() { },
// 删除模板服务 // 删除系统级别的报表
var deleteTemplate = function(model) { deleteSystemTemplate: function() {
templateGroupService.deleteTemplate(model).success(function(ret) {
if (ret.result) { // 删除模板服务
$scope.operateType = null; var deleteTemplate = function(model) {
$scope.isUpdate = true; templateGroupService.deleteTemplate(model).success(function(ret) {
SweetAlert.warning('删除成功'); if (ret.result) {
$scope.onClosed({ model: null }); $scope.operateType = null;
$scope.operateType = null; $scope.isUpdate = true;
} else { SweetAlert.warning('删除成功');
SweetAlert.warning($translate.instant('SaveFail')); $scope.onClosed({ model: null });
} $scope.operateType = null;
}); } else {
}; SweetAlert.warning($translate.instant('SaveFail'));
}
});
var text = "确定要删除报表" + $scope.templateModel.name + "吗?"; };
SweetAlert.swal({
title: '确定删除吗?', var text = "确定要删除报表" + $scope.templateModel.name + "吗?";
text: text,
type: "warning", SweetAlert.swal({
showCancelButton: true, title: '确定删除吗?',
confirmButtonColor: "#DD6B55", text: text,
confirmButtonText: $translate.instant('Confirm'), type: "warning",
cancelButtonText: $translate.instant('Cancel'), showCancelButton: true,
closeOnConfirm: false, confirmButtonColor: "#DD6B55",
closeOnCancel: true confirmButtonText: $translate.instant('Confirm'),
}, cancelButtonText: $translate.instant('Cancel'),
function(isConfirm) { closeOnConfirm: false,
if (isConfirm) { closeOnCancel: true
var model = { },
id: $scope.templateModel.id, function(isConfirm) {
isDeletePermanent: false, if (isConfirm) {
path: $scope.templateModel.path var model = {
}; id: $scope.templateModel.id,
deleteTemplate(model); isDeletePermanent: false,
} else { path: $scope.templateModel.path
$scope.operateType = null; };
$scope.isUpdate = false; deleteTemplate(model);
} } else {
}); $scope.operateType = null;
} $scope.isUpdate = false;
}; }
});
var thisModalService = { }
modalInstance: null, };
open: function(editModel) {
$scope.editModel = editModel; var thisModalService = {
modalInstance: null,
var modalInstance = $uibModal.open({ open: function(editModel) {
animation: false, $scope.editModel = editModel;
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body', var modalInstance = $uibModal.open({
templateUrl: 'editTemplateModal.html', animation: false,
windowClass: 'edit-template-modal-wrapper', ariaLabelledBy: 'modal-title',
scope: $scope, ariaDescribedBy: 'modal-body',
resolve: { templateUrl: 'editTemplateModal.html',
editModel: editModel windowClass: 'edit-template-modal-wrapper',
} scope: $scope,
}); resolve: {
editModel: editModel
}
modalInstance.result.then(function(data) { });
thisData.isUpdate = true;
thisData.resultModel = data;
$scope.onClosed({ model: data }); modalInstance.result.then(function(data) {
$scope.operateType = null; thisData.isUpdate = true;
}, function() { thisData.resultModel = data;
$scope.operateType = null; $scope.onClosed({ model: data });
$scope.isUpdate = false; $scope.operateType = null;
$log.info('Modal dismissed at: ' + new Date()); }, function() {
}); $scope.operateType = null;
$scope.isUpdate = false;
$scope.getSheetList = thisDataService.getSheetList; $log.info('Modal dismissed at: ' + new Date());
});
// 确定
$scope.save = function() { $scope.getSheetList = thisDataService.getSheetList;
if ($scope.editModel.addExists) { // 确定
thisDataService.saveFindAdd(modalInstance); $scope.save = function() {
} else {
thisDataService.save(modalInstance); if ($scope.editModel.addExists) {
} thisDataService.saveFindAdd(modalInstance);
} } else {
thisDataService.save(modalInstance);
// 取消 }
$scope.cancel = function() { }
modalInstance.dismiss('cancel');
}; // 取消
$scope.cancel = function() {
$timeout(function() { modalInstance.dismiss('cancel');
thisData.sheetNameObjList = []; };
// 下拉框内容
thisDataService.drawSheetNameDropDownList(); $timeout(function() {
thisData.sheetNameObjList = [];
}, 10); // 下拉框内容
}, thisDataService.drawSheetNameDropDownList();
newModel: function() {
var editModel = thisDataService.newModel(); }, 10);
thisModalService.open(editModel); },
var serviceTypeID = $scope.templateModel.serviceTypeID; newModel: function() {
var editModel = thisDataService.newModel();
var payTaxType = (serviceTypeID === enums.serviceType.CIT) ? '' : $scope.templateModel.payTaxType; thisModalService.open(editModel);
var reportType = (serviceTypeID === enums.serviceType.CIT) ? $scope.templateModel.reportType : ''; var serviceTypeID = $scope.templateModel.serviceTypeID;
var industryIDs = $scope.templateModel.industryIDs;
templateGroupService.getTemplateUniqList(serviceTypeID, payTaxType, reportType, industryIDs).success(function (data) { var payTaxType = (serviceTypeID === enums.serviceType.CIT) ? '' : $scope.templateModel.payTaxType;
var reportType = (serviceTypeID === enums.serviceType.CIT) ? $scope.templateModel.reportType : '';
var result = data; var industryIDs = $scope.templateModel.industryIDs;
if ($scope.templateModel.currentTemplateCodeList && $scope.templateModel.currentTemplateCodeList.length > 0) { templateGroupService.getTemplateUniqList(serviceTypeID, payTaxType, reportType, industryIDs).success(function (data) {
result = _.filter(data, function(row) { var result = data;
return $scope.templateModel.currentTemplateCodeList.indexOf(row.code) === -1; if ($scope.templateModel.currentTemplateCodeList && $scope.templateModel.currentTemplateCodeList.length > 0) {
});
} result = _.filter(data, function(row) {
return $scope.templateModel.currentTemplateCodeList.indexOf(row.code) === -1;
if (result && result.length > 0) { });
result.forEach(function(row) { }
if (row.code) {
row.nameDisplay = row.name + thisConstant.underLineSeparator + row.code; if (result && result.length > 0) {
} else { result.forEach(function(row) {
row.nameDisplay = row.name; if (row.code) {
} row.nameDisplay = row.name + thisConstant.underLineSeparator + row.code;
}); } else {
} row.nameDisplay = row.name;
}
thisData.allTemplateList = result; });
}
$timeout(function() {
thisDataService.drawFindSheetDropDownList(thisData.allTemplateList); thisData.allTemplateList = result;
}, 10);
}); $timeout(function() {
thisDataService.drawFindSheetDropDownList(thisData.allTemplateList);
}, }, 10);
// 删除报表Comfirm框 });
deleteTemplateComfirmModel: function() {
var editModel = {}; },
editModel.title = "删除报表" + $scope.templateModel.code + thisConstant.underLineSeparator + $scope.templateModel.name; // 删除报表Comfirm框
editModel.deleteConfirmText = '从当前模板删除还是整个系统中删除?'; deleteTemplateComfirmModel: function() {
editModel.id = $scope.templateModel.id; var editModel = {};
editModel.code = $scope.templateModel.code; editModel.title = "删除报表" + $scope.templateModel.code + thisConstant.underLineSeparator + $scope.templateModel.name;
editModel.name = $scope.templateModel.name; editModel.deleteConfirmText = '从当前模板删除还是整个系统中删除?';
editModel.isSystemType = $scope.templateModel.isSystemType; editModel.id = $scope.templateModel.id;
editModel.path = $scope.templateModel.path; editModel.code = $scope.templateModel.code;
$scope.editModel = editModel; editModel.name = $scope.templateModel.name;
var modalInstance = $uibModal.open({ editModel.isSystemType = $scope.templateModel.isSystemType;
animation: true, editModel.path = $scope.templateModel.path;
backdrop: false, $scope.editModel = editModel;
ariaLabelledBy: 'modal-title', var modalInstance = $uibModal.open({
ariaDescribedBy: 'modal-body', animation: true,
templateUrl: 'deleteTemplateModal.html', backdrop: false,
windowClass: 'edit-template-modal-wrapper', ariaLabelledBy: 'modal-title',
scope: $scope, ariaDescribedBy: 'modal-body',
resolve: { templateUrl: 'deleteTemplateModal.html',
editModel: editModel windowClass: 'edit-template-modal-wrapper',
} scope: $scope,
}); resolve: {
editModel: editModel
}
modalInstance.result.then(function(data) { });
$scope.templateModel = data;
$scope.isUpdate = true;
$scope.onClosed({ model: data }); modalInstance.result.then(function(data) {
$scope.operateType = null; $scope.templateModel = data;
}, function() { $scope.isUpdate = true;
$scope.operateType = null; $scope.onClosed({ model: data });
$scope.isUpdate = false; $scope.operateType = null;
$log.info('Modal dismissed at: ' + new Date()); }, function() {
}); $scope.operateType = null;
$scope.isUpdate = false;
// 删除模板服务 $log.info('Modal dismissed at: ' + new Date());
var deleteTemplate = function(model) { });
templateGroupService.deleteTemplate(model).success(function(ret) {
if (ret.result) { // 删除模板服务
modalInstance.close(model); var deleteTemplate = function(model) {
} else { templateGroupService.deleteTemplate(model).success(function(ret) {
SweetAlert.warning($translate.instant('SaveFail')); if (ret.result) {
} modalInstance.close(model);
} else {
}); SweetAlert.warning($translate.instant('SaveFail'));
}; }
// 删除关联 });
$scope.deleteRelation = function() { };
// thisDataService.saveFindAdd(modalInstance)
// 删除关联
var model = { $scope.deleteRelation = function() {
id: $scope.editModel.id, // thisDataService.saveFindAdd(modalInstance)
isDeletePermanent: false,
path: $scope.editModel.path var model = {
}; id: $scope.editModel.id,
isDeletePermanent: false,
deleteTemplate(model); path: $scope.editModel.path
}; };
// 永久删除 deleteTemplate(model);
$scope.deletePermanent = function() { };
//
var model = { // 永久删除
id: $scope.editModel.id, $scope.deletePermanent = function() {
isDeletePermanent: true, //
path: $scope.editModel.path var model = {
}; id: $scope.editModel.id,
isDeletePermanent: true,
deleteTemplate(model); path: $scope.editModel.path
}; };
// 取消 deleteTemplate(model);
$scope.cancel = function() { };
modalInstance.dismiss('cancel');
}; // 取消
}, $scope.cancel = function() {
// 编辑报表名称 modalInstance.dismiss('cancel');
editTemplateNameModal: function() { };
var editModel = { },
name: $scope.templateModel.name, // 编辑报表名称
id: $scope.templateModel.id, editTemplateNameModal: function() {
code: $scope.templateModel.code, var editModel = {
title: '编辑报表' + $scope.templateModel.name name: $scope.templateModel.name,
}; id: $scope.templateModel.id,
code: $scope.templateModel.code,
$scope.editModel = editModel; title: '编辑报表' + $scope.templateModel.name
};
var modalInstance = $uibModal.open({
animation: false, $scope.editModel = editModel;
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body', var modalInstance = $uibModal.open({
templateUrl: 'editTemplateNameModal.html', animation: false,
windowClass: 'edit-template-name-wrapper', ariaLabelledBy: 'modal-title',
size: 'sm', ariaDescribedBy: 'modal-body',
scope: $scope, templateUrl: 'editTemplateNameModal.html',
resolve: { windowClass: 'edit-template-name-wrapper',
editModel: editModel size: 'sm',
} scope: $scope,
}); resolve: {
editModel: editModel
}
modalInstance.result.then(function(data) { });
$scope.isUpdate = true;
$scope.onClosed({ model: data });
$scope.operateType = null; modalInstance.result.then(function(data) {
}, function() { $scope.isUpdate = true;
$scope.operateType = null; $scope.onClosed({ model: data });
$scope.isUpdate = false; $scope.operateType = null;
$log.info('Modal dismissed at: ' + new Date()); }, function() {
}); $scope.operateType = null;
$scope.isUpdate = false;
// 删除模板服务 $log.info('Modal dismissed at: ' + new Date());
var updateTemplateName = function(model) { });
templateGroupService.updateTemplateName(model).success(function(ret) {
if (ret.result) { // 删除模板服务
// 导入成功 var updateTemplateName = function(model) {
modalInstance.close(model); templateGroupService.updateTemplateName(model).success(function(ret) {
if (ret.result) {
} else { // 导入成功
if (ret.resultMsg && ret.resultMsg.length > 0) { modalInstance.close(model);
SweetAlert.warning(ret.data + $translate.instant(ret.resultMsg));
} else {
} else { if (ret.resultMsg && ret.resultMsg.length > 0) {
SweetAlert.warning($translate.instant('SaveFail')); SweetAlert.warning(ret.data + $translate.instant(ret.resultMsg));
}
} } else {
}); SweetAlert.warning($translate.instant('SaveFail'));
}; }
}
// 修改报表名称 });
$scope.saveUpdateTemplateName = function() { };
// thisDataService.saveFindAdd(modalInstance)
// 修改报表名称
var model = { $scope.saveUpdateTemplateName = function() {
id: $scope.editModel.id, // thisDataService.saveFindAdd(modalInstance)
name: $scope.editModel.name,
}; var model = {
id: $scope.editModel.id,
updateTemplateName(model); name: $scope.editModel.name,
}; };
// 取消 updateTemplateName(model);
$scope.cancel = function() { };
modalInstance.dismiss('cancel');
}; // 取消
} $scope.cancel = function() {
}; modalInstance.dismiss('cancel');
};
var mainModule = { }
main: function() { };
$scope.editModel = {}; var mainModule = {
mainModule.watchFunction(); main: function() {
},
watchFunction: function() { $scope.editModel = {};
$scope.$watch('operateType', function(newValue, oldValue) { mainModule.watchFunction();
},
if (newValue !== oldValue) { watchFunction: function() {
thisData.isUpdate = false; $scope.$watch('operateType', function(newValue, oldValue) {
thisData.resultModel = null;
$scope.isUpdate = false; if (newValue !== oldValue) {
} thisData.isUpdate = false;
thisData.resultModel = null;
if (newValue === constant.Operation.Add) { $scope.isUpdate = false;
thisModalService.newModel(); }
} else if (newValue === constant.Operation.Delete) {
// 删除 if (newValue === constant.Operation.Add) {
thisModalService.newModel();
if ($scope.templateModel) { } else if (newValue === constant.Operation.Delete) {
if ($scope.templateModel.isSystemType) { // 删除
// 系统级别直接删除,不用提示
thisDataService.deleteSystemTemplate(); if ($scope.templateModel) {
if ($scope.templateModel.isSystemType) {
} else { // 系统级别直接删除,不用提示
thisModalService.deleteTemplateComfirmModel(); thisDataService.deleteSystemTemplate();
}
} } else {
} else if (newValue === constant.Operation.Edit) { thisModalService.deleteTemplateComfirmModel();
thisModalService.editTemplateNameModal(); }
} }
}); } else if (newValue === constant.Operation.Edit) {
thisModalService.editTemplateNameModal();
}
} });
};
(function initialize() { }
mainModule.main(); };
})(); (function initialize() {
} mainModule.main();
})();
}
]); ]);
\ No newline at end of file
<div class="edit-template-modal-wrapper"> <div class="edit-template-modal-wrapper">
<!-- 采用导入报表模板的方式 --> <!-- 采用导入报表模板的方式 -->
<script type="text/ng-template" id="editTemplateModal.html"> <script type="text/ng-template" id="editTemplateModal.html">
<div class="modal-header"> <div class="modal-header">
<div class="modal-title">添加报表<span class="close" ng-click="cancel()" aria-hidden="true">×</span></div> <div class="modal-title">{{'AddReport' | translate}}<span class="close" ng-click="cancel()" aria-hidden="true">×</span></div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" id="editTemplateControlForm"> <form class="form-horizontal" id="editTemplateControlForm">
<div class="form-group radio-wrapper"> <div class="form-group radio-wrapper">
<label class="col-sm-4 normal-label"> <label class="col-sm-4 normal-label">
<input type="radio" ng-model="editModel.addExists" ng-value="true"><span>添加现有报表</span> <input type="radio" ng-model="editModel.addExists" ng-value="true"><span>{{'AddExistingReport' | translate}}</span>
</label> </label>
<label class="col-sm-4 normal-label"> <label class="col-sm-4 normal-label">
<input type="radio" ng-model="editModel.addExists" ng-value="false"><span>上传新报表</span> <input type="radio" ng-model="editModel.addExists" ng-value="false"><span>{{'UploadNewReport' | translate}}</span>
</label> </label>
</div> </div>
<div class="form-group" ng-show="!editModel.addExists"> <div class="form-group" ng-show="!editModel.addExists">
<label for="fileName" class="col-sm-3 control-label">报表底稿:</label> <label for="fileName" class="col-sm-3 control-label">{{'TemplateFile' | translate}}: </label>
<div class="col-sm-5"> <div class="col-sm-5">
<input class="form-control" type="text" name="fileName" ng-model="editModel.file.name" readonly placeholder=""> <input class="form-control" type="text" name="fileName" ng-model="editModel.file.name" readonly placeholder="">
</input> </input>
</div> </div>
<div class="col-sm-2"> <div class="col-sm-2">
<button type="button" type="file" ngf-select ng-model="editModel.file" accept=".xls,.xlsx" ngf-change="getSheetList()" class="btn btn-secondary browse">{{'Browse' | translate }}</button> <button type="button" type="file" ngf-select ng-model="editModel.file" accept=".xls,.xlsx" ngf-change="getSheetList()" class="btn btn-secondary browse">{{'Browse' | translate }}</button>
</div> </div>
</div> </div>
<div class="form-group" ng-show="!editModel.addExists"> <div class="form-group" ng-show="!editModel.addExists">
<label for="telCode" class="col-sm-3 control-label">选择报表:</label> <label for="telCode" class="col-sm-3 control-label">{{'SelectReportTemplate' | translate}}: </label>
<div class="col-sm-8 upload-sheet-wrapper"> <div class="col-sm-8 upload-sheet-wrapper">
<div id={{::editModel.sheetSelectDxID}}></div> <div id={{::editModel.sheetSelectDxID}}></div>
</div> </div>
</div> </div>
<div class="form-group radio-wrapper" ng-show="!editModel.addExists"> <div class="form-group" ng-show="editModel.addExists">
<label for="telCode" class="col-sm-4 normal-label"> <label for="telCode" class="col-sm-3 control-label">{{'SelectReportTemplate' | translate}}: </label>
<input type="radio" id="allowManual"><span>允许手工录入</span> <div class="col-sm-9">
</label> <div id={{::editModel.findSheetDxDropID}}></div>
</div> </div>
</div>
<div class="form-group" ng-show="editModel.addExists"> <div class="form-group" ng-show="!editModel.addExists">
<div class="col-sm-9 normal-label checkbox">
<label for="telCode" class="col-sm-3 control-label">选择报表:</label> <label>
<div class="col-sm-9"> <input type="checkbox" ng-model="editModel.defaultInput" ng-true-value="1" ng-false-value="0"> {{'AllowKeyInByDefault' | translate}}
<div id={{::editModel.findSheetDxDropID}}></div> </label>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer" style="padding-left: 22px;text-align: left;"> <div class="modal-footer" style="padding-left: 22px;text-align: left;">
<button type="button" class="btn btn-primary" ng-click="save()">{{'Confirm' | translate }}</button> <button type="button" class="btn btn-primary" ng-click="save()">{{'Confirm' | translate }}</button>
<button type="button" class="btn btn-default" ng-click="cancel()" data-dismiss="modal">{{'Cancel' | translate }}</button> <button type="button" class="btn btn-default" ng-click="cancel()" data-dismiss="modal">{{'Cancel' | translate }}</button>
</div> </div>
</script> </script>
<!-- 添加现有报表 --> <!-- 添加现有报表 -->
<script type="text/ng-template" id="addExistTemplateModal.html"> <script type="text/ng-template" id="addExistTemplateModal.html">
<div class="modal-header"> <div class="modal-header">
<div class="modal-title">添加现有报表</div> <div class="modal-title">{{'AddExistingReport' | translate}}</div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" id="editTemplateControlForm"> <form class="form-horizontal" id="editTemplateControlForm">
<div class="form-group"> <div class="form-group">
<label for="telCode" class="col-sm-3 control-label">选择报表:</label> <label for="telCode" class="col-sm-3 control-label">{{'SelectReportTemplate' | translate}}: </label>
<div class="col-sm-7"> <div class="col-sm-7">
<div id={{::editModel.findSheetDxDropID}}></div> <div id={{::editModel.findSheetDxDropID}}></div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer" style="padding-left: 22px;text-align: left;"> <div class="modal-footer" style="padding-left: 22px;text-align: left;">
<button type="button" class="btn btn-primary" ng-click="saveFindAdd()">{{'Confirm' | translate }}</button> <button type="button" class="btn btn-primary" ng-click="saveFindAdd()">{{'Confirm' | translate }}</button>
<button type="button" class="btn btn-default" ng-click="cancel()" data-dismiss="modal">{{'Cancel' | translate }}</button> <button type="button" class="btn btn-default" ng-click="cancel()" data-dismiss="modal">{{'Cancel' | translate }}</button>
</div> </div>
</script> </script>
<!-- 编辑报表名称 --> <!-- 编辑报表名称 -->
<script type="text/ng-template" id="deleteTemplateModal.html"> <script type="text/ng-template" id="deleteTemplateModal.html">
<div class="modal-header"> <div class="modal-header">
<div class="modal-title">删除报表</div> <div class="modal-title">{{'DeleteReport' | translate}}</div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" id="deleteTemplateControlForm"> <form class="form-horizontal" id="deleteTemplateControlForm">
{{::editModel.deleteConfirmText}} {{::editModel.deleteConfirmText}}
</form> </form>
</div> </div>
<div class="modal-footer" style="padding-left: 22px;text-align: left;"> <div class="modal-footer" style="padding-left: 22px;text-align: left;">
<button type="button" class="btn btn-primary" ng-click="deleteRelation()">仅删除当前模板</button> <button type="button" class="btn btn-primary" ng-click="deleteRelation()">仅删除当前模板</button>
<button type="button" class="btn btn-secondary" ng-click="deletePermanent()">永久删除</button> <button type="button" class="btn btn-secondary" ng-click="deletePermanent()">永久删除</button>
<button type="button" class="btn btn-default" ng-click="cancel()" data-dismiss="modal">{{'Cancel' | translate }}</button> <button type="button" class="btn btn-default" ng-click="cancel()" data-dismiss="modal">{{'Cancel' | translate }}</button>
</div> </div>
</script> </script>
<!-- 编辑报表名称 --> <!-- 编辑报表名称 -->
<script type="text/ng-template" id="editTemplateNameModal.html"> <script type="text/ng-template" id="editTemplateNameModal.html">
<div class="modal-header"> <div class="modal-header">
<div class="modal-title">编辑报表</div> <div class="modal-title">{{'EditReport' | translate}}</div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="form-horizontal" id="editTemplateNameModal"> <form class="form-horizontal" id="editTemplateNameModal">
<div class="form-group"> <div class="form-group">
<label for="name" class="col-sm-3 control-label"><span class="must-input">*</span>报表底稿:</label> <label for="name" class="col-sm-3 control-label"><span class="must-input">*</span>{{'TemplateFile' | translate}}: </label>
<div class="col-sm-8"> <div class="col-sm-8">
<input class="form-control" type="text" name="name" ng-model="editModel.name" /> <input class="form-control" type="text" name="name" ng-model="editModel.name" />
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer" style="padding-left: 22px;text-align: left;"> <div class="modal-footer" style="padding-left: 22px;text-align: left;">
<button type="button" class="btn btn-primary" ng-click="saveUpdateTemplateName()">{{'Confirm' | translate }}</button> <button type="button" class="btn btn-primary" ng-click="saveUpdateTemplateName()">{{'Confirm' | translate }}</button>
<button type="button" class="btn btn-default" ng-click="cancel()" data-dismiss="modal">{{'Cancel' | translate }}</button> <button type="button" class="btn btn-default" ng-click="cancel()" data-dismiss="modal">{{'Cancel' | translate }}</button>
</div> </div>
</script> </script>
</div> </div>
\ No newline at end of file
commonModule.directive('editTemplateModal', ['$log', commonModule.directive('editTemplateModal', ['$log',
function ($log) { function ($log) {
'use strict'; 'use strict';
$log.debug('editUserModal.ctor()...'); $log.debug('editUserModal.ctor()...');
return { return {
restrict: 'E', restrict: 'E',
templateUrl: '/app/common/controls/edit-template-modal/edit-template-modal.html' + '?_=' + Math.random(), templateUrl: '/app/common/controls/edit-template-modal/edit-template-modal.html' + '?_=' + Math.random(),
replace: true, replace: true,
controller: 'editTemplateModalController', controller: 'editTemplateModalController',
scope: scope:
{ {
operateType:'=', operateType:'=',
templateModel:'=?', templateModel:'=?',
isUpdate:'=?', isUpdate:'=?',
onClosed: '&' onClosed: '&'
} }
//, //,
//link: function (scope, element) { //link: function (scope, element) {
// element.find('.selector-input').on('focus', function () { // element.find('.selector-input').on('focus', function () {
// element.find('.org-tree-container').show(); // element.find('.org-tree-container').show();
// }); // });
// $(document).on('click', function () { // $(document).on('click', function () {
// element.find('.org-tree-container').hide(); // element.find('.org-tree-container').hide();
// }).on('click', '.org-tree-wrapper', function (e) { // }).on('click', '.org-tree-wrapper', function (e) {
// e.stopPropagation(); // e.stopPropagation();
// }); // });
//} //}
}; };
} }
]); ]);
\ No newline at end of file
@import "~/app-resources/css/admin-theme.less"; @import "~/app-resources/css/admin-theme.less";
.edit-template-modal-wrapper { .edit-template-modal-wrapper {
.radio-wrapper { .radio-wrapper {
margin-left: 0px; margin-left: 0px;
} }
.control-label { .control-label {
width: 100px!important; width: 100px!important;
font-weight: normal; font-weight: normal;
padding-left: 15px!important; padding-left: 15px!important;
padding-right: 0px!important; padding-right: 0px!important;
text-align: left; text-align: left;
} }
.normal-label { .normal-label {
font-weight: normal; font-weight: normal;
padding-left: 0px!important; padding-left: 0px!important;
padding-right: 0px!important; padding-right: 0px!important;
input[type="radio"] { input[type="radio"] {
margin: 0px 0.5em 0px 0px; margin: 0px 0.5em 0px 0px;
} }
} }
.col-sm-5, .col-sm-5,
.col-sm-7, .col-sm-7,
col-sm-9 { col-sm-9 {
padding-left: 0px!important; padding-left: 0px!important;
padding-right: 0px!important; padding-right: 0px!important;
} }
.upload-sheet-wrapper { .upload-sheet-wrapper {
padding-left: 0; padding-left: 0;
padding-right: 32px; padding-right: 32px;
} }
}
.checkbox {
.edit-template-name-wrapper { margin-left: 100px;
.modal-content { }
width: 400px!important; }
}
.edit-template-name-wrapper {
.must-input { .modal-content {
color: red; width: 400px!important;
} }
.control-label {
width: 100px !important; .must-input {
font-weight: normal; color: red;
padding-left: 15px; }
padding-right: 0px; .control-label {
text-align: left; width: 100px !important;
} font-weight: normal;
padding-left: 15px;
.col-sm-8 { padding-right: 0px;
padding-left: 0px; text-align: left;
padding-right: 0px; }
}
} .col-sm-8 {
padding-left: 0px;
.margin-find{ padding-right: 0px;
margin: -10px -10px 10px -10px; }
} }
.margin-sheet{ .margin-find{
margin: -10px -10px 10px -20px; margin: -10px -10px 10px -10px;
} }
.tree-view-list { .margin-sheet{
.dx-checkbox-container { margin: -10px -10px 10px -20px;
padding: 4px; }
.dx-checkbox-icon { .tree-view-list {
height: 16px; .dx-checkbox-container {
width: 16px; padding: 4px;
}
.dx-checkbox-icon {
.dx-checkbox-icon { height: 16px;
font-size: 14px; width: 16px;
} }
}
.dx-checkbox-icon {
.dx-checkbox-indeterminate .dx-checkbox-icon:before { font-size: 14px;
width: 14px; }
height: 14px; }
left: 0px;
top: 0px; .dx-checkbox-indeterminate .dx-checkbox-icon:before {
} width: 14px;
} height: 14px;
left: 0px;
.search-box { top: 0px;
margin: 6px -10px -10px -10px; }
}
.search-box {
margin: 6px -10px -10px -10px;
} }
\ No newline at end of file
...@@ -170,16 +170,22 @@ ...@@ -170,16 +170,22 @@
}).then(function (resp) { }).then(function (resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
} else { } else {
if (resp.message && resp.message.length > 0) { if (resp.message && resp.message.length > 0) {
SweetAlert.warning($translate.instant(resp.message));
} else {
SweetAlert.error($translate.instant('ImportFailed'));
}
if (resp.resultMsg && resp.resultMsg.length > 0) {
SweetAlert.warning($translate.instant(resp.resultMsg)); SweetAlert.warning($translate.instant(resp.resultMsg));
} else { } else {
SweetAlert.error($translate.instant('ImportFailed')); SweetAlert.error($translate.instant('ImportFailed'));
} }
logDto.UpdateState = $translate.instant('ImportFail'); logDto.UpdateState = $translate.instant('ImportFail');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
} }
...@@ -395,7 +401,7 @@ ...@@ -395,7 +401,7 @@
ele1.datepicker("setDate", $scope.selectedDate); ele1.datepicker("setDate", $scope.selectedDate);
}; };
$scope.initCompanyList = function () { var initCompanyList = function () {
orgService.getOrgListByUserId().success(function (data) { orgService.getOrgListByUserId().success(function (data) {
if (data) { if (data) {
$scope.companyList = data; $scope.companyList = data;
...@@ -494,6 +500,7 @@ ...@@ -494,6 +500,7 @@
$scope.setGridStyle = setGridStyle; $scope.setGridStyle = setGridStyle;
getUserPermission(); getUserPermission();
initCompanyList();
loadImportInfoDataGrid(); loadImportInfoDataGrid();
initDatePicker(); initDatePicker();
......
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
}).then(function(resp) { }).then(function(resp) {
$('#busy-indicator-container').hide(); $('#busy-indicator-container').hide();
deferred.resolve(); deferred.resolve();
if (resp.data) { if (resp.data || resp.result) {
logDto.UpdateState = $translate.instant('ImportSuccess'); logDto.UpdateState = $translate.instant('ImportSuccess');
vatOperationLogService.addOperationLog(logDto); vatOperationLogService.addOperationLog(logDto);
SweetAlert.success($translate.instant('ImportSuccess')); SweetAlert.success($translate.instant('ImportSuccess'));
......
...@@ -12,7 +12,7 @@ webservices.factory('templateGroupService', ['$http', 'apiConfig', 'httpCacheSer ...@@ -12,7 +12,7 @@ webservices.factory('templateGroupService', ['$http', 'apiConfig', 'httpCacheSer
return $http.post('/templateGroup/addTemplateGroup', templateGroup, apiConfig.create()); return $http.post('/templateGroup/addTemplateGroup', templateGroup, apiConfig.create());
}, },
addTemplateGroupWithoutTemplate: function (templateGroup) { addTemplateGroupWithoutTemplate: function (templateGroup) {
return $http.post('/templateGroup/templateGroup/withoutTemplate', templateGroup, apiConfig.create()); return $http.post('/templateGroup/withoutTemplate', templateGroup, apiConfig.create());
}, },
getTemplateList: function (templateGroupID, reportType) { getTemplateList: function (templateGroupID, reportType) {
return $http.get('/template/get?templateGroupID=' + templateGroupID + '&reportType=' + reportType, apiConfig.create()); return $http.get('/template/get?templateGroupID=' + templateGroupID + '&reportType=' + reportType, apiConfig.create());
......
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