/** | /** | ||||
* 获取指挥大屏任务管理列表数据 | * 获取指挥大屏任务管理列表数据 | ||||
* @param status | * @param status | ||||
* @param driverId | |||||
* @return | * @return | ||||
*/ | */ | ||||
List<IndexInspectListVo> getIndexInspectList(Integer status); | |||||
List<IndexInspectListVo> getIndexInspectList(Integer status, Integer driverId); | |||||
} | } |
LEFT JOIN tauv_driver AS r ON d.`driver_id` = r.`id` | LEFT JOIN tauv_driver AS r ON d.`driver_id` = r.`id` | ||||
LEFT JOIN sys_city AS c ON d.`driver_area` = c.`id` | LEFT JOIN sys_city AS c ON d.`driver_area` = c.`id` | ||||
LEFT JOIN tauv_equipment AS e ON d.`equipment_id` = e.`id` | LEFT JOIN tauv_equipment AS e ON d.`equipment_id` = e.`id` | ||||
WHERE d.`mark` = 1 AND r.`mark` = 1 AND c.`mark` = 1 AND d.`status` = #{status} order by d.id desc | |||||
WHERE d.`mark` = 1 AND r.`mark` = 1 AND c.`mark` = 1 | |||||
<if test="status != null and status > 0"> | |||||
AND d.`status` = #{status} | |||||
</if> | |||||
<if test="driverId != null and driverId > 0"> | |||||
AND d.`driver_id` = #{driverId} | |||||
</if> | |||||
order by d.id desc | |||||
</select> | </select> | ||||
</mapper> | </mapper> |
* @return | * @return | ||||
*/ | */ | ||||
@Override | @Override | ||||
@Transactional(rollbackFor = Exception.class) | |||||
@Transactional | |||||
public Response importData(MultipartFile file) { | public Response importData(MultipartFile file) { | ||||
List<List<Object>> objectList = null; | List<List<Object>> objectList = null; | ||||
try { | try { | ||||
objectList = ExcelUtil.importExcel(file, 0, 0); | objectList = ExcelUtil.importExcel(file, 0, 0); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
e.printStackTrace(); | e.printStackTrace(); | ||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | |||||
return response.failure(e.getMessage()); | return response.failure(e.getMessage()); | ||||
} | } | ||||
if (objectList.size() == 0) { | if (objectList.size() == 0) { | ||||
return response.failure("导入数据不能为空"); | return response.failure("导入数据不能为空"); | ||||
} | } | ||||
Integer m = 2; | Integer m = 2; | ||||
String message = ""; | |||||
for (List<Object> data : objectList) { | for (List<Object> data : objectList) { | ||||
String inspectNo = data.get(0).toString().trim(); | String inspectNo = data.get(0).toString().trim(); | ||||
String areaName = data.get(1).toString().trim(); | String areaName = data.get(1).toString().trim(); | ||||
String driverName = data.get(2).toString().trim(); | String driverName = data.get(2).toString().trim(); | ||||
if (StringUtils.isEmpty(inspectNo)) { | if (StringUtils.isEmpty(inspectNo)) { | ||||
return response.failure("第" + m + "行任务单号不能为空"); | |||||
throw new ApiException("第" + m + "行任务单号不能为空"); | |||||
} | } | ||||
if (StringUtils.isEmpty(areaName)) { | if (StringUtils.isEmpty(areaName)) { | ||||
return response.failure("第" + m + "行区属不能为空"); | |||||
throw new ApiException("第" + m + "行区属不能为空"); | |||||
} | } | ||||
if (StringUtils.isEmpty(driverName)) { | if (StringUtils.isEmpty(driverName)) { | ||||
return response.failure("第" + m + "行河湖名称不能为空"); | |||||
throw new ApiException("第" + m + "行河湖名称不能为空"); | |||||
} | } | ||||
// 任务校验 | // 任务校验 | ||||
inspectWrapper.last("limit 1"); | inspectWrapper.last("limit 1"); | ||||
TauvInspectDriver inspectDriver = inspectDriverMapper.selectOne(inspectWrapper); | TauvInspectDriver inspectDriver = inspectDriverMapper.selectOne(inspectWrapper); | ||||
if (inspectDriver == null) { | if (inspectDriver == null) { | ||||
return response.failure("第" + m + "行任务单号错误"); | |||||
throw new ApiException("第" + m + "行任务单号错误"); | |||||
} | } | ||||
// 区属校验 | // 区属校验 | ||||
QueryWrapper cityWrapper = new QueryWrapper(); | QueryWrapper cityWrapper = new QueryWrapper(); | ||||
cityWrapper.last("limit 1"); | cityWrapper.last("limit 1"); | ||||
SysCity city = cityMapper.selectOne(cityWrapper); | SysCity city = cityMapper.selectOne(cityWrapper); | ||||
if (city == null) { | if (city == null) { | ||||
return response.failure("第" + m + "行区属错误"); | |||||
throw new ApiException("第" + m + "行区属错误"); | |||||
} | } | ||||
// 河湖校验 | // 河湖校验 | ||||
QueryWrapper driverWrapper = new QueryWrapper(); | QueryWrapper driverWrapper = new QueryWrapper(); | ||||
driverWrapper.last("limit 1"); | driverWrapper.last("limit 1"); | ||||
TauvDriver driver = driverMapper.selectOne(driverWrapper); | TauvDriver driver = driverMapper.selectOne(driverWrapper); | ||||
if (driver == null) { | if (driver == null) { | ||||
return response.failure("第" + m + "行河湖名称错误"); | |||||
throw new ApiException("第" + m + "行河湖名称错误"); | |||||
} | } | ||||
// 关系校验 | // 关系校验 | ||||
QueryWrapper wrapper = new QueryWrapper(); | QueryWrapper wrapper = new QueryWrapper(); | ||||
wrapper.last("limit 1"); | wrapper.last("limit 1"); | ||||
TauvInspectDriver tauvInspectDriver = inspectDriverMapper.selectOne(wrapper); | TauvInspectDriver tauvInspectDriver = inspectDriverMapper.selectOne(wrapper); | ||||
if (tauvInspectDriver == null) { | if (tauvInspectDriver == null) { | ||||
return response.failure("第" + m + "行任务单号、区属、河湖名称关系错误"); | |||||
throw new ApiException("第" + m + "行任务单号、区属、河湖名称关系错误"); | |||||
} | } | ||||
if (tauvInspectDriver.getStatus() != 4) { | if (tauvInspectDriver.getStatus() != 4) { | ||||
return response.failure("第" + m + "行任务未完成"); | |||||
throw new ApiException("第" + m + "行任务未完成"); | |||||
} | } | ||||
// 判断水质数据表该任务、区属、河湖对应数据是否存在 | // 判断水质数据表该任务、区属、河湖对应数据是否存在 | ||||
QueryWrapper dataWrapper = new QueryWrapper(); | QueryWrapper dataWrapper = new QueryWrapper(); |
import com.taauav.admin.service.ITauvInspectService; | import com.taauav.admin.service.ITauvInspectService; | ||||
import com.taauav.common.bean.Response; | import com.taauav.common.bean.Response; | ||||
import com.taauav.common.constant.PermissionConstants; | import com.taauav.common.constant.PermissionConstants; | ||||
import com.taauav.front.dto.IndexInspectDto; | |||||
import com.taauav.front.service.IUserInspectDriverService; | import com.taauav.front.service.IUserInspectDriverService; | ||||
import com.taauav.front.service.IUserInspectService; | import com.taauav.front.service.IUserInspectService; | ||||
import org.apache.shiro.authz.annotation.RequiresPermissions; | import org.apache.shiro.authz.annotation.RequiresPermissions; | ||||
* @return | * @return | ||||
*/ | */ | ||||
@GetMapping("/list") | @GetMapping("/list") | ||||
public Response list(@RequestParam("type") Integer type) { | |||||
return inspectDriverService.getInspectList(type); | |||||
public Response list(IndexInspectDto indexInspectDto) { | |||||
return inspectDriverService.getInspectList(indexInspectDto); | |||||
} | } | ||||
/** | /** |
package com.taauav.front.dto; | |||||
import lombok.Data; | |||||
/** | |||||
* 指挥大屏 任务管理列表请求实体类 | |||||
* | |||||
* @author daixiantong | |||||
* @date 2020-06-01 | |||||
*/ | |||||
@Data | |||||
public class IndexInspectDto { | |||||
/** | |||||
* 类型:1已完成 2执行中 | |||||
*/ | |||||
private Integer type; | |||||
/** | |||||
* 河湖id | |||||
*/ | |||||
private Integer driverId; | |||||
} |
import com.taauav.admin.entity.TauvInspectDriver; | import com.taauav.admin.entity.TauvInspectDriver; | ||||
import com.taauav.common.bean.Response; | import com.taauav.common.bean.Response; | ||||
import com.taauav.common.service.IBaseService; | import com.taauav.common.service.IBaseService; | ||||
import com.taauav.front.dto.IndexInspectDto; | |||||
import com.taauav.front.entity.UserAdmin; | import com.taauav.front.entity.UserAdmin; | ||||
import com.taauav.front.query.UserInspectDriverQuery; | import com.taauav.front.query.UserInspectDriverQuery; | ||||
/** | /** | ||||
* 指挥大屏-任务管理列表 | * 指挥大屏-任务管理列表 | ||||
* @param type:1已完成 2执行中 | |||||
* @param indexInspectDto | |||||
* @return | * @return | ||||
*/ | */ | ||||
Response getInspectList(Integer type); | |||||
Response getInspectList(IndexInspectDto indexInspectDto); | |||||
} | } |
import com.taauav.common.util.FileUtil; | import com.taauav.common.util.FileUtil; | ||||
import com.taauav.common.util.FunctionUtils; | import com.taauav.common.util.FunctionUtils; | ||||
import com.taauav.common.util.ShiroUtils; | import com.taauav.common.util.ShiroUtils; | ||||
import com.taauav.front.dto.IndexInspectDto; | |||||
import com.taauav.front.mapper.UserAdminMapper; | import com.taauav.front.mapper.UserAdminMapper; | ||||
import com.taauav.front.service.IUserAdminService; | import com.taauav.front.service.IUserAdminService; | ||||
import com.taauav.front.service.IUserInspectDriverService; | import com.taauav.front.service.IUserInspectDriverService; | ||||
/** | /** | ||||
* 指挥大屏-任务管理列表 | * 指挥大屏-任务管理列表 | ||||
* | |||||
* @param type:1已完成 2执行中 | |||||
* @param indexInspectDto | |||||
* @return | * @return | ||||
*/ | */ | ||||
@Override | @Override | ||||
public Response getInspectList(Integer type) { | |||||
public Response getInspectList(IndexInspectDto indexInspectDto) { | |||||
Integer status = 4; | Integer status = 4; | ||||
if (type != null && type == 2) { | |||||
if (!StringUtils.isEmpty(indexInspectDto.getType()) && indexInspectDto.getType() == 2) { | |||||
status = 3; | status = 3; | ||||
} | } | ||||
List<IndexInspectListVo> inspectList = baseMapper.getIndexInspectList(status); | |||||
List<IndexInspectListVo> inspectList = baseMapper.getIndexInspectList(status, indexInspectDto.getDriverId()); | |||||
if (inspectList != null && inspectList.size() > 0) { | if (inspectList != null && inspectList.size() > 0) { | ||||
for (IndexInspectListVo item : inspectList) { | for (IndexInspectListVo item : inspectList) { | ||||
// 状态 | // 状态 |