From 9305554e857330d071e154d3cf075ca5196fa2cf Mon Sep 17 00:00:00 2001 From: fkf <1475794025@qq.com> Date: Thu, 28 Sep 2023 17:45:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E3=80=81=E7=94=B5=E7=AB=99=E5=8F=8A=E7=94=B5?= =?UTF-8?q?=E7=AB=99=E6=8A=A5=E8=A1=A8=EF=BC=8Csql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/databases/table_create_gf.sql | 55 +++ .../gf/api/orderindex/OrderIndexDb.java | 64 ++++ .../gf/biz/orderindex/OrderIndexMapper.java | 13 + .../gf/biz/orderindex/OrderIndexRest.java | 36 ++ .../gf/biz/orderindex/OrderIndexService.java | 318 ++++++++++++++++++ .../gf/biz/orderindex/OrdexIndexMapper.xml | 4 + .../gf/biz/outstock/OutStockService.java | 33 +- .../yxt/supervise/gf/shanhai/ShRequester.java | 111 ++++++ .../supervise/gf/shanhai/req/Order_Index.java | 17 + .../supervise/gf/shanhai/resp/OrderIndex.java | 58 ++++ .../gf/shanhai/resp/StatisticGroupArea.java | 20 ++ .../gf/shanhai/resp/StatisticGroupDataid.java | 16 + .../gf/shanhai/resp/StatisticGroupNode.java | 15 + .../shanhai/timedtask/ShanHaiTimedTask.java | 98 +++++- 14 files changed, 830 insertions(+), 28 deletions(-) create mode 100644 yxt-supervise-gf-api/src/main/java/com/yxt/supervise/gf/api/orderindex/OrderIndexDb.java create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexMapper.java create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexRest.java create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexService.java create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrdexIndexMapper.xml create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/req/Order_Index.java create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/OrderIndex.java create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupArea.java create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupDataid.java create mode 100644 yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupNode.java diff --git a/docs/databases/table_create_gf.sql b/docs/databases/table_create_gf.sql index 4cc8c58..fd943aa 100644 --- a/docs/databases/table_create_gf.sql +++ b/docs/databases/table_create_gf.sql @@ -350,3 +350,58 @@ CREATE TABLE `warehouse information` ( ) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '仓库信息表' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; + +-- ---------------------------- +-- Table structure for order_index +-- ---------------------------- +DROP TABLE IF EXISTS `order_index`; +CREATE TABLE `order_index` ( + `id` int(164) NULL DEFAULT NULL COMMENT 'id', + `order_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `admin_id` int(164) NULL DEFAULT NULL, + `customer_id` int(164) NULL DEFAULT NULL, + `agent_id` int(164) NULL DEFAULT NULL, + `product_id` int(164) NULL DEFAULT NULL, + `create_time` int(164) NULL DEFAULT NULL, + `data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `workflow_unique` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `prototype_id` int(164) NULL DEFAULT NULL, + `remain_unique` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `is_best` int(164) NULL DEFAULT NULL, + `order_type` int(164) NULL DEFAULT NULL, + `update_time` int(164) NULL DEFAULT NULL, + `company_id` int(164) NULL DEFAULT NULL, + `dg_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `contract_life` int(164) NULL DEFAULT NULL, + `contract_group` int(164) NULL DEFAULT NULL, + `agent_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `area_id` int(164) NULL DEFAULT NULL, + `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `component_number` int(164) NULL DEFAULT NULL, + `component_power` int(164) NULL DEFAULT NULL, + `admin_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `admin_phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `user_phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `id_card` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `product_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `workflow_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `node_id` int(164) NULL DEFAULT NULL, + `is_agree` int(164) NULL DEFAULT NULL, + `group_id` int(164) NULL DEFAULT NULL, + `sign` int(164) NULL DEFAULT NULL, + `uplode_contract` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `company_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `province_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `city_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `area_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `assets_no` int(164) NULL DEFAULT NULL, + `change_order_id` int(164) NULL DEFAULT NULL, + `p_agent_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `all_power` int(164) NULL DEFAULT NULL, + `order_type_text` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `is_save` int(164) NULL DEFAULT NULL, + `time` varchar(164) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据导入时间' +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/yxt-supervise-gf-api/src/main/java/com/yxt/supervise/gf/api/orderindex/OrderIndexDb.java b/yxt-supervise-gf-api/src/main/java/com/yxt/supervise/gf/api/orderindex/OrderIndexDb.java new file mode 100644 index 0000000..1967408 --- /dev/null +++ b/yxt-supervise-gf-api/src/main/java/com/yxt/supervise/gf/api/orderindex/OrderIndexDb.java @@ -0,0 +1,64 @@ +package com.yxt.supervise.gf.api.orderindex; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @author feikefei + * @create 2023-09-21-13:58 + */ +@Data +@ApiModel(value = "电站返回对象") +@TableName("order_index") +public class OrderIndexDb { + @TableId(value = "id",type = IdType.INPUT) + private Integer id; + private String order_no; + private Integer admin_id; + private Integer customer_id; + private Integer agent_id; + private Integer product_id; + private Integer create_time; + private String data_id; + private String workflow_unique; + private Integer prototype_id; + private String remain_unique; + private Integer is_best; + private Integer order_type; + private Integer update_time; + private Integer company_id; + private String dg_name; + private Integer contract_life; + private Integer contract_group; + private String agent_name; + private Integer area_id; + private String address; + private Integer component_number; + private Integer component_power; + private String admin_name; + private String admin_phone; + private String user_name; + private String user_phone; + private String id_card; + private String product_name; + private String workflow_name; + private Integer node_id; + private Integer is_agree; + private Integer group_id; + private Integer sign; + private String uplode_contract; + private String company_name; + private String province_name; + private String city_name; + private String area_name; + private Integer assets_no; + private Integer change_order_id; + private String p_agent_name; + private String all_power; + private String order_type_text; + private Integer is_save; + private String time; +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexMapper.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexMapper.java new file mode 100644 index 0000000..67b4693 --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexMapper.java @@ -0,0 +1,13 @@ +package com.yxt.supervise.gf.biz.orderindex; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.yxt.supervise.gf.api.orderindex.OrderIndexDb; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author feikefei + * @create 2023-09-25-16:54 + */ +@Mapper +public interface OrderIndexMapper extends BaseMapper { +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexRest.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexRest.java new file mode 100644 index 0000000..3c81241 --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexRest.java @@ -0,0 +1,36 @@ +package com.yxt.supervise.gf.biz.orderindex; + +import com.yxt.common.core.result.ResultBean; +import com.yxt.supervise.gf.shanhai.ShRequester; +import com.yxt.supervise.gf.shanhai.req.Order_Index; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @author feikefei + * @create 2023-09-25-16:44 + */ +@Api(value = "电站") +@RestController +@RequestMapping("gf/powerStation") +public class OrderIndexRest { + + @Autowired + private OrderIndexService orderIndexService; + + /** + * @Description //描述: group_id 7开发投资 8新增进件审核 9储备发货 10电站施工 11电站并网 12现场验收 13电站运营 group_id:{}有效电站 + * @Param [order_index] + * @return com.yxt.common.core.result.ResultBean + **/ + @PostMapping("/save") + public ResultBean save(@RequestBody Order_Index order_index){ + return orderIndexService.save(order_index); + } + + @GetMapping("/test") + public void excel(@RequestBody Order_Index order_index){ + orderIndexService.selectData(order_index); + } +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexService.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexService.java new file mode 100644 index 0000000..670af72 --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrderIndexService.java @@ -0,0 +1,318 @@ +package com.yxt.supervise.gf.biz.orderindex; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yxt.common.base.utils.DateUtils; +import com.yxt.common.core.result.ResultBean; +import com.yxt.supervise.gf.api.orderindex.OrderIndexDb; +import com.yxt.supervise.gf.shanhai.ShRequester; +import com.yxt.supervise.gf.shanhai.req.Order_Index; +import com.yxt.supervise.gf.shanhai.resp.*; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellAddress; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author feikefei + * @create 2023-09-25-16:53 + */ +@Service +public class OrderIndexService extends ServiceImpl { + + @Value("${import.filePath}") + private String filePath; + + public ResultBean save(Order_Index order_index) { + ResultBean rb = ResultBean.fireFail(); + String date = DateUtil.format(new Date(), "yyyy-MM-dd"); + BaseResponse> api$system$order$index = ShRequester.getApi$system$order$index(order_index); + List list = api$system$order$index.getData().getList(); + for (OrderIndex orderIndex : list) { + OrderIndexDb orderIndex1 = new OrderIndexDb(); + BeanUtil.copyProperties(orderIndex, orderIndex1); + orderIndex1.setTime(date); + baseMapper.insert(orderIndex1); + } + return rb.success().setMsg("添加成功"); + } + + /** + * @return void + * @Description //描述: 查询电站相关数据 + * @Param [order_index] + **/ + public void selectData(Order_Index order_index) { + //查询开发投资数据 + List kfsz = baseMapper.selectList(getQueryWrapper(order_index.getSearch_time()).eq("group_id", 7)); + List jjsh = baseMapper.selectList(getQueryWrapper(order_index.getSearch_time()).eq("group_id", 8)); + List cbfh = baseMapper.selectList(getQueryWrapper(order_index.getSearch_time()).eq("group_id", 9)); + List dzsg = baseMapper.selectList(getQueryWrapper(order_index.getSearch_time()).eq("group_id", 10)); + List dzbw = baseMapper.selectList(getQueryWrapper(order_index.getSearch_time()).eq("group_id", 11)); + List xcys = baseMapper.selectList(getQueryWrapper(order_index.getSearch_time()).eq("group_id", 12)); + List dzyy = baseMapper.selectList(getQueryWrapper(order_index.getSearch_time()).eq("group_id", 13)); + exportExcel(kfsz,jjsh,cbfh,dzsg,dzbw,xcys,dzyy); + } + + /** + * @return com.baomidou.mybatisplus.core.conditions.query.QueryWrapper + * @Description //描述: 公共方法 + * @Param [search_time] + **/ + private QueryWrapper getQueryWrapper(String[] search_time) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date dateFirst = null; + Date dateLast = null; + try { + dateFirst = sdf.parse(search_time[0]); + dateLast = sdf.parse(search_time[1]); + } catch (Exception e) { + e.printStackTrace(); + } + long dateFirstTime = dateFirst.getTime() / 1000; + long dateLastTime = dateLast.getTime() / 1000; + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.ge("create_time", dateFirstTime).le("create_time", dateLastTime); + return wrapper; + } + + public void exportExcel(List kfsz,List jjsh,List cbfh,List dzsg,List dzbw,List xcys,List dzyy){ + Calendar calendar=Calendar.getInstance(); + int month=calendar.get(Calendar.MONTH); + calendar.set(Calendar.MONTH, month-1); + calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); + Date endTime = calendar.getTime(); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat sdf11 = new SimpleDateFormat("yyyy/MM/dd"); + Date date = new Date(); + XSSFWorkbook wb = new XSSFWorkbook(); + Map> collect = null; + //设置sheet名称,并创建新的sheet对象 + Sheet stuSheet = wb.createSheet(); + stuSheet.autoSizeColumn(0); + //合并单元格 设置表头信息 + Row headRow = stuSheet.createRow(0); //第一行为头 + Font head1 = wb.createFont(); + head1.setFontHeightInPoints((short) 25); + CellStyle cellStyle = wb.createCellStyle(); + cellStyle.setFont(head1); + cellStyle.setAlignment(HorizontalAlignment.CENTER); //设置水平对齐方式 + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + CellRangeAddress callRangeAddress = new CellRangeAddress(0, 0, 0, 19); + Cell cell1 = headRow.createCell(0); + cell1.setCellStyle(cellStyle); + cell1.setCellValue("项目各流程通过数据表"); + stuSheet.addMergedRegion(callRangeAddress); + Row createTimeRow = stuSheet.createRow(1); + Font head11 = wb.createFont(); + head11.setFontHeightInPoints((short) 15); + CellStyle cellStyle1 = wb.createCellStyle(); + cellStyle1.setFont(head11); + cellStyle1.setAlignment(HorizontalAlignment.CENTER); //设置水平对齐方式 + cellStyle1.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + CellRangeAddress callRangeAddressOne = new CellRangeAddress(1, 1, 0, 17); + Cell cellTime = createTimeRow.createCell(0); + cellTime.setCellStyle(cellStyle1); + cellTime.setCellValue("数据截止日期:" + sdf.format(DateUtil.offsetDay(date, -1)) + " " + "制表时间:" + sdf1.format(date)); + stuSheet.addMergedRegion(callRangeAddressOne); + Row DataTitleRow = stuSheet.createRow(2); + CellRangeAddress callRangeAddressTwo = new CellRangeAddress(2, 3, 0, 0); + CellRangeAddress callRangeAddressTwo1 = new CellRangeAddress(2, 3, 1, 1); + Cell cellTitle = DataTitleRow.createCell(0); + cellTitle.setCellStyle(cellStyle1); + cellTitle.setCellValue("流程"); + stuSheet.addMergedRegion(callRangeAddressTwo); + Cell cellTitleOne = DataTitleRow.createCell(1); + cellTitleOne.setCellStyle(cellStyle1); + cellTitleOne.setCellValue("日期\\数据"); + stuSheet.addMergedRegion(callRangeAddressTwo1); + int j = 0; + String[] head = new String[]{"总数据", "户用合计", "安阳户用", "庄河户用", "曲阜户用", "工商业合计", "安阳工商业", "庄河工商业", "曲阜工商业"}; + Row DataTitleRowTitle = stuSheet.createRow(3); + for (String s : head) { + CellRangeAddress callHead = new CellRangeAddress(2, 2, 2+j, 3+j); + Cell cell = DataTitleRow.createCell(2+j); + cell.setCellValue(s); + cell.setCellStyle(cellStyle1); + stuSheet.addMergedRegion(callHead); + Cell cell2 = DataTitleRowTitle.createCell(2+j); + cell2.setCellValue("户数"); + cell2.setCellStyle(cellStyle1); + Cell cell22 = DataTitleRowTitle.createCell(3+j); + cell22.setCellValue("功率"); + cell22.setCellStyle(cellStyle1); + j=j+2; + } + int i = 0;int k = 0; + String[] leftHead = new String[]{"开发收资", "进件审核", "储备发货", "电站施工", "电站并网", "现场验收", "电站运营"}; + Font headLeft = wb.createFont(); + headLeft.setFontHeightInPoints((short) 18); + CellStyle cellStyleLeft = wb.createCellStyle(); + cellStyleLeft.setFont(headLeft); + cellStyleLeft.setRotation((short) 255); + cellStyleLeft.setAlignment(HorizontalAlignment.CENTER); //设置水平对齐方式 + cellStyleLeft.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 + for (String s : leftHead) { + Row leftTitleRowTitle = stuSheet.createRow(4+i); + leftTitleRowTitle.setHeight((short) 600); + CellRangeAddress leftCallHead = new CellRangeAddress(4+i, 7+i,0,0); + Cell cell = leftTitleRowTitle.createCell(0); + cell.setCellValue(s); + cell.setCellStyle(cellStyleLeft); + stuSheet.addMergedRegion(leftCallHead); + Cell cellTwo = leftTitleRowTitle.createCell(1); + cellTwo.setCellValue("累计"); + cellTwo.setCellStyle(cellStyle1); + Cell cellTwoData = null; + switch (i){ + case 0: + collect = kfsz.stream().collect(Collectors.groupingBy(it -> it.getOrder_type_text())); + break; + case 4: + collect = jjsh.stream().collect(Collectors.groupingBy(it -> it.getOrder_type_text())); + break; + case 8: + collect = dzsg.stream().collect(Collectors.groupingBy(it -> it.getOrder_type_text())); + break; + case 12: + collect = dzbw.stream().collect(Collectors.groupingBy(it -> it.getOrder_type_text())); + break; + case 16: + collect = xcys.stream().collect(Collectors.groupingBy(it -> it.getOrder_type_text())); + break; + case 20: + collect = dzyy.stream().collect(Collectors.groupingBy(it -> it.getOrder_type_text())); + break; + } + cellTwoData = leftTitleRowTitle.createCell(2); + long h = collect.get("户用") == null ? 0 : (long) collect.get("户用").size(); + long g = collect.get("工商业") == null ? 0 : (long) collect.get("工商业").size(); + cellTwoData.setCellValue(h+g); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(3); + long hg = collect.get("户用") == null ? 0 : (long) collect.get("户用").stream().mapToInt(it -> Integer.parseInt(it.getAll_power())).sum(); + long gg = collect.get("工商业") == null ? 0 : (long) collect.get("工商业").stream().mapToInt(it -> Integer.parseInt(it.getAll_power())).sum(); + cellTwoData.setCellValue(hg+gg); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(4); + cellTwoData.setCellValue(h); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(5); + cellTwoData.setCellValue(hg); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(6); + List list = collect.get("户用") == null ? null : collect.get("户用"); + List listG = collect.get("工商业") == null ? null : collect.get("工商业"); + long ha = 0;int hag = 0;long hz = 0;int hzg = 0;long hq = 0;int hqg = 0; + if (list != null){ + ha = list.stream().filter(it -> it.getData_id().contains("安阳")).count(); + hag = list.stream().filter(it -> it.getData_id().contains("安阳")).mapToInt(it -> Integer.parseInt(it.getAll_power())).sum(); + hz = list.stream().filter(it -> it.getData_id().contains("庄河")).count(); + hzg = list.stream().filter(it -> it.getData_id().contains("庄河")).mapToInt(it -> Integer.parseInt(it.getAll_power())).sum(); + hq = list.stream().filter(it -> it.getData_id().contains("曲阜")).count(); + hqg = list.stream().filter(it -> it.getData_id().contains("曲阜")).mapToInt(it -> Integer.parseInt(it.getAll_power())).sum(); + + } + long ga = 0;int gag = 0;long gz = 0;int gzg = 0;long gq = 0;int gqg = 0; + if (listG != null){ + ga = listG.stream().filter(it -> it.getData_id().contains("安阳")).count(); + gag = listG.stream().filter(it -> it.getData_id().contains("安阳")).mapToInt(it -> Integer.parseInt(it.getAll_power())).sum(); + gz = listG.stream().filter(it -> it.getData_id().contains("庄河")).count(); + gzg = listG.stream().filter(it -> it.getData_id().contains("庄河")).mapToInt(it -> Integer.parseInt(it.getAll_power())).sum(); + gq = listG.stream().filter(it -> it.getData_id().contains("曲阜")).count(); + gqg = listG.stream().filter(it -> it.getData_id().contains("曲阜")).mapToInt(it -> Integer.parseInt(it.getAll_power())).sum(); + + } + cellTwoData.setCellValue(ha); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(7); + cellTwoData.setCellValue(hag); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(8); + cellTwoData.setCellValue(hz); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(9); + cellTwoData.setCellValue(hzg); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(10); + cellTwoData.setCellValue(hq); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(11); + cellTwoData.setCellValue(hqg); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(12); + cellTwoData.setCellValue(g); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(13); + cellTwoData.setCellValue(gg); + cellTwoData.setCellStyle(cellStyle1); + + cellTwoData = leftTitleRowTitle.createCell(14); + cellTwoData.setCellValue(ga); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(15); + cellTwoData.setCellValue(gag); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(16); + cellTwoData.setCellValue(gz); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(17); + cellTwoData.setCellValue(gzg); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(18); + cellTwoData.setCellValue(gq); + cellTwoData.setCellStyle(cellStyle1); + cellTwoData = leftTitleRowTitle.createCell(19); + cellTwoData.setCellValue(gqg); + cellTwoData.setCellStyle(cellStyle1); + Row leftTitleRowTitleTwo = stuSheet.createRow(5+k); + leftTitleRowTitleTwo.setHeight((short) 600); + Cell cellTwo1 = leftTitleRowTitleTwo.createCell(1); + cellTwo1.setCellValue(sdf.format(endTime).split("-")[1]+"月"); + cellTwo1.setCellStyle(cellStyle1); + k++; + Row leftTitleRowTitleTwo1 = stuSheet.createRow(5+k); + leftTitleRowTitleTwo1.setHeight((short) 600); + Cell cellTwo11 = leftTitleRowTitleTwo1.createCell(1); + cellTwo11.setCellValue("第35周"); + cellTwo11.setCellStyle(cellStyle1); + k++; + Row leftTitleRowTitleTwo11 = stuSheet.createRow(5+k); + leftTitleRowTitleTwo11.setHeight((short) 600); + Cell cellTwo111 = leftTitleRowTitleTwo11.createCell(1); + cellTwo111.setCellValue(sdf11.format(endTime).split("/")[1]+"/"+sdf11.format(endTime).split("/")[2]); + cellTwo111.setCellStyle(cellStyle1); + k=k+2; + i=i+4; + } + File file = new File(filePath); + if (!file.exists()) { + file.mkdirs(); + } + //设置文件名 + String fileName = "货物入库质押表" + sdf.format(new Date()) + ".xlsx"; + + String savePath = filePath + File.separator + fileName; + //下载 + try { + OutputStream fileOut = new FileOutputStream(savePath); + wb.write(fileOut); + fileOut.close(); + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrdexIndexMapper.xml b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrdexIndexMapper.xml new file mode 100644 index 0000000..099969b --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/orderindex/OrdexIndexMapper.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/outstock/OutStockService.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/outstock/OutStockService.java index c7c9c36..2c498d9 100644 --- a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/outstock/OutStockService.java +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/biz/outstock/OutStockService.java @@ -158,8 +158,6 @@ public class OutStockService extends ServiceImpl { cellStylehz.setAlignment(HorizontalAlignment.CENTER); //设置水平对齐方式 cellStylehz.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 CellRangeAddress callRangeAddress22 = new CellRangeAddress(0,0,0,collectHead.length-1); - CellRangeAddress callRangeAddress1g = new CellRangeAddress(1,1,0,collectHead.length-1); - CellRangeAddress callRangeAddress2 = new CellRangeAddress(2,2,0,collectHead.length-1); Cell cell15 = headRow1.createCell(0); cell15.setCellStyle(cellStylehz); if (state == 0){ @@ -169,17 +167,8 @@ public class OutStockService extends ServiceImpl { } stuSheet1.addMergedRegion(callRangeAddress22); - Row headRowOnehz = stuSheet1.createRow(1); - Cell headCellhz = headRowOnehz.createCell(0); - headCellhz.setCellValue("编号:"); - stuSheet1.addMergedRegion(callRangeAddress1g); - Row headRowTwohz = stuSheet1.createRow(2); - Cell headCellTwohz = headRowTwohz.createCell(0); - headCellTwohz.setCellValue("上报日期:" + sdf1.format(date)); - stuSheet1.addMergedRegion(callRangeAddress2); - //获取表头行 - Row titleRowhz = stuSheet1.createRow(3); + Row titleRowhz = stuSheet1.createRow(1); CellStyle stylehz = wb.createCellStyle(); Font font = wb.createFont(); font.setFontHeightInPoints((short) 16); @@ -212,7 +201,7 @@ public class OutStockService extends ServiceImpl { Double countSum = 0.0; for (int i = 0; i < listMap1.size(); i++) { //创建list.size()行数据 - rowh = stuSheet1.createRow(i + 4); + rowh = stuSheet1.createRow(i + 2); rowh.setHeightInPoints(25); //把值一一写进单元格里 //设置第一列为自动递增的序号 @@ -233,7 +222,7 @@ public class OutStockService extends ServiceImpl { cell2h.setCellStyle(dataStyle1); } font.setFontHeightInPoints((short) 14); - Row row1h = stuSheet1.createRow(listMap1.size()+4); + Row row1h = stuSheet1.createRow(listMap1.size()+2); row1h.setHeightInPoints(25); CellStyle style111 = wb.createCellStyle(); style111.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 @@ -287,21 +276,11 @@ public class OutStockService extends ServiceImpl { cell1.setCellValue("质物解除质押出库汇总表"); } stuSheet.addMergedRegion(callRangeAddress); - Row headRowOne = stuSheet.createRow(1); - Cell headCell = headRowOne.createCell(0); - headCell.setCellValue("编号:"); - Cell headCell1 = headRowOne.createCell(8); - headCell1.setCellValue("仓库名称:" + stringListEntry.getKey()); - CellRangeAddress callRangeAddress1 = new CellRangeAddress(2,2,0,head.length-1); - Row headRowTwo = stuSheet.createRow(2); - Cell headCellTwo = headRowTwo.createCell(0); - headCellTwo.setCellValue("上报日期:" + sdf1.format(date)); - stuSheet.addMergedRegion(callRangeAddress1); //设置表头字体大小 Font font1 = wb.createFont(); font1.setFontHeightInPoints((short) 16); //获取表头行 - Row titleRow = stuSheet.createRow(3); + Row titleRow = stuSheet.createRow(1); //创建单元格,设置style居中,字体,单元格大小等 CellStyle style = wb.createCellStyle(); style.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 @@ -339,7 +318,7 @@ public class OutStockService extends ServiceImpl { recordMaterielList = new ObjectMapper().convertValue(stringListEntry.getValue().get(i), RecordMaterielList.class); } //创建list.size()行数据 - row = stuSheet.createRow(i + 4); + row = stuSheet.createRow(i + 2); row.setHeightInPoints(25); //把值一一写进单元格里 //设置第一列为自动递增的序号 @@ -405,7 +384,7 @@ public class OutStockService extends ServiceImpl { Font fontq = wb.createFont(); fontq.setFontHeightInPoints((short) 14); - Row row1 = stuSheet.createRow(stringListEntry.getValue().size()+4); + Row row1 = stuSheet.createRow(stringListEntry.getValue().size()+2); CellStyle style11 = wb.createCellStyle(); style11.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐方式 style11.setAlignment(HorizontalAlignment.CENTER); diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShRequester.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShRequester.java index 984800a..80a759f 100644 --- a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShRequester.java +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/ShRequester.java @@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.yxt.supervise.gf.shanhai.req.*; import com.yxt.supervise.gf.shanhai.resp.*; +import org.springframework.web.bind.annotation.RequestBody; import java.util.ArrayList; import java.util.HashMap; @@ -44,6 +45,12 @@ public class ShRequester { private static String in_stock$get_type = "/api/system/in_stock/get_type"; //29.获取入库类型 private static String search$get_agent_list = "/api/system/search/get_agent_list"; //30.获取代理商 private static String out_stock$get_status = "/api/system/out_stock/get_status"; //31.获取审核状态 + + private static String order$index = "/api/system/order/index" ;//32.获取开发投资列表 + private static String statistic$group_new_data = "/api/system/statistic/group_new_data"; //33.有效电站量 + private static String statistic$group_area = "/api/system/statistic/group_area"; //34.各地区电站对比 + private static String statistic$group_node = "/api/system/statistic/group_node"; //35.节点占比 + private static String statistic$group_dataid = "/api/system/statistic/group_dataid"; //36.项目占比 /** * 1.待配货列表 * @@ -670,6 +677,110 @@ public class ShRequester { return resp; } + /** + * @Description //描述: 32. 开发投资列表 + * @Param [order_index] group_id 7开发投资 8新增进件审核 9储备发货 10电站施工 11电站并网 12现场验收 13电站运营 group_id:{}有效电站 + * @return com.yxt.supervise.gf.shanhai.resp.BaseResponse> + **/ + public static BaseResponse> getApi$system$order$index(Order_Index order_index){ + BaseResponse> req = new BaseResponse<>(); + BaseResponseListObj reqObj = new BaseResponseListObj<>(); + order_index.setPage("1"); + order_index.setLimit("100"); + Map param = BeanUtil.beanToMap(order_index); + String s = ShHttp.dopost(order$index, param); + BaseResponse> baseResponse = toBean(s, req, reqObj); + List list = baseResponse.getData().getList(); + List orderIndices = new ArrayList<>(); + for (JSONObject jsonObject : list) { + OrderIndex orderIndex = JSONUtil.toBean(jsonObject, OrderIndex.class); + orderIndices.add(orderIndex); + } + reqObj.setList(orderIndices); + req.setData(reqObj); + return req; + } + + /** + * @Description //描述: 33. 有效电站量 + * @Param [group_id] + * @return com.yxt.supervise.gf.shanhai.resp.BaseResponse + **/ + public static BaseResponse getApi$system$statistic$group_new_data(String group_id){ + BaseResponse resp = new BaseResponse<>(); + Map stringObjectMap = BeanUtil.beanToMap(group_id); + String s = ShHttp.dopost(statistic$group_new_data, stringObjectMap); + JSONObject jsonObject = JSONUtil.parseObj(s); + String code = jsonObject.get("code").toString(); + String msg = jsonObject.get("msg").toString(); + resp.setCode(Integer.parseInt(code)); + resp.setMsg(msg); + resp.setData(jsonObject.get("data")); + return resp; + } + + /** + * @Description //描述: 34.各地区电站对比 + * @Param [group_id] + * @return com.yxt.supervise.gf.shanhai.resp.BaseResponse + **/ + public static BaseResponse getApi$system$statistic$group_area(String group_id){ + BaseResponse resp = new BaseResponse<>(); + Map params = BeanUtil.beanToMap(group_id); + String s = ShHttp.dopost(statistic$group_area, params); + JSONObject jsonObject = JSONUtil.parseObj(s); + String code = jsonObject.get("code").toString(); + String msg = jsonObject.get("msg").toString(); + resp.setCode(Integer.parseInt(code)); + resp.setMsg(msg); + Boolean a = jsonObject.get("data").toString().equals("null") || jsonObject.get("data") == null; + JSONObject data = a ? null : (JSONObject)jsonObject.get("data"); + StatisticGroupArea statisticGroupArea = JSONUtil.toBean(data, StatisticGroupArea.class); + resp.setData(statisticGroupArea); + return resp; + } + + /** + * @Description //描述: 35.节点占比 + * @Param [group_id] + * @return com.yxt.supervise.gf.shanhai.resp.BaseResponse + **/ + public static BaseResponse getApi$system$statistic$group_node(String group_id){ + BaseResponse resp = new BaseResponse<>(); + Map params = BeanUtil.beanToMap(group_id); + String s = ShHttp.dopost(statistic$group_node, params); + JSONObject jsonObject = JSONUtil.parseObj(s); + String code = jsonObject.get("code").toString(); + String msg = jsonObject.get("msg").toString(); + resp.setCode(Integer.parseInt(code)); + resp.setMsg(msg); + Boolean a = jsonObject.get("data").toString().equals("null") || jsonObject.get("data") == null; + JSONObject data = a ? null : (JSONObject)jsonObject.get("data"); + StatisticGroupNode statisticGroupNode = JSONUtil.toBean(data, StatisticGroupNode.class); + resp.setData(statisticGroupNode); + return resp; + } + + /** + * @Description //描述: 36.项目占比 + * @Param [group_id] + * @return com.yxt.supervise.gf.shanhai.resp.BaseResponse + **/ + public static BaseResponse getApi$system$statistic$group_dataid(String group_id){ + BaseResponse resp = new BaseResponse<>(); + Map params = BeanUtil.beanToMap(group_id); + String s = ShHttp.dopost(statistic$group_dataid, params); + JSONObject jsonObject = JSONUtil.parseObj(s); + String code = jsonObject.get("code").toString(); + String msg = jsonObject.get("msg").toString(); + resp.setCode(Integer.parseInt(code)); + resp.setMsg(msg); + Boolean a = jsonObject.get("data").toString().equals("null") || jsonObject.get("data") == null; + JSONObject data = a ? null : (JSONObject)jsonObject.get("data"); + StatisticGroupDataid statisticGroupDataid = JSONUtil.toBean(data, StatisticGroupDataid.class); + resp.setData(statisticGroupDataid); + return resp; + } /** * @Description //描述: 将Json格式数据封装成统一返回对象 diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/req/Order_Index.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/req/Order_Index.java new file mode 100644 index 0000000..b5e1d3d --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/req/Order_Index.java @@ -0,0 +1,17 @@ +package com.yxt.supervise.gf.shanhai.req; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @author feikefei + * @create 2023-09-21-13:52 + */ +@Data +@ApiModel(value = "开发投资") +public class Order_Index { + private String page; + private String limit; + private String group_id; + private String[] search_time; +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/OrderIndex.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/OrderIndex.java new file mode 100644 index 0000000..4f4029c --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/OrderIndex.java @@ -0,0 +1,58 @@ +package com.yxt.supervise.gf.shanhai.resp; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @author feikefei + * @create 2023-09-21-13:58 + */ +@Data +@ApiModel(value = "开发投资") +public class OrderIndex { + private Integer id; + private String order_no; + private Integer admin_id; + private Integer customer_id; + private Integer agent_id; + private Integer product_id; + private Integer create_time; + private String data_id; + private String workflow_unique; + private Integer prototype_id; + private String remain_unique; + private Integer is_best; + private Integer order_type; + private Integer update_time; + private Integer company_id; + private String dg_name; + private Integer contract_life; + private Integer contract_group; + private String agent_name; + private Integer area_id; + private String address; + private Integer component_number; + private Integer component_power; + private String admin_name; + private String admin_phone; + private String user_name; + private String user_phone; + private String id_card; + private String product_name; + private String workflow_name; + private Integer node_id; + private Integer is_agree; + private Integer group_id; + private Integer sign; + private String uplode_contract; + private String company_name; + private String province_name; + private String city_name; + private String area_name; + private Integer assets_no; + private Integer change_order_id; + private String p_agent_name; + private String all_power; + private String order_type_text; + private Integer is_save; +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupArea.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupArea.java new file mode 100644 index 0000000..f39d03e --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupArea.java @@ -0,0 +1,20 @@ +package com.yxt.supervise.gf.shanhai.resp; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @author feikefei + * @create 2023-09-21-14:47 + */ +@Data +@ApiModel(value = "各地区电站对比") +public class StatisticGroupArea { + private String name; + private String level; + private String parent_code; + private String area_id; + private String count; + private String all_power; + private String power; +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupDataid.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupDataid.java new file mode 100644 index 0000000..0208b8d --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupDataid.java @@ -0,0 +1,16 @@ +package com.yxt.supervise.gf.shanhai.resp; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @author feikefei + * @create 2023-09-21-15:10 + */ +@Data +@ApiModel(value = "项目占比") +public class StatisticGroupDataid { + private String count; + private String name; + private String data_id; +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupNode.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupNode.java new file mode 100644 index 0000000..8519198 --- /dev/null +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/resp/StatisticGroupNode.java @@ -0,0 +1,15 @@ +package com.yxt.supervise.gf.shanhai.resp; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @author feikefei + * @create 2023-09-21-15:01 + */ +@Data +@ApiModel(value = "节点占比") +public class StatisticGroupNode { + private String name; + private String count; +} diff --git a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/timedtask/ShanHaiTimedTask.java b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/timedtask/ShanHaiTimedTask.java index d164dbf..ad4452c 100644 --- a/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/timedtask/ShanHaiTimedTask.java +++ b/yxt-supervise-gf-biz/src/main/java/com/yxt/supervise/gf/shanhai/timedtask/ShanHaiTimedTask.java @@ -1,18 +1,25 @@ package com.yxt.supervise.gf.shanhai.timedtask; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.thread.ThreadUtil; -import com.yxt.common.core.result.ResultBean; +import com.yxt.common.base.utils.DateUtils; import com.yxt.supervise.gf.biz.instock.InStockService; import com.yxt.supervise.gf.biz.inventory.InventoryService; +import com.yxt.supervise.gf.biz.orderindex.OrderIndexService; import com.yxt.supervise.gf.biz.outstock.OutStockService; import com.yxt.supervise.gf.shanhai.req.In_stockGetRecordMaterielList; import com.yxt.supervise.gf.shanhai.req.InventoryIndex; +import com.yxt.supervise.gf.shanhai.req.Order_Index; import com.yxt.supervise.gf.shanhai.req.Out_stockGetRecordMaterielList; import io.swagger.annotations.ApiModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import java.util.Calendar; +import java.util.Date; + /** * @author feikefei * @create 2023-07-13-11:44 @@ -27,6 +34,8 @@ public class ShanHaiTimedTask { private InStockService inStockService; @Autowired private OutStockService outStockService; + @Autowired + private OrderIndexService orderIndexService; /** * @Description //描述: 定时抓取并添加数据到本地库存管理信息 @@ -59,4 +68,91 @@ public class ShanHaiTimedTask { Out_stockGetRecordMaterielList list = new Out_stockGetRecordMaterielList(); outStockService.save(list); } + + /** + * @Description //描述: 定时抓取电站数据到本地库 + * @Param [] group_id 7开发投资 8新增进件审核 9储备发货 10电站施工 11电站并网 12现场验收 13电站运营 + * @return void 每月一号一点抓取上一个月的数据 + **/ +// @Scheduled(cron = "0 0 1 1 * ?") + public void orderIndexSaveTimedTask(){ + String[] month = getMonth(new Date()); + ThreadUtil.execute(() -> { + Order_Index order_index = new Order_Index(); + order_index.setLimit("1000"); + order_index.setPage("1"); + order_index.setGroup_id("7"); + order_index.setSearch_time(month); + orderIndexService.save(order_index); + }); + ThreadUtil.execute(() -> { + Order_Index order_index = new Order_Index(); + order_index.setLimit("1000"); + order_index.setPage("1"); + order_index.setGroup_id("8"); + order_index.setSearch_time(month); + orderIndexService.save(order_index); + }); + ThreadUtil.execute(() -> { + Order_Index order_index = new Order_Index(); + order_index.setLimit("1000"); + order_index.setPage("1"); + order_index.setGroup_id("9"); + order_index.setSearch_time(month); + orderIndexService.save(order_index); + }); + ThreadUtil.execute(() -> { + Order_Index order_index = new Order_Index(); + order_index.setLimit("1000"); + order_index.setPage("1"); + order_index.setGroup_id("10"); + order_index.setSearch_time(month); + orderIndexService.save(order_index); + }); + ThreadUtil.execute(() -> { + Order_Index order_index = new Order_Index(); + order_index.setLimit("1000"); + order_index.setPage("1"); + order_index.setGroup_id("11"); + order_index.setSearch_time(month); + orderIndexService.save(order_index); + }); + ThreadUtil.execute(() -> { + Order_Index order_index = new Order_Index(); + order_index.setLimit("1000"); + order_index.setPage("1"); + order_index.setGroup_id("12"); + order_index.setSearch_time(month); + orderIndexService.save(order_index); + }); + ThreadUtil.execute(() -> { + Order_Index order_index = new Order_Index(); + order_index.setLimit("1000"); + order_index.setPage("1"); + order_index.setGroup_id("13"); + order_index.setSearch_time(month); + orderIndexService.save(order_index); + }); + } + + public static String[] getMonth(Date date){ + Date dateTime = DateUtil.offsetDay(date, -1); + Date dateTime1 = DateUtils.getFirstDayOfMonth(dateTime); + String firstDayOfMonth = DateUtil.format(dateTime1, "yyyy-MM-dd"); + String lastDayOfMonth = DateUtil.format(dateTime, "yyyy-MM-dd"); + String[] data = {firstDayOfMonth,lastDayOfMonth}; + return data; + } + +// @Scheduled(cron = "0 30 7 1 * ?") + public void orderIndexTimedTask(){ + String[] month = getMonth(new Date()); + month[0] = month[0]+"00:00:00"; + month[1] = month[1]+"23:59:59"; + ThreadUtil.execute(() -> { + Order_Index order_index = new Order_Index(); + order_index.setSearch_time(month); + orderIndexService.selectData(order_index); + }); + } }