| | |
| | | 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; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author xfei |
| | |
| | | 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("缺少参数"); |
| | | } |
| | | List result = iSubsidyPersonStaticsService.getMonthAddOut(areaId,type); |
| | | return ResultUtil.data(result); |
| | | List<Map<String,Object>> result = iSubsidyPersonStaticsService.getMonthAddOut(areaId,type); |
| | | StatisVO vo = new StatisVO(); |
| | | result.forEach(e->{ |
| | | String month = (String) e.get("month"); |
| | | int mAdd = Integer.parseInt(String.valueOf(e.get("mAdd"))); |
| | | int mOut = Integer.parseInt(String.valueOf(e.get("mOut"))); |
| | | int checkNum = Integer.parseInt(String.valueOf(e.get("checkNum"))); |
| | | int totalNum = Integer.parseInt(String.valueOf(e.get("totalNum"))); |
| | | vo.month.add(0,month.split("-")[1]); |
| | | vo.mAdd.add(0,mAdd); |
| | | vo.mOut.add(0,mOut); |
| | | vo.checkNum.add(0,checkNum); |
| | | vo.totalNum.add(0,totalNum); |
| | | }); |
| | | 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{ |
| | | //月份 |
| | | List month = new ArrayList(); |
| | | //月新增 |
| | | List mAdd = new ArrayList(); |
| | | //月退出 |
| | | List mOut = new ArrayList(); |
| | | //月复核数 |
| | | List checkNum = new ArrayList(); |
| | | //月复核数 |
| | | List totalNum = new ArrayList(); |
| | | |
| | | } |
| | | |