Commit 8424d1c1 authored by tangwei's avatar tangwei

修改巡检

parent 602718f3
......@@ -6,6 +6,8 @@ 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;
......@@ -20,12 +22,14 @@ public class MyIdGeneratorConfig implements IdentifierGenerator {
/**
* 终端ID
*/
public static long WORKER_ID = 1;
@Value("${generator.worker_id}")
public long WORKER_ID;
/**
* 数据中心id
*/
public static long DATACENTER_ID = 1;
@Value("${generator.datacenter_id}")
public long DATACENTER_ID;
private Snowflake snowflake = IdUtil.createSnowflake(WORKER_ID, DATACENTER_ID);
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.patrol.dao.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
......@@ -35,7 +36,11 @@ public class BasicEntity implements Serializable{
private Date createDate;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@GeneratedValue(generator = "myIdGeneratorConfig",
strategy = GenerationType.SEQUENCE)
@GenericGenerator(
name = "myIdGeneratorConfig",
strategy = "com.yeejoin.amos.patrol.core.common.request.MyIdGeneratorConfig")
@Column(name = "ID",nullable=false,unique=true)
public long getId() {
return id;
......
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.component.feign.model.FeignClientResult;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
......@@ -238,7 +240,13 @@ public class PlanController extends AbstractBaseController {
public CommonResponse queryPointById(@ApiParam(value = "计划id", required = true) @PathVariable(name = "id") Long 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);
}
......
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