From 6992aaf0587c09f7c511c1afd12e1519d91363d3 Mon Sep 17 00:00:00 2001 From: cjl <276999030@qq.com> Date: Thu, 14 Dec 2023 15:38:45 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/cjl' into qa --- screen-job/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java | 15 screen-api/src/main/java/com/moral/api/service/HistoryFiveMinutelyService.java | 2 screen-api/src/main/java/com/moral/api/service/FileTableService.java | 3 screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java | 22 + screen-api/src/main/java/com/moral/api/utils/CustomImageModifyHandler.java | 127 ++++++ screen-api/src/main/java/com/moral/ScreenApiBootstrap.java | 8 screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java | 21 screen-api/src/main/java/com/moral/api/utils/MyUrlConverterUtil.java | 70 +++ screen-api/src/main/java/com/moral/api/utils/WcharTest.java | 91 ++++ screen-api/pom.xml | 12 screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java | 68 ++- screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationFindVo.java | 11 screen-api/src/main/java/com/moral/api/entity/Allocation.java | 10 screen-api/src/main/java/com/moral/api/controller/AllocationController.java | 112 ++++- screen-api/src/main/java/com/moral/api/pojo/vo/file/FileAddressVo.java | 32 + screen-api/src/main/resources/mapper/HistoryHourlyMapper.xml | 6 screen-api/src/main/resources/mapper/AllocationMapper.xml | 14 screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationAddCond.java | 13 screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java | 16 screen-api/src/main/java/com/moral/api/config/mybatis/PlusConfig.java | 2 screen-api/src/main/java/com/moral/api/task/jobTask.java | 39 ++ screen-api/src/main/java/com/moral/api/pojo/enums/EmphasisEnum.java | 11 screen-api/src/main/java/com/moral/api/service/AllocationService.java | 4 screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAllocationFindVo.java | 12 screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java | 2 screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationVo.java | 16 screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationListExcelVo.java | 205 ++++++++++ screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationUpdateCond.java | 11 screen-api/src/main/java/com/moral/api/pojo/ext/allocation/AllocationExcelExt.java | 51 ++ screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java | 6 screen-api/src/main/java/com/moral/api/service/impl/FileTableServiceImpl.java | 19 + screen-api/src/main/resources/application-qa.yml | 4 screen-api/src/main/java/com/moral/api/utils/MyStringImageConverterUtil.java | 69 +++ 33 files changed, 1,025 insertions(+), 79 deletions(-) diff --git a/screen-api/pom.xml b/screen-api/pom.xml index ea3e1f9..9496d68 100644 --- a/screen-api/pom.xml +++ b/screen-api/pom.xml @@ -53,6 +53,18 @@ <artifactId>fastjson</artifactId> <version>1.2.66</version> </dependency> + + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>easyexcel</artifactId> + <version>2.2.7</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>4.0.1</version> + </dependency> + <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-spring-boot-starter</artifactId> diff --git a/screen-api/src/main/java/com/moral/ScreenApiBootstrap.java b/screen-api/src/main/java/com/moral/ScreenApiBootstrap.java index 26351cd..de445b6 100644 --- a/screen-api/src/main/java/com/moral/ScreenApiBootstrap.java +++ b/screen-api/src/main/java/com/moral/ScreenApiBootstrap.java @@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; @@ -19,7 +20,12 @@ @EnableTransactionManagement public class ScreenApiBootstrap { public static void main(String[] args) { - ApplicationContext applicationContext = SpringApplication.run(ScreenApiBootstrap.class, args); + /*SpringApplicationBuilder builder = new SpringApplicationBuilder(ScreenApiBootstrap.class); + builder.headless(false) + // .web(WebApplicationType.NONE) + // .bannerMode(Banner.Mode.OFF) + .run(args);*/ + ApplicationContext applicationContext = SpringApplication.run(ScreenApiBootstrap.class, args); SpringContextUtils.setApplicationContext(applicationContext); } @Bean diff --git a/screen-api/src/main/java/com/moral/api/config/mybatis/PlusConfig.java b/screen-api/src/main/java/com/moral/api/config/mybatis/PlusConfig.java index 55cf12d..8a9a272 100644 --- a/screen-api/src/main/java/com/moral/api/config/mybatis/PlusConfig.java +++ b/screen-api/src/main/java/com/moral/api/config/mybatis/PlusConfig.java @@ -25,7 +25,7 @@ * @Version 1.0 */ @Configuration -@MapperScan(basePackages = {"com.moral.*.mapper"}) +/*@MapperScan(basePackages = {"com.moral.*.mapper"})*/ public class PlusConfig { @Bean public PaginationInterceptor paginationInterceptor() { diff --git a/screen-api/src/main/java/com/moral/api/controller/AllocationController.java b/screen-api/src/main/java/com/moral/api/controller/AllocationController.java index 86f968a..07c8d6e 100644 --- a/screen-api/src/main/java/com/moral/api/controller/AllocationController.java +++ b/screen-api/src/main/java/com/moral/api/controller/AllocationController.java @@ -1,56 +1,56 @@ package com.moral.api.controller; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.collections4.CollectionUtils; +import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.moral.api.entity.AllocationLog; -import com.moral.api.pojo.enums.SysDictTypeEnum; +import com.moral.api.entity.ResponsibilityUnit; +import com.moral.api.pojo.enums.AllocationApproveEnum; +import com.moral.api.pojo.enums.ChangeEnum; +import com.moral.api.pojo.enums.YesOrNo; +import com.moral.api.pojo.ext.allocation.AllocationExcelExt; import com.moral.api.pojo.ext.allocation.AllocationExt; import com.moral.api.pojo.ext.allocation.AllocationPageExt; import com.moral.api.pojo.query.allocation.*; import com.moral.api.pojo.query.allocationextension.AllocationExtensionAddCond; - +import com.moral.api.pojo.vo.allocation.AllocationListExcelVo; import com.moral.api.pojo.vo.allocation.AllocationPageVo; import com.moral.api.pojo.vo.allocation.AllocationVo; - -import com.moral.constant.PageResult; -import io.swagger.annotations.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.ObjectUtils; - -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; - -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.moral.api.entity.ResponsibilityUnit; - +import com.moral.api.pojo.vo.file.FileAddressVo; import com.moral.api.service.AllocationService; -import com.moral.api.utils.EasyExcelUtils; -import com.moral.api.utils.NoModelWriteData; +import com.moral.api.utils.*; import com.moral.constant.Constants; +import com.moral.constant.PageResult; import com.moral.constant.ResultMessage; import com.moral.util.DateUtils; import com.moral.util.WebUtils; +import io.swagger.annotations.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.util.ObjectUtils; +import org.springframework.web.bind.annotation.*; - +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.net.URL; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; @Api(tags = {"������������"}) @RestController @RequestMapping("allocation") +@Slf4j public class AllocationController { + @Value("${file.path}") + private String basePath; @Autowired private AllocationService allocationService; @@ -99,6 +99,7 @@ */ @PostMapping("update") @ApiOperation("������") + public ResultMessage update(@Valid @RequestBody AllocationUpdateCond allocationUpdateCond){ allocationService.updateAll(allocationUpdateCond); return ResultMessage.ok(); @@ -172,7 +173,6 @@ return ResultMessage.ok(ObjectUtils.isEmpty(map1)? "0":map1); } - @GetMapping("unitExel") public void unitExel(HttpServletResponse response,HttpServletRequest request){ Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); @@ -220,4 +220,58 @@ } + + @GetMapping("listExcel") + @ApiOperation("������������") + public void listExcel(@RequestParam @ApiParam(value = "id",name = "������id") List<Integer> id,HttpServletResponse response){ + + List<AllocationExcelExt> extList = allocationService.listExcel(id); + try { + genImageExcel(extList,response); + }catch (Exception e){ + log.error("error result ",e); + } + + } + + + private void genImageExcel(List<AllocationExcelExt> list, HttpServletResponse response) throws IOException { + if (CollectionUtils.isEmpty(list)) { + return; + } + List<AllocationListExcelVo> demoDataList = new ArrayList<>(); + for(int i = 0;i<list.size();i++){ + AllocationExcelExt excelExt = list.get(i); + AllocationListExcelVo item = AllocationListExcelVo.convert(excelExt); + List<String> urls = new ArrayList<>(); + for(FileAddressVo z : excelExt.getFileBaseList()){ + urls.add(handleFileRealPath(z.getFileAddress())); + } + item.setChangeTypeStr(Objects.isNull(excelExt.getChangeType())?" ":ChangeEnum.getByValue(excelExt.getChangeType()).getName()); + item.setChangeStr(Objects.isNull(excelExt.getIsChange())?"���": YesOrNo.getByValue(excelExt.getIsChange()).getName()); + item.setWriteCellDataFile(urls); + List<String> urlsAfter = new ArrayList<>(); + for(FileAddressVo z : excelExt.getFileChangeList()){ + urlsAfter.add(handleFileRealPath(z.getFileAddress())); + } + item.setWriteCellDataFileResult(urlsAfter); + item.setEscalationTimeStr(DateUtils.dateToDateString(excelExt.getEscalationTime(),DateUtils.yyyy_MM_dd_EN)); + item.setChangeTimeStr(Objects.isNull(excelExt.getChangeTime())?" ":DateUtils.dateToDateString(excelExt.getChangeTime(),DateUtils.yyyy_MM_dd_EN)); + demoDataList.add(item); + } + try { + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + + URLEncoder.encode("���������������", "utf-8") + ".xlsx"); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + EasyExcel.write(response.getOutputStream(), AllocationListExcelVo.class) + .registerWriteHandler(new CustomImageModifyHandler()).sheet("���������").doWrite(demoDataList); + response.getOutputStream().close(); + }catch (Exception e){ + log.error("error result ",e); + } + } + private String handleFileRealPath(String path) { + return basePath.replaceAll(StringUtils.BACKSLASH.concat(StringUtils.BACKSLASH), StringUtils.SLASH).concat(StringUtils.SLASH).concat(path); + } + } diff --git a/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java b/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java index 7c477bf..e2e3b41 100644 --- a/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java +++ b/screen-api/src/main/java/com/moral/api/controller/MonitorPointController.java @@ -123,6 +123,28 @@ List<Object> response = historyFiveMinutelyService.getAreaWindData(params); return ResultMessage.ok(response); } + @GetMapping("getWindDataCenter") + @ApiOperation(value = "������������������������", notes = "������������������������") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), + @ApiImplicitParam(name = "monitorPointIds", value = "������id", required = true, paramType = "query", dataType = "String") + }) + public ResultMessage getWindDataCenter(HttpServletRequest request) { + Map<String, Object> params = WebUtils.getParametersStartingWith(request, null); + if (!params.containsKey("monitorPointIds")) { + return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); + } + String monitorPoint = params.remove("monitorPointIds").toString(); + params.put("monitorPointList", monitorPoint); + String[] monitorPointIds = monitorPoint.split(","); + if (monitorPointIds.length > 3) { + return ResultMessage.ok(); + } + + params.put("monitorPointIds", monitorPointIds); + List<Object> response = historyFiveMinutelyService.getAreaWindDataCenter(params); + return ResultMessage.ok(response); + } /** * @Description: ������������������������������ diff --git a/screen-api/src/main/java/com/moral/api/entity/Allocation.java b/screen-api/src/main/java/com/moral/api/entity/Allocation.java index 73e8bc5..b803c16 100644 --- a/screen-api/src/main/java/com/moral/api/entity/Allocation.java +++ b/screen-api/src/main/java/com/moral/api/entity/Allocation.java @@ -141,4 +141,14 @@ private Integer keyPoint; + private String latitude; + private String longitude; + /** + * ��������������� + */ + private String address; + /** + * ������������ + */ + private String name; } diff --git a/screen-api/src/main/java/com/moral/api/pojo/enums/EmphasisEnum.java b/screen-api/src/main/java/com/moral/api/pojo/enums/EmphasisEnum.java index 867a72e..3e9289d 100644 --- a/screen-api/src/main/java/com/moral/api/pojo/enums/EmphasisEnum.java +++ b/screen-api/src/main/java/com/moral/api/pojo/enums/EmphasisEnum.java @@ -14,13 +14,12 @@ @Getter @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum EmphasisEnum implements IntegerValueEnum { - /** - *������������ - */ + + + NONE(0,"���"), + JZDLS(1, "���������������������������������������"), - /** - *������������ - */ + JXHGK(2, "���������������"), ; diff --git a/screen-api/src/main/java/com/moral/api/pojo/ext/allocation/AllocationExcelExt.java b/screen-api/src/main/java/com/moral/api/pojo/ext/allocation/AllocationExcelExt.java new file mode 100644 index 0000000..2d0571f --- /dev/null +++ b/screen-api/src/main/java/com/moral/api/pojo/ext/allocation/AllocationExcelExt.java @@ -0,0 +1,51 @@ +package com.moral.api.pojo.ext.allocation; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.moral.api.entity.Allocation; +import com.moral.api.pojo.vo.approvetable.ApproveTableListVo; +import com.moral.api.pojo.vo.file.FileAddressVo; +import com.moral.api.pojo.vo.file.FileVo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * <p> + * ��������� + * </p> + * deyt template generate + * @author JI + * @since 2023-09-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class AllocationExcelExt extends Allocation { + + @ApiModelProperty(value = "������������") + private List<FileAddressVo> fileBaseList; + + @ApiModelProperty(value = "������������") + private List<FileAddressVo> fileChangeList; + + /* @ApiModelProperty(value = "������������") + private List<FileVo> fileApproveList; + + @ApiModelProperty(value = "������������") + private List<ApproveTableListVo> approveList;*/ + + //������������������ + @TableField(exist = false) + private String unitName; + + //������������������ + @TableField(exist = false) + private String escalationUnitName; + @TableField(exist = false) + //������������������ + private String polluteTypeName; + +} diff --git a/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationAddCond.java b/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationAddCond.java index f7f27d1..aeffd1a 100644 --- a/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationAddCond.java +++ b/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationAddCond.java @@ -37,6 +37,19 @@ @ApiModelProperty(value = "������������") private String pollutePosition; + @ApiModelProperty(value = "������") + private String latitude; + + @ApiModelProperty(value = "������") + private String longitude; + + @ApiModelProperty(value = "���������������") + private String address; + + @ApiModelProperty(value = "������������") + private String name; + + @ApiModelProperty(value = "������������id") private Integer unitId; diff --git a/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationUpdateCond.java b/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationUpdateCond.java index e1ad1f5..8ea2fdb 100644 --- a/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationUpdateCond.java +++ b/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationUpdateCond.java @@ -49,6 +49,17 @@ @NotNull(message = "���������������������������") private Integer polluteType; + @ApiModelProperty(value = "������") + private String latitude; + + @ApiModelProperty(value = "������") + private String longitude; + + @ApiModelProperty(value = "���������������") + private String address; + + @ApiModelProperty(value = "������������") + private String name; @ApiModelProperty(value = "������������id") @NotNull(message = "���������������������������") private Integer changeType; diff --git a/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationFindVo.java b/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationFindVo.java index 0b507d1..962c35d 100644 --- a/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationFindVo.java +++ b/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationFindVo.java @@ -41,6 +41,17 @@ @ApiModelProperty(value = "������������") private String pollutePosition; + @ApiModelProperty(value = "������") + private String latitude; + + @ApiModelProperty(value = "������") + private String longitude; + + @ApiModelProperty(value = "���������������") + private String address; + + @ApiModelProperty(value = "������������") + private String name; @ApiModelProperty(value = "������������") private Integer changeDay; diff --git a/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationListExcelVo.java b/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationListExcelVo.java new file mode 100644 index 0000000..2587ab1 --- /dev/null +++ b/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationListExcelVo.java @@ -0,0 +1,205 @@ +package com.moral.api.pojo.vo.allocation; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.moral.api.pojo.ext.allocation.AllocationExcelExt; +import com.moral.api.pojo.vo.approvetable.ApproveTableListVo; +import com.moral.api.pojo.vo.file.FileAddressVo; +import com.moral.api.pojo.vo.file.FileVo; +import com.moral.api.utils.BeanConverts; +import com.moral.api.utils.MyStringImageConverterUtil; +import com.moral.api.utils.MyUrlConverterUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.net.URL; +import java.util.Date; +import java.util.List; + +/** + * <p> + * ��������� + * </p> + * deyt template generate + * @author JI + * @since 2023-09-25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="AllocationListExcelVo - ������VO������", description="AllocationListExcelVo - ������VO������") +public class AllocationListExcelVo implements Serializable { + + + + + @ApiModelProperty(value = "������������") + @ExcelProperty(value = "������������") + private String allocationNum; + + + @ApiModelProperty(value = "������������") + @ExcelProperty(value = "������������") + private String escalationTimeStr; + + @ExcelProperty(value = "������������") + private String unitName; + + @ExcelProperty(value = "������������") + private String polluteTypeName; + + @ApiModelProperty(value = "������������") + @ExcelProperty(value = "������������") + private String pollutePosition; + + @ApiModelProperty(value = "������������id") + @ExcelProperty(value = "������������") + private String changeTypeStr; + + @ApiModelProperty(value = "���������") + @ExcelProperty(value = "���������") + private String escalationName; + + @ApiModelProperty(value = "������������") + @ExcelProperty(value = "������������") + private String problemDescribe; + + /* @ApiModelProperty(value = "������������") + private List<FileAddressVo> fileBaseList;*/ + + @ApiModelProperty(value = "������������") + @ExcelProperty(value = "���������������",converter = MyStringImageConverterUtil.class) + private List<String> writeCellDataFile; + + @ApiModelProperty(value = "������������") + @ExcelProperty(value = "������������") + private String changeStr; + + @ApiModelProperty(value = "������������") + @ExcelProperty(value = "������������") + private String changeDescribe; + + @ApiModelProperty(value = "���������������") + @ExcelProperty(value = "���������������") + private String changeName; + + @ApiModelProperty(value = "������������") + @ExcelProperty(value = "������������") + private String changeTimeStr; + + + @ExcelProperty(value = "���������������",converter = MyStringImageConverterUtil.class) + private List<String> writeCellDataFileResult; + + /* @ApiModelProperty(value = "������������id") + private Integer unitId; + + @ApiModelProperty(value = "������������id") + private Integer polluteType; + + @ApiModelProperty(value = "������������id") + private Integer changeType; + + @ApiModelProperty(value = "������������") + private Integer changeDay; + + @ApiModelProperty(value = "������������id") + private Integer escalationUnitId; + + @ApiModelProperty(value = "���������") + private String escalationName; + + @ApiModelProperty(value = "������������id") + private Integer investigationType; + + @ApiModelProperty(value = "������������") + private String problemDescribe; + + @ApiModelProperty(value = "������������") + private Integer isChange; + + @ApiModelProperty(value = "������������") + private String changeDescribe; + + @ApiModelProperty(value = "���������������") + private String changeName; + + @ApiModelProperty(value = "������������") + @JsonFormat(pattern="yyyy-MM-dd") + private Date changeTime; + + @ApiModelProperty(value = "������������") + private Integer checkScore; + + @ApiModelProperty(value = "������������") + private String checkDescribe; + + @ApiModelProperty(value = "���������") + private String checkName; + + @ApiModelProperty(value = "������������") + @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date checkTime; + + @ApiModelProperty(value = "������") + private Integer state; + + @ApiModelProperty(value = "������������") + private Integer isInvalid; + + @ApiModelProperty(value = "������������") + private String invalidReason; + + @ApiModelProperty(value = "���������id") + private Integer createId; + + @ApiModelProperty(value = "���������������") + private String createName; + + @ApiModelProperty(value = "������������") + @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date createTime; + + @ApiModelProperty(value = "���������id") + private Integer updateId; + + @ApiModelProperty(value = "���������������") + private String updateName; + + @ApiModelProperty(value = "������������") + @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date updateTime; + + + + @ApiModelProperty(value = "������������") + private List<FileVo> fileChangeList; + + @ApiModelProperty(value = "������������") + private List<FileVo> fileApproveList; + + @ApiModelProperty(value = "������������") + private List<ApproveTableListVo> approveList; + + @TableField(exist = false) + private String time; + + @TableField(exist = false) + private String unitName; + @TableField(exist = false) + private String escalationUnitName; + @TableField(exist = false) + private String polluteTypeName;*/ + + + public static AllocationListExcelVo convert(AllocationExcelExt allocationExt) { + AllocationListExcelVo allocationVo = BeanConverts.convert(allocationExt, AllocationListExcelVo.class); + return allocationVo; + } + +} diff --git a/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationVo.java b/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationVo.java index 12ae337..1f0a8a8 100644 --- a/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationVo.java +++ b/screen-api/src/main/java/com/moral/api/pojo/vo/allocation/AllocationVo.java @@ -11,6 +11,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.springframework.util.ObjectUtils; import java.io.Serializable; import java.util.Date; @@ -149,10 +150,25 @@ @TableField(exist = false) private String polluteTypeName; + @ApiModelProperty(value = "������") + private String latitude; + + @ApiModelProperty(value = "������") + private String longitude; + + @ApiModelProperty(value = "���������������") + private String address; + + @ApiModelProperty(value = "������������") + private String name; public static AllocationVo convert(AllocationExt allocationExt) { AllocationVo allocationVo = BeanConverts.convert(allocationExt, AllocationVo.class); return allocationVo; } + public Integer getkeyPoint() { + return ObjectUtils.isEmpty(keyPoint)?0:keyPoint; + } + } diff --git a/screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAllocationFindVo.java b/screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAllocationFindVo.java index 00c0cbb..503c633 100644 --- a/screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAllocationFindVo.java +++ b/screen-api/src/main/java/com/moral/api/pojo/vo/app/AppAllocationFindVo.java @@ -77,6 +77,18 @@ //������������������ private String escalationUnitName; + @ApiModelProperty(value = "������") + private String latitude; + + @ApiModelProperty(value = "������") + private String longitude; + + @ApiModelProperty(value = "���������������") + private String address; + + @ApiModelProperty(value = "������������") + private String name; + public Integer getResidueDay() { int day=0; if (this.changeType==ChangeEnum.DEADLINE.value){ diff --git a/screen-api/src/main/java/com/moral/api/pojo/vo/file/FileAddressVo.java b/screen-api/src/main/java/com/moral/api/pojo/vo/file/FileAddressVo.java new file mode 100644 index 0000000..26d087c --- /dev/null +++ b/screen-api/src/main/java/com/moral/api/pojo/vo/file/FileAddressVo.java @@ -0,0 +1,32 @@ +package com.moral.api.pojo.vo.file; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @ClassName FileVo + * @Description TODO + * @Author @cjl + * @Date 2023-09-21 14:51 + * @Version 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(description="FileAddressVo - ������VO������") +public class FileAddressVo { + @ApiModelProperty(value = "ID") + private Integer fileId; + + @ApiModelProperty(value = "������������") + private String fileName; + + @ApiModelProperty(value = "������������") + private String fileAddress; + + @ApiModelProperty(value = "������1������") + private Integer fileType; +} diff --git a/screen-api/src/main/java/com/moral/api/service/AllocationService.java b/screen-api/src/main/java/com/moral/api/service/AllocationService.java index 0da84e8..18b9bcb 100644 --- a/screen-api/src/main/java/com/moral/api/service/AllocationService.java +++ b/screen-api/src/main/java/com/moral/api/service/AllocationService.java @@ -9,6 +9,7 @@ import com.moral.api.entity.Allocation; import com.moral.api.entity.AllocationLog; import com.moral.api.entity.ResponsibilityUnit; +import com.moral.api.pojo.ext.allocation.AllocationExcelExt; import com.moral.api.pojo.ext.allocation.AllocationExt; import com.moral.api.pojo.ext.allocation.AllocationListExt; import com.moral.api.pojo.ext.allocation.AllocationPageExt; @@ -160,4 +161,7 @@ * @return */ List<Integer> getUnitAuthority(String code); + + + List<AllocationExcelExt> listExcel(List<Integer> id); } diff --git a/screen-api/src/main/java/com/moral/api/service/FileTableService.java b/screen-api/src/main/java/com/moral/api/service/FileTableService.java index b63cec4..b102755 100644 --- a/screen-api/src/main/java/com/moral/api/service/FileTableService.java +++ b/screen-api/src/main/java/com/moral/api/service/FileTableService.java @@ -2,6 +2,7 @@ import com.moral.api.entity.FileTable; import com.baomidou.mybatisplus.extension.service.IService; +import com.moral.api.pojo.vo.file.FileAddressVo; import com.moral.api.pojo.vo.file.FileVo; import org.springframework.web.multipart.MultipartFile; @@ -30,4 +31,6 @@ void upDateResult(List<FileVo> list,int relationId,int fileModule); List<FileVo> list(int relationId,int fileModule); + + List<FileAddressVo> list(int relationId,int fileModule,int fileType); } diff --git a/screen-api/src/main/java/com/moral/api/service/HistoryFiveMinutelyService.java b/screen-api/src/main/java/com/moral/api/service/HistoryFiveMinutelyService.java index b46372f..3125d8d 100644 --- a/screen-api/src/main/java/com/moral/api/service/HistoryFiveMinutelyService.java +++ b/screen-api/src/main/java/com/moral/api/service/HistoryFiveMinutelyService.java @@ -40,6 +40,8 @@ //������5������������������ List<Object> getAreaWindData(Map<String,Object> params); + //������������������������������ + List<Object> getAreaWindDataCenter(Map<String,Object> params); /** * @Description: ������������������������������������+������+tvoc diff --git a/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java index 61cb019..99cc3d0 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java @@ -107,4 +107,10 @@ } return true; } + + + + } + + diff --git a/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java index 6a2648b..f588770 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java @@ -19,6 +19,7 @@ import com.moral.api.pojo.bean.BaseInvalidEntity; import com.moral.api.pojo.dto.allocation.AllocationUnitViewDto; import com.moral.api.pojo.enums.*; +import com.moral.api.pojo.ext.allocation.AllocationExcelExt; import com.moral.api.pojo.ext.allocation.AllocationExt; import com.moral.api.pojo.ext.allocation.AllocationListExt; import com.moral.api.pojo.ext.allocation.AllocationPageExt; @@ -31,6 +32,7 @@ import com.moral.api.pojo.vo.app.AppAuthority; import com.moral.api.pojo.vo.user.QxUser; import com.moral.api.service.*; +import com.moral.api.utils.BeanConverts; import com.moral.constant.Constants; import com.moral.constant.RedisConstants; import com.moral.util.DateUtils; @@ -229,15 +231,16 @@ ArrayList<Map<String, Object>> escalationTypeList = new ArrayList<>(); ArrayList<AllocationUnitViewDto> allocationUnitViewDtos = new ArrayList<>(); - Object number1 = map.get("number"); + String number1 = map.get("number").toString(); String startTime=null; String endTime=null; if (!ObjectUtils.isEmpty(map.get("startTime")) || !ObjectUtils.isEmpty(map.get("endTime"))){ startTime = map.get("startTime").toString(); - endTime = map.get("endTime").toString(); +// endTime = map.get("endTime").toString(); + endTime = DateUtils.getDateOfDay(map.get("endTime").toString(), 1, DateUtils.yyyy_MM_dd_EN); } - if (!ObjectUtils.isEmpty(number1)){ + if (!number1.equals("0")){ String s = "-"+number1; //������������������ endTime = DateUtils.getCurDateTime(); @@ -994,4 +997,16 @@ return responsibilityUnit; } + @Override + public List<AllocationExcelExt> listExcel(List<Integer> id) { + List<AllocationExcelExt> list = new ArrayList<>(); + for(Integer i : id){ + AllocationExt allocationExt = oneAllocation(i); + AllocationExcelExt allocationExcelExt = BeanConverts.convert(allocationExt,AllocationExcelExt.class); + allocationExcelExt.setFileBaseList(fileTableService.list(i,FileTableEnum.ALLOCATION_FOUNDATION.value,FileType.PICTURE.getValue())); + allocationExcelExt.setFileChangeList(fileTableService.list(i,FileTableEnum.ALLOCATION_RECTIFICATION.value,FileType.PICTURE.getValue())); + list.add(allocationExcelExt); + } + return list; + } } diff --git a/screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java index 4ce7314..35a9cdd 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/DustldServiceImpl.java @@ -1,8 +1,13 @@ package com.moral.api.service.impl; +import com.moral.api.config.Interceptor.UserHelper; +import com.moral.api.entity.SysDictData; import com.moral.api.exception.BusinessException; import com.moral.api.mapper.*; +import com.moral.api.pojo.enums.SysDictTypeEnum; +import com.moral.api.pojo.vo.user.QxUser; +import com.moral.api.service.SysDictTypeService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -17,18 +22,7 @@ import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; import com.alibaba.fastjson.JSON; @@ -67,7 +61,7 @@ */ @Override public Integer getDailyDustld(Map<String, Object> params,MultipartFile file ) { - + SysDictData listDict = sysDictTypeService.listOne(SysDictTypeEnum.SYS_SECOND_CRUISER.getValue(),"dustld"); //������jar��������������� ApplicationHome applicationHome = new ApplicationHome(getClass()); //���jar������������������������������upload������������������������������������ @@ -93,8 +87,16 @@ ArrayList<Double> rsDouble = new ArrayList<>(); for (String s : dust) { double aDouble = Double.parseDouble(s); - - if (aDouble>=0 && aDouble<40 ){ + if(listDict.getDataValue().contains(",")){ + List<String> resultStr = Arrays.asList(listDict.getDataValue().split(",")); + if(resultStr.size() % 2 ==0){ + aDouble = numAvg(resultStr,BigDecimal.valueOf(aDouble)).doubleValue(); + } + }else { + BigDecimal dataValue = Objects.nonNull(listDict.getDataValue())?BigDecimal.valueOf(Double.parseDouble(listDict.getDataValue())):BigDecimal.ZERO; + aDouble = BigDecimal.valueOf(aDouble).add(dataValue).doubleValue(); + } + /*if (aDouble>=0 && aDouble<40 ){ aDouble = aDouble + 170; }else if (aDouble>=40 && aDouble<60){ aDouble = aDouble + 130; @@ -106,7 +108,7 @@ aDouble = aDouble + 30; }else { aDouble= aDouble+0; - } + }*/ rsDouble.add(aDouble); } list.addAll(rsDouble); @@ -271,11 +273,13 @@ private MaxRoadMapper maxRoadMapper; @Autowired private OrganizationMapper organizationMapper; + @Autowired + private SysDictTypeService sysDictTypeService; @Override @Transactional public Map<String, Object> dailyDustlds(Map<String, Object> params) { - + SysDictData list = sysDictTypeService.listOne(SysDictTypeEnum.SYS_SECOND_CRUISER.getValue(),"dustld"); Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo(); Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization"); Integer orgId = (Integer) orgInfo.get("id"); @@ -323,17 +327,14 @@ // String flyLon1 = dust.get("flyLon").toString(); if (latDouble1==latDouble && lonDouble1==lonDouble){ Double dustld = Objects.nonNull(dust.get("dustld"))?Double.parseDouble(dust.get("dustld").toString()):0d; - - if (dustld>=0 && dustld<40 ){ - dustld = dustld + 170; - }else if (dustld>=40 && dustld<60){ - dustld = dustld + 130; - }else if (dustld>=60 && dustld<100 ){ - dustld = dustld + 110; - }else if (dustld>=100 && dustld<150){ - dustld = dustld + 70; - }else if (dustld>=150 && dustld<180){ - dustld = dustld + 30; + if(list.getDataValue().contains(",")){ + List<String> resultStr = Arrays.asList(list.getDataValue().split(",")); + if(resultStr.size() % 2 ==0){ + dustld = numAvg(resultStr,BigDecimal.valueOf(dustld)).doubleValue(); + } + }else { + BigDecimal dataValue = Objects.nonNull(list.getDataValue())?BigDecimal.valueOf(Double.parseDouble(list.getDataValue())):BigDecimal.ZERO; + dustld = BigDecimal.valueOf(dustld).add(dataValue).doubleValue(); } doubleArrayList.add(dustld); break; @@ -494,5 +495,14 @@ } return null; } - + private BigDecimal numAvg(List<String> list , BigDecimal num){ + int nums = 1; + for (int i=0;i<list.size();i=i+2){ + if(num.compareTo(BigDecimal.valueOf(Double.parseDouble(list.get(i))))>= 0 ){ + return num.add(BigDecimal.valueOf(Double.parseDouble(list.get(i+1)))); + } + nums+=2; + } + return num; + } } diff --git a/screen-api/src/main/java/com/moral/api/service/impl/FileTableServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/FileTableServiceImpl.java index b8fc305..df097ce 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/FileTableServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/FileTableServiceImpl.java @@ -7,6 +7,7 @@ import com.moral.api.mapper.FileTableMapper; import com.moral.api.pojo.enums.FileType; import com.moral.api.pojo.enums.YesOrNo; +import com.moral.api.pojo.vo.file.FileAddressVo; import com.moral.api.pojo.vo.file.FileVo; import com.moral.api.pojo.vo.user.QxUser; import com.moral.api.service.FileTableService; @@ -237,4 +238,22 @@ }); return list; } + + @Override + public List<FileAddressVo> list(int relationId, int fileModule, int fileType) { + List<FileAddressVo> list = new ArrayList<>(); + List<FileTable> existsList = this.lambdaQuery().eq(FileTable::getRelationId, relationId) + .eq(FileTable::getFileModule, fileModule) + .eq(Objects.nonNull(fileType),FileTable::getFileType,fileType) + .eq(FileTable::getIsDel, YesOrNo.NO.value).orderByAsc(FileTable::getCreateTime).list(); + existsList.forEach(it->{ + FileAddressVo fileVo = new FileAddressVo(); + fileVo.setFileId(it.getFileId()); + fileVo.setFileName(it.getFileName()); + fileVo.setFileType(it.getFileType()); + fileVo.setFileAddress(it.getFileAddress()); + list.add(fileVo); + }); + return list; + } } diff --git a/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java index 40b13b6..8d56568 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java @@ -191,7 +191,21 @@ } return getWindData(windData,params); } + @Override + public List<Object> getAreaWindDataCenter(Map<String, Object> params) { +// String timeUnits = DateUtils.dateToDateString(new Date(), DateUtils.yyyyMM_EN); +// params.put("timeUnits", timeUnits); +// //������������ +// List<WindData> windData = historyFiveMinutelyMapper.getAreaWindData(params); +// return getWindData(windData); + params.put("timeUnits","202311"); + params.put("time","2023-11-05 09:00"); + params.put("macs",Arrays.asList("p5dnd7a0245472","p5dnd7a0245400","p5dnd7a0245385","p5dnd7a0245374")); + List<WindData> windData = historyHourlyMapper.getArea(params); + params.put("perdlen",50); + return getWindData(windData,params); + } //��������������������������� @Override @@ -462,7 +476,7 @@ laLaMap.put("minLa", lami); - int perdlen = windDate(Objects.nonNull(params.get("monitorPointList"))?params.get("monitorPointList").toString():null); + int perdlen = Objects.nonNull(params.get("perdlen"))?Integer.parseInt(params.get("perdlen").toString()):windDate(Objects.nonNull(params.get("monitorPointList"))?params.get("monitorPointList").toString():null); int length = perdlen*10; Double lo1 = lomi - length * 0.00001141; diff --git a/screen-api/src/main/java/com/moral/api/task/jobTask.java b/screen-api/src/main/java/com/moral/api/task/jobTask.java new file mode 100644 index 0000000..6e5df4f --- /dev/null +++ b/screen-api/src/main/java/com/moral/api/task/jobTask.java @@ -0,0 +1,39 @@ +/* +package com.moral.api.task; + +import com.moral.api.utils.WcharTest; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.awt.*; +import java.util.Date; + +*/ +/** + * @ClassName jobTask + * @Description TODO + * @Author @cjl + * @Date 2023-12-07 15:08 + * @Version 1.0 + *//* + +@Component +@EnableScheduling +@Slf4j +public class jobTask { + @Scheduled(cron = "0/20 * * * * ?") + public void startTask(){ + String friendNickName = "������������������";// "������������������"; + String msg="���������������������������������������������������"; + try { + WcharTest.sendMsgforSp(friendNickName,msg); + } catch (Exception e) { + log.error("error result ",e); + throw new RuntimeException(e); + } + System.out.println("������20������������������" + new Date()); + } +} +*/ diff --git a/screen-api/src/main/java/com/moral/api/utils/CustomImageModifyHandler.java b/screen-api/src/main/java/com/moral/api/utils/CustomImageModifyHandler.java new file mode 100644 index 0000000..e130b06 --- /dev/null +++ b/screen-api/src/main/java/com/moral/api/utils/CustomImageModifyHandler.java @@ -0,0 +1,127 @@ +package com.moral.api.utils; + +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.CellData; +import com.alibaba.excel.metadata.Head; +import com.alibaba.excel.write.handler.CellWriteHandler; +import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; +import com.alibaba.excel.write.metadata.holder.WriteTableHolder; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.util.Units; + +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName CustomImageModifyHandler + * @Description TODO + * @Author @cjl + * @Date 2023-11-15 10:56 + * @Version 1.0 + */ +public class CustomImageModifyHandler implements CellWriteHandler { + private List<String> repeats = new ArrayList<>(); + // ������������������������������������������������������������������������������������������������������������������������������������ + private Integer maxDataSize = 0; + @Override + public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) { + + } + + @Override + public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) { + + } + + @Override + public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) { + // ��� ��������������������� ��������������������������������� + if (isHead) { + return; + } + //���������������������������������type������������,��������������������� + if(cellData.getImageValue()!=null||cellData.getData() instanceof ArrayList){ + cellData.setType(CellDataTypeEnum.EMPTY); + } + } + + @Override + public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) { + // ��� ������������������������ ��������������������� + if (isHead || CollectionUtils.isEmpty(cellDataList)) { + return; + } + Boolean listFlag = false; + ArrayList data = null; + Sheet sheet = cell.getSheet(); + // ���������ListUrlConverterUtil������������ + if (cellDataList.get(0).getData() instanceof ArrayList){ + data = (ArrayList) cellDataList.get(0).getData(); + if (CollectionUtils.isEmpty(data)) { + return; + } + if (data.get(0) instanceof CellData){ + CellData cellData = (CellData) data.get(0); + if (cellData.getImageValue() == null){ + return; + }else { + listFlag = true; + } + } + } + if (!listFlag && cellDataList.get(0).getImageValue() == null){ + return; + } + String key = cell.getRowIndex() + "_" + cell.getColumnIndex(); + if (repeats.contains(key)){ + return; + } + repeats.add(key); + if (data.size() > maxDataSize) { + maxDataSize = data.size(); + } + //60px������������������900,60px���������������248*8,������������������ + sheet.getRow(cell.getRowIndex()).setHeight((short)900); + sheet.setColumnWidth(cell.getColumnIndex(), (int) (listFlag?21.8*256*maxDataSize:22.8*256)); + + if (listFlag){ + for (int i = 0; i < data.size(); i++) { + CellData cellData= (CellData) data.get(i); + if(cellData.getImageValue()==null){ + continue; + } + this.insertImage(sheet,cell,cellData.getImageValue(),i); + } + }else { + // cellDataList ���list������������ ������������������ ������������������������������������ ������������������������ ������������������ + this.insertImage(sheet,cell,cellDataList.get(0).getImageValue(),0); + } + + } + + private void insertImage(Sheet sheet,Cell cell,byte[] pictureData,int i){ + int picWidth = Units.pixelToEMU(175); + int index = sheet.getWorkbook().addPicture(pictureData, HSSFWorkbook.PICTURE_TYPE_PNG); + Drawing drawing = sheet.getDrawingPatriarch(); + if (drawing == null) { + drawing = sheet.createDrawingPatriarch(); + } + CreationHelper helper = sheet.getWorkbook().getCreationHelper(); + ClientAnchor anchor = helper.createClientAnchor(); + // ������������������ + anchor.setDx1(picWidth*i); + anchor.setDx2(picWidth+picWidth*i); + anchor.setDy1(0); + anchor.setDy2(0); + //������������������ + anchor.setCol1(cell.getColumnIndex()); + anchor.setCol2(cell.getColumnIndex()); + anchor.setRow1(cell.getRowIndex()); + anchor.setRow2(cell.getRowIndex() + 1); + // ��������������������������������������� + anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE); + drawing.createPicture(anchor, index); + } +} diff --git a/screen-api/src/main/java/com/moral/api/utils/MyStringImageConverterUtil.java b/screen-api/src/main/java/com/moral/api/utils/MyStringImageConverterUtil.java new file mode 100644 index 0000000..77ff3d2 --- /dev/null +++ b/screen-api/src/main/java/com/moral/api/utils/MyStringImageConverterUtil.java @@ -0,0 +1,69 @@ +package com.moral.api.utils; + +import cn.hutool.core.convert.Convert; +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.CellData; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import com.alibaba.excel.util.IoUtils; + +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName MyStringImageConverterUtil + * @Description TODO + * @Author @cjl + * @Date 2023-11-15 14:08 + * @Version 1.0 + */ +public class MyStringImageConverterUtil implements Converter<List<String>> { + @Override + public Class supportJavaTypeKey() { + return List.class; + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.IMAGE; + } + + @Override + public List<String> convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception { + String stringValue = cellData.getStringValue(); + //���json���������������excel���������������������������java List<String>������ + List<String> list = Convert.toList(String.class,stringValue); + return list; + + } + + @Override + public CellData convertToExcelData(List<String> stringUrl, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception { + // ������������������������������URL������������ + List<CellData> data = new ArrayList<>(); + // for ������������������ + for (String url : stringUrl) { + FileInputStream inputStream = null; + try { + inputStream = new FileInputStream(url); + byte[] bytes = IoUtils.toByteArray(inputStream); + data.add(new CellData(bytes)); + } catch (Exception e) { + //��������������������������� + //data.add(new CellData(IoUtils.toByteArray(new FileInputStream("D:\\easyexcel\\err.png")))); + continue; + } finally { + if (inputStream != null){ + inputStream.close(); + } + } + } + + // ���������������������������������List,������������������CellData cellData = new CellData(data);���������list���������������������CellData���������data������������ + CellData cellData = new CellData(data); + cellData.setType(CellDataTypeEnum.IMAGE); + return cellData; + } +} diff --git a/screen-api/src/main/java/com/moral/api/utils/MyUrlConverterUtil.java b/screen-api/src/main/java/com/moral/api/utils/MyUrlConverterUtil.java new file mode 100644 index 0000000..ab96d18 --- /dev/null +++ b/screen-api/src/main/java/com/moral/api/utils/MyUrlConverterUtil.java @@ -0,0 +1,70 @@ +package com.moral.api.utils; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.CellData; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import com.alibaba.excel.util.IoUtils; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName MyUrlConverterUtil + * @Description TODO + * @Author @cjl + * @Date 2023-11-15 11:02 + * @Version 1.0 + */ +public class MyUrlConverterUtil implements Converter<List<URL>> { + @Override + public Class supportJavaTypeKey() { + return List.class; + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + /** + *���������������������������IMAGE + */ + return CellDataTypeEnum.IMAGE; + } + + @Override + public List convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + return null; + } + + @Override + public CellData convertToExcelData(List<URL> value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { + // ������������������������������URL������������ + List<CellData> data = new ArrayList<>(); + // for ������������������ + for (URL url : value) { + InputStream inputStream = null; + try { + inputStream = url.openStream(); + byte[] bytes = IoUtils.toByteArray(inputStream); + data.add(new CellData(bytes)); + } catch (Exception e) { + //��������������������������� + data.add(new CellData(IoUtils.toByteArray(new FileInputStream("D:\\easyexcel\\err.png")))); + continue; + } finally { + if (inputStream != null){ + inputStream.close(); + } + } + } + + // ���������������������������������List,������������������CellData cellData = new CellData(data);���������list���������������������CellData���������data������������ + CellData cellData = new CellData(data); + cellData.setType(CellDataTypeEnum.IMAGE); + return cellData; + } + +} diff --git a/screen-api/src/main/java/com/moral/api/utils/WcharTest.java b/screen-api/src/main/java/com/moral/api/utils/WcharTest.java new file mode 100644 index 0000000..04a57b6 --- /dev/null +++ b/screen-api/src/main/java/com/moral/api/utils/WcharTest.java @@ -0,0 +1,91 @@ +package com.moral.api.utils; + +import lombok.SneakyThrows; + +import java.awt.*; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.event.KeyEvent; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Timer; +import java.util.TimerTask; + +/** + * @ClassName WcharTest + * @Description TODO + * @Author @cjl + * @Date 2023-12-07 14:27 + * @Version 1.0 + */ +public class WcharTest { + public static void main(String[] args) throws ParseException { + // ������������ + String friendNickName = "������������������";// "������������������"; + String msg="������������������00";//������������ + Timer timer = new Timer(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = format.parse("2023-07-03 14:43:00"); + System.out.println("���������������"); + timer.schedule(new TimerTask() { + @SneakyThrows + @Override + public void run() { + sendMsgforSp(friendNickName, msg); + } + },date); + System.out.println("������"); + } + + /** + * ��������������������� + * @param friendNickName ������������ + * @param msg ������������ + * @throws AWTException + */ + public static void sendMsgforSp(String friendNickName, String msg) throws AWTException { + //������robot������ + Robot robot = new Robot(); + //������������������������ control+alt+w + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_W); + //������Ctrl������������Ctrl������������������������������������������������������������������������������ + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.keyRelease(KeyEvent.VK_ALT); + // ��������������������������������������� + robot.delay(2000); + + //��������������������� + // Ctrl + F ������������������ + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_CONTROL); + // ��������������������������������� + Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); + Transferable tText = new StringSelection(friendNickName); + clip.setContents(tText, null); + // ���������������������ctrl+v��������������������� + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.delay(2000); + robot.keyPress(KeyEvent.VK_ENTER); + robot.delay(2000); + + //��������������������� + //������������ + // ������������������������������ + Transferable tText1 = new StringSelection(msg); + clip.setContents(tText1, null); + // ���������������������ctrl+v��������������������� + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_CONTROL); + // ������������ + robot.keyPress(KeyEvent.VK_ENTER); + robot.delay(2000); + } +} diff --git a/screen-api/src/main/resources/application-qa.yml b/screen-api/src/main/resources/application-qa.yml index ccec2b7..6b0351b 100644 --- a/screen-api/src/main/resources/application-qa.yml +++ b/screen-api/src/main/resources/application-qa.yml @@ -21,7 +21,7 @@ main: allow-bean-definition-overriding: true redis: - host: r-bp1hez4g7rkqjswpay158.redis.rds.aliyuncs.com + host: r-bp1hez4g7rkqjswpaypd159.redis.rds.aliyuncs.com port: 6379 password: moral_123456 timeout: 30000 @@ -38,7 +38,7 @@ max-wait: 30000 min-idle: 32 tokenRedis: - host: r-bp1hez4g7rkqjswpay158.redis.rds.aliyuncs.com + host: r-bp1hez4g7rkqjswpaypd159.redis.rds.aliyuncs.com port: 6379 password: moral_123456 timeout: 30000 diff --git a/screen-api/src/main/resources/mapper/AllocationMapper.xml b/screen-api/src/main/resources/mapper/AllocationMapper.xml index 8572d20..61f2f99 100644 --- a/screen-api/src/main/resources/mapper/AllocationMapper.xml +++ b/screen-api/src/main/resources/mapper/AllocationMapper.xml @@ -28,23 +28,31 @@ <result column="state" property="state" /> <result column="invalid_reason" property="invalidReason" /> <result column="key_point" property="keyPoint" /> + <result column="latitude" property="latitude" /> + <result column="longitude" property="longitude" /> + <result column="address" property="address" /> + <result column="name" property="name" /> </resultMap> <!-- ��������������������� --> <sql id="Base_Column_List"> - allocation_id, allocation_num, escalation_type, escalation_time, pollute_position, unit_id, pollute_type, change_type, change_day, escalation_unit_id, escalation_name, investigation_type, problem_describe, is_change, change_describe, change_name, change_time, check_score, check_describe, check_name, check_time, state, is_del, is_invalid, invalid_reason, create_id, create_name, create_time, update_id, update_name, update_time + allocation_id, allocation_num, escalation_type, escalation_time, pollute_position, unit_id, pollute_type, change_type, change_day, escalation_unit_id, escalation_name, investigation_type, problem_describe, is_change, change_describe, change_name, change_time, check_score, check_describe, check_name, check_time, state, is_del, is_invalid, invalid_reason, create_id, create_name, create_time, update_id, update_name, update_time,latitude,longitude,address,name </sql> <!-- ��������������������� --> <sql id="Allocation_Column_List"> - allocation.allocation_id, allocation.allocation_num, allocation.escalation_type, allocation.escalation_time, allocation.pollute_position, allocation.unit_id, allocation.pollute_type, allocation.change_type, allocation.change_day, allocation.escalation_unit_id, allocation.escalation_name, allocation.investigation_type, allocation.problem_describe, allocation.is_change, allocation.change_describe, allocation.change_name, allocation.change_time, allocation.check_score, allocation.check_describe, allocation.check_name, allocation.check_time, allocation.state, allocation.is_del, allocation.is_invalid, allocation.invalid_reason, allocation.create_id, allocation.create_name, allocation.create_time, allocation.update_id, allocation.update_name, allocation.update_time,allocation.key_point + allocation.allocation_id, allocation.allocation_num, allocation.escalation_type, allocation.escalation_time, allocation.pollute_position, allocation.unit_id, allocation.pollute_type, allocation.change_type, allocation.change_day, allocation.escalation_unit_id, allocation.escalation_name, allocation.investigation_type, allocation.problem_describe, allocation.is_change, allocation.change_describe, allocation.change_name, allocation.change_time, allocation.check_score, allocation.check_describe, allocation.check_name, allocation.check_time, allocation.state, allocation.is_del, allocation.is_invalid, allocation.invalid_reason, allocation.create_id, allocation.create_name, allocation.create_time, allocation.update_id, allocation.update_name, allocation.update_time,allocation.key_point,allocation.latitude,allocation.longitude,allocation.address,allocation.name </sql> <select id="extOne" resultType="com.moral.api.pojo.ext.allocation.AllocationExt"> SELECT - <include refid="Allocation_Column_List"/> + <include refid="Allocation_Column_List"/>,t1.unit_name as unitName,t5.dataValue as polluteTypeName FROM allocation allocation + left join responsibility_unit t1 on t1.unit_id = allocation.unit_id + left join (SELECT t3.dataKey,t3.dataValue FROM sys_dict_data t3 + LEFT JOIN sys_dict_type t4 on t4.id = t3.dict_type_id + where t4.name = 'contaminate') t5 on t5.dataKey = allocation.pollute_type where allocation.allocation_id = #{id} and allocation.is_del = 0 </select> diff --git a/screen-api/src/main/resources/mapper/HistoryHourlyMapper.xml b/screen-api/src/main/resources/mapper/HistoryHourlyMapper.xml index fbb6c7e..9e3acd3 100644 --- a/screen-api/src/main/resources/mapper/HistoryHourlyMapper.xml +++ b/screen-api/src/main/resources/mapper/HistoryHourlyMapper.xml @@ -50,6 +50,12 @@ <foreach item="monitorPointId" collection="monitorPointIds" index="index" open="(" separator="," close=")"> #{monitorPointId} </foreach> + <if test="macs != null and macs.size!= 0"> + and h.mac in + <foreach collection="macs" item="id" index="index" open="(" close=")" separator=","> + #{id} + </foreach> + </if> AND h.time = #{time} </select> diff --git a/screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java b/screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java index 581af76..e05a362 100644 --- a/screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java +++ b/screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java @@ -86,6 +86,8 @@ QueryWrapper<GovMonitorPoint> queryWrapper = new QueryWrapper<>(); queryWrapper.select("guid").eq("is_delete", Constants.NOT_DELETE); + /*// + queryWrapper.eq("guid","d0955320-4632-4276-b9e2-959e5ace49b3");*/ //������������������������������������������ String time1 = StringUtils.isNotEmpty(dateTime)?dateTime:DateUtils.dateToDateString(new Date(),DateUtils.yyyy_MM_dd_HH_EN); diff --git a/screen-job/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java b/screen-job/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java index 6f1f9a9..47beefb 100644 --- a/screen-job/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java +++ b/screen-job/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java @@ -197,6 +197,9 @@ private void judgeDeviceState(String mac,Map<String, Object> dataMap){ List<String> sensorList = Arrays.asList("a34004","a34002","a21026","a21004","a21005","a05024","a99054"); Device device = (Device) redisTemplate.opsForHash().get(RedisConstants.DEVICE_INFO, mac); + if(Objects.isNull(device)){ + return; + } List<Sensor> sensors = device.getVersion().getSensors(); Expression expression; int state = 1; @@ -403,12 +406,16 @@ dataMap.put("value", JSONObject.toJSONString(jsonMap)); //������redis jsonMap.put("dataTime", DateUtils.dateToDateString(start)); - // redisTemplate.opsForHash().put(RedisConstants.DATA_FIVE_MINUTES, key, jsonMap); - //insertData.add(dataMap); + redisTemplate.opsForHash().put(RedisConstants.DATA_FIVE_MINUTES, key, jsonMap); + insertData.add(dataMap); + System.out.println(">>>"+key+"->>>"+jsonMap.toString()); judgeDeviceState(key,jsonMap); - System.out.println(dataMap); - }); + }); + //5��������������� + // String insertTimeUnits = DateUtils.dateToDateString(start, DateUtils.yyyyMM_EN); + //��������������� + // historyFiveMinutelyMapper.insertHistoryFiveMinutely(insertData, insertTimeUnits); } } -- Gitblit v1.8.0