ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWell.java
@@ -1,6 +1,8 @@ package com.ruoyi.alarmpoints.well.domain; import java.util.Date; import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -96,4 +98,7 @@ /** å ³èç¸æºID */ private String cameraId; @TableField(exist = false) private String type; } ard-work/src/main/java/com/ruoyi/alarmpoints/well/domain/ArdAlarmpointsWellVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,18 @@ package com.ruoyi.alarmpoints.well.domain; import com.baomidou.mybatisplus.annotation.TableField; import com.ruoyi.common.annotation.Excel; import lombok.Data; @Data public class ArdAlarmpointsWellVo { /** id */ private String id; /** äºå· */ @Excel(name = "äºå·") private String wellId; @TableField(exist = false) private String type; } ard-work/src/main/java/com/ruoyi/app/patrolplan/controller/ArdAppPatrolplanController.java
@@ -190,10 +190,11 @@ */ @PreAuthorize("@ss.hasPermi('app:appPatrolplan:edit')") @Log(title = "appå·¡æ£è®¡å", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ArdAppPatrolplan ardAppPatrolplan) @ApiOperation("ä¿®æ¹åæ¡æ°æ®") @PutMapping("upd") public Results edit(@RequestBody Map<String,Object> para) { return toAjax(ardAppPatrolplanService.updateArdAppPatrolplan(ardAppPatrolplan)); return ardAppPatrolplanService.updateArdAppPatrolplan(para); } ard-work/src/main/java/com/ruoyi/app/patrolplan/domain/ArdAppPatrolplan.java
@@ -64,18 +64,6 @@ // @JsonInclude(JsonInclude.Include.NON_DEFAULT ) private String pUser; /** * å·¡æ£ç¹éå */ @TableField(exist = false) private List<ArdAlarmpointsWell> wellList; /** * å·¡æ£äººéå */ @TableField(exist = false) private List<SysUser> userList; @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) ard-work/src/main/java/com/ruoyi/app/patrolplan/mapper/ArdAppPatrolplanMapper.java
@@ -38,14 +38,6 @@ public int insertArdAppPatrolplan(ArdAppPatrolplan ardAppPatrolplan); /** * ä¿®æ¹appå·¡æ£è®¡å * * @param ardAppPatrolplan appå·¡æ£è®¡å * @return ç»æ */ public int updateArdAppPatrolplan(ArdAppPatrolplan ardAppPatrolplan); /** * å é¤appå·¡æ£è®¡å * * @param patroEndTime appå·¡æ£è®¡åä¸»é® ard-work/src/main/java/com/ruoyi/app/patrolplan/service/IArdAppPatrolplanService.java
@@ -41,10 +41,9 @@ /** * ä¿®æ¹appå·¡æ£è®¡å * * @param ardAppPatrolplan appå·¡æ£è®¡å * @return ç»æ */ public int updateArdAppPatrolplan(ArdAppPatrolplan ardAppPatrolplan); public Results updateArdAppPatrolplan(Map<String,Object> para); /** ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolplanServiceImpl.java
@@ -9,18 +9,21 @@ import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellVo; import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper; import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpoint; import com.ruoyi.app.patrolplan.domain.ArdAppPatroluser; import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolpointMapper; import com.ruoyi.app.patrolplan.mapper.ArdAppPatroluserMapper; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUserVo; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.utils.result.Results; import org.apache.logging.log4j.util.Strings; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolplanMapper; @@ -91,12 +94,54 @@ /** * ä¿®æ¹appå·¡æ£è®¡å * * @param ardAppPatrolplan appå·¡æ£è®¡å * @return ç»æ */ @Override public int updateArdAppPatrolplan(ArdAppPatrolplan ardAppPatrolplan) { return ardAppPatrolplanMapper.updateArdAppPatrolplan(ardAppPatrolplan); public Results updateArdAppPatrolplan(Map<String,Object> para) { if(para.get("id").toString().isEmpty()){ return Results.error("IDæ æï¼"); } //ä¿®æ¹ä¸»è¡¨ ArdAppPatrolplan ardAppPatrolplan = new ArdAppPatrolplan(); ardAppPatrolplan.setId(para.get("id").toString()); ardAppPatrolplan.setUserId(para.get("userId").toString()); ardAppPatrolplan.setCycle(para.get("cycle").toString()); ardAppPatrolplan.setPatroBeginTime(para.get("patroBeginTime").toString()); ardAppPatrolplan.setPatroEndTime(para.get("patroEndTime").toString()); ardAppPatrolplan.setPlanName(para.get("planName").toString()); int num = ardAppPatrolplanMapper.updateById(ardAppPatrolplan); //ä¿®æ¹å ´è¶£ç¹ ardAppPatrolpointMapper.deleteArdAppPatrolpointByPlanId(para.get("id").toString());//å é¤å·¡æ£è®¡å䏿ç¹ä½ List<String> alarmpointIdList = (List<String>) para.get("alarmpointIdList"); List<ArdAppPatrolpoint> ardAppPatrolpointList = new ArrayList(); for(String alarmpointId : alarmpointIdList){ String patrolpointId = IdUtils.simpleUUID(); ArdAppPatrolpoint ardAppPatrolpoint = new ArdAppPatrolpoint(); ardAppPatrolpoint.setId(patrolpointId); ardAppPatrolpoint.setPatrolplanId(para.get("id").toString()); ardAppPatrolpoint.setAlarmpointsId(alarmpointId); ardAppPatrolpoint.setType((String) para.get("type")); ardAppPatrolpointList.add(ardAppPatrolpoint); } ardAppPatrolpointMapper.insertArdAppPatrolpointList(ardAppPatrolpointList);//æ°å¢å ³èå ´è¶£ç¹ //ä¿®æ¹ç¨æ· ardAppPatroluserMapper.deleteArdAppPatroluserByPlanId(para.get("id").toString());//å é¤å·¡æ£è®¡åä¸æç¨æ· List<String> appUserIdList = (List<String>) para.get("appUserIdList"); List<ArdAppPatroluser> ardAppPatroluserList = new ArrayList(); for(String appUserId : appUserIdList){ String patroluserId = IdUtils.simpleUUID(); ArdAppPatroluser ardAppPatroluser = new ArdAppPatroluser(); ardAppPatroluser.setId(patroluserId); ardAppPatroluser.setPatrolplanId(para.get("id").toString()); ardAppPatroluser.setAppUserId(appUserId); ardAppPatroluserList.add(ardAppPatroluser); } ardAppPatroluserMapper.insertArdAppPatroluserList(ardAppPatroluserList);//æ°å¢å ³è人å if(num>0){ return Results.succeed("ä¿®æ¹æåï¼"); }else { return Results.error("ä¿®æ¹å¤±è´¥ï¼"); } } @@ -167,12 +212,29 @@ @Override public Results oneById(String id) { JSONObject jsonObject = new JSONObject(); ArdAppPatrolplan ardAppPatrolplan = ardAppPatrolplanMapper.selectById(id); jsonObject.put("plan",ardAppPatrolplan); List<ArdAlarmpointsWell> ardAlarmpointsWellList = ardAlarmpointsWellMapper.wellByPlanId(id); List<ArdAlarmpointsWellVo> wellVos = new ArrayList<>(); for (ArdAlarmpointsWell ardAlarmpointsWell : ardAlarmpointsWellList) { ArdAlarmpointsWellVo wellVo = new ArdAlarmpointsWellVo(); wellVo.setId(ardAlarmpointsWell.getId()); wellVo.setType(ardAlarmpointsWell.getType()); wellVo.setWellId(ardAlarmpointsWell.getWellId()); wellVos.add(wellVo); } jsonObject.put("well",wellVos); List<SysUser> sysUserList = sysUserMapper.userByPlanId(id); ardAppPatrolplan.setUserList(sysUserList); ardAppPatrolplan.setWellList(ardAlarmpointsWellList); return Results.succeed(ardAppPatrolplan); List<SysUserVo> sysUserVos = new ArrayList<>(); for (int i = 0; i < sysUserList.size(); i++) { SysUserVo sysUserVo = new SysUserVo(); sysUserVo.setUserId(sysUserList.get(i).getUserId()); sysUserVo.setNickName(sysUserList.get(i).getNickName()); sysUserVos.add(sysUserVo); } jsonObject.put("user",sysUserVos); return Results.succeed(jsonObject); } @Override ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
@@ -31,6 +31,12 @@ <result property="cameraId" column="camera_id"/> </resultMap> <resultMap type="ArdAlarmpointsWell" id="wellResult"> <result property="id" column="id"/> <result property="wellId" column="well_id"/> <result property="type" column="type"/> </resultMap> <sql id="selectArdAlarmpointsWellVo"> select c.id, c.well_id, @@ -198,7 +204,7 @@ WHERE well_id = #{wellId} </select> <select id="wellByPlanId" parameterType="String" resultMap="ArdAlarmpointsWellResult"> select * from ard_alarmpoints_well where id in (select alarmpoints_id from ard_app_patrolpoint where patrolplan_id = #{id}) <select id="wellByPlanId" parameterType="String" resultMap="wellResult"> select ard_app_patrolpoint.alarmpoints_id as id,ard_alarmpoints_well.well_id, ard_app_patrolpoint."type" from ard_alarmpoints_well LEFT JOIN ard_app_patrolpoint on ard_app_patrolpoint.alarmpoints_id = ard_alarmpoints_well.id where ard_alarmpoints_well.id in (select alarmpoints_id from ard_app_patrolpoint where patrolplan_id = #{id}) </select> </mapper> ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUserVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,18 @@ package com.ruoyi.common.core.domain.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.ruoyi.common.annotation.Excel; import lombok.Data; @Data public class SysUserVo { /** * ç¨æ·ID */ private String userId; /** * ç¨æ·æµç§° */ private String nickName; } ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -293,6 +293,6 @@ </select> <select id="userByPlanId" parameterType="String" resultMap="SysUserResult"> select * from sys_user where user_id in (select app_user_id from ard_app_patroluser where patrolplan_id = #{id}) select user_id,nick_name from sys_user where user_id in (select app_user_id from ard_app_patroluser where patrolplan_id = #{id}) </select> </mapper>