Commit 2b82a30e by 周海宝

Merge branch 'v1.0.1' into 'master'

V1.0.1

See merge request !1
2 parents 033f1a52 14c86920
Showing 96 changed files with 4357 additions and 106 deletions
## 开发环境
```properties
#rabbitmq
spring.rabbitmq.host=192.168.1.62
spring.rabbitmq.port=5672
spring.rabbitmq.username=admin
spring.rabbitmq.password=admin123
spring.rabbitmq.virtual-host=/
```
## 测试环境
```properties
#rabbitmq
spring.rabbitmq.host=192.168.1.62
spring.rabbitmq.port=5672
spring.rabbitmq.username=admin
spring.rabbitmq.password=admin123
spring.rabbitmq.virtual-host=/
```
## 预发步
```properties
#rabbitmq
spring.rabbitmq.host=192.168.1.62
spring.rabbitmq.port=5672
spring.rabbitmq.username=admin
spring.rabbitmq.password=admin123
spring.rabbitmq.virtual-host=/
```
## 生产
```properties
#rabbitmq
spring.rabbitmq.host=192.168.1.62
spring.rabbitmq.port=5672
spring.rabbitmq.username=admin
spring.rabbitmq.password=admin123
spring.rabbitmq.virtual-host=/
```
\ No newline at end of file \ No newline at end of file
...@@ -22,6 +22,21 @@ ...@@ -22,6 +22,21 @@
<groupId>com.glsx</groupId> <groupId>com.glsx</groupId>
<artifactId>rest-admin-feign</artifactId> <artifactId>rest-admin-feign</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.glsx</groupId>
<artifactId>rest-admin-swagger3</artifactId>
</dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>
package cn.com.glsx.cdp.api; package cn.com.glsx.cdp.api;
import cn.com.glsx.cdp.modules.model.UserDTO; import cn.com.glsx.cdp.modules.model.user.UserDTO;
import com.glsx.plat.core.web.Result; import com.glsx.plat.core.web.Result;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -42,7 +42,7 @@ public interface UserCenterFeignClient { ...@@ -42,7 +42,7 @@ public interface UserCenterFeignClient {
* 注意: @RequestParam("xx") 注解一定要写,而且属性名xx不能省略 * 注意: @RequestParam("xx") 注解一定要写,而且属性名xx不能省略
*/ */
@GetMapping("/echo") @GetMapping("/echo")
String echo(@RequestParam String message); String echo(@RequestParam("message") String message);
@GetMapping(value = "/info/{id}") @GetMapping(value = "/info/{id}")
UserDTO info(@PathVariable("id") Long id); UserDTO info(@PathVariable("id") Long id);
......
package cn.com.glsx.cdp.api.customer;
import cn.com.glsx.cdp.modules.model.customer.*;
import com.github.pagehelper.PageInfo;
import com.glsx.plat.core.web.Result;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author caiym
* @version V1.0.0
* @Title: CustomerSopJourneyFeignClient.java
* @Description: 客户sop旅程
* @date 2023年09月13日 11:12:51
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2021
*/
@FeignClient(name = "platform-cdp", contextId = "customerSopJourney", path = "/cdp/sop/api/customerSopJourney", decode404 = true)
public interface CustomerSopJourneyFeignClient {
@Operation(description = "分页查询客户旅程信息")
@PostMapping("/page")
Result<PageInfo<CustomerSopJourneyDTO>> pageCustomerSopJourney(@RequestBody CustomerSopJourneySearch request);
@Operation(description = "获取客户旅程详情")
@GetMapping("/detail")
Result<CustomerSopJourneyDetailDTO> detail(@RequestParam("orgId") String orgId, @RequestParam("sopJourneyId") String sopJourneyId, @RequestParam("oneId") String oneId);
@Operation(description = "修改客户旅程")
@PostMapping("/sopJourneyStage/modify")
Result<Boolean> modifyStage(@RequestBody ModifySopJourneyStageRequest request);
@Operation(description = "查询客户旅程客户统计数据")
@PostMapping("/statistics")
Result<List<CustomerSopJourneyStatisticsDTO>> statisticsCustomerSopJourney(@RequestBody CustomerSopJourneySearch request);
}
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_car")
public class Car implements Serializable {
private static final long serialVersionUID = 6742792058614900414L;
/**
* ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 组织ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 车辆id
*/
@Column(name = "car_id")
private String carId;
/**
* 车牌号
*/
@Column(name = "car_number")
private String carNumber;
/**
* 车架号
*/
@Column(name = "car_vin")
private String carVin;
/**
* 车架号后六位
*/
@Column(name = "car_vin_six")
private String carVinSix;
/**
* 发动机号
*/
@Column(name = "car_engine_num")
private String carEngineNum;
/**
* 车辆品牌
*/
@Column(name = "car_brand")
private String carBrand;
/**
* 车型
*/
@Column(name = "car_model")
private String carModel;
/**
* 车系
*/
@Column(name = "car_series")
private String carSeries;
/**
* 车辆颜色
*/
@Column(name = "car_color")
private String carColor;
/**
* 购车日期
*/
@Column(name = "car_buy_date")
private Date carBuyDate;
/**
* 车辆价格
*/
@Column(name = "car_price")
private BigDecimal carPrice;
/**
* 座位数
*/
@Column(name = "car_seats_num")
private String carSeatsNum;
/**
* 三包有效期
*/
@Column(name = "car_warranty_valid")
private String carWarrantyValid;
/**
* 车辆分类
*/
@Column(name = "car_classification")
private String carClassification;
/**
* 车辆性质
*/
@Column(name = "car_nature")
private String carNature;
/**
* 车辆经销商
*/
@Column(name = "car_dealer")
private String carDealer;
/**
* 工厂
*/
@Column(name = "car_factory")
private String carFactory;
/**
* 注册日期
*/
@Column(name = "car_register_date")
private Date carRegisterDate;
/**
* 车辆年款
*/
@Column(name = "car_model_year")
private Integer carModelYear;
/**
* 当前里程
*/
@Column(name = "car_mileage")
private String carMileage;
/**
* 日平均行驶里程
*/
@Column(name = "car_average_daily_mileage")
private String carAverageDailyMileage;
/**
* 来源
*/
@Column(name = "add_way")
private String addWay;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 修改人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 修改时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 0正常,-1已删除
*/
@Column(name = "del_flag")
private Integer delFlag;
/**
* 扩展字段json
*/
@Column(name = "ex_json")
private String exJson;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_car_maintenance_insurance")
public class CarMaintenanceInsurance implements Serializable {
private static final long serialVersionUID = -3242496221952147081L;
/**
* ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 组织ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 车辆id
*/
@Column(name = "car_id")
private String carId;
/**
* 维保标签
*/
@Column(name = "car_maintenance_insurance_tag")
private String carMaintenanceInsuranceTag;
/**
* 商业险订单号
*/
@Column(name = "car_ins_no")
private String carInsNo;
/**
* 交强险订单号
*/
@Column(name = "car_cpy_ins_no")
private String carCpyInsNo;
/**
* 交强险生效时间
*/
@Column(name = "car_cpy_ins_start_time")
private Date carCpyInsStartTime;
/**
* 交强险失效时间
*/
@Column(name = "car_cpy_ins_end_time")
private Date carCpyInsEndTime;
/**
* 首保日期
*/
@Column(name = "car_first_maintenance_date")
private Date carFirstMaintenanceDate;
/**
* 最后保养时间
*/
@Column(name = "car_last_maintenance_time")
private Date carLastMaintenanceTime;
/**
* 上次保养日期
*/
@Column(name = "car_previous_maintenance_date")
private Date carPreviousMaintenanceDate;
/**
* 通知保养日期
*/
@Column(name = "car_maintenance_notification_date")
private Date carMaintenanceNotificationDate;
/**
* 维修工时
*/
@Column(name = "car_maintenance_hour")
private String carMaintenanceHour;
/**
* 累计金额
*/
@Column(name = "car_maintenance_amount")
private String carMaintenanceAmount;
/**
* 累计维修次数
*/
@Column(name = "car_maintenance_time")
private Integer carMaintenanceTime;
/**
* 保养次数
*/
@Column(name = "car_maintenance_frequency")
private Integer carMaintenanceFrequency;
/**
* 免费维修次数
*/
@Column(name = "car_free_maintenance_time")
private Integer carFreeMaintenanceTime;
/**
* 平均保养天数
*/
@Column(name = "car_average_maintenance_day")
private String carAverageMaintenanceDay;
/**
* 本公司售车
*/
@Column(name = "car_sold_by_company")
private String carSoldByCompany;
/**
* 来源
*/
@Column(name = "add_way")
private String addWay;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 修改人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 修改时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 0正常,-1已删除
*/
@Column(name = "del_flag")
private Integer delFlag;
/**
* 扩展字段json
*/
@Column(name = "ex_json")
private String exJson;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_customer")
public class Customer implements Serializable {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 组织ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 客户oneID
*/
@Column(name = "one_id")
private String oneId;
/**
* 客户姓名
*/
@Column(name = "customer_name")
private String customerName;
/**
* 性别
*/
private String gender;
/**
* 出生日期
*/
private Date birthday;
/**
* 年龄
*/
private Integer age;
/**
* 电话号码
*/
@Column(name = "customer_phone")
private String customerPhone;
/**
* 电子邮箱
*/
@Column(name = "customer_email")
private String customerEmail;
/**
* 身份证号
*/
@Column(name = "id_number")
private String idNumber;
/**
* 国籍
*/
private String nationality;
/**
* 省份
*/
private String province;
/**
* 市
*/
private String city;
/**
* 区域
*/
private String region;
/**
* 地址
*/
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")
private String maritalStatus;
/**
* 职业
*/
private String occupation;
/**
* 年收入
*/
@Column(name = "customer_annual_income")
private BigDecimal customerAnnualIncome;
/**
* 公司
*/
@Column(name = "customer_company")
private String customerCompany;
/**
* 教育水平
*/
@Column(name = "education_level")
private String educationLevel;
/**
* 备注
*/
private String notes;
/**
* 来源
*/
@Column(name = "add_way")
private String addWay;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 是否删除:0=正常,-1=删除
*/
@Column(name = "del_flag")
private Integer delFlag;
/**
* 扩展字段
*/
@Column(name = "ex_json")
private String exJson;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_customer_car_relation")
public class CustomerCarRelation implements Serializable {
private static final long serialVersionUID = 7758828325578933433L;
/**
* 编号
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 组织ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 客户oneId
*/
@Column(name = "one_id")
private String oneId;
/**
* 车辆oneId
*/
@Column(name = "car_id")
private String carId;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 修改人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 修改时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 0正常,-1删除
*/
@Column(name = "del_flag")
private Integer delFlag;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_customer_event")
public class CustomerEvent implements Serializable {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 组织ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 客户oneID
*/
@Column(name = "one_id")
private String oneId;
/**
* 事件发生时间
*/
@Column(name = "event_time")
private Date eventTime;
/**
* 事件类型
*/
@Column(name = "event_type")
private String eventType;
/**
* 系统来源: scrm,dj,..
*/
@Column(name = "system_source")
private String systemSource;
/**
* 事件平台(小程序、H5、App等)
*/
private String platform;
/**
* 事件扩展字段
*/
private String extra;
/**
* 扩展字段
*/
@Column(name = "ex_json")
private String exJson;
/**
* 来源
*/
@Column(name = "add_way")
private String addWay;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 是否删除:0=正常,-1=删除
*/
@Column(name = "del_flag")
private Integer delFlag;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_customer_sop_journey")
public class CustomerSopJourney implements Serializable {
private static final long serialVersionUID = -8177989540603217173L;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 组织ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 客户oneID
*/
@Column(name = "one_id")
private String oneId;
/**
* sop旅程ID
*/
@Column(name = "sop_journey_id")
private String sopJourneyId;
/**
* sop旅程阶段
*/
@Column(name = "sop_journey_stage")
private String sopJourneyStage;
/**
* 进入sop旅程时间
*/
@Column(name = "sop_journey_enter_time")
private Date sopJourneyEnterTime;
/**
* 进入当前sop旅程阶段开始时间
*/
@Column(name = "sop_journey_stage_enter_time")
private Date sopJourneyStageEnterTime;
/**
* 跟进人id
*/
@Column(name = "sop_follow_up_person_id")
private String sopFollowUpPersonId;
/**
* 跟进人名称
*/
@Column(name = "sop_follow_up_person_name")
private String sopFollowUpPersonName;
/**
* 跟进人手机号
*/
@Column(name = "sop_follow_up_person_phone")
private String sopFollowUpPersonPhone;
/**
* 跟进人AI营销话术
*/
@Column(name = "sop_follow_up_person_aiSpeech")
private String sopFollowUpPersonAiSpeech;
/**
* 跟进人短信
*/
@Column(name = "sop_follow_up_person_sms")
private String sopFollowUpPersonSms;
/**
* 来源
*/
@Column(name = "add_way")
private String addWay;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 是否删除:0=正常,-1=删除
*/
@Column(name = "del_flag")
private Integer delFlag;
/**
* 扩展字段
*/
@Column(name = "ex_json")
private String exJson;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_field")
public class Field implements Serializable {
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 字段序号
*/
@Column(name = "field_index")
private Integer fieldIndex;
/**
* 属性的字段
*/
@Column(name = "field_name")
private String fieldName;
/**
* 字段类型
*/
@Column(name = "field_type")
private String fieldType;
/**
* 字段长度
*/
@Column(name = "field_length")
private Integer fieldLength;
/**
* 属性的字段名
*/
@Column(name = "field_describe")
private String fieldDescribe;
/**
* 字段规则
*/
@Column(name = "field_rule")
private String fieldRule;
/**
* 字段别名
*/
@Column(name = "field_alias")
private String fieldAlias;
/**
* 备注
*/
private String remark;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 是否删除:-1已删除,0正常
*/
@Column(name = "del_flag")
private Integer delFlag;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_model")
public class Model implements Serializable {
private static final long serialVersionUID = -6054904971227801924L;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 模型表名
*/
@Column(name = "model_name")
private String modelName;
/**
* 是否事事件表(1-是)
*/
@Column(name = "event_flag")
private Integer eventFlag;
/**
* 实体归属 1.客户
*/
@Column(name = "oneid_belong")
private Byte oneidBelong;
/**
* 备注说明
*/
private String remark;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 是否删除:0=正常,-1=删除
*/
@Column(name = "del_flag")
private Integer delFlag;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_model_field_mapping")
public class ModelFieldMapping implements Serializable {
private static final long serialVersionUID = 8972832964043406363L;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 模型表名
*/
@Column(name = "model_name")
private String modelName;
/**
* 字段序号
*/
@Column(name = "field_index")
private Integer fieldIndex;
/**
* 合并规则 (1-非空优先2-最后一次入库优先3-第一次入库优先4-时间最小5-时间最大)
*/
@Column(name = "union_rule")
private Byte unionRule;
/**
* 模型识别标识:1
*/
@Column(name = "model_flag")
private Boolean modelFlag;
/**
* 是否oneid识别字段:1
*/
@Column(name = "oneid_flag")
private Boolean oneidFlag;
/**
* 是否是扩展字段:1
*/
@Column(name = "expand_flag")
private Boolean expandFlag;
/**
* 是否是唯一值:1
*/
@Column(name = "unique_flag")
private Boolean uniqueFlag;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 是否删除:0=正常,-1=删除
*/
@Column(name = "del_flag")
private Integer delFlag;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_oneid_field_config")
public class OneIdFieldConfig implements Serializable {
private static final long serialVersionUID = 9187589612278038952L;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 组织ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 业务类型1.客户 2.车辆
*/
@Column(name = "business_type")
private Byte businessType;
/**
* 字段
*/
@Column(name = "field_name")
private String fieldName;
/**
* 字段描述
*/
@Column(name = "field_describe")
private String fieldDescribe;
/**
* 优先级
*/
private Byte priority;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 是否删除:0=正常,-1=删除
*/
@Column(name = "del_flag")
private Integer delFlag;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
@Table(name = "cdp_oneid_mapping")
public class OneIdMapping implements Serializable {
private static final long serialVersionUID = 911042986292649756L;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 组织ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 业务类型1.客户 2.车辆
*/
@Column(name = "business_type")
private Byte businessType;
/**
* 字段
*/
@Column(name = "field_name")
private String fieldName;
/**
* 字段值
*/
@Column(name = "field_value")
private String fieldValue;
/**
* one_id
*/
@Column(name = "one_id")
private String oneId;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 更新人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 是否删除:0=正常,-1=删除
*/
@Column(name = "del_flag")
private Integer delFlag;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.enums;
public enum CustomerEventTypeEnum {
SENT_SMS("SENT_SMS", "已发送短信"),
READ_URL("READ_URL","已查看链接"),
SENT_1V1_GROUP_MSG("SENT_1V1_GROUP_MSG","已1v1群发"),
SENT_AI_CALL("SENT_AI_CALL", "已发送ai外呼"),
RECALL_AI_CALL("RECALL_AI_CALL", "ai外呼回调"),
SHARED_WECHAT_MOMENT("SHARED_WECHAT_MOMENT","已分享朋友圈"),
ORDERED("ORDERED","已下单"),
ORDER_REFUNDED("ORDER_REFUNDED", "订单退款")
;
private final String value;
private final String displayText;
CustomerEventTypeEnum(String value, String displayText){
this.value = value;
this.displayText = displayText;
}
public String getValue() {
return value;
}
public String getDisplayText() {
return displayText;
}
public static CustomerEventTypeEnum getByValue(String value){
if (value != null) {
for (CustomerEventTypeEnum temp : CustomerEventTypeEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
}
package cn.com.glsx.cdp.modules.model.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Schema(description = "车辆维保信息")
@Data
public class CarMaintenanceInsuranceDTO implements Serializable {
private static final long serialVersionUID = 734253580989420799L;
@Schema(description = "车id")
private String carId;
@Schema(description = "车牌号")
private String carNumber;
@Schema(description = "车架号")
private String carVin;
@Schema(description = "车架号后六位")
private String carVinSix;
@Schema(description = "发动机号")
private String carEngineNum;
@Schema(description = "车辆品牌")
private String carBrand;
@Schema(description = "车型")
private String carModel;
@Schema(description = "车系")
private String carSeries;
@Schema(description = "车辆颜色")
private String carColor;
@Schema(description = "购车日期")
private Date carBuyDate;
@Schema(description = "车辆价格")
private BigDecimal carPrice;
@Schema(description = "座位数")
private String carSeatsNum;
@Schema(description = "三包有效期")
private String carWarrantyValid;
@Schema(description = "车辆分类")
private String carClassification;
@Schema(description = "车辆性质")
private String carNature;
@Schema(description = "车辆经销商")
private String carDealer;
@Schema(description = "工厂")
private String carFactory;
@Schema(description = "注册日期")
private Date carRegisterDate;
@Schema(description = "车辆年款")
private Integer carModelYear;
@Schema(description = "当前里程")
private String carMileage;
@Schema(description = "日平均行驶里程")
private String carAverageDailyMileage;
@Schema(description = "车辆其他信息(json)")
private String carExtra;
@Schema(description = "商业险订单号")
private String carInsNo;
@Schema(description = "交强险订单号")
private String carCpyInsNo;
@Schema(description = "交强险生效时间")
private Date carCpyInsStartTime;
@Schema(description = "交强险失效时间")
private Date carCpyInsEndTime;
@Schema(description = "首保日期")
private Date carFirstMaintenanceDate;
@Schema(description = "最后保养时间")
private Date carLastMaintenanceTime;
@Schema(description = "上次保养日期")
private Date carPreviousMaintenanceDate;
@Schema(description = "通知保养日期")
private Date carMaintenanceNotificationDate;
@Schema(description = "维修工时")
private String carMaintenanceHour;
@Schema(description = "累计金额")
private String carMaintenanceAmount;
@Schema(description = "累计维修次数")
private Integer carMaintenanceTime;
@Schema(description = "保养次数")
private Integer carMaintenanceFrequency;
@Schema(description = "免费维修次数")
private Integer carFreeMaintenanceTime;
@Schema(description = "平均保养天数")
private String carAverageMaintenanceDay;
@Schema(description = "本公司售车")
private String carSoldByCompany;
}
package cn.com.glsx.cdp.modules.model.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.util.Date;
@Schema(description = "客户sop旅程信息")
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
public class CustomerSopJourneyDTO implements Serializable {
private static final long serialVersionUID = 7567563160036214791L;
@Schema(description = "组织ID")
private String orgId;
@Schema(description = "客户oneID")
private String oneId;
@Schema(description = "客户姓名")
private String customerName;
@Schema(description = "客户电话")
private String customerPhone;
@Schema(description = "客户性别")
private String gender;
@Schema(description ="客户生日")
private Date birthday;
@Schema(description ="客户年龄")
private Integer age;
@Schema(description ="微信昵称")
private String wechatNickname;
@Schema(description ="微信头像")
private String wechatAvatarUrl;
@Schema(description = "客户额外信息json")
private String customerExtra;
@Schema(description = "sop旅程ID")
private String sopJourneyId;
@Schema(description = "sop旅程阶段")
private String sopJourneyStage;
@Schema(description = "进入sop旅程时间")
private Date sopJourneyEnterTime;
@Schema(description = "进入当前sop旅程阶段时间")
private Date sopJourneyStageEnterTime;
@Schema(description = "跟进人ID")
private String sopFollowUpPersonId;
@Schema(description = "跟进人名称")
private String sopFollowUpPersonName;
@Schema(description = "跟进人手机号")
private String sopFollowUpPersonPhone;
@Schema(description = "跟进人AI营销话术")
private String sopFollowUpPersonAiSpeech;
@Schema(description = "跟进人短信")
private String sopFollowUpPersonSms;
}
package cn.com.glsx.cdp.modules.model.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
@Schema(description = "客户sop旅程信息")
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
public class CustomerSopJourneyDetailDTO extends CustomerSopJourneyDTO{
private static final long serialVersionUID = 1864271167672001213L;
private List<CarMaintenanceInsuranceDTO> carMaintenanceInsurances;
}
package cn.com.glsx.cdp.modules.model.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
@Data
public class CustomerSopJourneySearch implements Serializable {
private static final long serialVersionUID = 3461654553135024523L;
@Schema(description = "页码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull
private Integer pageNum;
@Schema(description = "分页大小", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull
private Integer pageSize;
@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull
private String orgId;
@Schema(description = "oneId列表")
private List<String> oneIds;
@Schema(description = "客户旅程id列表")
private List<String> sopJourneyIds;
@Schema(description = "客户旅程阶段列表")
private List<String> sopJourneyStages;
@Schema(description = "客户手机号列表")
private List<String> customerPhones;
@Schema(description = "客户姓名")
private String customerName;
@Schema(description = "客户微信昵称")
private String wechatNickname;
@Schema(description = "客户旅程跟进人id列表")
private List<String> sopFollowUpPersonIds;
@Schema(description = "客户旅程跟进人手机号")
private String sopFollowUpPersonPhone;
@Schema(description = "进入sop旅程时间-开始")
private String sopJourneyEnterTimeBegin;
@Schema(description = "进入sop旅程时间-结束")
private String sopJourneyEnterTimeEnd;
}
package cn.com.glsx.cdp.modules.model.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
@Schema(description = "客户sop旅程统计信息")
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
public class CustomerSopJourneyStatisticsDTO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "sop旅程ID")
private String sopJourneyId;
@Schema(description = "sop旅程阶段")
private String sopJourneyStage;
@Schema(description = "数量")
private Long count;
}
package cn.com.glsx.cdp.modules.model.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
@Data
public class ModifySopJourneyStageRequest implements Serializable {
private static final long serialVersionUID = -5681594062904420438L;
@NotEmpty
@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String orgId;
@NotEmpty
@Schema(description = "客户旅程id", requiredMode = Schema.RequiredMode.REQUIRED)
private String sopJourneyId;
@Schema(description = "客户原旅程阶段列表")
private List<String> oldStages;
@Schema(description = "oneId列表")
private List<String> oneIds;
@NotEmpty
@Schema(description = "目标客户旅程阶段", requiredMode = Schema.RequiredMode.REQUIRED)
private String sopJourneyStage;
@NotEmpty
@Schema(description = "操作人", requiredMode = Schema.RequiredMode.REQUIRED)
private String oprBy;
}
package cn.com.glsx.cdp.modules.model; package cn.com.glsx.cdp.modules.model.user;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
...@@ -10,6 +11,7 @@ import javax.validation.constraints.NotBlank; ...@@ -10,6 +11,7 @@ import javax.validation.constraints.NotBlank;
@Data @Data
public class UserBO { public class UserBO {
@Schema(description = "用户id")
private Long id; private Long id;
@NotBlank @NotBlank
......
package cn.com.glsx.cdp.modules.model; package cn.com.glsx.cdp.modules.model.user;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
/** /**
...@@ -10,6 +11,7 @@ public class UserDTO { ...@@ -10,6 +11,7 @@ public class UserDTO {
private Long id; private Long id;
@Schema(description = "用户id")
private String account; private String account;
private String username; private String username;
......
package cn.com.glsx.cdp.modules.model; package cn.com.glsx.cdp.modules.model.user;
import cn.hutool.db.Page; import cn.hutool.db.Page;
import lombok.Data; import lombok.Data;
......
...@@ -50,6 +50,33 @@ ...@@ -50,6 +50,33 @@
<artifactId>rpc-scrm-proxy-api</artifactId> <artifactId>rpc-scrm-proxy-api</artifactId>
<version>3.7.0-SNAPSHOT</version> <version>3.7.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.6.11</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-redis</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -12,5 +12,6 @@ import com.glsx.plat.core.constant.BasicConstants; ...@@ -12,5 +12,6 @@ import com.glsx.plat.core.constant.BasicConstants;
public final class Constants extends BasicConstants { public final class Constants extends BasicConstants {
public final static String SERVER_NAME = "glsx_rest_admin"; public final static String SERVER_NAME = "glsx_rest_admin";
public final static String DEFAULT_UPDATED_BY = "system";
public final static String ONEID_PREFIX = "cdp";
} }
package cn.com.glsx.cdp.common.constant;
public class ModelConstants {
public final static String CUSTOMER_MODEL_NAME = "cdp_customer";
public final static String CAR_MODEL_NAME = "cdp_car";
public final static String CUSTOMER_CAR_RELATION_MODEL_NAME = "cdp_customer_car_relation";
}
package cn.com.glsx.cdp.common.constant;
public class ModelFieldConstants {
public final static String ORGID = "org_id";
public final static String ADD_WAY = "add_way";
public final static String EX_JSON = "ex_json";
}
package cn.com.glsx.cdp.common.constant;
public class OneIdConfigConstatns {
public static final String DEFAULT_CONFIG_ORG_ID = "-1";
}
package cn.com.glsx.cdp.common.constant;
public class RedisKeyConstants {
public static final String MODEL_LIST_STRING = "cdp_model_list_str";
}
package cn.com.glsx.cdp.common.distributeLock;
import com.alibaba.nacos.api.config.annotation.NacosValue;
import lombok.extern.slf4j.Slf4j;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.integration.redis.util.RedisLockRegistry;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
@Slf4j
@Component
public class DistributeLockMethodInterceptor implements MethodInterceptor {
@Autowired
private RedisConnectionFactory redisConnectionFactory;
private RedisLockRegistry lockRegistry;
@NacosValue(value = "${distributeLock.timeout.seconds:10}", autoRefreshed = true)
private Integer globalLockSecondsTime;
private static final Integer DEFAULT_LOCK_TIMEOUT_SECONDS = 10;
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
if (lockRegistry == null) {
lockRegistry = new RedisLockRegistry(redisConnectionFactory, "lock");
}
String className = invocation.getThis().getClass().getName();
String methodName = invocation.getMethod().getName();
GlsxDistributeLockable axLockable = invocation.getThis().getClass().getMethod(invocation.getMethod().getName(), invocation.getMethod().getParameterTypes()).getAnnotation(GlsxDistributeLockable.class);
if (StringUtils.isBlank(axLockable.name())) {
throw new RuntimeException(MessageFormat.format("{0}.{1} @GlsxDistributeLockable name not has config", className, methodName));
} else {
int time = axLockable.time();
TimeUnit timeUnit = axLockable.timeUnit();
log.info("globalLockSecondsTime:{}", globalLockSecondsTime);
globalLockSecondsTime = Optional.ofNullable(globalLockSecondsTime).orElse(DEFAULT_LOCK_TIMEOUT_SECONDS);
if (time < 0 && globalLockSecondsTime != null && globalLockSecondsTime > 0) {
time = globalLockSecondsTime;
timeUnit = TimeUnit.SECONDS;
}
if (time <= 0) {
Object result = invocation.proceed();
return result;
} else {
String threadName = Thread.currentThread().getName();
String lockName = this.parseKey(axLockable.name(), invocation.getMethod(), invocation.getArguments());
Lock lock = this.lockRegistry.obtain(lockName);
log.info("{}.{},lockName:{},threadName:{}, time:{},timeUnit:{} try to Lock.", new Object[]{className, methodName, lockName, threadName, time, timeUnit});
boolean isLock = lock.tryLock((long)time, timeUnit);
log.info("{}.{},lockName:{},threadName:{},time:{},timeUnit:{} try to Lock result:{}", new Object[]{className, methodName, lockName, threadName, time, timeUnit, isLock});
if (!isLock) {
Throwable throwable = (Throwable)axLockable.timeoutException().newInstance();
Field detailMessage = FieldUtils.getField(throwable.getClass(), "detailMessage", true);
detailMessage.set(throwable, MessageFormat.format("{0}.{1},lockName:{2},threadName:{3} get lock timeout in {4} {5}.", className, methodName, lockName, threadName, time, timeUnit.name()));
throw throwable;
} else {
Object var11;
try {
var11 = invocation.proceed();
} finally {
lock.unlock();
log.info("{}.{},lockName:{},threadName:{},time:{},timeUnit:{} unlock", new Object[]{className, methodName, lockName, threadName, time, timeUnit});
}
return var11;
}
}
}
}
private String parseKey(String key, Method method, Object[] args) {
if (StringUtils.isEmpty(key)) {
return null;
} else if (key.indexOf("#") == -1) {
return key;
} else {
LocalVariableTableParameterNameDiscoverer u = new LocalVariableTableParameterNameDiscoverer();
String[] paraNameArr = u.getParameterNames(method);
if (paraNameArr != null && paraNameArr.length != 0) {
ExpressionParser parser = new SpelExpressionParser();
StandardEvaluationContext context = new StandardEvaluationContext();
for(int i = 0; i < paraNameArr.length; ++i) {
context.setVariable(paraNameArr[i], args[i]);
}
Expression e = parser.parseExpression(key);
return (String)e.getValue(context, String.class);
} else {
return key;
}
}
}
}
package cn.com.glsx.cdp.common.distributeLock;
public class GetLockTimeoutException extends Exception {
private static final long serialVersionUID = -1227993606335097450L;
public GetLockTimeoutException() {
}
public GetLockTimeoutException(String message) {
super(message);
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.common.distributeLock;
import java.lang.annotation.*;
import java.util.concurrent.TimeUnit;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface GlsxDistributeLockable {
String name() default "";
int time() default -1;
TimeUnit timeUnit() default TimeUnit.SECONDS;
Class<? extends Throwable> timeoutException() default GetLockTimeoutException.class;
}
package cn.com.glsx.cdp.config;
import cn.com.glsx.cdp.common.distributeLock.DistributeLockMethodInterceptor;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class InteceptorConfig {
@Autowired
private DistributeLockMethodInterceptor distributeLockMethodInterceptor;
@Bean
public DefaultPointcutAdvisor glsxDistributeLockAdvisor(){
DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor();
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
pointcut.setExpression("@annotation(cn.com.glsx.cdp.common.distributeLock.GlsxDistributeLockable)");
advisor.setPointcut(pointcut);
advisor.setAdvice(distributeLockMethodInterceptor);
return advisor;
}
}
package cn.com.glsx.cdp.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitMQConfig {
public static final String DATA_REPORT_QUEUE_NAME = "dataReport_queue";
public static final String DATA_REPORT_EXCHANGE_NAME = "dataReport_exchange";
public static final String DATA_REPORT_TOPIC = "dataReport.#";
@Bean(name = "dataReportQueue")
public Queue dataReportQueue(){
return new Queue(DATA_REPORT_QUEUE_NAME, true);
}
@Bean(name = "dataReportTopicExchange")
public TopicExchange dataReportTopicExchange(){
return new TopicExchange(DATA_REPORT_EXCHANGE_NAME);
}
@Bean
public Binding bindingDataReport(@Qualifier("dataReportQueue") Queue dataReportQueue,
@Qualifier("dataReportTopicExchange") TopicExchange dataReportTopicExchange){
return BindingBuilder.bind(dataReportQueue).to(dataReportTopicExchange).with(DATA_REPORT_TOPIC);
}
}
...@@ -65,6 +65,7 @@ public class WebConfig implements WebMvcConfigurer { ...@@ -65,6 +65,7 @@ public class WebConfig implements WebMvcConfigurer {
.excludePathPatterns("/login") .excludePathPatterns("/login")
.excludePathPatterns("/actuator/**") .excludePathPatterns("/actuator/**")
.excludePathPatterns("/api/**") .excludePathPatterns("/api/**")
.excludePathPatterns("/sop/**")
.excludePathPatterns(uploadProperties.getFilepath()) .excludePathPatterns(uploadProperties.getFilepath())
.excludePathPatterns("/swagger-resources/**", "/swagger-ui/**", "/v3/**", "/doc.html"); .excludePathPatterns("/swagger-resources/**", "/swagger-ui/**", "/v3/**", "/doc.html");
registry.addInterceptor(logInterceptor).addPathPatterns("/**"); registry.addInterceptor(logInterceptor).addPathPatterns("/**");
......
...@@ -3,7 +3,7 @@ package cn.com.glsx.cdp.modules.api; ...@@ -3,7 +3,7 @@ package cn.com.glsx.cdp.modules.api;
import cn.com.glsx.cdp.api.UserCenterFeignClient; import cn.com.glsx.cdp.api.UserCenterFeignClient;
import cn.com.glsx.cdp.modules.converter.UserConverter; import cn.com.glsx.cdp.modules.converter.UserConverter;
import cn.com.glsx.cdp.modules.entity.User; import cn.com.glsx.cdp.modules.entity.User;
import cn.com.glsx.cdp.modules.model.UserDTO; import cn.com.glsx.cdp.modules.model.user.UserDTO;
import cn.com.glsx.cdp.modules.service.UserDemoService; import cn.com.glsx.cdp.modules.service.UserDemoService;
import cn.com.glsx.echocenter.api.EchoCenterFeignClient; import cn.com.glsx.echocenter.api.EchoCenterFeignClient;
import com.glsx.plat.core.annotation.ResponseResultBody; import com.glsx.plat.core.annotation.ResponseResultBody;
...@@ -11,7 +11,6 @@ import com.glsx.plat.core.web.Result; ...@@ -11,7 +11,6 @@ import com.glsx.plat.core.web.Result;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -38,7 +37,7 @@ public class UserApiController implements UserCenterFeignClient { ...@@ -38,7 +37,7 @@ public class UserApiController implements UserCenterFeignClient {
@Operation(summary = "FeignClient调用") @Operation(summary = "FeignClient调用")
@Override @Override
@GetMapping("/echo") @GetMapping("/echo")
public String echo(@RequestParam String message) { public String echo(@RequestParam("message") String message) {
String echo = echoCenterFeignClient.echo(message); String echo = echoCenterFeignClient.echo(message);
return echo; return echo;
} }
......
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.*;
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.enums.SysConstants;
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.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Tag(name = "客户sop旅程")
@RestController
@RequestMapping(value = "/sop/api/customerSopJourney")
@ResponseResultBody
public class CustomerSopJourneyController implements CustomerSopJourneyFeignClient {
@Autowired
private CustomerSopJourneyService customerSopJourneyService;
@Operation(description = "分页查询客户旅程信息")
@PostMapping("/page")
@Override
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(@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);
}
@Operation(description = "修改客户旅程")
@PostMapping("/sopJourneyStage/modify")
@Override
public Result<Boolean> modifyStage(ModifySopJourneyStageRequest request) {
log.info("修改客户旅程:{}", request);
try {
customerSopJourneyService.modifyStage(request);
} catch (Exception e) {
log.error("修改客户旅程失败", e);
String msg = e != null && e.getMessage() != null ? e.getMessage() : "";
return Result.failure(SysConstants.ResultStatus.failure.getCode(), "修改客户旅程失败:" + msg);
}
log.info("修改客户旅程成功");
return Result.success(true);
}
@Operation(description = "查询客户旅程客户统计数据")
@PostMapping("/statistics")
@Override
public Result<List<CustomerSopJourneyStatisticsDTO>> statisticsCustomerSopJourney(@RequestBody CustomerSopJourneySearch request) {
CustomerSopJourneyBO requestBO = CommonUtils.convertRequest(request, CustomerSopJourneyBO.class);
try {
return Result.success(customerSopJourneyService.statistics(requestBO));
} catch (Exception e) {
return Result.failure(SysConstants.ResultStatus.failure.getCode(), e.getMessage());
}
}
}
...@@ -3,9 +3,9 @@ package cn.com.glsx.cdp.modules.controller; ...@@ -3,9 +3,9 @@ package cn.com.glsx.cdp.modules.controller;
import cn.com.glsx.cdp.modules.BaseController; import cn.com.glsx.cdp.modules.BaseController;
import cn.com.glsx.cdp.modules.converter.UserConverter; import cn.com.glsx.cdp.modules.converter.UserConverter;
import cn.com.glsx.cdp.modules.entity.User; import cn.com.glsx.cdp.modules.entity.User;
import cn.com.glsx.cdp.modules.model.UserBO; import cn.com.glsx.cdp.modules.model.user.UserBO;
import cn.com.glsx.cdp.modules.model.UserDTO; import cn.com.glsx.cdp.modules.model.user.UserDTO;
import cn.com.glsx.cdp.modules.model.UserSearch; import cn.com.glsx.cdp.modules.model.user.UserSearch;
import cn.com.glsx.cdp.modules.service.UserDemoService; import cn.com.glsx.cdp.modules.service.UserDemoService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
......
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.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface CarMaintenanceInsuranceBOConvert {
CarMaintenanceInsuranceBOConvert INSTANCE = Mappers.getMapper(CarMaintenanceInsuranceBOConvert.class);
@Mappings({
@Mapping(source = "car",target = "."),
})
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"),
@Mapping(source = "carMaintenanceInsurances",target = "carMaintenanceInsurances"),
})
CustomerSopJourneyDetailDTO toCustomerSopJourneyDetailDTO(CustomerSopJourneyBO sourceEntity);
}
package cn.com.glsx.cdp.modules.converter;
import cn.com.glsx.cdp.modules.model.OneIdFieldConfigDTO;
import cn.com.glsx.cdp.modules.model.OneIdMappingDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface OneIdMappingDTOConvert {
OneIdMappingDTOConvert INSTANCE = Mappers.getMapper(OneIdMappingDTOConvert.class);
@Mappings({
@Mapping(target = "id", ignore = true),
@Mapping(source = "oneId", target = "oneId"),
@Mapping(source = "updatedBy", target = "updatedBy"),
@Mapping(source = "updatedBy", target = "createdBy")
})
OneIdMappingDTO fromOneIdFieldConfig(String oneId, OneIdFieldConfigDTO oneIdFieldConfigDTO, String updatedBy);
}
package cn.com.glsx.cdp.modules.converter; package cn.com.glsx.cdp.modules.converter;
import cn.com.glsx.cdp.modules.model.UserBO; import cn.com.glsx.cdp.modules.model.user.UserBO;
import cn.com.glsx.cdp.modules.model.UserDTO; import cn.com.glsx.cdp.modules.model.user.UserDTO;
import cn.com.glsx.cdp.modules.entity.User; import cn.com.glsx.cdp.modules.entity.User;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
...@@ -24,10 +24,10 @@ public interface UserConverter { ...@@ -24,10 +24,10 @@ public interface UserConverter {
User dto2do(UserDTO userDTO); User dto2do(UserDTO userDTO);
@Mappings(@Mapping(source = "realname", target = "realName")) @Mappings({@Mapping(source = "realname", target = "realName")})
UserBO do2bo(User user); UserBO do2bo(User user);
@Mappings(@Mapping(source = "realName", target = "realname")) @Mappings({@Mapping(source = "realName", target = "realname")})
User bo2do(UserBO userBO); User bo2do(UserBO userBO);
} }
package cn.com.glsx.cdp.modules.enums;
public enum ModelFieldUnionRuleEnum {
LAST_PRO((byte)1, "最后一次入库优先"),
FIRST_PRO((byte)2,"第一次入库优先"),
MIN_TIME_PRO((byte)3,"时间最小优先"),
MAX_TIME_PRO((byte)4, "时间最大优先");
private final Byte value;
private final String displayText;
ModelFieldUnionRuleEnum(Byte value, String displayText){
this.value = value;
this.displayText = displayText;
}
public Byte getValue() {
return value;
}
public String getDisplayText() {
return displayText;
}
public static ModelFieldUnionRuleEnum getByValue(Byte value){
if (value != null) {
for (ModelFieldUnionRuleEnum modelFieldUnionRuleEnum : ModelFieldUnionRuleEnum.values()) {
if (modelFieldUnionRuleEnum.getValue().equals(value)) {
return modelFieldUnionRuleEnum;
}
}
}
return null;
}
}
package cn.com.glsx.cdp.modules.enums;
import org.apache.commons.lang.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public enum OneIdBelongEnum {
CUSTOMER((byte)1, "one_id", "cdp_customer", "客户"),
CAR((byte)2, "car_id", "cdp_car", "车");
private final Byte value;
private final String oneIdFieldName;
private final String modelName;
private final String displayText;
OneIdBelongEnum(Byte value, String oneIdFieldName, String modelName, String displayText){
this.value = value;
this.oneIdFieldName = oneIdFieldName;
this.modelName = modelName;
this.displayText = displayText;
}
public Byte getValue() {
return value;
}
public String getOneIdFieldName() {
return oneIdFieldName;
}
public String getModelName() {
return modelName;
}
public String getDisplayText() {
return displayText;
}
public static OneIdBelongEnum getByValue(Byte value){
if (value != null) {
for (OneIdBelongEnum oneIdBelongEnum : OneIdBelongEnum.values()) {
if (oneIdBelongEnum.getValue().equals(value)) {
return oneIdBelongEnum;
}
}
}
return null;
}
public static List<String> getModelNames(){
return Arrays.stream(OneIdBelongEnum.values()).map(OneIdBelongEnum::getModelName).collect(Collectors.toList());
}
public static List<String> getOneIdFieldNames(){
return Arrays.stream(OneIdBelongEnum.values()).map(OneIdBelongEnum::getOneIdFieldName).collect(Collectors.toList());
}
public static OneIdBelongEnum getByModelName(String modelName){
if (StringUtils.isNotBlank(modelName)) {
for (OneIdBelongEnum oneIdBelongEnum : OneIdBelongEnum.values()) {
if (oneIdBelongEnum.getModelName().equals(modelName)) {
return oneIdBelongEnum;
}
}
}
return null;
}
public static OneIdBelongEnum getByOneIdFieldName(String oneIdFieldName){
if (StringUtils.isNotBlank(oneIdFieldName)) {
for (OneIdBelongEnum oneIdBelongEnum : OneIdBelongEnum.values()) {
if (oneIdBelongEnum.getOneIdFieldName().equals(oneIdFieldName)) {
return oneIdBelongEnum;
}
}
}
return null;
}
}
package cn.com.glsx.cdp.modules.enums;
public enum OneIdBusinessTypeEnum {
CUSTOMER((byte)1, "客户"),
CAR((byte)2,"车");
private final Byte value;
private final String displayText;
OneIdBusinessTypeEnum(Byte value, String displayText){
this.value = value;
this.displayText = displayText;
}
public Byte getValue() {
return value;
}
public String getDisplayText() {
return displayText;
}
public static OneIdBusinessTypeEnum getByValue(Byte value){
if (value != null) {
for (OneIdBusinessTypeEnum temp : OneIdBusinessTypeEnum.values()) {
if (temp.getValue().equals(value)) {
return temp;
}
}
}
return null;
}
}
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 \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.Car;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
public interface CarMapper extends CommonBaseMapper<Car> {
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.CustomerCarRelation;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
public interface CustomerCarRelationMapper extends CommonBaseMapper<CustomerCarRelation> {
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.CustomerEvent;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
public interface CustomerEventMapper extends CommonBaseMapper<CustomerEvent> {
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.Customer;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
public interface CustomerMapper extends CommonBaseMapper<Customer> {
}
\ No newline at end of file \ 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 cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyStatisticsDTO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface CustomerSopJourneyMapper extends CommonBaseMapper<CustomerSopJourney> {
List<CustomerSopJourneyBO> listCustomerSopJourney(CustomerSopJourneyBO customerSopJourneyBO);
List<CustomerSopJourneyStatisticsDTO> statisticsCustomerSopJourney(CustomerSopJourneyBO request);
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.Field;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
public interface FieldMapper extends CommonBaseMapper<Field> {
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.ModelFieldMapping;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
public interface ModelFieldMappingMapper extends CommonBaseMapper<ModelFieldMapping> {
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.Model;
import cn.com.glsx.cdp.modules.model.ModelDTO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface ModelMapper extends CommonBaseMapper<Model> {
List<ModelDTO> list(ModelDTO modelDTO);
List<Map<String, Object>> listMap(String sql);
void insertTable(String sql);
void updateTable(String sql);
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.OneIdFieldConfig;
import cn.com.glsx.cdp.modules.model.OneIdFieldConfigDTO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface OneIdFieldConfigMapper extends CommonBaseMapper<OneIdFieldConfig> {
List<OneIdFieldConfigDTO> list(OneIdFieldConfigDTO oneIdFieldConfigDTO);
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.OneIdMapping;
import cn.com.glsx.cdp.modules.model.OneIdMappingDTO;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface OneIdMappingMapper extends CommonBaseMapper<OneIdMapping> {
List<OneIdMappingDTO> list(OneIdMappingDTO oneIdMappingDTO);
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.mapper; package cn.com.glsx.cdp.modules.mapper;
import cn.com.glsx.cdp.modules.entity.User; import cn.com.glsx.cdp.modules.entity.User;
import cn.com.glsx.cdp.modules.model.UserSearch; import cn.com.glsx.cdp.modules.model.user.UserSearch;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper; import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
......
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 String oneId;
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.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
public class FindOrCreateOneIdParam implements Serializable {
private static final long serialVersionUID = -2777667996290039105L;
// 组织ID
private String orgId;
// 业务类型1.客户 2.车辆
private Byte businessType;
// oneId字段json
private String oneIdFieldJson;
}
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.entity.Model;
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 ModelDTO extends Model {
private static final long serialVersionUID = 5059373947534630461L;
private List<ModelFieldMappingDTO> modelFieldMappings;
}
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.entity.ModelFieldMapping;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
public class ModelFieldMappingDTO extends ModelFieldMapping {
/**
* 字段名称
*/
private String fieldName;
/**
* 字段值
*/
private Object fieldValue;
}
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.enums.OneIdBelongEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
public class OneIdDTO {
// oneId类型
private OneIdBelongEnum oneIdBelongEnum;
private String oneId;
}
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.entity.OneIdFieldConfig;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
public class OneIdFieldConfigDTO extends OneIdFieldConfig {
private static final long serialVersionUID = 3839452358183537235L;
private String fieldValue;
private String oneIdBelongOrgId;
}
package cn.com.glsx.cdp.modules.model;
import cn.com.glsx.cdp.modules.entity.OneIdMapping;
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 OneIdMappingDTO extends OneIdMapping {
private static final long serialVersionUID = -7012176705275858210L;
private List<String> fieldNames;
private List<String> oneIds;
}
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.entity.CustomerSopJourney;
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.cdp.modules.model.customer.CustomerSopJourneyStatisticsDTO;
import cn.com.glsx.cdp.modules.model.customer.ModifySopJourneyStageRequest;
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 tk.mybatis.mapper.entity.Example;
import java.util.Arrays;
import java.util.Date;
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;
}
/**
* 修改客户旅程阶段
*
* @param request
* @return void
* @author caiym
* @date 2023年09月25日 15:56:13
*/
public void modifyStage(ModifySopJourneyStageRequest request) {
if (CollectionUtils.isEmpty(request.getOldStages())
&& CollectionUtils.isEmpty(request.getOneIds())) {
throw new RpcServiceException(DefaultErrorEnum.DATA_INVALID, "客户旅程阶段和oneId不能同时为空");
}
Example example = new Example(CustomerSopJourney.class);
Example.Criteria criteria = example.createCriteria().andEqualTo("orgId", request.getOrgId()).andEqualTo("sopJourneyId", request.getSopJourneyId()).andEqualTo("delFlag", 0);
if (CollectionUtils.isNotEmpty(request.getOldStages())) {
criteria.andIn("sopJourneyStage", request.getOldStages());
}
if (CollectionUtils.isNotEmpty(request.getOneIds())) {
criteria.andIn("oneId", request.getOneIds());
}
CustomerSopJourney customerSopJourney = CustomerSopJourney.builder().sopJourneyStage(request.getSopJourneyStage()).sopJourneyStageEnterTime(new Date())
.updatedBy(request.getOprBy()).updatedTime(new Date()).build();
customerSopJourneyMapper.updateByExampleSelective(customerSopJourney, example);
}
public List<CustomerSopJourneyStatisticsDTO> statistics(CustomerSopJourneyBO request) {
try {
return customerSopJourneyMapper.statisticsCustomerSopJourney(request);
} 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.common.constant.RedisKeyConstants;
import cn.com.glsx.cdp.modules.mapper.ModelMapper;
import cn.com.glsx.cdp.modules.model.ModelDTO;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.alibaba.nacos.api.config.annotation.NacosValue;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class ModelService {
@Autowired
private ModelMapper modelMapper;
@Autowired
private RedisTemplate redisTemplate;
@NacosValue(value = "${cache.minute.model.list}", autoRefreshed = true)
private Long modelListCacheMinute;
public List<ModelDTO> listAllModels(){
try{
BoundValueOperations valueOps = redisTemplate.boundValueOps(RedisKeyConstants.MODEL_LIST_STRING);
// 先尝试从缓存中获取数据
List<ModelDTO> cachedList = (List<ModelDTO>) valueOps.get();
if (CollectionUtils.isNotEmpty(cachedList)) {
log.info("listModels, get data from redis cache");
return cachedList;
}
List<ModelDTO> list = modelMapper.list(null);
if (CollectionUtils.isNotEmpty(list)) {
valueOps.set(list, Optional.ofNullable(modelListCacheMinute).orElse(60L), TimeUnit.MINUTES);
}
return list;
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
public List<Map<String, Object>> listMap(String sql){
try{
return modelMapper.listMap(sql);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void insertTable(String sql){
try{
modelMapper.insertTable(sql);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void updateTable(String sql){
try{
modelMapper.updateTable(sql);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
public Map<String, Object> findModelData(String modelName, String oneIdFieldName, String oneId){
StringBuilder sqlStrBuilder = new StringBuilder();
sqlStrBuilder.append("select * from ").append(modelName).append(" where ").append(oneIdFieldName).append(" = '").append(oneId).append("'").append(" and del_flag = 0");
List<Map<String, Object>> listMap = listMap(sqlStrBuilder.toString());
if (CollectionUtils.isNotEmpty(listMap)) {
return listMap.get(0);
}
return null;
}
}
package cn.com.glsx.cdp.modules.service;
import cn.com.glsx.cdp.modules.mapper.OneIdFieldConfigMapper;
import cn.com.glsx.cdp.modules.model.OneIdFieldConfigDTO;
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 OneIdFieldConfigService {
@Autowired
private OneIdFieldConfigMapper oneIdFieldConfigMapper;
public List<OneIdFieldConfigDTO> list(OneIdFieldConfigDTO oneIdFieldConfigDTO){
try{
return oneIdFieldConfigMapper.list(oneIdFieldConfigDTO);
} 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.common.constant.Constants;
import cn.com.glsx.cdp.modules.converter.OneIdMappingDTOConvert;
import cn.com.glsx.cdp.modules.mapper.OneIdMappingMapper;
import cn.com.glsx.cdp.modules.model.OneIdFieldConfigDTO;
import cn.com.glsx.cdp.modules.model.OneIdMappingDTO;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
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.Date;
import java.util.List;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class OneIdMappingService {
@Autowired
private OneIdMappingMapper oneIdMappingMapper;
public List<OneIdMappingDTO> list(OneIdMappingDTO oneIdMappingDTO){
try{
return oneIdMappingMapper.list(oneIdMappingDTO);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RpcServiceException(DefaultErrorEnum.DATABASE_ERROR);
}
}
public OneIdMappingDTO getOneIdMapping(String orgId, Byte businessType, String fieldName, String fieldValue){
OneIdMappingDTO oneIdMappingDTO = OneIdMappingDTO.builder().orgId(orgId)
.businessType(businessType)
.fieldName(fieldName)
.fieldValue(fieldValue).build();
List<OneIdMappingDTO> list = list(oneIdMappingDTO);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(0);
}
return null;
}
@Transactional(propagation= Propagation.REQUIRED,rollbackFor=RpcServiceException.class)
public void saveOneIdMapping(String oneId, OneIdFieldConfigDTO oneIdFieldConfigDTO){
log.info("saveOneIdMapping, oneId:{}, oneIdFieldConfigDTO:{}", oneId, oneIdFieldConfigDTO);
RpcAssert.assertNotNull(oneIdFieldConfigDTO, DefaultErrorEnum.DATA_NULL,"oneIdFieldConfigDTO not be null");
RpcAssert.assertNotNull(oneIdFieldConfigDTO.getOneIdBelongOrgId(), DefaultErrorEnum.DATA_NULL,"oneIdFieldConfigDTO.getOneIdBelongOrgId() not be null");
RpcAssert.assertNotNull(oneIdFieldConfigDTO.getBusinessType(), DefaultErrorEnum.DATA_NULL,"oneIdFieldConfigDTO.getBusinessType() not be null");
RpcAssert.assertNotEmpty(oneIdFieldConfigDTO.getFieldName(), DefaultErrorEnum.DATA_NULL,"oneIdFieldConfigDTO.getFieldName() not be empty");
RpcAssert.assertNotEmpty(oneIdFieldConfigDTO.getFieldValue(), DefaultErrorEnum.DATA_NULL,"oneIdFieldConfigDTO.getFieldValue() not be empty");
RpcAssert.assertNotEmpty(oneId, DefaultErrorEnum.DATA_NULL,"oneId not be empty");
OneIdMappingDTO record = OneIdMappingDTOConvert.INSTANCE.fromOneIdFieldConfig(oneId, oneIdFieldConfigDTO, Constants.DEFAULT_UPDATED_BY);
record.setOrgId(oneIdFieldConfigDTO.getOneIdBelongOrgId());
record.setCreatedTime(new Date());
record.setUpdatedTime(record.getCreatedTime());
try{
oneIdMappingMapper.insertSelective(record);
} 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.common.constant.Constants;
import cn.com.glsx.cdp.common.constant.OneIdConfigConstatns;
import cn.com.glsx.cdp.common.distributeLock.GlsxDistributeLockable;
import cn.com.glsx.cdp.modules.model.FindOrCreateOneIdParam;
import cn.com.glsx.cdp.modules.model.OneIdFieldConfigDTO;
import cn.com.glsx.cdp.modules.model.OneIdMappingDTO;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import com.alibaba.fastjson.JSONObject;
import com.glsx.plat.redis.service.GainIdService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class OneIdService {
@Autowired
private OneIdMappingService oneIdMappingService;
@Autowired
private OneIdFieldConfigService oneIdFieldConfigService;
@Lazy
@Autowired
private OneIdService thiz;
@Autowired
private GainIdService gainIdService;
/**
* 查找或创建oneId
*
* @param param
* @return java.lang.String
* @author caiym
* @date 2023年09月21日 16:07:51
*/
public String findOrCreateOneId(FindOrCreateOneIdParam param){
log.info("findOrCreateOneId, param:{}", param);
RpcAssert.assertNotNull(param, DefaultErrorEnum.DATA_NULL,"param not be null");
RpcAssert.assertNotNull(param.getOrgId(), DefaultErrorEnum.DATA_NULL,"param.getOrgId() not be null");
RpcAssert.assertNotNull(param.getBusinessType(), DefaultErrorEnum.DATA_NULL,"param.getBusinessType() not be null");
RpcAssert.assertNotEmpty(param.getOneIdFieldJson(), DefaultErrorEnum.DATA_NULL,"param.getOneIdFieldJson() not be empty");
List<OneIdFieldConfigDTO> readyMatchOneIdFieldConfigs = getReadyMatchOneIdFieldConfigs(param);
String finalOneId = null;
if (CollectionUtils.isNotEmpty(readyMatchOneIdFieldConfigs)) {
for (OneIdFieldConfigDTO readyMatchOneIdFieldConfig : readyMatchOneIdFieldConfigs) {
finalOneId = thiz.findOrCreateOneId(finalOneId, readyMatchOneIdFieldConfig);
}
log.info("findOrCreateOneId, finalOneId:{}", finalOneId);
return finalOneId;
}else{
log.error("none match oneId field config, param: {}", JSONObject.toJSONString(param));
}
return null;
}
/**
* 查找或创建oneId
*
* @param finalOneId
* @param oneIdFieldConfig
* @return java.lang.String
* @author caiym
* @date 2023年09月21日 16:53:44
*/
@GlsxDistributeLockable(name = "'OneIdService_findOrCreateOneId_' + #oneIdFieldConfig.oneIdBelongOrgId + '_' + #oneIdFieldConfig.businessType + '_' + #oneIdFieldConfig.fieldName + '_' + #oneIdFieldConfig.fieldValue", time = 10, timeoutException = RpcServiceException.class)
public String findOrCreateOneId(String finalOneId, OneIdFieldConfigDTO oneIdFieldConfig){
log.info("findOrCreateOneId,finalOneId:{},fieldName:{}", oneIdFieldConfig.getFieldName());
OneIdMappingDTO oneIdMapping = oneIdMappingService.getOneIdMapping(oneIdFieldConfig.getOneIdBelongOrgId(),
oneIdFieldConfig.getBusinessType(), oneIdFieldConfig.getFieldName(),
oneIdFieldConfig.getFieldValue());
if (oneIdMapping == null) {
if (StringUtils.isBlank(finalOneId)) {
log.info("generate new oneId,fieldName:{}", oneIdFieldConfig.getFieldName());
finalOneId = gainIdService.globalUniqueId(Constants.ONEID_PREFIX);
}
oneIdMappingService.saveOneIdMapping(finalOneId, oneIdFieldConfig);
}else if (StringUtils.isBlank(finalOneId)) {
finalOneId = oneIdMapping.getOneId();
}
return finalOneId;
}
/**
* 获取准备匹配的oneId字段配置
*
* @param param
* @return java.util.List<cn.com.glsx.cdp.modules.model.OneIdFieldConfigDTO>
* @author caiym
* @date 2023年09月21日 15:27:53
*/
private List<OneIdFieldConfigDTO> getReadyMatchOneIdFieldConfigs(FindOrCreateOneIdParam param) {
JSONObject oneIdField = JSONObject.parseObject(param.getOneIdFieldJson());
OneIdFieldConfigDTO oneIdFieldConfigDTO = OneIdFieldConfigDTO.builder().orgId(param.getOrgId()).businessType(param.getBusinessType()).build();
List<OneIdFieldConfigDTO> oneIdFieldConfigDTOS = oneIdFieldConfigService.list(oneIdFieldConfigDTO);
if (CollectionUtils.isEmpty(oneIdFieldConfigDTOS)) {
log.info("not fund org oneId field config, try find default, orgId:{}", param.getOrgId());
oneIdFieldConfigDTO.setOrgId(OneIdConfigConstatns.DEFAULT_CONFIG_ORG_ID);
oneIdFieldConfigDTOS = oneIdFieldConfigService.list(oneIdFieldConfigDTO);
if (CollectionUtils.isEmpty(oneIdFieldConfigDTOS)) {
throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, "not fund default oneId field config, orgId: " + param.getOrgId() + ", businessType: " + param.getBusinessType());
}
}
oneIdFieldConfigDTOS = oneIdFieldConfigDTOS.stream()
.filter(o -> oneIdField.containsKey(o.getFieldName()))
.map(o -> {
o.setFieldValue(oneIdField.getString(o.getFieldName()));
o.setOneIdBelongOrgId(param.getOrgId());
return o;
})
.sorted(Comparator.comparing(OneIdFieldConfigDTO::getPriority))
.collect(Collectors.toList());
return oneIdFieldConfigDTOS;
}
}
...@@ -3,8 +3,8 @@ package cn.com.glsx.cdp.modules.service; ...@@ -3,8 +3,8 @@ package cn.com.glsx.cdp.modules.service;
import cn.com.glsx.cdp.modules.converter.UserConverter; import cn.com.glsx.cdp.modules.converter.UserConverter;
import cn.com.glsx.cdp.modules.entity.User; import cn.com.glsx.cdp.modules.entity.User;
import cn.com.glsx.cdp.modules.mapper.UserMapper; import cn.com.glsx.cdp.modules.mapper.UserMapper;
import cn.com.glsx.cdp.modules.model.UserDTO; import cn.com.glsx.cdp.modules.model.user.UserDTO;
import cn.com.glsx.cdp.modules.model.UserSearch; import cn.com.glsx.cdp.modules.model.user.UserSearch;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.plat.common.utils.ObjectUtils; import com.glsx.plat.common.utils.ObjectUtils;
import com.glsx.plat.common.utils.StringUtils; import com.glsx.plat.common.utils.StringUtils;
...@@ -86,8 +86,6 @@ public class UserDemoService { ...@@ -86,8 +86,6 @@ public class UserDemoService {
public int editUser(User user) { public int editUser(User user) {
String password = user.getPassword(); String password = user.getPassword();
//todo 更新入库
return 0; return 0;
} }
......
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 java.text.SimpleDateFormat;
import java.util.Date;
/**
* @Author yelq
* @Version 1.0
* @Description:
* @Date 2022/4/25 14:41
*/
public class DateUtil {
private static final String parten1="yyyy-MM-dd HH:mm:ss";
public static String DateTimeToString(Date date){
return new SimpleDateFormat(parten1).format(date);
}
public static void main(String[] args) {
System.out.println(new SimpleDateFormat(parten1).format(new Date()));
}
}
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 + "]";
}
}
...@@ -4,7 +4,7 @@ logging.path=/data/java_log/jetty/${spring.application.name}/${spring.applicatio ...@@ -4,7 +4,7 @@ logging.path=/data/java_log/jetty/${spring.application.name}/${spring.applicatio
spring.cloud.nacos.config.server-addr=192.168.0.63:8868 spring.cloud.nacos.config.server-addr=192.168.0.63:8868
spring.cloud.nacos.config.group=PLATFORM_GROUP spring.cloud.nacos.config.group=platform
spring.cloud.nacos.config.prefix=${spring.application.name} spring.cloud.nacos.config.prefix=${spring.application.name}
spring.profiles.active=dev spring.profiles.active=dev
spring.cloud.nacos.config.file-extension=properties spring.cloud.nacos.config.file-extension=properties
......
<?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="cn.com.glsx.cdp.modules.mapper.CarMaintenanceInsuranceMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.CarMaintenanceInsurance">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="car_id" jdbcType="VARCHAR" property="carId" />
<result column="car_maintenance_insurance_tag" jdbcType="VARCHAR" property="carMaintenanceInsuranceTag" />
<result column="car_ins_no" jdbcType="VARCHAR" property="carInsNo" />
<result column="car_cpy_ins_no" jdbcType="VARCHAR" property="carCpyInsNo" />
<result column="car_cpy_ins_start_time" jdbcType="TIMESTAMP" property="carCpyInsStartTime" />
<result column="car_cpy_ins_end_time" jdbcType="TIMESTAMP" property="carCpyInsEndTime" />
<result column="car_first_maintenance_date" jdbcType="TIMESTAMP" property="carFirstMaintenanceDate" />
<result column="car_last_maintenance_time" jdbcType="TIMESTAMP" property="carLastMaintenanceTime" />
<result column="car_previous_maintenance_date" jdbcType="TIMESTAMP" property="carPreviousMaintenanceDate" />
<result column="car_maintenance_notification_date" jdbcType="TIMESTAMP" property="carMaintenanceNotificationDate" />
<result column="car_maintenance_hour" jdbcType="VARCHAR" property="carMaintenanceHour" />
<result column="car_maintenance_amount" jdbcType="VARCHAR" property="carMaintenanceAmount" />
<result column="car_maintenance_time" jdbcType="INTEGER" property="carMaintenanceTime" />
<result column="car_maintenance_frequency" jdbcType="INTEGER" property="carMaintenanceFrequency" />
<result column="car_free_maintenance_time" jdbcType="INTEGER" property="carFreeMaintenanceTime" />
<result column="car_average_maintenance_day" jdbcType="VARCHAR" property="carAverageMaintenanceDay" />
<result column="car_sold_by_company" jdbcType="VARCHAR" property="carSoldByCompany" />
<result column="ex_json" jdbcType="LONGVARCHAR" property="exJson" />
<result column="add_way" jdbcType="VARCHAR" property="addWay" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<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
-->
id, org_id, car_id, car_maintenance_insurance_tag, car_ins_no, car_cpy_ins_no, car_cpy_ins_start_time, car_cpy_ins_end_time,
car_first_maintenance_date, car_last_maintenance_time, car_previous_maintenance_date,
car_maintenance_notification_date, car_maintenance_hour, car_maintenance_amount,
car_maintenance_time, car_maintenance_frequency, car_free_maintenance_time, car_average_maintenance_day,
car_sold_by_company, add_way, created_by, created_time, updated_by, updated_time,
del_flag
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
-->
ex_json
</sql>
<select id="listCarMaintenanceInsurance"
parameterType="cn.com.glsx.cdp.modules.model.CarMaintenanceInsuranceBO" resultMap="BOResultMap">
select
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,
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
from cdp_customer_car_relation cccr
left join cdp_car cc on cc.org_id = cccr.org_id and cc.car_id = cccr.car_id and cc.del_flag = '0'
left join cdp_car_maintenance_insurance ccmi on ccmi.car_id = cccr.car_id and cccr.org_id = ccmi.org_id and ccmi.del_flag = '0'
<where>
cccr.del_flag = 0
<if test="oneId != null">
and cccr.one_id = #{oneId}
</if>
<if test="oneIds != null and oneIds.size()>0">
and cccr.one_id in
<foreach collection="oneIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.CarMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.Car">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<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="ex_json" jdbcType="LONGVARCHAR" property="exJson" />
<result column="add_way" jdbcType="VARCHAR" property="addWay" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, org_id, car_id, car_number, car_vin, car_vin_six, car_engine_num, car_brand,
car_model, car_series, car_color, car_buy_date, car_price, car_seats_num, car_warranty_valid,
car_classification, car_nature, car_dealer, car_factory, car_register_date, car_model_year,
car_mileage, car_average_daily_mileage, add_way, created_by, created_time, updated_by,
updated_time, del_flag
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
-->
ex_json
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.CustomerCarRelationMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.CustomerCarRelation">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="one_id" jdbcType="VARCHAR" property="oneId" />
<result column="car_id" jdbcType="VARCHAR" property="carId" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, org_id, one_id, car_id, created_by, created_time, updated_by, updated_time, del_flag
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.CustomerEventMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.CustomerEvent">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="one_id" jdbcType="VARCHAR" property="oneId" />
<result column="event_time" jdbcType="TIMESTAMP" property="eventTime" />
<result column="event_type" jdbcType="VARCHAR" property="eventType" />
<result column="system_source" jdbcType="VARCHAR" property="systemSource" />
<result column="platform" jdbcType="CHAR" property="platform" />
<result column="extra" jdbcType="VARCHAR" property="extra" />
<result column="ex_json" jdbcType="LONGVARCHAR" property="exJson" />
<result column="add_way" jdbcType="VARCHAR" property="addWay" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, org_id, one_id, event_time, event_type, system_source, platform, extra, add_way,
created_by, created_time, updated_by, updated_time, del_flag
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
-->
ex_json
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.CustomerMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.Customer">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<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="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="add_way" jdbcType="VARCHAR" 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" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, org_id, one_id, customer_name, gender, birthday, age, customer_phone, customer_email,
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">
<!--
WARNING - @mbg.generated
-->
ex_json
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.CustomerSopJourneyMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.CustomerSopJourney">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="one_id" jdbcType="VARCHAR" property="oneId" />
<result column="sop_journey_id" jdbcType="VARCHAR" property="sopJourneyId" />
<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_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" />
<result column="ex_json" jdbcType="LONGVARCHAR" property="exJson" />
<result column="add_way" jdbcType="VARCHAR" property="addWay" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<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" extends="BaseResultMap">
<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="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="c_add_way" jdbcType="INTEGER" property="addWay" />
<result column="c_ex_json" jdbcType="LONGVARCHAR" property="exJson" />
</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_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>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
-->
ex_json
</sql>
<sql id="base_param" >
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="sopFollowUpPersonPhone != null and sopFollowUpPersonPhone != ''">
and csj.sop_follow_up_person_phone = #{sopFollowUpPersonPhone}
</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>
</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.wechat_id,
c.wechat_nickname, c.wechat_avatar_url, c.wechat_union_id,
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>
<include refid="base_param" />
</where>
</select>
<select id="statisticsCustomerSopJourney" parameterType="cn.com.glsx.cdp.modules.model.CustomerSopJourneyBO"
resultType="cn.com.glsx.cdp.modules.model.customer.CustomerSopJourneyStatisticsDTO">
select
csj.sop_journey_id as sopJourneyId,
csj.sop_journey_stage as sopJourneyStage,
count(csj.id) as count
from cdp_customer_sop_journey csj
left join cdp_customer c on csj.one_id = c.one_id and c.del_flag = 0
<where>
<include refid="base_param" />
</where>
group by csj.sop_journey_id, csj.sop_journey_stage
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.FieldMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.Field">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="field_index" jdbcType="INTEGER" property="fieldIndex" />
<result column="field_name" jdbcType="VARCHAR" property="fieldName" />
<result column="field_type" jdbcType="VARCHAR" property="fieldType" />
<result column="field_length" jdbcType="INTEGER" property="fieldLength" />
<result column="field_describe" jdbcType="VARCHAR" property="fieldDescribe" />
<result column="field_rule" jdbcType="VARCHAR" property="fieldRule" />
<result column="field_alias" jdbcType="VARCHAR" property="fieldAlias" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, field_index, field_name, field_type, field_length, field_describe, field_rule,
field_alias, remark, created_by, created_time, updated_by, updated_time, del_flag
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.ModelFieldMappingMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.ModelFieldMapping">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="model_name" jdbcType="VARCHAR" property="modelName" />
<result column="field_index" jdbcType="INTEGER" property="fieldIndex" />
<result column="union_rule" jdbcType="INTEGER" property="unionRule" />
<result column="model_flag" jdbcType="INTEGER" property="modelFlag" />
<result column="oneid_flag" jdbcType="BIT" property="oneidFlag" />
<result column="expand_flag" jdbcType="INTEGER" property="expandFlag" />
<result column="unique_flag" jdbcType="INTEGER" property="uniqueFlag" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, model_name, field_index, union_rule, model_flag, oneid_flag, expand_flag, unique_flag,
created_by, created_time, updated_by, updated_time, del_flag
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.ModelMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.Model">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="model_name" jdbcType="VARCHAR" property="modelName" />
<result column="event_flag" jdbcType="INTEGER" property="eventFlag" />
<result column="oneid_belong" jdbcType="TINYINT" property="oneidBelong" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<resultMap id="DTOResultMap" type="cn.com.glsx.cdp.modules.model.ModelDTO" extends="BaseResultMap">
<collection property="modelFieldMappings" ofType="cn.com.glsx.cdp.modules.model.ModelFieldMappingDTO">
<id column="cmfm_id" jdbcType="INTEGER" property="id" />
<result column="model_name" jdbcType="VARCHAR" property="modelName" />
<result column="field_index" jdbcType="INTEGER" property="fieldIndex" />
<result column="union_rule" jdbcType="INTEGER" property="unionRule" />
<result column="model_flag" jdbcType="BIT" property="modelFlag" />
<result column="oneid_flag" jdbcType="BIT" property="oneidFlag" />
<result column="expand_flag" jdbcType="BIT" property="expandFlag" />
<result column="unique_flag" jdbcType="BIT" property="uniqueFlag" />
<result column="field_name" jdbcType="VARCHAR" property="fieldName" />
</collection>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, model_name, event_flag, oneid_belong, remark, created_time, created_by, updated_time,
updated_by, del_flag
</sql>
<insert id="insertTable">
${sql}
</insert>
<update id="updateTable">
${sql}
</update>
<select id="list" parameterType="cn.com.glsx.cdp.modules.model.ModelDTO" resultMap="DTOResultMap">
select cm.id, cm.model_name, cm.event_flag, cm.oneid_belong, cm.remark, cm.created_time,
cm.created_by, cm.updated_time, cm.updated_by, cm.del_flag,
cmfm.id as cmfm_id, cmfm.field_index, cmfm.union_rule, cmfm.model_flag, cmfm.oneid_flag, cmfm.expand_flag, cmfm.unique_flag,
cf.field_name
from cdp_model cm
left join cdp_model_field_mapping cmfm on cm.model_name = cmfm.model_name and cmfm.del_flag = 0
left join cdp_field cf on cmfm.field_index = cf.field_index and cf.del_flag = 0
<where>
cm.del_flag = 0
</where>
</select>
<select id="listMap" resultType="java.util.Map">
${sql}
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.OneIdFieldConfigMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.OneIdFieldConfig">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="business_type" jdbcType="TINYINT" property="businessType" />
<result column="field_name" jdbcType="VARCHAR" property="fieldName" />
<result column="field_describe" jdbcType="VARCHAR" property="fieldDescribe" />
<result column="priority" jdbcType="TINYINT" property="priority" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, org_id, business_type, field_name, field_describe, priority, created_by, created_time,
updated_by, updated_time, del_flag
</sql>
<select id="list" resultType="cn.com.glsx.cdp.modules.model.OneIdFieldConfigDTO">
select <include refid="Base_Column_List"></include>
from cdp_oneid_field_config
<where>
del_flag = 0
<if test="orgId != null">
and org_id = #{orgId}
</if>
<if test="businessType != null">
and business_type = #{businessType}
</if>
</where>
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.cdp.modules.mapper.OneIdMappingMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.cdp.modules.entity.OneIdMapping">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="business_type" jdbcType="TINYINT" property="businessType" />
<result column="field_name" jdbcType="VARCHAR" property="fieldName" />
<result column="field_value" jdbcType="VARCHAR" property="fieldValue" />
<result column="one_id" jdbcType="VARCHAR" property="oneId" />
<result column="created_by" jdbcType="VARCHAR" property="createdBy" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, org_id, business_type, field_name, field_value, one_id, created_by, created_time,
updated_by, updated_time, del_flag
</sql>
<select id="list" resultType="cn.com.glsx.cdp.modules.model.OneIdMappingDTO">
select
<include refid="Base_Column_List" />
from cdp_oneid_mapping
<where>
del_flag = 0
<if test="orgId != null">
and org_id = #{orgId}
</if>
<if test="businessType != null">
and business_type = #{businessType}
</if>
<if test="fieldName != null">
and field_name = #{fieldName}
</if>
<if test="oneId != null">
and one_id = #{oneId}
</if>
<if test="fieldNames != null and fieldNames.size()>0">
and field_name in
<foreach collection="fieldNames" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="oneIds != null and oneIds.size()>0">
and one_id in
<foreach collection="oneIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="fieldValue != null">
and field_value = #{fieldValue}
</if>
</where>
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cdp.modules.queue;
import cn.com.glsx.Application;
import cn.com.glsx.cdp.config.RabbitMQConfig;
import com.alibaba.fastjson.JSONObject;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
class DataReportRabbitMQConsumerTest {
@Autowired
private DataReportRabbitMQConsumer dataReportRabbitMqConsumer;
@Autowired
private RabbitTemplate rabbitTemplate;
@Test
void processReportCustomerInfo() {
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 25; i < 27; i++) {
Map<String, Object> map = new HashMap<>();
map.put("org_id", "44211227");
map.put("add_way", "SOP");
map.put("customer_name", "天天"+i);
map.put("gender", "Male");
map.put("birthday", "1990-01-01");
map.put("age", "30");
map.put("customer_phone", "1380013800"+i);
map.put("customer_email", "1447777"+i+"7@qq.com");
map.put("id_number", "440101199001011234"+i);
map.put("address", "广东省深圳市南山区科技园北区"+i);
map.put("nationality", "中国");
// map.put("province", "广东省");
// map.put("city", "深圳市");
// map.put("region", "南山区");
map.put("marital_status", "Single");
map.put("occupation", "IT");
map.put("customer_annual_income", "100000");
map.put("customer_company", "腾讯");
map.put("education_level", "Master");
map.put("wechat_nickname", "ger"+i);
map.put("wechat_avatar_url", "http://www.baidu.com");
map.put("org_user_id", "1333113131"+i);
map.put("wechat_id", "wxid_123456789"+i);
map.put("wechat_union_id", "wxunionid_123456789"+i);
map.put("car_maintenance_insurance_tag", "在修不在保");
map.put("car_number", "粤B1245"+i);
map.put("car_vin", "12345678901234567"+i);
map.put("car_vin_six", "123456"+i);
map.put("car_brand", "奥迪");
map.put("car_engine_num", "12345678901234567"+i);
map.put("car_model", "A6");
map.put("car_series", "A6");
map.put("car_color", "白色");
map.put("car_buy_date", "2019-01-01");
map.put("car_price", "100000");
map.put("car_seats_num", "5");
map.put("car_warranty_valid", "2020-01-01");
map.put("car_classification", "轿车");
map.put("car_mileage", "10000");
map.put("car_average_daily_mileage", "100");
map.put("car_ins_no", "12345678901234567"+i);
map.put("car_cpy_ins_no", "12345678901234567"+i);
map.put("car_cpy_ins_start_time", "2019-01-01");
map.put("car_cpy_ins_end_time", "2020-01-01");
map.put("car_first_maintenance_date", "2019-01-01");
map.put("car_last_maintenance_time", "2019-09-01");
map.put("car_previous_maintenance_date", "2019-09-01");
map.put("car_maintenance_notification_date", "2019-10-01");
// map.put("car_maintenance_hour", "100");
// map.put("car_maintenance_amount", "1000");
// map.put("car_maintenance_times", "10");
map.put("car_maintenance_frequency", "1");
map.put("car_free_maintenance_times", "1");
map.put("car_average_maintenance_days", "5");
map.put("car_sold_by_company", "1");
list.add(map);
}
rabbitTemplate.convertAndSend(RabbitMQConfig.DATA_REPORT_EXCHANGE_NAME, "dataReport.customer.info", JSONObject.toJSONString(list));
}
@Test
void processReportCustomerEvent() {
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 5; i < 8; i++) {
Map<String, Object> map = new HashMap<>();
map.put("org_id", "44211227");
map.put("customer_phone", "1380013800"+i);
map.put("event_time", "2023-09-22 19:50:31");
map.put("event_type", "SENT_SMS");
map.put("system_source", "mdzs");
map.put("platform", "MiniProgram");
map.put("extra", "{\"activityId\":11,\"subOrderCode\":\"S234355566\",\"orderStatus\":2,\"orderCode\":\"2332334456\",\"payStatus\":2}\",\"orgId\":\"44211468\",\"platform\":\"Others\",\"systemSource\":\"scrm\"}");
list.add(map);
}
rabbitTemplate.convertAndSend(RabbitMQConfig.DATA_REPORT_EXCHANGE_NAME, "dataReport.customer.event", JSONObject.toJSONString(list));
}
@Test
void processReportCustomerEvent2() {
List<Map<String, Object>> list = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("org_id", "44211227");
map.put("add_way", "BURIED_POINT");
map.put("one_id", "cdp20230926213746000099");
map.put("customer_phone", "158001380011");
map.put("event_time", "2023-09-27 10:38:31");
map.put("event_type", "SENT_SMS");
map.put("system_source", "mdzs");
map.put("platform", "MiniProgram");
map.put("platform", "MiniProgram");
map.put("platform", "MiniProgram");
map.put("extra", "{\"activityId\":11,\"subOrderCode\":\"S234355566\",\"orderStatus\":2,\"orderCode\":\"2332334456\",\"payStatus\":2}\",\"orgId\":\"44211468\",\"platform\":\"Others\",\"systemSource\":\"scrm\"}");
list.add(map);
rabbitTemplate.convertAndSend(RabbitMQConfig.DATA_REPORT_EXCHANGE_NAME, "dataReport.customer.event", JSONObject.toJSONString(list));
}
@Test
void processReportCustomerSopJourney() {
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 5; i < 8; i++) {
Map<String, Object> map = new HashMap<>();
map.put("org_id", "44211227");
map.put("customer_phone", "1380013800"+i);
map.put("sop_journey_id", "111");
map.put("sop_journey_stage", "已成单");
map.put("sop_journey_enter_time", "2023-09-21 19:50:31");
map.put("sop_journey_stage_enter_time", "2023-09-21 19:50:31");
map.put("sop_follow_up_person_id", "user11444"+i);
map.put("sop_follow_up_person_name", "yundsds");
map.put("sop_follow_up_person_phone", "1580013890"+i);
map.put("sop_follow_up_person_aiSpeechId", "111");
map.put("sop_follow_up_person_aiSpeech", "你好,欢迎");
map.put("sop_follow_up_person_smsId", "111");
map.put("sop_follow_up_person_sms", "尊敬的用户,你好");
list.add(map);
}
rabbitTemplate.convertAndSend(RabbitMQConfig.DATA_REPORT_EXCHANGE_NAME, "dataReport.customer.event", JSONObject.toJSONString(list));
}
@Test
void handleModel() {
}
@Test
void getOneId() {
}
}
\ No newline at end of file \ No newline at end of file
//package cn.com.glsx;
//
//import com.glsx.microservice.api.EchoCenterFeignService;
//import com.glsx.plat.core.web.R;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
//import org.springframework.cloud.client.loadbalancer.LoadBalanced;
//import org.springframework.context.annotation.Bean;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.client.RestTemplate;
//
//import javax.annotation.Resource;
//
///**
// * 测试spring cloud 服务调用方式
// */
//@EnableDiscoveryClient
//@SpringBootApplication
//public class TestApplication {
//
// public static void main(String[] args) {
// SpringApplication.run(TestApplication.class, args);
// }
//
// @Slf4j
// @RestController
// static class TestController {
//
// @Autowired
// RestTemplate restTemplate;
//
// @Resource
// private EchoCenterFeignService echoCenterFeignService;
//
//// @Autowired
//// private WebClient.Builder webClientBuilder;
//
// @GetMapping("/test1")
// public String test1() {
// String result = restTemplate.getForObject("http://192.168.0.63:8829/rest-echo-center/echo/didi", String.class);
// return "Return : " + result;
// }
//
//// @GetMapping("/test")
//// public Mono<String> test() {
//// Mono<String> result = webClientBuilder.build()
//// .get()
//// .uri("http://alibaba-nacos-discovery-server/hello?name=didi")
//// .retrieve()
//// .bodyToMono(String.class);
//// return result;
//// }
//
// @GetMapping("/test3")
// public R test3() {
// String result = echoCenterFeignService.echo("this is a test!");
// return R.ok().data(result);
// }
// }
//
// @Bean
// @LoadBalanced
// public RestTemplate restTemplate() {
// return new RestTemplate();
// }
//
//// @Bean
//// @LoadBalanced
//// public WebClient.Builder loadBalancedWebClientBuilder() {
//// return WebClient.builder();
//// }
//
//}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.cn.com.glsx;
import cn.com.glsx.Application;
import cn.com.glsx.cdp.modules.service.UserDemoService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* 测试spring cloud 服务调用方式
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class)
public class TestApplication {
@Autowired
private UserDemoService userDemoService;
@Test
public void test() {
}
}
\ No newline at end of file \ No newline at end of file
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
</commentGenerator> </commentGenerator>
<!-- jdbc连接--> <!-- jdbc连接-->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.0.39:3306/seata_storage?serverTimeZone=Shanghai&amp;useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false" connectionURL="jdbc:mysql://192.168.3.227:3306/platform_cdp?serverTimeZone=Shanghai&amp;useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false"
userId="root" userId="dev_admin"
password="123456"> password="1f7e1ed2">
<!--防止生成其他库同名表--> <!--防止生成其他库同名表-->
<property name="nullCatalogMeansCurrent" value="true"/> <property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection> </jdbcConnection>
<!-- 类型转换 --> <!-- 类型转换 -->
<javaTypeResolver> <javaTypeResolver>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) --> <!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property name="forceBigDecimals" value="false"/> <!-- <property name="forceBigDecimals" value="false"/>-->
</javaTypeResolver> </javaTypeResolver>
<!-- 生成实体类地址 --> <!-- 生成实体类地址 -->
<javaModelGenerator targetPackage="cn.com.payu.modules.entity" targetProject="src/main/java"> <javaModelGenerator targetPackage="cn.com.glsx.cdp.modules.entity" targetProject="../platform-cdp-api/src/main/java">
<!-- 是否让schema作为包的后缀 --> <!-- 是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<!-- 从数据库返回的值去掉前后空格 --> <!-- 从数据库返回的值去掉前后空格 -->
...@@ -63,11 +63,39 @@ ...@@ -63,11 +63,39 @@
</sqlMapGenerator> </sqlMapGenerator>
<!-- 生成接口dao type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象 type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 --> <!-- 生成接口dao type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象 type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator targetPackage="cn.com.payu.modules.mapper" targetProject="src/main/java" type="XMLMAPPER"> <javaClientGenerator targetPackage="cn.com.glsx.cdp.modules.mapper" targetProject="../platform-cdp/src/main/java" type="XMLMAPPER">
<property name="enableSubPackages" value="false"/> <property name="enableSubPackages" value="false"/>
</javaClientGenerator> </javaClientGenerator>
<!-- table可以有多个,每个数据库中的表都可以写一个table,tableName表示要匹配的数据库表,也可以在tableName属性中通过使用%通配符来匹配所有数据库表,只有匹配的表才会自动生成文件 enableSelectByPrimaryKey相应的配置表示是否生成相应的接口 --> <!-- table可以有多个,每个数据库中的表都可以写一个table,tableName表示要匹配的数据库表,也可以在tableName属性中通过使用%通配符来匹配所有数据库表,只有匹配的表才会自动生成文件 enableSelectByPrimaryKey相应的配置表示是否生成相应的接口 -->
<table tableName="t_storage" domainObjectName="Storage" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> <!-- <table tableName="cdp_field" domainObjectName="Field" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="cdp_model" domainObjectName="Model" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="cdp_model_field_mapping" domainObjectName="ModelFieldMapping" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="cdp_customer" domainObjectName="Customer" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="cdp_customer_car_relation" domainObjectName="CustomerCarRelation" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<table tableName="cdp_customer_event" domainObjectName="CustomerEvent" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
<columnOverride column="extra" javaType="java.lang.String" jdbcType="VARCHAR" />
<columnOverride column="exJson" javaType="java.lang.String" jdbcType="VARCHAR" />
</table>
<!-- <table tableName="cdp_customer_sop_journey" domainObjectName="CustomerSopJourney" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="cdp_car" domainObjectName="Car" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
<!-- <table tableName="cdp_car_maintenance_insurance" domainObjectName="CarMaintenanceInsurance" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- <generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!-- </table>-->
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file \ 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!