Merge branch 'ww' into test

This commit is contained in:
wangw 2024-10-18 13:31:41 +08:00
commit 9129a114df
12 changed files with 6 additions and 513 deletions

View File

@ -1,140 +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.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
/**
* @author admin
* @date 2024-07-17
**/
@Entity
@Data
@Table(name="view_con_info_flow")
public class ViewConInfoFlow implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "`cons_id`")
@ApiModelProperty(value = "耗材id")
private Integer consId;
@Column(name = "`con_name`")
@ApiModelProperty(value = "耗材名称")
private String conName;
@Column(name = "`shop_id`")
@ApiModelProperty(value = "店铺id")
private Integer shopId;
@Column(name = "`con_return`",nullable = false)
@NotNull
@ApiModelProperty(value = "con_return")
private BigDecimal conReturn;
@Column(name = "`con_in`",nullable = false)
@NotNull
@ApiModelProperty(value = "con_in")
private BigDecimal conIn;
@Column(name = "`con_consume`",nullable = false)
@NotNull
@ApiModelProperty(value = "con_consume")
private BigDecimal conConsume;
@Column(name = "`con_out`",nullable = false)
@NotNull
@ApiModelProperty(value = "con_out")
private BigDecimal conOut;
@Column(name = "`balance`",nullable = false)
@NotNull
@ApiModelProperty(value = "balance")
private BigDecimal balance;
@Column(name = "`status`")
@ApiModelProperty(value = "status")
private String status;
@Column(name = "`product_id`")
@ApiModelProperty(value = "商品id")
private String productId;
@Column(name = "`product_name`")
@ApiModelProperty(value = "商品名称")
private String productName;
@Column(name = "`con_code`")
@ApiModelProperty(value = "耗材代码")
private String conCode;
@Column(name = "`con_type_code`")
@ApiModelProperty(value = "耗材类型代码")
private String conTypeCode;
@Column(name = "`con_type_name`")
@ApiModelProperty(value = "耗材类型名称")
private String conTypeName;
@Column(name = "`con_unit`")
@ApiModelProperty(value = "耗材单位")
private String conUnit;
@Column(name = "`con_warning`")
@ApiModelProperty(value = "预警值")
private String conWarning;
@Column(name = "`con_type_id`")
@ApiModelProperty(value = "耗材类型名称")
private Integer conTypeId;
@Column(name = "`is_check`")
@ApiModelProperty(value = "是否检测库存")
private String isCheck;
@Column(name = "`create_time`")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@Column(name = "`update_time`")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@Column(name = "price")
@ApiModelProperty(value = "单价")
private BigDecimal price;
public void copy(ViewConInfoFlow 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.ViewConInfoFlow;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @website https://eladmin.vip
* @author admin
* @date 2024-07-17
**/
public interface ViewConInfoFlowRepository extends JpaRepository<ViewConInfoFlow, Integer>, JpaSpecificationExecutor<ViewConInfoFlow> {
}

View File

@ -57,7 +57,7 @@ public class TbConsInfoController {
@PostMapping
@Log("新增耗材信息")
@ApiOperation("新增耗材信息")
public ResponseEntity<Object> createTbConsInfo(@Validated @RequestBody List<TbConsInfo> resources) throws Exception {
public ResponseEntity<Object> createTbConsInfo(@Validated @RequestBody List<TbConsInfo> resources) {
return new ResponseEntity<>(tbConsInfoService.create(resources),HttpStatus.CREATED);
}

View File

@ -1,63 +0,0 @@
//package cn.ysk.cashier.cons.rest;
//
//import cn.ysk.cashier.annotation.Log;
//import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
//import cn.ysk.cashier.cons.service.ViewConInfoFlowService;
//import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria;
//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-17
//**/
//@RestController
//@RequiredArgsConstructor
//@Api(tags = "获取耗材流水信息管理")
//@RequestMapping("/api/viewConInfoFlow")
//public class ViewConInfoFlowController {
//
// private final ViewConInfoFlowService viewConInfoFlowService;
//
// @Log("导出数据")
// @ApiOperation("导出数据")
// @GetMapping(value = "/download")
// public void exportViewConInfoFlow(HttpServletResponse response, ViewConInfoFlowQueryCriteria criteria) throws IOException {
// viewConInfoFlowService.download(viewConInfoFlowService.queryAll(criteria), response);
// }
//
// @PostMapping("get")
// @ApiOperation("查询获取耗材流水信息")
// public ResponseEntity<Object> queryViewConInfoFlow(@RequestBody ViewConInfoFlowQueryCriteria criteria){
// return new ResponseEntity<>(viewConInfoFlowService.queryAllPage(criteria),HttpStatus.OK);
// }
//
// @PostMapping
// @Log("新增获取耗材流水信息")
// @ApiOperation("新增获取耗材流水信息")
// public ResponseEntity<Object> createViewConInfoFlow(@Validated @RequestBody ViewConInfoFlow resources){
// return new ResponseEntity<>(viewConInfoFlowService.create(resources),HttpStatus.CREATED);
// }
//
// @PutMapping
// @Log("修改获取耗材流水信息")
// @ApiOperation("修改获取耗材流水信息")
// public ResponseEntity<Object> updateViewConInfoFlow(@Validated @RequestBody ViewConInfoFlow resources){
// viewConInfoFlowService.update(resources);
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
// }
//
// @DeleteMapping
// @Log("删除获取耗材流水信息")
// @ApiOperation("删除获取耗材流水信息")
// public ResponseEntity<Object> deleteViewConInfoFlow(@RequestBody Integer[] ids) {
// viewConInfoFlowService.deleteAll(ids);
// return new ResponseEntity<>(HttpStatus.OK);
// }
//}

View File

@ -49,7 +49,7 @@ public interface TbConsInfoService {
* @param resources /
* @return TbConsInfoDto
*/
TbConsInfoDto create(List<TbConsInfo> resources) throws Exception;
TbConsInfoDto create(List<TbConsInfo> resources);
/**
* 编辑

View File

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

View File

@ -1,73 +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 java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
/**
* @author admin
* @date 2024-07-17
**/
@Data
public class ViewConInfoFlowDto implements Serializable {
/** 耗材id */
private Integer consId;
/** 耗材名称 */
private String conName;
private BigDecimal conReturn;
private BigDecimal conIn;
private BigDecimal conConsume;
private BigDecimal conOut;
private BigDecimal balance;
private String productId;
private String productName;
private String status;
private String conCode;
private String conTypeCode;
private String conTypeName;
private String conUnit;
private String conWarning;
private Integer conTypeId;
private String isCheck;
private Date createTime;
private Date updateTime;
private BigDecimal price;
}

View File

@ -1,39 +0,0 @@
package cn.ysk.cashier.cons.service.dto;
import lombok.Data;
import java.util.Date;
import java.util.List;
import cn.ysk.cashier.annotation.Query;
/**
* @author admin
* @date 2024-07-17
**/
@Data
public class ViewConInfoFlowQueryCriteria {
/**
* 模糊
*/
@Query(type = Query.Type.INNER_LIKE)
private String conName;
@Query(type = Query.Type.INNER_LIKE)
private String productName;
@Query
private String shopId;
@Query
private Integer conTypeId;
@Query(type = Query.Type.BETWEEN)
private List<Date> createTime;
private Integer page;
private Integer size;
private String sort;
}

View File

@ -128,13 +128,13 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
@Override
@Transactional(rollbackFor = Exception.class)
public TbConsInfoDto create(List<TbConsInfo> resources) throws Exception {
public TbConsInfoDto create(List<TbConsInfo> resources){
for (TbConsInfo resource : resources) {
TbConsType tbConsType = tbConsTypeRepository.getById(resource.getConTypeId());
if (Objects.isNull(tbConsType)) {
throw new Exception("不存在的耗材类型");
throw new BadRequestException("不存在的耗材类型");
}
// int count = tbConsInfoRepository.countByConCode(resources.getConCode());
@ -142,7 +142,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService {
// throw new Exception("耗材代码不允许重复");
// }
if(StringUtils.isBlank(resource.getConUnit())){
throw new Exception(resource.getConName()+ "的单位不允许为空");
throw new BadRequestException(resource.getConName()+ "的单位不允许为空");
}
resource.setConCode(StringCodeUtil.getRandom(8, LETTER_CAPITAL_NUMBER));
resource.setConTypeName(tbConsType.getConTypeName());

View File

@ -1,99 +0,0 @@
package cn.ysk.cashier.cons.service.impl;
import cn.ysk.cashier.cons.domain.ViewConInfoFlow;
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.ViewConInfoFlowRepository;
import cn.ysk.cashier.cons.service.ViewConInfoFlowService;
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto;
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowQueryCriteria;
import cn.ysk.cashier.cons.service.mapstruct.ViewConInfoFlowMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
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;
@Service
@RequiredArgsConstructor
public class ViewConInfoFlowServiceImpl implements ViewConInfoFlowService {
private final ViewConInfoFlowRepository viewConInfoFlowRepository;
private final ViewConInfoFlowMapper viewConInfoFlowMapper;
@Override
public Map<String,Object> queryAllPage(ViewConInfoFlowQueryCriteria criteria){
Sort sort = Sort.by(Sort.Direction.DESC, "consId");
if(StringUtils.isNotBlank(criteria.getSort())){
String[] sortParams = criteria.getSort().split(",");
String sortField = sortParams[0];
Sort.Direction sortDirection = Sort.Direction.fromString(sortParams[1]);
sort = Sort.by(sortDirection, sortField);
}
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
Page<ViewConInfoFlow> page = viewConInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(viewConInfoFlowMapper::toDto));
}
@Override
public List<ViewConInfoFlowDto> queryAll(ViewConInfoFlowQueryCriteria criteria){
return viewConInfoFlowMapper.toDto(viewConInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public ViewConInfoFlowDto findById(Integer consId) {
ViewConInfoFlow viewConInfoFlow = viewConInfoFlowRepository.findById(consId).orElseGet(ViewConInfoFlow::new);
ValidationUtil.isNull(viewConInfoFlow.getConsId(),"ViewConInfoFlow","consId",consId);
return viewConInfoFlowMapper.toDto(viewConInfoFlow);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ViewConInfoFlowDto create(ViewConInfoFlow resources) {
return viewConInfoFlowMapper.toDto(viewConInfoFlowRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ViewConInfoFlow resources) {
ViewConInfoFlow viewConInfoFlow = viewConInfoFlowRepository.findById(resources.getConsId()).orElseGet(ViewConInfoFlow::new);
ValidationUtil.isNull( viewConInfoFlow.getConsId(),"ViewConInfoFlow","id",resources.getConsId());
viewConInfoFlow.copy(resources);
viewConInfoFlowRepository.save(viewConInfoFlow);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer consId : ids) {
viewConInfoFlowRepository.deleteById(consId);
}
}
@Override
public void download(List<ViewConInfoFlowDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (ViewConInfoFlowDto viewConInfoFlow : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("耗材名称", viewConInfoFlow.getConName());
map.put(" conreturn", viewConInfoFlow.getConReturn());
map.put(" conin", viewConInfoFlow.getConIn());
map.put(" conconsume", viewConInfoFlow.getConConsume());
map.put(" conout", viewConInfoFlow.getConOut());
map.put(" balance", viewConInfoFlow.getBalance());
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.ViewConInfoFlow;
import cn.ysk.cashier.cons.service.dto.ViewConInfoFlowDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author admin
* @date 2024-07-17
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ViewConInfoFlowMapper extends BaseMapper<ViewConInfoFlowDto, ViewConInfoFlow> {
}

View File

@ -65,7 +65,7 @@ public class TbPlussShopStaff implements Serializable {
@Column(name = "`max_discount_amount`")
@ApiModelProperty(value = "最大优惠金额")
private BigDecimal maxDiscountAmount;
private BigDecimal maxDiscountAmount = BigDecimal.ZERO;
@Column(name = "`status`")
@ApiModelProperty(value = "1启用0不启用")