feat:分账
This commit is contained in:
@@ -175,6 +175,7 @@ public enum ShopSubStageStatusEnum {
|
|||||||
SHOP_SUB_STAGE_STATUS_283(ShopSubStageEnum.SHOP_STAGE_28, 2830, "审批拒绝", Boolean.FALSE),
|
SHOP_SUB_STAGE_STATUS_283(ShopSubStageEnum.SHOP_STAGE_28, 2830, "审批拒绝", Boolean.FALSE),
|
||||||
SHOP_SUB_STAGE_STATUS_284(ShopSubStageEnum.SHOP_STAGE_28, 2840, "待缴费", Boolean.FALSE),
|
SHOP_SUB_STAGE_STATUS_284(ShopSubStageEnum.SHOP_STAGE_28, 2840, "待缴费", Boolean.FALSE),
|
||||||
SHOP_SUB_STAGE_STATUS_284_5(ShopSubStageEnum.SHOP_STAGE_28, 2845, "对账中", Boolean.FALSE),
|
SHOP_SUB_STAGE_STATUS_284_5(ShopSubStageEnum.SHOP_STAGE_28, 2845, "对账中", Boolean.FALSE),
|
||||||
|
SHOP_SUB_STAGE_STATUS_284_7(ShopSubStageEnum.SHOP_STAGE_28, 2847, "其他费用待扣款", Boolean.FALSE),
|
||||||
SHOP_SUB_STAGE_STATUS_285(ShopSubStageEnum.SHOP_STAGE_28, 2850, "已完成", Boolean.TRUE),
|
SHOP_SUB_STAGE_STATUS_285(ShopSubStageEnum.SHOP_STAGE_28, 2850, "已完成", Boolean.TRUE),
|
||||||
|
|
||||||
SHOP_SUB_STAGE_STATUS_290(ShopSubStageEnum.SHOP_STAGE_29, 2900, "待通知发货", Boolean.FALSE),
|
SHOP_SUB_STAGE_STATUS_290(ShopSubStageEnum.SHOP_STAGE_29, 2900, "待通知发货", Boolean.FALSE),
|
||||||
|
|||||||
@@ -78,4 +78,21 @@ public class PreAllocationRecordDAO {
|
|||||||
}
|
}
|
||||||
return preAllocationRecordMapper.deleteByIdsNotPaid(ids) > 0;
|
return preAllocationRecordMapper.deleteByIdsNotPaid(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 软删除
|
||||||
|
*/
|
||||||
|
public boolean softDeleteById(Long id) {
|
||||||
|
return preAllocationRecordMapper.softDeleteById(id) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量软删除
|
||||||
|
*/
|
||||||
|
public boolean softDeleteByIds(List<Long> ids) {
|
||||||
|
if (ids == null || ids.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return preAllocationRecordMapper.softDeleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -33,4 +33,14 @@ public interface PreAllocationRecordMapper extends Mapper<PreAllocationRecordDO>
|
|||||||
int deleteByIdsNotPaid(@Param("ids") List<Long> ids);
|
int deleteByIdsNotPaid(@Param("ids") List<Long> ids);
|
||||||
|
|
||||||
Integer updateByPayNoList(@Param("payNoList") List<String> payNoList, @Param("status") Integer status);
|
Integer updateByPayNoList(@Param("payNoList") List<String> payNoList, @Param("status") Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 软删除
|
||||||
|
*/
|
||||||
|
int softDeleteById(@Param("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量软删除
|
||||||
|
*/
|
||||||
|
int softDeleteByIds(@Param("ids") List<Long> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,17 @@
|
|||||||
<result column="allocation_status" property="allocationStatus" jdbcType="INTEGER"/>
|
<result column="allocation_status" property="allocationStatus" jdbcType="INTEGER"/>
|
||||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||||
|
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
||||||
|
<result column="deleted" property="deleted" jdbcType="TINYINT"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, order_id, shop_id, pay_no, expense_type, payee_name, payee_code,
|
id, order_id, shop_id, pay_no, expense_type, payee_name, payee_code,
|
||||||
pay_amount, allocation_status, create_time, update_time
|
pay_amount, allocation_status, create_time, update_time, remark, deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="Not_Deleted_Condition">
|
||||||
|
deleted = 0
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getById" resultMap="BaseResultMap">
|
<select id="getById" resultMap="BaseResultMap">
|
||||||
@@ -31,6 +37,7 @@
|
|||||||
SELECT <include refid="Base_Column_List"/>
|
SELECT <include refid="Base_Column_List"/>
|
||||||
FROM zxjp_pre_allocation_record
|
FROM zxjp_pre_allocation_record
|
||||||
WHERE order_id = #{orderId}
|
WHERE order_id = #{orderId}
|
||||||
|
AND <include refid="Not_Deleted_Condition"/>
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -38,6 +45,7 @@
|
|||||||
SELECT <include refid="Base_Column_List"/>
|
SELECT <include refid="Base_Column_List"/>
|
||||||
FROM zxjp_pre_allocation_record
|
FROM zxjp_pre_allocation_record
|
||||||
WHERE shop_id = #{shopId}
|
WHERE shop_id = #{shopId}
|
||||||
|
AND <include refid="Not_Deleted_Condition"/>
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -45,14 +53,16 @@
|
|||||||
SELECT <include refid="Base_Column_List"/>
|
SELECT <include refid="Base_Column_List"/>
|
||||||
FROM zxjp_pre_allocation_record
|
FROM zxjp_pre_allocation_record
|
||||||
WHERE shop_id = #{shopId}
|
WHERE shop_id = #{shopId}
|
||||||
and expense_type = #{expenseType}
|
AND expense_type = #{expenseType}
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryPageByPayNo" resultMap="BaseResultMap">
|
<select id="queryPageByPayNo" resultMap="BaseResultMap">
|
||||||
SELECT <include refid="Base_Column_List"/>
|
SELECT <include refid="Base_Column_List"/>
|
||||||
FROM zxjp_pre_allocation_record
|
FROM zxjp_pre_allocation_record
|
||||||
WHERE pay_no = #{payNo}
|
WHERE pay_no = #{payNo}
|
||||||
|
AND <include refid="Not_Deleted_Condition"/>
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -130,6 +140,23 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<update id="softDeleteById">
|
||||||
|
UPDATE zxjp_pre_allocation_record
|
||||||
|
SET deleted = 1,
|
||||||
|
update_time = NOW()
|
||||||
|
WHERE id = #{id}
|
||||||
|
AND <include refid="Not_Deleted_Condition"/>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="softDeleteByIds">
|
||||||
|
UPDATE zxjp_pre_allocation_record
|
||||||
|
SET deleted = 1,
|
||||||
|
update_time = NOW()
|
||||||
|
WHERE id IN
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
AND <include refid="Not_Deleted_Condition"/>
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -53,4 +53,10 @@ public class PreAllocationRecordDO implements Serializable {
|
|||||||
|
|
||||||
@Column(name = "update_time")
|
@Column(name = "update_time")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
@Column(name = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Column(name = "deleted")
|
||||||
|
private Integer deleted;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.cool.store.request.store;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.DecimalMin;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预分账记录请求
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PreAllocationAddRequest {
|
||||||
|
|
||||||
|
@NotNull(message = "订单ID不能为空")
|
||||||
|
@ApiModelProperty("订单ID")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
@NotNull(message = "门店ID不能为空")
|
||||||
|
@ApiModelProperty("门店ID")
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
@NotBlank(message = "费用类型不能为空")
|
||||||
|
@ApiModelProperty("费用类型")
|
||||||
|
private String expenseType;
|
||||||
|
|
||||||
|
@ApiModelProperty("收款公司名称")
|
||||||
|
private String payeeName;
|
||||||
|
|
||||||
|
@ApiModelProperty("收款公司Code")
|
||||||
|
private String payeeCode;
|
||||||
|
|
||||||
|
@NotNull(message = "分账金额不能为空")
|
||||||
|
@DecimalMin(value = "0.01", message = "分账金额必须大于0")
|
||||||
|
@ApiModelProperty("分账金额")
|
||||||
|
private BigDecimal payAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty("分账备注")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.cool.store.request.store;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.DecimalMin;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑预分账记录请求
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PreAllocationEditRequest {
|
||||||
|
|
||||||
|
@NotNull(message = "记录ID不能为空")
|
||||||
|
@ApiModelProperty("记录ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("费用类型")
|
||||||
|
private String expenseType;
|
||||||
|
|
||||||
|
@ApiModelProperty("收款公司名称")
|
||||||
|
private String payeeName;
|
||||||
|
|
||||||
|
@ApiModelProperty("收款公司Code")
|
||||||
|
private String payeeCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("分账金额")
|
||||||
|
@DecimalMin(value = "0.01", message = "分账金额必须大于0")
|
||||||
|
private BigDecimal payAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty("分账备注")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -50,5 +50,7 @@ public class PreAllocationRecordVO {
|
|||||||
@ApiModelProperty("更新时间")
|
@ApiModelProperty("更新时间")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("分账备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
|
|||||||
stageList.add(SHOP_SUB_STAGE_STATUS_80);
|
stageList.add(SHOP_SUB_STAGE_STATUS_80);
|
||||||
}else {
|
}else {
|
||||||
//标准店
|
//标准店
|
||||||
stageList.add(SHOP_SUB_STAGE_STATUS_285);
|
stageList.add(SHOP_SUB_STAGE_STATUS_284_7);
|
||||||
stageList.add(SHOP_SUB_STAGE_STATUS_80);
|
stageList.add(SHOP_SUB_STAGE_STATUS_80);
|
||||||
//查询可乐机缴费状态
|
//查询可乐机缴费状态
|
||||||
PreAllocationRecordDO preAllocationRecordDO = preAllocationRecordDAO.queryPageByShopIdAndExpenseType(request.getShopId(), WalletFeeItemEnum.DEVICE_EARNEST_MONEY.getExpenseType());
|
PreAllocationRecordDO preAllocationRecordDO = preAllocationRecordDAO.queryPageByShopIdAndExpenseType(request.getShopId(), WalletFeeItemEnum.DEVICE_EARNEST_MONEY.getExpenseType());
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.cool.store.enums.point.ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_285;
|
import static com.cool.store.enums.point.ShopSubStageStatusEnum.*;
|
||||||
import static com.cool.store.enums.point.ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_80;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author suzhuhong
|
* @Author suzhuhong
|
||||||
@@ -127,7 +126,7 @@ public class OpenApiServiceImpl implements OpenApiService {
|
|||||||
if (request.getClaimStatus() == 1 && preAllocationRecordDO!=null&&WalletFeeItemEnum.DEVICE_EARNEST_MONEY.getExpenseType().equals(preAllocationRecordDO.getExpenseType())){
|
if (request.getClaimStatus() == 1 && preAllocationRecordDO!=null&&WalletFeeItemEnum.DEVICE_EARNEST_MONEY.getExpenseType().equals(preAllocationRecordDO.getExpenseType())){
|
||||||
String key = MessageFormat.format(RedisConstant.XGJ_CALLBACK_SHOP, preAllocationRecordDO.getShopId());
|
String key = MessageFormat.format(RedisConstant.XGJ_CALLBACK_SHOP, preAllocationRecordDO.getShopId());
|
||||||
if (StringUtils.isNotEmpty(redisUtilPool.getString(key))){
|
if (StringUtils.isNotEmpty(redisUtilPool.getString(key))){
|
||||||
shopStageInfoDAO.batchUpdateShopStageStatus(preAllocationRecordDO.getShopId(),Arrays.asList(SHOP_SUB_STAGE_STATUS_285,SHOP_SUB_STAGE_STATUS_80));
|
shopStageInfoDAO.batchUpdateShopStageStatus(preAllocationRecordDO.getShopId(),Arrays.asList(SHOP_SUB_STAGE_STATUS_284_7,SHOP_SUB_STAGE_STATUS_80));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ApiResponse.success(Boolean.TRUE);
|
return ApiResponse.success(Boolean.TRUE);
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.cool.store.service.store;
|
|||||||
import com.cool.store.entity.order.PreAllocationRecordDO;
|
import com.cool.store.entity.order.PreAllocationRecordDO;
|
||||||
import com.cool.store.entity.order.StoreOrderDO;
|
import com.cool.store.entity.order.StoreOrderDO;
|
||||||
import com.cool.store.entity.wallet.WalletTradeDO;
|
import com.cool.store.entity.wallet.WalletTradeDO;
|
||||||
|
import com.cool.store.request.store.PreAllocationAddRequest;
|
||||||
|
import com.cool.store.request.store.PreAllocationEditRequest;
|
||||||
import com.cool.store.request.store.PreAllocationQueryShopRequest;
|
import com.cool.store.request.store.PreAllocationQueryShopRequest;
|
||||||
import com.cool.store.request.store.PreAllocationSaveRequest;
|
import com.cool.store.request.store.PreAllocationSaveRequest;
|
||||||
import com.cool.store.request.store.TransRequest;
|
import com.cool.store.request.store.TransRequest;
|
||||||
@@ -37,4 +39,26 @@ public interface PreAllocationRecordService {
|
|||||||
*/
|
*/
|
||||||
Boolean transStatusRefresh(WalletTradeDO walletTradeDO);
|
Boolean transStatusRefresh(WalletTradeDO walletTradeDO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预分账记录
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean add(PreAllocationAddRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑预分账记录
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean edit(PreAllocationEditRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预分账记录(软删除)
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean delete(Long id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
|||||||
import com.cool.store.enums.wallet.TradeTypeEnum;
|
import com.cool.store.enums.wallet.TradeTypeEnum;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
import com.cool.store.mapper.FranchiseFeeMapper;
|
import com.cool.store.mapper.FranchiseFeeMapper;
|
||||||
|
import com.cool.store.request.store.PreAllocationAddRequest;
|
||||||
|
import com.cool.store.request.store.PreAllocationEditRequest;
|
||||||
import com.cool.store.request.store.PreAllocationSaveRequest;
|
import com.cool.store.request.store.PreAllocationSaveRequest;
|
||||||
import com.cool.store.request.store.TransRequest;
|
import com.cool.store.request.store.TransRequest;
|
||||||
import com.cool.store.request.wallet.*;
|
import com.cool.store.request.wallet.*;
|
||||||
@@ -74,8 +76,8 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static com.cool.store.enums.order.StoreOrderStatusEnum.PAY_FAIL;
|
import static com.cool.store.enums.order.StoreOrderStatusEnum.PAY_FAIL;
|
||||||
import static com.cool.store.enums.wallet.WalletTradeModuleEnum.STANDARD_STORE;
|
import static com.cool.store.enums.point.ShopSubStageStatusEnum.*;
|
||||||
import static com.cool.store.enums.wallet.WalletTradeModuleEnum.TRANSFER;
|
import static com.cool.store.enums.wallet.WalletTradeModuleEnum.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Auther zx_szh
|
* @Auther zx_szh
|
||||||
@@ -756,6 +758,7 @@ public class PreAllocationRecordServiceImpl implements PreAllocationRecordServic
|
|||||||
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE);
|
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
record.setAllocationStatus(AllocationPayStatusEnum.PAYING.getStatus());
|
record.setAllocationStatus(AllocationPayStatusEnum.PAYING.getStatus());
|
||||||
|
record.setRemark(transRequest.getRemark());
|
||||||
//先改为分账中
|
//先改为分账中
|
||||||
preAllocationRecordDAO.updateByPrimaryKeySelective(record);
|
preAllocationRecordDAO.updateByPrimaryKeySelective(record);
|
||||||
WalletTradeDO walletTradeDO = new WalletTradeDO();
|
WalletTradeDO walletTradeDO = new WalletTradeDO();
|
||||||
@@ -804,10 +807,68 @@ public class PreAllocationRecordServiceImpl implements PreAllocationRecordServic
|
|||||||
if (BigDecimalUtils.equals(unpaidAmount,new BigDecimal(0))){
|
if (BigDecimalUtils.equals(unpaidAmount,new BigDecimal(0))){
|
||||||
//剩余缴纳金额是0 缴费完成
|
//剩余缴纳金额是0 缴费完成
|
||||||
updateOrder.setStatus( StoreOrderStatusEnum.PAID.getCode());
|
updateOrder.setStatus( StoreOrderStatusEnum.PAID.getCode());
|
||||||
|
//阶段状态变为完成
|
||||||
|
shopStageInfoDAO.updateShopStageInfo(storeOrder.getShopId(), SHOP_SUB_STAGE_STATUS_285);
|
||||||
}
|
}
|
||||||
storeOrderDAO.updateSelective(updateOrder);
|
storeOrderDAO.updateSelective(updateOrder);
|
||||||
}
|
}
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean add(PreAllocationAddRequest request) {
|
||||||
|
if (request == null) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
PreAllocationRecordDO record = PreAllocationRecordDO.builder()
|
||||||
|
.orderId(request.getOrderId())
|
||||||
|
.shopId(request.getShopId())
|
||||||
|
.expenseType(request.getExpenseType())
|
||||||
|
.payeeName(request.getPayeeName())
|
||||||
|
.payeeCode(request.getPayeeCode())
|
||||||
|
.payAmount(request.getPayAmount())
|
||||||
|
.remark(request.getRemark())
|
||||||
|
.deleted(0)
|
||||||
|
.allocationStatus(AllocationPayStatusEnum.UNPAID.getStatus())
|
||||||
|
.createTime(new Date())
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return dao.insertSelective(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean edit(PreAllocationEditRequest request) {
|
||||||
|
if (request == null || request.getId() == null) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
PreAllocationRecordDO exist = dao.getById(request.getId());
|
||||||
|
if (exist == null) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
PreAllocationRecordDO record = PreAllocationRecordDO.builder()
|
||||||
|
.id(request.getId())
|
||||||
|
.expenseType(request.getExpenseType())
|
||||||
|
.payeeName(request.getPayeeName())
|
||||||
|
.payeeCode(request.getPayeeCode())
|
||||||
|
.payAmount(request.getPayAmount())
|
||||||
|
.remark(request.getRemark())
|
||||||
|
.updateTime(new Date())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return dao.updateByPrimaryKeySelective(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(Long id) {
|
||||||
|
if (id == null) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
|
}
|
||||||
|
return dao.softDeleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.cool.store.controller.webb;
|
package com.cool.store.controller.webb;
|
||||||
|
|
||||||
|
import com.cool.store.request.store.PreAllocationAddRequest;
|
||||||
|
import com.cool.store.request.store.PreAllocationEditRequest;
|
||||||
import com.cool.store.request.store.PreAllocationQueryShopRequest;
|
import com.cool.store.request.store.PreAllocationQueryShopRequest;
|
||||||
import com.cool.store.request.store.PreAllocationSaveRequest;
|
import com.cool.store.request.store.PreAllocationSaveRequest;
|
||||||
import com.cool.store.request.store.TransRequest;
|
import com.cool.store.request.store.TransRequest;
|
||||||
@@ -45,4 +47,23 @@ public class PreAllocationRecordController {
|
|||||||
public ResponseResult<List<PreAllocationRecordVO>> queryByShop(@RequestParam(value = "shopId" ,required = true) Long shopId){
|
public ResponseResult<List<PreAllocationRecordVO>> queryByShop(@RequestParam(value = "shopId" ,required = true) Long shopId){
|
||||||
return ResponseResult.success(preAllocationRecordService.queryByShop(shopId));
|
return ResponseResult.success(preAllocationRecordService.queryByShop(shopId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增预分账记录")
|
||||||
|
@PostMapping("/add")
|
||||||
|
public ResponseResult<Boolean> add(@RequestBody @Valid PreAllocationAddRequest request){
|
||||||
|
return ResponseResult.success(preAllocationRecordService.add(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("编辑预分账记录")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
public ResponseResult<Boolean> edit(@RequestBody @Valid PreAllocationEditRequest request){
|
||||||
|
return ResponseResult.success(preAllocationRecordService.edit(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除预分账记录")
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public ResponseResult<Boolean> delete(@RequestParam(value = "id" ,required = true) Long id){
|
||||||
|
return ResponseResult.success(preAllocationRecordService.delete(id));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user