税率接口
This commit is contained in:
parent
a41d76d0ab
commit
b56a48c885
|
|
@ -4,15 +4,11 @@ import com.engine.common.biz.AbstractCommonCommand;
|
|||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.salary.biz.TaxRateBiz;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.util.DataUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import com.engine.salary.entity.taxrate.param.TaxRateSaveParam;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TaxRateSaveCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
|
|
@ -29,17 +25,9 @@ public class TaxRateSaveCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>(16);
|
||||
|
||||
|
||||
List<String> idStrs = DataUtil.castList(params.get("ids"), String.class);
|
||||
if (CollectionUtils.isEmpty(idStrs)) {
|
||||
throw new SalaryRunTimeException("参数错误");
|
||||
}
|
||||
List<Long> ids = idStrs.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
TaxRateBiz taxRateBiz = new TaxRateBiz();
|
||||
|
||||
// taxRateBiz.save();
|
||||
|
||||
TaxRateSaveParam taxRateSaveParam = (TaxRateSaveParam) params.get("taxRateSaveParam");
|
||||
taxRateBiz.save(taxRateSaveParam, (long) user.getUID());
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.engine.salary.cmd.TaxRate;
|
||||
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.salary.biz.TaxRateBiz;
|
||||
import com.engine.salary.entity.taxrate.param.TaxRateSaveParam;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TaxRateUpdateCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public TaxRateUpdateCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>(16);
|
||||
TaxRateBiz taxRateBiz = new TaxRateBiz();
|
||||
TaxRateSaveParam taxRateSaveParam = (TaxRateSaveParam) params.get("taxRateSaveParam");
|
||||
taxRateBiz.update(taxRateSaveParam, (long) user.getUID());
|
||||
return apidatas;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
package com.engine.salary.entity.taxrate;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 系统内置的税率表
|
||||
*/
|
||||
|
|
@ -52,4 +53,6 @@ public class SysTaxRateBase {
|
|||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private Collection<Long> ids;
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
package com.engine.salary.entity.taxrate;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 税率主表
|
||||
*/
|
||||
|
|
@ -52,4 +53,6 @@ public class TaxRateBase {
|
|||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private Collection<Long> ids;
|
||||
|
||||
}
|
||||
|
|
@ -7,13 +7,9 @@ import com.engine.salary.entity.taxrate.param.TaxRateBaseSaveParam;
|
|||
import com.engine.salary.entity.taxrate.param.TaxRateDetailSaveParam;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.google.common.collect.Lists;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -93,7 +89,7 @@ public class TaxRateBO {
|
|||
return null;
|
||||
}
|
||||
return TaxRateBase.builder()
|
||||
.id(IdGenerator.generate())
|
||||
// .id(IdGenerator.generate())
|
||||
.name(saveParam.getName())
|
||||
.systemType(SalarySystemTypeEnum.CUSTOM.getValue())
|
||||
.description(saveParam.getDescription())
|
||||
|
|
@ -118,7 +114,7 @@ public class TaxRateBO {
|
|||
}
|
||||
return saveParams.stream()
|
||||
.map(e -> TaxRateDetail.builder()
|
||||
.id(IdGenerator.generate())
|
||||
// .id(IdGenerator.generate())
|
||||
.baseId(taxRateBatchId)
|
||||
.indexNum(e.getIndexNum())
|
||||
.incomeUpperLimit(e.getIncomeUpperLimit())
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
--缴税人表主键自增
|
||||
alter table hrsa_tax_agent modify id bigint auto_increment;
|
||||
alter table hrsa_tax_rate_base modify id bigint auto_increment;
|
||||
alter table hrsa_tax_rate_detail modify id bigint auto_increment;
|
||||
|
|
|
|||
|
|
@ -13,4 +13,6 @@ public interface TaxRateBaseService {
|
|||
Map<String, Object> delete(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> save(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> update(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.engine.salary.service.impl;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.cmd.TaxRate.TaxRateDeleteCmd;
|
||||
import com.engine.salary.cmd.TaxRate.TaxRateListCmd;
|
||||
import com.engine.salary.cmd.TaxRate.TaxRateSaveCmd;
|
||||
import com.engine.salary.cmd.TaxRate.TaxRateUpdateCmd;
|
||||
import com.engine.salary.service.TaxRateBaseService;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -12,28 +14,24 @@ public class TaxRateBaseServiceImpl extends Service implements TaxRateBaseServic
|
|||
|
||||
@Override
|
||||
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
return commandExecutor.execute(new TaxRateListCmd(params,user));
|
||||
return commandExecutor.execute(new TaxRateListCmd(params, user));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> save(Map<String, Object> params) {
|
||||
return commandExecutor.execute(new TaxRateListCmd(params,user));
|
||||
return commandExecutor.execute(new TaxRateSaveCmd(params, user));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> update(Map<String, Object> params) {
|
||||
return commandExecutor.execute(new TaxRateUpdateCmd(params, user));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> delete(Map<String, Object> params) {
|
||||
return commandExecutor.execute(new TaxRateDeleteCmd(params,user));
|
||||
return commandExecutor.execute(new TaxRateDeleteCmd(params, user));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@ package com.engine.salary.web;
|
|||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.taxrate.param.TaxRateSaveParam;
|
||||
import com.engine.salary.service.TaxRateBaseService;
|
||||
import com.engine.salary.service.impl.TaxRateBaseServiceImpl;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -17,6 +19,7 @@ import javax.ws.rs.Path;
|
|||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
public class TaxRateController {
|
||||
|
||||
|
|
@ -43,13 +46,25 @@ public class TaxRateController {
|
|||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxRateSaveParam taxRateSaveParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ResponseResult.run(getService(user)::save, ParamUtil.request2Map(request));
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("taxRateSaveParam",taxRateSaveParam);
|
||||
return ResponseResult.run(getService(user)::save, map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新建税率表
|
||||
*/
|
||||
@POST
|
||||
@Path("/update")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String update(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxRateSaveParam taxRateSaveParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("taxRateSaveParam",taxRateSaveParam);
|
||||
return ResponseResult.run(getService(user)::update, map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除税率表
|
||||
|
|
@ -62,42 +77,6 @@ public class TaxRateController {
|
|||
return ResponseResult.run(getService(user)::delete, ParamUtil.request2Map(request));
|
||||
}
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 新建税率表
|
||||
// *
|
||||
// * @param saveParam
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("/save")
|
||||
// @ApiOperation("保存税率表")
|
||||
// @WeaPermission
|
||||
// public WeaResult<Object> saveTaxRate(@RequestBody @Validated TaxRateSaveParam saveParam) {
|
||||
// if (saveParam.getTaxRateBatch().getId() == null || saveParam.getTaxRateBatch().getId() <= 0) {
|
||||
// taxRateWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
||||
// } else {
|
||||
// taxRateWrapper.update(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
||||
// }
|
||||
// return WeaResult.success(null);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 编辑税率表
|
||||
// *
|
||||
// * @param saveParam
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("/update")
|
||||
// @ApiOperation("编辑税率表")
|
||||
// @WeaPermission
|
||||
// public WeaResult<Object> updateTaxRate(@RequestBody @Validated TaxRateSaveParam saveParam) {
|
||||
// if (Objects.isNull(saveParam.getTaxRateBatch().getId())) {
|
||||
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(99703, "参数错误,ID不允许为空"));
|
||||
// }
|
||||
// taxRateWrapper.update(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
|
||||
// return WeaResult.success(null);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue