轨迹、快速绑定企业
This commit is contained in:
parent
9294df9a4a
commit
8e9dd425a1
20
readme.md
20
readme.md
@ -33,6 +33,26 @@
|
||||
|
||||
1. taskCheck的v1版本
|
||||
|
||||
### 增加用户轨迹
|
||||
|
||||
表名
|
||||
|
||||
```sql
|
||||
CREATE TABLE `ac_action_point` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`action_point_id` char(36) NOT NULL,
|
||||
`lng` varchar(255) DEFAULT NULL COMMENT '经度',
|
||||
`lat` varchar(255) DEFAULT NULL COMMENT '维度',
|
||||
`gmt_create` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`creator` char(36) DEFAULT NULL COMMENT '创建人',
|
||||
`creator_name` varchar(255) DEFAULT NULL COMMENT '创建人姓名',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `action_point_id` (`action_point_id`),
|
||||
KEY `creator` (`creator`),
|
||||
KEY `gmt_create` (`gmt_create`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
```
|
||||
|
||||
## 集宁环保厅
|
||||
|
||||
1. 案件上报与流转与包头v1一致
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.cm.inspection.controller.apis.action;
|
||||
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.inspection.pojo.dtos.action.ActionPointDTO;
|
||||
import com.cm.inspection.service.action.IActionPointService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: ActionPointAppController
|
||||
* @Description: 行动轨迹
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/11/25 15:05
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "工作轨迹")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/action/point")
|
||||
public class ActionPointController {
|
||||
|
||||
@Autowired
|
||||
private IActionPointService actionPointService;
|
||||
|
||||
@ApiOperation(value = "轨迹列表", notes = "轨迹列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query"),
|
||||
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list/user-id/{userId}")
|
||||
public List<ActionPointDTO> list(@PathVariable("userId") String userId,
|
||||
@RequestParam("startDate") String startDate,
|
||||
@RequestParam("endDate") String endDate) {
|
||||
return actionPointService.listByUserId(userId, startDate, endDate);
|
||||
}
|
||||
|
||||
}
|
@ -4,6 +4,7 @@ import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||
import com.cm.common.base.AbstractController;
|
||||
import com.cm.common.component.SecurityComponent;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.ParamsException;
|
||||
import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
@ -18,7 +19,6 @@ import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -47,6 +47,18 @@ public class EnterpriseOfGridOperatorController extends AbstractController {
|
||||
return enterpriseOfGridOperatorService.saveEnterpriseOfGridOperator(enterpriseOfGridOperatorVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增网格员的企业", notes = "新增网格员的企业接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("saveenterprisesofgridoperator")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult saveEnterprisesOfGridOperator(@RequestBody EnterpriseOfGridOperatorVO enterpriseOfGridOperatorVO) throws Exception {
|
||||
if (enterpriseOfGridOperatorVO.getEnterpriseIds().isEmpty()) {
|
||||
throw new ParamsException("企业ID列表不能为空");
|
||||
}
|
||||
enterpriseOfGridOperatorService.saveEnterprisesOfGridOperator(enterpriseOfGridOperatorVO.getUserId(), enterpriseOfGridOperatorVO.getEnterpriseIds());
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除网格员的企业(id列表)", notes = "删除网格员的企业(id列表)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
@ -57,6 +69,8 @@ public class EnterpriseOfGridOperatorController extends AbstractController {
|
||||
return enterpriseOfGridOperatorService.removeEnterpriseOfGridOperator(ids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "删除网格员的企业(通过id,物理)", notes = "删除网格员的企业(通过id,物理)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
@ -67,6 +81,17 @@ public class EnterpriseOfGridOperatorController extends AbstractController {
|
||||
return enterpriseOfGridOperatorService.deleteEnterpriseOfGridOperator(ids);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除网格员的企业(id列表)", notes = "删除网格员的企业(id列表)接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("deleteenterprisesofgridoperator")
|
||||
public SuccessResult deleteEnterprisesOfGridOperator(@RequestBody EnterpriseOfGridOperatorVO enterpriseOfGridOperatorVO) throws RemoveException {
|
||||
if (enterpriseOfGridOperatorVO.getEnterpriseIds().isEmpty()) {
|
||||
throw new ParamsException("企业ID列表不能为空");
|
||||
}
|
||||
enterpriseOfGridOperatorService.deleteEnterprisesOfGridOperator(enterpriseOfGridOperatorVO.getUserId(), enterpriseOfGridOperatorVO.getEnterpriseIds());
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除网格员的企业(通过企业ID,和用户ID,物理)", notes = "删除网格员的企业(通过企业ID,和用户ID,物理)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "企业ID", paramType = "path"),
|
||||
@ -156,6 +181,16 @@ public class EnterpriseOfGridOperatorController extends AbstractController {
|
||||
return enterpriseOfGridOperatorService.listPageEnterpriseOfGridOperatorByUserId(userId, page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "网格员的企业列表(通过用户ID)", notes = "网格员的企业列表(通过用户ID)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listenterpriseofgridoperatorbyuserid/{userId}")
|
||||
public List<EnterpriseOfGridOperatorDTO> listEnterpriseOfGridOperatorByUserId(@PathVariable("userId") String userId) throws SearchException {
|
||||
return enterpriseOfGridOperatorService.listEnterpriseOfGridOperatorByUserId(userId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "当前用户id信息", notes = "当前用户id信息接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("getcurrentuseridinfo")
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.cm.inspection.controller.app.apis.action;
|
||||
|
||||
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.inspection.pojo.dtos.action.ActionPointDTO;
|
||||
import com.cm.inspection.pojo.vos.action.ActionPointVO;
|
||||
import com.cm.inspection.service.action.IActionPointService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: ActionPointAppController
|
||||
* @Description: 行动轨迹
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/11/25 15:05
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "工作轨迹")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/action/point")
|
||||
public class ActionPointAppController {
|
||||
|
||||
@Autowired
|
||||
private IActionPointService actionPointService;
|
||||
|
||||
@ApiOperation(value = "上报", notes = "上报接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult saveCheck(@RequestHeader("token") String token, @RequestBody ActionPointVO actionPointVO) throws Exception {
|
||||
actionPointService.save(token, actionPointVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "轨迹列表", notes = "轨迹列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query"),
|
||||
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list")
|
||||
public List<ActionPointDTO> list(@RequestHeader("token") String token,
|
||||
@RequestParam("startDate") String startDate,
|
||||
@RequestParam("endDate") String endDate) {
|
||||
return actionPointService.list(token, startDate, endDate);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.cm.inspection.dao.action;
|
||||
|
||||
import com.cm.inspection.pojo.dtos.action.ActionPointDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IActionPointDao
|
||||
* @Description:
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/11/25 15:30
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface IActionPointDao {
|
||||
|
||||
void save(Map<String, Object> params);
|
||||
|
||||
List<ActionPointDTO> list(Map<String, Object> params);
|
||||
}
|
@ -63,6 +63,15 @@ public interface IGridPersonnelDao {
|
||||
*/
|
||||
List<GridPersonnelDTO> listGridPersonnel(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 网格人员列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<GridPersonnelPO> listPO(Map<String, Object> params);
|
||||
|
||||
|
||||
/**
|
||||
* 统计网格员
|
||||
*
|
||||
@ -105,4 +114,5 @@ public interface IGridPersonnelDao {
|
||||
* @throws SearchException
|
||||
*/
|
||||
GridPersonnelPO getPO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
package com.cm.inspection.pojo.dtos.action;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @ClassName: ActionPointDTO
|
||||
* @Description:
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/11/25 16:16
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class ActionPointDTO {
|
||||
|
||||
@ApiModelProperty(name = "actionPointId", value = "主键")
|
||||
private String actionPointId;
|
||||
@ApiModelProperty(name = "lng", value = "经度")
|
||||
private String lng;
|
||||
@ApiModelProperty(name = "lat", value = "维度")
|
||||
private String lat;
|
||||
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
|
||||
private String gmtCreate;
|
||||
@ApiModelProperty(name = "creator", value = "创建人")
|
||||
private String creator;
|
||||
@ApiModelProperty(name = "creatorName", value = "创建人名称")
|
||||
private String creatorName;
|
||||
|
||||
public String getActionPointId() {
|
||||
return actionPointId == null ? "" : actionPointId.trim();
|
||||
}
|
||||
|
||||
public void setActionPointId(String actionPointId) {
|
||||
this.actionPointId = actionPointId;
|
||||
}
|
||||
|
||||
public String getLng() {
|
||||
return lng == null ? "" : lng.trim();
|
||||
}
|
||||
|
||||
public void setLng(String lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
public String getLat() {
|
||||
return lat == null ? "" : lat.trim();
|
||||
}
|
||||
|
||||
public void setLat(String lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator == null ? "" : creator.trim();
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName == null ? "" : creatorName.trim();
|
||||
}
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
}
|
@ -106,5 +106,7 @@ public class Check2DTO implements Serializable {
|
||||
private String creatorPhone;
|
||||
@ApiModelProperty(name = "checkItems", value = "检查列表")
|
||||
private List<CheckItemDTO> checkItems;
|
||||
@ApiModelProperty(name = "cardColor", value = "卡片颜色")
|
||||
private Integer cardColor;
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class Check2PO implements Serializable {
|
||||
private Integer rectificationDays;
|
||||
private String summary;
|
||||
private Integer isComplete;
|
||||
private String checkType;
|
||||
private Integer checkType;
|
||||
private String checkLng;
|
||||
private String checkLat;
|
||||
private String creator;
|
||||
|
@ -82,6 +82,10 @@ public class EnterpriseOfGridOperatorDTO implements Serializable {
|
||||
private Integer isLogOffByEnterpriseId;
|
||||
@ApiModelProperty(name = "userCount", value = "绑定用户数")
|
||||
private Integer userCount;
|
||||
@ApiModelProperty(name = "lng", value = "经度")
|
||||
private String lng;
|
||||
@ApiModelProperty(name = "lat", value = "维度")
|
||||
private String lat;
|
||||
|
||||
public String getEnterpriseOfGridOperatorId() {
|
||||
return enterpriseOfGridOperatorId == null ? "" : enterpriseOfGridOperatorId;
|
||||
@ -347,6 +351,22 @@ public class EnterpriseOfGridOperatorDTO implements Serializable {
|
||||
this.userCount = userCount;
|
||||
}
|
||||
|
||||
public String getLng() {
|
||||
return lng == null ? "" : lng.trim();
|
||||
}
|
||||
|
||||
public void setLng(String lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
public String getLat() {
|
||||
return lat == null ? "" : lat.trim();
|
||||
}
|
||||
|
||||
public void setLat(String lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
@ -416,6 +436,10 @@ public class EnterpriseOfGridOperatorDTO implements Serializable {
|
||||
.append(isLogOffByEnterpriseId);
|
||||
sb.append(",\"userCount\":")
|
||||
.append(userCount);
|
||||
sb.append(",\"lng\":\"")
|
||||
.append(lng).append('\"');
|
||||
sb.append(",\"lat\":\"")
|
||||
.append(lat).append('\"');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.cm.inspection.pojo.vos.action;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @ClassName: ActionPointVO
|
||||
* @Description:
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/11/25 15:13
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@ApiModel
|
||||
public class ActionPointVO {
|
||||
|
||||
@ApiModelProperty(name = "lng", value = "经度")
|
||||
private String lng;
|
||||
@ApiModelProperty(name = "lat", value = "维度")
|
||||
private String lat;
|
||||
|
||||
public String getLng() {
|
||||
return lng == null ? "" : lng.trim();
|
||||
}
|
||||
|
||||
public void setLng(String lng) {
|
||||
this.lng = lng;
|
||||
}
|
||||
|
||||
public String getLat() {
|
||||
return lat == null ? "" : lat.trim();
|
||||
}
|
||||
|
||||
public void setLat(String lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
package com.cm.inspection.pojo.vos.enterpriseofgridoperator;
|
||||
|
||||
import com.cm.common.annotation.CheckEmptyAnnotation;
|
||||
import com.cm.common.annotation.CheckNumberAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: EnterpriseOfGridOperatorVO
|
||||
* @Description: 网格员的企业
|
||||
@ -19,6 +20,8 @@ public class EnterpriseOfGridOperatorVO {
|
||||
private String userId;
|
||||
@ApiModelProperty(name = "enterpriseId", value = "企业ID")
|
||||
private String enterpriseId;
|
||||
@ApiModelProperty(name = "enterpriseIds", value = "企业ID列表")
|
||||
private List<String> enterpriseIds;
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId;
|
||||
@ -36,6 +39,14 @@ public class EnterpriseOfGridOperatorVO {
|
||||
this.enterpriseId = enterpriseId;
|
||||
}
|
||||
|
||||
public List<String> getEnterpriseIds() {
|
||||
return enterpriseIds == null ? new ArrayList() : enterpriseIds;
|
||||
}
|
||||
|
||||
public void setEnterpriseIds(List<String> enterpriseIds) {
|
||||
this.enterpriseIds = enterpriseIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
@ -43,6 +54,8 @@ public class EnterpriseOfGridOperatorVO {
|
||||
.append(userId).append('\"');
|
||||
sb.append(",\"enterpriseId\":\"")
|
||||
.append(enterpriseId).append('\"');
|
||||
sb.append(",\"enterpriseIds\":")
|
||||
.append(enterpriseIds);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.cm.inspection.service.action;
|
||||
|
||||
import com.cm.inspection.pojo.dtos.action.ActionPointDTO;
|
||||
import com.cm.inspection.pojo.vos.action.ActionPointVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: IActionService
|
||||
* @Description:
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/11/25 15:29
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IActionPointService {
|
||||
|
||||
void save(String token, ActionPointVO actionPointVO) throws Exception;
|
||||
|
||||
List<ActionPointDTO> list(String token, String startDate, String endDate);
|
||||
|
||||
List<ActionPointDTO> listByUserId(String userId, String startDate, String endDate);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.cm.inspection.service.action.impl;
|
||||
|
||||
import com.cm.common.token.app.AppTokenManager;
|
||||
import com.cm.common.token.app.entity.AppTokenUser;
|
||||
import com.cm.common.utils.DateUtil;
|
||||
import com.cm.common.utils.HashMapUtil;
|
||||
import com.cm.common.utils.UUIDUtil;
|
||||
import com.cm.inspection.dao.action.IActionPointDao;
|
||||
import com.cm.inspection.pojo.dtos.action.ActionPointDTO;
|
||||
import com.cm.inspection.pojo.vos.action.ActionPointVO;
|
||||
import com.cm.inspection.service.BaseService;
|
||||
import com.cm.inspection.service.action.IActionPointService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: ActionServiceImpl
|
||||
* @Description:
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/11/25 15:29
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class ActionPointServiceImpl extends BaseService implements IActionPointService {
|
||||
|
||||
@Autowired
|
||||
private IActionPointDao actionPointDao;
|
||||
|
||||
@Override
|
||||
public void save(String token, ActionPointVO actionPointVO) throws Exception {
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(actionPointVO);
|
||||
params.put("actionPointId", UUIDUtil.getUUID());
|
||||
params.put("gmtCreate", DateUtil.getTime());
|
||||
params.put("creator", appTokenUser.getId());
|
||||
params.put("creatorName", appTokenUser.getName());
|
||||
actionPointDao.save(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActionPointDTO> list(String token, String startDate, String endDate) {
|
||||
AppTokenUser appTokenUser = AppTokenManager.getInstance().getToken(token).getAppTokenUser();
|
||||
Map<String, Object> params = getHashMap(6);
|
||||
params.put("creator", appTokenUser.getId());
|
||||
params.put("startDate", startDate);
|
||||
params.put("endDate", endDate);
|
||||
return actionPointDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ActionPointDTO> listByUserId(String userId, String startDate, String endDate) {
|
||||
Map<String, Object> params = getHashMap(6);
|
||||
params.put("creator", userId);
|
||||
params.put("startDate", startDate);
|
||||
params.put("endDate", endDate);
|
||||
return actionPointDao.list(params);
|
||||
}
|
||||
}
|
@ -51,10 +51,12 @@ import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName: CheckServiceImpl
|
||||
@ -249,20 +251,90 @@ public class Check2ServiceImpl extends BaseService implements ICheck2Service {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Check2DTO> check2DTOs = check2Dao.list(params);
|
||||
// 原来是直接取值,慢
|
||||
// List<Check2DTO> check2DTOs = check2Dao.list(params);
|
||||
// 修改为逐步获取
|
||||
List<Check2PO> check2POS = check2Dao.listPO(params);
|
||||
List<Check2DTO> check2DTOs = listPO2DTO(check2POS);
|
||||
setUserInfo(check2DTOs);
|
||||
return check2DTOs;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<Check2DTO>> listPage(ListPage page) {
|
||||
if (page.getParams().get("reporter") != null) {
|
||||
String reporter = page.getParams().get("reporter").toString();
|
||||
if (!StringUtils.isBlank(reporter)) {
|
||||
List<String> userIds = listUserIdsByKeyword(reporter, userService);
|
||||
if (userIds.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
} else {
|
||||
page.getParams().put("creators", userIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<Check2DTO> check2DTOs = list(page.getParams());
|
||||
PageInfo<Check2DTO> pageInfo = new PageInfo<>(check2DTOs);
|
||||
List<Check2PO> check2POS = check2Dao.listPO(page.getParams());
|
||||
PageInfo<Check2PO> pageInfo = new PageInfo<>(check2POS);
|
||||
List<Check2DTO> check2DTOs = listPO2DTO(check2POS);
|
||||
setUserInfo(check2DTOs);
|
||||
return new SuccessResultList<>(check2DTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* PO转DTO
|
||||
*
|
||||
* @param check2POS
|
||||
* @return
|
||||
*/
|
||||
private List<Check2DTO> listPO2DTO(List<Check2PO> check2POS) {
|
||||
List<String> enterpriseIds = new ArrayList<>();
|
||||
List<Check2DTO> check2DTOS = check2POS.stream().map(check2PO -> {
|
||||
Check2DTO check2DTO = new Check2DTO();
|
||||
BeanUtils.copyProperties(check2PO, check2DTO);
|
||||
enterpriseIds.add(check2PO.getEnterpriseId());
|
||||
return check2DTO;
|
||||
}).collect(Collectors.toList());
|
||||
if (!enterpriseIds.isEmpty()) {
|
||||
List<EnterpriseDTO> enterpriseDTOS = enterpriseService.listEnterprise(enterpriseIds);
|
||||
check2DTOS.forEach(check2DTO -> {
|
||||
check2DTO.setEnterpriseName("企业不存在或已删除");
|
||||
for (EnterpriseDTO enterpriseDTO : enterpriseDTOS) {
|
||||
if (StringUtils.equals(enterpriseDTO.getEnterpriseId(), check2DTO.getEnterpriseId())) {
|
||||
check2DTO.setEnterpriseName(enterpriseDTO.getName());
|
||||
check2DTO.setEnterpriseType(enterpriseDTO.getType());
|
||||
check2DTO.setEnterpriseTypeName(enterpriseDTO.getTypeDictionaryName());
|
||||
check2DTO.setEnterpriseArea1(enterpriseDTO.getArea1());
|
||||
check2DTO.setEnterpriseArea1Name(enterpriseDTO.getArea1DictionaryName());
|
||||
check2DTO.setEnterpriseArea2(enterpriseDTO.getArea2());
|
||||
check2DTO.setEnterpriseArea2Name(enterpriseDTO.getArea2DictionaryName());
|
||||
check2DTO.setEnterpriseArea3(enterpriseDTO.getArea3());
|
||||
check2DTO.setEnterpriseArea3Name(enterpriseDTO.getArea3DictionaryName());
|
||||
check2DTO.setEnterpriseArea4(enterpriseDTO.getArea4());
|
||||
check2DTO.setEnterpriseArea4Name(enterpriseDTO.getArea4DictionaryName());
|
||||
check2DTO.setEnterpriseArea5(enterpriseDTO.getArea5());
|
||||
check2DTO.setEnterpriseArea5Name(enterpriseDTO.getArea5DictionaryName());
|
||||
check2DTO.setEnterpriseAddress(enterpriseDTO.getAddress());
|
||||
check2DTO.setEnterpriseIndustry(enterpriseDTO.getIndustry());
|
||||
check2DTO.setEnterpriseIndustryName(enterpriseDTO.getIndustryDictionaryName());
|
||||
check2DTO.setEnterpriseEngagedCount(enterpriseDTO.getEngagedCount() == null ? "0" : enterpriseDTO.getEngagedCount().toString());
|
||||
check2DTO.setEnterpriseRiskOperation(enterpriseDTO.getRiskOperation());
|
||||
check2DTO.setEnterpriseRiskOperationName(enterpriseDTO.getRiskOperationDictionaryName());
|
||||
check2DTO.setEnterpriseMaster(enterpriseDTO.getMaster());
|
||||
check2DTO.setEnterprisePhone(enterpriseDTO.getPhone());
|
||||
check2DTO.setEnterpriseLng(enterpriseDTO.getEnterpriseLng());
|
||||
check2DTO.setEnterpriseLat(enterpriseDTO.getEnterpriseLat());
|
||||
check2DTO.setEnterpriseFactoryGate(enterpriseDTO.getFactoryGate());
|
||||
check2DTO.setEnterpriseWorkplace(enterpriseDTO.getWorkplace());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return check2DTOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<Check2DTO>> listPageCheckOfMine(ListPage page) {
|
||||
return listPageCheckByUserId(securityComponent.getCurrentUser().getUserId(), page);
|
||||
|
@ -5,6 +5,7 @@ import com.cm.common.config.properties.ApiPathProperties;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
||||
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
|
||||
import com.cm.common.plugin.pojo.pos.datadictionary.DataDictionaryPO;
|
||||
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
|
||||
import com.cm.common.pojo.ListPage;
|
||||
import com.cm.common.result.SuccessResultData;
|
||||
@ -19,6 +20,7 @@ import com.cm.inspection.pojo.dtos.count.UserUseInfoDTO;
|
||||
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
|
||||
import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO;
|
||||
import com.cm.inspection.pojo.pos.count.IdCountPO;
|
||||
import com.cm.inspection.pojo.pos.gridpersonnel.GridPersonnelPO;
|
||||
import com.cm.inspection.service.BaseService;
|
||||
import com.cm.inspection.service.check.ICheckService;
|
||||
import com.cm.inspection.service.checkitem.ICheckItemService;
|
||||
@ -82,10 +84,10 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
areaId = StringUtils.isBlank(areaId) ? DEFAULT_AREA_ID : areaId;
|
||||
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId(areaId);
|
||||
LOG.debug("统计区域下的人员计划数量");
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
Map<String, Object> resultListMap = getHashMap(3);
|
||||
// 查找区域下的人员
|
||||
params.put("area" + areaLevel, areaDTO.getDictionaryId());
|
||||
@ -114,7 +116,6 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
areaId = StringUtils.isBlank(areaId) ? DEFAULT_AREA_ID : areaId;
|
||||
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId(areaId);
|
||||
LOG.debug("统计区域下的人员计划数量");
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
Map<String, Object> resultListMap = getHashMap(3);
|
||||
@ -146,25 +147,43 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId(areaId);
|
||||
LOG.debug("获取行业分类");
|
||||
List<DataDictionaryDTO> dataDictionaryDTOs = dataDictionaryService.listDictionaryByParentId("b97630ab-45b7-45bc-a624-507d4df952ff");
|
||||
Map<String, Object> params = getHashMap(5);
|
||||
params.put("isLogOff", 0);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
areaDTOs.parallelStream().forEach(areaDTO -> {
|
||||
Map<String, Object> params = getHashMap(5);
|
||||
params.put("isLogOff", 0);
|
||||
Map<String, Object> resultListMap = getHashMap(3);
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
params.put("area" + areaLevel, areaDTO.getDictionaryId());
|
||||
List<Map<String, Object>> industryTypeCountList = new ArrayList<>();
|
||||
for (DataDictionaryDTO dataDictionaryDTO : dataDictionaryDTOs) {
|
||||
dataDictionaryDTOs.parallelStream().forEach(dataDictionaryDTO -> {
|
||||
params.put("industryType", dataDictionaryDTO.getDictionaryId());
|
||||
Map<String, Object> industryTypeCountMap = getHashMap(3);
|
||||
industryTypeCountMap.put("areaName", dataDictionaryDTO.getDictionaryName());
|
||||
industryTypeCountMap.put("enterpriseCount", enterpriseService.countEnterpriseReturnInteger(params));
|
||||
industryTypeCountList.add(industryTypeCountMap);
|
||||
}
|
||||
});
|
||||
resultListMap.put("industryTypeCountList", industryTypeCountList);
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
});
|
||||
/**
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
Map<String, Object> resultListMap = getHashMap(3);
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
params.put("area" + areaLevel, areaDTO.getDictionaryId());
|
||||
List<Map<String, Object>> industryTypeCountList = new ArrayList<>();
|
||||
for (DataDictionaryDTO dataDictionaryDTO : dataDictionaryDTOs) {
|
||||
params.put("industryType", dataDictionaryDTO.getDictionaryId());
|
||||
Map<String, Object> industryTypeCountMap = getHashMap(3);
|
||||
industryTypeCountMap.put("areaName", dataDictionaryDTO.getDictionaryName());
|
||||
industryTypeCountMap.put("enterpriseCount", enterpriseService.countEnterpriseReturnInteger(params));
|
||||
industryTypeCountList.add(industryTypeCountMap);
|
||||
}
|
||||
resultListMap.put("industryTypeCountList", industryTypeCountList);
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
**/
|
||||
return new SuccessResultData<>(resultList);
|
||||
}
|
||||
|
||||
@ -174,8 +193,8 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
areaId = StringUtils.isBlank(areaId) ? DEFAULT_AREA_ID : areaId;
|
||||
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId(areaId);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
areaDTOs.parallelStream().forEach(areaDTO -> {
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
Map<String, Object> resultListMap = getHashMap(3);
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
@ -191,7 +210,26 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
resultListMap.put("enterpriseReceiveCount", enterpriseReceiveCount);
|
||||
resultListMap.put("enterpriseReceiveRatio", enterpriseCount == 0 ? 0 : String.format("%.2f", (double) enterpriseReceiveCount / enterpriseCount * 100));
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
});
|
||||
/**
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
Map<String, Object> resultListMap = getHashMap(3);
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
// 地区企业总数
|
||||
params.put("isLogOff", 0);
|
||||
params.put("area" + areaLevel, areaDTO.getDictionaryId());
|
||||
setParentArea(areaDTO.getDictionaryParentId(), areaLevel - 1, params);
|
||||
params.put("year", year);
|
||||
Integer enterpriseCount = enterpriseService.countEnterpriseReturnInteger(params);
|
||||
resultListMap.put("enterpriseCount", enterpriseCount);
|
||||
// 地区企业认领总数
|
||||
Integer enterpriseReceiveCount = countEnterpriseOfArea(areaDTO.getDictionaryId(), areaLevel, year);
|
||||
resultListMap.put("enterpriseReceiveCount", enterpriseReceiveCount);
|
||||
resultListMap.put("enterpriseReceiveRatio", enterpriseCount == 0 ? 0 : String.format("%.2f", (double) enterpriseReceiveCount / enterpriseCount * 100));
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
**/
|
||||
Map<String, Object> result = getHashMap(3);
|
||||
result.put("year", year);
|
||||
result.put("areaList", resultList);
|
||||
@ -204,11 +242,11 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
areaId = StringUtils.isBlank(areaId) ? DEFAULT_AREA_ID : areaId;
|
||||
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId(areaId);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
areaDTOs.parallelStream().forEach(areaDTO -> {
|
||||
Map<String, Object> resultListMap = getHashMap(16);
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
// 地区认领企业总数
|
||||
// 地区认领企业总数*
|
||||
Integer enterpriseReceiveCount = countEnterpriseOfArea(areaDTO.getDictionaryId(), areaLevel, year);
|
||||
resultListMap.put("enterpriseReceiveCount", enterpriseReceiveCount);
|
||||
// 网格员的Id列表
|
||||
@ -225,7 +263,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
resultListMap.put("rectificationRate", 0);
|
||||
resultListMap.put("countUnCoordination", 0);
|
||||
resultList.add(resultListMap);
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
// 年度计划数量
|
||||
Integer checkPlanCount = checkPlanService.countCheckPlanByUserIdsAndYear(userIdList, year);
|
||||
@ -234,7 +272,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
Integer checkCount = getCheckCountByYear(userIdList, year);
|
||||
resultListMap.put("checkCount", checkCount);
|
||||
resultListMap.put("completeRatio", checkPlanCount == null || checkPlanCount == 0 ? 0 : String.format("%.2f", (double) checkCount / checkPlanCount * 100));
|
||||
// 待复查企业
|
||||
// 待复查企业****
|
||||
List<String> listNeedReCheck = listNeedReCheckIds(userIdList);
|
||||
List<CheckDTO> checkDTOs = listNeedReCheck(listNeedReCheck, year);
|
||||
resultListMap.put("needReCheck", checkDTOs.size());
|
||||
@ -261,7 +299,67 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
Integer countUnCoordination = countUnCoordination(userIdList, year);
|
||||
resultListMap.put("countUnCoordination", countUnCoordination);
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
});
|
||||
/**
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
Map<String, Object> resultListMap = getHashMap(16);
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
// 地区认领企业总数
|
||||
Integer enterpriseReceiveCount = countEnterpriseOfArea(areaDTO.getDictionaryId(), areaLevel, year);
|
||||
resultListMap.put("enterpriseReceiveCount", enterpriseReceiveCount);
|
||||
// 网格员的Id列表
|
||||
List<String> userIdList = listGridPersonnelUserId(areaDTO.getDictionaryId(), areaLevel);
|
||||
if (userIdList.isEmpty()) {
|
||||
resultListMap.put("checkPlanCount", 0);
|
||||
resultListMap.put("checkCount", 0);
|
||||
resultListMap.put("completeRatio", 0);
|
||||
resultListMap.put("needReCheck", 0);
|
||||
resultListMap.put("countTimeoutCheck", 0);
|
||||
resultListMap.put("countCheckHiddenDanger", 0);
|
||||
resultListMap.put("countReCheckHiddenDanger", 0);
|
||||
resultListMap.put("countRectification", 0);
|
||||
resultListMap.put("rectificationRate", 0);
|
||||
resultListMap.put("countUnCoordination", 0);
|
||||
resultList.add(resultListMap);
|
||||
continue;
|
||||
}
|
||||
// 年度计划数量
|
||||
Integer checkPlanCount = checkPlanService.countCheckPlanByUserIdsAndYear(userIdList, year);
|
||||
resultListMap.put("checkPlanCount", checkPlanCount);
|
||||
// 实际检查企业统计
|
||||
Integer checkCount = getCheckCountByYear(userIdList, year);
|
||||
resultListMap.put("checkCount", checkCount);
|
||||
resultListMap.put("completeRatio", checkPlanCount == null || checkPlanCount == 0 ? 0 : String.format("%.2f", (double) checkCount / checkPlanCount * 100));
|
||||
// 待复查企业
|
||||
List<String> listNeedReCheck = listNeedReCheckIds(userIdList);
|
||||
List<CheckDTO> checkDTOs = listNeedReCheck(listNeedReCheck, year);
|
||||
resultListMap.put("needReCheck", checkDTOs.size());
|
||||
// 超期企业
|
||||
resultListMap.put("countTimeoutCheck", countTimeoutCheck(checkDTOs));
|
||||
// 获取隐患列表
|
||||
List<CheckItemOptionDTO> checkItemOptionDTOs = listCheckItemOptionDTO();
|
||||
// 企业检查隐患总数
|
||||
Integer countCheckHiddenDanger = countCheckHiddenDanger(checkItemOptionDTOs, userIdList, year);
|
||||
resultListMap.put("countCheckHiddenDanger", countCheckHiddenDanger);
|
||||
// 企业复查隐患总数
|
||||
Integer countReCheckHiddenDanger = countReCheckHiddenDanger(checkItemOptionDTOs, userIdList, year);
|
||||
// 需复查隐患数
|
||||
resultListMap.put("countReCheckHiddenDanger", countReCheckHiddenDanger);
|
||||
// 复查整改总数
|
||||
Integer countRectification = countCheckHiddenDanger - countReCheckHiddenDanger;
|
||||
resultListMap.put("countRectification", countRectification);
|
||||
// 立即整改(现场整改)数量
|
||||
Integer countImmediatelyRectification = countImmediatelyRectification(checkItemOptionDTOs, userIdList, year);
|
||||
resultListMap.put("countImmediatelyRectification", countImmediatelyRectification);
|
||||
// 整改率
|
||||
resultListMap.put("rectificationRate", countCheckHiddenDanger == null || countCheckHiddenDanger == 0 ? 0 : String.format("%.2f", (double) countRectification / countCheckHiddenDanger * 100));
|
||||
// 不配合次数(上报条数)
|
||||
Integer countUnCoordination = countUnCoordination(userIdList, year);
|
||||
resultListMap.put("countUnCoordination", countUnCoordination);
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
**/
|
||||
Map<String, Object> result = getHashMap(5);
|
||||
result.put("year", year);
|
||||
result.put("resultList", resultList);
|
||||
@ -308,7 +406,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
List<CheckItemOptionDTO> checkItemOptionDTOs = listCheckItemOptionDTO();
|
||||
// 检查结果
|
||||
List<Map<String, Object>> listCheckItemOptionArea = new ArrayList<>();
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
areaDTOs.parallelStream().forEach(areaDTO -> {
|
||||
Map<String, Object> areaMap = getHashMap(4);
|
||||
areaMap.put("areaId", areaDTO.getDictionaryId());
|
||||
areaMap.put("areaName", areaDTO.getDictionaryName());
|
||||
@ -318,22 +416,73 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
List<HiddenDangerReportDTO> listHiddenDangerReport = hiddenDangerReportService.listHiddenDangerReportSimpleByUserIdsYear(userIdList, year);
|
||||
// 遍历所有的检查项
|
||||
List<Map<String, Object>> listCheckItemOption = new ArrayList<>();
|
||||
/**
|
||||
checkItemOptionDTOs.parallelStream().forEach(checkItemOptionDTO -> {
|
||||
try {
|
||||
Map<String, Object> checkItemOptionMap = HashMapUtil.beanToMap(checkItemOptionDTO);
|
||||
int checkCount = 0;
|
||||
for (HiddenDangerReportDTO hiddenDangerReportDTO : listHiddenDangerReport) {
|
||||
// 检查项相同
|
||||
if (StringUtils.equals(checkItemOptionDTO.getCheckItemId(), hiddenDangerReportDTO.getCheckItemId()) &&
|
||||
StringUtils.equals(checkItemOptionDTO.getCheckItemOptionId(), hiddenDangerReportDTO.getCheckItemOptionId())) {
|
||||
checkCount++;
|
||||
}
|
||||
}
|
||||
checkItemOptionMap.put("checkCount", checkCount);
|
||||
listCheckItemOption.add(checkItemOptionMap);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
**/
|
||||
for (CheckItemOptionDTO checkItemOptionDTO : checkItemOptionDTOs) {
|
||||
Map<String, Object> checkItemOptionMap = HashMapUtil.beanToMap(checkItemOptionDTO);
|
||||
int checkCount = 0;
|
||||
for (HiddenDangerReportDTO hiddenDangerReportDTO : listHiddenDangerReport) {
|
||||
// 检查项相同
|
||||
if (StringUtils.equals(checkItemOptionDTO.getCheckItemId(), hiddenDangerReportDTO.getCheckItemId()) &&
|
||||
StringUtils.equals(checkItemOptionDTO.getCheckItemOptionId(), hiddenDangerReportDTO.getCheckItemOptionId())) {
|
||||
checkCount++;
|
||||
try {
|
||||
Map<String, Object> checkItemOptionMap = HashMapUtil.beanToMap(checkItemOptionDTO);
|
||||
int checkCount = 0;
|
||||
for (HiddenDangerReportDTO hiddenDangerReportDTO : listHiddenDangerReport) {
|
||||
// 检查项相同
|
||||
if (StringUtils.equals(checkItemOptionDTO.getCheckItemId(), hiddenDangerReportDTO.getCheckItemId()) &&
|
||||
StringUtils.equals(checkItemOptionDTO.getCheckItemOptionId(), hiddenDangerReportDTO.getCheckItemOptionId())) {
|
||||
checkCount++;
|
||||
}
|
||||
}
|
||||
checkItemOptionMap.put("checkCount", checkCount);
|
||||
listCheckItemOption.add(checkItemOptionMap);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
checkItemOptionMap.put("checkCount", checkCount);
|
||||
listCheckItemOption.add(checkItemOptionMap);
|
||||
}
|
||||
areaMap.put("listCheckItemOption", listCheckItemOption);
|
||||
listCheckItemOptionArea.add(areaMap);
|
||||
}
|
||||
});
|
||||
/**
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
Map<String, Object> areaMap = getHashMap(4);
|
||||
areaMap.put("areaId", areaDTO.getDictionaryId());
|
||||
areaMap.put("areaName", areaDTO.getDictionaryName());
|
||||
// 网格员的Id列表
|
||||
List<String> userIdList = listGridPersonnelUserId(areaDTO.getDictionaryId(), areaLevel);
|
||||
// 网格员的所有上报项
|
||||
List<HiddenDangerReportDTO> listHiddenDangerReport = hiddenDangerReportService.listHiddenDangerReportSimpleByUserIdsYear(userIdList, year);
|
||||
// 遍历所有的检查项
|
||||
List<Map<String, Object>> listCheckItemOption = new ArrayList<>();
|
||||
for (CheckItemOptionDTO checkItemOptionDTO : checkItemOptionDTOs) {
|
||||
Map<String, Object> checkItemOptionMap = HashMapUtil.beanToMap(checkItemOptionDTO);
|
||||
int checkCount = 0;
|
||||
for (HiddenDangerReportDTO hiddenDangerReportDTO : listHiddenDangerReport) {
|
||||
// 检查项相同
|
||||
if (StringUtils.equals(checkItemOptionDTO.getCheckItemId(), hiddenDangerReportDTO.getCheckItemId()) &&
|
||||
StringUtils.equals(checkItemOptionDTO.getCheckItemOptionId(), hiddenDangerReportDTO.getCheckItemOptionId())) {
|
||||
checkCount++;
|
||||
}
|
||||
}
|
||||
checkItemOptionMap.put("checkCount", checkCount);
|
||||
listCheckItemOption.add(checkItemOptionMap);
|
||||
}
|
||||
areaMap.put("listCheckItemOption", listCheckItemOption);
|
||||
listCheckItemOptionArea.add(areaMap);
|
||||
}
|
||||
**/
|
||||
// 封装结果
|
||||
// 构建检查项列表
|
||||
List<Map<String, Object>> checkItemList = buildCheckItem(checkItemDTOs);
|
||||
@ -356,9 +505,9 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
areaId = StringUtils.isBlank(areaId) ? DEFAULT_AREA_ID : areaId;
|
||||
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId(areaId);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
params.put("year", year);
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
areaDTOs.parallelStream().forEach(areaDTO -> {
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
params.put("year", year);
|
||||
Map<String, Object> resultListMap = getHashMap(4);
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
@ -369,7 +518,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
resultListMap.put("enterpriseCount", 0);
|
||||
resultListMap.put("coverage", 0);
|
||||
resultList.add(resultListMap);
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
params.put("userIdList", userIdList);
|
||||
// 统计检查多少家
|
||||
@ -384,7 +533,36 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
// 覆盖率
|
||||
resultListMap.put("coverage", enterpriseCount == 0 ? 0 : String.format("%.2f", (double) enterpriseCheckCount / enterpriseCount * 100));
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
});
|
||||
/**
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
Map<String, Object> resultListMap = getHashMap(4);
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
// 网格员的Id列表
|
||||
List<String> userIdList = listGridPersonnelUserId(areaDTO.getDictionaryId(), areaLevel);
|
||||
if (userIdList.isEmpty()) {
|
||||
resultListMap.put("enterpriseCheckCount", 0);
|
||||
resultListMap.put("enterpriseCount", 0);
|
||||
resultListMap.put("coverage", 0);
|
||||
resultList.add(resultListMap);
|
||||
continue;
|
||||
}
|
||||
params.put("userIdList", userIdList);
|
||||
// 统计检查多少家
|
||||
Integer enterpriseCheckCount = checkService.countEnterpriseCheck(params);
|
||||
resultListMap.put("enterpriseCheckCount", enterpriseCheckCount);
|
||||
// 统计地区有多少企业
|
||||
params.put("isLogOff", 0);
|
||||
params.put("area" + areaLevel, areaDTO.getDictionaryId());
|
||||
params.put("year", year);
|
||||
Integer enterpriseCount = enterpriseService.countEnterpriseReturnInteger(params);
|
||||
resultListMap.put("enterpriseCount", enterpriseCount);
|
||||
// 覆盖率
|
||||
resultListMap.put("coverage", enterpriseCount == 0 ? 0 : String.format("%.2f", (double) enterpriseCheckCount / enterpriseCount * 100));
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
**/
|
||||
Map<String, Object> result = getHashMap(4);
|
||||
result.put("year", year);
|
||||
result.put("resultList", resultList);
|
||||
@ -397,8 +575,8 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
areaId = StringUtils.isBlank(areaId) ? DEFAULT_AREA_ID : areaId;
|
||||
List<DataDictionaryDTO> areaDTOs = dataDictionaryService.listDictionaryByParentId(areaId);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
areaDTOs.parallelStream().forEach(areaDTO -> {
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
Map<String, Object> resultListMap = getHashMap(4);
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
@ -429,7 +607,41 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
}
|
||||
resultListMap.put("yearMonthList", yearMonthList);
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
});
|
||||
/**
|
||||
for (DataDictionaryDTO areaDTO : areaDTOs) {
|
||||
Map<String, Object> resultListMap = getHashMap(4);
|
||||
resultListMap.put("areaId", areaDTO.getDictionaryId());
|
||||
resultListMap.put("areaName", areaDTO.getDictionaryName());
|
||||
// 网格员的Id列表
|
||||
List<String> userIdList = listGridPersonnelUserId(areaDTO.getDictionaryId(), areaLevel);
|
||||
params.put("userIdList", userIdList);
|
||||
List<Map<String, Object>> yearMonthList = new ArrayList<>();
|
||||
for (int month = 1; month <= 12; month++) {
|
||||
Map<String, Object> yearMonthMap = getHashMap(3);
|
||||
yearMonthMap.put("month", month);
|
||||
if (userIdList.isEmpty()) {
|
||||
yearMonthMap.put("planCount", 0);
|
||||
yearMonthMap.put("enterpriseCheckCount", 0);
|
||||
yearMonthMap.put("completionRate", 0);
|
||||
yearMonthList.add(yearMonthMap);
|
||||
continue;
|
||||
}
|
||||
Integer planCount = checkPlanService.countCheckPlanByUserIdsAndYearMonth(userIdList, year, month);
|
||||
yearMonthMap.put("planCount", planCount);
|
||||
// 计划总数
|
||||
params.remove("month");
|
||||
params.put("yearMonth", String.format("%s-%02d", year, month));
|
||||
// 统计检查多少家
|
||||
Integer enterpriseCheckCount = checkService.countEnterpriseCheck(params);
|
||||
yearMonthMap.put("enterpriseCheckCount", enterpriseCheckCount);
|
||||
yearMonthMap.put("completionRate", planCount == 0 ? 0 : String.format("%.2f", (double) enterpriseCheckCount / planCount * 100));
|
||||
yearMonthList.add(yearMonthMap);
|
||||
}
|
||||
resultListMap.put("yearMonthList", yearMonthList);
|
||||
resultList.add(resultListMap);
|
||||
}
|
||||
**/
|
||||
Map<String, Object> result = getHashMap(4);
|
||||
result.put("year", year);
|
||||
result.put("resultList", resultList);
|
||||
@ -490,6 +702,25 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
List<IdCountPO> checkUserIdCountPOs = checkService.listUserIdCountPO(new ArrayList<>(userIdSet));
|
||||
// 认领企业数量
|
||||
List<IdCountPO> enterpriseUserIdCountPOs = enterpriseOfGridOperatorService.listUserIdCountPO(new ArrayList<>(userIdSet));
|
||||
userUseInfoDTOs.parallelStream().forEach(userUseInfoDTO -> {
|
||||
int checkCount = 0;
|
||||
int enterpriseCount = 0;
|
||||
for (IdCountPO checkUserIdCountPO : checkUserIdCountPOs) {
|
||||
if (StringUtils.equals(userUseInfoDTO.getUserId(), checkUserIdCountPO.getUserId())) {
|
||||
checkCount = checkUserIdCountPO.getTotal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (IdCountPO enterpriseUserIdCountPO : enterpriseUserIdCountPOs) {
|
||||
if (StringUtils.equals(userUseInfoDTO.getUserId(), enterpriseUserIdCountPO.getUserId())) {
|
||||
enterpriseCount = enterpriseUserIdCountPO.getTotal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
userUseInfoDTO.setCheckCount(checkCount);
|
||||
userUseInfoDTO.setEnterpriseCount(enterpriseCount);
|
||||
});
|
||||
/**
|
||||
for (UserUseInfoDTO userUseInfoDTO : userUseInfoDTOs) {
|
||||
int checkCount = 0;
|
||||
int enterpriseCount = 0;
|
||||
@ -508,6 +739,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
userUseInfoDTO.setCheckCount(checkCount);
|
||||
userUseInfoDTO.setEnterpriseCount(enterpriseCount);
|
||||
}
|
||||
**/
|
||||
return new SuccessResultList<>(userUseInfoDTOs, successResultList.getPage(), successResultList.getTotal());
|
||||
}
|
||||
|
||||
@ -821,7 +1053,7 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
*/
|
||||
private List<String> listNeedReCheckIds(List<String> userIdList) {
|
||||
List<String> checkIdList = new ArrayList<>();
|
||||
for (String userId : userIdList) {
|
||||
userIdList.parallelStream().forEach(userId -> {
|
||||
List<Task> tasks = processService.listTaskByAssignee(userId);
|
||||
LinkedHashSet<String> linkedHashSet = new LinkedHashSet<>();
|
||||
for (Task task : tasks) {
|
||||
@ -831,7 +1063,20 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
}
|
||||
}
|
||||
checkIdList.addAll(linkedHashSet);
|
||||
}
|
||||
});
|
||||
/**
|
||||
for (String userId : userIdList) {
|
||||
List<Task> tasks = processService.listTaskByAssignee(userId);
|
||||
LinkedHashSet<String> linkedHashSet = new LinkedHashSet<>();
|
||||
for (Task task : tasks) {
|
||||
Object isKeyObj = processService.getTaskVariableByTaskId(task.getId(), "isReport");
|
||||
if (isKeyObj != null && Integer.parseInt(isKeyObj.toString()) == 1) {
|
||||
linkedHashSet.add(processService.getTaskVariableByTaskId(task.getId(), "lastCheckId").toString());
|
||||
}
|
||||
}
|
||||
checkIdList.addAll(linkedHashSet);
|
||||
}
|
||||
**/
|
||||
return checkIdList;
|
||||
}
|
||||
|
||||
@ -878,9 +1123,9 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
Map<String, Object> params = getHashMap(3);
|
||||
List<String> userIdList = new ArrayList<>();
|
||||
params.put("area" + areaLevel, area3Id);
|
||||
List<GridPersonnelDTO> gridPersonnelDTOs = gridPersonnelService.list(params);
|
||||
for (GridPersonnelDTO gridPersonnelDTO : gridPersonnelDTOs) {
|
||||
userIdList.add(gridPersonnelDTO.getUserId().split("\\|")[0]);
|
||||
List<GridPersonnelPO> gridPersonnelPOS = gridPersonnelService.listPO(params);
|
||||
for (GridPersonnelPO gridPersonnelPO : gridPersonnelPOS) {
|
||||
userIdList.add(gridPersonnelPO.getUserId().split("\\|")[0]);
|
||||
}
|
||||
return userIdList;
|
||||
}
|
||||
@ -978,8 +1223,8 @@ public class CountServiceImpl extends BaseService implements ICountService {
|
||||
return;
|
||||
}
|
||||
params.put("area" + parentAreaLevel, parentAreaId);
|
||||
DataDictionaryDTO dataDictionaryDTO = dataDictionaryService.getDictionaryById(parentAreaId);
|
||||
setParentArea(dataDictionaryDTO.getDictionaryParentId(), parentAreaLevel - 1, params);
|
||||
DataDictionaryPO dataDictionaryPO = dataDictionaryService.getPOById(parentAreaId);
|
||||
setParentArea(dataDictionaryPO.getDictionaryParentId(), parentAreaLevel - 1, params);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -295,4 +295,8 @@ public interface IEnterpriseService {
|
||||
* @param classifyDictionaryName
|
||||
*/
|
||||
void updateClassify(List<String> enterpriseIds, String classify, String classifyDictionaryName);
|
||||
|
||||
List<EnterpriseDTO> listEnterprise(List<String> enterpriseIds);
|
||||
|
||||
List<EnterpriseDTO> listEnterpriseWithDelete(List<String> enterpriseIds);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.cm.inspection.service.enterprise.impl;
|
||||
|
||||
import com.cm.common.constants.ISystemConstant;
|
||||
import com.cm.common.exception.ParamsException;
|
||||
import com.cm.common.exception.RemoveException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
@ -493,16 +494,29 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
|
||||
List<DataDictionaryDTO> dataDictionaryDTOs = dataDictionaryService.listDictionaryByParentId("54c583df-6a6f-4a55-bcb3-2d6ace99b8ef");
|
||||
List<String> natureNameList = new ArrayList<>();
|
||||
List<Map<String, Object>> dataArray = new ArrayList<>();
|
||||
for (DataDictionaryDTO dataDictionaryDTO : dataDictionaryDTOs) {
|
||||
dataDictionaryDTOs.parallelStream().forEach(dataDictionaryDTO -> {
|
||||
natureNameList.add(dataDictionaryDTO.getDictionaryName());
|
||||
params.put("nature", dataDictionaryDTO.getDictionaryId());
|
||||
Integer countResult = enterpriseDao.countEnterprise(params);
|
||||
Map<String, Object> paramsMap = getHashMap(2);
|
||||
paramsMap.put("nature", dataDictionaryDTO.getDictionaryId());
|
||||
Integer countResult = enterpriseDao.countEnterprise(paramsMap);
|
||||
// 数据
|
||||
Map<String, Object> data = getHashMap(2);
|
||||
data.put("name", dataDictionaryDTO.getDictionaryName());
|
||||
data.put("value", countResult == null ? 0 : countResult);
|
||||
dataArray.add(data);
|
||||
}
|
||||
});
|
||||
/**
|
||||
for (DataDictionaryDTO dataDictionaryDTO : dataDictionaryDTOs) {
|
||||
natureNameList.add(dataDictionaryDTO.getDictionaryName());
|
||||
params.put("nature", dataDictionaryDTO.getDictionaryId());
|
||||
Integer countResult = enterpriseDao.countEnterprise(params);
|
||||
// 数据
|
||||
Map<String, Object> data = getHashMap(2);
|
||||
data.put("name", dataDictionaryDTO.getDictionaryName());
|
||||
data.put("value", countResult == null ? 0 : countResult);
|
||||
dataArray.add(data);
|
||||
}
|
||||
**/
|
||||
Map<String, Object> result = getHashMap(2);
|
||||
result.put("dataNames", natureNameList);
|
||||
result.put("datas", dataArray);
|
||||
@ -546,6 +560,21 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
|
||||
enterpriseDao.updateEnterpriseClassify(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnterpriseDTO> listEnterprise(List<String> enterpriseIds) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("enterpriseIds", enterpriseIds);
|
||||
return listEnterprise(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnterpriseDTO> listEnterpriseWithDelete(List<String> enterpriseIds) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("enterpriseIds", enterpriseIds);
|
||||
params.put("isDelete", ISystemConstant.IS_FALSE);
|
||||
return listEnterprise(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countEnterprisePollution(Map<String, Object> params) throws SearchException {
|
||||
return enterpriseDao.countEnterprisePollution(params);
|
||||
|
@ -269,4 +269,11 @@ public interface IEnterpriseOfGridOperatorService {
|
||||
* @return
|
||||
*/
|
||||
List<IdCountPO> listUserIdCountPO(List<String> userIds);
|
||||
|
||||
void saveEnterprisesOfGridOperator(String userId, List<String> enterpriseIds) throws Exception;
|
||||
|
||||
void deleteEnterprisesOfGridOperator(String userId, List<String> enterpriseIds);
|
||||
|
||||
List<EnterpriseOfGridOperatorDTO> listEnterpriseOfGridOperatorByUserId(String userId);
|
||||
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements
|
||||
// 判断企业已经绑定别人
|
||||
List<EnterpriseOfGridOperatorDTO> enterpriseOfGridOperatorDTOs = enterpriseOfGridOperatorDao.listEnterpriseOfGridOperatorByUserIdAndEnterpriseId(params);
|
||||
if (!enterpriseOfGridOperatorDTOs.isEmpty()) {
|
||||
throw new ParamsException("该企业已经被关联,不能重复关联");
|
||||
throw new ParamsException("企业已经被关联,不能重复关联");
|
||||
}
|
||||
params.put("enterpriseOfGridOperatorId", UUIDUtil.getUUID());
|
||||
if (token != null) {
|
||||
@ -322,6 +322,51 @@ public class EnterpriseOfGridOperatorServiceImpl extends BaseService implements
|
||||
return enterpriseOfGridOperatorDao.listUserIdCountPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveEnterprisesOfGridOperator(String userId, List<String> enterpriseIds) throws Exception {
|
||||
List<String> existEnterpriseIds = listEnterpriseIdByUserId(userId);
|
||||
for (String enterpriseId : enterpriseIds) {
|
||||
boolean isExist = false;
|
||||
for (String existEnterpriseId : existEnterpriseIds) {
|
||||
if (StringUtils.equals(enterpriseId, existEnterpriseId)) {
|
||||
isExist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isExist) {
|
||||
return;
|
||||
}
|
||||
EnterpriseOfGridOperatorVO enterpriseOfGridOperatorVO = new EnterpriseOfGridOperatorVO();
|
||||
enterpriseOfGridOperatorVO.setUserId(userId);
|
||||
enterpriseOfGridOperatorVO.setEnterpriseId(enterpriseId);
|
||||
saveEnterpriseOfGridOperator(enterpriseOfGridOperatorVO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteEnterprisesOfGridOperator(String userId, List<String> enterpriseIds) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("userId", userId);
|
||||
params.put("enterpriseIds", enterpriseIds);
|
||||
enterpriseOfGridOperatorDao.deleteEnterpriseOfGridOperator(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnterpriseOfGridOperatorDTO> listEnterpriseOfGridOperatorByUserId(String userId) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("userId", userId);
|
||||
GridPersonnelDTO gridPersonnelDTO = gridPersonnelService.getGridPersonnelByUserId(userId);
|
||||
if (gridPersonnelDTO == null) {
|
||||
throw new SearchException("");
|
||||
}
|
||||
params.put("area1", gridPersonnelDTO.getArea1());
|
||||
params.put("area2", gridPersonnelDTO.getArea2());
|
||||
params.put("area3", gridPersonnelDTO.getArea3());
|
||||
params.put("area4", gridPersonnelDTO.getArea4());
|
||||
params.put("area5", gridPersonnelDTO.getArea5());
|
||||
return enterpriseOfGridOperatorDao.listEnterpriseOfGridOperatorByUserId(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化未认领地区
|
||||
*
|
||||
|
@ -111,6 +111,14 @@ public interface IGridPersonnelService {
|
||||
*/
|
||||
List<GridPersonnelDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 网格人员列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<GridPersonnelPO> listPO(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 网格人员分页列表
|
||||
*
|
||||
@ -226,4 +234,5 @@ public interface IGridPersonnelService {
|
||||
* @return
|
||||
*/
|
||||
GridPersonnelDTO getSelf();
|
||||
|
||||
}
|
@ -255,6 +255,11 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson
|
||||
return gridPersonnelDTOs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GridPersonnelPO> listPO(Map<String, Object> params) {
|
||||
return gridPersonnelDao.listPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<GridPersonnelDTO>> listPage(ListPage page) throws SearchException, UnsupportedEncodingException {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
|
@ -82,7 +82,8 @@ file:
|
||||
# 安全
|
||||
security:
|
||||
oauth2:
|
||||
oauth-server: http://192.168.0.103:7001/usercenter
|
||||
# oauth-server: http://192.168.2.103:7011/usercenter
|
||||
oauth-server: http://49.233.36.36:58091/usercenter
|
||||
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
|
||||
client:
|
||||
client-id: 32ec344a5fd04fd9911586df5d1dc36b
|
||||
|
@ -0,0 +1,50 @@
|
||||
<?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.cm.inspection.dao.action.IActionPointDao">
|
||||
|
||||
<resultMap id="actionPointDTO" type="com.cm.inspection.pojo.dtos.action.ActionPointDTO">
|
||||
<id column="action_point_id" property="actionPointId"/>
|
||||
<result column="lng" property="lng"/>
|
||||
<result column="lat" property="lat"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="creator_name" property="creatorName"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO ac_action_point(
|
||||
action_point_id,
|
||||
lng,
|
||||
lat,
|
||||
gmt_create,
|
||||
creator,
|
||||
creator_name
|
||||
) VALUES(
|
||||
#{actionPointId},
|
||||
#{lng},
|
||||
#{lat},
|
||||
#{gmtCreate},
|
||||
#{creator},
|
||||
#{creatorName}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="list" parameterType="map" resultMap="actionPointDTO">
|
||||
SELECT
|
||||
action_point_id,
|
||||
lng,
|
||||
lat,
|
||||
gmt_create,
|
||||
creator,
|
||||
creator_name
|
||||
FROM
|
||||
ac_action_point
|
||||
WHERE
|
||||
creator = #{creator}
|
||||
AND
|
||||
gmt_create <![CDATA[ >= ]]> #{startDate}
|
||||
AND
|
||||
gmt_create <![CDATA[ <= ]]> #{endDate}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -379,6 +379,121 @@
|
||||
t1.gmt_create DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查表列表 -->
|
||||
<select id="listPO" parameterType="map" resultMap="check2PO" useCache="true">
|
||||
SELECT
|
||||
t1.check_id,
|
||||
t1.process_instance_id,
|
||||
t1.enterprise_id,
|
||||
t1.task_check_id,
|
||||
t1.is_coordination,
|
||||
t1.rectification_type,
|
||||
t1.immediately_change_type,
|
||||
t1.rectification_days,
|
||||
t1.summary,
|
||||
t1.is_complete,
|
||||
t1.check_type,
|
||||
t1.check_lng,
|
||||
t1.check_lat,
|
||||
t1.creator,
|
||||
t1.gmt_create,
|
||||
t1.modifier,
|
||||
t1.gmt_modified,
|
||||
t1.is_delete
|
||||
FROM
|
||||
gen_check t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="(keywords != null and keywords != '') or (area1 != null and area1 != '') or (area2 != null and area2 != '') or (area3 != null and area3 != '') or (area4 != null and area4 != '') or (area5 != null and area5 != '') or (type != null and type != '') or (industry != null and industry != '')">
|
||||
AND
|
||||
t1.enterprise_id IN (
|
||||
SELECT
|
||||
enterprise_id
|
||||
FROM
|
||||
gen_enterprise
|
||||
WHERE
|
||||
is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND
|
||||
name LIKE CONCAT('%', #{keywords}, '%')
|
||||
</if>
|
||||
<if test="area1 != null and area1 != ''">
|
||||
AND
|
||||
area1 = #{area1}
|
||||
</if>
|
||||
<if test="area2 != null and area2 != ''">
|
||||
AND
|
||||
area2 = #{area2}
|
||||
</if>
|
||||
<if test="area3 != null and area3 != ''">
|
||||
AND
|
||||
area3 = #{area3}
|
||||
</if>
|
||||
<if test="area4 != null and area4 != ''">
|
||||
AND
|
||||
area4 = #{area4}
|
||||
</if>
|
||||
<if test="area5 != null and area5 != ''">
|
||||
AND
|
||||
area5 = #{area5}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND
|
||||
type = #{type}
|
||||
</if>
|
||||
<if test="industry != null and industry != ''">
|
||||
AND
|
||||
industry = #{industry}
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
<if test="checkType != null and checkType != ''">
|
||||
AND
|
||||
t1.check_type = #{checkType}
|
||||
</if>
|
||||
<if test="isCoordination != null and isCoordination != ''">
|
||||
AND
|
||||
t1.is_coordination = #{isCoordination}
|
||||
</if>
|
||||
<if test="isComplete != null and isComplete != ''">
|
||||
AND
|
||||
t1.is_complete = #{isComplete}
|
||||
</if>
|
||||
<if test="checkIds != null and checkIds.size > 0">
|
||||
AND
|
||||
t1.check_id IN
|
||||
<foreach collection="checkIds" index="index" open="(" separator="," close=")">
|
||||
#{checkIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND
|
||||
t1.creator = #{creator}
|
||||
</if>
|
||||
<if test="creators != null and creators.size > 0">
|
||||
AND
|
||||
t1.creator IN
|
||||
<foreach collection="creators" index="index" open="(" separator="," close=")">
|
||||
#{creators[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="checkMonth != null">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 7) = #{checkMonth}
|
||||
</if>
|
||||
ORDER BY
|
||||
t1.gmt_create DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 统计检查 -->
|
||||
<select id="countCheck" parameterType="map" resultType="java.lang.Integer" useCache="true">
|
||||
SELECT
|
||||
@ -674,33 +789,6 @@
|
||||
DATE_FORMAT( gmt_create, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
|
||||
</select>
|
||||
|
||||
<!-- 检查列表 -->
|
||||
<select id="listPO" parameterType="map" resultMap="check2PO">
|
||||
SELECT
|
||||
check_id,
|
||||
process_instance_id,
|
||||
enterprise_id,
|
||||
task_check_id,
|
||||
is_coordination,
|
||||
rectification_type,
|
||||
immediately_change_type,
|
||||
rectification_days,
|
||||
summary,
|
||||
is_complete,
|
||||
check_type,
|
||||
check_lng,
|
||||
check_lat,
|
||||
creator,
|
||||
gmt_create,
|
||||
modifier,
|
||||
gmt_modified,
|
||||
is_delete
|
||||
FROM
|
||||
gen_check
|
||||
WHERE
|
||||
is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 更新流程实例 -->
|
||||
<update id="updateProcessInstanceId" parameterType="map">
|
||||
UPDATE
|
||||
|
@ -630,8 +630,11 @@
|
||||
t1.enterprise_id
|
||||
FROM
|
||||
gen_enterprise t1
|
||||
WHERE
|
||||
<where>
|
||||
<if test="isDelete == null or isDelete == 'true'">
|
||||
AND
|
||||
t1.is_delete = 0
|
||||
</if>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND
|
||||
t1.name LIKE CONCAT('%', #{keywords}, '%')
|
||||
@ -679,6 +682,7 @@
|
||||
#{enterpriseIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 统计企业 -->
|
||||
|
@ -38,6 +38,8 @@
|
||||
<result column="nature_by_enterprise_id" property="natureJoinByEnterpriseId"/>
|
||||
<result column="nature_dictionary_name" property="natureDictionaryName"/>
|
||||
<result column="is_log_off_by_enterprise_id" property="isLogOffByEnterpriseId"/>
|
||||
<result column="enterprise_lng" property="lng"/>
|
||||
<result column="enterprise_lat" property="lat"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="gridPersonnelDTO" type="com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO">
|
||||
@ -85,10 +87,12 @@
|
||||
modifier = #{modifier},
|
||||
gmt_modified = #{gmtModified}
|
||||
WHERE
|
||||
<if test="enterpriseOfGridOperatorIds != null and enterpriseOfGridOperatorIds.size > 0">
|
||||
enterprise_of_grid_operator_id IN
|
||||
<foreach collection="enterpriseOfGridOperatorIds" index="index" open="(" separator="," close=")">
|
||||
<foreach collection="enterpriseOfGridOperatorIds" index="index" open="(" separator="," close=")">
|
||||
#{enterpriseOfGridOperatorIds[${index}]}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<!-- 删除网格员的企业(物理删除) -->
|
||||
@ -107,6 +111,14 @@
|
||||
AND
|
||||
user_id = #{userId}
|
||||
</if>
|
||||
<if test="userId != null and userId != '' and enterpriseIds != null and enterpriseIds.size > 0">
|
||||
user_id = #{userId}
|
||||
AND
|
||||
enterprise_id IN
|
||||
<foreach collection="enterpriseIds" index="index" open="(" separator="," close=")">
|
||||
#{enterpriseIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 修改网格员的企业 -->
|
||||
@ -263,6 +275,8 @@
|
||||
t1.classify_dictionary_name,
|
||||
t1.nature nature_by_enterprise_id,
|
||||
t1.nature_dictionary_name,
|
||||
t1.enterprise_lng,
|
||||
t1.enterprise_lat,
|
||||
t1.is_log_off is_log_off_by_enterprise_id,
|
||||
(
|
||||
SELECT
|
||||
|
@ -311,6 +311,96 @@
|
||||
t1.level ASC
|
||||
</select>
|
||||
|
||||
<!-- 网格人员列表 -->
|
||||
<select id="listPO" parameterType="map" resultMap="gridPersonnelPO" useCache="true">
|
||||
SELECT
|
||||
t1.user_id,
|
||||
t1.area1,
|
||||
t1.area2,
|
||||
t1.area3,
|
||||
t1.area4,
|
||||
t1.area5,
|
||||
t1.leader_user_id,
|
||||
t1.person_type,
|
||||
t1.grid_type,
|
||||
t1.is_grid_operator,
|
||||
t1.level,
|
||||
t1.grid_personnel_id
|
||||
FROM
|
||||
gen_grid_personnel t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
<if test="gridPersonnelIds != null and gridPersonnelIds.size > 0">
|
||||
AND
|
||||
t1.grid_personnel_id IN
|
||||
<foreach collection="gridPersonnelIds" index="index" open="(" separator="," close=")">
|
||||
#{gridPersonnelIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
t1.user_id = #{userId}
|
||||
</if>
|
||||
<if test="personType != null and personType != ''">
|
||||
AND
|
||||
t1.person_type = #{personType}
|
||||
</if>
|
||||
<if test="isGridOperator != null">
|
||||
AND
|
||||
t1.is_grid_operator = #{isGridOperator}
|
||||
</if>
|
||||
<if test="leaderUserId != null and leaderUserId != ''">
|
||||
AND
|
||||
t1.leader_user_id = #{leaderUserId}
|
||||
</if>
|
||||
<if test="userIds != null and userIds.size > 0">
|
||||
AND
|
||||
<foreach collection="userIds" index="index" open="(" separator="OR" close=")">
|
||||
t1.user_id = #{userIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="groupUserIds != null and groupUserIds.size > 0">
|
||||
AND
|
||||
<foreach collection="groupUserIds" index="index" open="(" separator="OR" close=")">
|
||||
t1.user_id = #{groupUserIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="level != null">
|
||||
AND
|
||||
t1.level = #{level}
|
||||
</if>
|
||||
<if test="area1 != null and area1 != ''">
|
||||
AND
|
||||
t1.area1 = #{area1}
|
||||
</if>
|
||||
<if test="area2 != null and area2 != ''">
|
||||
AND
|
||||
t1.area2 = #{area2}
|
||||
</if>
|
||||
<if test="area3 != null and area3 != ''">
|
||||
AND
|
||||
t1.area3 = #{area3}
|
||||
</if>
|
||||
<if test="area4 != null and area4 != ''">
|
||||
AND
|
||||
t1.area4 = #{area4}
|
||||
</if>
|
||||
<if test="area5 != null and area5 != ''">
|
||||
AND
|
||||
t1.area5 = #{area5}
|
||||
</if>
|
||||
ORDER BY
|
||||
t1.level ASC
|
||||
</select>
|
||||
|
||||
<!-- 统计网格员 -->
|
||||
<select id="countGridPersonnel" parameterType="map" resultType="java.lang.Integer" useCache="true">
|
||||
SELECT
|
||||
|
BIN
src/main/resources/static/assets/images/run-point.png
Normal file
BIN
src/main/resources/static/assets/images/run-point.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
src/main/resources/static/assets/images/run.png
Normal file
BIN
src/main/resources/static/assets/images/run.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
596
src/main/resources/static/assets/js/BaiduMapGeoUtils.js
Normal file
596
src/main/resources/static/assets/js/BaiduMapGeoUtils.js
Normal file
@ -0,0 +1,596 @@
|
||||
/**
|
||||
* @fileoverview GeoUtils类提供若干几何算法,用来帮助用户判断点与矩形、
|
||||
* 圆形、多边形线、多边形面的关系,并提供计算折线长度和多边形的面积的公式。
|
||||
* 主入口类是<a href="symbols/BMapGLLib.GeoUtils.html">GeoUtils</a>,
|
||||
* 基于Baidu Map API GL 1.0。
|
||||
*
|
||||
* @author Baidu Map Api Group
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace BMapGL的所有library类均放在BMapGLLib命名空间下
|
||||
*/
|
||||
var BMapGLLib = (window.BMapGLLib = BMapGLLib || {});
|
||||
(function () {
|
||||
/**
|
||||
* 地球半径
|
||||
*/
|
||||
var EARTHRADIUS = 6370996.81;
|
||||
|
||||
/**
|
||||
* @exports GeoUtils as BMapGLLib.GeoUtils
|
||||
*/
|
||||
var GeoUtils =
|
||||
/**
|
||||
* GeoUtils类,静态类,勿需实例化即可使用
|
||||
* @class GeoUtils类的<b>入口</b>。
|
||||
* 该类提供的都是静态方法,勿需实例化即可使用。
|
||||
*/
|
||||
(BMapGLLib.GeoUtils = function () {});
|
||||
|
||||
/**
|
||||
* 判断点是否在矩形内
|
||||
* @param {Point} point 点对象
|
||||
* @param {Bounds} bounds 矩形边界对象
|
||||
* @returns {Boolean} 点在矩形内返回true,否则返回false
|
||||
*/
|
||||
GeoUtils.isPointInRect = function (point, bounds) {
|
||||
//检查类型是否正确
|
||||
if (
|
||||
!(point.toString() === "Point" || point.toString() === "LatLng") ||
|
||||
!(bounds instanceof BMapGL.Bounds)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
var sw = bounds.getSouthWest(); //西南脚点
|
||||
var ne = bounds.getNorthEast(); //东北脚点
|
||||
return (
|
||||
point.lng >= sw.lng &&
|
||||
point.lng <= ne.lng &&
|
||||
point.lat >= sw.lat &&
|
||||
point.lat <= ne.lat
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断点是否在圆形内
|
||||
* @param {Point} point 点对象
|
||||
* @param {Circle} circle 圆形对象
|
||||
* @returns {Boolean} 点在圆形内返回true,否则返回false
|
||||
*/
|
||||
GeoUtils.isPointInCircle = function (point, circle) {
|
||||
//检查类型是否正确
|
||||
if (
|
||||
!(point.toString() === "Point" || point.toString() === "LatLng") ||
|
||||
!(circle instanceof BMapGL.Circle)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//point与圆心距离小于圆形半径,则点在圆内,否则在圆外
|
||||
var c = circle.getCenter();
|
||||
var r = circle.getRadius();
|
||||
|
||||
var dis = GeoUtils.getDistance(point, c);
|
||||
if (dis <= r) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断点是否在折线上
|
||||
* @param {Point} point 点对象
|
||||
* @param {Polyline} polyline 折线对象
|
||||
* @returns {Boolean} 点在折线上返回true,否则返回false
|
||||
*/
|
||||
GeoUtils.isPointOnPolyline = function (point, polyline) {
|
||||
//检查类型
|
||||
if (
|
||||
!(point.toString() === "Point" || point.toString() === "LatLng") ||
|
||||
!(polyline instanceof BMapGL.Polyline)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//首先判断点是否在线的外包矩形内,如果在,则进一步判断,否则返回false
|
||||
var lineBounds = polyline.getBounds();
|
||||
if (!this.isPointInRect(point, lineBounds)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//判断点是否在线段上,设点为Q,线段为P1P2 ,
|
||||
//判断点Q在该线段上的依据是:( Q - P1 ) × ( P2 - P1 ) = 0,且 Q 在以 P1,P2为对角顶点的矩形内
|
||||
var pts = polyline.getPath();
|
||||
for (var i = 0; i < pts.length - 1; i++) {
|
||||
var curPt = pts[i];
|
||||
var nextPt = pts[i + 1];
|
||||
//首先判断point是否在curPt和nextPt之间,即:此判断该点是否在该线段的外包矩形内
|
||||
if (
|
||||
point.lng >= Math.min(curPt.lng, nextPt.lng) &&
|
||||
point.lng <= Math.max(curPt.lng, nextPt.lng) &&
|
||||
point.lat >= Math.min(curPt.lat, nextPt.lat) &&
|
||||
point.lat <= Math.max(curPt.lat, nextPt.lat)
|
||||
) {
|
||||
//判断点是否在直线上公式
|
||||
var precision =
|
||||
(curPt.lng - point.lng) * (nextPt.lat - point.lat) -
|
||||
(nextPt.lng - point.lng) * (curPt.lat - point.lat);
|
||||
if (precision < 2e-9 && precision > -2e-9) {
|
||||
//实质判断是否接近0
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断点是否多边形内
|
||||
* @param {Point} point 点对象
|
||||
* @param {Polyline} polygon 多边形对象
|
||||
* @returns {Boolean} 点在多边形内返回true,否则返回false
|
||||
*/
|
||||
GeoUtils.isPointInPolygon = function (point, polygon) {
|
||||
//检查类型
|
||||
if (
|
||||
!(point.toString() === "Point" || point.toString() === "LatLng") ||
|
||||
!(polygon instanceof BMapGL.Polygon)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//首先判断点是否在多边形的外包矩形内,如果在,则进一步判断,否则返回false
|
||||
var polygonBounds = polygon.getBounds();
|
||||
if (!this.isPointInRect(point, polygonBounds)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var pts = polygon.getPath(); //获取多边形点
|
||||
|
||||
//下述代码来源:http://paulbourke.net/geometry/insidepoly/,进行了部分修改
|
||||
//基本思想是利用射线法,计算射线与多边形各边的交点,如果是偶数,则点在多边形外,否则
|
||||
//在多边形内。还会考虑一些特殊情况,如点在多边形顶点上,点在多边形边上等特殊情况。
|
||||
|
||||
var N = pts.length;
|
||||
var boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
|
||||
var intersectCount = 0; //cross points count of x
|
||||
var precision = 2e-10; //浮点类型计算时候与0比较时候的容差
|
||||
var p1, p2; //neighbour bound vertices
|
||||
var p = point; //测试点
|
||||
|
||||
p1 = pts[0]; //left vertex
|
||||
for (var i = 1; i <= N; ++i) {
|
||||
//check all rays
|
||||
if (p.equals(p1)) {
|
||||
return boundOrVertex; //p is an vertex
|
||||
}
|
||||
|
||||
p2 = pts[i % N]; //right vertex
|
||||
if (
|
||||
p.lat < Math.min(p1.lat, p2.lat) ||
|
||||
p.lat > Math.max(p1.lat, p2.lat)
|
||||
) {
|
||||
//ray is outside of our interests
|
||||
p1 = p2;
|
||||
continue; //next ray left point
|
||||
}
|
||||
|
||||
if (
|
||||
p.lat > Math.min(p1.lat, p2.lat) &&
|
||||
p.lat < Math.max(p1.lat, p2.lat)
|
||||
) {
|
||||
//ray is crossing over by the algorithm (common part of)
|
||||
if (p.lng <= Math.max(p1.lng, p2.lng)) {
|
||||
//x is before of ray
|
||||
if (p1.lat == p2.lat && p.lng >= Math.min(p1.lng, p2.lng)) {
|
||||
//overlies on a horizontal ray
|
||||
return boundOrVertex;
|
||||
}
|
||||
|
||||
if (p1.lng == p2.lng) {
|
||||
//ray is vertical
|
||||
if (p1.lng == p.lng) {
|
||||
//overlies on a vertical ray
|
||||
return boundOrVertex;
|
||||
} else {
|
||||
//before ray
|
||||
++intersectCount;
|
||||
}
|
||||
} else {
|
||||
//cross point on the left side
|
||||
var xinters =
|
||||
((p.lat - p1.lat) * (p2.lng - p1.lng)) /
|
||||
(p2.lat - p1.lat) +
|
||||
p1.lng; //cross point of lng
|
||||
if (Math.abs(p.lng - xinters) < precision) {
|
||||
//overlies on a ray
|
||||
return boundOrVertex;
|
||||
}
|
||||
|
||||
if (p.lng < xinters) {
|
||||
//before ray
|
||||
++intersectCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//special case when ray is crossing through the vertex
|
||||
if (p.lat == p2.lat && p.lng <= p2.lng) {
|
||||
//p crossing over p2
|
||||
var p3 = pts[(i + 1) % N]; //next vertex
|
||||
if (
|
||||
p.lat >= Math.min(p1.lat, p3.lat) &&
|
||||
p.lat <= Math.max(p1.lat, p3.lat)
|
||||
) {
|
||||
//p.lat lies between p1.lat & p3.lat
|
||||
++intersectCount;
|
||||
} else {
|
||||
intersectCount += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
p1 = p2; //next ray left point
|
||||
}
|
||||
|
||||
if (intersectCount % 2 == 0) {
|
||||
//偶数在多边形外
|
||||
return false;
|
||||
} else {
|
||||
//奇数在多边形内
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 将度转化为弧度
|
||||
* @param {degree} Number 度
|
||||
* @returns {Number} 弧度
|
||||
*/
|
||||
GeoUtils.degreeToRad = function (degree) {
|
||||
return (Math.PI * degree) / 180;
|
||||
};
|
||||
|
||||
/**
|
||||
* 将弧度转化为度
|
||||
* @param {radian} Number 弧度
|
||||
* @returns {Number} 度
|
||||
*/
|
||||
GeoUtils.radToDegree = function (rad) {
|
||||
return (180 * rad) / Math.PI;
|
||||
};
|
||||
|
||||
/**
|
||||
* 将v值限定在a,b之间,纬度使用
|
||||
*/
|
||||
function _getRange(v, a, b) {
|
||||
if (a != null) {
|
||||
v = Math.max(v, a);
|
||||
}
|
||||
if (b != null) {
|
||||
v = Math.min(v, b);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将v值限定在a,b之间,经度使用
|
||||
*/
|
||||
function _getLoop(v, a, b) {
|
||||
while (v > b) {
|
||||
v -= b - a;
|
||||
}
|
||||
while (v < a) {
|
||||
v += b - a;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两点之间的距离,两点坐标必须为经纬度
|
||||
* @param {point1} Point 点对象
|
||||
* @param {point2} Point 点对象
|
||||
* @returns {Number} 两点之间距离,单位为米
|
||||
*/
|
||||
GeoUtils.getDistance = function (point1, point2) {
|
||||
//判断类型
|
||||
if (
|
||||
!(
|
||||
point1.toString() === "Point" ||
|
||||
point1.toString() === "LatLng" ||
|
||||
point2.toString() === "Point" ||
|
||||
point2.toString() === "LatLng"
|
||||
)
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
point1.lng = _getLoop(point1.lng, -180, 180);
|
||||
point1.lat = _getRange(point1.lat, -74, 74);
|
||||
point2.lng = _getLoop(point2.lng, -180, 180);
|
||||
point2.lat = _getRange(point2.lat, -74, 74);
|
||||
|
||||
var x1, x2, y1, y2;
|
||||
x1 = GeoUtils.degreeToRad(point1.lng);
|
||||
y1 = GeoUtils.degreeToRad(point1.lat);
|
||||
x2 = GeoUtils.degreeToRad(point2.lng);
|
||||
y2 = GeoUtils.degreeToRad(point2.lat);
|
||||
return (
|
||||
EARTHRADIUS *
|
||||
Math.acos(
|
||||
Math.sin(y1) * Math.sin(y2) +
|
||||
Math.cos(y1) * Math.cos(y2) * Math.cos(x2 - x1)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
GeoUtils.getCenterPoint = function(point1, point2) {
|
||||
var lng1 = parseFloat(point1.lng);
|
||||
var lat1 = parseFloat(point1.lat);
|
||||
|
||||
var lng2 = parseFloat(point2.lng);
|
||||
var lat2 = parseFloat(point2.lat);
|
||||
|
||||
var lngca = (Math.max(lng1,lng2)-Math.min(lng1,lng2))/2;
|
||||
var latca = (Math.max(lat1,lat2)-Math.min(lat1,lat2))/2;
|
||||
|
||||
var lngcenter = Math.min(lng1,lng2)+lngca;
|
||||
var latcenter = Math.min(lat1,lat2)+latca;
|
||||
|
||||
var pointcenter = new BMapGL.Point(lngcenter,latcenter);
|
||||
return pointcenter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算折线或者点数组的长度
|
||||
* @param {Polyline|Array<Point>} polyline 折线对象或者点数组
|
||||
* @returns {Number} 折线或点数组对应的长度
|
||||
*/
|
||||
GeoUtils.getPolylineDistance = function (polyline) {
|
||||
//检查类型
|
||||
if (polyline instanceof BMapGL.Polyline || polyline instanceof Array) {
|
||||
//将polyline统一为数组
|
||||
var pts;
|
||||
if (polyline instanceof BMapGL.Polyline) {
|
||||
pts = polyline.getPath();
|
||||
} else {
|
||||
pts = polyline;
|
||||
}
|
||||
if (pts.length < 2) {
|
||||
//小于2个点,返回0
|
||||
return 0;
|
||||
}
|
||||
//遍历所有线段将其相加,计算整条线段的长度
|
||||
var totalDis = 0;
|
||||
for (var i = 0; i < pts.length - 1; i++) {
|
||||
var curPt = pts[i];
|
||||
var nextPt = pts[i + 1];
|
||||
var dis = GeoUtils.getDistance(curPt, nextPt);
|
||||
totalDis += dis;
|
||||
}
|
||||
return totalDis;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 计算多边形面或点数组构建图形的面积,注意:坐标类型只能是经纬度,且不适合计算自相交多边形的面积
|
||||
* @param {Polygon|Array<Point>} polygon 多边形面对象或者点数组
|
||||
* @returns {Number} 多边形面或点数组构成图形的面积
|
||||
*/
|
||||
GeoUtils.getPolygonArea = function (polygon) {
|
||||
//检查类型
|
||||
if (
|
||||
!(polygon instanceof BMapGL.Polygon) &&
|
||||
!(polygon instanceof Array)
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
var pts;
|
||||
if (polygon instanceof BMapGL.Polygon) {
|
||||
pts = polygon.getPath();
|
||||
} else {
|
||||
pts = polygon;
|
||||
}
|
||||
|
||||
if (pts[0].equals(pts[pts.length - 1])) {
|
||||
pts.pop();
|
||||
}
|
||||
if (pts.length < 3) {
|
||||
//小于3个顶点,不能构建面
|
||||
return 0;
|
||||
}
|
||||
|
||||
var totalArea = 0; //初始化总面积
|
||||
var LowX = 0.0;
|
||||
var LowY = 0.0;
|
||||
var MiddleX = 0.0;
|
||||
var MiddleY = 0.0;
|
||||
var HighX = 0.0;
|
||||
var HighY = 0.0;
|
||||
var AM = 0.0;
|
||||
var BM = 0.0;
|
||||
var CM = 0.0;
|
||||
var AL = 0.0;
|
||||
var BL = 0.0;
|
||||
var CL = 0.0;
|
||||
var AH = 0.0;
|
||||
var BH = 0.0;
|
||||
var CH = 0.0;
|
||||
var CoefficientL = 0.0;
|
||||
var CoefficientH = 0.0;
|
||||
var ALtangent = 0.0;
|
||||
var BLtangent = 0.0;
|
||||
var CLtangent = 0.0;
|
||||
var AHtangent = 0.0;
|
||||
var BHtangent = 0.0;
|
||||
var CHtangent = 0.0;
|
||||
var ANormalLine = 0.0;
|
||||
var BNormalLine = 0.0;
|
||||
var CNormalLine = 0.0;
|
||||
var OrientationValue = 0.0;
|
||||
var AngleCos = 0.0;
|
||||
var Sum1 = 0.0;
|
||||
var Sum2 = 0.0;
|
||||
var Count2 = 0;
|
||||
var Count1 = 0;
|
||||
var Sum = 0.0;
|
||||
var Radius = EARTHRADIUS; //6378137.0,WGS84椭球半径
|
||||
var Count = pts.length;
|
||||
for (var i = 0; i < Count; i++) {
|
||||
if (i == 0) {
|
||||
LowX = (pts[Count - 1].lng * Math.PI) / 180;
|
||||
LowY = (pts[Count - 1].lat * Math.PI) / 180;
|
||||
MiddleX = (pts[0].lng * Math.PI) / 180;
|
||||
MiddleY = (pts[0].lat * Math.PI) / 180;
|
||||
HighX = (pts[1].lng * Math.PI) / 180;
|
||||
HighY = (pts[1].lat * Math.PI) / 180;
|
||||
} else if (i == Count - 1) {
|
||||
LowX = (pts[Count - 2].lng * Math.PI) / 180;
|
||||
LowY = (pts[Count - 2].lat * Math.PI) / 180;
|
||||
MiddleX = (pts[Count - 1].lng * Math.PI) / 180;
|
||||
MiddleY = (pts[Count - 1].lat * Math.PI) / 180;
|
||||
HighX = (pts[0].lng * Math.PI) / 180;
|
||||
HighY = (pts[0].lat * Math.PI) / 180;
|
||||
} else {
|
||||
LowX = (pts[i - 1].lng * Math.PI) / 180;
|
||||
LowY = (pts[i - 1].lat * Math.PI) / 180;
|
||||
MiddleX = (pts[i].lng * Math.PI) / 180;
|
||||
MiddleY = (pts[i].lat * Math.PI) / 180;
|
||||
HighX = (pts[i + 1].lng * Math.PI) / 180;
|
||||
HighY = (pts[i + 1].lat * Math.PI) / 180;
|
||||
}
|
||||
AM = Math.cos(MiddleY) * Math.cos(MiddleX);
|
||||
BM = Math.cos(MiddleY) * Math.sin(MiddleX);
|
||||
CM = Math.sin(MiddleY);
|
||||
AL = Math.cos(LowY) * Math.cos(LowX);
|
||||
BL = Math.cos(LowY) * Math.sin(LowX);
|
||||
CL = Math.sin(LowY);
|
||||
AH = Math.cos(HighY) * Math.cos(HighX);
|
||||
BH = Math.cos(HighY) * Math.sin(HighX);
|
||||
CH = Math.sin(HighY);
|
||||
CoefficientL =
|
||||
(AM * AM + BM * BM + CM * CM) / (AM * AL + BM * BL + CM * CL);
|
||||
CoefficientH =
|
||||
(AM * AM + BM * BM + CM * CM) / (AM * AH + BM * BH + CM * CH);
|
||||
ALtangent = CoefficientL * AL - AM;
|
||||
BLtangent = CoefficientL * BL - BM;
|
||||
CLtangent = CoefficientL * CL - CM;
|
||||
AHtangent = CoefficientH * AH - AM;
|
||||
BHtangent = CoefficientH * BH - BM;
|
||||
CHtangent = CoefficientH * CH - CM;
|
||||
AngleCos =
|
||||
(AHtangent * ALtangent +
|
||||
BHtangent * BLtangent +
|
||||
CHtangent * CLtangent) /
|
||||
(Math.sqrt(
|
||||
AHtangent * AHtangent +
|
||||
BHtangent * BHtangent +
|
||||
CHtangent * CHtangent
|
||||
) *
|
||||
Math.sqrt(
|
||||
ALtangent * ALtangent +
|
||||
BLtangent * BLtangent +
|
||||
CLtangent * CLtangent
|
||||
));
|
||||
if (AngleCos < -1.0) AngleCos = -1.0;
|
||||
if (AngleCos > 1.0) AngleCos = 1.0;
|
||||
AngleCos = Math.acos(AngleCos);
|
||||
ANormalLine = BHtangent * CLtangent - CHtangent * BLtangent;
|
||||
BNormalLine = 0 - (AHtangent * CLtangent - CHtangent * ALtangent);
|
||||
CNormalLine = AHtangent * BLtangent - BHtangent * ALtangent;
|
||||
if (AM != 0) OrientationValue = ANormalLine / AM;
|
||||
else if (BM != 0) OrientationValue = BNormalLine / BM;
|
||||
else OrientationValue = CNormalLine / CM;
|
||||
if (OrientationValue > 0) {
|
||||
Sum1 += AngleCos;
|
||||
Count1++;
|
||||
} else {
|
||||
Sum2 += AngleCos;
|
||||
Count2++;
|
||||
}
|
||||
}
|
||||
var tempSum1, tempSum2;
|
||||
tempSum1 = Sum1 + (2 * Math.PI * Count2 - Sum2);
|
||||
tempSum2 = 2 * Math.PI * Count1 - Sum1 + Sum2;
|
||||
if (Sum1 > Sum2) {
|
||||
if (tempSum1 - (Count - 2) * Math.PI < 1) Sum = tempSum1;
|
||||
else Sum = tempSum2;
|
||||
} else {
|
||||
if (tempSum2 - (Count - 2) * Math.PI < 1) Sum = tempSum2;
|
||||
else Sum = tempSum1;
|
||||
}
|
||||
totalArea = (Sum - (Count - 2) * Math.PI) * Radius * Radius;
|
||||
return totalArea; //返回总面积
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断折线与多边形是否相交
|
||||
* 参考:https://www.cnblogs.com/tuyang1129/p/9390376.html
|
||||
* @param {Polyline|Array<Point>} lines 折线
|
||||
* @param {Polygon|Array<Point>} polygon 多边形
|
||||
* @returns {Boolean} 折线和多边形是否相交
|
||||
*/
|
||||
|
||||
GeoUtils.isPolylineIntersectArea = function (lines, polygon) {
|
||||
var segmentIntersect = function (a, b, c, d) {
|
||||
var x1 = a.lng, y1 = a.lat;
|
||||
var x2 = b.lng, y2 = b.lat;
|
||||
var x3 = c.lng, y3 = c.lat;
|
||||
var x4 = d.lng, y4 = d.lat;
|
||||
|
||||
if (!(Math.min(x1, x2) <= Math.max(x3, x4) && Math.min(y3, y4) <= Math.max(y1, y2) && Math.min(x3, x4) <= Math.max(x1, x2) && Math.min(y1, y2) <= Math.max(y3, y4)))
|
||||
return false;
|
||||
var u, v, w, z
|
||||
u = (x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1);
|
||||
v = (x4 - x1) * (y2 - y1) - (x2 - x1) * (y4 - y1);
|
||||
w = (x1 - x3) * (y4 - y3) - (x4 - x3) * (y1 - y3);
|
||||
z = (x2 - x3) * (y4 - y3) - (x4 - x3) * (y2 - y3);
|
||||
return (u * v <= 2e-10 && w * z <= 2e-10);
|
||||
}
|
||||
|
||||
if (!(lines instanceof BMapGL.Polyline && polygon instanceof BMapGL.Polygon)) {
|
||||
console.error('参数出错,传入值非折线和多边形')
|
||||
return false;
|
||||
}
|
||||
|
||||
lines = lines.getPath().map(function (point) { return { 'lng': point.lng, 'lat': point.lat } });
|
||||
polygon = polygon.getPath().map(function (point) { return { 'lng': point.lng, lat: point.lat } });
|
||||
|
||||
// 包含点的判断
|
||||
if (lines.length < 1 || polygon.length <= 2) {
|
||||
console.error('参数出错,传入值非折线和多边形')
|
||||
return false;
|
||||
}
|
||||
var maybeLine = [], ploygonLine = [];
|
||||
// 遍历所有点 在内部直接返回true
|
||||
for (var j = 0; j < lines.length; j++) {
|
||||
if (GeoUtils.isPointInPolygon(lines[j], polygon)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var n = 1; n < lines.length; n++) {
|
||||
maybeLine.push([lines[n - 1], lines[n]]);
|
||||
}
|
||||
|
||||
for (var k = 1; k < polygon.length; k++) {
|
||||
ploygonLine.push([polygon[k - 1], polygon[k]]);
|
||||
}
|
||||
ploygonLine.push([polygon[polygon.length - 1], polygon[0]]);
|
||||
|
||||
// 折线与多边形边若相交则返回true
|
||||
for (var l = 0; l < maybeLine.length; l++) {
|
||||
for (var m = 0; m < ploygonLine.length; m++) {
|
||||
if (segmentIntersect(maybeLine[l][0], maybeLine[l][1], ploygonLine[m][0], ploygonLine[m][1])) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
})(); //闭包结束
|
13
src/main/resources/static/assets/js/baidu-map.config.js
Normal file
13
src/main/resources/static/assets/js/baidu-map.config.js
Normal file
@ -0,0 +1,13 @@
|
||||
(function() {
|
||||
var map = new BMap.Map('map', {
|
||||
enableMapClick: false
|
||||
});
|
||||
var point = new BMap.Point(111.848937,40.904095);
|
||||
map.centerAndZoom(point, 15);
|
||||
map.enableScrollWheelZoom();
|
||||
map.disableDoubleClickZoom();
|
||||
map.setDefaultCursor('pointer');
|
||||
map.closeInfoWindow();
|
||||
|
||||
window.BaiduMap = map;
|
||||
})();
|
@ -123,17 +123,37 @@
|
||||
var resizeTimeout = null;
|
||||
var enterpriseCheckData = top.dialog.dialogData.enterpriseCheckData;
|
||||
|
||||
function MonthDate() {
|
||||
var date = new Date();
|
||||
var year = date.getFullYear();
|
||||
var month = date.getMonth() + 1;
|
||||
var day = date.getDate();
|
||||
|
||||
function getMonthStart() {
|
||||
return year + '-' + (month.length === 1 ? '0'+ month : month) + '-01';
|
||||
}
|
||||
function getMonthEnd() {
|
||||
return year + '-' + (month.length === 1 ? '0'+ month : month) + '-' + (day.length === 1 ? '0'+ day : day);
|
||||
}
|
||||
return {
|
||||
monthStart: getMonthStart,
|
||||
monthEnd: getMonthEnd
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
format: 'yyyy-MM-dd',
|
||||
});
|
||||
$('#startTime').val(new MonthDate().monthStart())
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
format: 'yyyy-MM-dd',
|
||||
});
|
||||
$('#endTime').val(new MonthDate().monthEnd())
|
||||
}
|
||||
initDate();
|
||||
|
||||
@ -364,8 +384,12 @@
|
||||
this.div.style.top = (pixel.y - 34) +'px';
|
||||
}
|
||||
|
||||
var markerClusterer;
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
if(markerClusterer) {
|
||||
markerClusterer.clearMarkers();
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('api/check2/list-simple-with-enterprise', []), {
|
||||
keywords: $('#keywords').val(),
|
||||
area1: '6aba668e-8ab3-4fbb-8886-b2d468ccf00e',
|
||||
@ -378,7 +402,6 @@
|
||||
startTime: $('#startTime').val() ? $('#startTime').val() : '',
|
||||
endTime: $('#endTime').val() ? $('#endTime').val() : '',
|
||||
}, null, function(code, data) {
|
||||
map.clearOverlays();
|
||||
var checkPointArray = [];
|
||||
var markers = [];
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
@ -410,9 +433,9 @@
|
||||
// map.addOverlay(new CheckMarker(item.checkId, item.enterpriseId, item.enterpriseName, photoArray, checkPoint));
|
||||
}
|
||||
setTimeout(function() {
|
||||
new BMapLib.MarkerClusterer(map, {markers: markers});
|
||||
markerClusterer = new BMapLib.MarkerClusterer(map, {markers: markers});
|
||||
// map.setViewport(checkPointArray);
|
||||
}, 1000);
|
||||
}, 500);
|
||||
}, function(code, msg) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
@ -429,13 +452,6 @@
|
||||
initData();
|
||||
});
|
||||
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
$('#mapContainer').css('height', ($win.height() - 100) +'px');
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
@ -319,11 +319,11 @@
|
||||
if(row.checkType == 1) {
|
||||
checkType = '【检查】';
|
||||
} else if(row.checkType == 2) {
|
||||
checkType = '【复查】';
|
||||
checkType = '<span style="background-color: yellow;">【复查】</span>';
|
||||
}
|
||||
var isComplete = '<span style="color: #FF5722;">【未完成】</span>';
|
||||
var isComplete = '<span style="background-color: #FF5722; color: white">【未完成】</span>';
|
||||
if(row.isComplete == 1) {
|
||||
isComplete = '<span style="color: #009688;">【完成】</span>'
|
||||
isComplete = '<span style="background-color: #009688; color: white">【完成】</span>'
|
||||
}
|
||||
var infoDiv = '<table>';
|
||||
infoDiv += '<tr><td class="col-content">'+ checkType +'</td></tr>';
|
||||
|
@ -20,54 +20,14 @@
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item" id="area1SelectTemplateBox" lay-filter="area1SelectTemplateBox"></div>
|
||||
<script id="area1SelectTemplate" type="text/html">
|
||||
<select id="area1" name="area1" lay-filter="area1" lay-search>
|
||||
<option value="">选择1级区域</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<div class="layui-inline layui-form search-item" id="area2SelectTemplateBox" lay-filter="area2SelectTemplateBox"></div>
|
||||
<script id="area2SelectTemplate" type="text/html">
|
||||
<select id="area2" name="area2" lay-filter="area2" lay-search>
|
||||
<option value="">选择2级区域</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<div class="layui-inline layui-form search-item" id="area3SelectTemplateBox" lay-filter="area3SelectTemplateBox"></div>
|
||||
<script id="area3SelectTemplate" type="text/html">
|
||||
<select id="area3" name="area3" lay-filter="area3" lay-search>
|
||||
<option value="">选择3级区域</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<div class="layui-inline layui-form search-item" id="area4SelectTemplateBox" lay-filter="area4SelectTemplateBox"></div>
|
||||
<script id="area4SelectTemplate" type="text/html">
|
||||
<select id="area4" name="area4" lay-filter="area4" lay-search>
|
||||
<option value="">选择4级区域</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<div class="layui-inline layui-form search-item" id="area5SelectTemplateBox" lay-filter="area5SelectTemplateBox"></div>
|
||||
<script id="area5SelectTemplate" type="text/html">
|
||||
<select id="area5" name="area5" lay-filter="area5" lay-search>
|
||||
<option value="">选择5级区域</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
|
||||
{{# } }}
|
||||
</select>
|
||||
</script>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" id="batchClaim" class="layui-btn layui-btn-normal layui-btn-sm">批量认领</button>
|
||||
<button type="button" id="batchRelieve" class="layui-btn layui-btn-danger layui-btn-sm">批量解除</button>
|
||||
<button type="button" id="quickRelieve" class="layui-btn layui-btn-primary layui-btn-sm">快捷认领</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
</div>
|
||||
@ -95,83 +55,6 @@
|
||||
var basePath = "/inspection/";
|
||||
var tableUrl = basePath+'api/enterpriseofgridoperator/listpageenterpriseofgridoperatorbyuserid/'+ userId;
|
||||
|
||||
// 初始化选择框、单选、复选模板
|
||||
function initSelectRadioCheckboxTemplate(templateId, templateBoxId, data, callback) {
|
||||
laytpl(document.getElementById(templateId).innerHTML).render(data, function(html) {
|
||||
document.getElementById(templateBoxId).innerHTML = html;
|
||||
});
|
||||
form.render('select', templateBoxId);
|
||||
}
|
||||
|
||||
// 初始化1级区域下拉选择
|
||||
function initArea1Select() {
|
||||
top.restAjax.get(top.restAjax.path('{basePath}api/datadictionary/listdictionarybyparentid/81583ade-5466-49aa-b7b6-c643c131ea34', [basePath]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('area1SelectTemplate', 'area1SelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化2级区域下拉选择
|
||||
function initArea2Select(area1) {
|
||||
if(!area1) {
|
||||
initSelectRadioCheckboxTemplate('area2SelectTemplate', 'area2SelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('{basePath}api/datadictionary/listdictionarybyparentid/{area1}', [basePath,area1]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('area2SelectTemplate', 'area2SelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化3级区域下拉选择
|
||||
function initArea3Select(area2) {
|
||||
$('#area3Box').show();
|
||||
if(!area2) {
|
||||
initSelectRadioCheckboxTemplate('area3SelectTemplate', 'area3SelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('{basePath}api/datadictionary/listdictionarybyparentid/{area2}', [basePath,area2]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('area3SelectTemplate', 'area3SelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化4级区域下拉选择
|
||||
function initArea4Select(area3) {
|
||||
if(!area3) {
|
||||
initSelectRadioCheckboxTemplate('area4SelectTemplate', 'area4SelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('{basePath}api/datadictionary/listdictionarybyparentid/{area3}', [basePath,area3]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('area4SelectTemplate', 'area4SelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化5级区域下拉选择
|
||||
function initArea5Select(area4) {
|
||||
$('#area5Box').show();
|
||||
if(!area4) {
|
||||
initSelectRadioCheckboxTemplate('area5SelectTemplate', 'area5SelectTemplateBox', []);
|
||||
return;
|
||||
}
|
||||
top.restAjax.get(top.restAjax.path('{basePath}api/datadictionary/listdictionarybyparentid/{area4}', [basePath,area4]), {}, null, function(code, data, args) {
|
||||
initSelectRadioCheckboxTemplate('area5SelectTemplate', 'area5SelectTemplateBox', data);
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
initArea1Select();
|
||||
initArea2Select();
|
||||
initArea3Select();
|
||||
initArea4Select();
|
||||
initArea5Select();
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
@ -351,11 +234,6 @@
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
area1: $('#area1').val(),
|
||||
area2: $('#area2').val(),
|
||||
area3: $('#area3').val(),
|
||||
area4: $('#area4').val(),
|
||||
area5: $('#area5').val(),
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
@ -375,6 +253,57 @@
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
$(document).on('click', '#batchClaim', function() {
|
||||
var data = table.checkStatus('dataTable').data;
|
||||
var enterpriseIds = [];
|
||||
$.each(data, function(index, item) {
|
||||
enterpriseIds.push(item.enterpriseId);
|
||||
});
|
||||
if(enterpriseIds.length === 0) {
|
||||
top.dialog.msg('请先勾选数据');
|
||||
return;
|
||||
}
|
||||
top.restAjax.post(top.restAjax.path('{basePath}api/enterpriseofgridoperator/saveenterprisesofgridoperator', [basePath]), {
|
||||
userId: userId,
|
||||
enterpriseIds: enterpriseIds
|
||||
}, null, function(code, data) {
|
||||
top.dialog.msg('认领成功', {time: 1000});
|
||||
reloadTable();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
})
|
||||
$(document).on('click', '#batchRelieve', function() {
|
||||
var data = table.checkStatus('dataTable').data;
|
||||
var enterpriseIds = [];
|
||||
$.each(data, function(index, item) {
|
||||
enterpriseIds.push(item.enterpriseId);
|
||||
});
|
||||
if(enterpriseIds.length === 0) {
|
||||
top.dialog.msg('请先勾选数据');
|
||||
return;
|
||||
}
|
||||
top.restAjax.post(top.restAjax.path('{basePath}api/enterpriseofgridoperator/deleteenterprisesofgridoperator', [basePath]), {
|
||||
userId: userId,
|
||||
enterpriseIds: enterpriseIds
|
||||
}, null, function (code, data) {
|
||||
top.dialog.msg('解除成功', {time: 1000});
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
})
|
||||
$(document).on('click', '#quickRelieve', function() {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/enterpriseofgridoperator/quick-relieve.html?userId={userId}', [userId]),
|
||||
title: '快捷认领',
|
||||
width: '80%',
|
||||
height: '80%',
|
||||
onClose: function () {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
})
|
||||
table.on('tool(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var data = obj.data;
|
||||
@ -398,29 +327,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// 联动事件
|
||||
// area1 选择事件
|
||||
form.on('select(area1)', function(data) {
|
||||
initArea2Select(data.value);
|
||||
initArea3Select();
|
||||
initArea4Select();
|
||||
initArea5Select();
|
||||
});
|
||||
// area2 选择事件
|
||||
form.on('select(area2)', function(data) {
|
||||
initArea3Select(data.value);
|
||||
initArea4Select();
|
||||
initArea5Select();
|
||||
});
|
||||
// area3 选择事件
|
||||
form.on('select(area3)', function(data) {
|
||||
initArea4Select(data.value);
|
||||
initArea5Select();
|
||||
});
|
||||
// area4 选择事件
|
||||
form.on('select(area4)', function(data) {
|
||||
initArea5Select(data.value);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
@ -0,0 +1,221 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/inspection/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
html, body {width: 100%;height: 100%;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width: 100%; height: 100%"></div>
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=mlfOah4gWM1FjEo9CmlI64zK6MhyiMPW"></script>
|
||||
<script type="text/javascript" src="assets/js/BaiduMapGeoUtils.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var layer = layui.layer;
|
||||
var $win = $(window);
|
||||
var userId = top.restAjax.params(window.location.href).userId;
|
||||
var enterpriseArray = [];
|
||||
var baiduMap;
|
||||
var selectCircle = {
|
||||
drawing: false,
|
||||
startPoint: null,
|
||||
centerPoint: null,
|
||||
endPoint: null,
|
||||
radius: null,
|
||||
circle: null,
|
||||
};
|
||||
|
||||
function saveEnterpriseInCircle() {
|
||||
var enterpriseInCircleArray = [];
|
||||
$.each(enterpriseArray, function(index, item) {
|
||||
if(BMapGLLib.GeoUtils.isPointInCircle(item.point, selectCircle.circle)) {
|
||||
enterpriseInCircleArray.push(item);
|
||||
}
|
||||
});
|
||||
var enterpriseIds = [];
|
||||
var enterpriseNames = [];
|
||||
$.each(enterpriseInCircleArray, function(index, item) {
|
||||
enterpriseIds.push(item.enterprise.enterpriseId);
|
||||
enterpriseNames.push(item.enterprise.nameJoinByEnterpriseId);
|
||||
});
|
||||
if(enterpriseIds.length === 0) {
|
||||
top.dialog.msg('选择区域中没有企业');
|
||||
return;
|
||||
}
|
||||
top.dialog.confirm('确定认领:'+ enterpriseNames.join(',') + '?', function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/enterpriseofgridoperator/saveenterprisesofgridoperator', []), {
|
||||
userId: userId,
|
||||
enterpriseIds: enterpriseIds
|
||||
}, null, function (code, data) {
|
||||
top.dialog.msg('认领成功', {time: 1000});
|
||||
window.location.reload();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function initMap(callback) {
|
||||
baiduMap = new BMapGL.Map('map');
|
||||
var centerPoint = new BMapGL.Point(109.850206, 40.66852);
|
||||
baiduMap.centerAndZoom(centerPoint, 15);
|
||||
baiduMap.enableScrollWheelZoom();
|
||||
baiduMap.enableContinuousZoom();
|
||||
baiduMap.disableDoubleClickZoom();
|
||||
baiduMap.setDefaultCursor('pointer');
|
||||
baiduMap.addEventListener('dblclick', function(e) {
|
||||
var point = e.latlng;
|
||||
if(!selectCircle.drawing) {
|
||||
// 清除原有圆
|
||||
if(selectCircle.circle) {
|
||||
baiduMap.removeOverlay(selectCircle.circle);
|
||||
}
|
||||
// 双击画圆
|
||||
selectCircle.circle = new BMapGL.Circle(point, 1, {
|
||||
strokeColor: 'blue',
|
||||
strokeWeight: 2,
|
||||
strokeOpacity: 0.5,
|
||||
fillOpacity: 0.1
|
||||
});
|
||||
selectCircle.startPoint = point;
|
||||
baiduMap.addOverlay(selectCircle.circle);
|
||||
selectCircle.drawing = true;
|
||||
console.log('start draw');
|
||||
} else {
|
||||
selectCircle.drawing = false;
|
||||
console.log('end draw');
|
||||
// 保存范围内的企业
|
||||
saveEnterpriseInCircle();
|
||||
}
|
||||
});
|
||||
baiduMap.addEventListener('mousemove', function(e) {
|
||||
if(!selectCircle.drawing) {
|
||||
return;
|
||||
}
|
||||
var endPoint = e.latlng;
|
||||
var startPoint = selectCircle.startPoint;
|
||||
var centerPoint = BMapGLLib.GeoUtils.getCenterPoint(startPoint, endPoint);
|
||||
var radius = baiduMap.getDistance(centerPoint, endPoint);
|
||||
// 设置圆半径
|
||||
selectCircle.circle.setRadius(radius);
|
||||
selectCircle.circle.setCenter(centerPoint);
|
||||
selectCircle.centerPoint = centerPoint;
|
||||
selectCircle.endPoint = endPoint;
|
||||
selectCircle.radius = radius;
|
||||
});
|
||||
callback();
|
||||
}
|
||||
|
||||
// 企业标记类
|
||||
function EnterpriseMarker(enterprise) {
|
||||
this.enterprise = enterprise;
|
||||
this.point = new BMapGL.Point(enterprise.lng, enterprise.lat);
|
||||
}
|
||||
EnterpriseMarker.prototype = new BMapGL.Overlay();
|
||||
EnterpriseMarker.prototype.initialize = function(map) {
|
||||
var self = this;
|
||||
self.map = map;
|
||||
var nameSpan = document.createElement('span');
|
||||
self.nameSpan = nameSpan;
|
||||
nameSpan.appendChild(document.createTextNode(self.enterprise.nameJoinByEnterpriseId));
|
||||
nameSpan.style.position = 'absolute';
|
||||
nameSpan.style.padding = '5px';
|
||||
nameSpan.style.backgroundColor = 'rgba(72,72,47,0.5)';
|
||||
nameSpan.style.color = 'white';
|
||||
nameSpan.style.lineHeight = '18px';
|
||||
nameSpan.style.fontSize = '12px';
|
||||
nameSpan.style.border = '1px solid rgba(0,0,0,0.3)';
|
||||
nameSpan.style.boxShadow = '0px 5px 5px rgba(0,0,0,0.3)';
|
||||
nameSpan.style.borderRadius = '10px';
|
||||
nameSpan.style.whiteSpace = 'nowrap';
|
||||
nameSpan.style.zIndex = BMapGL.Overlay.getZIndex(this.point.lat);
|
||||
nameSpan.style.cursor = 'pointer';
|
||||
nameSpan.addEventListener('mouseover', function() {
|
||||
this.style.oldZIndex = this.style.zIndex;
|
||||
this.style.zIndex = '10000';
|
||||
this.style.oldBackgroundColor = this.style.backgroundColor;
|
||||
this.style.backgroundColor = 'rgba(72,72,47,1)';
|
||||
});
|
||||
nameSpan.addEventListener('mouseout', function() {
|
||||
this.style.zIndex = this.style.oldZIndex;
|
||||
this.style.backgroundColor = this.style.oldBackgroundColor;
|
||||
});
|
||||
nameSpan.addEventListener('click', function() {
|
||||
|
||||
});
|
||||
// 向面板中添加元素
|
||||
map.getPanes().labelPane.appendChild(nameSpan);
|
||||
return nameSpan;
|
||||
}
|
||||
EnterpriseMarker.prototype.draw = function() {
|
||||
var self = this;
|
||||
var pixel = self.map.pointToOverlayPixel(self.point);
|
||||
self.nameSpan.style.left = (pixel.x - 5) +'px';
|
||||
self.nameSpan.style.top = (pixel.y - 30) +'px';
|
||||
}
|
||||
|
||||
function markEnterprise() {
|
||||
// $.each(enterpriseArray, function(index, item) {
|
||||
// baiduMap.addOverlay(new BMapGL.Marker(item.point));
|
||||
// });
|
||||
var pointArray = [];
|
||||
$.each(enterpriseArray, function(index, item) {
|
||||
pointArray.push(item.point)
|
||||
baiduMap.addOverlay(item);
|
||||
});
|
||||
baiduMap.setViewport(pointArray);
|
||||
}
|
||||
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/enterpriseofgridoperator/listenterpriseofgridoperatorbyuserid/{userId}', [userId]), {}, null, function(code, data) {
|
||||
enterpriseArray = [];
|
||||
$.each(data, function(index, item) {
|
||||
if((item.userCount && item.userCount > 0) || (!item.lng || !item.lat)) {
|
||||
return;
|
||||
}
|
||||
enterpriseArray.push(new EnterpriseMarker(item));
|
||||
})
|
||||
markEnterprise();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
/*
|
||||
|
||||
, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
initMap(initData);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,350 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/inspection/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<style>
|
||||
html, body {width: 100%;height: 100%;}
|
||||
.map-box {height: 100%;}
|
||||
.option-box {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
padding: 5px;
|
||||
background-color: #FFF;
|
||||
z-index: 100;
|
||||
border-bottom: 1px solid silver;
|
||||
border-right: 1px solid silver;
|
||||
}
|
||||
#markerRightClickBtn {
|
||||
display: none;
|
||||
position: fixed;
|
||||
padding: 5px;
|
||||
background-color: #fff;
|
||||
border: 1px solid silver;
|
||||
z-index: 110;
|
||||
}
|
||||
.layui-input {width: 150px; font-size: 12px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein map-box">
|
||||
<div class="option-box">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="startTime" class="layui-input search-item search-item-width-100" placeholder="开始时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item search-item-width-100" placeholder="结束时间" readonly>
|
||||
</div>
|
||||
<div class="layui-btn-group">
|
||||
<button id="searchBtn" class="layui-btn layui-btn-normal layui-btn-xs">搜索</button>
|
||||
</div>
|
||||
<div class="layui-btn-group" style="margin-left: 0px;">
|
||||
<button id="playFlyBtn" class="layui-btn layui-btn-xs layui-bg-cyan">播放轨迹</button>
|
||||
<button id="cancelFlyBtn" class="layui-btn layui-btn-danger layui-btn-xs">结束播放</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="map" style="width: 100%; height: 100%"></div>
|
||||
</div>
|
||||
<script src="https://api.map.baidu.com/api?v=3.0&ak=mlfOah4gWM1FjEo9CmlI64zK6MhyiMPW"></script>
|
||||
<script src="assets/js/baidu-map.config.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
var mapData;
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var layer = layui.layer;
|
||||
var $win = $(window);
|
||||
var userId = top.restAjax.params(window.location.href).userId;
|
||||
var runIcon = new BMap.Icon('assets/images/run.png', new BMap.Size(64, 64));
|
||||
var runPoint = new BMap.Icon('assets/images/run-point.png', new BMap.Size(24, 24));
|
||||
runPoint.setImageSize(new BMap.Size(24, 24));
|
||||
var playData = {
|
||||
flyInterval: null,
|
||||
flyPointIndex: 0,
|
||||
flyMarker: null
|
||||
}
|
||||
mapData = {
|
||||
map: null,
|
||||
isEdit: false,
|
||||
rightMarkerId: null,
|
||||
rightMarkerInfo: null,
|
||||
flightPointArray:[],
|
||||
mapPolyline: null,
|
||||
};
|
||||
|
||||
function MonthDate() {
|
||||
var date = new Date();
|
||||
var year = date.getFullYear();
|
||||
var month = date.getMonth() + 1;
|
||||
month = (month.length === 1 ? '0'+ month : month);
|
||||
var day = date.getDate();
|
||||
day = (day.length === 1 ? '0'+ day : day)
|
||||
var hours = date.getHours();
|
||||
hours = (hours.length === 1 ? '0'+ hours : hours)
|
||||
var minutes = date.getMinutes();
|
||||
minutes = (minutes.length === 1 ? '0'+ minutes : minutes)
|
||||
var seconds = date.getSeconds();
|
||||
seconds = (day.length === 1 ? '0'+ seconds : seconds)
|
||||
var yyyyMMdd = year + '-' + month + '-' + day;
|
||||
|
||||
function getMonthStart() {
|
||||
return yyyyMMdd + ' 08:00:00';
|
||||
}
|
||||
function getMonthEnd() {
|
||||
return yyyyMMdd + ' 18:00:00';
|
||||
}
|
||||
return {
|
||||
monthStart: getMonthStart,
|
||||
monthEnd: getMonthEnd
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
type: 'datetime',
|
||||
format: 'yyyy-MM-dd HH:mm:ss',
|
||||
trigger: 'click'
|
||||
});
|
||||
$('#startTime').val(new MonthDate().monthStart())
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
type: 'datetime',
|
||||
format: 'yyyy-MM-dd HH:mm:ss',
|
||||
trigger: 'click'
|
||||
});
|
||||
$('#endTime').val(new MonthDate().monthEnd())
|
||||
}
|
||||
initDate();
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
// 显示marker右键按钮
|
||||
function showMarkerRightClickBtn(event) {
|
||||
var top = 0;
|
||||
var left = 0;
|
||||
if($win.height() - event.clientY > 40) {
|
||||
top = event.clientY + 5;
|
||||
} else {
|
||||
top = event.clientY - 40;
|
||||
}
|
||||
if($win.width() - event.clientX > 120) {
|
||||
left = event.clientX + 5;
|
||||
} else {
|
||||
left = event.clientX - 120;
|
||||
}
|
||||
$('#markerRightClickBtn').css({
|
||||
top: top + 'px',
|
||||
left: left + 'px',
|
||||
display: 'block'
|
||||
})
|
||||
}
|
||||
// maker右击事件
|
||||
function markerRightClick(event) {
|
||||
var self = this;
|
||||
if(!mapData.isEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
mapData.rightMarkerId = self.id;
|
||||
mapData.rightMarkerInfo = self.info;
|
||||
showMarkerRightClickBtn(event);
|
||||
}
|
||||
// 画直线
|
||||
function drawMarkerLine() {
|
||||
var pointArray = [];
|
||||
for(var i = 0, item; item = mapData.flightPointArray[i++];) {
|
||||
pointArray.push(item.mapPoint);
|
||||
}
|
||||
if(pointArray.length == 0) {
|
||||
return;
|
||||
}
|
||||
var mapPolyline = new BMap.Polyline(pointArray, {
|
||||
enableEditing: false,
|
||||
enableClicking: true,
|
||||
strokeWeight: '8',
|
||||
strokeOpacity: 0.8,
|
||||
strokeColor: '#18a45b'
|
||||
});
|
||||
mapData.mapPolyline = mapPolyline;
|
||||
mapData.map.addOverlay(mapPolyline);
|
||||
if(pointArray.length > 3) {
|
||||
mapData.map.setViewport(pointArray);
|
||||
}
|
||||
}
|
||||
// 添加marker
|
||||
function addMapMarker(point, info) {
|
||||
var id = new Date().getTime();
|
||||
var flightPoint = {
|
||||
lng: point.lng,
|
||||
lat: point.lat
|
||||
}
|
||||
var mapPoint = new BMap.Point(flightPoint.lng, flightPoint.lat);
|
||||
var mapMarker = new BMap.Marker(mapPoint, {
|
||||
icon: runPoint
|
||||
});
|
||||
mapMarker.id = id;
|
||||
mapMarker.info = info ? info : {};
|
||||
mapMarker.addEventListener('rightclick', markerRightClick);
|
||||
mapData.flightPointArray.push({
|
||||
id: id,
|
||||
flightPoint: flightPoint,
|
||||
mapPoint: mapPoint,
|
||||
mapMarker: mapMarker
|
||||
});
|
||||
mapData.map.addOverlay(mapMarker);
|
||||
}
|
||||
// 地区双击事件
|
||||
function mapDblClick(event) {
|
||||
if(!mapData.isEdit) {
|
||||
return;
|
||||
}
|
||||
addMapMarker({
|
||||
lng: event.point.lng,
|
||||
lat: event.point.lat
|
||||
});
|
||||
mapData.map.removeOverlay(mapData.mapPolyline);
|
||||
drawMarkerLine();
|
||||
}
|
||||
|
||||
function initMap(callback) {
|
||||
mapData.map = BaiduMap;
|
||||
mapData.map.setDefaultCursor('auto');
|
||||
callback();
|
||||
}
|
||||
// 初始化飞行轨迹
|
||||
function initFlightPath() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/action/point/list/user-id/{userId}', [userId]), {
|
||||
startDate: $('#startTime').val(),
|
||||
endDate: $('#endTime').val(),
|
||||
}, null, function(code, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
addMapMarker({
|
||||
lng: item.lng,
|
||||
lat: item.lat
|
||||
});
|
||||
}
|
||||
mapData.map.removeOverlay(mapData.mapPolyline);
|
||||
drawMarkerLine();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initMap(function() {
|
||||
initFlightPath();
|
||||
});
|
||||
|
||||
$('#removeMarker').on('click', function() {
|
||||
$('#markerRightClickBtn').hide();
|
||||
top.dialog.confirm('确定删除?', function(index) {
|
||||
top.dialog.close(index);
|
||||
$('#markerRightClickBtn').hide();
|
||||
if(!mapData.rightMarkerId) {
|
||||
return;
|
||||
}
|
||||
for(var i = 0; i < mapData.flightPointArray.length; i++) {
|
||||
var item = mapData.flightPointArray[i];
|
||||
if(item.id === mapData.rightMarkerId) {
|
||||
mapData.map.removeOverlay(item.mapMarker);
|
||||
mapData.flightPointArray.splice(i, 1);
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mapData.map.removeOverlay(mapData.mapPolyline);
|
||||
drawMarkerLine();
|
||||
});
|
||||
});
|
||||
$('#editorMarker').on('click', function() {
|
||||
$('#markerRightClickBtn').hide();
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/flightpath/save-flightpath.html', []),
|
||||
end: function() {
|
||||
for(var i = 0, item; item = mapData.flightPointArray[i++];) {
|
||||
if(mapData.rightMarkerId === item.id) {
|
||||
item.mapMarker.info = mapData.rightMarkerInfo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mapData.rightMarkerId = null;
|
||||
mapData.rightMarkerInfo = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#cancelMarker').on('click', function() {
|
||||
$('#markerRightClickBtn').hide();
|
||||
mapData.rightMarkerId = null;
|
||||
mapData.rightMarkerInfo = null;
|
||||
});
|
||||
|
||||
// 清楚飞行播放
|
||||
function clearPlay() {
|
||||
clearInterval(playData.flyInterval);
|
||||
playData.flyPointIndex = 0;
|
||||
mapData.map.removeOverlay(playData.flyMarker);
|
||||
}
|
||||
$('#playFlyBtn').on('click', function() {
|
||||
clearPlay();
|
||||
if(mapData.flightPointArray.length == 0) {
|
||||
return;
|
||||
}
|
||||
playData.flyMarker = new BMap.Marker(mapData.flightPointArray[playData.flyPointIndex].mapPoint, {
|
||||
icon: runIcon
|
||||
});
|
||||
playData.flyMarker.setZIndex(120);
|
||||
mapData.map.addOverlay(playData.flyMarker);
|
||||
playData.flyInterval = setInterval(function() {
|
||||
playData.flyPointIndex++;
|
||||
if(playData.flyPointIndex >= mapData.flightPointArray.length) {
|
||||
playData.flyPointIndex = 0;
|
||||
}
|
||||
playData.flyMarker.setPosition(mapData.flightPointArray[playData.flyPointIndex].mapPoint);
|
||||
}, 500);
|
||||
});
|
||||
$('#cancelFlyBtn').on('click', function() {
|
||||
clearPlay();
|
||||
});
|
||||
|
||||
$('#searchBtn').on('click', function () {
|
||||
initFlightPath();
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -296,11 +296,12 @@
|
||||
}
|
||||
];
|
||||
if(level == 5) {
|
||||
colArray.push({field: 'operation', width: 170, title: '操作', fixed: 'right', align:'center',
|
||||
colArray.push({field: 'operation', width: 240, title: '操作', fixed: 'right', align:'center',
|
||||
templet: function(row) {
|
||||
return '<div class="layui-btn-group">' +
|
||||
'<button type="button" class="layui-btn layui-btn-sm" lay-event="personnelEnterprise">企业片区</button>' +
|
||||
'<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="affiliatedEnterpriseEvent">关联企业</button>' +
|
||||
'<button type="button" class="layui-btn layui-btn-warm layui-btn-sm" lay-event="actionPathEvent">查看轨迹</button>' +
|
||||
'</div>';
|
||||
}
|
||||
})
|
||||
@ -462,16 +463,23 @@
|
||||
url: top.restAjax.path('route/enterpriseofgridoperator/list-enterpriseofgridoperator.html?userId={userId}', [data.userId]),
|
||||
title: data.userName +' 的关联企业',
|
||||
width: (windowWidth * 0.9) +'px',
|
||||
height: (windowHeight * 0.9) +'px'
|
||||
height: '90%'
|
||||
});
|
||||
} else if(layEvent === 'personnelEnterprise') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/gridpersonnel/get-enterprise-location.html?userId={userId}', [data.userId]),
|
||||
title: data.userName +' 的企业片区',
|
||||
width: (windowWidth * 0.8) +'px',
|
||||
height: (windowHeight * 0.8) +'px'
|
||||
height: '80%'
|
||||
});
|
||||
}
|
||||
} else if(layEvent === 'actionPathEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/gridpersonnel/get-actionpath.html?userId={userId}', [data.userId]),
|
||||
title: data.userName +' 的轨迹查看',
|
||||
width: (windowWidth * 0.8) +'px',
|
||||
height: '80%'
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
// 联动事件
|
||||
|
Loading…
Reference in New Issue
Block a user