无关风月
2025-06-19 391d3fed7809454f742d71dddc55ed7ca1bc089e
保洁巡检本周代码
2个文件已添加
14个文件已修改
175 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDeptController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TKnowledgeController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TProjectDeptController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/applet/dto/LeaveAuditDTO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/applet/vo/UserIndexVO.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TKnowledge.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TLeave.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/system/RoleInfoVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TCleanerMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TDeptMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TLocationMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TProjectDeptMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TDeptController.java
@@ -73,7 +73,7 @@
    }
    @Log(title = "启用/禁用部门", businessType = BusinessType.OTHER)
    @ApiOperation(value = "启用/禁用部门")
    @DeleteMapping(value = "/editStatus")
    @GetMapping(value = "/editStatus")
    public R<Boolean> editStatus(@RequestParam String id) {
        TDept byId = deptService.getById(id);
        if (byId.getStatus()==1){
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TKnowledgeController.java
@@ -73,7 +73,7 @@
    }
    @Log(title = "启用/禁用环卫知识", businessType = BusinessType.OTHER)
    @ApiOperation(value = "启用/禁用环卫知识")
    @DeleteMapping(value = "/editStatus")
    @GetMapping(value = "/editStatus")
    public R<Boolean> editStatus(@RequestParam String id) {
        TKnowledge byId = knowledgeService.getById(id);
        if (byId.getStatus()==1){
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TProjectDeptController.java
@@ -15,6 +15,7 @@
import com.ruoyi.system.vo.system.ProjectDeptListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -71,6 +72,10 @@
    @ApiOperation(value = "新增项目部")
    @PostMapping(value = "/add")
    public R<Boolean> add(@RequestBody ProjectDeptDTO dto) {
        if (!StringUtils.hasLength(dto.getParentId())){
            dto.setParentId("0");
        }
        deptService.save(dto);
        return R.ok();
    }
@@ -78,6 +83,9 @@
    @ApiOperation(value = "编辑项目部")
    @PostMapping(value = "/edit")
    public R<Boolean> edit(@RequestBody ProjectDeptDTO dto) {
        if (!StringUtils.hasLength(dto.getParentId())){
            dto.setParentId("0");
        }
        deptService.updateById(dto);
        return R.ok();
    }
@@ -94,6 +102,14 @@
    @GetMapping(value = "/editStatus")
    public R<Boolean> editStatus(@RequestParam String id) {
        TProjectDept byId = deptService.getById(id);
        if (byId.getParentId().equals("0")){
            // 禁用上级 下级一起禁用
            List<TProjectDept> list = deptService.lambdaQuery().eq(TProjectDept::getParentId, byId.getId()).list();
            for (TProjectDept tProjectDept : list) {
                tProjectDept.setStatus(2);
            }
            deptService.updateBatchById(list);
        }
        if (byId.getStatus()==1){
            byId.setStatus(2);
        }else{
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -125,6 +125,7 @@
        RoleInfoVO roleInfoVo = new RoleInfoVO();
        roleInfoVo.setRoleId(role.getRoleId());
        roleInfoVo.setRoleName(role.getRoleName());
        roleInfoVo.setRemark(role.getRemark());
        // 获取当前角色的菜单列表
        List<SysMenu> menus = menuService.selectListByRoleId(roleId);
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java
@@ -1,6 +1,7 @@
package com.ruoyi.web.controller.api;
import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.basic.PageInfo;
@@ -9,6 +10,7 @@
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.applet.dto.*;
@@ -35,9 +37,14 @@
import javax.annotation.Resource;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -92,7 +99,64 @@
    @Resource
    private TProblemEscalationService problemEscalationService;
    @ApiOperation(value = "个人中心-首页")
    @PostMapping(value = "/userIndex")
    public R<UserIndexVO> userIndex() {
        UserIndexVO userIndexVO = new UserIndexVO();
        Long userId = tokenService.getLoginUserApplet().getUserId();
        SysUser sysUser = sysUserService.selectUserById(userId);
        userIndexVO.setAvatar(sysUser.getAvatar());
        userIndexVO.setNickName(sysUser.getNickName());
        userIndexVO.setPhonenumber(sysUser.getPhonenumber());
        if (sysUser.getDeptType() == 1){
            TProjectDept tProjectDept = projectDeptService.getById(sysUser.getDeptId());
            if (!tProjectDept.getParentId().equals("0")){
                TProjectDept tProjectDept1 = projectDeptService.getById(tProjectDept.getParentId());
                userIndexVO.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName());
            }else{
                userIndexVO.setDeptName(tProjectDept.getProjectName());
            }
        }else{
            TDept tDept = deptService.getById(sysUser.getDeptId());
            userIndexVO.setDeptName(tDept.getDeptName());
        }
        // 查询请假状态
        List<TLeave> list = leaveService.lambdaQuery().eq(TLeave::getLeavePerson, userId)
                .eq(TLeave::getAuditStatus, 2)
                .list();
        userIndexVO.setIsLeave(0);
        for (TLeave tLeave : list) {
            LocalDate now = LocalDate.now();
            LocalDate startDate = tLeave.getStartTime().toLocalDate();
            LocalDate endDate = tLeave.getStartTime().toLocalDate();
            if (now.isAfter(startDate) && now.isBefore(endDate)) {
                userIndexVO.setIsLeave(1);
            }else if (now.isEqual(startDate)|| now.isEqual(endDate)){
                userIndexVO.setIsLeave(1);
            }
        }
        // 获取本月第一天凌晨00:00:00 和本月最后一天23:59:59 类型为LocalDateTime
        // 获取当前日期
        LocalDate now = LocalDate.now();
        // 本月第一天
        LocalDate firstDayOfMonth = now.withDayOfMonth(1);
        // 本月最后一天
        LocalDate lastDayOfMonth = now.withDayOfMonth(now.lengthOfMonth());
        // 转换为 LocalDateTime:第一天的 00:00:00
        LocalDateTime startOfMonth = LocalDateTime.of(firstDayOfMonth, LocalTime.MIN);
        // 转换为 LocalDateTime:最后一天的 23:59:59
        LocalDateTime endOfMonth = LocalDateTime.of(lastDayOfMonth, LocalTime.MAX);
        List<TTask> finishTask = taskCleanerService.lambdaQuery().eq(TTask::getPatrolInspector, userId)
                .ge(TTask::getImplementTime, startOfMonth)
                .le(TTask::getImplementTime, endOfMonth).list();
        int size = (int) finishTask.stream().filter(e -> e.getStatus() == 5 || e.getStatus() == 6).count();
        userIndexVO.setFinishCount(size);
        BigDecimal divide = new BigDecimal(size).divide(new BigDecimal(finishTask.size()), 2, BigDecimal.ROUND_DOWN);
        userIndexVO.setRate(divide);
//        userIndexVO.setRanking();
        return R.ok(userIndexVO);
    }
    @ApiOperation(value = "任务记录分页列表")
    @PostMapping(value = "/taskList")
    public R<PageInfo<TaskUserListVO>> pageList(@RequestBody TaskUserListQuery query) {
@@ -329,6 +393,11 @@
        List<SysUser> sysUsers = sysUserService.selectAllList();
        SysUser auditPerson = sysUserService.selectUserById(999L);
        leaveDTO.setAuditStatus(1);
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        // 生成随机数字6位
        String format = simpleDateFormat.format(date);
        leaveDTO.setCode(format+ RandomUtil.randomNumbers(6));
        leaveService.save(leaveDTO);
        //项目负责人、部门负责人、公司成员提交由最终审批人审批;
        if (user.getDeptType()==2 ||sysRole.getRoleName().contains("项目负责人")||sysRole.getRoleName().contains("部门负责人")){
@@ -387,6 +456,14 @@
    public R<PageInfo<LeaveUserListVO>> leaveList(@RequestBody LeaveListUserQuery query) {
        query.setUserId(tokenService.getLoginUser().getUserId()+"");
        return R.ok( leaveService.leaveList(query));
    }
    @ApiOperation(value = "我的审批-审批")
    @PostMapping(value = "/auditLeave")
    public R<Boolean> auditLeave(@RequestBody LeaveAuditDTO dto) {
        dto.setAuditId(tokenService.getLoginUser().getUserId()+"");
        dto.setAuditTime(LocalDateTime.now());
        leaveService.updateById(dto);
        return R.ok();
    }
    @ApiOperation(value = "我的审批-详情")
    @GetMapping(value = "/leaveDetail")
@@ -466,7 +543,7 @@
        leaveUserDetailVO.setAuditTime(leave.getAuditTime());
        leaveUserDetailVO.setAuditRemark(leave.getAuditRemark());
        leaveUserDetailVO.setCode(leave.getCode());
        return R.ok( );
        return R.ok(leaveUserDetailVO);
    }
}
ruoyi-system/src/main/java/com/ruoyi/system/applet/dto/LeaveAuditDTO.java
New file
@@ -0,0 +1,12 @@
package com.ruoyi.system.applet.dto;
import com.ruoyi.system.model.TLeave;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value = "审批请假DTO")
public class LeaveAuditDTO extends TLeave {
}
ruoyi-system/src/main/java/com/ruoyi/system/applet/vo/UserIndexVO.java
New file
@@ -0,0 +1,31 @@
package com.ruoyi.system.applet.vo;
import com.ruoyi.system.model.TTask;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "个人中心-任务记录列表分页VO")
public class UserIndexVO  {
    @ApiModelProperty(value = "头像")
    private String avatar;
    @ApiModelProperty(value = "名称")
    private String nickName;
    @ApiModelProperty(value = "手机号")
    private String phonenumber;
    @ApiModelProperty(value = "部门名称")
    private String deptName;
    @ApiModelProperty(value = "是否请假 0否1是")
    private Integer isLeave;
    @ApiModelProperty(value = "已完成任务数")
    private Integer finishCount;
    @ApiModelProperty(value = "合格率")
    private BigDecimal rate;
    @ApiModelProperty(value = "月排名")
    private Integer ranking;
}
ruoyi-system/src/main/java/com/ruoyi/system/model/TKnowledge.java
@@ -36,6 +36,9 @@
    @ApiModelProperty(value = "标题")
    @TableField("title")
    private String title;
    @ApiModelProperty(value = "内容")
    @TableField("content")
    private String content;
    @ApiModelProperty(value = "浏览量")
    @TableField("views")
ruoyi-system/src/main/java/com/ruoyi/system/model/TLeave.java
@@ -64,7 +64,7 @@
    @TableField("audit_status")
    private Integer auditStatus;
    @ApiModelProperty(value = "审核人id")
    @ApiModelProperty(value = "归属审核人id")
    @TableField("audit_id")
    private String auditId;
ruoyi-system/src/main/java/com/ruoyi/system/vo/system/RoleInfoVO.java
@@ -10,6 +10,7 @@
    private Long roleId;
    private String roleName;
    private String remark;
    @ApiModelProperty("菜单id")
    private List<Long> menus;
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
@@ -99,7 +99,7 @@
        select a.role_id AS roleId, a.role_name AS roleName, a.role_key AS roleKey, a.role_sort AS roleSort, a.data_scope AS dataScope,
        a.menu_check_strictly AS menuCheckStrictly, a.dept_check_strictly AS deptCheckStrictly,a.status AS status, a.del_flag AS delFlag,
        a.create_time AS createTime,a.create_by AS createBy,a.postType AS postType,a.removeDays AS removeDays,
        r.role_type as roleType
        a.role_type as roleType,a.remark
        IFNULL(b.userCount,0) as userCount
        from sys_role a
        LEFT JOIN
ruoyi-system/src/main/resources/mapper/system/TCleanerMapper.xml
@@ -32,7 +32,7 @@
                 and t1.projectId = #{query.projectId}
            </if>
        </where>
        and  t1.disabled = = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        and  t1.disabled  = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        order by t1.create_time desc
    </select>
ruoyi-system/src/main/resources/mapper/system/TDeptMapper.xml
@@ -6,7 +6,7 @@
    <select id="pageList" resultType="com.ruoyi.system.vo.system.DeptListVO">
select t1.*,count(t2.user_id) as userCount from
    t_dept t1
left join sys_user t2 on t2.deptId = t1.id
left join sys_user t2 on t2.deptId = t1.id and   t2.deptType =2
where 1=1
<if test="query.deptName != null and query.deptName != ''">
    and t1.dept_name like concat('%',#{query.deptName},'%')
@@ -14,8 +14,8 @@
<if test="query.status != null">
    and t1.status = #{query.status}
</if>
        and t2.deptType =2
and t1.`disabled` = = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
group by t1.id
order by t1.create_time desc
    </select>
ruoyi-system/src/main/resources/mapper/system/TLeaveMapper.xml
@@ -33,7 +33,7 @@
        from t_leave t1
                 left join sys_user t2 on t1.leave_person = t2.id
        where
            t1.disabled = = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
            t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        <if test="query.nickName != null and query.nickName != ''">
            and t2.nick_name like concat('%', #{query.nickName}, '%')
        </if>
@@ -58,7 +58,7 @@
        select t1.*,t1.create_time as createTime1
        from t_leave t1
        where
        t1.disabled = = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        t1.disabled =  ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        <if test="query.type == 1">
            and t1.audit_id = #{query.userId}
ruoyi-system/src/main/resources/mapper/system/TLocationMapper.xml
@@ -45,7 +45,7 @@
        <if test="query.locationCleaner != null and query.locationCleaner != ''">
            and t1.location_cleaner = #{query.locationCleaner}
        </if>
        and t1.disabled = = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        and t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
    </select>
ruoyi-system/src/main/resources/mapper/system/TProjectDeptMapper.xml
@@ -22,16 +22,16 @@
    <select id="pageList" resultType="com.ruoyi.system.vo.system.ProjectDeptListVO">
        select t1.*,count(t2.user_id) as userCount from
        t_project_dept t1
        left join sys_user t2 on t2.deptId = t1.id
        left join sys_user t2 on t2.deptId = t1.id and t2.deptType =1
        where 1=1
        <if test="query.projectName != null and query.projectName != ''">
            and t1.project_name like concat('%',#{query.projectName},'%')
        <if test="query.deptName != null and query.deptName != ''">
            and t1.project_name like concat('%',#{query.deptName},'%')
        </if>
        <if test="query.status != null and query.status != ''">
            and t1.status = #{query.status}
        </if>
        and t1.`disabled` = = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        and t2.deptType =1
        and t1.`disabled`  = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        group by t1.id
        order by t1.create_time desc
    </select>