Ver Fonte

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu há 4 meses atrás
pai
commit
806165b6d3

+ 32 - 48
mall-server-api/src/main/java/com/gree/mall/manager/bean/es/OrderBaseEs.java

@@ -92,19 +92,16 @@ public class OrderBaseEs   {
     private String orderStatusText;
 
     @ApiModelProperty(value = "派单给师傅的时间")
-    @Field(value = "dispatch_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date dispatchTime;
+    @Field(value = "dispatch_time", type = FieldType.Date,format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private String dispatchTime;
 
     @ApiModelProperty(value = "师傅接单时间")
-    @Field(value = "worker_rece_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date workerReceTime;
+    @Field(value = "worker_rece_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String workerReceTime;
 
     @ApiModelProperty(value = "派工网点时间")
-    @Field(value = "dispatch_websit_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date dispatchWebsitTime;
+    @Field(value = "dispatch_websit_time", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private String dispatchWebsitTime;
 
     @ApiModelProperty(value = "客户id(客户建单才有)")
     @Field(value = "user_id", type = FieldType.Keyword)
@@ -203,19 +200,16 @@ public class OrderBaseEs   {
     private String lastOperatorBy;
 
     @ApiModelProperty(value = "最近操作时间")
-    @Field(value = "last_operator_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date lastOperatorTime;
+    @Field(value = "last_operator_time", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private String lastOperatorTime;
 
     @ApiModelProperty(value = "预约安装/维修时间")
-    @Field(value = "appointment_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date appointmentTime;
+    @Field(value = "appointment_time", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private String appointmentTime;
 
     @ApiModelProperty(value = "预约结束时间")
-    @Field(value = "appointment_end_time",type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date appointmentEndTime;
+    @Field(value = "appointment_end_time",type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String appointmentEndTime;
 
     @ApiModelProperty(value = "预约备注")
     @Field(value = "appointment_remark", type = FieldType.Keyword)
@@ -238,34 +232,28 @@ public class OrderBaseEs   {
     private String lat;
 
     @ApiModelProperty(value = "师傅报完工时间")
-    @Field(value = "over_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date overTime;
+    @Field(value = "over_time", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private String overTime;
 
     @ApiModelProperty(value = "网点报完工时间")
-    @Field(value = "websit_over_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date websitOverTime;
+    @Field(value = "websit_over_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String websitOverTime;
 
     @ApiModelProperty(value = "完工时间(精确到天)")
-    @Field(value = "over_date", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date overDate;
+    @Field(value = "over_date", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String overDate;
 
     @ApiModelProperty(value = "正常关闭时间")
-    @Field(value = "close_time",type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date closeTime;
+    @Field(value = "close_time",type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private String closeTime;
 
     @ApiModelProperty(value = "创建时间(精确到天)")
-    @Field(value = "create_date", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date createDate;
+    @Field(value = "create_date", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String createDate;
 
     @ApiModelProperty(value = "创建时间")
-    @Field(value = "create_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date createTime;
+    @Field(value = "create_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String createTime;
 
     @ApiModelProperty(value = "创建人手机")
     @Field(value = "create_mobile", type = FieldType.Keyword)
@@ -280,9 +268,8 @@ public class OrderBaseEs   {
     private String createName;
 
     @ApiModelProperty(value = "修改时间")
-    @Field(value = "update_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date updateTime;
+    @Field(value = "update_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String updateTime;
 
     @ApiModelProperty(value = "修改人")
     @Field(value = "update_by", type = FieldType.Keyword)
@@ -297,9 +284,8 @@ public class OrderBaseEs   {
     private String appraiseContent;
 
     @ApiModelProperty(value = "首次评价时间")
-    @Field(value = "appraise_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date appraiseTime;
+    @Field(value = "appraise_time", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private String appraiseTime;
 
     @ApiModelProperty(value = "评价来源 1=用户评价 2=商家评价")
     @Field(value = "appraise_source", type = FieldType.Keyword)
@@ -318,9 +304,8 @@ public class OrderBaseEs   {
     private String saleCompany;
 
     @ApiModelProperty(value = "最近一次操作预约/改约的时间")
-    @Field(value = "last_operator_appointment_time",type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date lastOperatorAppointmentTime;
+    @Field(value = "last_operator_appointment_time",type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String lastOperatorAppointmentTime;
 
     @ApiModelProperty(value = "工单渠道id")
     @Field(value = "order_channel_id", type = FieldType.Keyword)
@@ -339,9 +324,8 @@ public class OrderBaseEs   {
     private String saleOrderId;
 
     @ApiModelProperty(value = "销售单下单时间")
-    @Field(value = "sale_create_time", type = FieldType.Date, pattern ="yyyy-MM-dd HH:mm:ss")
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
-    private Date saleCreateTime;
+    @Field(value = "sale_create_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String saleCreateTime;
 
     @ApiModelProperty(value = "销售单订单金额")
     @Field(value = "sale_total_amount", type = FieldType.Keyword)

+ 540 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/es/OrderBaseEsDate.java

@@ -0,0 +1,540 @@
+package com.gree.mall.manager.bean.es;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.elasticsearch.annotations.DateFormat;
+import org.springframework.data.elasticsearch.annotations.Document;
+import org.springframework.data.elasticsearch.annotations.Field;
+import org.springframework.data.elasticsearch.annotations.FieldType;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author qinrongjun
+ * @description
+ * @date 2023/6/19 10:39 星期一
+ */
+@Data
+@Document(indexName = "pg_order_base")
+public class OrderBaseEsDate {
+
+    @Id
+    @Field(value = "id", type = FieldType.Keyword)
+    private String id;
+
+    @ApiModelProperty(value = "服务说明(例如:家用空调x1,洗衣机x1)")
+    @Field(value = "order_title", type = FieldType.Keyword)
+    private String orderTitle;
+
+    @ApiModelProperty(value = "所属业务线   INSTALL=安装 REPAIR=维修")
+    @Field(value = "order_type", type = FieldType.Keyword)
+    private String orderType;
+
+    @ApiModelProperty(value = "所属业务线名称")
+    @Field(value = "order_type_text", type = FieldType.Keyword)
+    private String orderTypeText;
+
+    @ApiModelProperty(value = "工单类型")
+    @Field(value = "order_small_type", type = FieldType.Keyword)
+    private String orderSmallType;
+
+    @ApiModelProperty(value = "工单类型名称")
+    @Field(value = "order_small_type_text", type = FieldType.Keyword)
+    private String orderSmallTypeText;
+
+    @ApiModelProperty(value = "商户id")
+    @Field(value = "company_wechat_id", type = FieldType.Keyword)
+    private String companyWechatId;
+
+    @ApiModelProperty(value = "商户名称")
+    @Field(value = "company_wechat_name", type = FieldType.Keyword)
+    private String companyWechatName;
+
+    @ApiModelProperty(value = "主要师傅id")
+    @Field(value = "worker_id", type = FieldType.Keyword)
+    private String workerId;
+
+    @ApiModelProperty(value = "师傅名称")
+    @Field(value = "worker_name", type = FieldType.Keyword)
+    private String workerName;
+
+    @ApiModelProperty(value = "师傅电话")
+    @Field(value = "worker_mobile", type = FieldType.Keyword)
+    private String workerMobile;
+
+    @ApiModelProperty(value = "师傅身份证")
+    @Field(value = "worker_idcard", type = FieldType.Keyword)
+    private String workerIdcard;
+
+    @ApiModelProperty(value = "所有师傅的id(冗余字段),实际请看order_worker")
+    @Field(value = "worker_id_list", type = FieldType.Keyword)
+    private String workerIdList;
+
+    @ApiModelProperty(value = "工单状态 DYY=待预约 DSHPG=待商户派工 DWDPG=待网点派工 DQD=待抢单 DJD=待接单 FWZ=服务中 YCD=异常单 YWG=已完工待结算 YJS=已结算 YQX=已取消")
+    @Field(value = "order_status", type = FieldType.Keyword)
+    private String orderStatus;
+
+    @ApiModelProperty(value = "工单状态中文名称")
+    @Field(value = "order_status_text", type = FieldType.Keyword)
+    private String orderStatusText;
+
+    @ApiModelProperty(value = "派单给师傅的时间")
+    @Field(value = "dispatch_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date dispatchTime;
+
+    @ApiModelProperty(value = "师傅接单时间")
+    @Field(value = "worker_rece_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date workerReceTime;
+
+    @ApiModelProperty(value = "派工网点时间")
+    @Field(value = "dispatch_websit_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date dispatchWebsitTime;
+
+    @ApiModelProperty(value = "客户id(客户建单才有)")
+    @Field(value = "user_id", type = FieldType.Keyword)
+    private String userId;
+
+    @ApiModelProperty(value = "客户名称")
+    @Field(value = "user_name", type = FieldType.Keyword)
+    private String userName;
+
+    @ApiModelProperty(value = "联系人")
+    @Field(value = "link_name", type = FieldType.Keyword)
+    private String linkName;
+
+    @ApiModelProperty(value = "客户电话")
+    @Field(value = "user_mobile", type = FieldType.Keyword)
+    private String userMobile;
+
+    @ApiModelProperty(value = "客户电话2")
+    @Field(value = "user_mobile2", type = FieldType.Keyword)
+    private String userMobile2;
+
+    @ApiModelProperty(value = "省")
+    @Field(value = "province", type = FieldType.Keyword)
+    private String province;
+
+    @ApiModelProperty(value = "省id")
+    @Field(value = "province_id", type = FieldType.Keyword)
+    private String provinceId;
+
+    @ApiModelProperty(value = "市")
+    @Field(value = "city", type = FieldType.Keyword)
+    private String city;
+
+    @ApiModelProperty(value = "市id")
+    @Field(value = "city_id", type = FieldType.Keyword)
+    private String cityId;
+
+    @ApiModelProperty(value = "区")
+    @Field(value = "area", type = FieldType.Keyword)
+    private String area;
+
+    @ApiModelProperty(value = "区id")
+    @Field(value = "area_id", type = FieldType.Keyword)
+    private String areaId;
+
+    @ApiModelProperty(value = "街道")
+    @Field(value = "street", type = FieldType.Keyword)
+    private String street;
+
+    @ApiModelProperty(value = "街道id")
+    @Field(value = "street_id", type = FieldType.Keyword)
+    private String streetId;
+
+    @ApiModelProperty(value = "详细地址")
+    @Field(value = "address", type = FieldType.Keyword)
+    private String address;
+
+    @ApiModelProperty(value = "备注")
+    @Field(value = "remark", type = FieldType.Keyword)
+    private String remark;
+
+    @ApiModelProperty(value = "安装或维修网点名称(售后网点)")
+    @Field(value = "websit_name", type = FieldType.Keyword)
+    private String websitName;
+
+    @ApiModelProperty(value = "安装或维修网点编号(售后网点)")
+    @Field(value = "websit_id", type = FieldType.Keyword)
+    private String websitId;
+
+    @ApiModelProperty(value = "售后网点联系电话")
+    @Field(value = "websit_phone", type = FieldType.Keyword)
+    private String websitPhone;
+
+    @ApiModelProperty(value = "创建网点编号")
+    @Field(value = "create_websit_id", type = FieldType.Keyword)
+    private String createWebsitId;
+
+    @ApiModelProperty(value = "创建网点名称")
+    @Field(value = "create_websit_name", type = FieldType.Keyword)
+    private String createWebsitName;
+
+    @ApiModelProperty(value = "gps地址信息")
+    @Field(value = "gps_address", type = FieldType.Keyword)
+    private String gpsAddress;
+
+    @ApiModelProperty(value = "最新反馈记录")
+    @Field(value = "last_operator", type = FieldType.Keyword)
+    private String lastOperator;
+
+    @ApiModelProperty(value = "最近操作网点")
+    @Field(value = "last_operator_websit", type = FieldType.Keyword)
+    private String lastOperatorWebsit;
+
+    @ApiModelProperty(value = "最近操作网点编号")
+    @Field(value = "last_operator_by", type = FieldType.Keyword)
+    private String lastOperatorBy;
+
+    @ApiModelProperty(value = "最近操作时间")
+    @Field(value = "last_operator_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date lastOperatorTime;
+
+    @ApiModelProperty(value = "预约安装/维修时间")
+    @Field(value = "appointment_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date appointmentTime;
+
+    @ApiModelProperty(value = "预约结束时间")
+    @Field(value = "appointment_end_time",type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date appointmentEndTime;
+
+    @ApiModelProperty(value = "预约备注")
+    @Field(value = "appointment_remark", type = FieldType.Keyword)
+    private String appointmentRemark;
+
+    @ApiModelProperty(value = "安装/维修总数量")
+    @Field(value = "total_num", type = FieldType.Integer)
+    private Integer totalNum;
+
+    @ApiModelProperty(value = "未完成数量")
+    @Field(value = "undone_num", type = FieldType.Integer)
+    private Integer undoneNum;
+
+    @ApiModelProperty(value = "经度")
+    @Field(value = "lng", type = FieldType.Keyword)
+    private String lng;
+
+    @ApiModelProperty(value = "纬度")
+    @Field(value = "lat", type = FieldType.Keyword)
+    private String lat;
+
+    @ApiModelProperty(value = "师傅报完工时间")
+    @Field(value = "over_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date overTime;
+
+    @ApiModelProperty(value = "网点报完工时间")
+    @Field(value = "websit_over_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date websitOverTime;
+
+    @ApiModelProperty(value = "完工时间(精确到天)")
+    @Field(value = "over_date", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date overDate;
+
+    @ApiModelProperty(value = "正常关闭时间")
+    @Field(value = "close_time",type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date closeTime;
+
+    @ApiModelProperty(value = "创建时间(精确到天)")
+    @Field(value = "create_date", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date createDate;
+
+    @ApiModelProperty(value = "创建时间")
+    @Field(value = "create_time", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @ApiModelProperty(value = "创建人手机")
+    @Field(value = "create_mobile", type = FieldType.Keyword)
+    private String createMobile;
+
+    @ApiModelProperty(value = "创建人")
+    @Field(value = "create_by", type = FieldType.Keyword)
+    private String createBy;
+
+    @ApiModelProperty(value = "创建人名称")
+    @Field(value = "create_name", type = FieldType.Keyword)
+    private String createName;
+
+    @ApiModelProperty(value = "修改时间")
+    @Field(value = "update_time", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    @ApiModelProperty(value = "修改人")
+    @Field(value = "update_by", type = FieldType.Keyword)
+    private String updateBy;
+
+    @ApiModelProperty(value = "首次评价(A:好评,B:中评,C:差评,N:未评价,O:其他")
+    @Field(value = "appraise_status", type = FieldType.Keyword)
+    private String appraiseStatus;
+
+    @ApiModelProperty(value = "首次评价内容")
+    @Field(value = "appraise_content", type = FieldType.Keyword)
+    private String appraiseContent;
+
+    @ApiModelProperty(value = "首次评价时间")
+    @Field(value = "appraise_time", type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date appraiseTime;
+
+    @ApiModelProperty(value = "评价来源 1=用户评价 2=商家评价")
+    @Field(value = "appraise_source", type = FieldType.Keyword)
+    private Integer appraiseSource;
+
+    @ApiModelProperty(value = "多个图片逗号隔开")
+    @Field(value = "appraise_img_url", type = FieldType.Keyword)
+    private String appraiseImgUrl;
+
+    @ApiModelProperty(value = "师傅记事备注")
+    @Field(value = "worker_remark", type = FieldType.Keyword)
+    private String workerRemark;
+
+    @ApiModelProperty(value = "销售单位")
+    @Field(value = "sale_company", type = FieldType.Keyword)
+    private String saleCompany;
+
+    @ApiModelProperty(value = "最近一次操作预约/改约的时间")
+    @Field(value = "last_operator_appointment_time",type = FieldType.Date, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date lastOperatorAppointmentTime;
+
+    @ApiModelProperty(value = "工单渠道id")
+    @Field(value = "order_channel_id", type = FieldType.Keyword)
+    private String orderChannelId;
+
+    @ApiModelProperty(value = "工单渠道")
+    @Field(value = "order_channel_text", type = FieldType.Keyword)
+    private String orderChannelText;
+
+    @ApiModelProperty(value = "改约备注")
+    @Field(value = "change_remark", type = FieldType.Keyword)
+    private String changeRemark;
+
+    @ApiModelProperty(value = "销售单号")
+    @Field(value = "sale_order_id", type = FieldType.Keyword)
+    private String saleOrderId;
+
+    @ApiModelProperty(value = "销售单下单时间")
+    @Field(value = "sale_create_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date saleCreateTime;
+
+    @ApiModelProperty(value = "销售单订单金额")
+    @Field(value = "sale_total_amount", type = FieldType.Keyword)
+    private BigDecimal saleTotalAmount;
+
+    @ApiModelProperty(value = "销售单备注")
+    @Field(value = "sale_remark", type = FieldType.Keyword)
+    private String saleRemark;
+
+    @ApiModelProperty(value = "内部来源")
+    @Field(value = "source", type = FieldType.Keyword)
+    private String source;
+
+    @ApiModelProperty(value = "完工反馈备注")
+    @Field(value = "over_remark", type = FieldType.Keyword)
+    private String overRemark;
+
+    @ApiModelProperty(value = "客户签名")
+    @Field(value = "user_sign", type = FieldType.Keyword)
+    private String userSign;
+
+    @ApiModelProperty(value = "是否为导入工单,true=是 false=否")
+    @Field(value = "is_import", type = FieldType.Keyword)
+    private String isImport;
+
+    @ApiModelProperty(value = "是否已采集 YES 是 NO 否")
+    @Field(value = "is_gather", type = FieldType.Keyword)
+    private String isGather;
+
+    @ApiModelProperty(value = "是否异常工单 true/false")
+    @Field(value = "is_exception", type = FieldType.Keyword)
+    private String isException;
+
+    @ApiModelProperty(value = "增置服务id")
+    @Field(value = "pg_incre_id", type = FieldType.Keyword)
+    private String pgIncreId;
+
+    @ApiModelProperty(value = "增置服务订单id")
+    @Field(value = "pg_incre_order_id", type = FieldType.Keyword)
+    private String pgIncreOrderId;
+
+    @ApiModelProperty(value = "增置服务明细id")
+    @Field(value = "pg_incre_item_id", type = FieldType.Keyword)
+    private String pgIncreItemId;
+
+    @ApiModelProperty(value = "增置服务售卖网点")
+    @Field(value = "pg_incre_websit_name", type = FieldType.Keyword)
+    private String pgIncreWebsitName;
+
+    @ApiModelProperty(value = "增置服务售卖网点id")
+    @Field(value = "pg_incre_websit_id", type = FieldType.Keyword)
+    private String pgIncreWebsitId;
+
+    @ApiModelProperty(value = "结算服务费用")
+    @Field(value = "settle_service_amount", type = FieldType.Keyword)
+    private BigDecimal settleServiceAmount;
+
+    @ApiModelProperty(value = "维保基础id")
+    @Field(value = "rp_project_repair_id", type = FieldType.Keyword)
+    private String rpProjectRepairId;
+
+    @ApiModelProperty(value = "工程维保名称")
+    @Field(value = "rp_project_repair_name", type = FieldType.Keyword)
+    private String rpProjectRepairName;
+
+    @ApiModelProperty(value = "费用支付方式 EXAMINE=审批后结算 SITE=现场支付")
+    @Field(value = "fee_pay_method", type = FieldType.Keyword)
+    private String feePayMethod;
+
+    @ApiModelProperty(value = "是否包含全部费用 YES=是 NO=否")
+    @Field(value = "is_all_fee", type = FieldType.Keyword)
+    private String isAllFee;
+
+    @ApiModelProperty(value = "销售类型 1=零售 2=工程 3=延保 4=工程维保")
+    @Field(value = "sale_type", type = FieldType.Keyword)
+    private Integer saleType;
+
+    @ApiModelProperty(value = "工程编号")
+    @Field(value = "project_no", type = FieldType.Keyword)
+    private String projectNo;
+
+    @ApiModelProperty(value = "工程名称")
+    @Field(value = "project_name", type = FieldType.Keyword)
+    private String projectName;
+
+    @ApiModelProperty(value = "是否开启抢单")
+    @Field(value = "is_qd", type = FieldType.Keyword)
+    private String isQd;
+
+    @ApiModelProperty(value = "是否已产生通知 true=是 false=否")
+    @Field(value = "is_qd_notice", type = FieldType.Keyword)
+    private String isQdNotice;
+
+    @ApiModelProperty(value = "是否为拆机")
+    @Field(value = "is_cj", type = FieldType.Keyword)
+    private String isCj;
+
+    @ApiModelProperty(value = "是否为租赁单 true/false")
+    @Field(value = "is_zl", type = FieldType.Keyword)
+    private String isZl;
+
+
+
+    @ApiModelProperty(value = "是否为工单导入 true/false")
+    @Field(value = "is_import_excel", type = FieldType.Keyword)
+    private String isImportExcel;
+
+    @ApiModelProperty(value = "服务状态")
+    @Field(value = "service_status", type = FieldType.Keyword)
+    private String serviceStatus;
+
+    @ApiModelProperty(value = "投诉等级")
+    @Field(value = "complaint", type = FieldType.Keyword)
+    private String complaint;
+
+    @ApiModelProperty(value = "紧急程度")
+    @Field(value = "urgent", type = FieldType.Keyword)
+    private String urgent;
+
+    @ApiModelProperty(value = "评价结果")
+    @Field(value = "evaluate", type = FieldType.Keyword)
+    private String evaluate;
+
+    @ApiModelProperty(value = "销售平台")
+    @Field(value = "sales_platform", type = FieldType.Keyword)
+    private String salesPlatform;
+
+    @ApiModelProperty(value = "购买单位")
+    @Field(value = "buy_name", type = FieldType.Keyword)
+    private String buyName;
+
+    @ApiModelProperty(value = "销售类型")
+    @Field(value = "sales_type_name", type = FieldType.Keyword)
+    private String salesTypeName;
+
+    @ApiModelProperty(value = "要求状态")
+    @Field(value = "req_status", type = FieldType.Keyword)
+    private String reqStatus;
+
+    @ApiModelProperty(value = "要求类型")
+    @Field(value = "req_type", type = FieldType.Keyword)
+    private String reqType;
+
+    @ApiModelProperty(value = "要求内容")
+    @Field(value = "req_text", type = FieldType.Keyword)
+    private String reqText;
+
+    @ApiModelProperty(value = "服务单号")
+    @Field(value = "service_order_id", type = FieldType.Keyword)
+    private String serviceOrderId;
+
+    @ApiModelProperty(value = "销售单号")
+    @Field(value = "sales_order_id", type = FieldType.Keyword)
+    private String salesOrderId;
+
+    @ApiModelProperty(value = "管理组织")
+    @Field(value = "manager_name", type = FieldType.Keyword)
+    private String managerName;
+
+    @ApiModelProperty(value = "运营主体")
+    @Field(value = "operate_entity", type = FieldType.Keyword)
+    private String operateEntity;
+
+    @ApiModelProperty(value = "大类名称")
+    @Field(value = "main_name", type = FieldType.Keyword)
+    private String mainName;
+
+
+    @ApiModelProperty(value = "师傅编号")
+    @Field(value = "worker_number", type = FieldType.Keyword)
+    private String workerNumber;
+
+
+    @ApiModelProperty(value = "上午下午")
+    @Field(value = "time_name", type = FieldType.Keyword)
+    private String timeName;
+
+    @ApiModelProperty(value = "所属公司")
+    @Field(value = "belong_company", type = FieldType.Keyword)
+    private String belongCompany;
+
+    @ApiModelProperty(value = "销售网点编号")
+    @Field(value = "sales_websit_number", type = FieldType.Keyword)
+    private String salesWebsitNumber;
+
+    @ApiModelProperty(value = "销售网点名称")
+    @Field(value = "sales_websit", type = FieldType.Keyword)
+    private String salesWebsit;
+
+    @ApiModelProperty(value = "创建人编号")
+    @Field(value = "create_number", type = FieldType.Keyword)
+    private String createNumber;
+
+    @ApiModelProperty(value = "评价标签")
+    @Field(value = "appraise_label", type = FieldType.Keyword)
+    private String appraiseLabel;
+
+    @ApiModelProperty(value = "是否是工单3.0同步true/false")
+    @Field(value = "is_three_order", type = FieldType.Keyword)
+    private String isThreeOrder;
+
+    @ApiModelProperty(value = "故障类型")
+    @Field(value = "trouble_value", type = FieldType.Keyword)
+    private String troubleValue;
+
+    @ApiModelProperty(value = "需求类别")
+    @Field(value = "type", type = FieldType.Keyword)
+    private String type;
+
+    @ApiModelProperty(value = "需求小类")
+    @Field(value = "small_type", type = FieldType.Keyword)
+    private String smallType;
+
+    @ApiModelProperty(value = "1 已接单 0未接单")
+    @Field(value = "is_meet", type = FieldType.Keyword)
+    private String isMeet;
+
+    @ApiModelProperty(value = "申请状态 ING=申请中 END=到货反馈 CANCEL=取消申请")
+    @Field(value = "parts_apply_status", type = FieldType.Keyword)
+    private String partsApplyStatus;
+
+
+}

+ 3 - 1
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java

@@ -220,7 +220,9 @@ public interface CommonMapper {
      * @return
      */
     @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
-    public IPage<OrderBaseVO> orderBaseList(IPage page, @Param("ex") WorkOrderZfireParam zfireParamBean,@Param("adminUserType") Integer adminUserType
+    public IPage<OrderBaseVO> orderBaseList(IPage page,
+                                            @Param("ex") WorkOrderZfireParam zfireParamBean,
+                                            @Param("adminUserType") Integer adminUserType
             ,@Param("companyWechatId") String companyWechatId);
 
     /**

+ 40 - 2
mall-server-api/src/main/java/com/gree/mall/manager/controller/workerorder/ESOrderBaseController.java

@@ -1,10 +1,13 @@
 package com.gree.mall.manager.controller.workerorder;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.TypeReference;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.annotation.ApiNotAuth;
 import com.gree.mall.manager.annotation.ZfireList;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.es.OrderBaseEs;
 import com.gree.mall.manager.bean.listvo.param.WorkOrderZfireParam;
 import com.gree.mall.manager.bean.listvo.workorder.OrderBase2VO;
 import com.gree.mall.manager.bean.listvo.workorder.OrderBaseVO;
@@ -13,9 +16,11 @@ import com.gree.mall.manager.bean.workorder.OrderAddBeanDTO;
 import com.gree.mall.manager.bean.workorder.OrderSettleDetailBean;
 import com.gree.mall.manager.constant.Constant;
 import com.gree.mall.manager.enums.workorder.OrderFlagEnum;
+import com.gree.mall.manager.es.OrderBaseEsRepository;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
 import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.logic.workorder.OrderBaseEsLogic;
 import com.gree.mall.manager.logic.workorder.OrderBaseExcelLogic;
 import com.gree.mall.manager.logic.workorder.OrderBaseLogic;
 import com.gree.mall.manager.logic.workorder.OrderLogLogic;
@@ -42,6 +47,7 @@ import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 
@@ -52,7 +58,8 @@ import java.util.concurrent.locks.Lock;
 @RequestMapping(value = "/orderEs/base", produces = "application/json; charset=utf-8")
 public class ESOrderBaseController {
 
-    private final OrderBaseLogic orderBaseLogic;
+    private final OrderBaseEsLogic orderBaseEsLogic;
+
 
 
 
@@ -63,8 +70,39 @@ public class ESOrderBaseController {
     public ResponseHelper<Page<OrderBaseVO>> list(
             @RequestBody WorkOrderZfireParam workOrderZfireParam
     ) {
-        IPage<OrderBaseVO> orderBaseVOIPage = orderBaseLogic.orderEsBaseList(workOrderZfireParam);
+        IPage<OrderBaseVO> orderBaseVOIPage = orderBaseEsLogic.orderBaseEsList(workOrderZfireParam);
         return ResponseHelper.success(orderBaseVOIPage, new TypeReference<OrderBaseVO>() {});
     }
 
+    @PostMapping("/list/export")
+    @ApiOperation(value = "导出")
+    public void listExport(@RequestBody WorkOrderZfireParam zfireParamBean, HttpServletRequest request, HttpServletResponse response) throws Exception {
+        //1.组装查询条件
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        //2.查询要导出的内容
+        IPage<OrderBaseVO> orderBaseVOIPage = orderBaseEsLogic.orderBaseEsList(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(orderBaseVOIPage.getRecords(), zfireParam.getExportFields(), request, response);
+    }
+
+    @PostMapping("/status/count")
+    @ApiOperation(value = "按工单状态统计")
+    public ResponseHelper<List<Map<String,Object>>> countStatus(
+            @RequestParam(required = false) String startTime,
+            @RequestParam(required = false) String endTime,
+            @RequestParam(required = false) String orderSmallType,
+            @RequestParam(required = false) String orderSmallTypeText
+    ) {
+        List<Map<String, Object>> maps = orderBaseEsLogic.countStatus(startTime,endTime,orderSmallType,orderSmallTypeText);
+        return ResponseHelper.success(maps);
+    }
+
+
+    @ApiNotAuth
+    @PostMapping("test")
+    public ResponseHelper test() throws IllegalAccessException {
+        orderBaseEsLogic.test();
+        return ResponseHelper.success();
+    }
+
 }

+ 14 - 0
mall-server-api/src/main/java/com/gree/mall/manager/es/OrderBaseEsRepository.java

@@ -0,0 +1,14 @@
+package com.gree.mall.manager.es;
+
+
+import com.gree.mall.manager.bean.es.OrderBaseEs;
+import com.gree.mall.manager.bean.es.OrderBaseEsDate;
+import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
+
+/**
+ * @author
+ * @description
+ * @date 2023/6/19 10:37 星期一
+ */
+public interface OrderBaseEsRepository extends ElasticsearchRepository<OrderBaseEsDate, String> {
+}

+ 2 - 2
mall-server-api/src/main/java/com/gree/mall/manager/logic/user/UserLogic.java

@@ -429,7 +429,7 @@ public class UserLogic {
                             .eq(User::getType, UserTypeEnum.WORKER.getKey())
                             .last("limit 1")
                             .one();
-                    if (Objects.nonNull(worker)) {
+                    if (Objects.nonNull(worker) ) {
                         this.saveWebsitUser(adminWebsit.getWebsitId(), worker, brank, workerNumber, "系统导入初始化", userWait);
                     }
                 }
@@ -670,7 +670,7 @@ public class UserLogic {
     @Transactional
     public void saveWebsitUser(String websitId, User user, String bankAccount, String workerNumber, String remark,UserWait userWait) {
         // 用户师傅编号不为空并且师傅编号与传入师傅编号不一致,抛错
-        if (StringUtils.isNotBlank(user.getWorkerNumber())
+        if (StringUtils.isNotBlank(user.getWorkerNumber() )
                 && !StringUtils.equals(user.getWorkerNumber(), workerNumber)) {
             throw new RemoteServiceException("用户师傅编号与本次传入师傅编号不一致");
         }

+ 546 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseEsLogic.java

@@ -0,0 +1,546 @@
+package com.gree.mall.manager.logic.workorder;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.db.sql.Order;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.es.OrderBaseEs;
+import com.gree.mall.manager.bean.es.OrderBaseEsDate;
+import com.gree.mall.manager.bean.listvo.param.WorkOrderZfireParam;
+import com.gree.mall.manager.bean.listvo.workorder.OrderBaseVO;
+import com.gree.mall.manager.constant.Constant;
+import com.gree.mall.manager.enums.MaterialExamineStatusEnum;
+import com.gree.mall.manager.enums.OrderStatusEnum;
+import com.gree.mall.manager.enums.workorder.OrderTypeEnum;
+import com.gree.mall.manager.es.OrderBaseEsRepository;
+import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.plus.entity.PgOrderBase;
+import com.gree.mall.manager.plus.entity.PgOrderFlag;
+import com.gree.mall.manager.plus.entity.WorkerOrder;
+import com.gree.mall.manager.plus.service.PgOrderBaseService;
+import com.gree.mall.manager.plus.service.WorkerOrderService;
+import com.gree.mall.manager.zfire.bean.QueryParamBean;
+import io.micrometer.core.instrument.search.Search;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.index.query.RangeQueryBuilder;
+import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
+import org.elasticsearch.search.aggregations.AggregationBuilders;
+import org.elasticsearch.search.aggregations.Aggregations;
+import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder;
+import org.elasticsearch.search.aggregations.bucket.filter.ParsedFilter;
+import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms;
+import org.elasticsearch.search.aggregations.bucket.terms.Terms;
+import org.elasticsearch.search.aggregations.metrics.ParsedSum;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
+import org.elasticsearch.search.sort.SortBuilders;
+import org.elasticsearch.search.sort.SortOrder;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.elasticsearch.core.*;
+import org.springframework.data.elasticsearch.core.document.Document;
+import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
+import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class OrderBaseEsLogic {
+
+
+    private final OrderFlagLogic orderFlagLogic;
+
+    private final WorkerOrderService workerOrderService;
+
+    private final ElasticsearchRestTemplate elasticsearchRestTemplate;
+
+    private final CommonLogic commonLogic;
+    private final OrderBaseEsRepository orderBaseEsRepository;
+    private final PgOrderBaseService pgOrderBaseService;
+
+    public IPage<OrderBaseVO> orderBaseEsList(WorkOrderZfireParam zfireParamBean) {
+
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
+
+        if (CollectionUtils.isNotEmpty(adminUser.getAdminWebsitIds())) {
+            List<QueryBuilder> should = queryBuilder.should();
+            if (adminUser.getType().equals(1)) {
+                should.add(QueryBuilders.termsQuery("company_wechat_id", adminUser.getCompanyWechatId()));
+            }
+            should.add(QueryBuilders.termsQuery("create_websit_id", adminUser.getAdminWebsitIds()));
+            should.add(QueryBuilders.termsQuery("websit_id", adminUser.getAdminWebsitIds()));
+        }
+
+        BoolQueryBuilder queryBuilder1 = QueryBuilders.boolQuery();
+        this.montage(queryBuilder1,zfireParamBean);
+
+
+
+        NativeSearchQuery build = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withQuery(queryBuilder1)
+                .withSort(SortBuilders.fieldSort("create_time").order(SortOrder.DESC))
+                .withPageable(PageRequest.of(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()))
+                .build();
+
+
+        SearchHits<OrderBaseEs> orderBaseEsSearchHits = elasticsearchRestTemplate.search(build, OrderBaseEs.class);
+        SearchPage<OrderBaseEs> searchHits = SearchHitSupport.searchPageFor(orderBaseEsSearchHits, build.getPageable());
+
+
+        List<OrderBaseEs> orderBaseEs = new ArrayList<>();
+        for (SearchHit<OrderBaseEs> searchHit : searchHits.getContent()) {
+            orderBaseEs.add(searchHit.getContent());
+        }
+
+        IPage<OrderBaseVO> page = new Page<>();
+        page.setTotal(searchHits.getSearchHits().getTotalHits());
+        page.setCurrent(zfireParamBean.getPageNum());
+        page.setSize(zfireParamBean.getPageSize());
+        page.setRecords(BeanUtil.copyToList(orderBaseEs,OrderBaseVO.class));
+        //服务单标识
+        if (zfireParamBean.getPageSize() != -1 && page.getTotal() > 0) {
+            List<String> orderBaseIds = page.getRecords()
+                    .stream()
+                    .map(OrderBaseVO::getId)
+                    .collect(Collectors.toList());
+            Map<String, List<PgOrderFlag>> mapList = orderFlagLogic.list(orderBaseIds);
+
+            List<WorkerOrder> workerOrderList = workerOrderService.lambdaQuery().in(WorkerOrder::getWorkerOrderId, orderBaseIds)
+                    .eq(WorkerOrder::getPayStatus, MaterialExamineStatusEnum.PAID.getKey())
+                    .select(WorkerOrder::getWorkerOrderId, WorkerOrder::getTotalAmount).list();
+
+            for (OrderBaseVO orderBaseVO : page.getRecords()) {
+                orderBaseVO.setOrderFlags(mapList.get(orderBaseVO.getId()));
+
+                List<WorkerOrder> workerOrders = workerOrderList.stream()
+                        .filter(item -> item.getWorkerOrderId().equals(orderBaseVO.getId())).collect(Collectors.toList());
+                if (!CollectionUtils.isEmpty(workerOrderList)) {
+                    BigDecimal bigDecimal = workerOrders.stream().map(WorkerOrder::getTotalAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
+                    orderBaseVO.setWorkerPrice(bigDecimal);
+                }
+
+            }
+        }
+        return page;
+    }
+
+
+
+    private void montage(BoolQueryBuilder queryBuilder, WorkOrderZfireParam workOrderZfireParam) {
+
+        List<QueryParamBean> params = workOrderZfireParam.getParams();
+        if (params == null || params.size() == 0) {
+            return;
+        }
+
+        List<QueryBuilder> should = queryBuilder.should();
+        for (QueryParamBean paramBean : params) {
+            if (paramBean.getValue() == null)
+                continue;
+
+            String param = "";
+            if (paramBean.getParam().split("\\.").length > 1){
+                param = paramBean.getParam().split("\\.")[1];
+            }else {
+                param = paramBean.getParam();
+            }
+            if (paramBean.getValue() instanceof ArrayList) {
+                List<String> values = (List<String>) paramBean.getValue();
+                if (values != null && values.size() > 0) {
+                    List<String> join = new ArrayList<>();
+                    for (String s : values) {
+                        join.add(s);
+                    }
+
+                    queryBuilder.must(QueryBuilders.termsQuery(param,join));
+                    continue;
+                }
+            } else {
+                String value = "";
+                if (paramBean.getValue() instanceof Boolean) {
+                    value = paramBean.getValue().toString();
+                } else {
+                    value = paramBean.getValue().toString();
+                }
+                if (StringUtils.isBlank(value))
+                    continue;
+
+                if (paramBean.getParam().equals("order_status")
+                        && value.equals("DYY")
+                ){
+                    queryBuilder.mustNot(QueryBuilders.wildcardQuery("appointment_time","*"));
+                    queryBuilder.mustNot(QueryBuilders.termsQuery("order_status", "YWG", "GCSZX", "WDWG", "YWGO", "YQX", "FWZT", "YCGB",
+                            "FWQX", "FL", "YJS", "LRCD", "DSHPG", "CJ", "YPD", "DXSPD", "DZBPG", "DWDSPGP", "DXSSPGP", "DTJXSSPGP", "DZBSPGP"));
+                    continue;
+                }
+
+                if (paramBean.getParam().equals("order_status")
+                        &&  value.equals("YCD")
+                ){
+                    queryBuilder.must(QueryBuilders.termQuery("is_exception","1"));
+                    queryBuilder.mustNot(QueryBuilders.termsQuery("order_status", "YWG", "YWGO", "YJS"));
+                    continue;
+                }
+
+                if (paramBean.getParam().equals("order_status")
+                        && value.equals("DJD")
+                ){
+                    should.add(QueryBuilders.termsQuery("is_meet", "1"));
+                    should.add(QueryBuilders.termsQuery("order_status", "DJD"));
+                    queryBuilder.mustNot(QueryBuilders.termsQuery("order_status",
+                            "YQX", "FWQX", "FL", "FWZT", "YCGB"));
+
+
+                    continue;
+                }
+
+
+                if (paramBean.getParam().equals("order_status")
+                        && value.equals("PJSQZ")
+                ){
+                    queryBuilder.must(QueryBuilders.termQuery("parts_apply_status","ING"));
+                    continue;
+                }
+
+                if (paramBean.getParam().equals("order_status")
+                        && value.equals("PJYDH")
+                ){
+                    queryBuilder.must(QueryBuilders.termQuery("parts_apply_status","END"));
+                    continue;
+                }
+
+
+                if (paramBean.getParam().equals("order_status")
+                        && value.equals("PJYQX")
+                ){
+                    queryBuilder.must(QueryBuilders.termQuery("parts_apply_status","CANCEL"));
+                    continue;
+                }
+
+                if (StringUtils.equals(paramBean.getCompare(), "like")) {
+                    queryBuilder.must(QueryBuilders.matchQuery(param,value));
+                    continue;
+                }
+
+                if (value.equals("true") || value.equals("false")) {
+
+                    queryBuilder.must(QueryBuilders.termQuery(param,value.equals("true")?"1":"0"));
+                    continue;
+                } else {
+                    if (paramBean.getCompare().equals(">=")){
+
+                        queryBuilder.must(QueryBuilders.rangeQuery(param).gte(value));
+                        continue;
+                    }
+                    if (paramBean.getCompare().equals("<=")){
+                        queryBuilder.must(QueryBuilders.rangeQuery(param).lte(value));
+                        continue;
+                    }
+                    queryBuilder.must(QueryBuilders.termQuery(param,value));
+                    continue;
+                }
+            }
+        }
+
+
+    }
+
+        public static String replaceValue(String value) {
+            return value.replaceAll("'", "").replaceAll("\"", "")
+                    .replaceAll(" or ", "").replaceAll(" union ", "");
+        }
+
+
+    public void test() {
+ /*       boolean a = elasticsearchRestTemplate.indexOps(OrderBaseEs.class).delete();
+        IndexOperations indexOperations1 = elasticsearchRestTemplate.indexOps(OrderBaseEsDate.class);
+        if (!indexOperations1.exists()) {
+            indexOperations1.create();
+            Document document = indexOperations1.createMapping();
+            indexOperations1.putMapping(document);
+        }*/
+        List<PgOrderBase> list = pgOrderBaseService.lambdaQuery().list();
+
+        List<OrderBaseEsDate> orderBaseEsDates = BeanUtil.copyToList(list, OrderBaseEsDate.class);
+  /*      for (PgOrderBase pgOrderBase : list) {
+            OrderBaseEs orderBaseEs = BeanUtil.toBean(pgOrderBase, OrderBaseEs.class);
+
+            orderBaseEs.setDispatchTime(pgOrderBase.getDispatchTime() != null? DateUtil.format(pgOrderBase.getDispatchTime(),"yyyy-MM-dd HH:mm:ss"):null);
+            orderBaseEs.setWorkerReceTime(pgOrderBase.getWorkerReceTime() != null? DateUtil.format(pgOrderBase.getWorkerReceTime(),"yyyy-MM-dd HH:mm:ss"):null);
+            orderBaseEs.setDispatchWebsitTime(pgOrderBase.getDispatchWebsitTime() != null? DateUtil.format(pgOrderBase.getDispatchWebsitTime(),"yyyy-MM-dd HH:mm:ss"):null);
+
+            orderBaseEs.setLastOperatorTime(pgOrderBase.getLastOperatorTime() != null? DateUtil.format(pgOrderBase.getLastOperatorTime(),"yyyy-MM-dd HH:mm:ss"):null);
+            orderBaseEs.setAppointmentTime(pgOrderBase.getAppo() != null? DateUtil.format(pgOrderBase.getLastOperatorTime(),"yyyy-MM-dd HH:mm:ss"):null);
+
+            orderBaseEsList.add(orderBaseEs);
+        }*/
+
+       orderBaseEsRepository.saveAll(orderBaseEsDates);
+
+    }
+
+    public List<Map<String, Object>> countStatus(String startTime, String endTime, String orderSmallType, String orderSmallTypeText) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
+
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(adminUser.getAdminWebsitIds())) {
+            List<QueryBuilder> should = queryBuilder.should();
+            if (adminUser.getType().equals(1)) {
+                should.add(QueryBuilders.termsQuery("company_wechat_id", adminUser.getCompanyWechatId()));
+            }
+            should.add(QueryBuilders.termsQuery("create_websit_id", adminUser.getAdminWebsitIds()));
+            should.add(QueryBuilders.termsQuery("websit_id", adminUser.getAdminWebsitIds()));
+        }
+
+
+
+        //待预约
+        NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("DYY", QueryBuilders.boolQuery()
+                        .mustNot(QueryBuilders.existsQuery("appointment_time"))
+                        .mustNot(QueryBuilders.termsQuery("order_status", "YWG", "GCSZX", "WDWG", "YWGO", "YQX", "FWZT", "YCGB",
+                                "FWQX", "FL", "YJS", "LRCD", "DSHPG", "CJ", "YPD", "DXSPD", "DZBPG", "DWDSPGP", "DXSSPGP", "DTJXSSPGP", "DZBSPGP"))
+                        .must(QueryBuilders.rangeQuery("create_time")
+                                .gte(startTime)
+                                .lte(endTime)
+                        ))))
+                .build();
+        SearchHits response = elasticsearchRestTemplate.search(searchQuery, OrderBaseEs.class);
+
+        HashMap<String, Object> dyy = new HashMap<>();
+        dyy.put("total",this.getWorkerOrderCountResult(response.getAggregations(),"DYY"));
+        dyy.put("orderStatus","DYY");
+
+        maps.add(dyy);
+
+
+        //待抢单
+        NativeSearchQuery searchQueryDqd = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("DQD", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termQuery("order_status","DQD")))))
+                .build();
+        SearchHits responsedqd = elasticsearchRestTemplate.search(searchQueryDqd, OrderBaseEs.class);
+
+        HashMap<String, Object> dqd = new HashMap<>();
+        dqd.put("total",this.getWorkerOrderCountResult(responsedqd.getAggregations(),"DQD"));
+        dqd.put("orderStatus","DQD");
+
+        maps.add(dqd);
+
+
+        //待商户派工
+        NativeSearchQuery searchQueryDshpg = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("DSHPG", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","DSHPG","CJ","YPD","DXSPD","DZBPG","DWDSPGP","DXSSPGP",
+                                "DTJXSSPGP","DZBSPGP","DFZXPD","DFZXSPGP")))))
+                .build();
+        SearchHits responseDshpg = elasticsearchRestTemplate.search(searchQueryDshpg, OrderBaseEs.class);
+
+        HashMap<String, Object> dshpg = new HashMap<>();
+        dshpg.put("total",this.getWorkerOrderCountResult(responseDshpg.getAggregations(),"DSHPG"));
+        dshpg.put("orderStatus","DSHPG");
+
+        maps.add(dshpg);
+
+
+        //待网点派工
+        NativeSearchQuery searchQueryDwdpg = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("DWDPG", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","DWDPG","DWDPD")))))
+                .build();
+        SearchHits responseDwdpg = elasticsearchRestTemplate.search(searchQueryDwdpg, OrderBaseEs.class);
+
+        HashMap<String, Object> DWDPG = new HashMap<>();
+        DWDPG.put("total",this.getWorkerOrderCountResult(responseDwdpg.getAggregations(),"DWDPG"));
+        DWDPG.put("orderStatus","DWDPG");
+        maps.add(DWDPG);
+
+
+        //待接单
+        NativeSearchQuery searchQueryDJD = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("DJD", QueryBuilders.boolQuery()
+                        .mustNot(QueryBuilders.termsQuery("order_status","YQX", "FWQX", "FL", "FWZT", "YCGB"))
+                        .should(QueryBuilders.termsQuery("is_meet", "0"))
+                        .should(QueryBuilders.termsQuery("order_status", "DJD"))
+                        )))
+                .build();
+        SearchHits responseDJD = elasticsearchRestTemplate.search(searchQueryDJD, OrderBaseEs.class);
+
+        HashMap<String, Object> DJD = new HashMap<>();
+        DJD.put("total",this.getWorkerOrderCountResult(responseDJD.getAggregations(),"DJD"));
+        DJD.put("orderStatus","DJD");
+
+        maps.add(DJD);
+
+        //服务中
+        NativeSearchQuery searchQueryfwz = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("FWZ", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","FWZ","GCSZT","BFWG",
+                                "DSM","YZP","WDBH", "XSBH","TJXSBH","ZBBH","FZXBH")))))
+                .build();
+        SearchHits responseFWZ = elasticsearchRestTemplate.search(searchQueryfwz, OrderBaseEs.class);
+
+        HashMap<String, Object> FWZ = new HashMap<>();
+        FWZ.put("total",this.getWorkerOrderCountResult(responseFWZ.getAggregations(),"FWZ"));
+        FWZ.put("orderStatus","FWZ");
+
+        maps.add(FWZ);
+
+
+        //异常单
+        NativeSearchQuery searchQueryYCD = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("YCD", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termQuery("is_exception","1"))
+                        .mustNot(QueryBuilders.termsQuery("order_status", "YWG", "YWGO", "YJS")))))
+                .build();
+        SearchHits responseYCD = elasticsearchRestTemplate.search(searchQueryYCD, OrderBaseEs.class);
+
+        HashMap<String, Object> YCD = new HashMap<>();
+        YCD.put("total",this.getWorkerOrderCountResult(responseYCD.getAggregations(),"YCD"));
+        YCD.put("orderStatus","YCD");
+
+        maps.add(YCD);
+
+        //已完工待结算
+        NativeSearchQuery searchQueryYWGDJS = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("YWG", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","YWG","GCSZX","WDWG","YWGO")))))
+                .build();
+        SearchHits responseYWG = elasticsearchRestTemplate.search(searchQueryYWGDJS, OrderBaseEs.class);
+
+        HashMap<String, Object> YWG = new HashMap<>();
+        YWG.put("total",this.getWorkerOrderCountResult(responseYWG.getAggregations(),"YWG"));
+        YWG.put("orderStatus","YWG");
+
+        maps.add(YWG);
+
+
+        //已结算
+        NativeSearchQuery searchQueryYJS= new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("YJS", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","YJS","LRCD")))))
+                .build();
+        SearchHits responseYJS = elasticsearchRestTemplate.search(searchQueryYJS, OrderBaseEs.class);
+
+        HashMap<String, Object> YJS = new HashMap<>();
+        YJS.put("total",this.getWorkerOrderCountResult(responseYJS.getAggregations(),"YJS"));
+        YJS.put("orderStatus","YJS");
+
+        maps.add(YJS);
+
+        //已取消
+        NativeSearchQuery searchQueryYQX = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("YQX", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","YQX","FWZT","YCGB","FWQX","FL")))))
+                .build();
+        SearchHits responseYQX = elasticsearchRestTemplate.search(searchQueryYQX, OrderBaseEs.class);
+
+        HashMap<String, Object> YQX = new HashMap<>();
+        YQX.put("total",this.getWorkerOrderCountResult(responseYQX.getAggregations(),"YQX"));
+        YQX.put("orderStatus","YQX");
+
+        maps.add(YQX);
+
+
+        //配件申请中
+        NativeSearchQuery searchQueryPJSQZ = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("PJSQZ", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termQuery("parts_apply_status","ING")))))
+                .build();
+        SearchHits responsePJSQZ = elasticsearchRestTemplate.search(searchQueryPJSQZ, OrderBaseEs.class);
+
+        HashMap<String, Object> PJSQZ = new HashMap<>();
+        PJSQZ.put("total",this.getWorkerOrderCountResult(responsePJSQZ.getAggregations(),"PJSQZ"));
+        PJSQZ.put("orderStatus","PJSQZ");
+
+        maps.add(PJSQZ);
+
+
+        //配件已到货
+        NativeSearchQuery searchQueryPJYDH = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("PJYDH", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termQuery("parts_apply_status","END")))))
+                .build();
+        SearchHits responsePJYDH = elasticsearchRestTemplate.search(searchQueryPJYDH, OrderBaseEs.class);
+
+        HashMap<String, Object> PJYDH = new HashMap<>();
+        PJYDH.put("total",this.getWorkerOrderCountResult(responsePJYDH.getAggregations(),"PJYDH"));
+        PJYDH.put("orderStatus","PJSQZ");
+
+        maps.add(PJYDH);
+
+
+        //配件已取消
+        NativeSearchQuery searchQueryPJYQX = new NativeSearchQueryBuilder()
+                .withQuery(queryBuilder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("PJYQX", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termQuery("parts_apply_status","CANCEL")))))
+                .build();
+        SearchHits responsePJYQX = elasticsearchRestTemplate.search(searchQueryPJYQX, OrderBaseEs.class);
+
+        HashMap<String, Object> PJYQX = new HashMap<>();
+        PJYQX.put("total",this.getWorkerOrderCountResult(responsePJYQX.getAggregations(),"PJYQX"));
+        PJYQX.put("orderStatus","PJYQX");
+
+        maps.add(PJYQX);
+
+
+
+        return maps;
+    }
+
+    public AbstractAggregationBuilder<?> getAggs(FilterAggregationBuilder filter) {
+        return filter.subAggregation(AggregationBuilders.sum("total_mac_sum").field("total_num"))
+                .subAggregation(AggregationBuilders.terms("order_type_group").field("order_type")
+                        .subAggregation(AggregationBuilders.sum("mac_sum").field("total_num")));
+    }
+    private long getWorkerOrderCountResult(Aggregations aggregations, String name) {
+        StringBuffer sb = new StringBuffer();
+        ParsedFilter parsedFilter = aggregations.get(name);
+        //总服务单数
+        long totalOrderNums = parsedFilter.getDocCount();
+
+        return totalOrderNums;
+    }
+
+}

+ 6 - 0
mall-server-api/src/main/resources/bootstrap-dev.properties

@@ -102,6 +102,12 @@ spring.elasticsearch.rest.password=zfire2022@
 spring.elasticsearch.rest.connection-timeout=5s
 spring.elasticsearch.rest.read-timeout=30s
 
+#spring.elasticsearch.rest.uris=http://es-cn-i7m27kcyd002c3v8f.public.elasticsearch.aliyuncs.com:9200
+#spring.elasticsearch.rest.username=elastic
+#spring.elasticsearch.rest.password=zongjUzongjU2021_
+#spring.elasticsearch.rest.connection-timeout=5s
+#spring.elasticsearch.rest.read-timeout=30s
+
 #cmc bank request setting
 cmc.bank.url=http://cdctest.cmburl.cn:80/cdcserver/api/v2