Commit 1519bf01 authored by sherlock's avatar sherlock

merge

parents d2e9d3e7 fd4a320a
package pwc.taxtech.atms.common.exception;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.dto.ApiResultDto;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ControllerAdvice
public class CustomExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(CustomExceptionHandler.class);
@ExceptionHandler(value = Throwable.class)
public ApiResultDto handle(HttpServletResponse response) {
return ApiResultDto.fail("error.");
}
@ExceptionHandler(value = ServiceException.class)
public void customHandle(ServiceException exception, HttpServletResponse response) {
try {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=UTF-8");
response.getWriter().write(JSON.toJSONString(ApiResultDto.fail(exception.getMessage())));
} catch (IOException e) {
logger.error("customHandle error.", e);
}
}
}
...@@ -65,9 +65,15 @@ public class ApprovalController { ...@@ -65,9 +65,15 @@ public class ApprovalController {
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "/check/{taskId}") @RequestMapping(value = "/check/{taskId}",method = RequestMethod.PUT)
public void check(@PathVariable String taskId, @RequestParam String decide) {//only for manager role public void check(@PathVariable String taskId, @RequestParam String decide, @RequestParam String comment) {//only for manager role
approvalService.checkTask(taskId, decide); approvalService.checkTask(taskId, decide,comment);
}
@ResponseBody
@RequestMapping(value = "/status/{projectId}/{period}")
public String getApprovalStatus(@PathVariable String projectId,@PathVariable Integer period){
return approvalService.getApprovalStatus(projectId,period);
} }
@RequestMapping(value = "/show/{procDefId}")//获取流程图 @RequestMapping(value = "/show/{procDefId}")//获取流程图
......
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.exception.ApiException; import pwc.taxtech.atms.exception.ApiException;
import pwc.taxtech.atms.exception.ApplicationException; import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.exception.ServiceException; import pwc.taxtech.atms.exception.ServiceException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@EnableWebMvc
@ControllerAdvice @ControllerAdvice
public class AtmsExceptionHandler extends ResponseEntityExceptionHandler { public class AtmsExceptionHandler extends ResponseEntityExceptionHandler {
private static Logger LOGGER = LoggerFactory.getLogger(AtmsExceptionHandler.class); private static Logger LOGGER = LoggerFactory.getLogger(AtmsExceptionHandler.class);
@ExceptionHandler(value = { @ExceptionHandler(value = {
ApplicationException.class, ApplicationException.class,
ServiceException.class ApiException.class
}) })
protected ResponseEntity<Object> handleExceptions(Exception ex) throws ServiceException { protected ResponseEntity<Object> handleExceptions(Exception ex) throws ServiceException {
LOGGER.error("Rest Exception!", ex); LOGGER.error("Rest Exception!", ex);
...@@ -42,6 +49,22 @@ public class AtmsExceptionHandler extends ResponseEntityExceptionHandler { ...@@ -42,6 +49,22 @@ public class AtmsExceptionHandler extends ResponseEntityExceptionHandler {
} }
} }
@ExceptionHandler(value = Throwable.class)
public ApiResultDto handle(HttpServletResponse response) {
return ApiResultDto.fail("error.");
}
@ExceptionHandler(value = ServiceException.class)
public void customHandle(pwc.taxtech.atms.common.ServiceException exception, HttpServletResponse response) {
try {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=UTF-8");
response.getWriter().write(JSON.toJSONString(ApiResultDto.fail(exception.getMessage())));
} catch (IOException e) {
logger.error("customHandle error.", e);
}
}
private ResponseEntity<Object> handleApplicationException(ApplicationException ex) { private ResponseEntity<Object> handleApplicationException(ApplicationException ex) {
throw ex; throw ex;
} }
......
...@@ -38,10 +38,11 @@ public class ReportController { ...@@ -38,10 +38,11 @@ public class ReportController {
return reportService.getFilterReportTemplate(projectId, EnumServiceType.getEnumByCode(serviceType), period); return reportService.getFilterReportTemplate(projectId, EnumServiceType.getEnumByCode(serviceType), period);
} }
@RequestMapping(value = "generateByTotal/{projectId}/{mergeManual}/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "generateByTotal/{projectId}/{mergeManual}/{period}", method = RequestMethod.POST,
public OperationResultDto generateAllData(@PathVariable String projectId, @PathVariable Integer period, @RequestParam Optional<String> generator, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@PathVariable Boolean mergeManual) { public ResponseEntity generateAllData(@PathVariable String projectId, @PathVariable Integer period,
return reportService.generateData(projectId, EnumServiceType.VAT, mergeManual, period, null, generator); @RequestParam Optional<String> generator, @PathVariable Boolean mergeManual) {
return ResponseEntity.ok(reportService.generateData(projectId, EnumServiceType.VAT, mergeManual, period, null, generator));
} }
@RequestMapping(value = "getRunningJob/{projectId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "getRunningJob/{projectId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
...@@ -110,12 +111,12 @@ public class ReportController { ...@@ -110,12 +111,12 @@ public class ReportController {
} }
@RequestMapping(value = "addCellManualData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "addCellManualData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto addCellManualDataSource(@RequestBody ManualDataSourceDto data, @RequestHeader String from) { public ResponseEntity addCellManualDataSource(@RequestBody ManualDataSourceDto data, @RequestHeader String from) {
String projectId = StringUtils.EMPTY; String projectId = StringUtils.EMPTY;
if (StringUtils.isNotBlank(from) && from.split("@").length > 0) { if (StringUtils.isNotBlank(from) && from.split("@").length > 0) {
projectId = from.split("@")[0]; projectId = from.split("@")[0];
} }
return reportService.addCellManualDataSource(data, from); return ResponseEntity.ok(reportService.addCellManualDataSource(data, from));
} }
@RequestMapping(value = "addDataSource", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "addDataSource", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
......
package pwc.taxtech.atms.dto.vatdto; package pwc.taxtech.atms.dto.vatdto;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Select;
import pwc.taxtech.atms.common.util.MyAsserts; import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.entity.Project; import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.Template; import pwc.taxtech.atms.entity.Template;
...@@ -27,9 +34,8 @@ public class WrapPeriodJobDto { ...@@ -27,9 +34,8 @@ public class WrapPeriodJobDto {
job.setProjectId(projectId); job.setProjectId(projectId);
job.setPeriod(period); job.setPeriod(period);
job.setId(UUID.randomUUID().toString()); job.setId(UUID.randomUUID().toString());
job.setStatus(STATUS_BEGIN);
job.setCurrentStep(STEP_UPDATE_CONFIG); job.setCurrentStep(STEP_UPDATE_CONFIG);
setStatus(job,STEP_UPDATE_CONFIG,STATUS_BEGIN);
StringBuilder builder = new StringBuilder(STEP_UPDATE_CONFIG); StringBuilder builder = new StringBuilder(STEP_UPDATE_CONFIG);
templates.forEach(m -> { templates.forEach(m -> {
builder.append(",").append(m.getCode()); builder.append(",").append(m.getCode());
...@@ -38,4 +44,53 @@ public class WrapPeriodJobDto { ...@@ -38,4 +44,53 @@ public class WrapPeriodJobDto {
job.setStepsCode(builder.toString()); job.setStepsCode(builder.toString());
return job; return job;
} }
@Getter
@Setter
public static class Task {
String code;
String status;
}
public static List<Task> fromJson(String taskJson) {
return JSON.parseObject(taskJson, new TypeReference<List<Task>>() {});
}
public static String toJson(List<Task> tasks) {
return JSON.toJSONString(tasks);
}
public static void setStatus(PeriodJob periodJob, String code, String status) {
List<Task> list;
if (StringUtils.isBlank(periodJob.getStatus())) {
list = new ArrayList<>();
} else {
list = fromJson(periodJob.getStatus());
}
Task t = new Task();
t.code = code;
t.status = status;
boolean contains = false;
for (Task m : list) {
if (m.code.equals(t.code)) {
m.status = status;
contains = true;
break;
}
}
if(!contains)list.add(t);
periodJob.setStatus(toJson(list));
}
public static void setStatus(PeriodJob periodJob, String status) {
List<Task> list;
if (StringUtils.isBlank(periodJob.getStatus())) {
list = new ArrayList<>();
} else {
list = fromJson(periodJob.getStatus());
}
list.get(list.size()-1).status=status;
periodJob.setStatus(toJson(list));
}
} }
...@@ -18,4 +18,5 @@ public class Exceptions { ...@@ -18,4 +18,5 @@ public class Exceptions {
public static final ApiException PROJECT_PROJECT_EXCEPTION = new NotFoundException("not found project"); public static final ApiException PROJECT_PROJECT_EXCEPTION = new NotFoundException("not found project");
public static final ApiException NOT_FOUND_TEMPLATE_GROUP_EXCEPTION = new NotFoundException("not found template group"); public static final ApiException NOT_FOUND_TEMPLATE_GROUP_EXCEPTION = new NotFoundException("not found template group");
public static final ApiException NOT_FOUND_EXCEPTION = new NotFoundException("not found resources"); public static final ApiException NOT_FOUND_EXCEPTION = new NotFoundException("not found resources");
public static final ApiException REPORT_IN_PROCESS_OR_AGREED_EXCEPTION = new PreconditionFailedException("report in approval or agreed result");
} }
package pwc.taxtech.atms.exception;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
public class PreconditionFailedException extends ApiException {
public PreconditionFailedException() {
super();
}
public PreconditionFailedException(String message) {
super(message);
}
public PreconditionFailedException(String message, Throwable cause) {
super(message, cause);
}
public PreconditionFailedException(Throwable cause) {
super(cause);
}
@Override
public <Object> ResponseEntity handle() {
return ResponseEntity.status(HttpStatus.PRECONDITION_FAILED).build();
}
}
\ No newline at end of file
...@@ -988,7 +988,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService { ...@@ -988,7 +988,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService {
//endregion //endregion
//1. 如果将标准科目对应到企业科目的父级,那么该企业科目的子级都对应到该标准科目 //1. 如果将标准科目对应到企业科目的父级,那么该企业科目的子级都对应到该标准科目
updateManualMapChildAccount(eaList, eAccount, stdAccount, accountSetId, industryId, organization.getId()); // updateManualMapChildAccount(eaList, eAccount, stdAccount, accountSetId, industryId, organization.getId());
//region 添加日志 //region 添加日志
OperationLogDto operationLogDto = new OperationLogDto(); OperationLogDto operationLogDto = new OperationLogDto();
...@@ -1009,13 +1009,13 @@ public class EnterpriseAccountServiceImpl extends AbstractService { ...@@ -1009,13 +1009,13 @@ public class EnterpriseAccountServiceImpl extends AbstractService {
//region 手动对应当前的所有父级科目 //region 手动对应当前的所有父级科目
//清空ParentAccountMapResult //清空ParentAccountMapResult
this.mapParentAccountResult = Maps.newHashMap(); // this.mapParentAccountResult = Maps.newHashMap();
mapAccountUpdateParent(Lists.newArrayList(accountMapDto.getEnterpriseAccountCodes()), accountSetId, industryId, // mapAccountUpdateParent(Lists.newArrayList(accountMapDto.getEnterpriseAccountCodes()), accountSetId, industryId,
organization.getId(), true); // organization.getId(), true);
//endregion //endregion
AccountMapDto mapDto = new AccountMapDto(); AccountMapDto mapDto = new AccountMapDto();
mapDto.setParentAccountMappingResult(this.mapParentAccountResult); mapDto.setParentAccountMappingResult(this.mapParentAccountResult); //todo 此处有线程安全问题
return OperationResultDto.success(mapDto); return OperationResultDto.success(mapDto);
} }
......
...@@ -125,7 +125,7 @@ public class ApprovalService { ...@@ -125,7 +125,7 @@ public class ApprovalService {
@Transactional @Transactional
public void checkTask(String taskId, String decide) { public void checkTask(String instanceId, String decide,String comment) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
PeriodApprove pa = new PeriodApprove(); PeriodApprove pa = new PeriodApprove();
switch (decide) { switch (decide) {
...@@ -140,23 +140,40 @@ public class ApprovalService { ...@@ -140,23 +140,40 @@ public class ApprovalService {
default: default:
throw new BadParameterException("not support decide param type"); throw new BadParameterException("not support decide param type");
} }
List<Attachment> attachments = taskService.getTaskAttachments(taskId); List<Task> tasks = taskService.createTaskQuery().taskAssignee(Constant.ASSIGNEE_MANAGER).processInstanceId(
instanceId).list();
if (tasks != null && tasks.size() == 1) {
Task task = tasks.get(0);
List<Attachment> attachments = taskService.getTaskAttachments(task.getId());
if (attachments != null && attachments.size() == 1) { if (attachments != null && attachments.size() == 1) {
String uuid = attachments.get(0).getDescription(); String uuid = attachments.get(0).getDescription();
taskService.complete(taskId, map); taskService.complete(task.getId(), map);
pa.setId(uuid); pa.setId(uuid);
pa.setApprovalBy(authUserHelper.getCurrentUserId() == null ? "Admin" : authUserHelper.getCurrentUserId());
pa.setApprovalTime(new Date());
pa.setApprovalResualt(comment);
periodApproveMapper.updateByPrimaryKeySelective(pa); periodApproveMapper.updateByPrimaryKeySelective(pa);
PeriodApprove result = periodApproveMapper.selectByPrimaryKey(uuid);
//save report on service
} else { } else {
logger.warn("task must not null or size gt 1"); logger.warn("task must not null or size gt 1");
} }
} else {
logger.warn("task must not null or size eq 1");
}
} }
public Template getTemplateInfo(Long templateId) { public Template getTemplateInfo(Long templateId) {
return templateMapper.selectByPrimaryKey(templateId); return templateMapper.selectByPrimaryKey(templateId);
} }
public String getApprovalStatus(String projectId, Integer period) {
return periodApproveMapper.getStatusByProjectIdAndPeriod(projectId,period);
}
} }
...@@ -45,6 +45,7 @@ import java.util.stream.Collectors; ...@@ -45,6 +45,7 @@ import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.util.SpringContextUtil.reportMapper; import static pwc.taxtech.atms.common.util.SpringContextUtil.reportMapper;
import static pwc.taxtech.atms.constant.Constant.EMPTY; import static pwc.taxtech.atms.constant.Constant.EMPTY;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component @Component
public class ReportGeneratorImpl { public class ReportGeneratorImpl {
...@@ -87,18 +88,18 @@ public class ReportGeneratorImpl { ...@@ -87,18 +88,18 @@ public class ReportGeneratorImpl {
return periodResources; return periodResources;
} }
@Transactional
public void updateWorkbookCaclsValueToDb(String projectId, Integer period, Workbook workbook, PeriodResources resources, public void updateWorkbookCaclsValueToDb(String projectId, Integer period, Workbook workbook, PeriodResources resources,
Boolean isMergeMunual, PeriodJob job) { Boolean isMergeMunual, PeriodJob job) {
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
String code = sheet.getSheetName(); String code = sheet.getSheetName();
job.setCurrentStep(code); logger.info("-------------------------------------Begin Job [{}]------------------------------------------------------", code);
setStatus(job,code,STATUS_BEGIN);
periodJobMapper.updateByPrimaryKey(job);
Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream() Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream()
.filter(a -> a.getCode().equals(code)) .filter(a -> a.getCode().equals(code))
.findFirst(); .findFirst();
try {
Long templateId; Long templateId;
if (periodTemplate.isPresent()) { if (periodTemplate.isPresent()) {
...@@ -273,7 +274,7 @@ public class ReportGeneratorImpl { ...@@ -273,7 +274,7 @@ public class ReportGeneratorImpl {
// data = cell.getStringCellValue(); // data = cell.getStringCellValue();
// } // }
} else { } else {
data = EMPTY; data = "0.0";
} }
if (StringUtils.isNotBlank(data)) { if (StringUtils.isNotBlank(data)) {
...@@ -367,7 +368,7 @@ public class ReportGeneratorImpl { ...@@ -367,7 +368,7 @@ public class ReportGeneratorImpl {
cellDataSource.setProjectId(projectId); cellDataSource.setProjectId(projectId);
SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource); SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
periodCellDataMapper.updateByPrimaryKeySelective(cellData); periodCellDataMapper.updateByPrimaryKeySelective(cellData);
}else if(cellDataList.isEmpty()){ } else if (cellDataList.isEmpty()) {
PeriodCellData cellData = new PeriodCellData(); PeriodCellData cellData = new PeriodCellData();
Long cellDataId = distributedIdService.nextId(); Long cellDataId = distributedIdService.nextId();
cellData.setId(cellDataId); cellData.setId(cellDataId);
...@@ -395,7 +396,7 @@ public class ReportGeneratorImpl { ...@@ -395,7 +396,7 @@ public class ReportGeneratorImpl {
cellDataSource.setProjectId(projectId); cellDataSource.setProjectId(projectId);
SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource); SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
periodCellDataMapper.insert(cellData); periodCellDataMapper.insert(cellData);
}else { } else {
logger.warn("should not be !!!"); logger.warn("should not be !!!");
} }
...@@ -404,18 +405,14 @@ public class ReportGeneratorImpl { ...@@ -404,18 +405,14 @@ public class ReportGeneratorImpl {
} }
} }
} }
setStatus(job,code,STATUS_END);
} catch (Exception e) {
e.printStackTrace();
job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("cacals report for code " + code + " failed");
} finally {
periodJobMapper.updateByPrimaryKey(job); periodJobMapper.updateByPrimaryKey(job);
} logger.info("-------------------------------------End Job [{}]------------------------------------------------------", code);
} }
} }
private List<PeriodReport> createReportsByTemplates(Workbook workbook, List<PeriodTemplate> periodTemplateList, String projectId, Integer period) { private List<PeriodReport> createReportsByTemplates(Workbook
workbook, List<PeriodTemplate> periodTemplateList, String projectId, Integer period) {
List<PeriodReport> reports = new ArrayList<>(); List<PeriodReport> reports = new ArrayList<>();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
...@@ -471,6 +468,7 @@ public class ReportGeneratorImpl { ...@@ -471,6 +468,7 @@ public class ReportGeneratorImpl {
List<PeriodCellTemplate> tempPeriodCellTemplateList = resources.getPeriodCellTemplates().stream() List<PeriodCellTemplate> tempPeriodCellTemplateList = resources.getPeriodCellTemplates().stream()
.filter(a -> a.getReportTemplateId().equals(templateId)) .filter(a -> a.getReportTemplateId().equals(templateId))
.collect(Collectors.toList()); .collect(Collectors.toList());
tempPeriodCellTemplateList.forEach(a -> { tempPeriodCellTemplateList.forEach(a -> {
Optional<PeriodCellTemplateConfig> tempCellTemplateConfig = resources.getPeriodCellTemplateConfigs().stream() Optional<PeriodCellTemplateConfig> tempCellTemplateConfig = resources.getPeriodCellTemplateConfigs().stream()
.filter(item -> item.getCellTemplateId().equals(a.getCellTemplateId()) .filter(item -> item.getCellTemplateId().equals(a.getCellTemplateId())
...@@ -515,14 +513,16 @@ public class ReportGeneratorImpl { ...@@ -515,14 +513,16 @@ public class ReportGeneratorImpl {
return periodTemplateMapper.selectByExample(periodTemplateExample); return periodTemplateMapper.selectByExample(periodTemplateExample);
} }
private List<PeriodCellTemplate> queryPeriodCellTemplates(String projectId, Integer period, List<Long> periodTemplateIdList) { private List<PeriodCellTemplate> queryPeriodCellTemplates(String projectId, Integer
period, List<Long> periodTemplateIdList) {
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample(); PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
if (periodTemplateIdList.isEmpty()) periodTemplateIdList.add(Long.MAX_VALUE); if (periodTemplateIdList.isEmpty()) periodTemplateIdList.add(Long.MAX_VALUE);
periodCellTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period); periodCellTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period);
return periodCellTemplateMapper.selectByExample(periodCellTemplateExample); return periodCellTemplateMapper.selectByExample(periodCellTemplateExample);
} }
private List<PeriodCellTemplateConfig> queryPeriodCellTemplateConfigs(String projectId, Integer period, List<Long> periodTemplateIdList) { private List<PeriodCellTemplateConfig> queryPeriodCellTemplateConfigs(String projectId, Integer
period, List<Long> periodTemplateIdList) {
PeriodCellTemplateConfigExample periodCellTemplateConfigExample = new PeriodCellTemplateConfigExample(); PeriodCellTemplateConfigExample periodCellTemplateConfigExample = new PeriodCellTemplateConfigExample();
periodCellTemplateConfigExample.createCriteria().andProjectIdEqualTo(projectId).andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period); periodCellTemplateConfigExample.createCriteria().andProjectIdEqualTo(projectId).andReportTemplateIdIn(periodTemplateIdList).andPeriodEqualTo(period);
return periodCellTemplateConfigMapper.selectByExample(periodCellTemplateConfigExample); return periodCellTemplateConfigMapper.selectByExample(periodCellTemplateConfigExample);
...@@ -605,7 +605,8 @@ public class ReportGeneratorImpl { ...@@ -605,7 +605,8 @@ public class ReportGeneratorImpl {
workbook.addToolPack(udfToolpack); workbook.addToolPack(udfToolpack);
} }
public List<CellCalcInfoDto> getCellCalcInfo(List<Long> templateIdList, Integer periodParam, String projectId) { public List<CellCalcInfoDto> getCellCalcInfo(List<Long> templateIdList, Integer periodParam, String
projectId) {
//already finished by 20180711 //already finished by 20180711
int period = 0; int period = 0;
if (periodParam != null) { if (periodParam != null) {
...@@ -648,7 +649,8 @@ public class ReportGeneratorImpl { ...@@ -648,7 +649,8 @@ public class ReportGeneratorImpl {
return cellCalcInfoDtos; return cellCalcInfoDtos;
} }
private void fixedPCTParsedFormula(List<PeriodCellTemplateConfigExtendDto> periodCellTemplateConfigExtendDtos, String projectId, int period) { private void fixedPCTParsedFormula
(List<PeriodCellTemplateConfigExtendDto> periodCellTemplateConfigExtendDtos, String projectId, int period) {
Map<String, List<PCTEntity>> formulaMapToPCT = new HashMap<>(); Map<String, List<PCTEntity>> formulaMapToPCT = new HashMap<>();
Map<PeriodCellTemplateConfig, List<String>> configMapToPCTs = new HashMap<>(); Map<PeriodCellTemplateConfig, List<String>> configMapToPCTs = new HashMap<>();
Set<PCTEntity> parameter = new HashSet<>(); Set<PCTEntity> parameter = new HashSet<>();
......
...@@ -17,6 +17,7 @@ import pwc.taxtech.atms.common.CommonUtils; ...@@ -17,6 +17,7 @@ import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.util.BeanUtil; import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.common.util.MyAsserts; import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.*; import pwc.taxtech.atms.constant.enums.*;
import pwc.taxtech.atms.dao.*; import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dpo.ReportDto; import pwc.taxtech.atms.dpo.ReportDto;
...@@ -43,6 +44,8 @@ import java.util.regex.Matcher; ...@@ -43,6 +44,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component @Component
public class ReportServiceImpl { public class ReportServiceImpl {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class); private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
...@@ -103,6 +106,8 @@ public class ReportServiceImpl { ...@@ -103,6 +106,8 @@ public class ReportServiceImpl {
private DistributedIdService distributedIdService; private DistributedIdService distributedIdService;
@Autowired @Autowired
private PeriodJobMapper periodJobMapper; private PeriodJobMapper periodJobMapper;
@Autowired
private PeriodApproveMapper periodApprovalMapper;
public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) { public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
OperationResultDto<List<ReportDto>> result = new OperationResultDto<>(); OperationResultDto<List<ReportDto>> result = new OperationResultDto<>();
...@@ -265,24 +270,17 @@ public class ReportServiceImpl { ...@@ -265,24 +270,17 @@ public class ReportServiceImpl {
} }
@Transactional
private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) { private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) {
try { setStatus(job, STATUS_BEGIN);
job.setStatus(WrapPeriodJobDto.STATUS_BEGIN); periodJobMapper.updateByPrimaryKey(job);
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate(); List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData); clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
copyTemplateAndConfigFromAdmin(projectId, templates, period); copyTemplateAndConfigFromAdmin(projectId, templates, period);
} catch (Exception ex) { setStatus(job, STATUS_END);
job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("error update config with projectId " + projectId + " period" + period);
logger.error(ex.getMessage(), ex);
}finally {
periodJobMapper.updateByPrimaryKey(job); periodJobMapper.updateByPrimaryKey(job);
} }
}
private List<Template> getTemplatesByProjectId(String projectId) { private List<Template> getTemplatesByProjectId(String projectId) {
MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_PROJECT_EXCEPTION); MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_PROJECT_EXCEPTION);
...@@ -473,18 +471,19 @@ public class ReportServiceImpl { ...@@ -473,18 +471,19 @@ public class ReportServiceImpl {
public OperationResultDto generateData(String projectId, EnumServiceType serviceType, Boolean isMergeManualData, public OperationResultDto generateData(String projectId, EnumServiceType serviceType, Boolean isMergeManualData,
Integer periodParam, Integer reportType, Optional<String> generator) { Integer periodParam, Integer reportType, Optional<String> generator) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
try {
if (serviceType.equals(EnumServiceType.VAT) && (periodParam == null || periodParam <= 0)) {
operationResultDto.setResultMsg("PeriodRequiredForVAT");
return operationResultDto;
}
MyAsserts.assertEq(serviceType, EnumServiceType.VAT, new NotFoundException()); MyAsserts.assertEq(serviceType, EnumServiceType.VAT, new NotFoundException());
PeriodJobExample example = new PeriodJobExample(); PeriodJobExample example = new PeriodJobExample();
example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(periodParam) example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(periodParam)
.andStatusEqualTo(WrapPeriodJobDto.STATUS_BEGIN); .andStatusEqualTo(WrapPeriodJobDto.STATUS_BEGIN);
MyAsserts.assertEmpty(periodJobMapper.selectByExample(example), Exceptions.TASK_HAS_BEGINNING); MyAsserts.assertEmpty(periodJobMapper.selectByExample(example), Exceptions.TASK_HAS_BEGINNING);
String status = periodApprovalMapper.getStatusByProjectIdAndPeriod(projectId, periodParam);
MyAsserts.assertTrue(status == null || status.equals(Constant.APPROVAL_DISAGREED), Exceptions.REPORT_IN_PROCESS_OR_AGREED_EXCEPTION);
try {
if (serviceType.equals(EnumServiceType.VAT) && (periodParam == null || periodParam <= 0)) {
operationResultDto.setResultMsg("PeriodRequiredForVAT");
return operationResultDto;
}
List<Template> templates = getTemplatesByProjectId(projectId); List<Template> templates = getTemplatesByProjectId(projectId);
...@@ -508,14 +507,10 @@ public class ReportServiceImpl { ...@@ -508,14 +507,10 @@ public class ReportServiceImpl {
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll(); evaluator.evaluateAll();
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources,isMergeManualData, genJob); reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
} catch (Exception e) {
genJob.setStatus(WrapPeriodJobDto.STATUS_END); setStatus(genJob, STATUS_ERROR);
periodJobMapper.updateByPrimaryKey(genJob); genJob.setErrorMsg("Sever error " + e.getMessage());
}catch (Exception e){
genJob.setStatus(WrapPeriodJobDto.STATUS_ERROR);
genJob.setErrorMsg("Sever error");
periodJobMapper.updateByPrimaryKey(genJob); periodJobMapper.updateByPrimaryKey(genJob);
e.printStackTrace(); e.printStackTrace();
} }
...@@ -729,7 +724,7 @@ public class ReportServiceImpl { ...@@ -729,7 +724,7 @@ public class ReportServiceImpl {
private Integer convertType(Integer dataSourceType) { private Integer convertType(Integer dataSourceType) {
if (dataSourceType.equals(FormulaDataSourceDetailType.InputInvoiceDataSourceDto.getCode())) { if (dataSourceType.equals(FormulaDataSourceDetailType.InputInvoiceDataSourceDto.getCode())) {
return CellDataSourceType.InputInvoice.getCode(); return CellDataSourceType.InputInvoice.getCode();
} else if(dataSourceType.equals(FormulaDataSourceDetailType.OutputInvoiceDataSourceDto.getCode())){ } else if (dataSourceType.equals(FormulaDataSourceDetailType.OutputInvoiceDataSourceDto.getCode())) {
return CellDataSourceType.OutputInvoice.getCode(); return CellDataSourceType.OutputInvoice.getCode();
} else { } else {
return CellDataSourceType.Formula.getCode(); return CellDataSourceType.Formula.getCode();
...@@ -739,9 +734,10 @@ public class ReportServiceImpl { ...@@ -739,9 +734,10 @@ public class ReportServiceImpl {
private Integer convetToFType(Integer cellDataSourceType) { private Integer convetToFType(Integer cellDataSourceType) {
if (cellDataSourceType.equals(CellDataSourceType.InputInvoice.getCode())) { if (cellDataSourceType.equals(CellDataSourceType.InputInvoice.getCode())) {
return FormulaDataSourceType.InputInvoice.getCode(); return FormulaDataSourceType.InputInvoice.getCode();
} if(cellDataSourceType.equals(CellDataSourceType.OutputInvoice.getCode())){ }
if (cellDataSourceType.equals(CellDataSourceType.OutputInvoice.getCode())) {
return FormulaDataSourceType.OutputInvoice.getCode(); return FormulaDataSourceType.OutputInvoice.getCode();
}else { } else {
return FormulaDataSourceType.Other.getCode(); return FormulaDataSourceType.Other.getCode();
} }
} }
...@@ -859,6 +855,9 @@ public class ReportServiceImpl { ...@@ -859,6 +855,9 @@ public class ReportServiceImpl {
public OperationResultDto addCellManualDataSource(ManualDataSourceDto data, String projectId) { public OperationResultDto addCellManualDataSource(ManualDataSourceDto data, String projectId) {
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
String status = periodApprovalMapper.getStatusByProjectIdAndPeriod(projectId, data.getPeriod());
MyAsserts.assertTrue(status == null || status.equals(Constant.APPROVAL_DISAGREED), Exceptions.REPORT_IN_PROCESS_OR_AGREED_EXCEPTION);
try { try {
if (data.getCellId() == null) { if (data.getCellId() == null) {
...@@ -881,7 +880,8 @@ public class ReportServiceImpl { ...@@ -881,7 +880,8 @@ public class ReportServiceImpl {
PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(data.getCellId()); PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(data.getCellId());
if (cellData.getData() != data.getAmount().toString()) { if (cellData.getData() != data.getAmount().toString()) {
cellData.setData(data.getAmount().toString()); cellData.setData(data.getAmount().toString());
if(StringUtils.isEmpty(cellData.getFormulaExp()))cellData.setFormulaExp(data.getAmount().toString()); if (StringUtils.isEmpty(cellData.getFormulaExp()))
cellData.setFormulaExp(data.getAmount().toString());
periodCellDataMapper.updateByPrimaryKeySelective(cellData); periodCellDataMapper.updateByPrimaryKeySelective(cellData);
} }
} }
......
jdbc_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
jdbc_user=TAX_ADMIN
jdbc_password=taxadmin2018
#jdbc_password=111111
jdbc_admin_db=tax_admin
#jdbc_url=jdbc:oracle:thin:@10.158.230.144:11521:XE #jdbc_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
#jdbc_user=tax_admin_longi #jdbc_user=TAX_ADMIN
#jdbc_password=tax_admin_longi #jdbc_password=taxadmin2018
##jdbc_password=111111 ##jdbc_password=111111
#jdbc_admin_db=tax_admin_longi #jdbc_admin_db=tax_admin
jdbc_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
jdbc_user=tax_admin_longi
jdbc_password=tax_admin_longi
#jdbc_password=111111
jdbc_admin_db=tax_admin_longi
jdbc2_url=jdbc:oracle:thin:@10.158.230.144:11521:XE jdbc2_url=jdbc:oracle:thin:@10.158.230.144:11521:XE
jdbc2_user=pwc_invoice jdbc2_user=pwc_invoice
......
...@@ -133,4 +133,14 @@ public interface PeriodApproveMapper extends MyVatMapper { ...@@ -133,4 +133,14 @@ public interface PeriodApproveMapper extends MyVatMapper {
"</where>" + "</where>" +
"</script>") "</script>")
List<ApprovalTaskInfo> queryApprovalList(@Param("createId") String createId); List<ApprovalTaskInfo> queryApprovalList(@Param("createId") String createId);
@Select("" +
"SELECT " +
" STATUS AS status " +
"FROM " +
" ( SELECT * FROM PERIOD_APPROVE WHERE PROJECT_ID = #{projectId} AND PERIOD = #{period} ORDER BY CREATE_TIME DESC ) " +
"WHERE " +
" ROWNUM = 1" +
"")
String getStatusByProjectIdAndPeriod(@Param("projectId") String projectId, @Param("period") Integer period);
} }
\ No newline at end of file
...@@ -126,10 +126,10 @@ public interface PeriodReportMapper extends MyVatMapper { ...@@ -126,10 +126,10 @@ public interface PeriodReportMapper extends MyVatMapper {
" PERIOD_REPORT r " + " PERIOD_REPORT r " +
" LEFT JOIN PERIOD_TEMPLATE pt ON r.TEMPLATE_ID = pt.TEMPLATE_ID " + " LEFT JOIN PERIOD_TEMPLATE pt ON r.TEMPLATE_ID = pt.TEMPLATE_ID " +
"WHERE " + "WHERE " +
" r.PROJECT_ID = '1' " + " r.PROJECT_ID = #{projectId} " +
" AND r.PERIOD = 10 " + " AND r.PERIOD = #{period} " +
"ORDER BY " + "ORDER BY " +
" pt.ORDER_INDEX" + " pt.ORDER_INDEX" +
"") "")
List<PeriodReport> selectOrderReportIds(String projectId, Integer period); List<PeriodReport> selectOrderReportIds(@Param("projectId") String projectId, @Param("period") Integer period);
} }
\ No newline at end of file
...@@ -511,18 +511,18 @@ ...@@ -511,18 +511,18 @@
v['stdCode'] = codeToUpdate; v['stdCode'] = codeToUpdate;
v['stdName'] = nameToUpdate; v['stdName'] = nameToUpdate;
v['stdResult'] = getStdResult(codeToUpdate, nameToUpdate); v['stdResult'] = getStdResult(codeToUpdate, nameToUpdate);
//todo 需求不需要覆盖子节点
//找出该选中节点的所有子节点,然后复制,避免再次从数据库获取数据 //找出该选中节点的所有子节点,然后复制,避免再次从数据库获取数据
$scope.gridApiSubject.grid.rows.forEach(function (row) { // $scope.gridApiSubject.grid.rows.forEach(function (row) {
if (row.entity.parentCode === v.code) { // if (row.entity.parentCode === v.code) {
row.entity['stdCode'] = codeToUpdate; // row.entity['stdCode'] = codeToUpdate;
row.entity['stdName'] = nameToUpdate; // row.entity['stdName'] = nameToUpdate;
row.entity['stdResult'] = getStdResult(codeToUpdate, nameToUpdate); // row.entity['stdResult'] = getStdResult(codeToUpdate, nameToUpdate);
//
//再次更新该row下面的子节点如果存在的话 // //再次更新该row下面的子节点如果存在的话
updateChildrenMappedCodeNameRecursive($scope.gridApiSubject.grid.rows, row.entity['code'], codeToUpdate, nameToUpdate); // updateChildrenMappedCodeNameRecursive($scope.gridApiSubject.grid.rows, row.entity['code'], codeToUpdate, nameToUpdate);
} // }
}); // });
}); });
}; };
...@@ -855,7 +855,7 @@ ...@@ -855,7 +855,7 @@
if (newVal !== oldVal) { if (newVal !== oldVal) {
//初始化右侧标准科目的树,使用jquery fancytree的方式来显示树,所以需要用到ajax的方式 //初始化右侧标准科目的树,使用jquery fancytree的方式来显示树,所以需要用到ajax的方式
var stdAccountUrl = '/stdAccount/stdAccountHierarchy?orgID=' + $scope.selectedOrgID; var stdAccountUrl = '/stdAccount/stdAccountHierarchy?orgID=' + $scope.selectedOrgID;
commonWebService.initFancyTreeAjax('treetable', stdAccountUrl, mapStdAccount); commonWebService.initAllFancyTreeAjax('treetable', stdAccountUrl, mapStdAccount);
$scope.LoadEtsSubjectBySelectedOrg(); $scope.LoadEtsSubjectBySelectedOrg();
} }
......
...@@ -1036,7 +1036,7 @@ ...@@ -1036,7 +1036,7 @@
var excelIo = new GC.Spread.Excel.IO(); var excelIo = new GC.Spread.Excel.IO();
// here is excel IO API // here is excel IO API
excelIo.save(mainSpread.toJSON(), function (blob) { excelIo.save(mainSpread.toJSON(), function (blob) {
saveAs(blob, 'ttt.xlsx'); saveAs(blob, vatSessionService.project.name+'-'+vatSessionService.month+'-纳税申报.xlsx');
}, function (e) { }, function (e) {
alert(e); alert(e);
}); });
...@@ -1721,7 +1721,6 @@ ...@@ -1721,7 +1721,6 @@
} }
}); });
} else { } else {
SweetAlert.warning($translate.instant('CompleteDeclarationStatusCheck')); SweetAlert.warning($translate.instant('CompleteDeclarationStatusCheck'));
} }
} }
...@@ -2539,6 +2538,10 @@ ...@@ -2539,6 +2538,10 @@
}; };
$scope.commitApprove = function(){ $scope.commitApprove = function(){
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.month).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!');
}else{
SweetAlert.swal({ SweetAlert.swal({
title: "warning!", title: "warning!",
text: $translate.instant('报表提审后不能手工录入和重新生成!'), text: $translate.instant('报表提审后不能手工录入和重新生成!'),
...@@ -2561,16 +2564,25 @@ ...@@ -2561,16 +2564,25 @@
} }
});
}
$scope.doApprove = function(){ $scope.doApprove = function(){
$("#ApprovalComment").modal('show'); $("#ApprovalComment").modal('show');
} }
$scope.rejectApproval =function(){ $scope.rejectApproval =function(){
vatApproveService.checkTask(vatSessionService.approvalInfo.instanceId,'disagreed',$scope.comment).success(function(){
$("#ApprovalComment").modal('hide'); $("#ApprovalComment").modal('hide');
});
} }
$scope.agreeApproval =function(){ $scope.agreeApproval =function(){
vatApproveService.checkTask(vatSessionService.approvalInfo.instanceId,'agreed',$scope.comment).success(function(){
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Completed
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
$("#ApprovalComment").modal('hide'); $("#ApprovalComment").modal('hide');
});
} }
//排序 //排序
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
class="fa fa-floppy-o"></i>&nbsp;{{'报表提审'}}</span> class="fa fa-floppy-o"></i>&nbsp;{{'报表提审'}}</span>
<span ng-if="!isBSPL" ng-click="doApprove();"><i <span ng-if="!isBSPL" ng-click="doApprove();"><i
class="fa fa-floppy-o"></i>&nbsp;{{'报表审批'}}</span> class="fa fa-floppy-o"></i>&nbsp;{{'报表审批'}}</span>
<span ng-if="!isBSPL" ng-click="saveReportCache();"><i
class="fa fa-floppy-o"></i>&nbsp;{{'Save' | translate}}</span>
</div> </div>
<div class='report-container' id="reportContainer"> <div class='report-container' id="reportContainer">
...@@ -164,15 +166,15 @@ ...@@ -164,15 +166,15 @@
<table class="table"> <table class="table">
<caption>审核意见</caption> <caption>审核意见</caption>
<tr> <tr>
<td><textarea rows="3" class="form-control" ng-model="voucherComments">{{approvalComment}}</textarea> <td><textarea rows="3" class="form-control" ng-model="comment">{{comment}}</textarea>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="float:right;border-top:none;"> <td style="float:right;border-top:none;">
<button class="btn btn-sm" ng-click="rejectApproval()">审核通过 <button class="btn btn-sm" ng-click="rejectApproval()">驳回
</button> </button>
<button class="btn btn-sm" ng-click="agreeApproval()">审核拒绝 <button class="btn btn-sm" ng-click="agreeApproval()">通过
</button> </button>
</td> </td>
</tr> </tr>
......
...@@ -21,112 +21,12 @@ ...@@ -21,112 +21,12 @@
return $http.get('/approval/templateInfo/'+templateId, apiConfig.createVat()); return $http.get('/approval/templateInfo/'+templateId, apiConfig.createVat());
}, },
getExportOutputInvoiceList: function (param) { checkTask:function(taskId,decide,comment){
return $http.post('/outputInvoiceImport/getExportOutputInvoiceList', { return $http.put('/approval/check/'+taskId+'?decide='+decide+'&comment='+comment, {}, apiConfig.createVat());
PageInfo: param.pageInfo,
PeriodStart: param.periodStart,
PeriodEnd: param.periodEnd,
InvoiceType: param.invoiceType,
StartInvoiceDate: param.invoiceDateStart,
EndInvoiceDate: param.invoiceDateEnd,
ClassCode: param.classCode,
InvoiceNumber: param.invoiceNumber,
BuyerName: param.buyerName,
ProductName: param.productName,
AmountStart: param.amountStart,
AmountEnd: param.amountEnd,
TaxAmountStart: param.taxAmountStart,
TaxAmountEnd: param.taxAmountEnd,
}, apiConfig.createVat({ responseType: 'arraybuffer' }));
}, },
approvalStatus:function(projectId,period){
queryInputInvoiceList: function (param) { return $http.get('/approval/status/'+projectId+'/'+period,apiConfig.createVat({ignoreLoadingBar: true}))
return $http.post('/inputInvoiceImport/inputInvoicePreviewList', {
PageInfo: param.pageInfo,
PeriodStart: param.periodStart,
PeriodEnd: param.periodEnd,
CertificationDateStart: param.certificationDateStart,
CertificationDateEnd: param.certificationDateEnd,
InvoiceCode: param.invoiceCode,
InvoiceNumber: param.invoiceNumber,
SellerTaxNumber: param.sellerTaxNumber,
AmountStart: param.amountStart,
AmountEnd: param.amountEnd,
InvoiceType: param.invoiceType,
TaxAmountStart: param.taxAmountStart,
TaxAmountEnd: param.taxAmountEnd,
CertificationStatus: param.certificationStatus
}, apiConfig.createVat());
},
queryInputInvoiceItemList: function (inputInvoiceID) {
return $http.get('/inputInvoiceImport/inputInvoiceItemPreviewList/' + inputInvoiceID, apiConfig.createVat());
},
//导出进项发票数据
getExportInputInvoiceList: function (param) {
return $http.post('/inputInvoiceImport/exportQueryData/get', {
PageInfo: param.pageInfo,
PeriodStart: param.periodStart,
PeriodEnd: param.periodEnd,
CertificationDateStart: param.certificationDateStart,
CertificationDateEnd: param.certificationDateEnd,
InvoiceCode: param.invoiceCode,
InvoiceNumber: param.invoiceNumber,
SellerTaxNumber: param.sellerTaxNumber,
AmountStart: param.amountStart,
AmountEnd: param.amountEnd,
InvoiceType: param.invoiceType,
TaxAmountStart: param.taxAmountStart,
TaxAmountEnd: param.taxAmountEnd,
CertificationStatus: param.certificationStatus
}, apiConfig.createVat({ responseType: 'arraybuffer' }));
},
voucherSelectAdvancedByEntry: function (mainRelation, allJe, pagingInfo, listQueryCondition) {
return $http.post('/voucher/voucherSelectAdvancedByEntry', {
MainRelation: mainRelation,
AllJe: allJe,
PagingInfo: pagingInfo,
ListQueryCondition: listQueryCondition
}, apiConfig.create());
},
voucherSelectAdvancedByVoucher: function (mainRelation, allJe, pagingInfo, listQueryCondition) {
return $http.post('/voucher/voucherSelectAdvancedByVoucher', {
MainRelation: mainRelation,
AllJe: allJe,
PagingInfo: pagingInfo,
ListQueryCondition: listQueryCondition
}, apiConfig.create());
},
voucherSelectAdvancedCount: function (mainRelation, isEntryShow, allJe, listQueryCondition) {
return $http.post('/voucher/voucherSelectAdvancedCount', {
MainRelation: mainRelation,
AllJe: allJe,
IsEntryShow: isEntryShow,
ListQueryCondition: listQueryCondition
}, apiConfig.create());
},
getVoucherByConditon: function (mainRelation, allJe, period, vID, group, listQueryCondition) {
return $http.post('/voucher/getVoucherByConditon', {
MainRelation: mainRelation,
AllJe: allJe,
Period: period,
VID: vID,
Group: group,
ListQueryCondition: listQueryCondition
}, apiConfig.create());
},
getSelectWhereString: function (mainRelation, allJe, listQueryCondition) {
return $http.post('/voucher/getSelectWhereString', {
MainRelation: mainRelation,
AllJe: allJe,
ListQueryCondition: listQueryCondition
}, apiConfig.create());
},
getEnterpriseAccount: function () {
return $http.get('/voucher/getEnterpriseAccount', apiConfig.create());
} }
}; };
}]); }]);
\ No newline at end of file
...@@ -95,10 +95,14 @@ ...@@ -95,10 +95,14 @@
vatOperationLogService.addOperationLog(logInfo); vatOperationLogService.addOperationLog(logInfo);
data.dataSourceType = enums.cellDataSourceType.KeyIn; data.dataSourceType = enums.cellDataSourceType.KeyIn;
return $q.when(data); return $q.when(data);
}, function () { },function (data) {
if(data.status==412){
SweetAlert.error('报表提审中或审核已通过!');
}else{
logInfo.UpdateState = $translate.instant('ManualInputFail'); logInfo.UpdateState = $translate.instant('ManualInputFail');
SweetAlert.error($translate.instant('PleaseContactAdministrator')); SweetAlert.error($translate.instant('PleaseContactAdministrator'));
return vatOperationLogService.addOperationLog(logInfo); return vatOperationLogService.addOperationLog(logInfo);
}
}); });
}, },
deleteCellVoucher: function (voucherId, datasourceId) { deleteCellVoucher: function (voucherId, datasourceId) {
......
...@@ -252,6 +252,109 @@ webservices.factory('commonWebService', ['$http', 'apiConfig', 'loginContext', ' ...@@ -252,6 +252,109 @@ webservices.factory('commonWebService', ['$http', 'apiConfig', 'loginContext', '
node.setExpanded(false); node.setExpanded(false);
}); });
} }
},
initAllFancyTreeAjax: function (treeID, ajaxUrl, dblFn) {
var prefixUrl = loginContext.apiHost + constant.webapi.prefix;
var ajaxUrl = prefixUrl + ajaxUrl;
var ajaxSource = $.ajax({
url: ajaxUrl,
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', tokenType + ' ' + apiToken);
}
});
var treeOptions = {
extensions: ["edit", "glyph", "table", "filter"],
quicksearch: true,
checkbox: false,
glyph: glyph_opts,
source: ajaxSource,
table: {
checkboxColumnIdx: 1,
nodeColumnIdx: 2
},
dblclick: function (event, data) {
var node = data.node.data;
var code = node.code;
var name = node.fullName;
var acctProp = node.acctProp;
var direction = node.direction;
var hasChildren = node.hasChildren;
if (code != null) {
dblFn(code, name, acctProp, direction);
}
},
renderColumns: function (event, data) {
var node = data.node,
$tdList = $(node.tr).find(">td");
$tdList.eq(3).text(!!node.folder);
},
filter: {
autoApply: true, // Re-apply last filter if lazy data is loaded
autoExpand: true, // Expand all branches that contain matches while filtered
counter: true, // Show a badge with number of matching child nodes near parent icons
fuzzy: false, // Match single characters in order, e.g. 'fb' will match 'FooBar'
hideExpandedCounter: false, // Hide counter badge if parent is expanded
hideExpanders: false, // Hide expanders if all child nodes are hidden by filter
highlight: true, // Highlight matches by wrapping inside <mark> tags
leavesOnly: false, // Match end nodes only
nodata: true, // Display a 'no data' status node if result is empty
mode: "hide", // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
regularExpression: false,
matchWholeBranch: false
}
};
///由于fancyTree第一次ajax请求加载的时候,只需要把发送ajax option即可,不需要使用callback去赋值
///但是第二次ajax请求重新渲染fancytree的话,需要ajax.done获取返回的数据并做为参数传递给fancytree去重新渲染
///所以使用了tick来判断是否是首次请求
var tree = $.ui.fancytree.getTree("#" + treeID);
if (tree) {
ajaxSource.done(function (data) {
tree.reload(data).done(function () {
console.log('reloaded');
});
}).fail(function (err) { console.log(err); });
} else {
$("#" + treeID).fancytree(treeOptions);
}
$("input[name=fancytree-search]").keyup(function (e) {
var n,
tree = $.ui.fancytree.getTree("#" + treeID),
opts = {},
filterFunc = tree.options.filter.matchWholeBranch ? tree.filterBranches : tree.filterNodes,
match = $(this).val();
opts.nodata = tree.options.filter.nodata;
opts.leavesOnly = tree.options.filter.leavesOnly;
opts.highlight = tree.options.filter.highlight;
opts.hideExpanders = tree.options.filter.hideExpanders;
opts.fuzzy = tree.options.filter.fuzzy;
opts.autoApply = tree.options.filter.autoApply;
opts.mode = tree.options.filter.mode;
opts.autoExpand = tree.options.filter.autoExpand;
opts.counter = tree.options.filter.counter;
if (e && e.which === $.ui.keyCode.ESCAPE || $.trim(match) === "") {
$("input[name=fancytree-search]").val("");
tree.clearFilter();
return;
}
//opts.
if (tree.options.filter.regularExpression) {
// Pass function to perform match
n = filterFunc.call(tree, function (node) {
return new RegExp(match, "i").test(node.title);
}, opts);
} else {
// Pass a string to perform case insensitive matching
n = filterFunc.call(tree, match, opts);
}
}).focus();
} }
}; };
}]); }]);
\ No newline at end of file
...@@ -586,9 +586,20 @@ ...@@ -586,9 +586,20 @@
{ caption: '期间', width: '7%', dataField: "period"}, { caption: '期间', width: '7%', dataField: "period"},
{ caption: '提审人', width: '10%', dataField: "createBy"}, { caption: '提审人', width: '10%', dataField: "createBy"},
{ caption: '审批人', width: '10%', dataField: "approvalBy"}, { caption: '审批人', width: '10%', dataField: "approvalBy"},
{ caption: '审批状态', width: '10%', dataField: "status"}, { caption: '审批状态', width: '10%',
calculateCellValue: function(data) {
if(data.status=='disagreed'){
return '驳回';
}else if(data.status == 'agreed'){
return '通过';
}else if(data.status == 'committed'){
return '审核中';
}
}
},
{ caption: '审批意见', width: '15%', dataField: "approvalResult"}, { caption: '审批意见', width: '15%', dataField: "approvalResult"},
{ caption: '创建时间', width: '7.5%', dataField: "createTime"} { caption: '提审时间', width: '7.5%', dataField: "createTime"},
{ caption: '审批时间', width: '7.5%', dataField: "approvalTime"}
], ],
onRowClick: function (e) { onRowClick: function (e) {
$scope.goToService(e.data); $scope.goToService(e.data);
...@@ -602,12 +613,14 @@ ...@@ -602,12 +613,14 @@
$scope.goToService = function (approvalInfo) { $scope.goToService = function (approvalInfo) {
projectService.getProjectByID(approvalInfo.projectId).success( projectService.getProjectByID(approvalInfo.projectId).success(
function(result){ function(result){
vatApproveService.getApprovalTemplateInfo(approvalInfo.templateIds.split(",")[0]).success(
function(template){
vatSessionService.project = result; vatSessionService.project = result;
vatSessionService.project.projectName = approvalInfo.projectName; vatSessionService.project.projectName = approvalInfo.projectName;
vatSessionService.project.month = approvalInfo.period; vatSessionService.project.month = approvalInfo.period;
vatSessionService.month = approvalInfo.period; vatSessionService.month = approvalInfo.period;
vatApproveService.getApprovalTemplateInfo(approvalInfo.templateIds.split(",")[0]).success( vatSessionService.approvalInfo=approvalInfo;
function(template){
$state.go('vat.generateReport.reportView', { $state.go('vat.generateReport.reportView', {
id: approvalInfo.reportIds.split(",")[0], id: approvalInfo.reportIds.split(",")[0],
templateid: template.id, templateid: template.id,
......
...@@ -293,9 +293,10 @@ ...@@ -293,9 +293,10 @@
},1000); },1000);
} }
}).error(function () { }).error(function (data,status,config,statusText) {
$log.debug("generate all report may be some error"); if(status==412){
// taskError(_this); SweetAlert.error('报表提审中或审核已通过!');
}
}); });
} }
...@@ -350,7 +351,6 @@ ...@@ -350,7 +351,6 @@
} }
}; };
var startCaculate2 = function () { var startCaculate2 = function () {
if (vatSessionService.project.projectStatusList[vatSessionService.month] >= constant.ProjectStatusEnum.Generated) { if (vatSessionService.project.projectStatusList[vatSessionService.month] >= constant.ProjectStatusEnum.Generated) {
swal({ swal({
...@@ -570,6 +570,8 @@ ...@@ -570,6 +570,8 @@
item.status = 'completed'; item.status = 'completed';
if($scope.timer){ if($scope.timer){
$interval.cancel($scope.timer); $interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
} }
}else if(job.status == 'Begin'){ }else if(job.status == 'Begin'){
item.status = 'processing'; item.status = 'processing';
...@@ -587,10 +589,13 @@ ...@@ -587,10 +589,13 @@
updateTasksStatus(result.data); updateTasksStatus(result.data);
if(result.data.status=='Begin'){ if(result.data.status=='Begin'){
$scope.timer= $interval(function(){ $scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id).then(function(result){ vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id)
.success(function(result){
if(result.data && result.status == 200){ if(result.data && result.status == 200){
updateTasksStatus(result.data); updateTasksStatus(result.data);
} }
}).error(function(result){
$interval.cancel($scope.timer);
}); });
},1000); },1000);
......
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