订单列表

master
lzq 2026-02-09 18:42:31 +08:00
parent 62efe0bb0f
commit baf33cec58
20 changed files with 975 additions and 124 deletions

View File

@ -0,0 +1,15 @@
package com.njzscloud.common.core.jackson.serializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.njzscloud.common.core.ienum.Dict;
/**
* Long
*/
public class DictModule extends SimpleModule {
{
this.addSerializer(Dict.class, new DictSerializer())
.addDeserializer(Dict.class, new DictDeserializer());
}
}

View File

@ -1,6 +1,7 @@
package com.njzscloud.common.mvc.config;
import com.njzscloud.common.core.jackson.serializer.BigDecimalModule;
import com.njzscloud.common.core.jackson.serializer.DictModule;
import com.njzscloud.common.core.jackson.serializer.LongModule;
import com.njzscloud.common.core.jackson.serializer.TimeModule;
import com.njzscloud.common.mvc.support.DictHandlerMethodArgumentResolver;
@ -22,7 +23,7 @@ public class MvcAutoConfiguration {
@Bean
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
return build -> build
.modules(new TimeModule(), new LongModule(), new BigDecimalModule());
.modules(new TimeModule(), new LongModule(), new BigDecimalModule(), new DictModule());
}
@Bean

View File

@ -5,6 +5,7 @@ import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.dispose.cst.order.pojo.entity.OrderEntity;
import com.njzscloud.dispose.cst.order.pojo.param.*;
import com.njzscloud.dispose.cst.order.pojo.result.SearchOrderResult;
import com.njzscloud.dispose.cst.order.service.OrderService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -64,8 +65,8 @@ public class OrderController {
*
*/
@GetMapping("/paging")
public R<PageResult<OrderEntity>> paging(PageParam pageParam, OrderEntity orderEntity) {
return R.success(orderService.paging(pageParam, orderEntity));
public R<PageResult<SearchOrderResult>> paging(PageParam pageParam, SearchOrderParam searchOrderParam) {
return R.success(orderService.paging(pageParam, searchOrderParam));
}
/**

View File

@ -1,8 +1,12 @@
package com.njzscloud.dispose.cst.order.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njzscloud.dispose.cst.order.pojo.entity.OrderEntity;
import com.njzscloud.dispose.cst.order.pojo.result.SearchOrderResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* /
@ -10,6 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface OrderMapper extends BaseMapper<OrderEntity> {
IPage<SearchOrderResult> paging(IPage<SearchOrderResult> page, @Param("ew") QueryWrapper<Object> ew);
}

View File

@ -1,8 +1,13 @@
package com.njzscloud.dispose.cst.order.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njzscloud.dispose.cst.order.pojo.entity.OrderPaymentRecordEntity;
import com.njzscloud.dispose.cst.order.pojo.result.SearchOrderPaymentRecordResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
@ -11,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface OrderPaymentRecordMapper extends BaseMapper<OrderPaymentRecordEntity> {
List<SearchOrderPaymentRecordResult> listPaymentRecord(@Param("ew") QueryWrapper<Object> ew);
}

View File

@ -0,0 +1,62 @@
package com.njzscloud.dispose.cst.order.pojo.param;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* /
*
* @author ljw
*/
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class SearchOrderParam {
/**
* YuYueShiShiLiShiQuXiao
*/
private String orderType;
/**
* XiaoShouHuiShouDuanBo
*/
private String bizType;
/**
*
*/
private String sn;
/**
* cst_station.station.name
*/
private String stationName;
/**
*
*/
private String contacts;
/**
*
*/
private String phone;
private String transOrgName;
private String projectName;
/**
*
*/
private LocalDateTime orderTimeStart;
private LocalDateTime orderTimeEnd;
/**
*
*/
private String goodsName;
private String keywords;
}

View File

@ -0,0 +1,123 @@
package com.njzscloud.dispose.cst.order.pojo.result;
import com.njzscloud.dispose.cst.customer.constant.SettlementWay;
import com.njzscloud.dispose.cst.order.constant.PaymentStatus;
import com.njzscloud.dispose.finance.constant.ExpenseItemCategory;
import com.njzscloud.dispose.finance.constant.ExpenseStrategy;
import com.njzscloud.dispose.finance.constant.Payer;
import com.njzscloud.dispose.finance.constant.Unit;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
*
*
* @author ljw
*/
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class SearchOrderPaymentRecordResult {
/**
*
*/
private Long id;
/**
* Id
*/
private Long orderId;
/**
* IdQiTa-->ChanPin-->YunFei-->
*/
private Long expenseItemId;
/**
* Id
*/
private Long transId;
/**
* payerPingTai-->ChanFei-->YunShu-->XiaoNa-->CaiGou-->
*/
private Payer payer;
/**
*
*/
private BigDecimal quantity;
/**
* MianFei-->WeiZhiFu-->YiZhiFu-->YiTuiKuan-->退
*/
private PaymentStatus paymentStatus;
/**
*
*/
private LocalDateTime payTime;
/**
* 退
*/
private LocalDateTime refundTime;
/**
*
*/
private BigDecimal totalMoney;
/**
*
*/
private BigDecimal discountMoney;
/**
*
*/
private BigDecimal reviseMoney;
/**
*
*/
private BigDecimal settleMoney;
/**
* YueJie-->YuE-->XianFu-->
*/
private SettlementWay settlementWay;
/**
* Idsys_user.id
*/
private Long payerUserId;
/**
* Idcst_customer.id
*/
private Long payerCustomerId;
/**
* Id
*/
private Long payerMoneyAccountId;
private ExpenseItemCategory expenseItemCategory;
private String goodsId;
private String expenseItemName;
private ExpenseStrategy expenseStrategy;
private Unit unit;
private BigDecimal taxRate;
private BigDecimal unitPrice;
private BigDecimal initialPrice;
private Integer initialQuantity;
private Integer everyQuantity;
}

View File

@ -0,0 +1,526 @@
package com.njzscloud.dispose.cst.order.pojo.result;
import com.njzscloud.dispose.cst.customer.constant.SettlementWay;
import com.njzscloud.dispose.cst.order.constant.*;
import com.njzscloud.dispose.finance.constant.ExpenseItemCategory;
import com.njzscloud.dispose.finance.constant.ExpenseStrategy;
import com.njzscloud.dispose.finance.constant.Unit;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
* /
*
* @author ljw
*/
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class SearchOrderResult {
/**
*
*/
private Long id;
/**
*
*/
private String sn;
/**
* Id
*/
private Long projectId;
/**
* Idsys_user.id
*/
private Long userId;
/**
* Idcst_customer.id
*/
private Long customerId;
/**
*
*/
private String contacts;
/**
*
*/
private String phone;
/**
*
*/
private LocalDateTime orderTime;
/**
* order_categoryHuiShouYuYue-->XiaoShouYuYue-->DuanBoRu-->DuanBoChu-->
*/
private OrderCategory orderCategory;
/**
* order_statusYiYuYue-->JinXingZhong-->YiWanCheng-->YiQuXiao-->
*/
private OrderStatus orderStatus;
/**
*
*/
private LocalDateTime finishTime;
/**
* Idcst_org.id
*/
private Long transOrgId;
/**
* Id
*/
private Long transCustomerId;
/**
*
*/
private LocalDateTime assignmentTransTime;
/**
* Idcst_station.id
*/
private Long stationId;
/**
* cst_station.station.name
*/
private String stationName;
/**
*
*/
private Integer transDistance;
/**
*
*/
private Integer estimatedQuantity;
/**
*
*/
private Integer estimatedTrainNum;
/**
* Id
*/
private Long goodsId;
/**
*
*/
private String goodsName;
/**
* unit
*/
private Unit unit;
/**
*
*/
private String customerMemo;
/**
*
*/
private LocalDateTime createTime;
private List<TransRecode> transRecodes;
private CargoPlace cargoPlace;
private ProjectInfo projectInfo;
@Getter
@Setter
@ToString
@Accessors(chain = true)
public static class PaymentRecord {
private Long id;
private Long orderId;
private Long expenseItemId;
private Long transId;
private BigDecimal quantity;
private PaymentStatus paymentStatus;
private LocalDateTime payTime;
private LocalDateTime refundTime;
private BigDecimal totalMoney;
private BigDecimal discountMoney;
private BigDecimal reviseMoney;
private BigDecimal settleMoney;
private SettlementWay settlementWay;
private Long payerUserId;
private Long payerCustomerId;
private Long payerMoneyAccountId;
private ExpenseItemCategory expenseItemCategory;
private String goodsId;
private String expenseItemName;
private ExpenseStrategy expenseStrategy;
private Unit unit;
private BigDecimal taxRate;
private BigDecimal unitPrice;
private BigDecimal initialPrice;
private Integer initialQuantity;
private Integer everyQuantity;
}
@Getter
@Setter
@ToString
@Accessors(chain = true)
public static class TransRecode {
private Long id;
/**
*
*/
private Integer trainNum;
/**
* Id
*/
private Long orderId;
/**
* trans_statusDaiPaiDan-->DaiJieDan-->YiJieDan-->YunShuZhong-->YiJinChang-->YiChuChang-->YiWanCheng-->YiQuXiao-->
*/
private TransStatus transStatus;
/**
*
*/
private String lane;
/**
*
*/
private LocalDateTime assignmentDriverTime;
/**
*
*/
private LocalDateTime driverConfirmTime;
/**
*
*/
private LocalDateTime transTime;
/**
*
*/
private LocalDateTime finishTime;
/**
* Idsys_user.id
*/
private Long checkerId;
/**
* check_statusWu-->YiKanLiao-->WeiKanLiao-->
*/
private CheckStatus checkStatus;
/**
*
*/
private LocalDateTime checkTime;
/**
*
*/
private List<String> checkPhoto;
/**
*
*/
private String checkerMemo;
/**
* Id
*/
private Long driverId;
/**
* Idcst_customer.id
*/
private Long driverCustomerId;
/**
* Id
*/
private Long driverUserId;
/**
* Idcst_customer.id
*/
private Long truckCustomerId;
/**
*
*/
private Long truckOrgId;
/**
* Id
*/
private Long truckId;
/**
*
*/
private String truckLicensePlate;
/**
*
*/
private Integer historyTareWeight;
/**
*
*/
private Integer roughWeight;
/**
*
*/
private Integer tareWeight;
/**
*
*/
private Integer settleWeight;
/**
*
*/
private Integer transDistance;
/**
*
*/
private String inFrontPhoto;
/**
*
*/
private String inBodyPhoto;
/**
*
*/
private String outFrontPhoto;
/**
*
*/
private String outBodyPhoto;
/**
*
*/
private LocalDateTime inTime;
/**
*
*/
private LocalDateTime outTime;
private List<PaymentRecord> paymentRecord;
}
@Getter
@Setter
@ToString
@Accessors(chain = true)
public static class CargoPlace {
private Long id;
/**
* Id
*/
private Long orderId;
/**
* /ZhuangHuo-->XieHuo-->
*/
private String zx;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
*
*/
private String area;
/**
*
*/
private String town;
/**
*
*/
private String provinceName;
/**
*
*/
private String cityName;
/**
*
*/
private String areaName;
/**
*
*/
private String townName;
/**
*
*/
private String address;
/**
*
*/
private Double lng;
/**
*
*/
private Double lat;
}
@Getter
@Setter
@ToString
@Accessors(chain = true)
public static class ProjectInfo {
private Long id;
/**
*
*/
private String projectName;
/**
*
*/
private String contractPicture;
/**
* Id
*/
private Long transCustomerId;
/**
* Id
*/
private Long transOrgId;
/**
* / Id
*/
private Long fringeCustomerId;
/**
* / Id
*/
private Long fringeOrgId;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
*
*/
private String area;
/**
*
*/
private String town;
/**
*
*/
private String provinceName;
/**
*
*/
private String cityName;
/**
*
*/
private String areaName;
/**
*
*/
private String townName;
/**
*
*/
private String address;
/**
*
*/
private Double lng;
/**
*
*/
private Double lat;
/**
*
*/
private LocalDate contractStartDate;
/**
*
*/
private LocalDate contractEndDate;
}
}

View File

@ -1,5 +1,6 @@
package com.njzscloud.dispose.cst.order.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njzscloud.common.mp.support.PageParam;
@ -7,6 +8,7 @@ import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.dispose.cst.order.mapper.OrderPaymentRecordMapper;
import com.njzscloud.dispose.cst.order.pojo.entity.OrderPaymentRecordEntity;
import com.njzscloud.dispose.cst.order.pojo.param.SearchOrderPaymentRecordParam;
import com.njzscloud.dispose.cst.order.pojo.result.SearchOrderPaymentRecordResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -66,4 +68,8 @@ public class OrderPaymentRecordService extends ServiceImpl<OrderPaymentRecordMap
.eq(param.getPayer() != null, OrderPaymentRecordEntity::getPayer, param.getPayer())
.eq(param.getPaymentStatus() != null, OrderPaymentRecordEntity::getPaymentStatus, param.getPaymentStatus())));
}
public List<SearchOrderPaymentRecordResult> listPaymentRecord(QueryWrapper<Object> ew) {
return baseMapper.listPaymentRecord(ew);
}
}

View File

@ -2,13 +2,21 @@ package com.njzscloud.dispose.cst.order.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njzscloud.common.core.ex.Exceptions;
import com.njzscloud.common.core.utils.GroupUtil;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.common.security.util.SecurityUtil;
import com.njzscloud.common.sn.support.SnUtil;
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
import com.njzscloud.dispose.cst.customer.constant.IdentityCategory;
import com.njzscloud.dispose.cst.customer.constant.SettlementWay;
import com.njzscloud.dispose.cst.customer.mapper.CustomerMapper;
@ -22,6 +30,9 @@ import com.njzscloud.dispose.cst.order.mapper.OrderTransMapper;
import com.njzscloud.dispose.cst.order.pojo.entity.*;
import com.njzscloud.dispose.cst.order.pojo.param.*;
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
import com.njzscloud.dispose.cst.order.pojo.result.SearchOrderResult;
import com.njzscloud.dispose.cst.project.pojo.entity.ProjectEntity;
import com.njzscloud.dispose.cst.project.service.ProjectService;
import com.njzscloud.dispose.cst.station.mapper.StationMapper;
import com.njzscloud.dispose.cst.station.pojo.entity.StationEntity;
import com.njzscloud.dispose.cst.truck.mapper.TruckMapper;
@ -42,6 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static com.njzscloud.dispose.event.SysMittEvent.PURCHASE_ORDER;
@ -68,6 +80,7 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
private final MoneyAccountMapper moneyAccountMapper;
private final StationMapper stationMapper;
private final PaymentRecordHelper paymentRecordHelper;
private final ProjectService projectService;
@Transactional(rollbackFor = Exception.class)
public void add(CreateOrderParam param) {
@ -128,8 +141,102 @@ public class OrderService extends ServiceImpl<OrderMapper, OrderEntity> {
return this.getById(id);
}
public PageResult<OrderEntity> paging(PageParam pageParam, OrderEntity orderEntity) {
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(orderEntity)));
public PageResult<SearchOrderResult> paging(PageParam pageParam, SearchOrderParam searchOrderParam) {
String orderType = searchOrderParam.getOrderType();
String bizType = searchOrderParam.getBizType();
String sn = searchOrderParam.getSn();
String stationName = searchOrderParam.getStationName();
String contacts = searchOrderParam.getContacts();
String phone = searchOrderParam.getPhone();
String transOrgName = searchOrderParam.getTransOrgName();
String projectName = searchOrderParam.getProjectName();
String goodsName = searchOrderParam.getGoodsName();
String keywords = searchOrderParam.getKeywords();
LocalDateTime orderTimeStart = searchOrderParam.getOrderTimeStart();
LocalDateTime orderTimeEnd = searchOrderParam.getOrderTimeEnd();
QueryWrapper<Object> ew = Wrappers.query()
.exists("YuYue".equals(orderType), "SELECT 1 FROM cst_order_trans b WHERE b.order_id = a.id AND b.trans_status = 'DaiPaiDan'")
.exists("ShiShi".equals(orderType), "SELECT 1 FROM cst_order_trans b WHERE b.order_id = a.id AND b.trans_status IN ('YiJieDan','YunShuZhong','YiJinChang','YiChuChang')")
.exists("LiShi".equals(orderType), "SELECT 1 FROM cst_order_trans b WHERE b.order_id = a.id AND b.trans_status = 'YiWanCheng'")
.exists("QuXiao".equals(orderType), "SELECT 1 FROM cst_order_trans b WHERE b.order_id = a.id AND b.trans_status = 'YiQuXiao'")
.in("DuanBo".equals(bizType), "a.order_category", OrderCategory.DuanBoChu, OrderCategory.DuanBoRu)
.eq("HuiShou".equals(bizType), "a.order_category", OrderCategory.HuiShouYuYue)
.eq("XiaoShou".equals(bizType), "a.order_category", OrderCategory.XiaoShouYuYue)
.like(StrUtil.isNotBlank(sn), "a.sn", sn)
.like(StrUtil.isNotBlank(stationName), "a.station_name", stationName)
.like(StrUtil.isNotBlank(contacts), "a.contacts", contacts)
.like(StrUtil.isNotBlank(phone), "a.phone", phone)
.like(StrUtil.isNotBlank(transOrgName), "j.org_name", transOrgName)
.like(StrUtil.isNotBlank(projectName), "f.project_name", projectName)
.like(StrUtil.isNotBlank(goodsName), "a.goods_name", goodsName)
.ge(orderTimeStart != null, "a.order_time", orderTimeStart)
.le(orderTimeEnd != null, "a.order_time", orderTimeEnd)
.and(StrUtil.isNotBlank(keywords), it -> it
.like("a.goods_name", keywords)
.or().like("a.sn", keywords)
.or().like("a.contacts", keywords)
.or().like("a.phone", keywords)
.or().like("j.org_name", keywords)
.or().like("f.project_name", keywords)
);
Page<SearchOrderResult> page = pageParam.toPage();
page.addOrder(OrderItem.desc("a.create_time"));
IPage<SearchOrderResult> resultPage = baseMapper.paging(page, ew);
List<SearchOrderResult> results = resultPage.getRecords();
if (results.isEmpty()) return PageResult.of(resultPage);
List<Long> orderIdList = results.stream().map(SearchOrderResult::getId).toList();
List<Long> projectIdList = results.stream().map(SearchOrderResult::getProjectId).toList();
List<SearchOrderResult.TransRecode> transRecodes = orderTransMapper.selectList(Wrappers.lambdaQuery(OrderTransEntity.class)
.in(OrderTransEntity::getOrderId, orderIdList)
.eq("YuYue".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.DaiPaiDan)
.in("ShiShi".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.YiJieDan, TransStatus.YunShuZhong, TransStatus.YiJinChang, TransStatus.YiChuChang)
.eq("LiShi".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.YiWanCheng)
.eq("QuXiao".equals(orderType), OrderTransEntity::getTransStatus, TransStatus.YiQuXiao)
)
.stream()
.map(it -> BeanUtil.copyProperties(it, SearchOrderResult.TransRecode.class))
.toList();
Map<Long, List<SearchOrderResult.TransRecode>> orderId_transRecode_map = GroupUtil.k_a(transRecodes, SearchOrderResult.TransRecode::getOrderId);
List<SearchOrderResult.CargoPlace> cargoPlaceList = orderCargoPlaceService.list(Wrappers.lambdaQuery(OrderCargoPlaceEntity.class).in(OrderCargoPlaceEntity::getOrderId, orderIdList))
.stream()
.map(it -> BeanUtil.copyProperties(it, SearchOrderResult.CargoPlace.class))
.toList();
Map<Long, SearchOrderResult.CargoPlace> orderId_cargoPlace_map = GroupUtil.k_o(cargoPlaceList, SearchOrderResult.CargoPlace::getOrderId);
Map<Long, SearchOrderResult.ProjectInfo> projectId_project_map;
if (!projectIdList.isEmpty()) {
List<SearchOrderResult.ProjectInfo> projectInfoList = projectService.list(Wrappers.lambdaQuery(ProjectEntity.class).in(BaseEntity::getId, projectIdList))
.stream()
.map(it -> BeanUtil.copyProperties(it, SearchOrderResult.ProjectInfo.class))
.toList();
projectId_project_map = GroupUtil.k_o(projectInfoList, SearchOrderResult.ProjectInfo::getId);
} else {
projectId_project_map = MapUtil.empty();
}
List<SearchOrderResult.PaymentRecord> paymentRecordResultList = orderPaymentRecordService.listPaymentRecord(Wrappers.query().in("a.order_id", orderIdList))
.stream()
.map(it -> BeanUtil.copyProperties(it, SearchOrderResult.PaymentRecord.class))
.toList();
Map<Long, List<SearchOrderResult.PaymentRecord>> transId_paymentRecord_map = GroupUtil.k_a(paymentRecordResultList, SearchOrderResult.PaymentRecord::getTransId);
for (SearchOrderResult result : results) {
Long orderId = result.getId();
Long projectId = result.getProjectId();
List<SearchOrderResult.TransRecode> transRecodeList = orderId_transRecode_map.get(orderId);
for (SearchOrderResult.TransRecode transRecode : transRecodeList) {
Long transRecodeId = transRecode.getId();
transRecode.setPaymentRecord(transId_paymentRecord_map.get(transRecodeId));
}
result.setTransRecodes(transRecodeList);
result.setCargoPlace(orderId_cargoPlace_map.get(orderId));
result.setProjectInfo(projectId_project_map.get(projectId));
}
return PageResult.of(resultPage);
}
@Transactional(rollbackFor = Exception.class)

View File

@ -1,26 +0,0 @@
package com.njzscloud.dispose.goods.contant;
import com.njzscloud.common.core.ienum.DictStr;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* unit
*
*
* @author ljw
*/
@Getter
@RequiredArgsConstructor
public enum Unit implements DictStr {
CHE("che", "车"),
DUN("dun", "吨");
private final String val;
private final String txt;
}

View File

@ -1,9 +1,7 @@
package com.njzscloud.dispose.goods.pojo.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.njzscloud.common.core.ienum.DictItem;
import com.njzscloud.common.core.ienum.DictKey;
import com.njzscloud.common.mp.support.handler.j.DictItemTypeHandler;
import com.njzscloud.dispose.finance.constant.Unit;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@ -57,9 +55,7 @@ public class GoodsEntity {
/**
* unit
*/
@DictKey("unit")
@TableField(typeHandler = DictItemTypeHandler.class)
private DictItem unit;
private Unit unit;
/**
*

View File

@ -1,12 +1,8 @@
package com.njzscloud.dispose.goods.pojo.param;
import com.njzscloud.common.core.ienum.DictItem;
import com.njzscloud.common.core.ienum.DictKey;
import com.njzscloud.dispose.finance.constant.ExpenseItemCategory;
import com.njzscloud.dispose.finance.constant.ExpenseStrategy;
import com.njzscloud.dispose.finance.constant.Payer;
import com.njzscloud.dispose.finance.constant.Unit;
import com.njzscloud.dispose.finance.pojo.entity.ScopeStrategyConfig;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@ -30,11 +26,6 @@ public class AddGoodsParam {
*/
private Long goodsCategoryId;
/**
*
*/
private String sn;
/**
*
*/
@ -53,8 +44,7 @@ public class AddGoodsParam {
/**
* unit
*/
@DictKey("unit")
private DictItem unit;
private Unit unit;
/**
*
@ -102,11 +92,6 @@ public class AddGoodsParam {
*/
private BigDecimal taxRate;
/**
* payer
*/
private Payer payer;
/**
* -->
*/
@ -127,29 +112,10 @@ public class AddGoodsParam {
*/
private Integer everyQuantity;
/**
* {strategy: Wu | ZhiDing | SuoYou,ids:long[]}
*/
private ScopeStrategyConfig userScope;
/**
* {strategy: Wu | ZhiDing | SuoYou,ids:long[]}
*/
private ScopeStrategyConfig stationScope;
/**
* {strategy: Wu | ZhiDing | SuoYou,ids:long[]}
*/
private ScopeStrategyConfig goodsScope;
/**
*
*/
private String memo;
/**
* Id
*/
private Long goodsId;
}
}

View File

@ -2,9 +2,7 @@ package com.njzscloud.dispose.goods.pojo.param;
import com.njzscloud.dispose.finance.constant.ExpenseItemCategory;
import com.njzscloud.dispose.finance.constant.ExpenseStrategy;
import com.njzscloud.dispose.finance.constant.Payer;
import com.njzscloud.dispose.finance.constant.Unit;
import com.njzscloud.dispose.finance.pojo.entity.ScopeStrategyConfig;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@ -108,11 +106,6 @@ public class ModifyGoodsParam {
*/
private BigDecimal taxRate;
/**
* payer
*/
private Payer payer;
/**
* -->
*/
@ -132,22 +125,6 @@ public class ModifyGoodsParam {
*
*/
private Integer everyQuantity;
/**
* {strategy: Wu | ZhiDing | SuoYou,ids:long[]}
*/
private ScopeStrategyConfig userScope;
/**
* {strategy: Wu | ZhiDing | SuoYou,ids:long[]}
*/
private ScopeStrategyConfig stationScope;
/**
* {strategy: Wu | ZhiDing | SuoYou,ids:long[]}
*/
private ScopeStrategyConfig goodsScope;
/**
*
*/

View File

@ -23,6 +23,7 @@ public class SearchGoodsCategoryParam {
* biz_type
*/
private BizType bizType;
private String keywords;
/**
*

View File

@ -1,5 +1,6 @@
package com.njzscloud.dispose.goods.pojo.param;
import com.njzscloud.dispose.goods.contant.BizType;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@ -20,6 +21,7 @@ public class SearchGoodsParam {
* Id
*/
private Long goodsCategoryId;
private BizType bizType;
/**
*
@ -30,6 +32,7 @@ public class SearchGoodsParam {
*
*/
private String goodsName;
private String keywords;
/**
*

View File

@ -1,10 +1,10 @@
package com.njzscloud.dispose.goods.service;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Strings;
import com.njzscloud.common.core.ex.Exceptions;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
@ -35,13 +35,13 @@ public class GoodsCategoryService extends ServiceImpl<GoodsCategoryMapper, Goods
*
*/
public void add(GoodsCategoryEntity goodsCategoryEntity) {
if (goodsCategoryEntity.getBizType() == null) {
throw Exceptions.clierr("业务类型不可为空");
}
if (BizType.HuiShouPin.equals(goodsCategoryEntity.getBizType()) && Strings.isNullOrEmpty(goodsCategoryEntity.getSn())) {
throw Exceptions.clierr("回收品分类码不可为空");
BizType bizType = goodsCategoryEntity.getBizType();
Assert.notNull(bizType, () -> Exceptions.clierr("业务类型不能为空"));
if (bizType == BizType.HuiShouPin) {
String sn = goodsCategoryEntity.getSn();
Assert.notBlank(sn, () -> Exceptions.clierr("国标码不能为空"));
} else {
goodsCategoryEntity.setSn(this.generateSn());
goodsCategoryEntity.setSn(SnUtil.next("GC-SN"));
}
this.save(goodsCategoryEntity);
}
@ -76,29 +76,19 @@ public class GoodsCategoryService extends ServiceImpl<GoodsCategoryMapper, Goods
BizType bizType = searchGoodsCategoryParam.getBizType();
LocalDateTime createTimeStart = searchGoodsCategoryParam.getCreateTimeStart();
LocalDateTime createTimeEnd = searchGoodsCategoryParam.getCreateTimeEnd();
String keywords = searchGoodsCategoryParam.getKeywords();
Page<GoodsCategoryEntity> page = this.page(pageParam.toPage(), Wrappers.lambdaQuery(GoodsCategoryEntity.class)
.like(StrUtil.isNotBlank(categoryName), GoodsCategoryEntity::getCategoryName, categoryName)
.eq(bizType != null, GoodsCategoryEntity::getBizType, bizType)
.ge(createTimeStart != null, GoodsCategoryEntity::getCreateTime, createTimeStart)
.le(createTimeEnd != null, GoodsCategoryEntity::getCreateTime, createTimeEnd)
.and(StrUtil.isNotBlank(keywords), it -> it.like(GoodsCategoryEntity::getCategoryName, keywords)
.or().like(GoodsCategoryEntity::getSn, keywords)
)
);
return PageResult.of(page);
}
/**
*
*
* @return sn
*/
public String generateSn() {
String sn = SnUtil.next("GC-SN");
if (this.exists(Wrappers.<GoodsCategoryEntity>lambdaQuery().eq(GoodsCategoryEntity::getSn, sn)
.eq(GoodsCategoryEntity::getDeleted, Boolean.FALSE))) {
this.generateSn();
}
return sn;
}
}

View File

@ -12,6 +12,7 @@ import com.njzscloud.dispose.finance.pojo.entity.ExpenseItemEntity;
import com.njzscloud.dispose.finance.pojo.param.AddExpenseItemParam;
import com.njzscloud.dispose.finance.pojo.param.ModifyExpenseItemParam;
import com.njzscloud.dispose.finance.service.ExpenseItemService;
import com.njzscloud.dispose.goods.contant.BizType;
import com.njzscloud.dispose.goods.mapper.GoodsMapper;
import com.njzscloud.dispose.goods.pojo.entity.GoodsEntity;
import com.njzscloud.dispose.goods.pojo.param.AddGoodsParam;
@ -42,9 +43,8 @@ public class GoodsService extends ServiceImpl<GoodsMapper, GoodsEntity> {
*/
@Transactional(rollbackFor = Exception.class)
public void add(AddGoodsParam addGoodsParam) {
String sn = SnUtil.next("Goods-SN");
addGoodsParam.setSn(sn);
GoodsEntity goodsEntity = BeanUtil.copyProperties(addGoodsParam, GoodsEntity.class);
GoodsEntity goodsEntity = BeanUtil.copyProperties(addGoodsParam, GoodsEntity.class)
.setSn(SnUtil.next("Goods-SN"));
this.save(goodsEntity);
// 付费项
AddGoodsParam.ExpenseItem expenseItem = addGoodsParam.getExpenseItem();
@ -100,13 +100,24 @@ public class GoodsService extends ServiceImpl<GoodsMapper, GoodsEntity> {
*
*/
public PageResult<SearchGoodsResult> paging(PageParam pageParam, SearchGoodsParam goodsParam) {
String keywords = goodsParam.getKeywords();
BizType bizType = goodsParam.getBizType();
Long goodsCategoryId = goodsParam.getGoodsCategoryId();
String sn = goodsParam.getSn();
String goodsName = goodsParam.getGoodsName();
String specParams = goodsParam.getSpecParams();
Boolean canuse = goodsParam.getCanuse();
return PageResult.of(baseMapper.paging(pageParam.toPage(), Wrappers.query()
.eq("a.deleted", Boolean.FALSE)
.eq(goodsParam.getGoodsCategoryId() != null, "a.goods_category_id", goodsParam.getGoodsCategoryId())
.like(StrUtil.isNotBlank(goodsParam.getSn()), "a.sn", goodsParam.getSn())
.like(StrUtil.isNotBlank(goodsParam.getGoodsName()), "a.goods_name", goodsParam.getGoodsName())
.like(StrUtil.isNotBlank(goodsParam.getSpecParams()), "a.spec_params", goodsParam.getSpecParams())
.eq(goodsParam.getCanuse() != null, "a.canuse", goodsParam.getCanuse())
.eq(bizType != null, "b.biz_type", bizType)
.eq(goodsCategoryId != null, "a.goods_category_id", goodsCategoryId)
.like(StrUtil.isNotBlank(sn), "a.sn", sn)
.like(StrUtil.isNotBlank(goodsName), "a.goods_name", goodsName)
.like(StrUtil.isNotBlank(specParams), "a.spec_params", specParams)
.eq(canuse != null, "a.canuse", canuse)
.and(StrUtil.isNotBlank(keywords), it -> it.like("a.sn", keywords)
.or().like("a.goods_name", keywords)
)
));
}

View File

@ -0,0 +1,40 @@
<?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.njzscloud.dispose.cst.order.mapper.OrderMapper">
<select id="paging" resultType="com.njzscloud.dispose.cst.order.pojo.result.SearchOrderResult">
SELECT a.id,
a.sn,
a.project_id,
a.user_id,
a.customer_id,
a.contacts,
a.phone,
a.order_time,
a.order_category,
a.order_status,
a.finish_time,
a.trans_org_id,
a.trans_customer_id,
a.assignment_trans_time,
a.station_id,
a.station_name,
a.trans_distance,
a.estimated_quantity,
a.estimated_train_num,
a.goods_id,
a.goods_name,
a.unit,
a.customer_memo,
a.create_time
FROM (SELECT a.id
FROM cst_order a
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
) temp
INNER JOIN cst_order a ON a.id = temp.id
</select>
</mapper>

View File

@ -0,0 +1,41 @@
<?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.njzscloud.dispose.cst.order.mapper.OrderPaymentRecordMapper">
<select id="listPaymentRecord"
resultType="com.njzscloud.dispose.cst.order.pojo.result.SearchOrderPaymentRecordResult">
SELECT a.id,
a.order_id,
a.expense_item_id,
a.trans_id,
a.quantity,
a.payment_status,
a.pay_time,
a.refund_time,
a.total_money,
a.discount_money,
a.revise_money,
a.settle_money,
a.settlement_way,
a.payer_user_id,
a.payer_customer_id,
a.payer_money_account_id,
b.expense_item_category,
b.goods_id,
b.expense_item_name,
b.expense_strategy,
b.unit,
b.tax_rate,
b.unit_price,
b.initial_price,
b.initial_quantity,
b.every_quantity
FROM cst_order_payment_record a
INNER JOIN cst_order_expense_items b ON b.id = a.expense_item_id
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
</select>
</mapper>