|
|
|
@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
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.common.mybatis.helper.DataPermissionHelper; |
|
|
|
import org.dromara.system.domain.vo.SysUserVo; |
|
|
|
import org.dromara.system.service.ISysUserService; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
@ -37,29 +38,54 @@ public class AppEnfEnterpriseLawEnforcementController { |
|
|
|
/** |
|
|
|
* 执法端-执法预告列表 |
|
|
|
*/ |
|
|
|
@SaIgnore |
|
|
|
@PostMapping("/queryList") |
|
|
|
@ResponseBody |
|
|
|
public TableDataInfo<EnterpriseLawEnforcementVo> queryList(@RequestBody EnterpriseLawEnforcementBo bo, PageQuery pageQuery) { |
|
|
|
TableDataInfo<EnterpriseLawEnforcementVo> rspData = enterpriseLawEnforcementService.selectEnterpriseLawEnforcementVoPageByBo(bo, pageQuery); |
|
|
|
// 使用 DataPermissionHelper.ignore() 跳过数据权限检查,避免未登录时获取 LoginUser 报错
|
|
|
|
TableDataInfo<EnterpriseLawEnforcementVo> rspData = DataPermissionHelper.ignore(() -> |
|
|
|
enterpriseLawEnforcementService.selectEnterpriseLawEnforcementVoPageByBo(bo, pageQuery) |
|
|
|
); |
|
|
|
|
|
|
|
List<EnterpriseLawEnforcementVo> list = rspData.getRows(); |
|
|
|
if (list == null || list.isEmpty()) { |
|
|
|
return rspData; |
|
|
|
} |
|
|
|
|
|
|
|
for (EnterpriseLawEnforcementVo vo : list) { |
|
|
|
List<SysUserVo> userBeans = new ArrayList<>(); |
|
|
|
if (StringUtils.isNotEmpty(vo.getLawEnforcerTwoId())) { |
|
|
|
Long[] userIds = Convert.toLongArray(vo.getLawEnforcerTwoId()); |
|
|
|
List<Long> userIdList = java.util.Arrays.asList(userIds); |
|
|
|
userBeans = sysUserService.selectUserByIds(userIdList, null); |
|
|
|
try { |
|
|
|
String[] userIdStrs = Convert.toStrArray(vo.getLawEnforcerTwoId()); |
|
|
|
List<Long> userIdList = new ArrayList<>(); |
|
|
|
for (String id : userIdStrs) { |
|
|
|
try { |
|
|
|
userIdList.add(Long.parseLong(id.trim())); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
log.warn("无效的用户ID格式: {}", id); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!userIdList.isEmpty()) { |
|
|
|
userBeans = sysUserService.selectUserByIds(userIdList, null); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("解析执法人员ID失败: {}", vo.getLawEnforcerTwoId(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
String tmpUserShow = ""; |
|
|
|
for (SysUserVo ub : userBeans) { |
|
|
|
String temp = ub.getLawCertificateNum(); |
|
|
|
if(StringUtils.isEmpty(temp)) { |
|
|
|
temp = CommonUtil.encryptPhone(ub.getPhonenumber()); |
|
|
|
if (userBeans != null && !userBeans.isEmpty()) { |
|
|
|
for (SysUserVo ub : userBeans) { |
|
|
|
if (ub != null) { |
|
|
|
String temp = ub.getLawCertificateNum(); |
|
|
|
if(StringUtils.isEmpty(temp)) { |
|
|
|
temp = CommonUtil.encryptPhone(ub.getPhonenumber()); |
|
|
|
} |
|
|
|
tmpUserShow += ub.getUserName() +" "+ temp + ","; |
|
|
|
} |
|
|
|
} |
|
|
|
if (tmpUserShow.length() > 0) { |
|
|
|
tmpUserShow = tmpUserShow.substring(0, tmpUserShow.length()-1); |
|
|
|
} |
|
|
|
tmpUserShow += ub.getUserName() +" "+ temp + ","; |
|
|
|
} |
|
|
|
if (tmpUserShow.length() > 0) { |
|
|
|
tmpUserShow = tmpUserShow.substring(0, tmpUserShow.length()-1); |
|
|
|
} |
|
|
|
vo.setLawEnforcer2Show(tmpUserShow); |
|
|
|
|
|
|
|
|