订单修改

This commit is contained in:
seesaw
2024-10-30 15:43:32 +08:00
parent b17e85469f
commit 0a0f44c297
7 changed files with 42 additions and 24 deletions

View File

@ -38,4 +38,10 @@ public class StoreOrderPageVO extends PageParam {
@Schema(description = "时间段", example = "1722")
private String timePeriod;
private String startDate;
private String endDate;
@Schema(description = "门店", example = "1722")
private Long carteenId;
}

View File

@ -57,4 +57,6 @@ public class StoreOrderRespVO {
@Schema(description = "订单详情")
private List<AppStoreOrderDetailVo> detailDOS;
private Long carteenId;
}

View File

@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.storeorder.StoreOrderDO;
import cn.iocoder.yudao.module.member.dal.dataobject.storeorderdetail.StoreOrderDetailDO;
import cn.iocoder.yudao.module.member.service.storeorder.StoreOrderService;
import cn.iocoder.yudao.module.member.service.storeorderdetail.StoreOrderDetailService;
import cn.iocoder.yudao.module.system.api.carteen.CarteenApi;
import cn.iocoder.yudao.module.system.api.cashregisterinfo.CashregisterinfoApi;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -43,7 +44,7 @@ public class AppStoreOrderController {
@Resource
private StoreOrderDetailService orderDetailService;
@Resource
private CashregisterinfoApi cashregisterinfoApi;
private CarteenApi carteenApi;
@GetMapping("/page")
@Operation(summary = "获得商品订单分页")
@ -54,7 +55,7 @@ public class AppStoreOrderController {
for (StoreOrderRespVO vo: bean.getList()) {
List<AppStoreOrderDetailVo> listByOrderNo = orderDetailService.getListByOrderNo(vo.getOrderId());
vo.setDetailDOS(listByOrderNo);
vo.setStoresName(cashregisterinfoApi.getStoreName(vo.getEquipmentCode()));
vo.setStoresName(carteenApi.getCarteenById(vo.getCarteenId()).getStoresName());
}
return success(bean);
}

View File

@ -59,4 +59,9 @@ public class StoreOrderDO extends BaseDO {
*/
private Double reductionPrice;
/**
* 门店ID
*/
private Long carteenId;
}

View File

@ -227,9 +227,6 @@ public class StoreOrderServiceImpl implements StoreOrderService {
Page<StoreOrderPageVO> page = Page.of(pageReqVO.getPageNo(), pageReqVO.getPageSize());
IPage<StoreOrderPageVO> pageNew = storeOrderMapper.getStoreOrderPageNew(page, pageReqVO);
List<StoreOrderPageVO> records = pageNew.getRecords();
// for (StoreOrderPageVO record : records) {
// record.setTimePeriod(TimePeriodEnum.getTimeName(record.getCreateTime()));
// }
return new PageResult<>(records, pageNew.getTotal());
}

View File

@ -9,7 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
@ -44,7 +46,7 @@ public class StoreSaleGoodsServiceImpl implements StoreSaleGoodsService {
@Override
public Integer createStoreSaleGoods(StoreSaleGoodsSaveBatchVO createReqVO) {
List<StoreSaleGoodsDO> addList = new ArrayList<>();
List<StoreSaleGoodsDO> addList = new ArrayList<>();
List<Long> carteenIds = createReqVO.getCarteenIds();
List<Integer> goodsIds = createReqVO.getGoodsIds();
@ -53,7 +55,7 @@ public class StoreSaleGoodsServiceImpl implements StoreSaleGoodsService {
.eq(StoreSaleGoodsDO::getCarteenId, carteenId));
List<Integer> saleGoods = storeSaleGoodsDOS.stream().map(StoreSaleGoodsDO::getGoodsId).collect(Collectors.toList());
for (Integer goodsId : goodsIds) {
if(saleGoods.contains(goodsId)){
if (saleGoods.contains(goodsId)) {
continue;
}
// 插入
@ -103,22 +105,23 @@ public class StoreSaleGoodsServiceImpl implements StoreSaleGoodsService {
@Override
public Boolean bindGoods(StoreSaleGoodsDto dto) {
if(CollectionUtil.isEmpty(dto.getEquipmentGoodsCustoms())){
throw exception(STORE_SALE_GOODS_NOT_NULL);
}
Long storeId = cashregisterinfoApi.getStoreId(dto.getEquipmentCode());
//清空
storeSaleGoodsMapper.delete(new LambdaQueryWrapper<StoreSaleGoodsDO>().eq(StoreSaleGoodsDO::getCarteenId, storeId));
ArrayList<StoreSaleGoodsDO> list = new ArrayList<>();
for (StoreGoodsDto storeGoodsDto : dto.getEquipmentGoodsCustoms()) {
StoreSaleGoodsDO storeSaleGoodsDO = new StoreSaleGoodsDO();
BeanUtil.copyProperties(storeGoodsDto, storeSaleGoodsDO);
storeSaleGoodsDO.setEquipmentCode(dto.getEquipmentCode());
storeSaleGoodsDO.setCarteenId(storeId);
list.add(storeSaleGoodsDO);
Boolean b = true;
if (CollectionUtil.isNotEmpty(dto.getEquipmentGoodsCustoms())) {
ArrayList<StoreSaleGoodsDO> list = new ArrayList<>();
for (StoreGoodsDto storeGoodsDto : dto.getEquipmentGoodsCustoms()) {
StoreSaleGoodsDO storeSaleGoodsDO = new StoreSaleGoodsDO();
BeanUtil.copyProperties(storeGoodsDto, storeSaleGoodsDO);
storeSaleGoodsDO.setEquipmentCode(dto.getEquipmentCode());
storeSaleGoodsDO.setCarteenId(storeId);
list.add(storeSaleGoodsDO);
}
b = storeSaleGoodsMapper.insertBatch(list);
}
return storeSaleGoodsMapper.insertBatch(list);
return b;
}
@Override
@ -127,9 +130,9 @@ public class StoreSaleGoodsServiceImpl implements StoreSaleGoodsService {
Long storeId = cashregisterinfoApi.getStoreId(equipmentCode);
List<StoreSaleGoodsDO> storeSaleGoodsDOS = storeSaleGoodsMapper.selectList(new LambdaQueryWrapper<StoreSaleGoodsDO>().eq(StoreSaleGoodsDO::getCarteenId, storeId));
if (CollectionUtil.isEmpty(storeSaleGoodsDOS)){
if (CollectionUtil.isEmpty(storeSaleGoodsDOS)) {
return Collections.emptyList();
}else {
} else {
return storeSaleGoodsDOS.stream().map(StoreSaleGoodsDO::getGoodsId).collect(Collectors.toList());
}
}

View File

@ -11,11 +11,9 @@
<select id="getStoreOrderPageNew"
resultType="cn.iocoder.yudao.module.member.controller.admin.storeorder.vo.StoreOrderPageVO">
select so.order_id,so.total_price,so.create_time,mu.nickname,mu.mobile,tc.stores_name,so.reduction_price
select so.order_id,so.total_price,so.create_time,mu.nickname,mu.mobile,so.reduction_price,so.carteen_id
from member_store_order so
left join member_user mu on so.user_id = mu.id
left join t_cash_register_info tr on tr.equipment_code = so.equipment_code
left join t_carteen tc on tr.carteen_id = tc.id
<where>
so.deleted = false
<if test="vo.orderId != null">
@ -27,6 +25,12 @@
<if test="vo.mobile != null and vo.mobile != ''">
and mu.mobile like concat('%',#{vo.mobile},'%')
</if>
<if test="vo.startDate != null and vo.startDate != '' and vo.endDate != null and vo.endDate != '' ">
and date_format(so.create_time,'%Y-%m-%d') between #{vo.startDate} and #{vo.endDate}
</if>
<if test="vo.carteenId != null ">
and so.carteen_id = #{vo.carteenId}
</if>
</where>
order by so.order_id DESC
</select>