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