2024年6月13日 新增技师与物料关系
This commit is contained in:
parent
a5892a5fa6
commit
1fb4bdeb4f
|
@ -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<BlArtificerSelfGoods> 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<BlArtificerSelfGoods> 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();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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<BlArtificerSelfGoodsEntryExitRecords> 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<BlArtificerSelfGoodsEntryExitRecords> 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();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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<BlArtificerSelfGoods> {
|
||||
|
||||
}
|
|
@ -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<BlArtificerSelfGoodsEntryExitRecords> {
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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<BlArtificerSelfGoodsEntryExitRecords> {
|
||||
|
||||
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);
|
||||
|
||||
}
|
|
@ -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<BlArtificerSelfGoods> {
|
||||
|
||||
/**
|
||||
* 根据技师ID获取所有库
|
||||
* @param artificerId
|
||||
* @return
|
||||
*/
|
||||
List<BlArtificerSelfGoods> findArtificerSelfGoodsByArtificerId(String artificerId);
|
||||
|
||||
/**
|
||||
* 根据技师ID和商品类型ID获取所有库
|
||||
* @param artificerId
|
||||
* @param goodsTypeId
|
||||
* @return
|
||||
*/
|
||||
List<BlArtificerSelfGoods> 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<BlArtificerSelfGoods> artificerSelfGoodsList);
|
||||
|
||||
/**
|
||||
* 入库
|
||||
* @param artificerSelfGoodsId
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
boolean inWarehouse(Long artificerSelfGoodsId, BigDecimal purchasePrice, int num);
|
||||
|
||||
/**
|
||||
* 批量入库
|
||||
* @param artificerSelfGoods
|
||||
* @return
|
||||
*/
|
||||
boolean inWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods);
|
||||
|
||||
/**
|
||||
* 出库
|
||||
* @param artificerSelfGoodsId
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
boolean outWarehouse(Long artificerSelfGoodsId, int num, String userId);
|
||||
|
||||
/**
|
||||
* 批量出库
|
||||
* @param artificerSelfGoods
|
||||
* @return
|
||||
*/
|
||||
boolean outWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods);
|
||||
|
||||
/**
|
||||
* 修改库
|
||||
* @param artificerSelfGoodsId
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
boolean editWarehouse(Long artificerSelfGoodsId, int num, String remark);
|
||||
|
||||
/**
|
||||
* 批量修改库
|
||||
* @param artificerSelfGoods
|
||||
* @return
|
||||
*/
|
||||
boolean editWarehouse(List<BlArtificerSelfGoods> artificerSelfGoods);
|
||||
|
||||
|
||||
}
|
|
@ -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<BlArtificerSelfGoodsEntryExitRecordsDao, BlArtificerSelfGoodsEntryExitRecords> 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;
|
||||
}
|
||||
}
|
|
@ -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<BlArtificerSelfGoodsDao, BlArtificerSelfGoods> implements BlArtificerSelfGoodsService {
|
||||
|
||||
@Autowired
|
||||
private BlArtificerSelfGoodsEntryExitRecordsService artificerSelfGoodsEntryExitRecordsService;
|
||||
|
||||
@Override
|
||||
public List<BlArtificerSelfGoods> findArtificerSelfGoodsByArtificerId(String artificerId) {
|
||||
QueryWrapper<BlArtificerSelfGoods> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(BlArtificerSelfGoods::getArtificerId, artificerId);
|
||||
return list(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BlArtificerSelfGoods> findArtificerSelfGoodsByArtificerIdAndGoodsTypeId(String artificerId, String goodsTypeId) {
|
||||
QueryWrapper<BlArtificerSelfGoods> 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<BlArtificerSelfGoods> 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<BlArtificerSelfGoods> 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<BlArtificerSelfGoods> 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<BlArtificerSelfGoods> 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<BlArtificerSelfGoods> artificerSelfGoods) {
|
||||
artificerSelfGoods.forEach(x -> editWarehouse(x.getId(), x.getChangeNum(), x.getRemark()));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -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<TravelConfDao, TravelConf
|
|||
public TravelConf getConfByAccordingCondition(Integer pricingType, Integer travelType, Date businessTime) {
|
||||
//为空则使用当前系统时间
|
||||
if(businessTime == null) businessTime = DateUtil.date();
|
||||
|
||||
//时令
|
||||
Integer seasonsType = null;
|
||||
//时段
|
||||
Integer timeIntervalType = null;
|
||||
|
||||
//从配置文件中取出时间配置(包含很多个)
|
||||
|
@ -72,7 +74,7 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
|
||||
if(winterTimeValues.length == 0){
|
||||
//非夏令时就是冬令时
|
||||
boolean isSeasonsType = CommonConfigUtil.calcIsDateSlotCentre(DateUtil.date(), daylightSavingTimeValues[0],daylightSavingTimeValues[1]);
|
||||
boolean isSeasonsType = CommonConfigUtil.calcIsDateSlotCentre(businessTime, daylightSavingTimeValues[0],daylightSavingTimeValues[1]);
|
||||
if(isSeasonsType) {
|
||||
//夏令时
|
||||
seasonsType = TravelEnum.SeasonsType.DAYLIGHT_SAVING_TIME.getValue();
|
||||
|
@ -82,11 +84,25 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
}
|
||||
}else{
|
||||
//双方混合判断
|
||||
boolean isSeasonsType = CommonConfigUtil.calcIsDateSlotCentre(businessTime, daylightSavingTimeValues[0],daylightSavingTimeValues[1]);
|
||||
boolean isWinterTimeType = CommonConfigUtil.calcIsDateSlotCentre(businessTime, winterTimeValues[0],winterTimeValues[1]);
|
||||
|
||||
if(isSeasonsType) {
|
||||
//夏令时
|
||||
seasonsType = TravelEnum.SeasonsType.DAYLIGHT_SAVING_TIME.getValue();
|
||||
}else if(isWinterTimeType) {
|
||||
//冬令时
|
||||
seasonsType = TravelEnum.SeasonsType.WINTER_TIME.getValue();
|
||||
} else {
|
||||
throw new SqxException("无法找到行配置,请联系管理员!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(nightValues.length == 0){
|
||||
//非白天就是夜间
|
||||
boolean isTimeIntervalType = CommonConfigUtil.calcIsTimeSlotCentre(DateUtil.date(), dayValues[0],dayValues[1]);
|
||||
boolean isTimeIntervalType = CommonConfigUtil.calcIsTimeSlotCentre(businessTime, dayValues[0],dayValues[1]);
|
||||
if(isTimeIntervalType) {
|
||||
//白天
|
||||
timeIntervalType = TravelEnum.TimeIntervalType.DAY.getValue();
|
||||
|
@ -96,8 +112,9 @@ public class TravelConfServiceImpl extends ServiceImpl<TravelConfDao, TravelConf
|
|||
}
|
||||
}else{
|
||||
//双方混合判断
|
||||
//TODO 前台无法创建 23:00:00-12:00:00的数据,直接甩出错误或者忽略
|
||||
throw new SqxException("请清空夜间时间配置配置,请联系管理员!");
|
||||
}
|
||||
|
||||
return getConfByAccordingCondition(pricingType, travelType, seasonsType, timeIntervalType);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue