mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
添加车辆预约
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
package cn.lihongjie.coal.acAppointment.controller;
|
||||
|
||||
import cn.lihongjie.coal.acAppointment.dto.AcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.dto.BatchCreateAcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.dto.CreateAcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.dto.UpdateAcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.service.AcAppointmentService;
|
||||
import cn.lihongjie.coal.annotation.OrgScope;
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/acAppointment")
|
||||
@SysLog(module = "门禁设备预约")
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class AcAppointmentController {
|
||||
@Autowired private AcAppointmentService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public AcAppointmentDto create(@RequestBody CreateAcAppointmentDto request) {
|
||||
return this.service.create(request);
|
||||
}
|
||||
|
||||
@PostMapping("/batchCreate")
|
||||
public Object batchCreate(@RequestBody BatchCreateAcAppointmentDto request) {
|
||||
this.service.batchCreate(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public AcAppointmentDto update(@RequestBody UpdateAcAppointmentDto request) {
|
||||
return this.service.update(request);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public AcAppointmentDto getById(@RequestBody IdRequest request) {
|
||||
return this.service.getById(request.getId());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<AcAppointmentDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request);
|
||||
}
|
||||
|
||||
@PostMapping("/archive")
|
||||
public Object archive(@RequestBody IdRequest request) {
|
||||
this.service.archive(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/unarchive")
|
||||
public Object unarchive(@RequestBody IdRequest request) {
|
||||
this.service.unarchive(request);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.lihongjie.coal.acAppointment.dto;
|
||||
|
||||
import cn.lihongjie.coal.acDevice.dto.AcDeviceDto;
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
@Data
|
||||
public class AcAppointmentDto extends OrgCommonDto {
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private AcDeviceDto device;
|
||||
|
||||
@Comment("预约开始时间")
|
||||
private java.time.LocalDateTime startTime;
|
||||
|
||||
@Comment("预约结束时间")
|
||||
private java.time.LocalDateTime endTime;
|
||||
|
||||
@Comment("车牌号")
|
||||
private String plateNo;
|
||||
|
||||
@Comment("姓名")
|
||||
private String driverName;
|
||||
|
||||
@Comment("联系电话")
|
||||
private String driverPhone;
|
||||
|
||||
@Comment("事由")
|
||||
private String reason;
|
||||
|
||||
|
||||
|
||||
@Comment("下发时间")
|
||||
private java.time.LocalDateTime sendTime;
|
||||
|
||||
@Comment("下发状态")
|
||||
private String sendStatus;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'common.step.status'\n"
|
||||
+ " and i.code = send_status)")
|
||||
private String sendStatusName;
|
||||
|
||||
@Comment("下发完成时间")
|
||||
private java.time.LocalDateTime sendFinishTime;
|
||||
|
||||
|
||||
|
||||
|
||||
@Comment("删除时间")
|
||||
private java.time.LocalDateTime deleteTime;
|
||||
|
||||
|
||||
@Comment("下发状态")
|
||||
private String deleteStatus;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'common.step.status'\n"
|
||||
+ " and i.code = delete_status)")
|
||||
private String deleteStatusName;
|
||||
|
||||
@Comment("删除完成时间")
|
||||
private java.time.LocalDateTime deleteFinishTime;
|
||||
private String archiveStatus;
|
||||
|
||||
private String archiveStatusName;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.lihongjie.coal.acAppointment.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BatchCreateAcAppointmentDto extends OrgCommonDto {
|
||||
|
||||
@Comment("预约开始时间")
|
||||
private java.time.LocalDateTime startTime;
|
||||
|
||||
@Comment("预约结束时间")
|
||||
private java.time.LocalDateTime endTime;
|
||||
|
||||
@Comment("车牌号,司机姓名,联系电话")
|
||||
private List<String> lines;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Comment("事由")
|
||||
private String reason;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.lihongjie.coal.acAppointment.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class CreateAcAppointmentDto extends OrgCommonDto {
|
||||
|
||||
private String device;
|
||||
|
||||
@Comment("预约开始时间")
|
||||
private java.time.LocalDateTime startTime;
|
||||
|
||||
@Comment("预约结束时间")
|
||||
private java.time.LocalDateTime endTime;
|
||||
|
||||
@Comment("车牌号")
|
||||
private String plateNo;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Comment("姓名")
|
||||
private String driverName;
|
||||
|
||||
@Comment("联系电话")
|
||||
private String driverPhone;
|
||||
|
||||
@Comment("事由")
|
||||
private String reason;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.lihongjie.coal.acAppointment.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
public class UpdateAcAppointmentDto extends OrgCommonDto {
|
||||
|
||||
private String device;
|
||||
|
||||
@Comment("预约开始时间")
|
||||
private java.time.LocalDateTime startTime;
|
||||
|
||||
@Comment("预约结束时间")
|
||||
private java.time.LocalDateTime endTime;
|
||||
|
||||
@Comment("车牌号")
|
||||
private String plateNo;
|
||||
|
||||
@Comment("姓名")
|
||||
private String driverName;
|
||||
|
||||
@Comment("联系电话")
|
||||
private String driverPhone;
|
||||
|
||||
@Comment("事由")
|
||||
private String reason;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package cn.lihongjie.coal.acAppointment.entity;
|
||||
|
||||
import cn.lihongjie.coal.acDevice.entity.AcDeviceEntity;
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
public class AcAppointmentEntity extends OrgCommonEntity {
|
||||
|
||||
@ManyToOne
|
||||
private AcDeviceEntity device;
|
||||
|
||||
@Comment("预约开始时间")
|
||||
private java.time.LocalDateTime startTime;
|
||||
|
||||
@Comment("预约结束时间")
|
||||
private java.time.LocalDateTime endTime;
|
||||
|
||||
@Comment("车牌号")
|
||||
private String plateNo;
|
||||
|
||||
@Comment("姓名")
|
||||
private String driverName;
|
||||
|
||||
@Comment("联系电话")
|
||||
private String driverPhone;
|
||||
|
||||
@Comment("事由")
|
||||
private String reason;
|
||||
|
||||
|
||||
|
||||
@Comment("下发时间")
|
||||
private java.time.LocalDateTime sendTime;
|
||||
|
||||
@Comment("下发状态")
|
||||
private String sendStatus;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'common.step.status'\n"
|
||||
+ " and i.code = send_status)")
|
||||
private String sendStatusName;
|
||||
|
||||
@Comment("下发完成时间")
|
||||
private java.time.LocalDateTime sendFinishTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Comment("删除时间")
|
||||
private java.time.LocalDateTime deleteTime;
|
||||
|
||||
|
||||
@Comment("下发状态")
|
||||
private String deleteStatus;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'common.step.status'\n"
|
||||
+ " and i.code = delete_status)")
|
||||
private String deleteStatusName;
|
||||
|
||||
@Comment("删除完成时间")
|
||||
private java.time.LocalDateTime deleteFinishTime;
|
||||
|
||||
@Comment("预约状态")
|
||||
private String appointmentStatus;
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'appointment.status'\n"
|
||||
+ " and i.code = appointment_status)")
|
||||
private String appointmentStatusName;
|
||||
|
||||
@Comment("归档状态")
|
||||
@ColumnDefault("'0'")
|
||||
private String archiveStatus = "0";
|
||||
|
||||
@Formula(
|
||||
"(select i.name\n"
|
||||
+ "from t_dictionary d,\n"
|
||||
+ " t_dictionary_item i\n"
|
||||
+ "where d.id = i.dictionary_id\n"
|
||||
+ " and d.code = 'archiveStatus'\n"
|
||||
+ " and i.code = archive_status)")
|
||||
private String archiveStatusName;
|
||||
}
|
||||
@@ -0,0 +1,373 @@
|
||||
package cn.lihongjie.coal.acAppointment.listener;
|
||||
|
||||
import cn.lihongjie.coal.acAppointment.entity.AcAppointmentEntity;
|
||||
import cn.lihongjie.coal.acAppointment.service.AcAppointmentService;
|
||||
import cn.lihongjie.coal.acDevice.service.AcDeviceService;
|
||||
import cn.lihongjie.coal.acDeviceData.service.AcDeviceDataService;
|
||||
import cn.lihongjie.coal.dataCollector.service.DataCollectorService;
|
||||
import cn.lihongjie.coal.dataCollectorLog.service.DataCollectorLogService;
|
||||
import cn.lihongjie.coal.rabbitmq.RabbitMQConfiguration;
|
||||
import cn.lihongjie.coal.rabbitmq.RabbitMQService;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.amqp.core.AmqpAdmin;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.handler.annotation.Headers;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AcAppointmentListener {
|
||||
|
||||
@Autowired DataCollectorService dataCollectorService;
|
||||
|
||||
@Autowired DataCollectorLogService dataCollectorLogService;
|
||||
|
||||
@Autowired ObjectMapper objectMapper;
|
||||
|
||||
@Autowired AcDeviceDataService acDeviceDataService;
|
||||
|
||||
@Autowired AcDeviceService acDeviceService;
|
||||
@Autowired RabbitMQService rabbitMQService;
|
||||
@Autowired AcAppointmentService acAppointmentService;
|
||||
@Autowired AmqpAdmin amqpAdmin;
|
||||
|
||||
@NotNull
|
||||
private static HashMap<Object, Object> buildMessage(
|
||||
AcAppointmentEntity appointment, String value) {
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
|
||||
map.put("eventType", value);
|
||||
map.put("appointId", appointment.getId());
|
||||
// 客户端生成 序列 vehicleinfo_id_seq
|
||||
map.put("id", "");
|
||||
// 车牌号
|
||||
map.put("plateno", appointment.getPlateNo());
|
||||
map.put("platecolor", "1");
|
||||
map.put("platetype", "0");
|
||||
map.put("vehiclecolor", "1");
|
||||
map.put("vehicletype", "1");
|
||||
map.put("parkingtype", "0");
|
||||
map.put("cardno", "");
|
||||
map.put("brand", "");
|
||||
map.put(
|
||||
"ownername",
|
||||
StringUtils.defaultIfBlank(appointment.getDriverName(), appointment.getPlateNo()));
|
||||
map.put("owneraddress", "");
|
||||
map.put("ownerphonenumber", appointment.getDriverPhone());
|
||||
map.put("identitynumber", "");
|
||||
map.put(
|
||||
"registertime",
|
||||
LocalDateTime.now().format(RabbitMQConfiguration.DATE_TIME_FORMATTER));
|
||||
|
||||
map.put(
|
||||
"begintime",
|
||||
appointment.getStartTime().format(RabbitMQConfiguration.DATE_TIME_FORMATTER));
|
||||
map.put(
|
||||
"endtime",
|
||||
appointment.getEndTime().format(RabbitMQConfiguration.DATE_TIME_FORMATTER));
|
||||
map.put("ownergender", "");
|
||||
map.put("ownerworkplace", "");
|
||||
map.put("ownerdepartment", "");
|
||||
map.put("ownerpost", "");
|
||||
// 序列 uniquenosequence
|
||||
map.put("uniquenumber", "");
|
||||
|
||||
map.put("categorybelonged", "1");
|
||||
map.put("expiredhandling", "0");
|
||||
map.put("matchedhandling", "0");
|
||||
map.put("timestamp", LocalDateTime.now().format(RabbitMQConfiguration.DATE_TIME_FORMATTER));
|
||||
map.put("reserve1", "");
|
||||
map.put("reserve2", appointment.getId());
|
||||
map.put("parkpermission", "1,2,3,4,5");
|
||||
map.put("vehicleinfo_cardtype", "0");
|
||||
map.put("groupbelonged", "0");
|
||||
map.put("isalreaybag", "1");
|
||||
map.put("isfromthirdsystem", "0");
|
||||
map.put("uploadflag", "0");
|
||||
map.put("historytime", null);
|
||||
map.put(
|
||||
"extrainfo",
|
||||
"""
|
||||
{
|
||||
"发动机号": "",
|
||||
"排放量号": "",
|
||||
"识别代码": "",
|
||||
"车架号": "",
|
||||
"车辆排量": "",
|
||||
"车队名称": ""
|
||||
}
|
||||
""");
|
||||
return map;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@RabbitListener(
|
||||
bindings = {
|
||||
@QueueBinding(
|
||||
value =
|
||||
@org.springframework.amqp.rabbit.annotation.Queue(
|
||||
value = "acAppointment.data",
|
||||
durable = "true"),
|
||||
exchange =
|
||||
@Exchange(
|
||||
value = RabbitMQConfiguration.SYS_EXCHANGE,
|
||||
declare = Exchange.FALSE),
|
||||
key = "acAppointment.*")
|
||||
})
|
||||
@Transactional
|
||||
public void handlePmsMessage(String body, @Headers Map<String, Object> headers) {
|
||||
|
||||
var rk = headers.get(AmqpHeaders.RECEIVED_ROUTING_KEY).toString();
|
||||
|
||||
switch (rk) {
|
||||
case "acAppointment.create":
|
||||
handleCreate(body);
|
||||
break;
|
||||
case "acAppointment.update":
|
||||
handleUpdate(body);
|
||||
break;
|
||||
case "acAppointment.delete":
|
||||
handleDelete(body);
|
||||
break;
|
||||
|
||||
case "acAppointment.cancel":
|
||||
handleCancel(body);
|
||||
break;
|
||||
case "acAppointment.expire":
|
||||
handleExpire(body);
|
||||
break;
|
||||
|
||||
case "acAppointment.response":
|
||||
handleResponse(body);
|
||||
break;
|
||||
default:
|
||||
log.error("unknown routing key: {}", rk);
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void handleResponse(String body) {
|
||||
|
||||
ObjectNode node = (ObjectNode) objectMapper.readTree(body);
|
||||
|
||||
String appointId = node.get("appointId").asText();
|
||||
String eventType = node.get("eventType").asText();
|
||||
String status = node.get("status").asText();
|
||||
LocalDateTime time = LocalDateTime.parse(node.get("time").asText(), RabbitMQConfiguration.DATE_TIME_FORMATTER);
|
||||
|
||||
|
||||
AcAppointmentEntity appointment;
|
||||
try {
|
||||
|
||||
appointment = acAppointmentService.get(appointId);
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("appointment not exist: {}", appointId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (StringUtils.equals(status, "3")){
|
||||
log.info("{} fail: {}\n{}", eventType, appointId, node.get("message").asText());
|
||||
}else {
|
||||
|
||||
log.info("{} success: {}", eventType, appointId);
|
||||
}
|
||||
|
||||
|
||||
switch (eventType){
|
||||
|
||||
|
||||
case "acAppointment.create" ->{
|
||||
|
||||
|
||||
appointment.setSendFinishTime(time);
|
||||
appointment.setSendStatus(status);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
case "acAppointment.update" ->{
|
||||
|
||||
appointment.setSendFinishTime(time);
|
||||
appointment.setSendStatus(status);
|
||||
|
||||
}
|
||||
|
||||
case "acAppointment.delete" ->{
|
||||
|
||||
|
||||
log.info("appointment delete: {}", appointId);
|
||||
|
||||
}
|
||||
|
||||
case "acAppointment.cancel" ->{
|
||||
|
||||
appointment.setDeleteFinishTime(time);
|
||||
appointment.setDeleteStatus(status);
|
||||
|
||||
}
|
||||
case "acAppointment.expire" ->{
|
||||
|
||||
appointment.setDeleteFinishTime(time);
|
||||
appointment.setDeleteStatus(status);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.acAppointmentService.save(appointment);
|
||||
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void handleDelete(String body) {
|
||||
|
||||
List<ObjectNode> values = objectMapper.readerForListOf(ObjectNode.class).readValue(body);
|
||||
|
||||
for (ObjectNode value : values) {
|
||||
|
||||
String id = value.get("id").asText();
|
||||
String appKey = value.get("appKey").asText();
|
||||
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("eventType", "acAppointment.delete");
|
||||
map.put("appointId", id);
|
||||
|
||||
String queueName = "pms.client." + appKey;
|
||||
|
||||
rabbitMQService.send("", queueName, map, new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void handleCancel(String body) {
|
||||
|
||||
List<ObjectNode> values = objectMapper.readerForListOf(ObjectNode.class).readValue(body);
|
||||
|
||||
for (ObjectNode value : values) {
|
||||
|
||||
String id = value.get("id").asText();
|
||||
String appKey = value.get("appKey").asText();
|
||||
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("eventType", "acAppointment.cancel");
|
||||
map.put("appointId", id);
|
||||
|
||||
String queueName = "pms.client." + appKey;
|
||||
|
||||
rabbitMQService.send("", queueName, map, new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private void handleExpire(String body) {
|
||||
|
||||
List<ObjectNode> values = objectMapper.readerForListOf(ObjectNode.class).readValue(body);
|
||||
|
||||
for (ObjectNode value : values) {
|
||||
|
||||
String id = value.get("id").asText();
|
||||
String appKey = value.get("appKey").asText();
|
||||
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("eventType", "acAppointment.expire");
|
||||
map.put("appointId", id);
|
||||
|
||||
String queueName = "pms.client." + appKey;
|
||||
|
||||
rabbitMQService.send("", queueName, map, new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
private void handleUpdate(String body) {
|
||||
|
||||
AcAppointmentEntity appointment = acAppointmentService.get(body);
|
||||
|
||||
if (StringUtils.isEmpty(appointment.getSendStatus())
|
||||
|| "0".equals(appointment.getSendStatus())) {
|
||||
handleCreate(body);
|
||||
|
||||
} else if (StringUtils.equals("1", appointment.getSendStatus())) {
|
||||
|
||||
log.info(
|
||||
"appointment sending: {} status {}",
|
||||
appointment.getId(),
|
||||
appointment.getSendStatus());
|
||||
|
||||
} else if (StringUtils.equals("2", appointment.getSendStatus())) {
|
||||
|
||||
doUpdate(appointment);
|
||||
|
||||
} else if (StringUtils.equals("3", appointment.getSendStatus())) {
|
||||
|
||||
appointment.setSendStatus("0");
|
||||
handleCreate(body);
|
||||
|
||||
} else {
|
||||
|
||||
log.error("unknown status: {}", appointment.getSendStatus());
|
||||
}
|
||||
}
|
||||
|
||||
private void doUpdate(AcAppointmentEntity appointment) {
|
||||
|
||||
HashMap<Object, Object> message = buildMessage(appointment, "acAppointment.update");
|
||||
|
||||
String appKey = appointment.getDevice().getDataCollector().getAppKey();
|
||||
|
||||
String queueName = "pms.client." + appKey;
|
||||
|
||||
rabbitMQService.send("", queueName, message, new HashMap<>());
|
||||
|
||||
appointment.setSendStatus("1");
|
||||
appointment.setSendTime(LocalDateTime.now());
|
||||
appointment.setSendFinishTime(null);
|
||||
acAppointmentService.save(appointment);
|
||||
}
|
||||
|
||||
private void handleCreate(String body) {
|
||||
|
||||
AcAppointmentEntity appointment = acAppointmentService.get(body);
|
||||
|
||||
if (StringUtils.isEmpty(appointment.getSendStatus())
|
||||
|| "0".equals(appointment.getSendStatus())) {
|
||||
|
||||
String appKey = appointment.getDevice().getDataCollector().getAppKey();
|
||||
appointment.setSendStatus("1");
|
||||
|
||||
HashMap<Object, Object> map = buildMessage(appointment, "acAppointment.create");
|
||||
|
||||
String queueName = "pms.client." + appKey;
|
||||
|
||||
rabbitMQService.send("", queueName, map, new HashMap<>());
|
||||
|
||||
appointment.setSendStatus("1");
|
||||
appointment.setSendTime(LocalDateTime.now());
|
||||
appointment.setSendFinishTime(null);
|
||||
acAppointmentService.save(appointment);
|
||||
|
||||
} else {
|
||||
|
||||
log.info("appointment already send: {}", appointment.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.lihongjie.coal.acAppointment.mapper;
|
||||
|
||||
import cn.lihongjie.coal.acAppointment.dto.AcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.dto.CreateAcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.dto.UpdateAcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.entity.AcAppointmentEntity;
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonEntityMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class, CommonEntityMapper.class},
|
||||
mappingControl = DeepClone.class)
|
||||
public interface AcAppointmentMapper
|
||||
extends BaseMapper<
|
||||
AcAppointmentEntity,
|
||||
AcAppointmentDto,
|
||||
CreateAcAppointmentDto,
|
||||
UpdateAcAppointmentDto> {}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.lihongjie.coal.acAppointment.repository;
|
||||
|
||||
import cn.lihongjie.coal.acAppointment.entity.AcAppointmentEntity;
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface AcAppointmentRepository extends BaseRepository<AcAppointmentEntity> {}
|
||||
@@ -0,0 +1,247 @@
|
||||
package cn.lihongjie.coal.acAppointment.service;
|
||||
|
||||
import cn.lihongjie.coal.acAppointment.dto.AcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.dto.BatchCreateAcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.dto.CreateAcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.dto.UpdateAcAppointmentDto;
|
||||
import cn.lihongjie.coal.acAppointment.entity.AcAppointmentEntity;
|
||||
import cn.lihongjie.coal.acAppointment.mapper.AcAppointmentMapper;
|
||||
import cn.lihongjie.coal.acAppointment.repository.AcAppointmentRepository;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.common.ArchiveUtils;
|
||||
import cn.lihongjie.coal.dbFunctions.DbFunctionService;
|
||||
import cn.lihongjie.coal.exception.BizException;
|
||||
import cn.lihongjie.coal.rabbitmq.RabbitMQService;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class AcAppointmentService
|
||||
extends BaseService<AcAppointmentEntity, AcAppointmentRepository> {
|
||||
@Autowired RabbitMQService rabbitMQService;
|
||||
@Autowired private AcAppointmentRepository repository;
|
||||
@Autowired private AcAppointmentMapper mapper;
|
||||
@Autowired private ConversionService conversionService;
|
||||
@Autowired private DbFunctionService dbFunctionService;
|
||||
|
||||
public AcAppointmentDto create(CreateAcAppointmentDto request) {
|
||||
|
||||
AcAppointmentEntity entity = mapper.toEntity(request);
|
||||
entity.setAppointmentStatus("0");
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
rabbitMQService.sendToSysExchange("acAppointment.create", entity.getId(), new HashMap<String, String>());
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void batchCreate(BatchCreateAcAppointmentDto request) {
|
||||
|
||||
for (String no : request.getLines()) {
|
||||
|
||||
List<String> parts = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(no);
|
||||
|
||||
CreateAcAppointmentDto dto = new CreateAcAppointmentDto();
|
||||
dto.setStartTime(request.getStartTime());
|
||||
dto.setEndTime(request.getEndTime());
|
||||
dto.setPlateNo(parts.get(0));
|
||||
|
||||
dto.setReason(request.getReason());
|
||||
|
||||
if (parts.size() > 1) dto.setDriverName(parts.get(1));
|
||||
else dto.setDriverName("");
|
||||
|
||||
if (parts.size() > 2) dto.setDriverPhone(parts.get(2));
|
||||
else dto.setDriverPhone("");
|
||||
|
||||
create(dto);
|
||||
}
|
||||
}
|
||||
|
||||
public AcAppointmentDto update(UpdateAcAppointmentDto request) {
|
||||
AcAppointmentEntity entity = this.repository.get(request.getId());
|
||||
ArchiveUtils.checkArchiveStatus(
|
||||
entity,
|
||||
AcAppointmentEntity::getArchiveStatus,
|
||||
x -> "0",
|
||||
(e, actual, expected) -> {
|
||||
throw new BizException("数据 " + "已归档,无法编辑");
|
||||
});
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
rabbitMQService.sendToSysExchange("acAppointment.update", entity.getId(), new HashMap<String, String>());
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
ArchiveUtils.checkArchiveStatus(
|
||||
this.repository::findAllById,
|
||||
request.getIds(),
|
||||
AcAppointmentEntity::getArchiveStatus,
|
||||
x -> "0",
|
||||
(e, actual, expected) -> {
|
||||
throw new BizException("数据 " + "已归档,无法删除");
|
||||
});
|
||||
|
||||
List<AcAppointmentEntity> all = this.repository.findAllById(request.getIds());
|
||||
|
||||
List<Map<String, String>> payload = all.stream()
|
||||
.map(
|
||||
x -> {
|
||||
return Map.of(
|
||||
"id",
|
||||
x.getId(),
|
||||
"appKey",
|
||||
x.getDevice().getDataCollector().getAppKey());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
rabbitMQService.sendToSysExchange("acAppointment.delete", payload, new HashMap<String, String>());
|
||||
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
}
|
||||
|
||||
|
||||
public void cancel(IdRequest request) {
|
||||
ArchiveUtils.checkArchiveStatus(
|
||||
this.repository::findAllById,
|
||||
request.getIds(),
|
||||
AcAppointmentEntity::getArchiveStatus,
|
||||
x -> "0",
|
||||
(e, actual, expected) -> {
|
||||
throw new BizException("数据 " + "已归档,无法删除");
|
||||
});
|
||||
|
||||
List<AcAppointmentEntity> all = this.repository.findAllById(request.getIds());
|
||||
|
||||
List<Map<String, String>> payload = all.stream()
|
||||
.map(
|
||||
x -> {
|
||||
return Map.of(
|
||||
"id",
|
||||
x.getId(),
|
||||
"appKey",
|
||||
x.getDevice().getDataCollector().getAppKey());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
all.forEach(x -> x.setAppointmentStatus("1"));
|
||||
all.forEach(x -> x.setArchiveStatus("1"));
|
||||
this.repository.saveAll(all);
|
||||
rabbitMQService.sendToSysExchange("acAppointment.cancel", payload, new HashMap<String, String>());
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void expire(){
|
||||
|
||||
|
||||
List<AcAppointmentEntity> all = this.repository.findAll(new Specification<AcAppointmentEntity>() {
|
||||
@Override
|
||||
public Predicate toPredicate(Root<AcAppointmentEntity> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
|
||||
return criteriaBuilder.and(
|
||||
criteriaBuilder.lessThan(root.get("endTime"), LocalDateTime.now()))
|
||||
;
|
||||
}
|
||||
});
|
||||
|
||||
List<Map<String, String>> payload = all.stream()
|
||||
.map(
|
||||
x -> {
|
||||
return Map.of(
|
||||
"id",
|
||||
x.getId(),
|
||||
"appKey",
|
||||
x.getDevice().getDataCollector().getAppKey());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
all.forEach(x -> x.setAppointmentStatus("2"));
|
||||
|
||||
all.forEach(x -> x.setArchiveStatus("1"));
|
||||
|
||||
this.repository.saveAll(all);
|
||||
|
||||
rabbitMQService.sendToSysExchange("acAppointment.expire", payload, new HashMap<String, String>());
|
||||
|
||||
|
||||
}
|
||||
|
||||
public AcAppointmentDto getById(String id) {
|
||||
AcAppointmentEntity entity = repository.get(id);
|
||||
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
public Page<AcAppointmentDto> list(CommonQuery query) {
|
||||
Page<AcAppointmentEntity> page =
|
||||
repository.findAll(
|
||||
query.specification(conversionService),
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
}
|
||||
|
||||
public void archive(IdRequest dto) {
|
||||
this.repository.findAllById(dto.getIds()).stream()
|
||||
.peek(
|
||||
x ->
|
||||
ArchiveUtils.checkArchiveStatus(
|
||||
x,
|
||||
AcAppointmentEntity::getArchiveStatus,
|
||||
y -> "0",
|
||||
(e, actual, expected) -> {
|
||||
throw new BizException("数据 " + "已归档,无法再次归档");
|
||||
}))
|
||||
.peek(x -> x.setArchiveStatus("1"))
|
||||
.forEach(this.repository::save);
|
||||
}
|
||||
|
||||
public void unarchive(IdRequest dto) {
|
||||
this.repository.findAllById(dto.getIds()).stream()
|
||||
.peek(
|
||||
x ->
|
||||
ArchiveUtils.checkArchiveStatus(
|
||||
x,
|
||||
AcAppointmentEntity::getArchiveStatus,
|
||||
y -> "1",
|
||||
(e, actual, expected) -> {
|
||||
throw new BizException("数据" + "未归档,无法取消归档");
|
||||
}))
|
||||
.peek(x -> x.setArchiveStatus("0"))
|
||||
.forEach(this.repository::save);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,13 @@ public class CoalWashingMonthReportDto extends OrgCommonDto {
|
||||
private String remark2;
|
||||
private String remark3;
|
||||
private String remark4;
|
||||
|
||||
private String remark6;
|
||||
private String remark7;
|
||||
private String remark8;
|
||||
private String remark9;
|
||||
private String remark10;
|
||||
private String remark11;
|
||||
private Double days;
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,33 @@ select gen_random_uuid()::text as id,
|
||||
date_trunc('month', d.date) as create_time,
|
||||
date_trunc('month', d.date) as update_time,
|
||||
'' as remark4,
|
||||
sum(case
|
||||
when d.remark6 is null or d.remark6 = '' then null
|
||||
else d.remark6::numeric end) as remark6,
|
||||
|
||||
round(sum(case when d.remark6 is null or d.remark6 = '' then null else d.remark6::numeric end) /
|
||||
sum(case when d.remark1 is null or d.remark1 = '' then null else d.remark1::numeric end) * 100,
|
||||
2) as remark7,
|
||||
|
||||
|
||||
|
||||
sum(case
|
||||
when d.remark8 is null or d.remark8 = '' then null
|
||||
else d.remark8::numeric end) as remark8,
|
||||
|
||||
round(sum(case when d.remark8 is null or d.remark8 = '' then null else d.remark8::numeric end) /
|
||||
sum(case when d.remark1 is null or d.remark1 = '' then null else d.remark1::numeric end) * 100,
|
||||
2) as remark9,
|
||||
|
||||
sum(case
|
||||
when d.remark10 is null or d.remark10 = '' then null
|
||||
else d.remark10::numeric end) as remark10,
|
||||
|
||||
round(sum(case when d.remark10 is null or d.remark10 = '' then null else d.remark10::numeric end) /
|
||||
sum(case when d.remark1 is null or d.remark1 = '' then null else d.remark1::numeric end) * 100,
|
||||
2) as remark11,
|
||||
|
||||
|
||||
'' as create_user_id,
|
||||
'' as update_user_id,
|
||||
null as file_ids,
|
||||
@@ -55,6 +82,13 @@ public class CoalWashingMonthReportEntity extends OrgCommonEntity {
|
||||
private String remark3;
|
||||
private String remark4;
|
||||
|
||||
private String remark6;
|
||||
private String remark7;
|
||||
private String remark8;
|
||||
private String remark9;
|
||||
private String remark10;
|
||||
private String remark11;
|
||||
|
||||
private Double days;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,8 +11,14 @@ import cn.lihongjie.coal.dataCollector.mapper.DataCollectorMapper;
|
||||
import cn.lihongjie.coal.dataCollector.repository.DataCollectorRepository;
|
||||
import cn.lihongjie.coal.dbFunctions.DbFunctionService;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.amqp.core.AmqpAdmin;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -21,6 +27,7 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@@ -36,15 +43,34 @@ public class DataCollectorService
|
||||
|
||||
@Autowired private DbFunctionService dbFunctionService;
|
||||
|
||||
@Autowired AmqpAdmin amqpAdmin;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
||||
findAll().stream()
|
||||
.filter(x -> StringUtils.isNotEmpty(x.getAppKey()))
|
||||
.forEach(this::createQueue);
|
||||
}
|
||||
|
||||
public DataCollectorDto create(CreateDataCollectorDto request) {
|
||||
DataCollectorEntity entity = mapper.toEntity(request);
|
||||
|
||||
entity.setAppKey(UUID.randomUUID().toString());
|
||||
entity.setAppSecret(UUID.randomUUID().toString());
|
||||
this.repository.save(entity);
|
||||
|
||||
createQueue(entity);
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String createQueue(DataCollectorEntity entity) {
|
||||
return amqpAdmin.declareQueue(
|
||||
new Queue("pms.client." + entity.getAppKey(), true, false, false, new HashMap<>()));
|
||||
}
|
||||
|
||||
public DataCollectorDto update(UpdateDataCollectorDto request) {
|
||||
DataCollectorEntity entity = this.repository.get(request.getId());
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -62,7 +63,7 @@ class OrganizationService extends BaseService<OrganizationEntity, OrganizationRe
|
||||
dto.setUsername(request.getOrgAdminUserName());
|
||||
dto.setPassword(request.getOrgAdminPassword());
|
||||
userService.createOrgAdmin(dto);
|
||||
rabbitMQService.sendToSysExchange("organization.create", entity.getId());
|
||||
rabbitMQService.sendToSysExchange("organization.create", entity.getId(), new HashMap<String, String>());
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ class OrganizationService extends BaseService<OrganizationEntity, OrganizationRe
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
rabbitMQService.sendToSysExchange("organization.update", entity.getId());
|
||||
rabbitMQService.sendToSysExchange("organization.update", entity.getId(), new HashMap<String, String>());
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.springframework.boot.convert.DurationStyle;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
@EnableRabbit
|
||||
@@ -31,6 +32,7 @@ public class RabbitMQConfiguration {
|
||||
};
|
||||
|
||||
public static final Long[] DELAY_QUEUES_TIME = Arrays.stream(DELAY_QUEUES).map(x -> DurationStyle.detectAndParse(x).toMillis()).toArray(Long[]::new);
|
||||
public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Autowired private ObjectMapper objectMapper;
|
||||
|
||||
@@ -51,6 +53,7 @@ public class RabbitMQConfiguration {
|
||||
return sysExchange;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public HeadersExchange delayExchange() {
|
||||
HashMap<String, Object> arguments = new HashMap<>();
|
||||
@@ -78,7 +81,7 @@ public class RabbitMQConfiguration {
|
||||
"delayQueue." + delayQueue,
|
||||
Binding.DestinationType.QUEUE,
|
||||
SYS_DELAY_EXCHANGE,
|
||||
null,
|
||||
"",
|
||||
bindArgs));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,37 @@
|
||||
package cn.lihongjie.coal.rabbitmq;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class RabbitMQService {
|
||||
|
||||
@Autowired RabbitTemplate rabbitTemplate;
|
||||
|
||||
public void send(String exchange, String routingKey, String data) {
|
||||
public void send(String exchange, String routingKey, Object data, Map<String, String> headers) {
|
||||
|
||||
rabbitTemplate.convertAndSend(
|
||||
exchange,
|
||||
routingKey,
|
||||
data,
|
||||
message -> {
|
||||
if (MapUtils.isNotEmpty(headers))
|
||||
message.getMessageProperties().getHeaders().putAll(headers);
|
||||
return message;
|
||||
});
|
||||
|
||||
rabbitTemplate.convertAndSend(exchange, routingKey, data);
|
||||
}
|
||||
|
||||
public void sendToSysDelayExchange(String routingKey, String data, long delay) {
|
||||
public void sendToSysDelayExchange(String routingKey, Object data, long delay) {
|
||||
send(RabbitMQConfiguration.SYS_DELAY_EXCHANGE, routingKey, data, delay);
|
||||
}
|
||||
|
||||
public void send(String exchange, String routingKey, String data, long delay) {
|
||||
public void send(String exchange, String routingKey, Object data, long delay) {
|
||||
|
||||
rabbitTemplate.convertAndSend(
|
||||
exchange,
|
||||
@@ -45,7 +58,11 @@ public class RabbitMQService {
|
||||
throw new IllegalArgumentException("delay is too long: " + delay);
|
||||
}
|
||||
|
||||
public void sendToSysExchange(String routingKey, String data) {
|
||||
send(RabbitMQConfiguration.SYS_EXCHANGE, routingKey, data);
|
||||
public void sendToSysExchange(String routingKey, Object data) {
|
||||
sendToSysExchange(routingKey, data, new HashMap<>());
|
||||
}
|
||||
|
||||
public void sendToSysExchange(String routingKey, Object data, Map<String, String> headers) {
|
||||
send(RabbitMQConfiguration.SYS_EXCHANGE, routingKey, data, headers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1675,6 +1675,47 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "common.step.status",
|
||||
"name": "通用状态步骤",
|
||||
"item": [
|
||||
{
|
||||
"code": "0",
|
||||
"name": "未开始"
|
||||
},
|
||||
{
|
||||
"code": "1",
|
||||
"name": "进行中"
|
||||
},
|
||||
{
|
||||
"code": "2",
|
||||
"name": "已完成"
|
||||
},
|
||||
{
|
||||
"code": "3",
|
||||
"name": "失败"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "appointment.status",
|
||||
"name": "道闸车辆预约状态",
|
||||
"item": [
|
||||
{
|
||||
"code": "0",
|
||||
"name": "正常"
|
||||
},
|
||||
{
|
||||
"code": "1",
|
||||
"name": "已取消"
|
||||
},
|
||||
{
|
||||
"code": "2",
|
||||
"name": "已过期"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "purchaseOrder.status",
|
||||
"name": "采购订单状态",
|
||||
@@ -2529,7 +2570,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"code": "em.device.type",
|
||||
"name": "环保设备类型",
|
||||
@@ -2538,7 +2578,6 @@
|
||||
"code": "1",
|
||||
"name": "扬尘检测设备"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -2549,14 +2588,12 @@
|
||||
"code": "1",
|
||||
"name": "海康道闸PMS4.0"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "thirdAccount.type",
|
||||
"name": "第三方账号类型",
|
||||
"item": [
|
||||
|
||||
{
|
||||
"code": "1",
|
||||
"name": "阿里云"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
package scripts.dict
|
||||
|
||||
import cn.lihongjie.coal.acAppointment.controller.AcAppointmentController
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery
|
||||
import org.springframework.context.ApplicationContext
|
||||
|
||||
ApplicationContext ioc = ioc
|
||||
|
||||
def controller = ioc.getBean(AcAppointmentController.class)
|
||||
|
||||
|
||||
|
||||
|
||||
return controller.list(new CommonQuery())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user