Commit f79eb50a authored by sherlock's avatar sherlock

Merge branches 'dev_oracle' and 'dev_oracle_sherlock' of…

Merge branches 'dev_oracle' and 'dev_oracle_sherlock' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_oracle_sherlock
parents 800db84b 47b2d550
package pwc.taxtech.atms.common.schedule;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import pwc.taxtech.atms.dao.EnterpriseAccountMapper;
import pwc.taxtech.atms.dao.EnterpriseAccountSetOrgMapper;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.UserMapper;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.service.impl.LgGlBalanceService;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
public class LgGlBalanceJob extends QuartzJobBean {
......@@ -25,12 +24,10 @@ public class LgGlBalanceJob extends QuartzJobBean {
public static final String ORG_ID = "org_id";
public static final String PERIOD = "period";
@Autowired
private EnterpriseAccountMapper accountMapper;
@Autowired
private OrganizationMapper orgMapper;
@Autowired
private EnterpriseAccountSetOrgMapper setOrgMapper;
@Resource
private LgGlBalanceService lgGlBalanceService;
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
......@@ -45,10 +42,15 @@ public class LgGlBalanceJob extends QuartzJobBean {
}
for (Organization organization : orgList) {
try {
SimpleDateFormat dateFormat = new SimpleDateFormat(Constant.DateFormat.YEAR_MONTH);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, -1);
period = StringUtils.isBlank(period) ? dateFormat.format(calendar.getTime()) : period;
lgGlBalanceService.queryGlBalance(organization, period);
} catch (Exception e) {
LOGGER.error("LgGlBalanceJob error. Organization: " + organization.getId(), e);
}
}
}
}
......@@ -65,9 +65,9 @@ public class ApprovalController {
}
@ResponseBody
@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);
@RequestMapping(value = "/check/{projectId}/{period}",method = RequestMethod.PUT)
public void check(@PathVariable String projectId,@PathVariable Integer period, @RequestParam String decide, @RequestParam String comment) {//only for manager role
approvalService.checkTask(projectId, period, decide,comment);
}
@ResponseBody
......@@ -151,29 +151,5 @@ public class ApprovalController {
}
private void mocoDisAggreAndOver() {
logger.debug("------------------------update db -----------------------------------");
logger.debug("dis aggre");
logger.debug("------------------------updage db-----------------------------------");
}
private void mocoAggreAndOver() {
logger.debug("------------------------update db-----------------------------------");
logger.debug("aggree");
logger.debug("------------------------update db-----------------------------------");
}
private void mocoHasCommittedAndOver() {
logger.debug("-------------------------update db----------------------------------");
logger.debug("has committed");
logger.debug("-------------------------update db----------------------------------");
}
private void mocoInsert(ApprovalDto dto) {
logger.debug("-------------------------insert db----------------------------------");
logger.debug("save approval {}", dto.toString());
logger.debug("-------------------------insert db----------------------------------");
}
}
package pwc.taxtech.atms.controller;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.service.impl.ReportAnalysisService;
import javax.annotation.Resource;
import java.util.Collections;
@RestController
@RequestMapping("/api/v1/reportAnalysis")
public class ReportAnalysisController extends BaseController {
@Resource
private ReportAnalysisService reportAnalysisService;
@GetMapping("/burdenRateData/{projectId}")
public ApiResultDto getBurdenRateData(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getBurdenRateData(projectId));
} catch (Exception e) {
logger.error("getBurdenRateData error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/dispersion/{projectId}")
public ApiResultDto dispersion(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getDispersion(projectId));
} catch (Exception e) {
logger.error("getDispersion error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/incomeRate/{projectId}")
public ApiResultDto incomeRate(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getIncomeRate(projectId));
} catch (Exception e) {
logger.error("incomeRate error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/incomeVolatility/{projectId}")
public ApiResultDto incomeVolatility(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getIncomeVolatility(projectId));
} catch (Exception e) {
logger.error("incomeVolatility error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/vatIncomeRate/{projectId}/{period}")
public ApiResultDto getVatIncomeRate(@PathVariable String projectId, @PathVariable Integer period) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getVatIncomeRate(projectId, period));
} catch (Exception e) {
logger.error("getVatIncomeRate error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/vatIncomeLine/{projectId}")
public ApiResultDto getVatIncomeLine(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getVatIncomeLine(projectId));
} catch (Exception e) {
logger.error("getVatIncomeLine error.", e);
}
return ApiResultDto.fail();
}
@GetMapping("/deduction/{projectId}")
public ApiResultDto getDeduction(@PathVariable String projectId) {
if (StringUtils.isBlank(projectId)) {
return ApiResultDto.success(Collections.emptyList());
}
try {
return ApiResultDto.success(reportAnalysisService.getDeduction(projectId));
} catch (Exception e) {
logger.error("getDeduction error.", e);
}
return ApiResultDto.fail();
}
}
package pwc.taxtech.atms.dao;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.service.impl.BaseService;
import pwc.taxtech.atms.vat.dao.GlBalanceMapper;
import pwc.taxtech.atms.vat.entity.GlBalance;
import pwc.taxtech.atms.vat.entity.GlBalanceExample;
import javax.annotation.Resource;
import java.util.Optional;
@Service
public class GlBalanceDao extends BaseService {
@Resource
private GlBalanceMapper glBalanceMapper;
/**
* 查找科目
*
* @param code code
* @return GlBalance
*/
public Optional<GlBalance> get(String code, String orgId, String period) {
GlBalanceExample example = new GlBalanceExample();
example.createCriteria().andSegment3EqualTo(code).andSegment1EqualTo(orgId).andPeriodNameEqualTo(period);
Optional<GlBalance> optional = glBalanceMapper.selectByExample(example).stream().findFirst();
if (optional.isPresent()) {
return optional;
}
GlBalanceExample example2 = new GlBalanceExample();
example2.createCriteria().andSegment4EqualTo(code).andSegment1EqualTo(orgId).andPeriodNameEqualTo(period);
return glBalanceMapper.selectByExample(example2).stream().findFirst();
}
}
......@@ -12,7 +12,7 @@ public class OrganizationShort {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getName() {
......
......@@ -15,7 +15,7 @@ public class DimensinTypeOrgDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getName() {
......
......@@ -40,7 +40,7 @@ public class DimensionDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getName() {
......
......@@ -24,7 +24,7 @@ public class DimensionValueDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getName() {
......
......@@ -19,7 +19,7 @@ public class DimensionValueJoinDimensionDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getDimensionName() {
......
......@@ -50,7 +50,7 @@ public class UnionDimensionValueOrg {
}
public void setId(String id) {
id = id;
this.id = id;
}
}
......@@ -13,7 +13,7 @@ public class OrgCountDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getName() {
......
......@@ -76,7 +76,7 @@ public class OrgGeneralInfoMiddleDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getOrgName() {
......
package pwc.taxtech.atms.dto.permission;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class OrganizationPermissionDto {
@JsonProperty("ID")
private String id;
private String name;
......@@ -17,7 +14,7 @@ public class OrganizationPermissionDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getName() {
......
package pwc.taxtech.atms.dto.permission;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class OrganizationPermissionKeyDto {
@JsonProperty("ID")
private String id;
private String name;
......@@ -18,7 +14,7 @@ public class OrganizationPermissionKeyDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getName() {
......
......@@ -39,7 +39,7 @@ public class PermissionDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getName() {
......
......@@ -15,7 +15,7 @@ public class PermissionKeyDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getCode() {
......
......@@ -25,7 +25,7 @@ public class UserPermissionDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getUserName() {
......
......@@ -25,7 +25,7 @@ public class UserPermissionKeyDto {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getUserName() {
......
......@@ -30,7 +30,7 @@ public class DimensionUser {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getDimensionId() {
......
......@@ -36,7 +36,7 @@ public class UserRoleDisplayInfo {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getUserId() {
......
......@@ -28,7 +28,7 @@ public class UserRoleQuery {
}
public void setId(String id) {
id = id;
this.id = id;
}
public String getUserId() {
......
package pwc.taxtech.atms.dto.vatdto;
import java.math.BigDecimal;
import java.util.List;
public class BurdenRateDto {
private List<BigDecimal> vatAmount;
private List<BigDecimal> income;
private List<BigDecimal> rate;
public List<BigDecimal> getVatAmount() {
return this.vatAmount;
}
public void setVatAmount(List<BigDecimal> vatAmount) {
this.vatAmount = vatAmount;
}
public List<BigDecimal> getIncome() {
return this.income;
}
public void setIncome(List<BigDecimal> income) {
this.income = income;
}
public List<BigDecimal> getRate() {
return this.rate;
}
public void setRate(List<BigDecimal> rate) {
this.rate = rate;
}
}
......@@ -20,5 +20,6 @@ public class Exceptions {
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");
public static final FormulaException PROJECT_NOT_FOUND = new FormulaException("project not found");;
public static final FormulaException PSUM_CELL_TEMP_NULL = new FormulaException("cell template group is null or empty"); ;
public static final FormulaException PSUM_CELL_TEMP_NULL = new FormulaException("cell template group is null or empty");
public static final ApiException NOT_FOUND_INSTANCE_EXCEPTION = new NotFoundException("not found instance");
}
package pwc.taxtech.atms.service.impl;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.constant.enums.StdAccountEnum;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dto.vatdto.BurdenRateDto;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.invoice.InputInvoiceMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellDataMapper;
import pwc.taxtech.atms.vat.dao.PeriodCellTemplateMapper;
import pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper;
import pwc.taxtech.atms.vat.dao.PeriodTemplateMapper;
import pwc.taxtech.atms.vat.entity.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@Service
public class ReportAnalysisService extends BaseService {
@Resource
private GlBalanceDao glBalanceDao;
@Resource
private AccountMappingMapper accountMappingMapper;
@Resource
private ProjectMapper projectMapper;
@Resource
private OrganizationMapper organizationMapper;
@Resource
private StandardAccountDao standardAccountDao;
@Resource
private PeriodTemplateMapper periodTemplateMapper;
@Resource
private PeriodCellTemplateMapper periodCellTemplateMapper;
@Resource
private PeriodCellDataMapper periodCellDataMapper;
@Resource
private PeriodDataSourceMapper periodDataSourceMapper;
@Resource
private InputInvoiceMapper inputInvoiceMapper;
/**
* 增值税负担率
*/
public BurdenRateDto getBurdenRateData(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> vatAmountList = Lists.newArrayList();
List<BigDecimal> incomeList = Lists.newArrayList();
List<BigDecimal> rateList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal vat = getCellValue(projectId, p, "VAT001", 32, 18);
BigDecimal income = getTbValueByDirection("600101", projectId, p)
.add(getTbValueByDirection("600102", projectId, p))
.add(getTbValueByDirection("600103", projectId, p))
.add(getTbValueByDirection("600104", projectId, p))
.add(getTbValueByDirection("600105", projectId, p))
.add(getTbValueByDirection("600107", projectId, p))
.add(getTbValueByDirection("600111", projectId, p))
.add(getTbValueByDirection("600190", projectId, p));
vatAmountList.add(vat);
incomeList.add(income);
BigDecimal rate = income.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
vat.divide(income, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setVatAmount(vatAmountList);
dto.setIncome(incomeList);
dto.setRate(rateList);
return dto;
}
/**
* 增值税申报表收入与会计收入差异离散度分析
*/
public BurdenRateDto getDispersion(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> rateList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal val = getCellValue(projectId, p, "VAT001", 19, 18);
BigDecimal val2 = getCellValue(projectId, p, "VAT005", 26, 12);
BigDecimal val3 = getTbValueByDirection("600101", projectId, p)
.add(getTbValueByDirection("600102", projectId, p)).add(getTbValueByDirection("600103", projectId, p))
.add(getTbValueByDirection("600104", projectId, p)).add(getTbValueByDirection("600105", projectId, p))
.add(getTbValueByDirection("600107", projectId, p)).add(getTbValueByDirection("600111", projectId, p))
.add(getTbValueByDirection("600190", projectId, p)).add(getTbValueByDirection("605101", projectId, p))
.add(getTbValueByDirection("612101", projectId, p)).add(getTbValueByDirection("630101", projectId, p))
.add(getTbValueByDirection("630102", projectId, p)).add(getTbValueByDirection("630103", projectId, p))
.add(getTbValueByDirection("630104", projectId, p)).add(getTbValueByDirection("630105", projectId, p))
.add(getTbValueByDirection("630106", projectId, p)).add(getTbValueByDirection("630107", projectId, p))
.add(getTbValueByDirection("630108", projectId, p)).add(getTbValueByDirection("630198", projectId, p));
BigDecimal rate = val3.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : val.add(val2)
.divide(val3, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setRate(rateList);
return dto;
}
/**
* 进项税额占主营业务成本的比例
*/
public BurdenRateDto getIncomeRate(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> vatAmountList = Lists.newArrayList();
List<BigDecimal> incomeList = Lists.newArrayList();
List<BigDecimal> rateList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal vat = getCellValue(projectId, p, "VAT001", 20, 18);
BigDecimal income = getTbValueByDirection("640101", projectId, p)
.add(getTbValueByDirection("640102", projectId, p))
.add(getTbValueByDirection("640103", projectId, p))
.add(getTbValueByDirection("640104", projectId, p))
.add(getTbValueByDirection("640105", projectId, p))
.add(getTbValueByDirection("640106", projectId, p))
.add(getTbValueByDirection("640107", projectId, p))
.add(getTbValueByDirection("640190", projectId, p))
.add(getTbValueByDirection("640201", projectId, p));
vatAmountList.add(vat);
incomeList.add(income);
BigDecimal rate = income.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
vat.divide(income, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setVatAmount(vatAmountList);
dto.setIncome(incomeList);
dto.setRate(rateList);
return dto;
}
/**
* 进项税转出额波动率
*/
public BurdenRateDto getIncomeVolatility(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> vatAmountList = Lists.newArrayList();
List<BigDecimal> incomeList = Lists.newArrayList();
List<BigDecimal> rateList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal vat = getCellValue(projectId, p, "VAT001", 22, 18);
BigDecimal income = getCellValue(projectId, p, "VAT001", 20, 18);
vatAmountList.add(vat);
incomeList.add(income);
BigDecimal rate = income.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
vat.divide(income, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setVatAmount(vatAmountList);
dto.setIncome(incomeList);
dto.setRate(rateList);
return dto;
}
/**
* 增值税应税收入、增值税免、抵、退办法出口收入 占会计收入比例
*/
public BurdenRateDto getVatIncomeRate(String projectId, Integer period) {
BurdenRateDto dto = new BurdenRateDto();
BigDecimal val = getCellValue(projectId, period, "VAT001", 19, 18);
BigDecimal val2 = getCellValue(projectId, period, "VAT005", 26, 12);
dto.setVatAmount(Lists.newArrayList(val));
dto.setIncome(Lists.newArrayList(val2));
return dto;
}
/**
* 增值税应税收入、增值税免、抵、退办法出口收入 占会计收入比例 趋势
*/
public BurdenRateDto getVatIncomeLine(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> vatAmountList = Lists.newArrayList();
List<BigDecimal> incomeList = Lists.newArrayList();
for (int p = 1; p <= 12; p++) {
BigDecimal val = getCellValue(projectId, p, "VAT001", 19, 18);
BigDecimal val2 = getCellValue(projectId, p, "VAT005", 26, 12);
BigDecimal sum = val.add(val2);
BigDecimal rate = sum.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
val.divide(sum, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal rate2 = sum.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
val2.divide(sum, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
vatAmountList.add(rate);
incomeList.add(rate2);
}
dto.setVatAmount(vatAmountList);
dto.setIncome(incomeList);
return dto;
}
/**
* 已抵扣进项税波动率
*/
public BurdenRateDto getDeduction(String projectId) {
BurdenRateDto dto = new BurdenRateDto();
List<BigDecimal> rateList = Lists.newArrayList();
Project project = projectMapper.selectByPrimaryKey(projectId);
Organization org = organizationMapper.selectByPrimaryKey(project.getOrganizationId());
for (int p = 1; p <= 12; p++) {
BigDecimal val = getCellValue(projectId, p, "VAT001", 19, 18);
InputInvoiceExample example = new InputInvoiceExample();
example.createCriteria().andGFSHEqualTo(org.getTaxPayerNumber()).andFPZTIn(Lists.newArrayList("0", "2"))
.andLRRQBetween(DateUtils.getPeriodBeginFormat(project.getYear(), p), DateUtils.getPeriodEndFormat(project.getYear(), p));
BigDecimal sum = inputInvoiceMapper.selectByExample(example).stream().map(o ->
NumberUtils.isParsable(o.getHJSE()) ? NumberUtils.createBigDecimal(o.getHJSE()) : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal rate = sum.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
val.divide(sum, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
rateList.add(rate);
}
dto.setRate(rateList);
return dto;
}
/**
* 根据借贷方向获取TB表科目的发生额
*/
public BigDecimal getTbValueByDirection(String code, String projectId, Integer period) {
BigDecimal result = BigDecimal.ZERO;
try {
if (StringUtils.isBlank(projectId)) {
return result;
}
Project project = projectMapper.selectByPrimaryKey(projectId);
if (null == project) {
return result;
}
AccountMappingExample example = new AccountMappingExample();
example.createCriteria().andOrganizationIdEqualTo(project.getOrganizationId())
.andEnterpriseAccountSetIdEqualTo(project.getEnterpriseAccountSetId())
.andIndustryIdEqualTo(project.getIndustryId()).andStandardAccountCodeEqualTo(code);
List<AccountMapping> mappingList = accountMappingMapper.selectByExample(example).stream()
.filter(distinctByKey(AccountMapping::getEnterpriseAccountCode)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(mappingList)) {
return result;
}
for (AccountMapping mapping : mappingList) {
Optional<StandardAccount> accountOptional = standardAccountDao.getByCodeAndIndustryId(
mapping.getStandardAccountCode(), mapping.getIndustryId()).stream().findFirst();
Optional<GlBalance> optional = glBalanceDao.get(code, project.getClientCode(), project.getYear() + "-" +
(period < 10 ? "0" + period : period));
BigDecimal val;
if (optional.isPresent()) {
if (accountOptional.get().getDirection() == StdAccountEnum.Direction.Debit.getCode()) {
val = optional.get().getPtdDr();
} else {
val = optional.get().getPtdCr();
}
result = result.add(val);
}
}
} catch (Exception e) {
logger.error("getTbValueByDirection error.", e);
}
return result;
}
/**
* 获取单元格计算的值
*
* @param projectId projectId
* @param period period
* @param sheet VAT001
* @param rowIndex rowIndex
* @param colIndex colIndex
* @return BigDecimal
*/
public BigDecimal getCellValue(String projectId, Integer period, String sheet, Integer rowIndex, Integer colIndex) {
try {
PeriodTemplateExample templateExample = new PeriodTemplateExample();
templateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andCodeEqualTo(sheet);
Optional<PeriodTemplate> templateOptional = periodTemplateMapper.selectByExample(templateExample).stream().findFirst();
if (!templateOptional.isPresent()) {
return BigDecimal.ZERO;
}
PeriodCellTemplateExample cellTemplateExample = new PeriodCellTemplateExample();
cellTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period)
.andReportTemplateIdEqualTo(templateOptional.get().getTemplateId()).andRowIndexEqualTo(rowIndex)
.andColumnIndexEqualTo(colIndex);
Optional<PeriodCellTemplate> cellTemplateOptional = periodCellTemplateMapper.selectByExample(cellTemplateExample).stream().findFirst();
if (!cellTemplateOptional.isPresent()) {
return BigDecimal.ZERO;
}
//cell data数据源
PeriodCellDataExample cellDataExample = new PeriodCellDataExample();
cellDataExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andCellTemplateIdEqualTo(
cellTemplateOptional.get().getCellTemplateId());
BigDecimal sum = periodCellDataMapper.selectByExample(cellDataExample).stream().map(o -> NumberUtils.createBigDecimal(o.getData()))
.reduce(BigDecimal.ZERO, BigDecimal::add);
//manual data数据源
PeriodDataSourceExample dataSourceExample = new PeriodDataSourceExample();
dataSourceExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andCellTemplateIdEqualTo(
cellTemplateOptional.get().getCellTemplateId()).andTypeEqualTo(FormulaDataSourceType.KeyInSource.getCode());
sum = periodDataSourceMapper.selectByExample(dataSourceExample).stream().map(o -> o.getAmount()).reduce(sum, BigDecimal::add);
return sum;
} catch (Exception e) {
logger.error("getCellValue error", e);
}
return BigDecimal.ZERO;
}
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Map<Object, Boolean> seen = new ConcurrentHashMap<>();
return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
}
......@@ -55,9 +55,7 @@ public class ApprovalService {
public List<ApprovalTaskInfo> getTask() {
String userId = authUserHelper.getCurrentUserId();//TODO query user role from sesstion or db
String assignee = ("66933E7B-DA75-4B2E-B7D6-AB65DCA20D50".equalsIgnoreCase(userId)) ? "manager" : "accountant";
return periodApproveMapper.queryApprovalList(assignee.equalsIgnoreCase("manager") ? null : userId);
return periodApproveMapper.queryApprovalList();
}
private void startInstance(ApprovalDto dto, PeriodApprove pa) {
......@@ -125,7 +123,10 @@ public class ApprovalService {
@Transactional
public void checkTask(String instanceId, String decide,String comment) {
public void checkTask(String projectId,Integer period, String decide,String comment) {
PeriodApprove approve= periodApproveMapper.getInstanceIdByProjectIdAndPeriod(projectId,period);
MyAsserts.assertTrue(approve!=null&&approve.getStatus().equals("committed"),Exceptions.NOT_FOUND_INSTANCE_EXCEPTION);
String instanceId = approve.getInstanceId();
Map<String, Object> map = new HashMap<>();
PeriodApprove pa = new PeriodApprove();
switch (decide) {
......
package pwc.taxtech.atms.vat.service.impl;
import com.google.common.collect.Lists;
import jdk.nashorn.internal.runtime.options.Option;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
......@@ -16,20 +14,16 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.vatdto.CellCalcInfoDto;
import pwc.taxtech.atms.dto.vatdto.PeriodResources;
import pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.service.impl.DistributedIdService;
import pwc.taxtech.atms.service.impl.HttpFileService;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dpo.MergerManaualCellData;
import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigExtendDto;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.report.functions.*;
......@@ -44,7 +38,6 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.util.SpringContextUtil.reportMapper;
import static pwc.taxtech.atms.constant.Constant.EMPTY;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Component
......@@ -517,7 +510,7 @@ public class ReportGeneratorImpl {
*/
public void addFunctionsAndContext(Workbook workbook, String[] functions, FormulaContext formulaContext) {
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new ProjectContext(formulaContext)
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new PC(formulaContext)
, new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext), new DFFS(formulaContext),
new JFFS(formulaContext), new WPSR(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
......
......@@ -50,7 +50,7 @@ import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
public class ReportServiceImpl {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>();
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "ProjectContext", "JXFPMX",
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX",
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR"};
@Autowired
......
......@@ -12,8 +12,8 @@ import pwc.taxtech.atms.vat.entity.PeriodReport;
import java.util.Calendar;
import java.util.Date;
public class ProjectContext extends FunctionBase implements FreeRefFunction {
public ProjectContext(FormulaContext formulaContext) {
public class PC extends FunctionBase implements FreeRefFunction {
public PC(FormulaContext formulaContext) {
super(formulaContext);
}
......@@ -56,13 +56,9 @@ public class ProjectContext extends FunctionBase implements FreeRefFunction {
, formulaContext.getPeriod(), calendar.get(Calendar.DAY_OF_MONTH), formulaContext.getYear()
, formulaContext.getPeriod(), calendar2.get(Calendar.DAY_OF_MONTH)));
case "FillForm":
PeriodReport report = SpringContextUtil.reportMapper.selectByPrimaryKey(formulaContext.getReportId());
if (report != null) {
return new StringEval(String.format(Constant.ReportBuildInStringFormat.FillForm, report.getUpdateTime().getYear()
, report.getUpdateTime().getMonth(), report.getUpdateTime().getDay()));
} else {
return new StringEval(String.format(Constant.ReportBuildInStringFormat.FillFormStr, " ", " ", " "));
}
Date updateDate = new Date();
return new StringEval(String.format(Constant.ReportBuildInStringFormat.FillForm, updateDate.getYear()
, updateDate.getMonth(), updateDate.getDay()));
case "TaxPayerNo":
String taxPayerNo = SpringContextUtil.organizationMapper.selectByPrimaryKey(formulaContext.getOrganizationId()).getTaxPayerNumber();
if (StringUtils.isNotBlank(taxPayerNo) && taxPayerNo.length() - 1 >= parameterInt) {
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.WorkbookEvaluator;
import org.apache.poi.ss.formula.eval.*;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.StringEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -13,10 +14,7 @@ import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.entity.PeriodDataSource;
import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
......@@ -80,16 +78,16 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
dto.setName(DataSourceName.ReportDataSource);
dto.setPeriod(formulaContext.getPeriod());
dto.setProjectId(formulaContext.getProjectId());
dto.setRowIndex(pCell.rowIndex-1);
dto.setColumnIndex(pCell.columnIndex-1);
dto.setColumnName((pCell.columnIndex)+"列");
dto.setRowName((pCell.rowIndex)+"行");
dto.setRowIndex(pCell.rowIndex - 1);
dto.setColumnIndex(pCell.columnIndex - 1);
dto.setColumnName((pCell.columnIndex) + "列");
dto.setRowName((pCell.rowIndex) + "行");
dto.setReportName(ec.getWorkbook().getSheetName(ec.getSheetIndex()));
dto.setType( FormulaDataSourceType.Report.getCode());
dto.setType(FormulaDataSourceType.Report.getCode());
dataSource.add(dto);
bigDecimal = bigDecimal.add(cellValue);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.ss.formula.OperationEvaluationContext;
......@@ -8,11 +9,15 @@ import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.DataSourceName;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.vat.dao.HlOutputInterfaceLineMapper;
import pwc.taxtech.atms.vat.dao.HlOutputOrderKpsqmxbMapper;
import pwc.taxtech.atms.vat.dao.HlOutputOrderKpsqzbMapper;
import pwc.taxtech.atms.invoice.HlOutputInterfaceLineMapper;
import pwc.taxtech.atms.invoice.HlOutputOrderKpsqmxbMapper;
import pwc.taxtech.atms.invoice.HlOutputOrderKpsqzbMapper;
import pwc.taxtech.atms.vat.entity.*;
import java.math.BigDecimal;
......@@ -39,11 +44,12 @@ public class WPSR extends FunctionBase implements FreeRefFunction {
}
Integer type = getIntParam(args[0], ec);
Integer rate = getIntParam(args[1], ec);
String rateStr = String.valueOf(rate / 100);
String rateStr = String.valueOf(rate.doubleValue() / 100);
if (null == type || null == rate) {
return ZERO_EVAL;
}
ValueEval result = ZERO_EVAL;
String formulaExpression = "WPSR(" + type + "," + rate + ")";
try {
int period = formulaContext.getPeriod();
int year = formulaContext.getYear();
......@@ -57,10 +63,28 @@ public class WPSR extends FunctionBase implements FreeRefFunction {
HlOutputInterfaceLineExample lineExample = new HlOutputInterfaceLineExample();
lineExample.createCriteria().andSjfyrqBetween(periodStart, periodEnd).andSfkpNotEqualTo("1")
.andEbsSrbjEqualTo("1").andYwstidEqualTo(organization.getCode()); //排除 状态1:已开票,即未开票和预开票
List<HlOutputInterfaceLine> lineList = interfaceLineMapper.selectByExample(lineExample); //todo 无订单业务
List<HlOutputInterfaceLine> lineList = interfaceLineMapper.selectByExample(lineExample);
BigDecimal tmp = BigDecimal.ZERO;
if (!CollectionUtils.isEmpty(lineList)) {
result = new StringEval(getSum(lineList, rateStr).toPlainString());
tmp = tmp.add(getSum(lineList, rateStr));
}
//无订单业务
HlOutputInterfaceLineExample lineExampleWdd = new HlOutputInterfaceLineExample();
lineExampleWdd.createCriteria().andSjfyrqBetween(periodStart, periodEnd).andContextEqualTo("ETMS")
.andEbsSrbjEqualTo("1").andYwstidEqualTo(organization.getCode()).andTaxrateEqualTo(rateStr);
HlOutputInterfaceLineExample.Criteria criteria2 = lineExampleWdd.createCriteria().andSjfyrqBetween(periodStart, periodEnd)
.andContextEqualTo("ETMS").andEbsSrbjEqualTo("1").andYwstidEqualTo(organization.getCode())
.andTaxrateEqualTo(rateStr.substring(1));// 兼容税率为.16 这种数据
lineExampleWdd.or(criteria2);
List<HlOutputInterfaceLine> lineListWdd = interfaceLineMapper.selectByExample(lineExampleWdd);
if (!CollectionUtils.isEmpty(lineListWdd)) {
List<String> idList = lineListWdd.stream().map(HlOutputInterfaceLine::getUuid).collect(Collectors.toList());
HlOutputOrderKpsqmxbExample mxbExample = new HlOutputOrderKpsqmxbExample();
mxbExample.createCriteria().andIdIn(idList);
tmp = tmp.add(kpsqmxbMapper.selectByExample(mxbExample).stream().map(o -> NumberUtils.createBigDecimal(o.getHjje())).
reduce(BigDecimal.ZERO, BigDecimal::add));
}
result = new StringEval(tmp.toPlainString());
} else if (2 == type) {
//跨月开票
HlOutputInterfaceLineExample lineExample = new HlOutputInterfaceLineExample();
......@@ -74,6 +98,27 @@ public class WPSR extends FunctionBase implements FreeRefFunction {
} catch (Exception e) {
logger.error("evaluate WPSR error.", e);
}
//todo data source 显示优化
try {
BigDecimal val = NumberUtils.createBigDecimal(((StringEval) result).getStringValue());
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.setAmount(val);
dto.setName(DataSourceName.ReportDataSource);
dto.setPeriod(formulaContext.getPeriod());
dto.setProjectId(formulaContext.getProjectId());
// dto.setRowIndex(pCell.rowIndex-1);
// dto.setColumnIndex(pCell.columnIndex-1);
dto.setColumnName("");
dto.setRowName("");
dto.setReportName(ec.getWorkbook().getSheetName(ec.getSheetIndex()));
dto.setType(FormulaDataSourceType.Report.getCode());
Long dataSourceId = saveDataSource(ec, Lists.newArrayList(dto), FormulaDataSourceDetailType.InputInvoiceDataSourceDto, val, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, val, dataSourceId,
formulaContext.getProjectId());
} catch (Exception e) {
logger.error("saveDataSource or saveFormulaBlock error.", e);
}
return result;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<context-root>/</context-root>
<container-descriptor>
<prefer-application-packages>
<package-name>org.apache.commons.lang.*</package-name>
<package-name>antlr.*</package-name>
<package-name>javax.persistence.*</package-name>
<package-name>org.hibernate.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>com.fasterxml.jackson.*</package-name>
</prefer-application-packages>
</container-descriptor>
</weblogic-web-app>
\ No newline at end of file
......@@ -204,7 +204,8 @@ public class DataInitTest extends CommonIT {
@Test
public void initOutput() throws Exception {
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入\\进销项/导入模板_销项主表_乐叶_201807.xlsx"));
// todo 导入前检查开票日期,给的文档日期经常不一样
Workbook workbook = WorkbookFactory.create(new File("C:\\Users\\Eddie Wu\\Desktop\\导入\\进销项/导入模板_销项主表_绿能_201809.xlsx"));
Sheet sheet = workbook.getSheetAt(0);
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
try {
......@@ -219,6 +220,7 @@ public class DataInitTest extends CommonIT {
outputInvoice.setFPQQLSH(sheet.getRow(r).getCell(1).getStringCellValue());
outputInvoice.setFPDM(sheet.getRow(r).getCell(2).getStringCellValue());
outputInvoice.setFPHM(sheet.getRow(r).getCell(3).getStringCellValue());
// outputInvoice.setKPRQ(sheet.getRow(r).getCell(4).getStringCellValue() + " 00:00:00");
outputInvoice.setKPRQ(sheet.getRow(r).getCell(4).getStringCellValue());
String s = "000" + sheet.getRow(r).getCell(5).getStringCellValue();
outputInvoice.setFPLXDM(s.substring(s.length() - 3, s.length()));
......@@ -236,6 +238,8 @@ public class DataInitTest extends CommonIT {
// outputInvoice.setHTBH(sheet.getRow(r).getCell(54).getStringCellValue());
OutputInvoiceExample example = new OutputInvoiceExample();
example.createCriteria().andFPDMEqualTo(outputInvoice.getFPDM()).andFPHMEqualTo(outputInvoice.getFPHM());
//有重复数据 先删除
outputInvoiceMapper.deleteByExample(example);
if (outputInvoiceMapper.selectByExample(example).size() > 0) {
outputInvoiceMapper.updateByExampleSelective(outputInvoice, example);
} else {
......
package pwc.taxtech.atms.vat.dao;
package pwc.taxtech.atms.invoice;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
......
package pwc.taxtech.atms.vat.dao;
package pwc.taxtech.atms.invoice;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
......
package pwc.taxtech.atms.vat.dao;
package pwc.taxtech.atms.invoice;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
......
......@@ -110,6 +110,7 @@ public interface PeriodApproveMapper extends MyVatMapper {
@Select("<script>" +
"SELECT " +
" p.ORGANIZATION_ID AS organizationId, " +
" p.NAME AS projectName, " +
" pa.PROJECT_ID AS projectId, " +
" pa.PERIOD AS period, " +
......@@ -128,11 +129,8 @@ public interface PeriodApproveMapper extends MyVatMapper {
" INNER JOIN PROJECT p ON pa.PROJECT_ID = p.ID " +
" JOIN \"USER\" u1 ON pa.CREATE_BY = u1.id " +
" LEFT JOIN \"USER\" u2 ON pa.APPROVAL_BY = u2.id " +
"<where> 1=1 " +
" <if test=\"createId != null and createId !='' \">AND pa.CREATE_BY=#{createId}</if>" +
"</where>" +
"</script>")
List<ApprovalTaskInfo> queryApprovalList(@Param("createId") String createId);
List<ApprovalTaskInfo> queryApprovalList();
@Select("" +
"SELECT " +
......@@ -143,4 +141,14 @@ public interface PeriodApproveMapper extends MyVatMapper {
" ROWNUM = 1" +
"")
String getStatusByProjectIdAndPeriod(@Param("projectId") String projectId, @Param("period") Integer period);
@Select("" +
"SELECT " +
" INSTANCE_ID AS instanceId ,STATUS AS status " +
"FROM " +
" ( SELECT * FROM PERIOD_APPROVE WHERE PROJECT_ID = #{projectId} AND PERIOD = #{period} ORDER BY CREATE_TIME DESC ) " +
"WHERE " +
" ROWNUM = 1" +
"")
PeriodApprove getInstanceIdByProjectIdAndPeriod(@Param("projectId") String projectId, @Param("period") Integer period);
}
\ No newline at end of file
......@@ -127,7 +127,9 @@ public interface PeriodReportMapper extends MyVatMapper {
" LEFT JOIN PERIOD_TEMPLATE pt ON r.TEMPLATE_ID = pt.TEMPLATE_ID " +
"WHERE " +
" r.PROJECT_ID = #{projectId} " +
" AND r.PERIOD = #{period} " +
" AND r.PERIOD = #{period}" +
" AND pt.PROJECT_ID = r.PROJECT_ID " +
" AND pt.PERIOD = r.PERIOD " +
"ORDER BY " +
" pt.ORDER_INDEX" +
"")
......
......@@ -3,6 +3,7 @@ package pwc.taxtech.atms.vat.dpo;
import java.sql.Date;
public class ApprovalTaskInfo {
private String organizationId;
private String projectName;
private String projectId;
private Integer period;
......@@ -120,4 +121,12 @@ public class ApprovalTaskInfo {
public void setTemplateIds(String templateIds) {
this.templateIds = templateIds;
}
public String getOrganizationId() {
return organizationId;
}
public void setOrganizationId(String organizationId) {
this.organizationId = organizationId;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.HlOutputInterfaceLineMapper">
<mapper namespace="pwc.taxtech.atms.invoice.HlOutputInterfaceLineMapper">
<resultMap id="BaseResultMap" type="pwc.taxtech.atms.vat.entity.HlOutputInterfaceLine">
<!--
WARNING - @mbg.generated
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.HlOutputOrderKpsqmxbMapper">
<mapper namespace="pwc.taxtech.atms.invoice.HlOutputOrderKpsqmxbMapper">
<resultMap id="BaseResultMap" type="pwc.taxtech.atms.vat.entity.HlOutputOrderKpsqmxb">
<!--
WARNING - @mbg.generated
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.vat.dao.HlOutputOrderKpsqzbMapper">
<mapper namespace="pwc.taxtech.atms.invoice.HlOutputOrderKpsqzbMapper">
<resultMap id="BaseResultMap" type="pwc.taxtech.atms.vat.entity.HlOutputOrderKpsqzb">
<!--
WARNING - @mbg.generated
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -48,27 +48,6 @@
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DruidStatView</servlet-name>
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
<init-param>
<param-name>resetEnable</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>loginUsername</param-name>
<param-value>druid</param-value>
</init-param>
<init-param>
<param-name>loginPassword</param-name>
<param-value>druid</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DruidStatView</servlet-name>
<url-pattern>/druid/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
......
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<context-root>/</context-root>
<container-descriptor>
<prefer-application-packages>
<package-name>org.apache.commons.lang.*</package-name>
<package-name>antlr.*</package-name>
<package-name>javax.persistence.*</package-name>
<package-name>org.hibernate.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>com.fasterxml.jackson.*</package-name>
</prefer-application-packages>
</container-descriptor>
</weblogic-web-app>
\ No newline at end of file
......@@ -2539,7 +2539,9 @@
};
$scope.commitApprove = function(){
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.month).success(function(result){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
SweetAlert.error('报表提审中或审核已通过!');
}else{
......@@ -2569,17 +2571,30 @@
}
$scope.doApprove = function(){
$("#ApprovalComment").modal('show');
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.approvalStatus(vatSessionService.project.id,vatSessionService.project.period).success(function(result){
if(result&&result=='committed'){
$("#ApprovalComment").modal('show')
}else{
SweetAlert.warning('当前报表未提审,请先提审!');
}
});
;
}
$scope.rejectApproval =function(){
vatApproveService.checkTask(vatSessionService.approvalInfo.instanceId,'disagreed',$scope.comment).success(function(){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.checkTask(vatSessionService.project.id,vatSessionService.project.period,'disagreed',$scope.comment).success(function(){
$("#ApprovalComment").modal('hide');
});
}
$scope.agreeApproval =function(){
vatApproveService.checkTask(vatSessionService.approvalInfo.instanceId,'agreed',$scope.comment).success(function(){
if(vatSessionService.month)
vatSessionService.project.period=vatSessionService.month;
vatApproveService.checkTask(vatSessionService.project.id,vatSessionService.project.period,'agreed',$scope.comment).success(function(){
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Completed
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
$("#ApprovalComment").modal('hide');
......
......@@ -21,8 +21,8 @@
return $http.get('/approval/templateInfo/'+templateId, apiConfig.createVat());
},
checkTask:function(taskId,decide,comment){
return $http.put('/approval/check/'+taskId+'?decide='+decide+'&comment='+comment, {}, apiConfig.createVat());
checkTask:function(projectId,period,decide,comment){
return $http.put('/approval/check/'+projectId+'/'+period+'?decide='+decide+'&comment='+comment, {}, apiConfig.createVat());
},
approvalStatus:function(projectId,period){
......
......@@ -31,6 +31,7 @@
//*************************************************************************************************
$scope.randomCounter = 0;
$scope.allResults = [];
$scope.queryResults = [];
$scope.checkedOrgs = {};
$scope.orgList = [];
$scope.orderYear = true;
......@@ -125,17 +126,14 @@
return _.contains(_.values($scope.checkedOrgs), i.organizationName);
});
}
if ($scope.serviceTypeId) {
temp = _.filter(temp, function (i) {
return $scope.serviceTypeId == i.serviceTypeID;
});
}
if (vatSessionService.year) {
if ($scope.serviceTypeId === enums.serviceType.VAT) {
temp = _.filter(temp, function (i) {
if (i.startPeriod <= vatSessionService.month && i.endPeriod >= vatSessionService.month && i.year == vatSessionService.year) {
if (i.period == vatSessionService.month) {
return i;
}
});
}
else if ($scope.serviceTypeId === enums.serviceType.CIT) {
......@@ -164,28 +162,6 @@
var counter = 0;
var setWarningToTrue = false;
temp.forEach(function (project) {
setWarningToTrue = false;
project.finalStatus = setLayoutStatusTitle(project.projectStatusList);
project.periodDate = $scope.currentSelectedYear + "." + $scope.currentSelectedMonth;
var oneDemoData = _.find(demoData, function (one) { return one.id === project.id });
if (project.serviceTypeID === enums.serviceType.VAT) {
if (project.projectStatusList !== null && project.projectStatusList[vatSessionService.month] !== undefined && project.projectStatusList[vatSessionService.month] !== 10 && oneDemoData!==undefined) {
project.taxAmount = oneDemoData.taxAmount;
project.prepadidTaxAmount = oneDemoData.prepadidTaxAmount;
project.taxRate = oneDemoData.taxRate;
project.hasWarning = oneDemoData.hasWarning;
}
}
counter++;
});
$scope.queryResults = temp;
$scope.projectMsg = $translate.instant('ProjectResultMsg').formatObj({ "ProjectNum": $scope.queryResults.length });
......@@ -283,15 +259,6 @@
};
$scope.changeStartDate = function (e) {
if (e&&e.date) {
var tempYear = e.date.getFullYear();
var tempMonth = e.date.getMonth() + 1;
$scope.currentSelectedStartMonth = tempMonth;
$scope.currentSelectedStartYear = tempYear;
}
};
$scope.changeDate = function (e) {
if (e && e.date) {
var isDateUpdated = false;
......@@ -308,15 +275,15 @@
$scope.currentSelectedYear = tempYear;
if (isDateUpdated) {
//$scope.$apply(function () {
// $scope.conditionChange = !$scope.conditionChange;
//});
$timeout(function () {
$scope.conditionChange = !$scope.conditionChange;
});
}
if ($scope.serviceTypeId !== enums.serviceType.AssetsManage) {
$scope.query();
}
}
};
......@@ -577,8 +544,18 @@
var loadApprovalFromDB = function () {
vatApproveService.approvalTasks().success(function (data) {
if (data) {
data.forEach(function (p) {
if (PWC.isHavePermissionForOrg(p.organizationId, vatSessionService.userPermission))
{
$scope.allResults.push(p);
}
});
$scope.queryResults = _.clone($scope.allResults);
$scope.gridOptions = {
dataSource: data,
bindingOptions: {
"dataSource": "queryResults"
},
keyExpr: "instanceId",
showBorders: true,
columns: [
......@@ -597,7 +574,15 @@
}
}
},
{ caption: '审批意见', width: '15%', dataField: "approvalResult"},
{ caption: '审批意见', width: '15%',
calculateCellValue: function(data) {
if(data.approvalResult == 'undefined'){
return '';
}else{
return data.approvalResult;
}
}
},
{ caption: '提审时间', width: '7.5%', dataField: "createTime"},
{ caption: '审批时间', width: '7.5%', dataField: "approvalTime"}
],
......@@ -618,9 +603,11 @@
vatSessionService.project = result;
vatSessionService.project.projectName = approvalInfo.projectName;
vatSessionService.project.month = approvalInfo.period;
vatSessionService.project.templateGroupID = template.templateGroupId;
vatSessionService.month = approvalInfo.period;
vatSessionService.approvalInfo=approvalInfo;
$state.go('vat.generateReport.reportView', {
id: approvalInfo.reportIds.split(",")[0],
templateid: approvalInfo.templateIds.split(",")[0],
......
......@@ -10,17 +10,9 @@ frameworkModule.controller('appSideBarController', ['$scope', '$log', 'menuServi
$log.debug('appSideBarController.ctor()...');
userService.getUserPermission(loginContext.userName).success(function (data) {
$timeout(function () {
menuService.getMenusForDisplay(1).success(function (menuData) {
$scope.menuData = menuData;
$scope.menuData[2].subMenus[0].isVisible = true;
$scope.menuData[2].subMenus[1].isVisible = false;
$scope.menuData[2].subMenus[3].isVisible = false;
$scope.menuData[2].subMenus[4].isVisible = true;
$scope.menuData[2].subMenus[5].isVisible = true;
$window.location.href = '#/adminHomePage';
});
}, 500);
......
......@@ -5,9 +5,9 @@
$log.debug('VatAnalysisMenuController.ctor()...');
$scope.menus = [
{ name: '.analyzeReport', text: "出口数据对比", icon: 'glyphicon glyphicon-flag', permission: constant.vatPermission.dataAnalysis.modelAnalysisCode, show: true },
{ name: 'analyzeOrganizeDashboard({id:"' + vatSessionService.project.organizationID + '"})', text: "进项税额差异分析", icon: 'glyphicon glyphicon-stats', permission: constant.vatPermission.dataAnalysis.dashboard.dashboardCode, show: true },
{ name: '.vatTaxDifference', text: $translate.instant('BookTaxDifference'), icon: 'glyphicon glyphicon-tree-conifer', show: true }
{ name: '.analyzeReport', text: "指标分析", icon: 'glyphicon glyphicon-stats', permission: constant.vatPermission.dataAnalysis.modelAnalysisCode, show: true },
// { name: 'analyzeOrganizeDashboard({id:"' + vatSessionService.project.organizationID + '"})', text: "进项税额差异分析", icon: 'glyphicon glyphicon-stats', permission: constant.vatPermission.dataAnalysis.dashboard.dashboardCode, show: true },
// { name: '.vatTaxDifference', text: $translate.instant('BookTaxDifference'), icon: 'glyphicon glyphicon-tree-conifer', show: true }
];
vatSessionService.querySummayDashboardModel = {
organizationID: vatSessionService.project.organizationID,
......
vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$uibModal', 'vatSessionService', 'modelConfigurationService', '$compile', '$timeout', '$q', 'vatImportService', 'vatPreviewService', 'SweetAlert', 'enums', 'vatExportService',
function ($scope, $translate, $uibModal, vatSessionService, modelConfigurationService, $compile, $timeout, $q, vatImportService, vatPreviewService, SweetAlert, enums, vatExportService) {
vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$uibModal', 'vatSessionService', 'modelConfigurationService', '$compile', '$timeout', '$q', 'SweetAlert', '$http', 'apiConfig',
function ($scope, $translate, $uibModal, vatSessionService, modelConfigurationService, $compile, $timeout, $q, SweetAlert, $http, apiConfig) {
'use strict';
//由 project 决定的在本页面中固定的变量
......@@ -7,178 +7,630 @@ vatModule.controller('VatModelAnalysisController', ['$scope', '$translate', '$ui
$scope.organizationId = vatSessionService.project.organizationID;
$scope.projectId = vatSessionService.project.id;
$scope.projectYear = vatSessionService.project.year;
$scope.projectPeriod = vatSessionService.month;
$scope.serviceTypeId = vatSessionService.project.serviceTypeID;
/************* ViewModels BEGIN *************/
$scope.logOptions = {
isShown: false,
period: vatSessionService.month,
moduleId: enums.vatModuleEnum.Result_ModelAnalysisResult
};
var xArray = ['1月', '2月', '3月', '4月', '5月', '6月',
'7月', '8月', '9月', '10月', '11月', '12月'];
$scope.modelType = 1;
$scope.periodFrom = 1;
$scope.periodTo = 12;
$scope.modelTreeList = [];
//增值税负担率
function getBurdenRateData(chart) {
var yArray = ['应纳税额', '主营业务收入', '占比'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/burdenRateData/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '增值税负担率'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
type: 'scroll',
bottom: 10,
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: '金额',
// min: 0,
// max: 250,
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
{
type: 'value',
name: '占比',
// min: 0,
// max: 25,
position: 'left',
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[0],
type: 'bar',
data: res.data.vatAmount
},
{
name: yArray[1],
type: 'bar',
data: res.data.income
},
{
name: yArray[2],
type: 'line',
yAxisIndex: 1,
data: res.data.rate
}
]
};
chart.setOption(option);
}
$scope.selectCategoryId = null;
})
}
$scope.resizableOptions = {
handles: "right",
Width: 250,
minWidth: 200,
maxWidth: 350
//增值税申报表收入与会计收入差异离散度分析
function getDispersion(chart) {
$http.get('/reportAnalysis/burdenRateData/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var data = [];
for (var i in xArray) {
data.push([xArray[i], res.data.rate[i]]);
}
var option = {
title: {
text: '增值税申报表收入与会计收入差异离散度分析'
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: {},
series: [{
// symbolSize: 20,
data: data,
type: 'scatter'
}],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
}
};
chart.setOption(option);
}
$scope.dirtyDataProcess = {
hasCheckedFinished: false,
intervalId: null,
progressBarValue: 0,
processBarMax: 100,
processBarModalInstance: null,
progressBarOptions: {
min: 0,
width: "90%",
bindingOptions: {
value: 'dirtyDataProcess.progressBarValue',
max: 'dirtyDataProcess.processBarMax'
})
}
//进项税额占主营业务成本的比例
function getIncomeRateData(chart) {
var yArray = ['进项税额', '主营业务成本', '占比'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/incomeRate/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '进项税额占主营业务成本比例'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
type: 'scroll',
bottom: 10,
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: '金额',
// min: 0,
// max: 250,
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
statusFormat: function (value) {
return "计算进度: " + (value * 100).toFixed(0) + "%";
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
onComplete: function (e) {
$scope.dirtyDataProcess.processBarModalInstance.dismiss({$value: 'cancel'});
$scope.dirtyDataProcess.processBarModalInstance = null;
{
type: 'value',
name: '占比',
// min: 0,
// max: 25,
position: 'left',
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[0],
type: 'bar',
data: res.data.vatAmount
},
{
name: yArray[1],
type: 'bar',
data: res.data.income
},
{
name: yArray[2],
type: 'line',
yAxisIndex: 1,
data: res.data.rate
}
]
};
chart.setOption(option);
}
clearInterval($scope.dirtyDataProcess.intervalId);
$scope.dirtyDataProcess.intervalId = null;
})
}
loadTreeData();
//进项税转出额波动率
function getIncomeVolatilityData(chart) {
var yArray = ['本期进项税额转出额', '进项税额', '占比'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/incomeVolatility/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '进项税转出额波动率'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
type: 'scroll',
bottom: 10,
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: '金额',
// min: 0,
// max: 250,
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
formatter: function (val) {
return formatNum(val);
}
}
},
{
type: 'value',
name: '占比',
// min: 0,
// max: 25,
position: 'left',
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[0],
type: 'bar',
data: res.data.vatAmount
},
{
name: yArray[1],
type: 'bar',
data: res.data.income
},
{
name: yArray[2],
type: 'line',
yAxisIndex: 1,
data: res.data.rate
}
]
};
/************* ViewModels END *************/
var loadTreeData = function () {
var apiFunc = modelConfigurationService.getModelCategory;
apiFunc($scope.organizationId, $scope.industryId, $scope.serviceTypeId).success(function (data) {
var dic = {};
for (var ix = 0; ix < data.length; ix++) {
var item = data[ix];
dic[item.categoryID] = {
id: item.modelID,
title: item.modelName,
isCategory: item.isCategory,
questionCount: item.questionCount,
totalCount: item.modelTotalCount,
categoryId: item.categoryID,
parentID: item.parentID,
modelType: item.modelType,
parentNode: null,
sort: item.sort,
data: item,
feature: item.feature,
nodes: [],
};
chart.setOption(option);
}
//查找每个节点是否存在父节点,并维护父节点与本节点的关系
for (var key in dic) {
if (!dic.hasOwnProperty(key))
continue;
var item = dic[key];
var parentId = item.parentID;
if (!parentId || !dic.hasOwnProperty(parentId))
continue;
})
}
var p = dic[parentId];
if (!p && p === item)
continue;
//增值税应税收入、增值税免、抵、退办法出口收入 占会计收入比例
function getVatIncomeRateData(chart) {
var yArray = ['增值税应税收入', '增值税免、抵、退出口收入'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/vatIncomeRate/' + $scope.projectId + "/" + $scope.projectPeriod, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '应税收入、出口收入比例'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
type: 'scroll',
bottom: 5,
data: yArray
},
series: [
{
name: '占比',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: [
{value: res.data.vatAmount[0], name: '增值税应税收入'},
{value: res.data.income[0], name: '增值税免、抵、退出口收入'}
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
chart.setOption(option);
}
item.parentNode = p;
p.nodes.push(item);
})
}
var srcData = [];
for (var key in dic) {
if (!dic.hasOwnProperty(key))
continue;
//增值税应税收入、增值税免、抵、退办法出口收入 占会计收入比例 趋势
function getVatIncomeLineData(chart) {
var yArray = ['增值税应税收入', '增值税免、抵、退出口收入'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/vatIncomeLine/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '应税收入、出口收入比例趋势'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
type: 'scroll',
bottom: 10,
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: '占比',
// min: 0,
// max: 250,
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
}
}
],
series: [
{
name: yArray[0],
type: 'line',
data: res.data.vatAmount
},
{
name: yArray[1],
type: 'line',
data: res.data.income
}
]
};
chart.setOption(option);
}
var item = dic[key];
if (!item || item.parentNode)
continue;
})
}
srcData.push(item);
//已抵扣进项税波动率
function getDeductionData(chart) {
var yArray = ['占比', '基准值'];
var colors = ['#5793f3', '#d14a61', '#675bba'];
$http.get('/reportAnalysis/deduction/' + $scope.projectId, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
var option = {
title: {
text: '已抵扣进项税波动率'
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: false, readOnly: false},
restore: {show: false},
saveAsImage: {show: true}
}
},
legend: {
type: 'scroll',
bottom: 10,
data: yArray
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: xArray
}
],
yAxis: [
{
type: 'value',
name: '占比',
// max: 25,
position: 'left',
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: function (val) {
return (val * 100) + ' %';
}
$scope.modelTreeList = srcData;
});
}
}
],
series: [
{
name: yArray[1],
type: 'line',
data: ['1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1']
},
{
name: yArray[0],
type: 'bar',
data: res.data.rate
}
]
};
chart.setOption(option);
}
var getModelAnalysisPermission = function () {
var list = [];
var modelManageTemp = constant.vatPermission.dataAnalysis.modelAnalysis;
list.push(modelManageTemp.queryCode);
list.push(modelManageTemp.filterCode);
$scope.hasQueryPermission = false;
$scope.hasFilterIssuePermission = false;
$scope.$root.checkUserOrganizationPermissionList(list).success(function (data) {
$scope.hasQueryPermission = data[modelManageTemp.queryCode];
$scope.hasFilterIssuePermission = data[modelManageTemp.filterCode];
});
};
})
}
$scope.nodeSelected = function (node) {
$scope.selectCategoryId = node.categoryId;
$scope.modelType = node.feature;
};
function formatNum(strNum) {
if (strNum.length <= 3) {
return strNum;
}
if (!/^(\+|-)?(\d+)(\.\d+)?$/.test(strNum)) {
return strNum;
}
var a = RegExp.$1,
b = RegExp.$2,
c = RegExp.$3;
var re = new RegExp();
re.compile("(\\d)(\\d{3})(,|$)");
while (re.test(b)) {
b = b.replace(re, "$1,$2$3");
}
return a + "" + b + "" + c;
}
function init() {
var width = $("div .row")[0].offsetWidth;
$('div[name="p_chart"]').css("width", (width / 2) - 80);
$('div[name="p_chart"]').css("height", 400);
var burdenRateDiv = echarts.init(document.getElementById('burdenRateDiv'));
var discreteAnalysisDiv = echarts.init(document.getElementById('discreteAnalysisDiv'));
var incomeRateDiv = echarts.init(document.getElementById('incomeRateDiv'));
var incomeVolatilityDiv = echarts.init(document.getElementById('incomeVolatilityDiv'));
var vatIncomeRateDiv = echarts.init(document.getElementById('vatIncomeRateDiv'));
var vatIncomeLineDiv = echarts.init(document.getElementById('vatIncomeLineDiv'));
var deductionDiv = echarts.init(document.getElementById('deductionDiv'));
getBurdenRateData(burdenRateDiv);
getDispersion(discreteAnalysisDiv);
getIncomeRateData(incomeRateDiv);
getIncomeVolatilityData(incomeVolatilityDiv);
getVatIncomeRateData(vatIncomeRateDiv);
getVatIncomeLineData(vatIncomeLineDiv);
getDeductionData(deductionDiv);
}
(function () {
getModelAnalysisPermission();
//检查是否有脏数据
modelConfigurationService.projectHasDirtyData($scope.projectId, $scope.serviceTypeId).success(function (result) {
if (!result) {
loadTreeData();
return;
}
SweetAlert.swal({
title: $translate.instant('OrganizationsHasDirtyData'),
text: '',
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Confirm'),
cancelButtonText: $translate.instant('Cancel'),
closeOnConfirm: true
}, function (isConfirm) {
if (!isConfirm) {
loadTreeData();
return;
}
$scope.dirtyDataProcess.processBarModalInstance = $uibModal.open({
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: "vat-model-analysis-dirty-data-process-bar.html",
backdrop: 'static',
scope: $scope,
windowClass: "vat-model-analysis-dirty-data-process-bar"
});
$scope.dirtyDataProcess.intervalId = setInterval(function () {
$scope.dirtyDataProcess.progressBarValue++;
if (!$scope.dirtyDataProcess.hasCheckedFinished) {
$scope.dirtyDataProcess.processBarMax++;
}
}, 100);
//重新计算模型数据
modelConfigurationService.updateProjectModelDirtyDataSingleCard($scope.projectId, $scope.serviceTypeId).success(function () {
$scope.dirtyDataProcess.hasCheckedFinished = true;
});
});
});
init();
})();
}
]);
\ No newline at end of file
<div class="vat-model-analysis ">
<div class="col-lg-12 col-md-12" style="margin-top:20px;">
<div >
<table border="1" width="95%" style="margin: auto">
<thead>
<tr class="th">
<th>遇到一个问题1</th>
<th>遇到一个问题1</th>
</tr>
</thead>
<tbody>
<tr class="tb">
<td>遇到一个问题</td>
<td>遇到一个问题</td>
</tr>
</tbody>
</table>
<div class="col-lg-12 col-md-12" style="margin-top:20px;height: 100%;overflow:scroll">
<div class="row">
<div class="col-lg-5 col-md-5">
<div id="burdenRateDiv" name="p_chart"></div>
</div>
<div class="col-lg-5 col-md-5 col-md-offset-1 col-lg-offset-1">
<div id="discreteAnalysisDiv" name="p_chart"></div>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5">
<div id="incomeRateDiv" name="p_chart"></div>
</div>
<div class="col-lg-5 col-md-5 col-md-offset-1 col-lg-offset-1">
<div id="incomeVolatilityDiv" name="p_chart"></div>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5">
<div id="vatIncomeRateDiv" name="p_chart"></div>
</div>
<div class="col-lg-5 col-md-5 col-md-offset-1 col-lg-offset-1">
<div id="vatIncomeLineDiv" name="p_chart"></div>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-5">
<div id="deductionDiv" name="p_chart"></div>
</div>
<div class="col-lg-5 col-md-5 col-md-offset-1 col-lg-offset-1">
<div id="" name="p_chart"></div>
</div>
</div>
</div>
<style>
.th>th{
.th > th {
text-align: center;
}
.tb>td{
.tb > td {
height: 30px;
text-align: center;
}
......
......@@ -12,50 +12,50 @@
$scope.element = $element;
// rangePicker 需要手动释放,否则经过多次操作后,页面中会存在多个 rangePicker 的 div
var rangePicker = null;
var initializePeriodRangePicker = function () {
//初始化期间选择控件
var input = $($scope.element).find(".right-container .menu .period-range input");
var monthList = [
$translate.instant('Month01'),
$translate.instant('Month02'),
$translate.instant('Month03'),
$translate.instant('Month04'),
$translate.instant('Month05'),
$translate.instant('Month06'),
$translate.instant('Month07'),
$translate.instant('Month08'),
$translate.instant('Month09'),
$translate.instant('Month10'),
$translate.instant('Month11'),
$translate.instant('Month12')
];
input = input.rangePicker({
minDate: [1, $scope.projectYear],
maxDate: [12, $scope.projectYear],
setDate: [
[1, $scope.projectYear],
[12, $scope.projectYear]
],
months: monthList,
ConfirmBtnText: $translate.instant('Confirm'),
CancelBtnText: $translate.instant('ButtonCancel')
});
input.on('datePicker.done', function (e, result) {
$scope.periodFrom = result[0][0];
$scope.periodTo = result[1][0];
});
rangePicker = $(input).data("_ranegPicker");
};
// var rangePicker = null;
//
// var initializePeriodRangePicker = function () {
// //初始化期间选择控件
// var input = $($scope.element).find(".right-container .menu .period-range input");
// var monthList = [
// $translate.instant('Month01'),
// $translate.instant('Month02'),
// $translate.instant('Month03'),
// $translate.instant('Month04'),
// $translate.instant('Month05'),
// $translate.instant('Month06'),
// $translate.instant('Month07'),
// $translate.instant('Month08'),
// $translate.instant('Month09'),
// $translate.instant('Month10'),
// $translate.instant('Month11'),
// $translate.instant('Month12')
// ];
// input = input.rangePicker({
// minDate: [1, $scope.projectYear],
// maxDate: [12, $scope.projectYear],
// setDate: [
// [1, $scope.projectYear],
// [12, $scope.projectYear]
// ],
// months: monthList,
// ConfirmBtnText: $translate.instant('Confirm'),
// CancelBtnText: $translate.instant('ButtonCancel')
// });
// input.on('datePicker.done', function (e, result) {
// $scope.periodFrom = result[0][0];
// $scope.periodTo = result[1][0];
// });
//
// rangePicker = $(input).data("_ranegPicker");
// };
(function () {
initializePeriodRangePicker();
// initializePeriodRangePicker();
$scope.$on("$destroy", function () {
rangePicker.destroy();
});
// $scope.$on("$destroy", function () {
// rangePicker.destroy();
// });
})();
}
};
......
......@@ -18,7 +18,7 @@
//房地产
//projectID = '0cf0945f-d41c-4df3-8235-ae693d5e724d';
$q.all([
templateGroupService.getGroupTemplateByGroupID(48372654336679936, projectID),
templateGroupService.getGroupTemplateByGroupID(vatSessionService.project.templateGroupID, projectID),
vatReportService.getFilterTemplate(vatSessionService.project.id, constant.serviceType.VAT, vatSessionService.month)
]).then(function (result) {
if (!_.isEmpty(result[0]) && !_.isEmpty(result[0].data) && !_.isEmpty(result[0].data.data)
......
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