Showing
11 changed files
with
346 additions
and
14 deletions
| @@ -958,3 +958,19 @@ create table if not exists customer_visit_record( | @@ -958,3 +958,19 @@ create table if not exists customer_visit_record( | ||
| 958 | create_time datetime default now() comment '创建时间', | 958 | create_time datetime default now() comment '创建时间', |
| 959 | update_time datetime default now() comment '更新时间' | 959 | update_time datetime default now() comment '更新时间' |
| 960 | ); | 960 | ); |
| 961 | + | ||
| 962 | +CREATE TABLE `tbl_recapitalize` ( | ||
| 963 | + `id` varchar(32) NOT NULL COMMENT 'ID', | ||
| 964 | + `recapitalize_date` date DEFAULT NULL COMMENT '资金回笼日期', | ||
| 965 | + `ordering_unit` varchar(100) DEFAULT NULL COMMENT '订货单位ID', | ||
| 966 | + `returned_amount` decimal(15,4) DEFAULT NULL COMMENT '回笼金额', | ||
| 967 | + `dept_id` varchar(32) DEFAULT NULL COMMENT '办事处ID', | ||
| 968 | + `factory_type` varchar(50) DEFAULT NULL COMMENT '厂别', | ||
| 969 | + `create_by_id` varchar(32) NOT NULL COMMENT '创建人ID', | ||
| 970 | + `create_by` varchar(20) NOT NULL COMMENT '创建人', | ||
| 971 | + `update_by_id` varchar(32) NOT NULL COMMENT '更新人ID', | ||
| 972 | + `update_by` varchar(20) NOT NULL COMMENT '更新人', | ||
| 973 | + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 974 | + `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 975 | + PRIMARY KEY (`id`) | ||
| 976 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='回笼资金表' |
| @@ -7,7 +7,6 @@ import com.lframework.starter.common.constants.StringPool; | @@ -7,7 +7,6 @@ import com.lframework.starter.common.constants.StringPool; | ||
| 7 | import com.lframework.starter.web.core.bo.BaseBo; | 7 | import com.lframework.starter.web.core.bo.BaseBo; |
| 8 | import java.time.LocalDate; | 8 | import java.time.LocalDate; |
| 9 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
| 10 | -import com.lframework.starter.web.core.components.validation.TypeMismatch; | ||
| 11 | import io.swagger.annotations.ApiModelProperty; | 10 | import io.swagger.annotations.ApiModelProperty; |
| 12 | 11 | ||
| 13 | import lombok.Data; | 12 | import lombok.Data; |
| @@ -27,6 +26,9 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { | @@ -27,6 +26,9 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { | ||
| 27 | @ApiModelProperty("ID") | 26 | @ApiModelProperty("ID") |
| 28 | private String id; | 27 | private String id; |
| 29 | 28 | ||
| 29 | + @ApiModelProperty("父ID") | ||
| 30 | + private String parentId; | ||
| 31 | + | ||
| 30 | /** | 32 | /** |
| 31 | * 客户简称ID | 33 | * 客户简称ID |
| 32 | */ | 34 | */ |
| @@ -187,6 +189,12 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { | @@ -187,6 +189,12 @@ public class GetReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { | ||
| 187 | private Integer delFlag; | 189 | private Integer delFlag; |
| 188 | 190 | ||
| 189 | /** | 191 | /** |
| 192 | + * 是否拆分 | ||
| 193 | + */ | ||
| 194 | + @ApiModelProperty("是否拆分") | ||
| 195 | + private boolean spilt; | ||
| 196 | + | ||
| 197 | + /** | ||
| 190 | * 创建人ID | 198 | * 创建人ID |
| 191 | */ | 199 | */ |
| 192 | @ApiModelProperty("创建人ID") | 200 | @ApiModelProperty("创建人ID") |
| @@ -7,7 +7,6 @@ import com.lframework.starter.common.constants.StringPool; | @@ -7,7 +7,6 @@ import com.lframework.starter.common.constants.StringPool; | ||
| 7 | import com.lframework.starter.web.core.bo.BaseBo; | 7 | import com.lframework.starter.web.core.bo.BaseBo; |
| 8 | import java.time.LocalDate; | 8 | import java.time.LocalDate; |
| 9 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
| 10 | -import com.lframework.starter.web.core.components.validation.TypeMismatch; | ||
| 11 | import io.swagger.annotations.ApiModelProperty; | 10 | import io.swagger.annotations.ApiModelProperty; |
| 12 | 11 | ||
| 13 | import lombok.Data; | 12 | import lombok.Data; |
| @@ -27,6 +26,9 @@ public class QueryReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { | @@ -27,6 +26,9 @@ public class QueryReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { | ||
| 27 | @ApiModelProperty("ID") | 26 | @ApiModelProperty("ID") |
| 28 | private String id; | 27 | private String id; |
| 29 | 28 | ||
| 29 | + @ApiModelProperty("父ID") | ||
| 30 | + private String parentId; | ||
| 31 | + | ||
| 30 | /** | 32 | /** |
| 31 | * 客户简称ID | 33 | * 客户简称ID |
| 32 | */ | 34 | */ |
| @@ -181,6 +183,12 @@ public class QueryReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { | @@ -181,6 +183,12 @@ public class QueryReceiptLedgerInfoBo extends BaseBo<ReceiptLedgerInfo> { | ||
| 181 | private String description; | 183 | private String description; |
| 182 | 184 | ||
| 183 | /** | 185 | /** |
| 186 | + * 是否拆分 | ||
| 187 | + */ | ||
| 188 | + @ApiModelProperty("是否拆分") | ||
| 189 | + private boolean spilt; | ||
| 190 | + | ||
| 191 | + /** | ||
| 184 | * 创建人ID | 192 | * 创建人ID |
| 185 | */ | 193 | */ |
| 186 | @ApiModelProperty("创建人ID") | 194 | @ApiModelProperty("创建人ID") |
| @@ -11,6 +11,7 @@ import com.lframework.starter.web.core.utils.PageResultUtil; | @@ -11,6 +11,7 @@ import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 11 | import javax.annotation.Resource; | 11 | import javax.annotation.Resource; |
| 12 | import javax.validation.constraints.NotBlank; | 12 | import javax.validation.constraints.NotBlank; |
| 13 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; | 13 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; |
| 14 | +import com.lframework.xingyun.sc.vo.ledger.receipt.ReceiptLedgerInfoSplitVo; | ||
| 14 | import com.lframework.xingyun.sc.vo.ledger.receipt.UpdateReceiptLedgerInfoVo; | 15 | import com.lframework.xingyun.sc.vo.ledger.receipt.UpdateReceiptLedgerInfoVo; |
| 15 | import io.swagger.annotations.ApiOperation; | 16 | import io.swagger.annotations.ApiOperation; |
| 16 | import com.lframework.starter.common.utils.CollectionUtil; | 17 | import com.lframework.starter.common.utils.CollectionUtil; |
| @@ -38,19 +39,14 @@ import java.util.stream.Collectors; | @@ -38,19 +39,14 @@ import java.util.stream.Collectors; | ||
| 38 | @RestController | 39 | @RestController |
| 39 | @RequestMapping("/ledger/receipt") | 40 | @RequestMapping("/ledger/receipt") |
| 40 | public class ReceiptLedgerInfoController extends DefaultBaseController { | 41 | public class ReceiptLedgerInfoController extends DefaultBaseController { |
| 41 | - | ||
| 42 | - | ||
| 43 | - | ||
| 44 | @Resource | 42 | @Resource |
| 45 | private ReceiptLedgerInfoService receiptLedgerInfoService; | 43 | private ReceiptLedgerInfoService receiptLedgerInfoService; |
| 46 | 44 | ||
| 47 | - | ||
| 48 | - | ||
| 49 | /** | 45 | /** |
| 50 | * 查询列表 | 46 | * 查询列表 |
| 51 | */ | 47 | */ |
| 52 | @ApiOperation("查询列表") | 48 | @ApiOperation("查询列表") |
| 53 | - @HasPermission({"ledger:receipt:query"}) | 49 | + @HasPermission({"account-manage:ledger-detail:query"}) |
| 54 | @GetMapping("/query") | 50 | @GetMapping("/query") |
| 55 | public InvokeResult<PageResult<QueryReceiptLedgerInfoBo>> query(@Valid QueryReceiptLedgerInfoVo vo) { | 51 | public InvokeResult<PageResult<QueryReceiptLedgerInfoBo>> query(@Valid QueryReceiptLedgerInfoVo vo) { |
| 56 | PageResult<ReceiptLedgerInfo> pageResult = receiptLedgerInfoService.query(getPageIndex(vo), getPageSize(vo), vo); | 52 | PageResult<ReceiptLedgerInfo> pageResult = receiptLedgerInfoService.query(getPageIndex(vo), getPageSize(vo), vo); |
| @@ -68,7 +64,7 @@ public class ReceiptLedgerInfoController extends DefaultBaseController { | @@ -68,7 +64,7 @@ public class ReceiptLedgerInfoController extends DefaultBaseController { | ||
| 68 | */ | 64 | */ |
| 69 | @ApiOperation("根据ID查询") | 65 | @ApiOperation("根据ID查询") |
| 70 | @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | 66 | @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) |
| 71 | - @HasPermission({"ledger:receipt:query"}) | 67 | + @HasPermission({"account-manage:ledger-detail:query"}) |
| 72 | @GetMapping | 68 | @GetMapping |
| 73 | public InvokeResult<GetReceiptLedgerInfoBo> get(@NotBlank(message = "id不能为空!") String id) { | 69 | public InvokeResult<GetReceiptLedgerInfoBo> get(@NotBlank(message = "id不能为空!") String id) { |
| 74 | ReceiptLedgerInfo data = receiptLedgerInfoService.findById(id); | 70 | ReceiptLedgerInfo data = receiptLedgerInfoService.findById(id); |
| @@ -84,19 +80,43 @@ public class ReceiptLedgerInfoController extends DefaultBaseController { | @@ -84,19 +80,43 @@ public class ReceiptLedgerInfoController extends DefaultBaseController { | ||
| 84 | * 新增 | 80 | * 新增 |
| 85 | */ | 81 | */ |
| 86 | @ApiOperation("新增") | 82 | @ApiOperation("新增") |
| 87 | - @HasPermission({"ledger:receipt:add"}) | 83 | + @HasPermission({"account-manage:ledger-detail:add"}) |
| 88 | @PostMapping | 84 | @PostMapping |
| 89 | - public InvokeResult<Void> create(@Valid CreateReceiptLedgerInfoVo vo) { | 85 | + public InvokeResult<Void> create(@Valid @RequestBody CreateReceiptLedgerInfoVo vo) { |
| 90 | receiptLedgerInfoService.create(vo); | 86 | receiptLedgerInfoService.create(vo); |
| 91 | return InvokeResultBuilder.success(); | 87 | return InvokeResultBuilder.success(); |
| 92 | } | 88 | } |
| 93 | 89 | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 编辑 | ||
| 93 | + */ | ||
| 94 | + @ApiOperation("编辑") | ||
| 95 | + @HasPermission({"account-manage:ledger-detail:modify"}) | ||
| 96 | + @PutMapping | ||
| 97 | + public InvokeResult<Void> update(@Valid @RequestBody UpdateReceiptLedgerInfoVo vo) { | ||
| 98 | + receiptLedgerInfoService.update(vo); | ||
| 99 | + return InvokeResultBuilder.success(); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 拆分 | ||
| 105 | + */ | ||
| 106 | + @ApiOperation("拆分") | ||
| 107 | + @HasPermission({"account-manage:ledger-detail:split"}) | ||
| 108 | + @PostMapping("/split") | ||
| 109 | + public InvokeResult<Void> split(@Valid @RequestBody ReceiptLedgerInfoSplitVo vo) { | ||
| 110 | + receiptLedgerInfoService.split(vo); | ||
| 111 | + return InvokeResultBuilder.success(); | ||
| 112 | + } | ||
| 113 | + | ||
| 94 | /** | 114 | /** |
| 95 | * 根据ID删除 | 115 | * 根据ID删除 |
| 96 | */ | 116 | */ |
| 97 | @ApiOperation("根据ID删除") | 117 | @ApiOperation("根据ID删除") |
| 98 | @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | 118 | @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) |
| 99 | - @HasPermission({"ledger:receipt:delete"}) | 119 | + @HasPermission({"account-manage:ledger-detail:delete"}) |
| 100 | @DeleteMapping | 120 | @DeleteMapping |
| 101 | public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { | 121 | public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { |
| 102 | receiptLedgerInfoService.deleteById(id); | 122 | receiptLedgerInfoService.deleteById(id); |
| @@ -30,6 +30,11 @@ public class ReceiptLedgerInfo extends BaseEntity implements BaseDto { | @@ -30,6 +30,11 @@ public class ReceiptLedgerInfo extends BaseEntity implements BaseDto { | ||
| 30 | private String id; | 30 | private String id; |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | + * 父ID | ||
| 34 | + */ | ||
| 35 | + private String parentId; | ||
| 36 | + | ||
| 37 | + /** | ||
| 33 | * 客户简称ID | 38 | * 客户简称ID |
| 34 | */ | 39 | */ |
| 35 | private String customerShortId; | 40 | private String customerShortId; |
| @@ -191,6 +196,11 @@ public class ReceiptLedgerInfo extends BaseEntity implements BaseDto { | @@ -191,6 +196,11 @@ public class ReceiptLedgerInfo extends BaseEntity implements BaseDto { | ||
| 191 | private Integer delFlag; | 196 | private Integer delFlag; |
| 192 | 197 | ||
| 193 | /** | 198 | /** |
| 199 | + * 是否拆分 | ||
| 200 | + */ | ||
| 201 | + private boolean spilt; | ||
| 202 | + | ||
| 203 | + /** | ||
| 194 | * 创建人ID | 204 | * 创建人ID |
| 195 | */ | 205 | */ |
| 196 | @TableField(fill = FieldFill.INSERT) | 206 | @TableField(fill = FieldFill.INSERT) |
| 1 | package com.lframework.xingyun.sc.impl.ledger; | 1 | package com.lframework.xingyun.sc.impl.ledger; |
| 2 | 2 | ||
| 3 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
| 3 | import com.github.pagehelper.PageInfo; | 5 | import com.github.pagehelper.PageInfo; |
| 6 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | ||
| 7 | +import com.lframework.starter.common.utils.ObjectUtil; | ||
| 8 | +import com.lframework.starter.common.utils.StringUtil; | ||
| 9 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | ||
| 4 | import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo; | 10 | import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo; |
| 5 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | 11 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 6 | import com.lframework.starter.web.core.utils.PageResultUtil; | 12 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| @@ -11,6 +17,9 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; | @@ -11,6 +17,9 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 11 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | 17 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 12 | import com.lframework.starter.web.core.components.resp.PageResult; | 18 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 13 | import com.lframework.starter.common.utils.Assert; | 19 | import com.lframework.starter.common.utils.Assert; |
| 20 | +import com.lframework.xingyun.sc.utils.CommonUtil; | ||
| 21 | +import com.lframework.xingyun.sc.vo.ledger.receipt.ReceiptLedgerInfoSplitVo; | ||
| 22 | +import com.lframework.xingyun.sc.vo.ledger.receipt.UpdateReceiptLedgerInfoVo; | ||
| 14 | import org.springframework.transaction.annotation.Transactional; | 23 | import org.springframework.transaction.annotation.Transactional; |
| 15 | import com.lframework.xingyun.sc.mappers.ReceiptLedgerInfoMapper; | 24 | import com.lframework.xingyun.sc.mappers.ReceiptLedgerInfoMapper; |
| 16 | import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService; | 25 | import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService; |
| @@ -18,6 +27,8 @@ import com.lframework.xingyun.sc.vo.ledger.receipt.CreateReceiptLedgerInfoVo; | @@ -18,6 +27,8 @@ import com.lframework.xingyun.sc.vo.ledger.receipt.CreateReceiptLedgerInfoVo; | ||
| 18 | import com.lframework.xingyun.sc.vo.ledger.receipt.QueryReceiptLedgerInfoVo; | 27 | import com.lframework.xingyun.sc.vo.ledger.receipt.QueryReceiptLedgerInfoVo; |
| 19 | import org.springframework.stereotype.Service; | 28 | import org.springframework.stereotype.Service; |
| 20 | 29 | ||
| 30 | +import java.math.BigDecimal; | ||
| 31 | +import java.util.ArrayList; | ||
| 21 | import java.util.List; | 32 | import java.util.List; |
| 22 | 33 | ||
| 23 | @Service | 34 | @Service |
| @@ -53,6 +64,7 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge | @@ -53,6 +64,7 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge | ||
| 53 | public String create(CreateReceiptLedgerInfoVo vo) { | 64 | public String create(CreateReceiptLedgerInfoVo vo) { |
| 54 | ReceiptLedgerInfo data = new ReceiptLedgerInfo(); | 65 | ReceiptLedgerInfo data = new ReceiptLedgerInfo(); |
| 55 | data.setId(IdUtil.getId()); | 66 | data.setId(IdUtil.getId()); |
| 67 | + data.setParentId(vo.getParentId()); | ||
| 56 | data.setCustomerShortId(vo.getCustomerShortId()); | 68 | data.setCustomerShortId(vo.getCustomerShortId()); |
| 57 | data.setQuota(vo.getQuota()); | 69 | data.setQuota(vo.getQuota()); |
| 58 | data.setSettleTerm(vo.getSettleTerm()); | 70 | data.setSettleTerm(vo.getSettleTerm()); |
| @@ -77,7 +89,7 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge | @@ -77,7 +89,7 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge | ||
| 77 | data.setFourthCoordinateDate(vo.getFourthCoordinateDate()); | 89 | data.setFourthCoordinateDate(vo.getFourthCoordinateDate()); |
| 78 | data.setFifthCoordinateDate(vo.getFifthCoordinateDate()); | 90 | data.setFifthCoordinateDate(vo.getFifthCoordinateDate()); |
| 79 | data.setDescription(vo.getDescription()); | 91 | data.setDescription(vo.getDescription()); |
| 80 | - | 92 | + data.setSpilt(vo.isSpilt()); |
| 81 | getBaseMapper().insert(data); | 93 | getBaseMapper().insert(data); |
| 82 | 94 | ||
| 83 | OpLogUtil.setVariable("id", data.getId()); | 95 | OpLogUtil.setVariable("id", data.getId()); |
| @@ -86,6 +98,115 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge | @@ -86,6 +98,115 @@ public class ReceiptLedgerInfoServiceImpl extends BaseMpServiceImpl<ReceiptLedge | ||
| 86 | return data.getId(); | 98 | return data.getId(); |
| 87 | } | 99 | } |
| 88 | 100 | ||
| 101 | + @OpLog(type = OtherOpLogType.class, name = "修改应收款台账明细,ID:{}", params = {"#id"}) | ||
| 102 | + @Transactional(rollbackFor = Exception.class) | ||
| 103 | + @Override | ||
| 104 | + public void update(UpdateReceiptLedgerInfoVo vo) { | ||
| 105 | + ReceiptLedgerInfo data = getBaseMapper().selectById(vo.getId()); | ||
| 106 | + if (ObjectUtil.isNull(data)) { | ||
| 107 | + throw new DefaultClientException("应收款台账明细不存在!"); | ||
| 108 | + } | ||
| 109 | + LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class) | ||
| 110 | + .set(ReceiptLedgerInfo::getDescription, StringUtil.isBlank(vo.getDescription()) ? null : vo.getDescription()) | ||
| 111 | + .set(ReceiptLedgerInfo::getProcessedDate, vo.getProcessedDate() == null ? null : vo.getProcessedDate()) | ||
| 112 | + .set(ReceiptLedgerInfo::getRemark, StringUtil.isBlank(vo.getRemark()) ? null : vo.getRemark()) | ||
| 113 | + .eq(ReceiptLedgerInfo::getId, vo.getId()); | ||
| 114 | + | ||
| 115 | + getBaseMapper().update(updateWrapper); | ||
| 116 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 117 | + OpLogUtil.setExtra(vo); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @OpLog(type = OtherOpLogType.class, name = "逻辑删除应收款台账明细,ID:{}", params = {"#id"}) | ||
| 121 | + @Transactional(rollbackFor = Exception.class) | ||
| 122 | + @Override | ||
| 123 | + public void logicalDelete(String id) { | ||
| 124 | + ReceiptLedgerInfo data = getBaseMapper().selectById(id); | ||
| 125 | + if (ObjectUtil.isNull(data)) { | ||
| 126 | + throw new DefaultClientException("应收款台账明细不存在!"); | ||
| 127 | + } | ||
| 128 | + LambdaUpdateWrapper<ReceiptLedgerInfo> updateWrapper = Wrappers.lambdaUpdate(ReceiptLedgerInfo.class) | ||
| 129 | + .set(ReceiptLedgerInfo::getDelFlag, 1) | ||
| 130 | + .eq(ReceiptLedgerInfo::getId, id); | ||
| 131 | + | ||
| 132 | + getBaseMapper().update(updateWrapper); | ||
| 133 | + OpLogUtil.setVariable("id", data.getId()); | ||
| 134 | + OpLogUtil.setExtra(id); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * 拆分 | ||
| 139 | + * | ||
| 140 | + * @param vo 条件 | ||
| 141 | + */ | ||
| 142 | + @Override | ||
| 143 | + @Transactional(rollbackFor = Exception.class) | ||
| 144 | + public void split(ReceiptLedgerInfoSplitVo vo) { | ||
| 145 | + String id = vo.getId(); | ||
| 146 | + ReceiptLedgerInfo receiptLedgerInfo = findById(id); | ||
| 147 | + if (receiptLedgerInfo == null) { | ||
| 148 | + throw new DefaultClientException("应收款台账明细不存在!"); | ||
| 149 | + } | ||
| 150 | + // 判断拆分后总数量是否变化 | ||
| 151 | + List<BigDecimal> splitQuantityList = vo.getSplitQuantityList(); | ||
| 152 | + boolean match = CommonUtil.isQuantityMatchWithScale(splitQuantityList, receiptLedgerInfo.getStartAccountReceivable(), 4); | ||
| 153 | + if (!match) { | ||
| 154 | + throw new DefaultClientException("拆分金额总和必须等于原先期初应收账款金额!"); | ||
| 155 | + } | ||
| 156 | + // 封装数据 | ||
| 157 | + List<ReceiptLedgerInfo> detailList = new ArrayList<>(); | ||
| 158 | + for (BigDecimal quantity : splitQuantityList) { | ||
| 159 | + ReceiptLedgerInfo data = getReceiptLedgerInfo(quantity, receiptLedgerInfo); | ||
| 160 | + detailList.add(data); | ||
| 161 | + } | ||
| 162 | + getBaseMapper().batchAdd(detailList); | ||
| 163 | + //删除应收款台账明细(逻辑删除) | ||
| 164 | + logicalDelete(id); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * 封装应收款台账明细数据 | ||
| 170 | + * | ||
| 171 | + * @param quantity 数量 | ||
| 172 | + * @param vo 原数据 | ||
| 173 | + * @return ReceiptLedgerInfo | ||
| 174 | + */ | ||
| 175 | + private static ReceiptLedgerInfo getReceiptLedgerInfo(BigDecimal quantity, ReceiptLedgerInfo vo) { | ||
| 176 | + String userId = SecurityUtil.getCurrentUser().getId(); | ||
| 177 | + ReceiptLedgerInfo data = new ReceiptLedgerInfo(); | ||
| 178 | + data.setId(IdUtil.getId()); | ||
| 179 | + data.setParentId(vo.getId()); | ||
| 180 | + data.setCustomerShortId(vo.getCustomerShortId()); | ||
| 181 | + data.setQuota(vo.getQuota()); | ||
| 182 | + data.setSettleTerm(vo.getSettleTerm()); | ||
| 183 | + data.setDeptId(vo.getDeptId()); | ||
| 184 | + data.setRegion(vo.getRegion()); | ||
| 185 | + data.setStockUpCompanyId(vo.getStockUpCompanyId()); | ||
| 186 | + data.setCustomerId(vo.getCustomerId()); | ||
| 187 | + data.setFactoryType(vo.getFactoryType()); | ||
| 188 | + data.setShipmentDate(vo.getShipmentDate()); | ||
| 189 | + data.setStartAccountReceivable(quantity); | ||
| 190 | + data.setArrivalDate(vo.getArrivalDate()); | ||
| 191 | + data.setProcessedDate(vo.getProcessedDate()); | ||
| 192 | + data.setActualReturnedDate(vo.getActualReturnedDate()); | ||
| 193 | + data.setReturnedAmount(vo.getReturnedAmount()); | ||
| 194 | + data.setActualReturnedAmount(vo.getActualReturnedAmount()); | ||
| 195 | + data.setEndAccountReceivable(vo.getEndAccountReceivable()); | ||
| 196 | + data.setApplyStatus(vo.getApplyStatus()); | ||
| 197 | + data.setCoordinateDate(vo.getCoordinateDate()); | ||
| 198 | + data.setRemark(vo.getRemark()); | ||
| 199 | + data.setSecondCoordinateDate(vo.getSecondCoordinateDate()); | ||
| 200 | + data.setThirdCoordinateDate(vo.getThirdCoordinateDate()); | ||
| 201 | + data.setFourthCoordinateDate(vo.getFourthCoordinateDate()); | ||
| 202 | + data.setFifthCoordinateDate(vo.getFifthCoordinateDate()); | ||
| 203 | + data.setDescription(vo.getDescription()); | ||
| 204 | + data.setSpilt(true); | ||
| 205 | + data.setCreateById(userId); | ||
| 206 | + data.setUpdateById(userId); | ||
| 207 | + return data; | ||
| 208 | + } | ||
| 209 | + | ||
| 89 | @OpLog(type = OtherOpLogType.class, name = "删除应收款台账明细,ID:{}", params = {"#id"}) | 210 | @OpLog(type = OtherOpLogType.class, name = "删除应收款台账明细,ID:{}", params = {"#id"}) |
| 90 | @Transactional(rollbackFor = Exception.class) | 211 | @Transactional(rollbackFor = Exception.class) |
| 91 | @Override | 212 | @Override |
| @@ -22,4 +22,12 @@ public interface ReceiptLedgerInfoMapper extends BaseMapper<ReceiptLedgerInfo> { | @@ -22,4 +22,12 @@ public interface ReceiptLedgerInfoMapper extends BaseMapper<ReceiptLedgerInfo> { | ||
| 22 | * @return List<ReceiptLedgerInfo> | 22 | * @return List<ReceiptLedgerInfo> |
| 23 | */ | 23 | */ |
| 24 | List<ReceiptLedgerInfo> query(@Param("vo") QueryReceiptLedgerInfoVo vo); | 24 | List<ReceiptLedgerInfo> query(@Param("vo") QueryReceiptLedgerInfoVo vo); |
| 25 | + | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 批量新增 | ||
| 29 | + * | ||
| 30 | + * @param dataList 数据实体 | ||
| 31 | + */ | ||
| 32 | + void batchAdd(List<ReceiptLedgerInfo> dataList); | ||
| 25 | } | 33 | } |
| @@ -5,6 +5,8 @@ import com.lframework.xingyun.sc.vo.ledger.receipt.QueryReceiptLedgerInfoVo; | @@ -5,6 +5,8 @@ import com.lframework.xingyun.sc.vo.ledger.receipt.QueryReceiptLedgerInfoVo; | ||
| 5 | import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo; | 5 | import com.lframework.xingyun.sc.entity.ReceiptLedgerInfo; |
| 6 | import com.lframework.starter.web.core.service.BaseMpService; | 6 | import com.lframework.starter.web.core.service.BaseMpService; |
| 7 | import com.lframework.starter.web.core.components.resp.PageResult; | 7 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 8 | +import com.lframework.xingyun.sc.vo.ledger.receipt.ReceiptLedgerInfoSplitVo; | ||
| 9 | +import com.lframework.xingyun.sc.vo.ledger.receipt.UpdateReceiptLedgerInfoVo; | ||
| 8 | import java.util.List; | 10 | import java.util.List; |
| 9 | 11 | ||
| 10 | /** | 12 | /** |
| @@ -43,6 +45,26 @@ public interface ReceiptLedgerInfoService extends BaseMpService<ReceiptLedgerInf | @@ -43,6 +45,26 @@ public interface ReceiptLedgerInfoService extends BaseMpService<ReceiptLedgerInf | ||
| 43 | */ | 45 | */ |
| 44 | String create(CreateReceiptLedgerInfoVo vo); | 46 | String create(CreateReceiptLedgerInfoVo vo); |
| 45 | 47 | ||
| 48 | + /** | ||
| 49 | + * 更新 | ||
| 50 | + * | ||
| 51 | + * @param vo 数据实体 | ||
| 52 | + */ | ||
| 53 | + void update(UpdateReceiptLedgerInfoVo vo); | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 逻辑删除 | ||
| 57 | + * | ||
| 58 | + * @param id 主键 | ||
| 59 | + */ | ||
| 60 | + void logicalDelete(String id); | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 拆分 | ||
| 64 | + * | ||
| 65 | + * @param vo 数据实体 | ||
| 66 | + */ | ||
| 67 | + void split(ReceiptLedgerInfoSplitVo vo); | ||
| 46 | 68 | ||
| 47 | /** | 69 | /** |
| 48 | * 根据ID删除 | 70 | * 根据ID删除 |
| @@ -4,7 +4,6 @@ import com.lframework.starter.web.core.components.validation.IsNumberPrecision; | @@ -4,7 +4,6 @@ import com.lframework.starter.web.core.components.validation.IsNumberPrecision; | ||
| 4 | import java.math.BigDecimal; | 4 | import java.math.BigDecimal; |
| 5 | import javax.validation.constraints.NotBlank; | 5 | import javax.validation.constraints.NotBlank; |
| 6 | import java.time.LocalDate; | 6 | import java.time.LocalDate; |
| 7 | -import com.lframework.starter.web.core.utils.IdUtil; | ||
| 8 | import com.lframework.starter.web.core.vo.BaseVo; | 7 | import com.lframework.starter.web.core.vo.BaseVo; |
| 9 | import javax.validation.constraints.NotNull; | 8 | import javax.validation.constraints.NotNull; |
| 10 | import io.swagger.annotations.ApiModelProperty; | 9 | import io.swagger.annotations.ApiModelProperty; |
| @@ -18,6 +17,10 @@ public class CreateReceiptLedgerInfoVo implements BaseVo, Serializable { | @@ -18,6 +17,10 @@ public class CreateReceiptLedgerInfoVo implements BaseVo, Serializable { | ||
| 18 | 17 | ||
| 19 | private static final long serialVersionUID = 1L; | 18 | private static final long serialVersionUID = 1L; |
| 20 | 19 | ||
| 20 | + @ApiModelProperty("父ID") | ||
| 21 | + @Length(message = "父ID最多允许32个字符!") | ||
| 22 | + private String parentId; | ||
| 23 | + | ||
| 21 | /** | 24 | /** |
| 22 | * 客户简称ID | 25 | * 客户简称ID |
| 23 | */ | 26 | */ |
| @@ -215,4 +218,10 @@ public class CreateReceiptLedgerInfoVo implements BaseVo, Serializable { | @@ -215,4 +218,10 @@ public class CreateReceiptLedgerInfoVo implements BaseVo, Serializable { | ||
| 215 | @Length(message = "说明最多允许200个字符!") | 218 | @Length(message = "说明最多允许200个字符!") |
| 216 | private String description; | 219 | private String description; |
| 217 | 220 | ||
| 221 | + /** | ||
| 222 | + * 是否拆分 | ||
| 223 | + */ | ||
| 224 | + @ApiModelProperty("是否拆分") | ||
| 225 | + private boolean spilt; | ||
| 226 | + | ||
| 218 | } | 227 | } |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/ledger/receipt/ReceiptLedgerInfoSplitVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.vo.ledger.receipt; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | ||
| 4 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 5 | +import com.lframework.starter.web.core.vo.PageVo; | ||
| 6 | +import io.swagger.annotations.ApiModelProperty; | ||
| 7 | +import lombok.Data; | ||
| 8 | + | ||
| 9 | +import javax.validation.constraints.NotBlank; | ||
| 10 | +import javax.validation.constraints.NotEmpty; | ||
| 11 | +import java.io.Serializable; | ||
| 12 | +import java.math.BigDecimal; | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +@Data | ||
| 16 | +public class ReceiptLedgerInfoSplitVo extends PageVo implements BaseVo, Serializable { | ||
| 17 | + | ||
| 18 | + private static final long serialVersionUID = 1L; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 应收款台账明细ID | ||
| 22 | + */ | ||
| 23 | + @ApiModelProperty("应收款台账明细ID") | ||
| 24 | + @NotBlank(message = "应收款台账明细ID不能为空!") | ||
| 25 | + private String id; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 拆分金额集合 | ||
| 29 | + */ | ||
| 30 | + @ApiModelProperty("拆分金额集合") | ||
| 31 | + @NotEmpty(message = "拆分金额不能为空") | ||
| 32 | + @TypeMismatch(message = "拆分金额格式有误!") | ||
| 33 | + private List<BigDecimal> splitQuantityList; | ||
| 34 | +} |
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | 4 | ||
| 5 | <resultMap id="ReceiptLedgerInfo" type="com.lframework.xingyun.sc.entity.ReceiptLedgerInfo"> | 5 | <resultMap id="ReceiptLedgerInfo" type="com.lframework.xingyun.sc.entity.ReceiptLedgerInfo"> |
| 6 | <id column="id" property="id"/> | 6 | <id column="id" property="id"/> |
| 7 | + <result column="parent_id" property="parentId"/> | ||
| 7 | <result column="customer_short_id" property="customerShortId"/> | 8 | <result column="customer_short_id" property="customerShortId"/> |
| 8 | <result column="customer_short_name" property="customerShortName"/> | 9 | <result column="customer_short_name" property="customerShortName"/> |
| 9 | <result column="customer_type" property="customerType"/> | 10 | <result column="customer_type" property="customerType"/> |
| @@ -35,6 +36,7 @@ | @@ -35,6 +36,7 @@ | ||
| 35 | <result column="fifth_coordinate_date" property="fifthCoordinateDate"/> | 36 | <result column="fifth_coordinate_date" property="fifthCoordinateDate"/> |
| 36 | <result column="description" property="description"/> | 37 | <result column="description" property="description"/> |
| 37 | <result column="del_flag" property="delFlag"/> | 38 | <result column="del_flag" property="delFlag"/> |
| 39 | + <result column="spilt" property="spilt"/> | ||
| 38 | <result column="create_by_id" property="createById"/> | 40 | <result column="create_by_id" property="createById"/> |
| 39 | <result column="update_by_id" property="updateById"/> | 41 | <result column="update_by_id" property="updateById"/> |
| 40 | <result column="create_time" property="createTime"/> | 42 | <result column="create_time" property="createTime"/> |
| @@ -44,6 +46,7 @@ | @@ -44,6 +46,7 @@ | ||
| 44 | <sql id="ReceiptLedgerInfo_sql"> | 46 | <sql id="ReceiptLedgerInfo_sql"> |
| 45 | SELECT | 47 | SELECT |
| 46 | tb.id, | 48 | tb.id, |
| 49 | + tb.parent_id, | ||
| 47 | tb.customer_short_id, | 50 | tb.customer_short_id, |
| 48 | cs.short_name as customer_short_name, | 51 | cs.short_name as customer_short_name, |
| 49 | cs.type as customer_type, | 52 | cs.type as customer_type, |
| @@ -64,6 +67,7 @@ | @@ -64,6 +67,7 @@ | ||
| 64 | tb.processed_date, | 67 | tb.processed_date, |
| 65 | tb.actual_returned_date, | 68 | tb.actual_returned_date, |
| 66 | tb.returned_amount, | 69 | tb.returned_amount, |
| 70 | + tb.actual_returned_amount, | ||
| 67 | tb.end_account_receivable, | 71 | tb.end_account_receivable, |
| 68 | tb.apply_status, | 72 | tb.apply_status, |
| 69 | tb.coordinate_date, | 73 | tb.coordinate_date, |
| @@ -74,6 +78,7 @@ | @@ -74,6 +78,7 @@ | ||
| 74 | tb.fifth_coordinate_date, | 78 | tb.fifth_coordinate_date, |
| 75 | tb.description, | 79 | tb.description, |
| 76 | tb.del_flag, | 80 | tb.del_flag, |
| 81 | + tb.spilt, | ||
| 77 | tb.create_by_id, | 82 | tb.create_by_id, |
| 78 | tb.update_by_id, | 83 | tb.update_by_id, |
| 79 | tb.create_time, | 84 | tb.create_time, |
| @@ -112,4 +117,75 @@ | @@ -112,4 +117,75 @@ | ||
| 112 | </if> | 117 | </if> |
| 113 | </where> | 118 | </where> |
| 114 | </select> | 119 | </select> |
| 120 | + | ||
| 121 | + <insert id="batchAdd"> | ||
| 122 | + INSERT INTO receipt_ledger_info ( | ||
| 123 | + id, | ||
| 124 | + parent_id, | ||
| 125 | + customer_short_id, | ||
| 126 | + quota, | ||
| 127 | + settle_term, | ||
| 128 | + dept_id, | ||
| 129 | + region, | ||
| 130 | + stock_up_company_id, | ||
| 131 | + customer_id, | ||
| 132 | + factory_type, | ||
| 133 | + shipment_date, | ||
| 134 | + start_account_receivable, | ||
| 135 | + arrival_date, | ||
| 136 | + processed_date, | ||
| 137 | + actual_returned_date, | ||
| 138 | + returned_amount, | ||
| 139 | + actual_returned_amount | ||
| 140 | + end_account_receivable, | ||
| 141 | + apply_status, | ||
| 142 | + coordinate_date, | ||
| 143 | + remark, | ||
| 144 | + second_coordinate_date, | ||
| 145 | + third_coordinate_date, | ||
| 146 | + fourth_coordinate_date, | ||
| 147 | + fifth_coordinate_date, | ||
| 148 | + description, | ||
| 149 | + spilt, | ||
| 150 | + create_by_id, | ||
| 151 | + update_by_id, | ||
| 152 | + create_time, | ||
| 153 | + update_time | ||
| 154 | + ) VALUES | ||
| 155 | + <foreach collection="list" item="item" separator=","> | ||
| 156 | + ( | ||
| 157 | + #{item.id}, | ||
| 158 | + #{item.parentId}, | ||
| 159 | + #{item.customerShortId}, | ||
| 160 | + #{item.quota}, | ||
| 161 | + #{item.settleTerm}, | ||
| 162 | + #{item.deptId}, | ||
| 163 | + #{item.region}, | ||
| 164 | + #{item.stockUpCompanyId}, | ||
| 165 | + #{item.customerId}, | ||
| 166 | + #{item.factoryType}, | ||
| 167 | + #{item.shipmentDate}, | ||
| 168 | + #{item.startAccountReceivable}, | ||
| 169 | + #{item.arrivalDate}, | ||
| 170 | + #{item.processedDate}, | ||
| 171 | + #{item.actualReturnedDate}, | ||
| 172 | + #{item.returnedAmount}, | ||
| 173 | + #{item.actualReturnedAmount}, | ||
| 174 | + #{item.endAccountReceivable}, | ||
| 175 | + #{item.applyStatus}, | ||
| 176 | + #{item.coordinateAate}, | ||
| 177 | + #{item.remark}, | ||
| 178 | + #{item.secondCoordinateDate}, | ||
| 179 | + #{item.thirdCoordinateDate}, | ||
| 180 | + #{item.fourthCoordinateDate}, | ||
| 181 | + #{item.fifthCoordinateDate}, | ||
| 182 | + #{item.description}, | ||
| 183 | + #{item.spilt}, | ||
| 184 | + #{item.createById}, | ||
| 185 | + #{item.updateById}, | ||
| 186 | + #{item.createTime}, | ||
| 187 | + #{item.updateTime} | ||
| 188 | + ) | ||
| 189 | + </foreach> | ||
| 190 | + </insert> | ||
| 115 | </mapper> | 191 | </mapper> |