Commit 691bd013 authored by chase's avatar chase

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

# Conflicts:
#	atms-api/src/main/java/pwc/taxtech/atms/controller/ReportController.java
parents 6a0c77b8 0457636b
......@@ -5,29 +5,18 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class FileServiceConfig {
@Value("${file.server.url}")
private String serverUrl;
@Value("${file.server.upload}")
private String uploadUrl;
@Value("${file_upload_post_url}")
private String upload_post_url;
public String getUpload_post_url() {
return upload_post_url;
}
public void setUpload_post_url(String upload_post_url) {
this.upload_post_url = upload_post_url;
}
private String uploadUrl;
@Value("${file_upload_query_url}")
private String downloadUrl;
public String getServerUrl() {
return serverUrl;
public String getDownloadUrl() {
return downloadUrl;
}
public void setServerUrl(String serverUrl) {
this.serverUrl = serverUrl;
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public String getUploadUrl() {
return uploadUrl;
}
......
......@@ -7,9 +7,14 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
......@@ -18,75 +23,77 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.config.FileServiceConfig;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.exception.ServiceException;
import java.io.IOException;
import java.net.URLEncoder;
import java.security.MessageDigest;
/**
* author kevin
* ver 1.0
*/
@Configuration
public class FileUploadUtil implements ApplicationContextAware {
public class FileUploadUtil implements ApplicationContextAware {
protected static final Logger logger = LoggerFactory.getLogger(FileUploadUtil.class);
// Spring应用上下文环境
private static ApplicationContext applicationContext;
private static FileServiceConfig config;
private static final String USER_TEMPLATE_PATH = "pwc/userTemplate/";
private static final String HTTP_HEADER = "application/json;charset=UTF-8";
private static FileServiceConfig config;
private static final String HTTP_SUCCESS_CODE = "200";
public static String upload(MultipartFile file) throws ServiceException{
return upload( file, false);
}
protected static char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
public static String serverPath(boolean newUrl){
config = (FileServiceConfig)applicationContext.getBean("fileServiceConfig");
if(newUrl)
return config.getUpload_post_url();
return config.getServerUrl() + config.getUploadUrl();
public static String getUploadUrl() {
config = (FileServiceConfig) applicationContext.getBean("fileServiceConfig");
return config.getUploadUrl();
}
public static String serverPath(){
return serverPath(true);
public static String downLoadUrl() {
config = (FileServiceConfig) applicationContext.getBean("fileServiceConfig");
return config.getDownloadUrl();
}
/**
* 上传模板
*
* @param file MultipartFile
* @param fullPath 是否返回全路径 默认false ,如果为true返回的路径直接可以用于下载
* @param file MultipartFile
* @return Boolean
*/
public static String upload( MultipartFile file, boolean fullPath) throws ServiceException {
public static String upload(MultipartFile file, String fileName) throws ServiceException {
if (StringUtils.isBlank(file.getOriginalFilename()) || null == file) {
throw new IllegalArgumentException("上传参数为空");
}
if (fileName == null) {
fileName = file.getOriginalFilename();
}
CloseableHttpClient httpClient = null;
String filePath = USER_TEMPLATE_PATH + file.getOriginalFilename();
String requestKey = CommonUtils.getUUID();
String requestUrl = getUploadUrl() + "/" + requestKey;
try {
String serverPath = serverPath();
/*String serverPath = serverPath();
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(serverPath);
httpPost.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
JSONObject param = new JSONObject();
param.put("path", filePath);
param.put("file", file.getBytes());
HttpEntity httpEntity = new StringEntity(param.toJSONString(), ContentType.APPLICATION_JSON);
httpPost.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());*/
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(requestUrl);
String md5Str = getFileMD5String(file);
ByteArrayBody byteBody = new ByteArrayBody(file.getBytes(), ContentType.MULTIPART_FORM_DATA, StringUtils.isBlank(fileName) ? URLEncoder.encode(file.getOriginalFilename(), "UTF-8") : URLEncoder.encode(fileName, "UTF-8"));
StringBody md5 = new StringBody(md5Str, ContentType.create("text/plain"));
HttpEntity httpEntity = MultipartEntityBuilder.create().addPart("filecontent", byteBody).addPart("md5", md5).build();
httpPost.setEntity(httpEntity);
HttpResponse httpResponse = httpClient.execute(httpPost);
ApiResultDto resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"), ApiResultDto.class);
if (resultDto.getCode() == ApiResultDto.SUCCESS) {
if(fullPath)
return config.getServerUrl() + "/" + filePath;
return filePath;
}
JSONObject resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"));
if (HTTP_SUCCESS_CODE.equals(resultDto.getString("status_code")))
return requestKey;
return null;
} catch (Exception e) {
e.printStackTrace();
logger.error("uploadTemplate error.", e);
return null;
} finally {
if (null != httpClient) {
try {
......@@ -96,10 +103,23 @@ public class FileUploadUtil implements ApplicationContextAware {
}
}
}
throw new ServiceException("uploadTemplate error.");
}
public static boolean downLoad(String download_url) {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(downLoadUrl() + "/" + download_url);
HttpResponse httpResponse = null;
try {
httpResponse = httpClient.execute(httpGet);
JSONObject resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"));
if (resultDto.getString("status_code").equals(HTTP_SUCCESS_CODE))
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
return false;
}
/**
......@@ -110,10 +130,35 @@ public class FileUploadUtil implements ApplicationContextAware {
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
/**
* @return ApplicationContext
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
public static String getFileMD5String(MultipartFile file) throws Exception {
MessageDigest messagedigest = MessageDigest.getInstance("MD5");
messagedigest.update(file.getBytes());
byte bytes[] = messagedigest.digest();
return bufferToHex(bytes, 0, bytes.length);
}
private static String bufferToHex(byte bytes[], int m, int n) {
StringBuffer stringbuffer = new StringBuffer(2 * n);
int k = m + n;
for (int l = m; l < k; l++) {
appendHexPair(bytes[l], stringbuffer);
}
return stringbuffer.toString();
}
private static void appendHexPair(byte bt, StringBuffer stringbuffer) {
char c0 = hexDigits[(bt & 0xf0) >> 4];
char c1 = hexDigits[bt & 0xf];
stringbuffer.append(c0);
stringbuffer.append(c1);
}
}
......@@ -15,6 +15,8 @@ import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import com.alibaba.fastjson.JSON;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Consts;
......@@ -38,6 +40,8 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 依赖的jar包有:commons-lang-2.6.jar、httpclient-4.3.2.jar、httpcore-4.3.1.jar、commons-io-2.4.jar
......@@ -50,6 +54,7 @@ public class HttpUtil {
public static final int readTimeout=10000;
public static final String charset="UTF-8";
private static HttpClient client = null;
private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
static {
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
......@@ -140,6 +145,7 @@ public class HttpUtil {
public static String post(String url,Map<String, String> headers, String mimeType,String charset, Integer connTimeout, Integer readTimeout)
throws ConnectTimeoutException, SocketTimeoutException, Exception {
logger.info("Http post: url: {}, header: {}", url, JSON.toJSONString(headers == null ? MapUtils.EMPTY_MAP : headers));
HttpClient client = null;
HttpPost post = new HttpPost(url);
String result = "";
......
......@@ -73,7 +73,24 @@ public final class Constant {
public static final String APPROVAL_DISAGREED="disagreed";
public static final String ASSIGNEE_MANAGER="manager";
public static final String ASSIGNEE_TAX_BP="tax_bp";
public static final String ASSIGNEE_COMPLIANCE_IA="compliance_ia";
public static final String ASSIGNEE_COMPLIANCE_CHIEF ="compliance_chief";
public static final String ASSIGNEE_ACCOUNTANT="accountant";
//中文角色名
public static final String ROLE_ACCOUNTANT="会计";
public static final String ROLE_COMPLIANCE_CHIEF="合规负责人";
public static final String ROLE_TAX_BP="税务BP";
public static final String ROLE_COMPLIANCE_IA="合规IA";
public static final String[] APPROVAL_ROLEAll={
ROLE_ACCOUNTANT,
ROLE_COMPLIANCE_CHIEF,
ROLE_TAX_BP,
ROLE_COMPLIANCE_IA};
public static final String[] APPROVAL_ROLE2={
ROLE_TAX_BP,
ROLE_COMPLIANCE_IA};
public static class DataSourceName {
public static final String KeyValueDataSource = "KeyValueDataSource";
......
......@@ -53,9 +53,9 @@ public class ApprovalController {
}
@ResponseBody
@RequestMapping(value = "/tasks/{assignee}")
public List<ApprovalTaskInfo> data(@PathVariable String assignee) {//accountant manager
return approvalService.getTask();
@RequestMapping(value = "/tasks/{assignee}/{year}/{month}")
public List<ApprovalTaskInfo> data(@PathVariable String assignee,@PathVariable Integer year,@PathVariable Integer month) {//accountant manager
return approvalService.getTask(year,month);
}
@ResponseBody
......@@ -65,11 +65,18 @@ public class ApprovalController {
}
// @ApiOperation(value = "审批报表")
/**
* 同机构的不同角色不会有相同的用户
* @param projectId
* @param period
* @param decide
* @param comment
*/
@ResponseBody
@RequestMapping(value = "/check/{projectId}/{period}",method = RequestMethod.PUT)
@Secured("vatApproval:check")
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);
approvalService.checkTask(projectId, period, decide,comment,"");
}
@ResponseBody
......
package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
......@@ -223,7 +224,7 @@ public class EbsApiController {
*/
@RequestMapping(value = "/callback", method = RequestMethod.POST)
public ApiResultDto callback(@RequestBody EbsCallBackDto callBackDto) {
logger.info("EBS callback 调用,taskId :{}",callBackDto.getTaskId());
logger.info("EBS callback 调用,taskId :{}", JSON.toJSONString(callBackDto));
ApiResultDto apiResultDto = new ApiResultDto();
try{
ebsApiService.changeCallBackStatus(callBackDto);
......
......@@ -8,6 +8,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.util.FileUploadUtil;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
......@@ -18,11 +19,12 @@ import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.service.impl.DataImportService;
import pwc.taxtech.atms.service.impl.ReportUploadService;
import pwc.taxtech.atms.vat.dao.PwcReportAttachMapper;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
......@@ -160,7 +162,7 @@ public class ReportController {
return operationResultDto;
}
@Autowired
@Resource
private ProjectMapper projectMapper;
private String getProjId(String orgId, Integer tmsPeriod) {
......@@ -173,22 +175,6 @@ public class ReportController {
return "";
}
public static void main(String[] args) {
System.out.println(201833 % 100);
}
private DataImportService dataImportService;
@RequestMapping(value = "saveAndRefresh", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<EbitDataDto> saveAndRefresh(@RequestParam(value ="orgId") String orgId, @RequestParam(value ="period") Integer period, @RequestParam(value = "specialConsiderations", defaultValue = "0") Integer specialConsiderations, @RequestParam(value = "ebitRate", defaultValue = "1") String ebitRate) {
OperationResultDto operationResultDto = new OperationResultDto();
operationResultDto.setData(reportService.loadEbitData(orgId, period, specialConsiderations, ebitRate));
reportService.saveDatasource(orgId, period, specialConsiderations, ebitRate, operationResultDto);
return operationResultDto;
}
@RequestMapping(value = "report/{templateId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<ReportDto> getReportByTemplate(@PathVariable Long templateId, @PathVariable Integer period, @RequestHeader String from) {
OperationResultDto resultDto = new OperationResultDto();
......@@ -288,7 +274,22 @@ public class ReportController {
return reportService.deleteAttach(id);
}
@Autowired
@Resource
private PwcReportAttachMapper pwcReportAttachMapper;
@RequestMapping("")
public OperationResultDto downLoadAttach(Long id){
OperationResultDto operationResultDto = new OperationResultDto();
PwcReportAttachExample example = new PwcReportAttachExample();
PwcReportAttachExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(id);
if(FileUploadUtil.downLoad(pwcReportAttachMapper.selectByExample(example).get(0).getFileUrl()) == true){
return operationResultDto.success();
};
operationResultDto.setResultMsg("附件导出失败");
return operationResultDto;
}
@Resource
private OrganizationMapper organizationMapper;
@RequestMapping("getOrgLists")
......@@ -318,6 +319,16 @@ public class ReportController {
}
@RequestMapping(value = "saveAndRefresh", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<EbitDataDto> saveAndRefresh(@RequestParam(value ="orgId") String orgId, @RequestParam(value ="period") Integer period, @RequestParam(value = "specialConsiderations", defaultValue = "0") Integer specialConsiderations, @RequestParam(value = "ebitRate", defaultValue = "1") String ebitRate) {
OperationResultDto operationResultDto = new OperationResultDto();
operationResultDto.setData(reportService.loadEbitData(orgId, period, specialConsiderations, ebitRate));
reportService.saveDatasource(orgId, period, specialConsiderations, ebitRate, operationResultDto);
return operationResultDto;
}
/**
*批量导出利润表
*/
......@@ -327,5 +338,19 @@ public class ReportController {
operationResultDto.setResult(null);
return operationResultDto;
}
/**
* 将spread序列化字符串保存到数据库
*/
@RequestMapping("spreadToDb")
public OperationResultDto spreadToDb(@RequestBody RequestParameterDto.EbitParam ebitParam){
OperationResultDto operationResultDto = new OperationResultDto();
try{
reportService.spreadToDb(ebitParam);
return operationResultDto.success();
}catch (Exception e){
e.printStackTrace();
return operationResultDto.error();
}
}
}
\ No newline at end of file
......@@ -43,6 +43,7 @@ public class OperationResultDto<T> extends OperationResultBase {
return new OperationResultDto<>(true);
}
public static OperationResultDto<?> success(Object data) {
OperationResultDto dto = new OperationResultDto();
dto.setData(data);
......
package pwc.taxtech.atms.dto;
/**
* @ClassName RequestParameterBaseDto
* Description TODO
* @Author pwc kevin
* @Date 3/30/2019 3:00 PM
* Version 1.0
**/
public class RequestParameterBaseDto {
public String orgId;
public Integer period;
public String templateId;
public String projectId;
public String reportId;
}
......@@ -10,12 +10,38 @@ import java.io.Serializable;
* Version 1.0
* 请求参数封装
**/
public class RequestParameterDto implements Serializable {
private String reportId;
private String orgId;
private Integer period;
private String templateId;
private String projectId;
public class RequestParameterDto extends RequestParameterBaseDto implements Serializable {
public class EbitParam extends RequestParameterDto{
private String jsonString;//excel传过来的数据 已经被序列化成字符串了
private Integer specialConsiderations;
private String ebitRate;
public String getEbitRate() {
return ebitRate;
}
public void setEbitRate(String ebitRate) {
this.ebitRate = ebitRate;
}
public Integer getSpecialConsiderations() {
return specialConsiderations;
}
public void setSpecialConsiderations(Integer specialConsiderations) {
this.specialConsiderations = specialConsiderations;
}
public String getJsonString() {
return jsonString;
}
public void setJsonString(String jsonString) {
this.jsonString = jsonString;
}
}
public String getReportId() {
return reportId;
......
......@@ -60,6 +60,8 @@ public class CellDataDto {
private Boolean isConfigured;
private String validationResult;
public String getCellId() {
return this.cellId;
}
......@@ -259,4 +261,12 @@ public class CellDataDto {
public void setIsConfigured(Boolean configured) {
this.isConfigured = configured;
}
public String getValidationResult() {
return validationResult;
}
public void setValidationResult(String validationResult) {
this.validationResult = validationResult;
}
}
......@@ -9,8 +9,10 @@ import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -25,7 +27,9 @@ import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.*;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.CitAssetsListDto;
import pwc.taxtech.atms.dto.CitDistributionDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.export.ExportDto;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.*;
......@@ -35,6 +39,7 @@ import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
import pwc.taxtech.atms.vat.dpo.DataSourceExtendDto;
import pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto;
import pwc.taxtech.atms.vat.dpo.PeriodCellTemplateConfigDto;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.ReportGeneratorImpl;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper;
......@@ -219,6 +224,60 @@ public class CitReportServiceImpl extends BaseService {
periodJobMapper.updateByPrimaryKey(genJob);
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
//===============================================start validation compute==========================================================
//todo: 1.get the data from workbook, then put the data into new workbook
Workbook workbook4Validate = reportGenerator.createWorkBookByPeriodTemplate(resources.getPeriodTemplates(), genJob);
copyDataToWorkbook4Validate(workbook, workbook4Validate);
//todo: 2.get the validate formula in the cell_template_config
List<PeriodCellTemplateConfig> periodCellTemplateConfigs = resources.getPeriodCellTemplateConfigs().stream()
.filter(a -> a.getDataSourceType().equals(CellDataSourceType.Validation.getCode())).collect(Collectors.toList());
List<PeriodCellTemplateConfigDto> periodCellTemplateConfigDtos = new ArrayList<>();
periodCellTemplateConfigs.forEach(a -> {
if (StringUtils.isNotBlank(a.getValidation())) {
Optional<Template> template = templates.stream().filter(t -> t.getId().equals(a.getReportTemplateId())).findFirst();
String templateCode = template.isPresent() ? template.get().getCode() : "";
Integer sheetNumber = template.isPresent() ? template.get().getOrderIndex() : null;
Optional<PeriodCellTemplate> periodCellTemplate = resources.getPeriodCellTemplates().stream().filter(c -> c.getCellTemplateId().equals(a.getCellTemplateId())).findFirst();
Integer rowNumber = periodCellTemplate.isPresent() ? periodCellTemplate.get().getRowIndex() : null;
Integer colNumber = periodCellTemplate.isPresent() ? periodCellTemplate.get().getColumnIndex() : null;
if (StringUtils.isNotBlank(templateCode) && rowNumber != null && colNumber != null) {
String replaceFormula = String.format("BB(\"%s\",%d,%d,0,0)", templateCode, colNumber, rowNumber);
a.setParsedValidation(a.getValidation().replace("aa()", replaceFormula));
PeriodCellTemplateConfigDto periodCellTemplateConfigDto = new PeriodCellTemplateConfigDto();
periodCellTemplateConfigDto.setSheetNumber(sheetNumber);
periodCellTemplateConfigDto.setRowNumber(rowNumber);
periodCellTemplateConfigDto.setColNumber(colNumber);
periodCellTemplateConfigDto.setValidation(a.getValidation());
periodCellTemplateConfigDto.setParsedValidation(a.getParsedValidation());
periodCellTemplateConfigDto.setCellTemplateId(periodCellTemplate.get().getCellTemplateId());
periodCellTemplateConfigDto.setProjectId(projectId);
periodCellTemplateConfigDto.setPeriodParam(periodParam);
periodCellTemplateConfigDtos.add(periodCellTemplateConfigDto);
}
}
});
//todo: 3.use the validate formula to recalculate the new workbook
periodCellTemplateConfigDtos.forEach(a -> {
workbook4Validate.getSheetAt(a.getSheetNumber() - 1).getRow(a.getRowNumber()).getCell(a.getColNumber()).setCellFormula(a.getParsedValidation());
});
reportGenerator.addFunctionsAndContext(workbook4Validate, functions, reportGenerator.initContext(resources, periodParam));
FormulaEvaluator validateEvaluator = workbook4Validate.getCreationHelper().createFormulaEvaluator();
validateEvaluator.evaluateAll();
//todo: 4.then save the validation result to cellData table
periodCellTemplateConfigDtos.forEach(a -> {
//todo: according to periodParam , projectId, cellTemplateId to update the cellData table
PeriodCellDataExample periodCellDataExample = new PeriodCellDataExample();
periodCellDataExample.createCriteria().andCellTemplateIdEqualTo(a.getCellTemplateId()).andProjectIdEqualTo(a.getProjectId()).andPeriodEqualTo(a.getPeriodParam());
Optional<PeriodCellData> cellData = periodCellDataMapper.selectByExample(periodCellDataExample).stream().findFirst();
if (cellData.isPresent()) {
cellData.get().setValidateFormulaExp(a.getParsedValidation());
Boolean result = workbook4Validate.getSheetAt(a.getSheetNumber() - 1).getRow(a.getRowNumber()).getCell(a.getColNumber()).getBooleanCellValue();
cellData.get().setValidateResult(result.toString());
periodCellDataMapper.updateByPrimaryKey(cellData.get());
}
});
//===============================================end validation compute==============================================================
setStatus(genJob, STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
} catch (Exception e) {
......@@ -239,6 +298,42 @@ public class CitReportServiceImpl extends BaseService {
return operationResultDto;
}
private void copyDataToWorkbook4Validate(Workbook workbook, Workbook workbook4Validate) {
int sheetNumber = workbook.getNumberOfSheets();
for (int i = 0; i < sheetNumber; i++) {
Sheet sheet = workbook.getSheetAt(i);
for (Row row : sheet) {
for (Cell cell : row) {
String data;
String result;
data = ((XSSFCell) cell).getRawValue();
if (data != null && data.equals("#VALUE!")) {
FormulaEvaluator formulaEvaluator = new XSSFFormulaEvaluator((XSSFWorkbook) workbook);
try {
data = formulaEvaluator.evaluate(cell).getStringValue();
} catch (Exception e) {
logger.error(e.getStackTrace().toString());
data = "0.0";
}
}
if (StringUtils.isNotBlank(data)) {
Pattern pattern = Pattern.compile("[0-9.]*");
Matcher isNum = pattern.matcher(data);
if (isNum.matches()) {
result = new BigDecimal(data).toString();
} else {
result = data;
}
} else {
result = data;
}
workbook4Validate.getSheetAt(i).getRow(row.getRowNum()).getCell(cell.getColumnIndex()).setCellValue(result);
}
}
}
}
/**
* 根据projectId(卡片ID)获取模板
*
......
......@@ -2043,13 +2043,12 @@ public class DataImportService extends BaseService {
log.setFileType(EnumEbsExtractType.getNameByCode(type));
log.setPeriodStatus("EBS抽取");
log.setOperator(operator);
log.setId(idService.nextId());
try {
if (StringUtils.isEmpty(org.getEnterpriseAccountCode())) {
log.setId(idService.nextId());
log.setImportResult(false);
log.setErrorMsg(String.format(EnumApiCodeMsg.CALLFAILED.getMsg(), ErrorMessageCN.NoLedgerID));
}else if(StringUtils.isEmpty(org.getCode())) {
log.setId(idService.nextId());
log.setImportResult(false);
log.setErrorMsg(String.format(EnumApiCodeMsg.CALLFAILED.getMsg(), ErrorMessageCN.NoCompanyCode));
}
......@@ -2101,11 +2100,11 @@ public class DataImportService extends BaseService {
default:
break;
}
logger.info("EBS response: " + response);
if (StringUtils.isNotEmpty(response)) {
EbsCallResp resp = JSON.parseObject(response, EbsCallResp.class);
long taskId = Long.valueOf(resp.getTaskId());
if (taskId == -1) {
log.setId(idService.nextId());
log.setImportResult(false);
log.setErrorMsg(String.format(EnumApiCodeMsg.CALLFAILED.getMsg(), resp.getTaskDesc()));
} else {
......@@ -2119,11 +2118,10 @@ public class DataImportService extends BaseService {
}
dataImportLogMapper.insertSelective(log);
} catch (Exception e) {
log.setId(idService.nextId());
logger.error(String.format(EnumApiCodeMsg.CALLFAILED.getMsg(), e.getMessage()), e);
log.setImportResult(false);
log.setErrorMsg(String.format(EnumApiCodeMsg.CALLFAILED.getMsg(), e.getMessage()));
dataImportLogMapper.insertSelective(log);
logger.error(String.format(EnumApiCodeMsg.CALLFAILED.getMsg(), e.getMessage()), e);
}
return 1;
}
......
......@@ -255,7 +255,7 @@ public class EbsApiServiceImpl implements EbsApiService {
JournalEntryExample journalEntryExample = new JournalEntryExample();
item.setTaskId(String.valueOf(id));
//日记账头ID和日记账行号
journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum()).andTaskIdNotEqualTo(item.getTaskId());
journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum()).andSourceEqualTo(item.getSource());
List<JournalEntry> journalEntryList = journalEntryMapper.selectByExample(journalEntryExample);
//唯一则更新否则插入
JournalEntry journalEntry = new JournalEntry();
......
......@@ -52,7 +52,7 @@ public class HttpFileService extends BaseService {
CloseableHttpClient httpClient = null;
String filePath = USER_TEMPLATE_PATH + fileName;
try {
String serverPath = config.getServerUrl() + config.getUploadUrl();
String serverPath = config.getUploadUrl();
httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(serverPath);
httpPost.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
......@@ -68,7 +68,7 @@ public class HttpFileService extends BaseService {
ApiResultDto resultDto = JSON.parseObject(IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8"), ApiResultDto.class);
if (resultDto.getCode() == ApiResultDto.SUCCESS) {
if(fullPath){
return config.getServerUrl() + "/" + filePath;
return config.getUploadUrl() + "/" + filePath;
}
return filePath;
}
......@@ -101,14 +101,14 @@ public class HttpFileService extends BaseService {
if (StringUtils.isBlank(filePath)) {
return null;
}
if (StringUtils.isNotBlank(config.getServerUrl())) {
if (StringUtils.isNotBlank(config.getDownloadUrl())) {
CloseableHttpClient client = HttpClients.createDefault();
//先判断下是否是全域名 全域名代表是didi服务器url
String url;
if(filePath.indexOf("http")>=0){
url = filePath;
}else{
url = StringUtils.appendIfMissing(config.getServerUrl(), "/") + filePath;
url = StringUtils.appendIfMissing(config.getDownloadUrl(), "/") + filePath;
}
HttpGet httpGet = new HttpGet(url);
CloseableHttpResponse response = null;
......
......@@ -238,8 +238,14 @@ public class TemplateGroupServiceImpl extends AbstractService {
ebitCellData.setRow(m);
ebitCellData.setCreateTime(now);
try {
if(sheet.getRow(m).getCell(j) != null)
ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue());
if(sheet.getRow(m).getCell(j) != null){
if(CellType.STRING == sheet.getRow(m).getCell(j).getCellTypeEnum()){
ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue());
}else if (CellType.NUMERIC == sheet.getRow(m).getCell(j).getCellTypeEnum()){
ebitCellData.setData(String.valueOf(sheet.getRow(m).getCell(j).getNumericCellValue()));
}
}
}catch (Exception e){
//遇到空行,略过
}
......
......@@ -1067,7 +1067,5 @@ public class UserServiceImpl extends AbstractService {
logger.error(String.format("导出用户信息异常:%s",e.getMessage()));
}
return null;
}
}
......@@ -314,7 +314,7 @@ public class ReportGeneratorImpl {
cellDataSource.setPeriod(period);
cellDataSource.setProjectId(projectId);
SpringContextUtil.periodCellDataSourceMapper.insertSelective(cellDataSource);
periodCellDataMapper.insert(cellData);
periodCellDataMapper.insertSelective(cellData);
} else {
logger.warn("should not be !!!");
}
......
This diff is collapsed.
package pwc.taxtech.atms.service.impl;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import pwc.taxtech.atms.CommonIT;
import pwc.taxtech.atms.dto.approval.ApprovalDto;
import pwc.taxtech.atms.vat.service.impl.ApprovalService;
public class BpmTest extends CommonIT {
private static final Logger logger = LoggerFactory.getLogger(BpmTest.class);
@Autowired
RuntimeService runtimeService;
@Autowired
TaskService taskService;
@Autowired
ApprovalService approvalService;
@Test
public void testStart(){
ApprovalDto dto=new ApprovalDto();
dto.setProjectId("220c976c-f527-4abe-ad4a-3c2f863854c8");
dto.setPeriodDate("2019.2");
approvalService.startInstanceAndAssignee(dto);
// approvalService.checkTask("220c976c-f527-4abe-ad4a-3c2f863854c8",2,"agreed","aaa", Constant.ROLE_COMPLIANCE_CHIEF);
// approvalService.checkTask("220c976c-f527-4abe-ad4a-3c2f863854c8",2,"agreed","aaa", Constant.ROLE_TAX_BP);
// approvalService.checkTask("220c976c-f527-4abe-ad4a-3c2f863854c8",2,"agreed","aaa", Constant.ROLE_COMPLIANCE_IA);
}
@Test
public void testApproval(){
ApprovalDto dto=new ApprovalDto();
dto.setProjectId("220c976c-f527-4abe-ad4a-3c2f863854c8");
dto.setPeriodDate("2019.2");
// approvalService.checkTask("220c976c-f527-4abe-ad4a-3c2f863854c8",2,"disagreed","aaa", Constant.ROLE_COMPLIANCE_IA);
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -40,10 +40,11 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="pwc.taxtech.atms.vat.dao" targetProject="../../src/main/java">
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<!--<table tableName="ebit_cell_data" domainObjectName="EbitCellData">-->
<!--<property name="useActualColumnNames" value="false"/>-->
<!--<property name="ignoreQualifiersAtRuntime" value="true"/>-->
<!--</table>-->
<table tableName="ebit_spread_data" domainObjectName="EbitSpreadData">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--
......
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.EbitSpreadData;
import pwc.taxtech.atms.vat.entity.EbitSpreadDataExample;
@Mapper
public interface EbitSpreadDataMapper extends MyVatMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
long countByExample(EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int deleteByExample(EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int insert(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int insertSelective(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
List<EbitSpreadData> selectByExampleWithBLOBsWithRowbounds(EbitSpreadDataExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
List<EbitSpreadData> selectByExampleWithBLOBs(EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
List<EbitSpreadData> selectByExampleWithRowbounds(EbitSpreadDataExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
List<EbitSpreadData> selectByExample(EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
EbitSpreadData selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") EbitSpreadData record, @Param("example") EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByExampleWithBLOBs(@Param("record") EbitSpreadData record, @Param("example") EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByExample(@Param("record") EbitSpreadData record, @Param("example") EbitSpreadDataExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(EbitSpreadData record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table ebit_spread_data
*
* @mbg.generated
*/
int updateByPrimaryKey(EbitSpreadData record);
}
\ 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.annotations.Select;
......@@ -10,6 +9,8 @@ import pwc.taxtech.atms.vat.dpo.ApprovalTaskInfo;
import pwc.taxtech.atms.vat.entity.PeriodApprove;
import pwc.taxtech.atms.vat.entity.PeriodApproveExample;
import java.util.List;
@Mapper
public interface PeriodApproveMapper extends MyVatMapper {
/**
......@@ -129,8 +130,11 @@ 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=\"year != 0\"> AND pa.YEAR = #{year,jdbcType=DECIMAL} </if>" +
"<if test=\"month != 0\"> AND pa.PERIOD = #{month,jdbcType=DECIMAL} </if>" +
" order by pa.create_time desc "+
"</script>")
List<ApprovalTaskInfo> queryApprovalList();
List<ApprovalTaskInfo> queryApprovalList(@Param("year") Integer year, @Param("month") Integer month);
@Select("" +
"SELECT " +
......@@ -142,7 +146,7 @@ public interface PeriodApproveMapper extends MyVatMapper {
String getStatusByProjectIdAndPeriod(@Param("projectId") String projectId, @Param("period") Integer period);
@Select("" +
"SELECT " +
"SELECT p.id AS id ," +
" p.instance_id AS instanceId ,p.status AS status " +
"FROM " +
" ( SELECT * FROM period_approve WHERE project_id = #{projectId} AND period = #{period} ORDER BY create_time DESC ) p " +
......
package pwc.taxtech.atms.vat.dpo;
import java.sql.Date;
import java.util.List;
public class ApprovalTaskInfo {
private String organizationId;
......@@ -17,6 +18,16 @@ public class ApprovalTaskInfo {
private String reportPaths;
private String reportIds;
private String templateIds;
//详细流程
private List<ApprovalTaskNodeInfo> items;
public List<ApprovalTaskNodeInfo> getItems() {
return items;
}
public void setItems(List<ApprovalTaskNodeInfo> items) {
this.items = items;
}
public String getProjectName() {
return projectName;
......
package pwc.taxtech.atms.vat.dpo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class ApprovalTaskNodeInfo {
private String userId;
private String userName;
private String comment;
@JsonFormat(pattern="yyyy-MM-dd HH:ss:mm",timezone="GMT+8")
private Date startTime;
private String role;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
@Override
public String toString() {
return "ApprovalTaskNodeInfo{" +
"userId='" + userId + '\'' +
", userName='" + userName + '\'' +
", comment='" + comment + '\'' +
", startTime=" + startTime +
", role='" + role + '\'' +
'}';
}
}
package pwc.taxtech.atms.vat.dpo;
public class PeriodCellTemplateConfigDto {
private String validation;
private String parsedValidation;
private Integer sheetNumber;
private Integer rowNumber;
private Integer colNumber;
private Long cellTemplateId;
private String projectId;
private Integer periodParam;
public String getValidation() {
return validation;
}
public void setValidation(String validation) {
this.validation = validation;
}
public String getParsedValidation() {
return parsedValidation;
}
public void setParsedValidation(String parsedValidation) {
this.parsedValidation = parsedValidation;
}
public Integer getSheetNumber() {
return sheetNumber;
}
public void setSheetNumber(Integer sheetNumber) {
this.sheetNumber = sheetNumber;
}
public Integer getRowNumber() {
return rowNumber;
}
public void setRowNumber(Integer rowNumber) {
this.rowNumber = rowNumber;
}
public Integer getColNumber() {
return colNumber;
}
public void setColNumber(Integer colNumber) {
this.colNumber = colNumber;
}
public Long getCellTemplateId() {
return cellTemplateId;
}
public void setCellTemplateId(Long cellTemplateId) {
this.cellTemplateId = cellTemplateId;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public Integer getPeriodParam() {
return periodParam;
}
public void setPeriodParam(Integer periodParam) {
this.periodParam = periodParam;
}
}
package pwc.taxtech.atms.vat.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
import java.util.Date;
import pwc.taxtech.atms.entity.BaseEntity;
/**
*
......
......@@ -92,7 +92,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
ID, PROJECT_ID, PERIOD, REPORT_IDS, REPORT_PATHS, "STATUS", INSTANCE_ID, "YEAR",
ID, PROJECT_ID, PERIOD, REPORT_IDS, REPORT_PATHS, STATUS, INSTANCE_ID, YEAR,
TEMPLATE_IDS, CREATE_BY, CREATE_TIME, APPROVAL_BY, APPROVAL_TIME, APPROVAL_RESUALT
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodApproveExample" resultMap="BaseResultMap">
......@@ -105,7 +105,7 @@
distinct
</if>
<include refid="Base_Column_List" />
from PERIOD_APPROVE
from period_approve
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
......@@ -120,7 +120,7 @@
-->
select
<include refid="Base_Column_List" />
from PERIOD_APPROVE
from period_approve
where ID = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
......@@ -128,7 +128,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from PERIOD_APPROVE
delete from period_approve
where ID = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="pwc.taxtech.atms.vat.entity.PeriodApproveExample">
......@@ -136,7 +136,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from PERIOD_APPROVE
delete from period_approve
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
......@@ -146,9 +146,9 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into PERIOD_APPROVE (ID, PROJECT_ID, PERIOD,
REPORT_IDS, REPORT_PATHS, "STATUS",
INSTANCE_ID, "YEAR", TEMPLATE_IDS,
insert into period_approve (ID, PROJECT_ID, PERIOD,
REPORT_IDS, REPORT_PATHS, STATUS,
INSTANCE_ID, YEAR, TEMPLATE_IDS,
CREATE_BY, CREATE_TIME, APPROVAL_BY,
APPROVAL_TIME, APPROVAL_RESUALT)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{period,jdbcType=DECIMAL},
......@@ -162,7 +162,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into PERIOD_APPROVE
insert into period_approve
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
......@@ -180,13 +180,13 @@
REPORT_PATHS,
</if>
<if test="status != null">
"STATUS",
STATUS,
</if>
<if test="instanceId != null">
INSTANCE_ID,
</if>
<if test="year != null">
"YEAR",
YEAR,
</if>
<if test="templateIds != null">
TEMPLATE_IDS,
......@@ -257,7 +257,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from PERIOD_APPROVE
select count(*) from period_approve
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
......@@ -267,7 +267,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update PERIOD_APPROVE
update period_approve
<set>
<if test="record.id != null">
ID = #{record.id,jdbcType=VARCHAR},
......@@ -285,13 +285,13 @@
REPORT_PATHS = #{record.reportPaths,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
"STATUS" = #{record.status,jdbcType=VARCHAR},
STATUS = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.instanceId != null">
INSTANCE_ID = #{record.instanceId,jdbcType=VARCHAR},
</if>
<if test="record.year != null">
"YEAR" = #{record.year,jdbcType=DECIMAL},
YEAR = #{record.year,jdbcType=DECIMAL},
</if>
<if test="record.templateIds != null">
TEMPLATE_IDS = #{record.templateIds,jdbcType=VARCHAR},
......@@ -321,15 +321,15 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update PERIOD_APPROVE
update period_approve
set ID = #{record.id,jdbcType=VARCHAR},
PROJECT_ID = #{record.projectId,jdbcType=VARCHAR},
PERIOD = #{record.period,jdbcType=DECIMAL},
REPORT_IDS = #{record.reportIds,jdbcType=VARCHAR},
REPORT_PATHS = #{record.reportPaths,jdbcType=VARCHAR},
"STATUS" = #{record.status,jdbcType=VARCHAR},
STATUS = #{record.status,jdbcType=VARCHAR},
INSTANCE_ID = #{record.instanceId,jdbcType=VARCHAR},
"YEAR" = #{record.year,jdbcType=DECIMAL},
YEAR = #{record.year,jdbcType=DECIMAL},
TEMPLATE_IDS = #{record.templateIds,jdbcType=VARCHAR},
CREATE_BY = #{record.createBy,jdbcType=VARCHAR},
CREATE_TIME = #{record.createTime,jdbcType=TIMESTAMP},
......@@ -345,7 +345,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update PERIOD_APPROVE
update period_approve
<set>
<if test="projectId != null">
PROJECT_ID = #{projectId,jdbcType=VARCHAR},
......@@ -360,13 +360,13 @@
REPORT_PATHS = #{reportPaths,jdbcType=VARCHAR},
</if>
<if test="status != null">
"STATUS" = #{status,jdbcType=VARCHAR},
STATUS = #{status,jdbcType=VARCHAR},
</if>
<if test="instanceId != null">
INSTANCE_ID = #{instanceId,jdbcType=VARCHAR},
</if>
<if test="year != null">
"YEAR" = #{year,jdbcType=DECIMAL},
YEAR = #{year,jdbcType=DECIMAL},
</if>
<if test="templateIds != null">
TEMPLATE_IDS = #{templateIds,jdbcType=VARCHAR},
......@@ -394,14 +394,14 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update PERIOD_APPROVE
update period_approve
set PROJECT_ID = #{projectId,jdbcType=VARCHAR},
PERIOD = #{period,jdbcType=DECIMAL},
REPORT_IDS = #{reportIds,jdbcType=VARCHAR},
REPORT_PATHS = #{reportPaths,jdbcType=VARCHAR},
"STATUS" = #{status,jdbcType=VARCHAR},
STATUS = #{status,jdbcType=VARCHAR},
INSTANCE_ID = #{instanceId,jdbcType=VARCHAR},
"YEAR" = #{year,jdbcType=DECIMAL},
YEAR = #{year,jdbcType=DECIMAL},
TEMPLATE_IDS = #{templateIds,jdbcType=VARCHAR},
CREATE_BY = #{createBy,jdbcType=VARCHAR},
CREATE_TIME = #{createTime,jdbcType=TIMESTAMP},
......@@ -420,7 +420,7 @@
distinct
</if>
<include refid="Base_Column_List" />
from PERIOD_APPROVE
from period_approve
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
......
......@@ -850,6 +850,20 @@
"TBEBITForm":"TB EBIT Form",
"ClickEnsureTip": "Click Ensure Button!",
"ApproveCommitted":"Committed",
"ApproveAgreed":"Agreed",
"ApproveDisAgreed":"Disagreed",
"ApproveProjectName":"Project Name",
"ApprovePeriod":"Period",
"ApproveCommiteUser":"Commite User",
"ApproveUser":"Approve User",
"ApproveStatus":"Status",
"ApproveComment":"Approve Comment",
"ApproveStratTime":"Strat Time",
"ApproveEndTime":"Approved Time",
"ApproveTaskList":"Approve Task List",
"ApproveRole":"Approve Role",
"ConditionColumnNum": "Search Condition Column Num",
"Condition": "Search Condition",
"RevenueTypeConfiguration":"Revenue Type Config"
......
......@@ -905,7 +905,19 @@
"MenuBrazilianTax": "巴西税务分析",
"MenuOtherCountries": "其他国家税务分析",
"ApproveCommitted":"审核中",
"ApproveAgreed":"通过",
"ApproveDisAgreed":"驳回",
"ApproveProjectName":"项目名称",
"ApprovePeriod":"期间",
"ApproveCommiteUser":"提审人",
"ApproveUser":"审批人",
"ApproveStatus":"提审状态",
"ApproveComment":"审批意见",
"ApproveStratTime":"提审时间",
"ApproveEndTime":"审批时间",
"ApproveTaskList":"审批列表",
"ApproveRole":"审批角色",
"true": "是",
"false": "否",
......
analysisModule.controller('tableReportSheetController', ['$scope', '$rootScope', '$log', '$translate', '$timeout', '$q', '$compile', '$state', '$stateParams',
'apiInterceptor', 'vatExportService', 'SweetAlert', 'BSPLService', 'vatReportService', 'vatReportCacheService', 'vatSessionService',
'loginContext', 'enums', 'vatCommonService', 'vatWorkflowService', 'projectService', '$uibModal', '$cookies', 'Upload', 'vatImportService', 'vatApproveService','region',
'loginContext', 'enums', 'vatCommonService', 'vatWorkflowService', 'projectService', '$uibModal', '$cookies', 'Upload', 'vatImportService', 'vatApproveService','region','$http',
function ($scope, $rootScope, $log, $translate, $timeout, $q, $compile, $state, $stateParams, apiInterceptor, vatExportService, SweetAlert, BSPLService,
vatReportService, vatReportCacheService, vatSessionService, loginContext, enums, vatCommonService, vatWorkflowService, projectService,
$uibModal, $cookies, Upload, vatImportService, vatApproveService, region) {
$uibModal, $cookies, Upload, vatImportService, vatApproveService, region, $http) {
'use strict';
$log.debug('VatReportViewController.ctor()...');
......@@ -1100,7 +1100,7 @@
};
var getReportData = function (cb, period) {
vatReportService.getReportEbitData($scope.reportId, $scope.relation.orgId, $scope.relation.period == undefined ? period : $scope.relation.period ).success(function (reportData) {
vatReportService.getReportEbitData($scope.reportId, $scope.relation.orgId, period != undefined ? period : ($scope.relation.period == undefined ? period : $scope.relation.period) ).success(function (reportData) {
if (reportData && reportData.data && reportData.data.cellData) {
_.each(reportData.data.cellData, function (x) {
x.value = x.cellValue;
......@@ -2883,7 +2883,7 @@
var date = new Date();
var year = date.getFullYear();
var mon = date.getMonth()+ 1;
$scope.selectedDate = new Date(year, date.getMonth() + 1, 1);
$scope.selectedDate = new Date(year, date.getMonth() , 1);
$scope.startDate = new Date(year - 20, 1, 1);
$scope.endDate = new Date(year + 20, 1, 1);
var ele1 = $("#ebitDatepacker");
......@@ -2904,7 +2904,6 @@
//初始化
$scope.relation.period = year.toString() + monthRevert(mon);
loadCellData($scope.relation.period, $scope.relation.orgId, function(){
});
};
......@@ -2923,9 +2922,29 @@
if(res.data){
$scope.relation.data = res.data;
}
}).error(function(error){
});
}
var spreadTODb = function(){
//spread序列化参数
var serializationOption = {
ignoreFormula: false, // indicate to ignore the style when convert workbook to json, default value is false
ignoreStyle: false, // indicate to ignore the formula when convert workbook to json, default value is false
rowHeadersAsFrozenColumns: false, // indicate to treat the row headers as frozen columns when convert workbook to json, default value is false
columnHeadersAsFrozenRows: false // indicate to treat the column headers as frozen rows when convert workbook to json, default value is false
}
var jsonString = JSON.stringify($scope.spread.toJSON(serializationOption));
var obj = {
period : $scope.relation.period != undefined ? $scope.relation.period : null,
orgId : $scope.relation.orgId,
jsonString : jsonString
}
$http.post('/Report/spreadToDb', obj ,function(res){
if(!res.result)
SweetAlert.error("保存表单到数据库失败");
});
}
$scope.$watch('file', function (file) {
$scope.upload($scope.file);
......@@ -2953,7 +2972,6 @@
.progress(function (evt) {
})
.success(function (data, status, headers, config) {
debugger;
if(data.result){
frontImport(file);//前端导入
$('#busy-indicator-container').hide();
......@@ -2972,6 +2990,37 @@
SweetAlert.error(status + "上传失败")
})
};
//加载Ebit数据
$scope.relation.loadEbitCell = function (sheet) {
if(($scope.relation.data == null))
return;
for (var r = 37; r <= 43; r++) {
//sheet.setFormatter(r, 1, '# ??/??');//设置格式
if (r == 37) {
sheet.setValue(r, 1, PWC.tryParseStringToNum($scope.relation.data.ebitSubtraction != null ? $scope.relation.data.ebitSubtraction : ""));
}
if (r == 38) {
sheet.setValue(r, 1, PWC.tryParseStringToNum($scope.relation.data.specialConsiderations != null ? $scope.relation.data.specialConsiderations : ""));
}
if (r == 39) {
sheet.setValue(r, 1, PWC.tryParseStringToNum($scope.relation.data.specialFactors != null ? $scope.relation.data.specialFactors : ""));
}
if (r == 40) {
sheet.setValue(r, 1, PWC.tryParseStringToNum($scope.relation.data.ebitRate != null ? $scope.relation.data.ebitRate : ""));
}
if (r == 41) {
sheet.setValue(r, 1, PWC.tryParseStringToNum($scope.relation.data.transactionAmount != null ? $scope.relation.data.transactionAmount : ""));
}
if (r == 42) {
sheet.setValue(r, 1, PWC.tryParseStringToNum($scope.relation.data.sixAddTa != null ? $scope.relation.data.sixAddTa : ""));
}
if (r == 43) {
sheet.setValue(r, 1, PWC.tryParseStringToNum($scope.relation.data.totalAmountTax != null ? $scope.relation.data.totalAmountTax : ""));
}
sheet.setFormatter(r, 1, '# ?/?');
}
}
//前端导入
var frontImport = function(file){
......@@ -3001,7 +3050,7 @@
// here is excel IO API
excelIo.save(json, function (blob) {
saveAs(blob, fileName);
saveAs(blob, ($scope.relation.orgName != undefined ? $scope.relation.orgName : "" + $scope.relation.period) + fileName);
}, function (e) {
// process error
console.log(e);
......@@ -3054,15 +3103,14 @@
SweetAlert.error(error + "批量导出失败")
});
};
$scope.relation._orgId = null;
//机构下拉设置
$scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
width: '95%',
bindingOptions: {
value: 'relation.orgId',
value: 'relation._orgId',
dataSource: 'companyList'
},
height: '30px',
......@@ -3070,12 +3118,26 @@
showClearButton: true,
searchEnabled: true,
noDataText: $translate.instant('RevenueNoOrgData'),
showSelectionControls: false
showSelectionControls: false,
onInitialized : function(e){
},
onItemClick: function (e) {
loadCellData($scope.relation.period, e.itemData.id,function(){
$scope.relation.orgId = e.itemData.id;
$scope.relation.orgName = e.itemData.name;
});
}
};
$scope.$watch('relation._orgId', function(n, o){
if(n != undefined )
$scope.relation.orgId = n.pop();
});
var initCompanyList = function () {
orgService.getOrgListByUserId().success(function (data) {
vatReportService.getOrgLists().success(function (data) {
if (data) {
$scope.companyList = data;
$scope.companyList = data.data;
}
});
};
......
......@@ -4,13 +4,14 @@
<div class="col-sm-7" style=" margin-top: 20px;">
<div class="col-sm-6">
<span class="text-bold" translate="SelectedOrganization" style=" top: -11px; position: relative;">:</span>
<div id="dx-select-industry" class="tab-content-select industry " style=" display: inline-block;"
<!-- <div id="dx-select-industry" class="tab-content-select industry " style=" display: inline-block;"
dx-select-box="dataSourceIndustryList" dx-item-alias="itemObj">
<div data-options="dxTemplate: { name: 'orgList' }" class="dx-item-content dx-list-item-content"
title="{{itemObj.name}}-{{itemObj.name}}">
{{itemObj.code}}-{{itemObj.name}}
</div>
</div>
</div>-->
<div dx-tag-box="selectOrgOptions" style="width: 340px;display: inline-block"></div>
</div>
<div class="col-sm-6" class="dateClass">
<span class="text-bold" translate="InvoiceQJ">:</span>
......
......@@ -233,6 +233,8 @@ citModule.controller('citLayoutController', ['$scope', '$rootScope', '$location'
// });
// }
// else
// Data Preview
if (data[constant.citPermission.dataPreview.journalMerge.queryCode]) {
$scope.menus.push({
name: 'previewData', state: 'previewData', num: 2,
......@@ -307,6 +309,7 @@ citModule.controller('citLayoutController', ['$scope', '$rootScope', '$location'
});
}
// Data Manage
if (data[constant.citPermission.dataManage.caculateDataCode]) {
$scope.menus.push({
name: 'reductionData', state: 'reductionData', num: 3,
......@@ -319,18 +322,7 @@ citModule.controller('citLayoutController', ['$scope', '$rootScope', '$location'
permission: constant.citPermission.dataManage.caculateDataCode,
url: '#/cit/reductionData/caculateData'
});
} else if (data[constant.citPermission.dataManage.accountMappingCode]) {
$scope.menus.push({
name: 'reductionData', state: 'reductionData', num: 3,
permission: constant.citPermission.dataManage.dataManageCode, url: '#/cit/reductionData'
});
subMenus.push({
name: 'reductionData.accountMapping',
state: 'reductionData.accountMapping',
num: 3,
permission: constant.citPermission.dataManage.accountMappingCode,
url: '#/cit/reductionData/accountMapping'
});
} else if (data[constant.citPermission.dataManage.assetEamMapping]) {
$scope.menus.push({
name: 'reductionData', state: 'reductionData', num: 3,
......@@ -356,6 +348,20 @@ citModule.controller('citLayoutController', ['$scope', '$rootScope', '$location'
url: '#/cit/reductionData/distributionTable'
});
}
// } else if (data[constant.citPermission.dataManage.accountMappingCode]) {
// $scope.menus.push({
// name: 'reductionData', state: 'reductionData', num: 3,
// permission: constant.citPermission.dataManage.dataManageCode, url: '#/cit/reductionData'
// });
// subMenus.push({
// name: 'reductionData.accountMapping',
// state: 'reductionData.accountMapping',
// num: 3,
// permission: constant.citPermission.dataManage.accountMappingCode,
// url: '#/cit/reductionData/accountMapping'
// });
if (data[constant.citPermission.reportView.bsplCode]
|| data[constant.citPermission.reportView.quarterlyFilingReturnTypeCode]
......
......@@ -72,7 +72,7 @@ function ($scope, $q, $log, $translate, $location, loginContext, enums, vatSessi
else if ($location && $location.absUrl().indexOf('reductionData') > -1) {
$scope.nodeDicKey = constant.DictionaryDictKey.DataProcess;
$scope.linkShort = enums.linkShort.ReductionData;
debugger;
$scope.menus = [
{
name: 'caculateData', permission: constant.citPermission.dataManage.caculateDataCode,
......
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