20231120_qiuyh_区域巡检打卡、防患举报、物料web端
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("selectInfo") |
| | | BasicResult selectInfo(@RequestParam Integer id){ |
| | | BasicResult selectInfo(@RequestParam String id){ |
| | | return this.service.selectInfo(id); |
| | | } |
| | | |
| | |
| | | |
| | | List<SuMaterialWarehouseEntity> selectPageList(Map map); |
| | | |
| | | SuMaterialWarehouseEntity selectInfo(Integer id); |
| | | SuMaterialWarehouseEntity selectInfo(String id); |
| | | |
| | | /** |
| | | * 通过屏幕号查询最新一条 |
| | |
| | | import com.thhy.general.common.BasicResult; |
| | | import com.thhy.materials.modules.biz.suMaterialWarehouse.entity.SuMaterialWarehouseEntity; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | BasicResult selectPageList(Map map); |
| | | |
| | | BasicResult selectInfo(Integer id); |
| | | BasicResult selectInfo(String id); |
| | | |
| | | BasicResult selectNewOneByTableNum(Integer tableNum); |
| | | } |
| | |
| | | String companyId = sysUserInfo.getCompanyId(); |
| | | String userId = sysUserInfo.getUserId(); |
| | | String id = suMaterialWarehouseEntity.getId(); |
| | | suMaterialWarehouseEntity.setType(1);//1手动 |
| | | if(StringUtils.isNotBlank(id)){ |
| | | suMaterialWarehouseEntity.setUpdateTime(new Date()); |
| | | suMaterialWarehouseEntity.setUpdateUser(userId); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public BasicResult selectInfo(Integer id) { |
| | | public BasicResult selectInfo(String id) { |
| | | return BasicResult.success(suMaterialWarehouseMapper.selectInfo(id)); |
| | | } |
| | | |
| | |
| | | update_user= #{updateUser,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | update_time #{updateTime,jdbcType=TIMESTAMP}, |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="companyId != null"> |
| | | company_id = #{companyId,jdbcType=VARCHAR}, |
| | |
| | | </insert> |
| | | |
| | | <delete id="delete"> |
| | | update t_su_material_warehouse set isUse = 0 where id = #{id,jdbcType=VARCHAR} |
| | | update t_su_material_warehouse_record set is_use = 0 where id = #{id,jdbcType=VARCHAR} |
| | | </delete> |
| | | |
| | | <select id="selectPageList" resultType="com.thhy.materials.modules.biz.suMaterialWarehouse.entity.SuMaterialWarehouseEntity"> |
| | |
| | | t.id AS id, |
| | | t.name_of_origin AS nameOfOrigin, |
| | | t.table_num AS tableNum, |
| | | sd.dict_name AS materialName, |
| | | t.material_name AS materialName, |
| | | t.incoming_quantity AS incomingQuantity, |
| | | t.create_time AS createTime, |
| | | t.status AS status, |
| | |
| | | LEFT JOIN sys_users su1 on su1.user_id = t.update_user |
| | | LEFT JOIN sys_dict sd on sd.dict_id = t.material_name |
| | | where t.is_use = 1 and t.company_id = #{companyId} |
| | | <if test="tableNum != null and tableNum !=''"> |
| | | and t.table_num = #{tableNum} |
| | | </if> |
| | | <if test="type != null and type !=''"> |
| | | and t.type = #{type} |
| | | </if> |
| | | <if test="startTime != null and endTime != null"> |
| | | and t.create_time between #{startTime} and #{endTime} |
| | | </if> |
| | | order by t.create_time desc |
| | | </select> |
| | | |
| | |
| | | t.id AS id, |
| | | t.name_of_origin AS nameOfOrigin, |
| | | t.table_num AS tableNum, |
| | | sd.dict_name AS materialName, |
| | | t.material_name AS materialName, |
| | | t.incoming_quantity AS incomingQuantity, |
| | | t.create_time AS createTime, |
| | | t.status AS status, |
| | |
| | | t.id AS id, |
| | | t.table_num AS tableNum, |
| | | t.name_of_origin AS nameOfOrigin, |
| | | sd.dict_name AS materialName, |
| | | t.material_name AS materialName, |
| | | t.incoming_quantity AS incomingQuantity, |
| | | t.create_time AS createTime, |
| | | t.status AS status, |
| | |
| | | void delete(String id); |
| | | |
| | | List<HiddenDangerEntity> selectPageList(Map<String,Object> map); |
| | | List<HiddenDangerEntity> selectAppList(Map<String,Object> map); |
| | | |
| | | HiddenDangerEntity selectInfo(String id); |
| | | |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | map.put("companyId",sysUserInfo.getCompanyId()); |
| | | int pageNum = (int) map.get("pageNum"); |
| | | int pageSize = (int) map.get("pageSize"); |
| | | int type = (int) map.get("type");//type =1 小程序来的 |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<HiddenDangerEntity> hiddenDangerEntities = hiddenDangerMapper.selectPageList(map); |
| | | List<HiddenDangerEntity> hiddenDangerEntities = new ArrayList<>(); |
| | | if(type == 1){ |
| | | //小程序 待审核排前面 待审核按时间正序 审核成功的倒叙 |
| | | hiddenDangerEntities = hiddenDangerMapper.selectAppList(map); |
| | | }else { |
| | | //web 按时间倒序 |
| | | hiddenDangerEntities = hiddenDangerMapper.selectPageList(map); |
| | | } |
| | | hiddenDangerEntities.forEach(obj ->{ |
| | | String id = obj.getId(); |
| | | obj.setImgEntities(hiddenDangerMapper.selectImgList(id)); |
对比新文件 |
| | |
| | | package com.thhy.secure.modules.biz.regionInspection.controller; |
| | | |
| | | import com.thhy.general.common.BasicResult; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionEntity; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionRecordEntity; |
| | | import com.thhy.secure.modules.biz.regionInspection.service.RegionInspectionRecordService; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author QiuYuHao |
| | | * @CreateDate 2023-11-20 13:21:02 |
| | | * 区域打卡记录控制层 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("regionInspectionRecord") |
| | | public class RegionInspectionRecordController { |
| | | |
| | | @Autowired |
| | | private RegionInspectionRecordService regionInspectionRecordService; |
| | | /** |
| | | * app提交打卡 |
| | | * @param regionInspectionEntity |
| | | * @return |
| | | */ |
| | | @PostMapping("clockInSubmission") |
| | | BasicResult clockInSubmission(@RequestBody RegionInspectionRecordEntity regionInspectionEntity){ |
| | | return regionInspectionRecordService.insertAndUpdate(regionInspectionEntity); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("delete") |
| | | BasicResult delete(@RequestParam String id){ |
| | | return regionInspectionRecordService.delete(id); |
| | | } |
| | | |
| | | /** |
| | | * 查询分页列表 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping("selectPageList") |
| | | BasicResult selectPageList(@RequestBody Map map){ |
| | | return regionInspectionRecordService.selectPageList(map); |
| | | } |
| | | |
| | | /** |
| | | * web端列表详情 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping("selectInfo") |
| | | BasicResult selectInfo(@RequestBody Map map){ |
| | | String regionInspectionId = map.get("regionInspectionId").toString(); |
| | | String userId = map.get("userId").toString(); |
| | | return regionInspectionRecordService.selectInfo(regionInspectionId,userId); |
| | | } |
| | | |
| | | /** |
| | | * web端列表详情的区域详情 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping("regionInfo") |
| | | BasicResult regionInfo(@RequestBody Map map) { |
| | | String regionInspectionId = map.get("regionInspectionId").toString(); |
| | | String userId = map.get("userId").toString(); |
| | | String regionHazardInformId = map.get("regionHazardInformId").toString(); |
| | | return regionInspectionRecordService.regionInfo(regionInspectionId,userId,regionHazardInformId); |
| | | } |
| | | |
| | | /** |
| | | * 小程序列表详情 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping("selectAppInfo") |
| | | BasicResult selectAppInfo(@RequestBody Map map){ |
| | | String regionInspectionId = map.get("regionInspectionId").toString(); |
| | | String userId = map.get("userId").toString(); |
| | | return regionInspectionRecordService.selectAppInfo(regionInspectionId,userId); |
| | | } |
| | | |
| | | /** |
| | | * 小程序列表 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping("selectAppList") |
| | | BasicResult selectAppList(@RequestBody Map map){ |
| | | return regionInspectionRecordService.selectAppList(map); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private String companyId; |
| | | |
| | | private Integer status; //针对任务的完成状态 0未完成 1完成 |
| | | /** |
| | | * 巡检路线 |
| | | */ |
| | |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author QiuYuHao |
| | |
| | | private Integer sort; |
| | | |
| | | private String region; |
| | | |
| | | /** |
| | | * 一个区域对应一个结果记录 |
| | | */ |
| | | RegionInspectionRecordEntity recordEntity; |
| | | } |
对比新文件 |
| | |
| | | package com.thhy.secure.modules.biz.regionInspection.entity; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author QiuYuHao |
| | | * @CreateDate 2023-11-17 12:56:05 |
| | | * 区域巡检打卡记录表 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class RegionInspectionRecordEntity implements Serializable { |
| | | private String id; |
| | | private String regionInspectionId;//巡检任务id |
| | | private String userId;//用户id |
| | | |
| | | private Integer status;//0未完成 1完成 |
| | | private String statusName;//状态名称 0未完成 1完成 |
| | | |
| | | private String regionHazardInformId;//区域id |
| | | private String region;//区域 |
| | | |
| | | private String location;//当前位置 |
| | | private Date inspectionTime;//巡检时间 |
| | | private String createUser; |
| | | private Date createTime; |
| | | private String updateUser; |
| | | private Date updateTime; |
| | | private String result;//巡检结果 |
| | | //下面这些不是本表字段 |
| | | private String realName; |
| | | private String task;//任务 |
| | | private String standard;//巡检标准 |
| | | private String regions; |
| | | private String regionIds; |
| | | |
| | | private String[] imgPaths; |
| | | |
| | | List<RegionInspectionRecordImgEntity> imgList; |
| | | } |
对比新文件 |
| | |
| | | package com.thhy.secure.modules.biz.regionInspection.entity; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * @Author QiuYuHao |
| | | * @CreateDate 2023-11-17 13:25:12 |
| | | * 打卡记录图片表 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class RegionInspectionRecordImgEntity { |
| | | private String id; |
| | | private String regionInspectionRecordId;//打卡记录表id |
| | | private String imgName; |
| | | private String imgPath; |
| | | } |
对比新文件 |
| | |
| | | package com.thhy.secure.modules.biz.regionInspection.mapper; |
| | | |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionEntity; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionRecordEntity; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionRecordImgEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author QiuYuHao |
| | | * @CreateDate 2023-11-17 13:00:08 |
| | | * 打卡记录mapper |
| | | */ |
| | | @Mapper |
| | | public interface RegionInspectionRecordMapper { |
| | | |
| | | //app提交打卡 |
| | | void insert(RegionInspectionRecordEntity regionInspectionEntity); |
| | | |
| | | //删除打卡记录 |
| | | void delete(String id); |
| | | //根据任务id删除记录 |
| | | void deleteByRegionInspectionId(String regionInspectionId); |
| | | //任务打卡web端查询列表 或者 判断主任务完成未完成的标准 |
| | | List<RegionInspectionRecordEntity> selectPageList(Map map); |
| | | |
| | | //通过任务id查询打卡详情#{regionInspectionId} and b.user_id = #{userId} |
| | | RegionInspectionEntity selectInfo( |
| | | @Param("regionInspectionId") String regionInspectionId, |
| | | @Param("userId") String userId); |
| | | |
| | | |
| | | //获取web端任务打卡列表查询详情的区域详情 |
| | | RegionInspectionRecordEntity regionInfo( |
| | | @Param("regionInspectionId") String regionInspectionId, |
| | | @Param("userId") String userId, |
| | | @Param("regionHazardInformId")String regionHazardInformId); |
| | | |
| | | void insertIMG(RegionInspectionRecordImgEntity regionInspectionRecordImgEntity); |
| | | |
| | | //小程序巡检打卡列表 |
| | | List<Map> selectAppList(Map map); |
| | | } |
对比新文件 |
| | |
| | | package com.thhy.secure.modules.biz.regionInspection.service; |
| | | |
| | | import com.thhy.general.common.BasicResult; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionRecordEntity; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author QiuYuHao |
| | | * @CreateDate 2023-11-17 15:51:06 |
| | | * 区域巡检打卡记录表接口 |
| | | */ |
| | | public interface RegionInspectionRecordService { |
| | | |
| | | //新增打卡记录 |
| | | BasicResult insertAndUpdate(RegionInspectionRecordEntity regionInspectionEntity); |
| | | |
| | | //删除打卡记录 |
| | | BasicResult delete(String id); |
| | | |
| | | //任务打卡web端查询列表 |
| | | BasicResult selectPageList(Map map); |
| | | |
| | | //通过任务id查询打卡详情 |
| | | BasicResult selectInfo(String regionInspectionId,String userId); |
| | | |
| | | //通过任务id查询打卡详情 |
| | | BasicResult selectAppInfo(String regionInspectionId,String userId); |
| | | |
| | | BasicResult regionInfo( |
| | | String regionInspectionId, |
| | | String userId, |
| | | String regionHazardInformId); |
| | | |
| | | //小程序打卡列表 |
| | | BasicResult selectAppList(Map map); |
| | | } |
对比新文件 |
| | |
| | | package com.thhy.secure.modules.biz.regionInspection.service.impl; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.thhy.general.common.BasicResult; |
| | | import com.thhy.general.config.SysUserInfo; |
| | | import com.thhy.general.utils.UUIDUtils; |
| | | import com.thhy.general.utils.UserInfoUtils; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.*; |
| | | import com.thhy.secure.modules.biz.regionInspection.mapper.RegionInspectionMapper; |
| | | import com.thhy.secure.modules.biz.regionInspection.mapper.RegionInspectionRecordMapper; |
| | | import com.thhy.secure.modules.biz.regionInspection.service.RegionInspectionRecordService; |
| | | 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 java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * @Author QiuYuHao |
| | | * @CreateDate 2023-11-17 15:51:37 |
| | | * 区域巡检打卡记录表实现 |
| | | */ |
| | | @Service |
| | | public class RegionInspectionRecordServiceImpl implements RegionInspectionRecordService { |
| | | |
| | | @Autowired |
| | | private RegionInspectionRecordMapper regionInspectionRecordMapper; |
| | | |
| | | @Autowired |
| | | private RegionInspectionMapper regionInspectionMapper; |
| | | |
| | | /** |
| | | * 小程序提交打卡 |
| | | * @param regionInspectionEntity |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BasicResult insertAndUpdate(RegionInspectionRecordEntity regionInspectionEntity) { |
| | | SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); |
| | | String userId = sysUserInfo.getUserId(); |
| | | //修改逻辑 |
| | | if (StringUtils.isNotBlank(regionInspectionEntity.getId())){ |
| | | regionInspectionEntity.setUpdateUser(userId); |
| | | regionInspectionEntity.setInspectionTime(new Date()); |
| | | regionInspectionEntity.setUpdateTime(new Date()); |
| | | } |
| | | synchronized (this){ |
| | | //修改打卡记录 |
| | | regionInspectionEntity.setCreateUser(userId); |
| | | regionInspectionRecordMapper.insert(regionInspectionEntity); |
| | | |
| | | //添加记录相对应的图片 |
| | | if (!regionInspectionEntity.getImgList().isEmpty()){ |
| | | regionInspectionEntity.getImgList().forEach(obj->{ |
| | | RegionInspectionRecordImgEntity recordImgEntity = RegionInspectionRecordImgEntity |
| | | .builder() |
| | | .id(UUIDUtils.create()) |
| | | .regionInspectionRecordId(regionInspectionEntity.getId()) |
| | | .imgName(obj.getImgName()) |
| | | .imgPath(obj.getImgPath()) |
| | | .build(); |
| | | regionInspectionRecordMapper.insertIMG(recordImgEntity); |
| | | }); |
| | | } |
| | | //判断每个人提交打卡的时候 判断一次这个任务是否完全被所有人打过卡了 |
| | | Map map = new HashMap(); |
| | | map.put("companyId",sysUserInfo.getCompanyId()); |
| | | map.put("regionInspectionId",regionInspectionEntity.getRegionInspectionId()); |
| | | //此任务每个人对任务打卡是否完成 不精确到此人去哪个区域打卡 只精确到这个人是否完成任务 任务分多个区域 |
| | | List<RegionInspectionRecordEntity> recordEntities = regionInspectionRecordMapper.selectPageList(map); |
| | | int peopleDKCount = recordEntities.size();//若干人对应的若干任务 |
| | | AtomicInteger atomicInteger = new AtomicInteger();//记录完成打卡次数 |
| | | if (!recordEntities.isEmpty()){ |
| | | recordEntities.forEach(obj->{ |
| | | String statusName = obj.getStatusName(); |
| | | if("完成".equals(statusName)){ |
| | | atomicInteger.incrementAndGet(); |
| | | } |
| | | }); |
| | | } |
| | | //如果若干人对应若干任务数量和 完成打卡次数相等 那么此任务 已经完结 修改任务状态 |
| | | if (peopleDKCount == atomicInteger.get()){ |
| | | RegionInspectionEntity r = RegionInspectionEntity |
| | | .builder() |
| | | .id(regionInspectionEntity.getRegionInspectionId()) |
| | | .status(1) |
| | | .build(); |
| | | //修改任务状态 |
| | | regionInspectionMapper.insert(r); |
| | | } |
| | | |
| | | } |
| | | return BasicResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public BasicResult delete(String id) { |
| | | regionInspectionRecordMapper.delete(id); |
| | | return BasicResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | public BasicResult selectPageList(Map map) { |
| | | SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); |
| | | String companyId = sysUserInfo.getCompanyId(); |
| | | int pageNum = (int) map.get("pageNum"); |
| | | int pageSize = (int) map.get("pageSize"); |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | map.put("companyId",companyId); |
| | | return BasicResult.success(new PageInfo<>( |
| | | regionInspectionRecordMapper.selectPageList(map) |
| | | )); |
| | | } |
| | | |
| | | @Override |
| | | public BasicResult selectInfo(String regionInspectionId, String userId) { |
| | | RegionInspectionEntity obj = regionInspectionRecordMapper.selectInfo(regionInspectionId, userId); |
| | | List<RegionInspectionHazardInformEntity> regionList = new ArrayList<>(); |
| | | if (obj.getRegionIds()!=null){ |
| | | String[] regionIds = obj.getRegionIds().intern().split(","); |
| | | String[] regions = obj.getRegions().intern().split(","); |
| | | //区域对象数组 |
| | | for (int i = 0; i < regionIds.length; i++) { |
| | | RegionInspectionHazardInformEntity regionEntity = RegionInspectionHazardInformEntity |
| | | .builder() |
| | | .regionInspectionId(obj.getId()) |
| | | .regionHazardInformId(regionIds[i]) |
| | | .region(regions[i]).build(); |
| | | regionList.add(regionEntity); |
| | | } |
| | | } |
| | | obj.setRegionList(regionList); |
| | | return BasicResult.success(obj); |
| | | } |
| | | |
| | | @Override |
| | | public BasicResult selectAppInfo(String regionInspectionId, String userId) { |
| | | RegionInspectionEntity obj = regionInspectionRecordMapper.selectInfo(regionInspectionId, userId); |
| | | List<RegionInspectionHazardInformEntity> regionList = new ArrayList<>(); |
| | | if (obj.getRegionIds()!=null){ |
| | | String[] regionIds = obj.getRegionIds().intern().split(","); |
| | | String[] regions = obj.getRegions().intern().split(","); |
| | | //区域对象数组 |
| | | for (int i = 0; i < regionIds.length; i++) { |
| | | RegionInspectionRecordEntity recordEntity = regionInspectionRecordMapper.regionInfo( |
| | | regionInspectionId, |
| | | userId, |
| | | regionIds[i]); |
| | | RegionInspectionHazardInformEntity regionEntity = RegionInspectionHazardInformEntity |
| | | .builder() |
| | | .regionInspectionId(obj.getId()) |
| | | .regionHazardInformId(regionIds[i]) |
| | | .region(regions[i]) |
| | | .recordEntity(recordEntity).build(); |
| | | regionList.add(regionEntity); |
| | | } |
| | | } |
| | | obj.setRegionList(regionList); |
| | | return BasicResult.success(obj); |
| | | } |
| | | |
| | | @Override |
| | | public BasicResult regionInfo(String regionInspectionId, String userId, String regionHazardInformId) { |
| | | return BasicResult.success( |
| | | regionInspectionRecordMapper.regionInfo( |
| | | regionInspectionId, |
| | | userId, |
| | | regionHazardInformId)); |
| | | } |
| | | |
| | | @Override |
| | | public BasicResult selectAppList(Map map) { |
| | | SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); |
| | | String companyId = sysUserInfo.getCompanyId(); |
| | | String userId = sysUserInfo.getUserId(); |
| | | map.put("userId",userId); |
| | | map.put("companyId",companyId); |
| | | int pageNum = (int) map.get("pageNum"); |
| | | int pageSize = (int) map.get("pageSize"); |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | return BasicResult.success(new PageInfo<>(regionInspectionRecordMapper.selectAppList(map))); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.thhy.general.utils.UserInfoUtils; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionEntity; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionHazardInformEntity; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionRecordEntity; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionUserEntity; |
| | | import com.thhy.secure.modules.biz.regionInspection.mapper.RegionInspectionMapper; |
| | | import com.thhy.secure.modules.biz.regionInspection.mapper.RegionInspectionRecordMapper; |
| | | import com.thhy.secure.modules.biz.regionInspection.service.RegionInspectionRecordService; |
| | | import com.thhy.secure.modules.biz.regionInspection.service.RegionInspectionService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private RegionInspectionMapper regionInspectionMapper; |
| | | |
| | | @Autowired |
| | | private RegionInspectionRecordMapper regionInspectionRecordMapper; |
| | | |
| | | private static final Object lock = new Object(); |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | regionInspectionMapper.deleteUser(regionInspectId); |
| | | regionInspectionMapper.deleteInspectionHazardInform(regionInspectId); |
| | | } |
| | | //添加/修改区域巡检 |
| | | List<String> userIds = new ArrayList<>(); |
| | | List<String> regionIds = new ArrayList<>(); |
| | | synchronized (lock) { |
| | | regionInspectionEntity.setId(regionInspectId); |
| | | regionInspectionEntity.setCreateUser(userId); |
| | | regionInspectionMapper.insert(regionInspectionEntity); |
| | | //添加巡检人 |
| | | for (RegionInspectionUserEntity userEntity : regionInspectionEntity.getRegionUsersList()) { |
| | | userEntity.setId(UUIDUtils.create()); |
| | | String id = UUIDUtils.create(); |
| | | userIds.add(userEntity.getUserId()); |
| | | userEntity.setId(id); |
| | | userEntity.setRegionInspectionId(regionInspectId); |
| | | regionInspectionMapper.insertUser(userEntity); |
| | | } |
| | | //添加巡检的区域 |
| | | for (RegionInspectionHazardInformEntity region : regionInspectionEntity.getRegionList()) { |
| | | region.setId(UUIDUtils.create()); |
| | | String id = UUIDUtils.create(); |
| | | regionIds.add(region.getRegionHazardInformId()); |
| | | region.setId(id); |
| | | region.setRegionInspectionId(regionInspectId); |
| | | regionInspectionMapper.insertInspectionHazardInform(region); |
| | | } |
| | | |
| | | //添加任务的时候添加打卡记录 新增的是待打卡状态 |
| | | if (StringUtils.isBlank(regionInspectionEntity.getId())){ |
| | | for (String addUserId : userIds) { |
| | | for (String regionId : regionIds) { |
| | | RegionInspectionRecordEntity regionInspectionRecordEntity = |
| | | RegionInspectionRecordEntity |
| | | .builder() |
| | | .id(UUIDUtils.create()) |
| | | .userId(addUserId) |
| | | .regionHazardInformId(regionId) |
| | | .regionInspectionId(regionInspectId) |
| | | .createUser(userId) |
| | | .build(); |
| | | regionInspectionRecordMapper.insert(regionInspectionRecordEntity); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //添加/修改区域巡检 |
| | | regionInspectionEntity.setId(regionInspectId); |
| | | regionInspectionEntity.setCreateUser(userId); |
| | | regionInspectionMapper.insert(regionInspectionEntity); |
| | | |
| | | } |
| | | |
| | | return BasicResult.success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public BasicResult delete(String id) { |
| | | regionInspectionMapper.delete(id); |
| | | regionInspectionMapper.deleteUser(id); |
| | | regionInspectionMapper.deleteInspectionHazardInform(id); |
| | | regionInspectionRecordMapper.deleteByRegionInspectionId(id); |
| | | return BasicResult.success(); |
| | | } |
| | | |
| | |
| | | order by t.createTime desc |
| | | </select> |
| | | |
| | | <!--查询列表--> |
| | | <select id="selectAppList" resultType="com.thhy.secure.modules.biz.hiddenDanger.entity.HiddenDangerEntity"> |
| | | SELECT |
| | | t.id, |
| | | t.dangerLocation, |
| | | t.title, |
| | | t.createTime, |
| | | t.auditStatus, |
| | | t.isUse, |
| | | t.createUser, |
| | | t.updateUser, |
| | | t.updateTime, |
| | | t.companyId, |
| | | t.level, |
| | | t.integral, |
| | | su.real_name reporter |
| | | from t_hidden_danger t |
| | | LEFT JOIN sys_users su ON su.user_id = t.createUser |
| | | LEFT JOIN sys_users su1 ON su1.user_id = t.updateUser |
| | | WHERE |
| | | t.isUse = 1 |
| | | and t.companyId = #{companyId} |
| | | <if test="startTime!= null and endTime!=null and startTime != '' and endTime !=''"> |
| | | and t.createTime BETWEEN #{startTime} and #{endTime} |
| | | </if> |
| | | ORDER BY |
| | | t.auditStatus, |
| | | case when t.auditStatus = 0 then t.createTime END, |
| | | case when t.auditStatus = 1 then t.createTime END desc |
| | | </select> |
| | | <!--根据ID删除--> |
| | | <delete id="deleteImg"> |
| | | delete from t_hidden_danger_img |
| | |
| | | <if test="companyId != null"> |
| | | companyId, |
| | | </if> |
| | | <if test="status != null"> |
| | | `status`, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | |
| | | <if test="companyId != null"> |
| | | #{companyId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="status != null"> |
| | | #{status,jdbcType=INTEGER}, |
| | | </if> |
| | | </trim> |
| | | on duplicate key update |
| | | <trim suffixOverrides=","> |
| | |
| | | <if test="companyId != null"> |
| | | companyId = #{companyId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="status != null"> |
| | | `status` = #{status,jdbcType=INTEGER}, |
| | | </if> |
| | | </trim> |
| | | |
| | | </insert> |
| | |
| | | t.updateTime, |
| | | t.isUse, |
| | | t.companyId, |
| | | t.`status`, |
| | | GROUP_CONCAT(DISTINCT b.real_name ORDER BY b.job_num SEPARATOR '、') realNames, |
| | | GROUP_CONCAT(DISTINCT b.user_id ORDER BY b.job_num SEPARATOR '、') userIds, |
| | | GROUP_CONCAT(DISTINCT d.region ORDER BY c.sort SEPARATOR ',') regions, |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.thhy.secure.modules.biz.regionInspection.mapper.RegionInspectionRecordMapper"> |
| | | |
| | | <insert id="insertIMG"> |
| | | insert into t_region_inspection_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="regionInspectionRecordId != null"> |
| | | regionInspectionRecordId, |
| | | </if> |
| | | <if test="imgName != null"> |
| | | imgName, |
| | | </if> |
| | | <if test="imgPath != null"> |
| | | imgPath, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="regionInspectionRecordId != null"> |
| | | #{regionInspectionRecordId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="imgName != null"> |
| | | #{imgName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="imgPath != null"> |
| | | #{imgPath,jdbcType=VARCHAR}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <insert id="insert"> |
| | | insert into t_region_inspection_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="regionInspectionId != null"> |
| | | regionInspectionId, |
| | | </if> |
| | | <if test="userId != null"> |
| | | userId, |
| | | </if> |
| | | <if test="regionHazardInformId != null"> |
| | | regionHazardInformId, |
| | | </if> |
| | | <if test="status != null"> |
| | | `status`, |
| | | </if> |
| | | <if test="location != null"> |
| | | location, |
| | | </if> |
| | | <if test="inspectionTime != null"> |
| | | inspectionTime, |
| | | </if> |
| | | <if test="createUser != null"> |
| | | createUser, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | createTime, |
| | | </if> |
| | | <if test="updateUser != null"> |
| | | updateUser, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | updateTime, |
| | | </if> |
| | | <if test="result != null"> |
| | | result, |
| | | </if> |
| | | |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="regionInspectionId != null"> |
| | | #{regionInspectionId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="userId != null"> |
| | | #{userId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="regionHazardInformId != null"> |
| | | #{regionHazardInformId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="status != null"> |
| | | #{status,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="location != null"> |
| | | #{location,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="inspectionTime != null"> |
| | | #{inspectionTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="createUser != null"> |
| | | #{createUser,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateUser != null"> |
| | | #{updateUser,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="result != null"> |
| | | #{result,jdbcType=VARCHAR}, |
| | | </if> |
| | | </trim> |
| | | on duplicate key update |
| | | <trim suffixOverrides=","> |
| | | <if test="regionInspectionId != null"> |
| | | regionInspectionId = #{regionInspectionId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="userId != null"> |
| | | userId = #{userId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="regionHazardInformId != null"> |
| | | regionHazardInformId = #{regionHazardInformId,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="status != null"> |
| | | `status` = #{status,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="location != null"> |
| | | location = #{location,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="inspectionTime != null"> |
| | | inspectionTime = #{inspectionTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="createUser != null"> |
| | | createUser = #{createUser,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | createTime = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateUser != null"> |
| | | updateUser = #{updateUser,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="updateTime != null"> |
| | | updateTime = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="result != null"> |
| | | result = #{result,jdbcType=VARCHAR}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <delete id="delete"> |
| | | delete from t_region_inspection_record where id=#{id,jdbcType=VARCHAR} |
| | | </delete> |
| | | |
| | | <delete id="deleteByRegionInspectionId"> |
| | | delete from t_region_inspection_record where regionInspectionId=#{regionInspectionId,jdbcType=VARCHAR} |
| | | </delete> |
| | | |
| | | <select id="selectPageList" resultType="com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionRecordEntity"> |
| | | SELECT a.userId, |
| | | a.regionInspectionId, |
| | | a.inspectionTime, |
| | | a.task, |
| | | a.region, |
| | | a.realName, |
| | | IF(a.completeRegionNum = a.needRegionNum,"完成","未完成") statusName, |
| | | IF(a.completeRegionNum = a.needRegionNum,1,0) status |
| | | FROM ( |
| | | SELECT |
| | | t.userId , |
| | | t.regionInspectionId, |
| | | MIN(t.inspectionTime) inspectionTime, |
| | | tri.task task, |
| | | GROUP_CONCAT(DISTINCT trhi.region) region, |
| | | spu.real_name realName, |
| | | SUM(t.`status`)/(SELECT count(regionInspectionId) FROM t_region_inspection_hazard_inform WHERE regionInspectionId = t.regionInspectionId) completeRegionNum, |
| | | (SELECT count(regionInspectionId) FROM t_region_inspection_hazard_inform WHERE regionInspectionId = t.regionInspectionId) needRegionNum |
| | | from |
| | | t_region_inspection_record t |
| | | LEFT JOIN t_region_inspection tri on tri.id = t.regionInspectionId |
| | | LEFT JOIN t_region_inspection_hazard_inform trihi on trihi.regionInspectionId = t.regionInspectionId |
| | | LEFT JOIN t_region_hazard_inform trhi on trhi.id = trihi.regionHazardInformId |
| | | LEFT JOIN sys_plat_user spu on spu.user_id = t.userId |
| | | WHERE 1=1 |
| | | <if test="realName !=null and realName !=''"> |
| | | and spu.real_name REGEXP #{realName} |
| | | </if> |
| | | <if test="companyId !=null and companyId !=''"> |
| | | and tri.companyId = #{companyId} |
| | | </if> |
| | | <if test="regionInspectionId !=null and regionInspectionId !=''"> |
| | | and t.regionInspectionId = #{regionInspectionId} |
| | | </if> |
| | | GROUP BY t.regionInspectionId,t.userId |
| | | )a |
| | | |
| | | WHERE 1=1 |
| | | <if test="status !=null and status !='' and status ==0"> |
| | | and a.completeRegionNum != a.needRegionNum |
| | | </if> |
| | | <if test="status !=null and status !='' and status ==1"> |
| | | and a.completeRegionNum = a.needRegionNum |
| | | </if> |
| | | <if test="startTime != null and endTime != null and startTime !='' and endTime != ''"> |
| | | and a.inspectionTime BETWEEN #{startTime} and #{endTime} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectInfo" resultType="com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionEntity"> |
| | | SELECT |
| | | t.id regionInspectionId, |
| | | b.user_id userId, |
| | | t.task, |
| | | t.standard, |
| | | b.real_name realName, |
| | | GROUP_CONCAT(DISTINCT d.region ORDER BY c.sort SEPARATOR ',') regions, |
| | | GROUP_CONCAT(DISTINCT d.id ORDER BY c.sort SEPARATOR ',') regionIds |
| | | FROM t_region_inspection t |
| | | LEFT JOIN t_region_inspection_user a ON a.regionInspectionId = t.id |
| | | LEFT JOIN sys_plat_user b ON b.user_id = a.userId |
| | | LEFT JOIN t_region_inspection_hazard_inform c ON c.regionInspectionId = t.id |
| | | LEFT JOIN t_region_hazard_inform d ON d.id = c.regionHazardInformId |
| | | WHERE t.id = #{regionInspectionId} and b.user_id = #{userId} |
| | | GROUP BY t.id |
| | | </select> |
| | | |
| | | <select id="regionInfo" resultType="com.thhy.secure.modules.biz.regionInspection.entity.RegionInspectionRecordEntity"> |
| | | SELECT |
| | | t.userId, |
| | | t.regionInspectionId, |
| | | t.regionHazardInformId, |
| | | t.inspectionTime inspectionTime, |
| | | rhi.region region, |
| | | t.result result, |
| | | GROUP_CONCAT(timg.imgPath) imgPaths, |
| | | t.location, |
| | | spu.real_name realName |
| | | FROM t_region_inspection_record t |
| | | LEFT JOIN t_region_inspection_record_img timg on t.id = timg.regionInspectionRecordId |
| | | LEFT JOIN t_region_hazard_inform rhi on rhi.id = t.regionHazardInformId |
| | | LEFT JOIN sys_plat_user spu on spu.user_id = t.userId |
| | | WHERE t.userId = #{userId} and t.regionInspectionId = #{regionInspectionId} and t.regionHazardInformId = #{regionHazardInformId} |
| | | GROUP BY t.id |
| | | </select> |
| | | |
| | | <select id="selectAppList" resultType="java.util.Map"> |
| | | SELECT |
| | | a.id, |
| | | MIN( b.inspectionTime ) inspectionTime, |
| | | a.`status`, |
| | | a.task, |
| | | GROUP_CONCAT(DISTINCT d.region) region |
| | | FROM |
| | | t_region_inspection a |
| | | LEFT JOIN t_region_inspection_record b ON b.regionInspectionId = a.id |
| | | LEFT JOIN t_region_inspection_hazard_inform c ON c.regionInspectionId = a.id |
| | | LEFT JOIN t_region_hazard_inform d ON c.regionHazardInformId = d.id |
| | | LEFT JOIN t_region_inspection_user e on e.regionInspectionId = a.id |
| | | WHERE a.companyId = #{companyId} and e.userId = #{userId} |
| | | <if test="status != null and status != ''"> |
| | | and a.status = #{status} |
| | | </if> |
| | | <if test="startTime != null and endTime != null and startTime !='' and endTime != ''"> |
| | | and b.inspectionTime BETWEEN #{startTime} and #{endTime} |
| | | </if> |
| | | GROUP BY |
| | | a.id |
| | | </select> |
| | | |
| | | </mapper> |