26 changed files with 1008 additions and 556 deletions
@ -0,0 +1,119 @@ |
|||||
|
package com.qs.serve.modules.bms.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.common.util.CopierUtil; |
||||
|
import com.qs.serve.common.util.StringUtils; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierStatement; |
||||
|
import com.qs.serve.modules.bms.service.BmsSupplierStatementService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 基础档案 客户货款对账单 |
||||
|
* @author YenHex |
||||
|
* @since 2024-03-22 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("bms/supplierStatement") |
||||
|
public class BmsSupplierStatementController { |
||||
|
|
||||
|
private BmsSupplierStatementService bmsSupplierStatementService; |
||||
|
|
||||
|
/** |
||||
|
* 列表 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
//@GetMapping("/list")
|
||||
|
//@PreAuthorize("hasRole('bms:supplierStatement:query')")
|
||||
|
public R<List<BmsSupplierStatement>> getList(BmsSupplierStatement param){ |
||||
|
LambdaQueryWrapper<BmsSupplierStatement> lqw = new LambdaQueryWrapper<>(param); |
||||
|
List<BmsSupplierStatement> list = bmsSupplierStatementService.list(lqw); |
||||
|
return R.ok(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 翻页 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
//@GetMapping("/page")
|
||||
|
//@PreAuthorize("hasRole('bms:supplierStatement:query')")
|
||||
|
public R<PageVo<BmsSupplierStatement>> getPage(BmsSupplierStatement param){ |
||||
|
LambdaQueryWrapper<BmsSupplierStatement> lqw = new LambdaQueryWrapper<>(param); |
||||
|
PageUtil.startPage(); |
||||
|
List<BmsSupplierStatement> list = bmsSupplierStatementService.list(lqw); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
//@GetMapping("/getById/{id}")
|
||||
|
@SysLog(module = SystemModule.BASE, title = "客户货款对账单", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('bms:supplierStatement:query')") |
||||
|
public R<BmsSupplierStatement> getById(@PathVariable("id") String id){ |
||||
|
BmsSupplierStatement bmsSupplierStatement = bmsSupplierStatementService.getById(id); |
||||
|
return R.ok(bmsSupplierStatement); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
//@PostMapping("/updateById")
|
||||
|
@SysLog(module = SystemModule.BASE, title = "客户货款对账单", biz = BizType.UPDATE) |
||||
|
//@PreAuthorize("hasRole('bms:supplierStatement:update')")
|
||||
|
public R<?> updateById(@RequestBody @Valid BmsSupplierStatement param){ |
||||
|
boolean result = bmsSupplierStatementService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
//@PostMapping("/save")
|
||||
|
@SysLog(module = SystemModule.BASE, title = "客户货款对账单", biz = BizType.INSERT) |
||||
|
//@PreAuthorize("hasRole('bms:supplierStatement:insert')")
|
||||
|
public R<?> save(@RequestBody @Valid BmsSupplierStatement param){ |
||||
|
boolean result = bmsSupplierStatementService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{ids}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "客户货款对账单", biz = BizType.DELETE) |
||||
|
//@PreAuthorize("hasRole('bms:supplierStatement:delete')")
|
||||
|
public R<?> deleteById(@PathVariable("ids") String ids){ |
||||
|
List<Long> idsLong = StringUtils.splitIdLong(ids); |
||||
|
boolean result = bmsSupplierStatementService.removeByIds(idsLong); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,102 @@ |
|||||
|
package com.qs.serve.modules.bms.entity; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* 客户货款对账单 实体类 |
||||
|
* @author YenHex |
||||
|
* @since 2024-03-22 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("bms_supplier_statement") |
||||
|
public class BmsSupplierStatement implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 供应商ID */ |
||||
|
@Length(max = 20,message = "供应商ID长度不能超过20字") |
||||
|
private String supplierId; |
||||
|
|
||||
|
/** 供应商编码 */ |
||||
|
@Length(max = 255,message = "供应商编码长度不能超过255字") |
||||
|
private String supplierCode; |
||||
|
|
||||
|
/** 供应商名称 */ |
||||
|
@Length(max = 255,message = "供应商名称长度不能超过255字") |
||||
|
private String supplierName; |
||||
|
|
||||
|
/** 内容 */ |
||||
|
private String content; |
||||
|
|
||||
|
/** 状态 */ |
||||
|
@Length(max = 255,message = "状态长度不能超过255字") |
||||
|
private String status; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private String createBy; |
||||
|
|
||||
|
/** 更新时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
/** 更新人 */ |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private String updateBy; |
||||
|
|
||||
|
/** 租户id */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String tenantId; |
||||
|
|
||||
|
/** 删除标识 */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private Boolean delFlag; |
||||
|
|
||||
|
|
||||
|
public static BmsSupplierStatement toNewObject(BmsSupplierStatement source){ |
||||
|
BmsSupplierStatement supplierStatement = new BmsSupplierStatement(); |
||||
|
supplierStatement.setId(source.getId()); |
||||
|
supplierStatement.setSupplierId(source.getSupplierId()); |
||||
|
supplierStatement.setSupplierCode(source.getSupplierCode()); |
||||
|
supplierStatement.setSupplierName(source.getSupplierName()); |
||||
|
supplierStatement.setContent(source.getContent()); |
||||
|
supplierStatement.setStatus(source.getStatus()); |
||||
|
supplierStatement.setCreateTime(source.getCreateTime()); |
||||
|
supplierStatement.setCreateBy(source.getCreateBy()); |
||||
|
supplierStatement.setUpdateTime(source.getUpdateTime()); |
||||
|
supplierStatement.setUpdateBy(source.getUpdateBy()); |
||||
|
supplierStatement.setTenantId(source.getTenantId()); |
||||
|
supplierStatement.setDelFlag(source.getDelFlag()); |
||||
|
return supplierStatement; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.bms.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierStatement; |
||||
|
|
||||
|
/** |
||||
|
* 客户货款对账单 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public interface BmsSupplierStatementMapper extends BaseMapper<BmsSupplierStatement> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.bms.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierStatement; |
||||
|
|
||||
|
/** |
||||
|
* 客户货款对账单 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public interface BmsSupplierStatementService extends IService<BmsSupplierStatement> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.qs.serve.modules.bms.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplierStatement; |
||||
|
import com.qs.serve.modules.bms.service.BmsSupplierStatementService; |
||||
|
import com.qs.serve.modules.bms.mapper.BmsSupplierStatementMapper; |
||||
|
|
||||
|
/** |
||||
|
* 客户货款对账单 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2024-03-22 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class BmsSupplierStatementServiceImpl extends ServiceImpl<BmsSupplierStatementMapper,BmsSupplierStatement> implements BmsSupplierStatementService { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,78 @@ |
|||||
|
package com.qs.serve.modules.goods.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.common.util.CopierUtil; |
||||
|
import com.qs.serve.common.util.StringUtils; |
||||
|
import com.qs.serve.modules.goods.entity.bo.GoodsRuleBo; |
||||
|
import com.qs.serve.modules.goods.entity.dto.GoodsRuleBaseDTO; |
||||
|
import com.qs.serve.modules.goods.entity.vo.GoodsRuleVo; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import com.qs.serve.modules.goods.entity.GoodsRule; |
||||
|
import com.qs.serve.modules.goods.service.GoodsRuleService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 商品 规则 |
||||
|
* @author YenHex |
||||
|
* @since 2024-03-22 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("goods/rule") |
||||
|
public class GoodsRuleController { |
||||
|
|
||||
|
private GoodsRuleService goodsRuleService; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/get") |
||||
|
@SysLog(module = SystemModule.GOODS, title = "规则", biz = BizType.QUERY) |
||||
|
public R<GoodsRuleVo> getById(GoodsRuleBaseDTO dto){ |
||||
|
GoodsRuleVo goodsRule = goodsRuleService.getVoById(dto); |
||||
|
return R.ok(goodsRule); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 编辑 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@SysLog(module = SystemModule.GOODS, title = "规则", biz = BizType.INSERT) |
||||
|
public R<?> save(@RequestBody @Valid GoodsRuleBo param){ |
||||
|
goodsRuleService.modify(param); |
||||
|
return R.ok(param); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{ids}") |
||||
|
@SysLog(module = SystemModule.GOODS, title = "规则", biz = BizType.DELETE) |
||||
|
public R<?> deleteById(@PathVariable("ids") String ids){ |
||||
|
List<Long> idsLong = StringUtils.splitIdLong(ids); |
||||
|
boolean result = goodsRuleService.removeByIds(idsLong); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,94 @@ |
|||||
|
package com.qs.serve.modules.goods.entity; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 规则 实体类 |
||||
|
* @author YenHex |
||||
|
* @since 2024-03-22 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("goods_rule") |
||||
|
public class GoodsRule implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 客户id */ |
||||
|
private Long supplierId; |
||||
|
|
||||
|
/** 销售区域id */ |
||||
|
private String saleRegionId; |
||||
|
|
||||
|
/** 行政区域id */ |
||||
|
private String bizRegionId; |
||||
|
|
||||
|
/** 控规则 */ |
||||
|
private Integer emptyFlag; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@Length(max = 255,message = "备注长度不能超过255字") |
||||
|
private String remark; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
/** 最后更新时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
/** 所属租户 */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String tenantId; |
||||
|
|
||||
|
/** 逻辑删除标记(0:显示;1:隐藏) */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private String createBy; |
||||
|
|
||||
|
/** 更新人 */ |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private String updateBy; |
||||
|
|
||||
|
|
||||
|
public static GoodsRule toNewObject(GoodsRule source){ |
||||
|
GoodsRule rule = new GoodsRule(); |
||||
|
rule.setId(source.getId()); |
||||
|
rule.setSupplierId(source.getSupplierId()); |
||||
|
rule.setSaleRegionId(source.getSaleRegionId()); |
||||
|
rule.setBizRegionId(source.getBizRegionId()); |
||||
|
rule.setRemark(source.getRemark()); |
||||
|
rule.setCreateTime(source.getCreateTime()); |
||||
|
rule.setUpdateTime(source.getUpdateTime()); |
||||
|
rule.setTenantId(source.getTenantId()); |
||||
|
rule.setDelFlag(source.getDelFlag()); |
||||
|
rule.setCreateBy(source.getCreateBy()); |
||||
|
rule.setUpdateBy(source.getUpdateBy()); |
||||
|
return rule; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,107 @@ |
|||||
|
package com.qs.serve.modules.goods.entity; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* 商品sku规则 实体类 |
||||
|
* @author YenHex |
||||
|
* @since 2024-03-22 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("goods_rule_item") |
||||
|
public class GoodsRuleItem implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 规则id */ |
||||
|
@NotNull(message = "规则id不能为空") |
||||
|
private Long ruleId; |
||||
|
|
||||
|
/** 商品类型 :1只能选的分类;2不能选的分类;3只能选的SPU;4不能选的SPU*/ |
||||
|
@NotNull(message = "商品类型不能为空") |
||||
|
private Integer targetType; |
||||
|
|
||||
|
/** 品类编码 */ |
||||
|
@NotBlank(message = "品类编码不能为空") |
||||
|
@Length(max = 255,message = "品类编码长度不能超过255字") |
||||
|
private String targetCode; |
||||
|
|
||||
|
private String targetName; |
||||
|
|
||||
|
/** 商品id */ |
||||
|
@NotBlank(message = "商品id不能为空") |
||||
|
@Length(max = 30,message = "商品id长度不能超过30字") |
||||
|
private String targetId; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@Length(max = 255,message = "备注长度不能超过255字") |
||||
|
private String remark; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
/** 最后更新时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private LocalDateTime updateTime; |
||||
|
|
||||
|
/** 所属租户 */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String tenantId; |
||||
|
|
||||
|
/** 逻辑删除标记(0:显示;1:隐藏) */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private String createBy; |
||||
|
|
||||
|
/** 更新人 */ |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private String updateBy; |
||||
|
|
||||
|
|
||||
|
public static GoodsRuleItem toNewObject(GoodsRuleItem source){ |
||||
|
GoodsRuleItem ruleItem = new GoodsRuleItem(); |
||||
|
ruleItem.setId(source.getId()); |
||||
|
ruleItem.setRuleId(source.getRuleId()); |
||||
|
ruleItem.setTargetType(source.getTargetType()); |
||||
|
ruleItem.setTargetCode(source.getTargetCode()); |
||||
|
ruleItem.setTargetId(source.getTargetId()); |
||||
|
ruleItem.setRemark(source.getRemark()); |
||||
|
ruleItem.setCreateTime(source.getCreateTime()); |
||||
|
ruleItem.setUpdateTime(source.getUpdateTime()); |
||||
|
ruleItem.setTenantId(source.getTenantId()); |
||||
|
ruleItem.setDelFlag(source.getDelFlag()); |
||||
|
ruleItem.setCreateBy(source.getCreateBy()); |
||||
|
ruleItem.setUpdateBy(source.getUpdateBy()); |
||||
|
return ruleItem; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,33 @@ |
|||||
|
package com.qs.serve.modules.goods.entity.bo; |
||||
|
|
||||
|
import com.qs.serve.modules.goods.entity.dto.GoodsRuleBaseDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2024/3/22 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class GoodsRuleBo extends GoodsRuleBaseDTO { |
||||
|
|
||||
|
/** 规则ID(更新必传) */ |
||||
|
private Long ruleId; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
private String remark; |
||||
|
|
||||
|
/** 只能选的分类 */ |
||||
|
private List<String> onlyCategoryIds; |
||||
|
|
||||
|
/** 不能选的分类 */ |
||||
|
private List<String> notInCategoryIds; |
||||
|
|
||||
|
/** 只能选的SPU */ |
||||
|
private List<String> onlySpuIds; |
||||
|
|
||||
|
/** 不能选的SPU */ |
||||
|
private List<String> notInSpuIds; |
||||
|
|
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.qs.serve.modules.goods.entity.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2024/3/22 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class GoodsRuleBaseDTO { |
||||
|
|
||||
|
/** 客户id */ |
||||
|
private Long supplierId; |
||||
|
|
||||
|
/** 销售区域id */ |
||||
|
private String saleRegionId; |
||||
|
|
||||
|
/** 行政区域id */ |
||||
|
private String bizRegionId; |
||||
|
|
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.qs.serve.modules.goods.entity.vo; |
||||
|
|
||||
|
import com.qs.serve.modules.goods.entity.GoodsCategory; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsSpu; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2024/3/22 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class GoodsRuleVo { |
||||
|
|
||||
|
/** 规则ID(更新必传) */ |
||||
|
private Long ruleId; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
private String remark; |
||||
|
|
||||
|
/** 只能选的分类 */ |
||||
|
private List<GoodsCategory> onlyCategoryList; |
||||
|
|
||||
|
/** 不能选的分类 */ |
||||
|
private List<GoodsCategory> notInCategoryList; |
||||
|
|
||||
|
/** 只能选的SPU */ |
||||
|
private List<GoodsSpu> onlySpuList; |
||||
|
|
||||
|
/** 不能选的SPU */ |
||||
|
private List<GoodsSpu> notInSpuList; |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.goods.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsRuleItem; |
||||
|
|
||||
|
/** |
||||
|
* 商品sku规则 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public interface GoodsRuleItemMapper extends BaseMapper<GoodsRuleItem> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,26 @@ |
|||||
|
package com.qs.serve.modules.goods.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsRule; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
import org.apache.ibatis.annotations.Update; |
||||
|
|
||||
|
/** |
||||
|
* 规则 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public interface GoodsRuleMapper extends BaseMapper<GoodsRule> { |
||||
|
|
||||
|
@Select("select * from goods_rule where supplier_id = #{supplierId}") |
||||
|
GoodsRule selectRuleBySupplierId(@Param("supplierId")Long supplierId); |
||||
|
|
||||
|
@Select("select * from goods_rule where supplier_id = #{saleRegionId}") |
||||
|
GoodsRule selectRuleBySaleRegionId(@Param("saleRegionId")String saleRegionId); |
||||
|
|
||||
|
@Select("select * from goods_rule where supplier_id = #{bizRegionId}") |
||||
|
GoodsRule selectRuleByBizRegionId(@Param("bizRegionId")String bizRegionId); |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.goods.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsRuleItem; |
||||
|
|
||||
|
/** |
||||
|
* 商品sku规则 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public interface GoodsRuleItemService extends IService<GoodsRuleItem> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.qs.serve.modules.goods.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsRule; |
||||
|
import com.qs.serve.modules.goods.entity.bo.GoodsRuleBo; |
||||
|
import com.qs.serve.modules.goods.entity.dto.GoodsRuleBaseDTO; |
||||
|
import com.qs.serve.modules.goods.entity.vo.GoodsRuleVo; |
||||
|
|
||||
|
/** |
||||
|
* 规则 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2024-03-22 |
||||
|
*/ |
||||
|
public interface GoodsRuleService extends IService<GoodsRule> { |
||||
|
|
||||
|
void modify(GoodsRuleBo param); |
||||
|
|
||||
|
|
||||
|
GoodsRuleVo getVoById(GoodsRuleBaseDTO baseDTO); |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.qs.serve.modules.goods.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsRuleItem; |
||||
|
import com.qs.serve.modules.goods.service.GoodsRuleItemService; |
||||
|
import com.qs.serve.modules.goods.mapper.GoodsRuleItemMapper; |
||||
|
|
||||
|
/** |
||||
|
* 商品sku规则 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2024-03-22 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class GoodsRuleItemServiceImpl extends ServiceImpl<GoodsRuleItemMapper,GoodsRuleItem> implements GoodsRuleItemService { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,218 @@ |
|||||
|
package com.qs.serve.modules.goods.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.qs.serve.common.util.Assert; |
||||
|
import com.qs.serve.common.util.StringUtils; |
||||
|
import com.qs.serve.modules.bms.entity.BmsRegion; |
||||
|
import com.qs.serve.modules.bms.entity.BmsRegion2; |
||||
|
import com.qs.serve.modules.bms.entity.BmsSupplier; |
||||
|
import com.qs.serve.modules.bms.mapper.BmsRegion2Mapper; |
||||
|
import com.qs.serve.modules.bms.mapper.BmsRegionMapper; |
||||
|
import com.qs.serve.modules.bms.mapper.BmsSupplierMapper; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsCategory; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsRuleItem; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsSpu; |
||||
|
import com.qs.serve.modules.goods.entity.bo.GoodsRuleBo; |
||||
|
import com.qs.serve.modules.goods.entity.dto.GoodsRuleBaseDTO; |
||||
|
import com.qs.serve.modules.goods.entity.vo.GoodsRuleVo; |
||||
|
import com.qs.serve.modules.goods.mapper.GoodsCategoryMapper; |
||||
|
import com.qs.serve.modules.goods.mapper.GoodsSpuMapper; |
||||
|
import com.qs.serve.modules.goods.service.GoodsRuleItemService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsRule; |
||||
|
import com.qs.serve.modules.goods.service.GoodsRuleService; |
||||
|
import com.qs.serve.modules.goods.mapper.GoodsRuleMapper; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 规则 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2024-03-22 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class GoodsRuleServiceImpl extends ServiceImpl<GoodsRuleMapper,GoodsRule> implements GoodsRuleService { |
||||
|
|
||||
|
private BmsSupplierMapper supplierMapper; |
||||
|
private BmsRegionMapper saleRegionMapper; |
||||
|
private BmsRegion2Mapper bizRegionMapper; |
||||
|
private GoodsRuleItemService goodsRuleItemService; |
||||
|
private GoodsCategoryMapper categoryMapper; |
||||
|
private GoodsSpuMapper spuMapper; |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void modify(GoodsRuleBo param) { |
||||
|
GoodsRule goodsRule = null; |
||||
|
if(param.getRuleId()==null){ |
||||
|
goodsRule = getGoodsRule(param); |
||||
|
}else { |
||||
|
goodsRule = this.getById(param.getRuleId()); |
||||
|
} |
||||
|
|
||||
|
if(goodsRule==null){ |
||||
|
Assert.throwEx("参数异常 500B1 "); |
||||
|
} |
||||
|
|
||||
|
boolean b1 = CollUtil.isNotEmpty(param.getOnlyCategoryIds()); |
||||
|
boolean b2 = CollUtil.isNotEmpty(param.getNotInCategoryIds()); |
||||
|
boolean b3 = CollUtil.isNotEmpty(param.getOnlySpuIds()); |
||||
|
boolean b4 = CollUtil.isNotEmpty(param.getNotInSpuIds()); |
||||
|
|
||||
|
//清空操作
|
||||
|
LambdaQueryWrapper<GoodsRuleItem> rmItem = new LambdaQueryWrapper<>(); |
||||
|
rmItem.eq(GoodsRuleItem::getRuleId,goodsRule.getId()); |
||||
|
goodsRuleItemService.remove(rmItem); |
||||
|
|
||||
|
if(!b1 && !b2 && !b3 && !b4){ |
||||
|
if(goodsRule.getId()!=null){ |
||||
|
goodsRule.setEmptyFlag(1); |
||||
|
this.updateById(goodsRule); |
||||
|
} |
||||
|
}else { |
||||
|
if(goodsRule.getId()!=null){ |
||||
|
goodsRule.setEmptyFlag(0); |
||||
|
this.updateById(goodsRule); |
||||
|
}else { |
||||
|
this.save(goodsRule); |
||||
|
param.setRuleId(goodsRule.getId()); |
||||
|
} |
||||
|
Long ruleId = goodsRule.getId(); |
||||
|
if(b1){ |
||||
|
List<GoodsCategory> categoryList = categoryMapper.selectBatchIds(param.getOnlyCategoryIds()); |
||||
|
List<GoodsRuleItem> ruleItems = categoryList.stream().map(cate->{ |
||||
|
GoodsRuleItem item = new GoodsRuleItem(); |
||||
|
item.setRuleId(ruleId); |
||||
|
item.setTargetType(1); |
||||
|
item.setTargetCode(cate.getCode()); |
||||
|
item.setTargetName(cate.getName()); |
||||
|
item.setTargetId(cate.getId()+""); |
||||
|
return item; |
||||
|
}).collect(Collectors.toList()); |
||||
|
goodsRuleItemService.saveBatch(ruleItems); |
||||
|
} |
||||
|
|
||||
|
if(b2){ |
||||
|
List<GoodsCategory> categoryList = categoryMapper.selectBatchIds(param.getNotInCategoryIds()); |
||||
|
List<GoodsRuleItem> ruleItems = categoryList.stream().map(cate->{ |
||||
|
GoodsRuleItem item = new GoodsRuleItem(); |
||||
|
item.setRuleId(ruleId); |
||||
|
item.setTargetType(2); |
||||
|
item.setTargetCode(cate.getCode()); |
||||
|
item.setTargetName(cate.getName()); |
||||
|
item.setTargetId(cate.getId()+""); |
||||
|
return item; |
||||
|
}).collect(Collectors.toList()); |
||||
|
goodsRuleItemService.saveBatch(ruleItems); |
||||
|
} |
||||
|
|
||||
|
if(b3){ |
||||
|
List<GoodsSpu> spuList = spuMapper.selectBatchIds(param.getOnlySpuIds()); |
||||
|
List<GoodsRuleItem> ruleItems = spuList.stream().map(spu->{ |
||||
|
GoodsRuleItem item = new GoodsRuleItem(); |
||||
|
item.setRuleId(ruleId); |
||||
|
item.setTargetType(3); |
||||
|
item.setTargetCode(spu.getSpuCode()); |
||||
|
item.setTargetName(spu.getName()); |
||||
|
item.setTargetId(spu.getId()+""); |
||||
|
return item; |
||||
|
}).collect(Collectors.toList()); |
||||
|
goodsRuleItemService.saveBatch(ruleItems); |
||||
|
} |
||||
|
|
||||
|
if(b4){ |
||||
|
List<GoodsSpu> spuList = spuMapper.selectBatchIds(param.getNotInSpuIds()); |
||||
|
List<GoodsRuleItem> ruleItems = spuList.stream().map(spu->{ |
||||
|
GoodsRuleItem item = new GoodsRuleItem(); |
||||
|
item.setRuleId(ruleId); |
||||
|
item.setTargetType(4); |
||||
|
item.setTargetCode(spu.getSpuCode()); |
||||
|
item.setTargetName(spu.getName()); |
||||
|
item.setTargetId(spu.getId()+""); |
||||
|
return item; |
||||
|
}).collect(Collectors.toList()); |
||||
|
goodsRuleItemService.saveBatch(ruleItems); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public GoodsRuleVo getVoById(GoodsRuleBaseDTO baseDTO) { |
||||
|
GoodsRule goodsRule = this.getGoodsRule(baseDTO); |
||||
|
if(goodsRule.getId()!=null){ |
||||
|
LambdaQueryWrapper<GoodsRuleItem> listByRuleLqw = new LambdaQueryWrapper<>(); |
||||
|
listByRuleLqw.eq(GoodsRuleItem::getRuleId,goodsRule.getId()); |
||||
|
List<GoodsRuleItem> ruleItems = goodsRuleItemService.list(listByRuleLqw); |
||||
|
Map<Integer,List<GoodsRuleItem>> ruleItemMap = ruleItems.stream() |
||||
|
.collect(Collectors.groupingBy(GoodsRuleItem::getTargetType)); |
||||
|
List<GoodsRuleItem> list1 = ruleItemMap.get(1); |
||||
|
List<GoodsRuleItem> list2 = ruleItemMap.get(2); |
||||
|
List<GoodsRuleItem> list3 = ruleItemMap.get(3); |
||||
|
List<GoodsRuleItem> list4 = ruleItemMap.get(4); |
||||
|
GoodsRuleVo ruleVo = new GoodsRuleVo(); |
||||
|
ruleVo.setRuleId(goodsRule.getId()); |
||||
|
ruleVo.setRemark(goodsRule.getRemark()); |
||||
|
if(CollUtil.isNotEmpty(list1)){ |
||||
|
List<String> ids = list1.stream().map(GoodsRuleItem::getTargetId).collect(Collectors.toList()); |
||||
|
ruleVo.setOnlyCategoryList(categoryMapper.selectBatchIds(ids)); |
||||
|
} |
||||
|
if(CollUtil.isNotEmpty(list2)){ |
||||
|
List<String> ids = list2.stream().map(GoodsRuleItem::getTargetId).collect(Collectors.toList()); |
||||
|
ruleVo.setNotInCategoryList(categoryMapper.selectBatchIds(ids)); |
||||
|
} |
||||
|
if(CollUtil.isNotEmpty(list3)){ |
||||
|
List<String> ids = list3.stream().map(GoodsRuleItem::getTargetId).collect(Collectors.toList()); |
||||
|
ruleVo.setOnlySpuList(spuMapper.selectBatchIds(ids)); |
||||
|
} |
||||
|
if(CollUtil.isNotEmpty(list4)){ |
||||
|
List<String> ids = list4.stream().map(GoodsRuleItem::getTargetId).collect(Collectors.toList()); |
||||
|
ruleVo.setOnlySpuList(spuMapper.selectBatchIds(ids)); |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
private GoodsRule getGoodsRule(GoodsRuleBaseDTO param) { |
||||
|
GoodsRule goodsRule = null; |
||||
|
if(param.getSupplierId()!=null){ |
||||
|
BmsSupplier supplier = supplierMapper.selectById(param.getSupplierId()); |
||||
|
if(supplier!=null){ |
||||
|
goodsRule = super.baseMapper.selectRuleBySupplierId(param.getSupplierId()); |
||||
|
if(goodsRule ==null){ |
||||
|
goodsRule = new GoodsRule(); |
||||
|
goodsRule.setSupplierId(param.getSupplierId()); |
||||
|
} |
||||
|
} |
||||
|
}else if (StringUtils.hasText(param.getBizRegionId())){ |
||||
|
BmsRegion2 region2 = bizRegionMapper.selectById(param.getBizRegionId()); |
||||
|
if(region2!=null){ |
||||
|
goodsRule = super.baseMapper.selectRuleByBizRegionId(param.getBizRegionId()); |
||||
|
if(goodsRule ==null){ |
||||
|
goodsRule = new GoodsRule(); |
||||
|
goodsRule.setBizRegionId(param.getBizRegionId()); |
||||
|
} |
||||
|
} |
||||
|
}else if (StringUtils.hasText(param.getSaleRegionId())){ |
||||
|
BmsRegion region = saleRegionMapper.selectById(param.getSaleRegionId()); |
||||
|
if(region!=null){ |
||||
|
goodsRule = super.baseMapper.selectRuleBySaleRegionId(param.getBizRegionId()); |
||||
|
if(goodsRule ==null){ |
||||
|
goodsRule = new GoodsRule(); |
||||
|
goodsRule.setSaleRegionId(param.getSaleRegionId()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return goodsRule; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -1,25 +0,0 @@ |
|||||
package com.qs.serve.modules.tran.mapper; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
|
||||
import com.qs.serve.modules.tran.domain.OldCost; |
|
||||
import com.qs.serve.modules.tran.domain.OldVerify; |
|
||||
import org.apache.ibatis.annotations.Param; |
|
||||
import org.apache.ibatis.annotations.Select; |
|
||||
import org.apache.ibatis.annotations.Update; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* @author YenHex |
|
||||
* @since 2024/1/24 |
|
||||
*/ |
|
||||
public interface CpOldSupplierCodeMapper { |
|
||||
|
|
||||
|
|
||||
@Update("update ${tableName} set supplier_id = #{cusId},supplier_code = #{cusCode} where cost_apply_id = #{costId}") |
|
||||
int updateSupplierInfo(@Param("tableName")String tableName, |
|
||||
@Param("costId")Long costId, |
|
||||
@Param("cusId")String cusId, |
|
||||
@Param("cusCode")String cusCode); |
|
||||
|
|
||||
} |
|
@ -1,41 +0,0 @@ |
|||||
package com.qs.serve.modules.tran.mapper; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
|
||||
import com.qs.serve.modules.tran.domain.OldCost; |
|
||||
import com.qs.serve.modules.tran.domain.OldVerify; |
|
||||
import org.apache.ibatis.annotations.Select; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* @author YenHex |
|
||||
* @since 2024/1/24 |
|
||||
*/ |
|
||||
public interface TranOldCostMapper { |
|
||||
|
|
||||
@InterceptorIgnore(tenantLine = "true") |
|
||||
@Select("SELECT " + |
|
||||
" old_cost.*, " + |
|
||||
" cus_code as supplierCode, cus_name as supplierName, " + |
|
||||
" usedAmount " + |
|
||||
"FROM " + |
|
||||
" `old_main_cost` old_cost " + |
|
||||
" LEFT JOIN ( " + |
|
||||
" SELECT " + |
|
||||
" cost_code, " + |
|
||||
" cus_code, cus_name, " + |
|
||||
" sum( check_amt ) AS usedAmount " + |
|
||||
" FROM " + |
|
||||
" ( SELECT * FROM old_main_verify UNION SELECT * FROM old_main_verify2 UNION SELECT * FROM old_main_verify3 ) tmp " + |
|
||||
" GROUP BY " + |
|
||||
" cost_code " + |
|
||||
" ) tmp2 on tmp2.cost_code = old_cost.cost_code ") |
|
||||
List<OldCost> listCost(); |
|
||||
|
|
||||
@InterceptorIgnore(tenantLine = "true") |
|
||||
@Select("SELECT * FROM old_main_verify UNION SELECT * FROM old_main_verify2 UNION SELECT * FROM old_main_verify3") |
|
||||
List<OldVerify> listVerifyList(); |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
@ -1,472 +0,0 @@ |
|||||
package com.qs.serve.modules.tran.service; |
|
||||
|
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||
import com.qs.serve.common.config.properties.ProjectApisProperties; |
|
||||
import com.qs.serve.common.model.consts.ResultFlag; |
|
||||
import com.qs.serve.common.model.enums.BudgetLogOptFlag; |
|
||||
import com.qs.serve.common.util.CollectionUtil; |
|
||||
import com.qs.serve.common.util.StringUtils; |
|
||||
import com.qs.serve.modules.bms.entity.BmsSubject; |
|
||||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|
||||
import com.qs.serve.modules.bms.service.BmsCostCenterService; |
|
||||
import com.qs.serve.modules.bms.service.BmsRegionService; |
|
||||
import com.qs.serve.modules.bms.service.BmsSubjectService; |
|
||||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|
||||
import com.qs.serve.modules.goods.entity.GoodsCategory; |
|
||||
import com.qs.serve.modules.goods.entity.GoodsSpu; |
|
||||
import com.qs.serve.modules.goods.service.GoodsCategoryService; |
|
||||
import com.qs.serve.modules.goods.service.GoodsSkuService; |
|
||||
import com.qs.serve.modules.goods.service.GoodsSpuService; |
|
||||
import com.qs.serve.modules.pay.service.PayPaymentItemService; |
|
||||
import com.qs.serve.modules.pay.service.PayPaymentService; |
|
||||
import com.qs.serve.modules.seeyon.service.XiaoLuTonService; |
|
||||
import com.qs.serve.modules.sys.entity.SysUser; |
|
||||
import com.qs.serve.modules.sys.mapper.SysUserCodeMathMapper; |
|
||||
import com.qs.serve.modules.sys.service.SysSyncLogService; |
|
||||
import com.qs.serve.modules.sys.service.SysUserService; |
|
||||
import com.qs.serve.modules.tbs.common.TbsActivityState; |
|
||||
import com.qs.serve.modules.tbs.common.TbsCostApplyState; |
|
||||
import com.qs.serve.modules.tbs.common.util.TbsBudgetLogBuildUtil; |
|
||||
import com.qs.serve.modules.tbs.entity.*; |
|
||||
import com.qs.serve.modules.tbs.mapper.TbsBudgetMapper; |
|
||||
import com.qs.serve.modules.tbs.mapper.TbsScheduleItemBudgetMapper; |
|
||||
import com.qs.serve.modules.tbs.service.*; |
|
||||
import com.qs.serve.modules.tran.domain.OldCost; |
|
||||
import com.qs.serve.modules.tran.domain.OldVerify; |
|
||||
import com.qs.serve.modules.tran.mapper.CpOldSupplierCodeMapper; |
|
||||
import com.qs.serve.modules.tran.mapper.TranOldCostMapper; |
|
||||
import com.qs.serve.modules.tzc.service.TzcPolicyGoodsSyncService; |
|
||||
import com.qs.serve.modules.tzc.service.TzcPolicyItemLogService; |
|
||||
import com.qs.serve.modules.tzc.service.TzcPolicyItemService; |
|
||||
import com.qs.serve.modules.vtb.common.VtbVerificationState; |
|
||||
import com.qs.serve.modules.vtb.entity.VtbVerification; |
|
||||
import com.qs.serve.modules.vtb.entity.VtbVerificationSubject; |
|
||||
import com.qs.serve.modules.vtb.service.VtbVerificationService; |
|
||||
import com.qs.serve.modules.vtb.service.VtbVerificationSubjectService; |
|
||||
import lombok.AllArgsConstructor; |
|
||||
import lombok.extern.slf4j.Slf4j; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
import java.math.BigDecimal; |
|
||||
import java.time.LocalDateTime; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* @author YenHex |
|
||||
* @since 2024/1/24 |
|
||||
*/ |
|
||||
@Slf4j |
|
||||
@Service |
|
||||
@AllArgsConstructor |
|
||||
public class TranOldCostService { |
|
||||
|
|
||||
private TranOldCostMapper tranOldCostMapper; |
|
||||
private SysUserCodeMathMapper userCodeMathMapper; |
|
||||
private final SysSyncLogService sysSyncLogService; |
|
||||
|
|
||||
private TbsActivityService activityService; |
|
||||
private TbsActivityCenterService activityCenterService; |
|
||||
private TbsActivitySubjectService activitySubjectService; |
|
||||
private TbsActivityGoodsService activityGoodsService; |
|
||||
private TbsActivityCenterGoodsService activityCenterGoodsService; |
|
||||
|
|
||||
private BmsSupplierService supplierService; |
|
||||
private BmsSubjectService subjectService; |
|
||||
private BmsCostCenterService costCenterService; |
|
||||
private BmsRegionService saleRegionService; |
|
||||
|
|
||||
private SysUserService userService; |
|
||||
|
|
||||
private TbsCostApplyService costApplyService; |
|
||||
private TbsCostUnItemService costUnItemService; |
|
||||
private TbsBudgetCostItemService costItemService; |
|
||||
private TbsBudgetLogService budgetLogService; |
|
||||
private TbsBudgetApplicationService budgetApplicationService; |
|
||||
private TbsScheduleItemBudgetMapper scheduleItemBudgetMapper; |
|
||||
private TbsBudgetMapper tbsBudgetMapper; |
|
||||
|
|
||||
|
|
||||
private GoodsSkuService goodsSkuService; |
|
||||
private GoodsSpuService goodsSpuService; |
|
||||
private GoodsCategoryService goodsCategoryService; |
|
||||
|
|
||||
private PayPaymentService paymentService; |
|
||||
private PayPaymentItemService paymentItemService; |
|
||||
private CpOldSupplierCodeMapper oldSupplierCodeMapper; |
|
||||
private VtbVerificationService verificationService; |
|
||||
private VtbVerificationSubjectService verificationSubjectService; |
|
||||
|
|
||||
private TzcPolicyItemService policyItemServiceService; |
|
||||
private TzcPolicyItemLogService policyItemLogService; |
|
||||
private TzcPolicyGoodsSyncService tzcPolicyGoodsSyncService; |
|
||||
private final XiaoLuTonService xiaoLuTonService; |
|
||||
|
|
||||
private ProjectApisProperties projectApisProperties; |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
public void syncOldCost(){ |
|
||||
Long scheduleItemBudgetId = 4896L; |
|
||||
|
|
||||
String centerType = "center"; |
|
||||
String centerId = "71"; |
|
||||
String centerName = "BI历史记录"; |
|
||||
String centerCode = "HIS2022"; |
|
||||
|
|
||||
BmsSubject subject = new BmsSubject(); |
|
||||
subject.setId(79L); |
|
||||
subject.setSubjectName("原BI科目"); |
|
||||
subject.setSubjectCode("10001"); |
|
||||
|
|
||||
TbsScheduleItemBudget itemBudget = scheduleItemBudgetMapper.selectById(scheduleItemBudgetId); |
|
||||
|
|
||||
final BigDecimal OneHundred = new BigDecimal("100"); |
|
||||
|
|
||||
List<OldCost> costList = tranOldCostMapper.listCost(); |
|
||||
|
|
||||
for (OldCost oldCost : costList) { |
|
||||
|
|
||||
String costCode = oldCost.getCostCode(); |
|
||||
|
|
||||
LambdaQueryWrapper<TbsCostApply> costLqwCount = new LambdaQueryWrapper<>(); |
|
||||
costLqwCount.eq(TbsCostApply::getCode,costCode); |
|
||||
|
|
||||
if(costApplyService.count(costLqwCount)>0){ |
|
||||
log.warn("已存:{}",costCode); |
|
||||
continue; |
|
||||
} |
|
||||
|
|
||||
BmsSupplier supplier = supplierService.getByNameOrCode(oldCost.getSupplierCode()); |
|
||||
|
|
||||
if(supplier==null){ |
|
||||
supplier = new BmsSupplier(); |
|
||||
supplier.setId("0"); |
|
||||
if(oldCost.getSupplierCode()==null){ |
|
||||
supplier.setCode("未指定客户"); |
|
||||
supplier.setName("未指定客户"); |
|
||||
}else { |
|
||||
supplier.setCode(oldCost.getSupplierCode()); |
|
||||
supplier.setName(oldCost.getSupplierName()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
Long supplierId = Long.parseLong(supplier.getId()); |
|
||||
|
|
||||
SysUser user = new SysUser(); |
|
||||
if(oldCost.getCheckUser()!=null&&oldCost.getCheckUser().contains(" - ")){ |
|
||||
String[] users = oldCost.getCheckUser().split(" - "); |
|
||||
user.setId("0"); |
|
||||
user.setCode(users[0]); |
|
||||
user.setName(users[1]); |
|
||||
}else { |
|
||||
user.setId("0"); |
|
||||
user.setCode("系统导入"); |
|
||||
user.setName("系统导入"); |
|
||||
} |
|
||||
|
|
||||
BigDecimal usedAmt = oldCost.getUsedAmount(); |
|
||||
BigDecimal totalAmount = oldCost.getCostPrice(); |
|
||||
|
|
||||
//构建费用申请
|
|
||||
TbsCostApply costApply = new TbsCostApply(); |
|
||||
costApply.setCode(oldCost.getCostCode()); |
|
||||
costApply.setMatchType(-1); |
|
||||
String chargeTheme = StringUtils.tailorLen(oldCost.getCostTitle(),590); |
|
||||
costApply.setChargeTheme(chargeTheme); |
|
||||
costApply.setChargeState(TbsCostApplyState.State_3_finished.getCode()); |
|
||||
costApply.setSupplierId(Long.parseLong(supplier.getId())); |
|
||||
costApply.setSupplierName(supplier.getName()); |
|
||||
costApply.setSupplierCode(supplier.getCode()); |
|
||||
costApply.setUserId(user.getId()); |
|
||||
costApply.setUserCode(user.getCode()); |
|
||||
costApply.setUserName(user.getName()); |
|
||||
costApply.setTotalActivity(1); |
|
||||
costApply.setTotalActivityAmount(totalAmount); |
|
||||
costApply.setTotalActivityUsedAmount(usedAmt); |
|
||||
costApply.setSubmitTime(oldCost.getCreateTime()); |
|
||||
costApply.setCreateTime(oldCost.getCreateTime()); |
|
||||
costApply.setRemark(StringUtils.tailorLen(oldCost.getRemark(),590)); |
|
||||
|
|
||||
//构建活动
|
|
||||
TbsActivity activity = new TbsActivity(); |
|
||||
activity.setActivityCode(oldCost.getCostCode()); |
|
||||
activity.setActivityState(TbsActivityState.STATE_1_Finished); |
|
||||
activity.setCostPassFlag(1); |
|
||||
activity.setCostPassTime(oldCost.getCheckTime()); |
|
||||
activity.setActTitle(chargeTheme); |
|
||||
activity.setSupplierId(supplierId); |
|
||||
activity.setSupplierName(supplier.getName()); |
|
||||
activity.setSupplierCode(supplier.getCode()); |
|
||||
activity.setActStartDate(oldCost.getStartDate()); |
|
||||
activity.setActEndDate(oldCost.getEndDate()); |
|
||||
activity.setPreStartDate(oldCost.getStartDate()); |
|
||||
activity.setPreEndDate(oldCost.getEndDate()); |
|
||||
activity.setPreCheckDate(oldCost.getEndDate()); |
|
||||
activity.setPreActQuantity(oldCost.getCostPrePrice()); |
|
||||
activity.setTotalAmount(totalAmount); |
|
||||
activity.setUsedAmount(usedAmt); |
|
||||
activity.setFinishedFlag(ResultFlag.OK); |
|
||||
activity.setFinishedTime(oldCost.getCreateTime()); |
|
||||
|
|
||||
//活动-科目
|
|
||||
TbsActivitySubject activitySubject = new TbsActivitySubject(); |
|
||||
activitySubject.setSubjectId(subject.getId()); |
|
||||
activitySubject.setSubjectCode(subject.getSubjectCode()); |
|
||||
activitySubject.setSubjectName(subject.getSubjectName()); |
|
||||
activitySubject.setAmount(totalAmount); |
|
||||
activitySubject.setUsedAmount(usedAmt); |
|
||||
activitySubject.setCountSession(0); |
|
||||
activitySubject.setCountPerson(0); |
|
||||
|
|
||||
//活动-成本中心
|
|
||||
TbsActivityCenter activityCenter = new TbsActivityCenter(); |
|
||||
activityCenter.setSubjectId(subject.getId()); |
|
||||
activityCenter.setCenterAmount(totalAmount); |
|
||||
activityCenter.setCenterRate(OneHundred); |
|
||||
activityCenter.setCenterType(centerType); |
|
||||
activityCenter.setCenterId(centerId); |
|
||||
activityCenter.setCenterName(centerName); |
|
||||
activityCenter.setCenterCode(centerCode); |
|
||||
activityCenter.setUsedAmount(totalAmount); |
|
||||
|
|
||||
//品类
|
|
||||
TbsActivityGoods activityGoods = new TbsActivityGoods(); |
|
||||
activityGoods.setTargetType("brand"); |
|
||||
activityGoods.setTargetId(102L); |
|
||||
activityGoods.setTargetCode("B101"); |
|
||||
activityGoods.setTargetName("原BI品牌"); |
|
||||
activityGoods.setTargetLevelPathIds("102"); |
|
||||
activityGoods.setTargetLevelPathNames("原BI品牌"); |
|
||||
|
|
||||
TbsActivityCenterGoods centerGoods = new TbsActivityCenterGoods(); |
|
||||
centerGoods.setActivityCode(activity.getActivityCode()); |
|
||||
centerGoods.setCenterGoodsCode(activity.getActivityCode()); |
|
||||
centerGoods.setSupplierId(supplierId); |
|
||||
centerGoods.setSupplierCode(supplier.getCode()); |
|
||||
centerGoods.setSupplierName(supplier.getName()); |
|
||||
//设置成本中心
|
|
||||
centerGoods.setCenterType(centerType); |
|
||||
centerGoods.setCenterId(centerId); |
|
||||
centerGoods.setCenterName(centerName); |
|
||||
centerGoods.setCenterCode(centerCode); |
|
||||
centerGoods.setCenterRate(OneHundred); |
|
||||
centerGoods.setCenterAmount(totalAmount); |
|
||||
//设置科目
|
|
||||
centerGoods.setSubjectId(subject.getId()); |
|
||||
centerGoods.setSubjectCode(subject.getSubjectCode()); |
|
||||
centerGoods.setSubjectName(subject.getSubjectName()); |
|
||||
//设置活动时间
|
|
||||
centerGoods.setActEndDate(oldCost.getEndDate()); |
|
||||
centerGoods.setActStartDate(oldCost.getStartDate()); |
|
||||
centerGoods.setPreEndDate(oldCost.getEndDate()); |
|
||||
centerGoods.setPreStartDate(oldCost.getStartDate()); |
|
||||
centerGoods.setPreCheckDate(oldCost.getEndDate()); |
|
||||
//设置目标
|
|
||||
centerGoods.setTargetId(activityGoods.getTargetId()); |
|
||||
centerGoods.setTargetType(activityGoods.getTargetType()); |
|
||||
centerGoods.setTargetCode(activityGoods.getTargetCode()); |
|
||||
centerGoods.setTargetName(activityGoods.getTargetName()); |
|
||||
centerGoods.setTargetLevelPathIds(activityGoods.getTargetLevelPathIds()); |
|
||||
centerGoods.setTargetLevelPathNames(activityGoods.getTargetLevelPathNames()); |
|
||||
// 分配金额
|
|
||||
centerGoods.setCenterGoodsAmount(totalAmount); |
|
||||
centerGoods.setCenterGoodsRate(OneHundred); |
|
||||
centerGoods.setUsedAmount(usedAmt); |
|
||||
|
|
||||
|
|
||||
//保存活动有关数据
|
|
||||
costApplyService.save(costApply); |
|
||||
activity.setCostApplyId(costApply.getId()); |
|
||||
activityService.save(activity); |
|
||||
|
|
||||
activitySubject.setCostApplyId(costApply.getId()); |
|
||||
activitySubject.setActivityId(activity.getId()); |
|
||||
activitySubjectService.save(activitySubject); |
|
||||
|
|
||||
activityCenter.setCostApplyId(costApply.getId()); |
|
||||
activityCenter.setActivityId(activity.getId()); |
|
||||
activityCenterService.save(activityCenter); |
|
||||
|
|
||||
activityGoods.setCostApplyId(costApply.getId()); |
|
||||
activityGoods.setActivityId(activity.getId()); |
|
||||
activityGoodsService.save(activityGoods); |
|
||||
|
|
||||
centerGoods.setCostApplyId(costApply.getId()); |
|
||||
centerGoods.setActivityId(activity.getId()); |
|
||||
activityCenterGoodsService.save(centerGoods); |
|
||||
|
|
||||
//匹配的商品,生成预算日志
|
|
||||
TbsBudgetCostItem costItem = new TbsBudgetCostItem(); |
|
||||
costItem.setCenterGoodsCode(centerGoods.getCenterGoodsCode()); |
|
||||
costItem.setCostApplyId(centerGoods.getCostApplyId()); |
|
||||
costItem.setActivityId(centerGoods.getActivityId()); |
|
||||
costItem.setActivityCode(centerGoods.getActivityCode()); |
|
||||
costItem.setSupplierId(centerGoods.getSupplierId()); |
|
||||
costItem.setSupplierCode(centerGoods.getSupplierCode()); |
|
||||
costItem.setSupplierName(centerGoods.getSupplierName()); |
|
||||
costItem.setSubjectId(centerGoods.getSubjectId()); |
|
||||
costItem.setSubjectCode(centerGoods.getSubjectCode()); |
|
||||
costItem.setSubjectName(centerGoods.getSubjectName()); |
|
||||
costItem.setCenterType(centerGoods.getCenterType()); |
|
||||
costItem.setCenterId(centerGoods.getCenterId()); |
|
||||
costItem.setCenterCode(centerGoods.getCenterCode()); |
|
||||
costItem.setCenterName(centerGoods.getCenterName()); |
|
||||
costItem.setCenterAmount(centerGoods.getCenterAmount()); |
|
||||
costItem.setCenterRate(centerGoods.getCenterRate()); |
|
||||
costItem.setCenterGoodsAmount(centerGoods.getCenterGoodsAmount()); |
|
||||
costItem.setCenterGoodsRate(centerGoods.getCenterGoodsRate()); |
|
||||
costItem.setTargetType(centerGoods.getTargetType()); |
|
||||
costItem.setTargetId(centerGoods.getTargetId()); |
|
||||
costItem.setTargetCode(centerGoods.getTargetCode()); |
|
||||
costItem.setTargetName(centerGoods.getTargetName()); |
|
||||
costItem.setTargetLevelPathIds(centerGoods.getTargetLevelPathIds()); |
|
||||
costItem.setTargetLevelPathNames(centerGoods.getTargetLevelPathNames()); |
|
||||
costItem.setActStartDate(centerGoods.getActStartDate()); |
|
||||
costItem.setActEndDate(centerGoods.getActEndDate()); |
|
||||
costItem.setPreStartDate(centerGoods.getPreStartDate()); |
|
||||
costItem.setPreEndDate(centerGoods.getPreEndDate()); |
|
||||
costItem.setPreCheckDate(centerGoods.getPreCheckDate()); |
|
||||
costItem.setCenterGoodItemId(centerGoods.getId()); |
|
||||
|
|
||||
|
|
||||
TbsBudgetLog budgetLog = TbsBudgetLogBuildUtil.buildTbsBudgetLog(BudgetLogOptFlag.State_1,user, costApply, itemBudget, centerGoods,centerGoods.getCenterGoodsAmount(),activity); |
|
||||
costItem.setBudgetId(itemBudget.getBudgetId()); |
|
||||
costItem.setScheduleId(itemBudget.getScheduleId()); |
|
||||
costItem.setScheduleItemId(itemBudget.getScheduleItemId()); |
|
||||
costItem.setScheduleItemName(itemBudget.getItemName()); |
|
||||
costItem.setScheduleItemAmount(itemBudget.getFinalBudgetAmount()); |
|
||||
costItem.setScheduleItemAmountUsed(itemBudget.getUsedBudgetAmount()); |
|
||||
costItem.setScheduleItemAmountApply(itemBudget.getUnUsedBudgetAmount()); |
|
||||
costItem.setScheduleItemBudgetId(itemBudget.getId()); |
|
||||
budgetLogService.save(budgetLog); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public void syncVerify(){ |
|
||||
|
|
||||
BmsSubject subject = new BmsSubject(); |
|
||||
subject.setId(79L); |
|
||||
subject.setSubjectName("原BI科目"); |
|
||||
subject.setSubjectCode("10001"); |
|
||||
|
|
||||
List<OldVerify> oldVerifyList = tranOldCostMapper.listVerifyList(); |
|
||||
|
|
||||
for (OldVerify oldVerify : oldVerifyList) { |
|
||||
TbsCostApply costApply = costApplyService.getByCode(oldVerify.getCostCode()); |
|
||||
//if(oldVerify.getCode())
|
|
||||
long count = verificationService.count(new LambdaQueryWrapper<VtbVerification>() |
|
||||
.eq(VtbVerification::getVerificationCode,oldVerify.getCostCode())); |
|
||||
if(count>0L){ |
|
||||
log.warn("已存"); |
|
||||
continue; |
|
||||
} |
|
||||
if(costApply==null){ |
|
||||
log.warn("费用缺失"); |
|
||||
continue; |
|
||||
} |
|
||||
|
|
||||
TbsActivity activity = activityService.listByCostApplyId(costApply.getId()).get(0); |
|
||||
|
|
||||
String verifyCode = oldVerify.getCode(); |
|
||||
|
|
||||
BigDecimal totalAmount = oldVerify.getCheckAmt(); |
|
||||
|
|
||||
LocalDateTime nowTime = oldVerify.getSubmitDate(); |
|
||||
|
|
||||
SysUser user = new SysUser(); |
|
||||
if(oldVerify.getCheckUser()!=null&&oldVerify.getCheckUser().contains(" - ")){ |
|
||||
String[] users = oldVerify.getCheckUser().split(" - "); |
|
||||
user.setId("0"); |
|
||||
user.setCode(users[0]); |
|
||||
user.setName(users[1]); |
|
||||
}else { |
|
||||
user.setId("0"); |
|
||||
user.setCode("系统导入"); |
|
||||
user.setName("系统导入"); |
|
||||
} |
|
||||
|
|
||||
//保存核销申请
|
|
||||
VtbVerification verification = new VtbVerification(); |
|
||||
verification.setVerificationCode(verifyCode); |
|
||||
verification.setVerificationMainCode(verification.getVerificationCode()); |
|
||||
verification.setCostApplyId(costApply.getId()); |
|
||||
verification.setFinishedTime(nowTime); |
|
||||
verification.setVerificationState(VtbVerificationState.Finished.getCode()); |
|
||||
verification.setActivityId(activity.getId()); |
|
||||
verification.setSupplierId(activity.getSupplierId()); |
|
||||
verification.setSupplierCode(activity.getSupplierCode()); |
|
||||
verification.setSupplierName(activity.getSupplierName()); |
|
||||
verification.setUserId(user.getId()); |
|
||||
verification.setUserCode(user.getCode()); |
|
||||
verification.setUserName(user.getName()); |
|
||||
verification.setAmount(totalAmount); |
|
||||
verification.setAmountRecord(totalAmount); |
|
||||
verification.setPaymentState(ResultFlag.OK); |
|
||||
String remark = StringUtils.tailorLen("["+oldVerify.getSubjectName()+"]"+oldVerify.getTitle()+"备注:"+oldVerify.getRemark(),580); |
|
||||
verification.setRemark(remark); |
|
||||
verificationService.save(verification); |
|
||||
|
|
||||
//保存核销费用结果
|
|
||||
VtbVerificationSubject verificationSubject = new VtbVerificationSubject(); |
|
||||
verificationSubject.setVerificationId(verification.getId()); |
|
||||
verificationSubject.setVerificationSubCode(verification.getVerificationCode()+"_1"); |
|
||||
verificationSubject.setCostApplyId(costApply.getId()); |
|
||||
verificationSubject.setActivityId(activity.getId()); |
|
||||
verificationSubject.setSubjectId(costApply.getId()); |
|
||||
verificationSubject.setSubjectCode(subject.getSubjectCode()); |
|
||||
verificationSubject.setSubjectName(subject.getSubjectName()); |
|
||||
verificationSubject.setSupplierId(costApply.getSupplierId()); |
|
||||
verificationSubject.setSupplierCode(costApply.getSupplierCode()); |
|
||||
verificationSubject.setSupplierName(costApply.getSupplierName()); |
|
||||
verificationSubject.setPayFinishedFlag(ResultFlag.OK); |
|
||||
verificationSubject.setUsedAmount(totalAmount); |
|
||||
verificationSubject.setUsedAmountRecord(totalAmount); |
|
||||
verificationSubject.setCountPerson(0); |
|
||||
verificationSubject.setCountSession(0); |
|
||||
verificationSubjectService.save(verificationSubject); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
public void cpSupplierCode(){ |
|
||||
LambdaQueryWrapper<TbsCostApply> costLqw = new LambdaQueryWrapper<>(); |
|
||||
costLqw.eq(TbsCostApply::getMatchType,-1); |
|
||||
List<TbsCostApply> costApplyList = costApplyService.list(costLqw); |
|
||||
for (TbsCostApply costApply : costApplyList) { |
|
||||
String cusCode = costApply.getSupplierCode(); |
|
||||
boolean jtCus = cusCode.contains("JT"); |
|
||||
if(!jtCus){ |
|
||||
cusCode = "JT"+cusCode; |
|
||||
} |
|
||||
String cusId = "0"; |
|
||||
BmsSupplier supplier = supplierService.getByCode(cusCode,null); |
|
||||
if(supplier==null){ |
|
||||
supplier = new BmsSupplier(); |
|
||||
supplier.setSupplierCode(cusCode); |
|
||||
}else { |
|
||||
cusId = supplier.getId(); |
|
||||
} |
|
||||
|
|
||||
//更新相关
|
|
||||
oldSupplierCodeMapper.updateSupplierInfo("tbs_activity",costApply.getId(),cusId,cusCode); |
|
||||
oldSupplierCodeMapper.updateSupplierInfo("tbs_activity_center_goods",costApply.getId(),cusId,cusCode); |
|
||||
oldSupplierCodeMapper.updateSupplierInfo("tbs_budget_cost_item",costApply.getId(),cusId,cusCode); |
|
||||
oldSupplierCodeMapper.updateSupplierInfo("tbs_budget_log",costApply.getId(),cusId,cusCode); |
|
||||
oldSupplierCodeMapper.updateSupplierInfo("vtb_verification",costApply.getId(),cusId,cusCode); |
|
||||
oldSupplierCodeMapper.updateSupplierInfo("vtb_verification_subject",costApply.getId(),cusId,cusCode); |
|
||||
|
|
||||
//标记为-2,代表成功
|
|
||||
costApply.setSupplierId(Long.parseLong(cusId)); |
|
||||
costApply.setSupplierCode(cusCode); |
|
||||
costApply.setMatchType(-2); |
|
||||
costApplyService.updateById(costApply); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
Loading…
Reference in new issue