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 {
}
@ResponseBody
@RequestMapping(value = "/check/{taskId}")
public void check(@PathVariable String taskId, @RequestParam String decide) {//only for manager role
approvalService.checkTask(taskId, decide);
@RequestMapping(value = "/check/{taskId}",method = RequestMethod.PUT)
public void check(@PathVariable String taskId, @RequestParam String decide, @RequestParam String comment) {//only for manager role
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}")//获取流程图
......
package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
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 pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.exception.ApiException;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.exception.ServiceException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@EnableWebMvc
@ControllerAdvice
public class AtmsExceptionHandler extends ResponseEntityExceptionHandler {
private static Logger LOGGER = LoggerFactory.getLogger(AtmsExceptionHandler.class);
@ExceptionHandler(value = {
ApplicationException.class,
ServiceException.class
ApiException.class
})
protected ResponseEntity<Object> handleExceptions(Exception ex) throws ServiceException {
LOGGER.error("Rest Exception!", ex);
......@@ -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) {
throw ex;
}
......
......@@ -38,10 +38,11 @@ public class ReportController {
return reportService.getFilterReportTemplate(projectId, EnumServiceType.getEnumByCode(serviceType), period);
}
@RequestMapping(value = "generateByTotal/{projectId}/{mergeManual}/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto generateAllData(@PathVariable String projectId, @PathVariable Integer period, @RequestParam Optional<String> generator,
@PathVariable Boolean mergeManual) {
return reportService.generateData(projectId, EnumServiceType.VAT, mergeManual, period, null, generator);
@RequestMapping(value = "generateByTotal/{projectId}/{mergeManual}/{period}", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity generateAllData(@PathVariable String projectId, @PathVariable Integer period,
@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)
......@@ -110,12 +111,12 @@ public class ReportController {
}
@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;
if (StringUtils.isNotBlank(from) && from.split("@").length > 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)
......
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.entity.Project;
import pwc.taxtech.atms.entity.Template;
......@@ -27,9 +34,8 @@ public class WrapPeriodJobDto {
job.setProjectId(projectId);
job.setPeriod(period);
job.setId(UUID.randomUUID().toString());
job.setStatus(STATUS_BEGIN);
job.setCurrentStep(STEP_UPDATE_CONFIG);
setStatus(job,STEP_UPDATE_CONFIG,STATUS_BEGIN);
StringBuilder builder = new StringBuilder(STEP_UPDATE_CONFIG);
templates.forEach(m -> {
builder.append(",").append(m.getCode());
......@@ -38,4 +44,53 @@ public class WrapPeriodJobDto {
job.setStepsCode(builder.toString());
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 {
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_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 {
//endregion
//1. 如果将标准科目对应到企业科目的父级,那么该企业科目的子级都对应到该标准科目
updateManualMapChildAccount(eaList, eAccount, stdAccount, accountSetId, industryId, organization.getId());
// updateManualMapChildAccount(eaList, eAccount, stdAccount, accountSetId, industryId, organization.getId());
//region 添加日志
OperationLogDto operationLogDto = new OperationLogDto();
......@@ -1009,13 +1009,13 @@ public class EnterpriseAccountServiceImpl extends AbstractService {
//region 手动对应当前的所有父级科目
//清空ParentAccountMapResult
this.mapParentAccountResult = Maps.newHashMap();
mapAccountUpdateParent(Lists.newArrayList(accountMapDto.getEnterpriseAccountCodes()), accountSetId, industryId,
organization.getId(), true);
// this.mapParentAccountResult = Maps.newHashMap();
// mapAccountUpdateParent(Lists.newArrayList(accountMapDto.getEnterpriseAccountCodes()), accountSetId, industryId,
// organization.getId(), true);
//endregion
AccountMapDto mapDto = new AccountMapDto();
mapDto.setParentAccountMappingResult(this.mapParentAccountResult);
mapDto.setParentAccountMappingResult(this.mapParentAccountResult); //todo 此处有线程安全问题
return OperationResultDto.success(mapDto);
}
......
......@@ -125,7 +125,7 @@ public class ApprovalService {
@Transactional
public void checkTask(String taskId, String decide) {
public void checkTask(String instanceId, String decide,String comment) {
Map<String, Object> map = new HashMap<>();
PeriodApprove pa = new PeriodApprove();
switch (decide) {
......@@ -140,23 +140,40 @@ public class ApprovalService {
default:
throw new BadParameterException("not support decide param type");
}
List<Attachment> attachments = taskService.getTaskAttachments(taskId);
if (attachments != null && attachments.size() == 1) {
String uuid = attachments.get(0).getDescription();
taskService.complete(taskId, map);
pa.setId(uuid);
periodApproveMapper.updateByPrimaryKeySelective(pa);
PeriodApprove result = periodApproveMapper.selectByPrimaryKey(uuid);
//save report on service
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) {
String uuid = attachments.get(0).getDescription();
taskService.complete(task.getId(), map);
pa.setId(uuid);
pa.setApprovalBy(authUserHelper.getCurrentUserId() == null ? "Admin" : authUserHelper.getCurrentUserId());
pa.setApprovalTime(new Date());
pa.setApprovalResualt(comment);
periodApproveMapper.updateByPrimaryKeySelective(pa);
} else {
logger.warn("task must not null or size gt 1");
}
} else {
logger.warn("task must not null or size gt 1");
logger.warn("task must not null or size eq 1");
}
}
public Template getTemplateInfo(Long templateId) {
return templateMapper.selectByPrimaryKey(templateId);
}
public String getApprovalStatus(String projectId, Integer period) {
return periodApproveMapper.getStatusByProjectIdAndPeriod(projectId,period);
}
}
......@@ -17,6 +17,7 @@ import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.*;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dpo.ReportDto;
......@@ -43,6 +44,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component
public class ReportServiceImpl {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
......@@ -103,6 +106,8 @@ public class ReportServiceImpl {
private DistributedIdService distributedIdService;
@Autowired
private PeriodJobMapper periodJobMapper;
@Autowired
private PeriodApproveMapper periodApprovalMapper;
public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
OperationResultDto<List<ReportDto>> result = new OperationResultDto<>();
......@@ -265,23 +270,16 @@ public class ReportServiceImpl {
}
@Transactional
private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) {
try {
job.setStatus(WrapPeriodJobDto.STATUS_BEGIN);
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
setStatus(job, STATUS_BEGIN);
periodJobMapper.updateByPrimaryKey(job);
copyTemplateAndConfigFromAdmin(projectId, templates, period);
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
copyTemplateAndConfigFromAdmin(projectId, templates, period);
} catch (Exception ex) {
job.setStatus(WrapPeriodJobDto.STATUS_ERROR);
job.setErrorMsg("error update config with projectId " + projectId + " period" + period);
logger.error(ex.getMessage(), ex);
}finally {
periodJobMapper.updateByPrimaryKey(job);
}
setStatus(job, STATUS_END);
periodJobMapper.updateByPrimaryKey(job);
}
private List<Template> getTemplatesByProjectId(String projectId) {
......@@ -473,19 +471,20 @@ public class ReportServiceImpl {
public OperationResultDto generateData(String projectId, EnumServiceType serviceType, Boolean isMergeManualData,
Integer periodParam, Integer reportType, Optional<String> generator) {
OperationResultDto operationResultDto = new OperationResultDto();
MyAsserts.assertEq(serviceType, EnumServiceType.VAT, new NotFoundException());
PeriodJobExample example = new PeriodJobExample();
example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(periodParam)
.andStatusEqualTo(WrapPeriodJobDto.STATUS_BEGIN);
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;
}
MyAsserts.assertEq(serviceType, EnumServiceType.VAT, new NotFoundException());
PeriodJobExample example = new PeriodJobExample();
example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(periodParam)
.andStatusEqualTo(WrapPeriodJobDto.STATUS_BEGIN);
MyAsserts.assertEmpty(periodJobMapper.selectByExample(example), Exceptions.TASK_HAS_BEGINNING);
List<Template> templates = getTemplatesByProjectId(projectId);
PeriodJob genJob = WrapPeriodJobDto.createReportGenJob(projectId, periodParam, templates);
......@@ -508,14 +507,10 @@ public class ReportServiceImpl {
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources,isMergeManualData, genJob);
genJob.setStatus(WrapPeriodJobDto.STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
}catch (Exception e){
genJob.setStatus(WrapPeriodJobDto.STATUS_ERROR);
genJob.setErrorMsg("Sever error");
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
} catch (Exception e) {
setStatus(genJob, STATUS_ERROR);
genJob.setErrorMsg("Sever error " + e.getMessage());
periodJobMapper.updateByPrimaryKey(genJob);
e.printStackTrace();
}
......@@ -729,7 +724,7 @@ public class ReportServiceImpl {
private Integer convertType(Integer dataSourceType) {
if (dataSourceType.equals(FormulaDataSourceDetailType.InputInvoiceDataSourceDto.getCode())) {
return CellDataSourceType.InputInvoice.getCode();
} else if(dataSourceType.equals(FormulaDataSourceDetailType.OutputInvoiceDataSourceDto.getCode())){
} else if (dataSourceType.equals(FormulaDataSourceDetailType.OutputInvoiceDataSourceDto.getCode())) {
return CellDataSourceType.OutputInvoice.getCode();
} else {
return CellDataSourceType.Formula.getCode();
......@@ -739,9 +734,10 @@ public class ReportServiceImpl {
private Integer convetToFType(Integer cellDataSourceType) {
if (cellDataSourceType.equals(CellDataSourceType.InputInvoice.getCode())) {
return FormulaDataSourceType.InputInvoice.getCode();
} if(cellDataSourceType.equals(CellDataSourceType.OutputInvoice.getCode())){
}
if (cellDataSourceType.equals(CellDataSourceType.OutputInvoice.getCode())) {
return FormulaDataSourceType.OutputInvoice.getCode();
}else {
} else {
return FormulaDataSourceType.Other.getCode();
}
}
......@@ -859,6 +855,9 @@ public class ReportServiceImpl {
public OperationResultDto addCellManualDataSource(ManualDataSourceDto data, String projectId) {
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 {
if (data.getCellId() == null) {
......@@ -881,7 +880,8 @@ public class ReportServiceImpl {
PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(data.getCellId());
if (cellData.getData() != 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);
}
}
......
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_user=tax_admin_longi
#jdbc_password=tax_admin_longi
#jdbc_user=TAX_ADMIN
#jdbc_password=taxadmin2018
##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_user=pwc_invoice
......
......@@ -133,4 +133,14 @@ public interface PeriodApproveMapper extends MyVatMapper {
"</where>" +
"</script>")
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 {
" PERIOD_REPORT r " +
" LEFT JOIN PERIOD_TEMPLATE pt ON r.TEMPLATE_ID = pt.TEMPLATE_ID " +
"WHERE " +
" r.PROJECT_ID = '1' " +
" AND r.PERIOD = 10 " +
" r.PROJECT_ID = #{projectId} " +
" AND r.PERIOD = #{period} " +
"ORDER BY " +
" 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 @@
v['stdCode'] = codeToUpdate;
v['stdName'] = nameToUpdate;
v['stdResult'] = getStdResult(codeToUpdate, nameToUpdate);
//todo 需求不需要覆盖子节点
//找出该选中节点的所有子节点,然后复制,避免再次从数据库获取数据
$scope.gridApiSubject.grid.rows.forEach(function (row) {
if (row.entity.parentCode === v.code) {
row.entity['stdCode'] = codeToUpdate;
row.entity['stdName'] = nameToUpdate;
row.entity['stdResult'] = getStdResult(codeToUpdate, nameToUpdate);
//再次更新该row下面的子节点如果存在的话
updateChildrenMappedCodeNameRecursive($scope.gridApiSubject.grid.rows, row.entity['code'], codeToUpdate, nameToUpdate);
}
});
// $scope.gridApiSubject.grid.rows.forEach(function (row) {
// if (row.entity.parentCode === v.code) {
// row.entity['stdCode'] = codeToUpdate;
// row.entity['stdName'] = nameToUpdate;
// row.entity['stdResult'] = getStdResult(codeToUpdate, nameToUpdate);
//
// //再次更新该row下面的子节点如果存在的话
// updateChildrenMappedCodeNameRecursive($scope.gridApiSubject.grid.rows, row.entity['code'], codeToUpdate, nameToUpdate);
// }
// });
});
};
......@@ -855,7 +855,7 @@
if (newVal !== oldVal) {
//初始化右侧标准科目的树,使用jquery fancytree的方式来显示树,所以需要用到ajax的方式
var stdAccountUrl = '/stdAccount/stdAccountHierarchy?orgID=' + $scope.selectedOrgID;
commonWebService.initFancyTreeAjax('treetable', stdAccountUrl, mapStdAccount);
commonWebService.initAllFancyTreeAjax('treetable', stdAccountUrl, mapStdAccount);
$scope.LoadEtsSubjectBySelectedOrg();
}
......
......@@ -1036,7 +1036,7 @@
var excelIo = new GC.Spread.Excel.IO();
// here is excel IO API
excelIo.save(mainSpread.toJSON(), function (blob) {
saveAs(blob, 'ttt.xlsx');
saveAs(blob, vatSessionService.project.name+'-'+vatSessionService.month+'-纳税申报.xlsx');
}, function (e) {
alert(e);
});
......@@ -1721,7 +1721,6 @@
}
});
} else {
SweetAlert.warning($translate.instant('CompleteDeclarationStatusCheck'));
}
}
......@@ -2539,26 +2538,33 @@
};
$scope.commitApprove = function(){
SweetAlert.swal({
title: "warning!",
text: $translate.instant('报表提审后不能手工录入和重新生成!'),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
var approveParam={};
approveParam.projectId = vatSessionService.project.id;
approveParam.periodDate = vatSessionService.project.periodDate;
vatApproveService.commitNewApproval(approveParam);
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.month).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!');
}else{
SweetAlert.swal({
title: "warning!",
text: $translate.instant('报表提审后不能手工录入和重新生成!'),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
var approveParam={};
approveParam.projectId = vatSessionService.project.id;
approveParam.periodDate = vatSessionService.project.periodDate;
vatApproveService.commitNewApproval(approveParam);
}
});
}
});
});
}
$scope.doApprove = function(){
......@@ -2566,11 +2572,17 @@
}
$scope.rejectApproval =function(){
$("#ApprovalComment").modal('hide');
vatApproveService.checkTask(vatSessionService.approvalInfo.instanceId,'disagreed',$scope.comment).success(function(){
$("#ApprovalComment").modal('hide');
});
}
$scope.agreeApproval =function(){
$("#ApprovalComment").modal('hide');
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');
});
}
//排序
......
......@@ -6,6 +6,8 @@
class="fa fa-floppy-o"></i>&nbsp;{{'报表提审'}}</span>
<span ng-if="!isBSPL" ng-click="doApprove();"><i
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 class='report-container' id="reportContainer">
......@@ -164,15 +166,15 @@
<table class="table">
<caption>审核意见</caption>
<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>
</tr>
<tr>
<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 class="btn btn-sm" ng-click="agreeApproval()">审核拒绝
<button class="btn btn-sm" ng-click="agreeApproval()">通过
</button>
</td>
</tr>
......
......@@ -21,112 +21,12 @@
return $http.get('/approval/templateInfo/'+templateId, apiConfig.createVat());
},
getExportOutputInvoiceList: function (param) {
return $http.post('/outputInvoiceImport/getExportOutputInvoiceList', {
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' }));
checkTask:function(taskId,decide,comment){
return $http.put('/approval/check/'+taskId+'?decide='+decide+'&comment='+comment, {}, apiConfig.createVat());
},
queryInputInvoiceList: function (param) {
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());
approvalStatus:function(projectId,period){
return $http.get('/approval/status/'+projectId+'/'+period,apiConfig.createVat({ignoreLoadingBar: true}))
}
};
}]);
\ No newline at end of file
......@@ -95,10 +95,14 @@
vatOperationLogService.addOperationLog(logInfo);
data.dataSourceType = enums.cellDataSourceType.KeyIn;
return $q.when(data);
}, function () {
logInfo.UpdateState = $translate.instant('ManualInputFail');
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
return vatOperationLogService.addOperationLog(logInfo);
},function (data) {
if(data.status==412){
SweetAlert.error('报表提审中或审核已通过!');
}else{
logInfo.UpdateState = $translate.instant('ManualInputFail');
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
return vatOperationLogService.addOperationLog(logInfo);
}
});
},
deleteCellVoucher: function (voucherId, datasourceId) {
......
......@@ -252,6 +252,109 @@ webservices.factory('commonWebService', ['$http', 'apiConfig', 'loginContext', '
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 @@
{ caption: '期间', width: '7%', dataField: "period"},
{ caption: '提审人', width: '10%', dataField: "createBy"},
{ 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: '7.5%', dataField: "createTime"}
{ caption: '提审时间', width: '7.5%', dataField: "createTime"},
{ caption: '审批时间', width: '7.5%', dataField: "approvalTime"}
],
onRowClick: function (e) {
$scope.goToService(e.data);
......@@ -602,12 +613,14 @@
$scope.goToService = function (approvalInfo) {
projectService.getProjectByID(approvalInfo.projectId).success(
function(result){
vatSessionService.project = result;
vatSessionService.project.projectName = approvalInfo.projectName;
vatSessionService.project.month = approvalInfo.period;
vatSessionService.month = approvalInfo.period;
vatApproveService.getApprovalTemplateInfo(approvalInfo.templateIds.split(",")[0]).success(
function(template){
vatSessionService.project = result;
vatSessionService.project.projectName = approvalInfo.projectName;
vatSessionService.project.month = approvalInfo.period;
vatSessionService.month = approvalInfo.period;
vatSessionService.approvalInfo=approvalInfo;
$state.go('vat.generateReport.reportView', {
id: approvalInfo.reportIds.split(",")[0],
templateid: template.id,
......
......@@ -293,9 +293,10 @@
},1000);
}
}).error(function () {
$log.debug("generate all report may be some error");
// taskError(_this);
}).error(function (data,status,config,statusText) {
if(status==412){
SweetAlert.error('报表提审中或审核已通过!');
}
});
}
......@@ -350,7 +351,6 @@
}
};
var startCaculate2 = function () {
if (vatSessionService.project.projectStatusList[vatSessionService.month] >= constant.ProjectStatusEnum.Generated) {
swal({
......@@ -570,6 +570,8 @@
item.status = 'completed';
if($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'){
item.status = 'processing';
......@@ -587,10 +589,13 @@
updateTasksStatus(result.data);
if(result.data.status=='Begin'){
$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){
updateTasksStatus(result.data);
}
}).error(function(result){
$interval.cancel($scope.timer);
});
},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