亳州对接警综机构
parent
3c85d5950d
commit
4022dfa7b0
|
|
@ -59,7 +59,7 @@ public class SysDeptController extends BaseController {
|
|||
*/
|
||||
@SaCheckPermission("system:dept:list")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
|
||||
public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId", required = false) String deptId) {
|
||||
List<SysDeptVo> depts = deptService.selectDeptList(new SysDeptBo());
|
||||
depts.removeIf(d -> d.getDeptId().equals(deptId)
|
||||
|| StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId)));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class DeptTreeSelectVo implements Serializable {
|
|||
/**
|
||||
* 选中部门列表
|
||||
*/
|
||||
private List<Long> checkedKeys;
|
||||
private List<String> checkedKeys;
|
||||
|
||||
/**
|
||||
* 下拉树结构列表
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import org.dromara.system.mapper.SysRoleDeptMapper;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据权限 实现
|
||||
|
|
@ -63,6 +64,22 @@ public class RemoteDataScopeServiceImpl implements RemoteDataScopeService {
|
|||
@Override
|
||||
public String getDeptAndChild(String deptId) {
|
||||
if (ObjectUtil.isNull(deptId)) {
|
||||
return "'-1'";
|
||||
}
|
||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptId)
|
||||
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
|
||||
List<String> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
||||
ids.add(deptId);
|
||||
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
// 每个 ID 都加上单引号,并用逗号连接
|
||||
return ids.stream()
|
||||
.map(id -> "'" + id.replace("'", "''") + "'") // 转义单引号
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
return "'-1'";
|
||||
/*if (ObjectUtil.isNull(deptId)) {
|
||||
return "-1";
|
||||
}
|
||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
|
|
@ -73,7 +90,7 @@ public class RemoteDataScopeServiceImpl implements RemoteDataScopeService {
|
|||
if (CollUtil.isNotEmpty(ids)) {
|
||||
return StreamUtils.join(ids, Convert::toStr);
|
||||
}
|
||||
return "-1";
|
||||
return "-1";*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ public class TDeviceImportListener extends AnalysisEventListener<TDeviceImportVo
|
|||
Long id = deviceVo.getId();
|
||||
SysDeptVo deptVo = deptService.selectDeptById(deviceVo.getZzjgdm());
|
||||
if(null != deptVo){
|
||||
deviceVo.setZzjgmc(deptVo.getShortName());
|
||||
deviceImportVo.setZzjgmc(deptVo.getShortName());
|
||||
}
|
||||
TDeviceBo deviceBo = BeanUtil.toBean(deviceVo, TDeviceBo.class);
|
||||
TDeviceBo deviceBo = BeanUtil.toBean(deviceImportVo, TDeviceBo.class);
|
||||
deviceBo.setId(id);
|
||||
ValidatorUtils.validate(deviceBo);
|
||||
deviceService.updateByBo(deviceBo);
|
||||
|
|
|
|||
|
|
@ -41,10 +41,12 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
|||
* @param deptCheckStrictly 部门树选择项是否关联显示
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||
List<String> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||
|
||||
List<SysDeptVo> deviceStatics(@Param("deviceType") String deviceType);
|
||||
|
||||
List<SysDeptVo> deviceStaticsByDeptId(@Param("deviceType")String deviceType, @Param("deptId")String deptId);
|
||||
|
||||
List<SysDept> jzDept(String updateTime);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
package org.dromara.system.schedule;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.system.domain.SysDept;
|
||||
import org.dromara.system.service.ISysDeptService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
public class JzDeptSchedule {
|
||||
|
||||
private final ISysDeptService deptService;
|
||||
|
||||
|
||||
|
||||
// @Scheduled(cron = "0 0 0/1 * * ?")
|
||||
//http://53.1.230.5:8159/api/UUDB/org/list
|
||||
/* "data": [
|
||||
{
|
||||
"id": "24211111111111",
|
||||
"pid": "341699000000",
|
||||
"orgName": "亳州市高新区分局禁毒大队",
|
||||
"shortName": "亳州市高新区分局禁毒大队",
|
||||
"path": "/340000000000/341600000000/341699000000/24211111111111/",
|
||||
"status": "0",
|
||||
"modiTime": "2025-08-18 15:05:44",
|
||||
"createTime": "2025-06-14 10:35:17",
|
||||
"type": "REAL",
|
||||
"orderIdInt": 1
|
||||
}}*/
|
||||
public void jzDept(){
|
||||
JSONObject para = new JSONObject();
|
||||
para.put("orgId","34160000000");
|
||||
para.put("page","1");
|
||||
para.put("limit","2000");
|
||||
String result = HttpUtil.post("http://53.1.230.5:8159/api/UUDB/org/list", para.toString());
|
||||
List<SysDept> sysList = new ArrayList<>();
|
||||
JSONObject robj = JSON.parseObject(result);
|
||||
JSONArray dataArr = robj.getJSONArray("data");
|
||||
for (Object o : dataArr) {
|
||||
JSONObject data = JSONObject.parseObject(o.toString());
|
||||
String status = data.getString("status");
|
||||
if ("0".equals(status)){
|
||||
continue;
|
||||
}
|
||||
String modiTime = data.getString("modiTime");
|
||||
if (DateUtil.between(new Date(),DateUtil.parseDateTime(modiTime), DateUnit.HOUR) > 1){
|
||||
continue;
|
||||
}
|
||||
String createTime = data.getString("createTime");
|
||||
Integer orderNum = data.getInteger("orderIdInt");
|
||||
String id = data.getString("id");
|
||||
String pid = data.getString("pid");
|
||||
String orgName = data.getString("orgName");
|
||||
String shortName = data.getString("shortName");
|
||||
String path = data.getString("path").replaceAll("^/+|/+$", "").replace("/", ",");;
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDeptId(id);
|
||||
dept.setParentId(pid);
|
||||
dept.setDeptName(orgName);
|
||||
dept.setShortName(shortName);
|
||||
dept.setStatus("1");
|
||||
dept.setDelFlag("0");
|
||||
dept.setUpdateTime(DateUtil.parseDateTime(modiTime));
|
||||
dept.setOrderNum(orderNum);
|
||||
dept.setCreateTime(DateUtil.parseDateTime(createTime));
|
||||
dept.setAncestors(path);
|
||||
sysList.add(dept);
|
||||
}
|
||||
|
||||
deptService.insertORUpdate(sysList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package org.dromara.system.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import org.dromara.system.domain.SysDept;
|
||||
import org.dromara.system.domain.bo.SysDeptBo;
|
||||
import org.dromara.system.domain.vo.SysDeptVo;
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ public interface ISysDeptService {
|
|||
* @param roleId 角色ID
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
List<Long> selectDeptListByRoleId(Long roleId);
|
||||
List<String> selectDeptListByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
|
|
@ -138,4 +139,8 @@ public interface ISysDeptService {
|
|||
List<SysDeptVo> getDsList();
|
||||
|
||||
List<SysDeptVo> deviceStatics(String deviceType,String manageDeptId);
|
||||
|
||||
List<SysDept> jzDpet(String updateTime);
|
||||
|
||||
boolean insertORUpdate(List<SysDept> list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.ibatis.executor.BatchResult;
|
||||
import org.dromara.common.core.constant.CacheNames;
|
||||
import org.dromara.common.core.constant.UserConstants;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
|
|
@ -77,6 +79,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
|
||||
private LambdaQueryWrapper<SysDept> buildQueryWrapper(SysDeptBo bo) {
|
||||
LambdaQueryWrapper<SysDept> lqw = Wrappers.lambdaQuery();
|
||||
lqw.isNotNull(SysDept::getAncestors);
|
||||
lqw.eq(SysDept::getDelFlag, UserConstants.DEL_FLAG_NORMAL);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeptId()), SysDept::getDeptId, bo.getDeptId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getParentId()), SysDept::getParentId, bo.getParentId());
|
||||
|
|
@ -84,9 +87,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFullName()), SysDept::getFullName, bo.getFullName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getIsVisible()),SysDept::getIsVisible,bo.getIsVisible());
|
||||
lqw.orderByAsc(SysDept::getAncestors);
|
||||
lqw.orderByAsc(SysDept::getParentId);
|
||||
lqw.orderByAsc(SysDept::getOrderNum);
|
||||
lqw.orderByAsc(SysDept::getDeptId);
|
||||
return lqw;
|
||||
}
|
||||
|
|
@ -116,7 +117,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
* @return 选中部门列表
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectDeptListByRoleId(Long roleId) {
|
||||
public List<String> selectDeptListByRoleId(Long roleId) {
|
||||
SysRole role = roleMapper.selectById(roleId);
|
||||
return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly());
|
||||
}
|
||||
|
|
@ -304,7 +305,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
*/
|
||||
private void updateParentDeptStatusNormal(SysDept dept) {
|
||||
String ancestors = dept.getAncestors();
|
||||
Long[] deptIds = Convert.toLongArray(ancestors);
|
||||
String [] deptIds = Convert.toStrArray(ancestors);
|
||||
baseMapper.update(null, new LambdaUpdateWrapper<SysDept>()
|
||||
.set(SysDept::getStatus, UserConstants.DEPT_NORMAL)
|
||||
.in(SysDept::getDeptId, Arrays.asList(deptIds)));
|
||||
|
|
@ -386,4 +387,17 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
}
|
||||
return -1; // 如果没有找到不为0的字符,返回-1
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("slave")
|
||||
public List<SysDept> jzDpet(String updateTime) {
|
||||
return baseMapper.jzDept(updateTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertORUpdate(List<SysDept> list) {
|
||||
List<BatchResult> batchResults = baseMapper.insertOrUpdate(list);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
select count(*) from sys_dept where del_flag = '0' and dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<select id="selectDeptListByRoleId" resultType="Long">
|
||||
<select id="selectDeptListByRoleId" resultType="String">
|
||||
select d.dept_id
|
||||
from sys_dept d
|
||||
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||
|
|
@ -229,4 +229,12 @@
|
|||
|
||||
</select>
|
||||
|
||||
<select id="jzDept" resultMap="SysDeptResult">
|
||||
select dept_id,parent_id,ancestors,dept_name,order_num,status from sys_dept
|
||||
where ancestors like '%341600000000%'
|
||||
<if test="updateTime != null and '' != updateTime ">
|
||||
and update_time >= #{updateTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ db.num=1
|
|||
#db.url.0=jdbc:mysql://127.0.0.1:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||
db.url.0=jdbc:mysql://10.129.221.10:3306/wzhj-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||
db.user.0=root
|
||||
#db.password.0=root
|
||||
db.password.0=Ycgis@2509
|
||||
|
||||
### the maximum retry times for push
|
||||
|
|
|
|||
Loading…
Reference in New Issue