123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- package com.example.controller.gdc;
- import com.example.config.annotation.IgnoreAuth;
- import com.example.pojo.gdc.OtnAreaEntity;
- import com.example.pojo.gdc.WzHouseCustomerEntity;
- import com.example.service.gdc.WzHouseCustomerService;
- import com.example.service.gdc.WzOtnAreaService;
- import com.example.utils.PageMap;
- import com.example.utils.PageUtils;
- import com.example.utils.Query;
- import com.example.utils.R;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * 房屋出租(合同管理)
- */
- @RestController
- @RequestMapping("/house-car/house/dist/api/wzHouseCustomer")
- public class WzHouseCustomerController {
- @Autowired
- private WzHouseCustomerService wzHouseCustomerService;
- @Autowired
- private WzOtnAreaService otnAreaService;
- @RequestMapping("/list")
- @IgnoreAuth
- public R list(@RequestBody PageMap pageMap) {
- //查询列表数据
- Query query = new Query(pageMap);
- List<WzHouseCustomerEntity> list = wzHouseCustomerService.queryList(query);
- int total = wzHouseCustomerService.queryTotal(query);
- PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage());
- return R.ok().put("page", pageUtil);
- }
- @RequestMapping("/echartList")
- @IgnoreAuth
- public R echartList(@RequestBody PageMap pageMap) {
- //查询列表数据
- Query query = new Query(pageMap);
- List<WzHouseCustomerEntity> wzHouseContracEntityList = wzHouseCustomerService.queryList(query);
- WzHouseCustomerEntity province=new WzHouseCustomerEntity();
- province.setCity("全省");
- Map<String,List<WzHouseCustomerEntity>> map=new HashMap<>();
- for (WzHouseCustomerEntity leaveUseVo : wzHouseContracEntityList) {
- List<WzHouseCustomerEntity> list;
- if(map.get(leaveUseVo.getCity())!=null){
- list=map.get(leaveUseVo.getCity());
- list.add(leaveUseVo);
- }else{
- list=new ArrayList<>();
- list.add(leaveUseVo);
- }
- map.put(leaveUseVo.getCity(),list);
- }
- List<WzHouseCustomerEntity> resultList=new ArrayList<>();
- List<WzHouseCustomerEntity> cityList=new ArrayList<>();
- Integer allPerson=0;
- Integer allPersonPrivate=0;
- Integer allStateOwnedEnterprises=0;
- Integer allGovernment=0;
- Integer allAllNum=0;
- for(Map.Entry<String,List<WzHouseCustomerEntity>> entry:map.entrySet()){
- List<WzHouseCustomerEntity> list=entry.getValue();
- if(list.get(0).getCity().equals("全省")){
- continue;
- }
- Integer person=0;
- Integer personPrivate=0;
- Integer stateOwnedEnterprises=0;
- Integer government=0;
- Integer allNum=0;
- for (WzHouseCustomerEntity leaveUseVo : list) {
- if(leaveUseVo.getPerson()!=null){
- person+=leaveUseVo.getPerson();
- allPerson+=leaveUseVo.getPerson();
- }
- if(leaveUseVo.getPersonPrivate()!=null){
- personPrivate+=leaveUseVo.getPersonPrivate();
- allPersonPrivate+=leaveUseVo.getPersonPrivate();
- }
- if(leaveUseVo.getStateOwnedEnterprises()!=null){
- stateOwnedEnterprises+=leaveUseVo.getStateOwnedEnterprises();
- allStateOwnedEnterprises+=leaveUseVo.getStateOwnedEnterprises();
- }
- if(leaveUseVo.getGovernment()!=null){
- government+=leaveUseVo.getGovernment();
- allGovernment+=leaveUseVo.getGovernment();
- }
- allNum=person+personPrivate+stateOwnedEnterprises+government;
- allAllNum+=allNum;
- leaveUseVo.setAllNum(allNum);
- }
- cityList.add(list.get(0));
- }
- //对cityList 进行排序
- List<OtnAreaEntity> areaList=otnAreaService.getCityOption("018");
- List<WzHouseCustomerEntity> orderList=new ArrayList<>();
- for (OtnAreaEntity otnAreaEntity : areaList) {
- for (WzHouseCustomerEntity wzCity : cityList) {
- if(wzCity.getCity().contains(otnAreaEntity.getName())){
- orderList.add(wzCity);
- }
- }
- }
- province.setPerson(allPerson);
- province.setPersonPrivate(allPersonPrivate);
- province.setStateOwnedEnterprises(allStateOwnedEnterprises);
- province.setGovernment(allGovernment);
- province.setChildren(orderList);
- province.setAllNum(allAllNum);
- if(orderList.size()>0){
- resultList.add(province);
- }
- int total = wzHouseCustomerService.queryTotal(query);
- PageUtils pageUtil = new PageUtils(resultList, total, query.getLimit(), query.getPage());
- return R.ok().put("page", pageUtil);
- }
- }
|