无关风月
9 天以前 e897513fc65c426c5b0f0dce6f8b887b9cc9010d
保洁巡检本周代码
11个文件已修改
114 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TLocationController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/WorkbenchesController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TTaskDetailController.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/applet/dto/AppealListDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TAppealMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java
@@ -645,7 +645,7 @@
                    .eq(TDictData::getDataType, 2));
            List<AnalysisUnqualifiedCleaningDetailVO> analysisUnqualifiedCleaningDetailVOS = new ArrayList<>();
            for (TDictData tDictData : dictDataList) {
                List<TTaskDetail> tTaskDetails = taskDetailList.stream().filter(taskDetail -> taskDetail.getUnqualified().equals(tDictData.getId())).collect(Collectors.toList());
                List<TTaskDetail> tTaskDetails = taskDetailList.stream().filter(taskDetail -> org.springframework.util.StringUtils.hasLength(taskDetail.getUnqualified())&& taskDetail.getUnqualified().equals(tDictData.getId())).collect(Collectors.toList());
                AnalysisUnqualifiedCleaningDetailVO analysisUnqualifiedCleaningDetailVO = new AnalysisUnqualifiedCleaningDetailVO();
                analysisUnqualifiedCleaningDetailVO.setUnqualifiedName(tDictData.getDataContent());
                analysisUnqualifiedCleaningDetailVO.setCount(tTaskDetails.size());
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java
@@ -178,6 +178,9 @@
    @PostMapping(value = "/audit")
    public R<Boolean> audit(@RequestBody @Valid TAppealAuditDTO dto) {
        TAppeal appeal = appealService.getById(dto.getId());
        dto.setStatus(dto.getStatus());
        dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
        dto.setAuditTime(LocalDateTime.now());
        TTask task = taskCleanService.getById(appeal.getTaskId());
        TLocation location = locationService.getById(task.getLocationId());
        TNotice tNotice = new TNotice();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TLocationController.java
@@ -276,20 +276,6 @@
    public void importTemplate() {
        List<TLocationImportExcel> locationImportExcels = new ArrayList<>();
        TLocationImportExcel tLocationImportExcel = new TLocationImportExcel();
        tLocationImportExcel.setDeptCode("1");
        tLocationImportExcel.setDeptName("1");
        tLocationImportExcel.setNickName("1");
        tLocationImportExcel.setProjectCodeClear("1");
        tLocationImportExcel.setDeptCodeClear("1");
        tLocationImportExcel.setCleanerCodeClear("1");
        tLocationImportExcel.setLocationCode("1");
        tLocationImportExcel.setLocationType("1");
        tLocationImportExcel.setLocationName("1");
        tLocationImportExcel.setLocationAddress("1");
        tLocationImportExcel.setLocationAddressEnd("1");
        tLocationImportExcel.setLocationAddressLonLat("1");
        tLocationImportExcel.setLocationAddressEndLonLat("1");
        locationImportExcels.add(tLocationImportExcel);
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TLocationImportExcel.class, locationImportExcels);
        HttpServletResponse response = WebUtils.response();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java
@@ -176,6 +176,9 @@
    public R<Boolean> audit(@RequestBody  TTaskAuditDTO dto) {
        dto.setAuditTime(LocalDateTime.now());
        TTask task = taskCleanerService.getById(dto.getTaskId());
        TTaskDetail one = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, dto.getTaskId())
                .orderByDesc(BaseModel::getCreateTime).last("limit 1").one();
        dto.setClearStatus(one.getClearStatus());
        TLocation location = locationService.getById(task.getLocationId());
        TNotice tNotice = new TNotice();
        TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1")
@@ -230,6 +233,11 @@
        noticeService.save(tNotice);
        dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
        taskDetailService.save(dto);
        one.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
        one.setAuditTime(LocalDateTime.now());
        one.setAuditRemark(dto.getAuditRemark());
        one.setAuditStatus(dto.getAuditStatus());
        taskDetailService.updateById(one);
        return R.ok();
    }
    @Log(title = "批量审核任务", businessType = BusinessType.UPDATE)
@@ -340,9 +348,11 @@
                byId4.setUnqualifiedName(byId3.getDataContent());
            }
        }
        SysUser sysUser = sysUserService.selectUserById(Long.valueOf(byId4.getAuditPerson()));
        if (sysUser!=null){
            byId4.setAuditPersonName(sysUser.getUserName());
        if (byId4.getAuditPerson()!=null){
            SysUser sysUser = sysUserService.selectUserById(Long.valueOf(byId4.getAuditPerson()));
            if (sysUser!=null){
                byId4.setAuditPersonName(sysUser.getUserName());
            }
        }
        taskDetailVO.setTaskDetail(byId4);
        return R.ok(taskDetailVO);
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/WorkbenchesController.java
@@ -985,6 +985,7 @@
            List<TTaskDetail> taskDetails = tTaskDetailService.list(Wrappers.lambdaQuery(TTaskDetail.class)
                    .in(TTaskDetail::getTaskId, taskIds)
                    .eq(TTaskDetail::getClearStatus, 2)
                            .eq(TTaskDetail::getHandleType,1)
                    .orderByDesc(TTaskDetail::getCreateTime));
            List<TTaskDetail> taskDetailList = new ArrayList<>();
            for (TTask task : list) {
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java
@@ -396,7 +396,7 @@
                List<TTaskDetail> status3 = taskDetails.stream().filter(e -> e.getClearStatus() == 1).collect(Collectors.toList());
                List<TTaskDetail> status4 = taskDetails.stream().filter(e -> e.getClearStatus() == 2).collect(Collectors.toList());
                if (status3.size() + status4.size() != 0) {
                if (!status3.isEmpty()) {
                    BigDecimal divide = new BigDecimal(status3.size() + status4.size())
                            .divide(new BigDecimal(status3.size()), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
                    res.setRate(divide);
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TTaskDetailController.java
@@ -7,6 +7,7 @@
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.applet.dto.AppealDTO;
import com.ruoyi.system.dto.TTaskAuditBatchDTO;
import com.ruoyi.system.dto.TaskDetailDto;
@@ -30,6 +31,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@@ -67,43 +69,50 @@
        if (task==null)return R.fail("任务不存在");
        TLocation location = locationService.getById(task.getLocationId());
        if (location==null)return R.fail("点位不存在");
        try {
            String routeJson = AmapApiClient.getDrivingRoute(Double.parseDouble(location.getLocationLat()),
                    Double.parseDouble(location.getLocationLon()),
                            Double.parseDouble(location.getLocationLatEnd()),
                                    Double.parseDouble(location.getLocationLonEnd()));
            // 转化为json对象
            JSONObject jsonObject = JSONObject.parseObject(routeJson);
            JSONObject route = jsonObject.getJSONObject("route");
            JSONArray paths = route.getJSONArray("paths");
            JSONObject o = (JSONObject)paths.get(0);
            BigDecimal distance = o.getBigDecimal("distance");
            System.err.println( paths);
            List<double[]> fivePoints = PathParser.parseAndInterpolate(routeJson, segments,
                    Double.parseDouble(location.getLocationLat()),
                    Double.parseDouble(location.getLocationLon()),
                    Double.parseDouble(location.getLocationLatEnd()),
                    Double.parseDouble(location.getLocationLonEnd()));
            if (GeoChecker.isInAnyCircle(Double.parseDouble(dto.getLat()), Double.parseDouble(dto.getLon()),
                    fivePoints, radius)) {
                System.out.println("✅ 成功!您位于某个圆形电子围栏范围内。");
            } else {
                System.out.println("❌ 失败!您不在任何圆形电子围栏范围内。");
                return R.fail("位置信息与点位不一致,请点击此处更新定位");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
//        try {
//            String routeJson = AmapApiClient.getDrivingRoute(Double.parseDouble(location.getLocationLat()),
//                    Double.parseDouble(location.getLocationLon()),
//                            Double.parseDouble(location.getLocationLatEnd()),
//                                    Double.parseDouble(location.getLocationLonEnd()));
//            // 转化为json对象
//            JSONObject jsonObject = JSONObject.parseObject(routeJson);
//            JSONObject route = jsonObject.getJSONObject("route");
//            JSONArray paths = route.getJSONArray("paths");
//            JSONObject o = (JSONObject)paths.get(0);
//            BigDecimal distance = o.getBigDecimal("distance");
//            System.err.println( paths);
//            List<double[]> fivePoints = PathParser.parseAndInterpolate(routeJson, segments,
//                    Double.parseDouble(location.getLocationLat()),
//                    Double.parseDouble(location.getLocationLon()),
//                    Double.parseDouble(location.getLocationLatEnd()),
//                    Double.parseDouble(location.getLocationLonEnd()));
//
//            if (GeoChecker.isInAnyCircle(Double.parseDouble(dto.getLat()), Double.parseDouble(dto.getLon()),
//                    fivePoints, radius)) {
//                System.out.println("✅ 成功!您位于某个圆形电子围栏范围内。");
//            } else {
//                System.out.println("❌ 失败!您不在任何圆形电子围栏范围内。");
//                return R.fail("位置信息与点位不一致,请点击此处更新定位");
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        taskDetailService.save(dto);
        // 修改任务状态
        taskService.update(Wrappers.<TTask>lambdaUpdate().set(TTask::getStatus, 3).eq(TTask::getId, dto.getTaskId()));
        return R.ok();
    }
    @Resource
    private TokenService tokenService;
    @ApiOperation(value = "申诉")
    @PostMapping(value = "/appeal")
    public R<Boolean> appeal(@RequestBody AppealDTO dto) {
        List<TAppeal> list = appealService.lambdaQuery().eq(TAppeal::getTaskId, dto.getTaskId()).list();
        if (!list.isEmpty()){
            return R.fail("任务只有一次申诉机会");
        }
        dto.setAppealPerson(tokenService.getLoginUserApplet().getUserId()+"");
        appealService.save(dto);
        // 添加任务详情
        TTaskDetail taskDetail = new TTaskDetail();
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java
@@ -243,7 +243,7 @@
        userIndexVO.setFinishCount(size);
        List<TTaskDetail> status1 = taskDetails.stream().filter(e -> e.getClearStatus() == 1).collect(Collectors.toList());
        List<TTaskDetail> status2 = taskDetails.stream().filter(e -> e.getClearStatus() == 2).collect(Collectors.toList());
        if (status1.size() + status2.size() != 0) {
        if (!status1.isEmpty()) {
            BigDecimal divide = new BigDecimal(status1.size() + status2.size())
                    .divide(new BigDecimal(status1.size()), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
            userIndexVO.setRate(divide);
@@ -457,7 +457,6 @@
        Long userRole = sysUserService.getUserRole(userId);
        SysRole sysRole = roleService.selectRoleById(userRole);
        List<SysUser> sysUsers = sysUserService.selectAllList();
        sysRole.setRoleName("项目负责人");
        SysUser auditPerson = sysUserService.selectUserById(999L);
        //项目负责人、部门负责人、公司成员提交由最终审批人审批;
        if (user.getDeptType() == 2 || sysRole.getRoleName().contains("项目负责人") || sysRole.getRoleName().contains("部门负责人")) {
@@ -546,7 +545,6 @@
        leaveDTO.setTemplateId(user.getTemplateId());
        leaveDTO.setLeavePerson(userId + "");
        leaveService.save(leaveDTO);
        sysRole.setRoleName("项目负责人");
        //项目负责人、部门负责人、公司成员提交由最终审批人审批;
        if (user.getDeptType() == 2 || sysRole.getRoleName().contains("项目负责人") || sysRole.getRoleName().contains("部门负责人")) {
            TLeaveAudit tLeaveAudit1 = new TLeaveAudit();
@@ -649,7 +647,6 @@
        SysUser sysUser = sysUserService.selectUserById(Long.parseLong(leave.getLeavePerson()));
        Long userRole = sysUserService.getUserRole(sysUser.getUserId());
        SysRole sysRole = roleService.selectRoleById(userRole);
        sysRole.setRoleName("项目负责人");
        if (sysRole.getRoleName().contains("现场负责人") || sysRole.getRoleName().equals("组长")) {
            if (sysUser.getDeptType() == 1) {
                TProjectDept tProjectDept = projectDeptService.getById(sysUser.getDeptId());
ruoyi-system/src/main/java/com/ruoyi/system/applet/dto/AppealListDTO.java
@@ -13,4 +13,6 @@
    private String lon;
    @ApiModelProperty(value = "纬度")
    private String lat;
    @ApiModelProperty(value = "当前用户id 前端忽略")
    private String userId;
}
ruoyi-system/src/main/resources/mapper/system/TAppealMapper.xml
@@ -59,6 +59,7 @@
        <if test="query.startTime != null and startTime != ''">
            and (t5.implement_time between #{startTime} and #{endTime})
        </if>
        order by t1.create_time desc
    </select>
    <select id="pageListUser" resultType="com.ruoyi.system.vo.system.AppealListVO">
        select t1.*,t2.location_name as locationName,t3.location_name as locationTypeName,
@@ -147,8 +148,10 @@
        ) AS t2 ON t1.task_id = t2.task_id AND t1.create_time = t2.max_time
        ) t5 on t1.id = t5.task_id
        where 1=1
          and t1.patrol_inspector = #{query.userId}
        and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        and t1.status !=3 and t1.status !=5 and t1.status !=6
        AND DATE(t1.implement_time) = CURDATE()
        order by distance asc
    </select>
ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
@@ -59,6 +59,7 @@
        <if test="query.startTime != null and query.startTime != ''">
            and (t1.implement_time between #{query.startTime} and #{query.endTime})
        </if>
        order by t1.create_time desc
    </select>
    <select id="pageListUser" resultType="com.ruoyi.system.applet.vo.TaskUserListVO">
        select t1.*,t2.location_name as locationName,t3.location_name as locationTypeName,