| | |
| | | package cn.huge.module.client.api.impl; |
| | | |
| | | import cn.huge.base.common.bo.R; |
| | | import cn.huge.base.common.bo.ReturnBO; |
| | | import cn.huge.base.common.constant.ReturnConsts; |
| | | import cn.huge.base.common.exception.ClientException; |
| | | import cn.huge.base.common.exception.ServiceException; |
| | | import cn.huge.base.common.utils.DateUtils; |
| | | import cn.huge.base.common.utils.ObjectUtils; |
| | | import cn.huge.module.sys.vo.GridIdsVo; |
| | | import cn.huge.module.sys.vo.GridTaskVo; |
| | | import cn.huge.module.sys.vo.GridToDoBacthVo; |
| | | import cn.huge.module.sys.vo.GridToDoVo; |
| | | import cn.huge.module.cases.domain.dto.FileRelateDTO; |
| | | import cn.huge.module.client.api.SysClient; |
| | | import cn.huge.module.sys.constant.TimeUnitConsts; |
| | | import cn.huge.module.sys.dto.*; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 附件中心-根据业务编号查询固定格式所有附件 |
| | | * @param limitTable 表名 |
| | | * 获取时限 |
| | | * @param limitType 时限类型 |
| | | * @return List |
| | | */ |
| | | public Integer getTimeLimit(String limitTable, String limitType){ |
| | | public Integer getTimeLimitHour(String limitType){ |
| | | int timeTerm = 0; |
| | | try{ |
| | | ReturnBO returnBo = sysClient.getTimeLimit(limitTable, limitType); |
| | | ReturnBO returnBo = sysClient.getExpireTime(limitType); |
| | | if (ReturnConsts.OK == returnBo.getCode()){ |
| | | if (ObjectUtils.isNotEmpty(returnBo.getData())){ |
| | | timeTerm = (int)returnBo.getData(); |
| | | SyTimeLimitDTO syTimeLimitDTO = objectMapper.convertValue(returnBo.getData(), SyTimeLimitDTO.class); |
| | | if (ObjectUtils.isNotEmpty(syTimeLimitDTO)){ |
| | | if (ObjectUtils.isNotEmpty(syTimeLimitDTO)){ |
| | | if (TimeUnitConsts.TIME_UNIT_1.equals(syTimeLimitDTO.getTermUnit())){ |
| | | timeTerm = syTimeLimitDTO.getTimeTerm()*24*365; |
| | | } |
| | | if (TimeUnitConsts.TIME_UNIT_2.equals(syTimeLimitDTO.getTermUnit())){ |
| | | timeTerm = syTimeLimitDTO.getTimeTerm()*24*30; |
| | | } |
| | | if (TimeUnitConsts.TIME_UNIT_3.equals(syTimeLimitDTO.getTermUnit())){ |
| | | timeTerm = syTimeLimitDTO.getTimeTerm()*24; |
| | | } |
| | | if (TimeUnitConsts.TIME_UNIT_4.equals(syTimeLimitDTO.getTermUnit())){ |
| | | timeTerm = syTimeLimitDTO.getTimeTerm(); |
| | | } |
| | | if (TimeUnitConsts.TIME_UNIT_5.equals(syTimeLimitDTO.getTermUnit())){ |
| | | timeTerm = syTimeLimitDTO.getTimeTerm()/60; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | public Date getExpireTime(Date computeTime, String limitType){ |
| | | Date expireTime = null; |
| | | try{ |
| | | ReturnBO returnBo = sysClient.getExpireTime(computeTime, limitType); |
| | | ReturnBO returnBo = sysClient.getExpireTime(limitType); |
| | | if (ReturnConsts.OK == returnBo.getCode()){ |
| | | if (ObjectUtils.isNotEmpty(returnBo.getData())){ |
| | | expireTime = (Date) returnBo.getData(); |
| | | SyTimeLimitDTO syTimeLimitDTO = objectMapper.convertValue(returnBo.getData(), SyTimeLimitDTO.class); |
| | | if (ObjectUtils.isNotEmpty(syTimeLimitDTO)){ |
| | | if (ObjectUtils.isNotEmpty(syTimeLimitDTO)){ |
| | | if (TimeUnitConsts.TIME_UNIT_1.equals(syTimeLimitDTO.getTermUnit())){ |
| | | expireTime = DateUtils.addYear(computeTime, syTimeLimitDTO.getTimeTerm()); |
| | | } |
| | | if (TimeUnitConsts.TIME_UNIT_2.equals(syTimeLimitDTO.getTermUnit())){ |
| | | expireTime = DateUtils.addMonth(computeTime, syTimeLimitDTO.getTimeTerm()); |
| | | } |
| | | if (TimeUnitConsts.TIME_UNIT_3.equals(syTimeLimitDTO.getTermUnit())){ |
| | | expireTime = DateUtils.addDay(computeTime, syTimeLimitDTO.getTimeTerm()); |
| | | } |
| | | if (TimeUnitConsts.TIME_UNIT_4.equals(syTimeLimitDTO.getTermUnit())){ |
| | | expireTime = DateUtils.addHour(computeTime, syTimeLimitDTO.getTimeTerm()); |
| | | } |
| | | if (TimeUnitConsts.TIME_UNIT_5.equals(syTimeLimitDTO.getTermUnit())){ |
| | | expireTime = DateUtils.addMonth(computeTime, syTimeLimitDTO.getTimeTerm()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | log.error("service方法[SysClientImpl.removeFileRelate]请求异常:"+e, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据百度地图经纬度获取街道 |
| | | * @url {ctx}/api/client/syRegion/getTownByBaiduiLngLat |
| | | * @param lng 经度 |
| | | * @param lat 维度 |
| | | * @return |
| | | */ |
| | | public QueAddrBaseDTO getQueAddrByBaiduiLngLat(String lng, String lat){ |
| | | QueAddrBaseDTO queAddrBaseDTO = new QueAddrBaseDTO(); |
| | | try{ |
| | | ReturnBO returnBo = sysClient.getQueAddrByBaiduiLngLat(lng, lat); |
| | | if (ReturnConsts.OK == returnBo.getCode()){ |
| | | if (ObjectUtils.isNotEmpty(returnBo.getData())){ |
| | | queAddrBaseDTO = objectMapper.convertValue(returnBo.getData(), QueAddrBaseDTO.class); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("service方法[SysClientImpl.getQueAddrByBaiduiLngLat]调用异常:"+e, e); |
| | | } |
| | | return queAddrBaseDTO; |
| | | } |
| | | |
| | | /** |
| | | * 根据关系编号查询附件关系信息 |
| | | * @param ownerId 附件关系编号 |
| | | * @return List |
| | | */ |
| | | public List<FileRelateDTO> listFileRelateByOwnerId(String ownerId){ |
| | | List<FileRelateDTO> fileRelateDTOList = new ArrayList<>(); |
| | | try{ |
| | | ReturnBO returnBo = sysClient.listFileRelateByOwnerId(ownerId); |
| | | if (ReturnConsts.OK == returnBo.getCode()){ |
| | | if (ObjectUtils.isNotEmpty(returnBo.getData())){ |
| | | List<LinkedHashMap> list = (List<LinkedHashMap>) returnBo.getData(); |
| | | for (LinkedHashMap map : list) { |
| | | FileRelateDTO fileRelateDTO = JSON.parseObject(JSON.toJSONString(map), FileRelateDTO.class); |
| | | fileRelateDTOList.add(fileRelateDTO); |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("service方法[SysClientImpl.listFileRelateByOwnerId]调用异常:"+e, e); |
| | | } |
| | | return fileRelateDTOList; |
| | | } |
| | | |
| | | /** |
| | | * 插入多条附件关系记录 |
| | | * @param fileRelateList 附件关系 |
| | | * @return Object |
| | | */ |
| | | public void saveFileRelateList(List<FileRelateDTO> fileRelateList) { |
| | | try { |
| | | ReturnBO returnBo = sysClient.saveFileRelateList(fileRelateList); |
| | | if (ReturnConsts.OK != returnBo.getCode()){ |
| | | log.error("Client外服务接口[SysClientImpl.saveFileRelateList]请求异常:" + returnBo.getMsg(), returnBo.getMsg()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("service方法[SysClientImpl.saveFileRelateList]请求异常:"+e, e); |
| | | } |
| | | } |
| | | |
| | | public List<QueAreaDTO> listByParentId(String parentId){ |
| | | List<QueAreaDTO> queAreaDTOList = new ArrayList<>(); |
| | | try{ |
| | | ReturnBO returnBo = sysClient.listByParentId(parentId); |
| | | if (ReturnConsts.OK == returnBo.getCode()){ |
| | | if (ObjectUtils.isNotEmpty(returnBo.getData())){ |
| | | List<LinkedHashMap> list = (List<LinkedHashMap>) returnBo.getData(); |
| | | for (LinkedHashMap map : list) { |
| | | QueAreaDTO queAreaDTO = JSON.parseObject(JSON.toJSONString(map), QueAreaDTO.class); |
| | | queAreaDTOList.add(queAreaDTO); |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("service方法[SysClientImpl.listFileRelateByOwnerId]调用异常:"+e, e); |
| | | } |
| | | return queAreaDTOList; |
| | | } |
| | | |
| | | /** |
| | | * 创建待办 |
| | | * @url {ctx}/api/thrid/grid/todo/create-task-todo |
| | | * @param gridToDoBacthVo |
| | | * @param unitId |
| | | * @return |
| | | */ |
| | | public void createTaskToDo(GridToDoBacthVo gridToDoBacthVo, String unitId){ |
| | | try{ |
| | | R<List<GridToDoVo>> gridToDoBo = sysClient.createTaskToDo(gridToDoBacthVo, unitId); |
| | | if (ReturnConsts.OK != gridToDoBo.getCode()){ |
| | | log.error("Client外服务接口[SysClientImpl.createToDo]请求异常:" + gridToDoBo.getMsg()); |
| | | }else { |
| | | log.info("创建工单成功"); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("service方法[SysClientImpl.createToDo]调用异常:"+e, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 更新待办 |
| | | * @url {ctx}/api/thrid/grid/todo/update-task-todo |
| | | * @param gridToDoVo |
| | | * @return |
| | | */ |
| | | public void updateTaskTodo(GridToDoVo gridToDoVo, String previousTaskId){ |
| | | try{ |
| | | R<List<GridToDoVo>> gridToDoBo = sysClient.updateTaskTodo(gridToDoVo, previousTaskId); |
| | | if (ReturnConsts.OK != gridToDoBo.getCode()){ |
| | | log.error("Client外服务接口[SysClientImpl.updateTodo]请求异常:" + gridToDoBo.getMsg()); |
| | | }else{ |
| | | log.info("修改工单成功"); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("service方法[SysClientImpl.updateTodo]调用异常:"+e, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 批量删除待办 |
| | | * @url {ctx}/api/thrid/grid/todo/delete-task-todo |
| | | * @param gridTaskVo |
| | | * @return |
| | | */ |
| | | public void deleteTaskTodo(GridTaskVo gridTaskVo){ |
| | | try{ |
| | | R<String> gridToDoBo = sysClient.deleteTaskTodo(gridTaskVo); |
| | | if (ReturnConsts.OK != gridToDoBo.getCode()){ |
| | | log.error("Client外服务接口[SysClientImpl.deleteTaskTodo]请求异常:" + gridToDoBo.getMsg()); |
| | | }else{ |
| | | log.info("批量删除待办成功"); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("service方法[SysClientImpl.deleteTaskTodo]调用异常:"+e, e); |
| | | } |
| | | } |
| | | } |