Merge remote-tracking branch 'origin/guoshengxiong' into guoshengxiong
This commit is contained in:
commit
3989fc7981
@ -12,6 +12,7 @@ import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -30,12 +31,16 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AsyncCheckingPoint {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IMqttSender mqttPushClient;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private SystemUserMapper systemUserMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AsyncCommon asyncCommon;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private NoticeMapper noticeMapper;
|
||||
|
||||
|
||||
@ -206,12 +206,6 @@ public class HikvisionCall {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
private static String xingzongIscIpPort;
|
||||
|
||||
@Value("${xingzongIscIpPort:}")
|
||||
public void setXingzongIscIpPort(String xingzongIscIpPort) {
|
||||
HikvisionCall.xingzongIscIpPort = xingzongIscIpPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片
|
||||
@ -235,11 +229,7 @@ public class HikvisionCall {
|
||||
JSONObject rsJo = JSONObject.parseObject(rs);
|
||||
String code = rsJo.getString("code");
|
||||
if (Objects.equals(code, "0")) {
|
||||
String picUrl = rsJo.getJSONObject("data").getString("picUrl");
|
||||
if (EnvironmentUtil.isXingZong()) {
|
||||
picUrl = picUrl.replaceAll("^https:\\/\\/[^/]+\\/", xingzongIscIpPort);
|
||||
}
|
||||
return picUrl;
|
||||
return rsJo.getJSONObject("data").getString("picUrl");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -647,7 +637,7 @@ public class HikvisionCall {
|
||||
);
|
||||
if (count != 0) {
|
||||
log.info("重复的人员通行的数据不保存,idCard:{},time:{}", workerInfo.getIdCard(), time);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
HikvisionEventsPictureRq rq = new HikvisionEventsPictureRq();
|
||||
@ -754,7 +744,7 @@ public class HikvisionCall {
|
||||
Integer count = carPassRecordMapper.selectCount(queryWrapper);
|
||||
if (count != 0) {
|
||||
log.info("重复的车辆通行的数据不保存,plateNo:{},time:{}", plateNo, time);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
//车牌
|
||||
|
||||
@ -1,18 +1,15 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
@ -168,7 +165,7 @@ public class SystemUserController {
|
||||
})
|
||||
@PostMapping(value = "/getProjectChilderSystemUserList")
|
||||
public Result<List<SystemUser>> getProjectChilderSystemUserList(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(systemUserService.getProjectChilderSystemUserList(map));
|
||||
return Result.success(systemUserService.getProjectChildernSystemUserList(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发送安全帽平台账号信息", notes = "发送安全帽平台账号信息", httpMethod = "POST")
|
||||
|
||||
@ -123,7 +123,7 @@ public interface ISystemUserService extends IService<SystemUser> {
|
||||
/**
|
||||
* 查找项目子账号列表
|
||||
*/
|
||||
List<SystemUser> getProjectChilderSystemUserList(Map<String, Object> map);
|
||||
List<SystemUser> getProjectChildernSystemUserList(Map<String, Object> map);
|
||||
|
||||
SystemUser queryById(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -335,7 +335,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
result.put("systemLogoConfig", new SystemLogoConfig());
|
||||
result.put("personMail", systemUser.getPersonMail());
|
||||
result.put("avatar", systemUser.getAvatar());
|
||||
if (Objects.equals(systemUser.getAccountType(), 10) ||Objects.equals(systemUser.getAccountType(), 11)) {
|
||||
if (Objects.equals(systemUser.getAccountType(), 10) || Objects.equals(systemUser.getAccountType(), 11)) {
|
||||
XzSystemUserToCompanyProject xzSystemUserToCompanyProject = xzSystemUserToCompanyProjectMapper.selectOne(new LambdaQueryWrapper<XzSystemUserToCompanyProject>()
|
||||
.eq(XzSystemUserToCompanyProject::getType, 2)
|
||||
.eq(XzSystemUserToCompanyProject::getUserId, systemUser.getUserId())
|
||||
@ -385,7 +385,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
}
|
||||
}
|
||||
if (systemUser.getAccountType() == 6) {
|
||||
List<SystemUser> users = getProjectChilderSystemUserList(new MapBuilder<String, Object>().put("projectSn", systemUser.getSn())
|
||||
List<SystemUser> users = getProjectChildernSystemUserList(new MapBuilder<String, Object>().put("projectSn", systemUser.getSn())
|
||||
.put("userId", systemUser.getUserId()).build());
|
||||
if (CollUtil.isNotEmpty(users)) {
|
||||
systemUser.setPersonMail(users.get(0).getPersonMail());
|
||||
@ -862,7 +862,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemUser> getProjectChilderSystemUserList(Map<String, Object> map) {
|
||||
public List<SystemUser> getProjectChildernSystemUserList(Map<String, Object> map) {
|
||||
String enterpriseId = MapUtils.getString(map, "enterpriseId");
|
||||
if (StrUtil.isNotBlank(enterpriseId)) {
|
||||
map.put("enterpriseIdList", StrUtil.split(enterpriseId, ","));
|
||||
@ -1309,7 +1309,8 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
.apply("find_in_set({0}, inspect_user_ids)", id)
|
||||
.or()
|
||||
.apply("find_in_set({0}, notice_user_ids)", id));
|
||||
label:for (XzCheckingRoute xzCheckingRoute : checkingPointList) {
|
||||
label:
|
||||
for (XzCheckingRoute xzCheckingRoute : checkingPointList) {
|
||||
List<XzCheckingRouteTask> xzCheckingRouteTasks = xzCheckingRouteTaskService.list(Wrappers.<XzCheckingRouteTask>lambdaQuery()
|
||||
.eq(XzCheckingRouteTask::getXzCheckingRouteId, xzCheckingRoute.getId()));
|
||||
for (XzCheckingRouteTask xzCheckingRouteTask : xzCheckingRouteTasks) {
|
||||
@ -1689,6 +1690,9 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
@Override
|
||||
public boolean isSubProject() {
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
if (user == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(user.getAccountType(), 6);
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ import com.zhgd.xmgl.modules.checking.mapper.CheckingPointAlarmMapper;
|
||||
import com.zhgd.xmgl.modules.checking.mapper.CheckingPointInfoMapper;
|
||||
import com.zhgd.xmgl.modules.checking.service.CheckingPointAlarmService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -45,6 +46,7 @@ public class CheckingPointAlarmServiceImpl extends ServiceImpl<CheckingPointAlar
|
||||
CheckingPointInfoMapper checkingPointInfoMapper;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
AsyncCheckingPoint asyncCheckingPoint;
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.project.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
@ -91,7 +90,7 @@ public class ProjectEnterpriseController {
|
||||
List<Long> enterpriseIds = pageList.getRecords().stream().map(e -> e.getId()).collect(Collectors.toList());
|
||||
Map<String, Object> userMap = new HashMap<>();
|
||||
userMap.put("projectSn", map.get("projectSn").toString());
|
||||
List<SystemUser> systemUserList = systemUserService.getProjectChilderSystemUserList(userMap);
|
||||
List<SystemUser> systemUserList = systemUserService.getProjectChildernSystemUserList(userMap);
|
||||
List<WorkerInfo> workerInfoList = workerInfoService.listByIds(systemUserList.stream().map(u -> u.getWorkerId()).collect(Collectors.toList()));
|
||||
workerInfoList = workerInfoList.stream().filter(w -> enterpriseIds.contains(w.getEnterpriseId())).collect(Collectors.toList());
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
@ -187,7 +187,7 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("enterpriseIdList", enterpriseInfos.stream().map(EnterpriseInfo::getId).collect(Collectors.toList()));
|
||||
map.put("projectSn", qualityRegion.getProjectSn());
|
||||
List<SystemUser> systemUserList = systemUserService.getProjectChilderSystemUserList(map);
|
||||
List<SystemUser> systemUserList = systemUserService.getProjectChildernSystemUserList(map);
|
||||
Map<Long, SystemUser> userMap = systemUserList.stream().collect(Collectors.toMap(SystemUser::getUserId, Function.identity()));
|
||||
if (CollUtil.isEmpty(userMap)) {
|
||||
return;
|
||||
|
||||
@ -1,120 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.controller;
|
||||
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDataToFence;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataToFenceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 智能安全帽-实时数据-围栏中间表
|
||||
* @author: pds
|
||||
* @date: 2024-06-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/safetyHatDataToFence")
|
||||
@Slf4j
|
||||
@Api(tags = "智能安全帽-实时数据-围栏中间表相关Api")
|
||||
public class SafetyHatDataToFenceController {
|
||||
@Autowired
|
||||
private ISafetyHatDataToFenceService safetyHatDataToFenceService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页列表查询智能安全帽-实时数据-围栏中间表信息", notes = "分页列表查询智能安全帽-实时数据-围栏中间表信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<SafetyHatDataToFence>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(safetyHatDataToFenceService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "列表查询智能安全帽-实时数据-围栏中间表信息", notes = "列表查询智能安全帽-实时数据-围栏中间表信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SafetyHatDataToFence>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(safetyHatDataToFenceService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param safetyHatDataToFence
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加智能安全帽-实时数据-围栏中间表信息", notes = "添加智能安全帽-实时数据-围栏中间表信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<SafetyHatDataToFence> add(@RequestBody @Validate SafetyHatDataToFence safetyHatDataToFence) {
|
||||
safetyHatDataToFenceService.add(safetyHatDataToFence);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param safetyHatDataToFence
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "编辑智能安全帽-实时数据-围栏中间表信息", notes = "编辑智能安全帽-实时数据-围栏中间表信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<SafetyHatDataToFence> edit(@RequestBody SafetyHatDataToFence safetyHatDataToFence) {
|
||||
safetyHatDataToFenceService.edit(safetyHatDataToFence);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除智能安全帽-实时数据-围栏中间表信息", notes = "删除智能安全帽-实时数据-围栏中间表信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "智能安全帽-实时数据-围栏中间表ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<SafetyHatDataToFence> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
safetyHatDataToFenceService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询智能安全帽-实时数据-围栏中间表信息", notes = "通过id查询智能安全帽-实时数据-围栏中间表信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "智能安全帽-实时数据-围栏中间表ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SafetyHatDataToFence> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(safetyHatDataToFenceService.queryById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerNumAndRegionName;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -28,11 +27,10 @@ public interface SafetyHatDataMapper extends BaseMapper<SafetyHatData> {
|
||||
|
||||
List<SafetyHatData> queryList(@Param(Constants.WRAPPER) QueryWrapper<SafetyHatData> queryWrapper);
|
||||
|
||||
List<SafetyHatData> getNewestDataGroupByDevSn(String projectSn);
|
||||
List<SafetyHatData> getNewestDataGroupByProjectSn(String projectSn);
|
||||
|
||||
List<SafetyHatData> getNewestList(HashMap<String, Object> paramMap);
|
||||
|
||||
int batchInsert(@Param("list") List<SafetyHatData> list);
|
||||
|
||||
List<WorkerNumAndRegionName> countWorkerNumByRegion(@Param("param") Map<String, Object> param);
|
||||
}
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.mapper;
|
||||
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDataToFence;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 智能安全帽-实时数据-围栏中间表
|
||||
* @author: pds
|
||||
* @date: 2024-06-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SafetyHatDataToFenceMapper extends BaseMapper<SafetyHatDataToFence> {
|
||||
|
||||
}
|
||||
@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -23,4 +24,5 @@ public interface SafetyHatFenceMapper extends BaseMapper<SafetyHatFence> {
|
||||
List<SafetyHatFence> queryList(@Param(Constants.WRAPPER) QueryWrapper<SafetyHatFence> queryWrapper);
|
||||
|
||||
IPage<SafetyHatFence> queryList(Page<SafetyHatFence> page,@Param(Constants.WRAPPER) QueryWrapper<SafetyHatFence> queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="getNewestDataGroupByDevSn" resultType="com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData">
|
||||
<select id="getNewestDataGroupByProjectSn" resultType="com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatData">
|
||||
select shd.*,wi.worker_name,wi.id_card
|
||||
from safety_hat_data shd
|
||||
join (select max(create_time) as create_time, dev_sn
|
||||
@ -52,17 +52,4 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="countWorkerNumByRegion" resultType="com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerNumAndRegionName">
|
||||
select
|
||||
qr.region_name,
|
||||
count(DISTINCT shd.worker_info_id) as workerNum,
|
||||
date_format(shd.upload_time,'%Y-%m-%d') AS date
|
||||
from quality_region qr
|
||||
join safety_hat_fence shf on shf.quality_region_id = qr.id
|
||||
join safety_hat_data_to_fence shdtf on shdtf.safety_hat_fence_id = shf.id
|
||||
join safety_hat_data shd on shd.id=shdtf.safety_hat_data_id
|
||||
where qr.project_sn = #{param.projectSn}
|
||||
and shd.upload_time >= CONCAT(DATE_FORMAT(DATE_SUB(now(), interval 7 day), '%Y-%m-%d'), ' 00:00:00')
|
||||
group by qr.id,date
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
<?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.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataToFenceMapper">
|
||||
</mapper>
|
||||
@ -1,30 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDataToFence;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 智能安全帽-实时数据-围栏中间表
|
||||
* @author: pds
|
||||
* @date: 2024-06-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface ISafetyHatDataToFenceService extends IService<SafetyHatDataToFence> {
|
||||
|
||||
IPage<SafetyHatDataToFence> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
List<SafetyHatDataToFence> queryList(HashMap<String, Object> param);
|
||||
|
||||
void add(SafetyHatDataToFence safetyHatDataToFence);
|
||||
|
||||
void edit(SafetyHatDataToFence safetyHatDataToFence);
|
||||
|
||||
void delete(String id);
|
||||
|
||||
SafetyHatDataToFence queryById(String id);
|
||||
|
||||
}
|
||||
@ -23,10 +23,7 @@ import com.zhgd.xmgl.modules.safetyhat.entity.vo.WorkerNumByRegionVo;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.*;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import com.zhgd.xmgl.util.RegionUtil;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -34,8 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -48,11 +45,11 @@ import java.util.stream.Collectors;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Slf4j
|
||||
public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, SafetyHatData> implements ISafetyHatDataService {
|
||||
@Resource
|
||||
SafetyHatFenceServiceImpl safetyHatFenceService;
|
||||
@Autowired
|
||||
private SafetyHatDataMapper safetyHatDataMapper;
|
||||
@Autowired
|
||||
private SafetyHatDataToFenceMapper safetyHatDataToFenceMapper;
|
||||
@Autowired
|
||||
private SafetyHatDevMapper safetyHatDevMapper;
|
||||
@Autowired
|
||||
private SafetyHatFenceMapper safetyHatFenceMapper;
|
||||
@ -141,10 +138,6 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
}
|
||||
}
|
||||
if (isInFence) {
|
||||
SafetyHatDataToFence toFence = new SafetyHatDataToFence();
|
||||
toFence.setSafetyHatDataId(safetyHatData.getId());
|
||||
toFence.setSafetyHatFenceId(fence.getId());
|
||||
safetyHatDataToFenceMapper.insert(toFence);
|
||||
inFence = true;
|
||||
}
|
||||
}
|
||||
@ -275,22 +268,25 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
@Override
|
||||
public List<WorkerNumByRegionVo> countWorkerNumByRegion(Map<String, Object> param) {
|
||||
List<WorkerNumByRegionVo> vos = Lists.newArrayList();
|
||||
List<WorkerNumAndRegionName> dataList = baseMapper.countWorkerNumByRegion(param);
|
||||
Map<String, List<WorkerNumAndRegionName>> dateMap = dataList.stream().collect(Collectors.groupingBy(WorkerNumAndRegionName::getDate));
|
||||
Set<String> regionNameSet = dataList.stream().map(WorkerNumAndRegionName::getRegionName).collect(Collectors.toSet());
|
||||
String projectSn = MapUtils.getString(param, "projectSn");
|
||||
List<SafetyHatData> datas = safetyHatDataMapper.selectList(new LambdaQueryWrapper<SafetyHatData>()
|
||||
.eq(SafetyHatData::getProjectSn, projectSn)
|
||||
.ge(SafetyHatData::getUploadTime, DateUtil.formatDate(DateUtil.offsetDay(new Date(), -6)))
|
||||
);
|
||||
List<SafetyHatFence> regions = safetyHatFenceService.queryList(new MapBuilder<String, Object>()
|
||||
.put("projectSn", projectSn)
|
||||
.build());
|
||||
List<String> dateList = DateUtils.getDateTimeStrList(60, "yyyy-MM-dd");
|
||||
for (String date : dateList) {
|
||||
List<WorkerNumAndRegionName> list = new ArrayList<>();
|
||||
for (String regionName : regionNameSet) {
|
||||
List<WorkerNumAndRegionName> workerNumAndRegionNames = dateMap.get(date);
|
||||
Map<String, WorkerNumAndRegionName> regionNameMap = Optional.ofNullable(workerNumAndRegionNames).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(WorkerNumAndRegionName::getRegionName, Function.identity(), (oldValue, newValue) -> oldValue));
|
||||
WorkerNumAndRegionName workerNumAndRegionName = regionNameMap.get(regionName);
|
||||
if (workerNumAndRegionName == null) {
|
||||
workerNumAndRegionName = new WorkerNumAndRegionName();
|
||||
workerNumAndRegionName.setWorkerNum(0);
|
||||
workerNumAndRegionName.setDate(date);
|
||||
workerNumAndRegionName.setRegionName(regionName);
|
||||
}
|
||||
for (SafetyHatFence region : regions) {
|
||||
List<SafetyHatData> datas1 = datas.stream().filter(safetyHatData -> DateUtil.compare(safetyHatData.getUploadTime(), DateUtil.beginOfDay(DateUtil.parse(date))) >= 0
|
||||
&& DateUtil.compare(safetyHatData.getUploadTime(), DateUtil.endOfDay(DateUtil.parse(date))) <= 0).collect(Collectors.toList());
|
||||
int workerNum = getWorkerNumInFence(region, datas1);
|
||||
WorkerNumAndRegionName workerNumAndRegionName = new WorkerNumAndRegionName();
|
||||
workerNumAndRegionName.setWorkerNum(workerNum);
|
||||
workerNumAndRegionName.setDate(date);
|
||||
workerNumAndRegionName.setRegionName(region.getRegionName());
|
||||
list.add(workerNumAndRegionName);
|
||||
}
|
||||
WorkerNumByRegionVo oneVo = new WorkerNumByRegionVo();
|
||||
@ -298,8 +294,41 @@ public class SafetyHatDataServiceImpl extends ServiceImpl<SafetyHatDataMapper, S
|
||||
oneVo.setList(list);
|
||||
vos.add(oneVo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
private int getWorkerNumInFence(SafetyHatFence fence, List<SafetyHatData> datas) {
|
||||
int workerNum = 0;
|
||||
Set<Long> inWorkerSet = new HashSet<>();
|
||||
for (SafetyHatData d : datas) {
|
||||
boolean inFence = false;
|
||||
//判断是否在围栏范围内
|
||||
if (Objects.equals(fence.getRangeType(), 1)) {
|
||||
inFence = RegionUtil.isInCircle(d.getLongitude(), d.getLatitude(), fence.getLongitude(), fence.getLatitude(), fence.getAreaRadius());
|
||||
} else if (Objects.equals(fence.getRangeType(), 2)) {
|
||||
String fenceShape = fence.getFenceShape();
|
||||
if (StrUtil.isNotBlank(fenceShape)) {
|
||||
String[] couples = StringUtils.split(fenceShape, ",");
|
||||
Double[] lon = new Double[couples.length];
|
||||
Double[] lat = new Double[couples.length];
|
||||
for (int i = 0; i < couples.length; i++) {
|
||||
String couple = couples[i];
|
||||
String[] two = StringUtils.split(couple, "|");
|
||||
lon[i] = Double.valueOf(two[0]);
|
||||
lat[i] = Double.valueOf(two[1]);
|
||||
}
|
||||
inFence = RegionUtil.isInPolygon(d.getLongitude(), d.getLatitude(), lon, lat);
|
||||
}
|
||||
}
|
||||
if (inFence) {
|
||||
if (inWorkerSet.add(d.getWorkerInfoId())) {
|
||||
workerNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return workerNum;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,93 +0,0 @@
|
||||
package com.zhgd.xmgl.modules.safetyhat.service.impl;
|
||||
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.safetyhat.entity.SafetyHatDataToFence;
|
||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataToFenceService;
|
||||
import com.zhgd.xmgl.modules.safetyhat.mapper.SafetyHatDataToFenceMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 智能安全帽-实时数据-围栏中间表
|
||||
* @author: pds
|
||||
* @date: 2024-06-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SafetyHatDataToFenceServiceImpl extends ServiceImpl<SafetyHatDataToFenceMapper, SafetyHatDataToFence> implements ISafetyHatDataToFenceService {
|
||||
@Autowired
|
||||
private SafetyHatDataToFenceMapper safetyHatDataToFenceMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SafetyHatDataToFence> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<SafetyHatDataToFence> queryWrapper = getQueryWrapper(param);
|
||||
Page<SafetyHatDataToFence> page = PageUtil.getPage(param);
|
||||
IPage<SafetyHatDataToFence> pageList = this.page(page, queryWrapper);
|
||||
pageList.setRecords(dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SafetyHatDataToFence> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<SafetyHatDataToFence> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(this.list(queryWrapper));
|
||||
}
|
||||
|
||||
private QueryWrapper<SafetyHatDataToFence> getQueryWrapper(HashMap<String, Object> param) {
|
||||
String alias = "";
|
||||
QueryWrapper<SafetyHatDataToFence> queryWrapper = QueryGenerator.initPageQueryWrapper(SafetyHatDataToFence.class, param, alias);
|
||||
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(SafetyHatDataToFence::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<SafetyHatDataToFence> dealList(List<SafetyHatDataToFence> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SafetyHatDataToFence safetyHatDataToFence) {
|
||||
safetyHatDataToFence.setId(null);
|
||||
baseMapper.insert(safetyHatDataToFence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SafetyHatDataToFence safetyHatDataToFence) {
|
||||
SafetyHatDataToFence oldSafetyHatDataToFence = baseMapper.selectById(safetyHatDataToFence.getId());
|
||||
if (oldSafetyHatDataToFence == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(safetyHatDataToFence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
SafetyHatDataToFence safetyHatDataToFence = baseMapper.selectById(id);
|
||||
if (safetyHatDataToFence == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SafetyHatDataToFence queryById(String id) {
|
||||
SafetyHatDataToFence entity = getById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class SafetyHatFenceServiceImpl extends ServiceImpl<SafetyHatFenceMapper,
|
||||
private List<SafetyHatFence> dealList(List<SafetyHatFence> list, HashMap<String, Object> paramMap) {
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<SafetyHatData> dataList = safetyHatDataMapper.getNewestDataGroupByDevSn(projectSn);
|
||||
List<SafetyHatData> dataList = safetyHatDataMapper.getNewestDataGroupByProjectSn(projectSn);
|
||||
for (SafetyHatFence fence : list) {
|
||||
ArrayList<WorkerInfo> workerInfos = new ArrayList<>();
|
||||
int workerNum = 0;
|
||||
|
||||
@ -302,5 +302,4 @@ public class AiAnalyseHardWareAlarmRecordController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -181,5 +181,8 @@ public class AiAnalyseHardWareAlarmRecord implements Serializable {
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "AI扣分规则")
|
||||
private XzAiDeductRule aiDeductRule;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "项目子账号是否可以处置")
|
||||
private Boolean isEnableHandle;
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,9 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface AiAnalyseHardWareRecordMapper extends BaseMapper<AiAnalyseHardWareRecord> {
|
||||
|
||||
List<String> getAiAnalyseHardIdsByUserId(Long userId);
|
||||
List<String> getSeeAiAnalyseHardIdsByUserId(Long userId);
|
||||
|
||||
List<String> getHandleAiAnalyseHardIdsByUserId(Long userId);
|
||||
|
||||
List<String> getAiAnalyseHardIdsByEnterpriseId(Long enterpriseId);
|
||||
|
||||
|
||||
@ -1,7 +1,16 @@
|
||||
<?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.zhgd.xmgl.modules.video.mapper.AiAnalyseHardWareRecordMapper">
|
||||
<select id="getAiAnalyseHardIdsByUserId" resultType="java.lang.String">
|
||||
<select id="getSeeAiAnalyseHardIdsByUserId" resultType="java.lang.String">
|
||||
select distinct aahwr.hardware_id
|
||||
from ai_analyse_hard_ware_record aahwr
|
||||
join quality_region_to_ai_analyse_hard qrtaah on aahwr.id = qrtaah.ai_analyse_hard_ware_record_id
|
||||
join quality_region_to_enterprise qrte on qrte.quality_region_id = qrtaah.quality_region_id
|
||||
join worker_info wi on wi.enterprise_id = qrte.enterprise_id
|
||||
join system_user su on su.worker_id = wi.id
|
||||
where su.user_id = #{userId}
|
||||
</select>
|
||||
<select id="getHandleAiAnalyseHardIdsByUserId" resultType="java.lang.String">
|
||||
select distinct aahwr.hardware_id
|
||||
from ai_analyse_hard_ware_record aahwr
|
||||
join quality_region_to_ai_analyse_hard qrtaah on aahwr.id = qrtaah.ai_analyse_hard_ware_record_id
|
||||
|
||||
@ -64,4 +64,5 @@ public interface IAiAnalyseHardWareAlarmRecordService extends IService<AiAnalyse
|
||||
BigDecimal getScore(String projectSn, Date time);
|
||||
|
||||
void setFalsePositive(AiAnalyseHardWareAlarmRecord taskProgressMaterialRel);
|
||||
|
||||
}
|
||||
|
||||
@ -141,6 +141,17 @@ public class AiAnalyseHardWareAlarmRecordServiceImpl extends ServiceImpl<AiAnaly
|
||||
record.setAiDeductRule(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//项目子账号是否可以处置
|
||||
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getAccountType() == 6) {
|
||||
Long userId = SecurityUtils.getUser().getUserId();
|
||||
List<String> handleAiAnalyseHardIds = aiAnalyseHardWareRecordMapper.getHandleAiAnalyseHardIdsByUserId(userId);
|
||||
for (AiAnalyseHardWareAlarmRecord record : aiAnalyseHardWareAlarmRecords) {
|
||||
record.setIsEnableHandle(true);
|
||||
record.setIsEnableHandle(handleAiAnalyseHardIds.contains(record.getHardwareId()));
|
||||
}
|
||||
}
|
||||
return page.setRecords(aiAnalyseHardWareAlarmRecords);
|
||||
}
|
||||
|
||||
@ -601,7 +612,7 @@ public class AiAnalyseHardWareAlarmRecordServiceImpl extends ServiceImpl<AiAnaly
|
||||
ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(record.getProjectSn());
|
||||
String relativePath = projectInfoBySn.getProjectName() + "/AI预警列表/" + DateUtil.today();
|
||||
String dir = PathUtil.getBasePath() + "/" + relativePath;
|
||||
FileUtil.copy(PathUtil.getBasePath() + "/" + record.getImageUrl(), dir + "/" + FileUtil.getName(record.getImageUrl()), true);
|
||||
FileUtil.copy(PathUtil.getBasePath() + "/" + record.getImageUrl(), dir + "/" + FileUtil.getName(record.getImageUrl()), true);
|
||||
FileUtil.copy(PathUtil.getBasePath() + "/" + record.getAlarmVideo(), dir + "/" + FileUtil.getName(record.getAlarmVideo()), true);
|
||||
baseMapper.updateById(record);
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ public class AiAnalyseHardWareRecordServiceImpl extends ServiceImpl<AiAnalyseHar
|
||||
|
||||
@Override
|
||||
public List<String> getAiAnalyseHardIdsByUserId(Long userId) {
|
||||
return baseMapper.getAiAnalyseHardIdsByUserId(userId);
|
||||
return baseMapper.getSeeAiAnalyseHardIdsByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -30,8 +30,7 @@
|
||||
or (TIMESTAMPDIFF(HOUR, a.nad_time, now()) >= 168 and a.worker_classify = 1)) then '核酸已超时'
|
||||
else '核酸未超时' end) as acid_status_name,
|
||||
wt.type_name,
|
||||
if(wap.id is not null,1,2) presence,
|
||||
su.user_id as noticeUserId
|
||||
if(wap.id is not null,1,2) presence
|
||||
from worker_info a
|
||||
LEFT JOIN team_info b ON a.team_id = b.id
|
||||
LEFT JOIN department_info c ON a.department_id = c.id
|
||||
@ -40,7 +39,6 @@
|
||||
LEFT JOIN dictionaries_record e ON a.job_name = e.id
|
||||
LEFT JOIN enterprise_info en ON en.id = a.enterprise_id
|
||||
LEFT JOIN worker_attendance_presence wap ON wap.person_sn = a.person_sn
|
||||
left join system_user su on su.worker_id = a.id
|
||||
<if test="param.attendance == '1'.toString()">
|
||||
join (select * from worker_attendance where
|
||||
1=1
|
||||
@ -50,12 +48,6 @@
|
||||
and create_time>=current_date group by person_sn ) wa on wa.person_sn = a.person_sn
|
||||
</if>
|
||||
WHERE 1 = 1
|
||||
<if test="param.userIdList != null and param.userIdList.size() != 0">
|
||||
and su.user_id in
|
||||
<foreach collection="param.userIdList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.id != null and param.id != ''">
|
||||
and a.id = #{param.id}
|
||||
</if>
|
||||
|
||||
@ -62,7 +62,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -611,9 +610,9 @@ public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper,
|
||||
List<WorkerAttendance> workerAttendances = workerAttendanceService.selectWorkerAttendanceList(map);
|
||||
int highNum = 0;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
DateTime nextDate = DateUtil.offsetDay(DateUtil.parse(beginOfWeek), 1);
|
||||
List<WorkerAttendance> oneDayWas = workerAttendances.stream().filter(workerAttendance -> DateUtil.parse(workerAttendance.getCreateTime()).compareTo(nextDate) < 0
|
||||
&& DateUtil.parse(beginOfWeek).compareTo(DateUtil.parse(workerAttendance.getCreateTime())) <= 0).collect(Collectors.toList());
|
||||
DateTime day = DateUtil.offsetDay(DateUtil.parse(beginOfWeek), i);
|
||||
List<WorkerAttendance> oneDayWas = workerAttendances.stream().filter(workerAttendance -> DateUtil.parse(workerAttendance.getCreateTime()).compareTo(DateUtil.offsetDay(day, 1)) < 0
|
||||
&& day.compareTo(DateUtil.parse(workerAttendance.getCreateTime())) <= 0).collect(Collectors.toList());
|
||||
Set<String> inSet = new HashSet<>();
|
||||
int hn = 0;
|
||||
for (WorkerAttendance attendance : oneDayWas) {
|
||||
|
||||
@ -221,6 +221,7 @@ public class XzRiskPredictionController {
|
||||
List<XzSecurityQualityInspectionRecord> inspectionRecords = xzSecurityQualityInspectionRecordService.list(new LambdaQueryWrapper<XzSecurityQualityInspectionRecord>()
|
||||
.ne(XzSecurityQualityInspectionRecord::getStatus, 6)
|
||||
.in(XzSecurityQualityInspectionRecord::getProjectSn, projectSn)
|
||||
.eq(XzSecurityQualityInspectionRecord::getRecordType, 1)
|
||||
);
|
||||
Double severeWeatherRate = this.getSevereWeatherRate(project);
|
||||
Date date = new Date();
|
||||
@ -262,7 +263,7 @@ public class XzRiskPredictionController {
|
||||
}
|
||||
}
|
||||
for (EnterpriseInfo mainEnterprise : mainEnterprises) {
|
||||
List<Long> enterpriseIds = enterpriseInfos.stream().filter(enterpriseInfo -> enterpriseInfo.getAncestors().contains(mainEnterprise.getParentProjectEnterpriseId() + "")).map(EnterpriseInfo::getId).collect(Collectors.toList());
|
||||
List<Long> enterpriseIds = enterpriseInfos.stream().filter(enterpriseInfo -> enterpriseInfo.getAncestors().contains(mainEnterprise.getProjectEnterpriseId() + "")).map(EnterpriseInfo::getId).collect(Collectors.toList());
|
||||
enterpriseIds.add(mainEnterprise.getId());
|
||||
List<String> hardwareIds = enterpriseIdAndAiAnalyseHardIds.stream().filter(j -> enterpriseIds.contains(j.getLong("enterpriseId"))).map(j -> j.getString("hardwareId")).collect(Collectors.toList());
|
||||
|
||||
@ -440,14 +441,15 @@ public class XzRiskPredictionController {
|
||||
ProjectInfoExtVo project = projectService.getProjectInfoBySn(projectSn);
|
||||
List<XzSecurityQualityInspectionRecord> inspectionRecords = xzSecurityQualityInspectionRecordService.list(new LambdaQueryWrapper<XzSecurityQualityInspectionRecord>()
|
||||
.ne(XzSecurityQualityInspectionRecord::getStatus, 6)
|
||||
.eq(XzSecurityQualityInspectionRecord::getRecordType, 1)
|
||||
.in(XzSecurityQualityInspectionRecord::getProjectSn, projectSn)
|
||||
);
|
||||
Double severeWeatherRate = this.getSevereWeatherRate(project);
|
||||
RiskTrendByMainEnterpriseVo o = new RiskTrendByMainEnterpriseVo();
|
||||
o.setSevereWeatherRate(severeWeatherRate);
|
||||
o.setTotalPersonnelRiskRate(0.0D);
|
||||
long specialNotCount = inspectionRecords.stream().filter(r -> r.getStatus() != 6 && r.getStatus() != 5 && r.getType() != null).count();
|
||||
long specialCount = inspectionRecords.stream().filter(r -> r.getStatus() != 6 && r.getType() != null).count();
|
||||
long specialNotCount = inspectionRecords.stream().filter(r -> r.getStatus() != 6 && r.getStatus() != 5).count();
|
||||
long specialCount = inspectionRecords.stream().filter(r -> r.getStatus() != 6).count();
|
||||
o.setTotalSpecialOperationsRiskRate(NumberUtils.div(specialNotCount, specialCount, 2));
|
||||
JSONObject ssJo = BeanUtil.toBean(securityQualityInspectionRecordController.getStatScore(projectSn), JSONObject.class);
|
||||
o.setMonthlySafetyScoreRate(NumberUtils.div(ssJo.getDouble("total"), 100D, 2));
|
||||
|
||||
@ -9,6 +9,8 @@ public class CountTaskProgressVo {
|
||||
private Double projectTotalProgress;
|
||||
@ApiModelProperty("承包商总进度%")
|
||||
private Double enterpriseTotalProgress;
|
||||
@ApiModelProperty("承包商剩余天数")
|
||||
private Integer enterpriseSurplusDayNum;
|
||||
@ApiModelProperty("项目总天数")
|
||||
private Integer projectTotalDayNum;
|
||||
@ApiModelProperty("项目剩余天数")
|
||||
|
||||
@ -42,4 +42,5 @@ public interface XzTaskProgressMapper extends BaseMapper<XzTaskProgress> {
|
||||
CountTaskProgressVo getMaxMinProgress(HashMap<String, Object> paramMap);
|
||||
|
||||
List<XzTaskProgress> statsByEnterprise(Map<String, Object> paramMap);
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.zhgd.xmgl.modules.xz.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zhgd.xmgl.modules.xz.entity.vo.CountEnterpriseVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzTaskProgressTotal;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -21,4 +23,5 @@ public interface XzTaskProgressTotalMapper extends BaseMapper<XzTaskProgressTota
|
||||
void updateNotCurrent(XzTaskProgressTotal xzTaskProgressTotal);
|
||||
|
||||
List<CountEnterpriseVo> countEnterprise(@Param("param") Map<String, Object> param);
|
||||
|
||||
}
|
||||
|
||||
@ -180,6 +180,12 @@
|
||||
AND (p.enterprise_id = #{supplierEnterpriseId} OR p.enterprise_id IN ( SELECT t.id FROM project_enterprise t
|
||||
WHERE find_in_set(#{supplierEnterpriseId}, ancestors) ))
|
||||
</if>
|
||||
<if test="enterpriseId != null and enterpriseId != ''">
|
||||
AND (p.enterprise_id = #{enterpriseId} OR p.enterprise_id IN ( SELECT t.enterprise_id FROM
|
||||
project_enterprise t
|
||||
WHERE find_in_set((select id from project_enterprise where project_sn=#{projectSn} and enterprise_id =
|
||||
#{enterpriseId}), ancestors) ))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="statsByEnterprise" resultType="com.zhgd.xmgl.modules.xz.entity.XzTaskProgress">
|
||||
|
||||
@ -25,7 +25,6 @@ import com.zhgd.xmgl.modules.xz.service.IXzDangerousEngineeringAcceptanceService
|
||||
import com.zhgd.xmgl.modules.xz.special.service.*;
|
||||
import com.zhgd.xmgl.modules.xz.special.service.impl.XzSpecialOperationFireSafetyServiceImpl;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.MapUtil;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -124,7 +123,7 @@ public class XzDangerousEngineeringAcceptanceServiceImpl extends ServiceImpl<XzD
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("userId", userId);
|
||||
map.put("projectSn", xzDangerousEngineeringAcceptance.getProjectSn());
|
||||
List<SystemUser> userList = systemUserService.getProjectChilderSystemUserList(map);
|
||||
List<SystemUser> userList = systemUserService.getProjectChildernSystemUserList(map);
|
||||
if (CollUtil.isNotEmpty(userList)) {
|
||||
xzDangerousEngineeringAcceptance.setApplyAcceptanceUnitId(userList.get(0).getEnterpriseId());
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ public class XzRegistryServiceImpl extends ServiceImpl<XzRegistryMapper, XzRegis
|
||||
}
|
||||
email = xzRegistry.getEmail();
|
||||
} else if (su.getAccountType() == 6) {
|
||||
List<SystemUser> users = systemUserService.getProjectChilderSystemUserList(new MapBuilder<String, Object>().put("projectSn", su.getSn()).put("userId", su.getUserId()).build());
|
||||
List<SystemUser> users = systemUserService.getProjectChildernSystemUserList(new MapBuilder<String, Object>().put("projectSn", su.getSn()).put("userId", su.getUserId()).build());
|
||||
if (CollUtil.isEmpty(users)) {
|
||||
throw new OpenAlertException("项目子账号不存在");
|
||||
}
|
||||
|
||||
@ -92,6 +92,8 @@ public class XzTaskProgressServiceImpl extends ServiceImpl<XzTaskProgressMapper,
|
||||
@Autowired
|
||||
XzMilestoneMapper xzMilestoneMapper;
|
||||
@Autowired
|
||||
XzTaskProgressMapper xzTaskProgressMapper;
|
||||
@Autowired
|
||||
private QualityRegionMapper qualityRegionMapper;
|
||||
@Autowired
|
||||
private XzSupplierQualificationApplyServiceImpl xzSupplierQualificationApplyService;
|
||||
@ -570,6 +572,9 @@ public class XzTaskProgressServiceImpl extends ServiceImpl<XzTaskProgressMapper,
|
||||
} else {
|
||||
vo.setEnterpriseTotalProgress(0D);
|
||||
}
|
||||
CountTaskProgressVo surplusDayNum = xzTaskProgressMapper.getMaxMinProgress(paramMap);
|
||||
vo.setEnterpriseSurplusDayNum(surplusDayNum.getProjectSurplusDayNum());
|
||||
paramMap.put("enterpriseId", null);
|
||||
CountTaskProgressVo vo1 = baseMapper.getMaxMinProgress(paramMap);
|
||||
vo.setProjectTotalDayNum(vo1.getProjectTotalDayNum());
|
||||
vo.setProjectSurplusDayNum(vo1.getProjectSurplusDayNum());
|
||||
|
||||
@ -7,7 +7,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
|
||||
@ -15,6 +14,7 @@ import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemLogoConfigMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.dangerous.entity.HiddenDangerInspectRecord;
|
||||
import com.zhgd.xmgl.modules.dangerous.service.IHiddenDangerInspectRecordService;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
@ -50,7 +50,6 @@ import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchConfigService;
|
||||
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchManagerService;
|
||||
import com.zhgd.xmgl.modules.xz.service.impl.XzCertificateExpireAlarmRecordServiceImpl;
|
||||
import com.zhgd.xmgl.util.ElecardUtil;
|
||||
import com.zhgd.xmgl.util.MapBuilder;
|
||||
import com.zhgd.xmgl.util.NumberUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
@ -80,6 +79,8 @@ public class WorkerTask {
|
||||
@Autowired
|
||||
WorkerInfoServiceImpl workerInfoService;
|
||||
@Autowired
|
||||
ISystemUserService systemUserService;
|
||||
@Autowired
|
||||
private ProjectExternalSystemServiceMapper projectExternalSystemServiceMapper;
|
||||
@Autowired
|
||||
private WorkerInfoMapper workerInfoMapper;
|
||||
@ -289,7 +290,6 @@ public class WorkerTask {
|
||||
log.info("开始执行对人员未履职情况进行监测");
|
||||
String[] typeName = {"人员日常考勤", "每个项目自检任务", "一个月内缺勤超过", "一个月内迟到超过"};
|
||||
List<Project> projects = projectMapper.selectList(Wrappers.<Project>lambdaQuery().eq(Project::getStatus, 2));
|
||||
int day = DateUtil.dayOfMonth(new Date());
|
||||
for (Project project : projects) {
|
||||
if (project.getEnableWorkerSafeWatch() != null && project.getEnableWorkerSafeWatch() == 1) {
|
||||
List<XzWorkerSafeWatchConfig> list = xzWorkerSafeWatchConfigService.list(Wrappers.<XzWorkerSafeWatchConfig>lambdaQuery()
|
||||
@ -551,17 +551,24 @@ public class WorkerTask {
|
||||
}
|
||||
Set<Long> userIdSet = alarmList.stream().map(XzWorkerSafeWatchAlarm::getUserId).collect(Collectors.toSet());
|
||||
if (CollUtil.isNotEmpty(userIdSet)) {
|
||||
IPage<WorkerInfo> workerInfoList = workerInfoService.selectWorkerInfoList(new MapBuilder<String, Object>().put("userIdList", userIdSet).build());
|
||||
List<WorkerInfo> workerInfoListRecords = workerInfoList.getRecords();
|
||||
Map<Long, WorkerInfo> userIdMap = workerInfoListRecords.stream().collect(Collectors.toMap(WorkerInfo::getNoticeUserId, Function.identity(), (workerInfo, workerInfo2) -> workerInfo));
|
||||
List<SystemUser> users = systemUserService.list(new LambdaQueryWrapper<SystemUser>().in(SystemUser::getUserId, userIdSet));
|
||||
Map<Long, List<SystemUser>> userIdMap = users.stream().collect(Collectors.groupingBy(SystemUser::getUserId));
|
||||
Set<Long> workerIds = users.stream().map(SystemUser::getWorkerId).collect(Collectors.toSet());
|
||||
List<WorkerInfo> workerInfoList = new ArrayList<>(workerInfoService.list(new LambdaQueryWrapper<WorkerInfo>().in(WorkerInfo::getId, workerIds)));
|
||||
Map<Long, WorkerInfo> workerIdMap = workerInfoList.stream().collect(Collectors.toMap(WorkerInfo::getId, workerInfo -> workerInfo));
|
||||
for (XzWorkerSafeWatchAlarm alarm : alarmList) {
|
||||
WorkerInfo workerInfo = userIdMap.get(alarm.getUserId());
|
||||
if (workerInfo != null) {
|
||||
alarm.setWorkerId(workerInfo.getId());
|
||||
alarm.setWorkerName(workerInfo.getWorkerName());
|
||||
alarm.setEnterpriseId(workerInfo.getEnterpriseId());
|
||||
alarm.setEnterpriseName(workerInfo.getEnterpriseName());
|
||||
alarm.setDeptName(Objects.equals(workerInfo.getPersonType(), 1) ? workerInfo.getTeamName() : workerInfo.getDepartmentName());
|
||||
List<SystemUser> userList = userIdMap.get(alarm.getUserId());
|
||||
if (CollUtil.isNotEmpty(userList)) {
|
||||
for (SystemUser su : userList) {
|
||||
WorkerInfo workerInfo = workerIdMap.get(su.getWorkerId());
|
||||
if (workerInfo != null) {
|
||||
alarm.setWorkerId(workerInfo.getId());
|
||||
alarm.setWorkerName(workerInfo.getWorkerName());
|
||||
alarm.setEnterpriseId(workerInfo.getEnterpriseId());
|
||||
alarm.setEnterpriseName(workerInfo.getEnterpriseName());
|
||||
alarm.setDeptName(Objects.equals(workerInfo.getPersonType(), 1) ? workerInfo.getTeamName() : workerInfo.getDepartmentName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ sj.business.gateway.url=http://116.169.63.183:30867/
|
||||
#\u4E09\u6C5F\u4E1A\u52A1\u4E2D\u53F0\u7F51\u5173\u5730\u5740\u7684\u8C03\u7528\u51ED\u8BC1
|
||||
sj.business.gateway.api.key=nDmkHCxlQzCqE-xfYteXMw
|
||||
#\u4E09\u6C5F\u56FE\u7247\u8BBF\u95EE\u8DEF\u5F84\uFF08\u7528\u4E8E\u63A8\u9001\u4E1A\u52A1\u4E2D\u53F0\uFF09
|
||||
sj.upload.image.url.prefix=http://192.168.34.221:11111/image/
|
||||
sj.upload.image.url.prefix=http://182.90.224.237:51234/image/
|
||||
active.environment.name=gsx-other-env-show-dev
|
||||
#携稳扬尘
|
||||
xiwon.postEnvironmentDustData=http://openapi.xiwon588.com/dust/realTimeData
|
||||
@ -97,6 +97,6 @@ magic-api.web=/xmgl/magic/web
|
||||
#配置文件存储位置。当以classpath开头时,为只读模式
|
||||
magic-api.resource.location=C:/jxj/prod/backEnd/itbgpImage/data/magic-api
|
||||
#上传的图片的url前缀
|
||||
upload.image.url.prefix=http://192.168.34.221:11111/image/
|
||||
upload.image.url.prefix=http://182.90.224.237:51234/image/
|
||||
#内网的服务图片的url前缀
|
||||
xingzong.inner.upload.image.url.prefix=http://10.168.2.104:9809/image/
|
||||
|
||||
@ -73,4 +73,3 @@ spring.datasource.db2.jdbc-url=jdbc:mysql://127.0.0.1:3306/wflow_pro?useUnicode=
|
||||
spring.datasource.db2.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.db2.username=root
|
||||
spring.datasource.db2.password=JXJ@admin
|
||||
xingzongIscIpPort=https://10.168.1.100:6113/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user