Compare commits
2 Commits
6a1a56dcb3
...
97584f417e
| Author | SHA1 | Date |
|---|---|---|
|
|
97584f417e | |
|
|
7b9859411a |
|
|
@ -4,6 +4,8 @@ import com.njzscloud.common.core.utils.R;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
||||||
|
import com.njzscloud.dispose.cst.order.pojo.param.OrderTransQueryParam;
|
||||||
|
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
||||||
import com.njzscloud.dispose.cst.order.service.OrderTransService;
|
import com.njzscloud.dispose.cst.order.service.OrderTransService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -63,9 +65,7 @@ public class OrderTransController {
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*/
|
*/
|
||||||
@GetMapping("/paging")
|
@GetMapping("/paging")
|
||||||
public R<PageResult<OrderTransEntity>> paging(PageParam pageParam, OrderTransEntity orderTransEntity) {
|
public R<PageResult<OrderTransResult>> paging(PageParam pageParam, OrderTransQueryParam queryParam) {
|
||||||
return R.success(orderTransService.paging(pageParam, orderTransEntity));
|
return R.success(orderTransService.paging(pageParam, queryParam));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
package com.njzscloud.dispose.cst.order.mapper;
|
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.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
||||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 运输信息
|
* 运输信息
|
||||||
|
|
@ -15,6 +19,6 @@ public interface OrderTransMapper extends BaseMapper<OrderTransEntity> {
|
||||||
|
|
||||||
OrderTransResult getById(Long id);
|
OrderTransResult getById(Long id);
|
||||||
|
|
||||||
|
IPage<OrderTransResult> paging(Page<Object> page, @Param("ew") QueryWrapper<?> ew);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运输分页查询参数
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class OrderTransQueryParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单时间 - 开始
|
||||||
|
*/
|
||||||
|
private LocalDateTime orderTimeStart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单时间 - 结束
|
||||||
|
*/
|
||||||
|
private LocalDateTime orderTimeEnd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运输公司(组织Id)
|
||||||
|
*/
|
||||||
|
private Long transOrgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌
|
||||||
|
*/
|
||||||
|
private String truckLicensePlate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号(sn)
|
||||||
|
*/
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车次
|
||||||
|
*/
|
||||||
|
private Integer trainNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点名称
|
||||||
|
*/
|
||||||
|
private String stationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态
|
||||||
|
*/
|
||||||
|
private String orderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运输状态
|
||||||
|
*/
|
||||||
|
private String transStatus;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,11 +1,21 @@
|
||||||
package com.njzscloud.dispose.cst.order.service;
|
package com.njzscloud.dispose.cst.order.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njzscloud.common.core.ex.Exceptions;
|
||||||
import com.njzscloud.common.mp.support.PageParam;
|
import com.njzscloud.common.mp.support.PageParam;
|
||||||
import com.njzscloud.common.mp.support.PageResult;
|
import com.njzscloud.common.mp.support.PageResult;
|
||||||
|
import com.njzscloud.common.security.util.SecurityUtil;
|
||||||
|
import com.njzscloud.dispose.cst.customer.constant.IdentityCategory;
|
||||||
|
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||||
|
import com.njzscloud.dispose.cst.customer.service.CustomerService;
|
||||||
import com.njzscloud.dispose.cst.order.mapper.OrderTransMapper;
|
import com.njzscloud.dispose.cst.order.mapper.OrderTransMapper;
|
||||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
||||||
|
import com.njzscloud.dispose.cst.order.pojo.param.OrderTransQueryParam;
|
||||||
|
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
||||||
|
import com.njzscloud.dispose.sys.auth.pojo.result.MyResult;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -23,6 +33,8 @@ import java.util.List;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class OrderTransService extends ServiceImpl<OrderTransMapper, OrderTransEntity> {
|
public class OrderTransService extends ServiceImpl<OrderTransMapper, OrderTransEntity> {
|
||||||
|
|
||||||
|
private final CustomerService customerService;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void add(OrderTransEntity orderTransEntity) {
|
public void add(OrderTransEntity orderTransEntity) {
|
||||||
this.save(orderTransEntity);
|
this.save(orderTransEntity);
|
||||||
|
|
@ -42,9 +54,46 @@ public class OrderTransService extends ServiceImpl<OrderTransMapper, OrderTransE
|
||||||
return this.getById(id);
|
return this.getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageResult<OrderTransEntity> paging(PageParam pageParam, OrderTransEntity orderTransEntity) {
|
/**
|
||||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(orderTransEntity)));
|
* 分页查询,返回联表结果
|
||||||
|
*/
|
||||||
|
public PageResult<OrderTransResult> paging(PageParam pageParam, OrderTransQueryParam param) {
|
||||||
|
QueryWrapper<OrderTransResult> ew = Wrappers.<OrderTransResult>query()
|
||||||
|
.eq("cot.deleted", Boolean.FALSE);
|
||||||
|
if (param != null) {
|
||||||
|
ew.ge(param.getOrderTimeStart() != null, "co.order_time", param.getOrderTimeStart())
|
||||||
|
.le(param.getOrderTimeEnd() != null, "co.order_time", param.getOrderTimeEnd())
|
||||||
|
.eq(param.getTransOrgId() != null, "co.trans_org_id", param.getTransOrgId())
|
||||||
|
.like(StrUtil.isNotBlank(param.getTruckLicensePlate()), "cot.truck_license_plate", param.getTruckLicensePlate())
|
||||||
|
.like(StrUtil.isNotBlank(param.getSn()), "co.sn", param.getSn())
|
||||||
|
.eq(param.getTrainNum() != null, "cot.train_num", param.getTrainNum())
|
||||||
|
.like(StrUtil.isNotBlank(param.getStationName()), "co.station_name", param.getStationName())
|
||||||
|
.eq(StrUtil.isNotBlank(param.getOrderStatus()), "co.order_status", param.getOrderStatus())
|
||||||
|
.eq(StrUtil.isNotBlank(param.getTransStatus()), "cot.trans_status", param.getTransStatus());
|
||||||
|
}
|
||||||
|
// 管理员查看全部,非管理员按身份过滤
|
||||||
|
if (!SecurityUtil.isAdmin()) {
|
||||||
|
MyResult userDetail = SecurityUtil.loginUser();
|
||||||
|
Long currentCustomerId = userDetail.getCurrentCustomerId();
|
||||||
|
if (currentCustomerId != null) {
|
||||||
|
CustomerEntity customer = customerService.getById(currentCustomerId);
|
||||||
|
if (customer != null && customer.getIdentityCategory() != null) {
|
||||||
|
ew.eq(IdentityCategory.ChanFei.equals(customer.getIdentityCategory())
|
||||||
|
|| IdentityCategory.CaiGou.equals(customer.getIdentityCategory()),
|
||||||
|
"co.customer_id", currentCustomerId);
|
||||||
|
ew.eq(IdentityCategory.YunShu.equals(customer.getIdentityCategory()),
|
||||||
|
"co.trans_customer_id", currentCustomerId);
|
||||||
|
ew.eq(IdentityCategory.SiJi.equals(customer.getIdentityCategory()),
|
||||||
|
"cot.driver_customer_id", currentCustomerId);
|
||||||
|
} else {
|
||||||
|
throw Exceptions.clierr("客户信息或客户身份类型不存在");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw Exceptions.clierr("当前登录人无客户信息");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return PageResult.of(baseMapper.paging(pageParam.toPage(), ew));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
cot
|
cot.id AS id,
|
||||||
.
|
|
||||||
id
|
|
||||||
AS id,
|
|
||||||
cot.train_num AS train_num,
|
cot.train_num AS train_num,
|
||||||
cot.order_id AS order_id,
|
cot.order_id AS order_id,
|
||||||
cot.trans_status AS trans_status,
|
cot.trans_status AS trans_status,
|
||||||
|
|
@ -110,6 +107,14 @@
|
||||||
left join cst_order co on co.id = cot.order_id
|
left join cst_order co on co.id = cot.order_id
|
||||||
WHERE cot.id = #{id}
|
WHERE cot.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="paging" resultMap="BaseResultMap">
|
||||||
|
SELECT
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
FROM cst_order_trans cot
|
||||||
|
left join cst_order co on co.id = cot.order_id
|
||||||
|
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue