亳州位置汇聚

ds-bozhou
luyya 2026-02-27 09:16:42 +08:00
parent 623c35da0a
commit d667538721
4 changed files with 55 additions and 3 deletions

View File

@ -49,4 +49,9 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
List<SysDeptVo> jzDept(String updateTime);
int insertDept(SysDept dept);
int updateDept(SysDept dept);
}

View File

@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.service.ISysDeptService;
@ -21,6 +22,7 @@ import java.util.List;
@RequiredArgsConstructor
@RestController
@Slf4j
public class JzDeptSchedule {
private final ISysDeptService deptService;
@ -108,6 +110,7 @@ public class JzDeptSchedule {
public void jzDeptNew(){
Date time = DateUtil.offsetHour(new Date(),-1);
List<SysDeptVo> list = deptService.jzDpet(DateUtil.formatDateTime(time));
log.error("要同步警综的机构:"+list.toString());
List<SysDeptVo> sysList = new ArrayList<>();
for (SysDeptVo dept : list) {
if ("1".equals(dept.getStatus())){
@ -115,7 +118,6 @@ public class JzDeptSchedule {
}else {
dept.setStatus("1");
}
dept.setShortName(dept.getDeptName());
sysList.add(dept);
}
deptService.insertORUpdate(BeanUtil.copyToList(sysList, SysDept.class));

View File

@ -402,7 +402,16 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override
public boolean insertORUpdate(List<SysDept> list) {
List<BatchResult> batchResults = baseMapper.insertOrUpdate(list);
for (SysDept dept : list) {
SysDept d = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>().eq(SysDept::getDeptId,dept.getDeptId()).last("limit 1"));
if(null != d){
dept.setDeptId(d.getDeptId());
baseMapper.updateDept(dept);
}else {
baseMapper.insertDept(dept);
}
}
// List<BatchResult> batchResults = baseMapper.insertOrUpdate(list);
return true;
}

View File

@ -230,11 +230,47 @@
</select>
<select id="jzDept" resultMap="SysDeptResult">
select dept_id,parent_id,ancestors,dept_name,order_num,status from sys_dept
select dept_id,parent_id,ancestors,dept_name,short_name,order_num,status from sys_dept
where ancestors like '%341600000000%'
<if test="updateTime != null and '' != updateTime ">
and update_time >= #{updateTime}
</if>
</select>
<insert id="insertDept" parameterType="org.dromara.system.domain.SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="parentId != null and parentId != ''">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="shortName != null and shortName != ''">short_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null and orderNum != ''">order_num,</if>
<if test="status != null">status,</if>
create_time
)values(
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="parentId != null and parentId != ''">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="shortName != null and shortName != ''">#{shortName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
<if test="status != null">#{status},</if>
#{createTime}
)
</insert>
<update id="updateDept" parameterType="org.dromara.system.domain.SysDept">
update sys_dept
<set>
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
<if test="status != null and status != ''">status = #{status},</if>
update_time = #{updateTime}
</set>
where dept_id = #{deptId}
</update>
</mapper>