| | |
| | | import cn.cetc54.platform.zhyl.entity.SubsidyPersonStatics; |
| | | import cn.cetc54.platform.zhyl.service.ISubsidyPersonStaticsService; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import io.swagger.annotations.Api; |
| | |
| | | public class FwdxController { |
| | | @Autowired |
| | | private ISubsidyPersonStaticsService iSubsidyPersonStaticsService; |
| | | @GetMapping("getStaticsData") |
| | | @ApiOperation(value = "获取统计数据") |
| | | private int b = 18;//倍数 |
| | | // @GetMapping("getStaticsData") |
| | | // @ApiOperation(value = "获取统计数据") |
| | | public Result getStaticsData(String areaId,Integer type){ |
| | | if (StrUtil.isEmpty(areaId)){ |
| | | return ResultUtil.error("缺少参数"); |
| | |
| | | }); |
| | | return ResultUtil.data(statics); |
| | | } |
| | | @GetMapping("getHistoryStaticsData") |
| | | @ApiOperation(value = "获取历史统计数据") |
| | | // @GetMapping("getHistoryStaticsData") |
| | | // @ApiOperation(value = "获取历史统计数据") |
| | | public Result getHistoryStaticsData(String areaId,Integer type){ |
| | | if (StrUtil.isEmpty(areaId)){ |
| | | return ResultUtil.error("缺少参数"); |
| | |
| | | return ResultUtil.data(vo); |
| | | |
| | | } |
| | | |
| | | @GetMapping("getStaticsData") |
| | | @ApiOperation(value = "获取统计数据") |
| | | public Result getStaticsDataT(String areaId,Integer type){ |
| | | if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){ |
| | | //如果是全市 areaId设置未空 |
| | | areaId = null; |
| | | } |
| | | boolean all = areaId==null; |
| | | |
| | | List<SubsidyPersonStatics> list = new ArrayList<>(); |
| | | for (int i=0;i<(type==null?12:1);i++){ |
| | | SubsidyPersonStatics s = new SubsidyPersonStatics(); |
| | | int mAdd = NumberUtil.generateBySet(50,100,1)[0]; |
| | | int mOut = NumberUtil.generateBySet(1,50,1)[0]; |
| | | int mSum = NumberUtil.generateBySet(150,280,1)[0]; |
| | | int yAdd = NumberUtil.generateBySet(500,1600,1)[0]; |
| | | int yOut = NumberUtil.generateBySet(50,650,1)[0]; |
| | | int ySum = NumberUtil.generateBySet(1500,2800,1)[0]; |
| | | int totalNum = NumberUtil.generateBySet(200,300,1)[0]; |
| | | int checkNum = NumberUtil.generateBySet(100,200,1)[0]; |
| | | int personNum = NumberUtil.generateBySet(16000,23000,1)[0]; |
| | | s.setMonthAdd(all?mAdd*b:mAdd); |
| | | s.setMonthOut(all?mOut*b:mOut); |
| | | s.setMonthSum(all?mSum*b:mSum); |
| | | s.setYearSum(all?ySum*b:ySum); |
| | | s.setYearAdd(all?yAdd*b:yAdd); |
| | | s.setYearOut(all?yOut*b:yOut); |
| | | s.setTotalNum(all?totalNum*b:totalNum); |
| | | s.setCheckNum(all?checkNum*b:checkNum); |
| | | s.setPersonNum(all?personNum*b:personNum); |
| | | s.setSubsidyType(type==null?i:type); |
| | | list.add(s); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | SubsidyPersonStatics statics = new SubsidyPersonStatics(); |
| | | statics.setChild(list); |
| | | list.forEach(e->{ |
| | | statics.setMonth(e.getMonth()); |
| | | statics.setYearAdd(statics.getYearAdd()+e.getYearAdd()); |
| | | statics.setYearOut(statics.getYearOut()+e.getYearOut()); |
| | | statics.setYearSum(statics.getYearSum()+e.getYearSum()); |
| | | statics.setMonthAdd(statics.getMonthAdd()+e.getMonthAdd()); |
| | | statics.setMonthOut(statics.getMonthOut()+e.getMonthOut()); |
| | | statics.setMonthSum(statics.getMonthSum()+e.getMonthSum()); |
| | | statics.setTotalNum(statics.getTotalNum()+e.getTotalNum()); |
| | | statics.setCheckNum(statics.getCheckNum()+e.getCheckNum()); |
| | | statics.setPersonNum(statics.getPersonNum()+e.getPersonNum()); |
| | | }); |
| | | return ResultUtil.data(statics); |
| | | } |
| | | @GetMapping("getHistoryStaticsData") |
| | | @ApiOperation(value = "获取历史统计数据") |
| | | public Result getHistoryStaticsDataT(String areaId,Integer type){ |
| | | if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){ |
| | | //如果是全市 areaId设置未空 |
| | | areaId = null; |
| | | } |
| | | boolean all = areaId==null; |
| | | |
| | | StatisVO vo = new StatisVO(); |
| | | for (int i=1;i<13;i++){ |
| | | int mAdd = NumberUtil.generateBySet(50,100,1)[0]; |
| | | int mOut = NumberUtil.generateBySet(1,50,1)[0]; |
| | | int checkNum = NumberUtil.generateBySet(100,200,1)[0]; |
| | | int totalNum = NumberUtil.generateBySet(200,300,1)[0]; |
| | | vo.month.add(i); |
| | | vo.mAdd.add(all?mAdd*b:mAdd); |
| | | vo.mOut.add(all?mOut*b:mOut); |
| | | vo.checkNum.add(all?checkNum*b:checkNum); |
| | | vo.totalNum.add(all?totalNum*b:totalNum); |
| | | } |
| | | return ResultUtil.data(vo); |
| | | } |
| | | |
| | | |
| | | |
| | | @Data |
| | | class StatisVO{ |
| | | //月份 |