11 changed files with 478 additions and 1 deletions
@ -0,0 +1,117 @@ |
|||
package com.qs.serve.modules.sale.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.sale.entity.bo.SalePlanBo; |
|||
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.sale.entity.SalePlan; |
|||
import com.qs.serve.modules.sale.service.SalePlanService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 销售 销售计划 |
|||
* @author YenHex |
|||
* @since 2023-09-20 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("sale/plan") |
|||
public class SalePlanController { |
|||
|
|||
private SalePlanService salePlanService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
//@GetMapping("/list")
|
|||
public R<List<SalePlan>> getList(SalePlan param){ |
|||
LambdaQueryWrapper<SalePlan> lqw = new LambdaQueryWrapper<>(param); |
|||
List<SalePlan> list = salePlanService.list(lqw); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<SalePlan>> getPage(SalePlan param){ |
|||
LambdaQueryWrapper<SalePlan> lqw = new LambdaQueryWrapper<>(param); |
|||
PageUtil.startPage(); |
|||
List<SalePlan> list = salePlanService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.SALE, title = "销售计划", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('sale:plan:query')") |
|||
public R<SalePlan> getById(@PathVariable("id") String id){ |
|||
SalePlan salePlan = salePlanService.getById(id); |
|||
return R.ok(salePlan); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.SALE, title = "销售计划", biz = BizType.UPDATE) |
|||
public R<?> updateById(@RequestBody @Valid SalePlanBo param){ |
|||
SalePlan entity = CopierUtil.copy(param,new SalePlan()); |
|||
boolean result = salePlanService.updateById(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.SALE, title = "销售计划", biz = BizType.INSERT) |
|||
public R<?> save(@RequestBody @Valid SalePlanBo param){ |
|||
SalePlan entity = CopierUtil.copy(param,new SalePlan()); |
|||
boolean result = salePlanService.save(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.SALE, title = "销售计划", biz = BizType.DELETE) |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = salePlanService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,125 @@ |
|||
package com.qs.serve.modules.sale.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 2023-09-20 |
|||
*/ |
|||
@Data |
|||
@TableName("sale_plan") |
|||
public class SalePlan implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 编码 */ |
|||
@NotBlank(message = "编码不能为空") |
|||
@Length(max = 50,message = "编码长度不能超过50字") |
|||
private String planCode; |
|||
|
|||
/** 标题 */ |
|||
@NotBlank(message = "标题不能为空") |
|||
@Length(max = 255,message = "标题长度不能超过255字") |
|||
private String planTitle; |
|||
|
|||
/** 状态 */ |
|||
@NotNull(message = "状态不能为空") |
|||
private Integer planState; |
|||
|
|||
/** 发布人id */ |
|||
@Length(max = 255,message = "发布人id长度不能超过255字") |
|||
private String userId; |
|||
|
|||
/** 发布人编码 */ |
|||
@Length(max = 255,message = "发布人编码长度不能超过255字") |
|||
private String userCode; |
|||
|
|||
/** 发布人 */ |
|||
@Length(max = 255,message = "发布人长度不能超过255字") |
|||
private String userName; |
|||
|
|||
/** 客户id */ |
|||
@Length(max = 255,message = "客户id长度不能超过255字") |
|||
private String supplierId; |
|||
|
|||
/** 客户编码 */ |
|||
@Length(max = 255,message = "客户编码长度不能超过255字") |
|||
private String supplierCode; |
|||
|
|||
/** 客户名称 */ |
|||
@Length(max = 255,message = "客户名称长度不能超过255字") |
|||
private String supplierName; |
|||
|
|||
/** 创建时间 */ |
|||
@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 SalePlan toNewObject(SalePlan source){ |
|||
SalePlan plan = new SalePlan(); |
|||
plan.setId(source.getId()); |
|||
plan.setPlanCode(source.getPlanCode()); |
|||
plan.setPlanTitle(source.getPlanTitle()); |
|||
plan.setPlanState(source.getPlanState()); |
|||
plan.setUserId(source.getUserId()); |
|||
plan.setUserCode(source.getUserCode()); |
|||
plan.setUserName(source.getUserName()); |
|||
plan.setSupplierId(source.getSupplierId()); |
|||
plan.setSupplierCode(source.getSupplierCode()); |
|||
plan.setSupplierName(source.getSupplierName()); |
|||
plan.setCreateTime(source.getCreateTime()); |
|||
plan.setUpdateTime(source.getUpdateTime()); |
|||
plan.setTenantId(source.getTenantId()); |
|||
plan.setDelFlag(source.getDelFlag()); |
|||
plan.setCreateBy(source.getCreateBy()); |
|||
plan.setUpdateBy(source.getUpdateBy()); |
|||
return plan; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,126 @@ |
|||
package com.qs.serve.modules.sale.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 2023-09-20 |
|||
*/ |
|||
@Data |
|||
@TableName("sale_plan_goods") |
|||
public class SalePlanGoods implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 标题 */ |
|||
@NotNull(message = "标题不能为空") |
|||
private Long planId; |
|||
|
|||
/** 状态 */ |
|||
@NotNull(message = "状态不能为空") |
|||
private Integer planState; |
|||
|
|||
/** 目标类型(brand、category、series、spu、sku) */ |
|||
@NotBlank(message = "目标类型(brand、category、series、spu、sku)不能为空") |
|||
@Length(max = 30,message = "目标类型(brand、category、series、spu、sku)长度不能超过30字") |
|||
private String targetType; |
|||
|
|||
/** 目标id */ |
|||
@NotNull(message = "目标id不能为空") |
|||
private Long targetId; |
|||
|
|||
/** 目标编码 */ |
|||
@NotBlank(message = "目标编码不能为空") |
|||
@Length(max = 30,message = "目标编码长度不能超过30字") |
|||
private String targetCode; |
|||
|
|||
/** 目标名称 */ |
|||
@NotBlank(message = "目标名称不能为空") |
|||
@Length(max = 200,message = "目标名称长度不能超过200字") |
|||
private String targetName; |
|||
|
|||
/** 目标等级路径 */ |
|||
@Length(max = 600,message = "目标等级路径长度不能超过600字") |
|||
private String targetLevelPathIds; |
|||
|
|||
/** 目标等级路径 */ |
|||
@Length(max = 800,message = "目标等级路径长度不能超过800字") |
|||
private String targetLevelPathNames; |
|||
|
|||
/** 计划数量 */ |
|||
@NotNull(message = "计划数量不能为空") |
|||
private Integer qty; |
|||
|
|||
/** 创建时间 */ |
|||
@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; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
|
|||
public static SalePlanGoods toNewObject(SalePlanGoods source){ |
|||
SalePlanGoods planGoods = new SalePlanGoods(); |
|||
planGoods.setId(source.getId()); |
|||
planGoods.setPlanId(source.getPlanId()); |
|||
planGoods.setPlanState(source.getPlanState()); |
|||
planGoods.setTargetType(source.getTargetType()); |
|||
planGoods.setTargetId(source.getTargetId()); |
|||
planGoods.setTargetCode(source.getTargetCode()); |
|||
planGoods.setTargetName(source.getTargetName()); |
|||
planGoods.setTargetLevelPathIds(source.getTargetLevelPathIds()); |
|||
planGoods.setTargetLevelPathNames(source.getTargetLevelPathNames()); |
|||
planGoods.setQty(source.getQty()); |
|||
planGoods.setCreateTime(source.getCreateTime()); |
|||
planGoods.setCreateBy(source.getCreateBy()); |
|||
planGoods.setUpdateTime(source.getUpdateTime()); |
|||
planGoods.setUpdateBy(source.getUpdateBy()); |
|||
planGoods.setDelFlag(source.getDelFlag()); |
|||
planGoods.setTenantId(source.getTenantId()); |
|||
return planGoods; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,8 @@ |
|||
package com.qs.serve.modules.sale.entity.bo; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/9/20 |
|||
*/ |
|||
public class SalePlanBo { |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.sale.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.sale.entity.SalePlanGoods; |
|||
|
|||
/** |
|||
* 销售计划商品 Mapper |
|||
* @author YenHex |
|||
* @date 2023-09-20 |
|||
*/ |
|||
public interface SalePlanGoodsMapper extends BaseMapper<SalePlanGoods> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.sale.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.sale.entity.SalePlan; |
|||
|
|||
/** |
|||
* 销售计划 Mapper |
|||
* @author YenHex |
|||
* @date 2023-09-20 |
|||
*/ |
|||
public interface SalePlanMapper extends BaseMapper<SalePlan> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.sale.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.sale.entity.SalePlanGoods; |
|||
|
|||
/** |
|||
* 销售计划商品 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-09-20 |
|||
*/ |
|||
public interface SalePlanGoodsService extends IService<SalePlanGoods> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.sale.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.sale.entity.SalePlan; |
|||
|
|||
/** |
|||
* 销售计划 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-09-20 |
|||
*/ |
|||
public interface SalePlanService extends IService<SalePlan> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.sale.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.sale.entity.SalePlanGoods; |
|||
import com.qs.serve.modules.sale.service.SalePlanGoodsService; |
|||
import com.qs.serve.modules.sale.mapper.SalePlanGoodsMapper; |
|||
|
|||
/** |
|||
* 销售计划商品 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-09-20 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class SalePlanGoodsServiceImpl extends ServiceImpl<SalePlanGoodsMapper,SalePlanGoods> implements SalePlanGoodsService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.sale.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.sale.entity.SalePlan; |
|||
import com.qs.serve.modules.sale.service.SalePlanService; |
|||
import com.qs.serve.modules.sale.mapper.SalePlanMapper; |
|||
|
|||
/** |
|||
* 销售计划 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-09-20 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class SalePlanServiceImpl extends ServiceImpl<SalePlanMapper,SalePlan> implements SalePlanService { |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue