From 46a8b6fef4a3582280669b9398ed405b53bee17c Mon Sep 17 00:00:00 2001 From: songwenxuan <1924103812@qq.com> Date: Thu, 25 Apr 2024 14:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=87=E6=80=BB=E5=8F=B0=E8=B4=A6=E5=92=8C?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hiddenApi/HiddenApiController.java | 141 ++++++++ .../datasource/hiddenApi/HiddenApiMapper.java | 4 + .../bus/impl/PositioningServiceImpl.java | 3 +- .../service/hiddenApi/HiddenApiService.java | 5 + .../hiddenApi/impl/HiddenApiServiceImpl.java | 105 ++++++ .../datasource/hiddenApi/HiddenApiMapper.xml | 336 ++++++++++++++++++ 6 files changed, 593 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/zcloud/controller/hiddenApi/HiddenApiController.java b/src/main/java/com/zcloud/controller/hiddenApi/HiddenApiController.java index 4853f6bf..4e1b609c 100644 --- a/src/main/java/com/zcloud/controller/hiddenApi/HiddenApiController.java +++ b/src/main/java/com/zcloud/controller/hiddenApi/HiddenApiController.java @@ -19,6 +19,7 @@ import com.zcloud.util.*; import com.zcloud.util.event.DeviceHiddenEvent; import com.zcloud.util.message.MessageService; import org.apache.commons.lang.StringUtils; +import org.apache.fop.fo.FObj; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; @@ -946,6 +947,121 @@ public class HiddenApiController extends BaseController { return map; } + /**导出某一个选中项到excel + * @param + * @throws Exception + */ + @RequestMapping(value="/excelSummary") + // @RequiresPermissions("toExcel") + public ModelAndView excelSummary() throws Exception{ + ModelAndView mv = new ModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + Map dataMap = new HashMap(); + List titles = new ArrayList(); + titles.add("月份"); //1 + titles.add("数量(公司)"); //2 + titles.add("已完成(公司)"); //3 + titles.add("完成率(公司)"); //4 + titles.add("数量(装船部)"); //5 + titles.add("已完成(装船部)"); //6 + titles.add("完成率(装船部)"); //7 + titles.add("数量(卸车部)"); //8 + titles.add("已完成(卸车部)"); //9 + titles.add("完成率(卸车部)"); //10 + titles.add("数量(生产保障部)"); //11 + titles.add("已完成(生产保障部)"); //12 + titles.add("完成率(生产保障部)"); //13 + titles.add("数量(其他部)"); //14 + titles.add("已完成(其他部)"); //15 + titles.add("完成率(其他部)"); //16 + dataMap.put("titles", titles); + List dataList = hiddenApiService.goSummaryTable(pd); + List varOList = hiddenApiService.dealData(dataList); + ArrayList varList = new ArrayList<>(); + for(int i=0;i dataMap = new HashMap(); + List titles = new ArrayList(); + titles.add("序号"); //1 + titles.add("隐患类型"); //2 + titles.add("等级"); //3 + titles.add("隐患位置"); //4 + titles.add("隐患简要情况"); //5 + titles.add("整改治理措施"); //6 + titles.add("发现隐患日期"); //7 + titles.add("整改完成时限"); //8 + titles.add("整改责任部门"); //9 + titles.add("整改责任人"); //10 + titles.add("整改督办人"); //11 + titles.add("投入资金(元)"); //12 + titles.add("复查时间及结果"); //13 + titles.add("复查人"); //14 + titles.add("检查人员"); //15 + List varOList = hiddenApiService.listForExcel(pd); + List varList = new ArrayList(); + for(int i=0;i map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + if (pd.get("YEAR").equals("")){ + pd.put("YEAR","2024"); + } + List dataList = hiddenApiService.goSummaryTable(pd); + List varList = hiddenApiService.dealData(dataList); + map.put("varList", varList); + map.put("result", errInfo); + return map; + } } diff --git a/src/main/java/com/zcloud/mapper/datasource/hiddenApi/HiddenApiMapper.java b/src/main/java/com/zcloud/mapper/datasource/hiddenApi/HiddenApiMapper.java index 3a82091b..92de566b 100644 --- a/src/main/java/com/zcloud/mapper/datasource/hiddenApi/HiddenApiMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/hiddenApi/HiddenApiMapper.java @@ -83,5 +83,9 @@ public interface HiddenApiMapper { List getListdatalistPage(Page page); List getListAll(PageData pd); + + List goSummaryTable(PageData pd); + + List listForExcel(PageData pd); } diff --git a/src/main/java/com/zcloud/service/bus/impl/PositioningServiceImpl.java b/src/main/java/com/zcloud/service/bus/impl/PositioningServiceImpl.java index 334e18b6..6cd6d3bc 100644 --- a/src/main/java/com/zcloud/service/bus/impl/PositioningServiceImpl.java +++ b/src/main/java/com/zcloud/service/bus/impl/PositioningServiceImpl.java @@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import java.util.List; @@ -18,7 +19,7 @@ import java.util.Set; public class PositioningServiceImpl implements PositioningService { @Autowired - private RedisTemplate redisTemplate; + private StringRedisTemplate redisTemplate; @Autowired private UsersService usersService; diff --git a/src/main/java/com/zcloud/service/hiddenApi/HiddenApiService.java b/src/main/java/com/zcloud/service/hiddenApi/HiddenApiService.java index e0c3e9d7..555bdd7c 100644 --- a/src/main/java/com/zcloud/service/hiddenApi/HiddenApiService.java +++ b/src/main/java/com/zcloud/service/hiddenApi/HiddenApiService.java @@ -106,5 +106,10 @@ public interface HiddenApiService { */ public List getListAll (PageData pd) throws Exception; + public List goSummaryTable (PageData pd) throws Exception; + + public List dealData (List pd) throws Exception; + + public List listForExcel (PageData pd) throws Exception; } diff --git a/src/main/java/com/zcloud/service/hiddenApi/impl/HiddenApiServiceImpl.java b/src/main/java/com/zcloud/service/hiddenApi/impl/HiddenApiServiceImpl.java index 050e7348..bba2bf79 100644 --- a/src/main/java/com/zcloud/service/hiddenApi/impl/HiddenApiServiceImpl.java +++ b/src/main/java/com/zcloud/service/hiddenApi/impl/HiddenApiServiceImpl.java @@ -16,6 +16,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -271,5 +272,109 @@ public class HiddenApiServiceImpl implements HiddenApiService{ public List getListAll (PageData pd) throws Exception{ return hiddenApiMapper.getListAll(pd); } + + public List goSummaryTable (PageData pd) throws Exception{ + return hiddenApiMapper.goSummaryTable(pd); + } + + public List listForExcel (PageData pd) throws Exception{ + return hiddenApiMapper.listForExcel(pd); + } + + public List dealData (List pdList) throws Exception{ + ArrayList varList = new ArrayList<>(); + PageData pd1 = new PageData(); + pd1.put("MONTH","1月"); + PageData pd2 = new PageData(); + pd2.put("MONTH","2月"); + PageData pd3 = new PageData(); + pd3.put("MONTH","3月"); + PageData pd4 = new PageData(); + pd4.put("MONTH","4月"); + PageData pd5 = new PageData(); + pd5.put("MONTH","5月"); + PageData pd6 = new PageData(); + pd6.put("MONTH","6月"); + PageData pd7 = new PageData(); + pd7.put("MONTH","7月"); + PageData pd8 = new PageData(); + pd8.put("MONTH","8月"); + PageData pd9 = new PageData(); + pd9.put("MONTH","9月"); + PageData pd10 = new PageData(); + pd10.put("MONTH","10月"); + PageData pd11 = new PageData(); + pd11.put("MONTH","11月"); + PageData pd12 = new PageData(); + pd12.put("MONTH","12月"); + for (int i = 0;i + + and hreg.HIDDENREGION_ID LIKE CONCAT(CONCAT('%', #{hiddenpart}),'%') + + + and f.CONFIRM_USER = #{CONFIRM_USER} + + + and f.STATE in('1','-1','10') + + + and f.RECTIFICATIONOR = #{SELFUSERID} + + + and f.STATE ='2' + + + and f.STATE = '2' + and (select count(1) from BUS_HIDDENCHECK bh where bh.HIDDEN_ID=f.HIDDEN_ID and bh.USER_ID=#{checkUser} )>0 + + GROUP BY f.HIDDEN_ID + order by FIELD ( f.STATE, '-2' ) desc, + f.DISCOVERYTIME desc + + + + + + +