Commit 1a17bba5 by ThomasAdv

客户旅程查询接口实现

1 parent 1b0f26a8
Showing 22 changed files with 722 additions and 29 deletions
......@@ -29,5 +29,5 @@ public interface CustomerSopJourneyFeignClient {
@Operation(description = "获取客户旅程详情")
@GetMapping("/detail")
Result<CustomerSopJourneyDetailDTO> detail(@RequestParam("orgId") String orgId, @RequestParam("customerPhone") String customerPhone);
Result<CustomerSopJourneyDetailDTO> detail(@RequestParam("orgId") String orgId, @RequestParam("sopJourneyId") String sopJourneyId, @RequestParam("oneId") String oneId);
}
......@@ -69,13 +69,7 @@ public class Customer implements Serializable {
private String customerEmail;
/**
* 证件类型
*/
@Column(name = "id_type")
private String idType;
/**
* 证件号码
* 身份证号
*/
@Column(name = "id_number")
private String idNumber;
......@@ -106,6 +100,36 @@ public class Customer implements Serializable {
private String address;
/**
* 客户企业内部标识
*/
@Column(name = "org_user_id")
private String orgUserId;
/**
* 客户微信号
*/
@Column(name = "wechat_id")
private String wechatId;
/**
* 微信昵称
*/
@Column(name = "wechat_nickname")
private String wechatNickname;
/**
* 微信头像
*/
@Column(name = "wechat_avatar_url")
private String wechatAvatarUrl;
/**
* 微信union_id
*/
@Column(name = "wechat_union_id")
private String wechatUnionId;
/**
* 婚姻状况
*/
@Column(name = "marital_status")
......
......@@ -15,6 +15,7 @@ import java.util.Date;
@Data
@Table(name = "cdp_customer_sop_journey")
public class CustomerSopJourney implements Serializable {
private static final long serialVersionUID = -8177989540603217173L;
/**
* id
*/
......@@ -59,10 +60,16 @@ public class CustomerSopJourney implements Serializable {
private Date sopJourneyStageEnterTime;
/**
* 跟进人
* 跟进人id
*/
@Column(name = "sop_follow_up_person")
private String sopFollowUpPerson;
@Column(name = "sop_follow_up_person_id")
private String sopFollowUpPersonId;
/**
* 跟进人名称
*/
@Column(name = "sop_follow_up_person_name")
private String sopFollowUpPersonName;
/**
* 跟进人手机号
......
......@@ -13,6 +13,9 @@ public class CarMaintenanceInsuranceDTO implements Serializable {
private static final long serialVersionUID = 734253580989420799L;
@Schema(description = "车id")
private String carId;
@Schema(description = "车牌号")
private String carNumber;
......
......@@ -20,6 +20,9 @@ public class CustomerSopJourneyDTO implements Serializable {
@Schema(description = "组织ID")
private String orgId;
@Schema(description = "客户oneID")
private String oneId;
@Schema(description = "客户姓名")
private String customerName;
......@@ -35,7 +38,13 @@ public class CustomerSopJourneyDTO implements Serializable {
@Schema(description ="客户年龄")
private Integer age;
@Schema(description = "客户额外信息json(微信昵称、头像等)")
@Schema(description ="微信昵称")
private String wechatNickname;
@Schema(description ="微信头像")
private String wechatAvatarUrl;
@Schema(description = "客户额外信息json")
private String customerExtra;
@Schema(description = "sop旅程ID")
......
......@@ -39,10 +39,10 @@ public class CustomerSopJourneySearch implements Serializable {
private String customerName;
@Schema(description = "客户微信昵称")
private String customerWechatNickname;
private String wechatNickname;
@Schema(description = "客户旅程跟进人列表")
private List<String> sopFollowUpPersons;
@Schema(description = "客户旅程跟进人id列表")
private List<String> sopFollowUpPersonIds;
@Schema(description = "进入sop旅程时间-开始")
private String sopJourneyEnterTimeBegin;
......
package cn.com.glsx.cdp.modules.api.customer;
import cn.com.glsx.cdp.api.customer.CustomerSopJourneyFeignClient;
import cn.com.glsx.cdp.modules.converter.CustomerSopJourneyBOConvert;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneySearch;
import cn.com.glsx.cdp.modules.service.CustomerSopJourneyService;
import cn.com.glsx.cdp.modules.util.CommonUtils;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.annotation.ResponseResultBody;
import com.glsx.plat.core.web.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.stream.Collectors;
@Slf4j
@Tag(name = "客户sop旅程")
......@@ -18,13 +29,40 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping(value = "/api/customerSopJourney")
@ResponseResultBody
public class CustomerSopJourneyController implements CustomerSopJourneyFeignClient {
@Autowired
private CustomerSopJourneyService customerSopJourneyService;
@Operation(description = "分页查询客户旅程信息")
@PostMapping("/page")
@Override
public Result<PageInfo<CustomerSopJourneyDTO>> pageCustomerSopJourney(CustomerSopJourneySearch request) {
return null;
public Result<PageInfo<CustomerSopJourneyDTO>> pageCustomerSopJourney(@RequestBody CustomerSopJourneySearch request) {
log.info("分页查询客户旅程信息:{}", request);
RpcPagination<CustomerSopJourneyBO> pagination = CommonUtils.getRpcPagination(request, CustomerSopJourneyBO.class);
Page<CustomerSopJourneyBO> page = customerSopJourneyService.page(pagination);
PageInfo<CustomerSopJourneyDTO> data = new PageInfo<>();
data.setPageNum(page.getPageNum());
data.setPageSize(page.getPageSize());
data.setTotal(page.getTotal());
data.setPages(page.getPages());
data.setStartRow(page.getStartRow());
data.setEndRow(page.getEndRow());
data.setList(new ArrayList<>());
if (CollectionUtils.isNotEmpty(page)) {
data.setList(page.parallelStream().map(CustomerSopJourneyBOConvert.INSTANCE::toCustomerSopJourneyDTO)
.collect(Collectors.toList()));
}
log.info("分页查询客户旅程信息返回:{}", data);
return Result.success(data);
}
@Operation(description = "获取客户旅程详情")
@GetMapping("/detail")
@Override
public Result<CustomerSopJourneyDetailDTO> detail(String orgId, String customerPhone) {
return null;
public Result<CustomerSopJourneyDetailDTO> detail(@RequestParam("orgId") String orgId, @RequestParam("sopJourneyId") String sopJourneyId, @RequestParam("oneId") String oneId) {
log.info("获取客户旅程详情:orgId:{},sopJourneyId:{},oneId:{}", orgId, sopJourneyId, oneId);
CustomerSopJourneyBO data = customerSopJourneyService.detail(orgId, sopJourneyId, oneId);
CustomerSopJourneyDetailDTO customerSopJourneyDetailDTO = CustomerSopJourneyBOConvert.INSTANCE.toCustomerSopJourneyDetailDTO(data);
log.info("获取客户旅程详情:{}", customerSopJourneyDetailDTO);
return Result.success(customerSopJourneyDetailDTO);
}
}
package cn.com.glsx.cdp.modules.converter;
import cn.com.glsx.cdp.modules.model.CarMaintenanceInsuranceBO;
import cn.com.glsx.cdp.modules.model.customer.CarMaintenanceInsuranceDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface CarMaintenanceInsuranceBOConvert {
CarMaintenanceInsuranceBOConvert INSTANCE = Mappers.getMapper(CarMaintenanceInsuranceBOConvert.class);
CarMaintenanceInsuranceDTO toCarMaintenanceInsuranceDTO(CarMaintenanceInsuranceBO sourceEntity);
}
package cn.com.glsx.cdp.modules.converter;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDTO;
import cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyDetailDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper(uses = {CarMaintenanceInsuranceBOConvert.class})
public interface CustomerSopJourneyBOConvert {
CustomerSopJourneyBOConvert INSTANCE = Mappers.getMapper(CustomerSopJourneyBOConvert.class);
@Mappings({
@Mapping(source = "customer.*",target = "."),
@Mapping(source = "customer.exJson",target = "customerExtra"),
})
CustomerSopJourneyDTO toCustomerSopJourneyDTO(CustomerSopJourneyBO sourceEntity);
@Mappings({
@Mapping(source = "customer.*",target = "."),
@Mapping(source = "customer.exJson",target = "customerExtra"),
})
CustomerSopJourneyDetailDTO toCustomerSopJourneyDetailDTO(CustomerSopJourneyBO sourceEntity);
}
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.CarMaintenanceInsurance;
import cn.com.glsx.cdp.modules.model.CarMaintenanceInsuranceBO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CarMaintenanceInsuranceMapper extends CommonBaseMapper<CarMaintenanceInsurance> {
List<CarMaintenanceInsuranceBO> listCarMaintenanceInsurance(CarMaintenanceInsuranceBO condition);
}
\ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.CustomerSopJourney;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.mapstruct.Mapper;
import java.util.List;
@Mapper
public interface CustomerSopJourneyMapper extends CommonBaseMapper<CustomerSopJourney> {
List<CustomerSopJourneyBO> listCustomerSopJourney(CustomerSopJourneyBO customerSopJourneyBO);
}
\ No newline at end of file
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.entity.Car;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
public class CarBO extends Car {
private static final long serialVersionUID = 1002595583762016894L;
// carId列表
private List<String> carIds;
}
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.entity.CarMaintenanceInsurance;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
public class CarMaintenanceInsuranceBO extends CarMaintenanceInsurance {
private static final long serialVersionUID = -3091758347089448890L;
// oneId列表
private List<String> oneIds;
private CarBO car;
}
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.entity.Customer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
public class CustomerBO extends Customer {
private static final long serialVersionUID = 7737436798332111409L;
// oneId列表
private List<String> oneIds;
}
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.entity.CustomerSopJourney;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
public class CustomerSopJourneyBO extends CustomerSopJourney {
private static final long serialVersionUID = 169617991270474434L;
private CustomerBO customer;
// oneId列表
private List<String> oneIds;
// 客户旅程id列表
private List<String> sopJourneyIds;
// 客户旅程阶段列表
private List<String> sopJourneyStages;
// 客户手机号(模糊匹配)
private String customerPhone;
// 客户手机号列表(精确匹配)
private List<String> customerPhones;
// 客户姓名
private String customerName;
// 客户微信昵称
private String wechatNickname;
// 客户旅程跟进人id列表
private List<String> sopFollowUpPersonIds;
// 进入sop旅程时间-开始
private String sopJourneyEnterTimeBegin;
// 进入sop旅程时间-结束
private String sopJourneyEnterTimeEnd;
private List<CarMaintenanceInsuranceBO> carMaintenanceInsurances;
}
package cn.com.glsx.cdp.modules.service;
import cn.com.glsx.cdp.modules.mapper.CarMaintenanceInsuranceMapper;
import cn.com.glsx.cdp.modules.model.CarMaintenanceInsuranceBO;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class CarMaintenanceInsuranceService {
@Autowired
private CarMaintenanceInsuranceMapper carMaintenanceInsuranceMapper;
public List<CarMaintenanceInsuranceBO> listCarMaintenanceInsurance(CarMaintenanceInsuranceBO condition){
try{
return carMaintenanceInsuranceMapper.listCarMaintenanceInsurance(condition);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
}
package cn.com.glsx.cdp.modules.service;
import cn.com.glsx.cdp.modules.mapper.CustomerSopJourneyMapper;
import cn.com.glsx.cdp.modules.model.CarMaintenanceInsuranceBO;
import cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class CustomerSopJourneyService {
@Autowired
private CustomerSopJourneyMapper customerSopJourneyMapper;
@Autowired
private CarMaintenanceInsuranceService carMaintenanceInsuranceService;
public Page<CustomerSopJourneyBO> page(RpcPagination<CustomerSopJourneyBO> pagination){
try{
Page<CustomerSopJourneyBO> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize(), pagination.isNeedCount());
customerSopJourneyMapper.listCustomerSopJourney(pagination.getCondition());
return page;
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
public CustomerSopJourneyBO detail(String orgId, String sopJourneyId, String oneId){
CustomerSopJourneyBO condition = CustomerSopJourneyBO.builder().orgId(orgId).sopJourneyId(sopJourneyId).oneId(oneId).build();
List<CustomerSopJourneyBO> list = customerSopJourneyMapper.listCustomerSopJourney(condition);
if (CollectionUtils.isNotEmpty(list)) {
CustomerSopJourneyBO customerSopJourneyBO = list.get(0);
CarMaintenanceInsuranceBO carMaintenanceInsuranceBO = CarMaintenanceInsuranceBO.builder().oneIds(Arrays.asList(customerSopJourneyBO.getOneId())).build();
List<CarMaintenanceInsuranceBO> carMaintenanceInsuranceBOS = carMaintenanceInsuranceService.listCarMaintenanceInsurance(carMaintenanceInsuranceBO);
customerSopJourneyBO.setCarMaintenanceInsurances(carMaintenanceInsuranceBOS);
return customerSopJourneyBO;
}
log.info("查询客户旅程详情结果为空,orgId:{},sopJourneyId:{},oneId:{}", orgId, sopJourneyId, oneId);
return null;
}
}
package cn.com.glsx.cdp.modules.util;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
public class CommonUtils {
public static <T> RpcPagination<T> getRpcPagination(Object pageRequest, Class<T> conditionClass){
RpcPagination<T> rpcPagination = new RpcPagination<>();
rpcPagination.setPageNum(1);
rpcPagination.setPageSize(10);
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(pageRequest));
if(StringUtils.isNotBlank(jsonObject.getString("currentPage"))){
rpcPagination.setPageNum(Integer.valueOf(jsonObject.getString("currentPage")));
}else if(StringUtils.isNotBlank(jsonObject.getString("pageNum"))){
rpcPagination.setPageNum(Integer.valueOf(jsonObject.getString("pageNum")));
}
if(StringUtils.isNotBlank(jsonObject.getString("pageSize"))){
rpcPagination.setPageSize(Integer.valueOf(jsonObject.getString("pageSize")));
}
rpcPagination.setCondition(convertRequest(pageRequest, conditionClass));
return rpcPagination;
}
public static <T> T convertRequest(Object request, Class<T> clazz){
try {
T bean = clazz.newInstance();
BeanUtils.copyProperties(request, bean);
return bean;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
}
package cn.com.glsx.cdp.modules.util;
import cn.com.glsx.framework.core.annotation.ReflectMethodName;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
public class RpcPagination<T> implements Serializable {
private static final long serialVersionUID = 9015548678953444686L;
@ReflectMethodName(
get = "getPageNum",
set = "setPageNum"
)
private int pageNum = 1;
@ReflectMethodName(
get = "getPageSize",
set = "setPageSize"
)
private int pageSize = 10;
@ReflectMethodName(
get = "getStartRow",
set = "setStartRow"
)
private long startRow;
@ReflectMethodName(
get = "getEndRow",
set = "setEndRow"
)
private long endRow;
@ReflectMethodName(
get = "getTotal",
set = "setTotal"
)
private long total;
@ReflectMethodName(
get = "getPages",
set = "setPages"
)
private int pages;
@ReflectMethodName(
get = "getResult",
set = "setList"
)
private List<T> list;
private T condition;
private boolean needCount = true;
public RpcPagination() {
}
public int getPageNum() {
return this.pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return this.pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public long getStartRow() {
return this.startRow;
}
public void setStartRow(long startRow) {
this.startRow = startRow;
}
public long getEndRow() {
return this.endRow;
}
public void setEndRow(long endRow) {
this.endRow = endRow;
}
public long getTotal() {
return this.total;
}
public void setTotal(long total) {
this.total = total;
}
public int getPages() {
return this.pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public List<T> getList() {
return this.list;
}
public void setList(List<T> list) {
this.list = list;
}
public T getCondition() {
return this.condition;
}
public void setCondition(T condition) {
this.condition = condition;
}
public boolean isNeedCount() {
return this.needCount;
}
public RpcPagination<T> setNeedCount(boolean needCount) {
this.needCount = needCount;
return this;
}
public static <T> RpcPagination<T> copyPage(Object page) {
try {
RpcPagination<T> pagination = new RpcPagination();
Class<?> sourceClass = page.getClass();
Class<?> targetClass = pagination.getClass();
Field[] fields = targetClass.getDeclaredFields();
Field[] var5 = fields;
int var6 = fields.length;
for(int var7 = 0; var7 < var6; ++var7) {
Field field = var5[var7];
ReflectMethodName methodName = (ReflectMethodName)field.getAnnotation(ReflectMethodName.class);
if (methodName != null) {
Method sourceMethod = sourceClass.getDeclaredMethod(methodName.get());
sourceMethod.setAccessible(true);
Object value = sourceMethod.invoke(page);
Method targetMethod = targetClass.getMethod(methodName.set(), field.getType());
targetMethod.invoke(pagination, value);
sourceMethod = null;
}
methodName = null;
}
fields = null;
targetClass = null;
sourceClass = null;
page = null;
return pagination;
} catch (Exception var13) {
var13.printStackTrace();
return null;
}
}
public String toString() {
return "RpcPagination [pageNum=" + this.pageNum + ", pageSize=" + this.pageSize + ", startRow=" + this.startRow + ", endRow=" + this.endRow + ", total=" + this.total + ", pages=" + this.pages + "]";
}
}
......@@ -32,6 +32,33 @@
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<resultMap id="BOResultMap" type="cn.com.glsx.cdp.modules.model.CarMaintenanceInsuranceBO" extends="BaseResultMap">
<association property="car" javaType="cn.com.glsx.cdp.modules.model.CarBO">
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="car_id" jdbcType="VARCHAR" property="carId" />
<result column="car_number" jdbcType="VARCHAR" property="carNumber" />
<result column="car_vin" jdbcType="VARCHAR" property="carVin" />
<result column="car_vin_six" jdbcType="VARCHAR" property="carVinSix" />
<result column="car_engine_num" jdbcType="VARCHAR" property="carEngineNum" />
<result column="car_brand" jdbcType="VARCHAR" property="carBrand" />
<result column="car_model" jdbcType="VARCHAR" property="carModel" />
<result column="car_series" jdbcType="VARCHAR" property="carSeries" />
<result column="car_color" jdbcType="VARCHAR" property="carColor" />
<result column="car_buy_date" jdbcType="TIMESTAMP" property="carBuyDate" />
<result column="car_price" jdbcType="DECIMAL" property="carPrice" />
<result column="car_seats_num" jdbcType="VARCHAR" property="carSeatsNum" />
<result column="car_warranty_valid" jdbcType="VARCHAR" property="carWarrantyValid" />
<result column="car_classification" jdbcType="VARCHAR" property="carClassification" />
<result column="car_nature" jdbcType="VARCHAR" property="carNature" />
<result column="car_dealer" jdbcType="VARCHAR" property="carDealer" />
<result column="car_factory" jdbcType="VARCHAR" property="carFactory" />
<result column="car_register_date" jdbcType="TIMESTAMP" property="carRegisterDate" />
<result column="car_model_year" jdbcType="INTEGER" property="carModelYear" />
<result column="car_mileage" jdbcType="VARCHAR" property="carMileage" />
<result column="car_average_daily_mileage" jdbcType="VARCHAR" property="carAverageDailyMileage" />
<result column="cc_add_way" jdbcType="INTEGER" property="addWay" />
</association>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
......@@ -49,4 +76,32 @@
-->
ex_json
</sql>
<select id="listCarMaintenanceInsurance"
parameterType="cn.com.glsx.cdp.modules.model.CarMaintenanceInsuranceBO" resultMap="BOResultMap">
select ccmi.id, ccmi.org_id, ccmi.car_id, ccmi.car_maintenance_insurance_tag, ccmi.car_ins_no, ccmi.car_cpy_ins_no,
ccmi.car_cpy_ins_start_time, ccmi.car_cpy_ins_end_time, ccmi.car_first_maintenance_date, ccmi.car_last_maintenance_time,
ccmi.car_previous_maintenance_date, ccmi.car_maintenance_notification_date, ccmi.car_maintenance_hour,
ccmi.car_maintenance_amount, ccmi.car_maintenance_time, ccmi.car_maintenance_frequency, ccmi.car_free_maintenance_time,
ccmi.car_average_maintenance_day, ccmi.car_sold_by_company, ccmi.add_way,
cc.car_id, cc.car_number, cc.car_vin, cc.car_vin_six, cc.car_engine_num, cc.car_brand, cc.car_model, cc.car_series,
cc.car_color, cc.car_buy_date, cc.car_price, cc.car_seats_num, cc.car_warranty_valid, cc.car_classification,
cc.car_nature, cc.car_dealer, cc.car_factory, cc.car_register_date, cc.car_model_year, cc.car_mileage, cc.car_average_daily_mileage,
cc.add_way as cc_add_way
from cdp_car_maintenance_insurance ccmi
left join cdp_customer_car_relation cccr on ccmi.car_id = cccr.car_id and cccr.org_id = ccmi.org_id and cccr.del_flag = 'N'
left join cdp_car cc on cc.org_id = cccr.org_id and cc.car_id = cccr.car_id and cc.del_flag = 'N'
left join cdp_customer cc on cccr.one_id = cc.one_id and cc.org_id = cccr.org_id and cc.del_flag = 'N'
<where>
ccmi.del_flag = 0
<if test="oneId != null">
and cc.one_id = #{oneId}
</if>
<if test="oneIds != null and oneIds.size()>0">
and cc.one_id in
<foreach collection="oneIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -14,21 +14,25 @@
<result column="age" jdbcType="INTEGER" property="age" />
<result column="customer_phone" jdbcType="VARCHAR" property="customerPhone" />
<result column="customer_email" jdbcType="VARCHAR" property="customerEmail" />
<result column="id_type" jdbcType="CHAR" property="idType" />
<result column="id_number" jdbcType="VARCHAR" property="idNumber" />
<result column="nationality" jdbcType="VARCHAR" property="nationality" />
<result column="province" jdbcType="VARCHAR" property="province" />
<result column="city" jdbcType="VARCHAR" property="city" />
<result column="region" jdbcType="VARCHAR" property="region" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="org_user_id" jdbcType="VARCHAR" property="orgUserId" />
<result column="wechat_id" jdbcType="VARCHAR" property="wechatId" />
<result column="wechat_nickname" jdbcType="VARCHAR" property="wechatNickname" />
<result column="wechat_avatar_url" jdbcType="VARCHAR" property="wechatAvatarUrl" />
<result column="wechat_union_id" jdbcType="VARCHAR" property="wechatUnionId" />
<result column="marital_status" jdbcType="CHAR" property="maritalStatus" />
<result column="occupation" jdbcType="VARCHAR" property="occupation" />
<result column="customer_annual_income" jdbcType="DECIMAL" property="customerAnnualIncome" />
<result column="customer_company" jdbcType="VARCHAR" property="customerCompany" />
<result column="education_level" jdbcType="CHAR" property="educationLevel" />
<result column="notes" jdbcType="VARCHAR" property="notes" />
<result column="ex_json" jdbcType="LONGVARCHAR" property="exJson" />
<result column="add_way" jdbcType="INTEGER" property="addWay" />
<result column="ex_json" jdbcType="LONGVARCHAR" property="exJson" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
......@@ -40,9 +44,10 @@
WARNING - @mbg.generated
-->
id, org_id, one_id, customer_name, gender, birthday, age, customer_phone, customer_email,
id_type, id_number, nationality, province, city, region, address, marital_status,
occupation, customer_annual_income, customer_company, education_level, notes, add_way,
created_by, created_time, updated_by, updated_time, del_flag
id_number, nationality, province, city, region, address, org_user_id, wechat_id,
wechat_nickname, wechat_avatar_url, wechat_union_id, marital_status, occupation,
customer_annual_income, customer_company, education_level, notes, add_way, created_by,
created_time, updated_by, updated_time, del_flag
</sql>
<sql id="Blob_Column_List">
<!--
......
......@@ -12,7 +12,8 @@
<result column="sop_journey_stage" jdbcType="VARCHAR" property="sopJourneyStage" />
<result column="sop_journey_enter_time" jdbcType="TIMESTAMP" property="sopJourneyEnterTime" />
<result column="sop_journey_stage_enter_time" jdbcType="TIMESTAMP" property="sopJourneyStageEnterTime" />
<result column="sop_follow_up_person" jdbcType="VARCHAR" property="sopFollowUpPerson" />
<result column="sop_follow_up_person_id" jdbcType="VARCHAR" property="sopFollowUpPersonId" />
<result column="sop_follow_up_person_name" jdbcType="VARCHAR" property="sopFollowUpPersonName" />
<result column="sop_follow_up_person_phone" jdbcType="VARCHAR" property="sopFollowUpPersonPhone" />
<result column="sop_follow_up_person_aiSpeech" jdbcType="VARCHAR" property="sopFollowUpPersonAiSpeech" />
<result column="sop_follow_up_person_sms" jdbcType="VARCHAR" property="sopFollowUpPersonSms" />
......@@ -24,12 +25,38 @@
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<resultMap id="BOResultMap" type="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO">
<association property="customer" javaType="cn.com.glsx.cdp.modules.model.CustomerBO">
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="one_id" jdbcType="VARCHAR" property="oneId" />
<result column="customer_name" jdbcType="VARCHAR" property="customerName" />
<result column="gender" jdbcType="CHAR" property="gender" />
<result column="birthday" jdbcType="TIMESTAMP" property="birthday" />
<result column="age" jdbcType="INTEGER" property="age" />
<result column="customer_phone" jdbcType="VARCHAR" property="customerPhone" />
<result column="customer_email" jdbcType="VARCHAR" property="customerEmail" />
<result column="id_number" jdbcType="VARCHAR" property="idNumber" />
<result column="nationality" jdbcType="VARCHAR" property="nationality" />
<result column="province" jdbcType="VARCHAR" property="province" />
<result column="city" jdbcType="VARCHAR" property="city" />
<result column="region" jdbcType="VARCHAR" property="region" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="marital_status" jdbcType="CHAR" property="maritalStatus" />
<result column="occupation" jdbcType="VARCHAR" property="occupation" />
<result column="customer_annual_income" jdbcType="DECIMAL" property="customerAnnualIncome" />
<result column="customer_company" jdbcType="VARCHAR" property="customerCompany" />
<result column="education_level" jdbcType="CHAR" property="educationLevel" />
<result column="notes" jdbcType="VARCHAR" property="notes" />
<result column="c_ex_json" jdbcType="LONGVARCHAR" property="exJson" />
<result column="c_add_way" jdbcType="INTEGER" property="addWay" />
</association>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, org_id, one_id, sop_journey_id, sop_journey_stage, sop_journey_enter_time, sop_journey_stage_enter_time,
sop_follow_up_person, sop_follow_up_person_phone, sop_follow_up_person_aiSpeech,
id, org_id, one_id, sop_journey_id, sop_journey_stage, sop_journey_enter_time, sop_journey_stage_enter_time,
sop_follow_up_person_id, sop_follow_up_person_name, sop_follow_up_person_phone, sop_follow_up_person_aiSpeech,
sop_follow_up_person_sms, add_way, created_by, created_time, updated_by, updated_time,
del_flag
</sql>
......@@ -39,4 +66,72 @@
-->
ex_json
</sql>
<select id="listCustomerSopJourney" parameterType="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO" resultMap="BOResultMap">
select
csj.id, csj.org_id, csj.one_id, csj.sop_journey_id, csj.sop_journey_stage,
csj.sop_journey_enter_time, csj.sop_journey_stage_enter_time, csj.sop_follow_up_person_id,
csj.sop_follow_up_person_name, csj.sop_follow_up_person_phone, csj.sop_follow_up_person_aiSpeech,
csj.sop_follow_up_person_sms, csj.add_way
c.customer_name, c.gender, c.birthday, c.age, c.customer_phone, c.customer_email,
c.id_number, c.nationality, c.province, c.city, c.region, c.address, c.marital_status,
c.occupation, c.customer_annual_income, c.customer_company, c.education_level, c.notes,
c.add_way as c_add_way
from cdp_customer_sop_journey csj
left join cdp_customer c on csj.one_id = c.one_id and c.del_flag = 0
<where>
csj.del_flag = 0
<if test="oneId != null">
and csj.one_id = #{oneId}
</if>
<if test="oneIds != null and oneIds.size()>0">
and csj.one_id in
<foreach collection="oneIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="sopJourneyId != null">
and csj.sop_journey_id = #{sopJourneyId}
</if>
<if test="sopJourneyIds != null and sopJourneyIds.size()>0">
and csj.sop_journey_id in
<foreach collection="sopJourneyIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="sopJourneyStages != null and sopJourneyStages.size()>0">
and csj.sop_journey_stage in
<foreach collection="sopJourneyStages" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="customerPhones != null and customerPhones.size()>0">
and c.customer_phone in
<foreach collection="customerPhones" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="customerPhone != null and customerPhone != ''">
and c.customer_phone like CONCAT('%', #{customerPhone},'%')
</if>
<if test="customerName != null and customerName != ''">
and c.customer_name like CONCAT('%', #{customerName},'%')
</if>
<if test="wechatNickname != null and wechatNickname != ''">
and c.wechat_nickname like CONCAT('%', #{wechatNickname},'%')
</if>
<if test="sopFollowUpPersonIds != null and sopFollowUpPersonIds.size()>0">
and csj.sop_follow_up_person_id in
<foreach collection="sopFollowUpPersonIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="sopJourneyEnterTimeBegin != null and sopJourneyEnterTimeBegin != ''">
and csj.sop_journey_enter_time &gt;= #{sopJourneyEnterTimeBegin}
</if>
<if test="sopJourneyEnterTimeEnd != null and sopJourneyEnterTimeEnd != ''">
and csj.sop_journey_enter_time &lt;= #{sopJourneyEnterTimeEnd}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!