master
parent
2875291282
commit
08cfaa9665
|
|
@ -67,3 +67,4 @@ public class OrderController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,4 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
public interface OrderMapper extends BaseMapper<OrderEntity> {
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -132,3 +132,4 @@ public class OrderEntity extends BaseEntity {
|
|||
private String customerMemo;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,3 +24,4 @@ public interface OrderService extends IService<OrderEntity> {
|
|||
PageResult<OrderEntity> paging(PageParam pageParam, OrderEntity orderEntity);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,3 +52,4 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,3 +67,4 @@ public class OrderCargoPlaceController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,4 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
public interface OrderCargoPlaceMapper extends BaseMapper<OrderCargoPlaceEntity> {
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -84,3 +84,4 @@ public class OrderCargoPlaceEntity extends BaseEntity {
|
|||
private Double lat;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,3 +24,4 @@ public interface OrderCargoPlaceService extends IService<OrderCargoPlaceEntity>
|
|||
PageResult<OrderCargoPlaceEntity> paging(PageParam pageParam, OrderCargoPlaceEntity orderCargoPlaceEntity);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,3 +52,4 @@ public class OrderCargoPlaceServiceImpl extends ServiceImpl<OrderCargoPlaceMappe
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,3 +67,4 @@ public class OrderExpenseDetailController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,4 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
public interface OrderExpenseDetailMapper extends BaseMapper<OrderExpenseDetailEntity> {
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -96,3 +96,4 @@ public class OrderExpenseDetailEntity extends BaseEntity {
|
|||
private Long payerMoneyAccount;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,3 +24,4 @@ public interface OrderExpenseDetailService extends IService<OrderExpenseDetailEn
|
|||
PageResult<OrderExpenseDetailEntity> paging(PageParam pageParam, OrderExpenseDetailEntity orderExpenseDetailEntity);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,3 +52,4 @@ public class OrderExpenseDetailServiceImpl extends ServiceImpl<OrderExpenseDetai
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,3 +67,4 @@ public class OrderExpenseItemsController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,4 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
public interface OrderExpenseItemsMapper extends BaseMapper<OrderExpenseItemsEntity> {
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -100,3 +100,4 @@ public class OrderExpenseItemsEntity extends BaseEntity {
|
|||
private String goodsScope;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,3 +24,4 @@ public interface OrderExpenseItemsService extends IService<OrderExpenseItemsEnti
|
|||
PageResult<OrderExpenseItemsEntity> paging(PageParam pageParam, OrderExpenseItemsEntity orderExpenseItemsEntity);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,3 +52,4 @@ public class OrderExpenseItemsServiceImpl extends ServiceImpl<OrderExpenseItemsM
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -67,3 +67,4 @@ public class OrderTransController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,4 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
public interface OrderTransMapper extends BaseMapper<OrderTransEntity> {
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -181,3 +181,4 @@ public class OrderTransEntity extends BaseEntity {
|
|||
private LocalDateTime outTime;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,3 +24,4 @@ public interface OrderTransService extends IService<OrderTransEntity> {
|
|||
PageResult<OrderTransEntity> paging(PageParam pageParam, OrderTransEntity orderTransEntity);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,3 +52,4 @@ public class OrderTransServiceImpl extends ServiceImpl<OrderTransMapper, OrderTr
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 项目信息
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Slf4j
|
||||
|
|
|
|||
|
|
@ -1,15 +1,21 @@
|
|||
package com.njzscloud.dispose.cst.project.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njzscloud.dispose.cst.project.pojo.entity.ProjectEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 项目信息
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectMapper extends BaseMapper<ProjectEntity> {
|
||||
|
||||
Page<ProjectEntity> paging(Page<ProjectEntity> page, @Param("ew") QueryWrapper<ProjectEntity> ew);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package com.njzscloud.dispose.cst.project.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.org.pojo.entity.OrgEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
|
@ -35,21 +38,48 @@ public class ProjectEntity extends BaseEntity {
|
|||
*/
|
||||
private Long transCustomerId;
|
||||
|
||||
/**
|
||||
* 运输方客户信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private CustomerEntity transCustomerInfo;
|
||||
|
||||
/**
|
||||
* 运输方组织 Id
|
||||
*/
|
||||
private Long transOrgId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String transOrgName;
|
||||
|
||||
/**
|
||||
* 运输方组织信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private OrgEntity transOrgInfo;
|
||||
|
||||
/**
|
||||
* 产废方/购买方客户 Id
|
||||
*/
|
||||
private Long fringeCustomerId;
|
||||
|
||||
/**
|
||||
* 产废方/购买方客户信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private CustomerEntity fringeCustomerInfo;
|
||||
|
||||
/**
|
||||
* 产废方/购买方组织 Id
|
||||
*/
|
||||
private Long fringeOrgId;
|
||||
|
||||
/**
|
||||
* 产废方/购买方组织信息
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private OrgEntity fringeOrgInfo;
|
||||
|
||||
/**
|
||||
* 省;代码
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
package com.njzscloud.dispose.cst.project.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.mp.support.PageParam;
|
||||
import com.njzscloud.common.mp.support.PageResult;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.customer.service.CustomerService;
|
||||
import com.njzscloud.dispose.cst.org.pojo.entity.OrgEntity;
|
||||
import com.njzscloud.dispose.cst.org.service.OrgService;
|
||||
import com.njzscloud.dispose.cst.project.mapper.ProjectMapper;
|
||||
import com.njzscloud.dispose.cst.project.pojo.entity.ProjectEntity;
|
||||
import com.njzscloud.dispose.cst.project.service.ProjectService;
|
||||
|
|
@ -12,10 +20,12 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 项目信息
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Slf4j
|
||||
|
|
@ -23,6 +33,9 @@ import java.util.List;
|
|||
@RequiredArgsConstructor
|
||||
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity> implements ProjectService {
|
||||
|
||||
private final CustomerService customerService;
|
||||
private final OrgService orgService;
|
||||
|
||||
@Override
|
||||
public void add(ProjectEntity projectEntity) {
|
||||
this.save(projectEntity);
|
||||
|
|
@ -41,12 +54,73 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
|
||||
@Override
|
||||
public ProjectEntity detail(Long id) {
|
||||
return this.getById(id);
|
||||
ProjectEntity detail = this.getById(id);
|
||||
if (detail != null) {
|
||||
fillCustomerAndOrgInfo(Collections.singletonList(detail));
|
||||
}
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProjectEntity> paging(PageParam pageParam, ProjectEntity projectEntity) {
|
||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<ProjectEntity>query(projectEntity)));
|
||||
QueryWrapper<ProjectEntity> ew = Wrappers.<ProjectEntity>query().eq("p.deleted", 0);
|
||||
if (projectEntity != null) {
|
||||
String projectName = projectEntity.getProjectName();
|
||||
String transOrgName = projectEntity.getTransOrgName();
|
||||
ew.like(projectName != null, "p.project_name", projectName).like(transOrgName != null, "o.org_name", transOrgName);
|
||||
}
|
||||
|
||||
// 直接调用自定义分页 SQL(项目名称 & 运输公司名称均为模糊查询)
|
||||
Page<ProjectEntity> page = pageParam.toPage();
|
||||
page.addOrder(OrderItem.desc("p.create_time"), OrderItem.desc("p.id"));
|
||||
Page<ProjectEntity> paging = baseMapper.paging(page, ew);
|
||||
|
||||
if (CollUtil.isNotEmpty(paging.getRecords())) {
|
||||
fillCustomerAndOrgInfo(paging.getRecords());
|
||||
}
|
||||
|
||||
return PageResult.of(paging);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量填充运输方 / 产废方(购买方)的客户与组织信息
|
||||
*/
|
||||
private void fillCustomerAndOrgInfo(List<ProjectEntity> records) {
|
||||
// 收集所有需要的 ID
|
||||
Set<Long> transCustomerIds = records.stream().map(ProjectEntity::getTransCustomerId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||
Set<Long> fringeCustomerIds = records.stream().map(ProjectEntity::getFringeCustomerId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||
Set<Long> transOrgIds = records.stream().map(ProjectEntity::getTransOrgId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||
Set<Long> fringeOrgIds = records.stream().map(ProjectEntity::getFringeOrgId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||
|
||||
Set<Long> allCustomerIds = new HashSet<>(transCustomerIds);
|
||||
allCustomerIds.addAll(fringeCustomerIds);
|
||||
Set<Long> allOrgIds = new HashSet<>(transOrgIds);
|
||||
allOrgIds.addAll(fringeOrgIds);
|
||||
|
||||
Map<Long, CustomerEntity> customerMap = Collections.emptyMap();
|
||||
Map<Long, OrgEntity> orgMap = Collections.emptyMap();
|
||||
|
||||
if (!allCustomerIds.isEmpty()) {
|
||||
customerMap = customerService.listByIds(allCustomerIds).stream().collect(Collectors.toMap(CustomerEntity::getId, it -> it));
|
||||
}
|
||||
if (!allOrgIds.isEmpty()) {
|
||||
orgMap = orgService.listByIds(allOrgIds).stream().collect(Collectors.toMap(OrgEntity::getId, it -> it));
|
||||
}
|
||||
|
||||
for (ProjectEntity item : records) {
|
||||
if (item.getTransCustomerId() != null) {
|
||||
item.setTransCustomerInfo(customerMap.get(item.getTransCustomerId()));
|
||||
}
|
||||
if (item.getFringeCustomerId() != null) {
|
||||
item.setFringeCustomerInfo(customerMap.get(item.getFringeCustomerId()));
|
||||
}
|
||||
if (item.getTransOrgId() != null) {
|
||||
item.setTransOrgInfo(orgMap.get(item.getTransOrgId()));
|
||||
}
|
||||
if (item.getFringeOrgId() != null) {
|
||||
item.setFringeOrgInfo(orgMap.get(item.getFringeOrgId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,3 +70,4 @@
|
|||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,3 +32,4 @@
|
|||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,3 +28,4 @@
|
|||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,3 +34,4 @@
|
|||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,3 +56,4 @@
|
|||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,16 +31,26 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, project_name, contract_picture, trans_customer_id, trans_org_id,
|
||||
fringe_customer_id, fringe_org_id, province, city, area, town,
|
||||
province_name, city_name, area_name, town_name, address, lng, lat,
|
||||
contract_start_date, contract_end_date, creator_id, modifier_id, create_time, modify_time, deleted
|
||||
p.id, p.project_name, p.contract_picture, p.trans_customer_id, p.trans_org_id,
|
||||
p.fringe_customer_id, p.fringe_org_id, p.province, p.city, p.area, p.town,
|
||||
p.province_name, p.city_name, p.area_name, p.town_name, p.address, p.lng, p.lat,
|
||||
p.contract_start_date, p.contract_end_date, p.creator_id, p.modifier_id, p.create_time, p.modify_time, p.deleted
|
||||
</sql>
|
||||
|
||||
<select id="getById" resultMap="ProjectResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM cst_project
|
||||
WHERE id = #{id}
|
||||
FROM cst_project p
|
||||
WHERE p.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 分页查询,支持项目名称模糊查询与运输公司名称模糊查询(直接表关联写法) -->
|
||||
<select id="paging" resultMap="ProjectResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM cst_project p
|
||||
LEFT JOIN cst_org o ON o.id = p.trans_org_id AND o.deleted = 0
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue