master
parent
e72876114a
commit
71f2bb4d86
|
|
@ -6,6 +6,7 @@ import com.njzscloud.common.mp.support.PageResult;
|
|||
import com.njzscloud.dispose.cst.org.pojo.entity.OrgEntity;
|
||||
import com.njzscloud.dispose.cst.org.pojo.param.AddOrgParam;
|
||||
import com.njzscloud.dispose.cst.org.pojo.param.OrgPagingParam;
|
||||
import com.njzscloud.dispose.cst.org.pojo.result.OrgResult;
|
||||
import com.njzscloud.dispose.cst.org.service.OrgService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -92,7 +93,7 @@ public class OrgController {
|
|||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/paging")
|
||||
public R<PageResult<OrgEntity>> paging(PageParam pageParam, OrgPagingParam orgPagingParam) {
|
||||
public R<PageResult<OrgResult>> paging(PageParam pageParam, OrgPagingParam orgPagingParam) {
|
||||
return R.success(orgService.paging(pageParam, orgPagingParam));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,28 @@
|
|||
package com.njzscloud.dispose.cst.org.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.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.org.pojo.entity.OrgEntity;
|
||||
import com.njzscloud.dispose.cst.org.pojo.result.OrgResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织信息
|
||||
* @author lzq
|
||||
*/
|
||||
@Mapper
|
||||
public interface OrgMapper extends BaseMapper<OrgEntity> {
|
||||
boolean admitCustomer(@Param("orgId") Long orgId, @Param("customerId") Long customerId);
|
||||
|
||||
boolean quitOrg(@Param("customerId") Long customerId);
|
||||
|
||||
Page<OrgResult> paging(Page<OrgResult> page, @Param("ew") QueryWrapper<OrgResult> ew);
|
||||
|
||||
List<CustomerEntity> queryList(@Param("ew") QueryWrapper<CustomerEntity> ew);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,175 @@
|
|||
package com.njzscloud.dispose.cst.org.pojo.result;
|
||||
|
||||
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.org.constant.OrgCategory;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织信息
|
||||
*
|
||||
* @author ljw
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class OrgResult {
|
||||
|
||||
/**
|
||||
* Id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 主体类型,GeTiHu-->个体户、QiYe-->企业
|
||||
*/
|
||||
private OrgCategory orgCategory;
|
||||
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
*/
|
||||
private String uscc;
|
||||
|
||||
/**
|
||||
* 组织名称
|
||||
*/
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String businessLicense;
|
||||
|
||||
/**
|
||||
* 营业执照有效期
|
||||
*/
|
||||
private LocalDate licenseStartTime;
|
||||
|
||||
/**
|
||||
* 营业执照有效期
|
||||
*/
|
||||
private LocalDate licenseEndTime;
|
||||
|
||||
/**
|
||||
* 法人名称
|
||||
*/
|
||||
private String legalRepresentative;
|
||||
|
||||
/**
|
||||
* 法人身份证号
|
||||
*/
|
||||
private String idcard;
|
||||
|
||||
/**
|
||||
* 法人身份证有效期
|
||||
*/
|
||||
private LocalDate idcardStartTime;
|
||||
|
||||
/**
|
||||
* 法人身份证有效期
|
||||
*/
|
||||
private LocalDate idcardEndTime;
|
||||
|
||||
/**
|
||||
* 法人身份证正面
|
||||
*/
|
||||
private String idcardFront;
|
||||
|
||||
/**
|
||||
* 法人身份证反面
|
||||
*/
|
||||
private String idcardBack;
|
||||
|
||||
/**
|
||||
* 省;代码
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* 创建人 Id; sys_user.id
|
||||
*/
|
||||
private Long creatorId;
|
||||
|
||||
/**
|
||||
* 修改人 Id; sys_user.id
|
||||
*/
|
||||
private Long modifierId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime modifyTime;
|
||||
|
||||
/**
|
||||
* 是否删除; 0-->未删除、1-->已删除
|
||||
*/
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 客户信息
|
||||
*/
|
||||
private List<CustomerEntity> customerList;
|
||||
|
||||
}
|
||||
|
|
@ -3,18 +3,21 @@ package com.njzscloud.dispose.cst.org.service;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
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.extension.service.IService;
|
||||
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.PageResult;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.org.constant.ApplyStatus;
|
||||
import com.njzscloud.dispose.cst.org.mapper.OrgMapper;
|
||||
import com.njzscloud.dispose.cst.org.pojo.entity.OrgApplyEntity;
|
||||
import com.njzscloud.dispose.cst.org.pojo.entity.OrgEntity;
|
||||
import com.njzscloud.dispose.cst.org.pojo.param.AddOrgParam;
|
||||
import com.njzscloud.dispose.cst.org.pojo.param.OrgPagingParam;
|
||||
import com.njzscloud.dispose.cst.org.pojo.result.OrgResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -22,9 +25,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 组织信息
|
||||
*
|
||||
* @author lzq
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
|
|
@ -74,15 +82,32 @@ public class OrgService extends ServiceImpl<OrgMapper, OrgEntity> implements ISe
|
|||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<OrgEntity> paging(PageParam pageParam, OrgPagingParam orgPagingParam) {
|
||||
public PageResult<OrgResult> paging(PageParam pageParam, OrgPagingParam orgPagingParam) {
|
||||
String keywords = orgPagingParam.getKeywords();
|
||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<OrgEntity>lambdaQuery()
|
||||
QueryWrapper<OrgResult> ew = Wrappers.<OrgResult>query()
|
||||
.eq("deleted", Boolean.FALSE)
|
||||
.and(StrUtil.isNotBlank(keywords), it ->
|
||||
it.like(OrgEntity::getUscc, keywords)
|
||||
.or().like(OrgEntity::getOrgName, keywords)
|
||||
.or().like(OrgEntity::getLegalRepresentative, keywords)
|
||||
)
|
||||
));
|
||||
it.like("uscc", keywords)
|
||||
.or().like("org_name", keywords)
|
||||
.or().like("legal_representative", keywords)
|
||||
);
|
||||
PageResult<OrgResult> page = PageResult.of(baseMapper.paging(pageParam.toPage(), ew));
|
||||
List<OrgResult> records = page.getRecords();
|
||||
if (records.isEmpty()) {
|
||||
return page;
|
||||
}
|
||||
List<Long> orgIds = records.stream()
|
||||
.map(OrgResult::getId)
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
Map<Long, List<CustomerEntity>> orgMap = baseMapper.queryList(Wrappers.<CustomerEntity>query()
|
||||
.eq("deleted", Boolean.FALSE)
|
||||
.eq("manager", Boolean.TRUE)
|
||||
.in("org_id", orgIds))
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(CustomerEntity::getOrgId));
|
||||
records.forEach(org -> org.setCustomerList(orgMap.get(org.getId())));
|
||||
return page;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
<?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.org.mapper.OrgMapper">
|
||||
<resultMap id="BaseResultMap" autoMapping="true" type="com.njzscloud.dispose.cst.org.pojo.result.OrgResult">
|
||||
</resultMap>
|
||||
<resultMap id="CustomerResultMap" autoMapping="true" type="com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity">
|
||||
</resultMap>
|
||||
<update id="admitCustomer">
|
||||
UPDATE cst_customer
|
||||
SET org_id = #{orgId}
|
||||
|
|
@ -15,4 +19,61 @@
|
|||
AND org_id IS NOT NULL
|
||||
</update>
|
||||
|
||||
<select id="paging" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
id,
|
||||
org_category,
|
||||
uscc,
|
||||
org_name,
|
||||
business_license,
|
||||
license_start_time,
|
||||
license_end_time,
|
||||
legal_representative,
|
||||
idcard,
|
||||
idcard_start_time,
|
||||
idcard_end_time,
|
||||
idcard_front,
|
||||
idcard_back,
|
||||
province,
|
||||
city,
|
||||
area,
|
||||
town,
|
||||
province_name,
|
||||
city_name,
|
||||
area_name,
|
||||
town_name,
|
||||
address,
|
||||
lng,
|
||||
lat,
|
||||
creator_id,
|
||||
modifier_id,
|
||||
create_time,
|
||||
modify_time,
|
||||
deleted
|
||||
FROM cst_org
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryList" resultMap="CustomerResultMap">
|
||||
SELECT
|
||||
id,
|
||||
user_id,
|
||||
identity_category,
|
||||
org_id,
|
||||
customer_name,
|
||||
phone,
|
||||
settlement_way,
|
||||
manager,
|
||||
creator_id,
|
||||
modifier_id,
|
||||
create_time,
|
||||
modify_time,
|
||||
deleted
|
||||
from cst_customer
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue