Commit dfa0e903 authored by maoying's avatar maoying

合并0.6-7到0.8代码解决冲突

parents 6225538e d29fd966
...@@ -29,6 +29,8 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> { ...@@ -29,6 +29,8 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
* @return * @return
*/ */
public DataDictionary getByCode(String code,String type); public DataDictionary getByCode(String code,String type);
public DataDictionary getByType(@Param("type") String type);
public List<DataDictionary> getFireTeamTypeTree(String bizOrgCode); public List<DataDictionary> getFireTeamTypeTree(String bizOrgCode);
......
package com.yeejoin.amos.boot.biz.common.utils;
public class SnowFlakeGenerateIdWorker {
/**
* 开始时间截
*/
private final long twepoch = 1420041600000L;
/**
* 机器id所占的位数
*/
private final long workerIdBits = 5L;
/**
* 数据标识id所占的位数
*/
private final long datacenterIdBits = 5L;
/**
* 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数)
*/
private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
/**
* 支持的最大数据标识id,结果是31
*/
private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
/**
* 序列在id中占的位数
*/
private final long sequenceBits = 12L;
/**
* 机器ID向左移12位
*/
private final long workerIdShift = sequenceBits;
/**
* 数据标识id向左移17位(12+5)
*/
private final long datacenterIdShift = sequenceBits + workerIdBits;
/**
* 时间截向左移22位(5+5+12)
*/
private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
/**
* 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095)
*/
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
/**
* 工作机器ID(0~31)
*/
private long workerId;
/**
* 数据中心ID(0~31)
*/
private long datacenterId;
/**
* 毫秒内序列(0~4095)
*/
private long sequence = 0L;
/**
* 上次生成ID的时间截
*/
private long lastTimestamp = -1L;
/**
* 构造函数
*
* @param workerId 工作ID (0~31)
* @param datacenterId 数据中心ID (0~31)
*/
public SnowFlakeGenerateIdWorker(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
/**
* 获得下一个ID (该方法是线程安全的)
*
* @return long
*/
public synchronized long nextId() {
long timestamp = timeGen();
timestamp = generateId(timestamp);
return ((timestamp - twepoch) << timestampLeftShift) //
| (datacenterId << datacenterIdShift) //
| (workerId << workerIdShift) //
| sequence;
}
private long generateId(long timestamp){
//如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
if(timestamp < lastTimestamp){
throw new RuntimeException(
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
//如果是同一时间生成的,则进行毫秒内序列
if(lastTimestamp == timestamp)
{
sequence = (sequence + 1) & sequenceMask;
//毫秒内序列溢出
if(sequence == 0)
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp);
}
else//时间戳改变,毫秒内序列重置
{
sequence = 0L;
}
//上次生成ID的时间截
lastTimestamp = timestamp;
return timestamp;
}
/**
*获得下一个ID (string)
**/
public synchronized String generateNextId() {
long timestamp = timeGen();
timestamp = generateId(timestamp);
//移位并通过或运算拼到一起组成64位的ID
return String.valueOf(((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift)
| (workerId << workerIdShift)
| sequence);
}
/**
* 阻塞到下一个毫秒,直到获得新的时间戳
*
* @param lastTimestamp 上次生成ID的时间截
* @return 当前时间戳
*/
protected long tilNextMillis(long lastTimestamp) {
long timestamp = timeGen();
while (timestamp <= lastTimestamp) {
timestamp = timeGen();
}
return timestamp;
}
/**
* 返回以毫秒为单位的当前时间
*
* @return 当前时间(毫秒)
*/
protected long timeGen() {
return System.currentTimeMillis();
}
}
...@@ -116,6 +116,13 @@ WHERE ...@@ -116,6 +116,13 @@ WHERE
cdd.type = 'XFSYLX' cdd.type = 'XFSYLX'
</select> </select>
<select id="getByType" resultType="com.yeejoin.amos.boot.biz.common.entity.DataDictionary">
SELECT
*
FROM
cb_data_dictionary cbb
WHERE
cbb.is_delete = 0 and cbb.type = #{type}
</select>
</mapper> </mapper>
...@@ -266,8 +266,8 @@ public class OrgUsrTPDlExcelDto{ ...@@ -266,8 +266,8 @@ public class OrgUsrTPDlExcelDto{
@ApiModelProperty(value = "平台单位id") @ApiModelProperty(value = "平台单位id")
private String companySeqs; private String companySeqs;
@ExplicitConstraint(indexNum = 16, sourceClass = CommonExplicitConstraint.class, method = "getdeptSeqsList") @ExplicitConstraint(indexNum = 16, sourceClass = CommonExplicitConstraint.class, method = "getdeptSeqsList")
@ExcelProperty(value = "平台部门id", index = 16) @ExcelProperty(value = "平台部门", index = 16)
@ApiModelProperty(value = "平台部门id") @ApiModelProperty(value = "平台部门")
private String deptSeqs; private String deptSeqs;
@ExcelIgnore @ExcelIgnore
@ApiModelProperty(value = "邮箱") @ApiModelProperty(value = "邮箱")
......
...@@ -93,12 +93,14 @@ public class WaterResourceDto extends BaseDto { ...@@ -93,12 +93,14 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "建造日期") @ApiModelProperty(value = "建造日期")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@com.alibaba.excel.annotation.format.DateTimeFormat("yyyy-MM-dd")
private Date buildDate; private Date buildDate;
@ExcelProperty(value = "启用日期", index = 8) @ExcelProperty(value = "启用日期", index = 8)
@ApiModelProperty(value = "启用日期") @ApiModelProperty(value = "启用日期")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@com.alibaba.excel.annotation.format.DateTimeFormat("yyyy-MM-dd")
private Date enableDate; private Date enableDate;
@ExcelIgnore @ExcelIgnore
......
package com.yeejoin.equipmanage.common.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 车量里程表
*
* @author duanwei
* @date 2023-02-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="WlCarMileage对象", description="车量里程表")
public class WlCarMileageDto extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "iot编码")
private String iotCode;
@ApiModelProperty(value = "里程km")
private Double travel;
@ApiModelProperty(value = "日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date date;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "耗时")
private Long takeTime;
@ApiModelProperty(value = "开始地址")
private String startName;
@ApiModelProperty(value = "结束地址")
private String endName;
@ApiModelProperty(value = "开始精度")
private Double startLongitude;
@ApiModelProperty(value = "开始纬度")
private Double startLatitude;
@ApiModelProperty(value = "结束精度")
private Double endLongitude;
@ApiModelProperty(value = "结束纬度")
private Double endLatitude;
@ApiModelProperty(value = "开始速度km/h")
private Integer startSpeed;
@ApiModelProperty(value = "结束速度km/h")
private Integer endSpeed;
@TableField(exist = false)
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date filterDate;
@TableField(exist = false)
private String name;
@TableField(exist = false)
private String time;
@TableField(exist = false)
private long carId;
@TableField(exist = false)
private String startFullTime;
@TableField(exist = false)
private String endFullTime;
}
...@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.entity; ...@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity; import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO; import com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -22,7 +23,7 @@ import java.util.List; ...@@ -22,7 +23,7 @@ import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("wl_car") @TableName(value="wl_car",autoResultMap = true)
@ApiModel(value = "Car对象", description = "消防车信息") @ApiModel(value = "Car对象", description = "消防车信息")
public class Car extends BaseEntity { public class Car extends BaseEntity {
...@@ -176,4 +177,61 @@ public class Car extends BaseEntity { ...@@ -176,4 +177,61 @@ public class Car extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String iotStatus; private String iotStatus;
@TableField(exist = false)
private Long categoryId;
@TableField(exist = false)
private String importStr;
@TableField(exist = false)
private Integer totalTravel;
@TableField(exist = false)
private double longitude;
@TableField(exist = false)
private double latitude;
@TableField(exist = false)
private Integer speed;
@ApiModelProperty(value = "配备方式")
private String deployment;
@ApiModelProperty(value = "配备日期")
private String deployDate;
@ApiModelProperty(value = "配备日期区间")
@TableField(typeHandler = FastjsonTypeHandler.class )
private List<String> deployDateRange;
@ApiModelProperty(value = "排量")
private String displacement;
@ApiModelProperty(value = "车辆产权单位")
private String ownership;
@ApiModelProperty(value = "编号")
private String code;
@ApiModelProperty(value = "扩展字段1")
private String extra1;
@ApiModelProperty(value = "扩展字段2")
private String extra2;
@ApiModelProperty(value = "扩展字段3")
private String extra3;
@ApiModelProperty(value = "扩展字段4")
private String extra4;
@TableField(exist = false)
private String iotMeasurement;
@TableField(exist = false)
private String iotDeviceName;
} }
...@@ -173,4 +173,12 @@ public class EquipmentSpecific extends BaseEntity { ...@@ -173,4 +173,12 @@ public class EquipmentSpecific extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String equipCondition; private String equipCondition;
@ApiModelProperty(value = "是否遥测")
@TableField(exist = false)
private Boolean isTrend;
@ApiModelProperty(value = "指标单位")
@TableField(exist = false)
private String unit;
} }
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 车量里程表
*
* @author duanwei
* @date 2023-02-01
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="WlCarMileage对象", description="车量里程表")
public class WlCarMileage extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "iot编码")
private String iotCode;
@ApiModelProperty(value = "里程km")
private Double travel;
@ApiModelProperty(value = "日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date date;
@ApiModelProperty(value = "开始时间")
private Date startTime;
@ApiModelProperty(value = "结束时间")
private Date endTime;
@ApiModelProperty(value = "耗时")
private Long takeTime;
@ApiModelProperty(value = "开始地址")
private String startName;
@ApiModelProperty(value = "结束地址")
private String endName;
@ApiModelProperty(value = "开始精度")
private Double startLongitude;
@ApiModelProperty(value = "开始纬度")
private Double startLatitude;
@ApiModelProperty(value = "结束精度")
private Double endLongitude;
@ApiModelProperty(value = "结束纬度")
private Double endLatitude;
@ApiModelProperty(value = "开始速度km/h")
private Integer startSpeed;
@ApiModelProperty(value = "结束速度km/h")
private Integer endSpeed;
@TableField(exist = false)
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date filterDate;
@TableField(exist = false)
private String name;
@TableField(exist = false)
private String time;
@TableField(exist = false)
private long carId;
@TableField(exist = false)
private boolean complete = false;
}
package com.yeejoin.equipmanage.common.entity.dto;
import com.yeejoin.equipmanage.common.dto.WlCarMileageDto;
import lombok.Data;
import java.util.List;
@Data
public class CarTravelDto {
Long total;
String totalTime;
Integer totalTravel;
List<WlCarMileageDto> records;
}
package com.yeejoin.equipmanage.common.entity.dto;
import lombok.Data;
@Data
public class CommonFile {
private static final long serialVersionUID = 1L;
private String url;
private String name;
private String uid;
private String status;
}
...@@ -65,4 +65,17 @@ public class EquipTypeAmountPageDTO extends BaseDTO<EquipmentSpecific> { ...@@ -65,4 +65,17 @@ public class EquipTypeAmountPageDTO extends BaseDTO<EquipmentSpecific> {
@ApiModelProperty(value = "缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是") @ApiModelProperty(value = "缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是")
private Integer isDefect; private Integer isDefect;
@ApiModelProperty(value = "关键字-地图用")
private String keyword;
@ApiModelProperty(value = "页数-地图用")
private Integer current;
@ApiModelProperty(value = "分页大小-地图用")
private Integer size;
@ApiModelProperty(value = "车牌号")
private String carNum;
} }
package com.yeejoin.equipmanage.common.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.CommonFile;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class CarMessage {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "车牌号")
private String carNum;
@ApiModelProperty(value = "车辆类型")
private Long equipmentId;
@ApiModelProperty(value = "车辆状态")
private String carState;
@ApiModelProperty(value = "品牌")
private String brand;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "规格型号")
private String standard;
@ApiModelProperty(value = "底盘品牌")
private String chassisBrand;
@ApiModelProperty(value = "厂商id")
private Long manufacturerId;
@ApiModelProperty(value = "底盘国别")
private String chassisCountry;
@ApiModelProperty(value = "国别")
private String country;
@ApiModelProperty(value = "进口国产")
private Boolean isImport;
@ApiModelProperty(value = "二维码")
private String qrCode;
@ApiModelProperty(value = "全部二维码含类型标识03#qrCode")
private String fullQrCode;
@ApiModelProperty(value = "保养周期")
private BigDecimal maintenanceCycle;
@ApiModelProperty(value = "3c认证")
private Boolean cccAuth;
@ApiModelProperty(value = "负责人")
private Long creatorId;
@ApiModelProperty(value = "组织机构")
private String orgCode;
@ApiModelProperty(value = "公司名")
private String companyName;
@ApiModelProperty(value = "部门code")
private String departmentOrgcode;
@ApiModelProperty(value = "部门名")
private String departmentName;
@ApiModelProperty(value = "物联编码")
private String iotCode;
@ApiModelProperty(value = "所属单位id(来源于平台)")
private String agencyId;
@ApiModelProperty(value = "所属队伍id(来源于平台)")
private String teamId;
@ApiModelProperty(value = "队伍名称(冗余字段来源于平台)")
private String teamName;
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "图片")
@TableField(exist = false)
private List<CommonFile> img;
@ApiModelProperty(value = "视频")
@TableField(exist = false)
private List<UploadFile> video;
@ApiModelProperty(value = "证书")
@TableField(exist = false)
private List<CommonFile> certification;
@ApiModelProperty(value = "说明")
@TableField(exist = false)
private List<UploadFile> instruction;
@TableField(exist = false)
private Equipment equipment;
@TableField(exist = false)
private String manufacturerName;
@TableField(exist = false)
private String countryName;
@TableField(exist = false)
private String chassisCountryName;
@TableField(exist = false)
private ManufacturerInfo manufacturerInfo;
@TableField(exist = false)
private List<CarProperty> carPropertyList;
@TableField(exist = false)
private List<Journal> journals;
@TableField(exist = false)
private List<EquipmentOnCarAppVO> EquipmentsOnCar;
@TableField(exist = false)
@ApiModelProperty(value = "扩展字段")
private String ext;
@TableField(exist = false)
private String unitName;
@TableField(exist = false)
private Unit unit;
@ApiModelProperty(value = "证书")
@TableField(exist = false)
private String iotStatus;
@TableField(exist = false)
private Long categoryId;
@TableField(exist = false)
private String importStr;
@TableField(exist = false)
private Integer totalTravel;
@TableField(exist = false)
private double longitude;
@TableField(exist = false)
private double latitude;
@TableField(exist = false)
private Integer speed;
@ApiModelProperty(value = "配备方式")
private String deployment;
@ApiModelProperty(value = "配备日期")
private String deployDate;
@ApiModelProperty(value = "配备日期区间")
@TableField(typeHandler = FastjsonTypeHandler.class )
private List<String> deployDateRange;
@ApiModelProperty(value = "排量")
private String displacement;
@ApiModelProperty(value = "车辆产权单位")
private String ownership;
@ApiModelProperty(value = "编号")
private String code;
@ApiModelProperty(value = "扩展字段1")
private String extra1;
@ApiModelProperty(value = "扩展字段2")
private String extra2;
@ApiModelProperty(value = "扩展字段3")
private String extra3;
@ApiModelProperty(value = "扩展字段4")
private String extra4;
@TableField(exist = false)
private String iotMeasurement;
@TableField(exist = false)
private String iotDeviceName;
}
...@@ -55,4 +55,10 @@ public class EquipTypeImgAmountVO { ...@@ -55,4 +55,10 @@ public class EquipTypeImgAmountVO {
@ApiModelProperty(value = "所在建筑") @ApiModelProperty(value = "所在建筑")
private String belongBuildName; private String belongBuildName;
@ApiModelProperty(value = "经度")
private Double longitude;
@ApiModelProperty(value = "纬度")
private Double latitude;
} }
package com.yeejoin.equipmanage.common.utils;
public class CoordinateUtil {
// WGS84标准参考椭球中的地球长半径(单位:米)
private static final double EARH_RADIUS_WGS84 = 6378137.0;
public static double distance(double lat1, double lng1, double lat2, double lng2) {
double radLat1 = Math.toRadians(lat1);
double radLat2 = Math.toRadians(lat2);
double a = radLat1 - radLat2;
double b = Math.toRadians(lng1) - Math.toRadians(lng2);
double s = 2 * Math.asin(Math.sqrt(
Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
return s * EARH_RADIUS_WGS84;
}
}
...@@ -221,6 +221,47 @@ public class QRCodeUtil { ...@@ -221,6 +221,47 @@ public class QRCodeUtil {
return encoder.encodeToString(outputStream.toByteArray()); return encoder.encodeToString(outputStream.toByteArray());
} }
/**
* 根据二维码信息,生成二维码图片 用户excel,word等导出图片 可自定义图片大小
*
* @param content
* @return
*/
public static byte[] generateQRCodeImageByteData(String content, int size) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
hints.put(EncodeHintType.CHARACTER_SET, CHARSET);
hints.put(EncodeHintType.MARGIN, 1);
BitMatrix bitMatrix = new MultiFormatWriter().encode(
content
, BarcodeFormat.QR_CODE
, size
, size,
hints);
int width = bitMatrix.getWidth();
int height = bitMatrix.getHeight();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF);
}
}
ImageIO.write(image, "png", out);
return out.toByteArray();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(genQrCodeBase64Png("101",100,100)); System.out.println(genQrCodeBase64Png("101",100,100));
System.out.println(genQrCodeBase64PngWithWord("101",100,100,"sd",100)); System.out.println(genQrCodeBase64PngWithWord("101",100,100,"sd",100));
......
...@@ -113,7 +113,7 @@ public class UnitTransformUtil { ...@@ -113,7 +113,7 @@ public class UnitTransformUtil {
BigDecimal nowVal = new BigDecimal(0); BigDecimal nowVal = new BigDecimal(0);
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)) { if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)) {
nowVal = new BigDecimal(currentValue); nowVal = new BigDecimal(currentValue);
map.put("nowValue", nowVal); map.put("nowValue", nowVal.setScale(2, BigDecimal.ROUND_HALF_UP));
} else { } else {
map.put("nowValue", "--"); map.put("nowValue", "--");
} }
......
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
</select> </select>
<select id="queryStaticForPage" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto"> <select id="queryStaticForPage" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto">
select date,count(name) signNum,bizOrgName,bizOrgCode,personOfDay from ( select date,count(userId) signNum,bizOrgName,bizOrgCode,personOfDay from (
SELECT SELECT
DISTINCT name, DISTINCT sign.user_id userId,
date, date,
biz_org_Name bizOrgName, biz_org_Name bizOrgName,
biz_org_code bizOrgCode, biz_org_code bizOrgCode,
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
group by group by
date, date,
biz_org_code, biz_org_code,
name user_id
order by order by
sign.sign_time desc sign.sign_time desc
) s group by date,bizOrgCode ) s group by date,bizOrgCode
......
...@@ -12,6 +12,13 @@ ...@@ -12,6 +12,13 @@
<artifactId>amos-boot-module-patrol-api</artifactId> <artifactId>amos-boot-module-patrol-api</artifactId>
<dependencies> <dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.10</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
......
package com.yeejoin.amos.patrol.core.common.request;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.net.NetUtil;
import cn.hutool.core.util.IdUtil;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.IdentifierGenerator;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.PostConstruct;
import java.io.Serializable;
/**
* @description:
* @author: tw
* @createDate: 2023/4/10
*/
public class MyIdGeneratorConfig implements IdentifierGenerator {
/**
* 终端ID
*/
@Value("${generator.worker_id}")
public long WORKER_ID;
/**
* 数据中心id
*/
@Value("${generator.datacenter_id}")
public long DATACENTER_ID;
private Snowflake snowflake = IdUtil.createSnowflake(WORKER_ID, DATACENTER_ID);
@PostConstruct
public void init() {
WORKER_ID = NetUtil.ipv4ToLong(NetUtil.getLocalhostStr());
}
public synchronized long snowflakeId() {
return snowflake.nextId();
}
public synchronized long snowflakeId(long workerId, long datacenterId) {
Snowflake snowflake = IdUtil.createSnowflake(workerId, datacenterId);
return snowflake.nextId();
}
@Override
public Serializable generate(SharedSessionContractImplementor session, Object object)
throws HibernateException {
return snowflakeId(WORKER_ID, DATACENTER_ID);
}
}
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.dao.entity; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.dao.entity;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...@@ -35,7 +36,11 @@ public class BasicEntity implements Serializable{ ...@@ -35,7 +36,11 @@ public class BasicEntity implements Serializable{
private Date createDate; private Date createDate;
@Id @Id
@GeneratedValue(strategy=GenerationType.IDENTITY) @GeneratedValue(generator = "myIdGeneratorConfig",
strategy = GenerationType.AUTO)
@GenericGenerator(
name = "myIdGeneratorConfig",
strategy = "com.yeejoin.amos.patrol.core.common.request.MyIdGeneratorConfig")
@Column(name = "ID",nullable=false,unique=true) @Column(name = "ID",nullable=false,unique=true)
public long getId() { public long getId() {
return id; return id;
......
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
...@@ -43,11 +44,17 @@ public class DutyShiftController extends BaseController { ...@@ -43,11 +44,17 @@ public class DutyShiftController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增值班班次", notes = "新增值班班次") @ApiOperation(httpMethod = "POST", value = "新增值班班次", notes = "新增值班班次")
public ResponseModel<DutyShiftDto> save(HttpServletRequest request, @RequestBody DutyShiftDto model) { public ResponseModel<Boolean> save(HttpServletRequest request, @RequestBody DutyShiftDto model) {
QueryWrapper<DutyShift> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name", model.getName());
List<DutyShift> list = dutyShiftServiceImpl.list(queryWrapper);
if(!list.isEmpty()) {
return ResponseHelper.buildResponse(false);
}
String appKey = request.getHeader("appKey"); String appKey = request.getHeader("appKey");
model.setAppKey(appKey); model.setAppKey(appKey);
model = dutyShiftServiceImpl.createWithModel(model); dutyShiftServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(true);
} }
/** /**
...@@ -79,7 +86,7 @@ public class DutyShiftController extends BaseController { ...@@ -79,7 +86,7 @@ public class DutyShiftController extends BaseController {
if(dutyPersonShiftServiceImpl.checkCurrentDutyIsUser(sequenceNbr)) { if(dutyPersonShiftServiceImpl.checkCurrentDutyIsUser(sequenceNbr)) {
return ResponseHelper.buildResponse(false); return ResponseHelper.buildResponse(false);
}; }
DutyShift dutyShift = dutyShiftServiceImpl.getById(sequenceNbr); DutyShift dutyShift = dutyShiftServiceImpl.getById(sequenceNbr);
if (null != dutyShift) { if (null != dutyShift) {
dutyShift.setIsDelete(true); dutyShift.setIsDelete(true);
......
...@@ -26,6 +26,7 @@ import io.swagger.annotations.Api; ...@@ -26,6 +26,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -42,6 +43,7 @@ import java.util.Collection; ...@@ -42,6 +43,7 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author fengwang * @author fengwang
...@@ -249,6 +251,7 @@ public class OrgPersonController extends BaseController { ...@@ -249,6 +251,7 @@ public class OrgPersonController extends BaseController {
@TycloudOperation( ApiLevel = UserType.AGENCY) @TycloudOperation( ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/listAllByCurrentUserALL", method = RequestMethod.GET) @RequestMapping(value = "/listAllByCurrentUserALL", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询(表单用)", notes = "列表分页查询(表单用)") @ApiOperation(httpMethod = "GET", value = "列表分页查询(表单用)", notes = "列表分页查询(表单用)")
@PersonIdentify
public ResponseModel<Object> listAllByCurrentUserALL() { public ResponseModel<Object> listAllByCurrentUserALL() {
Map<String, Object> req = new HashMap<>(); Map<String, Object> req = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
...@@ -496,6 +499,22 @@ public class OrgPersonController extends BaseController { ...@@ -496,6 +499,22 @@ public class OrgPersonController extends BaseController {
return ResponseHelper.buildResponse(iOrgUsrService.personListByBizOrgCode( requestBody.containsKey("bizOrgCode") ? requestBody.get("bizOrgCode").toString() : null)); return ResponseHelper.buildResponse(iOrgUsrService.personListByBizOrgCode( requestBody.containsKey("bizOrgCode") ? requestBody.get("bizOrgCode").toString() : null));
} }
/**
* 根据bizOrgCode查询
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PersonIdentify
@RequestMapping(value = "/getByCurrent/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "查询当前单位或部门自己的人员列表 非父子级", notes = "根据bizOrgCode查询")
public ResponseModel<List<OrgUsr>> personListByCurrent() {
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(iOrgUsrService.personByBizOrgCode( reginParams.getPersonIdentity().getCompanyBizOrgCode()));
}
/** /**
* 根据bizOrgCode查询 * 根据bizOrgCode查询
* @param bizOrgCode * @param bizOrgCode
...@@ -521,4 +540,23 @@ public class OrgPersonController extends BaseController { ...@@ -521,4 +540,23 @@ public class OrgPersonController extends BaseController {
} }
/**
* 根据ids查询多人员信息
* @param ids
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/listCompanyByIds", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据ids查询多人员信息 非父子级", notes = "根据ids查询多人员信息")
public List<OrgUsr> listCompanyByIds(@RequestParam List<Long> ids) {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete,false);
wrapper.in(OrgUsr::getSequenceNbr,ids);
wrapper.eq(OrgUsr::getBizOrgType,"PERSON");
List<OrgUsr> orgUsrs = orgUsrMapper.selectList(wrapper);
return orgUsrs;
}
} }
...@@ -625,33 +625,31 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -625,33 +625,31 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
// 2021-09-16 // 2021-09-16
if (null != t.get("amosOrgId") && StringUtils.isNotEmpty(t.get("amosOrgId").toString())) { if (null != t.get("amosOrgId") && StringUtils.isNotEmpty(t.get("amosOrgId").toString())) {
amosIds.add(t.get("amosOrgId").toString()); amosIds.add(t.get("amosOrgId").toString());
String chargePersonId = iOrgUsrService.getIdNumberByAmosId(t.get("amosOrgId").toString()); if (!ObjectUtils.isEmpty(t.get("certificateTypeValue")) && "120".equals(t.get("certificateTypeValue").toString())) {
t.put("chargePersonId", chargePersonId); t.put("chargePersonId", t.get("certificatesNumber"));
}
} else { } else {
t.put("chargePersonId", null); t.put("chargePersonId", null);
} }
if (!ObjectUtils.isEmpty(t.get("state"))) {
DataDictionary gwmc = dataDictionaryService.getByCode(t.get("state").toString(), "RYZT");
if (!ObjectUtils.isEmpty(gwmc)) {
t.put("stateName", gwmc.getName());
} else {
t.put("stateName", t.get("state"));
}
}
}); });
List<DataDictionary> dictList = dataDictionaryService.getByType("RYZT");
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(DataDictionary::getCode, DataDictionary::getName));
Map<String, AgencyUserModel> collect = new HashMap<>();
if (CollectionUtils.isNotEmpty(amosIds)) { if (CollectionUtils.isNotEmpty(amosIds)) {
String join = String.join(",", amosIds); String join = String.join(",", amosIds);
List<AgencyUserModel> amosUser = Privilege.agencyUserClient.queryByIds(join, false).getResult(); List<AgencyUserModel> amosUser = Privilege.agencyUserClient.queryByIds(join, false).getResult();
Map<String, AgencyUserModel> collect = amosUser.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, t -> t)); collect = amosUser.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, t -> t));
list.stream().forEach(t -> {
if (null != t.get("amosOrgId") && StringUtils.isNotEmpty(t.get("amosOrgId").toString()) && collect.containsKey(t.get("amosOrgId").toString())) {
t.put("amosOrgCode", collect.get(t.get("amosOrgId").toString()).getRealName());
}
});
} }
Map<String, AgencyUserModel> finalCollect = collect;
list.forEach(t -> {
if (!ObjectUtils.isEmpty(finalCollect) && null != t.get("amosOrgId") && StringUtils.isNotEmpty(t.get("amosOrgId").toString()) && finalCollect.containsKey(t.get("amosOrgId").toString())) {
t.put("amosOrgCode", finalCollect.get(t.get("amosOrgId").toString()).getRealName());
}
if (!ObjectUtils.isEmpty(t.get("state"))) {
t.put("stateName", dictMap.getOrDefault(t.get("state").toString(), t.get("state").toString()));
}
});
if(!positionType.equals("")) { if(!positionType.equals("")) {
String positionTypeFine = positionType; String positionTypeFine = positionType;
list = list.stream().filter(e-> !ObjectUtils.isEmpty(e.get("positionType")) && String.valueOf(e.get("positionType")).contains(positionTypeFine)).collect(Collectors.toList()); list = list.stream().filter(e-> !ObjectUtils.isEmpty(e.get("positionType")) && String.valueOf(e.get("positionType")).contains(positionTypeFine)).collect(Collectors.toList());
...@@ -721,41 +719,38 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -721,41 +719,38 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<Map<String, Object>> list = this.baseMapper.selectPersonList(map); List<Map<String, Object>> list = this.baseMapper.selectPersonList(map);
//处理循环中的远程调用(原有逻辑不变) //处理循环中的远程调用(原有逻辑不变)
List<String> amosIds = new ArrayList<>(); List<String> amosIds = new ArrayList<>();
list.stream().forEach(t -> { list.forEach(t -> {
// BUG2886 因为前期沟通 人员code 可能会发生改变 所以 现在接口code 不再保存,查询数据时通过接口重新赋值 by kongfm // BUG2886 因为前期沟通 人员code 可能会发生改变 所以 现在接口code 不再保存,查询数据时通过接口重新赋值 by kongfm
// 2021-09-16 // 2021-09-16
if (null != t.get("amosOrgId") && StringUtils.isNotEmpty(t.get("amosOrgId").toString())) { if (null != t.get("amosOrgId") && StringUtils.isNotEmpty(t.get("amosOrgId").toString())) {
amosIds.add(t.get("amosOrgId").toString()); amosIds.add(t.get("amosOrgId").toString());
if (!ObjectUtils.isEmpty(t.get("certificateTypeValue")) && "120".equals(t.get("certificateTypeValue").toString())) {
String chargePersonId = iOrgUsrService.getIdNumberByAmosId(t.get("amosOrgId").toString()); t.put("chargePersonId", t.get("certificatesNumber"));
t.put("chargePersonId", chargePersonId); }
} else { } else {
t.put("chargePersonId", null); t.put("chargePersonId", null);
} }
if (!ObjectUtils.isEmpty(t.get("state"))) {
DataDictionary gwmc = dataDictionaryService.getByCode(t.get("state").toString(), "RYZT");
if (!ObjectUtils.isEmpty(gwmc)) {
t.put("stateName", gwmc.getName());
} else {
t.put("stateName", t.get("state"));
}
}
}); });
List<DataDictionary> dictList = dataDictionaryService.getByType("RYZT");
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(DataDictionary::getCode, DataDictionary::getName));
Map<String, AgencyUserModel> collect = new HashMap<>();
if (CollectionUtils.isNotEmpty(amosIds)) { if (CollectionUtils.isNotEmpty(amosIds)) {
String join = String.join(",", amosIds); String join = String.join(",", amosIds);
List<AgencyUserModel> amosUser = Privilege.agencyUserClient.queryByIds(join, false).getResult(); List<AgencyUserModel> amosUser = Privilege.agencyUserClient.queryByIds(join, false).getResult();
Map<String, AgencyUserModel> collect = amosUser.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, t -> t)); collect = amosUser.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, t -> t));
list.stream().forEach(t -> { }
if (null != t.get("amosOrgId") && StringUtils.isNotEmpty(t.get("amosOrgId").toString()) && collect.containsKey(t.get("amosOrgId").toString())) { Map<String, AgencyUserModel> finalCollect = collect;
t.put("amosOrgCode", collect.get(t.get("amosOrgId").toString()).getRealName()); list.forEach(t -> {
if (!ObjectUtils.isEmpty(finalCollect) && null != t.get("amosOrgId") && StringUtils.isNotEmpty(t.get("amosOrgId").toString()) && finalCollect.containsKey(t.get("amosOrgId").toString())) {
t.put("amosOrgCode", finalCollect.get(t.get("amosOrgId").toString()).getRealName());
}
if (!ObjectUtils.isEmpty(t.get("state"))) {
t.put("stateName", dictMap.getOrDefault(t.get("state").toString(), t.get("state").toString()));
} }
}); });
}
/* Bug2652 根据名字和工号模糊查询失效 已添加模糊匹配 2021-09-01 陈召 结束 */ /* Bug2652 根据名字和工号模糊查询失效 已添加模糊匹配 2021-09-01 陈召 结束 */
pageBean.setRecords(list); pageBean.setRecords(list);
return pageBean; return pageBean;
} }
...@@ -1654,17 +1649,25 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1654,17 +1649,25 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return null; return null;
} }
List<CompanyPerson> tempList = new ArrayList<CompanyPerson>(); List<CompanyPerson> tempList = new ArrayList<CompanyPerson>();
for (Long tempId : ids) { //4.24优化 原有方法不断循环查库 接口太慢 将数据一次捞出由java层组装
// BUG 2740 机场单位主键varchar 导致 通过主键搜索返回多条数据 2021 - 09 - 09by kongfm //获取指定单位
OrgUsr org = getById(tempId.toString()); LambdaQueryWrapper<OrgUsr> companyWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isEmpty(org)) { companyWrapper.in(BaseEntity::getSequenceNbr,ids);
continue; List<OrgUsr> companys = this.orgUsrMapper.selectList(companyWrapper);
} //获取指定单位下所有人员
LambdaQueryWrapper<OrgUsr> personWrapper = new LambdaQueryWrapper<>();
personWrapper.in(OrgUsr::getParentId,ids);
personWrapper.eq(OrgUsr::getBizOrgType,OrgPersonEnum.人员.getKey());
personWrapper.eq(BaseEntity::getIsDelete,false);
List<OrgUsr> persons = this.orgUsrMapper.selectList(personWrapper);
//将各单位人员数据组装
companys.stream().forEach(e->{
List<OrgUsr> list = persons.stream().filter(p -> p.getParentId().equals(e.getSequenceNbr().toString())).collect(Collectors.toList());
CompanyPerson company = new CompanyPerson(); CompanyPerson company = new CompanyPerson();
BeanUtils.copyProperties(org, company); BeanUtils.copyProperties(e, company);
company.setPersons(this.queryForListByParentIdAndOrgType(org.getSequenceNbr(), OrgPersonEnum.人员.getKey())); company.setPersons(Bean.toModels(list, this.getModelClass()));
tempList.add(company); tempList.add(company);
} });
return tempList; return tempList;
} }
...@@ -3376,6 +3379,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3376,6 +3379,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return baseMapper.selectList(wrapper); return baseMapper.selectList(wrapper);
} }
public List<OrgUsr> personByBizOrgCode(String bizOrgCode){
QueryWrapper<OrgUsr> wrapper = new QueryWrapper<>();
wrapper.eq("is_delete",false);
wrapper.like("biz_org_code",bizOrgCode);
wrapper.eq("biz_org_type","PERSON");
wrapper.isNotNull("amos_org_id");
return baseMapper.selectList(wrapper);
}
public List<OrgUsr> getDetByCompanyId(String companyId){ public List<OrgUsr> getDetByCompanyId(String companyId){
QueryWrapper<OrgUsr> wrapper = new QueryWrapper<>(); QueryWrapper<OrgUsr> wrapper = new QueryWrapper<>();
wrapper.eq("is_delete",false); wrapper.eq("is_delete",false);
......
package com.yeejoin.equipmanage.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @program: api
* @description:
* @author: duanwei
* @create: 2019-12-13 11:16
**/
@Order(Ordered.HIGHEST_PRECEDENCE)
@Configuration
public class CORSFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST,GET,OPTIONS,PUT,DELETE,PATCH,HEAD");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers",
"Origin, X-Requested-With, X-Access-Token, X-Api-Key, Content-Type, Accept, Cache-Control,appkey,token,product");
//response.setHeader("Access-Control-Allow-Headers","*");
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
response.setStatus(HttpServletResponse.SC_OK);
} else {
filterChain.doFilter(servletRequest, servletResponse);
}
}
@Override
public void destroy() {
}
}
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -7,11 +8,14 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -7,11 +8,14 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.equipmanage.common.dto.CarInfoDto; import com.yeejoin.equipmanage.common.dto.CarInfoDto;
import com.yeejoin.equipmanage.common.dto.CarStatusInfoDto; import com.yeejoin.equipmanage.common.dto.CarStatusInfoDto;
import com.yeejoin.equipmanage.common.entity.*; import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.CommonFile;
import com.yeejoin.equipmanage.common.entity.publics.CommonResponse; import com.yeejoin.equipmanage.common.entity.publics.CommonResponse;
import com.yeejoin.equipmanage.common.entity.vo.CarIndexVo; import com.yeejoin.equipmanage.common.entity.vo.CarIndexVo;
import com.yeejoin.equipmanage.common.entity.vo.CarMessage;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO; import com.yeejoin.equipmanage.common.entity.vo.EquipmentOnCarAppVO;
import com.yeejoin.equipmanage.common.enums.*; import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
...@@ -27,6 +31,7 @@ import io.swagger.annotations.ApiParam; ...@@ -27,6 +31,7 @@ import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
...@@ -169,7 +174,23 @@ public class CarController extends AbstractBaseController { ...@@ -169,7 +174,23 @@ public class CarController extends AbstractBaseController {
// Car carInstance = iCarService.saveCar(user, car, carInfo, carpList); // Car carInstance = iCarService.saveCar(user, car, carInfo, carpList);
// saveFile(carInstance); 图片视频后期统一处理 // saveFile(carInstance); 图片视频后期统一处理
//如果默认有id值则认为是更新
if (car.getId() != null) {
Car car1 = this.iCarService.getById(car.getId());
if (car.getOrgCode() != null && !car.getBizOrgCode().equals(car1.getBizOrgCode())) {
FeignClientResult<Map<String, Object>> result = Privilege.companyClient
.queryByOrgcode(car.getBizOrgCode());
System.out.println("==============================" + JSONObject.toJSONString(result.getResult()));
if (result.getResult() != null && result.getResult().containsKey("compnay")) {
Map<String, String> map = (Map<String, String>) result.getResult().get("compnay");
car.setBizOrgName(map.get("companyName"));
}
}
Car car2 = updateCar(car);
CarController controllerProxy = SpringUtils.getBean(CarController.class);
controllerProxy.refreshAllCount();
return car2;
}
// 验证车辆code唯一性 // 验证车辆code唯一性
String iotCode = car.getIotCode(); String iotCode = car.getIotCode();
if(StringUtils.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())){ if(StringUtils.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())){
...@@ -183,7 +204,7 @@ public class CarController extends AbstractBaseController { ...@@ -183,7 +204,7 @@ public class CarController extends AbstractBaseController {
} }
car.setQrCode(QRCodeUtil.generateQRCode()); car.setQrCode(QRCodeUtil.generateQRCode());
List<CarProperty> carPropertyList = car.getCarPropertyList(); List<CarProperty> carPropertyList = car.getCarPropertyList();
if (carPropertyList.size() > 0) { if (carPropertyList != null && carPropertyList.size() > 0) {
carPropertyList.forEach(x -> { carPropertyList.forEach(x -> {
QueryWrapper<EquipmentIndex> queryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentIndex> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", x.getEquipmentIndexId()); queryWrapper.eq("id", x.getEquipmentIndexId());
...@@ -198,6 +219,18 @@ public class CarController extends AbstractBaseController { ...@@ -198,6 +219,18 @@ public class CarController extends AbstractBaseController {
} }
}); });
} }
if (ObjectUtils.isEmpty(car.getName())) {
Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
car.setName(equipment != null ? equipment.getName() : null);
}
if (ObjectUtils.isEmpty(car.getBizOrgName()) && !ObjectUtils.isEmpty(car.getBizOrgCode())) {
FeignClientResult<Map<String, Object>> result = Privilege.companyClient.queryByOrgcode(car.getBizOrgCode());
System.out.println("==============================" + JSONObject.toJSONString(result.getResult()));
if (result.getResult() != null && result.getResult().containsKey("compnay")) {
Map<String, String> map = (Map<String, String>) result.getResult().get("compnay");
car.setBizOrgName(map.get("companyName"));
}
}
Car car2 = iCarService.saveOne(car); Car car2 = iCarService.saveOne(car);
CarController controllerProxy = SpringUtils.getBean(CarController.class); CarController controllerProxy = SpringUtils.getBean(CarController.class);
controllerProxy.refreshAllCount(); controllerProxy.refreshAllCount();
...@@ -327,6 +360,18 @@ public class CarController extends AbstractBaseController { ...@@ -327,6 +360,18 @@ public class CarController extends AbstractBaseController {
if (!ObjectUtils.isEmpty(car.getTeamId())){ if (!ObjectUtils.isEmpty(car.getTeamId())){
jcsFeign.getUserCar(car.getId(),car.getTeamId()); jcsFeign.getUserCar(car.getId(),car.getTeamId());
} }
if (ObjectUtils.isEmpty(car.getName())) {
Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
car.setName(equipment != null ? equipment.getName() : null);
}
if (ObjectUtils.isEmpty(car.getBizOrgName()) && !ObjectUtils.isEmpty(car.getBizOrgCode())) {
FeignClientResult<Map<String, Object>> result = Privilege.companyClient.queryByOrgcode(car.getBizOrgCode());
System.out.println("==============================" + JSONObject.toJSONString(result.getResult()));
if (result.getResult() != null && result.getResult().containsKey("compnay")) {
Map<String, String> map = (Map<String, String>) result.getResult().get("compnay");
car.setBizOrgName(map.get("companyName"));
}
}
Car car1 = iCarService.updateOneById(car); Car car1 = iCarService.updateOneById(car);
CarController controllerProxy = SpringUtils.getBean(CarController.class); CarController controllerProxy = SpringUtils.getBean(CarController.class);
controllerProxy.refreshAllCount(); controllerProxy.refreshAllCount();
...@@ -378,6 +423,36 @@ public class CarController extends AbstractBaseController { ...@@ -378,6 +423,36 @@ public class CarController extends AbstractBaseController {
} }
/** /**
* 电建项目-车辆信息详情(表单组件格式导致白屏修复)
* @param request
* @param id
* @return
*/
@RequestMapping(value = "getMessage/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public CarMessage getMessage(HttpServletRequest request, @PathVariable Long id) {
CarMessage carMessage = new CarMessage();
Car car = iCarService.selectOneById(id);
BeanUtils.copyProperties(car, carMessage, "img");
ArrayList<CommonFile> commonFiles = new ArrayList<>();
car.getImg().forEach(item -> {
CommonFile commonFile = new CommonFile();
BeanUtils.copyProperties(item, commonFile);
commonFiles.add(commonFile);
});
ArrayList<CommonFile> certifications = new ArrayList<>();
car.getCertification().forEach(item -> {
CommonFile commonFile = new CommonFile();
BeanUtils.copyProperties(item, commonFile);
certifications.add(commonFile);
});
carMessage.setImg(commonFiles);
carMessage.setCertification(certifications);
return carMessage;
}
/**
* 根据id查询 * 根据id查询
* *
* @param carIds * @param carIds
...@@ -1308,4 +1383,18 @@ public class CarController extends AbstractBaseController { ...@@ -1308,4 +1383,18 @@ public class CarController extends AbstractBaseController {
FeignClientResult<List<OrgMenuDto>> menusList = jcsFeign.getCompanyDeptTreeWithAuth(iotAuthKey, null); FeignClientResult<List<OrgMenuDto>> menusList = jcsFeign.getCompanyDeptTreeWithAuth(iotAuthKey, null);
return ResponseHelper.buildResponse(menusList.getResult()); return ResponseHelper.buildResponse(menusList.getResult());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getQRCode", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取二维码图片", notes = "获取二维码图片")
public ResponseModel<Object> getQRCode(long id) throws Exception {
return ResponseHelper.buildResponse(iCarService.getQRCode(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/location", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取二维码图片", notes = "获取二维码图片")
public ResponseModel<Object> location() throws Exception {
return ResponseHelper.buildResponse(iCarService.location());
}
} }
package com.yeejoin.equipmanage.controller;
import lombok.Data;
import java.util.List;
@Data
public class Coordinate {
//经纬度
private List<Double> lnglat;
//车速
private double speed;
//时间
private long time;
// 转角
private double direction;
}
...@@ -117,6 +117,9 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -117,6 +117,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@Value("${equip.enabled}") @Value("${equip.enabled}")
private Boolean enabled; private Boolean enabled;
@Autowired
IEquipmentIndexService equipmentIndexService;
@Value("${iot.code.prefix.have.used:20210003,20210004,20210005}") @Value("${iot.code.prefix.have.used:20210003,20210004,20210005}")
private String haveUsedIotPrefix; private String haveUsedIotPrefix;
...@@ -246,7 +249,9 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -246,7 +249,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@RequestParam(required = false) Long stockDetailId) { @RequestParam(required = false) Long stockDetailId) {
EquipmentDate equipmentDate = new EquipmentDate(); EquipmentDate equipmentDate = new EquipmentDate();
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.getEquipSpecificEntityByCode(code); EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.getEquipSpecificEntityByCode(code);
EquipmentIndex equipmentIndex = equipmentIndexService.getById(equipmentSpecific.getRealtimeIotIndexId());
equipmentSpecific.setIsTrend(equipmentIndex.getIsTrend());
equipmentSpecific.setUnit(equipmentIndex.getUnit());
FireFightingSystemEntity fightingSystemEntity = new FireFightingSystemEntity(); FireFightingSystemEntity fightingSystemEntity = new FireFightingSystemEntity();
if(!ObjectUtils.isEmpty(equipmentSpecific.getSystemId())){ if(!ObjectUtils.isEmpty(equipmentSpecific.getSystemId())){
fightingSystemEntity = fireFightingSystemService.getOneById(Long.valueOf(equipmentSpecific.getSystemId())); fightingSystemEntity = fireFightingSystemService.getOneById(Long.valueOf(equipmentSpecific.getSystemId()));
......
...@@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -199,6 +200,29 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -199,6 +200,29 @@ public class FireFightingSystemController extends AbstractBaseController {
return result; return result;
} }
/**
* 装备卡片批量删除
*
* @return
*/
@DeleteMapping(value = "/delEquipmentSpecificByIds")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "装备卡片批量删除")
@Transactional
public ResponseModel delEquipmentSpecific(@RequestBody List<Long> specificIds) {
if (CollectionUtils.isEmpty(specificIds)) {
throw new BadRequest("所选装备不能为空");
}
Set<String> bizOrgCodes = new HashSet<>();
specificIds.forEach(specId -> {
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getById(specId);
equipmentSpecificSerivce.delEquipmentSpecificByIdNew(equipmentSpecific);
bizOrgCodes.add(equipmentSpecific.getBizOrgCode());
});
bizOrgCodes.forEach(this::refreshCount);
return CommonResponseUtil.success(Boolean.TRUE);
}
private void refreshCount(String bizOrgCode) { private void refreshCount(String bizOrgCode) {
equipmentSpecificSerivce.refreshStaData(); equipmentSpecificSerivce.refreshStaData();
...@@ -339,6 +363,50 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -339,6 +363,50 @@ public class FireFightingSystemController extends AbstractBaseController {
} }
@GetMapping(value = "/getEquipTypeAmountCar")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "九大类下装备,通过code截取", notes = "九大类下装备信息列表")
public IPage<EquipTypeImgAmountVO> getEquipTypeAmountCarByGet(EquipTypeAmountPageDTO equipTypeAmountPage) {
String[] result = hierarchy.split(",");
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < result.length; i++) {
map.put(i, Integer.valueOf(result[i]));
}
if(equipTypeAmountPage.getCurrent()!=null&&equipTypeAmountPage.getSize()!=null)
{
equipTypeAmountPage.setPage(new Page<>(equipTypeAmountPage.getCurrent(),equipTypeAmountPage.getSize()));
}
if (StringUtil.isNotEmpty(equipTypeAmountPage.getEquipmentClassificationCode())) {
QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>();
equipmentCategoryQueryWrapper.eq("code", equipTypeAmountPage.getEquipmentClassificationCode());
equipmentCategoryQueryWrapper.eq("industry_code", equipTypeAmountPage.getIndustryCode());
EquipmentCategory equipmentCategory = equipmentCategoryService.getOne(equipmentCategoryQueryWrapper);
if (equipmentCategory == null) {
throw new RuntimeException("装备定义code有误");
}
int inhierarchy = 1;
for (int i = 0; i < result.length + 1; i++) {
//进来先判断是否默认就是空,如果为空第一层
if (equipmentCategory.getParentId() == null) {
//判断是否是最下面的子节点
if (i >= 4) {
inhierarchy = 8;
} else {
inhierarchy = map.get(i);
}
break;
} else {
//查找到循环几次为空
equipmentCategory = equipmentCategoryService.getById(equipmentCategory.getParentId());
}
}
return fireFightingSystemService.getColaCategoryAmountCarList(inhierarchy, equipTypeAmountPage.getEquipmentClassificationCode().substring(0, inhierarchy), equipTypeAmountPage);
} else {
return fireFightingSystemService.getColaCategoryAmountCarList(0, null, equipTypeAmountPage);
}
}
@PostMapping(value = "/iot/getEquipTypeAmount") @PostMapping(value = "/iot/getEquipTypeAmount")
......
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.dto.WlCarMileageDto;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.entity.dto.CarTravelDto;
import com.yeejoin.equipmanage.common.utils.NameUtils;
import com.yeejoin.equipmanage.service.IWlCarMileageService;
import com.yeejoin.equipmanage.utils.BeanUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 车量里程表
*
* @author duanwei
* @date 2023-02-01
*/
@RestController
@Api(tags = "车量里程表Api")
@RequestMapping(value = "/wl-car-mileage", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class WlCarMileageController {
@Autowired
IWlCarMileageService iWlCarMileageService;
/**
* 新增车量里程表
*
* @return
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增车量里程表", notes = "新增车量里程表")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public boolean saveWlCarMileage(HttpServletRequest request, @RequestBody WlCarMileage wlCarMileage) {
return iWlCarMileageService.save(wlCarMileage);
}
/**
* 根据id删除
*
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
return iWlCarMileageService.removeById(id);
}
/**
* 修改车量里程表
*
* @return
*/
@RequestMapping(value = "/updateById", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "修改车量里程表", notes = "修改车量里程表")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public boolean updateByIdWlCarMileage(HttpServletRequest request, @RequestBody WlCarMileage wlCarMileage) {
return iWlCarMileageService.updateById(wlCarMileage);
}
/**
* 根据id查询
*
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public WlCarMileage selectById(HttpServletRequest request, @PathVariable Long id) {
return iWlCarMileageService.getById(id);
}
/**
* 列表分页查询
*
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public IPage<WlCarMileage> listPage(String pageNum, String pageSize, WlCarMileage wlCarMileage) {
Page<WlCarMileage> pageBean;
QueryWrapper<WlCarMileage> wlCarMileageQueryWrapper = new QueryWrapper<>();
Class<? extends WlCarMileage> aClass = wlCarMileage.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(wlCarMileage);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(wlCarMileage);
wlCarMileageQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(wlCarMileage);
wlCarMileageQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(wlCarMileage);
wlCarMileageQueryWrapper.eq(name, fileValue);
} else if (type.equals(Date.class)) {
Date fileValue = (Date) field.get(wlCarMileage);
wlCarMileageQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(wlCarMileage);
wlCarMileageQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
IPage<WlCarMileage> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iWlCarMileageService.page(pageBean, wlCarMileageQueryWrapper);
return page;
}
/**
* 列表分页查询
*
* @return
*/
@RequestMapping(value = "/page", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public CarTravelDto page(Integer pageNum, Integer pageSize, WlCarMileage wlCarMileage) {
Page<WlCarMileage> pageBean;
if (pageNum == null || pageSize == null) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(pageNum, pageSize);
}
//只查询已完成的轨迹
wlCarMileage.setComplete(true);
Page<WlCarMileage> page = iWlCarMileageService.page(pageBean, wlCarMileage);
SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
CarTravelDto carTravelDto = new CarTravelDto();
carTravelDto.setTotal(page.getTotal());
long totalTime = 0;
int totalTravel = 0;
List<WlCarMileageDto> list = new ArrayList<WlCarMileageDto>();
for (WlCarMileage wl : page.getRecords()) {
WlCarMileageDto wlCarMileageDto = new WlCarMileageDto();
wl.setTime(millisToStringShort(wl.getTakeTime()));
totalTravel += wl.getTravel();
totalTime += wl.getTakeTime();
BeanUtil.copyPropertiesIgnoreNull(wl, wlCarMileageDto);
wlCarMileageDto.setStartTime(sdf.format(wl.getStartTime()));
wlCarMileageDto.setEndTime(sdf.format(wl.getEndTime()));
list.add(wlCarMileageDto);
}
carTravelDto.setRecords(list);
// // 初始化format格式
// SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
// // 设置时区,跳过此步骤会默认设置为"GMT+08:00" 得到的结果会多出来8个小时
// dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
//
// String timeStr = dateFormat.format(totalTime);
carTravelDto.setTotalTime(millisToStringShort(totalTime));
carTravelDto.setTotalTravel(totalTravel);
return carTravelDto;
}
public String millisToStringShort(long millis) {
StringBuffer strBuilder = new StringBuffer();
long temp = millis;
long hper = 60 * 60 * 1000;
long mper = 60 * 1000;
long sper = 1000;
if (temp / hper > 0) {
if ((temp / hper) < 10) {
strBuilder.append(0);
}
strBuilder.append(temp / hper).append(":");
} else {
strBuilder.append("00").append(":");
}
temp = temp % hper;
if (temp / mper > 0) {
if ((temp / mper) < 10) {
strBuilder.append(0);
}
strBuilder.append(temp / mper).append(":");
} else {
strBuilder.append("00").append(":");
}
temp = temp % mper;
if (temp / sper > 0) {
if ((temp / sper) < 10) {
strBuilder.append(0);
}
strBuilder.append(temp / sper);
} else {
strBuilder.append("00");
}
return strBuilder.toString();
}
/**
* 获取轨迹
*
* @return
*/
@RequestMapping(value = "/travel", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取轨迹", notes = "获取轨迹")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public List<Coordinate> travel(long id) {
return iWlCarMileageService.getCoordinateList(id);
}
/**
* 获取日历
*
* @return
*/
@RequestMapping(value = "/calendar", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取日历", notes = "获取日历")
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
public Map<String, Boolean> calendar(@RequestParam("id") long id,
@DateTimeFormat(pattern = "yyyy-MM") @RequestParam("date") Date date) {
return iWlCarMileageService.getCalender(id, date);
}
}
package com.yeejoin.equipmanage.dto; package com.yeejoin.equipmanage.dto;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
...@@ -59,9 +61,16 @@ public class EquipDataDto { ...@@ -59,9 +61,16 @@ public class EquipDataDto {
// //@Excel(name = "品牌", width = 30, orderNum = "4") // //@Excel(name = "品牌", width = 30, orderNum = "4")
// private BigDecimal maintenanceCycle ; // private BigDecimal maintenanceCycle ;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@com.alibaba.excel.annotation.format.DateTimeFormat("yyyy-MM-dd")
@Excel(name = "生产日期", width = 30, orderNum = "12") @Excel(name = "生产日期", width = 30, orderNum = "12")
private Date productionDate; private Date productionDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@com.alibaba.excel.annotation.format.DateTimeFormat("yyyy-MM-dd")
@Excel(name = "投运日期", width = 30, orderNum = "13") @Excel(name = "投运日期", width = 30, orderNum = "13")
//@Excel(name = "品牌", width = 30, orderNum = "4") //@Excel(name = "品牌", width = 30, orderNum = "4")
private Date deliveryDate; private Date deliveryDate;
......
...@@ -2,8 +2,11 @@ package com.yeejoin.equipmanage.dto; ...@@ -2,8 +2,11 @@ package com.yeejoin.equipmanage.dto;
import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.equipmanage.utils.ExplicitConstraint; import com.yeejoin.equipmanage.utils.ExplicitConstraint;
import com.yeejoin.equipmanage.utils.RoleNameExplicitConstraint; import com.yeejoin.equipmanage.utils.RoleNameExplicitConstraint;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
...@@ -60,6 +63,9 @@ public class EquipmentDetailExcelSingleTemplateDto { ...@@ -60,6 +63,9 @@ public class EquipmentDetailExcelSingleTemplateDto {
private String companyName; private String companyName;
@ExcelProperty(value = "生产日期", index = 11) @ExcelProperty(value = "生产日期", index = 11)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@com.alibaba.excel.annotation.format.DateTimeFormat("yyyy-MM-dd")
//@Excel(name = "品牌", width = 30, orderNum = "4") //@Excel(name = "品牌", width = 30, orderNum = "4")
private Date productionDate; private Date productionDate;
...@@ -72,6 +78,9 @@ public class EquipmentDetailExcelSingleTemplateDto { ...@@ -72,6 +78,9 @@ public class EquipmentDetailExcelSingleTemplateDto {
// private BigDecimal maintenanceCycle ; // private BigDecimal maintenanceCycle ;
@ExcelProperty(value = "投运日期", index = 12) @ExcelProperty(value = "投运日期", index = 12)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@com.alibaba.excel.annotation.format.DateTimeFormat("yyyy-MM-dd")
//@Excel(name = "品牌", width = 30, orderNum = "4") //@Excel(name = "品牌", width = 30, orderNum = "4")
private Date deliveryDate; private Date deliveryDate;
......
package com.yeejoin.equipmanage.dto; package com.yeejoin.equipmanage.dto;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.equipmanage.utils.ExplicitConstraint; import com.yeejoin.equipmanage.utils.ExplicitConstraint;
import com.yeejoin.equipmanage.utils.RoleNameExplicitConstraint; import com.yeejoin.equipmanage.utils.RoleNameExplicitConstraint;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -65,6 +67,9 @@ public class EquipmentDetailExcelTemplateDto implements Serializable { ...@@ -65,6 +67,9 @@ public class EquipmentDetailExcelTemplateDto implements Serializable {
private String companyName; private String companyName;
@ExcelProperty(value = "生产日期", index = 12) @ExcelProperty(value = "生产日期", index = 12)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@com.alibaba.excel.annotation.format.DateTimeFormat("yyyy-MM-dd")
//@Excel(name = "品牌", width = 30, orderNum = "4") //@Excel(name = "品牌", width = 30, orderNum = "4")
private Date productionDate; private Date productionDate;
...@@ -77,6 +82,9 @@ public class EquipmentDetailExcelTemplateDto implements Serializable { ...@@ -77,6 +82,9 @@ public class EquipmentDetailExcelTemplateDto implements Serializable {
// private BigDecimal maintenanceCycle ; // private BigDecimal maintenanceCycle ;
@ExcelProperty(value = "投运时间", index = 13) @ExcelProperty(value = "投运时间", index = 13)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@com.alibaba.excel.annotation.format.DateTimeFormat("yyyy-MM-dd")
//@Excel(name = "品牌", width = 30, orderNum = "4") //@Excel(name = "品牌", width = 30, orderNum = "4")
private Date deliveryDate; private Date deliveryDate;
......
...@@ -2,9 +2,12 @@ package com.yeejoin.equipmanage.fegin; ...@@ -2,9 +2,12 @@ package com.yeejoin.equipmanage.fegin;
import com.yeejoin.equipmanage.common.entity.dto.IndexLogsRequest; import com.yeejoin.equipmanage.common.entity.dto.IndexLogsRequest;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -71,4 +74,10 @@ public interface IotFeign { ...@@ -71,4 +74,10 @@ public interface IotFeign {
@RequestMapping(value = "v1/livedata/index/logs", method = RequestMethod.POST, consumes = "application/json") @RequestMapping(value = "v1/livedata/index/logs", method = RequestMethod.POST, consumes = "application/json")
ResponseModel<Map<String ,Object>> getEquipAlarmLog(@RequestBody IndexLogsRequest indexLogsRequest ); ResponseModel<Map<String ,Object>> getEquipAlarmLog(@RequestBody IndexLogsRequest indexLogsRequest );
@GetMapping("/v1/livedata/common/list")
ResponseModel<List<Object>> getLiveData(@RequestParam("measurement") String measurement,
@RequestParam("deviceName") String deviceName,
@RequestParam("timeStart") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date timeStart,
@RequestParam("timeEnd") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")Date timeEnd);
} }
package com.yeejoin.equipmanage.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.utils.CoordinateUtil;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Component
public class CarIotListener extends EmqxListener {
@Autowired
private IWlCarMileageService iWlCarMileageService;
@Autowired
private ICarService iCarService;
@Autowired
private IotFeign iotFeign;
private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404";
private final String GUIDE_URL = "https://restapi.amap.com/v3/geocode/regeo?";
@Autowired
private EmqKeeper emqkeeper;
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Override
public void processMessage(String topic, MqttMessage message) throws Exception {
JSONObject jsonObject = JSONObject.parseObject(message.toString());
if (jsonObject.containsKey("startUp") || jsonObject.containsKey("FireCar_Longitude")) {
System.out.println(topic);
System.out.println(message);
String measurement = topic.split("/")[0];
String deviceName = topic.split("/")[1];
String iotCode = measurement + deviceName;
if (jsonObject.containsKey("startUp")) {
if (jsonObject.getBooleanValue("startUp")) {
WlCarMileage wlCarMileage = new WlCarMileage();
wlCarMileage.setIotCode(iotCode);
wlCarMileage.setDate(new Date());
// 获取开始坐标
double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude");
double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude");
// String currentTime = "20"+jsonObject.getString("currentTime");
wlCarMileage.setStartLongitude(startLongitude);
wlCarMileage.setStartLatitude(startLatitude);
// Date startTime = UTCToCST();
Date startTime = new Date(jsonObject.getLong("time"));
wlCarMileage.setStartTime(startTime);
wlCarMileage.setStartName(getAddress(startLongitude, startLatitude));
wlCarMileage.setStartSpeed(jsonObject.getIntValue("FireCar_Speed"));
try {
iWlCarMileageService.save(wlCarMileage);
} catch (Exception e) {
e.printStackTrace();
iWlCarMileageService.save(wlCarMileage);
}
} else {
// 获取结束坐标
WlCarMileage last = iWlCarMileageService
.getOne(new LambdaQueryWrapper<WlCarMileage>().eq(WlCarMileage::getIotCode, iotCode)
.isNull(WlCarMileage::getEndLongitude).isNull(WlCarMileage::getEndLatitude)
.orderByDesc(WlCarMileage::getStartTime).last("limit 1"));
ResponseModel<List<Object>> result = iotFeign.getLiveData(measurement, deviceName,
last.getStartTime(), new Date(new Date().getTime() + 2000));
List<Object> list = result.getResult();
if (list != null && list.size() > 0) {
// 获取最后一个有坐标的数据
JSONObject lastObj = null;
// 过滤空坐标
List<Object> filterList = new ArrayList<Object>();
for (int i = 0; i < list.size(); i++) {
JSONObject Obj = JSONObject.parseObject(JSONObject.toJSONString(list.get(i)));
if (Obj.get("FireCar_Longitude") != null && Obj.get("FireCar_Latitude") != null
&& Obj.getDoubleValue("FireCar_Longitude") != 0
&& Obj.getDoubleValue("FireCar_Latitude") != 0) {
filterList.add(list.get(i));
// 获取第一个不为空的坐标
if (lastObj == null) {
lastObj = Obj;
}
}
}
// JSONObject lastObj =
// JSONObject.parseObject(JSONObject.toJSONString(list.get(list.size() - 1)));
if (lastObj == null) {
lastObj = new JSONObject();
lastObj.put("FireCar_Longitude", 0.0);
lastObj.put("FireCar_Latitude", 0.0);
lastObj.put("time", 0);
lastObj.put("FireCar_Speed", 0);
}
double endLongitude = lastObj.getDoubleValue("FireCar_Longitude");
double endLatitude = lastObj.getDoubleValue("FireCar_Latitude");
// 230215180624
// Date endTime =UTCToCST(lastObj.getString("time"));
Date endTime = new Date(jsonObject.getLong("time"));
long takeTime = (endTime.getTime()/1000*1000) - (last.getStartTime().getTime()/1000*1000) ;
last.setEndLongitude(endLongitude);
last.setEndLatitude(endLatitude);
last.setEndTime(endTime);
last.setEndName(getAddress(endLongitude, endLatitude));
last.setEndSpeed(lastObj.getIntValue("FireCar_Speed"));
last.setTakeTime(takeTime);
double travel = 0.0;
// 获取里程
for (int i = 0; i < filterList.size() - 1; i++) {
JSONObject start = JSONObject.parseObject(JSONObject.toJSONString(filterList.get(i)));
JSONObject end = JSONObject.parseObject(JSONObject.toJSONString(filterList.get(i + 1)));
travel += CoordinateUtil.distance(start.getDoubleValue("FireCar_Latitude"),
start.getDoubleValue("FireCar_Longitude"), end.getDoubleValue("FireCar_Latitude"),
end.getDoubleValue("FireCar_Longitude"));
}
last.setTravel(new BigDecimal(travel/1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
try {
iWlCarMileageService.updateById(last);
} catch (Exception e) {
iWlCarMileageService.updateById(last);
}
}
}
} else if (jsonObject.containsKey("FireCar_Longitude")) {
if (jsonObject.containsKey("FireCar_Longitude") && jsonObject.containsKey("FireCar_Latitude")) {
// 获取开始坐标
double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude");
double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude");
int direction = jsonObject.getIntValue("direction");
// 地图推送消息
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) {
JSONArray sendArr = new JSONArray();
JSONObject sendObj = new JSONObject();
sendObj.put("id", String.valueOf(car.getId()));
sendObj.put("direction", direction);
sendObj.put("longitude", String.valueOf(startLongitude));
sendObj.put("latitude", String.valueOf(startLatitude));
sendObj.put("carNum", car.getCarNum());
sendObj.put("bizOrgName", car.getBizOrgName());
sendArr.add(sendObj);
MqttMessage mqttMessage = new MqttMessage();
mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude);
car.setLatitude(startLatitude);
iCarService.updateById(car);
emqkeeper.getMqttClient().publish("car/location", mqttMessage);
}
}
}
}
}
public String getAddress(double longitude, double lantitude) {
StringBuilder api = new StringBuilder(GUIDE_URL);
api.append("key=").append(GUIDE_KEY).append("&location=").append(longitude).append(",").append(lantitude)
.append("&radius=1000").append("&batch=false").append("&extensions=base").append("&roadlevel=0")
.append("&batch=false");
StringBuilder res = new StringBuilder();
BufferedReader in = null;
try {
System.out.println(api.toString());
URL url = new URL(api.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
res.append(line).append("\n");
}
JSONObject object = JSONObject.parseObject(res.toString());
System.out.println(object);
JSONObject regeocode = object.getJSONObject("regeocode");
String address = regeocode.getString("formatted_address");
if ("[]".equals(address)) {
System.out.println("===============无效坐标:" + longitude + "," + lantitude);
address = "无效坐标";
}
res = new StringBuilder(address);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return res.toString();
}
public Date UTCToCST(String UTCStr) throws ParseException {
Date date = sdf.parse(UTCStr);
System.out.println("UTC时间: " + date);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) + 8);
return calendar.getTime();
}
}
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import org.apache.ibatis.annotations.Param;
/**
* 车量里程表 Mapper 接口
*
* @author duanwei
* @date 2023-02-01
*/
public interface WlCarMileageMapper extends BaseMapper<WlCarMileage> {
Page<WlCarMileage> page(Page<WlCarMileage> page,@Param("wlCarMileage") WlCarMileage wlCarMileage);
Integer totalMileage(String iotCode);
}
...@@ -185,4 +185,8 @@ public interface ICarService extends IService<Car> { ...@@ -185,4 +185,8 @@ public interface ICarService extends IService<Car> {
* iot装备更新redis 统计数据 * iot装备更新redis 统计数据
*/ */
void iotrefreshStaData(); void iotrefreshStaData();
IPage getQRCode(Long id);
List<Car> location();
} }
...@@ -75,6 +75,12 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> { ...@@ -75,6 +75,12 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
Boolean delEquipmentSpecific(Long id); Boolean delEquipmentSpecific(Long id);
/** /**
* 批量清除调用
* @param equipmentSpecific 装备信息
*/
Boolean delEquipmentSpecificByIdNew(EquipmentSpecific equipmentSpecific);
/**
* 组装组态使用的卡片数据 * 组装组态使用的卡片数据
* *
* @param id * @param id
......
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.controller.Coordinate;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 车量里程表 服务类
*
* @author duanwei
* @date 2023-02-01
*/
public interface IWlCarMileageService extends IService<WlCarMileage> {
Page<WlCarMileage> page(Page<WlCarMileage> page, WlCarMileage wlCarMileage);
Integer totalMileage(String iotCode);
List<Coordinate> getCoordinateList(long id);
Map<String,Boolean> getCalender(long id,Date date);
}
...@@ -11,6 +11,7 @@ import com.google.common.collect.Lists; ...@@ -11,6 +11,7 @@ import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil; import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.utils.SnowFlakeGenerateIdWorker;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.morphic.Morphic; import com.yeejoin.amos.feign.morphic.Morphic;
...@@ -82,6 +83,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -82,6 +83,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
private IFormGroupService iFormGroupService; private IFormGroupService iFormGroupService;
@Autowired @Autowired
IWarehouseService iWarehouseService;
@Autowired
private IEqSourceFileService iEqSourceFileService; private IEqSourceFileService iEqSourceFileService;
@Autowired @Autowired
...@@ -361,10 +365,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -361,10 +365,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
private void synWarehouse(Map<String, Object> formKeyMap) { private void synWarehouse(Map<String, Object> formKeyMap) {
String parentId = (String) formKeyMap.get("parentId"); String parentId = (String) formKeyMap.get("parentId");
if ("0".equals(parentId)) { String stuctureName = formInstanceMapper.getStuctureName(parentId);
formKeyMap.put("address", formKeyMap.get("name")); if (StringUtils.isEmpty(stuctureName)){
} else { formKeyMap.put("address",formKeyMap.get("name"));
String stuctureName = formInstanceMapper.getStuctureName(parentId); }else {
formKeyMap.put("address", stuctureName + "-" + formKeyMap.get("name")); formKeyMap.put("address", stuctureName + "-" + formKeyMap.get("name"));
} }
formInstanceMapper.saveStucture(formKeyMap); formInstanceMapper.saveStucture(formKeyMap);
...@@ -1668,6 +1672,12 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1668,6 +1672,12 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
String orgCode = null; String orgCode = null;
String companyName = null; String companyName = null;
String dutyUser = null; String dutyUser = null;
//代码执行前 需清空数据库原有数据 涉及 wl_warehouse、wl_warehouse_structure、wl_form_instance。
formInstanceMapper.delete(null);
iWarehouseStructureService.getBaseMapper().delete(null);
iWarehouseService.getBaseMapper().delete(null);
if (!ObjectUtils.isEmpty(reginParams) && !ObjectUtils.isEmpty(reginParams.getPersonIdentity())) { if (!ObjectUtils.isEmpty(reginParams) && !ObjectUtils.isEmpty(reginParams.getPersonIdentity())) {
if (!ObjectUtils.isEmpty(reginParams.getPersonIdentity().getBizOrgCode())) { if (!ObjectUtils.isEmpty(reginParams.getPersonIdentity().getBizOrgCode())) {
companyCode = reginParams.getPersonIdentity().getBizOrgCode(); companyCode = reginParams.getPersonIdentity().getBizOrgCode();
...@@ -1705,11 +1715,23 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1705,11 +1715,23 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
private void importBuildMessage(List<BuildingImportDto> collect, String orgCode, String bizOrgName, String bizOrgCode, String dutyUser) { private void importBuildMessage(List<BuildingImportDto> collect, String orgCode, String bizOrgName, String bizOrgCode, String dutyUser) {
// 处理建筑数据、入库 // 处理建筑数据、入库 并在wl_warehouse插入跟数据
//避免id重复且sourceId与id保持一致 通过雪花算法生成
SnowFlakeGenerateIdWorker snowFlakeGenerateIdWorker =
new SnowFlakeGenerateIdWorker(0L, 0L);
long id = snowFlakeGenerateIdWorker.nextId();
Warehouse warehouse = new Warehouse();
warehouse.setName(orgCode);
warehouse.setCompanyName(bizOrgName);
warehouse.setSourceCode("10000");
warehouse.setId(id);
warehouse.setSourceId(id);
iWarehouseService.getBaseMapper().insert(warehouse);
collect.forEach(item -> { collect.forEach(item -> {
HashMap<String, Object> buildingData = new HashMap<>(); HashMap<String, Object> buildingData = new HashMap<>();
// 建筑默认父级id 为顶级id // 建筑默认父级id 为顶级id
buildingData.put("parentId", 0); buildingData.put("parentId", id);
// 建筑类型 // 建筑类型
String groupCode = null; String groupCode = null;
if (!ObjectUtils.isEmpty(item.getBuildingType())) { if (!ObjectUtils.isEmpty(item.getBuildingType())) {
......
...@@ -17,6 +17,7 @@ import com.yeejoin.amos.component.feign.config.InnerInvokException; ...@@ -17,6 +17,7 @@ import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.equipmanage.common.datasync.entity.FireVehicle; import com.yeejoin.equipmanage.common.datasync.entity.FireVehicle;
import com.yeejoin.equipmanage.common.dto.CarFusionDto; import com.yeejoin.equipmanage.common.dto.CarFusionDto;
import com.yeejoin.equipmanage.common.dto.CarInfoDto; import com.yeejoin.equipmanage.common.dto.CarInfoDto;
...@@ -35,6 +36,7 @@ import com.yeejoin.equipmanage.mapper.*; ...@@ -35,6 +36,7 @@ import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService; import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType;
import org.gavaghan.geodesy.Ellipsoid; import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator; import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GlobalCoordinates; import org.gavaghan.geodesy.GlobalCoordinates;
...@@ -42,17 +44,22 @@ import org.springframework.beans.BeanUtils; ...@@ -42,17 +44,22 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Consumer; import java.util.function.Consumer;
...@@ -149,6 +156,9 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -149,6 +156,9 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
@Value("${systemctl.sync.switch}") @Value("${systemctl.sync.switch}")
private Boolean syncSwitch; private Boolean syncSwitch;
@Autowired
private IWlCarMileageService iWlCarMileageService;
/** /**
* 当前登录用户信息 * 当前登录用户信息
*/ */
...@@ -1326,13 +1336,38 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -1326,13 +1336,38 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
equipment.setEquipmentCategory(equipmentCategoryMapper.selectById(equipment.getCategoryId())); equipment.setEquipmentCategory(equipmentCategoryMapper.selectById(equipment.getCategoryId()));
} }
car.setEquipment(equipment); car.setEquipment(equipment);
car.setCountryName(iSystemDicService.getOne(new QueryWrapper<SystemDic>().eq("id", car.getCountry())).getName()); if( car.getCountry()!=null) {
car.setChassisCountryName( car.setCountryName(
iSystemDicService.getOne(new QueryWrapper<SystemDic>().eq("id", car.getChassisCountry())).getName()); iSystemDicService.getOne(new QueryWrapper<SystemDic>().eq("id", car.getCountry())).getName());
car.setJournals(journalService.list(new QueryWrapper<Journal>().eq("car_id", car.getId()).orderByAsc("create_date"))); }
if (!ObjectUtils.isEmpty(car.getChassisCountry())) {
car.setChassisCountryName(iSystemDicService
.getOne(new QueryWrapper<SystemDic>().eq("id", car.getChassisCountry())).getName());
}
car.setJournals(
journalService.list(new QueryWrapper<Journal>().eq("car_id", car.getId()).orderByAsc("create_date")));
car.setEquipmentsOnCar(this.baseMapper.selectEquipmentOnCarAppList(car.getId())); car.setEquipmentsOnCar(this.baseMapper.selectEquipmentOnCarAppList(car.getId()));
List<Equipment> equipment1 = iEquipmentService.listByCategoryId(equipment.getCategoryId()); List<Equipment> equipment1 = iEquipmentService.listByCategoryId(equipment.getCategoryId());
car.setUnit(equipment1.get(0).getUnit()); car.setUnit(equipment1.get(0).getUnit());
car.setCategoryId(equipment.getCategoryId());
if(car.getIsImport()!=null)
{
car.setImportStr(car.getIsImport() ? "进口" : "国产");
}
if (!ObjectUtils.isEmpty(car.getIotCode())) {
Integer totalTravel = iWlCarMileageService.totalMileage(car.getIotCode());
car.setTotalTravel(totalTravel);
WlCarMileage last = iWlCarMileageService
.getOne(new LambdaQueryWrapper<WlCarMileage>().eq(WlCarMileage::getIotCode, car.getIotCode())
.orderByDesc(WlCarMileage::getEndTime).last("limit 1"));
car.setSpeed(last != null ? last.getEndSpeed() : null);
//产品 和 设备 各8位
if(car.getIotCode().length()>=16)
{
car.setIotMeasurement(car.getIotCode().substring(0, 8));
car.setIotDeviceName(car.getIotCode().substring(8, car.getIotCode().length()));
}
}
return car; return car;
} }
...@@ -1638,4 +1673,44 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -1638,4 +1673,44 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
private String iotbuildKey(Map<String, Object> row) { private String iotbuildKey(Map<String, Object> row) {
return SourcesStatisticsImpl.PREFIX_CATEGORY_COUNT + row.get("bizOrgCode").toString() + "_" + SourceTypeEnum.IOT.getCode() + "_" + row.get("categoryCode").toString(); return SourcesStatisticsImpl.PREFIX_CATEGORY_COUNT + row.get("bizOrgCode").toString() + "_" + SourceTypeEnum.IOT.getCode() + "_" + row.get("categoryCode").toString();
} }
@Override
public IPage getQRCode(Long id) {
Car car = this.getById(id);
if (car == null) {
return null;
}
String url = "";
JSONObject jsonObject = new JSONObject();
byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(car.getQrCode(),200);
InputStream inputStream = new ByteArrayInputStream(bytes);
try {
MultipartFile file = new MockMultipartFile(car.getQrCode() + ".jpg", car.getQrCode() + ".jpg",
ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFileFree(file,
"jxiop/qrcode");
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
String urlString = it.next();
jsonObject.put("fileUrl", urlString);
jsonObject.put("fileName", car.getQrCode());
}
} catch (IOException e) {
e.printStackTrace();
}
List list = new ArrayList();
list.add(jsonObject);
IPage page = new Page(1, 100);
page.setRecords(list);
return page;
}
@Override
public List<Car> location() {
List<Car> list = this.list();
return list;
}
} }
...@@ -49,6 +49,7 @@ import org.springframework.util.CollectionUtils; ...@@ -49,6 +49,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil; import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException; import java.io.IOException;
...@@ -1010,6 +1011,52 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1010,6 +1011,52 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
} }
@Override
public Boolean delEquipmentSpecificByIdNew(EquipmentSpecific equipmentSpecific) {
Long id = equipmentSpecific.getId();
QueryWrapper<StockDetail> stockDetailQueryWrapper = new QueryWrapper<>();
stockDetailQueryWrapper.eq("equipment_specific_id", equipmentSpecific.getId());
if (stockDetailService.count(stockDetailQueryWrapper) > 0) {
throw new BadRequest("所选设备中存在已入库设备,无法删除,请重新选择,装备名称:" + equipmentSpecific.getName());
}
String code = this.getSystemCodeBySpeId(equipmentSpecific.getSystemId());
int res = this.baseMapper.deleteById(id);
if (StringUtil.isNotEmpty(code)) {
this.integrationPageSysDataRefresh(code);
}
if (res > 0 && Boolean.TRUE.equals(syncSwitch)) {
//数据同步
delEquipmentSpecificSyncData(id);
}
//判断装备表剩余数量,无剩余删除模板
QueryWrapper<EquipmentSpecific> wrapper = new QueryWrapper<>();
wrapper.eq("equipment_detail_id", equipmentSpecific.getEquipmentDetailId());
List<String> sys = this.baseMapper.selectSystemList(id);
List<String> build = this.baseMapper.selectBuildList(id);
String sysErrorMeg = "";
String buildErrorMeg = "";
if (!CollectionUtils.isEmpty(sys) || !CollectionUtils.isEmpty(build)) {
for (String s : sys) {
sysErrorMeg = sysErrorMeg.equals("") ? s : sysErrorMeg + "," + s;
}
for (String s : build) {
buildErrorMeg = buildErrorMeg.equals("") ? s : buildErrorMeg + "," + s;
}
sysErrorMeg = sysErrorMeg.equals("") ? sysErrorMeg : "系统:" + sysErrorMeg + ",";
buildErrorMeg = buildErrorMeg.equals("") ? buildErrorMeg : "建筑:" + buildErrorMeg + ",";
throw new BadRequest("所选设备中有与" + sysErrorMeg + buildErrorMeg + "存在绑定关系,无法删除,装备名称:" + equipmentSpecific.getName());
}
if (this.baseMapper.selectCount(wrapper) == 0) {
equipmentDetailService.removeById(equipmentSpecific.getEquipmentDetailId());
}
if (res > 0) {
// 删除设备动态表单扩展属性
return formInstanceEquipService.deleteInstanceById(id);
} else {
return false;
}
}
private String getSystemCodeBySpeId(String sysIds) { private String getSystemCodeBySpeId(String sysIds) {
if (StringUtil.isNotEmpty(sysIds)) { if (StringUtil.isNotEmpty(sysIds)) {
List<FireFightingSystemEntity> sys = fireFightingSystemMapper.getFightingSysByIds(sysIds.split(",")); List<FireFightingSystemEntity> sys = fireFightingSystemMapper.getFightingSysByIds(sysIds.split(","));
......
...@@ -28,11 +28,9 @@ import com.yeejoin.equipmanage.common.entity.*; ...@@ -28,11 +28,9 @@ import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO; import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.*; import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.enums.*; import com.yeejoin.equipmanage.common.enums.*;
import com.yeejoin.equipmanage.common.utils.ChartsUtils; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.utils.WordTemplateUtils;
import com.yeejoin.equipmanage.common.vo.*; import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.controller.EquipmentDetailController;
import com.yeejoin.equipmanage.fegin.JcsFeign; import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.mapper.*; import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService; import com.yeejoin.equipmanage.remote.RemoteSecurityService;
...@@ -169,6 +167,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -169,6 +167,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Value("${redis_equip_type_count}") @Value("${redis_equip_type_count}")
private String equipTypeAndCount; private String equipTypeAndCount;
@Autowired
IWlCarMileageService iWlCarMileageService;
@Override @Override
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) { public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return this.baseMapper.getEquipCountBySystemId(systemId); return this.baseMapper.getEquipCountBySystemId(systemId);
...@@ -919,6 +920,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -919,6 +920,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) { if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
x.setAmount(x.getAmount().split("\\.")[0]); x.setAmount(x.getAmount().split("\\.")[0]);
} }
x.setType(null);
}); });
return list; return list;
} }
...@@ -1225,12 +1227,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1225,12 +1227,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override @Override
public Object getEquipmentTypeAndCount(String bizOrgCode) { public Object getEquipmentTypeAndCount(String bizOrgCode) {
// if (redisUtils.hasKey(equipTypeAndCount + bizOrgCode)) { if (redisUtils.hasKey(equipTypeAndCount + bizOrgCode)) {
// return JSONArray.parseArray( return refreshEquipmentTypeAndCount(bizOrgCode);
// JSONArray.toJSONString(redisUtils.get(equipTypeAndCount + bizOrgCode)), EquipmentCategory.class); } else {
// } else { if (redisUtils.hasKey(equipTypeAndCount + bizOrgCode)) {
return refreshEquipmentTypeAndCount(bizOrgCode);
}
syncDataService.saveOrUpdateEquipIotCodeRedisData(null);
EquipmentDetailController controllerProxy = SpringUtils.getBean(EquipmentDetailController.class);
controllerProxy.refreshCount(bizOrgCode);
}
return refreshEquipmentTypeAndCount(bizOrgCode); return refreshEquipmentTypeAndCount(bizOrgCode);
// }
} }
@Override @Override
......
...@@ -217,16 +217,23 @@ public class PressurePumpServiceImpl implements IPressurePumpService { ...@@ -217,16 +217,23 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
String iotCode = pumpInfoList.get(0).get("iotCode").toString(); String iotCode = pumpInfoList.get(0).get("iotCode").toString();
if (iotCode.length() > 8) { if (iotCode.length() > 8) {
String prefix = iotCode.substring(0, 8); String prefix = iotCode.substring(0, 8);
List<Map<String, String>> iotDataList = getIotTopSingleField(top, prefix, null, null, nameKey); List<Map<String, String>> iotDataList = new ArrayList<>();
try {
iotDataList = getIotTopSingleField(top, prefix, null, null, nameKey);
} catch (Exception e) {
e.printStackTrace();
}
//将iot的List<Map<String, String>>转化为List<IotDataVO>类型 //将iot的List<Map<String, String>>转化为List<IotDataVO>类型
iotDataList.forEach(e -> { if (0 < iotDataList.size()) {
try { iotDataList.forEach(e -> {
IotDataVO iotDataVO = (IotDataVO) mapToObject(e, IotDataVO.class, nameKey); try {
dataList.add(iotDataVO); IotDataVO iotDataVO = (IotDataVO) mapToObject(e, IotDataVO.class, nameKey);
} catch (Exception el) { dataList.add(iotDataVO);
throw new BadRequest("IOT数据类型转换失败"); } catch (Exception el) {
} throw new BadRequest("IOT数据类型转换失败");
}); }
});
}
} }
} else { } else {
throw new BadRequest("装备物联编码错误,请确认!"); throw new BadRequest("装备物联编码错误,请确认!");
...@@ -400,7 +407,12 @@ public class PressurePumpServiceImpl implements IPressurePumpService { ...@@ -400,7 +407,12 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
@Override @Override
public List<Map<String, String>> getIotTopSingleField(String top, String productKey, String deviceName, String key, String fieldKey) { public List<Map<String, String>> getIotTopSingleField(String top, String productKey, String deviceName, String key, String fieldKey) {
ResponseModel responseModel = iotFeign.topSingleField(top, productKey, deviceName, key, fieldKey); ResponseModel responseModel = null;
try {
responseModel = iotFeign.topSingleField(top, productKey, deviceName, key, fieldKey);
} catch (Exception e) {
e.printStackTrace();
}
if (responseModel != null && 200 == responseModel.getStatus()) { if (responseModel != null && 200 == responseModel.getStatus()) {
String json = JSON.toJSONString(responseModel.getResult()); String json = JSON.toJSONString(responseModel.getResult());
return (List<Map<String, String>>) JSONArray.parse(json); return (List<Map<String, String>>) JSONArray.parse(json);
...@@ -410,7 +422,12 @@ public class PressurePumpServiceImpl implements IPressurePumpService { ...@@ -410,7 +422,12 @@ public class PressurePumpServiceImpl implements IPressurePumpService {
@Override @Override
public List<Map<String, String>> getIotCommonListData(String startTime, String endTime, String prefix, String suffix, String key, String fieldKey) { public List<Map<String, String>> getIotCommonListData(String startTime, String endTime, String prefix, String suffix, String key, String fieldKey) {
ResponseModel responseModel = iotFeign.selectListNew(prefix, suffix, startTime, endTime, key, fieldKey); ResponseModel responseModel = null;
try {
responseModel = iotFeign.selectListNew(prefix, suffix, startTime, endTime, key, fieldKey);
} catch (Exception e) {
e.printStackTrace();
}
if (responseModel != null && 200 == responseModel.getStatus()) { if (responseModel != null && 200 == responseModel.getStatus()) {
String json = JSON.toJSONString(responseModel.getResult()); String json = JSON.toJSONString(responseModel.getResult());
return (List<Map<String, String>>) JSONArray.parse(json); return (List<Map<String, String>>) JSONArray.parse(json);
......
package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.utils.HttpUtil;
import com.yeejoin.equipmanage.controller.Coordinate;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.WlCarMileageMapper;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 车量里程表 服务实现类
*
* @author duanwei
* @date 2023-02-01
*/
@Service
public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlCarMileage>
implements IWlCarMileageService {
@Autowired
IotFeign iotFeign;
@Autowired
ICarService iCarService;
private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404";
private final String GUIDE_URL = "https://restapi.amap.com/v4/grasproad/driving?";
@Override
public Page<WlCarMileage> page(Page<WlCarMileage> page, WlCarMileage wlCarMileage) {
return this.baseMapper.page(page, wlCarMileage);
}
@Override
public Integer totalMileage(String iotCode) {
return this.baseMapper.totalMileage(iotCode);
}
@Override
public List<Coordinate> getCoordinateList(long id) {
double speed = 0;
WlCarMileage wlCarMileage = this.getById(id);
String iotCode = wlCarMileage.getIotCode();
String measurement = "0THMcLKR";
String deviceName = iotCode.replace(measurement, "");
// 由于iot存在毫秒故结束时间要+1秒 iot+1秒有bug还是查不到 +2秒
ResponseModel<List<Object>> result = iotFeign.getLiveData(measurement, deviceName, wlCarMileage.getStartTime(),
new Date(wlCarMileage.getEndTime().getTime()));
List<Object> list = result.getResult();
List<Coordinate> coordinateList = new ArrayList<Coordinate>();
if (list != null) {
DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
DateFormat format2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
for (Object object : list) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object));
if (jsonObject.get("FireCar_Longitude") != null && jsonObject.get("FireCar_Latitude") != null) {
Coordinate coordinate = new Coordinate();
List<Double> lnglat = new ArrayList<Double>();
lnglat.add(jsonObject.getDoubleValue("FireCar_Longitude"));
lnglat.add(jsonObject.getDoubleValue("FireCar_Latitude"));
coordinate.setLnglat(lnglat);
coordinate.setSpeed(jsonObject.getDoubleValue("FireCar_Speed"));
speed = speed + jsonObject.getDoubleValue("FireCar_Speed");
String time = jsonObject.getString("time");
if (time.length() > 20) {
try {
coordinate.setTime(format1.parse(jsonObject.getString("time")).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
} else {
try {
coordinate.setTime(format2.parse(jsonObject.getString("time")).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
}
double direction = jsonObject.getDoubleValue("direction");
if (!ObjectUtils.isEmpty(direction)){
coordinate.setDirection(jsonObject.getDoubleValue("direction"));
}else {
coordinate.setDirection(0);
}
coordinateList.add(coordinate);
}
}
}
// 倒序坐标变为正序
Collections.reverse(coordinateList);
// 坐标轨迹纠偏
double avgSpeed = speed / coordinateList.size();
double count = Double.valueOf(coordinateList.size()) / 500;
int ceil = (int) Math.ceil(count);
ArrayList<Coordinate> resultList = new ArrayList<>();
for (int i = 1; i <= ceil; i++) {
if (i == ceil) {
List<Coordinate> coordinates = coordinateList.subList(500 * (i - 1), coordinateList.size());
List<Coordinate> check = check(coordinates, avgSpeed);
resultList.addAll(check);
} else {
List<Coordinate> coordinates = coordinateList.subList(500 * (i - 1), 500 + (i - 1) * 500);
List<Coordinate> check = check(coordinates, avgSpeed);
resultList.addAll(check);
}
}
return resultList;
}
private List<Coordinate> check(List<Coordinate> list, double avgSpeed) {
ArrayList<Coordinate> coordinates = new ArrayList<>();
JSONArray objects = new JSONArray();
int count = 0;
for (Coordinate coordinate : list) {
JSONObject jsonObject = new JSONObject();
// 经度
jsonObject.put("x", coordinate.getLnglat().get(0));
// 纬度
jsonObject.put("y", coordinate.getLnglat().get(1));
// 角度
jsonObject.put("ag", coordinate.getDirection());
// 速度
jsonObject.put("sp", coordinate.getSpeed());
// 时间
if (count == 0) {
jsonObject.put("tm", coordinate.getTime() / 1000);
} else {
jsonObject.put("tm", 3 * count);
}
count += 1;
objects.add(jsonObject);
}
String s = objects.toJSONString();
StringBuilder api = new StringBuilder(GUIDE_URL);
api.append("key=").append(GUIDE_KEY);
String result = null;
try {
result = HttpUtil.post(api.toString(), s);
} catch (IOException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {
e.printStackTrace();
}
if (result != null) {
Map<String, Object> jsonObject = (Map<String, Object>) JSONObject.parseObject(result);
if (jsonObject.containsKey("data")) {
JSONObject data3 = JSONObject.parseObject(jsonObject.get("data").toString());
JSONArray points1 = JSONArray.parseArray(data3.get("points").toString());
points1.forEach(item -> {
JSONObject jsonObject1 = JSONObject.parseObject(item.toString());
List<Double> doubles = new ArrayList<>();
Coordinate coordinate = new Coordinate();
doubles.add(Double.valueOf(jsonObject1.get("x").toString()));
doubles.add(Double.valueOf(jsonObject1.get("y").toString()));
coordinate.setLnglat(doubles);
coordinate.setSpeed(avgSpeed);
coordinates.add(coordinate);
});
}
}
return coordinates;
}
@Override
public Map<String, Boolean> getCalender(long id, Date date) {
List<String> daylist = new ArrayList<String>();
Map<String, Boolean> map = new HashMap<>();
Car car = iCarService.getById(id);
if (car == null || car.getIotCode() == null || date == null) {
return map;
}
Calendar c = Calendar.getInstance();
// 获取上一个月
c.setTime(date);
c.add(Calendar.MONTH, -1);
daylist.addAll(getDayByMonth(c.getTime()));
// 获取当月
c.setTime(date);
daylist.addAll(getDayByMonth(c.getTime()));
// 获取下一个月
c.setTime(date);
c.add(Calendar.MONTH, 1);
daylist.addAll(getDayByMonth(c.getTime()));
List<Map<String, Object>> hasList = this.listMaps(new QueryWrapper<WlCarMileage>()
.select("COUNT(1) AS count,date").lambda().eq(WlCarMileage::getIotCode, car.getIotCode())
.between(WlCarMileage::getDate, daylist.get(0), daylist.get(daylist.size() - 1))
.groupBy(WlCarMileage::getDate));
Map<String, Object> hasMap = new HashMap<>();
for (Map<String, Object> mapOne : hasList) {
hasMap.put(String.valueOf(mapOne.get("date")), mapOne.get("count"));
}
for (String day : daylist) {
boolean has = false;
if (hasMap.containsKey(day)) {
has = true;
}
map.put(day, has);
}
return map;
}
public static List<String> getDayByMonth(Date date) {
List<String> data = new ArrayList<>();
try {
Calendar c = Calendar.getInstance();
c.setTime(date);
// 获取当前的年份
int year = c.get(Calendar.YEAR);
// 获取当前的月份(需要加1才是现在的月份)
int month = c.get(Calendar.MONTH) + 1;
// 获取本月的总天数
int dayCount = c.getActualMaximum(Calendar.DAY_OF_MONTH);
// 定义时间格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 开始日期为当前年月拼接1号
Date startDate = sdf.parse(year + "-" + month + "-01");
// 结束日期为当前年月拼接该月最大天数
Date endDate = sdf.parse(year + "-" + month + "-" + dayCount);
// 设置calendar的开始日期
c.setTime(startDate);
// 当前时间小于等于设定的结束时间
while (c.getTime().compareTo(endDate) <= 0) {
String time = sdf.format(c.getTime());
data.add(time);
// 当前日期加1
c.add(Calendar.DATE, 1);
}
} catch (ParseException e) {
e.printStackTrace();
}
return data;
}
}
...@@ -392,7 +392,7 @@ public class DataSourcesImpl implements DataSources { ...@@ -392,7 +392,7 @@ public class DataSourcesImpl implements DataSources {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
// 权限处理 // 权限处理
PermissionInterceptorContext.setDataAuthRule(FIRE_WATER_INFO); PermissionInterceptorContext.setDataAuthRule(FIRE_WATER_INFO);
List<OrgMenuDto> orgUsrTree = iOrgUsrService.companyTreeByUserAndType(reginParams, OrgPersonEnum.公司.getKey(), null); List<OrgMenuDto> orgUsrTree = iOrgUsrService.companyTreeByUserAndType(reginParams, null, null);
List<String> stringList = new ArrayList<String>(); List<String> stringList = new ArrayList<String>();
initCompanyList(orgUsrTree, stringList); initCompanyList(orgUsrTree, stringList);
String[] str = stringList.toArray(new String[stringList.size()]); String[] str = stringList.toArray(new String[stringList.size()]);
......
...@@ -357,9 +357,7 @@ public class ExcelServiceImpl { ...@@ -357,9 +357,7 @@ public class ExcelServiceImpl {
String signTimeBIGGER =par.containsKey("signTimeBIGGER")?par.get("signTimeBIGGER").toString():null; String signTimeBIGGER =par.containsKey("signTimeBIGGER")?par.get("signTimeBIGGER").toString():null;
String signTimeLESS =par.containsKey("signTimeLESS")?par.get("signTimeLESS").toString():null; String signTimeLESS =par.containsKey("signTimeLESS")?par.get("signTimeLESS").toString():null;
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String companyId = reginParams.getPersonIdentity().getCompanyId(); dto.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
OrgUsr orgUsr = orgUsrMapper.queryBySequenceNbr(companyId);
dto.setBizOrgCode(orgUsr.getBizOrgCode());
dto.setDate(date); dto.setDate(date);
dto.setBizOrgName(bizOrgName); dto.setBizOrgName(bizOrgName);
dto.setName(name); dto.setName(name);
...@@ -374,7 +372,7 @@ public class ExcelServiceImpl { ...@@ -374,7 +372,7 @@ public class ExcelServiceImpl {
} }
Page<SignDto> page = new Page<>(); Page<SignDto> page = new Page<>();
page.setCurrent(1); page.setCurrent(1);
page.setSize(10000); page.setSize(-1);
IPage<SignDto> signDtos = signServiceImpl IPage<SignDto> signDtos = signServiceImpl
.queryForSignPageByMapper(page,dto); .queryForSignPageByMapper(page,dto);
signDtos.getRecords().stream().forEach(e->{ signDtos.getRecords().stream().forEach(e->{
...@@ -1022,14 +1020,18 @@ public class ExcelServiceImpl { ...@@ -1022,14 +1020,18 @@ public class ExcelServiceImpl {
//组装参数 //组装参数
Long group=null; Long group=null;
user.setCompanySeqs(companySeqs); user.setCompanySeqs(companySeqs);
String[] split = orgUsrExcelDto.getDeptSeqs().split("@"); if (!StringUtils.isEmpty(orgUsrExcelDto.getDeptSeqs())){
user.setDeptSeqs(split[1]); String[] split = orgUsrExcelDto.getDeptSeqs().split("@");
user.setDeptSeqs(split[1]);
}
user.setEmail(orgUsrExcelDto.getEmail()); user.setEmail(orgUsrExcelDto.getEmail());
user.setLockStatus("UNLOCK"); user.setLockStatus("UNLOCK");
for (UserVO userVO : listUser) { for (UserVO userVO : listUser) {
if(userVO.getType().equals(orgUsrExcelDto.getUserType())){ if(userVO.getType().equals(orgUsrExcelDto.getUserType())){
Map<String,List<String>> orgRoleSeqs=new HashMap<>(); Map<String,List<String>> orgRoleSeqs=new HashMap<>();
orgRoleSeqs.put(split[1],userVO.getRoleSeqs()); if (!StringUtils.isEmpty(orgUsrExcelDto.getDeptSeqs())) {
orgRoleSeqs.put(orgUsrExcelDto.getDeptSeqs().split("@")[1],userVO.getRoleSeqs());
}
user.setOrgRoleSeqs(orgRoleSeqs); user.setOrgRoleSeqs(orgRoleSeqs);
user.setAppCodes(userVO.getAppCodes()); user.setAppCodes(userVO.getAppCodes());
user.setRoleSeqs(userVO.getRoleSeqs()); user.setRoleSeqs(userVO.getRoleSeqs());
...@@ -1037,7 +1039,7 @@ public class ExcelServiceImpl { ...@@ -1037,7 +1039,7 @@ public class ExcelServiceImpl {
} }
} }
//密码效验加密,不能为空,并且必须相等 //密码效验加密,不能为空,并且必须相等
if(!orgUsrExcelDto.getPassword().isEmpty()){ if(!StringUtils.isEmpty(orgUsrExcelDto.getPassword())){
user.setPassword(DesUtil.encode(orgUsrExcelDto.getPassword(), "qaz")); user.setPassword(DesUtil.encode(orgUsrExcelDto.getPassword(), "qaz"));
user.setRePassword(DesUtil.encode(orgUsrExcelDto.getPassword(), "qaz")); user.setRePassword(DesUtil.encode(orgUsrExcelDto.getPassword(), "qaz"));
}else{ }else{
...@@ -2303,10 +2305,10 @@ private void saveuser(OrgUsrTPDlExcelDto orgUsrExcelDto,Set<String> set,String a ...@@ -2303,10 +2305,10 @@ private void saveuser(OrgUsrTPDlExcelDto orgUsrExcelDto,Set<String> set,String a
continue; continue;
} }
} }
Cell cell4 = row.getCell(4); // Cell cell4 = row.getCell(4);
if(cell4 ==null) { // if(cell4 ==null) {
continue; // continue;
} // }
Cell cell = row.getCell(1); Cell cell = row.getCell(1);
if (cell != null) { if (cell != null) {
dutyPersonDto.setUserId(cell.toString()); dutyPersonDto.setUserId(cell.toString());
...@@ -2325,6 +2327,8 @@ private void saveuser(OrgUsrTPDlExcelDto orgUsrExcelDto,Set<String> set,String a ...@@ -2325,6 +2327,8 @@ private void saveuser(OrgUsrTPDlExcelDto orgUsrExcelDto,Set<String> set,String a
String[] split = cell.toString().split("@"); String[] split = cell.toString().split("@");
dutyPersonDto.setPostTypeName(split[0]); dutyPersonDto.setPostTypeName(split[0]);
dutyPersonDto.setPostType(split[1]); dutyPersonDto.setPostType(split[1]);
} else {
throw new BadRequest("第"+i+1+"行,第5列数据为空,请检查数据后再上传");
} }
// 需求958 添加值班区域 导入 by kongfm 2021-09-15 // 需求958 添加值班区域 导入 by kongfm 2021-09-15
cell = row.getCell(5); cell = row.getCell(5);
...@@ -2332,6 +2336,8 @@ private void saveuser(OrgUsrTPDlExcelDto orgUsrExcelDto,Set<String> set,String a ...@@ -2332,6 +2336,8 @@ private void saveuser(OrgUsrTPDlExcelDto orgUsrExcelDto,Set<String> set,String a
String[] dutyArea = cell.toString().split("@"); String[] dutyArea = cell.toString().split("@");
dutyPersonDto.setDutyArea(dutyArea[0]); dutyPersonDto.setDutyArea(dutyArea[0]);
dutyPersonDto.setDutyAreaId(dutyArea[1]); dutyPersonDto.setDutyAreaId(dutyArea[1]);
} else {
throw new BadRequest("第"+i+1+"行,第6列数据为空,请检查数据后再上传");
} }
List<DutyPersonShiftDto> dutyShift = new ArrayList<>(); List<DutyPersonShiftDto> dutyShift = new ArrayList<>();
for (int j = 0; j < dayByMonth.size(); j++) { for (int j = 0; j < dayByMonth.size(); j++) {
......
...@@ -37,6 +37,25 @@ ...@@ -37,6 +37,25 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.1.1</version>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId> <artifactId>amos-component-rule</artifactId>
<exclusions> <exclusions>
...@@ -127,6 +146,12 @@ ...@@ -127,6 +146,12 @@
<groupId>org.liquibase</groupId> <groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId> <artifactId>liquibase-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<classifier>jdk16</classifier>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.patrol.business.service.intfc.IEquipmentHandlerService; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.patrol.business.service.intfc.IEquipmentHandlerService;
import com.yeejoin.amos.patrol.business.util.CommonResponse; import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil; import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.business.util.Toke; import com.yeejoin.amos.patrol.business.util.Toke;
import com.yeejoin.amos.patrol.core.common.request.ToJson;
import com.yeejoin.amos.patrol.dao.entity.InputItem; import com.yeejoin.amos.patrol.dao.entity.InputItem;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -70,7 +71,8 @@ public class EquipmentRuleController extends AbstractBaseController{ ...@@ -70,7 +71,8 @@ public class EquipmentRuleController extends AbstractBaseController{
// param.put("classifyId",classifyId); // param.put("classifyId",classifyId);
// param.put("orgCode",orgCode); // param.put("orgCode",orgCode);
List<InputItem> list=equipmentHandlerService.getEquipmnetRulesByName(equipmentName); List<InputItem> list=equipmentHandlerService.getEquipmnetRulesByName(equipmentName);
return CommonResponseUtil.success(list); Object ov= ToJson.tojson(list);
return CommonResponseUtil.success(ov);
} }
} }
...@@ -87,6 +87,8 @@ public class InputItemController extends AbstractBaseController { ...@@ -87,6 +87,8 @@ public class InputItemController extends AbstractBaseController {
*/ */
private static final String EQUIP_AND_FIRE_TREE = "EQUIP_AND_FIRE_TREE:"; private static final String EQUIP_AND_FIRE_TREE = "EQUIP_AND_FIRE_TREE:";
private static final String ITEMTYPE = "选择,文本:";
/** /**
* 新加接口***************************************************************************** * 新加接口*****************************************************************************
...@@ -327,13 +329,14 @@ public class InputItemController extends AbstractBaseController { ...@@ -327,13 +329,14 @@ public class InputItemController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入检查项", notes = "导入检查项") @ApiOperation(value = "导入检查项", notes = "导入检查项")
@PostMapping(value = "/importData", produces = "application/json;charset=UTF-8") @PostMapping(value = "/importData", produces = "application/json;charset=UTF-8")
public void importData(@RequestPart("file") MultipartFile multipartFile) { public CommonResponse importData(@RequestPart("file") MultipartFile multipartFile) {
try { try {
List<InputItemExcelDto> inputItemExcelDtos = ExcelUtil.readFirstSheetExcel(multipartFile, InputItemExcelDto.class, 1); List<InputItemExcelDto> inputItemExcelDtos = ExcelUtil.readFirstSheetExcel(multipartFile, InputItemExcelDto.class, 1);
for (InputItemExcelDto inputItemExcelDto : inputItemExcelDtos) { for (InputItemExcelDto inputItemExcelDto : inputItemExcelDtos) {
if (StringUtils.isEmpty(inputItemExcelDto.getItemNo()) || StringUtils.isEmpty(inputItemExcelDto.getName()) || StringUtils.isEmpty(inputItemExcelDto.getInputClassify())){ if (StringUtils.isEmpty(inputItemExcelDto.getItemNo()) || StringUtils.isEmpty(inputItemExcelDto.getName()) || StringUtils.isEmpty(inputItemExcelDto.getInputClassify())){
throw new BadRequest("编号、名称、检查类型不能为空"); throw new BadRequest("编号、名称、检查类型不能为空");
} }
InputItemParam inputItemParam = new InputItemParam();
//组装参数 因部分字段数据数据库中用json统一保存 按类型组装为所需数据结构 //组装参数 因部分字段数据数据库中用json统一保存 按类型组装为所需数据结构
if (inputItemExcelDto.getItemType().equals("选择") && StringUtil.isNotEmpty(inputItemExcelDto.getDataJson())){ if (inputItemExcelDto.getItemType().equals("选择") && StringUtil.isNotEmpty(inputItemExcelDto.getDataJson())){
List<InputItemDataDto> itemDataDtos = new ArrayList<>(); List<InputItemDataDto> itemDataDtos = new ArrayList<>();
...@@ -356,12 +359,41 @@ public class InputItemController extends AbstractBaseController { ...@@ -356,12 +359,41 @@ public class InputItemController extends AbstractBaseController {
BeanUtils.copyProperties(inputItemExcelDto,inputItemDataJsonlDto); BeanUtils.copyProperties(inputItemExcelDto,inputItemDataJsonlDto);
inputItemExcelDto.setDataJson(JSON.toJSONString(inputItemExcelDto)); inputItemExcelDto.setDataJson(JSON.toJSONString(inputItemExcelDto));
} }
List<Map<String, String> > itemDataDtos = new ArrayList<>();
if (inputItemExcelDto.getPictureJson() != null){
if (inputItemExcelDto.getPictureJson().contains("|")) {
String[] datas = inputItemExcelDto.getPictureJson().split("\\|");
List<String> list = Arrays.asList(datas);
list.forEach(e->{
String[] data = e.split(",");
Map<String, String> map = new HashMap<>();
map.put("name",data[0]);
map.put("isMust",data[1]);
itemDataDtos.add(map);
});
}else {
String[] data = inputItemExcelDto.getPictureJson().split(",");
Map<String, String> map = new HashMap<>();
map.put("name",data[0]);
map.put("isMust",data[1]);
itemDataDtos.add(map);
}
}
//转化为新增接口所需参数 //转化为新增接口所需参数
InputItemParam inputItemParam = new InputItemParam();
BeanUtils.copyProperties(inputItemExcelDto,inputItemParam); BeanUtils.copyProperties(inputItemExcelDto,inputItemParam);
if (inputItemParam.getDataJson() != null){
inputItemParam.setDataJson(JSON.parseArray(inputItemParam.getDataJson().toString(),Map.class));
}
if (inputItemParam.getPictureJson()!=null){
inputItemParam.setPictureJson(itemDataDtos);
}
//新增接口 //新增接口
this.addNewItemNew(inputItemParam); this.addNewItemNew(inputItemParam);
} }
return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
throw new BadRequest(e.getMessage()); throw new BadRequest(e.getMessage());
} }
...@@ -370,17 +402,22 @@ public class InputItemController extends AbstractBaseController { ...@@ -370,17 +402,22 @@ public class InputItemController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出检查项", notes = "导出检查项") @ApiOperation(value = "导出检查项", notes = "导出检查项")
@RequestMapping(value = "/exportData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/exportData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public void exportData(HttpServletResponse response) { public void exportData(HttpServletResponse response,String ids) {
InputItemPageParam criterias = new InputItemPageParam(); InputItemPageParam criterias = new InputItemPageParam();
ReginParams params = getSelectedOrgInfo();
if (!StringUtils.isEmpty(ids)){
criterias.setIds(ids);
}
criterias.setBizOrgCode(params.getPersonIdentity().getCompanyBizOrgCode());
List<InputItemExcelVo> content = inputItemMapper.getInputItemInfoExcelNew(criterias); List<InputItemExcelVo> content = inputItemMapper.getInputItemInfoExcelNew(criterias);
//此处对数据做统一处理 拼接为易读内容 //此处对数据做统一处理 拼接为易读内容
for (InputItemExcelVo inputItemExcelDto : content) { for (InputItemExcelVo inputItemExcelDto : content) {
String text = ""; String text = "";
if (inputItemExcelDto.getItemType().equals("选择")&& !inputItemExcelDto.getDataJson().equals("[]")) { if (inputItemExcelDto.getItemType().equals("选择")&& !inputItemExcelDto.getDataJson().equals("[]")&& !inputItemExcelDto.getDataJson().equals("")) {
List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getDataJson(), Map.class); List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getDataJson(), Map.class);
for (int i = 0; i< maps.size(); i++) { for (int i = 0; i< maps.size(); i++) {
Map jsonObject = maps.get(i); Map jsonObject = maps.get(i);
text = text + jsonObject.get("name")+","+jsonObject.get("score")+","+jsonObject.get("isOk")+","+jsonObject.get("isChecked"); text = text +"名称:"+jsonObject.get("name")+" "+"评分:"+jsonObject.get("score")+" "+"选择是否合格:"+jsonObject.get("isOk")+" "+"默认选中:"+jsonObject.get("isChecked");
if(i < (maps.size()-1) ){ if(i < (maps.size()-1) ){
text = text+"|"; text = text+"|";
inputItemExcelDto.setDataJson(text); inputItemExcelDto.setDataJson(text);
...@@ -389,6 +426,20 @@ public class InputItemController extends AbstractBaseController { ...@@ -389,6 +426,20 @@ public class InputItemController extends AbstractBaseController {
} }
} }
} }
if (!inputItemExcelDto.getPictureJson().equals("[]")&& !inputItemExcelDto.getPictureJson().equals("")) {
List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getPictureJson(), Map.class);
text = "";
for (int i = 0; i< maps.size(); i++) {
Map jsonObject = maps.get(i);
text = text +"名称:"+ jsonObject.get("name")+","+ "是否拍照:"+jsonObject.get("isMust");
if(i < (maps.size()-1) ){
text = text+"|";
inputItemExcelDto.setPictureJson(text);
}else {
inputItemExcelDto.setPictureJson(text);
}
}
}
if (inputItemExcelDto.getItemType().equals("数字") || inputItemExcelDto.getItemType().equals("文本")) { if (inputItemExcelDto.getItemType().equals("数字") || inputItemExcelDto.getItemType().equals("文本")) {
//此处为避免大量set方法 将data_json字段中的数据转为对象组装 //此处为避免大量set方法 将data_json字段中的数据转为对象组装
InputItemDataJsonlDto inputItemDataJsonlDto = JSONObject.parseObject(inputItemExcelDto.getDataJson(), InputItemDataJsonlDto.class); InputItemDataJsonlDto inputItemDataJsonlDto = JSONObject.parseObject(inputItemExcelDto.getDataJson(), InputItemDataJsonlDto.class);
......
package com.yeejoin.amos.patrol.business.controller; package com.yeejoin.amos.patrol.business.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import com.yeejoin.amos.patrol.business.constants.XJConstant;
...@@ -140,12 +142,14 @@ public class PlanController extends AbstractBaseController { ...@@ -140,12 +142,14 @@ public class PlanController extends AbstractBaseController {
@RequestMapping(value = "/addPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/addPlan", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse checkPlanAdd(@ApiParam(value = "巡检计划", required = true) @RequestBody Plan param) { public CommonResponse checkPlanAdd(@ApiParam(value = "巡检计划", required = true) @RequestBody Plan param) {
try { try {
if (param.getDayRate() == 1) {
long dayBeginTime = param.getDayBegin().getTime();
if ( param.getDayBegin().getTime()> param.getDayEnd().getTime()){ long dayEndTime = param.getDayEnd().getTime();
throw new BadRequest("开始时间不能大于结束时间"); long diff = (dayEndTime - dayBeginTime) / 1000 / 60;
if (diff < param.getDuration()) {
return CommonResponseUtil.failure("工作时长超出结束时间");
}
} }
String userId = getUserId(); String userId = getUserId();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams); String loginOrgCode = getOrgCode(reginParams);
...@@ -180,7 +184,9 @@ public class PlanController extends AbstractBaseController { ...@@ -180,7 +184,9 @@ public class PlanController extends AbstractBaseController {
} }
} }
map.put("param", param); map.put("param", param);
return CommonResponseUtil.success(planService.addPlan(map)); Plan plan = planService.addPlan(map);
Object ob = plan != null ? ToJson.tojson(plan) : null;
return CommonResponseUtil.success(ob);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return CommonResponseUtil.failure("巡检计划新增失败"); return CommonResponseUtil.failure("巡检计划新增失败");
...@@ -197,7 +203,7 @@ public class PlanController extends AbstractBaseController { ...@@ -197,7 +203,7 @@ public class PlanController extends AbstractBaseController {
@ApiOperation(value = "删除巡检计划", notes = "删除巡检计划") @ApiOperation(value = "删除巡检计划", notes = "删除巡检计划")
@RequestMapping(value = "/deletePlanById", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/deletePlanById", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse deletePlanById( public CommonResponse deletePlanById(
@ApiParam(value = "巡检计划ID", required = true) @RequestParam Integer[] param) { @ApiParam(value = "巡检计划ID", required = true) @RequestParam Long[] param) {
try { try {
planService.delPlanById(param); planService.delPlanById(param);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
...@@ -217,7 +223,7 @@ public class PlanController extends AbstractBaseController { ...@@ -217,7 +223,7 @@ public class PlanController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "另存巡检计划", notes = "另存巡检计划") @ApiOperation(value = "另存巡检计划", notes = "另存巡检计划")
@RequestMapping(value = "/saveAs", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/saveAs", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse planSaveAs(@ApiParam(value = "参数", required = true) @RequestParam Integer[] param) { public CommonResponse planSaveAs(@ApiParam(value = "参数", required = true) @RequestParam Long[] param) {
try { try {
planService.planSaveAs(param); planService.planSaveAs(param);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.param.PlanInfoPageParam;
import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam; import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam;
import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService; import com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.patrol.business.service.intfc.IPointService; import com.yeejoin.amos.patrol.business.service.intfc.IPointService;
...@@ -17,6 +18,7 @@ import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum; ...@@ -17,6 +18,7 @@ import com.yeejoin.amos.patrol.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum; import com.yeejoin.amos.patrol.common.enums.TaskIsOrderEnum;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable; import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.core.common.request.CommonRequest; import com.yeejoin.amos.patrol.core.common.request.CommonRequest;
import com.yeejoin.amos.patrol.core.common.request.ToJson;
import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone; import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.dao.entity.Point; import com.yeejoin.amos.patrol.dao.entity.Point;
import com.yeejoin.amos.patrol.dao.entity.PointClassify; import com.yeejoin.amos.patrol.dao.entity.PointClassify;
...@@ -29,15 +31,19 @@ import org.slf4j.Logger; ...@@ -29,15 +31,19 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -115,29 +121,6 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -115,29 +121,6 @@ public class PlanTaskController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "计划执行重做", notes = "计划执行重做") @ApiOperation(value = "计划执行重做", notes = "计划执行重做")
@RequestMapping(value = "/regenPlanTaskNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/regenPlanTaskNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
...@@ -166,23 +149,6 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -166,23 +149,6 @@ public class PlanTaskController extends AbstractBaseController {
/** /**
* 计划执行删除 * 计划执行删除
* *
...@@ -204,8 +170,6 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -204,8 +170,6 @@ public class PlanTaskController extends AbstractBaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出巡检记录", notes = "导出巡检记录") @ApiOperation(value = "导出巡检记录", notes = "导出巡检记录")
@RequestMapping(value = "/exportSelectPlanTaskNew", method = RequestMethod.GET) @RequestMapping(value = "/exportSelectPlanTaskNew", method = RequestMethod.GET)
...@@ -242,7 +206,6 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -242,7 +206,6 @@ public class PlanTaskController extends AbstractBaseController {
} }
/** /**
* 计划执行查询 * 计划执行查询
* *
...@@ -1071,4 +1034,40 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -1071,4 +1034,40 @@ public class PlanTaskController extends AbstractBaseController {
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
} }
} }
/**
* 巡检任务列表
* @param queryRequests
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "巡查任务分页列表", notes = "巡查任务分页列表")
@RequestMapping(value = "/page", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse getPlanTaskPageList(@ApiParam(value = "查询条件", required = false)
@RequestBody(required = false) PlanTaskPageParam queryRequests) {
ReginParams reginParams = getSelectedOrgInfo();
queryRequests.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
Page<HashMap<String, Object>> list = planTaskService.getPlanTaskPageList(queryRequests);
Object ob = list.getContent().size() > 0 ? ToJson.tojson(list) : null;
return CommonResponseUtil.success(ob);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "预览巡查报表", notes = "预览巡查报表")
@RequestMapping(value = "/preview", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse preview(@ApiParam(value = "任务id", required = true) @RequestParam String taskDetailId) {
RequestContext.setProduct(getProduct());
RequestContext.setAppKey(getAppKey());
RequestContext.setToken(getToken());
return CommonResponseUtil.success(planTaskService.preview(taskDetailId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "下载巡查报表", notes = "下载巡查报表")
@RequestMapping(value = "/download", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public void download(HttpServletRequest request, HttpServletResponse response, @ApiParam(value = "任务id", required = true) @RequestParam String taskDetailId) throws UnsupportedEncodingException {
planTaskService.download(request, response, taskDetailId);
}
} }
...@@ -820,7 +820,7 @@ public class PointController extends AbstractBaseController { ...@@ -820,7 +820,7 @@ public class PointController extends AbstractBaseController {
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return CommonResponseUtil.failure("导入失败"); return CommonResponseUtil.failure(e.getLocalizedMessage());
} }
} }
...@@ -1471,7 +1471,9 @@ public class PointController extends AbstractBaseController { ...@@ -1471,7 +1471,9 @@ public class PointController extends AbstractBaseController {
@ApiParam(value = "巡检点ID") @RequestParam(value = "pointId") Long pointId, @ApiParam(value = "巡检点ID") @RequestParam(value = "pointId") Long pointId,
@ApiParam(value = "设备ID") @RequestParam(value = "classifyId") Long classifyId, @ApiParam(value = "设备ID") @RequestParam(value = "classifyId") Long classifyId,
@ApiParam(value = "路线ID") @RequestParam(value = "routeId") Long routeId) { @ApiParam(value = "路线ID") @RequestParam(value = "routeId") Long routeId) {
return CommonResponseUtil.success(iPointService.queryItemList4RoutePointNew(routeId,pointId, classifyId)); List list = iPointService.queryItemList4RoutePointNew(routeId, pointId, classifyId);
Object ob=list!=null?ToJson.tojson(list):null;
return CommonResponseUtil.success(ob);
} }
/** /**
......
...@@ -14,6 +14,7 @@ import org.springframework.stereotype.Repository; ...@@ -14,6 +14,7 @@ import org.springframework.stereotype.Repository;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
@Repository @Repository
@Mapper @Mapper
...@@ -61,7 +62,7 @@ public interface InputItemMapper extends BaseMapper<InputItem> { ...@@ -61,7 +62,7 @@ public interface InputItemMapper extends BaseMapper<InputItem> {
public List<PointInputItemVo> queryCustomInputItem( HashMap<String, Object> param ); public List<PointInputItemVo> queryCustomInputItem( HashMap<String, Object> param );
List<PointInputItemVo> queryCustomInputItemByCodes(@Param("inputItemNos") List<String> inputItemNos); List<PointInputItemVo> queryCustomInputItemByCodes(@Param("inputItemNos") Set<String> inputItemNos);
public List<InputItemVo> getInputItemListByitemNos(@Param("itemNos") String[] itemNos); public List<InputItemVo> getInputItemListByitemNos(@Param("itemNos") String[] itemNos);
......
...@@ -196,4 +196,24 @@ public interface PlanTaskMapper extends BaseMapper { ...@@ -196,4 +196,24 @@ public interface PlanTaskMapper extends BaseMapper {
* @return 消防巡检信息统计 * @return 消防巡检信息统计
*/ */
List<Map<String, Object>> firePatrolStatics(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> firePatrolStatics(@Param("bizOrgCode") String bizOrgCode);
long countData(@Param(value="param") PlanTaskPageParam param);
List<HashMap<String, Object>> planTaskPage(@Param(value="param") PlanTaskPageParam param);
Map<String, Object> getPlanTaskBasicInfo(@Param(value="taskDetailId") String taskDetailId);
Map<String, Object> getPlanTaskExecuteInfo(@Param(value="taskDetailId") String taskDetailId);
List<String> getDefinitionObjCode(@Param(value="taskDetailId") String taskDetailId);
Map<String, Object> getDefectEquipInfo(@Param(value="id") String id);
List<Map<String, Object>> getCheckMissedEquipInfo(@Param(value="taskDetailId") String taskDetailId);
List<Map<String, Object>> getCheckQualifiedEquipInfo(@Param(value="taskDetailId") String taskDetailId);
List<Map<String, Object>> getCheckNotQualifiedEquipInfo(@Param(value="taskDetailId") String taskDetailId);
String getCheckIdByDetailId(@Param(value="taskDetailId") String taskDetailId);
} }
...@@ -41,6 +41,7 @@ public class InputItemExcelDto extends BaseDto { ...@@ -41,6 +41,7 @@ public class InputItemExcelDto extends BaseDto {
@ExcelProperty(value = "评分项(选择)", index = 5) @ExcelProperty(value = "评分项(选择)", index = 5)
@ApiModelProperty(value = "评分项") @ApiModelProperty(value = "评分项")
private String dataJson; private String dataJson;
@ExcelProperty(value = "消防装备类型", index = 6) @ExcelProperty(value = "消防装备类型", index = 6)
@ApiModelProperty(value = "消防装备类型") @ApiModelProperty(value = "消防装备类型")
private String equipmentType; private String equipmentType;
...@@ -64,9 +65,9 @@ public class InputItemExcelDto extends BaseDto { ...@@ -64,9 +65,9 @@ public class InputItemExcelDto extends BaseDto {
@ApiModelProperty(value = "检查类型") @ApiModelProperty(value = "检查类型")
private String inputClassify; private String inputClassify;
@ExcelProperty(value = "拍照项(文本/选择)", index = 14) @ExcelProperty(value = "拍照项", index = 14)
@ApiModelProperty(value = "拍照项") @ApiModelProperty(value = "拍照项")
private Object pictureJson; private String pictureJson;
@ExplicitConstraint(indexNum=11,source = {"是","否"}) @ExplicitConstraint(indexNum=11,source = {"是","否"})
@ExcelProperty(value = "是否必填", index = 11) @ExcelProperty(value = "是否必填", index = 11)
...@@ -303,7 +304,9 @@ public class InputItemExcelDto extends BaseDto { ...@@ -303,7 +304,9 @@ public class InputItemExcelDto extends BaseDto {
} }
public void setKeyPartsType(String keyPartsType) { public void setKeyPartsType(String keyPartsType) {
// this.keyPartsType = StringUtils.isEmpty(keyPartsType) ? "1":keyPartsType; // this.keyPartsType = StringUtils.isEmpty(keyPartsType) ? "1":keyPartsType;
this.keyPartsType =StringUtils.isNotEmpty(keyPartsType) ? (keyPartsType.equals("是")?"0":"1") :keyPartsType; this.keyPartsType =StringUtils.isNotEmpty(keyPartsType) ? (keyPartsType.equals("是")?"0":"1") :keyPartsType;
} }
...@@ -449,11 +452,11 @@ public class InputItemExcelDto extends BaseDto { ...@@ -449,11 +452,11 @@ public class InputItemExcelDto extends BaseDto {
this.orgCode = orgCode; this.orgCode = orgCode;
} }
public Object getPictureJson() { public String getPictureJson() {
return pictureJson; return pictureJson;
} }
public void setPictureJson(Object pictureJson) { public void setPictureJson(String pictureJson) {
this.pictureJson = pictureJson; this.pictureJson = pictureJson;
} }
......
package com.yeejoin.amos.patrol.business.dto; package com.yeejoin.amos.patrol.business.dto;
import cn.jiguang.common.utils.StringUtils;
import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
...@@ -9,6 +8,7 @@ import com.yeejoin.amos.patrol.common.enums.PointCheckTypeEnum; ...@@ -9,6 +8,7 @@ import com.yeejoin.amos.patrol.common.enums.PointCheckTypeEnum;
import com.yeejoin.amos.patrol.common.enums.PointLevelEnum; import com.yeejoin.amos.patrol.common.enums.PointLevelEnum;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import liquibase.pro.packaged.S;
import lombok.Data; import lombok.Data;
...@@ -64,9 +64,9 @@ public class InputItemExcelVo extends BaseDto { ...@@ -64,9 +64,9 @@ public class InputItemExcelVo extends BaseDto {
@ApiModelProperty(value = "检查类型") @ApiModelProperty(value = "检查类型")
private String inputClassify; private String inputClassify;
@ExcelProperty(value = "拍照项(文本/选择)", index = 14) @ExcelProperty(value = "拍照项", index = 14)
@ApiModelProperty(value = "拍照项") @ApiModelProperty(value = "拍照项")
private Object pictureJson; private String pictureJson;
@ExplicitConstraint(indexNum=11,source = {"是","否"}) @ExplicitConstraint(indexNum=11,source = {"是","否"})
@ExcelProperty(value = "是否必填", index = 11) @ExcelProperty(value = "是否必填", index = 11)
...@@ -117,19 +117,19 @@ public class InputItemExcelVo extends BaseDto { ...@@ -117,19 +117,19 @@ public class InputItemExcelVo extends BaseDto {
@ExcelProperty(value = "强制校验,输入值不能大于有效值上限(数字)", index = 22) @ExcelProperty(value = "强制校验,输入值不能大于有效值上限(数字)", index = 22)
@ApiModelProperty(value = "强制校验,输入值不能大于有效值上限") @ApiModelProperty(value = "强制校验,输入值不能大于有效值上限")
private String checkValidUp = "false"; private String checkValidUp ;
@ExcelProperty(value = "强制校验,输入值不能小于有效值下限(数字)", index = 23) @ExcelProperty(value = "强制校验,输入值不能小于有效值下限(数字)", index = 23)
@ApiModelProperty(value = "强制校验,输入值不能小于有效值下限") @ApiModelProperty(value = "强制校验,输入值不能小于有效值下限")
private String checkValidDown = "false"; private String checkValidDown ;
@ExcelProperty(value = "合格判断,输入值大于合格值上限时为不合格(数字)", index = 24) @ExcelProperty(value = "合格判断,输入值大于合格值上限时为不合格(数字)", index = 24)
@ApiModelProperty(value = "合格判断,输入值大于合格值上限时为不合格") @ApiModelProperty(value = "合格判断,输入值大于合格值上限时为不合格")
private String checkOkUp = "false"; private String checkOkUp ;
@ExcelProperty(value = "合格判断,输入值小于合格值上限时为不合格(数字)", index = 25) @ExcelProperty(value = "合格判断,输入值小于合格值上限时为不合格(数字)", index = 25)
@ApiModelProperty(value = "合格判断,输入值小于合格值上限时为不合格") @ApiModelProperty(value = "合格判断,输入值小于合格值上限时为不合格")
private String checkOkDown = "false"; private String checkOkDown ;
@ExcelProperty(value = "小数点后位数(数字)", index = 26) @ExcelProperty(value = "小数点后位数(数字)", index = 26)
@ApiModelProperty(value = "小数点后位数") @ApiModelProperty(value = "小数点后位数")
...@@ -158,6 +158,17 @@ public class InputItemExcelVo extends BaseDto { ...@@ -158,6 +158,17 @@ public class InputItemExcelVo extends BaseDto {
@ExcelIgnore @ExcelIgnore
private String riskDesc; private String riskDesc;
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
@ExcelIgnore
private String ids;
/** /**
* 新加字段 * 新加字段
*/ */
...@@ -446,11 +457,11 @@ public class InputItemExcelVo extends BaseDto { ...@@ -446,11 +457,11 @@ public class InputItemExcelVo extends BaseDto {
this.orgCode = orgCode; this.orgCode = orgCode;
} }
public Object getPictureJson() { public String getPictureJson() {
return pictureJson; return pictureJson;
} }
public void setPictureJson(Object pictureJson) { public void setPictureJson(String pictureJson) {
this.pictureJson = pictureJson; this.pictureJson = pictureJson;
} }
......
package com.yeejoin.amos.patrol.business.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author DELL
*/
@FeignClient(name = "${idx.feign.name}", path = "idx", configuration = {FeignConfiguration.class})
public interface IdxFeign {
/***
* <pre>
* @Description: 根据巡检转缺陷code查询缺陷列表
* </pre>
*
* @MethodName:
* @Param:
* @Return: null
* @Throws
* @Author keyong
* @Date 2023/04/22 17:46
*/
@PostMapping(value = "/defect/check/list")
FeignClientResult queryDefectByCodes(@RequestBody List<String> codes, @RequestParam String checkId);
}
...@@ -27,6 +27,16 @@ public class InputItemPageParam extends CommonPageable{ ...@@ -27,6 +27,16 @@ public class InputItemPageParam extends CommonPageable{
private String subCode; private String subCode;
public String getIds() {
return ids;
}
public void setIds(String ids) {
this.ids = ids;
}
private String ids;
public Integer getInhierarchy() { public Integer getInhierarchy() {
return inhierarchy; return inhierarchy;
} }
......
...@@ -32,7 +32,27 @@ public class PlanTaskPageParam extends CommonPageable { ...@@ -32,7 +32,27 @@ public class PlanTaskPageParam extends CommonPageable {
* 所属计划 * 所属计划
*/ */
private String planId; private String planId;
private String beginTime;
private String endTime;
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getBeginTime() {
return beginTime;
}
public String getEndTime() {
return endTime;
}
/** /**
* 所属路线 * 所属路线
*/ */
...@@ -56,6 +76,16 @@ public class PlanTaskPageParam extends CommonPageable { ...@@ -56,6 +76,16 @@ public class PlanTaskPageParam extends CommonPageable {
private String searchDay; private String searchDay;
private String taskName;
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public String getTaskName() {
return taskName;
}
public String getSearchDay() { public String getSearchDay() {
return searchDay; return searchDay;
} }
......
...@@ -168,7 +168,10 @@ public class CheckServiceImpl implements ICheckService { ...@@ -168,7 +168,10 @@ public class CheckServiceImpl implements ICheckService {
Check check = checkDao.findById(imgList.get(0).getCheckId()).get(); Check check = checkDao.findById(imgList.get(0).getCheckId()).get();
check.setShotNumber(check.getShotNumber() + imgList.size()); check.setShotNumber(check.getShotNumber() + imgList.size());
checkDao.save(check); checkDao.save(check);
checkShotDao.saveAll(imgList); for (CheckShot cs: imgList
) {
checkShotDao.saveAndFlush(cs);
}
// 巡检站端与中心级数据同步 // 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override @Override
...@@ -614,7 +617,11 @@ public class CheckServiceImpl implements ICheckService { ...@@ -614,7 +617,11 @@ public class CheckServiceImpl implements ICheckService {
imgList.add(img); imgList.add(img);
} }
} }
List<CheckInput> checkInputList = checkInputDao.saveAll(checkItemList); List<CheckInput> checkInputList = new ArrayList<>();
for (CheckInput checkInput : checkItemList) {
checkInputDao.saveAndFlush(checkInput);
checkInputList.add(checkInput);
}
//规则请求结果 //规则请求结果
checkInputList.forEach(checkInput -> { checkInputList.forEach(checkInput -> {
InputItem inputItem = inputItemDao.findById(checkInput.getInputId()).get(); InputItem inputItem = inputItemDao.findById(checkInput.getInputId()).get();
......
...@@ -10,6 +10,7 @@ import com.yeejoin.amos.patrol.business.service.intfc.IPlanService; ...@@ -10,6 +10,7 @@ import com.yeejoin.amos.patrol.business.service.intfc.IPlanService;
import com.yeejoin.amos.patrol.core.util.DateUtil; import com.yeejoin.amos.patrol.core.util.DateUtil;
import com.yeejoin.amos.patrol.core.util.StringUtil; import com.yeejoin.amos.patrol.core.util.StringUtil;
import com.yeejoin.amos.patrol.dao.entity.Plan; import com.yeejoin.amos.patrol.dao.entity.Plan;
import liquibase.pro.packaged.L;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -88,7 +89,7 @@ public class PlanServiceImpl implements IPlanService { ...@@ -88,7 +89,7 @@ public class PlanServiceImpl implements IPlanService {
@Override @Override
@Transactional @Transactional
public void delPlanById(Integer[] param) { public void delPlanById(Long[] param) {
List<Long> ids = new ArrayList<Long>(); List<Long> ids = new ArrayList<Long>();
for(int i=0;i<param.length;i++){ for(int i=0;i<param.length;i++){
ids.add(Long.parseLong(param[i].toString())); ids.add(Long.parseLong(param[i].toString()));
...@@ -112,7 +113,7 @@ public class PlanServiceImpl implements IPlanService { ...@@ -112,7 +113,7 @@ public class PlanServiceImpl implements IPlanService {
} }
@Override @Override
public void planSaveAs(Integer[] param) { public void planSaveAs(Long[] param) {
for(int i=0;i<param.length;i++){ for(int i=0;i<param.length;i++){
planMapper.saveAs(param[i].toString()); planMapper.saveAs(param[i].toString());
} }
......
...@@ -47,6 +47,7 @@ import org.springframework.transaction.support.TransactionSynchronization; ...@@ -47,6 +47,7 @@ import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -191,7 +192,7 @@ public class PointServiceImpl implements IPointService { ...@@ -191,7 +192,7 @@ public class PointServiceImpl implements IPointService {
// BeanUtils.copyProperties(param, point); // BeanUtils.copyProperties(param, point);
int count = iPointDao.findByPointNo(param.getPointNo(), orgCode); int count = iPointDao.findByPointNo(param.getPointNo(), orgCode);
if (count > 0) {// 该单位已存在该编号的点 if (count > 0) {// 该单位已存在该编号的点
continue; throw new BadRequest(param.getPointNo()+"该编号已存在");
} }
if (ObjectUtils.isEmpty(param.getChargePersonId())) { if (ObjectUtils.isEmpty(param.getChargePersonId())) {
throw new BadRequest("责任人不能为空"); throw new BadRequest("责任人不能为空");
...@@ -282,60 +283,67 @@ public class PointServiceImpl implements IPointService { ...@@ -282,60 +283,67 @@ public class PointServiceImpl implements IPointService {
ids.add(point.getId()); ids.add(point.getId());
if (StringUtil.isNotEmpty(param.getEquipInputInfo())) { if (StringUtil.isNotEmpty(param.getEquipInputInfo())) {
String[] infos = param.getEquipInputInfo().split("\\|"); String[] info = param.getEquipInputInfo().split("\\|");
for (int i = 0; i < infos.length; i++) { Set<String> infos=new HashSet<>();
String[] split = infos[i].split(":"); Collections.addAll(infos,info);
String equipCode = split[0]; for (String e : infos) {
List<String> inputItemCodes = Arrays.asList(split[1].split(",")); String[] split = e.split(":");
List<RoutePoint> routePointList = iRoutePointDao.queryByPointId(point.getId()); String equipCode = split[0];
HashMap<String, String> equipByCode = routePointItemMapper.getEquipByCode(equipCode); Set<String> inputItemCodes = new HashSet<>(Arrays.asList(split[1].split(",")));
if (ObjectUtils.isEmpty(equipByCode)) { // List<String> inputItemCodes = Arrays.asList(split[1].split(","));
throw new BadRequest("装备编码不存在"); List<RoutePoint> routePointList = iRoutePointDao.queryByPointId(point.getId());
} HashMap<String, String> equipByCode = routePointItemMapper.getEquipByCode(equipCode);
PointClassify newPointClassify = new PointClassify(); if (ObjectUtils.isEmpty(equipByCode)) {
newPointClassify.setEquipmentId(equipByCode.get("equipmentId")); throw new BadRequest("装备编码不存在");
newPointClassify.setName(equipByCode.get("name")); }
PointClassify newPointClassify = new PointClassify();
newPointClassify.setEquipmentId(equipByCode.get("equipmentId"));
newPointClassify.setName(equipByCode.get("name"));
// newPointClassify.setInspectionSpecName(); // newPointClassify.setInspectionSpecName();
newPointClassify.setCreatorId(userId); newPointClassify.setCreatorId(userId);
newPointClassify.setPointId(point.getId()); newPointClassify.setPointId(point.getId());
newPointClassify.setOrderNo(0); newPointClassify.setOrderNo(0);
newPointClassify.setDataSourceCode("1"); newPointClassify.setDataSourceCode("1");
newPointClassify.setDataSourceName("消防装备"); newPointClassify.setDataSourceName("消防装备");
newPointClassify.setAddress(equipByCode.get("address")); newPointClassify.setAddress(equipByCode.get("address"));
newPointClassify.setBuildingId(String.valueOf(equipByCode.get("sourceId"))); newPointClassify.setBuildingId(String.valueOf(equipByCode.get("sourceId")));
String uuid = UUID.randomUUID().toString().replace("-", ""); String uuid = UUID.randomUUID().toString().replace("-", "");
newPointClassify.setOriginalId(uuid.substring(0, 16)); newPointClassify.setOriginalId(uuid.substring(0, 16));
newPointClassify.setCategoryCode(equipByCode.get("categoryCode")); newPointClassify.setCategoryCode(equipByCode.get("categoryCode"));
newPointClassify.setCategoryName(equipByCode.get("categoryName")); newPointClassify.setCategoryName(equipByCode.get("categoryName"));
newPointClassify.setCode(equipByCode.get("code")); newPointClassify.setCode(equipByCode.get("code"));
newPointClassify.setBuildingName(equipByCode.get("fullName")); newPointClassify.setBuildingName(equipByCode.get("fullName"));
List<PointClassify> pointClassifies = iPointClassifyDao.queryByPointIdAndEquipmentId(point.getId(), equipByCode.get("equipmentId")); List<PointClassify> pointClassifies = iPointClassifyDao.queryByPointIdAndEquipmentId(point.getId(), equipByCode.get("equipmentId"));
if (!CollectionUtils.isEmpty(pointClassifies)) { if (!CollectionUtils.isEmpty(pointClassifies)) {
newPointClassify.setId(pointClassifies.get(0).getId()); newPointClassify.setId(pointClassifies.get(0).getId());
} }
this.addPointClassifyByPointId(newPointClassify); this.addPointClassifyByPointId(newPointClassify);
List<PointInputItemVo> customInputList = inputItemMapper.queryCustomInputItemByCodes(inputItemCodes); List<PointInputItemVo> customInputList = inputItemMapper.queryCustomInputItemByCodes(inputItemCodes);
for (PointInputItemVo pItemVo : customInputList) { if (ValidationUtil.isEmpty(customInputList) || customInputList.size() < inputItemCodes.size()) {
PointInputItem pointInputItem = new PointInputItem(); throw new BadRequest(split[1]+"中存在不正确的检查项编号");
pointInputItem.setPointId(newPointClassify.getPointId()); }
pointInputItem.setInputItemId(pItemVo.getId()); for (PointInputItemVo pItemVo : customInputList) {
pointInputItem.setClassifyIds(Long.valueOf(newPointClassify.getId()).toString()); PointInputItem pointInputItem = new PointInputItem();
pointInputItem.setId(0); pointInputItem.setPointId(newPointClassify.getPointId());
pointInputItem.setOrderNo(pItemVo.getpOrderNo()); pointInputItem.setInputItemId(pItemVo.getId());
PointInputItem pointInputItemResult = iPointInputItemDao.save(pointInputItem); pointInputItem.setClassifyIds(Long.valueOf(newPointClassify.getId()).toString());
//更新巡检路线 pointInputItem.setId(0);
if (routePointList.size() > 0) { pointInputItem.setOrderNo(pItemVo.getpOrderNo());
Long classifyId = newPointClassify.getId(); PointInputItem pointInputItemResult = iPointInputItemDao.saveAndFlush(pointInputItem);
for (RoutePoint routePoint : routePointList) { //更新巡检路线
RoutePointItem routePointItem = new RoutePointItem(); if (routePointList.size() > 0) {
routePointItem.setPointClassifyId(classifyId); Long classifyId = newPointClassify.getId();
routePointItem.setPointInputItemId(pointInputItemResult.getId()); for (RoutePoint routePoint : routePointList) {
routePointItem.setRoutePointId(routePoint.getId()); RoutePointItem routePointItem = new RoutePointItem();
iRoutePointItemDao.save(routePointItem); routePointItem.setPointClassifyId(classifyId);
routePointItem.setPointInputItemId(pointInputItemResult.getId());
routePointItem.setRoutePointId(routePoint.getId());
iRoutePointItemDao.save(routePointItem);
}
} }
} }
}
} }
} }
String inputItems = param.getInputItems(); String inputItems = param.getInputItems();
......
...@@ -286,7 +286,10 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement ...@@ -286,7 +286,10 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
}); });
}); });
if(!items.isEmpty()) { if(!items.isEmpty()) {
iRoutePointItemDao.saveAll(items); for (RoutePointItem routePointItem: items
) {
iRoutePointItemDao.saveAndFlush(routePointItem);
}
} }
} }
} }
......
...@@ -25,12 +25,12 @@ public interface IPlanService { ...@@ -25,12 +25,12 @@ public interface IPlanService {
/** /**
* 巡检计划删除 * 巡检计划删除
*/ */
void delPlanById(Integer[] param); void delPlanById(Long[] param);
/** /**
* 巡检计划另存 * 巡检计划另存
*/ */
void planSaveAs(Integer[] param); void planSaveAs(Long[] param);
/** /**
* 巡检路线查询 * 巡检路线查询
*/ */
......
...@@ -11,6 +11,9 @@ import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone; ...@@ -11,6 +11,9 @@ import com.yeejoin.amos.patrol.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.patrol.dao.entity.PlanTask; import com.yeejoin.amos.patrol.dao.entity.PlanTask;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.text.ParseException; import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -183,4 +186,13 @@ public interface IPlanTaskService { ...@@ -183,4 +186,13 @@ public interface IPlanTaskService {
* @return 消防巡检信息统计 * @return 消防巡检信息统计
*/ */
List<Map<String,Object>> firePatrolStatics(String bizOrgCode); List<Map<String,Object>> firePatrolStatics(String bizOrgCode);
/**
* 计划执行查询
*/
Page<HashMap<String, Object>> getPlanTaskPageList(PlanTaskPageParam params);
Map<String, String> preview(String taskDetailId);
void download(HttpServletRequest request, HttpServletResponse response, String taskDetailId) throws UnsupportedEncodingException;
} }
...@@ -1067,15 +1067,15 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam ...@@ -1067,15 +1067,15 @@ private static void defaultExport(List<Map<String, Object>> list, String fileNam
} }
if(dlData.length<5){ //255以内的下拉 if(dlData.length<5){ //255以内的下拉
//255以内的下拉,参数分别是:作用的sheet、下拉内容数组、起始行、终止行、起始列、终止列 //255以内的下拉,参数分别是:作用的sheet、下拉内容数组、起始行、终止行、起始列、终止列
sheet1.addValidationData(setDataValidation(sheet1, dlData, 1, 30000, rownum ,rownum)); //超过255个报错 sheet1.addValidationData(setDataValidation(sheet1, dlData, 1, dlData.length, rownum ,rownum)); //超过255个报错
} else { //255以上的下拉,即下拉列表元素很多的情况 } else { //255以上的下拉,即下拉列表元素很多的情况
//1、设置有效性 //1、设置有效性
//String strFormula = "Sheet2!$A$1:$A$5000" ; //Sheet2第A1到A5000作为下拉列表来源数据 //String strFormula = "Sheet2!$A$1:$A$5000" ; //Sheet2第A1到A5000作为下拉列表来源数据
String strFormula = "Sheet2!$"+arr[index]+"$1:$"+arr[index]+"$5000"; //Sheet2第A1到A5000作为下拉列表来源数据 String strFormula = "Sheet2!$"+arr[index]+"$1:$"+arr[index]+"$"+dlData.length; //Sheet2第A1到A5000作为下拉列表来源数据
sheet2.setColumnWidth(r, 4000); //设置每列的列宽 sheet2.setColumnWidth(r, 4000); //设置每列的列宽
//设置数据有效性加载在哪个单元格上,参数分别是:从sheet2获取A1到A5000作为一个下拉的数据、起始行、终止行、起始列、终止列 //设置数据有效性加载在哪个单元格上,参数分别是:从sheet2获取A1到A5000作为一个下拉的数据、起始行、终止行、起始列、终止列
sheet1.addValidationData(SetDataValidation(strFormula, 1, 30000, rownum, rownum)); //下拉列表元素很多的情况 sheet1.addValidationData(SetDataValidation(strFormula, 1, dlData.length, rownum, rownum)); //下拉列表元素很多的情况
//2、生成sheet2内容 //2、生成sheet2内容
for(int j=0;j<dlData.length;j++){ for(int j=0;j<dlData.length;j++){
......
package com.yeejoin.amos.patrol.business.util;
import lombok.NonNull;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
/**
* @author keyong
* @title: MyByteArrayMultipartFile
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/21 16:47
*/
public class MyByteArrayMultipartFile implements MultipartFile {
private String name;
private String originalFilename;
private String contentType;
public MyByteArrayMultipartFile(String name, String originalFilename, String contentType, @NonNull byte[] bytes) {
super();
this.name = name;
this.originalFilename = originalFilename;
this.contentType = contentType;
this.bytes = bytes;
}
public MyByteArrayMultipartFile() {
super();
// TODO Auto-generated constructor stub
}
public String getName() {
return name;
}
public String getOriginalFilename() {
return originalFilename;
}
public String getContentType() {
return contentType;
}
public byte[] getBytes() {
return bytes;
}
@NonNull
byte[] bytes;
@Override
public boolean isEmpty() {
return bytes.length == 0;
}
@Override
public long getSize() {
return bytes.length;
}
@Override
public InputStream getInputStream() {
return new ByteArrayInputStream(bytes);
}
@Override
public void transferTo(File destination) throws IOException {
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream(destination);
outputStream.write(bytes);
} finally {
if (outputStream != null) {
outputStream.close();
}
}
}
}
package com.yeejoin.amos.patrol.business.util;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import sun.misc.BASE64Encoder;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
/**
* @author keyong
* @title: WordTemplateUtils
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/21 16:35
*/
public class WordTemplateUtils {
private static String fileUploadDir;
private Configuration configuration;
private static WordTemplateUtils wordTemplateUtils;
private WordTemplateUtils() {
configuration = new Configuration();
configuration.setDefaultEncoding("utf-8");
}
public static synchronized WordTemplateUtils getInstance() {
if (wordTemplateUtils == null) {
//添加你的内容
Properties props;
try {
props = PropertiesLoaderUtils.loadAllProperties("application-dev.properties");
fileUploadDir = (String) props.get("file.uploadUrl");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
wordTemplateUtils = new WordTemplateUtils();
}
return wordTemplateUtils;
}
public void exportMillCertificateWord(HttpServletRequest request, HttpServletResponse response, Map map,
String title, String ftlFile) throws IOException {
configuration.setClassForTemplateLoading(this.getClass(), "/ftl");
Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8");
File file = null;
InputStream fin = null;
ServletOutputStream out = null;
try {
// 调用工具类的createDoc方法生成Word文档
file = createDoc(map, freemarkerTemplate);
fin = new FileInputStream(file);
response.setCharacterEncoding("utf-8");
response.setContentType("application/msword");
// 设置浏览器以下载的方式处理该文件名
String fileName = (StringUtils.isNotEmpty(title) ? title : getUUID()) + ".doc";
response.setHeader("Content-Disposition",
"attachment;filename=".concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
out = response.getOutputStream();
// 缓冲区
byte[] buffer = new byte[512];
int bytesToRead = -1;
// 通过循环将读入的Word文件的内容输出到浏览器中
while ((bytesToRead = fin.read(buffer)) != -1) {
out.write(buffer, 0, bytesToRead);
}
} finally {
if (fin != null) {
fin.close();
}
if (out != null) {
out.close();
}
if (file != null) {
file.delete();
}// 删除临时文件
}
}
/**
* 生成文件名
*
* @param * @param
* @return
*/
public static String getUUID() {
return UUID.randomUUID().toString().replace("-", "");
}
public File getWordFileItem(Map map, String title, String ftlFile,String type) throws IOException {
configuration.setClassForTemplateLoading(this.getClass(), "/ftl");
Template freemarkerTemplate = configuration.getTemplate(ftlFile, "UTF-8");
File file = null;
File filepdf = new File("sellPlan.pdf");
InputStream fin = null;
OutputStream os = null;
try {
// 调用工具类的createDoc方法生成Word文档
file = createDoc(map, freemarkerTemplate);
fin = new FileInputStream(file);
os = new FileOutputStream(filepdf);
wordTopdfByAspose(fin, os,type);
return filepdf;
} finally {
if (fin != null) {
fin.close();
}
if (os != null) {
os.close();
}
if (file != null) {
file.delete();
}// 删除临时文件
}
}
private static File createDoc(Map<?, ?> dataMap, Template template) {
String name = "sellPlan.doc";
File f = new File(name);
Template t = template;
try {
// 这个地方不能使用FileWriter因为需要指定编码类型否则生成的Word文档会因为有无法识别的编码而无法打开
Writer w = new OutputStreamWriter(new FileOutputStream(f), "utf-8");
t.process(dataMap, w);
w.close();
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
return f;
}
public boolean wordTopdfByAspose(InputStream inputStream, OutputStream outputStream,String type) {
// 验证License 若不验证则转化出的pdf文档会有水印产生
if (!getLicense()) {
return false;
}
try {
// 将源文件保存在com.aspose.words.Document中,具体的转换格式依靠里面的save方法
com.aspose.words.Document doc = new com.aspose.words.Document(inputStream);
// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,EPUB, XPS, SWF 相互转换
if("pdf".equals(type)){
doc.save(outputStream, SaveFormat.PDF);
}else {
doc.save(outputStream, SaveFormat.DOCX);
}
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
if (outputStream != null) {
try {
outputStream.flush();
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return true;
}
// 官方文档的要求 无需理会
public static boolean getLicense() {
boolean result = false;
try {
String s = "<License><Data><Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products><EditionType>Enterprise</EditionType><SubscriptionExpiry>20991231</SubscriptionExpiry><LicenseExpiry>20991231</LicenseExpiry><SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber></Data><Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature></License>";
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 获得图片的base64码
*
* @param src 图片路径
* @return String
*/
@SuppressWarnings("deprecation")
public String getImageBase(String src) {
if (StringUtils.isEmpty(src)) {
return "";
}
src = src.replaceAll("\\.\\.", "");
String fileName = fileUploadDir + src;
File file = new File(fileName);
if (!file.exists()) {
return "";
}
InputStream in = null;
byte[] data = null;
try {
in = new FileInputStream(file);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
try {
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);
}
}
...@@ -13,6 +13,7 @@ public class CheckInfoVo { ...@@ -13,6 +13,7 @@ public class CheckInfoVo {
private String pointNo; private String pointNo;
private String userId; private String userId;
private String depId; private String depId;
private String address;
@Excel(name = "执行人员", orderNum = "2") @Excel(name = "执行人员", orderNum = "2")
private String userName; private String userName;
@Excel(name = "执行部门", orderNum = "3") @Excel(name = "执行部门", orderNum = "3")
...@@ -140,6 +141,15 @@ public class CheckInfoVo { ...@@ -140,6 +141,15 @@ public class CheckInfoVo {
public String getCheckMode() { public String getCheckMode() {
return checkMode; return checkMode;
} }
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public void setCheckMode(String checkMode) { public void setCheckMode(String checkMode) {
this.checkMode = checkMode; this.checkMode = checkMode;
} }
......
package com.yeejoin.amos.patrol.business.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author keyong
* @title: DefectVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/22 22:30
*/
@Data
public class DefectVo {
private String id;
@ApiModelProperty(value = "缺陷等级1-一般 2-严重 3-危急")
private Integer defectLevel;
@ApiModelProperty(value = "缺陷设备ids")
private String defectEquipmentIds;
@ApiModelProperty(value = "缺陷设备名称")
private String defectEquipmentName;
@ApiModelProperty(value = "缺陷设备类型1-装备2-系统3-水源")
private Integer defectEquipmentType;
@ApiModelProperty(value = "缺陷描述")
private String defectDescribe;
@ApiModelProperty(value = "缺陷来源 1-巡查 2-维保 3-消防检测 4-其他")
private Integer defectResource;
@ApiModelProperty(value = "缺陷类型")
private String defectType;
@ApiModelProperty(value = "缺陷图片")
private String defectImg;
@ApiModelProperty(value = "发现日期")
private Date defectDiscoverDate;
@ApiModelProperty(value = "发现人")
private String defectDiscover;
@ApiModelProperty(value = "计划消缺日期")
private Date planClearDate;
@ApiModelProperty(value = "责任人")
private String defectResponsible;
@ApiModelProperty(value = "处理状态(0:未处理,1:已处理,2:处理中)")
private Integer defectStatus;
@ApiModelProperty(value = "是否需要停电处理(0:不需要,1:需要)")
private Integer isPowerCut;
@ApiModelProperty(value = "换流站名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "公司编码")
private String orgCode;
@ApiModelProperty(value = "添加时间")
private Date addTime;
@ApiModelProperty(value = "处理措施/处理情况")
private String handleSituation;
@ApiModelProperty(value = "处理-图片")
private String handleImg;
@ApiModelProperty(value = "工作票号")
private String handleWorkTicketNum;
@ApiModelProperty(value = "工作负责人")
private String handleWorkLeader;
@ApiModelProperty(value = "工作票是否已消号 1-已消号 0 -未消号")
private Integer handleWorkIdTicket;
@ApiModelProperty(value = "负责人检查日期")
private String handleLeaderDate;
@ApiModelProperty(value = "负责人")
private String handleLeader;
@ApiModelProperty(value = "消缺日期")
private Date handleClearDate;
@ApiModelProperty(value = "消缺人")
private String handleClearPerson;
@ApiModelProperty(value = "缺陷编号")
private String defectNum;
@ApiModelProperty(value = "超期提醒")
private String expiredWarning;
@ApiModelProperty(value = "缺陷状态【装备用】")
private String defectStatusName;
@ApiModelProperty(value = "告警id")
private String batchId;
@ApiModelProperty(value = "设备code")
private String defectEquipmentCode;
}
package com.yeejoin.amos.patrol.core.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: DefectLevelEnum
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/23 8:30
*/
@AllArgsConstructor
@Getter
public enum DefectLevelEnum {
GENERAL(1, "一般"),
SEVERITY(2, "严重"),
URGENT(3, "危急");
private Integer key;
private String value;
public static DefectLevelEnum getByKey(Integer key) {
for (DefectLevelEnum enums : DefectLevelEnum.values())
{
if (enums.getKey() == key)
{
return enums;
}
}
return null;
}
}
package com.yeejoin.amos.patrol.core.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: 模板分类
* <pre>
* @description: TODO
* </pre>
* @date 2023/4/21 16:28
*/
@AllArgsConstructor
@Getter
public enum WordTemplateEnum {
firePatrolPlanTaskReport("消防巡查报表", "firePatrolPlanTaskReport.ftl");
private String label;
private String templateFile;
}
...@@ -201,6 +201,7 @@ public class JobService implements IJobService { ...@@ -201,6 +201,7 @@ public class JobService implements IJobService {
iPlanTaskDetailDao.saveAndFlush(action); iPlanTaskDetailDao.saveAndFlush(action);
}); });
} }
log.info("更新plan_task 和 plan_task_detail表完成,planTask:{}", planTask);
// 巡检站端与中心级数据同步 // 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override @Override
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</parent> </parent>
<artifactId>amos-boot-system-equip</artifactId> <artifactId>amos-boot-system-equip</artifactId>
<version>3.7.0.6</version> <version>3.7.0.8</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
......
package com.yeejoin; package com.yeejoin;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils; import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import com.yeejoin.equipmanage.listener.CarIotListener;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
...@@ -18,6 +21,7 @@ import org.springframework.core.env.Environment; ...@@ -18,6 +21,7 @@ import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress; import java.net.InetAddress;
...@@ -39,6 +43,12 @@ public class AmostEquipApplication { ...@@ -39,6 +43,12 @@ public class AmostEquipApplication {
private static final Logger logger = LoggerFactory.getLogger(AmostEquipApplication.class); private static final Logger logger = LoggerFactory.getLogger(AmostEquipApplication.class);
@Autowired
private EmqKeeper emqKeeper;
@Autowired
private CarIotListener carIotListener;
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args);
Environment env = context.getEnvironment(); Environment env = context.getEnvironment();
...@@ -56,4 +66,14 @@ public class AmostEquipApplication { ...@@ -56,4 +66,14 @@ public class AmostEquipApplication {
RestTemplate restTemplate(){ RestTemplate restTemplate(){
return new RestTemplate(); return new RestTemplate();
} }
/**
* 初始化MQTT
*
* @throws MqttException
*/
@Bean
void initMqtt() throws MqttException {
emqKeeper.getMqttClient().subscribe("+/+/property", 1, carIotListener);
}
} }
...@@ -3086,4 +3086,72 @@ ...@@ -3086,4 +3086,72 @@
create index index_equipment_code on wl_equipment_specific_alarm_log (`equipment_code`); create index index_equipment_code on wl_equipment_specific_alarm_log (`equipment_code`);
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="ls" id="202300406-1" >
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_car_mileage"/>
</not>
</preConditions>
<comment>add wl_car_mileage</comment>
<sql>
CREATE TABLE `wl_car_mileage` (
`id` bigint(0) NOT NULL,
`iot_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'iot编码',
`travel` double(11, 1) NULL DEFAULT NULL COMMENT '里程km',
`date` date NULL DEFAULT NULL COMMENT '日期',
`start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
`end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
`take_time` bigint(0) NULL DEFAULT NULL COMMENT '耗时',
`start_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开始地址',
`end_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结束地址',
`start_longitude` double(20, 6) NULL DEFAULT NULL COMMENT '开始精度',
`start_latitude` double(20, 6) NULL DEFAULT NULL COMMENT '开始纬度',
`end_longitude` double(20, 6) NULL DEFAULT NULL COMMENT '结束精度',
`end_latitude` double(20, 6) NULL DEFAULT NULL COMMENT '结束纬度',
`start_speed` int(0) NULL DEFAULT NULL COMMENT '开始速度km/h',
`end_speed` int(0) NULL DEFAULT NULL COMMENT '结束速度km/h',
`create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '车量里程表' ROW_FORMAT = Dynamic;
</sql>
</changeSet>
<changeSet author="ls" id="202300406-2" >
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_car" columnName="deployment"/>
</not>
</preConditions>
<comment>wl_car add displacement,ownership,code,extra1,extra2,extra3,extra4,longitude,latitude</comment>
<sql>
ALTER TABLE `wl_car`
ADD COLUMN `deployment` varchar(255) NULL COMMENT '配备方式';
ALTER TABLE `wl_car`
ADD COLUMN `deploy_date` varchar(50) NULL COMMENT '配备日期';
ALTER TABLE `wl_car`
ADD COLUMN `deploy_date_range` varchar(100) NULL COMMENT '配备日期区间';
ALTER TABLE `wl_car`
ADD COLUMN `displacement` varchar(255) NULL COMMENT '排量';
ALTER TABLE `wl_car`
ADD COLUMN `ownership` varchar(255) NULL COMMENT '车辆产权单位';
ALTER TABLE `wl_car`
ADD COLUMN `code` varchar(255) NULL COMMENT '编号';
ALTER TABLE `wl_car`
ADD COLUMN `extra1` varchar(255) NULL COMMENT '扩展字段1';
ALTER TABLE `wl_car`
ADD COLUMN `extra2` varchar(255) NULL COMMENT '扩展字段2';
ALTER TABLE `wl_car`
ADD COLUMN `extra3` varchar(255) NULL COMMENT '扩展字段3';
ALTER TABLE `wl_car`
ADD COLUMN `extra4` varchar(255) NULL COMMENT '扩展字段4';
ALTER TABLE `wl_car`
ADD COLUMN `longitude` double(20, 6) NULL COMMENT '经度';
ALTER TABLE `wl_car`
ADD COLUMN `latitude` double(20, 6) NULL COMMENT '纬度';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -1878,7 +1878,7 @@ ...@@ -1878,7 +1878,7 @@
WHERE WHERE
( (
0 <![CDATA[<>]]> find_in_set(`fs`.`id`, `s`.`system_id`) 0 <![CDATA[<>]]> find_in_set(`fs`.`id`, `s`.`system_id`)
) ) limt 1
) AS `chargePersonName` ) AS `chargePersonName`
FROM FROM
`wl_equipment_specific_index` `si` `wl_equipment_specific_index` `si`
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace="com.yeejoin.equipmanage.mapper.WlCarMileageMapper">
<select id="totalMileage" resultType="Integer">
SELECT SUM(travel) FROM wl_car_mileage WHERE iot_code = #{iotCode}
</select>
<select id="page"
resultType="com.yeejoin.equipmanage.common.entity.WlCarMileage">
SELECT
wl_car_mileage.id,
wl_car_mileage.iot_code,
travel,
date,
start_time,
end_time,
take_time,
start_name,
end_name,
start_longitude,
start_latitude,
end_longitude,
end_latitude,
start_speed,
end_speed,
wl_car_mileage.create_date,
date AS name
FROM wl_car_mileage
LEFT JOIN wl_car ON wl_car.iot_code = wl_car_mileage.iot_code
<where>
<if test="wlCarMileage.carId != null">
AND wl_car.id = #{wlCarMileage.carId}
</if>
<if test="wlCarMileage.iotCode != null">
AND wl_car_mileage.iot_code = #{wlCarMileage.iotCode}
</if>
<if test="wlCarMileage.filterDate != null">
AND wl_car_mileage.date = #{wlCarMileage.filterDate}
</if>
<if test="wlCarMileage.complete">
AND wl_car_mileage.start_time IS NOT NULL AND wl_car_mileage.end_time IS NOT NULL
</if>
</where>
</select>
</mapper>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<artifactId>amos-boot-system-jcs</artifactId> <artifactId>amos-boot-system-jcs</artifactId>
<version>3.7.0.6</version> <version>3.7.0.8</version>
<dependencies> <dependencies>
<dependency> <dependency>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</parent> </parent>
<artifactId>amos-boot-system-patrol</artifactId> <artifactId>amos-boot-system-patrol</artifactId>
<version>3.0.6</version> <version>3.7.0.8</version>
<dependencies> <dependencies>
<dependency> <dependency>
......
...@@ -8,7 +8,7 @@ spring.jackson.serialization.write-dates-as-timestamps=true ...@@ -8,7 +8,7 @@ spring.jackson.serialization.write-dates-as-timestamps=true
feign.httpclient.enabled= true feign.httpclient.enabled= true
logging.config=classpath:logback-${spring.profiles.active}.xml logging.config=classpath:logback-${spring.profiles.active}.xml
#鏃堕棿杩斿洖绫诲瀷閰嶇疆 #\u93C3\u5815\u68FF\u6769\u65BF\u6D16\u7EEB\u8BF2\u7037\u95B0\u5D87\u7586
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone = Asia/Shanghai spring.jackson.time-zone = Asia/Shanghai
...@@ -41,6 +41,8 @@ amos.feign.gennerator.use-gateway=true ...@@ -41,6 +41,8 @@ amos.feign.gennerator.use-gateway=true
Business.fegin.name=AMOS-AUTOSYS Business.fegin.name=AMOS-AUTOSYS
idx.feign.name=AMOS-IDX
Push.fegin.name=APPMESSAGEPUSHSERVICE Push.fegin.name=APPMESSAGEPUSHSERVICE
...@@ -49,9 +51,9 @@ amosRefresh.danger.topic =patrolDangerInsertOrUpdate ...@@ -49,9 +51,9 @@ amosRefresh.danger.topic =patrolDangerInsertOrUpdate
amosRefresh.patrol.topic =patrolCheckInsert amosRefresh.patrol.topic =patrolCheckInsert
patrol.point.classify.topic=patrol/point/classify patrol.point.classify.topic=patrol/point/classify
patrol.topic=patrol/# patrol.topic=patrol/#
#停止通过WEB公开所有端点 #\u505C\u6B62\u901A\u8FC7WEB\u516C\u5F00\u6240\u6709\u7AEF\u70B9
#management.endpoints.web.exposure.exclude=* #management.endpoints.web.exposure.exclude=*
## redis失效时间 ## redis\u5931\u6548\u65F6\u95F4
redis.cache.failure.time=10800 redis.cache.failure.time=10800
rule.definition.load=false rule.definition.load=false
...@@ -67,4 +69,9 @@ equipment.hierarchy=1,2,4,6 ...@@ -67,4 +69,9 @@ equipment.hierarchy=1,2,4,6
management.security.enabled=true management.security.enabled=true
spring.security.user.name=admin spring.security.user.name=admin
spring.security.user.password=a1234560 spring.security.user.password=a1234560
\ No newline at end of file
#\u96EA\u82B1\u7B97\u6CD5\u53C2\u6570 \u7EC8\u7AEFID
generator.worker_id=1
#\u96EA\u82B1\u7B97\u6CD5\u53C2\u6570 \u6570\u636E\u4E2D\u5FC3id
generator.datacenter_id=1
\ No newline at end of file
...@@ -474,9 +474,9 @@ ...@@ -474,9 +474,9 @@
DROP PROCEDURE IF EXISTS `updatePlanTask`; DROP PROCEDURE IF EXISTS `updatePlanTask`;
</createProcedure> </createProcedure>
</changeSet> </changeSet>
<changeSet author="gaodongdong" id="1610421278000-21" runAlways="true"> <changeSet author="gaodongdong" id="1610421278000-21-230419" runAlways="true">
<createProcedure procedureName="updatePlanTask" > <createProcedure procedureName="updatePlanTask" >
CREATE PROCEDURE `updatePlanTask`(IN `planTaskId` int,IN `pointId` int,IN `planTaskDetailId` int,IN `executorId` int) CREATE PROCEDURE `updatePlanTask`(IN `planTaskId` BIGINT,IN `pointId` BIGINT,IN `planTaskDetailId` BIGINT,IN `executorId` BIGINT)
BEGIN BEGIN
declare num int ; declare num int ;
declare orgCode VARCHAR(50) ; declare orgCode VARCHAR(50) ;
......
...@@ -394,10 +394,22 @@ ...@@ -394,10 +394,22 @@
'四级' '四级'
ELSE ELSE
'五级' '五级'
END )AS level,
IFNULL(a.key_parts_type,1) AS keyPartsType, IFNULL(a.key_parts_type,1) AS keyPartsType,
IFNULL(a.custom_type,1) AS customType, IFNULL(a.custom_type,1) AS customType,
a.risk_desc, a.risk_desc,
(CASE a.data_json
WHEN '[]' THEN
''
ELSE
a.data_json a.data_json
END ) AS dataJson,
(CASE a.picture_json
WHEN '[]' THEN
''
ELSE
a.picture_json
END ) AS pictureJson
from from
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
where a.is_delete = '0' where a.is_delete = '0'
...@@ -422,6 +434,9 @@ ...@@ -422,6 +434,9 @@
<if test="treeId != null and treeId != '' and treeId == '-4'"> <if test="treeId != null and treeId != '' and treeId == '-4'">
and a.key_parts_type is not null and a.key_parts_type is not null
</if> </if>
<if test="ids != null and ids != ''">
and a.id in (${ids})
</if>
<if test="treeId != null and treeId != '' and treeId == '-5'"> <if test="treeId != null and treeId != '' and treeId == '-5'">
and a.custom_type is not null and a.custom_type is not null
</if> </if>
...@@ -430,6 +445,7 @@ ...@@ -430,6 +445,7 @@
treeId != '-2' and treeId != '-4' and treeId != '-5' and treeId.contains('@'.toString())"> treeId != '-2' and treeId != '-4' and treeId != '-5' and treeId.contains('@'.toString())">
and LEFT (a.facilities_type, #{inhierarchy}) = #{subCode} and LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}
</if> </if>
<if test="subCode!=null and subCode!='' and subCode!=' ' and <if test="subCode!=null and subCode!='' and subCode!=' ' and
treeId != null and treeId != '' and treeId != '-3' and treeId != '-1' and treeId != null and treeId != '' and treeId != '-3' and treeId != '-1' and
treeId != '-2' and treeId != '-4' and treeId != '-5' and !treeId.contains('@'.toString())"> treeId != '-2' and treeId != '-4' and treeId != '-5' and !treeId.contains('@'.toString())">
...@@ -440,10 +456,6 @@ ...@@ -440,10 +456,6 @@
<when test="level!=null and level != '-0'">and a.level = #{level}</when> <when test="level!=null and level != '-0'">and a.level = #{level}</when>
</choose> </choose>
order by a.id desc order by a.id desc
<choose>
<when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
</choose>
</select> </select>
<select id="getEquipParentCode" resultType="map"> <select id="getEquipParentCode" resultType="map">
......
...@@ -588,11 +588,6 @@ ...@@ -588,11 +588,6 @@
</choose> </choose>
</select> </select>
<!-- 巡检执行情况查询 --> <!-- 巡检执行情况查询 -->
<select id="getChkExListNew" resultMap="ChkExResultMap"> <select id="getChkExListNew" resultMap="ChkExResultMap">
select select
...@@ -626,20 +621,6 @@ ...@@ -626,20 +621,6 @@
</choose> </choose>
</select> </select>
<select id="getPlanTaskStatisticsForApp" resultType="Map"> <select id="getPlanTaskStatisticsForApp" resultType="Map">
SELECT SELECT
count(1) total, count(1) total,
...@@ -1173,4 +1154,204 @@ ...@@ -1173,4 +1154,204 @@
AND org_code LIKE CONCAT(#{bizOrgCode}, '%') AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if> </if>
</select> </select>
<select id="countData" resultType="long">
SELECT
count(1)
FROM
`p_plan_task` ppk
LEFT JOIN p_plan pp ON pp.id = ppk.plan_id
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
LEFT JOIN p_route pr ON pr.id = ppk.route_id
<where>
<if test="param.userId != null "> find_in_set(#{param.userId}, ppk.user_id) </if>
<if test="param.beginDate != null and param.beginDate != '' "> ppk.begin_time <![CDATA[>=]]> #{param.beginDate} </if>
<if test="param.endDate != null and param.endDate != ''"> and ppk.end_time <![CDATA[<=]]> #{param.endDate} </if>
<if test="param.taskName != null and param.taskName != ''"> and pp.name like concat('%',#{param.taskName},'%') </if>
<if test="param.status != null"> and pptd.STATUS = #{param.status} </if>
<if test="param.routeId != null"> and ppk.route_id = #{param.routeId} </if>
<if test="param.bizOrgCode != null"> and pp.biz_org_code like concat('%',#{param.bizOrgCode},'%') </if>
</where>
</select>
<select id="planTaskPage" resultType="java.util.HashMap">
SELECT
ppk.id AS planTaskId,
pptd.id AS taskDetailId,
pp.NAME AS taskName,
pr.`name` AS routeName,
DATE_FORMAT(ppk.begin_time, '%Y-%m-%d %H:%i:%s') AS beginTime,
DATE_FORMAT(ppk.end_time, '%Y-%m-%d %H:%i:%s') AS endTime,
ppk.point_num AS checkedNum,
ppk.finish_num AS finishedNum,
( CASE pptd.STATUS WHEN 0 THEN '未执行' WHEN 1 THEN '正常' WHEN 2 THEN '异常' WHEN 3 THEN '漏检' END ) AS execution,
ppk.user_id AS userId,
ppk.user_name AS executor
FROM
`p_plan_task` ppk
LEFT JOIN p_plan pp ON pp.id = ppk.plan_id
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
LEFT JOIN p_route pr ON pr.id = ppk.route_id
<where>
<if test="param.beginDate != null and param.beginDate != '' "> ppk.begin_time <![CDATA[>=]]> #{param.beginDate} </if>
<if test="param.endDate != null and param.endDate != ''"> and ppk.end_time <![CDATA[<=]]> #{param.endDate} </if>
<if test="param.taskName != null and param.taskName != ''"> and pp.name like concat('%',#{param.taskName},'%') </if>
<if test="param.status != null"> and pptd.STATUS = #{param.status} </if>
<if test="param.routeId != null"> and ppk.route_id = #{param.routeId} </if>
<if test="param.bizOrgCode != null"> and pp.biz_org_code like concat('%',#{param.bizOrgCode},'%') </if>
</where>
ORDER BY
ppk.begin_time DESC
<choose>
<when test="param.pageSize==-1"></when>
<when test="param.pageSize!=-1">limit #{param.pageNumber}, #{param.pageSize}</when>
</choose>
</select>
<select id="getPlanTaskBasicInfo" resultType="Map">
SELECT
DISTINCT
ppk.id AS planTaskId,
pp.NAME AS taskName,
pp.biz_org_name AS stationName,
ppk.begin_time AS beginTime,
ppk.end_time AS endTime,
(UNIX_TIMESTAMP(ppk.end_time) - UNIX_TIMESTAMP(ppk.begin_time)) AS difSecond,
( CASE pptd.is_finish WHEN 0 THEN '未完成' WHEN 1 THEN '已完成' WHEN 2 THEN '超时漏检' END ) AS taskStatus
FROM
`p_plan_task` ppk
LEFT JOIN p_plan pp ON pp.id = ppk.plan_id
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
<where>
pptd.id = #{taskDetailId}
</where>
</select>
<select id="getPlanTaskExecuteInfo" resultType="Map">
SELECT
(SELECT
count(DISTINCT cl.id)
FROM
p_plan_task_detail de
LEFT JOIN p_point_classify cl ON cl.point_id = de.point_id
WHERE
de.id = #{taskDetailId}) AS 'should_check_equip_num',
(SELECT
count( DISTINCT pci.point_classify_id )
FROM
p_check pc
LEFT JOIN p_check_input pci ON pci.check_id = pc.id
WHERE
pc.plan_task_detail_id = #{taskDetailId}
AND pci.is_ok != 3
) AS 'real_check_equip_num',
(SELECT
count( DISTINCT pci.point_classify_id )
FROM
p_check pc
LEFT JOIN p_check_input pci ON pci.check_id = pc.id
WHERE
pc.plan_task_detail_id = #{taskDetailId}
AND pci.is_ok = 1
) AS 'qualified_equip_num',
(SELECT
count( DISTINCT pci.point_classify_id )
FROM
p_check pc
LEFT JOIN p_check_input pci ON pci.check_id = pc.id
WHERE
pc.plan_task_detail_id = #{taskDetailId}
AND pci.is_ok = 2
) AS 'not_qualified_equip_num',
(SELECT
count(DISTINCT cl.id)
FROM
p_check pc
LEFT JOIN p_point_classify cl ON cl.point_id = pc.point_id
WHERE
pc.is_ok = 3 AND pc.plan_task_detail_id = #{taskDetailId}
) AS 'missed_equip_num'
</select>
<select id="getDefinitionObjCode" resultType="String">
SELECT
cl.`code`
FROM
p_plan_task_detail de
LEFT JOIN p_point_classify cl ON cl.point_id = de.point_id
LEFT JOIN p_plan_task task ON task.id = de.task_no
WHERE
de.id = #{taskDetailId} AND cl.`code` IS NOT NULL
</select>
<select id="getDefectEquipInfo" resultType="Map">
SELECT
es.position AS equipLocation
FROM
wl_equipment_specific es
<where>
<if test="id != null">
es.id = #{id}
</if>
</where>
</select>
<select id="getCheckMissedEquipInfo" resultType="Map">
SELECT
cl.`name` AS equipName,
cl.address AS equipPosition,
'漏检' AS result,
cl.data_source_name AS remark
FROM
p_point_classify cl
LEFT JOIN p_check_input pci ON pci.point_classify_id = cl.id
LEFT JOIN p_check pc ON pc.id = pci.check_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pci.is_ok = 3 AND pc.plan_task_detail_id = #{taskDetailId}
GROUP BY cl.id;
</select>
<select id="getCheckQualifiedEquipInfo" resultType="Map">
SELECT
cl.`name` AS equipName,
cl.address AS equipPosition,
pii.name AS checkItem,
'合格' AS result,
pc.check_time AS checkDate,
pc.user_name AS checkUserName
FROM
p_point_classify cl
LEFT JOIN p_check_input pci ON pci.point_classify_id = cl.id
LEFT JOIN p_check pc ON pc.id = pci.check_id
LEFT JOIN p_input_item pii ON pii.id = pci.input_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pci.is_ok = 1 AND pc.plan_task_detail_id = #{taskDetailId}
GROUP BY cl.id;
</select>
<select id="getCheckNotQualifiedEquipInfo" resultType="Map">
SELECT
cl.`name` AS equipName,
cl.address AS equipPosition,
pii.name AS checkItem,
'不合格' AS result,
pc.check_time AS checkDate,
pc.user_name AS checkUserName,
cl.`code` AS objCode
FROM
p_point_classify cl
LEFT JOIN p_check_input pci ON pci.point_classify_id = cl.id
LEFT JOIN p_check pc ON pc.id = pci.check_id
LEFT JOIN p_input_item pii ON pii.id = pci.input_id
LEFT JOIN p_plan_task task ON task.id = pc.plan_task_id
WHERE
pci.is_ok = 2 AND pc.plan_task_detail_id = #{taskDetailId}
GROUP BY cl.id;
</select>
<select id="getCheckIdByDetailId" resultType="java.lang.String">
select id from p_check where plan_task_detail_id = #{taskDetailId} limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment