Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
SongZhang 2024-10-30 16:59:05 +08:00
commit bae22532d1
20 changed files with 40 additions and 964 deletions

View File

@ -31,6 +31,8 @@ public class SuppFlow implements Serializable {
public static class ConInfos{
private Integer conInfoId;
private String unit;
private BigDecimal price;
private BigDecimal stockNumber;

View File

@ -53,6 +53,13 @@ public class TbConsInfo implements Serializable {
@ApiModelProperty(value = "单位值")
private String conUnit;
@Column(name = "`con_unit_two`")
@ApiModelProperty(value = "单位值")
private String conUnitTwo;
@Column(name = "`con_unit_two_convert`")
@ApiModelProperty(value = "单位换算")
private BigDecimal conUnitTwoConvert;
@Column(name = "`laster_in_stock`")
@ApiModelProperty(value = "最近一次入库量")

View File

@ -47,7 +47,7 @@ public class TbConsInfoV2 implements Serializable {
@ApiModelProperty(value = "库存值")
private BigDecimal stockNumber;
// @Column(name = "`balance`")
// @Column(name = "`balance`")
@ApiModelProperty(value = "实际库存值")
private BigDecimal balance;
@ -55,6 +55,14 @@ public class TbConsInfoV2 implements Serializable {
@ApiModelProperty(value = "单位值")
private String conUnit;
@Column(name = "`con_unit_two`")
@ApiModelProperty(value = "单位值")
private String conUnitTwo;
@Column(name = "`con_unit_two_convert`")
@ApiModelProperty(value = "单位换算")
private BigDecimal conUnitTwoConvert;
@Column(name = "`laster_in_stock`")
@ApiModelProperty(value = "最近一次入库量")

View File

@ -1,139 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.cons.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author admin
* @date 2024-07-03
**/
@Entity
@Data
@Table(name="view_cons_supp_flow")
public class ViewConsSuppFlow implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "`id`")
@ApiModelProperty(value = "id")
private Integer id;
@Column(name = "`con_info_id`",nullable = false)
@NotNull
@ApiModelProperty(value = "conInfoId")
private Integer conInfoId;
@Column(name = "`shop_id`")
@ApiModelProperty(value = "店铺id")
private Integer shopId;
@Column(name = "`sku_id`")
@ApiModelProperty(value = "skuId")
private Integer skuId;
@Column(name = "`product_id`")
@ApiModelProperty(value = "productId")
private Integer productId;
@Column(name = "`supplier_id`",nullable = false)
@NotNull
@ApiModelProperty(value = "supplierId")
private Integer supplierId;
@Column(name = "`type`",nullable = false)
@NotBlank
@ApiModelProperty(value = "出入库类型: in 入库 out 出库")
private String type;
@Column(name = "`stock_number`",nullable = false)
@NotNull
@ApiModelProperty(value = "数量")
private BigDecimal stockNumber;
@Column(name = "`price`",nullable = false)
@NotNull
@ApiModelProperty(value = "进价")
private BigDecimal price;
@Column(name = "`amount`",nullable = false)
@NotNull
@ApiModelProperty(value = "小计")
private BigDecimal amount;
@Column(name = "`balance`",nullable = false)
@NotNull
@ApiModelProperty(value = "剩余库存")
private BigDecimal balance;
@Column(name = "`accounts_payable`",nullable = false)
@NotNull
@ApiModelProperty(value = "应付款")
private BigDecimal accountsPayable;
@Column(name = "`actual_payment`",nullable = false)
@NotNull
@ApiModelProperty(value = "实付款")
private BigDecimal actualPayment;
@Column(name = "`payment_time`")
@ApiModelProperty(value = "paymentTime")
private Timestamp paymentTime;
@Column(name = "`create_time`")
@ApiModelProperty(value = "createTime")
private Timestamp createTime;
@Column(name = "`update_time`")
@ApiModelProperty(value = "updateTime")
private Timestamp updateTime;
@Column(name = "`con_name`")
@ApiModelProperty(value = "耗材名称")
private String conName;
@Column(name = "`con_code`")
@ApiModelProperty(value = "耗材代码")
private String conCode;
@Column(name = "`con_type_name`")
@ApiModelProperty(value = "耗材类型名称")
private String conTypeName;
@Column(name = "`purveyor_name`")
@ApiModelProperty(value = "联系人名字")
private String purveyorName;
@Column(name = "`address`")
@ApiModelProperty(value = "供应商地址")
private String address;
@Column(name = "`purveyor_telephone`")
@ApiModelProperty(value = "联系人电话")
private String purveyorTelephone;
public void copy(ViewConsSuppFlow source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -1,13 +0,0 @@
package cn.ysk.cashier.cons.repository;
import cn.ysk.cashier.cons.domain.TbConUnit;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @website https://eladmin.vip
* @author admin
* @date 2024-07-12
**/
public interface TbConUnitRepository extends JpaRepository<TbConUnit, Integer>, JpaSpecificationExecutor<TbConUnit> {
}

View File

@ -1,13 +0,0 @@
package cn.ysk.cashier.cons.repository;
import cn.ysk.cashier.cons.domain.ViewConsSuppFlow;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @website https://eladmin.vip
* @author admin
* @date 2024-07-03
**/
public interface ViewConsSuppFlowRepository extends JpaRepository<ViewConsSuppFlow, Integer>, JpaSpecificationExecutor<ViewConsSuppFlow> {
}

View File

@ -1,82 +0,0 @@
package cn.ysk.cashier.cons.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.cons.domain.TbConUnit;
import cn.ysk.cashier.cons.service.TbConUnitService;
import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Objects;
import javax.servlet.http.HttpServletResponse;
/**
* @author admin
* @date 2024-07-12
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "耗材单位添加管理")
@RequestMapping("/api/tbConUnit")
public class TbConUnitController {
private final TbConUnitService tbConUnitService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void exportTbConUnit(HttpServletResponse response, TbConUnitQueryCriteria criteria) throws IOException {
tbConUnitService.download(tbConUnitService.queryAll(criteria), response);
}
@GetMapping
@ApiOperation("查询耗材单位添加")
public ResponseEntity<Object> queryTbConUnit(TbConUnitQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbConUnitService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增耗材单位添加")
@ApiOperation("新增耗材单位添加")
public ResponseEntity<Object> createTbConUnit(@Validated @RequestBody TbConUnit resources){
if(ObjectUtil.isEmpty(resources.getParentId())|| Objects.isNull(resources.getParentId())){
resources.setParentId(0);
}
resources.setStatus("0");
resources.setCreateTime(new Timestamp(System.currentTimeMillis()));
return new ResponseEntity<>(tbConUnitService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改耗材单位添加")
@ApiOperation("修改耗材单位添加")
public ResponseEntity<Object> updateTbConUnit(@Validated @RequestBody TbConUnit resources){
resources.setUpdateTime(new Timestamp(System.currentTimeMillis()));
tbConUnitService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除耗材单位添加")
@ApiOperation("删除耗材单位添加")
public ResponseEntity<Object> deleteTbConUnit(@RequestBody Integer[] ids) {
tbConUnitService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@RequestMapping("queryTbConUnitInfo")
public ResponseEntity<Object> queryTbConUnitInfo(TbConUnitQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbConUnitService.queryAllInfo(criteria,pageable),HttpStatus.OK);
}
}

View File

@ -1,64 +0,0 @@
package cn.ysk.cashier.cons.rest;
import cn.ysk.cashier.annotation.Log;
import cn.ysk.cashier.cons.domain.ViewConsSuppFlow;
import cn.ysk.cashier.cons.service.ViewConsSuppFlowService;
import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @author admin
* @date 2024-07-03
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "出入库记录管理")
@RequestMapping("/api/viewConsSuppFlow")
public class ViewConsSuppFlowController {
private final ViewConsSuppFlowService viewConsSuppFlowService;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void exportViewConsSuppFlow(HttpServletResponse response, ViewConsSuppFlowQueryCriteria criteria) throws IOException {
viewConsSuppFlowService.download(viewConsSuppFlowService.queryAll(criteria), response);
}
@GetMapping
@ApiOperation("查询出入库记录")
public ResponseEntity<Object> queryViewConsSuppFlow(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(viewConsSuppFlowService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增出入库记录")
@ApiOperation("新增出入库记录")
public ResponseEntity<Object> createViewConsSuppFlow(@Validated @RequestBody ViewConsSuppFlow resources){
return new ResponseEntity<>(viewConsSuppFlowService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改出入库记录")
@ApiOperation("修改出入库记录")
public ResponseEntity<Object> updateViewConsSuppFlow(@Validated @RequestBody ViewConsSuppFlow resources){
viewConsSuppFlowService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除出入库记录")
@ApiOperation("删除出入库记录")
public ResponseEntity<Object> deleteViewConsSuppFlow(@RequestBody Integer[] ids) {
viewConsSuppFlowService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -1,70 +0,0 @@
package cn.ysk.cashier.cons.service;
import cn.ysk.cashier.cons.domain.TbConUnit;
import cn.ysk.cashier.cons.service.dto.TbConUnitDto;
import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @author admin
* @date 2024-07-12
**/
public interface TbConUnitService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbConUnitQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbConUnitDto>
*/
List<TbConUnitDto> queryAll(TbConUnitQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbConUnitDto
*/
TbConUnitDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbConUnitDto
*/
TbConUnitDto create(TbConUnit resources);
/**
* 编辑
* @param resources /
*/
void update(TbConUnit resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbConUnitDto> all, HttpServletResponse response) throws IOException;
Map<String,Object> queryAllInfo(TbConUnitQueryCriteria criteria, Pageable pageable);
}

View File

@ -1,66 +0,0 @@
package cn.ysk.cashier.cons.service;
import cn.ysk.cashier.cons.domain.ViewConsSuppFlow;
import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowDto;
import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @author admin
* @date 2024-07-03
**/
public interface ViewConsSuppFlowService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<ViewConsSuppFlowDto>
*/
List<ViewConsSuppFlowDto> queryAll(ViewConsSuppFlowQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return ViewConsSuppFlowDto
*/
ViewConsSuppFlowDto findById(Integer id);
/**
* 创建
* @param resources /
* @return ViewConsSuppFlowDto
*/
ViewConsSuppFlowDto create(ViewConsSuppFlow resources);
/**
* 编辑
* @param resources /
*/
void update(ViewConsSuppFlow resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<ViewConsSuppFlowDto> all, HttpServletResponse response) throws IOException;
}

View File

@ -1,52 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.cons.service.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author admin
* @date 2024-07-12
**/
@Data
public class TbConUnitDto implements Serializable {
private Integer id;
/** 主单位名称 */
private String name;
/** 主单位值 */
private BigDecimal value;
private Integer parentId;
private String isConsume;
/** 状态 1 启用 0 禁用 */
private String status;
private Timestamp createTime;
private Timestamp updateTime;
}

View File

@ -1,25 +0,0 @@
package cn.ysk.cashier.cons.service.dto;
import lombok.Data;
import java.util.List;
import cn.ysk.cashier.annotation.Query;
/**
* @author admin
* @date 2024-07-12
**/
@Data
public class TbConUnitQueryCriteria{
/** 模糊 */
@Query(type = Query.Type.INNER_LIKE)
private String name;
/** 精确 */
@Query
private Integer parentId;
/** 精确 */
@Query
private String status;
}

View File

@ -1,24 +1,7 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.cons.service.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
@ -53,6 +36,10 @@ public class TbConsInfoDto implements Serializable {
/** 单位值 */
private String conUnit;
private String conUnitTwo;
private BigDecimal conUnitTwoConvert;
/** 最近一次入库量 */
private BigDecimal lasterInStock;

View File

@ -1,87 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ysk.cashier.cons.service.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author admin
* @date 2024-07-03
**/
@Data
public class ViewConsSuppFlowDto implements Serializable {
private Integer id;
private Integer conInfoId;
/** 店铺id */
private Integer shopId;
private Integer skuId;
private Integer productId;
private Integer supplierId;
/** 出入库类型: in 入库 out 出库 */
private String type;
/** 数量 */
private BigDecimal stockNumber;
/** 进价 */
private BigDecimal price;
/** 小计 */
private BigDecimal amount;
/** 剩余库存 */
private BigDecimal balance;
/** 应付款 */
private BigDecimal accountsPayable;
/** 实付款 */
private BigDecimal actualPayment;
private Timestamp paymentTime;
private Timestamp createTime;
private Timestamp updateTime;
/** 耗材名称 */
private String conName;
/** 耗材代码 */
private String conCode;
/** 耗材类型名称 */
private String conTypeName;
/** 联系人名字 */
private String purveyorName;
/** 供应商地址 */
private String address;
/** 联系人电话 */
private String purveyorTelephone;
}

View File

@ -1,43 +0,0 @@
package cn.ysk.cashier.cons.service.dto;
import cn.ysk.cashier.utils.JSONUtil;
import lombok.Data;
import java.util.List;
import cn.ysk.cashier.annotation.Query;
/**
* @author admin
* @date 2024-07-03
**/
@Data
public class ViewConsSuppFlowQueryCriteria{
/** 精确 */
@Query
private Integer conInfoId;
/** 精确 */
@Query
private String type;
/** 模糊 */
@Query(type = Query.Type.INNER_LIKE)
private String conName;
/** 精确 */
@Query
private String conCode;
/** 精确 */
@Query
private String conTypeName;
/** 模糊 */
@Query(type = Query.Type.INNER_LIKE)
private String purveyorName;
public static void main(String[] args){
System.out.println(JSONUtil.toJSONString(new ViewConsSuppFlowQueryCriteria()));
}
}

View File

@ -1,138 +0,0 @@
package cn.ysk.cashier.cons.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.ysk.cashier.cons.domain.TbConUnit;
import cn.ysk.cashier.cons.service.dto.ConUnitPO;
import cn.ysk.cashier.utils.FileUtil;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import cn.ysk.cashier.utils.ValidationUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.cons.repository.TbConUnitRepository;
import cn.ysk.cashier.cons.service.TbConUnitService;
import cn.ysk.cashier.cons.service.dto.TbConUnitDto;
import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria;
import cn.ysk.cashier.cons.service.mapstruct.TbConUnitMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author admin
* @date 2024-07-12
**/
@Service
@RequiredArgsConstructor
public class TbConUnitServiceImpl implements TbConUnitService {
private final TbConUnitRepository tbConUnitRepository;
private final TbConUnitMapper tbConUnitMapper;
@Override
public Map<String,Object> queryAll(TbConUnitQueryCriteria criteria, Pageable pageable){
Page<TbConUnit> page = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbConUnitMapper::toDto));
}
@Override
public List<TbConUnitDto> queryAll(TbConUnitQueryCriteria criteria){
return tbConUnitMapper.toDto(tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbConUnitDto findById(Integer id) {
TbConUnit tbConUnit = tbConUnitRepository.findById(id).orElseGet(TbConUnit::new);
ValidationUtil.isNull(tbConUnit.getId(),"TbConUnit","id",id);
return tbConUnitMapper.toDto(tbConUnit);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbConUnitDto create(TbConUnit resources) {
return tbConUnitMapper.toDto(tbConUnitRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbConUnit resources) {
TbConUnit tbConUnit = tbConUnitRepository.findById(resources.getId()).orElseGet(TbConUnit::new);
ValidationUtil.isNull( tbConUnit.getId(),"TbConUnit","id",resources.getId());
tbConUnit.copy(resources);
tbConUnitRepository.save(tbConUnit);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbConUnitRepository.deleteById(id);
}
}
@Override
public void download(List<TbConUnitDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbConUnitDto tbConUnit : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("主单位名称", tbConUnit.getName());
map.put("主单位值", tbConUnit.getValue());
map.put("状态 1 启用 0 禁用", tbConUnit.getStatus());
map.put(" createTime", tbConUnit.getCreateTime());
map.put(" updateTime", tbConUnit.getUpdateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
public Map<String, Object> queryAllInfo(TbConUnitQueryCriteria criteria, Pageable pageable) {
List<ConUnitPO> list=new ArrayList<>();
if(ObjectUtil.isEmpty(criteria.getParentId())){
criteria.setParentId(0);
}
Page<TbConUnit> page = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
if(Objects.nonNull(page)&&Objects.nonNull(page.getContent())){
page.getContent().parallelStream().forEach(it->{
ConUnitPO po=new ConUnitPO();
po.setId(it.getId());
po.setName(it.getName());
po.setValue(it.getValue());
po.setIsConsume(it.getIsConsume());
po.setCreateTime(it.getCreateTime());
po.setUpdateTime(it.getUpdateTime());
criteria.setParentId(it.getId());
criteria.setName(null);
criteria.setStatus(null);
Page<TbConUnit> childPage = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
if(Objects.nonNull(childPage)&&Objects.nonNull(childPage.getContent())){
List<ConUnitPO> list1=new ArrayList<>();
for (TbConUnit tbConUnit : childPage.getContent()) {
ConUnitPO child=new ConUnitPO();
child.setId(tbConUnit.getId());
child.setName(tbConUnit.getName());
child.setValue(tbConUnit.getValue());
child.setIsConsume(tbConUnit.getIsConsume());
child.setCreateTime(tbConUnit.getCreateTime());
child.setUpdateTime(tbConUnit.getUpdateTime());
list1.add(child);
}
po.setChildConUnit(list1);
}
list.add(po);
});
}
Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",list);
map.put("totalElements",page.getTotalElements());
return map;
}
}

View File

@ -229,6 +229,11 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
log.info("耗材信息不存在");
continue;
}
BigDecimal changeStock = conInfos.getStockNumber();
//副单位的实际修改值
if (StringUtils.isNotBlank(conInfos.getUnit()) && conInfos.getUnit().equals(info.getConUnitTwo())) {
changeStock = conInfos.getStockNumber().multiply(info.getConUnitTwoConvert()).setScale(2, BigDecimal.ROUND_HALF_UP);
}
TbConsSuppFlow suppFlow = new TbConsSuppFlow();
@ -246,17 +251,17 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
suppFlow.setShopId(resources.getShopId());
suppFlow.setSupplierId(Objects.isNull(resources.getSupplierId()) ? 0 : resources.getSupplierId());
suppFlow.setType(resources.getType());
suppFlow.setStockNumber(conInfos.getStockNumber());
suppFlow.setStockNumber(changeStock);
//实际库存
BigDecimal amount = info.getStockNumber().subtract(info.getStockConsume());
if ("in".equals(resources.getType())) {
stockOperate.setSubType(1);
info.setStockNumber(info.getStockNumber().add(conInfos.getStockNumber()));
info.setLasterInStock(conInfos.getStockNumber());
info.setStockNumber(info.getStockNumber().add(changeStock));
info.setLasterInStock(changeStock);
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).add(conInfos.getStockNumber()));
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).add(changeStock));
flow.setBizCode("stockIn");
@ -268,19 +273,19 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())));
purveyorTransact.setType("cons_in");
object.put("number", conInfos.getStockNumber());
object.put("number", changeStock);
}
else if ("out".equals(resources.getType())) {
stockOperate.setSubType(-1);
if (conInfos.getStockNumber().compareTo(info.getStockNumber().subtract(info.getStockConsume())) > 0) {
if (changeStock.compareTo(amount) > 0) {
throw new BadRequestException("出库数量大于现有的库存数量");
}
info.setStockNumber(info.getStockNumber().subtract(conInfos.getStockNumber()));
info.setStockNumber(info.getStockNumber().subtract(changeStock));
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).subtract(conInfos.getStockNumber()));
suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).subtract(changeStock));
flow.setBizCode("stockout");
@ -292,7 +297,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate());
purveyorTransact.setType("cons_out");
object.put("number", conInfos.getStockNumber());
object.put("number", changeStock);
}
else {
throw new BadRequestException("错误操作类型");
@ -302,7 +307,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
object.put("stockNumber", amount);
object.put("name", info.getConName());
object.put("unitName", info.getConUnit());
object.put("unitName", StringUtils.isBlank(conInfos.getUnit()) ? info.getConUnit() : conInfos.getUnit());
array.add(object);
suppFlow.setPrice(conInfos.getPrice());
@ -319,7 +324,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
}
purveyorTransact.setPaidAt(System.currentTimeMillis());
//供应商
purveyorTransactRepository.save(purveyorTransact);
if (resources.getSupplierId() != null) {
tbShopPurveyorRepository.upLastTransactAt(resources.getSupplierId().toString());
@ -333,7 +338,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
flow.setConsId(info.getId());
flow.setShopId(info.getShopId());
flow.setConName(info.getConName());
flow.setAmount(conInfos.getStockNumber());
flow.setAmount(changeStock);
flow.setRemark(resources.getRemark());
flow.setBalance(info.getStockNumber().subtract(info.getStockConsume()));
flow.setOperator(SecurityUtils.getCurrentUserNickName());

View File

@ -1,109 +0,0 @@
package cn.ysk.cashier.cons.service.impl;
import cn.ysk.cashier.cons.domain.ViewConsSuppFlow;
import cn.ysk.cashier.utils.FileUtil;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import cn.ysk.cashier.utils.ValidationUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.cons.repository.ViewConsSuppFlowRepository;
import cn.ysk.cashier.cons.service.ViewConsSuppFlowService;
import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowDto;
import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowQueryCriteria;
import cn.ysk.cashier.cons.service.mapstruct.ViewConsSuppFlowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author admin
* @date 2024-07-03
**/
@Service
@RequiredArgsConstructor
public class ViewConsSuppFlowServiceImpl implements ViewConsSuppFlowService {
private final ViewConsSuppFlowRepository viewConsSuppFlowRepository;
private final ViewConsSuppFlowMapper viewConsSuppFlowMapper;
@Override
public Map<String,Object> queryAll(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable){
Page<ViewConsSuppFlow> page = viewConsSuppFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(viewConsSuppFlowMapper::toDto));
}
@Override
public List<ViewConsSuppFlowDto> queryAll(ViewConsSuppFlowQueryCriteria criteria){
return viewConsSuppFlowMapper.toDto(viewConsSuppFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public ViewConsSuppFlowDto findById(Integer id) {
ViewConsSuppFlow viewConsSuppFlow = viewConsSuppFlowRepository.findById(id).orElseGet(ViewConsSuppFlow::new);
ValidationUtil.isNull(viewConsSuppFlow.getId(),"ViewConsSuppFlow","id",id);
return viewConsSuppFlowMapper.toDto(viewConsSuppFlow);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ViewConsSuppFlowDto create(ViewConsSuppFlow resources) {
return viewConsSuppFlowMapper.toDto(viewConsSuppFlowRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ViewConsSuppFlow resources) {
ViewConsSuppFlow viewConsSuppFlow = viewConsSuppFlowRepository.findById(resources.getId()).orElseGet(ViewConsSuppFlow::new);
ValidationUtil.isNull( viewConsSuppFlow.getId(),"ViewConsSuppFlow","id",resources.getId());
viewConsSuppFlow.copy(resources);
viewConsSuppFlowRepository.save(viewConsSuppFlow);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
viewConsSuppFlowRepository.deleteById(id);
}
}
@Override
public void download(List<ViewConsSuppFlowDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (ViewConsSuppFlowDto viewConsSuppFlow : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put(" conInfoId", viewConsSuppFlow.getConInfoId());
map.put("店铺id", viewConsSuppFlow.getShopId());
map.put(" skuId", viewConsSuppFlow.getSkuId());
map.put(" productId", viewConsSuppFlow.getProductId());
map.put(" supplierId", viewConsSuppFlow.getSupplierId());
map.put("出入库类型: in 入库 out 出库", viewConsSuppFlow.getType());
map.put("数量", viewConsSuppFlow.getStockNumber());
map.put("进价", viewConsSuppFlow.getPrice());
map.put("小计", viewConsSuppFlow.getAmount());
map.put("剩余库存", viewConsSuppFlow.getBalance());
map.put("应付款", viewConsSuppFlow.getAccountsPayable());
map.put("实付款", viewConsSuppFlow.getActualPayment());
map.put(" paymentTime", viewConsSuppFlow.getPaymentTime());
map.put(" createTime", viewConsSuppFlow.getCreateTime());
map.put(" updateTime", viewConsSuppFlow.getUpdateTime());
map.put("耗材名称", viewConsSuppFlow.getConName());
map.put("耗材代码", viewConsSuppFlow.getConCode());
map.put("耗材类型名称", viewConsSuppFlow.getConTypeName());
map.put("联系人名字", viewConsSuppFlow.getPurveyorName());
map.put("供应商地址", viewConsSuppFlow.getAddress());
map.put("联系人电话", viewConsSuppFlow.getPurveyorTelephone());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@ -1,16 +0,0 @@
package cn.ysk.cashier.cons.service.mapstruct;
import cn.ysk.cashier.base.BaseMapper;
import cn.ysk.cashier.cons.domain.TbConUnit;
import cn.ysk.cashier.cons.service.dto.TbConUnitDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author admin
* @date 2024-07-12
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface TbConUnitMapper extends BaseMapper<TbConUnitDto, TbConUnit> {
}

View File

@ -1,16 +0,0 @@
package cn.ysk.cashier.cons.service.mapstruct;
import cn.ysk.cashier.base.BaseMapper;
import cn.ysk.cashier.cons.domain.ViewConsSuppFlow;
import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author admin
* @date 2024-07-03
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ViewConsSuppFlowMapper extends BaseMapper<ViewConsSuppFlowDto, ViewConsSuppFlow> {
}