Commit f6cd03e1 authored by eddie.woo's avatar eddie.woo

modify

parent 3ce7ed2b
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dpo.PagingResultDto; import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.dto.revenuconf.RevConfAddDto;
import pwc.taxtech.atms.dto.revenuconf.RevenueConfParam; import pwc.taxtech.atms.dto.revenuconf.RevenueConfParam;
import pwc.taxtech.atms.dto.revenuconf.RevenueConfResult;
import pwc.taxtech.atms.service.impl.RevenueConfService; import pwc.taxtech.atms.service.impl.RevenueConfService;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -17,9 +21,21 @@ public class RevenueConfController extends BaseController { ...@@ -17,9 +21,21 @@ public class RevenueConfController extends BaseController {
@Resource @Resource
private RevenueConfService revenueConfService; private RevenueConfService revenueConfService;
@GetMapping @PostMapping("queryPage")
public PagingResultDto queryPage(@RequestBody RevenueConfParam param) { public CamelPagingResultDto<RevenueConfResult> queryPage(@RequestBody RevenueConfParam param) {
return null; return new CamelPagingResultDto<>(revenueConfService.queryPage(param));
}
@PostMapping("add")
public ApiResultDto addConf(@RequestBody RevConfAddDto addDto) {
revenueConfService.addConfig(addDto);
return ApiResultDto.success();
}
@PostMapping("update")
public ApiResultDto updateConf(@RequestBody RevenueConfig config) {
revenueConfService.updateConfig(config);
return ApiResultDto.success();
} }
} }
package pwc.taxtech.atms.dto.input; package pwc.taxtech.atms.dto.input;
import com.alibaba.fastjson.annotation.JSONField; import com.github.pagehelper.PageInfo;
import java.util.List; import java.util.List;
public class CamelPagingResultDto<T> { public class CamelPagingResultDto<T> {
@JSONField(name = "List")
private List<T> list; private List<T> list;
@JSONField(name = "PageInfo")
private CamelPagingDto pageInfo; private CamelPagingDto pageInfo;
private T calculateData; private T calculateData;
public CamelPagingResultDto() { public CamelPagingResultDto() {
super(); }
public CamelPagingResultDto(PageInfo<T> pageInfo) {
this.setList(pageInfo.getList());
CamelPagingDto pagingDto = new CamelPagingDto();
pagingDto.setPageIndex(pageInfo.getPageNum());
pagingDto.setPageSize(pageInfo.getPageSize());
pagingDto.setTotalCount((int) pageInfo.getTotal());
this.setPageInfo(pagingDto);
} }
public List<T> getList() { public List<T> getList() {
......
package pwc.taxtech.atms.dto.revenuconf;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
import java.util.List;
public class RevConfAddDto extends RevenueConfig {
private List<String> orgList;
public List<String> getOrgList() {
return this.orgList;
}
public void setOrgList(List<String> orgList) {
this.orgList = orgList;
}
}
package pwc.taxtech.atms.dto.revenuconf; package pwc.taxtech.atms.dto.revenuconf;
import pwc.taxtech.atms.dpo.PagingDto; import pwc.taxtech.atms.dto.input.CamelPagingDto;
import pwc.taxtech.atms.vat.entity.RevenueConfig; import pwc.taxtech.atms.vat.entity.RevenueConfig;
public class RevenueConfParam extends RevenueConfig { public class RevenueConfParam extends RevenueConfig {
private PagingDto pageInfo; private CamelPagingDto pageInfo;
public PagingDto getPageInfo() { public CamelPagingDto getPageInfo() {
return this.pageInfo; return this.pageInfo;
} }
public void setPageInfo(PagingDto pageInfo) { public void setPageInfo(CamelPagingDto pageInfo) {
this.pageInfo = pageInfo; this.pageInfo = pageInfo;
} }
} }
package pwc.taxtech.atms.dto.revenuconf;
import pwc.taxtech.atms.constant.enums.RevenueConfEnum;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
public class RevenueConfResult extends RevenueConfig {
public String getAccountTypeStr() {
return RevenueConfEnum.AccountType.MAPPING.get(this.getAccountType());
}
public String getTaxBaseStr() {
return RevenueConfEnum.TaxBase.MAPPING.get(this.getTaxBase());
}
public String getTaxTypeStr() {
return RevenueConfEnum.TaxType.MAPPING.get(this.getTaxType());
}
public String getRevenueTypeStr() {
return RevenueConfEnum.RevenueType.MAPPING.get(this.getRevenueType());
}
public String getStatusStr() {
return RevenueConfEnum.Status.MAPPING.get(this.getStatus());
}
}
package pwc.taxtech.atms.exception; package pwc.taxtech.atms.exception;
public class ServiceException extends Exception { public class ServiceException extends RuntimeException {
public ServiceException() { public ServiceException() {
} }
......
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dpo.OrgSelectDto;
import pwc.taxtech.atms.dto.revenuconf.RevConfAddDto;
import pwc.taxtech.atms.dto.revenuconf.RevenueConfParam; import pwc.taxtech.atms.dto.revenuconf.RevenueConfParam;
import pwc.taxtech.atms.dto.revenuconf.RevenueConfResult;
import pwc.taxtech.atms.vat.dao.RevenueConfigMapper; import pwc.taxtech.atms.vat.dao.RevenueConfigMapper;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
import pwc.taxtech.atms.vat.entity.RevenueConfigExample;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class RevenueConfService extends BaseService { public class RevenueConfService extends BaseService {
@Resource @Resource
private RevenueConfigMapper revenueConfigMapper; private RevenueConfigMapper revenueConfigMapper;
@Resource
private OrganizationServiceImpl organizationService;
/**
* 分页查询可查看的配置信息
*
* @param param RevenueConfParam
* @return PageInfo
*/
public PageInfo<RevenueConfResult> queryPage(RevenueConfParam param) {
List<OrgSelectDto> orgDtoList = organizationService.getMyOrgList();
if (CollectionUtils.isEmpty(orgDtoList)) {
return new PageInfo<>();
}
Page page = PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize());
RevenueConfigExample example = new RevenueConfigExample();
example.createCriteria().andOrgIdIn(orgDtoList.stream().map(OrgSelectDto::getId).collect(Collectors.toList()));
PageInfo<RevenueConfResult> pageInfo = new PageInfo<>(revenueConfigMapper.selectByExample(example).stream()
.map(o -> beanUtil.copyProperties(o, new RevenueConfResult())).collect(Collectors.toList()));
pageInfo.setTotal(page.getTotal());
return pageInfo;
}
public void queryPage(RevenueConfParam param) { /**
PageHelper.startPage(param.getPageInfo().getPageIndex(), param.getPageInfo().getPageSize()); * 新增配置
*
* @param config RevenueConfig
*/
public void addConfig(RevenueConfig config) {
//todo 重复校验
config.setId(idService.nextId());
revenueConfigMapper.insertSelective(config);
}
/**
* 前台批量新增
*
* @param addDto RevConfAddDto
*/
public void addConfig(RevConfAddDto addDto) {
if (!CollectionUtils.isEmpty(addDto.getOrgList())) {
addDto.getOrgList().forEach(id -> {
addDto.setId(idService.nextId());
addDto.setOrgId(id);
revenueConfigMapper.insertSelective(addDto);
});
}
} }
/**
* 更新配置
*
* @param config RevenueConfig
*/
public void updateConfig(RevenueConfig config) {
//todo 重复校验
revenueConfigMapper.updateByPrimaryKeySelective(config);
}
} }
...@@ -2097,6 +2097,8 @@ ...@@ -2097,6 +2097,8 @@
"RevenueColEdit": "编辑", "RevenueColEdit": "编辑",
"RevenueNoOrgData": "没有机构权限", "RevenueNoOrgData": "没有机构权限",
"RevenueGetOrgError": "获取机构信息失败", "RevenueGetOrgError": "获取机构信息失败",
"RevenueAddSuccess": "添加成功",
"RevenueUpdateSuccess": "更新成功",
"~MustBeEndOneApp": "我必须是最后一个!" "~MustBeEndOneApp": "我必须是最后一个!"
} }
\ No newline at end of file
...@@ -6,29 +6,49 @@ ...@@ -6,29 +6,49 @@
//表格配置 //表格配置
$scope.revenueGridOptions = $.extend(true, {}, dxDataGridService.BASIC_GRID_OPTIONS, { $scope.revenueGridOptions = $.extend(true, {}, dxDataGridService.BASIC_GRID_OPTIONS, {
columns: [ columns: [
{dataField: 'statusString', caption: $translate.instant('RevenueColSerialNo'), fixed: true, allowHeaderFiltering: true}, // {dataField: 'serialNo', caption: $translate.instant('RevenueColSerialNo'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColName'), fixed: true, allowHeaderFiltering: true}, {dataField: 'name', caption: $translate.instant('RevenueColName'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColOrg'), fixed: true, allowHeaderFiltering: true}, {dataField: 'orgId', caption: $translate.instant('RevenueColOrg'), fixed: true, allowHeaderFiltering: true,
{dataField: 'statusString', caption: $translate.instant('RevenueColAccountName'), fixed: true, allowHeaderFiltering: true}, calculateCellValue: function(data) {
{dataField: 'statusString', caption: $translate.instant('RevenueColTaxRate'), fixed: true, allowHeaderFiltering: true}, return _.find($scope.selectOrgList, function(o) {
{dataField: 'statusString', caption: $translate.instant('RevenueColTaxBase'), fixed: true, allowHeaderFiltering: true}, return o.id === data.orgId;
{dataField: 'statusString', caption: $translate.instant('RevenueColType'), fixed: true, allowHeaderFiltering: true}, }).name;
{dataField: 'statusString', caption: $translate.instant('RevenueColTaxType'), fixed: true, allowHeaderFiltering: true}, }},
{dataField: 'statusString', caption: $translate.instant('RevenueColStatus'), fixed: true, allowHeaderFiltering: true}, //todo 组装accountName
{dataField: 'statusString', caption: $translate.instant('RevenueColEnable'), fixed: true, allowHeaderFiltering: true}, {dataField: 'accountTypeStr', caption: $translate.instant('RevenueColAccountName'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColDisable'), fixed: true, allowHeaderFiltering: true}, {dataField: 'taxRate', caption: $translate.instant('RevenueColTaxRate'), fixed: true, allowHeaderFiltering: true,
calculateCellValue: function(data) {
return (data.taxRate * 100) + '%';
}},
{dataField: 'taxBaseStr', caption: $translate.instant('RevenueColTaxBase'), fixed: true, allowHeaderFiltering: true},
{dataField: 'revenueTypeStr', caption: $translate.instant('RevenueColType'), fixed: true, allowHeaderFiltering: true},
{dataField: 'taxTypeStr', caption: $translate.instant('RevenueColTaxType'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusStr', caption: $translate.instant('RevenueColStatus'), fixed: true, allowHeaderFiltering: true},
{dataField: 'startDate', caption: $translate.instant('RevenueColEnable'), fixed: true, allowHeaderFiltering: true},
{dataField: 'endDate', caption: $translate.instant('RevenueColDisable'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColEdit'), fixed: true, allowHeaderFiltering: true}, {dataField: 'statusString', caption: $translate.instant('RevenueColEdit'), fixed: true, allowHeaderFiltering: true},
], ],
dataSource: new DevExpress.data.CustomStore({ bindingOptions: {
load: function (loadOptions) { dataSource: 'pageConfDataSource',
return [{"statusString":"test"},{"statusString":"test2"}]; },
} selection: {
}), mode: 'multiple',
showCheckBoxesMode: 'always',
allowSelectAll: true
}
}); });
//刷新页面 //刷新页面
$scope.refreshConfigGrid = function () { $scope.refreshConfigGrid = function () {
SweetAlert.info('ajax'); $http.post('/revenueConf/queryPage',{pageInfo: $scope.pagingOptions}, apiConfig.createVat())
.success(function (res) {
if (res && res.list) {
$scope.pageConfDataSource = res.list;
$scope.pagingOptions.totalItems = res.pageInfo.totalCount;
}else {
SweetAlert.error($translate.instant('SystemError'));
}
})
}; };
//添加配置 //添加配置
...@@ -43,12 +63,22 @@ ...@@ -43,12 +63,22 @@
//添加配置 //添加配置
$scope.saveConfig = function () { $scope.saveConfig = function () {
SweetAlert.info('save'); $http.post('/revenueConf/add',$scope.formParam, apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
SweetAlert.success($translate.instant('RevenueAddSuccess'));
$scope.refreshConfigGrid();
$($scope.revenueConfAddDiv).modal('hide');
}else {
SweetAlert.error($translate.instant('SystemError'));
}
})
}; };
//关闭配置框 //关闭配置框
$scope.cancelModal = function () { $scope.cancelModal = function () {
$('#configForm')[0].reset(); // $('#configForm')[0].reset();
$scope.formParam = {}
}; };
//获取机构列表 //获取机构列表
...@@ -56,7 +86,7 @@ ...@@ -56,7 +86,7 @@
$http.get('/org/getMyOrgList',apiConfig.createVat()) $http.get('/org/getMyOrgList',apiConfig.createVat())
.success(function (res) { .success(function (res) {
if (res && 0 === res.code) { if (res && 0 === res.code) {
$scope.formParam.orgList = res.data; $scope.selectOrgList = res.data;
}else { }else {
SweetAlert.error($translate.instant('RevenueGetOrgError')); SweetAlert.error($translate.instant('RevenueGetOrgError'));
} }
...@@ -85,8 +115,8 @@ ...@@ -85,8 +115,8 @@
valueExpr: 'id', valueExpr: 'id',
width: '95%', width: '95%',
bindingOptions: { bindingOptions: {
value: 'formParam.selectedOrg', value: 'formParam.orgList',
dataSource: 'formParam.orgList' dataSource: 'selectOrgList'
}, },
height: '30px', height: '30px',
placeholder: '', placeholder: '',
...@@ -100,6 +130,9 @@ ...@@ -100,6 +130,9 @@
$scope.selectTaxRateOptions = { $scope.selectTaxRateOptions = {
displayExpr: 'key', displayExpr: 'key',
valueExpr: 'val', valueExpr: 'val',
bindingOptions: {
value: 'formParam.taxRate'
},
dataSource: [ dataSource: [
{'key': '0%', 'val': 0}, {'key': '0%', 'val': 0},
{'key': '1.5%', 'val': 0.015}, {'key': '1.5%', 'val': 0.015},
...@@ -115,6 +148,9 @@ ...@@ -115,6 +148,9 @@
$scope.selectTaxBaseOptions = { $scope.selectTaxBaseOptions = {
displayExpr: 'key', displayExpr: 'key',
valueExpr: 'val', valueExpr: 'val',
bindingOptions: {
value: 'formParam.taxBase'
},
dataSource: [ dataSource: [
{'key': '账载收入', 'val': 1}, {'key': '账载收入', 'val': 1},
{'key': '开票收入', 'val': 2}, {'key': '开票收入', 'val': 2},
...@@ -128,6 +164,9 @@ ...@@ -128,6 +164,9 @@
$scope.selectAccountTypeOptions = { $scope.selectAccountTypeOptions = {
displayExpr: 'key', displayExpr: 'key',
valueExpr: 'val', valueExpr: 'val',
bindingOptions: {
value: 'formParam.accountType'
},
dataSource: [ dataSource: [
{'key': '0值', 'val': 0}, {'key': '0值', 'val': 0},
{'key': '科目', 'val': 1}, {'key': '科目', 'val': 1},
...@@ -138,6 +177,9 @@ ...@@ -138,6 +177,9 @@
$scope.selectRevenueTypeOptions = { $scope.selectRevenueTypeOptions = {
displayExpr: 'key', displayExpr: 'key',
valueExpr: 'val', valueExpr: 'val',
bindingOptions: {
value: 'formParam.revenueType'
},
dataSource: [ dataSource: [
{'key': '货物及加工修理修配劳务', 'val': 0}, {'key': '货物及加工修理修配劳务', 'val': 0},
{'key': '服务、不动产和无形资产', 'val': 1}, {'key': '服务、不动产和无形资产', 'val': 1},
...@@ -147,6 +189,9 @@ ...@@ -147,6 +189,9 @@
$scope.selectTaxTypeOptions = { $scope.selectTaxTypeOptions = {
displayExpr: 'key', displayExpr: 'key',
valueExpr: 'val', valueExpr: 'val',
bindingOptions: {
value: 'formParam.taxType'
},
dataSource: [ dataSource: [
{'key': '一般计税', 'val': 0}, {'key': '一般计税', 'val': 0},
{'key': '简易计税', 'val': 1}, {'key': '简易计税', 'val': 1},
...@@ -158,6 +203,9 @@ ...@@ -158,6 +203,9 @@
$scope.selectStatusOptions = { $scope.selectStatusOptions = {
displayExpr: 'key', displayExpr: 'key',
valueExpr: 'val', valueExpr: 'val',
bindingOptions: {
value: 'formParam.status'
},
dataSource: [ dataSource: [
{'key': '启用', 'val': 0}, {'key': '启用', 'val': 0},
{'key': '停用', 'val': 1}, {'key': '停用', 'val': 1},
...@@ -168,8 +216,9 @@ ...@@ -168,8 +216,9 @@
acceptCustomValue: false, acceptCustomValue: false,
openOnFieldClick: true, openOnFieldClick: true,
displayFormat: 'yyyy-MM', displayFormat: 'yyyy-MM',
dateSerializationFormat: 'yyyy-MM',
bindingOptions: { bindingOptions: {
value: 'currentStartDate' value: 'formParam.startDate'
} }
}; };
...@@ -177,8 +226,9 @@ ...@@ -177,8 +226,9 @@
acceptCustomValue: false, acceptCustomValue: false,
openOnFieldClick: true, openOnFieldClick: true,
displayFormat: 'yyyy-MM', displayFormat: 'yyyy-MM',
dateSerializationFormat: 'yyyy-MM',
bindingOptions: { bindingOptions: {
value: 'currentEndDate' value: 'formParam.endDate'
} }
}; };
...@@ -187,6 +237,7 @@ ...@@ -187,6 +237,7 @@
function init() { function init() {
getMyOrgList(); getMyOrgList();
$scope.refreshConfigGrid();
} }
init() init()
......
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
<div class="col-sm-1"> <div class="col-sm-1">
<div dx-select-box="selectAccountTypeOptions" style="width: 90px;"></div> <div dx-select-box="selectAccountTypeOptions" style="width: 90px;"></div>
</div> </div>
<div class="col-sm-1"><input class="form-control" name="name" ng-model="formParam.segment3" ng-disabled="!isAccount" maxlength="255" placeholder="科目"></div> <div class="col-sm-1"><input class="form-control" name="name" ng-model="formParam.tbSegment3" ng-disabled="!isAccount" maxlength="255" placeholder="科目"></div>
<div class="col-sm-1"><input class="form-control" name="name" ng-model="formParam.segment5" ng-disabled="!isAccount" maxlength="255" placeholder="利润中心"></div> <div class="col-sm-1"><input class="form-control" name="name" ng-model="formParam.tbSegment5" ng-disabled="!isAccount" maxlength="255" placeholder="利润中心"></div>
<div class="col-sm-1"><input class="form-control" name="name" ng-model="formParam.segment6" ng-disabled="!isAccount" maxlength="255" placeholder="产品"></div> <div class="col-sm-1"><input class="form-control" name="name" ng-model="formParam.tbSegment6" ng-disabled="!isAccount" maxlength="255" placeholder="产品"></div>
<label class="col-sm-2 control-label"><span style="color: red">*</span>{{'RevenueColTaxRate' | translate}}:</label> <label class="col-sm-2 control-label"><span style="color: red">*</span>{{'RevenueColTaxRate' | translate}}:</label>
<div class="col-sm-4"> <div class="col-sm-4">
<div dx-select-box="selectTaxRateOptions"></div> <div dx-select-box="selectTaxRateOptions"></div>
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<div dx-select-box="selectTaxBaseOptions"></div> <div dx-select-box="selectTaxBaseOptions"></div>
</div> </div>
<div class="col-sm-2"> <div class="col-sm-2">
<input class="form-control" name="name" ng-model="formParam.taxBaseAccount" maxlength="255" placeholder="科目"> <input class="form-control" name="name" ng-model="formParam.baseCrCode" maxlength="255" placeholder="科目">
</div> </div>
<label class="col-sm-2 control-label"><span style="color: red">*</span>{{'RevenueColType' | translate}}:</label> <label class="col-sm-2 control-label"><span style="color: red">*</span>{{'RevenueColType' | translate}}:</label>
<div class="col-sm-4"> <div class="col-sm-4">
......
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