| | |
| | | |
| | | 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.cases.domain.dto.FileRelateDTO; |
| | | import cn.huge.module.client.api.SysClient; |
| | | import cn.huge.module.cust.dto.CtUserDTO; |
| | | 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){ |
| | |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | } |