* 航线文件 | * 航线文件 | ||||
*/ | */ | ||||
private String driverFile; | private String driverFile; | ||||
/** | |||||
* 巡检任务来源 | |||||
*/ | |||||
private Integer source; | |||||
} | } |
*/ | */ | ||||
private Integer inspectId; | private Integer inspectId; | ||||
/** | |||||
* 巡检任务来源:1平台发布 2客户发起 | |||||
*/ | |||||
private Integer source; | |||||
/** | /** | ||||
* 行号(以10的倍数递增) | * 行号(以10的倍数递增) | ||||
*/ | */ |
/** | /** | ||||
* 根据河道编号获取河道类型下问题图片的数量 | * 根据河道编号获取河道类型下问题图片的数量 | ||||
* | * | ||||
* @param driverArea 河道区域 | |||||
* @param driverArea 河道区域 | |||||
* @param inspectDriverId | * @param inspectDriverId | ||||
* @param inspectTime | * @param inspectTime | ||||
* @param endTime | * @param endTime | ||||
/** | /** | ||||
* 根据附件id获取数据 | * 根据附件id获取数据 | ||||
* | |||||
* @param fileId | * @param fileId | ||||
* @return | * @return | ||||
*/ | */ | ||||
Response getDetailById(Integer fileId); | Response getDetailById(Integer fileId); | ||||
/** | |||||
* 根据巡检任务ID获取航拍图片列表 | |||||
* | |||||
* @param inspectDriverId 巡检任务ID | |||||
* @return | |||||
*/ | |||||
List<TauvInspectFile> getInspectFileListByInspectDriverId(Integer inspectDriverId); | |||||
} | } |
} | } | ||||
driver.setId(0); | driver.setId(0); | ||||
driver.setInspectId(inspectId); | driver.setInspectId(inspectId); | ||||
// 任务来源:平台 | |||||
driver.setSource(1); | |||||
driver.setInspectNo(inspect.getInspectNo()); | driver.setInspectNo(inspect.getInspectNo()); | ||||
driver.setCreateTime(DateUtil.now()); | driver.setCreateTime(DateUtil.now()); | ||||
driver.setCreateUser(ShiroUtils.getAdminId()); | driver.setCreateUser(ShiroUtils.getAdminId()); |
return response.success(inspectFileDataVo); | return response.success(inspectFileDataVo); | ||||
} | } | ||||
/** | |||||
* 根据巡检任务ID获取航拍图片列表 | |||||
* | |||||
* @param inspectDriverId 巡检任务ID | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public List<TauvInspectFile> getInspectFileListByInspectDriverId(Integer inspectDriverId) { | |||||
QueryWrapper<TauvInspectFile> queryWrapper = new QueryWrapper<>(); | |||||
queryWrapper.eq("inspect_driver_id", inspectDriverId); | |||||
queryWrapper.eq("is_review", 1); | |||||
queryWrapper.eq("is_effective", 1); | |||||
queryWrapper.eq("status", 1); | |||||
queryWrapper.eq("mark", 1); | |||||
List<TauvInspectFile> inspectFileList = inspectFileMapper.selectList(queryWrapper); | |||||
return inspectFileList; | |||||
} | |||||
} | } |
package com.taauav.admin.vo.inspectdriver; | package com.taauav.admin.vo.inspectdriver; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | import com.fasterxml.jackson.annotation.JsonFormat; | ||||
import com.taauav.admin.entity.TauvInspectFile; | |||||
import com.taauav.admin.vo.TauvEquipmentListVo; | import com.taauav.admin.vo.TauvEquipmentListVo; | ||||
import com.taauav.admin.vo.TauvMountEquipmentListVo; | import com.taauav.admin.vo.TauvMountEquipmentListVo; | ||||
import lombok.Data; | import lombok.Data; | ||||
*/ | */ | ||||
private List<TauvMountEquipmentListVo> mountEquipmentList; | private List<TauvMountEquipmentListVo> mountEquipmentList; | ||||
/** | |||||
* 巡检航拍图片 | |||||
*/ | |||||
private List<TauvInspectFile> inspectFileList; | |||||
} | } |
*/ | */ | ||||
private String driverNote; | private String driverNote; | ||||
/** | |||||
* 巡检轨迹 | |||||
*/ | |||||
private String inspectTrack; | |||||
/** | |||||
* 申请人ID | |||||
*/ | |||||
private Integer createUser; | |||||
/** | |||||
* 申请人名称 | |||||
*/ | |||||
private String createUserName; | |||||
/** | |||||
* 申请时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd") | |||||
@JsonFormat(pattern = "yyyy-MM-dd") | |||||
private Date createTime; | |||||
/** | |||||
* 巡检任务状态 | |||||
*/ | |||||
private Integer status; | |||||
/** | |||||
* 巡检任务状态名称 | |||||
*/ | |||||
private String statusName; | |||||
} | } |
filterChainDefinitionMap.put("/v2/**", "anon"); | filterChainDefinitionMap.put("/v2/**", "anon"); | ||||
filterChainDefinitionMap.put("/doc.html", "anon"); | filterChainDefinitionMap.put("/doc.html", "anon"); | ||||
//前台接口权限 开放 | //前台接口权限 开放 | ||||
//filterChainDefinitionMap.put("/front/**", "anon"); | |||||
filterChainDefinitionMap.put("/front/**", "anon"); | |||||
// 所有url都必须认证通过才可以访问 | // 所有url都必须认证通过才可以访问 | ||||
filterChainDefinitionMap.put("/**", "authc"); | filterChainDefinitionMap.put("/**", "authc"); | ||||
package com.taauav.front.constant; | |||||
import java.util.HashMap; | |||||
import java.util.Map; | |||||
/** | |||||
* @author dyg | |||||
*/ | |||||
public class UserAdminConstant { | |||||
public static Map<String, String> getAdminStatus() { | |||||
Map<String, String> status = new HashMap<>(2); | |||||
status.put("1", "正常"); | |||||
status.put("2", "禁用"); | |||||
return status; | |||||
} | |||||
} |
package com.taauav.front.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import com.taauav.front.controller.FrontBaseController; | |||||
/** | |||||
* <p> | |||||
* 问题管理 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/tauv-inspect-question") | |||||
public class TauvInspectQuestionController extends FrontBaseController { | |||||
} |
package com.taauav.front.controller; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import com.taauav.front.controller.FrontBaseController; | |||||
/** | |||||
* <p> | |||||
* 外部用户角色表 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/user-auth-group") | |||||
public class UserAuthGroupController extends FrontBaseController { | |||||
} |
package com.taauav.front.controller; | |||||
import com.taauav.admin.entity.TauvInspect; | |||||
import com.taauav.admin.service.ITauvInspectService; | |||||
import com.taauav.common.bean.Response; | |||||
import com.taauav.common.constant.PermissionConstants; | |||||
import com.taauav.front.service.IUserInspectService; | |||||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.validation.BindingResult; | |||||
import org.springframework.validation.FieldError; | |||||
import org.springframework.web.bind.annotation.PostMapping; | |||||
import org.springframework.web.bind.annotation.RequestBody; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import javax.validation.Valid; | |||||
import java.util.List; | |||||
/** | |||||
* 巡检任务 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/front/inspect") | |||||
public class UserInspectController { | |||||
@Autowired | |||||
private IUserInspectService userInspectService; | |||||
@Autowired | |||||
private Response response; | |||||
private static final String controllerName = "inspect"; | |||||
@PostMapping("/addTask") | |||||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||||
public Response addTask(@RequestBody @Valid TauvInspect inspect, BindingResult bindingResult) { | |||||
if (bindingResult.hasErrors()) { | |||||
List<FieldError> errorList = bindingResult.getFieldErrors(); | |||||
String msg = bindingResult.getFieldError().getDefaultMessage(); | |||||
return response.failure(msg); | |||||
} | |||||
return userInspectService.addTask(inspect); | |||||
} | |||||
} |
package com.taauav.front.controller; | |||||
import com.taauav.common.bean.Response; | |||||
import com.taauav.common.constant.PermissionConstants; | |||||
import com.taauav.front.query.UserInspectDriverQuery; | |||||
import com.taauav.front.service.IUserAdminService; | |||||
import com.taauav.front.service.IUserInspectDriverService; | |||||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.web.bind.annotation.*; | |||||
import java.util.HashMap; | |||||
import java.util.Map; | |||||
/** | |||||
* <p> | |||||
* 巡检任务 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/front/inspectDriver") | |||||
public class UserInspectDriverController extends FrontBaseController { | |||||
@Autowired | |||||
private IUserInspectDriverService inspectDriverService; | |||||
private static final String controllerName = "inspectDriver"; | |||||
/** | |||||
* 获取巡检任务列表 | |||||
* | |||||
* @param map | |||||
* @return | |||||
*/ | |||||
@PostMapping("/index") | |||||
public Response index(@RequestBody(required = false) Map<String, Object> map) { | |||||
if (map == null) { | |||||
map = new HashMap<>(); | |||||
} | |||||
String status = "status"; | |||||
if (map.containsKey(status) && !"".equals(map.get(status))) { | |||||
map.put("status", Integer.valueOf(map.get(status).toString())); | |||||
} else { | |||||
map.put("status", new Integer[]{2, 3, 4, 5, 6}); | |||||
} | |||||
return inspectDriverService.getList(map); | |||||
} | |||||
/** | |||||
* 任务详情 | |||||
*/ | |||||
@GetMapping("/detail") | |||||
// @RequiresPermissions(controllerName + ":" + PermissionConstants.VIEW_PERMISSION) | |||||
public Response detail(@RequestBody @RequestParam("id") Integer id) { | |||||
return inspectDriverService.detail(id); | |||||
} | |||||
} |
package com.taauav.front.entity; | |||||
import java.time.LocalDateTime; | |||||
import com.taauav.common.domain.Entity; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
/** | |||||
* <p> | |||||
* 问题管理 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@Accessors(chain = true) | |||||
public class TauvInspectQuestion extends Entity { | |||||
private static final long serialVersionUID = 1L; | |||||
/** | |||||
* 巡检河流ID | |||||
*/ | |||||
private Integer inspectDriverId; | |||||
/** | |||||
* 巡检图片文件ID | |||||
*/ | |||||
private Integer inspectFileId; | |||||
/** | |||||
* 问题单号 | |||||
*/ | |||||
private String questionNo; | |||||
/** | |||||
* 处理人 | |||||
*/ | |||||
private Integer handlerUser; | |||||
/** | |||||
* 处理人联系方式 | |||||
*/ | |||||
private String handlerContact; | |||||
/** | |||||
* 处理备注 | |||||
*/ | |||||
private String handlerNote; | |||||
/** | |||||
* 处理反馈图片 | |||||
*/ | |||||
private String handlerImage; | |||||
/** | |||||
* 处理结果 | |||||
*/ | |||||
private String handlerResult; | |||||
} |
package com.taauav.front.entity; | package com.taauav.front.entity; | ||||
import java.math.BigInteger; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.Date; | import java.util.Date; | ||||
import com.baomidou.mybatisplus.annotation.TableField; | |||||
import com.taauav.common.domain.Entity; | import com.taauav.common.domain.Entity; | ||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
/** | /** | ||||
* 河长等级:1一级 2二级 3三级 | * 河长等级:1一级 2二级 3三级 | ||||
*/ | */ | ||||
private boolean level; | |||||
private Integer level; | |||||
/** | /** | ||||
* 区划ID | * 区划ID | ||||
*/ | */ | ||||
private Long driverArea; | |||||
private BigInteger driverArea; | |||||
/** | /** | ||||
* 职务 | * 职务 | ||||
*/ | */ | ||||
private Integer sort; | private Integer sort; | ||||
/** | |||||
* 角色描述 | |||||
*/ | |||||
@TableField(exist = false) | |||||
private String authGroupText; | |||||
/** | |||||
* 状态描述 | |||||
*/ | |||||
@TableField(exist = false) | |||||
private String statusText; | |||||
} | } |
package com.taauav.front.entity; | |||||
import java.time.LocalDateTime; | |||||
import com.taauav.common.domain.Entity; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
/** | |||||
* <p> | |||||
* 外部用户角色表 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@Accessors(chain = true) | |||||
public class UserAuthGroup extends Entity { | |||||
private static final long serialVersionUID = 1L; | |||||
/** | |||||
* 用户组中文名称 | |||||
*/ | |||||
private String name; | |||||
/** | |||||
* 数据权限:1查看自己区划数据 2查看所有区划数据 3查看指定区划数据 | |||||
*/ | |||||
private Integer authData; | |||||
/** | |||||
* auth_data=3时的个性化区划 | |||||
*/ | |||||
private String driverArea; | |||||
/** | |||||
* 备注 | |||||
*/ | |||||
private String remark; | |||||
/** | |||||
* 排序 | |||||
*/ | |||||
private Integer sort; | |||||
} |
package com.taauav.front.mapper; | |||||
import com.taauav.front.entity.TauvInspectQuestion; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* 问题管理 Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
public interface TauvInspectQuestionMapper extends BaseMapper<TauvInspectQuestion> { | |||||
} |
<?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.taauav.front.mapper.TauvInspectQuestionMapper"> | |||||
</mapper> |
package com.taauav.front.mapper; | |||||
import com.taauav.front.entity.UserAuthGroup; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* 外部用户角色表 Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
public interface UserAuthGroupMapper extends BaseMapper<UserAuthGroup> { | |||||
} |
<?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.taauav.front.mapper.UserAuthGroupMapper"> | |||||
</mapper> |
package com.taauav.front.query; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.taauav.common.core.mps.BaseQuery; | |||||
import lombok.Data; | |||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import java.math.BigInteger; | |||||
import java.util.Date; | |||||
/** | |||||
* 巡检任务查询条件 | |||||
*/ | |||||
@Data | |||||
public class UserInspectDriverQuery extends BaseQuery { | |||||
/** | |||||
* 巡检任务 | |||||
*/ | |||||
private Integer type; | |||||
/** | |||||
* 区划ID | |||||
*/ | |||||
private BigInteger driverArea; | |||||
/** | |||||
* 河湖名称 | |||||
*/ | |||||
private String driverName; | |||||
/** | |||||
* 状态 | |||||
*/ | |||||
private Integer status; | |||||
/** | |||||
* 执行日期 | |||||
*/ | |||||
private String executionTime; | |||||
} |
package com.taauav.front.service; | |||||
import com.taauav.front.entity.TauvInspectQuestion; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 问题管理 服务类 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
public interface ITauvInspectQuestionService extends IService<TauvInspectQuestion> { | |||||
} |
*/ | */ | ||||
Response getUserAdminList(); | Response getUserAdminList(); | ||||
/** | |||||
* 获取管理员数据 | |||||
* | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
UserAdmin getAdminInfo(Integer id); | |||||
} | } |
package com.taauav.front.service; | |||||
import com.taauav.front.entity.UserAuthGroup; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 外部用户角色表 服务类 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
public interface IUserAuthGroupService extends IService<UserAuthGroup> { | |||||
} |
package com.taauav.front.service; | |||||
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.entity.UserAdmin; | |||||
import com.taauav.front.query.UserInspectDriverQuery; | |||||
import java.util.Map; | |||||
/** | |||||
* <p> | |||||
* 巡检任务 服务类 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
public interface IUserInspectDriverService extends IBaseService<TauvInspectDriver> { | |||||
/** | |||||
* 添加任务对应数据 | |||||
* | |||||
* @param inspect | |||||
* @return | |||||
*/ | |||||
String batchAddData(TauvInspect inspect); | |||||
/** | |||||
* 获取巡检任务列表 | |||||
* | |||||
* @param map 查询条件 | |||||
* @return | |||||
*/ | |||||
Response getList(Map<String, Object> map); | |||||
/** | |||||
* 任务详情 | |||||
* | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
Response detail(Integer id); | |||||
} |
package com.taauav.front.service; | |||||
import com.taauav.admin.entity.TauvInspect; | |||||
import com.taauav.common.bean.Response; | |||||
import com.taauav.common.service.IBaseService; | |||||
/** | |||||
* <p> | |||||
* 巡检任务表 服务类 | |||||
* </p> | |||||
* | |||||
* @author dyg | |||||
* @since 2019-11-14 | |||||
*/ | |||||
public interface IUserInspectService extends IBaseService<TauvInspect> { | |||||
/** | |||||
* 添加任务 | |||||
* | |||||
* @param inspect | |||||
* @return | |||||
*/ | |||||
Response addTask(TauvInspect inspect); | |||||
} |
package com.taauav.front.service.impl; | |||||
import com.taauav.front.entity.TauvInspectQuestion; | |||||
import com.taauav.front.mapper.TauvInspectQuestionMapper; | |||||
import com.taauav.front.service.ITauvInspectQuestionService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 问题管理 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@Service | |||||
public class TauvInspectQuestionServiceImpl extends ServiceImpl<TauvInspectQuestionMapper, TauvInspectQuestion> implements ITauvInspectQuestionService { | |||||
} |
package com.taauav.front.service.impl; | package com.taauav.front.service.impl; | ||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
import com.taauav.admin.entity.SysAdmin; | |||||
import com.taauav.common.bean.CacheUser; | |||||
import com.taauav.common.bean.Response; | import com.taauav.common.bean.Response; | ||||
import com.taauav.common.config.FrontUserToken; | |||||
import com.taauav.common.service.impl.BaseServiceImpl; | import com.taauav.common.service.impl.BaseServiceImpl; | ||||
import com.taauav.front.dto.LoginDto; | |||||
import com.taauav.common.util.FunctionUtils; | |||||
import com.taauav.common.util.StringUtils; | |||||
import com.taauav.front.constant.UserAdminConstant; | |||||
import com.taauav.front.entity.UserAdmin; | import com.taauav.front.entity.UserAdmin; | ||||
import com.taauav.front.entity.UserAuthGroup; | |||||
import com.taauav.front.mapper.UserAdminMapper; | import com.taauav.front.mapper.UserAdminMapper; | ||||
import com.taauav.front.mapper.UserAuthGroupMapper; | |||||
import com.taauav.front.service.IUserAdminService; | import com.taauav.front.service.IUserAdminService; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.apache.shiro.SecurityUtils; | |||||
import org.apache.shiro.authc.AuthenticationException; | |||||
import org.apache.shiro.authc.IncorrectCredentialsException; | |||||
import org.apache.shiro.authc.UnknownAccountException; | |||||
import org.apache.shiro.authc.UsernamePasswordToken; | |||||
import org.apache.shiro.subject.Subject; | |||||
import org.springframework.beans.BeanUtils; | |||||
import com.taauav.front.service.IUserAuthGroupService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.beans.factory.annotation.Value; | import org.springframework.beans.factory.annotation.Value; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.ArrayList; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
@Autowired | @Autowired | ||||
private Response response; | private Response response; | ||||
@Autowired | |||||
private UserAuthGroupMapper userAuthGroupMapper; | |||||
@Autowired | |||||
private IUserAuthGroupService userAuthGroupService; | |||||
/** | /** | ||||
* 根据用户名获取人员信息 | * 根据用户名获取人员信息 | ||||
* | * | ||||
List<UserAdmin> userAdminList = userAdminMapper.selectList(queryWrapper); | List<UserAdmin> userAdminList = userAdminMapper.selectList(queryWrapper); | ||||
return response.success(userAdminList); | return response.success(userAdminList); | ||||
} | } | ||||
/** | |||||
* 根据人员ID获取人员信息 | |||||
* | |||||
* @param id 人员ID | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public UserAdmin getAdminInfo(Integer id) { | |||||
if (id <= 0) { | |||||
return null; | |||||
} | |||||
UserAdmin admin = userAdminMapper.selectById(id); | |||||
if (admin == null) { | |||||
return null; | |||||
} | |||||
//处理头像 | |||||
if (!"".equals(admin.getAvatar())) { | |||||
admin.setAvatar(imageUrl + admin.getAvatar()); | |||||
} | |||||
//处理角色名称 | |||||
if (!StringUtils.isEmpty(admin.getAuthGroup())) { | |||||
UserAuthGroup userAuthGroup = userAuthGroupMapper.selectById(Integer.valueOf(admin.getAuthGroup())); | |||||
admin.setAuthGroupText(userAuthGroup.getName()); | |||||
} | |||||
//处理状态名称 | |||||
String statusText = FunctionUtils.getArrayText(String.valueOf(admin.getStatus()), UserAdminConstant.getAdminStatus()); | |||||
admin.setStatusText(statusText); | |||||
return admin; | |||||
} | |||||
} | } |
package com.taauav.front.service.impl; | |||||
import com.taauav.admin.entity.SysAuthGroup; | |||||
import com.taauav.front.entity.UserAuthGroup; | |||||
import com.taauav.front.mapper.UserAuthGroupMapper; | |||||
import com.taauav.front.service.IUserAuthGroupService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 外部用户角色表 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@Service | |||||
public class UserAuthGroupServiceImpl extends ServiceImpl<UserAuthGroupMapper, UserAuthGroup> implements IUserAuthGroupService { | |||||
} |
package com.taauav.front.service.impl; | |||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.taauav.admin.dto.TauvInspectDriverDTO; | |||||
import com.taauav.admin.entity.*; | |||||
import com.taauav.admin.mapper.TauvInspectDriverMapper; | |||||
import com.taauav.admin.mapper.TauvInspectMapper; | |||||
import com.taauav.admin.service.*; | |||||
import com.taauav.admin.vo.TauvEquipmentListVo; | |||||
import com.taauav.admin.vo.TauvMountEquipmentListVo; | |||||
import com.taauav.admin.vo.inspectdriver.TauvInspectDriverInfoVo; | |||||
import com.taauav.common.bean.Response; | |||||
import com.taauav.common.service.impl.BaseServiceImpl; | |||||
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.entity.UserAdmin; | |||||
import com.taauav.front.mapper.UserAdminMapper; | |||||
import com.taauav.front.query.UserInspectDriverQuery; | |||||
import com.taauav.front.service.IUserAdminService; | |||||
import com.taauav.front.service.IUserInspectDriverService; | |||||
import com.taauav.front.utils.LoginUtils; | |||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.util.StringUtils; | |||||
import java.io.File; | |||||
import java.math.BigDecimal; | |||||
import java.math.BigInteger; | |||||
import java.util.*; | |||||
/** | |||||
* <p> | |||||
* 外包人员表 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@Service | |||||
public class UserInspectDriverServiceImpl extends BaseServiceImpl<TauvInspectDriverMapper, TauvInspectDriver> implements IUserInspectDriverService { | |||||
@Autowired | |||||
private ILsCityService lsCityService; | |||||
@Autowired | |||||
private UserAdminMapper userAdminMapper; | |||||
@Autowired | |||||
private IUserAdminService userAdminService; | |||||
@Autowired | |||||
private TauvInspectDriverMapper inspectDriverMapper; | |||||
@Value("${spring.pageSize}") | |||||
private Integer pageSize; | |||||
@Value("${server.UPLOAD_URL}") | |||||
private String uploadUrl; | |||||
@Value("${file.uploadFolder}") | |||||
private String uploadFolder; | |||||
@Autowired | |||||
private Response response; | |||||
@Autowired | |||||
private ISysCityService iSysCityService; | |||||
@Autowired | |||||
private ISysAdminService iSysAdminService; | |||||
@Autowired | |||||
private ITauvReportService iTauvReportService; | |||||
@Autowired | |||||
private ITauvEquipmentService equipmentService; | |||||
@Autowired | |||||
private ITauvMountEquipmentService mountEquipmentService; | |||||
@Autowired | |||||
private ITauvDriverService iTauvDriverService; | |||||
@Autowired | |||||
private TauvInspectMapper inspectMapper; | |||||
@Autowired | |||||
private ITauvInspectFileService inspectFileService; | |||||
@Override | |||||
public String batchAddData(TauvInspect inspect) { | |||||
List<TauvInspectDriver> inspectDriver = inspect.getInspectDriverList(); | |||||
Integer inspectId = inspect.getId(); | |||||
String errorMsg = ""; | |||||
if (inspectDriver != null && !"".equals(inspectDriver) && inspectDriver.size() > 0) { | |||||
int i = 1; | |||||
for (TauvInspectDriver driver : inspectDriver) { | |||||
if (!StringUtils.isEmpty(driver.getDriverFile())) { | |||||
// 如果上传了文件则对文件进行处理 | |||||
String file = driver.getDriverFile(); | |||||
if (file.contains("temp")) { | |||||
file = file.replace(uploadUrl, uploadFolder); | |||||
File oldFile = new File(file); | |||||
if (!oldFile.exists()) { | |||||
return "文件不存在"; | |||||
} | |||||
//把文件移动到正式目录下 | |||||
Calendar date = Calendar.getInstance(); | |||||
String year = String.valueOf(date.get(Calendar.YEAR)); | |||||
String month = String.valueOf(date.get(Calendar.MONTH) + 1); | |||||
String day = String.valueOf(date.get(Calendar.DATE)); | |||||
String destFile = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/"; | |||||
boolean flag = FileUtil.cutGeneralFile(file, destFile); | |||||
if (flag) { | |||||
// 文件名 | |||||
String fileName = oldFile.getName(); | |||||
destFile = destFile.replace(uploadFolder, ""); | |||||
driver.setDriverFile(destFile + fileName); | |||||
} else { | |||||
return "文件保存失败了!"; | |||||
} | |||||
} | |||||
} | |||||
Integer driverId = driver.getDriverId(); | |||||
TauvDriver driverInfo = iTauvDriverService.getInfoById(driverId); | |||||
if (driverInfo != null) { | |||||
driver.setDriverName(driverInfo.getName()); | |||||
driver.setDriverArea(driverInfo.getDriverArea()); | |||||
BigDecimal bigDecimal = new BigDecimal(driverInfo.getLength()); | |||||
driver.setDriverLength(bigDecimal); | |||||
driver.setDriverStart(driverInfo.getStartPoint()); | |||||
driver.setDriverEnd(driverInfo.getEndPoint()); | |||||
} else { | |||||
//抛出异常 | |||||
return "河流名称不存在"; | |||||
} | |||||
driver.setId(0); | |||||
driver.setInspectId(inspectId); | |||||
// 任务来源:客户 | |||||
driver.setSource(2); | |||||
driver.setInspectNo(inspect.getInspectNo()); | |||||
driver.setCreateTime(DateUtil.now()); | |||||
driver.setCreateUser(ShiroUtils.getAdminId()); | |||||
driver.setNum(i * 10); | |||||
i++; | |||||
} | |||||
} else { | |||||
return "请选择河流信息"; | |||||
} | |||||
saveBatch(inspectDriver); | |||||
return errorMsg; | |||||
} | |||||
/** | |||||
* 获取巡检任务列表 | |||||
* | |||||
* @param map 查询条件 | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public Response getList(Map<String, Object> map) { | |||||
Integer pageNo = 1; | |||||
if (!org.springframework.util.StringUtils.isEmpty(map)) { | |||||
if (map.containsKey("page") && !"".equals(map.get("page")) && Integer.valueOf(map.get("page").toString()) > 0) { | |||||
pageNo = Integer.valueOf(map.get("page").toString()); | |||||
} | |||||
//每页数量 | |||||
if (map.containsKey("pageSize") && !"".equals(map.get("pageSize")) && Integer.valueOf(map.get("pageSize").toString()) > 0) { | |||||
pageSize = Integer.valueOf(map.get("pageSize").toString()); | |||||
} | |||||
//分配列表:期望巡检时间 任务列表:执行时间 | |||||
String inspectTime = "inspectTime"; | |||||
if (!StringUtils.isEmpty(map.get(inspectTime))) { | |||||
String startTime = FunctionUtils.formatTime(Integer.valueOf(map.get(inspectTime).toString()), "yyyy-MM-dd") + " 00:00:00"; | |||||
map.put("executionTime", startTime); | |||||
} | |||||
//区属 | |||||
map = FunctionUtils.dealArea(map); | |||||
} else { | |||||
map = new HashMap<>(); | |||||
} | |||||
Page<TauvInspectDriverDTO> page = new Page<>(pageNo, pageSize); | |||||
List<TauvInspectDriverDTO> data = inspectDriverMapper.getPageList(page, map); | |||||
TauvInspect tauvInspect = new TauvInspect(); | |||||
if (data != null) { | |||||
for (TauvInspectDriverDTO driver : data) { | |||||
driver = getInfoDetail(driver); | |||||
} | |||||
} | |||||
page.setRecords(data); | |||||
return response.success(page); | |||||
} | |||||
/** | |||||
* 获取数据详细数据 | |||||
* | |||||
* @param driver | |||||
* @return | |||||
*/ | |||||
private TauvInspectDriverDTO getInfoDetail(TauvInspectDriverDTO driver) { | |||||
TauvInspect tauvInspect = new TauvInspect(); | |||||
Map<Integer, String> mapList = driver.getStatusList(); | |||||
Map<Integer, String> typeList = tauvInspect.getTypeList(); | |||||
if (StringUtils.isEmpty(driver.getType())) { | |||||
driver.setTypeText(""); | |||||
} else { | |||||
driver.setTypeText(typeList.get(driver.getType().intValue())); | |||||
} | |||||
driver.setStatusText(mapList.get(driver.getStatus().intValue())); | |||||
if (driver.getSource() == 1) { | |||||
// 平台发起的任务 | |||||
SysAdmin adminInfo = iSysAdminService.getAdminInfo(driver.getCreateUser()); | |||||
driver.setFormatCreateUser(StringUtils.isEmpty(adminInfo) ? "" : adminInfo.getRealname()); | |||||
} else { | |||||
// 客户发起的任务 | |||||
UserAdmin adminInfo = userAdminService.getAdminInfo(driver.getCreateUser()); | |||||
driver.setFormatCreateUser(StringUtils.isEmpty(adminInfo) ? "" : adminInfo.getRealname()); | |||||
} | |||||
driver.setFormatCreateTime(DateUtil.format(driver.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); | |||||
driver.setFormatInspectTime(DateUtil.format(driver.getInspectTime(), "yyyy-MM-dd")); | |||||
if (!StringUtils.isEmpty(driver.getExecutionTime())) { | |||||
driver.setFormatExecutionTime(DateUtil.format(driver.getExecutionTime(), "yyyy-MM-dd")); | |||||
} | |||||
if (!StringUtils.isEmpty(driver.getDriverArea())) { | |||||
SysCity cityInfo = iSysCityService.getInfoById(driver.getDriverArea()); | |||||
driver.setDriverAreaText(StringUtils.isEmpty(cityInfo) ? "" : cityInfo.getName()); | |||||
} else { | |||||
driver.setDriverAreaText(""); | |||||
} | |||||
//已完成时展示报告 | |||||
if (driver.getStatus() == 4) { | |||||
QueryWrapper wrapper = new QueryWrapper(); | |||||
wrapper.eq("mark", 1); | |||||
wrapper.eq("inspect_driver_id", driver.getId()); | |||||
wrapper.last("limit 1"); | |||||
TauvReport report = iTauvReportService.getOne(wrapper); | |||||
if (report != null) { | |||||
driver.setReportId(report.getId()); | |||||
} | |||||
} | |||||
// 获取飞手信息 | |||||
List<String> inspectHandList = iSysAdminService.getAdminNameByIds(driver.getInspectHand()); | |||||
driver.setInspectHandName(org.apache.commons.lang3.StringUtils.join(inspectHandList.toArray(), ",")); | |||||
// 获取无人机设备名称 | |||||
List<String> equipmentNameList = equipmentService.getEquipmentNameByIds(driver.getEquipmentId()); | |||||
driver.setEquipmentName(org.apache.commons.lang3.StringUtils.join(equipmentNameList.toArray(), ",")); | |||||
// 获取挂载设备名称 | |||||
List<String> mountEquipmentNameList = mountEquipmentService.getMountEquipmentNameByIds(driver.getMountequipmentId()); | |||||
driver.setMountequipmentName(org.apache.commons.lang3.StringUtils.join(mountEquipmentNameList.toArray(), ",")); | |||||
return driver; | |||||
} | |||||
/** | |||||
* 获取任务详情 | |||||
* | |||||
* @param id 任务ID | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public Response detail(Integer id) { | |||||
// 获取巡检任务河流 | |||||
TauvInspectDriver inspectDriver = inspectDriverMapper.selectById(id); | |||||
if (inspectDriver == null) { | |||||
return response.failure("巡检任务河流信息不存在"); | |||||
} | |||||
// 拷贝属性 | |||||
TauvInspectDriverInfoVo inspectDriverInfoVo = new TauvInspectDriverInfoVo(); | |||||
BeanUtils.copyProperties(inspectDriver, inspectDriverInfoVo); | |||||
// 获取区划描述 | |||||
String cityName = iSysCityService.getCityName(inspectDriver.getDriverArea()); | |||||
inspectDriverInfoVo.setDriverAreaName(cityName); | |||||
// 获取航线文件 | |||||
if (!StringUtils.isEmpty(inspectDriver.getDriverFile())) { | |||||
inspectDriverInfoVo.setDriverFile(uploadUrl + inspectDriver.getDriverFile()); | |||||
} | |||||
// 飞手名称 | |||||
List<String> inspectHandName = iSysAdminService.getAdminNameByIds(inspectDriver.getInspectHand()); | |||||
inspectDriverInfoVo.setInspectHandName(org.apache.commons.lang3.StringUtils.join(inspectHandName.toArray(), ",")); | |||||
// 获取巡检任务信息 | |||||
TauvInspect inspect = inspectMapper.selectById(inspectDriver.getInspectId()); | |||||
if (inspect == null) { | |||||
return response.failure("巡检任务不存在"); | |||||
} | |||||
inspectDriverInfoVo.setInspectTime(inspect.getInspectTime()); | |||||
// 获取无人机设备 | |||||
if (!StringUtils.isEmpty(inspectDriver.getEquipmentId())) { | |||||
List<TauvEquipmentListVo> equipmentListVoList = equipmentService.getEquipmentListByIds(inspectDriver.getEquipmentId()); | |||||
inspectDriverInfoVo.setEquipmentList(equipmentListVoList); | |||||
} | |||||
// 获取挂载设备 | |||||
if (!StringUtils.isEmpty(inspectDriver.getMountequipmentId())) { | |||||
List<TauvMountEquipmentListVo> mountEquipmentListVoList = mountEquipmentService.getMountEquipmentListByIds(inspectDriver.getMountequipmentId()); | |||||
inspectDriverInfoVo.setMountEquipmentList(mountEquipmentListVoList); | |||||
} | |||||
// 获取巡检任务航拍图片列表 | |||||
List<TauvInspectFile> inspectFileList = inspectFileService.getInspectFileListByInspectDriverId(inspectDriver.getId()); | |||||
inspectDriverInfoVo.setInspectFileList(inspectFileList); | |||||
return response.success(inspectDriverInfoVo); | |||||
} | |||||
} |
package com.taauav.front.service.impl; | |||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||||
import com.taauav.admin.entity.TauvInspect; | |||||
import com.taauav.admin.mapper.TauvInspectMapper; | |||||
import com.taauav.common.bean.Response; | |||||
import com.taauav.common.service.impl.BaseServiceImpl; | |||||
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.constant.UserNoticeConstant; | |||||
import com.taauav.front.entity.UserAdmin; | |||||
import com.taauav.front.entity.UserNotice; | |||||
import com.taauav.front.mapper.UserAdminMapper; | |||||
import com.taauav.front.mapper.UserNoticeMapper; | |||||
import com.taauav.front.query.UserNoticeQuery; | |||||
import com.taauav.front.service.IUserInspectDriverService; | |||||
import com.taauav.front.service.IUserInspectService; | |||||
import com.taauav.front.service.IUserNoticeService; | |||||
import com.taauav.front.vo.usernotice.UserNoticeInfoVo; | |||||
import com.taauav.front.vo.usernotice.UserNoticeListVo; | |||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.stereotype.Service; | |||||
import org.springframework.util.StringUtils; | |||||
import java.io.File; | |||||
import java.util.*; | |||||
/** | |||||
* <p> | |||||
* 通知公告表 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author 鲲鹏 | |||||
* @since 2020-05-14 | |||||
*/ | |||||
@Service | |||||
public class UserInspectServiceImpl extends BaseServiceImpl<TauvInspectMapper, TauvInspect> implements IUserInspectService { | |||||
@Autowired | |||||
private Response response; | |||||
@Value("${server.UPLOAD_URL}") | |||||
private String uploadUrl; | |||||
@Value("${file.uploadFolder}") | |||||
private String uploadFolder; | |||||
@Autowired | |||||
private IUserInspectDriverService userInspectDriverService; | |||||
/** | |||||
* 创建巡检任务 | |||||
* | |||||
* @param inspect | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public Response addTask(TauvInspect inspect) { | |||||
// 巡检类型校验 | |||||
if (inspect.getType() == null || inspect.getType() <= 0) { | |||||
return response.failure("请选择巡检类型"); | |||||
} | |||||
// 创建巡检任务 | |||||
boolean result = this.addData(inspect); | |||||
if (!result) { | |||||
return response.failure("巡检任务创建失败"); | |||||
} | |||||
// 生成巡检任务单号 | |||||
String code = ""; | |||||
if (inspect.getType() == 1) { | |||||
// 可见光巡检 | |||||
code = "KJG" + FunctionUtils.formatTime(FunctionUtils.getCurrentTime(), "yyyyMM"); | |||||
} else if (inspect.getType() == 2) { | |||||
// 多光谱巡检 | |||||
code = "DGP" + FunctionUtils.formatTime(FunctionUtils.getCurrentTime(), "yyyyMM"); | |||||
} | |||||
Integer id = inspect.getId(); | |||||
String idStr = String.format("%04d", id); | |||||
inspect.setId(id); | |||||
inspect.setInspectNo(code + idStr); | |||||
// 图片处理 | |||||
if (!StringUtils.isEmpty(inspect.getAttachment())) { | |||||
// 如果上传了文件则对文件进行处理 | |||||
String file = inspect.getAttachment(); | |||||
if (file.contains("temp")) { | |||||
file = file.replace(uploadUrl, uploadFolder); | |||||
File oldFile = new File(file); | |||||
if (!oldFile.exists()) { | |||||
return response.failure("文件不存在"); | |||||
} | |||||
//把文件移动到正式目录下 | |||||
Calendar date = Calendar.getInstance(); | |||||
String year = String.valueOf(date.get(Calendar.YEAR)); | |||||
String month = String.valueOf(date.get(Calendar.MONTH) + 1); | |||||
String day = String.valueOf(date.get(Calendar.DATE)); | |||||
String destFile = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/"; | |||||
boolean flag = FileUtil.cutGeneralFile(file, destFile); | |||||
if (flag) { | |||||
// 文件名 | |||||
String fileName = oldFile.getName(); | |||||
destFile = destFile.replace(uploadFolder, ""); | |||||
inspect.setAttachment(destFile + fileName); | |||||
} else { | |||||
return response.failure("文件保存失败了"); | |||||
} | |||||
} | |||||
} | |||||
saveOrUpdate(inspect); | |||||
String msg = userInspectDriverService.batchAddData(inspect); | |||||
if (!"".equals(msg)) { | |||||
return response.failure(msg); | |||||
} | |||||
return response.success("添加成功"); | |||||
} | |||||
} |