Commit 099be078 authored by tangwei's avatar tangwei

Merge branch 'develop_dl_0410' into develop_dl

parents f060fb4e 328a7cdc
...@@ -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;
......
...@@ -18,6 +18,25 @@ ...@@ -18,6 +18,25 @@
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</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>
......
...@@ -12,6 +12,7 @@ import com.yeejoin.amos.patrol.business.dao.repository.IPointInputItemDao; ...@@ -12,6 +12,7 @@ import com.yeejoin.amos.patrol.business.dao.repository.IPointInputItemDao;
import com.yeejoin.amos.patrol.business.dto.InputItemDataDto; import com.yeejoin.amos.patrol.business.dto.InputItemDataDto;
import com.yeejoin.amos.patrol.business.dto.InputItemDataJsonlDto; import com.yeejoin.amos.patrol.business.dto.InputItemDataJsonlDto;
import com.yeejoin.amos.patrol.business.dto.InputItemExcelDto; import com.yeejoin.amos.patrol.business.dto.InputItemExcelDto;
import com.yeejoin.amos.patrol.business.dto.InputItemExcelVo;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient; import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.InputItemPageParam; import com.yeejoin.amos.patrol.business.param.InputItemPageParam;
import com.yeejoin.amos.patrol.business.param.InputItemParam; import com.yeejoin.amos.patrol.business.param.InputItemParam;
...@@ -370,9 +371,9 @@ public class InputItemController extends AbstractBaseController { ...@@ -370,9 +371,9 @@ public class InputItemController extends AbstractBaseController {
@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) {
InputItemPageParam criterias = new InputItemPageParam(); InputItemPageParam criterias = new InputItemPageParam();
List<InputItemExcelDto> content = inputItemMapper.getInputItemInfoExcelNew(criterias); List<InputItemExcelVo> content = inputItemMapper.getInputItemInfoExcelNew(criterias);
//此处对数据做统一处理 拼接为易读内容 //此处对数据做统一处理 拼接为易读内容
for (InputItemExcelDto inputItemExcelDto : content) { for (InputItemExcelVo inputItemExcelDto : content) {
String text = ""; String text = "";
if (inputItemExcelDto.getItemType().equals("选择")&& !inputItemExcelDto.getDataJson().equals("[]")) { if (inputItemExcelDto.getItemType().equals("选择")&& !inputItemExcelDto.getDataJson().equals("[]")) {
List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getDataJson(), Map.class); List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getDataJson(), Map.class);
...@@ -395,7 +396,7 @@ public class InputItemController extends AbstractBaseController { ...@@ -395,7 +396,7 @@ public class InputItemController extends AbstractBaseController {
} }
} }
ExcelUtil.createTemplate(response,"检查项","检查项",content,InputItemExcelDto.class,null,true); ExcelUtil.createTemplate(response,"检查项","检查项",content,InputItemExcelVo.class,null,true);
} }
......
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;
...@@ -238,7 +240,13 @@ public class PlanController extends AbstractBaseController { ...@@ -238,7 +240,13 @@ public class PlanController extends AbstractBaseController {
public CommonResponse queryPointById(@ApiParam(value = "计划id", required = true) @PathVariable(name = "id") Long id) { public CommonResponse queryPointById(@ApiParam(value = "计划id", required = true) @PathVariable(name = "id") Long id) {
Plan plan = planService.queryPlanById(id); Plan plan = planService.queryPlanById(id);
return CommonResponseUtil.success(plan); String json=plan!=null? JSON.toJSONString(plan):null;
JSONObject obj=json!=null?JSON.parseObject(json):null;
if(obj!=null){
obj.put("id",obj.get("id").toString());
}
return CommonResponseUtil.success(obj);
} }
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.business.dao.mapper; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.patrol.business.dto.InputItemExcelDto; import com.yeejoin.amos.patrol.business.dto.InputItemExcelDto;
import com.yeejoin.amos.patrol.business.dto.InputItemExcelVo;
import com.yeejoin.amos.patrol.business.param.InputItemPageParam; import com.yeejoin.amos.patrol.business.param.InputItemPageParam;
import com.yeejoin.amos.patrol.business.vo.InputItemVo; import com.yeejoin.amos.patrol.business.vo.InputItemVo;
import com.yeejoin.amos.patrol.business.vo.PointInputItemVo; import com.yeejoin.amos.patrol.business.vo.PointInputItemVo;
...@@ -31,7 +32,7 @@ public interface InputItemMapper extends BaseMapper<InputItem> { ...@@ -31,7 +32,7 @@ public interface InputItemMapper extends BaseMapper<InputItem> {
public List<InputItemVo> getInputItemInfoNew(InputItemPageParam param); public List<InputItemVo> getInputItemInfoNew(InputItemPageParam param);
public List<InputItemExcelDto> getInputItemInfoExcelNew(InputItemPageParam param); public List<InputItemExcelVo> getInputItemInfoExcelNew(InputItemPageParam param);
Map<Long, Long> getAllCountInfo(); Map<Long, Long> getAllCountInfo();
......
...@@ -71,7 +71,7 @@ public class InputItemExcelDto extends BaseDto { ...@@ -71,7 +71,7 @@ public class InputItemExcelDto extends BaseDto {
@ExplicitConstraint(indexNum=11,source = {"是","否"}) @ExplicitConstraint(indexNum=11,source = {"是","否"})
@ExcelProperty(value = "是否必填", index = 11) @ExcelProperty(value = "是否必填", index = 11)
@ApiModelProperty(value = "是否必填") @ApiModelProperty(value = "是否必填")
private String isMust = "0"; private String isMust = "";
@ExplicitConstraint(indexNum=12,source = {"是","否"}) @ExplicitConstraint(indexNum=12,source = {"是","否"})
@ExcelProperty(value = "是否评分", index = 12) @ExcelProperty(value = "是否评分", index = 12)
...@@ -298,20 +298,27 @@ public class InputItemExcelDto extends BaseDto { ...@@ -298,20 +298,27 @@ public class InputItemExcelDto extends BaseDto {
} }
public String getKeyPartsType() { public String getKeyPartsType() {
return keyPartsType.equals("是")?"0":"1"; return keyPartsType;
// keyPartsType.equals("是")?"0":"1";
} }
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;
} }
public String getCustomType() { public String getCustomType() {
return customType.equals("是")?"0":"1"; return customType;
} }
public void setCustomType(String customType) { /* public void setCustomType(String customType) {
this.customType = StringUtils.isEmpty(customType) ? "1":customType; this.customType = StringUtils.isEmpty(customType) ? "1":customType;
}*/
public void setCustomType(String customType) {
this.customType =StringUtils.isNotEmpty(customType) ? (customType.equals("是")?"0":"1") :customType;
} }
public String getUnit() { public String getUnit() {
...@@ -347,11 +354,11 @@ public class InputItemExcelDto extends BaseDto { ...@@ -347,11 +354,11 @@ public class InputItemExcelDto extends BaseDto {
} }
public String getLevel() { public String getLevel() {
return level == null? null :String.valueOf(PointLevelEnum.getValue(level)); return level ;
} }
public void setLevel(String level) { public void setLevel(String level) {
this.level = level; this.level = level == null? null :String.valueOf(PointLevelEnum.getValue(level));
} }
public long getCatalogId() { public long getCatalogId() {
......
...@@ -614,7 +614,11 @@ public class CheckServiceImpl implements ICheckService { ...@@ -614,7 +614,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();
......
...@@ -67,4 +67,9 @@ equipment.hierarchy=1,2,4,6 ...@@ -67,4 +67,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
#雪花算法参数 终端ID
generator.worker_id=1
#雪花算法参数 数据中心id
generator.datacenter_id=1
\ No newline at end of file
...@@ -388,7 +388,7 @@ ...@@ -388,7 +388,7 @@
</choose> </choose>
</select> </select>
<select id="getInputItemInfoExcelNew" resultType="com.yeejoin.amos.patrol.business.dto.InputItemExcelDto"> <select id="getInputItemInfoExcelNew" resultType="com.yeejoin.amos.patrol.business.dto.InputItemExcelVo">
SELECT SELECT
a.id, a.id,
a.name, a.name,
...@@ -402,40 +402,30 @@ ...@@ -402,40 +402,30 @@
a.input_classify, a.input_classify,
a.check_method, a.check_method,
(CASE a.equipment_type (CASE a.equipment_type
WHEN a.equipment_type is not null and a.equipment_type = '-1' WHEN '-1'
THEN '通用消防装备' THEN '通用消防装备'
ELSE ELSE
(select name from wl_equipment_category where code = a.equipment_type AND industry_code = 2) (select name from wl_equipment_category where code = a.equipment_type AND industry_code = 2)
END) as equipment_type, END) as equipment_type,
(CASE a.facilities_type (CASE a.facilities_type
WHEN a.facilities_type is not null and a.facilities_type = '-1' WHEN '-1'
THEN '通用消防设施' THEN '通用消防设施'
ELSE (select name from wl_equipment_category where code = a.facilities_type AND industry_code = 2) ELSE (select name from wl_equipment_category where code = a.facilities_type AND industry_code = 2)
END) as facilities_type, END) as facilities_type,
(CASE a.level (CASE a.level
WHEN 1 THEN WHEN 1 THEN
'1级' '级'
WHEN 2 THEN WHEN 2 THEN
'2级' '级'
WHEN 3 THEN WHEN 3 THEN
'3级' '级'
WHEN 4 THEN WHEN 4 THEN
'4级' '级'
ELSE ELSE
'5级' '级'
END )AS level, END )AS level,
(CASE a.key_parts_type IFNULL(a.key_parts_type,1) AS keyPartsType,
WHEN 0 THEN IFNULL(a.custom_type,1) AS customType,
'是'
WHEN 1 THEN
'否'
END )AS keyPartsType,
(CASE a.custom_type
WHEN 0 THEN
'是'
WHEN 1 THEN
'否'
END )AS customType,
a.risk_desc, a.risk_desc,
a.data_json a.data_json
from from
......
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