Merge remote-tracking branch 'origin/cjl' into qa
8 files added
25 files modified
| | |
| | | <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> |
| | |
| | | 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; |
| | |
| | | @EnableTransactionManagement |
| | | public class ScreenApiBootstrap { |
| | | public static void main(String[] 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); |
| | | } |
| | |
| | | * @Version 1.0 |
| | | */ |
| | | @Configuration |
| | | @MapperScan(basePackages = {"com.moral.*.mapper"}) |
| | | /*@MapperScan(basePackages = {"com.moral.*.mapper"})*/ |
| | | public class PlusConfig { |
| | | @Bean |
| | | public PaginationInterceptor paginationInterceptor() { |
| | |
| | | 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; |
| | | |
| | |
| | | */ |
| | | @PostMapping("update") |
| | | @ApiOperation("修改") |
| | | |
| | | public ResultMessage update(@Valid @RequestBody AllocationUpdateCond allocationUpdateCond){ |
| | | allocationService.updateAll(allocationUpdateCond); |
| | | return ResultMessage.ok(); |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @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); |
| | | } |
| | | |
| | | } |
| | |
| | | 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: 监测站点数据显示导出 |
| | |
| | | private Integer keyPoint; |
| | | |
| | | |
| | | private String latitude; |
| | | private String longitude; |
| | | /** |
| | | * 省市区地址 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 详细地址 |
| | | */ |
| | | private String name; |
| | | } |
| | |
| | | @Getter |
| | | @JsonFormat(shape = JsonFormat.Shape.OBJECT) |
| | | public enum EmphasisEnum implements IntegerValueEnum { |
| | | /** |
| | | *立行整改 |
| | | */ |
| | | |
| | | |
| | | NONE(0,"无"), |
| | | |
| | | JZDLS(1, "建筑工地落实“六个百分百”"), |
| | | /** |
| | | *限期整改 |
| | | */ |
| | | |
| | | JXHGK(2, "精细化管控"), |
| | | |
| | | ; |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | @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; |
| | | |
| | |
| | | @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; |
| | |
| | | @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; |
| | | |
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | |
| | | @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; |
| | | } |
| | | |
| | | } |
| | |
| | | //上报单位名字 |
| | | 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){ |
New file |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | * @return |
| | | */ |
| | | List<Integer> getUnitAuthority(String code); |
| | | |
| | | |
| | | List<AllocationExcelExt> listExcel(List<Integer> id); |
| | | } |
| | |
| | | |
| | | 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; |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | //获取5分钟风场数据 |
| | | List<Object> getAreaWindData(Map<String,Object> params); |
| | | //获取中心风场风场数据 |
| | | List<Object> getAreaWindDataCenter(Map<String,Object> params); |
| | | |
| | | /** |
| | | * @Description: 获取五分钟弹窗数据,六参+时间+tvoc |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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(); |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | */ |
| | | @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文件夹用来存储上传的图片 |
| | |
| | | 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; |
| | |
| | | aDouble = aDouble + 30; |
| | | }else { |
| | | aDouble= aDouble+0; |
| | | } |
| | | }*/ |
| | | rsDouble.add(aDouble); |
| | | } |
| | | list.addAll(rsDouble); |
| | |
| | | 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"); |
| | |
| | | // 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; |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | }); |
| | | 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; |
| | | } |
| | | } |
| | |
| | | } |
| | | 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 |
| | |
| | | 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; |
New file |
| | |
| | | /* |
| | | 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()); |
| | | } |
| | | } |
| | | */ |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | <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> |
| | | |
| | |
| | | <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> |
| | | |
| | |
| | | |
| | | 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); |
| | | |
| | |
| | | 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; |
| | |
| | | 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); |
| | | |
| | | } |
| | | } |