工作票bug修复和批量人员绑定设备
This commit is contained in:
parent
41b81aa2dd
commit
3a12d05af0
@ -257,4 +257,37 @@ public class AsyncWorker {
|
||||
log.error("error:", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量人员绑定设备
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
@Async("doubleCarbonExecutor")
|
||||
public void batchBindDevForWorkers(List<WorkerInfo> workerList, Long userId) {
|
||||
try {
|
||||
for (WorkerInfo info : workerList) {
|
||||
try {
|
||||
workerInfoService.editWorkerInfo(info);
|
||||
} catch (Exception e) {
|
||||
log.error("批量人员绑定设备异常,人员名称:{}", info.getWorkerName() + "," + e.getMessage());
|
||||
log.error("error:", e);
|
||||
}
|
||||
}
|
||||
if (userId != null) {
|
||||
java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Notice notice = new Notice();
|
||||
notice.setAccountId(userId);
|
||||
notice.setMsg("已经完成批量人员绑定设备" + workerList.size() + "个人");
|
||||
notice.setTitle("批量人员绑定设备提醒");
|
||||
notice.setSendTime(format1.format(new Date()));
|
||||
notice.setType("1");
|
||||
noticeService.addNotice(notice, true);
|
||||
}
|
||||
log.info("--------------------------------批量人员绑定设备执行完成-------------------------------");
|
||||
} catch (Exception e) {
|
||||
log.error("error:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,10 +61,17 @@ public class Mcs8Call implements PoliceCameraManufacturer {
|
||||
if (CollUtil.isEmpty(ticket.getItemList())) {
|
||||
throw new OpenAlertException("请先绑定设备");
|
||||
}
|
||||
Mcs8Util.addTask(config, StrUtil.format("{}-{}-{}", ticket.getConstructionAreaNames(), ticket.getWorkTicketNumber(), "第" + no + "次作业"), workNo);
|
||||
String taskId = Mcs8Util.getTaskIdByWorkNo(config, workNo);
|
||||
Mcs8Util.updateTaskDest(config, ticket.getItemList(), taskId);
|
||||
Mcs8Util.updateTaskStatus(config, 0, taskId);
|
||||
try {
|
||||
Mcs8Util.addTask(config, StrUtil.format("{}-{}-{}", ticket.getConstructionAreaNames(), ticket.getWorkTicketNumber(), "第" + no + "次作业"), workNo);
|
||||
String taskId = Mcs8Util.getTaskIdByWorkNo(config, workNo);
|
||||
Mcs8Util.updateTaskDest(config, ticket.getItemList(), taskId);
|
||||
Mcs8Util.updateTaskStatus(config, 0, taskId);
|
||||
} catch (OpenAlertException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("err", e);
|
||||
throw new OpenAlertException("开启设备录像失败,请检查调度台服务器配置");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -72,8 +79,15 @@ public class Mcs8Call implements PoliceCameraManufacturer {
|
||||
if (CollUtil.isEmpty(ticket.getItemList())) {
|
||||
throw new OpenAlertException("请先绑定设备");
|
||||
}
|
||||
String taskId = Mcs8Util.getTaskIdByWorkNo(config, workNo);
|
||||
Mcs8Util.updateTaskStatus(config, 2, taskId);
|
||||
try {
|
||||
String taskId = Mcs8Util.getTaskIdByWorkNo(config, workNo);
|
||||
Mcs8Util.updateTaskStatus(config, 2, taskId);
|
||||
} catch (OpenAlertException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("err", e);
|
||||
throw new OpenAlertException("关闭设备录像失败,请检查调度台服务器配置");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +119,7 @@ public class Mcs8Call implements PoliceCameraManufacturer {
|
||||
WorkTicketHistory history = workTicketHistoryService.getById(bo.getWorkNo());
|
||||
if (item != null) {
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
headers.put("token", Mcs8Util.getToken(config.getIp(), config.getPort(), config.getAccount(), config.getPassword()));
|
||||
headers.put("token", Mcs8Util.getToken(Mcs8Util.getHost(config), config.getPort(), config.getAccount(), config.getPassword()));
|
||||
File downloadFile = HttpUtils.downloadFile(signedUrl.getPubUrl(), PathUtil.getBasePath(), headers);
|
||||
if (downloadFile != null) {
|
||||
PoliceCameraItemFile file = new PoliceCameraItemFile();
|
||||
@ -159,4 +173,6 @@ public class Mcs8Call implements PoliceCameraManufacturer {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -67,13 +67,13 @@ public class Mcs8Util {
|
||||
*/
|
||||
public static void updateTaskDest(ProjectPoliceCameraConfig config, List<PoliceCameraItem> itemList, String taskId) {
|
||||
for (PoliceCameraItem item : itemList) {
|
||||
String url = config.getIp() + ":" + config.getPort() + "/api/v1/TaskUpdateDest";
|
||||
String url = getHost(config) + ":" + config.getPort() + "/api/v1/TaskUpdateDest";
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("id", taskId);
|
||||
jo.put("destDevId", item.getDevSn());
|
||||
url = HttpUtil.urlWithForm(url, jo, CharsetUtil.CHARSET_UTF_8, false);
|
||||
log.info("mcs8 更新工单执行设置(派发) url:{}", url);
|
||||
String result = HttpRequest.get(url).header("token", getToken(config.getIp(), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
String result = HttpRequest.get(url).header("token", getToken(getHost(config), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
|
||||
log.info("mcs8 更新工单执行设置(派发) result:{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
@ -85,6 +85,16 @@ public class Mcs8Util {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接host
|
||||
*
|
||||
* @param config
|
||||
* @return
|
||||
*/
|
||||
public static String getHost(ProjectPoliceCameraConfig config) {
|
||||
return (Objects.equals(config.getHttpType(), 1) ? "http" : "https") + "://" + config.getIp();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过工单号获取工单id
|
||||
*
|
||||
@ -92,14 +102,14 @@ public class Mcs8Util {
|
||||
* @param workNo
|
||||
*/
|
||||
public static String getTaskIdByWorkNo(ProjectPoliceCameraConfig config, String workNo) {
|
||||
String url = config.getIp() + ":" + config.getPort() + "/api/v1/TaskList";
|
||||
String url = getHost(config) + ":" + config.getPort() + "/api/v1/TaskList";
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("st", "2022-01-01");
|
||||
jo.put("et", DateUtil.formatDateTime(DateUtil.offsetDay(new Date(), 1)));
|
||||
jo.put("workNo", workNo);
|
||||
url = HttpUtil.urlWithForm(url, jo, CharsetUtil.CHARSET_UTF_8, false);
|
||||
log.info("mcs8 获取工单列表 url:{}", url);
|
||||
String result = HttpRequest.get(url).header("token", getToken(config.getIp(), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
String result = HttpRequest.get(url).header("token", getToken(getHost(config), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
|
||||
log.info("mcs8 获取工单列表 result:{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
@ -122,7 +132,7 @@ public class Mcs8Util {
|
||||
* @param workNo
|
||||
*/
|
||||
public static void addTask(ProjectPoliceCameraConfig config, String title, String workNo) {
|
||||
String url = config.getIp() + ":" + config.getPort() + "/api/v1/TaskAdd";
|
||||
String url = getHost(config) + ":" + config.getPort() + "/api/v1/TaskAdd";
|
||||
JSONObject bodyJo = new JSONObject();
|
||||
bodyJo.put("workNo", workNo);
|
||||
bodyJo.put("title", title);
|
||||
@ -131,7 +141,7 @@ public class Mcs8Util {
|
||||
bodyJo.put("custome", null);
|
||||
String body = bodyJo.toString();
|
||||
log.info("mcs8 添加工单 url:{} , body:{}", url, body);
|
||||
String result = HttpRequest.post(url).header("token", getToken(config.getIp(), config.getPort(), config.getAccount(), config.getPassword())).body(body).execute().body();
|
||||
String result = HttpRequest.post(url).header("token", getToken(getHost(config), config.getPort(), config.getAccount(), config.getPassword())).body(body).execute().body();
|
||||
log.info("mcs8 添加工单 result:{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if (Objects.equals(jsonObject.getInteger("result"), 200) || Objects.equals(jsonObject.getInteger("error"), 200)) {
|
||||
@ -149,7 +159,7 @@ public class Mcs8Util {
|
||||
* @param taskId
|
||||
*/
|
||||
public static void updateTaskStatus(ProjectPoliceCameraConfig config, int status, String taskId) {
|
||||
String url = config.getIp() + ":" + config.getPort() + "/api/v1/TaskUpdateStatus";
|
||||
String url = getHost(config) + ":" + config.getPort() + "/api/v1/TaskUpdateStatus";
|
||||
JSONObject jo = new JSONObject();
|
||||
if (StrUtil.isBlank(taskId) && status == 2) {
|
||||
return;
|
||||
@ -158,7 +168,7 @@ public class Mcs8Util {
|
||||
jo.put("status", status);
|
||||
url = HttpUtil.urlWithForm(url, jo, CharsetUtil.CHARSET_UTF_8, false);
|
||||
log.info("mcs8 更新工单执行状态 url:{}", url);
|
||||
String result = HttpRequest.get(url).header("token", getToken(config.getIp(), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
String result = HttpRequest.get(url).header("token", getToken(getHost(config), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
|
||||
log.info("mcs8 更新工单执行状态 result:{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
@ -180,7 +190,7 @@ public class Mcs8Util {
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject getRecordFileList(ProjectPoliceCameraConfig config, Integer page, Integer pageSize, Date begin, Date end) {
|
||||
String url = config.getIp() + ":" + config.getPort() + "/api/v1/RecordFileList";
|
||||
String url = getHost(config) + ":" + config.getPort() + "/api/v1/RecordFileList";
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("st", DateUtil.formatDateTime(begin));
|
||||
jo.put("et", DateUtil.formatDateTime(end));
|
||||
@ -191,7 +201,7 @@ public class Mcs8Util {
|
||||
jo.put("pagesize", pageSize);
|
||||
url = HttpUtil.urlWithForm(url, jo, CharsetUtil.CHARSET_UTF_8, false);
|
||||
log.info("mcs8 查询文件列表 url:{}", url);
|
||||
String result = HttpRequest.get(url).header("token", getToken(config.getIp(), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
String result = HttpRequest.get(url).header("token", getToken(getHost(config), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
|
||||
log.info("mcs8 查询文件列表 result:{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
@ -210,13 +220,13 @@ public class Mcs8Util {
|
||||
* @return
|
||||
*/
|
||||
public static Mcs8FileSignedUrlBo getSignedUrl(ProjectPoliceCameraConfig config, String id) {
|
||||
String url = config.getIp() + ":" + config.getPort() + "/api/v1/oss/SignedUrl";
|
||||
String url = getHost(config) + ":" + config.getPort() + "/api/v1/oss/SignedUrl";
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("id", id);
|
||||
jo.put("expires", 7);
|
||||
url = HttpUtil.urlWithForm(url, jo, CharsetUtil.CHARSET_UTF_8, false);
|
||||
log.info("mcs8 获取文件网络访问地址 url:{}", url);
|
||||
String result = HttpRequest.get(url).header("token", getToken(config.getIp(), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
String result = HttpRequest.get(url).header("token", getToken(getHost(config), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
|
||||
log.info("mcs8 获取文件网络访问地址 result:{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
@ -236,13 +246,13 @@ public class Mcs8Util {
|
||||
* @return
|
||||
*/
|
||||
public static JSONArray getDevList(ProjectPoliceCameraConfig config, int page, int pageSize) {
|
||||
String url = config.getIp() + ":" + config.getPort() + "/api/v1/DevList";
|
||||
String url = getHost(config) + ":" + config.getPort() + "/api/v1/DevList";
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("page", page);
|
||||
jo.put("pageSize", pageSize);
|
||||
url = HttpUtil.urlWithForm(url, jo, CharsetUtil.CHARSET_UTF_8, false);
|
||||
log.info("mcs8 获取设备列表 url:{} ", url);
|
||||
String result = HttpRequest.get(url).header("token", getToken(config.getIp(), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
String result = HttpRequest.get(url).header("token", getToken(getHost(config), config.getPort(), config.getAccount(), config.getPassword())).execute().body();
|
||||
|
||||
log.info("mcs8 获取设备列表 result:{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
|
||||
@ -495,6 +495,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
if (systemUser != null && systemUser.getWorkerId() != null) {
|
||||
result.put("workerId", systemUser.getWorkerId().toString());
|
||||
WorkerInfo workerInfo = workerInfoMapper.selectById(systemUser.getWorkerId());
|
||||
result.put("enterpriseId", workerInfo.getEnterpriseId());
|
||||
result.put("workerNature", workerInfo == null ? null : workerInfo.getWorkerNature());
|
||||
} else {
|
||||
result.put("workerId", "");
|
||||
|
||||
@ -60,6 +60,7 @@ public class PoliceCameraItemController {
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "bindTicket", value = "1已绑定0空闲", paramType = "query", required = false, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "ticketId", value = "工作票id", paramType = "query", required = false, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<PoliceCameraItemVo>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
|
||||
@ -52,6 +52,7 @@ public class WorkTicketController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "numberOrContent", value = "工作票编号或内容", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<WorkTicketVo>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
|
||||
@ -87,4 +87,10 @@ public class ProjectPoliceCameraConfig implements Serializable {
|
||||
@Excel(name = "版本:1:v1;2:v2", width = 15)
|
||||
@ApiModelProperty(value = "版本:1:v1;2:v2")
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 1http2https(默认http)
|
||||
*/
|
||||
@ApiModelProperty(value = "1http2https(默认http)")
|
||||
private java.lang.Integer httpType;
|
||||
}
|
||||
|
||||
@ -77,4 +77,11 @@ public interface PoliceCameraItemMapper extends BaseMapper<PoliceCameraItem> {
|
||||
*/
|
||||
CountStatusVo countStatus(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 根据工单id查询执法记录仪设备列表idList
|
||||
*
|
||||
* @param ticketId
|
||||
* @return
|
||||
*/
|
||||
List<Long> getCameraItemIdListByTicketId(String ticketId);
|
||||
}
|
||||
|
||||
@ -79,4 +79,11 @@
|
||||
where pvc.project_sn =#{projectSn}
|
||||
and pvc.is_enable=1) as t
|
||||
</select>
|
||||
|
||||
<select id="getCameraItemIdListByTicketId" resultType="java.lang.Long">
|
||||
select distinct wtcr.police_camera_id
|
||||
from work_ticket wt
|
||||
join work_ticket_camera_rel wtcr on wt.id = wtcr.work_ticket_id
|
||||
where wt.id = #{ticketId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -7,6 +7,11 @@
|
||||
,wtt.type_name
|
||||
from work_ticket t
|
||||
left join work_ticket_type wtt on wtt.id=t.type_id
|
||||
where 1=1
|
||||
<if test="param.numberOrContent != null and param.numberOrContent != ''">
|
||||
and (t.work_ticket_number like CONCAT('%',#{param.numberOrContent},'%') or t.work_content like
|
||||
CONCAT('%',#{param.numberOrContent},'%' ))
|
||||
</if>
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
@ -96,7 +96,15 @@ public class PoliceCameraItemServiceImpl extends ServiceImpl<PoliceCameraItemMap
|
||||
}
|
||||
|
||||
private QueryWrapper<PoliceCameraItemVo> getQueryWrapper(HashMap<String, Object> param) {
|
||||
String ticketId = MapUtils.getString(param, "ticketId");
|
||||
QueryWrapper<PoliceCameraItemVo> queryWrapper = QueryGenerator.initPageQueryWrapper(PoliceCameraItemVo.class, param, true);
|
||||
if (StrUtil.isNotBlank(ticketId)) {
|
||||
List<Long> cameraItemIds = baseMapper.getCameraItemIdListByTicketId(ticketId);
|
||||
if (CollUtil.isEmpty(cameraItemIds)) {
|
||||
cameraItemIds.add(-1L);
|
||||
}
|
||||
queryWrapper.lambda().in(PoliceCameraItemVo::getItemId, cameraItemIds);
|
||||
}
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(PoliceCameraItemVo::getItemId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
@ -126,4 +126,12 @@ public class QualityRegionController {
|
||||
return Result.success(qualityRegionService.queryRegionWorker(qualityRegion.getId().toString()).size());
|
||||
}
|
||||
|
||||
@OperLog(operModul = "区域管理", operType = "查询", operDesc = "查询项目子账号绑定的区域列表")
|
||||
@ApiOperation(value = "查询项目子账号绑定的区域列表", notes = "查询项目子账号绑定的区域列表", httpMethod = "GET")
|
||||
@GetMapping(value = "/queryBindRegions")
|
||||
public Result<List<QualityRegion>> queryBindRegions() {
|
||||
return Result.success(qualityRegionService.queryBindRegions());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import com.zhgd.xmgl.modules.quality.entity.QualityRegion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -68,4 +69,12 @@ public interface QualityRegionMapper extends BaseMapper<QualityRegion> {
|
||||
* @return
|
||||
*/
|
||||
List<QualityRegion> queryBindRegion(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 查询项目子账号绑定的区域List
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
List<QualityRegion> queryBindRegions(HashMap<String, Object> map);
|
||||
}
|
||||
|
||||
@ -119,4 +119,15 @@
|
||||
join system_user su on qr.belong_user_id=su.user_id
|
||||
where su.user_id=#{userId} and su.account_type=6
|
||||
</select>
|
||||
|
||||
<select id="queryBindRegions" resultType="com.zhgd.xmgl.modules.quality.entity.QualityRegion">
|
||||
SELECT
|
||||
qr.*
|
||||
FROM
|
||||
quality_region qr
|
||||
JOIN quality_region_to_user qrtu ON qrtu.quality_region_id = qr.id
|
||||
JOIN system_user su ON qrtu.user_id = su.user_id
|
||||
WHERE
|
||||
su.user_id=#{userId} and su.account_type=6
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -74,4 +74,12 @@ public interface IQualityRegionService extends IService<QualityRegion> {
|
||||
* @return
|
||||
*/
|
||||
Map<Long, QualityRegion> getQualityRegionMapByProjectSn(String projectSn);
|
||||
|
||||
/**
|
||||
* 查询项目子账号绑定的唯一区域
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<QualityRegion> queryBindRegions();
|
||||
|
||||
}
|
||||
|
||||
@ -363,6 +363,13 @@ public class QualityRegionServiceImpl extends ServiceImpl<QualityRegionMapper, Q
|
||||
.eq(QualityRegion::getProjectSn, projectSn)).stream().collect(Collectors.toMap(QualityRegion::getId, Function.identity(), (o1, o2) -> o1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QualityRegion> queryBindRegions() {
|
||||
HashMap<String, Object> map = new HashMap<>(16);
|
||||
map.put("userId", SecurityUtils.getUser().getUserId());
|
||||
return baseMapper.queryBindRegions(map);
|
||||
}
|
||||
|
||||
private void deleteRegion(Long id) {
|
||||
QueryWrapper<QualityRegion> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.lambda().eq(QualityRegion::getParentRegion, id);
|
||||
|
||||
@ -8,6 +8,7 @@ import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
@ -15,6 +16,7 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.redis.annotation.ApiIdempotent;
|
||||
import com.zhgd.redis.lock.RedisRepository;
|
||||
import com.zhgd.xmgl.async.AsyncWorker;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
||||
@ -22,6 +24,7 @@ import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService;
|
||||
import com.zhgd.xmgl.modules.worker.service.ITeamInfoService;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -71,6 +74,9 @@ public class WorkerInfoController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IWorkerAttendanceService workerAttendanceService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private AsyncWorker asyncWorker;
|
||||
|
||||
/**
|
||||
* 添加
|
||||
@ -884,5 +890,28 @@ public class WorkerInfoController {
|
||||
return Result.success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "劳务管理", notes = "批量人员绑定设备", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "workerIdList", value = "人员idList", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "ufaceDevId", value = "门禁设备id(多个,分割)", paramType = "body", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/batchBindDevForWorkers")
|
||||
public Result batchBindDevForWorkers(@ApiIgnore @RequestBody Map<String, Object> paramMap) {
|
||||
String projectSn = MapUtils.getString(paramMap, "projectSn");
|
||||
String ufaceDevId = MapUtils.getString(paramMap, "ufaceDevId");
|
||||
List<String> workerIdList = (List<String>) paramMap.get("workerIdList");
|
||||
List<WorkerInfo> workerInfos = workerInfoService.list(new LambdaQueryWrapper<WorkerInfo>()
|
||||
.eq(WorkerInfo::getProjectSn, projectSn)
|
||||
.in(WorkerInfo::getId, workerIdList)
|
||||
);
|
||||
for (WorkerInfo workerInfo : workerInfos) {
|
||||
workerInfo.setDevType(1);
|
||||
workerInfo.setUfaceDevId(ufaceDevId);
|
||||
}
|
||||
Long userId = SecurityUtils.getUser().getUserId();
|
||||
asyncWorker.batchBindDevForWorkers(workerInfos, userId);
|
||||
return Result.success(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -107,9 +107,9 @@ public class DangongWorkerFaceStatusServiceImpl extends ServiceImpl<DangongWorke
|
||||
//保存弹弓下发状态
|
||||
Pair<String, String> pair = projectUfaceConfigService.getSendAndDeleteDevSns(workerInfo);
|
||||
String devs = pair.getLeft();
|
||||
this.remove(new LambdaQueryWrapper<DangongWorkerFaceStatus>()
|
||||
.eq(DangongWorkerFaceStatus::getWorkerId, workerInfo.getId()));
|
||||
if (StrUtil.isNotEmpty(devs)) {
|
||||
this.remove(new LambdaQueryWrapper<DangongWorkerFaceStatus>()
|
||||
.eq(DangongWorkerFaceStatus::getWorkerId, workerInfo.getId()));
|
||||
for (String sn : StrUtil.split(devs, ",")) {
|
||||
DangongWorkerFaceStatus st = new DangongWorkerFaceStatus();
|
||||
st.setProjectSn(workerInfo.getProjectSn());
|
||||
|
||||
@ -93,6 +93,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -291,6 +292,9 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IProjectEnterpriseWorkerStatisticsService projectEnterpriseWorkerStatisticsService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private IUfaceDevService ufaceDevService;
|
||||
|
||||
/**
|
||||
* 人员管理分页
|
||||
@ -2180,36 +2184,6 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
return vo;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private DeclareAgeVO getDeclareAgeVO(HashMap<String, Object> map) {
|
||||
List<String> ageList = workerInfoMapper.getDeclareAge(map);
|
||||
Set<Map.Entry<Integer, List<String>>> ageSet = ageList.stream().collect(Collectors.groupingBy(birthDay -> {
|
||||
try {
|
||||
return DateUtil.ageOfNow(birthDay);
|
||||
} catch (Exception e) {
|
||||
log.error("error:", e);
|
||||
}
|
||||
return 0;
|
||||
})).entrySet();
|
||||
DeclareAgeVO result = new DeclareAgeVO();
|
||||
for (Map.Entry<Integer, List<String>> ageItem : ageSet) {
|
||||
Integer age = ageItem.getKey();
|
||||
int size = ageItem.getValue().size();
|
||||
if (age == null) {
|
||||
result.setNotRegistered(result.getNotRegistered() + size);
|
||||
} else if (age >= 18 && age <= 24) {
|
||||
result.setEighteenToTwentyFour(result.getEighteenToTwentyFour() + size);
|
||||
} else if (age >= 25 && age <= 34) {
|
||||
result.setTwentyFiveToThirtyFour(result.getTwentyFiveToThirtyFour() + size);
|
||||
} else if (age >= 35 && age <= 49) {
|
||||
result.setThirtyFiveToFortyNine(result.getThirtyFiveToFortyNine() + size);
|
||||
} else if (age >= 50 && age <= 55) {
|
||||
result.setFiftyToFiftyFive(result.getFiftyToFiftyFive() + size);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
///*
|
||||
//全量和增量更新
|
||||
// */
|
||||
@ -2259,6 +2233,36 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
// return JSON.toJSONString(getWorkerInfoByDevVo);
|
||||
//}
|
||||
|
||||
@NotNull
|
||||
private DeclareAgeVO getDeclareAgeVO(HashMap<String, Object> map) {
|
||||
List<String> ageList = workerInfoMapper.getDeclareAge(map);
|
||||
Set<Map.Entry<Integer, List<String>>> ageSet = ageList.stream().collect(Collectors.groupingBy(birthDay -> {
|
||||
try {
|
||||
return DateUtil.ageOfNow(birthDay);
|
||||
} catch (Exception e) {
|
||||
log.error("error:", e);
|
||||
}
|
||||
return 0;
|
||||
})).entrySet();
|
||||
DeclareAgeVO result = new DeclareAgeVO();
|
||||
for (Map.Entry<Integer, List<String>> ageItem : ageSet) {
|
||||
Integer age = ageItem.getKey();
|
||||
int size = ageItem.getValue().size();
|
||||
if (age == null) {
|
||||
result.setNotRegistered(result.getNotRegistered() + size);
|
||||
} else if (age >= 18 && age <= 24) {
|
||||
result.setEighteenToTwentyFour(result.getEighteenToTwentyFour() + size);
|
||||
} else if (age >= 25 && age <= 34) {
|
||||
result.setTwentyFiveToThirtyFour(result.getTwentyFiveToThirtyFour() + size);
|
||||
} else if (age >= 35 && age <= 49) {
|
||||
result.setThirtyFiveToFortyNine(result.getThirtyFiveToFortyNine() + size);
|
||||
} else if (age >= 50 && age <= 55) {
|
||||
result.setFiftyToFiftyFive(result.getFiftyToFiftyFive() + size);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<IPage<WorkerInfoDetailsVo>> getWorkerInfoDetails(Integer pageNo, Integer pageSize, String projectSn) {
|
||||
if (pageNo == null) {
|
||||
@ -2359,6 +2363,17 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
.eq(WorkerInfo::getProjectSn, projectSn)
|
||||
.eq(WorkerInfo::getInserviceType, 1)
|
||||
);
|
||||
// workerInfos = workerInfos.stream().filter(workerInfo -> {
|
||||
// Integer devType = workerInfo.getDevType();
|
||||
// if (Objects.equals(devType, 1)) {
|
||||
// if (workerInfo.getUfaceDevId() != null) {
|
||||
// return workerInfo.getUfaceDevId().contains(dev.getId() + "");
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }).collect(Collectors.toList());
|
||||
|
||||
//添加人员
|
||||
ArrayList<GetWorkerInfoByDevVo.Worker> datas = new ArrayList<>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user