| | |
| | | package com.ld.igds.phone35.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ld.igds.constant.BizType; |
| | | import com.ld.igds.constant.RespCodeEnum; |
| | | import com.ld.igds.constant.WarnType; |
| | | import com.ld.igds.phone35.constant.Phone35Constant; |
| | | import com.ld.igds.phone35.dto.DtoWarn; |
| | | import com.ld.igds.phone35.dto.Phone35AuthUser; |
| | | import com.ld.igds.phone35.dto.PhoneResponse; |
| | | import com.ld.igds.phone35.mapper.Phone35Mapper; |
| | | import com.ld.igds.phone35.param.Phone35DepotCommonParam; |
| | | import com.ld.igds.phone35.param.Phone35Request; |
| | | import com.ld.igds.phone35.service.Phone35Service; |
| | | import com.ld.igds.phone35.util.PhoneRespUtil; |
| | | import com.ld.igds.util.ContextUtil; |
| | | import com.ld.igds.util.DateUtil; |
| | | import com.ld.igds.warn.WarnUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 预警列表 |
| | | * |
| | | * @Author:YAN |
| | | */ |
| | | @Service |
| | | public class Phone35ServiceImpl5801 implements Phone35Service { |
| | | |
| | | @Autowired |
| | | private Phone35Mapper phone35Mapper; |
| | | |
| | | @Override |
| | | public String getInterfaceId() { |
| | | return Phone35Constant.API_PHONE_5801; |
| | |
| | | |
| | | @Override |
| | | public PhoneResponse<Object> execute(Phone35Request<JSONObject> req, Phone35AuthUser phone35AuthUser) throws Exception { |
| | | return null; |
| | | //转化对象 |
| | | Phone35DepotCommonParam param = JSONObject.parseObject(req.getData().toString(), Phone35DepotCommonParam.class); |
| | | if (null == param) { |
| | | return PhoneRespUtil.error(RespCodeEnum.CODE_1111, "参数有误,请重试!!"); |
| | | } |
| | | //参数验证 |
| | | if (StringUtils.isEmpty(param.getDeptId())) { |
| | | return PhoneRespUtil.error(RespCodeEnum.CODE_1111, "参数有误,请重试!!"); |
| | | } |
| | | //参数验证 |
| | | if (StringUtils.isEmpty(param.getDateTime())) { |
| | | return PhoneRespUtil.error(RespCodeEnum.CODE_1111, "参数有误,请重试!!"); |
| | | } |
| | | Date date = DateUtils.parseDate(param.getDateTime(), "yyyy-MM-dd"); |
| | | param.setStartTime(date); |
| | | param.setEndTime(DateUtil.getNextZero(date)); |
| | | param.setCompanyId(phone35AuthUser.getCompanyId()); |
| | | List<DtoWarn> list = phone35Mapper.getWarnByDept(param); |
| | | for (DtoWarn warn : list) { |
| | | warn.setType(WarnType.getMsg(warn.getType())); |
| | | warn.setBizType(BizType.getMsg(warn.getBizType())); |
| | | } |
| | | return PhoneRespUtil.success(list, req); |
| | | } |
| | | } |