Commit 03000ff9 authored by chase's avatar chase

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents 1fd33481 7e67c133
......@@ -397,6 +397,25 @@
<version>3.2.6</version>
</dependency>
<!--CXF END-->
<!-- https://mvnrepository.com/artifact/org.jxls/jxls -->
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls</artifactId>
<version>2.4.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jxls/jxls-poi -->
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls-poi</artifactId>
<version>1.0.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.jxls/jxls-core -->
<dependency>
<groupId>net.sf.jxls</groupId>
<artifactId>jxls-core</artifactId>
<version>1.0.6</version>
</dependency>
</dependencies>
<profiles>
......@@ -468,6 +487,14 @@
</includes>
<targetPath>${basedir}/target/classes/userTemplate</targetPath>
</resource>
<resource>
<directory>src/main/resources/vat_excel_template</directory>
<includes>
<include>**/*.xls</include>
<include>**/*.xlsx</include>
</includes>
<targetPath>${basedir}/target/classes/vat_excel_template</targetPath>
</resource>
</resources>
<plugins>
<plugin>
......
package pwc.taxtech.atms.common;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Component
public class ResponseMessageBuilder {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
public HttpServletResponse getDownloadTmpResponseMessage(HttpServletResponse response, OutputStream outputStream, String fileName) throws Exception {
fileName = fileName + DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now()) + ".xlsx";
response.setContentType("application/octet-stream;charset=UTF-8");
response.setHeader("Access-Control-Expose-Headers", "x-file-name");
response.addHeader("Content-Disposition", "attachment; filename=" + fileName);
try (OutputStream responseOutputStream = response.getOutputStream()) {
response.setHeader("x-file-name", URLEncoder.encode(fileName, "UTF-8"));
ByteArrayOutputStream byteArrayOutputStream = (ByteArrayOutputStream) outputStream;
responseOutputStream.write(byteArrayOutputStream.toByteArray());
} catch (Exception e) {
logger.error("Error write data to response output stream");
e.printStackTrace();
throw new Exception(e.getMessage());
}
return response;
}
}
package pwc.taxtech.atms.constant.enums;
import java.util.HashMap;
import java.util.Map;
public class RevenueConfEnum {
/**
* 账载收入类型
*/
public enum AccountType {
Zero(0, "0值"),
Account(1, "科目"),
Manual(2, "手工录入");
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
AccountType(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
static {
for (RevenueConfEnum.AccountType accountType : RevenueConfEnum.AccountType.values()) {
MAPPING.put(accountType.getCode(), accountType.getName());
}
}
}
/**
* 账载收入类型
*/
public enum TaxBase {
Account(1, "账载"),
Invoice(2, "开票收入"),
Manual(3, "手工录入"),
Period_Dr(4, "借方发生额"),
Period_Cr(5, "贷方发生额");
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
TaxBase(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
static {
for (RevenueConfEnum.TaxBase taxBase : RevenueConfEnum.TaxBase.values()) {
MAPPING.put(taxBase.getCode(), taxBase.getName());
}
}
}
/**
* 计税方法
*/
public enum TaxType {
Common(0, "一般计税"),
Simple(1, "简易计税"),
Tax_Exemption(2, "免抵退税"),
Free(3, "免税");
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
TaxType(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
static {
for (RevenueConfEnum.TaxType taxType : RevenueConfEnum.TaxType.values()) {
MAPPING.put(taxType.getCode(), taxType.getName());
}
}
}
/**
* 收入类型
*/
public enum RevenueType {
Service(0, "货物及加工修理修配劳务"),
Assets(1, "服务、不动产和无形资产");
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
RevenueType(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
static {
for (RevenueConfEnum.RevenueType revenueType : RevenueConfEnum.RevenueType.values()) {
MAPPING.put(revenueType.getCode(), revenueType.getName());
}
}
}
/**
* 状态
*/
public enum Status {
Enable(0, "启用"),
Disable(1, "停用");
private Integer code;
private String name;
public static final Map<Integer, String> MAPPING = new HashMap<>();
Status(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
static {
for (RevenueConfEnum.Status status : RevenueConfEnum.Status.values()) {
MAPPING.put(status.getCode(), status.getName());
}
}
}
}
......@@ -55,6 +55,13 @@ public class DataPreviewController extends BaseController {
return dataPreviewSerivceImpl.getBSDataForDisplay(param);
}
@RequestMapping(value = "exportCFData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadCFQueryData(@RequestBody CashFlowParam param, HttpServletResponse response) {
logger.debug("enter downloadCFQueryData");
String fileName="testFile";
dataPreviewSerivceImpl.exportCashFlowList(response, param, fileName);
}
@RequestMapping(value = "exportTBData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadTBQueryData(@RequestBody TrialBalanceParam paras, HttpServletResponse response) {
response.setContentType("application/vnd.ms-excel;charset=utf-8");
......
package pwc.taxtech.atms.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.ebsdto.JEqueryDto;
import pwc.taxtech.atms.service.EbsApiService;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@RestController
@RequestMapping("/ebs/api/v1/dd")
public class EbsApiController {
private static final Logger logger= LoggerFactory.getLogger(EbsApiController.class);
@Resource
private EbsApiService ebsApiService;
@RequestMapping(value = "/queryRemoteServerThenUpdateJE", method = RequestMethod.POST)
public ApiResultDto queryRemoteServerThenUpdateJE(@RequestBody List<JEqueryDto> items) {
if (items!=null&&!items.isEmpty()) {
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateJE(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("queryRemoteServerThenUpdateJE error.", e);
}
return ApiResultDto.fail();
}
}
package pwc.taxtech.atms.dto.vatdto.excelheader;
public class CashFlowHeader {
private String companyNameCn;
private String companyNameEn;
private Integer periodStart;
private Integer periodEnd;
private String ledgerName;
private String ledgerCurrencyCode;
private String status;
public String getCompanyNameCn() {
return companyNameCn;
}
public void setCompanyNameCn(String companyNameCn) {
this.companyNameCn = companyNameCn;
}
public String getCompanyNameEn() {
return companyNameEn;
}
public void setCompanyNameEn(String companyNameEn) {
this.companyNameEn = companyNameEn;
}
public Integer getPeriodStart() {
return periodStart;
}
public void setPeriodStart(Integer periodStart) {
this.periodStart = periodStart;
}
public Integer getPeriodEnd() {
return periodEnd;
}
public void setPeriodEnd(Integer periodEnd) {
this.periodEnd = periodEnd;
}
public String getLedgerName() {
return ledgerName;
}
public void setLedgerName(String ledgerName) {
this.ledgerName = ledgerName;
}
public String getLedgerCurrencyCode() {
return ledgerCurrencyCode;
}
public void setLedgerCurrencyCode(String ledgerCurrencyCode) {
this.ledgerCurrencyCode = ledgerCurrencyCode;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.ebsdto.JEqueryDto;
import java.util.List;
public interface EbsApiService {
/**
* EBS 日记账同步更新
* @param items
*/
void queryRemoteServerThenUpdateJE(List<JEqueryDto> items);
}
......@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;
import pwc.taxtech.atms.common.AtmsApiSettings;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.ResponseMessageBuilder;
import pwc.taxtech.atms.common.util.BeanUtil;
public class BaseService {
......@@ -23,5 +24,9 @@ public class BaseService {
protected BeanUtil beanUtil;
@Autowired
protected RestTemplate restTemplate;
@Autowired
protected CommonDocumentHelper commonDocumentHelper;
@Autowired
protected ResponseMessageBuilder responseMessageBuilder;
}
package pwc.taxtech.atms.service.impl;
import org.jxls.common.Context;
import org.jxls.expression.JexlExpressionEvaluator;
import org.jxls.transform.Transformer;
import org.jxls.util.JxlsHelper;
import org.nutz.lang.Lang;
import org.nutz.lang.Streams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class CommonDocumentHelper {
private static final Logger logger = LoggerFactory.getLogger(CommonDocumentHelper.class);
public void toXlsxFileUsingJxls(List<?> list, String excelTemplatePathInClassPath, String outputFilePath) {
//InputStream is = Streams.fileIn(excelTemplatePathInClassPath);
InputStream is = this.getClass().getResourceAsStream(excelTemplatePathInClassPath);
OutputStream os = Streams.fileOut(outputFilePath);
Context context = new Context();
context.putVar("list", list);
context.putVar("REPORT_DATE", new Date());
JxlsHelper jxlsHelper = JxlsHelper.getInstance();
Transformer transformer = jxlsHelper.createTransformer(is, os);
JexlExpressionEvaluator evaluator = (JexlExpressionEvaluator) transformer.getTransformationConfig()
.getExpressionEvaluator();
// evaluator.getJexlEngine().setSilent(true); // 设置静默模式,不报警告
Map<String, Object> funcs = new HashMap<String, Object>();
funcs.put("myutils", new JxlsUtils());
evaluator.getJexlEngine().setFunctions(funcs);
// jxlsHelper.setUseFastFormulaProcessor(false); //与统计函数有关
try {
jxlsHelper.processTemplate(context, transformer);
} catch (IOException e) {
logger.error("error when calling processTemplate:" + e, e);
throw Lang.wrapThrow(e);
} finally {
Streams.safeClose(is);
Streams.safeClose(os);
}
}
public OutputStream toXlsxFileUsingJxls(Object header, List<?> list, String excelTemplatePathInClassPath) {
//InputStream is = Streams.fileIn(excelTemplatePathInClassPath);
InputStream is = this.getClass().getResourceAsStream(excelTemplatePathInClassPath);
OutputStream os = new ByteArrayOutputStream();
Context context = new Context();
context.putVar("header", header);
context.putVar("list", list);
context.putVar("REPORT_DATE", new Date());
JxlsHelper jxlsHelper = JxlsHelper.getInstance();
Transformer transformer = jxlsHelper.createTransformer(is, os);
JexlExpressionEvaluator evaluator = (JexlExpressionEvaluator) transformer.getTransformationConfig()
.getExpressionEvaluator();
// evaluator.getJexlEngine().setSilent(true); // 设置静默模式,不报警告
Map<String, Object> funcs = new HashMap<String, Object>();
funcs.put("myutils", new JxlsUtils());
evaluator.getJexlEngine().setFunctions(funcs);
// jxlsHelper.setUseFastFormulaProcessor(false); //与统计函数有关
try {
jxlsHelper.processTemplate(context, transformer);
} catch (IOException e) {
logger.error("error when calling processTemplate:" + e, e);
throw Lang.wrapThrow(e);
} finally {
Streams.safeClose(is);
Streams.safeClose(os);
}
return os;
}
}
package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.dto.vatdto.dd.*;
import pwc.taxtech.atms.dto.vatdto.dd.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.excelheader.CashFlowHeader;
import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dpo.*;
......@@ -14,11 +18,9 @@ import pwc.taxtech.atms.vat.dpo.TrialBalanceCondition;
import pwc.taxtech.atms.vat.entity.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @Auther: Gary J Li
......@@ -42,6 +44,8 @@ public class DataPreviewSerivceImpl extends BaseService {
@Resource
private CashFlowMapper cashFlowMapper;
@Resource
private OrganizationMapper organizationMapper;
public PageInfo<TrialBalanceDto> getTBDataForDisplay(TrialBalanceParam param) {
......@@ -85,6 +89,30 @@ public class DataPreviewSerivceImpl extends BaseService {
}
public PageInfo<CashFlowDto> getCFDataForDisplay(CashFlowParam param) {
CashFlowCondition condition = new CashFlowCondition();
beanUtil.copyProperties(param, condition);
//Integer totalCount=cashFlowMapper.selectCountByCondition(condition);
List<CashFlowDto> cashFlowDtos = Lists.newArrayList();
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
List<CashFlow> cashFlows = cashFlowMapper.selectByCondition(condition);
//使用page的getTotal()
Long total = page.getTotal();
cashFlows.forEach(cf -> {
CashFlowDto cashFlowDto = new CashFlowDto();
beanUtil.copyProperties(cf, cashFlowDto);
cashFlowDtos.add(cashFlowDto);
});
PageInfo<CashFlowDto> pageInfo=new PageInfo<>(cashFlowDtos);
pageInfo.setTotal(total);
pageInfo.setPageNum(param.getPageInfo().getPageIndex());
return pageInfo;
}
public HttpServletResponse exportCashFlowList(HttpServletResponse response, CashFlowParam param, String fileName) {
//Boolean isEn = StringUtils.equals(language, "en-us");
logger.debug("start export input invoice list to excel");
//String excelTemplatePathInClassPath = "/vat_excel_template/cash_flow"+(isEn?"":"_cn") + ".xlsx";
String excelTemplatePathInClassPath = "/vat_excel_template/cash_flow.xlsx";
CashFlowCondition condition = new CashFlowCondition();
beanUtil.copyProperties(param, condition);
PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
......@@ -95,7 +123,25 @@ public class DataPreviewSerivceImpl extends BaseService {
beanUtil.copyProperties(cf, cashFlowDto);
cashFlowDtos.add(cashFlowDto);
});
return new PageInfo<>(cashFlowDtos);
CashFlowHeader cashFlowHeader=new CashFlowHeader();
if(cashFlowDtos.size()>0){
Organization org = organizationMapper.selectByPrimaryKey(param.getOrgId());
cashFlowHeader.setCompanyNameCn(org.getName());
cashFlowHeader.setPeriodStart(param.getPeriodStart());
cashFlowHeader.setPeriodEnd(param.getPeriodEnd());
cashFlowHeader.setLedgerName(cashFlowDtos.get(0).getLedgerName());
cashFlowHeader.setLedgerCurrencyCode(cashFlowDtos.get(0).getLedgerCurrencyCode());
cashFlowHeader.setStatus(cashFlowDtos.get(0).getStatus());
}
OutputStream outputStream = commonDocumentHelper.toXlsxFileUsingJxls(cashFlowHeader, cashFlowDtos, excelTemplatePathInClassPath);
try {
return responseMessageBuilder.getDownloadTmpResponseMessage(response, outputStream, fileName);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage());
}
return null;
}
public PageInfo<JournalEntryDto> getJEDataForDisplay(JournalEntryParam param) {
......
package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.dto.ebsdto.JEqueryDto;
import pwc.taxtech.atms.service.EbsApiService;
import pwc.taxtech.atms.vat.dao.JournalEntryMapper;
import pwc.taxtech.atms.vat.entity.JournalEntry;
import pwc.taxtech.atms.vat.entity.JournalEntryExample;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Optional;
@Service
public class EbsApiServiceImpl implements EbsApiService {
@Resource
private JournalEntryMapper journalEntryMapper;
@Resource
private DistributedIdService distributedIdService;
@Resource
private BeanUtil beanUtil;
private static final Logger logger= LoggerFactory.getLogger(EbsApiServiceImpl.class);
@Override
public void queryRemoteServerThenUpdateJE(List<JEqueryDto> items) {
long start=System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateJE");
//判断数据是否存在
if(items.size()==0){
logger.error("empty EBS JE response, skip processing");
return;
}
logger.debug("requestJEItems:"+ JSON.toJSONString(items));
for(JEqueryDto a:items){
try {
processJE(a);
}catch (Exception e){
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateJE,took [{}] ms",System.currentTimeMillis()-start);
}
private void processJE(JEqueryDto item){
JournalEntryExample journalEntryExample=new JournalEntryExample();
journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum());
List<JournalEntry> journalEntryList=journalEntryMapper.selectByExample(journalEntryExample);
//唯一则更新否则插入
JournalEntry journalEntry=new JournalEntry();
if(journalEntryList.size()==1){
logger.info("exit and update journalEntry headerId:{},lineNum:{}", item.getHeaderId(),item.getLineNum());
journalEntry=journalEntryList.get(0);
populateFieldsJE(item,journalEntry);
journalEntryMapper.updateByPrimaryKey(journalEntry);
}else{
logger.info("miss and insert journalEntry headerId:{},lineNum:{}", item.getHeaderId(),item.getLineNum());
populateFieldsJE(item,journalEntry);
journalEntry.setId(distributedIdService.nextId());
journalEntry.setCreatedBy("");
journalEntry.setCreatedDate(new Date());
journalEntry.setCreateTime(new Date());
journalEntryMapper.insertSelective(journalEntry);
}
}
private void populateFieldsJE(JEqueryDto item,JournalEntry result){
result.setOrganizationId(trimLimit(item.getOrganizationId(),128));
result.setProjectId(trimLimit(item.getProjectId(),128));
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(),20));
result.setLedgerId(trimLimit(item.getLedgerId(),128));
result.setLedgerName(trimLimit(item.getLedgerName(),300));
result.setCurrencyCode(trimLimit(item.getCurrencyCode(),20));
result.setStatus(trimLimit(item.getStatus(),10));
result.setHeaderId(trimLimit(item.getHeaderId(),128));
result.setLineNum(trimLimit(item.getLineNum(),300));
result.setApprovalStatus(trimLimit(item.getApprovalStatus(),20));
result.setPostedStatus(trimLimit(item.getPostedStatus(),20));
result.setPeriod(StringUtils.isBlank(item.getPeriod().toString())?0:item.getPeriod());
result.setAccountingDate(item.getAccountingDate());
result.setJournalSource(trimLimit(item.getJournalSource(),20));
result.setCategory(trimLimit(item.getCategory(),50));
result.setName(trimLimit(item.getName(),300));
result.setVoucherNum(trimLimit(item.getVoucherNum(),128));
result.setDescription(trimLimit(item.getDescription(),500));
result.setSegment1(trimLimit(item.getSegment1(),300));
result.setSegment2(trimLimit(item.getSegment2(),300));
result.setSegment3(trimLimit(item.getSegment3(),300));
result.setSegment4(trimLimit(item.getSegment4(),300));
result.setSegment5(trimLimit(item.getSegment5(),300));
result.setSegment6(trimLimit(item.getSegment6(),300));
result.setSegment7(trimLimit(item.getSegment7(),300));
result.setSegment8(trimLimit(item.getSegment8(),300));
result.setSegment9(trimLimit(item.getSegment9(),300));
result.setSegment10(trimLimit(item.getSegment10(),300));
result.setSegment1Name(trimLimit(item.getSegment1Name(),300));
result.setSegment2Name(trimLimit(item.getSegment2Name(),300));
result.setSegment3Name(trimLimit(item.getSegment3Name(),300));
result.setSegment4Name(trimLimit(item.getSegment4Name(),300));
result.setSegment5Name(trimLimit(item.getSegment5Name(),300));
result.setSegment6Name(trimLimit(item.getSegment6Name(),300));
result.setSegment7Name(trimLimit(item.getSegment7Name(),300));
result.setSegment8Name(trimLimit(item.getSegment8Name(),300));
result.setSegment9Name(trimLimit(item.getSegment9Name(),300));
result.setSegment10Name(trimLimit(item.getSegment10Name(),300));
result.setJournalCurrencyCode(trimLimit(item.getJournalCurrencyCode(),20));
result.setSobCurrencyCode(trimLimit(item.getSobCurrencyCode(),20));
result.setAccountedDr(Optional.ofNullable(item.getAccountedDr()).map(x->x.setScale(4, RoundingMode.HALF_UP)).orElse(BigDecimal.ZERO));
result.setAccountedCr(Optional.ofNullable(item.getAccountedCr()).map(x->x.setScale(4, RoundingMode.HALF_UP)).orElse(BigDecimal.ZERO));
result.setEnteredDr(Optional.ofNullable(item.getEnteredDr()).map(x->x.setScale(4, RoundingMode.HALF_UP)).orElse(BigDecimal.ZERO));
result.setEnteredCr(Optional.ofNullable(item.getEnteredCr()).map(x->x.setScale(4, RoundingMode.HALF_UP)).orElse(BigDecimal.ZERO));
result.setCfItem(trimLimit(item.getCfItem(),50));
result.setAttribute1(trimLimit(item.getAttribute1(),300));
result.setAttribute2(item.getAttribute2());
result.setAttribute3(trimLimit(item.getAttribute3(),300));
result.setAttribute4(trimLimit(item.getAttribute4(),300));
result.setAttribute5(trimLimit(item.getAttribute5(),300));
result.setAttribute6(trimLimit(item.getAttribute6(),300));
result.setAttribute7(trimLimit(item.getAttribute7(),300));
result.setAttribute8(trimLimit(item.getAttribute8(),300));
result.setAttribute9(trimLimit(item.getAttribute9(),300));
result.setAttribute10(trimLimit(item.getAttribute10(),300));
result.setAttribute11(trimLimit(item.getAttribute11(),300));
result.setAttribute12(trimLimit(item.getAttribute12(),300));
result.setAttribute13(trimLimit(item.getAttribute13(),300));
result.setAttribute14(trimLimit(item.getAttribute14(),300));
result.setAttribute15(trimLimit(item.getAttribute15(),300));
result.setAttribute16(trimLimit(item.getAttribute16(),300));
result.setLateUpdatedBy("");
result.setLateUpdatedDate(new Date());
result.setUpdateTime(new Date());
}
/** Trim字符串,并限定字符串的长度. 如果是输入值是空指针,会返回空字符串 */
public String trimLimit(String str, int limit) {
if (Strings.isBlank(str)) {
return "";
}
String tmp = str.trim();
String result = cutString(tmp, limit);
if (result == null)
result = "";
return result;
}
/** 限定字符串的长度. */
public String cutString(String s, int length) {
if (Lang.isEmpty(length) || Lang.isEmpty(s))
return "";
else if (s.length() <= length)
return s;
else
return s.substring(0, length);
}
}
package pwc.taxtech.atms.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public class JxlsUtils {
public String formatDate(Date date, String pattern) {
if (null == date)
return "";
SimpleDateFormat sdf = new SimpleDateFormat(pattern, Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
try {
return sdf.format(date);
} catch (Exception e) {
return "<Invalid date pattern:" + pattern + ">";
}
}
}
......@@ -6,7 +6,7 @@
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.tablePrefix = QRTZ_
org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 5000
org.quartz.jobStore.clusterCheckinInterval = 60000
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.txIsolationLevelReadCommitted = true
......
......@@ -17,7 +17,7 @@
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!-- 4.0.0以后版本可以不设置该参数 -->
<property name="diaect" value="oracle"/>
<property name="helperDialect" value="mysql"/>
<!--
该参数默认为false
设置为true时,会将RowBounds第一个参数offset当成pageNum页码使用
......
package pwc.taxtech.atms.service.impl;
import org.junit.Test;
import pwc.taxtech.atms.CommonIT;
import pwc.taxtech.atms.dto.ebsdto.JEqueryDto;
import pwc.taxtech.atms.service.EbsApiService;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class EbsApiServiceImplTest extends CommonIT {
@Resource
private EbsApiService ebsApiService;
@Resource
private DistributedIdService distributedIdService;
@Test
public void queryRemoteServerThenUpdateJE(){
List<JEqueryDto> items=new ArrayList<>();
for(int i=0;i<10;i++){
JEqueryDto jEqueryDto=new JEqueryDto();
jEqueryDto.setId(distributedIdService.nextId());
jEqueryDto.setOrganizationId("44250A49-F3EF-4A1E-89E0-165BB89A94D0");
jEqueryDto.setProjectId("44250A49-F3EF-4A1E-89E0-165BB89A94D0");
jEqueryDto.setDate(new Date());
jEqueryDto.setSource("这是哪里"+i);
jEqueryDto.setLedgerId("我关联谁"+i);
jEqueryDto.setLedgerName("我是谁"+i);
jEqueryDto.setCurrencyCode("123"+i);
jEqueryDto.setStatus("1");
jEqueryDto.setHeaderId("123456789");
jEqueryDto.setLineNum("1");
jEqueryDto.setApprovalStatus("1");
jEqueryDto.setPostedStatus("1");
jEqueryDto.setPeriod(0);
jEqueryDto.setAccountingDate(new Date());
jEqueryDto.setJournalSource("setJournalSource");
jEqueryDto.setCategory("setCategory");
jEqueryDto.setName("setName");
jEqueryDto.setVoucherNum("setVoucherNum");
jEqueryDto.setDescription("setDescription");
jEqueryDto.setSegment1("setSegment1");
jEqueryDto.setSegment2("setSegment2");
jEqueryDto.setSegment3("");
jEqueryDto.setSegment4("");
jEqueryDto.setSegment5("");
jEqueryDto.setSegment6("");
jEqueryDto.setSegment7("");
jEqueryDto.setSegment8("");
jEqueryDto.setSegment9("");
jEqueryDto.setSegment10("");
jEqueryDto.setSegment1Name("");
jEqueryDto.setSegment2Name("");
jEqueryDto.setSegment3Name("");
jEqueryDto.setSegment4Name("");
jEqueryDto.setSegment5Name("");
jEqueryDto.setSegment6Name("");
jEqueryDto.setSegment7Name("");
jEqueryDto.setSegment8Name("");
jEqueryDto.setSegment9Name("");
jEqueryDto.setSegment10Name("");
jEqueryDto.setJournalCurrencyCode("");
jEqueryDto.setSobCurrencyCode("");
jEqueryDto.setAccountedDr(new BigDecimal("0"));
jEqueryDto.setAccountedCr(new BigDecimal("0"));
jEqueryDto.setEnteredDr(new BigDecimal("0"));
jEqueryDto.setEnteredCr(new BigDecimal("0"));
jEqueryDto.setCfItem("");
jEqueryDto.setAttribute1("");
jEqueryDto.setAttribute2(new Date());
jEqueryDto.setAttribute3("");
jEqueryDto.setAttribute4("");
jEqueryDto.setAttribute5("");
jEqueryDto.setAttribute6("");
jEqueryDto.setAttribute7("");
jEqueryDto.setAttribute8("");
jEqueryDto.setAttribute9("");
jEqueryDto.setAttribute10("");
jEqueryDto.setAttribute11("");
jEqueryDto.setAttribute12("");
jEqueryDto.setAttribute13("");
jEqueryDto.setAttribute14("");
jEqueryDto.setAttribute15("");
jEqueryDto.setAttribute16("");
items.add(jEqueryDto);
}
ebsApiService.queryRemoteServerThenUpdateJE(items);
}
}
\ No newline at end of file
......@@ -41,12 +41,22 @@
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<table tableName="invoice_data" domainObjectName="InvoiceData">
<table tableName="revenue_config" domainObjectName="RevenueConfig">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
<columnOverride column="count_type" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<columnOverride column="account_type" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<columnOverride column="tax_base" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<columnOverride column="revenue_type" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<columnOverride column="tax_type" javaType="java.lang.Integer" jdbcType="TINYINT"/>
<columnOverride column="status" javaType="java.lang.Integer" jdbcType="TINYINT"/>
</table>
<!--<table tableName="invoice_data" domainObjectName="InvoiceData">-->
<!--<property name="useActualColumnNames" value="false"/>-->
<!--<property name="ignoreQualifiersAtRuntime" value="true"/>-->
<!--<columnOverride column="count_type" javaType="java.lang.Integer" jdbcType="TINYINT"/>-->
<!--</table>-->
<!--<table tableName="coupa_purchasing_report" domainObjectName="CoupaPurchasingReport">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
......
package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
......@@ -9,6 +8,8 @@ import pwc.taxtech.atms.vat.dpo.CashFlowCondition;
import pwc.taxtech.atms.vat.entity.CashFlow;
import pwc.taxtech.atms.vat.entity.CashFlowExample;
import java.util.List;
@Mapper
public interface CashFlowMapper extends MyVatMapper {
/**
......@@ -109,5 +110,7 @@ public interface CashFlowMapper extends MyVatMapper {
List<CashFlow> selectByCondition(@Param("cfCondition") CashFlowCondition condition);
Integer selectCountByCondition(@Param("cfCondition") CashFlowCondition condition);
int insertBatch(List<CashFlow> cfs);
}
\ No newline at end of file
package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
import pwc.taxtech.atms.vat.entity.RevenueConfigExample;
@Mapper
public interface RevenueConfigMapper extends MyVatMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
long countByExample(RevenueConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
int deleteByExample(RevenueConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
int insert(RevenueConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
int insertSelective(RevenueConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
List<RevenueConfig> selectByExampleWithRowbounds(RevenueConfigExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
List<RevenueConfig> selectByExample(RevenueConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
RevenueConfig selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") RevenueConfig record, @Param("example") RevenueConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
int updateByExample(@Param("record") RevenueConfig record, @Param("example") RevenueConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(RevenueConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table revenue_config
*
* @mbg.generated
*/
int updateByPrimaryKey(RevenueConfig record);
}
\ No newline at end of file
......@@ -35,6 +35,13 @@
where
<include refid="QueryCondition"/>
</select>
<select id="selectCountByCondition" parameterType="pwc.taxtech.atms.vat.dpo.CashFlowCondition" resultType="Integer">
select
count(*)
from cash_flow
where
<include refid="QueryCondition"/>
</select>
<insert id="insertBatch" parameterType="java.util.List">
insert into cash_flow
......
......@@ -928,7 +928,7 @@ constant.outputTaxRate = ['17%', '13%', '11%', '6%', '5%', '3%', '1.5%', '0%', '
constant.AccountMappingProcessKey = {UnSelected: 'UnSelected', Submit: 'Submit', Undo: 'Undo'}
constant.pagesize = 100;
constant.pagesize = 50;
constant.ErpCheckType = {
CustomInvoice_DuplicatePayNum: 20
......
webservices.factory('vatPreviewService', ['$http', 'apiConfig', function ($http, apiConfig) {
webservices.factory('vatPreviewService', ['$http', 'apiConfig','FileSaver', function ($http, apiConfig,FileSaver) {
'use strict';
return {
sample: function () {
......@@ -189,8 +189,14 @@
getCFDataForDisplay: function (queryParams) {
return $http.post('/dataPreview/getCFDataForDisplay', queryParams, apiConfig.createVat());
},
initExportCFData: function (queryParams) {
return $http.post('/dataPreview/exportCFData/get', queryParams, apiConfig.create({ responseType: 'arraybuffer' }));
//服务器导出
initExportCFData: function (queryParm, fileName) {
var thisConfig = apiConfig.create();
thisConfig.responseType = "arraybuffer";
return $http.post('/dataPreview/exportCFData/get', queryParm, thisConfig).then(function (response) {
var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data, fileName + '.xlsx');
});
},
getPLDataForDisplay: function (queryParams) {
return $http.post('/dataPreview/getPLDataForDisplay', queryParams, apiConfig.createVat());
......
<div class="vat-preview-cash-flow" id="mainPreviewDiv">
<div class="top-area-wrapper" style="margin-top: 10px">
<span translate="ImportCFStatusGridSourceDDTitle" class="text-bold"></span> &nbsp;&nbsp;|&nbsp;&nbsp;<span class="text-bold" translate="InvoiceQJ"></span>
<span translate="CashFlowDDTitle" class="text-bold"></span> &nbsp;&nbsp;|&nbsp;&nbsp;<span class="text-bold" translate="InvoiceQJ"></span>
<input type="text" class="form-control input-width-middle" style="position: relative; top: -30px; left: 130px;" id="input-invoice-period-picker" />
<span ng-click="downloadInputInvoice()" style="position: relative; top: -13px; left: 95%;"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'ExportBtn' | translate}}</span>
<span ng-click="downloadCashFlow()" style="position: relative; top: -13px; left: 95%;"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'ExportBtn' | translate}}</span>
</div>
<div style="margin-bottom: 10px;margin-left: 20px;margin-top: 10px;">
......@@ -11,26 +11,8 @@
是否关账:<span class="numAmount">{{ledgerStatusFirst}}</span>
</div>
<!-- <div id="filterCriteriaDiv" style="max-width:98%;margin-bottom:2px;" ng-show="criteriaList.length>0">
<span class="text-bold margin-left20" translate="FilterCriteriaTags"></span>:
<span class="tag label label-default" ng-repeat="criteria in criteriaListFirstRow">
<span title="{{criteria.fullName}}">
{{criteria.name}}
</span>
<a><i class="remove glyphicon glyphicon-remove-sign glyphicon-white" ng-click="doDataFilter(criteria.propertyName)"></i></a>
</span>
<span ng-if="criteriaList.length>6"><br /></span>
<span ng-if="criteriaList.length>6" style="margin-left: 81px; margin-top: 19px; display: inline-block;"></span>
<span ng-if="criteriaList.length>6" class="tag label label-default" ng-repeat="criteria in criteriaListSecondRow">
<span title="{{criteria.fullName}}">
{{criteria.name}}
</span>
<a><i class="remove glyphicon glyphicon-remove-sign glyphicon-white" ng-click="doDataFilter(criteria.propertyName)"></i></a>
</span>
</div> -->
<div id="mainAreaDiv" class="main-area">
<div class="inputInvoiceGrid" ui-grid-expandable ui-grid="gridOptions">
<div class="inputInvoiceGrid" ui-grid="gridOptions">
<div class="watermark" ng-show="!gridOptions.data.length"><span translate="NoDataAvailable"></span></div>
</div>
<div class="pagination-container">
......
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