From 1fb4bdeb4fa9fdbf6be21f25e9293cfdd2e2a435 Mon Sep 17 00:00:00 2001 From: bai <1643359946@qq.com> Date: Thu, 13 Jun 2024 00:57:17 +0800 Subject: [PATCH] =?UTF-8?q?2024=E5=B9=B46=E6=9C=8813=E6=97=A5=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8A=80=E5=B8=88=E4=B8=8E=E7=89=A9=E6=96=99=E5=85=B3?= =?UTF-8?q?=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BlArtificerSelfGoodsController.java | 91 +++++++++++++ ...erSelfGoodsEntryExitRecordsController.java | 90 +++++++++++++ .../dao/BlArtificerSelfGoodsDao.java | 14 ++ ...ArtificerSelfGoodsEntryExitRecordsDao.java | 14 ++ .../entity/BlArtificerSelfGoods.java | 111 ++++++++++++++++ .../BlArtificerSelfGoodsEntryExitRecords.java | 96 ++++++++++++++ .../enums/ArtificerSelfGoodsEnum.java | 35 +++++ ...ficerSelfGoodsEntryExitRecordsService.java | 19 +++ .../service/BlArtificerSelfGoodsService.java | 84 ++++++++++++ ...rSelfGoodsEntryExitRecordsServiceImpl.java | 59 +++++++++ .../impl/BlArtificerSelfGoodsServiceImpl.java | 125 ++++++++++++++++++ .../service/impl/TravelConfServiceImpl.java | 25 +++- 12 files changed, 759 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/controller/BlArtificerSelfGoodsController.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/controller/BlArtificerSelfGoodsEntryExitRecordsController.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/dao/BlArtificerSelfGoodsDao.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/dao/BlArtificerSelfGoodsEntryExitRecordsDao.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/entity/BlArtificerSelfGoods.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/entity/BlArtificerSelfGoodsEntryExitRecords.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/enums/ArtificerSelfGoodsEnum.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/service/BlArtificerSelfGoodsEntryExitRecordsService.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/service/BlArtificerSelfGoodsService.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/service/impl/BlArtificerSelfGoodsEntryExitRecordsServiceImpl.java create mode 100644 src/main/java/com/sqx/modules/artificerselfgoods/service/impl/BlArtificerSelfGoodsServiceImpl.java diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/controller/BlArtificerSelfGoodsController.java b/src/main/java/com/sqx/modules/artificerselfgoods/controller/BlArtificerSelfGoodsController.java new file mode 100644 index 0000000..4f41643 --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/controller/BlArtificerSelfGoodsController.java @@ -0,0 +1,91 @@ +package com.sqx.modules.artificerselfgoods.controller; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.sqx.common.utils.Result; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoods; +import com.sqx.modules.artificerselfgoods.service.BlArtificerSelfGoodsService; +import com.sqx.modules.artificerselfgoods.service.BlArtificerSelfGoodsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; + +/** + * @author bai + * @date 2024/06/08 + */ +@RestController +@Api(value = "v3-技师与物料关系表", tags = { "v3-技师与物料关系表" }) +@RequestMapping(value = "/blArtificerSelfGoods") +public class BlArtificerSelfGoodsController { + + @Autowired + private BlArtificerSelfGoodsService service; + + @GetMapping("/list") + @ApiOperation("获取数据列表") + public Result list(BlArtificerSelfGoods entity, Integer page,Integer limit){ + QueryWrapper qw = new QueryWrapper<>(); + +// if(entity != null) { + //价格类型 +// qw.lambda().eq(entity.getPricingType() != null, BlArtificerSelfGoods::getPricingType, entity.getPricingType()); +// //出行方式 +// qw.lambda().eq(entity.getTravelType() != null, BlArtificerSelfGoods::getTravelType, entity.getTravelType()); +// //时令 +// qw.lambda().eq(entity.getSeasonsType() != null, BlArtificerSelfGoods::getSeasonsType, entity.getSeasonsType()); +// //时段 +// qw.lambda().eq(entity.getTimeIntervalType() != null, BlArtificerSelfGoods::getTimeIntervalType, entity.getTimeIntervalType()); +// } + +// qw.orderByAsc("sort"); + IPage pageList = service.page(new Page<>(page,limit),qw); + return Result.success().put("data",pageList); + } + + @PostMapping(value = "/add") + @ApiOperation("新增") + public Result add(@RequestBody BlArtificerSelfGoods entity){ + entity.setCreateTime(DateUtil.now()); + entity.setUpdateTime(DateUtil.now()); + return Result.success().put("data",service.save(entity)); + } + + @PostMapping(value = "/update") + @ApiOperation("修改") + public Result update(@RequestBody BlArtificerSelfGoods entity){ + entity.setUpdateTime(DateUtil.now()); + return Result.success().put("data",service.updateById(entity)); + } + + @RequestMapping("/info/{id}") + public Result info(@PathVariable("id") Long id){ + BlArtificerSelfGoods data = service.getById(id); + return Result.success().put("data", data); + } + + @DeleteMapping(value = "/deleteById") + @ApiOperation("删除") + public Result deleteById(Long id){ + service.removeById(id); + return Result.success(); + } + + @DeleteMapping(value = "/deleteByIds") + @ApiOperation("批量删除") + public Result deleteByIds(String id){ + if(StringUtils.isNotBlank(id)){ + String[] ids = StringUtils.split(id,","); + service.removeByIds(Arrays.asList(ids)); + } + return Result.success(); + } + + +} \ No newline at end of file diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/controller/BlArtificerSelfGoodsEntryExitRecordsController.java b/src/main/java/com/sqx/modules/artificerselfgoods/controller/BlArtificerSelfGoodsEntryExitRecordsController.java new file mode 100644 index 0000000..38da838 --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/controller/BlArtificerSelfGoodsEntryExitRecordsController.java @@ -0,0 +1,90 @@ +package com.sqx.modules.artificerselfgoods.controller; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.sqx.common.utils.Result; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoodsEntryExitRecords; +import com.sqx.modules.artificerselfgoods.service.BlArtificerSelfGoodsEntryExitRecordsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; + +/** + * @author bai + * @date 2024/06/08 + */ +@RestController +@Api(value = "v3-技师与物料关系表出入库记录", tags = { "v3-技师与物料关系表出入库记录" }) +@RequestMapping(value = "/blArtificerSelfGoodsEntryExitRecords") +public class BlArtificerSelfGoodsEntryExitRecordsController { + + @Autowired + private BlArtificerSelfGoodsEntryExitRecordsService service; + + @GetMapping("/list") + @ApiOperation("获取数据列表") + public Result list(BlArtificerSelfGoodsEntryExitRecords entity, Integer page,Integer limit){ + QueryWrapper qw = new QueryWrapper<>(); + +// if(entity != null) { + //价格类型 +// qw.lambda().eq(entity.getPricingType() != null, BlArtificerSelfGoodsEntryExitRecords::getPricingType, entity.getPricingType()); +// //出行方式 +// qw.lambda().eq(entity.getTravelType() != null, BlArtificerSelfGoodsEntryExitRecords::getTravelType, entity.getTravelType()); +// //时令 +// qw.lambda().eq(entity.getSeasonsType() != null, BlArtificerSelfGoodsEntryExitRecords::getSeasonsType, entity.getSeasonsType()); +// //时段 +// qw.lambda().eq(entity.getTimeIntervalType() != null, BlArtificerSelfGoodsEntryExitRecords::getTimeIntervalType, entity.getTimeIntervalType()); +// } + +// qw.orderByAsc("sort"); + IPage pageList = service.page(new Page<>(page,limit),qw); + return Result.success().put("data",pageList); + } + + @PostMapping(value = "/add") + @ApiOperation("新增") + public Result add(@RequestBody BlArtificerSelfGoodsEntryExitRecords entity){ + entity.setCreateTime(DateUtil.now()); + entity.setUpdateTime(DateUtil.now()); + return Result.success().put("data",service.save(entity)); + } + + @PostMapping(value = "/update") + @ApiOperation("修改") + public Result update(@RequestBody BlArtificerSelfGoodsEntryExitRecords entity){ + entity.setUpdateTime(DateUtil.now()); + return Result.success().put("data",service.updateById(entity)); + } + + @RequestMapping("/info/{id}") + public Result info(@PathVariable("id") Long id){ + BlArtificerSelfGoodsEntryExitRecords data = service.getById(id); + return Result.success().put("data", data); + } + + @DeleteMapping(value = "/deleteById") + @ApiOperation("删除") + public Result deleteById(Long id){ + service.removeById(id); + return Result.success(); + } + + @DeleteMapping(value = "/deleteByIds") + @ApiOperation("批量删除") + public Result deleteByIds(String id){ + if(StringUtils.isNotBlank(id)){ + String[] ids = StringUtils.split(id,","); + service.removeByIds(Arrays.asList(ids)); + } + return Result.success(); + } + + +} \ No newline at end of file diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/dao/BlArtificerSelfGoodsDao.java b/src/main/java/com/sqx/modules/artificerselfgoods/dao/BlArtificerSelfGoodsDao.java new file mode 100644 index 0000000..5993750 --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/dao/BlArtificerSelfGoodsDao.java @@ -0,0 +1,14 @@ +package com.sqx.modules.artificerselfgoods.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoods; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author bai + * @date 2024/06/08 + */ +@Mapper +public interface BlArtificerSelfGoodsDao extends BaseMapper { + +} diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/dao/BlArtificerSelfGoodsEntryExitRecordsDao.java b/src/main/java/com/sqx/modules/artificerselfgoods/dao/BlArtificerSelfGoodsEntryExitRecordsDao.java new file mode 100644 index 0000000..6be7aed --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/dao/BlArtificerSelfGoodsEntryExitRecordsDao.java @@ -0,0 +1,14 @@ +package com.sqx.modules.artificerselfgoods.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoodsEntryExitRecords; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author bai + * @date 2024/06/08 + */ +@Mapper +public interface BlArtificerSelfGoodsEntryExitRecordsDao extends BaseMapper { + +} diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/entity/BlArtificerSelfGoods.java b/src/main/java/com/sqx/modules/artificerselfgoods/entity/BlArtificerSelfGoods.java new file mode 100644 index 0000000..e0c4b63 --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/entity/BlArtificerSelfGoods.java @@ -0,0 +1,111 @@ +package com.sqx.modules.artificerselfgoods.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author bai + * @date 2024/06/08 + */ +@Data +@TableName("bl_artificer_self_goods") +public class BlArtificerSelfGoods implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 创建时间 + */ + private String createTime; + + /** + * 创建人 + */ + private String createAt; + + /** + * 修改时间 + */ + private String updateTime; + + /** + * 修改人 + */ + private String updateAt; + + /** + * 商品ID [self_goods.id] + */ + private Long selfGoodsId; + + /** + * 商品标题 [self_goods.title] + */ + private String selfGoodsTitle; + + /** + * 商品类型ID [goods_type.id] + */ + private String selfGoodsTypeId; + + /** + * 商品类型父ID [goods_type.parent_id] + */ + private String selfGoodsTypeParentId; + + /** + * 技师ID[artificer.id] + */ + private String artificerId; + + /** + * 库存量 + */ + private Integer num; + + /** + * 上一次库存量 + */ + private Integer lastTimeNum; + + /** + * 上一次变更量 + */ + private Integer lastTimeChangeNum; + + /** + * 变更数量(批量使用) + */ + @TableField(exist = false) + private Integer changeNum; + + /** + * 购入价格(批量入库使用) + */ + @TableField(exist = false) + private BigDecimal purchasePrice; + + /** + * 使用用户(批量使用) + */ + @TableField(exist = false) + private String userId; + + /** + * 备注(批量操作时使用) + */ + @TableField(exist = false) + private String remark; + +} \ No newline at end of file diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/entity/BlArtificerSelfGoodsEntryExitRecords.java b/src/main/java/com/sqx/modules/artificerselfgoods/entity/BlArtificerSelfGoodsEntryExitRecords.java new file mode 100644 index 0000000..c521529 --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/entity/BlArtificerSelfGoodsEntryExitRecords.java @@ -0,0 +1,96 @@ +package com.sqx.modules.artificerselfgoods.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author bai + * @date 2024/06/08 + */ +@Data +@TableName("bl_artificer_self_goods_entry_exit_records") +public class BlArtificerSelfGoodsEntryExitRecords implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 创建时间 + */ + private String createTime; + + /** + * 创建人 + */ + private String createAt; + + /** + * 商品ID [self_goods.id] + */ + private Long selfGoodsId; + + /** + * 商品标题 [self_goods.title] + */ + private String selfGoodsTitle; + + /** + * 商品类型ID [goods_type.id] + */ + private String selfGoodsTypeId; + + /** + * 商品类型父ID [goods_type.parent_id] + */ + private String selfGoodsTypeParentId; + + /** + * 技师ID[artificer.id] + */ + private String artificerId; + + /** + * 变更后库存量 + */ + private Integer num; + + /** + * 变更前库存量 + */ + private Integer lastTimeNum; + + /** + * 本次变更量 + */ + private Integer lastTimeChangeNum; + + /** + * 操作类型(1:入库,2:出库,3:修改库) + */ + private Integer operationType; + + /** + * 购入价格(元) + */ + private BigDecimal purchasePrice; + + /** + * 客户ID + */ + private String userId; + + /** + * 备注 + */ + private String remark; + +} \ No newline at end of file diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/enums/ArtificerSelfGoodsEnum.java b/src/main/java/com/sqx/modules/artificerselfgoods/enums/ArtificerSelfGoodsEnum.java new file mode 100644 index 0000000..3e09f01 --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/enums/ArtificerSelfGoodsEnum.java @@ -0,0 +1,35 @@ +package com.sqx.modules.artificerselfgoods.enums; + +import lombok.Getter; + +public class ArtificerSelfGoodsEnum { + + /** + * 价格类型 + */ + @Getter + public enum OperationType { + + /*** + * 入库 + */ + IN(1), + + /** + * 出库 + */ + OUT(2), + + /** + * 修改库 + */ + EDIT(3); + + private final Integer value; + + OperationType(Integer value) { + this.value = value; + } + } + +} diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/service/BlArtificerSelfGoodsEntryExitRecordsService.java b/src/main/java/com/sqx/modules/artificerselfgoods/service/BlArtificerSelfGoodsEntryExitRecordsService.java new file mode 100644 index 0000000..0379b5e --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/service/BlArtificerSelfGoodsEntryExitRecordsService.java @@ -0,0 +1,19 @@ +package com.sqx.modules.artificerselfgoods.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoods; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoodsEntryExitRecords; + +import java.math.BigDecimal; + +public interface BlArtificerSelfGoodsEntryExitRecordsService extends IService { + + boolean addLog(BlArtificerSelfGoods e,Integer operationType, String createAt, Integer changeEndNum, Integer allNum, Integer num, BigDecimal purchasePrice, String userId, String remark); + + boolean addInLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, BigDecimal purchasePrice); + + boolean addOutLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, String userId); + + boolean editLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, String remark); + +} diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/service/BlArtificerSelfGoodsService.java b/src/main/java/com/sqx/modules/artificerselfgoods/service/BlArtificerSelfGoodsService.java new file mode 100644 index 0000000..99cac3a --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/service/BlArtificerSelfGoodsService.java @@ -0,0 +1,84 @@ +package com.sqx.modules.artificerselfgoods.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoods; + +import java.math.BigDecimal; +import java.util.List; + +public interface BlArtificerSelfGoodsService extends IService { + + /** + * 根据技师ID获取所有库 + * @param artificerId + * @return + */ + List findArtificerSelfGoodsByArtificerId(String artificerId); + + /** + * 根据技师ID和商品类型ID获取所有库 + * @param artificerId + * @param goodsTypeId + * @return + */ + List findArtificerSelfGoodsByArtificerIdAndGoodsTypeId(String artificerId, String goodsTypeId); + + /** + * 根据技师ID和商品ID获取指定库 + * @param artificerId + * @param goodsId + * @return + */ + BlArtificerSelfGoods findArtificerSelfGoodsByArtificerIdAndGoodsId(String artificerId, String goodsId); + + boolean addWarehouse(BlArtificerSelfGoods artificerSelfGoods); + + boolean addWarehouse(List artificerSelfGoodsList); + + /** + * 入库 + * @param artificerSelfGoodsId + * @param num + * @return + */ + boolean inWarehouse(Long artificerSelfGoodsId, BigDecimal purchasePrice, int num); + + /** + * 批量入库 + * @param artificerSelfGoods + * @return + */ + boolean inWarehouse(List artificerSelfGoods); + + /** + * 出库 + * @param artificerSelfGoodsId + * @param num + * @return + */ + boolean outWarehouse(Long artificerSelfGoodsId, int num, String userId); + + /** + * 批量出库 + * @param artificerSelfGoods + * @return + */ + boolean outWarehouse(List artificerSelfGoods); + + /** + * 修改库 + * @param artificerSelfGoodsId + * @param num + * @return + */ + boolean editWarehouse(Long artificerSelfGoodsId, int num, String remark); + + /** + * 批量修改库 + * @param artificerSelfGoods + * @return + */ + boolean editWarehouse(List artificerSelfGoods); + + +} diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/service/impl/BlArtificerSelfGoodsEntryExitRecordsServiceImpl.java b/src/main/java/com/sqx/modules/artificerselfgoods/service/impl/BlArtificerSelfGoodsEntryExitRecordsServiceImpl.java new file mode 100644 index 0000000..6f9499c --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/service/impl/BlArtificerSelfGoodsEntryExitRecordsServiceImpl.java @@ -0,0 +1,59 @@ +package com.sqx.modules.artificerselfgoods.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.sqx.modules.artificerselfgoods.dao.BlArtificerSelfGoodsEntryExitRecordsDao; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoods; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoodsEntryExitRecords; +import com.sqx.modules.artificerselfgoods.enums.ArtificerSelfGoodsEnum; +import com.sqx.modules.artificerselfgoods.service.BlArtificerSelfGoodsEntryExitRecordsService; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; + +/** + * 消息 + */ +@Service +public class BlArtificerSelfGoodsEntryExitRecordsServiceImpl extends ServiceImpl implements BlArtificerSelfGoodsEntryExitRecordsService { + + @Override + public boolean addLog(BlArtificerSelfGoods e,Integer operationType, String createAt, Integer changeEndNum, Integer allNum, Integer num, BigDecimal purchasePrice, String userId, String remark) { + BlArtificerSelfGoodsEntryExitRecords log = new BlArtificerSelfGoodsEntryExitRecords(); + log.setCreateTime(DateUtil.now()); + log.setCreateAt(createAt); + log.setSelfGoodsId(e.getSelfGoodsId()); + log.setSelfGoodsTitle(e.getSelfGoodsTitle()); + log.setSelfGoodsTypeId(e.getSelfGoodsTypeId()); + log.setSelfGoodsTypeParentId(e.getSelfGoodsTypeParentId()); + log.setArtificerId(e.getArtificerId()); + log.setNum(changeEndNum); + log.setLastTimeNum(allNum); + log.setLastTimeChangeNum(num); + log.setOperationType(operationType); + log.setPurchasePrice(purchasePrice); + log.setUserId(userId); + log.setRemark(remark); + + save(log); + return true; + } + + @Override + public boolean addInLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, BigDecimal purchasePrice) { + addLog(e, ArtificerSelfGoodsEnum.OperationType.IN.getValue(), createAt, changeEndNum, allNum, num, purchasePrice, null, null); + return true; + } + + @Override + public boolean addOutLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, String userId) { + addLog(e, ArtificerSelfGoodsEnum.OperationType.OUT.getValue(), createAt, changeEndNum, allNum, num, null, userId, null); + return true; + } + + @Override + public boolean editLog(BlArtificerSelfGoods e, String createAt, Integer changeEndNum, Integer allNum, Integer num, String remark) { + addLog(e, ArtificerSelfGoodsEnum.OperationType.EDIT.getValue(), createAt, changeEndNum, allNum, num, null, null, remark); + return true; + } +} diff --git a/src/main/java/com/sqx/modules/artificerselfgoods/service/impl/BlArtificerSelfGoodsServiceImpl.java b/src/main/java/com/sqx/modules/artificerselfgoods/service/impl/BlArtificerSelfGoodsServiceImpl.java new file mode 100644 index 0000000..ea78848 --- /dev/null +++ b/src/main/java/com/sqx/modules/artificerselfgoods/service/impl/BlArtificerSelfGoodsServiceImpl.java @@ -0,0 +1,125 @@ +package com.sqx.modules.artificerselfgoods.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.sqx.modules.artificerselfgoods.dao.BlArtificerSelfGoodsDao; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoods; +import com.sqx.modules.artificerselfgoods.entity.BlArtificerSelfGoodsEntryExitRecords; +import com.sqx.modules.artificerselfgoods.enums.ArtificerSelfGoodsEnum; +import com.sqx.modules.artificerselfgoods.service.BlArtificerSelfGoodsEntryExitRecordsService; +import com.sqx.modules.artificerselfgoods.service.BlArtificerSelfGoodsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 消息 + */ +@Service +public class BlArtificerSelfGoodsServiceImpl extends ServiceImpl implements BlArtificerSelfGoodsService { + + @Autowired + private BlArtificerSelfGoodsEntryExitRecordsService artificerSelfGoodsEntryExitRecordsService; + + @Override + public List findArtificerSelfGoodsByArtificerId(String artificerId) { + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().eq(BlArtificerSelfGoods::getArtificerId, artificerId); + return list(qw); + } + + @Override + public List findArtificerSelfGoodsByArtificerIdAndGoodsTypeId(String artificerId, String goodsTypeId) { + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().eq(BlArtificerSelfGoods::getArtificerId, artificerId); + qw.lambda().eq(BlArtificerSelfGoods::getSelfGoodsTypeId, goodsTypeId); + return list(qw); + } + + @Override + public BlArtificerSelfGoods findArtificerSelfGoodsByArtificerIdAndGoodsId(String artificerId, String goodsId) { + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().eq(BlArtificerSelfGoods::getArtificerId, artificerId); + qw.lambda().eq(BlArtificerSelfGoods::getSelfGoodsId, goodsId); + qw.last("limit 1"); + return getOne(qw); + } + + @Override + public boolean addWarehouse(BlArtificerSelfGoods artificerSelfGoods) { + save(artificerSelfGoods); + return true; + } + + @Override + public boolean addWarehouse(List artificerSelfGoodsList) { + saveBatch(artificerSelfGoodsList); + return true; + } + + @Override + public boolean inWarehouse(Long artificerSelfGoodsId, BigDecimal purchasePrice, int num) { + BlArtificerSelfGoods e = getById(artificerSelfGoodsId); + if(e == null) return false; + Integer allNum = e.getNum(); + e.setLastTimeChangeNum(num); + e.setLastTimeNum(e.getNum()); + Integer changeEndNum = allNum - num; + e.setNum(changeEndNum); + updateById(e); + //记录日志 + artificerSelfGoodsEntryExitRecordsService.addInLog(e, null, changeEndNum, allNum, num, purchasePrice); + return true; + } + + @Override + public boolean inWarehouse(List artificerSelfGoods) { + artificerSelfGoods.forEach(x -> inWarehouse(x.getId(), x.getPurchasePrice(), x.getChangeNum())); + return true; + } + + @Override + public boolean outWarehouse(Long artificerSelfGoodsId, int num, String userId) { + BlArtificerSelfGoods e = getById(artificerSelfGoodsId); + if(e == null) return false; + Integer allNum = e.getNum(); + e.setLastTimeChangeNum(num); + e.setLastTimeNum(e.getNum()); + Integer changeEndNum = allNum - num; + e.setNum(changeEndNum); + updateById(e); + //记录日志 + artificerSelfGoodsEntryExitRecordsService.addOutLog(e, null, changeEndNum, allNum, num, userId); + return true; + } + + @Override + public boolean outWarehouse(List artificerSelfGoods) { + artificerSelfGoods.forEach(x -> outWarehouse(x.getId(), x.getChangeNum(), x.getUserId())); + return true; + } + + @Override + public boolean editWarehouse(Long artificerSelfGoodsId, int num, String remark) { + BlArtificerSelfGoods e = getById(artificerSelfGoodsId); + if(e == null) return false; + Integer allNum = e.getNum(); + e.setLastTimeChangeNum(num); + e.setLastTimeNum(e.getNum()); + Integer changeEndNum = allNum - num; + e.setNum(changeEndNum); + updateById(e); + //记录日志 + artificerSelfGoodsEntryExitRecordsService.editLog(e, null, changeEndNum, allNum, num, remark); + return true; + } + + @Override + public boolean editWarehouse(List artificerSelfGoods) { + artificerSelfGoods.forEach(x -> editWarehouse(x.getId(), x.getChangeNum(), x.getRemark())); + return true; + } +} diff --git a/src/main/java/com/sqx/modules/travelconf/service/impl/TravelConfServiceImpl.java b/src/main/java/com/sqx/modules/travelconf/service/impl/TravelConfServiceImpl.java index 57cc0a4..bc43735 100644 --- a/src/main/java/com/sqx/modules/travelconf/service/impl/TravelConfServiceImpl.java +++ b/src/main/java/com/sqx/modules/travelconf/service/impl/TravelConfServiceImpl.java @@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; -import java.util.List; import java.util.Map; /** @@ -34,7 +33,10 @@ public class TravelConfServiceImpl extends ServiceImpl