| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.thhy.general.common.BasicResult; |
| | | import com.thhy.general.config.SysUserInfo; |
| | | import com.thhy.general.utils.ExcelUtils; |
| | | import com.thhy.general.utils.UUIDUtils; |
| | | import com.thhy.general.utils.UserInfoUtils; |
| | | import com.thhy.secure.modules.biz.regionInspection.entity.*; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | |
| | | regionInspectionEntity.setInspectionTime(new Date()); |
| | | regionInspectionEntity.setUpdateTime(new Date()); |
| | | } |
| | | regionInspectionRecordMapper.deleteIMG(regionInspectionEntity.getId()); |
| | | synchronized (this){ |
| | | //修改打卡记录 |
| | | regionInspectionEntity.setCreateUser(userId); |
| | | regionInspectionRecordMapper.insert(regionInspectionEntity); |
| | | |
| | | //添加记录相对应的图片 |
| | | if (!regionInspectionEntity.getImgList().isEmpty()){ |
| | | regionInspectionEntity.getImgList().forEach(obj->{ |
| | |
| | | if (!recordEntities.isEmpty()){ |
| | | recordEntities.forEach(obj->{ |
| | | String statusName = obj.getStatusName(); |
| | | if("完成".equals(statusName)){ |
| | | if("已完成".equals(statusName)){ |
| | | atomicInteger.incrementAndGet(); |
| | | } |
| | | }); |
| | |
| | | String companyId = sysUserInfo.getCompanyId(); |
| | | int pageNum = (int) map.get("pageNum"); |
| | | int pageSize = (int) map.get("pageSize"); |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | String startHour = " 00:00:00"; |
| | | String endHour = " 23:59:59"; |
| | | String startTime = map.get("startTime").toString(); |
| | | String endTime = map.get("endTime").toString(); |
| | | if(StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)){ |
| | | startTime = startTime+startHour; |
| | | endTime = endTime +endHour; |
| | | map.put("startTime",startTime); |
| | | map.put("endTime",endTime); |
| | | } |
| | | if (StringUtils.isNotBlank(map.get("status").toString())){ |
| | | int intStatus = Integer.valueOf(map.get("status").toString()); |
| | | map.put("intStatus",intStatus); |
| | | } |
| | | map.put("companyId",companyId); |
| | | return BasicResult.success(new PageInfo<>( |
| | | regionInspectionRecordMapper.selectPageList(map) |
| | | )); |
| | | map.put("page",(pageNum-1)*10); |
| | | map.put("limit",pageSize); |
| | | List<RegionInspectionRecordEntity> recordEntities = regionInspectionRecordMapper.selectPageList(map); |
| | | Integer integer = regionInspectionRecordMapper.selectCount(map); |
| | | map.put("list",recordEntities); |
| | | map.put("total",integer); |
| | | return BasicResult.success(map); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public BasicResult selectAppInfo(String regionInspectionId, String userId) { |
| | | RegionInspectionEntity obj = regionInspectionRecordMapper.selectInfo(regionInspectionId, userId); |
| | | SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); |
| | | userId = sysUserInfo.getUserId(); |
| | | String platUserId = regionInspectionRecordMapper.selectPlatUserId(userId); |
| | | RegionInspectionEntity obj = regionInspectionRecordMapper.selectInfo(regionInspectionId, platUserId); |
| | | List<RegionInspectionHazardInformEntity> regionList = new ArrayList<>(); |
| | | if (obj.getRegionIds()!=null){ |
| | | if (obj!=null && 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, |
| | | platUserId, |
| | | regionIds[i]); |
| | | List<RegionInspectionRecordImgEntity> imgEntityList=null; |
| | | if (recordEntity!=null){ |
| | | imgEntityList = regionInspectionRecordMapper.selectImgByRecordId(recordEntity.getId()); |
| | | recordEntity.setImgList(imgEntityList); |
| | | } |
| | | RegionInspectionHazardInformEntity regionEntity = RegionInspectionHazardInformEntity |
| | | .builder() |
| | | .regionInspectionId(obj.getId()) |
| | | .regionHazardInformId(regionIds[i]) |
| | | .region(regions[i]) |
| | | .recordEntity(recordEntity).build(); |
| | | .recordEntity(recordEntity) |
| | | .imgList(imgEntityList) |
| | | .result(recordEntity.getResult()) |
| | | .status(recordEntity.getStatus()) |
| | | .build(); |
| | | regionList.add(regionEntity); |
| | | } |
| | | } |
| | |
| | | SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); |
| | | String companyId = sysUserInfo.getCompanyId(); |
| | | String userId = sysUserInfo.getUserId(); |
| | | map.put("userId",userId); |
| | | String platUserId = regionInspectionRecordMapper.selectPlatUserId(userId); |
| | | map.put("userId",platUserId); |
| | | map.put("companyId",companyId); |
| | | int pageNum = (int) map.get("pageNum"); |
| | | int pageSize = (int) map.get("pageSize"); |
| | |
| | | return BasicResult.success(new PageInfo<>(regionInspectionRecordMapper.selectAppList(map))); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void export(Map map, HttpServletResponse response) { |
| | | SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); |
| | | String companyId = sysUserInfo.getCompanyId(); |
| | | String startHour = " 00:00:00"; |
| | | String endHour = " 23:59:59"; |
| | | String startTime = map.get("startTime").toString(); |
| | | String endTime = map.get("endTime").toString(); |
| | | if(StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)){ |
| | | startTime = startTime+startHour; |
| | | endTime = endTime +endHour; |
| | | map.put("startTime",startTime); |
| | | map.put("endTime",endTime); |
| | | } |
| | | if (StringUtils.isNotBlank(map.get("status").toString())){ |
| | | int intStatus = Integer.valueOf(map.get("status").toString()); |
| | | map.put("intStatus",intStatus); |
| | | } |
| | | map.put("companyId",companyId); |
| | | List<RegionInspectionRecordEntity> recordEntities = regionInspectionRecordMapper.selectPageList(map); |
| | | ExcelUtils.downExcel(recordEntities,RegionInspectionRecordEntity.class,response,"打卡导出"); |
| | | } |
| | | } |