Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
caaa3196b3 | ||
| 45a6bcbe9d | |||
| 4ee6999b16 | |||
| 2af6d62737 |
@@ -0,0 +1,70 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.ShopPrinterService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺打印机配置
|
||||
* @author tankaikai
|
||||
* @since 2024-09-24 16:56
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*")
|
||||
@RequestMapping("shop-config/printer")
|
||||
public class ShopPrinterController {
|
||||
|
||||
@Resource
|
||||
private ShopPrinterService shopPrinterService;
|
||||
|
||||
@GetMapping("page")
|
||||
public Result page(@RequestParam Map<String, Object> params) {
|
||||
PageInfo<ShopPrinterDTO> page = shopPrinterService.page(params);
|
||||
return Result.success(CodeEnum.SUCCESS,page);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
List<ShopPrinterDTO> list = shopPrinterService.list(params);
|
||||
return Result.success(CodeEnum.SUCCESS,list);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
public Result get(@PathVariable("id") Integer id) {
|
||||
ShopPrinterDTO dto = shopPrinterService.get(id);
|
||||
return Result.success(CodeEnum.SUCCESS,dto);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public Result save(@RequestBody ShopPrinterDTO dto) {
|
||||
shopPrinterService.save(dto);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public Result update(@RequestBody ShopPrinterDTO dto) {
|
||||
shopPrinterService.update(dto);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
public Result delete(@PathVariable("id") Integer id){
|
||||
shopPrinterService.delete(id);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@PostMapping("update-status")
|
||||
public Result updateStatus(@RequestBody ShopPrinterDTO dto){
|
||||
shopPrinterService.updateStatus(dto.getId(),dto.getStatus());
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2024-09-24 17:25
|
||||
*/
|
||||
@Mapper
|
||||
public interface ShopPrinterServiceMapper {
|
||||
List<ShopPrinterDTO> getList(Map<String, Object> params);
|
||||
|
||||
int updateStatus(@Param("id") Integer id, @Param("status") Integer status);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 店铺打印机配置
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2024-09-24 17:13
|
||||
*/
|
||||
@Data
|
||||
public class ShopPrinterDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
|
||||
private String connectionType;
|
||||
|
||||
private String address;
|
||||
|
||||
private String port;
|
||||
|
||||
private String subType;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String shopId;
|
||||
|
||||
private String categoryIds;
|
||||
|
||||
private String contentType;
|
||||
|
||||
private String createdAt;
|
||||
|
||||
private String updatedAt;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private String vendorId;
|
||||
|
||||
private String productId;
|
||||
private String config;
|
||||
|
||||
public String getCreatedAt() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new Date(Long.valueOf(createdAt)));
|
||||
}
|
||||
|
||||
public String getUpdatedAt() {
|
||||
if("".equals(updatedAt) || updatedAt == null){
|
||||
return "";
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new Date(Long.valueOf(updatedAt)));
|
||||
}
|
||||
}
|
||||
@@ -66,8 +66,8 @@ public class ConsService {
|
||||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
|
||||
for (TbOrderDetail orderDetail : orderDetails) {
|
||||
// List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductIdAndCheck(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
// List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductIdAndCheck(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
if(Objects.isNull(proskuCons)||proskuCons.size()<=0){
|
||||
log.info("耗材信息未配置或未开启校验:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
continue;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 打印机配置
|
||||
* @author tankaikai
|
||||
* @since 2024-09-24 17:15
|
||||
*/
|
||||
public interface ShopPrinterService {
|
||||
|
||||
PageInfo<ShopPrinterDTO> page(Map<String, Object> params);
|
||||
|
||||
List<ShopPrinterDTO> list(Map<String, Object> params);
|
||||
|
||||
ShopPrinterDTO get(Integer id);
|
||||
|
||||
void save(ShopPrinterDTO dto);
|
||||
|
||||
void update(ShopPrinterDTO dto);
|
||||
|
||||
void delete(Integer id);
|
||||
|
||||
void updateStatus(Integer id,Integer status);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import com.chaozhanggui.system.cashierservice.dao.ShopPrinterServiceMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbPrintMachineMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPrintMachineWithBLOBs;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.ShopPrinterService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺打印配置
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2024-09-24 17:23
|
||||
*/
|
||||
@Service
|
||||
public class ShopPrinterServiceImpl implements ShopPrinterService {
|
||||
|
||||
@Resource
|
||||
private ShopPrinterServiceMapper shopPrinterServiceMapper;
|
||||
|
||||
@Resource
|
||||
private TbPrintMachineMapper tbPrintMachineMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<ShopPrinterDTO> page(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
Integer pageNum = mapProxy.getInt("pageNum");
|
||||
Integer pageSize = mapProxy.getInt("pageSize");
|
||||
PageInfo<ShopPrinterDTO> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> shopPrinterServiceMapper.getList(params));
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopPrinterDTO> list(Map<String, Object> params) {
|
||||
return shopPrinterServiceMapper.getList(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopPrinterDTO get(Integer id) {
|
||||
TbPrintMachineWithBLOBs entity = tbPrintMachineMapper.selectByPrimaryKey(id);
|
||||
return BeanUtil.toBean(entity, ShopPrinterDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(ShopPrinterDTO dto) {
|
||||
TbPrintMachineWithBLOBs entity = new TbPrintMachineWithBLOBs();
|
||||
BeanUtil.copyProperties(dto, entity, "createdAt", "updatedAt");
|
||||
entity.setCreatedAt(System.currentTimeMillis());
|
||||
entity.setUpdatedAt(System.currentTimeMillis());
|
||||
tbPrintMachineMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ShopPrinterDTO dto) {
|
||||
TbPrintMachineWithBLOBs entity = tbPrintMachineMapper.selectByPrimaryKey(dto.getId());
|
||||
BeanUtil.copyProperties(dto, entity, "createdAt", "updatedAt");
|
||||
entity.setUpdatedAt(System.currentTimeMillis());
|
||||
tbPrintMachineMapper.updateByPrimaryKeyWithBLOBs(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Integer id) {
|
||||
tbPrintMachineMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(Integer id, Integer status) {
|
||||
shopPrinterServiceMapper.updateStatus(id, status);
|
||||
}
|
||||
}
|
||||
65
src/main/resources/mapper/ShopPrinterMapper.xml
Normal file
65
src/main/resources/mapper/ShopPrinterMapper.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.ShopPrinterServiceMapper">
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, name, type, connection_type, address, port, sub_type, status, shop_id, category_ids, content_type, created_at, updated_at, sort, vendor_id, product_id
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
config, category_list
|
||||
</sql>
|
||||
|
||||
<select id="getList" resultType="com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO">
|
||||
select
|
||||
<include refid="Base_Column_List" />,
|
||||
<include refid="Blob_Column_List" />
|
||||
from tb_print_machine
|
||||
where shop_id = #{shopId}
|
||||
<if test="name != null and name != ''">
|
||||
and name like concat(#{name}, '%')
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="connectionType != null and connectionType != ''">
|
||||
and connection_type = #{connectionType}
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
and address = #{address}
|
||||
</if>
|
||||
<if test="port != null and port != ''">
|
||||
and port = #{port}
|
||||
</if>
|
||||
<if test="subType != null and subType != ''">
|
||||
and sub_type = #{subType}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="categoryIds != null and categoryIds != ''">
|
||||
and category_ids = #{categoryIds}
|
||||
</if>
|
||||
<if test="contentType != null and contentType != ''">
|
||||
and content_type = #{contentType}
|
||||
</if>
|
||||
<if test="config != null and config != ''">
|
||||
and config = #{config}
|
||||
</if>
|
||||
<if test="categoryList != null and categoryList != ''">
|
||||
and category_list = #{categoryList}
|
||||
</if>
|
||||
<if test="vendorId != null and vendorId != ''">
|
||||
and vendor_id = #{vendorId}
|
||||
</if>
|
||||
<if test="productId != null and productId != ''">
|
||||
and product_id = #{productId}
|
||||
</if>
|
||||
order by sort asc,id desc
|
||||
</select>
|
||||
|
||||
<update id="updateStatus">
|
||||
update tb_print_machine set status = #{status} where id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user