| | |
| | | |
| | | import com.google.gson.*; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.vo.AcceptAdminData; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | import org.yeshi.utils.statistic.BaseStatisticTimeQuery; |
| | | import org.yeshi.utils.statistic.StatisticNumberResult; |
| | | import org.yeshi.utils.statistic.StatisticResulterFilterUtil; |
| | | import org.yeshi.utils.statistic.StatisticTimeSpan; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/api/goldcorn/get/record") |
| | |
| | | |
| | | @Override |
| | | public JsonElement serialize(Date date, Type type, JsonSerializationContext jsonSerializationContext) { |
| | | return date == null ? new JsonPrimitive("") : new JsonPrimitive(TimeUtil.getGernalTime(date.getTime(), "yyyy.MM.dd HH:mm")); |
| | | return date == null ? new JsonPrimitive("") : new JsonPrimitive(TimeUtil.getGernalTime(date.getTime(), "yyyy.MM.dd HH:mm:ss")); |
| | | } |
| | | }).registerTypeAdapter(GoldCornGetType.class, new JsonSerializer<GoldCornGetType>() { |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("delete") |
| | | public String delete(String ids) { |
| | | Type type = new TypeToken<List<String>>() { |
| | | }.getType(); |
| | | List<String> idList = new Gson().fromJson(ids, type); |
| | | goldCornGetRecordService.delete(idList); |
| | | return JsonUtil.loadTrueResult(""); |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("get") |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("statistic") |
| | | public String statistic(AcceptAdminData acceptAdminData, long startTime, long endTime, String span, String callback) { |
| | | if (endTime < startTime) { |
| | | return JsonUtil.loadFalseResult("开始时间不能大于结束时间"); |
| | | } |
| | | |
| | | if (StatisticTimeSpan.valueOf(span) == null) { |
| | | return JsonUtil.loadFalseResult("时间间隔不存在"); |
| | | } |
| | | |
| | | BaseStatisticTimeQuery timeQuery = new BaseStatisticTimeQuery(); |
| | | timeQuery.setStartTime(new Date(startTime)); |
| | | timeQuery.setEndTime(new Date(endTime)); |
| | | timeQuery.setTimeSpan(StatisticTimeSpan.valueOf(span)); |
| | | |
| | | List<StatisticNumberResult> list = goldCornGetRecordService.statistic(acceptAdminData.getSystem(), timeQuery); |
| | | list = StatisticResulterFilterUtil.filterNumberResult(list, timeQuery); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", new Gson().toJson(list)); |
| | | data.put("count", list.size()); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | |
| | | } |