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

modify

parent 3ce7ed2b
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.RequestMapping;
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.RevenueConfResult;
import pwc.taxtech.atms.service.impl.RevenueConfService;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
import javax.annotation.Resource;
......@@ -17,9 +21,21 @@ public class RevenueConfController extends BaseController {
@Resource
private RevenueConfService revenueConfService;
@GetMapping
public PagingResultDto queryPage(@RequestBody RevenueConfParam param) {
return null;
@PostMapping("queryPage")
public CamelPagingResultDto<RevenueConfResult> queryPage(@RequestBody RevenueConfParam param) {
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;
import com.alibaba.fastjson.annotation.JSONField;
import com.github.pagehelper.PageInfo;
import java.util.List;
public class CamelPagingResultDto<T> {
@JSONField(name = "List")
private List<T> list;
@JSONField(name = "PageInfo")
private CamelPagingDto pageInfo;
private T calculateData;
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() {
......
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;
import pwc.taxtech.atms.dpo.PagingDto;
import pwc.taxtech.atms.dto.input.CamelPagingDto;
import pwc.taxtech.atms.vat.entity.RevenueConfig;
public class RevenueConfParam extends RevenueConfig {
private PagingDto pageInfo;
private CamelPagingDto pageInfo;
public PagingDto getPageInfo() {
public CamelPagingDto getPageInfo() {
return this.pageInfo;
}
public void setPageInfo(PagingDto pageInfo) {
public void setPageInfo(CamelPagingDto 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;
public class ServiceException extends Exception {
public class ServiceException extends RuntimeException {
public ServiceException() {
}
......
package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
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.RevenueConfResult;
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 java.util.List;
import java.util.stream.Collectors;
@Service
public class RevenueConfService extends BaseService {
@Resource
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 @@
"RevenueColEdit": "编辑",
"RevenueNoOrgData": "没有机构权限",
"RevenueGetOrgError": "获取机构信息失败",
"RevenueAddSuccess": "添加成功",
"RevenueUpdateSuccess": "更新成功",
"~MustBeEndOneApp": "我必须是最后一个!"
}
\ No newline at end of file
......@@ -6,29 +6,49 @@
//表格配置
$scope.revenueGridOptions = $.extend(true, {}, dxDataGridService.BASIC_GRID_OPTIONS, {
columns: [
{dataField: 'statusString', caption: $translate.instant('RevenueColSerialNo'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColName'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColOrg'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColAccountName'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColTaxRate'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColTaxBase'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColType'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColTaxType'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColStatus'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColEnable'), fixed: true, allowHeaderFiltering: true},
{dataField: 'statusString', caption: $translate.instant('RevenueColDisable'), fixed: true, allowHeaderFiltering: true},
// {dataField: 'serialNo', caption: $translate.instant('RevenueColSerialNo'), fixed: true, allowHeaderFiltering: true},
{dataField: 'name', caption: $translate.instant('RevenueColName'), fixed: true, allowHeaderFiltering: true},
{dataField: 'orgId', caption: $translate.instant('RevenueColOrg'), fixed: true, allowHeaderFiltering: true,
calculateCellValue: function(data) {
return _.find($scope.selectOrgList, function(o) {
return o.id === data.orgId;
}).name;
}},
//todo 组装accountName
{dataField: 'accountTypeStr', caption: $translate.instant('RevenueColAccountName'), 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},
],
dataSource: new DevExpress.data.CustomStore({
load: function (loadOptions) {
return [{"statusString":"test"},{"statusString":"test2"}];
}
}),
bindingOptions: {
dataSource: 'pageConfDataSource',
},
selection: {
mode: 'multiple',
showCheckBoxesMode: 'always',
allowSelectAll: true
}
});
//刷新页面
$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 @@
//添加配置
$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 () {
$('#configForm')[0].reset();
// $('#configForm')[0].reset();
$scope.formParam = {}
};
//获取机构列表
......@@ -56,7 +86,7 @@
$http.get('/org/getMyOrgList',apiConfig.createVat())
.success(function (res) {
if (res && 0 === res.code) {
$scope.formParam.orgList = res.data;
$scope.selectOrgList = res.data;
}else {
SweetAlert.error($translate.instant('RevenueGetOrgError'));
}
......@@ -85,8 +115,8 @@
valueExpr: 'id',
width: '95%',
bindingOptions: {
value: 'formParam.selectedOrg',
dataSource: 'formParam.orgList'
value: 'formParam.orgList',
dataSource: 'selectOrgList'
},
height: '30px',
placeholder: '',
......@@ -100,6 +130,9 @@
$scope.selectTaxRateOptions = {
displayExpr: 'key',
valueExpr: 'val',
bindingOptions: {
value: 'formParam.taxRate'
},
dataSource: [
{'key': '0%', 'val': 0},
{'key': '1.5%', 'val': 0.015},
......@@ -115,6 +148,9 @@
$scope.selectTaxBaseOptions = {
displayExpr: 'key',
valueExpr: 'val',
bindingOptions: {
value: 'formParam.taxBase'
},
dataSource: [
{'key': '账载收入', 'val': 1},
{'key': '开票收入', 'val': 2},
......@@ -128,6 +164,9 @@
$scope.selectAccountTypeOptions = {
displayExpr: 'key',
valueExpr: 'val',
bindingOptions: {
value: 'formParam.accountType'
},
dataSource: [
{'key': '0值', 'val': 0},
{'key': '科目', 'val': 1},
......@@ -138,6 +177,9 @@
$scope.selectRevenueTypeOptions = {
displayExpr: 'key',
valueExpr: 'val',
bindingOptions: {
value: 'formParam.revenueType'
},
dataSource: [
{'key': '货物及加工修理修配劳务', 'val': 0},
{'key': '服务、不动产和无形资产', 'val': 1},
......@@ -147,6 +189,9 @@
$scope.selectTaxTypeOptions = {
displayExpr: 'key',
valueExpr: 'val',
bindingOptions: {
value: 'formParam.taxType'
},
dataSource: [
{'key': '一般计税', 'val': 0},
{'key': '简易计税', 'val': 1},
......@@ -158,6 +203,9 @@
$scope.selectStatusOptions = {
displayExpr: 'key',
valueExpr: 'val',
bindingOptions: {
value: 'formParam.status'
},
dataSource: [
{'key': '启用', 'val': 0},
{'key': '停用', 'val': 1},
......@@ -168,8 +216,9 @@
acceptCustomValue: false,
openOnFieldClick: true,
displayFormat: 'yyyy-MM',
dateSerializationFormat: 'yyyy-MM',
bindingOptions: {
value: 'currentStartDate'
value: 'formParam.startDate'
}
};
......@@ -177,8 +226,9 @@
acceptCustomValue: false,
openOnFieldClick: true,
displayFormat: 'yyyy-MM',
dateSerializationFormat: 'yyyy-MM',
bindingOptions: {
value: 'currentEndDate'
value: 'formParam.endDate'
}
};
......@@ -187,6 +237,7 @@
function init() {
getMyOrgList();
$scope.refreshConfigGrid();
}
init()
......
......@@ -49,9 +49,9 @@
<div class="col-sm-1">
<div dx-select-box="selectAccountTypeOptions" style="width: 90px;"></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.segment5" 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.tbSegment3" 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.tbSegment6" ng-disabled="!isAccount" maxlength="255" placeholder="产品"></div>
<label class="col-sm-2 control-label"><span style="color: red">*</span>{{'RevenueColTaxRate' | translate}}:</label>
<div class="col-sm-4">
<div dx-select-box="selectTaxRateOptions"></div>
......@@ -63,7 +63,7 @@
<div dx-select-box="selectTaxBaseOptions"></div>
</div>
<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>
<label class="col-sm-2 control-label"><span style="color: red">*</span>{{'RevenueColType' | translate}}:</label>
<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