diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/entity/MtGoods.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/entity/MtGoods.java new file mode 100644 index 000000000..9b0f01948 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/entity/MtGoods.java @@ -0,0 +1,119 @@ +package com.fuint.business.cashierGoods.entity; + +import com.fuint.framework.entity.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.io.Serializable; + +/** + * 商品表(MtGoods)实体类 + * + * @author makejava + * @since 2024-09-13 11:10:23 + */ +@Data +public class MtGoods extends BaseEntity { + private static final long serialVersionUID = 253041736189731537L; + /** + * 自增ID + */ + private Integer id; + /** + * 所属店铺ID + */ + private Integer storeId; + /** + * 商品名称 + */ + private String name; + /** + * 商品分类ID + */ + private Integer cvsGoodId; + /** + * 商品编码(条码) + */ + private String goodsNo; + /** + * 商品拼音码 + */ + private String pinyinCode; + /** + * 货架号 + */ + private String shelfNumber; + /** + * 进货价 + */ + private BigDecimal buyingPrice; + /** + * 零售价 + */ + private BigDecimal retailPrice; + /** + * 会员价 + */ + private Double memberPrice; + /** + * 库存 + */ + private Long stock; + /** + * 单位 + */ + private String unit; + /** + * 供应商id + */ + private String supplierId; + /** + * 可否使用积分抵扣 + */ + private String canUsePoint; + /** + * 排序 + */ + private Integer sort; + /** + * 是否在回收站:0不在回收站,1在回收站 + */ + private Integer isRecovery; + /** + * 商品描述 + */ + private String description; + /** + * 状态:启用、禁用 + */ + private String status; + /** + * 创建时间 + */ + private Date createTime; + /** + * 创建人 + */ + private String createBy; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 更新人 + */ + private String updateBy; + /** + * 0未删除 1 删除 + */ + private String ifDelete; + /** + * 可否使用兑换券兑换;0可以,1不可以 + */ + private String canUseExchange; + + + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/CashRegisterGoodsMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/CashRegisterGoodsMapper.java new file mode 100644 index 000000000..f249d9edd --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/CashRegisterGoodsMapper.java @@ -0,0 +1,14 @@ +package com.fuint.business.cashierGoods.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.cashierGoods.entity.MtGoods; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +// 如何集成mybatis plus 通用mapper +public interface CashRegisterGoodsMapper extends BaseMapper { + + + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/xml/MtGoodsMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/xml/MtGoodsMapper.xml new file mode 100644 index 000000000..aa5827cc4 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/mapper/xml/MtGoodsMapper.xml @@ -0,0 +1,316 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/CashRegisterGoodsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/CashRegisterGoodsService.java new file mode 100644 index 000000000..846a4ad9d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/CashRegisterGoodsService.java @@ -0,0 +1,17 @@ +package com.fuint.business.cashierGoods.service; + +import com.fuint.business.cashierGoods.entity.MtGoods; + +import java.util.List; +import java.util.Map; + +public interface CashRegisterGoodsService { + + +// 通用mapper条件查询 + List selectListByMap(Map columnMap); + + + + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/impl/CashRegisterGoodsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/impl/CashRegisterGoodsServiceImpl.java new file mode 100644 index 000000000..b46099094 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/cashierGoods/service/impl/CashRegisterGoodsServiceImpl.java @@ -0,0 +1,23 @@ +package com.fuint.business.cashierGoods.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.cashierGoods.entity.MtGoods; +import com.fuint.business.cashierGoods.mapper.CashRegisterGoodsMapper; +import com.fuint.business.cashierGoods.service.CashRegisterGoodsService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class CashRegisterGoodsServiceImpl extends ServiceImpl implements CashRegisterGoodsService { + + + @Override + public List selectListByMap(Map columnMap) { + + List mtGoods = super.baseMapper.selectByMap(columnMap); + + return mtGoods; + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilGunController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilGunController.java index d3f62859a..2e9ea977c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilGunController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilGunController.java @@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.petrolStationManagement.entity.OilGun; import com.fuint.business.petrolStationManagement.service.OilGunService; +import com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo; import com.fuint.business.petrolStationManagement.vo.OilGunVO; import com.fuint.business.setting.entity.SysLog; import com.fuint.business.setting.service.SysLogService; import com.fuint.framework.web.BaseController; import com.fuint.framework.web.ResponseObject; +import io.swagger.annotations.Authorization; import org.apache.ibatis.annotations.Param; +import org.aspectj.lang.annotation.AdviceName; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.http.ResponseEntity; @@ -17,6 +20,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; +import java.util.Map; +import java.util.Set; /** * 油枪表(OilGun)表控制层 @@ -64,6 +69,15 @@ public class OilGunController extends BaseController { } + //根据当前店铺 获取油枪 分组油号 + @GetMapping("/cashRegisterList") + public ResponseObject cashRegisterList() { + + Map> integerSetMap = this.oilGunService.cashRegisterList(); + + return getSuccessResult(integerSetMap); + } + /** * 通过主键查询单条数据 @@ -86,15 +100,16 @@ public class OilGunController extends BaseController { public ResponseObject add(@RequestBody OilGun oilGun) { if (this.oilGunService.insert(oilGun)) { try { - SysLog sysLog =new SysLog(); + SysLog sysLog = new SysLog(); sysLog.setSystemName("2"); sysLog.setMoudle("油枪管理"); - sysLog.setContent("新增名称为"+oilGun.getGunName()+"的油枪信息"); + sysLog.setContent("新增名称为" + oilGun.getGunName() + "的油枪信息"); sysLogService.saveVo(sysLog); - }catch (Exception ignored){} + } catch (Exception ignored) { + } return getSuccessResult(true); - }else { - return getSuccessResult(201,"存在重复的油枪名称,请修改",null); + } else { + return getSuccessResult(201, "存在重复的油枪名称,请修改", null); } } @@ -106,17 +121,18 @@ public class OilGunController extends BaseController { */ @PutMapping public ResponseObject edit(@RequestBody OilGun oilGun) { - if (this.oilGunService.update(oilGun)){ + if (this.oilGunService.update(oilGun)) { try { - SysLog sysLog =new SysLog(); + SysLog sysLog = new SysLog(); sysLog.setSystemName("2"); sysLog.setMoudle("油枪管理"); - sysLog.setContent("更新名称为"+oilGun.getGunName()+"的油枪信息"); + sysLog.setContent("更新名称为" + oilGun.getGunName() + "的油枪信息"); sysLogService.saveVo(sysLog); - }catch (Exception ignored){} + } catch (Exception ignored) { + } return getSuccessResult(this.oilGunService.update(oilGun)); - }else { - return getSuccessResult(201,"存在重复的油枪名称,请修改",null); + } else { + return getSuccessResult(201, "存在重复的油枪名称,请修改", null); } } @@ -129,31 +145,34 @@ public class OilGunController extends BaseController { @DeleteMapping public ResponseObject deleteById(Integer id) { try { - SysLog sysLog =new SysLog(); + SysLog sysLog = new SysLog(); sysLog.setSystemName("2"); sysLog.setMoudle("油枪管理"); - sysLog.setContent("删除编号为"+id+"的油枪信息"); + sysLog.setContent("删除编号为" + id + "的油枪信息"); sysLogService.saveVo(sysLog); - }catch (Exception ignored){} + } catch (Exception ignored) { + } return getSuccessResult(this.oilGunService.deleteById(id)); } /** * 根据油号id查询油枪列表信息 + * * @param numberId * @return */ @GetMapping("/queryGunList/{numberId}") - public ResponseObject queryGunList(@PathVariable Integer numberId){ + public ResponseObject queryGunList(@PathVariable Integer numberId) { return getSuccessResult(oilGunService.selectOilGunByNumberId(numberId)); } /** * 查询当前店铺所有油枪列表信息 + * * @return */ @GetMapping("/queryOilGunList") - public ResponseObject selectGunList(){ + public ResponseObject selectGunList() { return getSuccessResult(oilGunService.selectOilGuns()); } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilGunMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilGunMapper.java index af6f44f89..b6ffd8a57 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilGunMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilGunMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.petrolStationManagement.entity.OilGun; +import com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo; import com.fuint.business.petrolStationManagement.vo.OilGunVO; import org.apache.ibatis.annotations.Param; @@ -17,6 +18,9 @@ import java.util.List; */ public interface OilGunMapper extends BaseMapper { + + List cashRegisterList(@Param("storeId") Integer storeId); + /** * 通过ID查询单条数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml index 39ccbdedf..f1424e00e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml @@ -20,8 +20,15 @@ @@ -46,7 +53,8 @@ + @@ -155,26 +179,24 @@ create_by, update_by, number_id, oil_machine_gun_number, staff_status, - staff_list, -device_id, -device_name - - ) + staff_list, + device_id, + device_name) values (#{gunName}, #{tankId}, #{status}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy}, #{numberId}, #{oilMachineGunNumber}, #{staffStatus} #{staffList} #{deviceId} - #{deviceName} - ) + #{deviceName}) insert into oil_gun(gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by) values - (#{entity.gunName}, #{entity.tankId}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}) + (#{entity.gunName}, #{entity.tankId}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, + #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}) @@ -182,7 +204,8 @@ device_name insert into oil_gun(gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by) values - (#{entity.gunName}, #{entity.tankId}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}) + (#{entity.gunName}, #{entity.tankId}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, + #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}) on duplicate key update gun_name = values(gun_name), @@ -251,7 +274,9 @@ device_name - delete from oil_gun where id = #{id} + delete + from oil_gun + where id = #{id} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilGunService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilGunService.java index 66eeaa7e6..c86840090 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilGunService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilGunService.java @@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.petrolStationManagement.entity.OilGun; import com.fuint.business.petrolStationManagement.entity.OilTank; +import com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo; import com.fuint.business.petrolStationManagement.vo.OilGunVO; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.PageRequest; import java.util.List; +import java.util.Map; +import java.util.Set; /** * 油枪表(OilGun)表服务接口 @@ -48,6 +51,8 @@ public interface OilGunService { */ boolean insert(OilGun oilGun); + Map> cashRegisterList(); + /** * 修改数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilGunServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilGunServiceImpl.java index 33d074c53..e16c3b2a3 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilGunServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilGunServiceImpl.java @@ -9,17 +9,22 @@ import com.fuint.business.petrolStationManagement.entity.OilNumber; import com.fuint.business.petrolStationManagement.mapper.OilGunMapper; import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper; import com.fuint.business.petrolStationManagement.service.OilGunService; +import com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo; import com.fuint.business.petrolStationManagement.vo.OilGunVO; import com.fuint.business.petrolStationManagement.vo.OilNumberVO; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; import com.fuint.quartz.util.BeanUtils; +import io.swagger.models.auth.In; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; /** * 油枪表(OilGun)表服务实现类 @@ -60,7 +65,9 @@ public class OilGunServiceImpl implements OilGunService { // IPage oilGunIPage = oilGunDao.queryAllByLimit(page, oilGun); return oilGunDao.queryAllByLimit(page, oilGun); - } @Override + } + + @Override public IPage queryByPage2(@Param("page") Page page, @Param("oilGun") OilGun oilGun) { if (ObjectUtil.isEmpty(oilGun.getStoreId())) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); @@ -80,7 +87,7 @@ public class OilGunServiceImpl implements OilGunService { List oilName = oilGunDao.getOilName(nowAccountInfo.getStoreId()); // 根据店铺id查询所有油枪 List allList = oilGunDao.getAllList(oilGun); - if (oilName.size() <= 0 || allList.size() <= 0){ + if (oilName.size() <= 0 || allList.size() <= 0) { return oilName; } for (OilGunVO oilNumber : oilName) { @@ -104,7 +111,7 @@ public class OilGunServiceImpl implements OilGunService { oilGun.setStatus("启用"); // 根据店铺id查询所有油枪 List allList = oilGunDao.getAllList(oilGun); - if (oilName.size() <= 0 || allList.size() <= 0){ + if (oilName.size() <= 0 || allList.size() <= 0) { return oilName; } for (OilGunVO oilNumber : oilName) { @@ -131,12 +138,25 @@ public class OilGunServiceImpl implements OilGunService { oilGun.setStoreId(accountInfo.getStoreId()); oilGun.setCreateBy(accountInfo.getStaffId().toString()); int i = checkData(oilGun); - if (i>0) { + if (i > 0) { return false; } oilGun.setCreateBy(accountInfo.getId().toString()); - return oilGunDao.insert(oilGun)>0; + return oilGunDao.insert(oilGun) > 0; + } + + @Override + public Map> cashRegisterList() { + AccountInfo accountInfo = TokenUtil.getNowAccountInfo(); + Integer storeId = accountInfo.getStoreId(); + List oilCashRegisterVos = oilGunDao.cashRegisterList(storeId); + + Map> groupedByOilName = oilCashRegisterVos.stream() + .collect(Collectors.groupingBy(OilCashRegisterVo::getOilName)); + + + return groupedByOilName; } // 判断是否有同一名称的数据 @@ -162,7 +182,7 @@ public class OilGunServiceImpl implements OilGunService { oilGun.setStoreId(accountInfo.getStoreId()); List oilGuns = checkData2(oilGun); if (ObjectUtil.isNotEmpty(oilGuns)) { - if (oilGuns.size()>1) { + if (oilGuns.size() > 1) { return false; } if (!oilGuns.get(0).getId().equals(oilGun.getId())) { @@ -171,7 +191,7 @@ public class OilGunServiceImpl implements OilGunService { } oilGun.setUpdateBy(accountInfo.getId().toString()); - return this.oilGunDao.update(oilGun)>0; + return this.oilGunDao.update(oilGun) > 0; } /** @@ -188,8 +208,8 @@ public class OilGunServiceImpl implements OilGunService { @Override public List selectOilGunByNumberId(Integer numberId) { QueryWrapper queryWrapper = new QueryWrapper(); - queryWrapper.eq("number_id",numberId); - queryWrapper.eq("status","启用"); + queryWrapper.eq("number_id", numberId); + queryWrapper.eq("status", "启用"); List list = oilGunDao.selectList(queryWrapper); return list; } @@ -197,8 +217,8 @@ public class OilGunServiceImpl implements OilGunService { @Override public List selectOilGunByTankId(Integer tankId) { QueryWrapper queryWrapper = new QueryWrapper(); - queryWrapper.eq("tank_id",tankId); - queryWrapper.eq("status","启用"); + queryWrapper.eq("tank_id", tankId); + queryWrapper.eq("status", "启用"); List list = oilGunDao.selectList(queryWrapper); return list; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilCashRegisterVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilCashRegisterVo.java new file mode 100644 index 000000000..277f9c018 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilCashRegisterVo.java @@ -0,0 +1,24 @@ +package com.fuint.business.petrolStationManagement.vo; + +import com.fuint.business.petrolStationManagement.entity.OilGun; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class OilCashRegisterVo extends OilGun { + + /** + * 关联表 油号名称 + */ + private String oilName; + /** + * 关联表 油品类型 + */ + private String oilType; + /** + * 关联表 挂牌价 + */ + private BigDecimal oilPrice; + +}