客户管理、换行符
parent
b9858c758e
commit
211b60e526
|
|
@ -7,6 +7,8 @@ import com.njzscloud.common.mp.support.PageResult;
|
|||
import com.njzscloud.common.security.util.SecurityUtil;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.param.AddCustomerParam;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.param.SearchCustomerParam;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.result.SearchCustomerResult;
|
||||
import com.njzscloud.dispose.cst.customer.service.CustomerService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -64,7 +66,7 @@ public class CustomerController {
|
|||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public R<CustomerEntity> detail(@RequestParam Long id) {
|
||||
public R<SearchCustomerResult> detail(@RequestParam Long id) {
|
||||
return R.success(customerService.detail(id));
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +74,7 @@ public class CustomerController {
|
|||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/paging")
|
||||
public R<PageResult<CustomerEntity>> paging(PageParam pageParam, CustomerEntity customerEntity) {
|
||||
return R.success(customerService.paging(pageParam, customerEntity));
|
||||
public R<PageResult<SearchCustomerResult>> paging(PageParam pageParam, SearchCustomerParam searchCustomerParam) {
|
||||
return R.success(customerService.paging(pageParam, searchCustomerParam));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,20 @@
|
|||
package com.njzscloud.dispose.cst.customer.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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.result.SearchCustomerResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 客户信息
|
||||
*/
|
||||
@Mapper
|
||||
public interface CustomerMapper extends BaseMapper<CustomerEntity> {
|
||||
IPage<SearchCustomerResult> paging(Page<Object> page, @Param("ew") QueryWrapper<?> ew);
|
||||
|
||||
SearchCustomerResult detail(@Param("id") Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.njzscloud.dispose.cst.customer.pojo.param;
|
||||
|
||||
import com.njzscloud.dispose.cst.customer.constant.IdentityCategory;
|
||||
import com.njzscloud.dispose.cst.customer.constant.SettlementWay;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 客户信息
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class SearchCustomerParam {
|
||||
|
||||
/**
|
||||
* 身份类型;多个身份多条数据,PingTai-->平台、ChanFei-->产废方、QingYun-->清运方、XiaoNa-->消纳方、CaiGou-->采购方
|
||||
*/
|
||||
private IdentityCategory identityCategory;
|
||||
|
||||
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 结算方式,YueJie-->月结、YuE-->余额、XianFu-->现付
|
||||
*/
|
||||
private SettlementWay settlementWay;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,220 @@
|
|||
package com.njzscloud.dispose.cst.customer.pojo.result;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.njzscloud.dispose.cst.customer.constant.IdentityCategory;
|
||||
import com.njzscloud.dispose.cst.customer.constant.SettlementWay;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 客户信息
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class SearchCustomerResult {
|
||||
|
||||
/**
|
||||
* Id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户 Id;一个用户可以有多个身份
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 身份类型;多个身份多条数据,PingTai-->平台、ChanFei-->产废方、QingYun-->清运方、XiaoNa-->消纳方、CaiGou-->采购方
|
||||
*/
|
||||
private IdentityCategory identityCategory;
|
||||
|
||||
/**
|
||||
* 组织信息 Id;cst_org.id
|
||||
*/
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 客户姓名
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 客户联系电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 结算方式,YueJie-->月结、YuE-->余额、XianFu-->现付
|
||||
*/
|
||||
private SettlementWay settlementWay;
|
||||
|
||||
/**
|
||||
* 是否管理员;是否为当前的组织管理员,0-->否、1-->是
|
||||
*/
|
||||
private Boolean manager;
|
||||
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
|
||||
/**
|
||||
* 微信 openid
|
||||
*/
|
||||
private String wechatOpenid;
|
||||
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
private LocalDateTime regdate;
|
||||
|
||||
/**
|
||||
* 允许登录的客户端;位权, 0-->PC、1-->移动端、2-->小程序
|
||||
*/
|
||||
private Integer clientCode;
|
||||
|
||||
/**
|
||||
* 是否禁用; 0-->启用、1-->禁用
|
||||
*/
|
||||
private Boolean disabled;
|
||||
|
||||
|
||||
/**
|
||||
* 主体类型,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;
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.njzscloud.dispose.cst.customer.service;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
|
@ -9,9 +10,12 @@ 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.constant.IdentityCategory;
|
||||
import com.njzscloud.dispose.cst.customer.constant.SettlementWay;
|
||||
import com.njzscloud.dispose.cst.customer.mapper.CustomerMapper;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.param.AddCustomerParam;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.param.SearchCustomerParam;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.result.SearchCustomerResult;
|
||||
import com.njzscloud.dispose.cst.org.pojo.param.AddOrgParam;
|
||||
import com.njzscloud.dispose.cst.org.service.OrgService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -81,14 +85,30 @@ public class CustomerService extends ServiceImpl<CustomerMapper, CustomerEntity>
|
|||
/**
|
||||
* 详情
|
||||
*/
|
||||
public CustomerEntity detail(Long id) {
|
||||
return this.getById(id);
|
||||
public SearchCustomerResult detail(Long id) {
|
||||
return baseMapper.detail(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult<CustomerEntity> paging(PageParam pageParam, CustomerEntity customerEntity) {
|
||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<CustomerEntity>query(customerEntity)));
|
||||
public PageResult<SearchCustomerResult> paging(PageParam pageParam, SearchCustomerParam searchCustomerParam) {
|
||||
String keywords = searchCustomerParam.getKeywords();
|
||||
SettlementWay settlementWay = searchCustomerParam.getSettlementWay();
|
||||
IdentityCategory identityCategory = searchCustomerParam.getIdentityCategory();
|
||||
return PageResult.of(baseMapper.paging(pageParam.toPage(), Wrappers.query()
|
||||
.eq("a.deleted", 0)
|
||||
.and(StrUtil.isNotBlank(keywords), it -> it
|
||||
.like("a.customer_name", keywords)
|
||||
.or().like("a.phone", keywords)
|
||||
.or().like("b.nickname", keywords)
|
||||
.or().like("c.username", keywords)
|
||||
.or().like("c.wechat_openid", keywords)
|
||||
.or().like("d.org_name", keywords)
|
||||
.or().like("d.legal_representative", keywords)
|
||||
)
|
||||
.eq(settlementWay != null, "a.settlement_way", settlementWay)
|
||||
.eq(identityCategory != null, "a.identity_category", identityCategory)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package com.njzscloud.dispose.cst.driver.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.njzscloud.dispose.common.pojo.entity.BaseEntity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,65 @@
|
|||
<?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.customer.mapper.CustomerMapper">
|
||||
|
||||
<sql id="searchCustomer">
|
||||
SELECT a.id,
|
||||
a.user_id,
|
||||
a.identity_category,
|
||||
a.org_id,
|
||||
a.customer_name,
|
||||
a.phone,
|
||||
a.settlement_way,
|
||||
a.manager,
|
||||
b.nickname,
|
||||
b.avatar,
|
||||
c.id account_id,
|
||||
c.username,
|
||||
c.wechat_openid,
|
||||
c.regdate,
|
||||
c.client_code,
|
||||
d.org_category,
|
||||
d.uscc,
|
||||
d.org_name,
|
||||
d.business_license,
|
||||
d.license_start_time,
|
||||
d.license_end_time,
|
||||
d.legal_representative,
|
||||
d.idcard,
|
||||
d.idcard_start_time,
|
||||
d.idcard_end_time,
|
||||
d.idcard_front,
|
||||
d.idcard_back,
|
||||
d.province,
|
||||
d.city,
|
||||
d.area,
|
||||
d.town,
|
||||
d.province_name,
|
||||
d.city_name,
|
||||
d.area_name,
|
||||
d.town_name,
|
||||
d.address,
|
||||
d.lng,
|
||||
d.lat
|
||||
FROM cst_customer a
|
||||
INNER JOIN sys_user b ON b.id = a.user_id AND b.deleted = 0
|
||||
INNER JOIN sys_user_account c ON c.user_id = b.id AND b.deleted = 0
|
||||
LEFT JOIN cst_org d ON c.id = a.org_id AND d.deleted = 0
|
||||
</sql>
|
||||
|
||||
<resultMap id="searchCustomerResultMap" autoMapping="true" type="com.njzscloud.dispose.cst.customer.pojo.result.SearchCustomerResult">
|
||||
</resultMap>
|
||||
|
||||
<select id="paging" resultMap="searchCustomerResultMap">
|
||||
<include refid="searchCustomer"/>
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="detail" resultMap="searchCustomerResultMap">
|
||||
<include refid="searchCustomer"/>
|
||||
WHERE a.deleted = 0
|
||||
AND a.id = ${id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue