Kaynağa Gözat

Merge branch 'develop-es'

# Conflicts:
#	mall-miniapp-service/src/main/java/com/gree/mall/miniapp/config/aop/ApiAspect.java
#	mall-server-api/src/main/java/com/gree/mall/manager/controller/admin/AdminUserController.java
‘linchangsheng’ 1 ay önce
ebeveyn
işleme
2c83347b25

+ 551 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/workorder/OrderBaseEs.java

@@ -0,0 +1,551 @@
+package com.gree.mall.miniapp.bean.workorder;
+
+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;
+
+/**
+ * @author qinrongjun
+ * @description
+ * @date 2023/6/19 10:39 星期一
+ */
+@Data
+@Document(indexName = "pg_order_base")
+public class OrderBaseEs {
+
+    @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 String dispatchTime;
+
+    @ApiModelProperty(value = "师傅接单时间")
+    @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, format = DateFormat.custom,pattern ="yyyy-MM-dd HH:mm:ss")
+    private String 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 String lastOperatorTime;
+
+    @ApiModelProperty(value = "预约安装/维修时间")
+    @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,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String appointmentEndTime;
+
+    @ApiModelProperty(value = "预约备注")
+    @Field(value = "appointment_remark", type = FieldType.Keyword)
+    private String appointmentRemark;
+
+    @ApiModelProperty(value = "安装/维修总数量")
+    @Field(value = "total_num", type = FieldType.Keyword)
+    private Integer totalNum;
+
+    @ApiModelProperty(value = "未完成数量")
+    @Field(value = "undone_num", type = FieldType.Keyword)
+    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 String overTime;
+
+    @ApiModelProperty(value = "网点报完工时间")
+    @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,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String overDate;
+
+    @ApiModelProperty(value = "正常关闭时间")
+    @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,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String createDate;
+
+    @ApiModelProperty(value = "创建时间")
+    @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)
+    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 String 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 String 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 String 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 String 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 Boolean 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 Boolean 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 Boolean isQd;
+
+    @ApiModelProperty(value = "是否已产生通知 true=是 false=否")
+    @Field(value = "is_qd_notice", type = FieldType.Keyword)
+    private Boolean isQdNotice;
+
+    @ApiModelProperty(value = "是否为拆机")
+    @Field(value = "is_cj", type = FieldType.Keyword)
+    private Boolean isCj;
+
+    @ApiModelProperty(value = "是否为租赁单 true/false")
+    @Field(value = "is_zl", type = FieldType.Keyword)
+    private Boolean isZl;
+
+
+
+    @ApiModelProperty(value = "是否为工单导入 true/false")
+    @Field(value = "is_import_excel", type = FieldType.Keyword)
+    private Boolean 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 Boolean 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 Boolean isMeet;
+
+    @ApiModelProperty(value = "申请状态 ING=申请中 END=到货反馈 CANCEL=取消申请")
+    @Field(value = "parts_apply_status", type = FieldType.Keyword)
+    private String partsApplyStatus;
+
+    @ApiModelProperty(value = "首次派工时间")
+    @Field(value = "first_dispatch_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String firstDispatchTime;
+
+    @ApiModelProperty(value = "首次预约时间")
+    @Field(value = "first_appointment_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String firstAppointmentTime;
+
+    @ApiModelProperty(value = "取消时间")
+    @Field(value = "cancel_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String cancelTime;
+}

+ 86 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/workorder/PgOrderWorkerDateEs.java

@@ -0,0 +1,86 @@
+package com.gree.mall.miniapp.bean.workorder;
+
+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.util.Date;
+
+/**
+ * @author qinrongjun
+ * @description
+ * @date 2023/6/19 10:39 星期一
+ */
+@Data
+@Document(indexName = "pg_order_worker")
+public class PgOrderWorkerDateEs {
+
+    @Id
+    @Field(value = "id",  type = FieldType.Keyword)
+    private String id;
+
+    @ApiModelProperty(value = "工单号")
+    @Field(value = "order_base_id", type = FieldType.Keyword)
+    private String orderBaseId;
+
+    @ApiModelProperty(value = "网点id")
+    @Field(value = "websit_id", type = FieldType.Keyword)
+    private String websitId;
+
+    @ApiModelProperty(value = "网点名称")
+    @Field(value = "websit_name", type = FieldType.Keyword)
+    private String websitName;
+
+    @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_number", type = FieldType.Keyword)
+    private String workerNumber;
+
+    @ApiModelProperty(value = "师傅身份证")
+    @Field(value = "worker_idcard", type = FieldType.Keyword)
+    private String workerIdcard;
+
+    @ApiModelProperty(value = "师傅查询条件")
+    @Field(value = "worker_query", type = FieldType.Keyword)
+    private String workerQuery;
+
+    @ApiModelProperty(value = "是否费用审批(维保工单用)")
+    @Field(value = "is_examine", type = FieldType.Boolean)
+    private Boolean isExamine;
+
+    @ApiModelProperty(value = "是否为大工或主要服务人员 1=是 0=否")
+    @Field(value = "is_master", type = FieldType.Boolean)
+    private Boolean isMaster;
+
+    @ApiModelProperty(value = "创建时间")
+    @Field(value = "create_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String createTime;
+
+    @ApiModelProperty(value = "修改时间")
+    @Field(value = "update_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private String updateTime;
+
+    @ApiModelProperty(value = "创建人")
+    @Field(value = "create_by", type = FieldType.Keyword)
+    private String createBy;
+
+    @ApiModelProperty(value = "修改人")
+    @Field(value = "update_by", type = FieldType.Keyword)
+    private String updateBy;
+
+}

+ 88 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/bean/workorder/PgOrderWorkerEs.java

@@ -0,0 +1,88 @@
+package com.gree.mall.miniapp.bean.workorder;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+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.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * @author qinrongjun
+ * @description
+ * @date 2023/6/19 10:39 星期一
+ */
+@Data
+@Document(indexName = "pg_order_worker")
+public class PgOrderWorkerEs {
+
+    @Id
+    @Field(value = "id",  type = FieldType.Keyword)
+    private String id;
+
+    @ApiModelProperty(value = "工单号")
+    @Field(value = "order_base_id", type = FieldType.Keyword)
+    private String orderBaseId;
+
+    @ApiModelProperty(value = "网点id")
+    @Field(value = "websit_id", type = FieldType.Keyword)
+    private String websitId;
+
+    @ApiModelProperty(value = "网点名称")
+    @Field(value = "websit_name", type = FieldType.Keyword)
+    private String websitName;
+
+    @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_number", type = FieldType.Keyword)
+    private String workerNumber;
+
+    @ApiModelProperty(value = "师傅身份证")
+    @Field(value = "worker_idcard", type = FieldType.Keyword)
+    private String workerIdcard;
+
+    @ApiModelProperty(value = "师傅查询条件")
+    @Field(value = "worker_query", type = FieldType.Keyword)
+    private String workerQuery;
+
+    @ApiModelProperty(value = "是否费用审批(维保工单用)")
+    @Field(value = "is_examine", type = FieldType.Boolean)
+    private Boolean isExamine;
+
+    @ApiModelProperty(value = "是否为大工或主要服务人员 1=是 0=否")
+    @Field(value = "is_master", type = FieldType.Boolean)
+    private Boolean isMaster;
+
+    @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 = "update_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人")
+    @Field(value = "create_by", type = FieldType.Keyword)
+    private String createBy;
+
+    @ApiModelProperty(value = "修改人")
+    @Field(value = "update_by", type = FieldType.Keyword)
+    private String updateBy;
+
+}

+ 2 - 6
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/config/aop/ApiAspect.java

@@ -72,23 +72,20 @@ public class ApiAspect {
         }
         String token = CommonUtils.getToken(request);
         String jwtUserId = CommonUtils.getUserId(request);
-        log.info("用户"+jwtUserId+"token:{} 访问 {}+", token, request.getRequestURI());
+      //  log.info("用户"+jwtUserId+"token:{} 访问 {}+", token, request.getRequestURI());
         if (StringUtils.isNotBlank(jwtUserId) && StringUtils.isNotBlank(token) && token.equals(jwtUserId)) {
             throw new RemoteServiceException(ResponseHelper.ResponseCode_TOKEN_ID_ERROR, "请求不合法, token");
         }
 
 
         //String userId = CommonUtils.getUserId(request);
-        log.info("用户"+jwtUserId+"redis开始时间"+ DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
         String userId = (String)redisUtil.get(Constant.RedisPrefix.TOKEN_WX+token);
-        log.info("用户"+jwtUserId+"redis结束时间"+ DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
         if (StringUtils.isBlank(userId) || StringUtils.isBlank(jwtUserId)) {
             throw new RemoteServiceException(ResponseHelper.ResponseCode_TOKEN_ID_ERROR, "请求不合法");
         }
 
-        log.info("用户"+jwtUserId+"mysql开始时间"+ DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
-        User userToken = userService.getById(jwtUserId);
 
+        User userToken = userService.getById(jwtUserId);
         if (userToken == null) {
             throw new RemoteServiceException(ResponseHelper.ResponseCode_TOKEN_ID_ERROR, "请求不合法");
         }
@@ -98,7 +95,6 @@ public class ApiAspect {
         if(user == null){
             throw new RemoteServiceException(ResponseHelper.ResponseCode_AUTH_ERROR, "用户不存在,请联系相关人员");
         }
-        log.info("用户"+jwtUserId+"mysql结束时间"+ DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
     }
 
     private Method getSourceMethod(JoinPoint jp) {

+ 405 - 11
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/workorder/OrderBaseLogic.java

@@ -2,6 +2,7 @@ package com.gree.mall.miniapp.logic.workorder;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -27,7 +28,23 @@ import com.gree.mall.miniapp.plus.service.*;
 import com.gree.mall.miniapp.utils.DateUtils;
 import com.gree.mall.miniapp.utils.StringUtil;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+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.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
+import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
+import org.springframework.data.elasticsearch.core.SearchHits;
+import org.springframework.data.elasticsearch.core.query.*;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -38,6 +55,7 @@ import java.util.stream.Collectors;
 
 @RequiredArgsConstructor
 @Service
+@Slf4j
 public class OrderBaseLogic {
 
     private final PgOrderBaseService pgOrderBaseService;
@@ -54,12 +72,13 @@ public class OrderBaseLogic {
     private final AdminWebsitService adminWebsitService;
     private final WorkerTeamService workerTeamService;
     private final WebsitUserService websitUserService;
-
+    private final ElasticsearchRestTemplate elasticsearchRestTemplate;
+    private final ElasticsearchOperations elasticsearchOperations;
     /**
-     * 工单状态统计
+     * 工单状态统计mysql
      * @return
      */
-    public CountOrderStatusBean countOrderStatus(String pgIncreOrderId, Boolean isYb, Boolean isWb) {
+    public CountOrderStatusBean countOrderStatusMysql(String pgIncreOrderId, Boolean isYb, Boolean isWb) {
         CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
         CountOrderStatusBean countOrderStatusBean = orderBaseCMapper.countOrderStatus(currentCompanyWechat.getUserId(),
                 currentCompanyWechat.getUser().getWorkerNumber(), pgIncreOrderId, isYb, isWb, currentCompanyWechat.getCompanyWechatId());
@@ -72,6 +91,178 @@ public class OrderBaseLogic {
     }
 
     /**
+     * 工单状态统计ES
+     * @return
+     */
+    public CountOrderStatusBean countOrderStatus(String pgIncreOrderId, Boolean isYb, Boolean isWb) {
+        CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
+        CountOrderStatusBean countOrderStatusBean = new CountOrderStatusBean();
+
+        BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
+
+        // 根据参数动态添加筛选条件
+        if (StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber())) {
+            boolQuery.must(QueryBuilders.matchQuery("worker_idcard", currentCompanyWechat.getUser().getIdCard()));
+        }
+        else  {
+            boolQuery.must(QueryBuilders.matchQuery("worker_number", currentCompanyWechat.getUser().getWorkerNumber()));
+        }
+
+        // 构建查询,最大只能查两万数据
+        NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
+                .withQuery(boolQuery)
+                .withPageable(PageRequest.of(0, 10000))
+                .build();
+
+        // 执行查询
+        List<PgOrderWorkerDateEs> pgOrderWorkerEs = elasticsearchRestTemplate.search(searchQuery, PgOrderWorkerDateEs.class).map(searchHit -> searchHit.getContent())
+                .toList();
+
+        List<String> orderBaseIds = pgOrderWorkerEs.stream().map(PgOrderWorkerDateEs::getOrderBaseId).collect(Collectors.toList());
+
+        if (CollectionUtil.isEmpty(orderBaseIds))
+            return new CountOrderStatusBean();
+
+        BoolQueryBuilder boolQueryOrder = QueryBuilders.boolQuery()
+                .mustNot(QueryBuilders.termsQuery("order_status", "YQX","FWQX","FL","FWZT","YCGB"))
+                ;
+        boolQueryOrder.must(
+                QueryBuilders.boolQuery().should(QueryBuilders.termsQuery("id", orderBaseIds))
+                        .should(QueryBuilders.termsQuery("order_status", OrderBaseStatusEnum.DQD.getKey()))
+        );
+
+
+
+
+
+        //待接单
+        // A 或 B 的条件
+        BoolQueryBuilder orConditionAB = QueryBuilders.boolQuery()
+                .must(QueryBuilders.matchQuery("is_import_excel", false))
+                .must(QueryBuilders.matchQuery("order_status",  OrderBaseStatusEnum.DJD.getKey()));
+
+        // C 或 D 的条件
+        BoolQueryBuilder orConditionCD = QueryBuilders.boolQuery()
+                .must(QueryBuilders.matchQuery("is_import_excel", true))
+                .must(QueryBuilders.matchQuery("is_meet", false));
+
+        NativeSearchQuery searchQueryDJD = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("DJD", QueryBuilders.boolQuery()
+                        .should(orConditionAB).should(orConditionCD)
+                        )))
+                .build();
+        SearchHits response = elasticsearchRestTemplate.search(searchQueryDJD, OrderBaseEs.class);
+
+
+        countOrderStatusBean.setDjd(this.getWorkerOrderCountResult(response.getAggregations(),"DJD"));
+
+        //服务中
+        NativeSearchQuery searchQueryFWZ = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("FWZ", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","FWZ","GCSZT","BFWG","DSM","YZP","XSBH","TJXSBH","ZBBH","FZXBH","WDBH"))
+                )))
+                .build();
+        SearchHits responseFWZ = elasticsearchRestTemplate.search(searchQueryFWZ, OrderBaseEs.class);
+        countOrderStatusBean.setFwz(this.getWorkerOrderCountResult(responseFWZ.getAggregations(),"FWZ"));
+
+        //异常单
+        NativeSearchQuery searchQueryYCD = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("YCD", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("is_exception",true))
+                )))
+                .build();
+        SearchHits responseYCD = elasticsearchRestTemplate.search(searchQueryYCD, OrderBaseEs.class);
+        countOrderStatusBean.setYcd(this.getWorkerOrderCountResult(responseYCD.getAggregations(),"YCD"));
+
+
+        //待抢单
+        NativeSearchQuery searchQueryDQD = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("DQD", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","DQD"))
+                )))
+                .build();
+        SearchHits responseDQD = elasticsearchRestTemplate.search(searchQueryDQD, OrderBaseEs.class);
+        countOrderStatusBean.setDqd(this.getWorkerOrderCountResult(responseDQD.getAggregations(),"DQD"));
+
+        //已完工
+        NativeSearchQuery searchQueryYWG = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("YWG", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.termsQuery("order_status","YWG","YJS","GCSZX","YWGO","WDWG"))
+                )))
+                .build();
+        SearchHits responseYWG = elasticsearchRestTemplate.search(searchQueryYWG, OrderBaseEs.class);
+        countOrderStatusBean.setYwg(this.getWorkerOrderCountResult(responseYWG.getAggregations(),"YWG"));
+
+
+        //今日完工
+        NativeSearchQuery searchQueryJRWG = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("JRWG", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.rangeQuery("over_time")
+                                .gte(DateUtil.format(DateUtil.beginOfDay(new Date()),"yyyy-MM-dd HH:mm:ss"))
+                                .lte(DateUtil.format(DateUtil.endOfDay(new Date()),"yyyy-MM-dd HH:mm:ss")))
+                )))
+                .build();
+        SearchHits responseJRWG = elasticsearchRestTemplate.search(searchQueryJRWG, OrderBaseEs.class);
+        countOrderStatusBean.setJrwg(this.getWorkerOrderCountResult(responseJRWG.getAggregations(),"JRWG"));
+
+
+        //近半年完工
+        NativeSearchQuery searchQueryJBNWG = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("JBNWG", QueryBuilders.boolQuery()
+                        .must(QueryBuilders.rangeQuery("over_time")
+                                .gte(DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetMonth(new Date(),-6)),"yyyy-MM-dd HH:mm:ss"))
+                                .lte(DateUtil.format(DateUtil.endOfDay(new Date()),"yyyy-MM-dd HH:mm:ss")))
+                )))
+                .build();
+        SearchHits responseJBNWG = elasticsearchRestTemplate.search(searchQueryJBNWG, OrderBaseEs.class);
+        countOrderStatusBean.setJbnwg(this.getWorkerOrderCountResult(responseJBNWG.getAggregations(),"JBNWG"));
+
+
+        //未完工
+        NativeSearchQuery searchQueryWWG = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(PageRequest.of(1, 1))
+                .addAggregation(this.getAggs(AggregationBuilders.filter("WWG", QueryBuilders.boolQuery()
+                        .mustNot(QueryBuilders.termsQuery("order_status","YWG","YJS","GCSZX","YWGO","WDWG","DQD"))
+                )))
+                .build();
+        SearchHits responseWWG = elasticsearchRestTemplate.search(searchQueryWWG, OrderBaseEs.class);
+        countOrderStatusBean.setWwg(this.getWorkerOrderCountResult(responseWWG.getAggregations(),"WWG"));
+        countOrderStatusBean.setAll(orderBaseIds.size());
+
+        return countOrderStatusBean;
+    }
+
+    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 Integer getWorkerOrderCountResult(Aggregations aggregations, String name) {
+        StringBuffer sb = new StringBuffer();
+        ParsedFilter parsedFilter = aggregations.get(name);
+        //总服务单数
+        long totalOrderNums = parsedFilter.getDocCount();
+
+        return Convert.toInt(totalOrderNums);
+    }
+
+    /**
      * 未来7天的日程统计
      * @return
      */
@@ -107,12 +298,28 @@ public class OrderBaseLogic {
         );
         mySchedule7Day.setDayList(dayList);
 
-        List<String> orderBaseIds = pgOrderWorkerService.lambdaQuery()
-                .and(item -> item.eq(PgOrderWorker::getWorkerId, currentCompanyWechat.getUserId())
-                        .or(!StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber()))
-                        .eq(PgOrderWorker::getWorkerNumber,currentCompanyWechat.getUser().getWorkerNumber())
-                )
-                .list().stream().map(PgOrderWorker::getOrderBaseId).distinct().collect(Collectors.toList());
+        BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
+
+        // 根据参数动态添加筛选条件
+        if (StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber())) {
+            boolQuery.must(QueryBuilders.matchQuery("worker_idcard", currentCompanyWechat.getUser().getIdCard()));
+        }
+        else  {
+            boolQuery.must(QueryBuilders.matchQuery("worker_number", currentCompanyWechat.getUser().getWorkerNumber()));
+        }
+
+
+        // 构建查询,最大只能查两万数据
+        NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
+                .withQuery(boolQuery)
+                .withPageable(PageRequest.of(0, 10000))
+                .build();
+
+        // 执行查询
+        List<PgOrderWorkerDateEs> pgOrderWorkerEs = elasticsearchRestTemplate.search(searchQuery, PgOrderWorkerDateEs.class).map(searchHit -> searchHit.getContent())
+                .toList();
+
+        List<String> orderBaseIds = pgOrderWorkerEs.stream().map(PgOrderWorkerDateEs::getOrderBaseId).collect(Collectors.toList());
         if(CollectionUtils.isEmpty(orderBaseIds)){
             return mySchedule7Day;
         }
@@ -184,13 +391,13 @@ public class OrderBaseLogic {
     }
 
     /**
-     * 工单列表
+     * 工单列表mysql
      * @param byDay 1=今天 2=明天 3=其他
      * @param startTime
      * @param endTime
      * @return
      */
-    public IPage<OrderBaseVO> list(String keyword,String pgIncreOrderId,Boolean isYb,Boolean isWb,OrderBaseStatusEnum orderBaseStatusEnum,
+    public IPage<OrderBaseVO> listMysql(String keyword,String pgIncreOrderId,Boolean isYb,Boolean isWb,OrderBaseStatusEnum orderBaseStatusEnum,
                                    Integer byDay,String startTime,String endTime,Integer pageNum,Integer pageSize){
         CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
         if(!StringUtils.equals(currentCompanyWechat.getUser().getType(),UserTypeEnum.WORKER.getKey())){
@@ -360,6 +567,193 @@ public class OrderBaseLogic {
     }
 
 
+
+    public IPage<OrderBaseVO> list(String keyword,String pgIncreOrderId,Boolean isYb,Boolean isWb,OrderBaseStatusEnum orderBaseStatusEnum,
+                                        Integer byDay,String startTime,String endTime,Integer pageNum,Integer pageSize){
+
+        CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
+        if(!StringUtils.equals(currentCompanyWechat.getUser().getType(),UserTypeEnum.WORKER.getKey())){
+            return new Page<>(pageNum,pageSize);
+        }
+        //查询师傅拥有工单
+        BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
+
+        // 根据参数动态添加筛选条件
+        if (StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber())) {
+            boolQuery.must(QueryBuilders.matchQuery("worker_idcard", currentCompanyWechat.getUser().getIdCard()));
+        }
+        else  {
+            boolQuery.must(QueryBuilders.matchQuery("worker_number", currentCompanyWechat.getUser().getWorkerNumber()));
+        }
+
+        // 构建查询,最大只能查两万数据
+        NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
+                .withQuery(boolQuery)
+                .withPageable(PageRequest.of(0, 10000))
+                .build();
+
+        // 执行查询
+        List<PgOrderWorkerDateEs> pgOrderWorkerEs = elasticsearchRestTemplate.search(searchQuery, PgOrderWorkerDateEs.class).map(searchHit -> searchHit.getContent())
+                .toList();
+
+        List<String> orderBaseIds = pgOrderWorkerEs.stream().map(PgOrderWorkerDateEs::getOrderBaseId).collect(Collectors.toList());
+
+
+        if(byDay != null){
+            if(byDay == 1) {
+                startTime = DateUtil.formatDateTime(DateUtil.beginOfDay(new Date()));
+                endTime = DateUtil.formatDateTime(DateUtil.endOfDay(new Date()));
+            }else if(byDay == 2){
+                startTime = DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.beginOfDay(new Date()),1));
+                endTime = DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.endOfDay(new Date()),1));
+            }else if(byDay == 3){
+                startTime = DateUtil.formatDateTime(DateUtil.beginOfDay(new Date()));
+                endTime = DateUtil.formatDateTime(DateUtil.offsetDay(DateUtil.endOfDay(new Date()),1));
+            }
+        }
+
+        // 创建 Bool 查询
+        BoolQueryBuilder boolQueryOrder = QueryBuilders.boolQuery()
+                .mustNot(QueryBuilders.termsQuery("order_status", "YQX","FWQX","FL","FWZT","YCGB"))
+                ;
+        boolQueryOrder.must(
+                QueryBuilders.boolQuery().should(QueryBuilders.termsQuery("id", orderBaseIds))
+                        .should(QueryBuilders.termsQuery("order_status", OrderBaseStatusEnum.DQD.getKey()))
+        );
+
+        if (!StringUtil.isEmpty(startTime)) {
+            boolQueryOrder.must(QueryBuilders.rangeQuery("create_time")
+                    .gte(startTime)
+                    .lte(endTime)
+            );
+        }
+
+        String orderStatus = orderBaseStatusEnum != null ? orderBaseStatusEnum.getKey() : null;
+
+        if(StringUtils.isNotBlank(keyword)){
+            boolQueryOrder.must(
+                    QueryBuilders.boolQuery().should(QueryBuilders.wildcardQuery("id","*"+keyword+"*"))
+                            .should(QueryBuilders.wildcardQuery("user_name","*"+keyword+"*"))
+                            .should(QueryBuilders.wildcardQuery("order_small_type_text","*"+keyword+"*"))
+                            .should(QueryBuilders.wildcardQuery("user_mobile","*"+keyword+"*"))
+                            .should(QueryBuilders.wildcardQuery("address","*"+keyword+"*"))
+            );
+        }
+
+        if(StringUtils.equals(orderStatus, OrderBaseStatusEnum.DJD.getKey())) {
+            // A 或 B 的条件
+            BoolQueryBuilder orConditionAB = QueryBuilders.boolQuery()
+                    .must(QueryBuilders.matchQuery("is_import_excel", false))
+                    .must(QueryBuilders.matchQuery("order_status",  OrderBaseStatusEnum.DJD.getKey()));
+
+            // C 或 D 的条件
+            BoolQueryBuilder orConditionCD = QueryBuilders.boolQuery()
+                    .must(QueryBuilders.matchQuery("is_import_excel", true))
+                    .must(QueryBuilders.matchQuery("is_meet", false));
+
+            boolQueryOrder
+                  .must( QueryBuilders.boolQuery()
+                          .should(orConditionAB).should(orConditionCD));
+
+        }
+
+        if(StringUtils.equals(orderStatus, OrderBaseStatusEnum.FWZ.getKey())) {
+            boolQueryOrder .must(QueryBuilders.termsQuery("order_status","FWZ","GCSZT","BFWG","DSM","YZP","XSBH","TJXSBH","ZBBH","FZXBH","WDBH"));
+
+        }
+
+        if(StringUtils.equals(orderStatus, OrderBaseStatusEnum.YCD.getKey())) {
+            boolQueryOrder.must(QueryBuilders.termsQuery("is_exception",true));
+        }
+
+        if(StringUtils.equals(orderStatus, OrderBaseStatusEnum.YWG.getKey())) {
+            boolQueryOrder.must(QueryBuilders.termsQuery("order_status","YWG","YJS","GCSZX","YWGO","WDWG"));
+
+        }
+
+        if(StringUtils.equals(orderStatus, OrderBaseStatusEnum.DQD.getKey())) {
+            boolQueryOrder.must(QueryBuilders.termsQuery("order_status","DQD"));
+
+        }
+
+        if(StringUtils.equals(orderStatus, OrderBaseStatusEnum.DCL.getKey())) {
+            boolQueryOrder.mustNot(QueryBuilders.termsQuery("order_status","YWG","YJS","GCSZX","YWGO","WDWG","DQD"));
+        }
+
+        if (pageSize == -1) {
+            pageSize = 10;
+        }
+
+        // 创建分页请求
+        Pageable pageable = PageRequest.of(pageNum-1, pageSize);
+
+        // 创建查询
+        Query searchQueryOrder = new NativeSearchQueryBuilder()
+                .withQuery(boolQueryOrder)
+                .withPageable(pageable)
+                .build();
+
+
+        SearchHits<OrderBaseEs> searchHits  = elasticsearchRestTemplate.search(searchQueryOrder, OrderBaseEs.class);
+
+
+        // 获取结果和总数
+        List<OrderBaseEs> content = searchHits.get().map(hit -> hit.getContent()).collect(Collectors.toList());
+        long totalHits = searchHits.getTotalHits();
+
+        List<OrderBaseVO> orderBaseVOS = BeanUtil.copyToList(content, OrderBaseVO.class);
+
+
+
+        //服务单标识
+        List<String> orderIds = orderBaseVOS
+                .stream()
+                .map(OrderBaseVO::getId)
+                .collect(Collectors.toList());
+        List<AdminWebsit> adminWebsits = new ArrayList<>();
+        Map<String, String> adminWebsitMap = new HashMap<>();
+
+        if (CollectionUtil.isNotEmpty(orderBaseVOS)) {
+            adminWebsits = adminWebsitService.lambdaQuery()
+                    .eq(AdminWebsit::getCompanyWechatId, currentCompanyWechat.getCompanyWechatId())
+                    .in(AdminWebsit::getWebsitId, orderBaseVOS.stream().map(OrderBaseVO::getWebsitId).collect(Collectors.toList()))
+                    .list();
+        }
+
+        if (CollectionUtil.isNotEmpty(adminWebsits)) {
+            adminWebsitMap = adminWebsits.stream().collect(Collectors.toMap(AdminWebsit::getWebsitId, AdminWebsit::getAttr));
+        }
+
+        Map<String, List<PgOrderFlag>> mapList = this.getOrderFlags(orderIds);
+        for (OrderBaseVO orderBaseVO : orderBaseVOS) {
+            orderBaseVO.setOrderFlags(mapList.get(orderBaseVO.getId()));
+            //明细
+            orderBaseVO.setPgOrderProducts(
+                    pgOrderProductService.lambdaQuery().eq(PgOrderProduct::getOrderBaseId,orderBaseVO.getId()).list()
+            );
+            //待抢单状态隐藏
+            if(StringUtils.equals(orderBaseVO.getOrderStatus(),OrderBaseStatusEnum.DQD.getKey())){
+                orderBaseVO.setUserMobile(orderBaseVO.getUserMobile().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
+                orderBaseVO.setAddress(orderBaseVO.getProvince()+orderBaseVO.getCity()+orderBaseVO.getArea()+orderBaseVO.getStreet()+"****");
+            }
+            final String attr = adminWebsitMap.get(orderBaseVO.getWebsitId());
+
+            orderBaseVO.setAttr(attr);
+            if (StringUtils.isNotBlank(attr)
+                    && attr.equals(WebsitAttrEnum.SELF.getKey())
+                    && "安装, 拆移机".contains(orderBaseVO.getOrderSmallTypeText())) {
+                orderBaseVO.setNeedSlave(true);
+            }
+        }
+        Page<OrderBaseVO> page = new Page<>();
+        page.setRecords(orderBaseVOS);
+        page.setCurrent(pageNum);
+        page.setTotal(totalHits);
+        page.setSize(pageSize);
+
+        return page;
+    }
+
     /**
      * 客户的工单列表
      * @param flag 1=待预约 2=服务中 3=待评价 4=已完成

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

@@ -1,5 +1,6 @@
 package com.gree.mall.manager.bean.es;
 
+import com.gree.mall.manager.plus.entity.PgOrderBase;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springframework.data.annotation.Id;
@@ -546,4 +547,8 @@ public class OrderBaseEsDate {
     @ApiModelProperty(value = "取消时间")
     @Field(value = "cancel_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
     private Date cancelTime;
+
+    @ApiModelProperty(value = "联系人虚拟号")
+    @Field(value = "contact_virtual_no", type = FieldType.Keyword)
+    private String contactVirtualNo;
 }

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

@@ -0,0 +1,92 @@
+package com.gree.mall.manager.bean.es;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.gree.mall.manager.plus.entity.PgOrderWorker;
+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_worker")
+public class PgOrderWorkerEs  {
+
+    @Id
+    @Field(value = "id",  type = FieldType.Keyword)
+    private String id;
+
+    @ApiModelProperty(value = "工单号")
+    @Field(value = "order_base_id", type = FieldType.Keyword)
+    private String orderBaseId;
+
+    @ApiModelProperty(value = "网点id")
+    @Field(value = "websit_id", type = FieldType.Keyword)
+    private String websitId;
+
+    @ApiModelProperty(value = "网点名称")
+    @Field(value = "websit_name", type = FieldType.Keyword)
+    private String websitName;
+
+    @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_number", type = FieldType.Keyword)
+    private String workerNumber;
+
+    @ApiModelProperty(value = "师傅身份证")
+    @Field(value = "worker_idcard", type = FieldType.Keyword)
+    private String workerIdcard;
+
+    @ApiModelProperty(value = "师傅查询条件")
+    @Field(value = "worker_query", type = FieldType.Keyword)
+    private String workerQuery;
+
+    @ApiModelProperty(value = "是否费用审批(维保工单用)")
+    @Field(value = "is_examine", type = FieldType.Boolean)
+    private Boolean isExamine;
+
+    @ApiModelProperty(value = "是否为大工或主要服务人员 1=是 0=否")
+    @Field(value = "is_master", type = FieldType.Boolean)
+    private Boolean isMaster;
+
+    @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 = "update_time", type = FieldType.Date,format = DateFormat.custom, pattern ="yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    @ApiModelProperty(value = "创建人")
+    @Field(value = "create_by", type = FieldType.Keyword)
+    private String createBy;
+
+    @ApiModelProperty(value = "修改人")
+    @Field(value = "update_by", type = FieldType.Keyword)
+    private String updateBy;
+
+}

+ 6 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/admin/AdminUserController.java

@@ -1,5 +1,8 @@
 package com.gree.mall.manager.controller.admin;
 
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.gree.mall.manager.annotation.ApiNotAuth;
 import com.gree.mall.manager.bean.ExcelData;
@@ -25,13 +28,16 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.integration.redis.util.RedisLockRegistry;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 

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

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

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

@@ -7,18 +7,18 @@ 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.es.PgOrderWorkerEs;
 import com.gree.mall.manager.bean.es.SettlementOrderEs;
 import com.gree.mall.manager.bean.listvo.param.WorkOrderZfireParam;
 import com.gree.mall.manager.bean.listvo.workorder.OrderBaseVO;
 import com.gree.mall.manager.enums.MaterialExamineStatusEnum;
 import com.gree.mall.manager.es.OrderBaseEsRepository;
+import com.gree.mall.manager.es.OrderWorkerEsRepository;
 import com.gree.mall.manager.es.SettlementOrderEsRepository;
 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.SettlementOrder;
-import com.gree.mall.manager.plus.entity.WorkerOrder;
+import com.gree.mall.manager.plus.entity.*;
 import com.gree.mall.manager.plus.service.PgOrderBaseService;
+import com.gree.mall.manager.plus.service.PgOrderWorkerService;
 import com.gree.mall.manager.plus.service.SettlementOrderService;
 import com.gree.mall.manager.plus.service.WorkerOrderService;
 import com.gree.mall.manager.utils.StringUtil;
@@ -39,6 +39,7 @@ 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;
@@ -64,6 +65,8 @@ public class OrderBaseEsLogic {
     private final PgOrderBaseService pgOrderBaseService;
     private final SettlementOrderService settlementOrderService;
     private final SettlementOrderEsRepository settlementOrderEsRepository;
+    private final OrderWorkerEsRepository orderWorkerEsRepository;
+    private final PgOrderWorkerService pgOrderWorkerService;
 
     public IPage<OrderBaseVO> orderBaseEsList(WorkOrderZfireParam zfireParamBean) {
 
@@ -85,6 +88,7 @@ public class OrderBaseEsLogic {
         if (zfireParamBean.getIsWait() != null && zfireParamBean.getIsWait()){
             List<String> collect = workerOrderService.lambdaQuery()
                     .eq(WorkerOrder::getPayStatus, "WAIT")
+                    .in(CollectionUtils.isNotEmpty(adminUser.getAdminWebsitIds()),WorkerOrder::getWebsitId,  adminUser.getAdminWebsitIds())
                     .ne(WorkerOrder::getWorkerOrderId, "").select(WorkerOrder::getWorkerOrderId)
                     .list().stream().map(WorkerOrder::getWorkerOrderId).collect(Collectors.toList());
 
@@ -280,18 +284,19 @@ public class OrderBaseEsLogic {
 
 
     public void test() {
-  /*      boolean a = elasticsearchRestTemplate.indexOps(OrderBaseEs.class).delete();
+
+        boolean a = elasticsearchRestTemplate.indexOps(OrderBaseEsDate.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<PgOrderBase> list = pgOrderBaseService.lambdaQuery().list();
 
        // List<OrderBaseEsDate> orderBaseEsDates = BeanUtil.copyToList(list, OrderBaseEsDate.class);
-  /*      for (PgOrderBase pgOrderBase : list) {
+        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);
@@ -302,18 +307,19 @@ public class OrderBaseEsLogic {
             orderBaseEs.setAppointmentTime(pgOrderBase.getAppo() != null? DateUtil.format(pgOrderBase.getLastOperatorTime(),"yyyy-MM-dd HH:mm:ss"):null);
 
             orderBaseEsList.add(orderBaseEs);
-        }*/
+        }
 
       // orderBaseEsRepository.saveAll(orderBaseEsDates);
+*/
+
 
- /*       boolean a = elasticsearchRestTemplate.indexOps(SettlementOrderEs.class).delete();
-        IndexOperations indexOperations1 = elasticsearchRestTemplate.indexOps(SettlementOrderEs.class);
+    /*    boolean a = elasticsearchRestTemplate.indexOps(PgOrderWorkerEs.class).delete();
+        IndexOperations indexOperations1 = elasticsearchRestTemplate.indexOps(PgOrderWorkerEs.class);
         if (!indexOperations1.exists()) {
             indexOperations1.create();
             Document document = indexOperations1.createMapping();
             indexOperations1.putMapping(document);
-        }
-*/
+        }*/
     }
 
     public List<Map<String, Object>> countStatus(String startTime, String endTime, String orderSmallType, String orderSmallTypeText) {
@@ -623,4 +629,16 @@ public class OrderBaseEsLogic {
 
     public void del() {
     }
+
+    public void esSync2() {
+
+        List<PgOrderWorker> list = pgOrderWorkerService.lambdaQuery()
+                .gt(PgOrderWorker::getUpdateTime,DateUtil.offsetMinute(new Date(),-5))
+                .list();
+
+        List<PgOrderWorkerEs> pgOrderWorkerEs = BeanUtil.copyToList(list, PgOrderWorkerEs.class);
+
+
+        orderWorkerEsRepository.saveAll(pgOrderWorkerEs);
+    }
 }

+ 7 - 0
mall-server-api/src/main/java/com/gree/mall/manager/schedule/daily/EsSyncSchedule.java

@@ -39,4 +39,11 @@ public class EsSyncSchedule {
         orderBaseEsLogic.esSync1();
     }
 
+
+    //同步工单数据
+    @Scheduled(fixedDelay =2* 1000)
+    public void task2() throws IOException {
+        orderBaseEsLogic.esSync2();
+    }
+
 }