代码提交
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -7,8 +8,10 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.csdevice.service.CsEquipmentProcessPOService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -54,13 +57,23 @@ public class CsEquipmentProcessController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/query")
|
||||
@ApiOperation("新增记录")
|
||||
@ApiImplicitParam(name = "csEquipmentProcessDTO", value = "逻辑子设备标识", required = true)
|
||||
@ApiOperation("查询记录")
|
||||
@ApiImplicitParam(name = "csEquipmentProcessDTO", value = "查询参数", required = true)
|
||||
public HttpResult<List<CsEquipmentProcessDTO>> queryList(@RequestBody @Validated CsEquipmentProcessDTO csEquipmentProcessDTO){
|
||||
String methodDescribe = getMethodDescribe("query");
|
||||
String methodDescribe = getMethodDescribe("queryList");
|
||||
List<CsEquipmentProcessDTO> result = csEquipmentProcessPOService.queryqueryList(csEquipmentProcessDTO);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryPage")
|
||||
@ApiOperation("分页查询记录")
|
||||
@ApiImplicitParam(name = "baseParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<CsEquipmentProcessDTO>> queryPage(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("queryPage");
|
||||
Page<CsEquipmentProcessDTO> list = csEquipmentProcessPOService.queryPage(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
@@ -57,9 +58,9 @@ public class CsEventSendMsgController extends BaseController {
|
||||
@PostMapping("/queryLog")
|
||||
@ApiOperation("查询推送日志")
|
||||
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
|
||||
public HttpResult<IPage<CsEventSendMsgVO>> queryLog(@RequestBody BaseParam baseParam){
|
||||
public HttpResult<Page<CsEventSendMsgVO>> queryLog(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("queryLog");
|
||||
IPage<CsEventSendMsgVO> list = csEventSendMsgService.queryPage(baseParam);
|
||||
Page<CsEventSendMsgVO> list = csEventSendMsgService.queryPage(baseParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -12,4 +16,5 @@ import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsEquipmentProcessPOMapper extends BaseMapper<CsEquipmentProcessPO> {
|
||||
Page<CsEquipmentProcessDTO> selectPages(Page<CsEquipmentProcessDTO> returnpage, @Param("baseParam") BaseParam baseParam);
|
||||
}
|
||||
@@ -34,9 +34,9 @@
|
||||
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
||||
AND a.dev_type_name LIKE concat('%',#{csDevModelQueryParm.devName},'%')
|
||||
</if>
|
||||
<if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">
|
||||
AND a.dev_type = #{csDevModelQueryParm.devType}
|
||||
</if>
|
||||
<!-- <if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
|
||||
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
|
||||
<!-- </if>-->
|
||||
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
||||
AND a.name = #{csDevModelQueryParm.name}
|
||||
</if>
|
||||
|
||||
@@ -16,4 +16,19 @@
|
||||
<!--@mbg.generated-->
|
||||
id, dev_id, `operator`, start_time, end_time, `status`, `process`
|
||||
</sql>
|
||||
|
||||
<select id="selectPages" resultType="com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO">
|
||||
select a.*,b.name devName from cs_equipment_process a left join cs_equipment_delivery b on a.dev_id =b.ndid
|
||||
where 1=1
|
||||
<if test="baseParam!=null and baseParam.searchValue != null and baseParam.searchValue !=''">
|
||||
AND b.name like concat(concat("%",#{baseParam.searchValue}),"%")
|
||||
</if>
|
||||
<if test="baseParam!=null and baseParam.searchEndTime != null and baseParam.searchEndTime !=''">
|
||||
AND DATE(a.start_time) <= DATE(#{baseParam.searchEndTime})
|
||||
</if>
|
||||
<if test="baseParam!=null and baseParam.searchBeginTime != null and baseParam.searchBeginTime !=''">
|
||||
AND DATE(a.start_time) >= DATE(#{baseParam.searchBeginTime})
|
||||
</if>
|
||||
order by a.start_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -3,6 +3,14 @@
|
||||
<mapper namespace="com.njcn.csdevice.mapper.CsEventSendMsgMapper">
|
||||
|
||||
<select id="selectPages" resultType="com.njcn.csdevice.pojo.vo.CsEventSendMsgVO">
|
||||
select * from cs_event_send_msg a LEFT JOIN cs_event b on a.event_id =b.id
|
||||
select a.*,b.*,c.name devName from cs_event_send_msg a LEFT JOIN cs_event b on a.event_id =b.id left JOIN cs_ledger c on b.device_id =c.id
|
||||
where 1=1
|
||||
<if test="baseParam!=null and baseParam.searchEndTime != null and baseParam.searchEndTime !=''">
|
||||
AND DATE(a.send_time) <= DATE(#{baseParam.searchEndTime})
|
||||
</if>
|
||||
<if test="baseParam!=null and baseParam.searchBeginTime != null and baseParam.searchBeginTime !=''">
|
||||
AND DATE(a.send_time) >= DATE(#{baseParam.searchBeginTime})
|
||||
</if>
|
||||
order by send_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,4 +20,6 @@ public interface CsEquipmentProcessPOService extends IService<CsEquipmentProcess
|
||||
|
||||
|
||||
List<CsEquipmentProcessDTO> queryqueryList(CsEquipmentProcessDTO csEquipmentProcessDTO);
|
||||
}
|
||||
|
||||
Page<CsEquipmentProcessDTO> queryPage(BaseParam baseParam);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
@@ -16,5 +17,5 @@ import com.njcn.web.pojo.param.BaseParam;
|
||||
*/
|
||||
public interface ICsEventSendMsgService extends IService<CsEventSendMsg> {
|
||||
|
||||
IPage<CsEventSendMsgVO> queryPage(BaseParam baseParam);
|
||||
Page<CsEventSendMsgVO> queryPage(BaseParam baseParam);
|
||||
}
|
||||
|
||||
@@ -2,15 +2,25 @@ package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentProcessDTO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentProcessPOMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
|
||||
import com.njcn.csdevice.service.CsEquipmentProcessPOService;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -22,7 +32,9 @@ import java.util.stream.Collectors;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsEquipmentProcessPOServiceImpl extends ServiceImpl<CsEquipmentProcessPOMapper, CsEquipmentProcessPO> implements CsEquipmentProcessPOService{
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
@Override
|
||||
public List<CsEquipmentProcessDTO> queryqueryList(CsEquipmentProcessDTO csEquipmentProcessDTO) {
|
||||
@@ -36,4 +48,24 @@ public class CsEquipmentProcessPOServiceImpl extends ServiceImpl<CsEquipmentProc
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<CsEquipmentProcessDTO> queryPage(BaseParam baseParam) {
|
||||
Page<CsEquipmentProcessDTO> returnpage = new Page<> (baseParam.getPageNum ( ), baseParam.getPageSize ( ));
|
||||
|
||||
Page<CsEquipmentProcessDTO> result = this.getBaseMapper().selectPages(returnpage,baseParam);
|
||||
List<String> collect1 = result.getRecords().stream().map(CsEquipmentProcessDTO::getOperator).distinct().collect(Collectors.toList());
|
||||
Map<String, String> collect2;
|
||||
if(!CollectionUtils.isEmpty(collect1)){
|
||||
List<User> userTem = userFeignClient.getUserByIdList(collect1).getData();
|
||||
collect2 = userTem.stream().collect(Collectors.toMap(User::getId, User::getName, (e1, e2) -> e1 + "," + e2));
|
||||
|
||||
} else {
|
||||
collect2 = new HashMap<>();
|
||||
}
|
||||
result.getRecords().forEach(temp->{
|
||||
temp.setOperatorName(collect2.get(temp.getOperator()));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,20 @@ import com.njcn.csdevice.pojo.po.CsEventSendMsg;
|
||||
import com.njcn.csdevice.pojo.po.CsLogsPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEventSendMsgVO;
|
||||
import com.njcn.csdevice.service.ICsEventSendMsgService;
|
||||
import com.njcn.cssystem.pojo.po.CsFeedbackChatPO;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -20,13 +32,32 @@ import org.springframework.stereotype.Service;
|
||||
* @since 2023-09-18
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsEventSendMsgServiceImpl extends ServiceImpl<CsEventSendMsgMapper, CsEventSendMsg> implements ICsEventSendMsgService {
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
@Override
|
||||
public IPage<CsEventSendMsgVO> queryPage(BaseParam baseParam) {
|
||||
public Page<CsEventSendMsgVO> queryPage(BaseParam baseParam) {
|
||||
Page<CsEventSendMsgVO> returnpage = new Page<> (baseParam.getPageNum ( ), baseParam.getPageSize ( ));
|
||||
|
||||
Page<CsEventSendMsgVO> result = this.getBaseMapper().selectPages(returnpage,baseParam);
|
||||
List<String> collect1 = result.getRecords().stream().map(CsEventSendMsgVO::getUserId).distinct().collect(Collectors.toList());
|
||||
Map<String, String> collect2;
|
||||
if(!CollectionUtils.isEmpty(collect1)){
|
||||
List<User> userTem = userFeignClient.getUserByIdList(collect1).getData();
|
||||
collect2 = userTem.stream().collect(Collectors.toMap(User::getId, User::getName, (e1, e2) -> e1 + "," + e2));
|
||||
|
||||
} else {
|
||||
collect2 = new HashMap<>();
|
||||
}
|
||||
result.getRecords().forEach(temp->{
|
||||
EleEpdPqd data = epdFeignClient.findByName(temp.getTag()).getData();
|
||||
temp.setShowName(data.getShowName());
|
||||
temp.setUserName(collect2.get(temp.getUserId()));
|
||||
});
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.AppProjectMapper;
|
||||
import com.njcn.csdevice.mapper.AppTopologyDiagramMapper;
|
||||
@@ -12,17 +14,17 @@ import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.service.ICsEngineeringUserService;
|
||||
import com.njcn.csdevice.service.ICsLedgerService;
|
||||
import com.njcn.csdevice.service.RoleEngineerDevService;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -49,7 +51,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final AppTopologyDiagramMapper appTopologyDiagramMapper;
|
||||
private final AppProjectMapper appProjectMapper;
|
||||
private final CsEngineeringMapper csEngineeringMapper;
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
|
||||
@@ -73,6 +76,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
public List<CsLedgerVO> getLineTree() {
|
||||
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||
|
||||
/*获取用户工程,设备信息过滤*/
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
@@ -89,7 +94,15 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> lineList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, lineList)));
|
||||
// List<String> collect = lineList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
// List<CsLinePO> csLinePOS = csLinePOService.listByIds(collect);
|
||||
// List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(temp.getPosition(), areaId)).collect(Collectors.toList());
|
||||
// List<String> collect2 = collect1.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
// lineList = lineList.stream().filter(temp -> collect2.contains(temp.getId())).collect(Collectors.toList());
|
||||
|
||||
|
||||
List<CsLedgerVO> finalLineList = lineList;
|
||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||
return engineeringList;
|
||||
|
||||
Reference in New Issue
Block a user