| | |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import static org.springblade.core.tool.utils.DateUtil.now; |
| | | |
| | | /** |
| | | * 包裹服务实现层 |
| | |
| | | List<String> listTime = new ArrayList<>(); |
| | | List<Map<String,Object>> parcelList = new ArrayList<>(); |
| | | if (conditionVo.getStatus() == 1) { |
| | | //3.获取本周开始时间和结束时间的每一天数组 |
| | | listTime = DateUtils.pastDay(DateUtils.getWeekEnd()); |
| | | //3.获取今天之前的每一天数组 2021-3-12 arsn修改 |
| | | listTime = DateUtils.pastDay(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); |
| | | List<String> percelTimeList = new ArrayList<>(); |
| | | for (Object object:objectList) { |
| | | //4.取出list里面的值转为map |
| | |
| | | startDate = DateUtils.getToday(); |
| | | endDate = DateUtils.getToday(); |
| | | } |
| | | //2.2查询本周内每天的数据 |
| | | //2.2查询过去6天及当天的的数据 |
| | | if (conditionVo.getStatus() == 1) { |
| | | //3.获取本周开始时间和结束时间 |
| | | startDate = DateUtils.getWeekStart(); |
| | | endDate = DateUtils.getWeekEnd(); |
| | | //3.获取过去6天及当天开始时间和结束时间 |
| | | startDate = DateUtils.getPastDate(6,now()); |
| | | endDate = DateUtils.getToday(); |
| | | } |
| | | //2.2查询本月的数据 |
| | | if (conditionVo.getStatus() == 2) { |
| | |
| | | Map<String, Object> data = (Map<String, Object>) JSONObject.parse(params); |
| | | return JSON.parseArray(data.get("result").toString()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询包裹,违禁品总数 |
| | | * @param status 状态码 0:本天 1:本周 2:本月 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Integer> selectParcelCount(Integer status) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | ConditionVo conditionVo = new ConditionVo(); |
| | | conditionVo.setStatus(status); |
| | | //获取包裹数据 |
| | | List<Object> parcelData = getParcelData(conditionVo, PARCEL_URL, PARCEL_KEY, PARCEL_SECRET); |
| | | //查询当天的包裹总数 |
| | | Integer checkCount = null; |
| | | Integer dangerCount = null; |
| | | if (status == 0) { |
| | | for (Object object : parcelData) { |
| | | //取出list里面的值转为map |
| | | Map<String, Object> objectMap = (Map<String, Object>) object; |
| | | checkCount = Integer.parseInt(objectMap.get("checkCount").toString()); //安检包裹数量 |
| | | dangerCount = Integer.parseInt(objectMap.get("dangerCount").toString()); //违禁包裹数量 |
| | | } |
| | | } |
| | | //封装数据 |
| | | list.add(checkCount); |
| | | list.add(dangerCount); |
| | | //返回数据 |
| | | return list; |
| | | } |
| | | } |