123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package com.example.controller.gdc;
- import com.example.config.annotation.IgnoreAuth;
- import com.example.pojo.gdc.WzRentHouseArrearsEntity;
- import com.example.service.gdc.WzRentHouseArrearsService;
- import com.example.utils.PageMap;
- import com.example.utils.PageUtils;
- import com.example.utils.Query;
- import com.example.utils.R;
- import com.example.utils.excel.ExcelExport;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import javax.servlet.http.HttpServletResponse;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * 出租监控_出租房屋欠费超5万元
- */
- @RestController
- @RequestMapping("/house-car/house/dist/api/wzRentHouseArrears")
- public class WzRentHouseArrearsController {
- @Autowired
- private WzRentHouseArrearsService wzRentHouseArrearsService;
- /**
- * 出租监控_出租房屋欠费超5万元
- */
- @RequestMapping("/list")
- @IgnoreAuth
- public R list(@RequestBody PageMap pageMap) {
- //查询列表数据
- Query query = new Query(pageMap);
- Query query1 = new Query(pageMap);
- if(query.get("statisticalMonth")==null||query.get("statisticalMonth").toString().equals("")){
- String lastTime=wzRentHouseArrearsService.getLastStaticMonth();
- query.put("statisticalMonth",lastTime);
- query1.put("statisticalMonth",lastTime);
- }
- List<WzRentHouseArrearsEntity> resultList = wzRentHouseArrearsService.queryList(query);
- int total = wzRentHouseArrearsService.queryTotal(query1);
- PageUtils pageUtil = new PageUtils(resultList, total, query.getLimit(), query.getPage());
- return R.ok().put("page", pageUtil);
- }
- /**
- * 清单excel
- */
- @GetMapping("/excel")
- @IgnoreAuth
- public void excel(String name, String buildingNameAlias,String statisticalMonth, String city, String county, HttpServletResponse response) {
- Map<String, Object> map = new HashMap<>();
- if(statisticalMonth==null||statisticalMonth.equals("")||statisticalMonth.equals("undefined")){
- String lastTime=wzRentHouseArrearsService.getLastStaticMonth();
- map.put("statisticalMonth",lastTime);
- }
- if (buildingNameAlias != null) {
- map.put("buildingNameAlias", buildingNameAlias);
- }
- if (city != null) {
- map.put("city", city);
- }
- if (county != null) {
- map.put("county", county);
- }
- List<WzRentHouseArrearsEntity> resultList = wzRentHouseArrearsService.queryList(map);
- DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
- ExcelExport ee1 = new ExcelExport("出租监控_出租房屋欠费超5万元" + df.format(new Date()));
- List<Object> colList;
- List<Object[]> allList = new ArrayList();
- for (int i = 0; i < resultList.size(); i++) {
- colList = new ArrayList();
- colList.add(resultList.get(i).getMonth());
- colList.add(resultList.get(i).getCity());
- colList.add(resultList.get(i).getCounty());
- colList.add(resultList.get(i).getUserName());
- colList.add(resultList.get(i).getUserAttribute());
- colList.add(WzHouseMaintenaCostController.toThousands(resultList.get(i).getArrears(),true));
- allList.add(colList.toArray());
- }
- String[] header = new String[]{
- "统计月份",
- "地市",
- "县区",
- "用户名称",
- "租户属性",
- "累计欠费"
- };
- ee1.addSheetByArray(df.format(new Date()) + "清单", allList, header);
- ee1.export(response);
- }
- }
|