10 changed files with 640 additions and 3 deletions
@ -0,0 +1,106 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.epidemic.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.dto.analysis.pc.epidemic.EpidemicUserSyncDTO; |
||||
|
import com.elink.esua.epdc.modules.epidemic.excel.EpidemicUserSyncExcel; |
||||
|
import com.elink.esua.epdc.modules.epidemic.service.EpidemicUserSyncService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-11 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("epidemicusersync") |
||||
|
public class EpidemicUserSyncController { |
||||
|
|
||||
|
@Autowired |
||||
|
private EpidemicUserSyncService epidemicUserSyncService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<EpidemicUserSyncDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<EpidemicUserSyncDTO> page = epidemicUserSyncService.page(params); |
||||
|
return new Result<PageData<EpidemicUserSyncDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<EpidemicUserSyncDTO> get(@PathVariable("id") String id){ |
||||
|
EpidemicUserSyncDTO data = epidemicUserSyncService.get(id); |
||||
|
return new Result<EpidemicUserSyncDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody EpidemicUserSyncDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
epidemicUserSyncService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody EpidemicUserSyncDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
epidemicUserSyncService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
epidemicUserSyncService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<EpidemicUserSyncDTO> list = epidemicUserSyncService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, EpidemicUserSyncExcel.class); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @describe: 向县平台推送更新的人员数据 |
||||
|
* @author wangtong |
||||
|
* @date 2022/1/11 9:56 |
||||
|
* @params [params, response] |
||||
|
* @return void |
||||
|
*/ |
||||
|
@PostMapping("syncUser") |
||||
|
public void syncUser() { |
||||
|
epidemicUserSyncService.syncUser(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.epidemic.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.analysis.pc.epidemic.DsfUserInfoSyncDTO; |
||||
|
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicUserSyncEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-11 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface EpidemicUserSyncDao extends BaseDao<EpidemicUserSyncEntity> { |
||||
|
|
||||
|
/** |
||||
|
* @describe: 查询最新的需要更新的时间 |
||||
|
* @author wangtong |
||||
|
* @date 2022/1/11 10:01 |
||||
|
* @params [] |
||||
|
* @return java.lang.String |
||||
|
*/ |
||||
|
String selectLastSyncDate(); |
||||
|
|
||||
|
/** |
||||
|
* @describe: 通过日期查询需要更新的人员 |
||||
|
* @author wangtong |
||||
|
* @date 2022/1/11 10:17 |
||||
|
* @params [syncDate] |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.analysis.pc.epidemic.DsfUserInfoSyncDTO> |
||||
|
*/ |
||||
|
List<DsfUserInfoSyncDTO> selectSyncUserListByDate(@Param("syncDate") String syncDate); |
||||
|
|
||||
|
/** |
||||
|
* @describe: 插入同步时间 |
||||
|
* @author wangtong |
||||
|
* @date 2022/1/13 10:16 |
||||
|
* @params [record] |
||||
|
* @return void |
||||
|
*/ |
||||
|
void insertEpidemicUserSync(EpidemicUserSyncEntity record); |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.epidemic.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("epidemic_user_sync") |
||||
|
public class EpidemicUserSyncEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 同步时间 |
||||
|
*/ |
||||
|
private Date syncDate; |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.epidemic.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-11 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpidemicUserSyncExcel { |
||||
|
|
||||
|
@Excel(name = "主键") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "同步时间") |
||||
|
private Date syncDate; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,105 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.epidemic.service; |
||||
|
|
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.dto.analysis.pc.epidemic.EpidemicUserSyncDTO; |
||||
|
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicUserSyncEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-11 |
||||
|
*/ |
||||
|
public interface EpidemicUserSyncService extends BaseService<EpidemicUserSyncEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<EpidemicUserSyncDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-01-11 |
||||
|
*/ |
||||
|
PageData<EpidemicUserSyncDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<EpidemicUserSyncDTO> |
||||
|
* @author generator |
||||
|
* @date 2022-01-11 |
||||
|
*/ |
||||
|
List<EpidemicUserSyncDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return EpidemicUserSyncDTO |
||||
|
* @author generator |
||||
|
* @date 2022-01-11 |
||||
|
*/ |
||||
|
EpidemicUserSyncDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-01-11 |
||||
|
*/ |
||||
|
void save(EpidemicUserSyncDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-01-11 |
||||
|
*/ |
||||
|
void update(EpidemicUserSyncDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2022-01-11 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* @describe: 向县平台推送更新的人员数据 |
||||
|
* @author wangtong |
||||
|
* @date 2022/1/11 9:57 |
||||
|
* @params [] |
||||
|
* @return void |
||||
|
*/ |
||||
|
void syncUser(); |
||||
|
} |
@ -0,0 +1,165 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.epidemic.service.impl; |
||||
|
|
||||
|
import cn.hutool.http.HttpRequest; |
||||
|
import cn.hutool.http.HttpResponse; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.dto.analysis.pc.epidemic.DsfUserInfoSyncDTO; |
||||
|
import com.elink.esua.epdc.dto.analysis.pc.epidemic.DsfUserInfoSyncTotalDTO; |
||||
|
import com.elink.esua.epdc.dto.analysis.pc.epidemic.EpidemicUserSyncDTO; |
||||
|
import com.elink.esua.epdc.modules.epidemic.dao.EpidemicUserSyncDao; |
||||
|
import com.elink.esua.epdc.modules.epidemic.entity.EpidemicUserSyncEntity; |
||||
|
import com.elink.esua.epdc.modules.epidemic.service.EpidemicUserSyncService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2022-01-11 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class EpidemicUserSyncServiceImpl extends BaseServiceImpl<EpidemicUserSyncDao, EpidemicUserSyncEntity> implements EpidemicUserSyncService { |
||||
|
|
||||
|
@Value("${epidemic.user.url}") |
||||
|
public String baseUrl; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public PageData<EpidemicUserSyncDTO> page(Map<String, Object> params) { |
||||
|
IPage<EpidemicUserSyncEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, EpidemicUserSyncDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<EpidemicUserSyncDTO> list(Map<String, Object> params) { |
||||
|
List<EpidemicUserSyncEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, EpidemicUserSyncDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<EpidemicUserSyncEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<EpidemicUserSyncEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public EpidemicUserSyncDTO get(String id) { |
||||
|
EpidemicUserSyncEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, EpidemicUserSyncDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(EpidemicUserSyncDTO dto) { |
||||
|
EpidemicUserSyncEntity entity = ConvertUtils.sourceToTarget(dto, EpidemicUserSyncEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(EpidemicUserSyncDTO dto) { |
||||
|
EpidemicUserSyncEntity entity = ConvertUtils.sourceToTarget(dto, EpidemicUserSyncEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void syncUser() { |
||||
|
Date newSyncDate = new Date(); |
||||
|
String syncDate = baseDao.selectLastSyncDate(); |
||||
|
//分批传送,1000
|
||||
|
int pointsDataLimit = 1000; |
||||
|
List<DsfUserInfoSyncDTO> userList = baseDao.selectSyncUserListByDate(syncDate); |
||||
|
List<DsfUserInfoSyncDTO> newList = new ArrayList<>(); |
||||
|
//成功失败标识
|
||||
|
boolean sucessFlag = true; |
||||
|
for (int i = 0; i < userList.size(); i++) {//分批次处理
|
||||
|
newList.add(userList.get(i)); |
||||
|
if (pointsDataLimit == newList.size() || i == userList.size() - 1) { |
||||
|
boolean sendResult = sendUserList(newList);//发送
|
||||
|
if (!sendResult) { |
||||
|
sucessFlag = false; |
||||
|
} |
||||
|
newList.clear(); |
||||
|
} |
||||
|
} |
||||
|
if(sucessFlag){ |
||||
|
EpidemicUserSyncEntity record = new EpidemicUserSyncEntity(); |
||||
|
record.setSyncDate(newSyncDate); |
||||
|
baseDao.insertEpidemicUserSync(record); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public boolean sendUserList(List<DsfUserInfoSyncDTO> dataList){ |
||||
|
DsfUserInfoSyncTotalDTO data = new DsfUserInfoSyncTotalDTO(); |
||||
|
data.setList(dataList); |
||||
|
try { |
||||
|
String url = baseUrl + "/userinfosync/sync"; |
||||
|
log.info(url); |
||||
|
|
||||
|
String paramJson = JSONObject.toJSONString(data); |
||||
|
log.info("<发送更新的人员信息to县平台>data:" + paramJson); |
||||
|
HttpResponse response = HttpRequest.post(url) |
||||
|
.body(paramJson) |
||||
|
.header("Content-Type", "application/json") |
||||
|
.execute(); |
||||
|
System.out.println("response.body():" + response.body()); |
||||
|
log.info("<发送更新的人员信息to县平台>response.body():" + response.body()); |
||||
|
JSONObject res = JSONObject.parseObject(response.body()); |
||||
|
if (null != res && (res.getIntValue("code") == 200 || res.getIntValue("code") == 0)) { |
||||
|
log.error("<发送更新的人员信息to县平台>成功!"); |
||||
|
return true; |
||||
|
} else { |
||||
|
log.error("<发送更新的人员信息to县平台>获取信息编码异常:" + response.body()); |
||||
|
return false; |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("<发送更新的人员信息to县平台>获取信息异常:", e); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,103 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.elink.esua.epdc.modules.epidemic.dao.EpidemicUserSyncDao"> |
||||
|
|
||||
|
<resultMap type="com.elink.esua.epdc.modules.epidemic.entity.EpidemicUserSyncEntity" id="epidemicUserSyncMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="syncDate" column="SYNC_DATE"/> |
||||
|
</resultMap> |
||||
|
<select id="selectLastSyncDate" resultType="java.lang.String"> |
||||
|
SELECT sync_date |
||||
|
FROM <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_custom"/>.epidemic_user_sync |
||||
|
order by sync_date desc |
||||
|
limit 1 |
||||
|
</select> |
||||
|
<select id="selectSyncUserListByDate" |
||||
|
resultType="com.elink.esua.epdc.dto.analysis.pc.epidemic.DsfUserInfoSyncDTO"> |
||||
|
select USER_NAME, |
||||
|
ID_CARD, |
||||
|
HOUSEHOLD_REGISTER_CODE, |
||||
|
HOUSEHOLD_REGISTER_NAME, |
||||
|
HOUSEHOLD_REGISTER_DETAIL, |
||||
|
CASE gender |
||||
|
WHEN '0' THEN '女' |
||||
|
WHEN '1' THEN '男' |
||||
|
ELSE '' |
||||
|
END AS gender, |
||||
|
nation, |
||||
|
FORMER_NAME, |
||||
|
birthday, |
||||
|
height, |
||||
|
soc.dict_name as standardOfCulture, |
||||
|
he.dict_name as health, |
||||
|
ms.dict_name as maritalStatus, |
||||
|
relation, |
||||
|
nationality, |
||||
|
ps.dict_name as politicsStatus, |
||||
|
faith, |
||||
|
GRADUATE_SCHOOL, |
||||
|
professional, |
||||
|
CASE WORK_STATUS |
||||
|
WHEN '0' THEN '在岗' |
||||
|
WHEN '1' THEN '失业' |
||||
|
ELSE WORK_STATUS |
||||
|
END AS workStatus, |
||||
|
INDUSTRY_CATEGORY, |
||||
|
WORK_UNITS, |
||||
|
MILITARY, |
||||
|
pc.dict_name as peopleCategories, |
||||
|
sc.dict_name as specialCrowd, |
||||
|
car, |
||||
|
CAR_NO, |
||||
|
HUSHAI_STATUS, |
||||
|
NATIVE_PLACE, |
||||
|
BLOOD_TYPE, |
||||
|
MOBILE, |
||||
|
LIVE_ADDRESS_CODE, |
||||
|
LIVE_ADDRESS_NAME, |
||||
|
OUT_LIVE_ADDRESS_DETAIL, |
||||
|
plot, |
||||
|
BUILDING_NO, |
||||
|
UNIT, |
||||
|
ROOM_NO, |
||||
|
HOUSE_PROPERTY, |
||||
|
FAMILY_SECURITY, |
||||
|
LIVING_SITUATION, |
||||
|
SUBSTRING_INDEX(ALL_DEPT_NAMES, '-', -1) as gridName, |
||||
|
SUBSTRING_INDEX(ALL_DEPT_IDS, ',', -1) as gridId, |
||||
|
SUBSTRING_INDEX(PARENT_DEPT_NAMES, '-', -1) as community, |
||||
|
SUBSTRING_INDEX(PARENT_DEPT_IDS, ',', -1) as communityId, |
||||
|
REVISION, |
||||
|
ui.CREATED_BY, |
||||
|
ui.CREATED_TIME, |
||||
|
ui.UPDATED_BY, |
||||
|
ui.UPDATED_TIME, |
||||
|
ui.DEL_FLAG |
||||
|
|
||||
|
from <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_custom"/>.epidemic_user_info ui |
||||
|
left join <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dict soc on soc.dict_value = ui.STANDARD_OF_CULTURE |
||||
|
and soc.dict_type='education_level' |
||||
|
left join <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dict he on he.dict_value = ui.HEALTH |
||||
|
and he.dict_type='body_status' |
||||
|
left join <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dict ms on ms.dict_value = ui.MARITAL_STATUS |
||||
|
and ms.dict_type='marital_status' |
||||
|
left join <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dict ps on ps.dict_value = ui.POLITICS_STATUS |
||||
|
and ps.dict_type='politics_status' |
||||
|
left join <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dict pc on pc.dict_value = ui.PEOPLE_CATEGORIES |
||||
|
and pc.dict_type='people_categories' |
||||
|
left join <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_admin"/>.sys_dict sc on sc.dict_value = ui.SPECIAL_CROWD |
||||
|
and sc.dict_type='special_crowd' |
||||
|
where DEPT_ID!='' |
||||
|
and DEPT_ID is not null |
||||
|
and UPDATED_TIME >= #{syncDate} |
||||
|
</select> |
||||
|
<insert id="insertEpidemicUserSync"> |
||||
|
insert into <include refid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_custom"/>.epidemic_user_sync |
||||
|
(ID,SYNC_DATE) |
||||
|
VALUES |
||||
|
(REPLACE(MD5(UUID()), '-', ''),#{syncDate}) |
||||
|
</insert> |
||||
|
|
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue