Commit ac09da2d authored by frank.xa.zhang's avatar frank.xa.zhang

remove blank

parent 6edf0b16
......@@ -18,6 +18,7 @@ public class FTPClientPool {
private GenericObjectPool<FTPClient> pool;
private String ftpRootPath;
private static final String SYMBOL = "/";
private FTPClientConfig ftpClientConfig;
@Value("${ftp.host}")
private String ftpHost;
......@@ -36,6 +37,7 @@ public class FTPClientPool {
clientConfig.setPort(ftpPort);
clientConfig.setUsername(ftpUser);
clientConfig.setPassword(ftpPwd);
ftpClientConfig = clientConfig;
pool = new GenericObjectPool<>(new FtpClientFactory(clientConfig), config);
ftpRootPath = pool.borrowObject().printWorkingDirectory();
}
......@@ -54,19 +56,23 @@ public class FTPClientPool {
*/
public void upload(String filePath, String fileName, InputStream inputStream) throws Exception {
String upPath;
if (StringUtils.isBlank(filePath)) {
upPath = ftpRootPath;
} else {
upPath = filePath;
}
if (!StringUtils.endsWith(upPath, SYMBOL)) {
upPath = upPath + SYMBOL;
}
FTPClient client = getClient();
if (!isExist(upPath, client)) {
mkDir(upPath, client);
try {
if (StringUtils.isBlank(filePath)) {
upPath = ftpRootPath;
} else {
upPath = filePath;
}
if (!StringUtils.endsWith(upPath, SYMBOL)) {
upPath = upPath + SYMBOL;
}
if (!isExist(upPath, client)) {
mkDir(upPath, client);
}
client.storeFile(upPath + fileName, inputStream);
} finally {
pool.returnObject(client);
}
client.storeFile(upPath + fileName, inputStream);
}
/**
......@@ -78,8 +84,12 @@ public class FTPClientPool {
*/
public InputStream download(String filePath) throws Exception {
FTPClient client = getClient();
client.changeWorkingDirectory(ftpRootPath);
return StringUtils.isBlank(filePath) ? null : client.retrieveFileStream(filePath);
try {
client.changeWorkingDirectory(ftpRootPath);
return StringUtils.isBlank(filePath) ? null : client.retrieveFileStream(filePath);
} finally {
pool.returnObject(client);
}
}
private void mkDir(String path, FTPClient ftpClient) throws IOException {
......@@ -121,12 +131,19 @@ public class FTPClientPool {
if (StringUtils.isBlank(filePath)) {
return;
}
FTPClient client = getClient();
if (!isExist(filePath, client)) {
return;
} else {
client.deleteFile(filePath);
try {
if (!isExist(filePath, client)) {
return;
} else {
client.deleteFile(filePath);
}
} finally {
pool.returnObject(client);
}
}
public FTPClientConfig getFtpClientConfig() {
return ftpClientConfig;
}
}
......@@ -17,23 +17,23 @@ public class ReportController {
@Autowired
ReportService reportService;
@RequestMapping(value = "template/{organizationID}/{serviceType}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<List<ReportDto>> getTemplate(@PathVariable String organizationID,@PathVariable int serviceType, @PathVariable Integer period) {
return reportService.getReportTemplate(organizationID, EnumServiceType.getEnumByCode(serviceType), period);
@RequestMapping(value = "template/{projectID}/{serviceType}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<List<ReportDto>> getTemplate(@PathVariable String projectID, @PathVariable int serviceType, @PathVariable Integer period) {
return reportService.getReportTemplate(projectID, EnumServiceType.getEnumByCode(serviceType), period);
}
@RequestMapping(value = "updateConfig/{projectId}/{ifDeleteManualDataSource}/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto updateConfig(@PathVariable String projectId,@PathVariable Boolean ifDeleteManualDataSource, @PathVariable Integer period, @RequestParam String generator) {
public OperationResultDto updateConfig(@PathVariable String projectId, @PathVariable Boolean ifDeleteManualDataSource, @PathVariable Integer period, @RequestParam String generator) {
return reportService.updateConfig(projectId, period, ifDeleteManualDataSource, generator);
}
@RequestMapping(value = "generateByTotal/{projectId}/{ifDeleteManualDataSource}/{period}",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto generateAllData(@PathVariable String projectId,@PathVariable Boolean ifDeleteManualDataSource,@PathVariable Integer period,@RequestParam String generator){
return reportService.generateData(projectId,EnumServiceType.VAT,ifDeleteManualDataSource,period,null,generator);
@RequestMapping(value = "generateByTotal/{projectId}/{ifDeleteManualDataSource}/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto generateAllData(@PathVariable String projectId, @PathVariable Boolean ifDeleteManualDataSource, @PathVariable Integer period, @RequestParam String generator) {
return reportService.generateData(projectId, EnumServiceType.VAT, ifDeleteManualDataSource, period, null, generator);
}
@RequestMapping(value = "templateReferences/{period}",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<CellTemplateReferenceDto> getTemplateReferences(@PathVariable int period){
@RequestMapping(value = "templateReferences/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<CellTemplateReferenceDto> getTemplateReferences(@PathVariable int period) {
return reportService.getTemplateReferences(period);
}
}
......@@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.common.ftp.FTPClientPool;
import pwc.taxtech.atms.dto.*;
......@@ -137,4 +138,15 @@ public class TemplateController extends BaseController {
}
}
@RequestMapping(value = "getGroupTemplateByGroupID", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto<List<TemplateByGroupDto>> getGroupTemplateByGroupID(@RequestParam Long templateGroupID, @RequestParam String projectID) {
OperationResultDto resultDto = new OperationResultDto();
if (templateGroupID == null || templateGroupID.equals("undefined") || StringUtils.isBlank(projectID) || projectID.equals("undefined")) {
resultDto.setResult(false);
return resultDto;
}
return templateService.getByGroupID(templateGroupID, projectID);
}
}
......@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.Industry;
import pwc.taxtech.atms.entitiy.IndustryExample;
import pwc.taxtech.atms.entitiy.TemplateGroup;
@Mapper
public interface IndustryMapper extends MyMapper {
......@@ -107,4 +108,6 @@ public interface IndustryMapper extends MyMapper {
int updateByPrimaryKey(Industry record);
List<Industry> getAllAvailableIndustry();
List<TemplateGroup> getTemplateGroup();
}
\ No newline at end of file
package pwc.taxtech.atms.dto.vatdto;
import lombok.Getter;
import lombok.Setter;
import pwc.taxtech.atms.dto.TemplateDto;
import java.util.List;
@Getter
@Setter
public class TemplateByGroupDto {
private Long id ;
private String name ;
private int OrderIndex ;
private List<TemplateDto> children ;
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto;
import pwc.taxtech.atms.entitiy.Template;
import java.util.List;
......@@ -24,4 +25,6 @@ public interface TemplateService {
OperationResultDto<String> deleteTemplate(DeleteTemplateParam param);
OperationResultDto setRowColName(Long id,List<CellBriefDto> cellInfo);
OperationResultDto<List<TemplateByGroupDto>> getByGroupID(Long templateGroupID, String projectID);
}
......@@ -125,4 +125,6 @@ public class AbstractService {
protected FormulaConfigMapper formulaConfigMapper;
@Autowired
DistributedIDService distributedIDService;
@Autowired
ProjectMapper projectMapper;
}
......@@ -5,11 +5,11 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.TemplateGroupType;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.entitiy.CellTemplate;
import pwc.taxtech.atms.entitiy.CellTemplateExample;
import pwc.taxtech.atms.entitiy.Template;
import pwc.taxtech.atms.entitiy.TemplateExample;
import pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto;
import pwc.taxtech.atms.entitiy.*;
import pwc.taxtech.atms.service.TemplateService;
import java.util.*;
......@@ -224,6 +224,75 @@ public class TemplateServiceImpl extends AbstractService implements TemplateServ
return result;
}
@Override
public OperationResultDto<List<TemplateByGroupDto>> getByGroupID(Long templateGroupID, String projectID) {
OperationResultDto result = new OperationResultDto();
Long bspl = getBSPLTemplateGroup(projectID);
TemplateExample example = new TemplateExample();
List<Long> ids = new ArrayList<>();
ids.add(templateGroupID);
ids.add(bspl);
example.createCriteria().andTemplateGroupIdIn(ids);
example.setOrderByClause(" order_index");
List<Template> templates = templateMapper.selectByExample(example);
TemplateByGroupDto bsplGroup = new TemplateByGroupDto();
bsplGroup.setId(bspl);
bsplGroup.setName(TemplateGroupType.FinancialReturn.name());
List<TemplateDto> templateDtos = new ArrayList<>();
templates.stream().filter(x -> x.getTemplateGroupId().equals(bspl)).collect(Collectors.toList()).forEach(a -> {
TemplateDto templateDto = new TemplateDto();
CommonUtils.copyProperties(a, templateDto);
templateDtos.add(templateDto);
});
bsplGroup.setChildren(templateDtos);
bsplGroup.setOrderIndex(1);
TemplateByGroupDto taxReturnGroup = new TemplateByGroupDto();
taxReturnGroup.setId(templateGroupID);
taxReturnGroup.setName(TemplateGroupType.TaxReturn.name());
List<TemplateDto> templateDtos2 = new ArrayList<>();
templates.stream().filter(x -> x.getTemplateGroupId().equals(templateGroupID)).collect(Collectors.toList()).forEach(a -> {
TemplateDto templateDto = new TemplateDto();
CommonUtils.copyProperties(a, templateDto);
templateDtos2.add(templateDto);
});
taxReturnGroup.setChildren(templateDtos2);
taxReturnGroup.setOrderIndex(2);
List<TemplateByGroupDto> wrappList = new ArrayList<>();
wrappList.add(bsplGroup);
wrappList.add(taxReturnGroup);
result.setResult(true);
result.setData(wrappList);
return result;
}
private Long getBSPLTemplateGroup(String projectID) {
ProjectExample example = new ProjectExample();
example.createCriteria().andIDEqualTo(projectID);
List<Project> projects = projectMapper.selectByExample(example);
Optional<String> industryID = projects.stream().map(Project::getIndustryID).findFirst();
if (industryID == null) {
return null;
}
List<TemplateGroup> allTemplateGroups = templateGroupMapper.selectByExample(new TemplateGroupExample());
Optional<TemplateGroup> bsplTemplateGroup = allTemplateGroups.stream().filter(a -> a.getIndustryIds().equals(industryID) && a.getGroupType().equals(TemplateGroupType.FinancialReturn.getCode())).findFirst();
if (bsplTemplateGroup == null) {
bsplTemplateGroup = allTemplateGroups.stream().filter(a -> a.getIndustryIds().contains(industryID.get()) && a.getGroupType().equals(TemplateGroupType.FinancialReturn.getCode())).findFirst();
}
if (bsplTemplateGroup == null) {
bsplTemplateGroup = industryMapper.getTemplateGroup().stream().findFirst();
}
if (bsplTemplateGroup == null) {
return null;
}
return bsplTemplateGroup.get().getId();
}
private void logicDeleteIsActiveAssociation(Template templateDb) {
templateDb.setIsActiveAssociation(false);
templateMapper.updateByPrimaryKeySelective(templateDb);
......
......@@ -59,7 +59,13 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
String serviceTypeStr = serviceType.getCode().toString();
ProjectServiceTypeExample projectServiceTypeExample = new ProjectServiceTypeExample();
projectServiceTypeExample.createCriteria().andServiceTypeIDEqualTo(serviceTypeStr).andProjectIDEqualTo(projectID);
templateGroupID = projectServiceTypeMapper.selectByExample(projectServiceTypeExample).stream().map(ProjectServiceType::getTemplateGroupID).findFirst().get();
Optional<Long> tempVlaue = projectServiceTypeMapper.selectByExample(projectServiceTypeExample).stream().map(ProjectServiceType::getTemplateGroupID).findFirst();
if(tempVlaue.isPresent()){
templateGroupID = tempVlaue.get();
}
else{
templateGroupID = 0L;
}
}
String dbName = ShardingContextHolder.getDataSourceKey();
......
......@@ -11,7 +11,9 @@ import pwc.taxtech.atms.dto.vatdto.CellTemplatePerGroupDto;
import java.util.List;
import java.util.Optional;
/**
* Already unused
*/
public class SGSR implements FreeRefFunction {
private FormulaContext formulaContext;
......
......@@ -281,4 +281,34 @@
isActive = 1
AND Name IN ('通用行业' ,'房地产业', '资产管理', '银行及其他金融服务业')
</select>
<resultMap id="TemplateGroup" type="pwc.taxtech.atms.entitiy.Template">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="path" jdbcType="VARCHAR" property="path" />
<result column="report_type" jdbcType="INTEGER" property="reportType" />
<result column="template_group_id" jdbcType="BIGINT" property="templateGroupId" />
<result column="order_index" jdbcType="INTEGER" property="orderIndex" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_system_type" jdbcType="INTEGER" property="isSystemType" />
<result column="is_active_association" jdbcType="INTEGER" property="isActiveAssociation" />
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
</resultMap>
<select id="getTemplateGroup" resultMap="TemplateGroup">
SELECT *
FROM Industry a
JOIN template_group b
ON a.ID = b.industry_ids
WHERE a.Name = '通用行业'
AND b.group_type = 2
LIMIT 1
</select>
</mapper>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
commonModule.directive('vatReportView', ['$log', 'enums',
function ($log, enums) {
'use strict';
$log.debug('vatReportView.ctor()...');
return {
restrict: 'E',
templateUrl: '/app/common/controls/vat-report-view/vat-report-view.html' + '?_=' + Math.random(),
scope: {
templateId: '=',
reportId: '=',
templateName:'=',
templateCode: '=',
isDocumentList: '=',
serviceType: '=',
initRow: '=?',
initCol: '=?'
},
controller: 'VatReportViewController',
link: function ($scope, $ele, $attr) {
$ele.find("#tax-cell-detail").draggable({
scroll: true,
cancel: '#dataSourceGrid,.hand-input-container,.add-voucher-range-propover,.add-invoice,.tab-type,.dx-texteditor-input,input,.btn'
});
var saveFunc = $scope.$on('saveReportSheet', function (event, args) {
$scope.saveReportCache();
});
$scope.$on('$destroy', function () {
saveFunc();
});
}
};
}
]);
\ No newline at end of file
@import "~/app-resources/less/theme.less";
@color-red:#e20;
@color-gray:#939598-#222;
.vat-report-view {
height: calc(~"100% - 20px");
min-height: 500px;
margin: 10px 10px 10px 20px;
.report-container {
border: @thin-border solid @color-border;
height: calc(~"100% - 36px");
margin: 0;
width: 100%;
white-space: normal;
display: inline-block;
}
.row {
margin-left: 0px;
margin-bottom:10px;
&>span {
float: right;
margin-right: 15px;
cursor: pointer;
}
}
#addCertificatePop {
.modal-dialog {
width: 700px;
.add-certificate-pop-body {
height: 240px;
#add-certificate-grid {
height: 210px;
}
}
.modal-footer {
.template-1-button {
background-color: @color-red;
color: white;
margin-right:30px;
}
.template-2-button {
background-color: @color-gray;
color: white;
margin-right: 30px;
}
}
}
}
}
.model-report-approve-popup {
width: 400px;
height:500px;
position:fixed;
top:25%;
left:40%;
.modal-dialog {
width: 100%;
height: 90%;
margin: 20px auto;
.modal-content {
width: 100%;
.modal-body {
height: 90%;
}
}
}
}
.model-report-remarks-popup {
width: 400px;
height:500px;
position:fixed;
top:25%;
left:40%;
.modal-dialog {
width: 100%;
height: 90%;
margin: 20px auto;
.modal-content {
width: 100%;
.modal-body {
height: 90%;
}
}
}
}
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