|
|
|
@ -1,17 +1,24 @@ |
|
|
|
package com.zdxt.enforcementcode.controller; |
|
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
import com.zdxt.enforcementcode.common.util.CommonUtil; |
|
|
|
import com.zdxt.enforcementcode.common.util.IdCardCryptoUtil; |
|
|
|
import com.zdxt.enforcementcode.domain.vo.UnitUserVo; |
|
|
|
import com.zdxt.enforcementcode.service.IEfcodeVirtualUnitService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.dromara.common.core.utils.StringUtils; |
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery; |
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
|
import org.dromara.system.domain.bo.QuerySysUserBo; |
|
|
|
import org.dromara.system.domain.bo.SysUserBo; |
|
|
|
import org.dromara.system.domain.vo.SysUserVo; |
|
|
|
import org.dromara.system.service.ISysUserService; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Validated |
|
|
|
@RequiredArgsConstructor |
|
|
|
@ -19,7 +26,9 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
@RequestMapping("/enforcementcode/bureauUnit") |
|
|
|
public class BureauUnitController { |
|
|
|
private final IEfcodeVirtualUnitService efcodeVirtualUnitService; |
|
|
|
|
|
|
|
private final ISysUserService userService; |
|
|
|
// 手机号解密key
|
|
|
|
private static String KEY="VRJHzFqJpsSZhwnsKTWNspv_GZMxTWl-bgH6DyE9Ty0"; |
|
|
|
@GetMapping("/users") |
|
|
|
public TableDataInfo<UnitUserVo> queryUsers( |
|
|
|
@RequestParam(required = false) String sysDeptId, |
|
|
|
@ -33,4 +42,41 @@ public class BureauUnitController { |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查询用户列表 |
|
|
|
*/ |
|
|
|
@PostMapping("/queryUsersByPage") |
|
|
|
public TableDataInfo<SysUserVo> queryUsersByPage(@RequestBody SysUserBo user, PageQuery pageQuery) { |
|
|
|
if (null != user.getNotUserId()) { |
|
|
|
Map<String, Object> params = user.getParams(); |
|
|
|
params.put("notUserIds", Convert.toStrArray(user.getNotUserId())); |
|
|
|
} |
|
|
|
if (null != user.getIsShowCardId()) { |
|
|
|
Map<String, Object> params = user.getParams(); |
|
|
|
params.put("showCardId", user.getIsShowCardId()); |
|
|
|
} |
|
|
|
user.setDataScopeId(null); |
|
|
|
// 分页查询:service 内部已通过 PageQuery.build() 构建 MyBatis-Plus Page 并返回 TableDataInfo
|
|
|
|
TableDataInfo<SysUserVo> result = userService.queryUsersByPage(user, pageQuery); |
|
|
|
// 对手机号进行按需解密后返回明文,便于前端直接展示与使用
|
|
|
|
List<SysUserVo> rows = result.getRows(); |
|
|
|
if (rows != null && !rows.isEmpty()) { |
|
|
|
rows.forEach(li -> { |
|
|
|
if (StringUtils.isEmpty(li.getPhonenumber())) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (li.getPhonenumber().matches("^\\d+$")) { |
|
|
|
li.setDecryptPhoneNum(li.getPhonenumber()); |
|
|
|
} else { |
|
|
|
li.setDecryptPhoneNum(IdCardCryptoUtil.symmetricDecryptIdCard(KEY, li.getPhonenumber())); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|