From 135090721ee50abef2577e61617d3f2b2e15bb4a Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期五, 09 五月 2025 18:19:07 +0800 Subject: [PATCH] Merge remote-tracking branch '喜望/dev-2.0.1' into dev-2.0.1 --- springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java | 4 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java | 38 ++++++++++++ springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java | 4 + springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml | 11 +-- springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/SystemUserMapper.xml | 54 +++++++++++------ springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java | 3 + springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java | 5 + springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserServiceImpl.java | 16 +++-- 8 files changed, 100 insertions(+), 35 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java index cd91124..7900a51 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/DepartmentController.java @@ -45,8 +45,8 @@ @GetMapping("/list") - @ApiOperation(value = "获取单位列表1", tags = {"三个身边后台-用户管理"}) - @OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取单位列表1") + @ApiOperation(value = "获取单位列表2.0.1", tags = {"三个身边后台-用户管理"}) + @OperLog(operModul = "三个身边后台",operType = 0, businessType = "获取单位列表2.0.1") public R<List<RegionVO>> list(String name){ // 社区 List<ComAct> list2 = comActService.list(new LambdaQueryWrapper<ComAct>().eq(ComAct::getCityCode,510400).like(StringUtils.isNotEmpty(name), ComAct::getName, name)); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java index b50f429..cbc75ff 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java @@ -1,6 +1,7 @@ package com.panzhihua.sangeshenbian.api; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.interfaces.OperLog; @@ -67,6 +68,9 @@ @Resource private ISystemLogService systemLogService; + + @Resource + private ISystemUserLevelService systemUserLevelService; @@ -209,6 +213,16 @@ public R add(@RequestBody SystemUser systemUser){ Integer id = this.getLoginUserInfoSanGeShenBian().getId(); SystemUser user = systemUserService.getById(id); + List<SystemUserLevel> systemUserLevels = systemUser.getSystemUserLevels(); + if(systemUserLevels==null || systemUserLevels.isEmpty()){ + return R.fail("请选择账号层级"); + } + // 获取最高层级的用于原来的判断 + systemUserLevels.sort(Comparator.comparing(SystemUserLevel::getLevel)); + Integer level = systemUserLevels.get(0).getLevel(); + user.setAccountLevel(level); + + if(2 == user.getAccountLevel() && 1 == systemUser.getAccountLevel()){ return R.fail("不能添加市级账号"); } @@ -245,6 +259,13 @@ // 2.0.1 默认管理员 systemUser.setIsAdmin(1); systemUserService.save(systemUser); + + // 2.0.1添加账号层级 + systemUserLevels.forEach(e->{ + e.setSystemUserId(systemUser.getId()); + e.setStatus(1); + }); + systemUserLevelService.saveBatch(systemUserLevels); return R.ok(); } @@ -253,6 +274,10 @@ @ApiOperation(value = "编辑人员", tags = {"三个身边后台-人员管理"}) @SysLog(operatorCategory = "编辑账号",operId = 4) public R edit(@RequestBody SystemUser systemUser){ + List<SystemUserLevel> systemUserLevels = systemUser.getSystemUserLevels(); + if(systemUserLevels==null || systemUserLevels.isEmpty()){ + return R.fail("请选择账号层级"); + } long count = systemUserService.count(new LambdaQueryWrapper<SystemUser>().eq(SystemUser::getPhone, systemUser.getPhone()) .ne(SystemUser::getStatus, 3).ne(SystemUser::getId, systemUser.getId())); if(0 < count){ @@ -280,6 +305,15 @@ systemUser.setStatus(1); systemUser.setCreateTime(LocalDateTime.now()); systemUserService.updateById(systemUser); + // 移除原来层级 在添加新层级 + systemUserLevelService.remove(new LambdaQueryWrapper<SystemUserLevel>().eq(SystemUserLevel::getSystemUserId, systemUser.getId())); + systemUserLevels.forEach(e->{ + e.setSystemUserId(systemUser.getId()); + e.setStatus(1); + }); + systemUserLevelService.saveBatch(systemUserLevels); + + return R.ok(); } @@ -291,6 +325,7 @@ SystemUser systemUser = systemUserService.getById(id); systemUser.setStatus(3); systemUserService.updateById(systemUser); + systemUserLevelService.update(new LambdaUpdateWrapper<SystemUserLevel>().eq(SystemUserLevel::getSystemUserId, id).set(SystemUserLevel::getStatus,3)); return R.ok(systemUser.getName()); } @@ -300,6 +335,9 @@ @OperLog(operModul = "三个身边后台",operType = 0,businessType = "查询人员详情") public R<SystemUser> getSystemUserInfo(@PathVariable("id") Integer id){ SystemUser systemUser = systemUserService.getById(id); + List<SystemUserLevel> listBySystemUserId = systemUserLevelService.getListBySystemUserId(id); + listBySystemUserId.sort(Comparator.comparing(SystemUserLevel::getLevel)); + systemUser.setSystemUserLevels(listBySystemUserId); return R.ok(systemUser); } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java index 9bc87b4..c8b9afa 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/model/entity/SystemUser.java @@ -11,6 +11,7 @@ import lombok.Data; import java.time.LocalDateTime; +import java.util.List; /** * 系统用户 @@ -141,6 +142,10 @@ @TableField("create_time") private LocalDateTime createTime; + @TableField(exist = false) + @ApiModelProperty(value = "账号层级 2.0.1新增") + private List<SystemUserLevel> systemUserLevels; + diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java index 198f638..ba3b5b9 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java @@ -1562,6 +1562,9 @@ Date parse1 = simpleDateFormat.parse(split[1] + " 23:59:59"); complaints = complaints.stream().filter(e -> e.getCreateTime().getTime() <= parse1.getTime() && e.getCreateTime().getTime() >= parse.getTime()).collect(Collectors.toList()); int day = DateUtils.getDay(parse, parse1); + if(day>30){ + throw new ServiceException("时间范围不能超过30天"); + } for (int i = 0; i <= day; i++) { AnalyticStatisticsTwoVo analyticStatisticsTwoVo = new AnalyticStatisticsTwoVo(); diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserServiceImpl.java index 48ee471..9fb7274 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/SystemUserServiceImpl.java @@ -5,20 +5,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.beust.jcommander.internal.Lists; -import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.common.utlis.StringUtils; +import com.panzhihua.sangeshenbian.dao.SystemUserLevelMapper; import com.panzhihua.sangeshenbian.dao.SystemUserMapper; import com.panzhihua.sangeshenbian.model.entity.ComAct; -import com.panzhihua.sangeshenbian.model.entity.PartyMember; import com.panzhihua.sangeshenbian.model.entity.SystemUser; +import com.panzhihua.sangeshenbian.model.entity.SystemUserLevel; import com.panzhihua.sangeshenbian.model.vo.RegionVO; -import com.panzhihua.sangeshenbian.service.IBcRegionService; import com.panzhihua.sangeshenbian.service.IComActService; -import com.panzhihua.sangeshenbian.service.IComStreetService; import com.panzhihua.sangeshenbian.service.ISystemUserService; -import com.panzhihua.sangeshenbian.warpper.IdentityInformationVO; -import com.panzhihua.sangeshenbian.warpper.PermissionsVO; import com.panzhihua.sangeshenbian.warpper.SystemUserList; import com.panzhihua.sangeshenbian.warpper.SystemUserListVo; import lombok.RequiredArgsConstructor; @@ -26,9 +22,9 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; /** * @author zhibing.pu @@ -38,6 +34,7 @@ @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUser> implements ISystemUserService { private final IComActService comActService; + private final SystemUserLevelMapper systemUserLevelMapper; /** * 获取列表数据 * @param query @@ -49,6 +46,11 @@ page.setCurrent(query.getPageNum()); page.setSize(query.getPageSize()); IPage<SystemUserListVo> list = this.baseMapper.list(page, user, query); + list.getRecords().forEach(item -> { + List<SystemUserLevel> systemUserLevels = systemUserLevelMapper.selectList(new LambdaQueryWrapper<SystemUserLevel>().eq(SystemUserLevel::getStatus,1).eq(SystemUserLevel::getSystemUserId, item.getId())); + systemUserLevels.sort(Comparator.comparing(SystemUserLevel::getLevel)); + item.setList(systemUserLevels); + }); return list; } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java index 1fae5eb..19756da 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/SystemUserList.java @@ -19,7 +19,7 @@ private Integer departmentId; @ApiModelProperty(value = "所属角色") private Integer systemRoleId; - @ApiModelProperty(value = "账号层级(1=市级账号,2=区县账号,3=街道账号,4=社区账号)") + @ApiModelProperty(value = "账号层级(1=市级账号,2=区县账号,3=街道账号,4=社区账号) 优先账号所属层级-》选择的组织结构tier ") private Integer accountLevel; @ApiModelProperty(value = "页码", required = true) private Integer pageNum; @@ -27,4 +27,6 @@ private Integer pageSize; @ApiModelProperty(value = "1当前组织架构 2当前及下级", required = true) private Integer type; + @ApiModelProperty(value = "组织架构编码 2传当前指定的区县regionCode 3传街道streetId 4传communityId") + private String code; } diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml index 5021ff2..bfa6ded 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/ComplaintRejectMapper.xml @@ -10,11 +10,10 @@ <select id="getComplaintRejectList" resultType="com.panzhihua.sangeshenbian.model.vo.ComplaintRejectVo"> - select t1.remark,t1.create_time examineTime,t2.id complaintId,t2.serial_number serialNumber,t2.report_user_name reportUserName,t2.status, + select t3.reject_reason remark,t3.audit_time examineTime,t2.id complaintId,t2.serial_number serialNumber,t2.report_user_name reportUserName,t2.status, t2.report_user_phone reportUserPhone,t3.auditor_name examineUserName,t3.create_time applyTime,t3.apply_name applyUserName - from sgsb_complaint_reject t1 - left join sgsb_complaint t2 on t1.complaint_id = t2.id - left join sgsb_complaint_audit_record t3 on t1.complaint_audit_id = t3.id + from sgsb_complaint_audit_record t3 + left join sgsb_complaint t2 on t3.complaint_id = t2.id <where> <if test="query.serialNumber != null and query.serialNumber != ''"> and t2.serial_number = #{query.serialNumber} @@ -35,10 +34,10 @@ and t3.create_time between #{applyStartTime} and #{applyEndTime} </if> <if test="examineStartTime !=null"> - and t1.create_time between #{applyStartTime} and #{applyEndTime} + and t3.audit_time between #{examineStartTime} and #{examineEndTime} </if> </where> - order by t1.create_time desc + order by t3.create_time desc </select> </mapper> diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/SystemUserMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/SystemUserMapper.xml index d9b69f0..f8f5a4b 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/SystemUserMapper.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/resources/mapper/SystemUserMapper.xml @@ -6,22 +6,17 @@ <select id="list" resultType="com.panzhihua.sangeshenbian.warpper.SystemUserListVo"> - select + select distinct a.id, a.name, a.phone, - IF(a.four_department_id is not null, e.`name`, IF(a.three_department_id is not null, d.`name`, IF(a.two_department_id is not null, c.`name`, b.`name`))) as departmentName, f.`name` as systemPostName, g.`name` as systemRoleName, - a.account_level as accountLevel, a.`status` from sgsb_system_user a - left join sgsb_department b on (a.one_department_id = b.id) - left join sgsb_department c on (a.two_department_id = c.id) - left join sgsb_department d on (a.three_department_id = d.id) - left join sgsb_department e on (a.four_department_id = e.id) left join sgsb_system_post f on (a.system_post_id = f.id) left join sgsb_system_role g on (a.system_role_id = g.id) + left join sgsb_system_user_level h on (a.id = h.system_user_id) where a.`status` != 3 <if test="null != query.name and '' != query.name"> and a.name like CONCAT('%', #{query.name}, '%') @@ -29,26 +24,47 @@ <if test="null != query.phone and '' != query.phone"> and a.phone like CONCAT('%', #{query.phone}, '%') </if> - <if test="null != query.departmentId"> - and (a.one_department_id = #{query.departmentId} or a.two_department_id = #{query.departmentId} or a.three_department_id = #{query.departmentId} or a.four_department_id = #{query.departmentId}) - </if> <if test="null != query.systemRoleId"> and a.system_role_id = #{query.systemRoleId} </if> - <if test="null != user.accountLevel and 2 == user.accountLevel"> - and a.account_level >= #{user.accountLevel} and a.districts_code = #{user.districtsCode} + <if test="null != query.accountLevel and 2 == query.accountLevel and query.type==2 and query.code != null and query.code !='' "> + and h.level >= #{query.accountLevel} and h.districts_code = #{query.code} </if> - <if test="null != user.accountLevel and 3 == user.accountLevel"> - and a.account_level >= #{user.accountLevel} and a.street_id = #{user.streetId} + <if test="null != query.accountLevel and 2 == query.accountLevel and query.type==2 and query.code == null"> + and h.level >= #{query.accountLevel} </if> - <if test="null != user.accountLevel and 4 == user.accountLevel"> - and a.account_level >= #{user.accountLevel} and a.community_id = #{user.communityId} + <if test="null != query.accountLevel and 2 == query.accountLevel and query.type==1 and query.code != null and query.code !=''"> + and h.level = #{query.accountLevel} and h.districts_code = #{query.code} + </if> + <if test="null != query.accountLevel and 2 == query.accountLevel and query.type==1 and query.code == null "> + and h.level = #{query.accountLevel} + </if> + <if test="null != query.accountLevel and 3 == query.accountLevel and query.type==2 and query.code != null and query.code !=''"> + and h.level >= #{query.accountLevel} and h.street_id = #{query.code} + </if> + <if test="null != query.accountLevel and 3 == query.accountLevel and query.type==2 and query.code == null"> + and h.level >= #{query.accountLevel} + </if> + <if test="null != query.accountLevel and 3 == query.accountLevel and query.type==1 and query.code != null and query.code !=''"> + and h.level = #{query.accountLevel} and h.street_id = #{query.code} + </if> + <if test="null != query.accountLevel and 3 == query.accountLevel and query.type==1 and query.code == null"> + and h.level = #{query.accountLevel} + </if> + <if test="null != query.accountLevel and 4 == query.accountLevel and query.type==2 and query.code != null and query.code !=''"> + and h.level >= #{query.accountLevel} and h.community_id = #{query.code} + </if> + <if test="null != query.accountLevel and 4 == query.accountLevel and query.type==2 and query.code == null"> + and h.level >= #{query.accountLevel} + </if> + <if test="null != query.accountLevel and 4 == query.accountLevel and query.type==1 and query.code != null and query.code !=''"> + and h.level = #{query.accountLevel} and h.community_id = #{query.code} + </if> + <if test="null != query.accountLevel and 4 == query.accountLevel and query.type==1 and query.code == null"> + and h.level = #{query.accountLevel} </if> <if test="null != user.accountLevel and 5 == user.accountLevel"> and a.id = 0 - </if> - <if test="null != query.accountLevel"> - and a.account_level = #{query.accountLevel} </if> order by a.create_time desc </select> -- Gitblit v1.7.1