Commit e75c9f24 authored by chase's avatar chase

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

parents 207adb55 88c65e7b
package pwc.taxtech.atms.common.schedule;
import com.alibaba.fastjson.JSONObject;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.quartz.QuartzJobBean;
import pwc.taxtech.atms.common.util.HttpUtil;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.RegionMapper;
import pwc.taxtech.atms.dto.organization.DDSyncOrgInfo;
import pwc.taxtech.atms.dto.organization.OrgSyncData;
import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.OrganizationExample;
import pwc.taxtech.atms.entity.Region;
import pwc.taxtech.atms.entity.RegionExample;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OrgSyncJob extends QuartzJobBean {
private static final Logger logger = LoggerFactory.getLogger(OrgSyncJob.class);
@Resource
private OrganizationMapper organizationMapper;
@Resource
private RegionMapper regionMapper;
@Autowired
private OrganizationMapper orgMapper;
@Value("${org_sync_url}")
private String orgSyncUrl;
@Value("${org_sync_token}")
private String token;
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
JobDataMap dataMap = jobExecutionContext.getJobDetail().getJobDataMap();
Map<String, String> headers = new HashMap<>();
headers.put("token", token);
headers.put("Content-Type", "application/x-www-form-urlencoded");
try {
// todo 这里要加分页查询的参数
String response = HttpUtil.get(orgSyncUrl, headers);
DDSyncOrgInfo ddSyncOrgInfo = JSONObject.parseObject(response, DDSyncOrgInfo.class);
List<OrgSyncData> orgSyncDatas = ddSyncOrgInfo.getData();
orgSyncDatas.forEach(osd -> {
OrganizationExample example = new OrganizationExample();
example.createCriteria().andNameEqualTo(osd.getNameCN());
Organization o = new Organization();
o.setClientCode(osd.getCode());
o.setCode(osd.getCode());
o.setEnterpriseAccountCode(String.valueOf(osd.getSobId()));
o.setEnterpriseAccountName(osd.getSobName());
o.setCurrencyCode(osd.getCurrencyCode());
o.setLegalEntity(osd.getLegalEntity());
o.setLegalPersonName(osd.getLegalRepresentative());
o.setAddress(osd.getAddress());
o.setCreateTime(osd.getGmtCreate());
o.setUpdateTime(osd.getGmtModified());
o.setPsCode(osd.getPsCode());
RegionExample regionExample = new RegionExample();
regionExample.createCriteria().andShortNameEqualTo(osd.getCompanyLocation());
List<Region> regions = regionMapper.selectByExample(regionExample);
if (regions.size() > 0) {
o.setRegionId(regions.get(0).getId());
}
organizationMapper.updateByExampleSelective(o, example);
});
} catch (Exception e) {
logger.error(String.format("机构信息同步异常:[%s]", e.getMessage()), e);
}
}
}
......@@ -76,12 +76,12 @@ public class HttpUtil {
return postForm(url, params, null, connTimeout, readTimeout);
}
public static String get(String url) throws Exception {
return get(url, charset, null, null);
public static String get(String url, Map<String, String> headers) throws Exception {
return get(url, headers, charset, null, null);
}
public static String get(String url, String charset) throws Exception {
return get(url, charset, connTimeout, readTimeout);
public static String get(String url, Map<String, String> headers, String charset) throws Exception {
return get(url, headers, charset, connTimeout, readTimeout);
}
/**
......@@ -216,7 +216,7 @@ public class HttpUtil {
* @throws SocketTimeoutException 响应超时
* @throws Exception
*/
public static String get(String url, String charset, Integer connTimeout,Integer readTimeout)
public static String get(String url,Map<String,String> headers, String charset, Integer connTimeout,Integer readTimeout)
throws ConnectTimeoutException,SocketTimeoutException, Exception {
HttpClient client = null;
......@@ -231,6 +231,9 @@ public class HttpUtil {
if (readTimeout != null) {
customReqConf.setSocketTimeout(readTimeout);
}
headers.forEach((k,v)->{
get.setHeader(k,v);
});
get.setConfig(customReqConf.build());
HttpResponse res = null;
......
package pwc.taxtech.atms.constant;
import java.io.File;
import java.util.UUID;
public final class CodeErrorConstant {
public static final int SUCCESS = 0;
public static final int APIERROR = -1;
public static final int APIDATAEMPTY = -2;
}
\ No newline at end of file
package pwc.taxtech.atms.constant;
public final class MsgErrorConstant {
public static final int SUCCESS = 0;
public static final int APIERROR = -1;
public static final int APIDATAEMPTY = -2;
}
\ No newline at end of file
package pwc.taxtech.atms.constant.enums;
public enum EnumErrorCodeMsg {
SUCCESS(0, "成功"),
APIERROR(-1, "接口异常"),
APIDATAEMPTY(-2, "接口输入数据为空");
private Integer code;
private String msg;
EnumErrorCodeMsg(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
public static EnumErrorCodeMsg fromCode(Integer code){
for(EnumErrorCodeMsg error: EnumErrorCodeMsg.values()){
if(error.getCode().intValue()==code.intValue())return error;
}
// 超出范围值默认返回异常
return EnumErrorCodeMsg.APIERROR;
}
public static String getMsg(Integer code){
for(EnumErrorCodeMsg error: EnumErrorCodeMsg.values()){
if(error.getCode().intValue()==code.intValue())return error.msg;
}
// 超出范围值默认返回异常
return EnumErrorCodeMsg.APIERROR.msg;
}
}
......@@ -39,26 +39,13 @@ public class CitDataPreviewController extends BaseController {
@RequestMapping(value = "exportJournalMergeData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportJournalMergeData(@RequestBody CitJournalAdjustDto paras, HttpServletResponse response) {
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name");
String fileName = paras.getPeriodStart() + "-" + paras.getPeriodEnd();
response.setCharacterEncoding("UTF-8");
OutputStream os = null;
try {
response.addHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.addHeader("x-file-name", fileName);
os = response.getOutputStream();
int count = citDataPreviewService.exportJournalMergeData(paras, os);
if (count == 0) {
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(SC_OK);
}
} catch (IOException e) {
logger.error(String.format("下载科目余额表-生成文件异常:%s",e.getMessage()));
int count = citDataPreviewService.exportJournalMergeData2(paras, response);
if (count == 0) {
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(SC_OK);
}
}
......@@ -70,25 +57,32 @@ public class CitDataPreviewController extends BaseController {
@RequestMapping(value = "exportTbGeneVerData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportTbGeneVerData(@RequestBody CitTrialBalanceDto paras, HttpServletResponse response) {
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name");
String fileName = paras.getPeriodStart() + "-" + paras.getPeriodEnd();
response.setCharacterEncoding("UTF-8");
OutputStream os = null;
try {
response.addHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.addHeader("x-file-name", fileName);
os = response.getOutputStream();
int count = citDataPreviewService.exportTbGeneVerData(paras, os);
if (count == 0) {
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(SC_OK);
}
} catch (IOException e) {
logger.error(String.format("下载试算平衡表生成版-生成文件异常:%s",e.getMessage()));
// response.setContentType("application/vnd.ms-excel;charset=utf-8");
// response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name");
// String fileName = paras.getPeriodStart() + "-" + paras.getPeriodEnd();
// response.setCharacterEncoding("UTF-8");
// OutputStream os = null;
// try {
// response.addHeader("Content-Disposition", "attachment;filename="
// + UUID.randomUUID() + ".xls");
// response.addHeader("x-file-name", fileName);
// os = response.getOutputStream();
// int count = citDataPreviewService.exportTbGeneVerData(paras, os);
//
// if (count == 0) {
// response.setStatus(SC_NO_CONTENT);
// } else {
// response.setStatus(SC_OK);
// }
// } catch (IOException e) {
// logger.error(String.format("下载试算平衡表生成版-生成文件异常:%s",e.getMessage()));
// }
int count = citDataPreviewService.exportTbGeneVerData2(paras, response);
if (count == 0) {
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(SC_OK);
}
}
......@@ -101,25 +95,12 @@ public class CitDataPreviewController extends BaseController {
@RequestMapping(value = "exportTbMappingVerData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportTbMappingVerData(@RequestBody CitTrialBalanceDto paras, HttpServletResponse response) {
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.addHeader("Access-Control-Expose-Headers", "Content-Type,Content-Disposition,x-file-name");
String fileName = paras.getPeriodStart() + "-" + paras.getPeriodEnd();
response.setCharacterEncoding("UTF-8");
OutputStream os = null;
try {
response.addHeader("Content-Disposition", "attachment;filename="
+ UUID.randomUUID() + ".xls");
response.addHeader("x-file-name", fileName);
os = response.getOutputStream();
int count = citDataPreviewService.exportTbMappingVerData(paras, os);
if (count == 0) {
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(SC_OK);
}
} catch (IOException e) {
logger.error(String.format("下载科目余额表-生成文件异常:%s",e.getMessage()));
int count = citDataPreviewService.exportTbMappingVerData2(paras, response);
if (count == 0) {
response.setStatus(SC_NO_CONTENT);
} else {
response.setStatus(SC_OK);
}
}
......
......@@ -28,14 +28,14 @@ public class CitReportController {
/**
* 获取CIT所有要生成的报表模板相关信息,
* 注意CIT不存在月份期间
* 注意CIT不存在月份期间,默认为0
* @param projectId
* @param serviceType
* @return
*/
@RequestMapping(value = "citTemplate/{projectId}/{serviceType}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<List<ReportDto>> getCitTemplate(@PathVariable String projectId, @PathVariable int serviceType) {
return citReportService.getReportTemplate(projectId, EnumServiceType.getEnumByCode(serviceType));
return citReportService.getReportTemplate(projectId, EnumServiceType.getEnumByCode(serviceType),0);
}
/**
......@@ -52,4 +52,9 @@ public class CitReportController {
return ResponseEntity.ok(citReportService.generateCitData(projectId, EnumServiceType.CIT, mergeManual,0,null, generator));
}
@RequestMapping(value = "filterTemplate/{projectId}/{serviceType}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<List<ReportDto>> getFilterTemplate(@PathVariable String projectId, @PathVariable int serviceType, @PathVariable Integer period) {
return citReportService.getFilterReportTemplate(projectId, EnumServiceType.getEnumByCode(serviceType), period);
}
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ public class DataPreviewController extends BaseController {
@PostMapping("getPLDataForDisplay")
public PageInfo<ProfitLossStatementDto> getPLDataForDisplay(@RequestBody ProfitLossStatementParam param) {
logger.debug(String.format("利润表查询 Condition:%s", JSON.toJSONString(param)));
logger.debug(String.format("利润表PRC查询 Condition:%s", JSON.toJSONString(param)));
return dataPreviewSerivceImpl.getPLDataForDisplay(param);
}
......@@ -51,7 +51,7 @@ public class DataPreviewController extends BaseController {
@PostMapping("getBSDataForDisplay")
public PageInfo<BalanceSheetDto> getBSDataForDisplay(@RequestBody BalanceSheetParam param) {
logger.debug(String.format("资产负债表查询 Condition:%s", JSON.toJSONString(param)));
logger.debug(String.format("资产负债表PRC查询 Condition:%s", JSON.toJSONString(param)));
return dataPreviewSerivceImpl.getBSDataForDisplay(param);
}
......
......@@ -58,7 +58,7 @@ public class OperationLogController {
public Boolean addOperationLog(VatOperationLog vatOperationLog) {
OperationLogDto operationLogDto = new OperationLogDto();
CommonUtils.copyProperties(vatOperationLog, operationLogDto);
operationLogService.addOperationLog(operationLogDto);
// operationLogService.addOperationLog(operationLogDto);
return true;
}
}
......@@ -162,6 +162,25 @@ public class BalanceSheetPrcQueryDto {
*/
private BigDecimal begBal;
/**
* Database Column Remarks:
* 同步用于标记不同分页的数据,避免重复删除
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.task_id
*
* @mbg.generated
*/
private String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getSource() {
return source;
}
......
......@@ -161,6 +161,25 @@ public class BalanceSheetQueryDto {
*/
private BigDecimal begBal;
/**
* Database Column Remarks:
* 同步用于标记不同分页的数据,避免重复删除
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.task_id
*
* @mbg.generated
*/
private String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getSource() {
return source;
}
......
......@@ -173,6 +173,25 @@ public class CashFlowQueryDto {
*/
private BigDecimal ytdAmt;
/**
* Database Column Remarks:
* 同步用于标记不同分页的数据,避免重复删除
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.task_id
*
* @mbg.generated
*/
private String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public Date getDate() {
return date;
}
......
......@@ -716,6 +716,25 @@ public class JournalEntryQueryDto {
@JsonFormat(pattern = "yyyy-MM-dd HH:ss:mm",timezone = "GMT+8")
private Date lateUpdatedDate;
/**
* Database Column Remarks:
* 同步用于标记不同分页的数据,避免重复删除
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.task_id
*
* @mbg.generated
*/
private String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public Date getDate() {
return date;
}
......
......@@ -73,6 +73,19 @@ public class OrganizationAccountingRateQueryDto {
*/
private String invalidDate;
/**
* 同步用于标记不同分页的数据,避免重复删除
*/
private String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public Date getDate() {
return date;
}
......
......@@ -161,6 +161,25 @@ public class ProfitLossStatementPrcQueryDto {
*/
private BigDecimal ytdAmt;
/**
* Database Column Remarks:
* 同步用于标记不同分页的数据,避免重复删除
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.task_id
*
* @mbg.generated
*/
private String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getSource() {
return source;
}
......
......@@ -161,6 +161,25 @@ public class ProfitLossStatementQueryDto {
*/
private BigDecimal ytdAmt;
/**
* Database Column Remarks:
* 同步用于标记不同分页的数据,避免重复删除
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.task_id
*
* @mbg.generated
*/
private String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getSource() {
return source;
}
......
......@@ -546,6 +546,25 @@ public class TrialBalanceQueryDto {
*/
private BigDecimal ytdCrBeq;
/**
* Database Column Remarks:
* 同步用于标记不同分页的数据,避免重复删除
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column cash_flow.task_id
*
* @mbg.generated
*/
private String taskId;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public Date getDate() {
return date;
}
......
package pwc.taxtech.atms.dto.organization;
import java.util.List;
/**
* @Auther: Gary J Li
* @Date: 12/03/2019 11:23
* @Description:
*/
public class DDSyncOrgInfo {
private List<OrgSyncData> data;
private int currentPage;
private int pageSize;
private int totalPage;
private int totalCount;
public void setData(List<OrgSyncData> data) {
this.data = data;
}
public List<OrgSyncData> getData() {
return data;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getCurrentPage() {
return currentPage;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageSize() {
return pageSize;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public int getTotalCount() {
return totalCount;
}
}
package pwc.taxtech.atms.dto.organization;
import java.util.Date;
/**
* @Auther: Gary J Li
* @Date: 12/03/2019 11:26
* @Description:
*/
public class OrgSyncData {
private String id;
private String code;
private String commonValueId;
private String nameCN;
private int orgId;
private String orgName;
private int sobId;
private String sobName;
private String currencyCode;
private String legalEntity;
private String legalRepresentative;
private String address;
private String registrationFromDate;
private Date gmtCreate;
private Date gmtModified;
private String psCode;
private String companyLocation;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setCommonValueId(String commonValueId) {
this.commonValueId = commonValueId;
}
public String getCommonValueId() {
return commonValueId;
}
public void setNameCN(String nameCN) {
this.nameCN = nameCN;
}
public String getNameCN() {
return nameCN;
}
public void setOrgId(int orgId) {
this.orgId = orgId;
}
public int getOrgId() {
return orgId;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getOrgName() {
return orgName;
}
public void setSobId(int sobId) {
this.sobId = sobId;
}
public int getSobId() {
return sobId;
}
public void setSobName(String sobName) {
this.sobName = sobName;
}
public String getSobName() {
return sobName;
}
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
public String getCurrencyCode() {
return currencyCode;
}
public void setLegalEntity(String legalEntity) {
this.legalEntity = legalEntity;
}
public String getLegalEntity() {
return legalEntity;
}
public void setLegalRepresentative(String legalRepresentative) {
this.legalRepresentative = legalRepresentative;
}
public String getLegalRepresentative() {
return legalRepresentative;
}
public void setAddress(String address) {
this.address = address;
}
public String getAddress() {
return address;
}
public void setRegistrationFromDate(String registrationFromDate) {
this.registrationFromDate = registrationFromDate;
}
public String getRegistrationFromDate() {
return registrationFromDate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public Date getGmtModified() {
return gmtModified;
}
public void setPsCode(String psCode) {
this.psCode = psCode;
}
public String getPsCode() {
return psCode;
}
public void setCompanyLocation(String companyLocation) {
this.companyLocation = companyLocation;
}
public String getCompanyLocation() {
return companyLocation;
}
}
......@@ -113,7 +113,7 @@ public class CitReportServiceImpl extends BaseService {
@Autowired
private DataUtil dataUtil;
public OperationResultDto<List<ReportDto>> getReportTemplate(String projectId, EnumServiceType serviceType) {
public OperationResultDto<List<ReportDto>> getReportTemplate(String projectId, EnumServiceType serviceType, Integer period) {
OperationResultDto<List<ReportDto>> operationResult = new OperationResultDto<>();
try {
Project project = projectMapper.selectByPrimaryKey(projectId);
......@@ -661,4 +661,24 @@ public class CitReportServiceImpl extends BaseService {
return job;
}
public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
OperationResultDto<List<ReportDto>> result = new OperationResultDto<>();
CommonUtils.copyProperties(getReportTemplate(projectId,serviceType,periodParam),result);
if(!result.getResult() || CollectionUtils.isEmpty(result.getData())) {
return result;
}
int period = periodParam != null ? periodParam : 0;
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId)
.andPeriodEqualTo(period);
List<PeriodTemplate> periodTemplateList = periodTemplateMapper.selectByExample(periodTemplateExample);
List<String> ids = Lists.newArrayList();
periodTemplateList.stream().forEach(x -> ids.add(x.getTemplateId() + ""));
List<ReportDto> reportDtos = result.getData().stream().filter(x -> {
return x.getId() != null && ids.contains(x.getTemplateId());
}).collect(Collectors.toList());
result.setData(reportDtos);
return result;
}
}
......@@ -58,15 +58,13 @@ public class DataImportService extends BaseService {
@Resource
private DataValidateLogMapper dataValidateLogMapper;
@Resource
private ProfitLossStatementMapper profitLossStatementMapper;
private BalanceSheetPrcManualMapper balanceSheetPrcManualMapper;
@Resource
private BalanceSheetManualMapper balanceSheetManualMapper;
private ProfitLossStatementPrcManualMapper profitLossStatementPrcManualMapper;
@Resource
private ProfitLossStatementManualMapper profitLossStatementManualMapper;
private BalanceSheetPrcFinalMapper balanceSheetPrcFinalMapper;
@Resource
private BalanceSheetFinalMapper balanceSheetFinalMapper;
@Resource
private ProfitLossStatementFinalMapper profitLossStatementFinalMapper;
private ProfitLossStatementPrcFinalMapper profitLossStatementPrcFinalMapper;
@Resource
private RedLetterInfoTableMapper redLetterInfoTableMapper;
@Resource
......@@ -328,15 +326,15 @@ public class DataImportService extends BaseService {
// 1、写入最终表
// 2、记录数据导入记录与数据处理校验记录
if (EnumTbImportType.CoverImport.getCode().equals(importType)) {
ProfitLossStatementExample profitLossStatementExample = new ProfitLossStatementExample();
profitLossStatementExample.createCriteria().andOrganizationIdEqualTo(orgId).andPeriodEqualTo(period);
profitLossStatementManualMapper.deleteByExample(profitLossStatementExample);
if (profitLossStatementFinalMapper.countByExample(profitLossStatementExample) > 0) {
profitLossStatementFinalMapper.deleteByExample(profitLossStatementExample);
ProfitLossStatementPrcExample delExample = new ProfitLossStatementPrcExample();
delExample.createCriteria().andOrganizationIdEqualTo(orgId).andPeriodEqualTo(period);
profitLossStatementPrcManualMapper.deleteByExample(delExample);
if (profitLossStatementPrcFinalMapper.countByExample(delExample) > 0) {
profitLossStatementPrcFinalMapper.deleteByExample(delExample);
}
}
profitLossStatementManualMapper.insertBatch(pls);
profitLossStatementFinalMapper.insertBatch(pls);
profitLossStatementPrcManualMapper.insertBatch(pls);
profitLossStatementPrcFinalMapper.insertBatch(pls);
dataImportLog.setRecordSize(pls.size());
dataImportLog.setImportResult(true);
dataImportLogs.add(dataImportLog);
......@@ -492,15 +490,15 @@ public class DataImportService extends BaseService {
// 2、记录数据导入记录与数据处理校验记录
if (EnumTbImportType.CoverImport.getCode().equals(importType)) {
// 根据orgId period删除记录
BalanceSheetExample balanceSheetExample = new BalanceSheetExample();
balanceSheetExample.createCriteria().andOrganizationIdEqualTo(orgId).andPeriodEqualTo(period);
balanceSheetManualMapper.deleteByExample(balanceSheetExample);
if (balanceSheetFinalMapper.countByExample(balanceSheetExample) > 0) {
balanceSheetFinalMapper.deleteByExample(balanceSheetExample);
BalanceSheetPrcExample delExample = new BalanceSheetPrcExample();
delExample.createCriteria().andOrganizationIdEqualTo(orgId).andPeriodEqualTo(period);
balanceSheetPrcManualMapper.deleteByExample(delExample);
if (balanceSheetPrcFinalMapper.countByExample(delExample) > 0) {
balanceSheetPrcFinalMapper.deleteByExample(delExample);
}
}
balanceSheetManualMapper.insertBatch(bls);
balanceSheetFinalMapper.insertBatch(bls);
balanceSheetPrcManualMapper.insertBatch(bls);
balanceSheetPrcFinalMapper.insertBatch(bls);
dataImportLog.setRecordSize(bls.size());
dataImportLog.setImportResult(true);
dataImportLogs.add(dataImportLog);
......
......@@ -40,13 +40,13 @@ public class DataPreviewSerivceImpl extends BaseService {
private TrialBalanceMapper trialBalanceMapper;
@Resource
private ProfitLossStatementMapper profitLossStatementMapper;
private ProfitLossStatementPrcMapper profitLossStatementPrcMapper;
@Resource
private JournalEntryMapper journalEntryMapper;
@Resource
private BalanceSheetMapper balanceSheetMapper;
private BalanceSheetPrcMapper balanceSheetPrcMapper;
@Resource
private CashFlowMapper cashFlowMapper;
......@@ -98,7 +98,7 @@ public class DataPreviewSerivceImpl extends BaseService {
ProfitLossStatementCondition condition = beanUtil.copyProperties(param, new ProfitLossStatementCondition());
Page page = PageHelper.startPage(condition.getPageInfo().getPageIndex(), condition.getPageInfo().getPageSize());
List<ProfitLossStatement> profitLossStatements = profitLossStatementMapper.selectByCondition(condition);
List<ProfitLossStatement> profitLossStatements = profitLossStatementPrcMapper.selectByCondition(condition);
List<ProfitLossStatementDto> profitLossDtos = Lists.newArrayList();
profitLossStatements.forEach(pl -> {
......@@ -196,7 +196,7 @@ public class DataPreviewSerivceImpl extends BaseService {
BalanceSheetCondition condition = beanUtil.copyProperties(param, new BalanceSheetCondition());
Page page = PageHelper.startPage(condition.getPageInfo().getPageIndex(), condition.getPageInfo().getPageSize());
List<BalanceSheet> balanceSheets = balanceSheetMapper.selectByCondition(condition);
List<BalanceSheet> balanceSheets = balanceSheetPrcMapper.selectByCondition(condition);
List<BalanceSheetDto> balanceSheetDtos = Lists.newArrayList();
balanceSheets.forEach(bs -> {
......@@ -343,7 +343,7 @@ public class DataPreviewSerivceImpl extends BaseService {
ProfitLossStatementCondition condition = new ProfitLossStatementCondition();
beanUtil.copyProperties(param, condition);
List<ProfitLossStatement> profitLossStatements = profitLossStatementMapper.selectByCondition(condition);
List<ProfitLossStatement> profitLossStatements = profitLossStatementPrcMapper.selectByCondition(condition);
Map<String, String> header = generalPLHeader();
List<ProfitLossStatementExportDto> cellList = new ArrayList<>();
profitLossStatements.forEach(pl -> {
......@@ -384,8 +384,7 @@ public class DataPreviewSerivceImpl extends BaseService {
try {
BalanceSheetCondition condition = new BalanceSheetCondition();
beanUtil.copyProperties(param, condition);
List<BalanceSheet> balanceSheets = balanceSheetMapper.selectByCondition(condition);
List<BalanceSheet> balanceSheets = balanceSheetPrcMapper.selectByCondition(condition);
Map<String, String> header = generalBSHeader();
List<BalanceSheetExportDto> cellList = new ArrayList<>();
balanceSheets.forEach(bs -> {
......
......@@ -35,11 +35,13 @@
<property name="triggers">
<list>
<ref bean="lgApiJobTrigger"/>
<ref bean="orgSyncJobTrigger"/>
</list>
</property>
<property name="jobDetails">
<list>
<ref bean="lgGlBalanceJob"/>
<ref bean="orgSyncJob"/>
</list>
</property>
<property name="taskExecutor" ref="executor"/>
......@@ -59,5 +61,18 @@
<property name="cronExpression" value="0 0 1 3 * ?"/>
</bean>
<bean name="orgSyncJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="pwc.taxtech.atms.common.schedule.OrgSyncJob"/>
<property name="durability" value="true"/>
<property name="requestsRecovery" value="false"/>
<property name="description" value="机构信息同步"/>
</bean>
<!-- 每月1日执行一次-->
<bean id="orgSyncJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="orgSyncJob"/>
<property name="cronExpression" value="0 0 0 1 * ?"/>
</bean>
<!-- 分布式事务配置 end -->
</beans>
\ No newline at end of file
......@@ -18,6 +18,7 @@
<intercept-url pattern="/api/v1/cache/getallcache" access="permitAll" />
<intercept-url pattern="/api/v1/user/login" access="permitAll" />
<intercept-url pattern="/api/v1/approval/**" access="permitAll" />
<intercept-url pattern="/ebs/api/v1/dd/**" access="permitAll" />
<intercept-url pattern="/api/**" access="authenticated" />
<intercept-url pattern="/**" access="permitAll" />
<headers>
......
......@@ -53,3 +53,6 @@ get_user_info_url=${get_user_info_url}
app_id=${app_id}
app_key=${app_key}
cookie.maxAgeSeconds=${cookie.maxAgeSeconds}
api_white_list=${api_white_list}
org_sync_url=${org_sync_url}
org_sync_token=${org_sync_token}
\ No newline at end of file
......@@ -51,3 +51,6 @@ get_user_info_url=http://mis-test.diditaxi.com.cn/auth/sso/api/
app_id=2500
app_key=983258e7fd04d7fa0534735f7b1c33f3
cookie.maxAgeSeconds=86400
api_white_list=/ebs/api/v1/dd;
org_sync_url=http://10.96.238.10/erp-main-data-test-v2/api/companies
org_sync_token=174af08f
......@@ -53,4 +53,7 @@ check_ticket=true
get_user_info_url=http://mis.diditaxi.com.cn/auth/sso/api/
app_id=2500
app_key=983258e7fd04d7fa0534735f7b1c33f3
cookie.maxAgeSeconds=18000
\ No newline at end of file
cookie.maxAgeSeconds=18000
api_white_list=/ebs/api/v1/dd;
org_sync_url=http://10.96.238.10/erp-main-data-test-v2/api/companies
org_sync_token=174af08f
\ No newline at end of file
This diff is collapsed.
......@@ -17,6 +17,8 @@ import pwc.taxtech.atms.common.message.LogMessage;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.NationalEconomicIndustryEnum;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dto.organization.DDSyncOrgInfo;
import pwc.taxtech.atms.dto.organization.OrgSyncData;
import pwc.taxtech.atms.entity.*;
import javax.annotation.Resource;
......@@ -397,12 +399,43 @@ public class DataInitTest extends CommonIT {
@Test
public void syncOrg(){
List<String> taxPayNums= organizationMapper.selectByExample(new OrganizationExample()).stream().map(Organization::getTaxPayerNumber).collect(Collectors.toList());
/**
* 1、taxPayNums http 滴滴oa接口同步机构的信息
* 2、逐条update,记录更新失败或未更新上的taxPayNum
* 3、失败的再次处理
*/
String input = "";
try {
File targetFile = new File("src/main/resources/orgImport/ddOrgJson.json");
input = FileUtils.readFileToString(targetFile, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
DDSyncOrgInfo ddSyncOrgInfo = JSONObject.parseObject(input,DDSyncOrgInfo.class);
List<OrgSyncData> orgSyncDatas = ddSyncOrgInfo.getData();
orgSyncDatas.forEach(osd -> {
OrganizationExample example = new OrganizationExample();
example.createCriteria().andNameEqualTo(osd.getNameCN());
Organization o = new Organization();
o.setClientCode(osd.getCode());
o.setCode(osd.getCode());
o.setEnterpriseAccountCode(String.valueOf(osd.getSobId()));
o.setEnterpriseAccountName(osd.getSobName());
o.setCurrencyCode(osd.getCurrencyCode());
o.setLegalEntity(osd.getLegalEntity());
o.setLegalPersonName(osd.getLegalRepresentative());
o.setAddress(osd.getAddress());
o.setCreateTime(osd.getGmtCreate());
o.setUpdateTime(osd.getGmtModified());
o.setPsCode(osd.getPsCode());
RegionExample regionExample = new RegionExample();
regionExample.createCriteria().andShortNameEqualTo(osd.getCompanyLocation());
List<Region> regions = regionMapper.selectByExample(regionExample);
if (regions.size() > 0) {
o.setRegionId(regions.get(0).getId());
}
organizationMapper.updateByExampleSelective(o, example);
});
}
private void setProperty(Object obj, String propertyName, Object value) {
......
......@@ -41,17 +41,49 @@
<property name="rootInterface" value="pwc.taxtech.atms.MyVatMapper" />
</javaClientGenerator>
<!-- <table tableName="trial_balance_final" domainObjectName="TrialBalanceFinal">
<!--
<table tableName="profit_loss_statement_prc" domainObjectName="ProfitLossStatementPrc">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>-->
</table>
<table tableName="profit_loss_statement_prc_manual" domainObjectName="ProfitLossStatementPrcManual">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="profit_loss_statement_prc_final" domainObjectName="ProfitLossStatementPrcFinal">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="balance_sheet_prc" domainObjectName="BalanceSheetPrc">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="balance_sheet_prc_manual" domainObjectName="BalanceSheetPrcManual">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="balance_sheet_prc_final" domainObjectName="BalanceSheetPrcFinal">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="trial_balance_final" domainObjectName="TrialBalanceFinal">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<table tableName="report_file_upload" domainObjectName="ReportFileUpload">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
<!--<table tableName="certified_invoices_list" domainObjectName="CertifiedInvoicesList">
<table tableName="certified_invoices_list" domainObjectName="CertifiedInvoicesList">
<property name="useActualColumnNames" value="false"/>
<property name="ignoreQualifiersAtRuntime" value="true"/>
</table>
......
......@@ -7,7 +7,6 @@ import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entity.CitEAMAssetsDisposal;
import pwc.taxtech.atms.entity.CitEAMAssetsDisposalExample;
import pwc.taxtech.atms.entity.CitSalaryAdvance;
@Mapper
public interface CitEAMAssetsDisposalMapper extends MyMapper {
......
......@@ -5,7 +5,6 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entity.CitEAMAssetsDisposal;
import pwc.taxtech.atms.entity.CitSalaryAdvance;
import pwc.taxtech.atms.entity.CitSalaryAdvanceExample;
......
package pwc.taxtech.atms.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.MyMapper;
import pwc.taxtech.atms.entity.OrganizationAccountingRate;
import pwc.taxtech.atms.entity.OrganizationAccountingRateExample;
@Mapper
public interface OrganizationAccountingRateMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
long countByExample(OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int deleteByExample(OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int insert(OrganizationAccountingRate record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int insertSelective(OrganizationAccountingRate record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
List<OrganizationAccountingRate> selectByExampleWithRowbounds(OrganizationAccountingRateExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
List<OrganizationAccountingRate> selectByExample(OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
OrganizationAccountingRate selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") OrganizationAccountingRate record, @Param("example") OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int updateByExample(@Param("record") OrganizationAccountingRate record, @Param("example") OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(OrganizationAccountingRate record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int updateByPrimaryKey(OrganizationAccountingRate record);
package pwc.taxtech.atms.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entity.OrganizationAccountingRate;
import pwc.taxtech.atms.entity.OrganizationAccountingRateExample;
import java.util.List;
@Mapper
public interface OrganizationAccountingRateMapper extends MyMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
long countByExample(OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int deleteByExample(OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int deleteByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int insert(OrganizationAccountingRate record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int insertSelective(OrganizationAccountingRate record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
List<OrganizationAccountingRate> selectByExampleWithRowbounds(OrganizationAccountingRateExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
List<OrganizationAccountingRate> selectByExample(OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
OrganizationAccountingRate selectByPrimaryKey(Long id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") OrganizationAccountingRate record, @Param("example") OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int updateByExample(@Param("record") OrganizationAccountingRate record, @Param("example") OrganizationAccountingRateExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(OrganizationAccountingRate record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_accounting_rate
*
* @mbg.generated
*/
int updateByPrimaryKey(OrganizationAccountingRate record);
}
\ No newline at end of file
......@@ -53,6 +53,22 @@
<when test="item.occurPeriod != null">#{item.occurPeriod,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.oaAssetBillType != null">#{item.oaAssetBillType,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.oaAssetNumber != null">#{item.oaAssetNumber,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.scrapReason != null">#{item.scrapReason,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.assetNumber != null">#{item.assetNumber,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.assetLabelNumber != null">#{item.assetLabelNumber,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
......@@ -61,6 +77,38 @@
<when test="item.compensationSaleAmount != null">#{item.compensationSaleAmount,jdbcType=DECIMAL},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.liableEmployeeNum != null">#{item.liableEmployeeNum,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.liableEmployeeName != null">#{item.liableEmployeeName,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.remitEmployeeNum != null">#{item.remitEmployeeNum,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.remitEmployeeName != null">#{item.remitEmployeeName,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.remitTime != null">#{item.remitTime,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
</choose>
<choose>
<when test="item.remitAmount != null">#{item.remitAmount,jdbcType=DECIMAL},</when>
<otherwise>0,</otherwise>
</choose>
<choose>
<when test="item.gatheringCompanyName != null">#{item.gatheringCompanyName,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.gatheringCompanyAccount != null">#{item.gatheringCompanyAccount,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.createdBy != null">#{item.createdBy,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise>
......
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