diff --git a/fuintAdmin/src/views/integral/settings/index.vue b/fuintAdmin/src/views/integral/settings/index.vue index bf5177aee..b8c93b57e 100644 --- a/fuintAdmin/src/views/integral/settings/index.vue +++ b/fuintAdmin/src/views/integral/settings/index.vue @@ -76,15 +76,15 @@ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java index b99f2dbfa..10f250c96 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java @@ -7,15 +7,16 @@ import com.fuint.api.fuyou.entity.Const; import com.fuint.api.fuyou.entity.Message; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.util.Utils; +import com.fuint.business.order.entity.CashierOrder; import com.fuint.business.order.entity.LJOrder; import com.fuint.business.order.entity.OilOrder; +import com.fuint.business.order.service.CashierOrderService; import com.fuint.business.order.service.LJOrderService; import com.fuint.business.order.service.OilOrderService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.text.SimpleDateFormat; import java.util.*; @Service @@ -25,6 +26,8 @@ public class FyPayServiceImpl implements FyPayService { private LJOrderService goodsOrderService; @Autowired private OilOrderService oilOrderService; + @Autowired + private CashierOrderService cashierOrderService; /** * 条码支付 @@ -112,9 +115,8 @@ public class FyPayServiceImpl implements FyPayService { if (Utils.verifySign(reqMap, str)){ OilOrder oilOrder = oilOrderService.selectOilOrderByOrderNo(orderNo); LJOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo); + CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo); Date date = new Date(); -// SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss"); -// dateFormat.format(date); if (reqMap.get("trans_stat").equals("SUCCESS")){ if (!ObjectUtil.isEmpty(oilOrder)){ oilOrder.setOrderStatus("paid"); @@ -123,6 +125,9 @@ public class FyPayServiceImpl implements FyPayService { if (!ObjectUtil.isEmpty(goodsOrder)){ goodsOrder.setStatus("paid"); } + if (!ObjectUtil.isEmpty(cashierOrder)){ + cashierOrder.setStatus("paid"); + } resMap.put("msg","success"); }else if (reqMap.get("trans_stat").equals("USERPAYING")){ resMap.put("msg","unpaid"); @@ -133,6 +138,9 @@ public class FyPayServiceImpl implements FyPayService { if (!ObjectUtil.isEmpty(goodsOrder)){ goodsOrder.setStatus("payFail"); } + if (!ObjectUtil.isEmpty(cashierOrder)){ + cashierOrder.setStatus("payFail"); + } } if (!ObjectUtil.isEmpty(oilOrder)){ oilOrderService.updateOilOrder(oilOrder); @@ -140,6 +148,9 @@ public class FyPayServiceImpl implements FyPayService { if (!ObjectUtil.isEmpty(goodsOrder)){ goodsOrderService.updateGoodOrder(goodsOrder); } + if (!ObjectUtil.isEmpty(cashierOrder)){ + cashierOrderService.updateCashierOrder(cashierOrder); + } } }catch (Exception e){ log.error(e.getMessage()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/LJGoodsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/LJGoodsController.java index 84d6624cf..d820dd2c9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/LJGoodsController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/LJGoodsController.java @@ -3,6 +3,7 @@ package com.fuint.business.convenienceSore.controller; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.convenienceSore.dto.LJGoodsDto; import com.fuint.business.convenienceSore.entity.LJGoods; import com.fuint.business.convenienceSore.service.LJGoodsService; import com.fuint.framework.web.BaseController; @@ -117,4 +118,15 @@ public class LJGoodsController extends BaseController { public ResponseObject edit(@Validated @RequestBody LJGoods goods){ return getSuccessResult(goodsService.updateLJGoods(goods)); } + + /** + * 修改该商品库存 + * @param goods + * @return + */ + @PostMapping("editGoodsInventory") + public ResponseObject editGoodsInventory(@RequestBody LJGoodsDto goods){ + return getSuccessResult(goodsService.editGoodsInventory(goods)); + } + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/dto/LJGoodsDto.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/dto/LJGoodsDto.java new file mode 100644 index 000000000..c3b407af4 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/dto/LJGoodsDto.java @@ -0,0 +1,16 @@ +package com.fuint.business.convenienceSore.dto; + +import com.fuint.business.convenienceSore.entity.LJGoods; +import lombok.Data; + +@Data +public class LJGoodsDto extends LJGoods { + + // 库存变动 + private Integer numberOfChanges; + private Integer stockId; + // 变动原因 + private String document; + + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/LJGoodsMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/LJGoodsMapper.java index 3ae66bdda..874581857 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/LJGoodsMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/LJGoodsMapper.java @@ -15,4 +15,6 @@ public interface LJGoodsMapper extends BaseMapper { * @return */ public IPage selectLJGoodsList(Page page, @Param("goods") LJGoods goods); + + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/LJGoodsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/LJGoodsService.java index d79db80ee..21a7b5683 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/LJGoodsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/LJGoodsService.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.convenienceSore.dto.LJGoodsDto; import com.fuint.business.convenienceSore.entity.LJGoods; import java.util.List; @@ -70,4 +71,7 @@ public interface LJGoodsService extends IService { * @return */ public int updateLJGoods(LJGoods goods); + + + boolean editGoodsInventory(LJGoodsDto goods); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockStatisticService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockStatisticService.java index 37a15c102..a0c29486f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockStatisticService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockStatisticService.java @@ -53,4 +53,8 @@ public interface StockStatisticService extends IService { * @return */ public void deleteStock(Integer goodsId); + + public int editStock(StockStatistic stock); + + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/LJGoodsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/LJGoodsServiceImpl.java index f89419b81..43cdaf8b5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/LJGoodsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/LJGoodsServiceImpl.java @@ -1,11 +1,13 @@ package com.fuint.business.convenienceSore.service.impl; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.convenienceSore.dto.LJGoodsDto; import com.fuint.business.convenienceSore.entity.LJGoods; import com.fuint.business.convenienceSore.entity.StockStatistic; import com.fuint.business.convenienceSore.entity.StockTrack; @@ -14,12 +16,19 @@ import com.fuint.business.convenienceSore.service.LJGoodsService; import com.fuint.business.convenienceSore.service.StockStatisticService; import com.fuint.business.convenienceSore.service.StockTrackService; import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.StringUtils; import com.fuint.common.util.TokenUtil; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; +import java.math.BigDecimal; import java.util.List; import java.util.Random; +import java.util.concurrent.ExecutionException; /** * 商品信息 业务层 @@ -174,4 +183,77 @@ public class LJGoodsServiceImpl extends ServiceImpl impl int row = baseMapper.updateById(goods); return row; } + + + @Override + @Transactional + public boolean editGoodsInventory(LJGoodsDto goods) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer storeId = nowAccountInfo.getStoreId(); + goods.setStoreId(storeId); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("id",goods.getId()); + queryWrapper.eq("store_id",goods.getStoreId()); + LJGoods ljGoods = baseMapper.selectOne(queryWrapper); + // 变动库存 + if (ObjectUtil.isEmpty(ljGoods)) { + return false; + } + goods.setBuyingPrice(ljGoods.getBuyingPrice()); + if (!ObjectUtil.isEmpty(ljGoods.getStock()) && !ObjectUtil.isEmpty(goods.getNumberOfChanges())) { + goods.setStock(ljGoods.getStock() + goods.getNumberOfChanges()); + if (goods.getStock()>0) { + // 修改该库存 + int i = baseMapper.updateById(goods); + if (i>0) { + // 添加统计信息 + StockStatistic stockStatistic = stockService.selectStockByGoodsId(goods.getId().intValue()); + goods.setStockId(stockStatistic.getId()); + boolean b = addStockStatistic(goods); + + if (!ObjectUtil.isEmpty(stockStatistic)) { + // 添加库存跟踪信息 + if (!ObjectUtil.isEmpty(stockStatistic.getId())){ + goods.setStockId(stockStatistic.getId()); + addStockTrack(goods); + return true; + } + } + } + } else { + try { + throw new Exception("剩余库存已小于0"); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return false; + } + + // 添加统计信息 + public boolean addStockStatistic(LJGoodsDto goods) { + StockStatistic stock = new StockStatistic(); + stock.setId(goods.getId()); + BigDecimal Price = new BigDecimal(goods.getBuyingPrice()); + BigDecimal Stock = new BigDecimal(goods.getStock()); + BigDecimal multiply = Price.multiply(Stock); + stock.setCostAmount(multiply.doubleValue()); + int i = stockService.editStock(stock); + + return i>0; + } + + // 添加库存跟踪信息 + public boolean addStockTrack(LJGoodsDto goods) { + StockTrack stockTrack = new StockTrack(); + stockTrack.setStockId(goods.getStockId()); + stockTrack.setStoreId(goods.getStoreId()); + stockTrack.setDocument(goods.getDocument()); + stockTrack.setChangeNumber(goods.getNumberOfChanges()); + int i = trackService.insertStockTrack(stockTrack); + return i>0; + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockStatisticServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockStatisticServiceImpl.java index ce293b0ad..813e01907 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockStatisticServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockStatisticServiceImpl.java @@ -91,4 +91,11 @@ public class StockStatisticServiceImpl extends ServiceImpl iPageList = this.integralDetailService.queryByPage(page, integralDetail); + return getSuccessResult(iPageList); + } + + + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseObject queryById(@PathVariable("id") Integer id) { + return getSuccessResult(this.integralDetailService.queryById(id)); + } + + /** + * 新增数据 + * + * @param integralDetail 实体 + * @return 新增结果 + */ + @PostMapping + public ResponseObject add(@RequestBody IntegralDetail integralDetail) { + return getSuccessResult(this.integralDetailService.insert(integralDetail)); + } + + /** + * 编辑数据 + * + * @param integralDetail 实体 + * @return 编辑结果 + */ + @PutMapping + public ResponseObject edit(@RequestBody IntegralDetail integralDetail) { + return getSuccessResult(this.integralDetailService.update(integralDetail)); + } + + /** + * 删除数据 + * + * @param id 主键 + * @return 删除是否成功 + */ + @DeleteMapping + public ResponseObject deleteById(Integer id) { + return getSuccessResult(this.integralDetailService.deleteById(id)); + } + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralOrdersController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralOrdersController.java index e16ad79b7..86a208a79 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralOrdersController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/controller/IntegralOrdersController.java @@ -110,5 +110,29 @@ public class IntegralOrdersController extends BaseController { public ResponseObject statistics() { return getSuccessResult(this.integralOrdersService.statistics()); } + + + /** + * + * 礼品订单 + * + * 判断积分是否足够 + * + * 增加订单之前首先判断是否还存在 库存 + * + * 增加积分订单 + * + * 减去积分商城库存 + * + * 减去商品库存 + * + * 减去用户积分 + * + */ + @PostMapping("integralOrdersProcessing") + public ResponseObject integralOrdersProcessing(@RequestBody IntegralOrders integralOrders) { + return getSuccessResult(this.integralOrdersService.integralOrdersProcessing(integralOrders)); + } + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java new file mode 100644 index 000000000..94dd8dc45 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralDetail.java @@ -0,0 +1,74 @@ +package com.fuint.business.integral.entity; + +import java.util.Date; +import com.fuint.repository.model.base.BaseEntity; +import lombok.Data; + +/** + * 积分明细表(IntegralDetail)实体类 + * + * @author wangh + * @since 2023-11-10 17:52:33 + */ +@Data +public class IntegralDetail extends BaseEntity { + private static final long serialVersionUID = 263718830208700746L; + /** + * 积分明细ID + */ + private Integer id; + /** + * 用户ID,表示积分变动的用户 + */ + private Integer userId; + /** + * 积分变动的数量,可以是正数表示增加,负数表示减少 + */ + private Integer pointsChange; + /** + * 变动后用户的当前积分总数 + */ + private Integer currentPoints; + /** + * 变动类型 + */ + private String type; + /** + * 积分变动的原因,用于记录变动的具体原因或业务场景 + */ + private String changeReason; + /** + * 店铺ID + */ + private Integer storeId; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 创建人 + */ + private String createBy; + /** + * 更新人 + */ + private String updateBy; + + + + + + + + + + + + + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralSettings.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralSettings.java index e99cc10a0..ca3930614 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralSettings.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/entity/IntegralSettings.java @@ -44,7 +44,7 @@ public class IntegralSettings extends BaseEntity { /** * 加油消费金额 */ - private Double refuelConsumptionAmount; + private String refuelConsumptionAmount; /** * 加油积分 */ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralDetailMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralDetailMapper.java new file mode 100644 index 000000000..822c673b4 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/IntegralDetailMapper.java @@ -0,0 +1,85 @@ +package com.fuint.business.integral.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.integral.entity.IntegralDetail; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; +import java.util.List; + +/** + * 积分明细表(IntegralDetail)表数据库访问层 + * + * @author wangh + * @since 2023-11-10 17:52:33 + */ +public interface IntegralDetailMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + IntegralDetail queryById(Integer id); + + /** + * 查询指定行数据 + * + * @param integralDetail 查询条件 + * @param page 分页对象 + * @return 对象列表 + */ + IPage queryAllByLimit(@Param("page") Page page, IntegralDetail integralDetail); + + /** + * 统计总行数 + * + * @param integralDetail 查询条件 + * @return 总行数 + */ + long count(IntegralDetail integralDetail); + + /** + * 新增数据 + * + * @param integralDetail 实例对象 + * @return 影响行数 + */ + int insert(IntegralDetail integralDetail); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param integralDetail 实例对象 + * @return 影响行数 + */ + int update(IntegralDetail integralDetail); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml new file mode 100644 index 000000000..5c7ebbc8c --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by) + values (#{userId}, #{pointsChange}, #{currentPoints}, #{type}, #{changeReason}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy}) + + + + insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by) + values + + (#{entity.userId}, #{entity.pointsChange}, #{entity.currentPoints}, #{entity.type}, #{entity.changeReason}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}) + + + + + insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by) + values + + (#{entity.userId}, #{entity.pointsChange}, #{entity.currentPoints}, #{entity.type}, #{entity.changeReason}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}) + + on duplicate key update + user_id = values(user_id), + points_change = values(points_change), + current_points = values(current_points), + type = values(type), + change_reason = values(change_reason), + store_id = values(store_id), + create_time = values(create_time), + update_time = values(update_time), + create_by = values(create_by), + update_by = values(update_by) + + + + + update integral_detail + + + user_id = #{userId}, + + + points_change = #{pointsChange}, + + + current_points = #{currentPoints}, + + + type = #{type}, + + + change_reason = #{changeReason}, + + + store_id = #{storeId}, + + + + update_time = NOW(), + + + create_by = #{createBy}, + + + update_by = #{updateBy}, + + + where id = #{id} + + + + + delete from integral_detail where id = #{id} + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralSettingsMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralSettingsMapper.xml index d9924a2e1..c61069ce9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralSettingsMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralSettingsMapper.xml @@ -10,7 +10,7 @@ - + @@ -125,7 +125,7 @@ + + + store_id = #{order.storeId} + + and staff_id = #{order.staffId} + + + and order_no like concat('%', #{order.orderNo}, '%') + + + and date_format(pay_time,'%y%m%d') >= date_format(#{order.params.beginTime},'%y%m%d') + + + and date_format(pay_time,'%y%m%d') <= date_format(#{order.params.endTime},'%y%m%d') + + + + + \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml index 9519913e3..a7e054451 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/OilOrderMapper.xml @@ -35,4 +35,5 @@ + \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CashierOrderService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CashierOrderService.java new file mode 100644 index 000000000..70c37d066 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/CashierOrderService.java @@ -0,0 +1,40 @@ +package com.fuint.business.order.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.order.entity.CashierOrder; + +/** + * 收银员订单信息 业务层 + */ +public interface CashierOrderService extends IService { + /** + * 根据条件分页查询订单信息 + * @param page + * @param order + * @return + */ + public IPage selectCashierOrderList(Page page, CashierOrder order); + + /** + * 根据订单号查询商品订单信息 + * @param orderNo + * @return + */ + public CashierOrder selectCashierOrder(String orderNo); + + /** + * 添加商品订单信息 + * @param order + * @return + */ + public int insertCashierOrder(CashierOrder order); + + /** + * 修改商品订单信息 + * @param order + * @return + */ + public int updateCashierOrder(CashierOrder order); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/LJOrderService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/LJOrderService.java index 75a06b4a6..26f04aca4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/LJOrderService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/LJOrderService.java @@ -24,6 +24,13 @@ public interface LJOrderService extends IService { */ public LJOrder selectGoodsOrder(String orderNo); + /** + * 根据订单号查询商品订单信息 + * @param id + * @return + */ + public LJOrder selectGoodsOrderById(Integer id); + /** * 添加商品订单信息 * @param order diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java index aaa4e91ff..e306481e0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.fuint.business.order.entity.OilOrder; +import java.util.List; import java.util.Map; /** @@ -26,6 +27,13 @@ public interface OilOrderService extends IService { */ public OilOrder selectOilOrderByOrderNo(String orderNo); + /** + * 根据订单号模糊查询商品订单信息 + * @param orderNo + * @return + */ + public List selectOilOrder(String orderNo); + /** * 添加油品订单信息 * @param map diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CashierOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CashierOrderServiceImpl.java new file mode 100644 index 000000000..f54a5c7ec --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/CashierOrderServiceImpl.java @@ -0,0 +1,44 @@ +package com.fuint.business.order.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.order.entity.CashierOrder; +import com.fuint.business.order.mapper.CashierOrderMapper; +import com.fuint.business.order.service.CashierOrderService; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.springframework.stereotype.Service; + +@Service +public class CashierOrderServiceImpl extends ServiceImpl implements CashierOrderService { + @Override + public IPage selectCashierOrderList(Page page, CashierOrder order) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer storeId = nowAccountInfo.getStoreId(); + order.setStoreId(storeId); + IPage cashierOrderIPage = baseMapper.selectCashierOrderList(page, order); + return cashierOrderIPage; + } + + @Override + public CashierOrder selectCashierOrder(String orderNo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_no",orderNo); + CashierOrder cashierOrder = baseMapper.selectOne(queryWrapper); + return cashierOrder; + } + + @Override + public int insertCashierOrder(CashierOrder order) { + int row = baseMapper.insert(order); + return row; + } + + @Override + public int updateCashierOrder(CashierOrder order) { + int row = baseMapper.updateById(order); + return row; + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/LJOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/LJOrderServiceImpl.java index 8eab34999..ec8ba2200 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/LJOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/LJOrderServiceImpl.java @@ -30,6 +30,12 @@ public class LJOrderServiceImpl extends ServiceImpl impl return ljOrder; } + @Override + public LJOrder selectGoodsOrderById(Integer id) { + LJOrder ljOrder = baseMapper.selectById(id); + return ljOrder; + } + @Override public int insertGoodOrder(LJOrder order) { int row = baseMapper.insert(order); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index 2498477d2..f16fb39f7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -10,10 +10,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.api.fuyou.entity.MerchantConfig; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.service.MerchantConfigService; +import com.fuint.business.order.entity.CashierOrder; import com.fuint.business.order.entity.LJOrder; import com.fuint.business.order.entity.OilOrder; import com.fuint.business.order.entity.OrderGoods; import com.fuint.business.order.mapper.OilOrderMapper; +import com.fuint.business.order.service.CashierOrderService; import com.fuint.business.order.service.LJOrderService; import com.fuint.business.order.service.OilOrderService; import com.fuint.business.order.service.OrderGoodsService; @@ -39,6 +41,8 @@ public class OilOrderServiceImpl extends ServiceImpl i private MerchantConfigService merchantConfigService; @Autowired private UserBalanceService userBalanceService; + @Autowired + private CashierOrderService cashierOrderService; @Override public IPage selectOilOrderList(Page page, OilOrder order) { @@ -57,6 +61,14 @@ public class OilOrderServiceImpl extends ServiceImpl i return order; } + @Override + public List selectOilOrder(String orderNo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.like("order_no",orderNo+"%"); + List list = baseMapper.selectList(queryWrapper); + return list; + } + @Override public Map insertOilOrder(Map map) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); @@ -131,6 +143,19 @@ public class OilOrderServiceImpl extends ServiceImpl i String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); String orderNo = timestamp+randomString; +// 添加收银台订单信息 + CashierOrder cashierOrder = new CashierOrder(); + cashierOrder.setStaffId(staffId); + cashierOrder.setStoreId(storeId); + cashierOrder.setPayUser(payUser); + cashierOrder.setAmount(oilAmount+goodsAmount); + cashierOrder.setPayAmount(oilActualPay+goodsActualPay); + cashierOrder.setStatus(payStatus); + if (payType.equals("CASH")){ + cashierOrder.setPayTime(new Date()); + } + cashierOrder.setOrderNo(orderNo); + OilOrder oilOrder1 = null; LJOrder ljOrder1 = null; // 添加油品订单信息 @@ -244,10 +269,13 @@ public class OilOrderServiceImpl extends ServiceImpl i LJOrder goodsOrder1 = orderService.selectGoodsOrder(orderNo); if (!ObjectUtil.isEmpty(oilOrder2)){ orders.put("oilOrder",oilOrder2); + cashierOrder.setOilOrderId(oilOrder2.getId()); } if (!ObjectUtil.isEmpty(goodsOrder1)){ orders.put("goodsOrder",goodsOrder1); + cashierOrder.setGoodsOrderId(goodsOrder1.getId()); } + cashierOrderService.insertCashierOrder(cashierOrder); return orders; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/OilOrderVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/OilOrderVo.java new file mode 100644 index 000000000..bfdb0a7f6 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/vo/OilOrderVo.java @@ -0,0 +1,25 @@ +package com.fuint.business.order.vo; + +import lombok.Data; + +@Data +public class OilOrderVo { +// 油品id + private Integer id; +// 油品订单金额 + private Double orderAmount; +// 油号 + private String oils; +// 油枪 + private Integer oilGunNum; +// 加油数量 + private Double oilNum; +// 油品单价 + private Double oilPrice; +// 员工id + private Integer staffId; +// 员工姓名 + private String name; +// 员工账号 + private String mobile; +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilNumberMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilNumberMapper.java index 6e42cbc5b..f4b3f7605 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilNumberMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilNumberMapper.java @@ -21,37 +21,37 @@ public interface OilNumberMapper extends BaseMapper { * @param page * @return */ - public IPage selectOilNumberList(Page page, @Param("oilNumber") OilNumber oilNumber); + IPage selectOilNumberList(Page page, @Param("oilNumber") OilNumber oilNumber); /** * 根据id查询员工信息 * @param id * @return */ - public OilNumber selectOilNumberById(@Param("id") int id); + OilNumber selectOilNumberById(@Param("id") int id); /** * 根据id删除员工信息 * @return */ - public int deleteOilNumberById(@Param("id") int id); + int deleteOilNumberById(@Param("id") int id); /** * 添加员工信息 * @return */ - public int insertOilNumber(OilNumber oilNumber); + int insertOilNumber(OilNumber oilNumber); /** * 修改员工信息 * @return */ - public int updateOilNumber(OilNumber oilNumber); + int updateOilNumber(OilNumber oilNumber); - public List getOilName(@Param("storeId") Integer storeId); + List getOilName(@Param("storeId") Integer storeId); // 根据店铺和油号查询是否存在重复 - public int selectOilNameByStore(OilNumber oilNumber); + int selectOilNameByStore(OilNumber oilNumber); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilNumberMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilNumberMapper.xml index 51ba7521d..0d90195cc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilNumberMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilNumberMapper.xml @@ -92,7 +92,6 @@ update_by= #{updateBy}, unit= #{unit}, update_time= NOW() - where number_id = #{numberId} @@ -105,11 +104,10 @@ from oil_number onm left join oil_name name on onm.oil_name = name.id - - onm.store_id = #{storeId} - + onm.store_id = #{storeId} + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNumberService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNumberService.java index 1497854b8..f0d5d28a5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNumberService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNumberService.java @@ -49,9 +49,9 @@ public interface OilNumberService extends IService { public int updateOilNumber(OilNumber oilNumber); - public List getOilName(); + List getOilName(); - public OilNumber selectOilNameByStore(OilNumber oilNumber); + OilNumber selectOilNameByStore(OilNumber oilNumber); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPresetPricesServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPresetPricesServiceImpl.java index 4246a8816..4c80ee89d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPresetPricesServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPresetPricesServiceImpl.java @@ -126,10 +126,9 @@ public class OilPresetPricesServiceImpl extends ServiceImpl
-
-
- - - - - -
-
- 搜索 -
-
+ + + + + + + + + + + + + + + + + {{ item.realName }} + {{ item.mobile }} + + + + + + + + + + + 搜索 + 重置 + +
@@ -37,89 +70,71 @@
+ prop="orderNo" + label="订单号" + width="180"> - - - - - - + - - - - - - - + - + + prop="oilOrderId" + label="油品金额"> + - - + prop="goodsOrderId" + label="商品金额"> + + prop="payUser" + label="付款用户"> - - - + prop="status" + label="状态"> + + + + + + @@ -140,10 +155,29 @@ @@ -262,5 +344,4 @@ width: 20%; } -