亳州位置汇聚
parent
623c35da0a
commit
d667538721
|
|
@ -49,4 +49,9 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
||||||
|
|
||||||
List<SysDeptVo> jzDept(String updateTime);
|
List<SysDeptVo> jzDept(String updateTime);
|
||||||
|
|
||||||
|
int insertDept(SysDept dept);
|
||||||
|
|
||||||
|
int updateDept(SysDept dept);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.system.domain.SysDept;
|
import org.dromara.system.domain.SysDept;
|
||||||
import org.dromara.system.domain.vo.SysDeptVo;
|
import org.dromara.system.domain.vo.SysDeptVo;
|
||||||
import org.dromara.system.service.ISysDeptService;
|
import org.dromara.system.service.ISysDeptService;
|
||||||
|
|
@ -21,6 +22,7 @@ import java.util.List;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
|
@Slf4j
|
||||||
public class JzDeptSchedule {
|
public class JzDeptSchedule {
|
||||||
|
|
||||||
private final ISysDeptService deptService;
|
private final ISysDeptService deptService;
|
||||||
|
|
@ -108,6 +110,7 @@ public class JzDeptSchedule {
|
||||||
public void jzDeptNew(){
|
public void jzDeptNew(){
|
||||||
Date time = DateUtil.offsetHour(new Date(),-1);
|
Date time = DateUtil.offsetHour(new Date(),-1);
|
||||||
List<SysDeptVo> list = deptService.jzDpet(DateUtil.formatDateTime(time));
|
List<SysDeptVo> list = deptService.jzDpet(DateUtil.formatDateTime(time));
|
||||||
|
log.error("要同步警综的机构:"+list.toString());
|
||||||
List<SysDeptVo> sysList = new ArrayList<>();
|
List<SysDeptVo> sysList = new ArrayList<>();
|
||||||
for (SysDeptVo dept : list) {
|
for (SysDeptVo dept : list) {
|
||||||
if ("1".equals(dept.getStatus())){
|
if ("1".equals(dept.getStatus())){
|
||||||
|
|
@ -115,7 +118,6 @@ public class JzDeptSchedule {
|
||||||
}else {
|
}else {
|
||||||
dept.setStatus("1");
|
dept.setStatus("1");
|
||||||
}
|
}
|
||||||
dept.setShortName(dept.getDeptName());
|
|
||||||
sysList.add(dept);
|
sysList.add(dept);
|
||||||
}
|
}
|
||||||
deptService.insertORUpdate(BeanUtil.copyToList(sysList, SysDept.class));
|
deptService.insertORUpdate(BeanUtil.copyToList(sysList, SysDept.class));
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,16 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean insertORUpdate(List<SysDept> list) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -230,11 +230,47 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="jzDept" resultMap="SysDeptResult">
|
<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%'
|
where ancestors like '%341600000000%'
|
||||||
<if test="updateTime != null and '' != updateTime ">
|
<if test="updateTime != null and '' != updateTime ">
|
||||||
and update_time >= #{updateTime}
|
and update_time >= #{updateTime}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue