交班记录
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_handover")
|
||||
public class TbHandover implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`trade_day`")
|
||||
@ApiModelProperty(value = "交班日期")
|
||||
private String tradeDay;
|
||||
|
||||
@Column(name = "`print_no`")
|
||||
@ApiModelProperty(value = "打印机编号")
|
||||
private String printNo;
|
||||
|
||||
@Column(name = "`duty_id`")
|
||||
@ApiModelProperty(value = "dutyId")
|
||||
private Integer dutyId;
|
||||
|
||||
@Column(name = "`shop_id`")
|
||||
@ApiModelProperty(value = "shopId")
|
||||
private Integer shopId;
|
||||
|
||||
@Column(name = "`merchant_name`")
|
||||
@ApiModelProperty(value = "merchantName")
|
||||
private String merchantName;
|
||||
|
||||
@Column(name = "`start_time`")
|
||||
@ApiModelProperty(value = "startTime")
|
||||
private String startTime;
|
||||
|
||||
@Column(name = "`end_time`")
|
||||
@ApiModelProperty(value = "endTime")
|
||||
private String endTime;
|
||||
|
||||
@Column(name = "`staff_id`")
|
||||
@ApiModelProperty(value = "staffId")
|
||||
private Integer staffId;
|
||||
|
||||
@Column(name = "`staff_name`")
|
||||
@ApiModelProperty(value = "staffName")
|
||||
private String staffName;
|
||||
|
||||
@Column(name = "`pay_infos`")
|
||||
@ApiModelProperty(value = "payInfos")
|
||||
private String payInfos;
|
||||
|
||||
@Column(name = "`member_data`")
|
||||
@ApiModelProperty(value = "memberData")
|
||||
private String memberData;
|
||||
|
||||
@Column(name = "`product_categories`")
|
||||
@ApiModelProperty(value = "productCategories")
|
||||
private String productCategories;
|
||||
|
||||
@Column(name = "`total_amount`")
|
||||
@ApiModelProperty(value = "totalAmount")
|
||||
private String totalAmount;
|
||||
|
||||
@Column(name = "`imprest`")
|
||||
@ApiModelProperty(value = "imprest")
|
||||
private String imprest;
|
||||
|
||||
@Column(name = "`payable`")
|
||||
@ApiModelProperty(value = "payable")
|
||||
private String payable;
|
||||
|
||||
@Column(name = "`hand_in`")
|
||||
@ApiModelProperty(value = "handIn")
|
||||
private String handIn;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`return_amount`")
|
||||
@ApiModelProperty(value = "returnAmount")
|
||||
private String returnAmount;
|
||||
|
||||
|
||||
@Column(name = "`order_num`")
|
||||
@ApiModelProperty(value = "orderNum")
|
||||
private String orderNum;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`quick_amount`")
|
||||
@ApiModelProperty(value = "quickAmount")
|
||||
private String quickAmount;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`product_info_pos`")
|
||||
@ApiModelProperty(value = "productInfoPos")
|
||||
private String productInfoPos;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`product_infos`")
|
||||
@ApiModelProperty(value = "productInfos")
|
||||
private String productInfos;
|
||||
|
||||
|
||||
|
||||
@Column(name = "`create_time`")
|
||||
@ApiModelProperty(value = "createTime")
|
||||
private Timestamp createTime;
|
||||
|
||||
|
||||
|
||||
|
||||
public void copy(TbHandover source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.ysk.cashier.cons.repository;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
public interface TbHandoverRepository extends JpaRepository<TbHandover, Integer>, JpaSpecificationExecutor<TbHandover> {
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cn.ysk.cashier.cons.rest;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
import cn.ysk.cashier.cons.service.TbHandoverService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverQueryCriteria;
|
||||
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-25
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "查询交班记录管理")
|
||||
@RequestMapping("/api/tbHandover")
|
||||
public class TbHandoverController {
|
||||
|
||||
private final TbHandoverService tbHandoverService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void exportTbHandover(HttpServletResponse response, TbHandoverQueryCriteria criteria) throws IOException {
|
||||
tbHandoverService.download(tbHandoverService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询查询交班记录")
|
||||
@ApiOperation("查询查询交班记录")
|
||||
public ResponseEntity<Object> queryTbHandover(TbHandoverQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbHandoverService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增查询交班记录")
|
||||
@ApiOperation("新增查询交班记录")
|
||||
public ResponseEntity<Object> createTbHandover(@Validated @RequestBody TbHandover resources){
|
||||
return new ResponseEntity<>(tbHandoverService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改查询交班记录")
|
||||
@ApiOperation("修改查询交班记录")
|
||||
public ResponseEntity<Object> updateTbHandover(@Validated @RequestBody TbHandover resources){
|
||||
tbHandoverService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除查询交班记录")
|
||||
@ApiOperation("删除查询交班记录")
|
||||
public ResponseEntity<Object> deleteTbHandover(@RequestBody Integer[] ids) {
|
||||
tbHandoverService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.ysk.cashier.cons.service;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverQueryCriteria;
|
||||
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-25
|
||||
**/
|
||||
public interface TbHandoverService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbHandoverQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbHandoverDto>
|
||||
*/
|
||||
List<TbHandoverDto> queryAll(TbHandoverQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbHandoverDto
|
||||
*/
|
||||
TbHandoverDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbHandoverDto
|
||||
*/
|
||||
TbHandoverDto create(TbHandover resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbHandover resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbHandoverDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@Data
|
||||
public class TbHandoverDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 交班日期 */
|
||||
private String tradeDay;
|
||||
|
||||
/** 打印机编号 */
|
||||
private String printNo;
|
||||
|
||||
private Integer dutyId;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private String merchantName;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private Integer staffId;
|
||||
|
||||
private String staffName;
|
||||
|
||||
private String payInfos;
|
||||
|
||||
private String memberData;
|
||||
|
||||
private String productCategories;
|
||||
|
||||
private String totalAmount;
|
||||
|
||||
private String imprest;
|
||||
|
||||
private String payable;
|
||||
|
||||
private String handIn;
|
||||
|
||||
|
||||
private String returnAmount;
|
||||
|
||||
/** 交班日期 */
|
||||
|
||||
private String orderNum;
|
||||
|
||||
/** 打印机编号 */
|
||||
|
||||
private String quickAmount;
|
||||
|
||||
|
||||
private String productInfoPos;
|
||||
|
||||
|
||||
private String productInfos;
|
||||
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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-25
|
||||
**/
|
||||
@Data
|
||||
public class TbHandoverQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String tradeDay;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String printNo;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer shopId;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String merchantName;
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package cn.ysk.cashier.cons.service.impl;
|
||||
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
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.TbHandoverRepository;
|
||||
import cn.ysk.cashier.cons.service.TbHandoverService;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverDto;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverQueryCriteria;
|
||||
import cn.ysk.cashier.cons.service.mapstruct.TbHandoverMapper;
|
||||
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-25
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbHandoverServiceImpl implements TbHandoverService {
|
||||
|
||||
private final TbHandoverRepository tbHandoverRepository;
|
||||
private final TbHandoverMapper tbHandoverMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbHandoverQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbHandover> page = tbHandoverRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbHandoverMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbHandoverDto> queryAll(TbHandoverQueryCriteria criteria){
|
||||
return tbHandoverMapper.toDto(tbHandoverRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbHandoverDto findById(Integer id) {
|
||||
TbHandover tbHandover = tbHandoverRepository.findById(id).orElseGet(TbHandover::new);
|
||||
ValidationUtil.isNull(tbHandover.getId(),"TbHandover","id",id);
|
||||
return tbHandoverMapper.toDto(tbHandover);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbHandoverDto create(TbHandover resources) {
|
||||
return tbHandoverMapper.toDto(tbHandoverRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbHandover resources) {
|
||||
TbHandover tbHandover = tbHandoverRepository.findById(resources.getId()).orElseGet(TbHandover::new);
|
||||
ValidationUtil.isNull( tbHandover.getId(),"TbHandover","id",resources.getId());
|
||||
tbHandover.copy(resources);
|
||||
tbHandoverRepository.save(tbHandover);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbHandoverRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbHandoverDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbHandoverDto tbHandover : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("交班日期", tbHandover.getTradeDay());
|
||||
map.put("打印机编号", tbHandover.getPrintNo());
|
||||
map.put(" dutyId", tbHandover.getDutyId());
|
||||
map.put(" shopId", tbHandover.getShopId());
|
||||
map.put(" merchantName", tbHandover.getMerchantName());
|
||||
map.put(" startTime", tbHandover.getStartTime());
|
||||
map.put(" endTime", tbHandover.getEndTime());
|
||||
map.put(" staffId", tbHandover.getStaffId());
|
||||
map.put(" staffName", tbHandover.getStaffName());
|
||||
map.put(" payInfos", tbHandover.getPayInfos());
|
||||
map.put(" memberData", tbHandover.getMemberData());
|
||||
map.put(" productCategories", tbHandover.getProductCategories());
|
||||
map.put(" totalAmount", tbHandover.getTotalAmount());
|
||||
map.put(" imprest", tbHandover.getImprest());
|
||||
map.put(" payable", tbHandover.getPayable());
|
||||
map.put(" handIn", tbHandover.getHandIn());
|
||||
map.put(" returnAmount", tbHandover.getReturnAmount());
|
||||
map.put("交班日期", tbHandover.getTradeDay());
|
||||
map.put(" orderNum", tbHandover.getOrderNum());
|
||||
map.put("打印机编号", tbHandover.getPrintNo());
|
||||
map.put(" quickAmount", tbHandover.getQuickAmount());
|
||||
map.put(" dutyId", tbHandover.getDutyId());
|
||||
map.put(" productInfoPos", tbHandover.getProductInfoPos());
|
||||
map.put(" shopId", tbHandover.getShopId());
|
||||
map.put(" productInfos", tbHandover.getProductInfos());
|
||||
map.put(" merchantName", tbHandover.getMerchantName());
|
||||
map.put(" createTime", tbHandover.getCreateTime());
|
||||
map.put(" startTime", tbHandover.getStartTime());
|
||||
map.put(" endTime", tbHandover.getEndTime());
|
||||
map.put(" staffId", tbHandover.getStaffId());
|
||||
map.put(" staffName", tbHandover.getStaffName());
|
||||
map.put(" payInfos", tbHandover.getPayInfos());
|
||||
map.put(" memberData", tbHandover.getMemberData());
|
||||
map.put(" productCategories", tbHandover.getProductCategories());
|
||||
map.put(" totalAmount", tbHandover.getTotalAmount());
|
||||
map.put(" imprest", tbHandover.getImprest());
|
||||
map.put(" payable", tbHandover.getPayable());
|
||||
map.put(" handIn", tbHandover.getHandIn());
|
||||
map.put(" returnAmount", tbHandover.getReturnAmount());
|
||||
map.put(" orderNum", tbHandover.getOrderNum());
|
||||
map.put(" quickAmount", tbHandover.getQuickAmount());
|
||||
map.put(" productInfoPos", tbHandover.getProductInfoPos());
|
||||
map.put(" productInfos", tbHandover.getProductInfos());
|
||||
map.put(" createTime", tbHandover.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.ysk.cashier.cons.service.mapstruct;
|
||||
|
||||
import cn.ysk.cashier.base.BaseMapper;
|
||||
import cn.ysk.cashier.cons.domain.TbHandover;
|
||||
import cn.ysk.cashier.cons.service.dto.TbHandoverDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2024-07-25
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbHandoverMapper extends BaseMapper<TbHandoverDto, TbHandover> {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user