| | |
| | | public static final String PLATFORM ="PLATFORM" ; |
| | | public static final String POWER_MINUTE ="POWER_MINUTE" ; |
| | | public static final String SPECIAL_COMPANY_ID ="SPECIAL_COMPANY_ID" ; |
| | | public static final String YW_DEVICE ="YW_DEVICE" ; |
| | | public static final String YW_PATROL ="YW_PATROL" ; |
| | | |
| | | public static final String RESERVATION_TOTAL_NUM ="RESERVATION_TOTAL_NUM" ; |
| | | public static final String SIGN_IN_PLACE_LAT ="SIGN_IN_PLACE_LAT" ; |
| | | public static final String SIGN_IN_PLACE_LNT ="SIGN_IN_PLACE_LNT" ; |
| | | public static final String SIGN_IN_PLACE_DISTANCE ="SIGN_IN_PLACE_DISTANCE" ; |
| | | public static final String SIGN_IN_QRCODE ="SIGN_IN_QRCODE" ; |
| | | |
| | | |
| | | //被拜访人信息校验方式(0手机号单独校验 1手机号和姓名组合校验) |
| | | public static final String BEVISITED_USER_VALID = "BEVISITED_USER_VALID"; |
| | |
| | | HIDDEN_DANGER_DEAL_AFTER(2, "隐患随手拍处理后 ", "隐患随手拍处理后 "), |
| | | YW_WORKORDER_PROBLEM(3, "运维工单问题附件 ", "运维工单问题附件 "), |
| | | YW_WORKORDER_DEAL(4, "运维工单处理附件 ", "运维工单处理附件 "), |
| | | FN_DEVICE_FILE(5, "阜宁服务平台设备类型图片 ", "阜宁服务平台设备类型图片 "), |
| | | FN_DEVICE_RECORD_FILE(6, "阜宁服务平台运维记录图片 ", "阜宁服务平台运维记录图片 "), |
| | | FN_PATROL_POINT_FILE(7, "巡检点附件 ", "巡检点附件 "), |
| | | ; |
| | | // 成员变量 |
| | | private String name; |
| | |
| | | @ExcelColumn(name="类型0图片 1视频 2其他") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "关联对象类型 0隐患现场情况 1隐患处理前情况 2隐患处理后情况 3隐患退回说明 4会议室文件", example = "1") |
| | | @ExcelColumn(name="关联对象类型 0隐患现场情况 1隐患处理前情况 2隐患处理后情况 3隐患退回说明 4会议室文件") |
| | | @ApiModelProperty(value = "关联对象类型 0隐患现场情况 1隐患处理前情况 2隐患处理后情况 3隐患退回说明 4会议室文件 5阜宁设备图片 6阜宁设备运维图片", example = "1") |
| | | @ExcelColumn(name="关联对象类型 0隐患现场情况 1隐患处理前情况 2隐患处理后情况 3隐患退回说明 4会议室文件 5阜宁设备图片 6阜宁设备运维图片") |
| | | private Integer objType; |
| | | |
| | | @ApiModelProperty(value = "文件地址") |
| | |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywdevice:query") |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywDeviceService.findById(id)); |
| | | return ApiResponse.success(ywDeviceService.getDetail(id)); |
| | | } |
| | | } |
| | |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywdevicerecord:query") |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywDeviceRecordService.findById(id)); |
| | | return ApiResponse.success(ywDeviceRecordService.getDetail(id)); |
| | | } |
| | | } |
| | |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywpatrolline:query") |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywPatrolLineService.findById(id)); |
| | | return ApiResponse.success(ywPatrolLineService.getDetail(id)); |
| | | } |
| | | } |
| | |
| | | return ApiResponse.success(ywPatrolPointService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("列表查询") |
| | | @PostMapping("/list") |
| | | @CloudRequiredPermission("business:ywpatrolpoint:query") |
| | | public ApiResponse<List<YwPatrolPoint>> list (@RequestBody YwPatrolPoint ywPatrolPoint,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywPatrolPointService.findList(ywPatrolPoint)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywpatrolpoint:exportExcel") |
| | |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:ywpatrolpoint:query") |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywPatrolPointService.findById(id)); |
| | | return ApiResponse.success(ywPatrolPointService.getDetail(id)); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.doumee.dao.business.model.YwDevice; |
| | | import com.github.yulichang.base.mapper.MPJJoinMapper; |
| | | |
| | | /** |
| | | * @author 江蹄蹄 |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.core.model.LoginUserModel; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | |
| | | @ExcelColumn(name="所在位置") |
| | | private String addr; |
| | | |
| | | @ApiModelProperty(value = "分类名称") |
| | | @TableField(exist = false) |
| | | private String categoryName; |
| | | |
| | | @ApiModelProperty(value = "管理员名称") |
| | | @TableField(exist = false) |
| | | private String realName; |
| | | |
| | | @ApiModelProperty(value = "附件信息") |
| | | @TableField(exist = false) |
| | | private Multifile multifile; |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.core.model.LoginUserModel; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 运维设备运维记录表 |
| | |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty(value = "主键", example = "1") |
| | | @ExcelColumn(name="主键") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "创建人编码", example = "1") |
| | | @ExcelColumn(name="创建人编码") |
| | | private Integer creator; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @ExcelColumn(name="创建时间") |
| | | @ExcelColumn(name="创建时间",index = 5, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date createDate; |
| | | |
| | | @ApiModelProperty(value = "更新人编码", example = "1") |
| | | @ExcelColumn(name="更新人编码") |
| | | private Integer editor; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | @ExcelColumn(name="更新时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date editDate; |
| | | |
| | | @ApiModelProperty(value = "是否删除0否 1是", example = "1") |
| | | @ExcelColumn(name="是否删除0否 1是") |
| | | private Integer isdeleted; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | @ExcelColumn(name="备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "状态 0正常 1损坏 2报废", example = "1") |
| | | @ExcelColumn(name="状态 0正常 1损坏 2报废") |
| | | @ExcelColumn(name="设备状态",index = 3, valueMapping = "0=正常;1=损坏;2=报废;") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "设备型号", example = "1") |
| | | @ExcelColumn(name="设备型号") |
| | | private Integer modelNo; |
| | | |
| | | @ApiModelProperty(value = "设备类编码(管理yw_device)", example = "1") |
| | | @ExcelColumn(name="设备类编码(管理yw_device)") |
| | | private Integer deviceId; |
| | | |
| | | @ApiModelProperty(value = "运维人员编码编码(关联system_user)", example = "1") |
| | | @ExcelColumn(name="运维人员编码编码(关联system_user)") |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty(value = "供应商") |
| | | @ExcelColumn(name="供应商") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date company; |
| | | |
| | | @ApiModelProperty(value = "情况说明") |
| | | @ExcelColumn(name="情况说明") |
| | | @ExcelColumn(name="运维备注",index = 4) |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "运维时间") |
| | | @ExcelColumn(name="运维时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date dealDate; |
| | | |
| | | @ApiModelProperty(value = "设备名称") |
| | | @ExcelColumn(name="设备名称",index = 2) |
| | | @TableField(exist = false) |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty(value = "设备编号") |
| | | @ExcelColumn(name="设备编号",index = 1) |
| | | @TableField(exist = false) |
| | | private String deviceCode; |
| | | |
| | | @ApiModelProperty(value = "运维人名称") |
| | | @ExcelColumn(name="运维人",index = 0) |
| | | @TableField(exist = false) |
| | | private String realName; |
| | | |
| | | @ApiModelProperty(value = "运维人组织名称") |
| | | @TableField(exist = false) |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "运维人手机号") |
| | | @TableField(exist = false) |
| | | private String mobile; |
| | | |
| | | @ApiModelProperty(value = "开始日期 yyyy-MM-dd") |
| | | @TableField(exist = false) |
| | | private Date startDate; |
| | | |
| | | @ApiModelProperty(value = "结束日期 yyyy-MM-dd") |
| | | @TableField(exist = false) |
| | | private Date endDate; |
| | | |
| | | @ApiModelProperty(value = "附件信息") |
| | | @TableField(exist = false) |
| | | private List<Multifile> multifileList; |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.core.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ExcelColumn(name="是否扫码打卡 0不需要 1需要") |
| | | private Integer needScancode; |
| | | |
| | | @ApiModelProperty(value = "巡检点名称") |
| | | @TableField(exist = false) |
| | | private String pointName; |
| | | |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.core.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 运维巡检路线信息表 |
| | |
| | | @ExcelColumn(name="图标") |
| | | private String imgurl; |
| | | |
| | | @ApiModelProperty(value = "巡检点数量") |
| | | @TableField(exist = false) |
| | | private Integer lineAmount; |
| | | |
| | | @ApiModelProperty(value = "巡检点") |
| | | @TableField(exist = false) |
| | | private List<YwLinePoint> linePointList; |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.core.model.LoginUserModel; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 运维巡检点信息表 |
| | |
| | | @ExcelColumn(name="地址") |
| | | private String addr; |
| | | |
| | | @ApiModelProperty(value = "编码") |
| | | @ExcelColumn(name="编码") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @ExcelColumn(name="经度") |
| | | private String longitude; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | @ExcelColumn(name="纬度") |
| | | private String latitude; |
| | | |
| | | @ApiModelProperty(value = "内容") |
| | | @ExcelColumn(name="内容") |
| | | private String content; |
| | | |
| | | @ApiModelProperty(value = "巡检设备(关联 yw_device)", example = "1") |
| | | @ExcelColumn(name="巡检设备(关联 yw_device)") |
| | | private Integer deviceId; |
| | | |
| | | @ApiModelProperty(value = "区域名称") |
| | | @TableField(exist = false) |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty(value = "设备名称") |
| | | @TableField(exist = false) |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty(value = "附件信息") |
| | | @TableField(exist = false) |
| | | private Multifile multifile; |
| | | |
| | | @ApiModelProperty(value = "过滤数据") |
| | | @TableField(exist = false) |
| | | private List<Integer> idLists; |
| | | } |
| | |
| | | * @return long |
| | | */ |
| | | long count(YwDeviceRecord ywDeviceRecord); |
| | | |
| | | YwDeviceRecord getDetail(Integer id); |
| | | } |
| | |
| | | * @return long |
| | | */ |
| | | long count(YwDevice ywDevice); |
| | | |
| | | YwDevice getDetail(Integer id); |
| | | } |
| | |
| | | * @return long |
| | | */ |
| | | long count(YwPatrolLine ywPatrolLine); |
| | | |
| | | YwPatrolLine getDetail(Integer id); |
| | | } |
| | |
| | | * @return long |
| | | */ |
| | | long count(YwPatrolPoint ywPatrolPoint); |
| | | |
| | | YwPatrolPoint getDetail(Integer id); |
| | | } |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwDeviceRecordMapper; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.YwCustomer; |
| | | import com.doumee.dao.business.model.YwDevice; |
| | | import com.doumee.dao.business.model.YwDeviceRecord; |
| | | import com.doumee.dao.system.MultifileMapper; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.YwDeviceRecordService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 运维设备运维记录表Service实现 |
| | |
| | | |
| | | @Autowired |
| | | private YwDeviceRecordMapper ywDeviceRecordMapper; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | |
| | | |
| | | @Override |
| | | public Integer create(YwDeviceRecord ywDeviceRecord) { |
| | | if(Objects.isNull(ywDeviceRecord) |
| | | || Objects.isNull(ywDeviceRecord.getDeviceId()) |
| | | || Objects.isNull(ywDeviceRecord.getStatus()) |
| | | || StringUtils.isBlank(ywDeviceRecord.getContent()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = ywDeviceRecord.getLoginUserInfo(); |
| | | ywDeviceRecord.setCreateDate(new Date()); |
| | | ywDeviceRecord.setCreator(loginUserInfo.getId()); |
| | | ywDeviceRecord.setIsdeleted(Constants.ZERO); |
| | | ywDeviceRecordMapper.insert(ywDeviceRecord); |
| | | |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywDeviceRecord.getMultifileList())){ |
| | | List<Multifile> multifiles = ywDeviceRecord.getMultifileList(); |
| | | for (Multifile multifile:multifiles) { |
| | | multifile.setCreator(loginUserInfo.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjType(Constants.MultiFile.FN_DEVICE_RECORD_FILE.getKey()); |
| | | multifile.setObjId(ywDeviceRecord.getId()); |
| | | } |
| | | multifileMapper.insert(multifiles); |
| | | } |
| | | return ywDeviceRecord.getId(); |
| | | } |
| | | |
| | |
| | | return ywDeviceRecordMapper.selectById(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public YwDeviceRecord getDetail(Integer id) { |
| | | YwDeviceRecord ywDeviceRecord = ywDeviceRecordMapper.selectJoinOne(YwDeviceRecord.class, |
| | | new MPJLambdaWrapper<YwDeviceRecord>() |
| | | .selectAll(YwDeviceRecord.class) |
| | | .selectAs(SystemUser::getRealname,YwDeviceRecord::getRealName) |
| | | .selectAs(SystemUser::getMobile,YwDeviceRecord::getMobile) |
| | | .selectAs(Company::getName,YwDeviceRecord::getCompanyName) |
| | | .selectAs(YwDevice::getName,YwDeviceRecord::getDeviceName) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwDeviceRecord::getUserId) |
| | | .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) |
| | | .leftJoin(YwDevice.class,YwDevice::getId,YwDeviceRecord::getDeviceId) |
| | | .eq(YwDeviceRecord::getId,id) |
| | | .last(" limit 1 ") |
| | | ); |
| | | List<Multifile> multifiles = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.FN_DEVICE_RECORD_FILE)); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(multifiles)) { |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP, Constants.FTP_RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.FTP, Constants.YW_DEVICE).getCode(); |
| | | for (Multifile multifile : multifiles) { |
| | | multifile.setFileurlFull(path + multifile.getFileurl()); |
| | | } |
| | | ywDeviceRecord.setMultifileList(multifiles); |
| | | } |
| | | return ywDeviceRecord; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public YwDeviceRecord findOne(YwDeviceRecord ywDeviceRecord) { |
| | | QueryWrapper<YwDeviceRecord> wrapper = new QueryWrapper<>(ywDeviceRecord); |
| | |
| | | @Override |
| | | public PageData<YwDeviceRecord> findPage(PageWrap<YwDeviceRecord> pageWrap) { |
| | | IPage<YwDeviceRecord> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<YwDeviceRecord> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(YwDeviceRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(YwDeviceRecord::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(YwDeviceRecord::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(YwDeviceRecord::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getModelNo() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getModelNo, pageWrap.getModel().getModelNo()); |
| | | } |
| | | if (pageWrap.getModel().getDeviceId() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getDeviceId, pageWrap.getModel().getDeviceId()); |
| | | } |
| | | if (pageWrap.getModel().getUserId() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getUserId, pageWrap.getModel().getUserId()); |
| | | } |
| | | if (pageWrap.getModel().getCompany() != null) { |
| | | queryWrapper.lambda().ge(YwDeviceRecord::getCompany, Utils.Date.getStart(pageWrap.getModel().getCompany())); |
| | | queryWrapper.lambda().le(YwDeviceRecord::getCompany, Utils.Date.getEnd(pageWrap.getModel().getCompany())); |
| | | } |
| | | if (pageWrap.getModel().getContent() != null) { |
| | | queryWrapper.lambda().eq(YwDeviceRecord::getContent, pageWrap.getModel().getContent()); |
| | | } |
| | | if (pageWrap.getModel().getDealDate() != null) { |
| | | queryWrapper.lambda().ge(YwDeviceRecord::getDealDate, Utils.Date.getStart(pageWrap.getModel().getDealDate())); |
| | | queryWrapper.lambda().le(YwDeviceRecord::getDealDate, Utils.Date.getEnd(pageWrap.getModel().getDealDate())); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(ywDeviceRecordMapper.selectPage(page, queryWrapper)); |
| | | YwDeviceRecord model = pageWrap.getModel(); |
| | | IPage iPage = ywDeviceRecordMapper.selectJoinPage(page,YwDeviceRecord.class, |
| | | new MPJLambdaWrapper<YwDeviceRecord>() |
| | | .selectAll(YwDeviceRecord.class) |
| | | .selectAs(SystemUser::getRealname,YwDeviceRecord::getRealName) |
| | | .selectAs(SystemUser::getMobile,YwDeviceRecord::getMobile) |
| | | .selectAs(Company::getName,YwDeviceRecord::getCompanyName) |
| | | .selectAs(YwDevice::getName,YwDeviceRecord::getDeviceName) |
| | | .selectAs(YwDevice::getCode,YwDeviceRecord::getDeviceCode) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwDeviceRecord::getUserId) |
| | | .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) |
| | | .leftJoin(YwDevice.class,YwDevice::getId,YwDeviceRecord::getDeviceId) |
| | | .eq(YwDeviceRecord::getIsdeleted,Constants.ZERO) |
| | | .and(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getDeviceName()),i->i.like(YwDevice::getName,model.getDeviceName()).or().like(YwDevice::getCode,model.getDeviceName())) |
| | | .ge(Objects.nonNull(model.getStartDate()),YwDeviceRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate())) |
| | | .le(Objects.nonNull(model.getEndDate()),YwDeviceRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getEndDate())) |
| | | .eq(YwDeviceRecord::getIsdeleted,Constants.ZERO) |
| | | ); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwDeviceMapper; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.YwDevice; |
| | | import com.doumee.dao.system.MultifileMapper; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.YwDeviceService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.java.Log; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 运维设备信息表Service实现 |
| | |
| | | @Autowired |
| | | private YwDeviceMapper ywDeviceMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String,Object> redisTemplate; |
| | | |
| | | |
| | | @Override |
| | | public Integer create(YwDevice ywDevice) { |
| | | if(Objects.isNull(ywDevice) |
| | | || StringUtils.isBlank(ywDevice.getName()) |
| | | || StringUtils.isBlank(ywDevice.getCode()) |
| | | || Objects.isNull(ywDevice.getStatus()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = ywDevice.getLoginUserInfo(); |
| | | if(ywDeviceMapper.selectCount(new QueryWrapper<YwDevice>().lambda().eq(YwDevice::getIsdeleted,Constants.ZERO).eq(YwDevice::getCode,ywDevice.getCode()))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"设备编号重复!"); |
| | | } |
| | | // if(StringUtils.isBlank(ywDevice.getCode())){ |
| | | // String code = this.getMaxAutoMaticDeviceCode(); |
| | | // while (ywDeviceMapper.selectCount(new QueryWrapper<YwDevice>().lambda().eq(YwDevice::getIsdeleted,Constants.ZERO).eq(YwDevice::getCode,code))>Constants.ZERO){ |
| | | // code = this.getMaxAutoMaticDeviceCode(); |
| | | // } |
| | | // ywDevice.setCode(code); |
| | | // }else{ |
| | | // |
| | | // } |
| | | ywDevice.setCreateDate(new Date()); |
| | | ywDevice.setCreator(loginUserInfo.getId()); |
| | | ywDevice.setIsdeleted(Constants.ZERO); |
| | | ywDeviceMapper.insert(ywDevice); |
| | | |
| | | if(Objects.nonNull(ywDevice.getMultifile())){ |
| | | ywDevice.getMultifile().setCreator(loginUserInfo.getId()); |
| | | ywDevice.getMultifile().setCreateDate(new Date()); |
| | | ywDevice.getMultifile().setIsdeleted(Constants.ZERO); |
| | | ywDevice.getMultifile().setObjType(Constants.MultiFile.FN_DEVICE_FILE.getKey()); |
| | | ywDevice.getMultifile().setObjId(ywDevice.getId()); |
| | | multifileMapper.insert(ywDevice.getMultifile()); |
| | | } |
| | | |
| | | return ywDevice.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | ywDeviceMapper.deleteById(id); |
| | | ywDeviceMapper.update(new UpdateWrapper<YwDevice>().lambda().set(YwDevice::getIsdeleted,Constants.ONE) |
| | | .set(YwDevice::getEditDate," now() ") |
| | | .set(YwDevice::getEditor,user.getId()) |
| | | .eq(YwDevice::getId,user.getId()) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void updateById(YwDevice ywDevice) { |
| | | if(Objects.isNull(ywDevice) |
| | | || StringUtils.isBlank(ywDevice.getName()) |
| | | || StringUtils.isBlank(ywDevice.getCode()) |
| | | || Objects.isNull(ywDevice.getStatus()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = ywDevice.getLoginUserInfo(); |
| | | if(ywDeviceMapper.selectCount(new QueryWrapper<YwDevice>().lambda().eq(YwDevice::getIsdeleted,Constants.ZERO) |
| | | .eq(YwDevice::getCode,ywDevice.getCode()) |
| | | .ne(YwDevice::getId,ywDevice.getId()))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"设备编号重复!"); |
| | | } |
| | | ywDevice.setEditDate(new Date()); |
| | | ywDevice.setEditor(loginUserInfo.getId()); |
| | | ywDeviceMapper.updateById(ywDevice); |
| | | multifileMapper.delete(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getObjId,ywDevice.getId()) |
| | | .eq(Multifile::getObjType,Constants.MultiFile.FN_DEVICE_FILE.getKey()) |
| | | ); |
| | | if(Objects.nonNull(ywDevice.getMultifile())){ |
| | | ywDevice.getMultifile().setCreator(loginUserInfo.getId()); |
| | | ywDevice.getMultifile().setCreateDate(new Date()); |
| | | ywDevice.getMultifile().setIsdeleted(Constants.ZERO); |
| | | ywDevice.getMultifile().setObjType(Constants.MultiFile.FN_DEVICE_FILE.getKey()); |
| | | ywDevice.getMultifile().setObjId(ywDevice.getId()); |
| | | multifileMapper.insert(ywDevice.getMultifile()); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public YwDevice getDetail(Integer id) { |
| | | YwDevice ywDevice = ywDeviceMapper.selectById(id); |
| | | Multifile multifile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.FN_DEVICE_FILE).last(" limit 1")); |
| | | if(Objects.nonNull(multifile)){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.YW_DEVICE).getCode(); |
| | | multifile.setFileurlFull(path + multifile.getFileurl()); |
| | | ywDevice.setMultifile(multifile); |
| | | } |
| | | return ywDevice; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public YwDevice findOne(YwDevice ywDevice) { |
| | | QueryWrapper<YwDevice> wrapper = new QueryWrapper<>(ywDevice); |
| | | return ywDeviceMapper.selectOne(wrapper); |
| | |
| | | @Override |
| | | public PageData<YwDevice> findPage(PageWrap<YwDevice> pageWrap) { |
| | | IPage<YwDevice> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<YwDevice> queryWrapper = new QueryWrapper<>(); |
| | | MPJLambdaWrapper<YwDevice> queryWrapper = new MPJLambdaWrapper<YwDevice>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(YwDevice::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(YwDevice::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(YwDevice::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(YwDevice::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | if (pageWrap.getModel().getModelNo() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getModelNo, pageWrap.getModel().getModelNo()); |
| | | } |
| | | if (pageWrap.getModel().getCateId() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getCateId, pageWrap.getModel().getCateId()); |
| | | } |
| | | if (pageWrap.getModel().getUserId() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getUserId, pageWrap.getModel().getUserId()); |
| | | } |
| | | if (pageWrap.getModel().getCompany() != null) { |
| | | queryWrapper.lambda().ge(YwDevice::getCompany, Utils.Date.getStart(pageWrap.getModel().getCompany())); |
| | | queryWrapper.lambda().le(YwDevice::getCompany, Utils.Date.getEnd(pageWrap.getModel().getCompany())); |
| | | } |
| | | if (pageWrap.getModel().getContent() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getContent, pageWrap.getModel().getContent()); |
| | | } |
| | | if (pageWrap.getModel().getCode() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getCode, pageWrap.getModel().getCode()); |
| | | } |
| | | if (pageWrap.getModel().getAddr() != null) { |
| | | queryWrapper.lambda().eq(YwDevice::getAddr, pageWrap.getModel().getAddr()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(ywDeviceMapper.selectPage(page, queryWrapper)); |
| | | YwDevice model = pageWrap.getModel(); |
| | | queryWrapper.selectAll(YwDevice.class) |
| | | .selectAs(Category::getName,YwDevice::getCategoryName) |
| | | .selectAs(SystemUser::getRealname,YwDevice::getRealName) |
| | | .leftJoin(Category.class,Category::getId,YwDevice::getCateId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwDevice::getUserId) |
| | | .and(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getName()),i->i.like(YwDevice::getName,model.getName()).or().like(YwDevice::getCode,model.getName())) |
| | | .eq(Objects.nonNull(model.getStatus()),YwDevice::getStatus,model.getStatus()) |
| | | .eq(YwDevice::getIsdeleted,Constants.ZERO) |
| | | .orderByDesc(YwDevice::getCreateDate) |
| | | ; |
| | | IPage iPage = ywDeviceMapper.selectJoinPage(page,YwDevice.class,queryWrapper); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwLinePointMapper; |
| | | import com.doumee.dao.business.YwPatrolLineMapper; |
| | | import com.doumee.dao.business.model.YwPatrolLine; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.YwPatrolLineService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 运维巡检路线信息表Service实现 |
| | |
| | | @Autowired |
| | | private YwPatrolLineMapper ywPatrolLineMapper; |
| | | |
| | | @Autowired |
| | | private YwLinePointMapper ywLinePointMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public Integer create(YwPatrolLine ywPatrolLine) { |
| | | if(Objects.isNull(ywPatrolLine) |
| | | || StringUtils.isBlank(ywPatrolLine.getName()) |
| | | || com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywPatrolLine.getLinePointList())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | LoginUserInfo loginUserInfo = ywPatrolLine.getLoginUserInfo(); |
| | | ywPatrolLine.setCreateDate(new Date()); |
| | | ywPatrolLine.setCreator(loginUserInfo.getId()); |
| | | ywPatrolLine.setIsdeleted(Constants.ZERO); |
| | | ywPatrolLine.setStatus(Constants.ZERO); |
| | | ywPatrolLineMapper.insert(ywPatrolLine); |
| | | //循环处理 子集数据 |
| | | |
| | | List<YwLinePoint> ywLinePointList = ywPatrolLine.getLinePointList(); |
| | | for (YwLinePoint ywLinePoint:ywLinePointList) { |
| | | if(Objects.isNull(ywLinePoint) |
| | | || Objects.isNull(ywLinePoint.getPointId()) |
| | | || Objects.isNull(ywLinePoint.getNeedScancode()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"巡检点配置错误"); |
| | | } |
| | | ywLinePoint.setCreateDate(new Date()); |
| | | ywLinePoint.setCreator(loginUserInfo.getId()); |
| | | ywLinePoint.setIsdeleted(Constants.ZERO); |
| | | ywLinePoint.setLineId(ywLinePoint.getId()); |
| | | } |
| | | ywLinePointMapper.insert(ywLinePointList); |
| | | return ywPatrolLine.getId(); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void updateById(YwPatrolLine ywPatrolLine) { |
| | | if(Objects.isNull(ywPatrolLine) |
| | | || StringUtils.isBlank(ywPatrolLine.getName()) |
| | | || com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywPatrolLine.getLinePointList())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | LoginUserInfo loginUserInfo = ywPatrolLine.getLoginUserInfo(); |
| | | ywPatrolLine.setEditDate(new Date()); |
| | | ywPatrolLine.setEditor(loginUserInfo.getId()); |
| | | ywPatrolLineMapper.updateById(ywPatrolLine); |
| | | //删除子数据 |
| | | ywLinePointMapper.delete(new QueryWrapper<YwLinePoint>().lambda() |
| | | .eq(YwLinePoint::getLineId,ywPatrolLine.getId())); |
| | | //循环处理 子集数据 |
| | | List<YwLinePoint> ywLinePointList = ywPatrolLine.getLinePointList(); |
| | | for (YwLinePoint ywLinePoint:ywLinePointList) { |
| | | if(Objects.isNull(ywLinePoint) |
| | | || Objects.isNull(ywLinePoint.getPointId()) |
| | | || Objects.isNull(ywLinePoint.getNeedScancode()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"巡检点配置错误"); |
| | | } |
| | | ywLinePoint.setLineId(ywLinePoint.getId()); |
| | | ywLinePoint.setCreateDate(new Date()); |
| | | ywLinePoint.setCreator(loginUserInfo.getId()); |
| | | ywLinePoint.setIsdeleted(Constants.ZERO); |
| | | } |
| | | ywLinePointMapper.insert(ywLinePointList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return ywPatrolLineMapper.selectById(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public YwPatrolLine getDetail(Integer id) { |
| | | YwPatrolLine ywPatrolLine = ywPatrolLineMapper.selectById(id); |
| | | |
| | | List<YwLinePoint> ywLinePointList = ywLinePointMapper.selectJoinList(YwLinePoint.class,new MPJLambdaWrapper<YwLinePoint>() |
| | | .selectAll(YwLinePoint.class) |
| | | .selectAs(YwPatrolPoint::getName,YwLinePoint::getPointName) |
| | | .leftJoin(YwPatrolLine.class,YwPatrolLine::getId,YwLinePoint::getPointId) |
| | | .eq(YwLinePoint::getLineId,id) |
| | | .orderByAsc(YwLinePoint::getSortnum) |
| | | ); |
| | | |
| | | ywPatrolLine.setLinePointList(ywLinePointList); |
| | | |
| | | return ywPatrolLine; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public YwPatrolLine findOne(YwPatrolLine ywPatrolLine) { |
| | | QueryWrapper<YwPatrolLine> wrapper = new QueryWrapper<>(ywPatrolLine); |
| | |
| | | @Override |
| | | public PageData<YwPatrolLine> findPage(PageWrap<YwPatrolLine> pageWrap) { |
| | | IPage<YwPatrolLine> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<YwPatrolLine> queryWrapper = new QueryWrapper<>(); |
| | | MPJLambdaWrapper<YwPatrolLine> queryWrapper = new MPJLambdaWrapper<YwPatrolLine>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(YwPatrolLine::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(YwPatrolLine::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(YwPatrolLine::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(YwPatrolLine::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | if (pageWrap.getModel().getImgurl() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolLine::getImgurl, pageWrap.getModel().getImgurl()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(ywPatrolLineMapper.selectPage(page, queryWrapper)); |
| | | YwPatrolLine model = pageWrap.getModel(); |
| | | queryWrapper.selectAll(YwPatrolLine.class) |
| | | .select(" ( select count(1) from yw_line_point y where y.LINE_ID = yw_patrol_line.id ) as lineAmount ") |
| | | .like(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getName()),YwPatrolLine::getName,model.getName()) |
| | | .eq(YwPatrolLine::getIsdeleted,Constants.ZERO) |
| | | .orderByDesc(YwPatrolLine::getCreateDate) |
| | | ; |
| | | IPage iPage = ywPatrolLineMapper.selectJoinPage(page,YwPatrolLine.class,queryWrapper); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwPatrolPointMapper; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.YwDevice; |
| | | import com.doumee.dao.business.model.YwPatrolPoint; |
| | | import com.doumee.dao.system.MultifileMapper; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.YwPatrolPointService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 运维巡检点信息表Service实现 |
| | |
| | | |
| | | @Autowired |
| | | private YwPatrolPointMapper ywPatrolPointMapper; |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | |
| | | @Override |
| | | public Integer create(YwPatrolPoint ywPatrolPoint) { |
| | | if(Objects.isNull(ywPatrolPoint) |
| | | || Objects.isNull(ywPatrolPoint.getCode()) |
| | | || Objects.isNull(ywPatrolPoint.getName()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(ywPatrolPointMapper.selectCount(new QueryWrapper<YwPatrolPoint>().lambda().eq(YwPatrolPoint::getIsdeleted,Constants.ZERO) |
| | | .eq(YwPatrolPoint::getCode,ywPatrolPoint.getCode()))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"巡检点编码重复!"); |
| | | } |
| | | LoginUserInfo loginUserInfo = ywPatrolPoint.getLoginUserInfo(); |
| | | ywPatrolPoint.setCreateDate(new Date()); |
| | | ywPatrolPoint.setCreator(loginUserInfo.getId()); |
| | | ywPatrolPoint.setIsdeleted(Constants.ZERO); |
| | | ywPatrolPoint.setStatus(Constants.ZERO); |
| | | ywPatrolPointMapper.insert(ywPatrolPoint); |
| | | |
| | | |
| | | if(Objects.nonNull(ywPatrolPoint.getMultifile())){ |
| | | ywPatrolPoint.getMultifile().setCreator(loginUserInfo.getId()); |
| | | ywPatrolPoint.getMultifile().setCreateDate(new Date()); |
| | | ywPatrolPoint.getMultifile().setIsdeleted(Constants.ZERO); |
| | | ywPatrolPoint.getMultifile().setObjType(Constants.MultiFile.FN_PATROL_POINT_FILE.getKey()); |
| | | ywPatrolPoint.getMultifile().setObjId(ywPatrolPoint.getId()); |
| | | multifileMapper.insert(ywPatrolPoint.getMultifile()); |
| | | } |
| | | |
| | | return ywPatrolPoint.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | ywPatrolPointMapper.deleteById(id); |
| | | ywPatrolPointMapper.update(new UpdateWrapper<YwPatrolPoint>().lambda().set(YwPatrolPoint::getIsdeleted,Constants.ONE) |
| | | .set(YwPatrolPoint::getEditDate," now() ") |
| | | .set(YwPatrolPoint::getEditor,user.getId()) |
| | | .eq(YwPatrolPoint::getId,user.getId()) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void updateById(YwPatrolPoint ywPatrolPoint) { |
| | | if(Objects.isNull(ywPatrolPoint) |
| | | || Objects.isNull(ywPatrolPoint.getId()) |
| | | || Objects.isNull(ywPatrolPoint.getCode()) |
| | | || Objects.isNull(ywPatrolPoint.getName()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(ywPatrolPointMapper.selectCount(new QueryWrapper<YwPatrolPoint>().lambda().eq(YwPatrolPoint::getIsdeleted,Constants.ZERO) |
| | | .eq(YwPatrolPoint::getCode,ywPatrolPoint.getCode()).ne(YwPatrolPoint::getId,ywPatrolPoint.getId()))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"巡检点编码重复!"); |
| | | } |
| | | LoginUserInfo loginUserInfo = ywPatrolPoint.getLoginUserInfo(); |
| | | ywPatrolPoint.setEditDate(new Date()); |
| | | ywPatrolPoint.setEditor(loginUserInfo.getId()); |
| | | ywPatrolPointMapper.updateById(ywPatrolPoint); |
| | | |
| | | multifileMapper.delete(new QueryWrapper<Multifile>().lambda() |
| | | .eq(Multifile::getObjId,ywPatrolPoint.getId()) |
| | | .eq(Multifile::getObjType,Constants.MultiFile.FN_PATROL_POINT_FILE.getKey()) |
| | | ); |
| | | |
| | | if(Objects.nonNull(ywPatrolPoint.getMultifile())){ |
| | | ywPatrolPoint.getMultifile().setCreator(loginUserInfo.getId()); |
| | | ywPatrolPoint.getMultifile().setCreateDate(new Date()); |
| | | ywPatrolPoint.getMultifile().setIsdeleted(Constants.ZERO); |
| | | ywPatrolPoint.getMultifile().setObjType(Constants.MultiFile.FN_PATROL_POINT_FILE.getKey()); |
| | | ywPatrolPoint.getMultifile().setObjId(ywPatrolPoint.getId()); |
| | | multifileMapper.insert(ywPatrolPoint.getMultifile()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public YwPatrolPoint getDetail(Integer id) { |
| | | YwPatrolPoint ywPatrolPoint = ywPatrolPointMapper.selectById(id); |
| | | Multifile multifile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjId,id) |
| | | .eq(Multifile::getObjType,Constants.MultiFile.FN_PATROL_POINT_FILE).last(" limit 1")); |
| | | if(Objects.nonNull(multifile)){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.YW_PATROL).getCode(); |
| | | multifile.setFileurlFull(path + multifile.getFileurl()); |
| | | ywPatrolPoint.setMultifile(multifile); |
| | | } |
| | | return ywPatrolPoint; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public YwPatrolPoint findOne(YwPatrolPoint ywPatrolPoint) { |
| | | QueryWrapper<YwPatrolPoint> wrapper = new QueryWrapper<>(ywPatrolPoint); |
| | | return ywPatrolPointMapper.selectOne(wrapper); |
| | |
| | | |
| | | @Override |
| | | public List<YwPatrolPoint> findList(YwPatrolPoint ywPatrolPoint) { |
| | | QueryWrapper<YwPatrolPoint> wrapper = new QueryWrapper<>(ywPatrolPoint); |
| | | QueryWrapper<YwPatrolPoint> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda().eq(YwPatrolPoint::getIsdeleted,Constants.ZERO); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(ywPatrolPoint.getIdLists())){ |
| | | wrapper.lambda().notIn(YwPatrolPoint::getId,ywPatrolPoint.getIdLists()); |
| | | } |
| | | return ywPatrolPointMapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public PageData<YwPatrolPoint> findPage(PageWrap<YwPatrolPoint> pageWrap) { |
| | | IPage<YwPatrolPoint> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<YwPatrolPoint> queryWrapper = new QueryWrapper<>(); |
| | | MPJLambdaWrapper<YwPatrolPoint> queryWrapper = new MPJLambdaWrapper<YwPatrolPoint>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(YwPatrolPoint::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(YwPatrolPoint::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(YwPatrolPoint::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(YwPatrolPoint::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | if (pageWrap.getModel().getImgurl() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getImgurl, pageWrap.getModel().getImgurl()); |
| | | } |
| | | if (pageWrap.getModel().getAreaId() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getAreaId, pageWrap.getModel().getAreaId()); |
| | | } |
| | | if (pageWrap.getModel().getAddr() != null) { |
| | | queryWrapper.lambda().eq(YwPatrolPoint::getAddr, pageWrap.getModel().getAddr()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(ywPatrolPointMapper.selectPage(page, queryWrapper)); |
| | | YwPatrolPoint model = pageWrap.getModel(); |
| | | queryWrapper.selectAll(YwPatrolPoint.class) |
| | | .selectAs(Category::getName,YwPatrolPoint::getAreaName) |
| | | .selectAs(YwDevice::getName,YwPatrolPoint::getDeviceName) |
| | | .leftJoin(Category.class,Category::getId,YwPatrolPoint::getAreaId) |
| | | .leftJoin(YwDevice.class,YwDevice::getId,YwPatrolPoint::getDeviceId) |
| | | .and(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getName()), |
| | | i->i.like(YwPatrolPoint::getName,model.getName()).or().like(YwPatrolPoint::getCode,model.getName())) |
| | | .eq(Objects.nonNull(model.getAreaId()),YwPatrolPoint::getAreaId,model.getAreaId()) |
| | | .eq(YwPatrolPoint::getIsdeleted,Constants.ZERO) |
| | | .orderByDesc(YwPatrolPoint::getCreateDate) |
| | | ; |
| | | IPage iPage = ywPatrolPointMapper.selectJoinPage(page,YwPatrolPoint.class,queryWrapper); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |