Browse Source
# Conflicts: # epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.javamaster
76 changed files with 3632 additions and 45 deletions
@ -0,0 +1,13 @@ |
|||||
|
package com.epmet.commons.rocketmq.constants; |
||||
|
|
||||
|
/** |
||||
|
* @Description MQ用户自定义属性 |
||||
|
* @author wxz |
||||
|
* @date 2021.10.14 15:47:03 |
||||
|
*/ |
||||
|
public interface MQUserPropertys { |
||||
|
|
||||
|
//堆积消息label
|
||||
|
String PENDING_MSG_LABEL = "pendingMsgLabel"; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.commons.rocketmq.messages; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* 用户巡查消息体 |
||||
|
* @author liujianjun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class StaffPatrolMQMsg { |
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 巡查记录id |
||||
|
*/ |
||||
|
private String patrolId; |
||||
|
|
||||
|
/** |
||||
|
* 操作类型 |
||||
|
* SystemMessageType.USER_PATROL_START |
||||
|
* SystemMessageTypSTOP |
||||
|
*/ |
||||
|
private String actionType; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.dto.org; |
||||
|
|
||||
|
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @dscription 插叙客户网格基础信息--接口入参 |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AgencyBaseInfoFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -3634745091993094743L; |
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
@NotBlank(message = "事件标识不能为空", groups = {Agency.class}) |
||||
|
private String customerId = ""; |
||||
|
/** |
||||
|
* 组织Id |
||||
|
*/ |
||||
|
private List<String> agencyIdList; |
||||
|
public interface Agency extends CustomerClientShowGroup {} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.dto.org; |
||||
|
|
||||
|
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @dscription 插叙客户网格基础信息--接口入参 |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class GridBaseInfoFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -3634745091993094743L; |
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
@NotBlank(message = "事件标识不能为空", groups = {Grid.class}) |
||||
|
private String customerId = ""; |
||||
|
/** |
||||
|
* 网格Id |
||||
|
*/ |
||||
|
private List<String> gridIdList; |
||||
|
public interface Grid extends CustomerClientShowGroup {} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,145 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.org.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 机关单位信息表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-04-20 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerAgencyDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 上级组织机构ID |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级组织机构ID(以英文:隔开) |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级名称,以-连接 |
||||
|
*/ |
||||
|
private String allParentName; |
||||
|
|
||||
|
/** |
||||
|
* 组织名称 |
||||
|
*/ |
||||
|
private String organizationName; |
||||
|
|
||||
|
/** |
||||
|
* 机关级别(社区级:community, |
||||
|
乡(镇、街道)级:street, |
||||
|
区县级: district, |
||||
|
市级: city |
||||
|
省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) |
||||
|
*/ |
||||
|
private String level; |
||||
|
|
||||
|
/** |
||||
|
* 地区编码 |
||||
|
*/ |
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
/** |
||||
|
* 总人数 |
||||
|
*/ |
||||
|
private Integer totalUser; |
||||
|
|
||||
|
/** |
||||
|
* 省 |
||||
|
*/ |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 市 |
||||
|
*/ |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 区县 |
||||
|
*/ |
||||
|
private String district; |
||||
|
|
||||
|
/** |
||||
|
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701 |
||||
|
*/ |
||||
|
private String parentAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 街道 |
||||
|
*/ |
||||
|
private String street; |
||||
|
|
||||
|
/** |
||||
|
* 社区 |
||||
|
*/ |
||||
|
private String community; |
||||
|
} |
||||
@ -0,0 +1,129 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.org.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 客户网格表 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerGridDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
|
||||
|
/** 组织-网格 */ |
||||
|
private String gridNamePath; |
||||
|
|
||||
|
/** |
||||
|
* 中心位置经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
/** |
||||
|
* 中心位置纬度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 所属地区码(所属组织地区码) |
||||
|
*/ |
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
/** |
||||
|
* 管辖区域 |
||||
|
*/ |
||||
|
private String manageDistrict; |
||||
|
|
||||
|
/** |
||||
|
* 当前网格总人数 |
||||
|
*/ |
||||
|
private Integer totalUser; |
||||
|
|
||||
|
/** |
||||
|
* 所属组织机构ID(customer_organization.id) |
||||
|
*/ |
||||
|
private String pid; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级组织ID |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 所属组织机构名 |
||||
|
*/ |
||||
|
private String agencyName; |
||||
|
|
||||
|
/** |
||||
|
* 所有上级组织名 |
||||
|
*/ |
||||
|
private String allParentName; |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.dto.user; |
||||
|
|
||||
|
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @dscription 插叙客户网格人员基础信息--接口入参 |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class StaffBaseInfoFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -3634745091993094743L; |
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
@NotBlank(message = "事件标识不能为空", groups = {Staff.class}) |
||||
|
private String customerId = ""; |
||||
|
/** |
||||
|
* 人员Id |
||||
|
*/ |
||||
|
private List<String> staffIdList; |
||||
|
public interface Staff extends CustomerClientShowGroup {} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.dto.user.param; |
||||
|
|
||||
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* desc:查询巡查 参数 |
||||
|
* |
||||
|
* @author zhaoqifeng |
||||
|
* @dscription |
||||
|
* @date 2021/6/7 16:23 |
||||
|
*/ |
||||
|
@NoArgsConstructor |
||||
|
@Data |
||||
|
public class MidPatrolFormDTO extends PageFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 4411051728689886810L; |
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
/** |
||||
|
* 巡查记录id 没有则查询全部 |
||||
|
*/ |
||||
|
private String patrolId; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.user.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 工作人员巡查明细记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-06-07 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class MidPatrolDetailResult implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 维度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 经度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,132 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.user.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 工作人员巡查主记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-06-07 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class MidPatrolRecordResult implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 网格id |
||||
|
*/ |
||||
|
private String grid; |
||||
|
|
||||
|
/** |
||||
|
* 网格所有上级id |
||||
|
*/ |
||||
|
private String gridPids; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员用户id |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员所属组织id=网格所属的组织id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 巡查开始时间 |
||||
|
*/ |
||||
|
private Date patrolStartTime; |
||||
|
|
||||
|
/** |
||||
|
* 巡查结束时间,前端传入 |
||||
|
*/ |
||||
|
private Date patrolEndTime; |
||||
|
|
||||
|
/** |
||||
|
* 实际结束时间=操作结束巡查的时间 |
||||
|
*/ |
||||
|
private Date actrualEndTime; |
||||
|
|
||||
|
/** |
||||
|
* 本次巡查总耗时,单位秒;结束巡查时写入 |
||||
|
*/ |
||||
|
private Integer totalTime; |
||||
|
|
||||
|
/** |
||||
|
* 正在巡查中:patrolling;结束:end |
||||
|
*/ |
||||
|
private String status; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
/** |
||||
|
* 维度 |
||||
|
*/ |
||||
|
private String latitude; |
||||
|
|
||||
|
/** |
||||
|
* 精度 |
||||
|
*/ |
||||
|
private String longitude; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,91 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.dto.org.AgencyBaseInfoFormDTO; |
||||
|
import com.epmet.dto.org.GridBaseInfoFormDTO; |
||||
|
import com.epmet.dto.org.result.CustomerAgencyDTO; |
||||
|
import com.epmet.dto.org.result.CustomerGridDTO; |
||||
|
import com.epmet.dto.user.StaffBaseInfoFormDTO; |
||||
|
import com.epmet.dto.user.param.MidPatrolFormDTO; |
||||
|
import com.epmet.dto.user.result.CustomerStaffDTO; |
||||
|
import com.epmet.dto.user.result.MidPatrolDetailResult; |
||||
|
import com.epmet.dto.user.result.MidPatrolRecordResult; |
||||
|
import com.epmet.service.DataReportingService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @dscription 省网格化平台数据上报--数据查询 |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@RequestMapping("datareporting") |
||||
|
@RestController |
||||
|
public class DataReportingController { |
||||
|
@Autowired |
||||
|
private DataReportingService dataReportingService; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户组织基础信息 |
||||
|
**/ |
||||
|
@PostMapping("agencybaseinfo") |
||||
|
public Result<List<CustomerAgencyDTO>> getAgencyBaseInfo(@RequestBody(required = false) AgencyBaseInfoFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO, AgencyBaseInfoFormDTO.Agency.class); |
||||
|
return new Result<List<CustomerAgencyDTO>>().ok(dataReportingService.getAgencyBaseInfo(formDTO)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户网格基础信息 |
||||
|
**/ |
||||
|
@PostMapping("gridbaseinfo") |
||||
|
public Result<List<CustomerGridDTO>> getGridBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO, GridBaseInfoFormDTO.Grid.class); |
||||
|
return new Result<List<CustomerGridDTO>>().ok(dataReportingService.getGridBaseInfo(formDTO)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户网格员基础信息 |
||||
|
**/ |
||||
|
@PostMapping("staffbaseinfo") |
||||
|
public Result<List<CustomerStaffDTO>> getStaffBaseInfo(@RequestBody(required = false) StaffBaseInfoFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class); |
||||
|
return new Result<List<CustomerStaffDTO>>().ok(dataReportingService.getStaffBaseInfo(formDTO)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* desc: 条件获取巡查主表信息 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.user.result.MidPatrolRecordResult>> |
||||
|
* @author LiuJanJun |
||||
|
* @date 2021/10/15 12:01 下午 |
||||
|
*/ |
||||
|
@PostMapping("getPatrolRecordList") |
||||
|
public Result<List<MidPatrolRecordResult>> getPatrolRecordList(@RequestBody(required = false) MidPatrolFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class); |
||||
|
return new Result<List<MidPatrolRecordResult>>().ok(dataReportingService.getPatrolRecordList(formDTO)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* desc: 条件获取巡查明细信息 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.user.result.CustomerStaffDTO>> |
||||
|
* @author LiuJanJun |
||||
|
* @date 2021/10/15 12:01 下午 |
||||
|
*/ |
||||
|
@PostMapping("getPatrolDetailList") |
||||
|
public Result<List<MidPatrolDetailResult>> getPatrolDetailList(@RequestBody(required = false) MidPatrolFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO, StaffBaseInfoFormDTO.Staff.class); |
||||
|
return new Result<List<MidPatrolDetailResult>>().ok(dataReportingService.getPatrolDetailList(formDTO)); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.dto.org.AgencyBaseInfoFormDTO; |
||||
|
import com.epmet.dto.org.GridBaseInfoFormDTO; |
||||
|
import com.epmet.dto.org.result.CustomerAgencyDTO; |
||||
|
import com.epmet.dto.org.result.CustomerGridDTO; |
||||
|
import com.epmet.dto.user.StaffBaseInfoFormDTO; |
||||
|
import com.epmet.dto.user.param.MidPatrolFormDTO; |
||||
|
import com.epmet.dto.user.result.CustomerStaffDTO; |
||||
|
import com.epmet.dto.user.result.MidPatrolDetailResult; |
||||
|
import com.epmet.dto.user.result.MidPatrolRecordResult; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @dscription 省网格化平台数据上报--数据查询 |
||||
|
* @author sun |
||||
|
*/ |
||||
|
public interface DataReportingService { |
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户组织基础信息 |
||||
|
* |
||||
|
* @return*/ |
||||
|
List<CustomerAgencyDTO> getAgencyBaseInfo(AgencyBaseInfoFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户网格基础信息 |
||||
|
* |
||||
|
* @return*/ |
||||
|
List<CustomerGridDTO> getGridBaseInfo(GridBaseInfoFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户网格员基础信息 |
||||
|
* |
||||
|
* @return*/ |
||||
|
List<CustomerStaffDTO> getStaffBaseInfo(StaffBaseInfoFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* desc: 获取巡查记录列表 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return java.util.List<com.epmet.dto.user.result.CustomerStaffDTO> |
||||
|
* @author LiuJanJun |
||||
|
* @date 2021/10/15 1:21 下午 |
||||
|
*/ |
||||
|
List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO); |
||||
|
|
||||
|
/** |
||||
|
* desc: 获取巡查明细列表 |
||||
|
* |
||||
|
* @param formDTO |
||||
|
* @return java.util.List<com.epmet.dto.user.result.MidPatrolDetailResult> |
||||
|
* @author LiuJanJun |
||||
|
* @date 2021/10/15 1:22 下午 |
||||
|
*/ |
||||
|
List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,82 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
import com.epmet.dto.org.AgencyBaseInfoFormDTO; |
||||
|
import com.epmet.dto.org.GridBaseInfoFormDTO; |
||||
|
import com.epmet.dto.org.result.CustomerAgencyDTO; |
||||
|
import com.epmet.dto.org.result.CustomerGridDTO; |
||||
|
import com.epmet.dto.user.StaffBaseInfoFormDTO; |
||||
|
import com.epmet.dto.user.param.MidPatrolFormDTO; |
||||
|
import com.epmet.dto.user.result.CustomerStaffDTO; |
||||
|
import com.epmet.dto.user.result.MidPatrolDetailResult; |
||||
|
import com.epmet.dto.user.result.MidPatrolRecordResult; |
||||
|
import com.epmet.service.DataReportingService; |
||||
|
import com.epmet.service.org.CustomerAgencyService; |
||||
|
import com.epmet.service.org.CustomerGridService; |
||||
|
import com.epmet.service.user.StatsStaffPatrolService; |
||||
|
import com.epmet.service.user.UserService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @dscription 省网格化平台数据上报--数据查询 |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class DataReportingServiceImpl implements DataReportingService { |
||||
|
@Autowired |
||||
|
private CustomerAgencyService customerAgencyService; |
||||
|
@Autowired |
||||
|
private CustomerGridService customerGridService; |
||||
|
@Autowired |
||||
|
private UserService userService; |
||||
|
@Autowired |
||||
|
private StatsStaffPatrolService statsStaffPatrolService; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户组织基础信息 |
||||
|
**/ |
||||
|
@Override |
||||
|
public List<CustomerAgencyDTO> getAgencyBaseInfo(AgencyBaseInfoFormDTO formDTO) { |
||||
|
//批量查询客户组织信息
|
||||
|
List<CustomerAgencyDTO> resultList = customerAgencyService.getAgencyBaseInfo(formDTO); |
||||
|
return resultList; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户网格基础信息 |
||||
|
**/ |
||||
|
@Override |
||||
|
public List<CustomerGridDTO> getGridBaseInfo(GridBaseInfoFormDTO formDTO) { |
||||
|
//批量查询客户网格信息
|
||||
|
List<CustomerGridDTO> resultList = customerGridService.getGridBaseInfo(formDTO); |
||||
|
return resultList; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 批量查询客户网格员基础信息 |
||||
|
**/ |
||||
|
@Override |
||||
|
public List<CustomerStaffDTO> getStaffBaseInfo(StaffBaseInfoFormDTO formDTO) { |
||||
|
//批量查询客户网格员信息
|
||||
|
List<CustomerStaffDTO> resultList = userService.getStaffBaseInfo(formDTO); |
||||
|
return resultList; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO) { |
||||
|
return userService.getPatrolRecordList(formDTO); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO) { |
||||
|
return userService.getPatrolDetailList(formDTO); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
package com.epmet.service.user.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.epmet.dto.user.param.MidPatrolFormDTO; |
||||
|
import com.epmet.dto.user.result.MidPatrolRecordResult; |
||||
|
import com.epmet.service.user.UserService; |
||||
|
import org.jboss.arquillian.container.test.api.Deployment; |
||||
|
import org.jboss.arquillian.junit.Arquillian; |
||||
|
import org.jboss.shrinkwrap.api.ShrinkWrap; |
||||
|
import org.jboss.shrinkwrap.api.asset.EmptyAsset; |
||||
|
import org.jboss.shrinkwrap.api.spec.JavaArchive; |
||||
|
import org.junit.Test; |
||||
|
import org.junit.runner.RunWith; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import static org.junit.Assert.*; |
||||
|
|
||||
|
@RunWith(Arquillian.class) |
||||
|
public class UserServiceImplTest { |
||||
|
@Deployment |
||||
|
public static JavaArchive createDeployment() { |
||||
|
return ShrinkWrap.create(JavaArchive.class) |
||||
|
.addClass(UserServiceImpl.class) |
||||
|
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); |
||||
|
} |
||||
|
@Autowired |
||||
|
private UserService userService; |
||||
|
|
||||
|
@Test |
||||
|
public void getPatrolRecordList() { |
||||
|
MidPatrolFormDTO midPatrolFormDTO = new MidPatrolFormDTO(); |
||||
|
midPatrolFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); |
||||
|
midPatrolFormDTO.setPatrolId(""); |
||||
|
midPatrolFormDTO.setPageNo(1); |
||||
|
midPatrolFormDTO.setPageSize(110); |
||||
|
|
||||
|
List<MidPatrolRecordResult> patrolRecordList = userService.getPatrolRecordList(midPatrolFormDTO); |
||||
|
System.out.println(JSON.toJSONString(patrolRecordList)); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void getPatrolDetailList() { |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>open-data-worker</artifactId> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>open-data-worker-client</artifactId> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons-tools</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
</project> |
||||
@ -0,0 +1,33 @@ |
|||||
|
package com.epmet.opendata.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotEmpty; |
||||
|
|
||||
|
/** |
||||
|
* 插入或更新巡查记录主表 |
||||
|
* @author liujianjun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class UpsertPatrolRecordForm { |
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
@NotEmpty(message = "customerId不能为空") |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 巡查记录id |
||||
|
*/ |
||||
|
@NotEmpty(message = "customerId不能为空") |
||||
|
private String patrolId; |
||||
|
|
||||
|
/** |
||||
|
* 操作类型 |
||||
|
* SystemMessageType.USER_PATROL_START |
||||
|
* SystemMessageTypSTOP |
||||
|
*/ |
||||
|
@NotEmpty(message = "actionType不能为空") |
||||
|
private String actionType; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,282 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>open-data-worker</artifactId> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>open-data-worker-server</artifactId> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons-tools</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons-mybatis</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework</groupId> |
||||
|
<artifactId>spring-context-support</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-actuator</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>de.codecentric</groupId> |
||||
|
<artifactId>spring-boot-admin-starter-client</artifactId> |
||||
|
<version>${spring.boot.admin.version}</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
||||
|
</dependency> |
||||
|
<!-- 替换Feign原生httpclient --> |
||||
|
<dependency> |
||||
|
<groupId>io.github.openfeign</groupId> |
||||
|
<artifactId>feign-httpclient</artifactId> |
||||
|
<version>10.3.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<!--rocketmq--> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-commons-rocketmq</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-message-client</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>open-data-worker-client</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>epmet-user-client</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<artifactId>data-statistical-client</artifactId> |
||||
|
<version>2.0.0</version> |
||||
|
<scope>compile</scope> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<finalName>${project.artifactId}</finalName> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-surefire-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<skipTests>true</skipTests> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> |
||||
|
<resources> |
||||
|
<resource> |
||||
|
<filtering>true</filtering> |
||||
|
<directory>${basedir}/src/main/resources</directory> |
||||
|
</resource> |
||||
|
</resources> |
||||
|
</build> |
||||
|
|
||||
|
<profiles> |
||||
|
<profile> |
||||
|
<id>dev</id> |
||||
|
<properties> |
||||
|
<server.port>8117</server.port> |
||||
|
<spring.profiles.active>dev</spring.profiles.active> |
||||
|
|
||||
|
<!-- 数据库配置--> |
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_open_data?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epmet_open_data_user</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> |
||||
|
<!-- redis配置 --> |
||||
|
<spring.redis.index>0</spring.redis.index> |
||||
|
<spring.redis.host>192.168.1.140</spring.redis.host> |
||||
|
<spring.redis.port>6379</spring.redis.port> |
||||
|
<spring.redis.password>123456</spring.redis.password> |
||||
|
<!-- nacos --> |
||||
|
<nacos.register-enabled>true</nacos.register-enabled> |
||||
|
<nacos.server-addr>192.168.1.140:8848</nacos.server-addr> |
||||
|
<nacos.discovery.namespace>1fecc730-5e6e-464c-aae9-7567944e7936</nacos.discovery.namespace> |
||||
|
<nacos.config.namespace></nacos.config.namespace> |
||||
|
<nacos.config.group></nacos.config.group> |
||||
|
<nacos.config-enabled>false</nacos.config-enabled> |
||||
|
<nacos.ip/> |
||||
|
<!--是否开启服务列表变更监听--> |
||||
|
<nacos.service-list-changed-listening.enable>true</nacos.service-list-changed-listening.enable> |
||||
|
|
||||
|
<!--flyway migration 数据库迁移工具--> |
||||
|
<spring.flyway.enabled>false</spring.flyway.enabled> |
||||
|
|
||||
|
<!--钉钉 机器人地址--> |
||||
|
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook> |
||||
|
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret> |
||||
|
|
||||
|
<!--rocketmq--> |
||||
|
<rocketmq.enable>true</rocketmq.enable> |
||||
|
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
<profile> |
||||
|
<id>local</id> |
||||
|
<activation> |
||||
|
<activeByDefault>true</activeByDefault> |
||||
|
</activation> |
||||
|
<properties> |
||||
|
<server.port>8117</server.port> |
||||
|
<spring.profiles.active>local</spring.profiles.active> |
||||
|
|
||||
|
<!-- 数据库配置--> |
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_open_data?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epmet_open_data_user</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> |
||||
|
<!-- redis配置 --> |
||||
|
<spring.redis.index>0</spring.redis.index> |
||||
|
<spring.redis.host>192.168.1.140</spring.redis.host> |
||||
|
<spring.redis.port>6379</spring.redis.port> |
||||
|
<spring.redis.password>123456</spring.redis.password> |
||||
|
<!-- nacos --> |
||||
|
<nacos.register-enabled>false</nacos.register-enabled> |
||||
|
<nacos.server-addr>192.168.1.140:8848</nacos.server-addr> |
||||
|
<nacos.discovery.namespace>1fecc730-5e6e-464c-aae9-7567944e7936</nacos.discovery.namespace> |
||||
|
<nacos.config.namespace></nacos.config.namespace> |
||||
|
<nacos.config.group></nacos.config.group> |
||||
|
<nacos.config-enabled>false</nacos.config-enabled> |
||||
|
<nacos.ip/> |
||||
|
<!--是否开启服务列表变更监听--> |
||||
|
<nacos.service-list-changed-listening.enable>false</nacos.service-list-changed-listening.enable> |
||||
|
|
||||
|
<!--flyway migration 数据库迁移工具--> |
||||
|
<spring.flyway.enabled>false</spring.flyway.enabled> |
||||
|
|
||||
|
<!--钉钉 机器人地址--> |
||||
|
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook> |
||||
|
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret> |
||||
|
|
||||
|
<!--rocketmq--> |
||||
|
<rocketmq.enable>false</rocketmq.enable> |
||||
|
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
<profile> |
||||
|
<id>test</id> |
||||
|
<!--<activation> |
||||
|
<activeByDefault>true</activeByDefault> |
||||
|
</activation>--> |
||||
|
<properties> |
||||
|
<server.port>8117</server.port> |
||||
|
<spring.profiles.active>test</spring.profiles.active> |
||||
|
|
||||
|
<!-- 数据库配置--> |
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_open_data?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epmet</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> |
||||
|
<!-- redis配置 --> |
||||
|
<spring.redis.index>0</spring.redis.index> |
||||
|
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host> |
||||
|
<spring.redis.port>6379</spring.redis.port> |
||||
|
<spring.redis.password>EpmEtrEdIs!q@w</spring.redis.password> |
||||
|
<!-- nacos --> |
||||
|
<nacos.register-enabled>true</nacos.register-enabled> |
||||
|
<nacos.server-addr>192.168.10.150:8848</nacos.server-addr> |
||||
|
<nacos.discovery.namespace>67e3c350-533e-4d7c-9f8f-faf1b4aa82ae</nacos.discovery.namespace> |
||||
|
<nacos.config.namespace></nacos.config.namespace> |
||||
|
<nacos.config.group></nacos.config.group> |
||||
|
<nacos.config-enabled>false</nacos.config-enabled> |
||||
|
<nacos.ip/> |
||||
|
<!--是否开启服务列表变更监听--> |
||||
|
<nacos.service-list-changed-listening.enable>true</nacos.service-list-changed-listening.enable> |
||||
|
|
||||
|
<!--flyway migration 数据库迁移工具--> |
||||
|
<spring.flyway.enabled>true</spring.flyway.enabled> |
||||
|
|
||||
|
<!--钉钉 机器人地址--> |
||||
|
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook> |
||||
|
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret> |
||||
|
|
||||
|
<!--rocketmq--> |
||||
|
<rocketmq.enable>true</rocketmq.enable> |
||||
|
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
<profile> |
||||
|
<id>prod</id> |
||||
|
<properties> |
||||
|
<server.port>8117</server.port> |
||||
|
<spring.profiles.active>prod</spring.profiles.active> |
||||
|
|
||||
|
<!-- 数据库配置--> |
||||
|
<spring.datasource.druid.url> |
||||
|
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_open_data?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
||||
|
</spring.datasource.druid.url> |
||||
|
<spring.datasource.druid.username>epmet_open_data_user</spring.datasource.druid.username> |
||||
|
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> |
||||
|
<!-- redis配置 --> |
||||
|
<spring.redis.index>0</spring.redis.index> |
||||
|
<spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host> |
||||
|
<spring.redis.port>6379</spring.redis.port> |
||||
|
<spring.redis.password>EpmEtclOUdrEdIs!Q2w</spring.redis.password> |
||||
|
<!-- nacos --> |
||||
|
<nacos.register-enabled>true</nacos.register-enabled> |
||||
|
<nacos.server-addr>192.168.11.180:8848</nacos.server-addr> |
||||
|
<nacos.discovery.namespace>bd205d23-e696-47be-b995-916313f86e99</nacos.discovery.namespace> |
||||
|
<nacos.config.namespace></nacos.config.namespace> |
||||
|
<nacos.config.group></nacos.config.group> |
||||
|
<nacos.config-enabled>false</nacos.config-enabled> |
||||
|
<nacos.ip/> |
||||
|
<!--是否开启服务列表变更监听--> |
||||
|
<nacos.service-list-changed-listening.enable>true</nacos.service-list-changed-listening.enable> |
||||
|
|
||||
|
<!--flyway migration 数据库迁移工具--> |
||||
|
<spring.flyway.enabled>true</spring.flyway.enabled> |
||||
|
|
||||
|
<!--生产钉钉 机器人地址--> |
||||
|
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c</dingTalk.robot.webHook> |
||||
|
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret> |
||||
|
|
||||
|
<!--rocketmq--> |
||||
|
<rocketmq.enable>true</rocketmq.enable> |
||||
|
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver> |
||||
|
</properties> |
||||
|
</profile> |
||||
|
</profiles> |
||||
|
|
||||
|
</project> |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.epmet; |
||||
|
|
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.boot.web.servlet.ServletComponentScan; |
||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
||||
|
import org.springframework.cloud.openfeign.EnableFeignClients; |
||||
|
import org.springframework.context.annotation.ComponentScan; |
||||
|
|
||||
|
/** |
||||
|
* @Description OpenData服务启动类 |
||||
|
* 注意:此处要使用@ComponentScan的原因是,启动类处于包com.epmet.opendata下,想用com.epmet.commons包下的一些Spring对象,需要 |
||||
|
* 手动指定扫描包,否则无法扫描 |
||||
|
* @author wxz |
||||
|
* @date 2021.10.13 15:16:05 |
||||
|
*/ |
||||
|
@SpringBootApplication |
||||
|
@EnableDiscoveryClient |
||||
|
@EnableFeignClients |
||||
|
@ServletComponentScan |
||||
|
//@ComponentScan(value = { "com.epmet" })
|
||||
|
public class OpenDataApplication { |
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(OpenDataApplication.class, args); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,161 @@ |
|||||
|
package com.epmet.opendata.config; |
||||
|
|
||||
|
import com.alibaba.cloud.nacos.NacosDiscoveryProperties; |
||||
|
import com.alibaba.nacos.api.exception.NacosException; |
||||
|
import com.alibaba.nacos.api.naming.NamingService; |
||||
|
import com.alibaba.nacos.api.naming.listener.Event; |
||||
|
import com.alibaba.nacos.api.naming.listener.EventListener; |
||||
|
import com.alibaba.nacos.api.naming.listener.NamingEvent; |
||||
|
import com.alibaba.nacos.api.naming.pojo.ListView; |
||||
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
||||
|
import com.netflix.loadbalancer.DynamicServerListLoadBalancer; |
||||
|
import com.netflix.loadbalancer.ILoadBalancer; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||
|
import org.springframework.cloud.netflix.ribbon.SpringClientFactory; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.concurrent.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wxz |
||||
|
* @Description Nacos服务列表刷新监听注册器 |
||||
|
* @date 2021.09.22 14:33:11 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Configuration |
||||
|
@ConditionalOnProperty(prefix = "spring.cloud.nacos.discovery.serviceListChangedListening", name = "enable", havingValue = "true", matchIfMissing = false) |
||||
|
public class NacosServiceListListenerRegisterer { |
||||
|
|
||||
|
public static final String REFRESH_SERVER_LIST_METHOD_NAME = "restOfInit"; |
||||
|
// 服务列表拉取间隔:10s
|
||||
|
public static final long SERVICE_LIST_PULLING_DELAY_SECONDS = 10; |
||||
|
|
||||
|
private NamingService namingService; |
||||
|
|
||||
|
private ScheduledExecutorService executor; |
||||
|
|
||||
|
@Autowired |
||||
|
private NacosDiscoveryProperties discoveryProperties; |
||||
|
|
||||
|
@Autowired |
||||
|
private SpringClientFactory springClientFactory; |
||||
|
|
||||
|
// 监听中的服务列表
|
||||
|
private List<String> observingServers = new ArrayList<>(33); |
||||
|
|
||||
|
@PostConstruct |
||||
|
public void init() { |
||||
|
namingService = discoveryProperties.namingServiceInstance(); |
||||
|
// 启动监听
|
||||
|
executor = new ScheduledThreadPoolExecutor(2, new ThreadFactory() { |
||||
|
@Override |
||||
|
public Thread newThread(Runnable r) { |
||||
|
Thread thread = new Thread(r); |
||||
|
thread.setDaemon(true); |
||||
|
thread.setName("NacosServiceListWatchingRegisterer"); |
||||
|
return thread; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 立即启动,并15s刷新一次服务列表,用于新服务列表的发现
|
||||
|
ScheduledFuture<?> future = executor.scheduleAtFixedRate(new EpmetNacosServiceListListener(), 0, SERVICE_LIST_PULLING_DELAY_SECONDS, TimeUnit.SECONDS); |
||||
|
} |
||||
|
|
||||
|
public class EpmetNacosServiceListListener implements Runnable { |
||||
|
|
||||
|
@Override |
||||
|
public void run() { |
||||
|
doRefreshServerList(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @return |
||||
|
* @description 执行刷新 |
||||
|
* @author wxz |
||||
|
* @date 2021.09.22 16:04:49 |
||||
|
*/ |
||||
|
private synchronized void doRefreshServerList() { |
||||
|
ListView<String> serviceListView = null; |
||||
|
try { |
||||
|
serviceListView = namingService.getServicesOfServer(1, 100); |
||||
|
//启动监听
|
||||
|
if (serviceListView == null || serviceListView.getCount() == 0) { |
||||
|
log.info("【Nacos服务列表定时刷新】当前无任何可添加监听的服务"); |
||||
|
return; |
||||
|
} |
||||
|
List<String> serviceList = serviceListView.getData(); |
||||
|
log.info("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList); |
||||
|
|
||||
|
for (String service : serviceList) { |
||||
|
try { |
||||
|
|
||||
|
// 如果该服务已经在监听列表中存在了,则不再注册监听。注:不能取消空服务的监听,因为空服务随时可能恢复运行,需要实时监听。
|
||||
|
if (observingServers.contains(service)) { |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
namingService.subscribe(service, new EventListener() { |
||||
|
@Override |
||||
|
public void onEvent(Event event) { |
||||
|
if (event instanceof NamingEvent) { |
||||
|
NamingEvent namingEvent = (NamingEvent) event; |
||||
|
log.info("【Nacos服务列表刷新监听】收到事件:{}:[{}]", namingEvent.getServiceName(), namingEvent.getInstances()); |
||||
|
doRefreshServerList(service); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 将该服务加入到监听列表中
|
||||
|
observingServers.add(service); |
||||
|
} catch (NacosException e) { |
||||
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
||||
|
log.error("【Nacos服务列表定时刷新】订阅ApplicationContext的刷新事件失败,错误信息:{}", errorStackTrace); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} catch (NacosException e) { |
||||
|
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
||||
|
log.error("【Nacos服务列表定时刷新】链接Nacos服务端失败,错误信息:{}", errorStackTrace); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param serviceName |
||||
|
* @return |
||||
|
* @description 刷新ServerList |
||||
|
* @author wxz |
||||
|
* @date 2021.09.22 09:29:16 |
||||
|
*/ |
||||
|
private void doRefreshServerList(String serviceName) { |
||||
|
// 刷新方式1:反射调用DynamicServerListLoadBalancer中的restOfInit()方法。该方法原来只执行一次,此处不推荐用
|
||||
|
//ILoadBalancer loadBalancer = springClientFactory.getLoadBalancer(serviceName);
|
||||
|
//if (loadBalancer instanceof ZoneAwareLoadBalancer) {
|
||||
|
// ZoneAwareLoadBalancer zaLoadBalancer = (ZoneAwareLoadBalancer) loadBalancer;
|
||||
|
// IClientConfig clientConfig = springClientFactory.getClientConfig(serviceName);
|
||||
|
// try {
|
||||
|
// Method restOfInitMethod = zaLoadBalancer.getClass().getSuperclass().getDeclaredMethod(REFRESH_SERVER_LIST_METHOD_NAME, IClientConfig.class);
|
||||
|
// restOfInitMethod.setAccessible(true);
|
||||
|
// restOfInitMethod.invoke(zaLoadBalancer, clientConfig);
|
||||
|
// } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
|
// String errorStackTrace = ExceptionUtils.getErrorStackTrace(e);
|
||||
|
// log.error("【LoadBalancer刷新服务列表】失败:{}", errorStackTrace);
|
||||
|
// }
|
||||
|
//}
|
||||
|
|
||||
|
// 刷新方式2:DynamicServerListLoadBalancer#updateListOfServers()该方法为ribbon定时刷新服务列表的时候真正调用的方法,但是加了@VisibleForTesting
|
||||
|
// 暂且 1 try
|
||||
|
ILoadBalancer loadBalancer = springClientFactory.getLoadBalancer(serviceName); |
||||
|
if (loadBalancer instanceof DynamicServerListLoadBalancer) { |
||||
|
DynamicServerListLoadBalancer dslb = (DynamicServerListLoadBalancer) loadBalancer; |
||||
|
dslb.updateListOfServers(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.controller; |
||||
|
|
||||
|
import com.epmet.opendata.service.UserPatrolRecordService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用户巡查主记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("userpatrolrecord") |
||||
|
public class UserPatrolRecordController { |
||||
|
|
||||
|
@Autowired |
||||
|
private UserPatrolRecordService userPatrolRecordService; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.opendata.entity.UserPatrolDetailEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员巡查记录明细 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface UserPatrolDetailDao extends BaseDao<UserPatrolDetailEntity> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.opendata.entity.UserPatrolRecordEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 用户巡查主记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface UserPatrolRecordDao extends BaseDao<UserPatrolRecordEntity> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员巡查记录明细 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("user_patrol_detail") |
||||
|
public class UserPatrolDetailEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* staff_patrol_record.ID |
||||
|
*/ |
||||
|
private String staffPatrolRecId; |
||||
|
|
||||
|
/** |
||||
|
* 路线 |
||||
|
*/ |
||||
|
private String route; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,106 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 用户巡查主记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("user_patrol_record") |
||||
|
public class UserPatrolRecordEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 网格id |
||||
|
*/ |
||||
|
private String grid; |
||||
|
|
||||
|
/** |
||||
|
* 网格所有上级id |
||||
|
*/ |
||||
|
private String gridPids; |
||||
|
|
||||
|
/** |
||||
|
* 用户id |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员所属组织id=网格所属的组织id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 巡查开始时间 |
||||
|
*/ |
||||
|
private Date patrolStartTime; |
||||
|
|
||||
|
/** |
||||
|
* 巡查结束时间 |
||||
|
*/ |
||||
|
private Date patrolEndTime; |
||||
|
|
||||
|
/** |
||||
|
* 实际结束时间 |
||||
|
*/ |
||||
|
private Date actrualEndTime; |
||||
|
|
||||
|
/** |
||||
|
* 巡查开始地点 |
||||
|
*/ |
||||
|
private String startLocation; |
||||
|
|
||||
|
/** |
||||
|
* 巡查结束地点 |
||||
|
*/ |
||||
|
private String endLocation; |
||||
|
|
||||
|
/** |
||||
|
* 本次巡查总耗时,单位秒 |
||||
|
*/ |
||||
|
private Integer totalTime; |
||||
|
|
||||
|
/** |
||||
|
* 巡查距离,单位米 |
||||
|
*/ |
||||
|
private Integer distance; |
||||
|
|
||||
|
/** |
||||
|
* 正在巡查中:patrolling;结束:end |
||||
|
*/ |
||||
|
private String status; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
package com.epmet.opendata.mq; |
||||
|
|
||||
|
import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; |
||||
|
import com.epmet.commons.rocketmq.constants.TopicConstants; |
||||
|
import com.epmet.commons.rocketmq.register.MQAbstractRegister; |
||||
|
import com.epmet.commons.rocketmq.register.MQConsumerProperties; |
||||
|
import com.epmet.opendata.mq.listener.OpenDataOrgChangeEventListener; |
||||
|
import com.epmet.opendata.mq.listener.OpenDataPatrolChangeEventListener; |
||||
|
import com.epmet.opendata.mq.listener.OpenDataStaffChangeEventListener; |
||||
|
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Description 如果rocketmq.enable=true,这里必须实现,且 实例化 |
||||
|
* @author wxz |
||||
|
* @date 2021.07.14 17:13:41 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class RocketMQConsumerRegister extends MQAbstractRegister { |
||||
|
|
||||
|
@Override |
||||
|
public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { |
||||
|
// 客户初始化监听器注册
|
||||
|
register(consumerProperties, |
||||
|
ConsomerGroupConstants.OPEN_DATA_ORG_CHANGE_EVENT_LISTENER_GROUP, |
||||
|
MessageModel.CLUSTERING, |
||||
|
TopicConstants.ORG, |
||||
|
"*", |
||||
|
new OpenDataOrgChangeEventListener()); |
||||
|
|
||||
|
register(consumerProperties, |
||||
|
ConsomerGroupConstants.OPEN_DATA_STAFF_CHANGE_EVENT_LISTENER_GROUP, |
||||
|
MessageModel.CLUSTERING, |
||||
|
TopicConstants.STAFF, |
||||
|
"*", |
||||
|
new OpenDataStaffChangeEventListener()); |
||||
|
|
||||
|
register(consumerProperties, |
||||
|
ConsomerGroupConstants.OPEN_DATA_PATROL_CHANGE_EVENT_LISTENER_GROUP, |
||||
|
MessageModel.CLUSTERING, |
||||
|
TopicConstants.PATROL, |
||||
|
"*", |
||||
|
new OpenDataPatrolChangeEventListener()); |
||||
|
|
||||
|
// ...其他监听器类似
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,97 @@ |
|||||
|
package com.epmet.opendata.mq.listener; |
||||
|
|
||||
|
import com.epmet.commons.rocketmq.constants.MQUserPropertys; |
||||
|
import com.epmet.commons.tools.distributedlock.DistributedLock; |
||||
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.redis.RedisKeys; |
||||
|
import com.epmet.commons.tools.redis.RedisUtils; |
||||
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
||||
|
import org.apache.commons.lang.StringUtils; |
||||
|
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; |
||||
|
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; |
||||
|
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; |
||||
|
import org.apache.rocketmq.common.message.MessageExt; |
||||
|
import org.redisson.api.RLock; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description 系统对接中间库,组织信息变更监听器 |
||||
|
* @author wxz |
||||
|
* @date 2021.10.13 15:21:48 |
||||
|
*/ |
||||
|
public class OpenDataOrgChangeEventListener implements MessageListenerConcurrently { |
||||
|
|
||||
|
private Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
@Override |
||||
|
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) { |
||||
|
|
||||
|
if (redisUtils == null) { |
||||
|
redisUtils = SpringContextUtils.getBean(RedisUtils.class); |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
msgs.forEach(msg -> consumeMessage(msg)); |
||||
|
} catch (Exception e) { |
||||
|
logger.error(ExceptionUtils.getErrorStackTrace(e)); |
||||
|
return ConsumeConcurrentlyStatus.RECONSUME_LATER; |
||||
|
} |
||||
|
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; |
||||
|
} |
||||
|
|
||||
|
private void consumeMessage(MessageExt messageExt) { |
||||
|
// msg即为消息体
|
||||
|
// tags为SystemMessageType.java中的项,为具体的操作,此处拿到tags,判断是创建还是变更,来做响应的后续操作即可
|
||||
|
String msg = new String(messageExt.getBody()); |
||||
|
String topic = messageExt.getTopic(); |
||||
|
String tags = messageExt.getTags(); |
||||
|
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.PENDING_MSG_LABEL); |
||||
|
|
||||
|
logger.info("【开放数据事件监听器】-组织信息变更-收到消息内容:{},操作:{}", msg, tags); |
||||
|
|
||||
|
DistributedLock distributedLock = null; |
||||
|
RLock lock = null; |
||||
|
try { |
||||
|
//distributedLock = SpringContextUtils.getBean(DistributedLock.class);
|
||||
|
//lock = distributedLock.getLock(String.format("lock:open_data_org:%s", orgId),
|
||||
|
// 30L, 30L, TimeUnit.SECONDS);
|
||||
|
} catch (RenException e) { |
||||
|
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
|
||||
|
logger.error("【开放数据事件监听器】-组织信息变更-同步信息到中间库失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
||||
|
} catch (Exception e) { |
||||
|
// 不是我们自己抛出的异常,可以让MQ重试
|
||||
|
logger.error("【开放数据事件监听器】-组织信息变更-同步信息到中间库失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
||||
|
throw e; |
||||
|
} finally { |
||||
|
//distributedLock.unLock(lock);
|
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(pendingMsgLabel)) { |
||||
|
try { |
||||
|
removePendingMqMsgCache(pendingMsgLabel); |
||||
|
} catch (Exception e) { |
||||
|
logger.error("【开放数据事件监听器】-删除mq滞留消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description |
||||
|
* |
||||
|
* @param pendingMsgLabel |
||||
|
* @return |
||||
|
* @author wxz |
||||
|
* @date 2021.10.14 16:32:32 |
||||
|
*/ |
||||
|
private void removePendingMqMsgCache(String pendingMsgLabel) { |
||||
|
String key = RedisKeys.pendingMqMsgKey(pendingMsgLabel); |
||||
|
redisUtils.delete(key); |
||||
|
logger.info("【开放数据事件监听器】删除mq滞留消息缓存失败,pendingMsgLabel:{}", pendingMsgLabel); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,113 @@ |
|||||
|
package com.epmet.opendata.mq.listener; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.epmet.commons.rocketmq.constants.MQUserPropertys; |
||||
|
import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; |
||||
|
import com.epmet.commons.tools.distributedlock.DistributedLock; |
||||
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.redis.RedisKeys; |
||||
|
import com.epmet.commons.tools.redis.RedisUtils; |
||||
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
||||
|
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; |
||||
|
import com.epmet.opendata.service.UserPatrolRecordService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; |
||||
|
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; |
||||
|
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; |
||||
|
import org.apache.rocketmq.common.message.MessageExt; |
||||
|
import org.redisson.api.RLock; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.concurrent.TimeUnit; |
||||
|
|
||||
|
/** |
||||
|
* @author wxz |
||||
|
* @Description 系统对接中间库,巡查信息变更监听器 |
||||
|
* @date 2021.10.13 15:21:48 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
public class OpenDataPatrolChangeEventListener implements MessageListenerConcurrently { |
||||
|
|
||||
|
private Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
@Override |
||||
|
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) { |
||||
|
|
||||
|
if (redisUtils == null) { |
||||
|
redisUtils = SpringContextUtils.getBean(RedisUtils.class); |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
msgs.forEach(msg -> consumeMessage(msg)); |
||||
|
} catch (Exception e) { |
||||
|
logger.error(ExceptionUtils.getErrorStackTrace(e)); |
||||
|
return ConsumeConcurrentlyStatus.RECONSUME_LATER; |
||||
|
} |
||||
|
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; |
||||
|
} |
||||
|
|
||||
|
private void consumeMessage(MessageExt messageExt) { |
||||
|
// msg即为消息体
|
||||
|
// tags为SystemMessageType.java中的项,为具体的操作,此处拿到tags,判断是创建还是变更,来做响应的后续操作即可
|
||||
|
String msg = new String(messageExt.getBody()); |
||||
|
String topic = messageExt.getTopic(); |
||||
|
String tags = messageExt.getTags(); |
||||
|
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.PENDING_MSG_LABEL); |
||||
|
|
||||
|
logger.info("【开放数据事件监听器】-巡查记录信息变更-收到消息内容:{}, 操作:{}", msg, tags); |
||||
|
StaffPatrolMQMsg msgObj = JSON.parseObject(msg, StaffPatrolMQMsg.class); |
||||
|
if (msgObj == null) { |
||||
|
log.warn("consumeMessage msg body is blank"); |
||||
|
return; |
||||
|
} |
||||
|
DistributedLock distributedLock = null; |
||||
|
RLock lock = null; |
||||
|
try { |
||||
|
distributedLock = SpringContextUtils.getBean(DistributedLock.class); |
||||
|
lock = distributedLock.getLock(String.format("lock:open_data_patrol:%s", msgObj.getPatrolId()), |
||||
|
30L, 30L, TimeUnit.SECONDS); |
||||
|
UpsertPatrolRecordForm patrolRecordForm = new UpsertPatrolRecordForm(); |
||||
|
patrolRecordForm.setCustomerId(msgObj.getCustomerId()); |
||||
|
patrolRecordForm.setPatrolId(msgObj.getPatrolId()); |
||||
|
patrolRecordForm.setActionType(msgObj.getActionType()); |
||||
|
|
||||
|
Boolean aBoolean = SpringContextUtils.getBean(UserPatrolRecordService.class).upsertPatrolRecord(patrolRecordForm); |
||||
|
} catch (RenException e) { |
||||
|
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
|
||||
|
logger.error("【开放数据事件监听器】-巡查记录信息变更-初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
||||
|
} catch (Exception e) { |
||||
|
// 不是我们自己抛出的异常,可以让MQ重试
|
||||
|
logger.error("【开放数据事件监听器】-巡查记录信息变更-初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
||||
|
throw e; |
||||
|
} finally { |
||||
|
distributedLock.unLock(lock); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(pendingMsgLabel)) { |
||||
|
try { |
||||
|
removePendingMqMsgCache(pendingMsgLabel); |
||||
|
} catch (Exception e) { |
||||
|
logger.error("【开放数据事件监听器】-巡查-删除mq滞留消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description |
||||
|
* |
||||
|
* @param pendingMsgLabel |
||||
|
* @return |
||||
|
* @author wxz |
||||
|
* @date 2021.10.14 16:32:32 |
||||
|
*/ |
||||
|
private void removePendingMqMsgCache(String pendingMsgLabel) { |
||||
|
String key = RedisKeys.pendingMqMsgKey(pendingMsgLabel); |
||||
|
redisUtils.delete(key); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,102 @@ |
|||||
|
package com.epmet.opendata.mq.listener; |
||||
|
|
||||
|
import com.epmet.commons.rocketmq.constants.MQUserPropertys; |
||||
|
import com.epmet.commons.tools.distributedlock.DistributedLock; |
||||
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.redis.RedisKeys; |
||||
|
import com.epmet.commons.tools.redis.RedisUtils; |
||||
|
import com.epmet.commons.tools.utils.SpringContextUtils; |
||||
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; |
||||
|
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; |
||||
|
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; |
||||
|
import org.apache.rocketmq.common.message.MessageExt; |
||||
|
import org.redisson.api.RLock; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description 系统对接中间库,工作人员信息变更监听器 |
||||
|
* @author wxz |
||||
|
* @date 2021.10.13 15:21:48 |
||||
|
*/ |
||||
|
public class OpenDataStaffChangeEventListener implements MessageListenerConcurrently { |
||||
|
|
||||
|
private Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
private EpmetMessageOpenFeignClient messageOpenFeignClient; |
||||
|
|
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
@Override |
||||
|
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) { |
||||
|
|
||||
|
if (redisUtils == null) { |
||||
|
redisUtils = SpringContextUtils.getBean(RedisUtils.class); |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
msgs.forEach(msg -> consumeMessage(msg)); |
||||
|
} catch (Exception e) { |
||||
|
logger.error(ExceptionUtils.getErrorStackTrace(e)); |
||||
|
return ConsumeConcurrentlyStatus.RECONSUME_LATER; |
||||
|
} |
||||
|
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; |
||||
|
} |
||||
|
|
||||
|
private void consumeMessage(MessageExt messageExt) { |
||||
|
// msg即为消息体
|
||||
|
// tags为SystemMessageType.java中的项,为具体的操作,此处拿到tags,判断是创建还是变更,来做响应的后续操作即可
|
||||
|
String msg = new String(messageExt.getBody()); |
||||
|
String topic = messageExt.getTopic(); |
||||
|
String tags = messageExt.getTags(); |
||||
|
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.PENDING_MSG_LABEL); |
||||
|
|
||||
|
//messageExt.propert
|
||||
|
|
||||
|
logger.info("【开放数据事件监听器】-工作人员信息变更-收到消息内容:{}, 操作:{}, pendingMsgLabel:{}", msg, tags, pendingMsgLabel); |
||||
|
|
||||
|
DistributedLock distributedLock = null; |
||||
|
RLock lock = null; |
||||
|
try { |
||||
|
//distributedLock = SpringContextUtils.getBean(DistributedLock.class);
|
||||
|
//lock = distributedLock.getLock(String.format("lock:open_data_staff:%s", staffId),
|
||||
|
// 30L, 30L, TimeUnit.SECONDS);
|
||||
|
|
||||
|
} catch (RenException e) { |
||||
|
// 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
|
||||
|
logger.error("【开放数据事件监听器】-工作人员信息变更-初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
||||
|
} catch (Exception e) { |
||||
|
// 不是我们自己抛出的异常,可以让MQ重试
|
||||
|
logger.error("【开放数据事件监听器】-工作人员信息变更-初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); |
||||
|
throw e; |
||||
|
} finally { |
||||
|
//distributedLock.unLock(lock);
|
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(pendingMsgLabel)) { |
||||
|
try { |
||||
|
removePendingMqMsgCache(pendingMsgLabel); |
||||
|
} catch (Exception e) { |
||||
|
logger.error("【开放数据事件监听器】-staff-删除mq滞留消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description |
||||
|
* |
||||
|
* @param pendingMsgLabel |
||||
|
* @return |
||||
|
* @author wxz |
||||
|
* @date 2021.10.14 16:32:32 |
||||
|
*/ |
||||
|
private void removePendingMqMsgCache(String pendingMsgLabel) { |
||||
|
String key = RedisKeys.pendingMqMsgKey(pendingMsgLabel); |
||||
|
redisUtils.delete(key); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.opendata.entity.UserPatrolDetailEntity; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员巡查记录明细 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
public interface UserPatrolDetailService extends BaseService<UserPatrolDetailEntity> { |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; |
||||
|
import com.epmet.opendata.entity.UserPatrolRecordEntity; |
||||
|
|
||||
|
/** |
||||
|
* 用户巡查主记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
public interface UserPatrolRecordService extends BaseService<UserPatrolRecordEntity> { |
||||
|
|
||||
|
/** |
||||
|
* desc:根据条件更新或者插入巡查记录 |
||||
|
* @param patrolRecordForm |
||||
|
* @return |
||||
|
*/ |
||||
|
Boolean upsertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm); |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.service.impl; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.opendata.dao.UserPatrolDetailDao; |
||||
|
import com.epmet.opendata.entity.UserPatrolDetailEntity; |
||||
|
import com.epmet.opendata.service.UserPatrolDetailService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员巡查记录明细 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class UserPatrolDetailServiceImpl extends BaseServiceImpl<UserPatrolDetailDao, UserPatrolDetailEntity> implements UserPatrolDetailService { |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,163 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.opendata.service.impl; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.constant.StrConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.constant.SystemMessageType; |
||||
|
import com.epmet.dto.user.param.MidPatrolFormDTO; |
||||
|
import com.epmet.dto.user.result.MidPatrolDetailResult; |
||||
|
import com.epmet.dto.user.result.MidPatrolRecordResult; |
||||
|
import com.epmet.feign.DataStatisticalOpenFeignClient; |
||||
|
import com.epmet.opendata.dao.UserPatrolDetailDao; |
||||
|
import com.epmet.opendata.dao.UserPatrolRecordDao; |
||||
|
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; |
||||
|
import com.epmet.opendata.entity.UserPatrolDetailEntity; |
||||
|
import com.epmet.opendata.entity.UserPatrolRecordEntity; |
||||
|
import com.epmet.opendata.service.UserPatrolRecordService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.jetbrains.annotations.NotNull; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用户巡查主记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2021-10-14 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class UserPatrolRecordServiceImpl extends BaseServiceImpl<UserPatrolRecordDao, UserPatrolRecordEntity> implements UserPatrolRecordService { |
||||
|
|
||||
|
@Autowired |
||||
|
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; |
||||
|
@Autowired |
||||
|
private UserPatrolDetailDao userPatrolDetailDao; |
||||
|
|
||||
|
@Override |
||||
|
public Boolean upsertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm) { |
||||
|
ValidatorUtils.validateEntity(patrolRecordForm); |
||||
|
boolean delFlag = false; |
||||
|
MidPatrolFormDTO midPatrolFormDTO = buildParam(patrolRecordForm); |
||||
|
Result<List<MidPatrolRecordResult>> record = dataStatisticalOpenFeignClient.getPatrolRecordList(midPatrolFormDTO); |
||||
|
if (record == null || !record.success()){ |
||||
|
log.error("获取巡查记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); |
||||
|
return false; |
||||
|
} |
||||
|
List<MidPatrolRecordResult> data = record.getData(); |
||||
|
if (CollectionUtils.isEmpty(data)){ |
||||
|
//数据已被删除了
|
||||
|
delFlag = true; |
||||
|
//暂时设置error 用于排错
|
||||
|
log.error("获取巡查记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); |
||||
|
int effectRow = baseDao.deleteById(patrolRecordForm.getPatrolId()); |
||||
|
log.warn("del effectRow:{}",effectRow); |
||||
|
return true; |
||||
|
} |
||||
|
MidPatrolRecordResult recordResult = data.get(NumConstant.ZERO); |
||||
|
switch (patrolRecordForm.getActionType()){ |
||||
|
case SystemMessageType.USER_PATROL_START: |
||||
|
//insert
|
||||
|
baseDao.insert(buildEntity(recordResult)); |
||||
|
break; |
||||
|
case SystemMessageType.USER_PATROL_STOP: |
||||
|
//update
|
||||
|
baseDao.updateById(buildEntity(recordResult)); |
||||
|
Result<List<MidPatrolDetailResult>> detailResult = dataStatisticalOpenFeignClient.getPatrolDetailList(midPatrolFormDTO); |
||||
|
if (detailResult == null || !detailResult.success()){ |
||||
|
log.error("获取巡查记录明细失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); |
||||
|
return false; |
||||
|
} |
||||
|
UserPatrolDetailEntity detailEntity = buildDetailEntity(recordResult, detailResult); |
||||
|
|
||||
|
userPatrolDetailDao.insert(detailEntity); |
||||
|
break; |
||||
|
default: |
||||
|
log.info("======"); |
||||
|
|
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
@NotNull |
||||
|
private UserPatrolDetailEntity buildDetailEntity(MidPatrolRecordResult recordResult, Result<List<MidPatrolDetailResult>> detailResult) { |
||||
|
UserPatrolDetailEntity detailEntity = new UserPatrolDetailEntity(); |
||||
|
detailEntity.setCustomerId(recordResult.getCustomerId()); |
||||
|
detailEntity.setStaffPatrolRecId(recordResult.getId()); |
||||
|
StringBuilder sb =new StringBuilder(); |
||||
|
detailResult.getData().forEach(o->{ |
||||
|
sb.append(o.getLongitude()) |
||||
|
.append(StrConstant.COMMA) |
||||
|
.append(o.getLatitude()) |
||||
|
.append(StrConstant.SEMICOLON); |
||||
|
}); |
||||
|
detailEntity.setRoute(sb.toString()); |
||||
|
detailEntity.setId(recordResult.getId()); |
||||
|
detailEntity.setRevision(recordResult.getRevision()); |
||||
|
detailEntity.setCreatedBy(recordResult.getCreatedBy()); |
||||
|
detailEntity.setCreatedTime(recordResult.getCreatedTime()); |
||||
|
detailEntity.setUpdatedBy(recordResult.getUpdatedBy()); |
||||
|
detailEntity.setUpdatedTime(recordResult.getUpdatedTime()); |
||||
|
detailEntity.setDelFlag(String.valueOf(recordResult.getDelFlag())); |
||||
|
return detailEntity; |
||||
|
} |
||||
|
|
||||
|
private UserPatrolRecordEntity buildEntity(MidPatrolRecordResult recordResult) { |
||||
|
UserPatrolRecordEntity entity = new UserPatrolRecordEntity(); |
||||
|
entity.setCustomerId(recordResult.getCustomerId()); |
||||
|
entity.setGrid(recordResult.getGrid()); |
||||
|
entity.setGridPids(recordResult.getGridPids()); |
||||
|
entity.setStaffId(recordResult.getStaffId()); |
||||
|
entity.setAgencyId(recordResult.getAgencyId()); |
||||
|
entity.setPatrolStartTime(recordResult.getPatrolStartTime()); |
||||
|
entity.setPatrolEndTime(recordResult.getPatrolEndTime()); |
||||
|
entity.setActrualEndTime(recordResult.getActrualEndTime()); |
||||
|
entity.setStartLocation(""); |
||||
|
entity.setEndLocation(""); |
||||
|
entity.setTotalTime(recordResult.getTotalTime()); |
||||
|
entity.setDistance(0); |
||||
|
entity.setStatus(recordResult.getStatus()); |
||||
|
entity.setId(recordResult.getId()); |
||||
|
entity.setRevision(recordResult.getRevision()); |
||||
|
entity.setCreatedBy(recordResult.getCreatedBy()); |
||||
|
entity.setCreatedTime(recordResult.getCreatedTime()); |
||||
|
entity.setUpdatedBy(recordResult.getUpdatedBy()); |
||||
|
entity.setUpdatedTime(recordResult.getUpdatedTime()); |
||||
|
entity.setDelFlag(String.valueOf(recordResult.getDelFlag())); |
||||
|
return entity; |
||||
|
} |
||||
|
|
||||
|
@NotNull |
||||
|
private MidPatrolFormDTO buildParam(UpsertPatrolRecordForm patrolRecordForm) { |
||||
|
MidPatrolFormDTO midPatrolFormDTO = new MidPatrolFormDTO(); |
||||
|
midPatrolFormDTO.setCustomerId(patrolRecordForm.getCustomerId()); |
||||
|
midPatrolFormDTO.setPatrolId(patrolRecordForm.getPatrolId()); |
||||
|
midPatrolFormDTO.setPageNo(0); |
||||
|
midPatrolFormDTO.setPageSize(1); |
||||
|
return midPatrolFormDTO; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,138 @@ |
|||||
|
server: |
||||
|
port: @server.port@ |
||||
|
version: @version@ |
||||
|
servlet: |
||||
|
context-path: /opendata |
||||
|
|
||||
|
spring: |
||||
|
main: |
||||
|
allow-bean-definition-overriding: true |
||||
|
application: |
||||
|
name: open-data-server |
||||
|
#环境 dev|test|prod |
||||
|
profiles: |
||||
|
active: @spring.profiles.active@ |
||||
|
jackson: |
||||
|
time-zone: GMT+8 |
||||
|
date-format: yyyy-MM-dd HH:mm:ss |
||||
|
redis: |
||||
|
database: @spring.redis.index@ |
||||
|
host: @spring.redis.host@ |
||||
|
port: @spring.redis.port@ |
||||
|
password: @spring.redis.password@ |
||||
|
timeout: 30s |
||||
|
datasource: |
||||
|
druid: |
||||
|
#MySQL |
||||
|
driver-class-name: com.mysql.cj.jdbc.Driver |
||||
|
url: @spring.datasource.druid.url@ |
||||
|
username: @spring.datasource.druid.username@ |
||||
|
password: @spring.datasource.druid.password@ |
||||
|
cloud: |
||||
|
nacos: |
||||
|
discovery: |
||||
|
server-addr: @nacos.server-addr@ |
||||
|
#nacos的命名空间ID,默认是public |
||||
|
namespace: @nacos.discovery.namespace@ |
||||
|
#不把自己注册到注册中心的地址 |
||||
|
register-enabled: @nacos.register-enabled@ |
||||
|
ip: @nacos.ip@ |
||||
|
serviceListChangedListening: |
||||
|
enable: @nacos.service-list-changed-listening.enable@ |
||||
|
config: |
||||
|
enabled: @nacos.config-enabled@ |
||||
|
server-addr: @nacos.server-addr@ |
||||
|
namespace: @nacos.config.namespace@ |
||||
|
group: @nacos.config.group@ |
||||
|
file-extension: yaml |
||||
|
#指定共享配置,且支持动态刷新 |
||||
|
# ext-config: |
||||
|
# - data-id: datasource.yaml |
||||
|
# group: ${spring.cloud.nacos.config.group} |
||||
|
# refresh: true |
||||
|
# - data-id: common.yaml |
||||
|
# group: ${spring.cloud.nacos.config.group} |
||||
|
# refresh: true |
||||
|
|
||||
|
# 数据迁移工具flyway |
||||
|
flyway: |
||||
|
enabled: @spring.flyway.enabled@ |
||||
|
locations: classpath:db/migration |
||||
|
url: @spring.datasource.druid.url@ |
||||
|
user: @spring.datasource.druid.username@ |
||||
|
password: @spring.datasource.druid.password@ |
||||
|
baseline-on-migrate: true |
||||
|
baseline-version: 0 |
||||
|
|
||||
|
|
||||
|
management: |
||||
|
endpoints: |
||||
|
web: |
||||
|
exposure: |
||||
|
include: "*" |
||||
|
endpoint: |
||||
|
health: |
||||
|
show-details: ALWAYS |
||||
|
|
||||
|
mybatis-plus: |
||||
|
mapper-locations: classpath:/mapper/**/*.xml |
||||
|
#实体扫描,多个package用逗号或者分号分隔 |
||||
|
typeAliasesPackage: com.epmet.entity |
||||
|
global-config: |
||||
|
#数据库相关配置 |
||||
|
db-config: |
||||
|
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; |
||||
|
id-type: ID_WORKER |
||||
|
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" |
||||
|
field-strategy: NOT_NULL |
||||
|
#驼峰下划线转换 |
||||
|
column-underline: true |
||||
|
banner: false |
||||
|
#原生配置 |
||||
|
configuration: |
||||
|
map-underscore-to-camel-case: true |
||||
|
cache-enabled: false |
||||
|
call-setters-on-nulls: true |
||||
|
jdbc-type-for-null: 'null' |
||||
|
|
||||
|
feign: |
||||
|
hystrix: |
||||
|
enabled: true |
||||
|
client: |
||||
|
config: |
||||
|
default: |
||||
|
loggerLevel: BASIC |
||||
|
okhttp: |
||||
|
enabled: true |
||||
|
|
||||
|
hystrix: |
||||
|
command: |
||||
|
default: |
||||
|
execution: |
||||
|
isolation: |
||||
|
thread: |
||||
|
timeoutInMilliseconds: 60000 #缺省为1000 |
||||
|
|
||||
|
ribbon: |
||||
|
ReadTimeout: 300000 |
||||
|
ConnectTimeout: 300000 |
||||
|
|
||||
|
#pageHelper分页插件 |
||||
|
pagehelper: |
||||
|
helper-dialect: mysql |
||||
|
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 |
||||
|
|
||||
|
#feign 日志需要该配置 |
||||
|
logging: |
||||
|
level: |
||||
|
com.epmet: debug |
||||
|
|
||||
|
dingTalk: |
||||
|
robot: |
||||
|
webHook: @dingTalk.robot.webHook@ |
||||
|
secret: @dingTalk.robot.secret@ |
||||
|
|
||||
|
rocketmq: |
||||
|
# 是否开启mq |
||||
|
enable: @rocketmq.enable@ |
||||
|
name-server: @rocketmq.nameserver@ |
||||
@ -0,0 +1,14 @@ |
|||||
|
create database epmet_open_data default character set utf8mb4 collate utf8mb4_general_ci; |
||||
|
|
||||
|
-- 开发环境的脚本 |
||||
|
CREATE USER epmet_open_data_user@'%' IDENTIFIED BY 'EpmEt-db-UsEr'; |
||||
|
GRANT ALL ON `epmet_open_data`.* TO 'epmet_open_data_user'@'%'; |
||||
|
flush privileges; |
||||
|
|
||||
|
|
||||
|
|
||||
|
-- 测试环境的脚本 |
||||
|
|
||||
|
|
||||
|
|
||||
|
-- 生产环境的数据 |
||||
@ -0,0 +1,176 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<configuration> |
||||
|
<include resource="org/springframework/boot/logging/logback/base.xml"/> |
||||
|
|
||||
|
<property name="log.path" value="logs/open-data"/> |
||||
|
|
||||
|
<springProperty scope="context" name="appname" source="spring.application.name"/> |
||||
|
|
||||
|
<springProperty scope="context" name="webHook" source="dingTalk.robot.webHook"/> |
||||
|
<springProperty scope="context" name="secret" source="dingTalk.robot.secret"/> |
||||
|
|
||||
|
<!-- 日志上下文名称 --> |
||||
|
<contextName>${appname}</contextName> |
||||
|
|
||||
|
<!-- 彩色日志格式 --> |
||||
|
<property name="CONSOLE_LOG_PATTERN" |
||||
|
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
|
|
||||
|
<!--1. 输出到控制台--> |
||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
||||
|
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
|
<level>debug</level> |
||||
|
</filter> |
||||
|
<encoder> |
||||
|
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
||||
|
<!-- 设置字符集 --> |
||||
|
<charset>UTF-8</charset> |
||||
|
</encoder> |
||||
|
</appender> |
||||
|
|
||||
|
<!--2. 输出到文档--> |
||||
|
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
||||
|
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文档的路径及文档名 --> |
||||
|
<file>${log.path}/debug.log</file> |
||||
|
<!--日志文档输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 日志归档 --> |
||||
|
<fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文档保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文档只记录debug级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>debug</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
||||
|
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文档的路径及文档名 --> |
||||
|
<file>${log.path}/info.log</file> |
||||
|
<!--日志文档输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 每天日志归档路径以及格式 --> |
||||
|
<fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文档保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文档只记录info级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>info</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
||||
|
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文档的路径及文档名 --> |
||||
|
<file>${log.path}/warn.log</file> |
||||
|
<!--日志文档输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文档保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文档只记录warn级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>warn</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
||||
|
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文档的路径及文档名 --> |
||||
|
<file>${log.path}/error.log</file> |
||||
|
<!--日志文档输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文档保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文档只记录ERROR级别的 发送钉钉短信 --> |
||||
|
<filter class="com.epmet.commons.tools.filter.LogMsgSendFilter"> |
||||
|
<level>ERROR</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
<webHook>${webHook}</webHook> |
||||
|
<secret>${secret}</secret> |
||||
|
<appName>${appname}</appName> |
||||
|
</filter> |
||||
|
<!-- 此日志文档只记录ERROR级别的 --> |
||||
|
<!--<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>ERROR</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter>--> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 开发、测试环境 --> |
||||
|
<springProfile name="dev,test,local"> |
||||
|
<logger name="org.springframework.web" level="INFO"/> |
||||
|
<logger name="org.springboot.sample" level="INFO"/> |
||||
|
<logger name="com.epmet.dao" level="INFO"/> |
||||
|
<logger name="com.epmet.dao" level="DEBUG"/> |
||||
|
<root level="INFO"> |
||||
|
<appender-ref ref="DEBUG_FILE"/> |
||||
|
<appender-ref ref="INFO_FILE"/> |
||||
|
<appender-ref ref="WARN_FILE"/> |
||||
|
<appender-ref ref="ERROR_FILE"/> |
||||
|
</root> |
||||
|
</springProfile> |
||||
|
|
||||
|
<!-- 生产环境 --> |
||||
|
<springProfile name="prod"> |
||||
|
<logger name="org.springframework.web" level="INFO"/> |
||||
|
<logger name="org.springboot.sample" level="INFO"/> |
||||
|
<logger name="com.epmet.dao" level="INFO"/> |
||||
|
<root level="INFO"> |
||||
|
<appender-ref ref="CONSOLE"/> |
||||
|
<appender-ref ref="DEBUG_FILE"/> |
||||
|
<appender-ref ref="INFO_FILE"/> |
||||
|
<appender-ref ref="WARN_FILE"/> |
||||
|
<appender-ref ref="ERROR_FILE"/> |
||||
|
</root> |
||||
|
</springProfile> |
||||
|
|
||||
|
</configuration> |
||||
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.opendata.dao.UserPatrolDetailDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.opendata.entity.UserPatrolDetailEntity" id="staffPatrolDetailMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID"/> |
||||
|
<result property="staffPatrolRecId" column="STAFF_PATROL_REC_ID"/> |
||||
|
<result property="route" column="ROUTE"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.opendata.dao.UserPatrolRecordDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.opendata.entity.UserPatrolRecordEntity" id="userPatrolRecordMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID"/> |
||||
|
<result property="grid" column="GRID"/> |
||||
|
<result property="gridPids" column="GRID_PIDS"/> |
||||
|
<result property="staffId" column="STAFF_ID"/> |
||||
|
<result property="agencyId" column="AGENCY_ID"/> |
||||
|
<result property="patrolStartTime" column="PATROL_START_TIME"/> |
||||
|
<result property="patrolEndTime" column="PATROL_END_TIME"/> |
||||
|
<result property="actrualEndTime" column="ACTRUAL_END_TIME"/> |
||||
|
<result property="startLocation" column="START_LOCATION"/> |
||||
|
<result property="endLocation" column="END_LOCATION"/> |
||||
|
<result property="totalTime" column="TOTAL_TIME"/> |
||||
|
<result property="distance" column="DISTANCE"/> |
||||
|
<result property="status" column="STATUS"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,18 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<parent> |
||||
|
<artifactId>epmet-module</artifactId> |
||||
|
<groupId>com.epmet</groupId> |
||||
|
<version>2.0.0</version> |
||||
|
</parent> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<artifactId>open-data-worker</artifactId> |
||||
|
<packaging>pom</packaging> |
||||
|
<modules> |
||||
|
<module>open-data-worker-client</module> |
||||
|
<module>open-data-worker-server</module> |
||||
|
</modules> |
||||
|
</project> |
||||
Loading…
Reference in new issue