@@ -31,7 +31,8 @@ public interface TauvInspectDriverMapper extends BaseMapper<TauvInspectDriver> { | |||
/** | |||
* 获取指挥大屏任务管理列表数据 | |||
* @param status | |||
* @param driverId | |||
* @return | |||
*/ | |||
List<IndexInspectListVo> getIndexInspectList(Integer status); | |||
List<IndexInspectListVo> getIndexInspectList(Integer status, Integer driverId); | |||
} |
@@ -99,6 +99,13 @@ | |||
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 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> | |||
</mapper> |
@@ -83,7 +83,7 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe | |||
* @return | |||
*/ | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
@Transactional | |||
public Response importData(MultipartFile file) { | |||
List<List<Object>> objectList = null; | |||
try { | |||
@@ -97,25 +97,25 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe | |||
objectList = ExcelUtil.importExcel(file, 0, 0); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | |||
return response.failure(e.getMessage()); | |||
} | |||
if (objectList.size() == 0) { | |||
return response.failure("导入数据不能为空"); | |||
} | |||
Integer m = 2; | |||
String message = ""; | |||
for (List<Object> data : objectList) { | |||
String inspectNo = data.get(0).toString().trim(); | |||
String areaName = data.get(1).toString().trim(); | |||
String driverName = data.get(2).toString().trim(); | |||
if (StringUtils.isEmpty(inspectNo)) { | |||
return response.failure("第" + m + "行任务单号不能为空"); | |||
throw new ApiException("第" + m + "行任务单号不能为空"); | |||
} | |||
if (StringUtils.isEmpty(areaName)) { | |||
return response.failure("第" + m + "行区属不能为空"); | |||
throw new ApiException("第" + m + "行区属不能为空"); | |||
} | |||
if (StringUtils.isEmpty(driverName)) { | |||
return response.failure("第" + m + "行河湖名称不能为空"); | |||
throw new ApiException("第" + m + "行河湖名称不能为空"); | |||
} | |||
// 任务校验 | |||
@@ -125,7 +125,7 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe | |||
inspectWrapper.last("limit 1"); | |||
TauvInspectDriver inspectDriver = inspectDriverMapper.selectOne(inspectWrapper); | |||
if (inspectDriver == null) { | |||
return response.failure("第" + m + "行任务单号错误"); | |||
throw new ApiException("第" + m + "行任务单号错误"); | |||
} | |||
// 区属校验 | |||
QueryWrapper cityWrapper = new QueryWrapper(); | |||
@@ -134,7 +134,7 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe | |||
cityWrapper.last("limit 1"); | |||
SysCity city = cityMapper.selectOne(cityWrapper); | |||
if (city == null) { | |||
return response.failure("第" + m + "行区属错误"); | |||
throw new ApiException("第" + m + "行区属错误"); | |||
} | |||
// 河湖校验 | |||
QueryWrapper driverWrapper = new QueryWrapper(); | |||
@@ -144,7 +144,7 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe | |||
driverWrapper.last("limit 1"); | |||
TauvDriver driver = driverMapper.selectOne(driverWrapper); | |||
if (driver == null) { | |||
return response.failure("第" + m + "行河湖名称错误"); | |||
throw new ApiException("第" + m + "行河湖名称错误"); | |||
} | |||
// 关系校验 | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
@@ -156,10 +156,10 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe | |||
wrapper.last("limit 1"); | |||
TauvInspectDriver tauvInspectDriver = inspectDriverMapper.selectOne(wrapper); | |||
if (tauvInspectDriver == null) { | |||
return response.failure("第" + m + "行任务单号、区属、河湖名称关系错误"); | |||
throw new ApiException("第" + m + "行任务单号、区属、河湖名称关系错误"); | |||
} | |||
if (tauvInspectDriver.getStatus() != 4) { | |||
return response.failure("第" + m + "行任务未完成"); | |||
throw new ApiException("第" + m + "行任务未完成"); | |||
} | |||
// 判断水质数据表该任务、区属、河湖对应数据是否存在 | |||
QueryWrapper dataWrapper = new QueryWrapper(); |
@@ -5,6 +5,7 @@ import com.taauav.admin.service.ITauvDriverPointService; | |||
import com.taauav.admin.service.ITauvInspectService; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.front.dto.IndexInspectDto; | |||
import com.taauav.front.service.IUserInspectDriverService; | |||
import com.taauav.front.service.IUserInspectService; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
@@ -47,8 +48,8 @@ public class IndexInspectController { | |||
* @return | |||
*/ | |||
@GetMapping("/list") | |||
public Response list(@RequestParam("type") Integer type) { | |||
return inspectDriverService.getInspectList(type); | |||
public Response list(IndexInspectDto indexInspectDto) { | |||
return inspectDriverService.getInspectList(indexInspectDto); | |||
} | |||
/** |
@@ -0,0 +1,23 @@ | |||
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; | |||
} |
@@ -4,6 +4,7 @@ import com.taauav.admin.entity.TauvInspect; | |||
import com.taauav.admin.entity.TauvInspectDriver; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.service.IBaseService; | |||
import com.taauav.front.dto.IndexInspectDto; | |||
import com.taauav.front.entity.UserAdmin; | |||
import com.taauav.front.query.UserInspectDriverQuery; | |||
@@ -51,10 +52,10 @@ public interface IUserInspectDriverService extends IBaseService<TauvInspectDrive | |||
/** | |||
* 指挥大屏-任务管理列表 | |||
* @param type:1已完成 2执行中 | |||
* @param indexInspectDto | |||
* @return | |||
*/ | |||
Response getInspectList(Integer type); | |||
Response getInspectList(IndexInspectDto indexInspectDto); | |||
} |
@@ -17,6 +17,7 @@ import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FileUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
import com.taauav.front.dto.IndexInspectDto; | |||
import com.taauav.front.mapper.UserAdminMapper; | |||
import com.taauav.front.service.IUserAdminService; | |||
import com.taauav.front.service.IUserInspectDriverService; | |||
@@ -337,17 +338,16 @@ public class UserInspectDriverServiceImpl extends BaseServiceImpl<TauvInspectDri | |||
/** | |||
* 指挥大屏-任务管理列表 | |||
* | |||
* @param type:1已完成 2执行中 | |||
* @param indexInspectDto | |||
* @return | |||
*/ | |||
@Override | |||
public Response getInspectList(Integer type) { | |||
public Response getInspectList(IndexInspectDto indexInspectDto) { | |||
Integer status = 4; | |||
if (type != null && type == 2) { | |||
if (!StringUtils.isEmpty(indexInspectDto.getType()) && indexInspectDto.getType() == 2) { | |||
status = 3; | |||
} | |||
List<IndexInspectListVo> inspectList = baseMapper.getIndexInspectList(status); | |||
List<IndexInspectListVo> inspectList = baseMapper.getIndexInspectList(status, indexInspectDto.getDriverId()); | |||
if (inspectList != null && inspectList.size() > 0) { | |||
for (IndexInspectListVo item : inspectList) { | |||
// 状态 |