mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
完善
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -50,6 +50,12 @@
|
|||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.lemire.integercompression</groupId>
|
||||||
|
<artifactId>JavaFastPFOR</artifactId>
|
||||||
|
<version>0.1.12</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||||
<artifactId>caffeine</artifactId>
|
<artifactId>caffeine</artifactId>
|
||||||
|
|||||||
@@ -9,10 +9,18 @@ import java.util.*;
|
|||||||
@Data
|
@Data
|
||||||
public class SimpleDto {
|
public class SimpleDto {
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@Comment("名称")
|
@Comment("名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Comment("编码")
|
@Comment("编码")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
public static SimpleDto from(String name) {
|
||||||
|
SimpleDto simpleDto = new SimpleDto();
|
||||||
|
simpleDto.setName(name);
|
||||||
|
simpleDto.setId(name);
|
||||||
|
simpleDto.setCode(name);
|
||||||
|
return simpleDto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ public class DictCode {
|
|||||||
public static final String DEVICE_CATEGORY_DEVICECODEGENRULE =
|
public static final String DEVICE_CATEGORY_DEVICECODEGENRULE =
|
||||||
"device.category.deviceCodeGenRule";
|
"device.category.deviceCodeGenRule";
|
||||||
|
|
||||||
|
public static final String DEVICE_STATUS = "device.status";
|
||||||
|
|
||||||
public static final String EXCEL_GENERATOR_DATASOURCE_TYPE = "excel.generator.datasource.type";
|
public static final String EXCEL_GENERATOR_DATASOURCE_TYPE = "excel.generator.datasource.type";
|
||||||
|
|
||||||
public static final String DEVICE_WORKORDER_STATUS = "device.workOrder.status";
|
public static final String DEVICE_WORKORDER_STATUS = "device.workOrder.status";
|
||||||
|
|||||||
34
src/main/java/cn/lihongjie/coal/common/IntsCompression.java
Normal file
34
src/main/java/cn/lihongjie/coal/common/IntsCompression.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package cn.lihongjie.coal.common;
|
||||||
|
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
|
import me.lemire.integercompression.differential.IntegratedIntCompressor;
|
||||||
|
|
||||||
|
@UtilityClass
|
||||||
|
public class IntsCompression {
|
||||||
|
|
||||||
|
public static int[] compress(int[] data){
|
||||||
|
|
||||||
|
|
||||||
|
if (data == null || data.length == 0) {
|
||||||
|
return new int[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IntegratedIntCompressor iic = new IntegratedIntCompressor();
|
||||||
|
|
||||||
|
return iic.compress(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int[] decompress(int[] compressed) {
|
||||||
|
|
||||||
|
if (compressed == null || compressed.length == 0) {
|
||||||
|
return new int[0];
|
||||||
|
}
|
||||||
|
IntegratedIntCompressor iic = new IntegratedIntCompressor();
|
||||||
|
return iic.uncompress(compressed);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package cn.lihongjie.coal.dataCollector.listener;
|
|||||||
|
|
||||||
import cn.lihongjie.coal.acDevice.service.AcDeviceService;
|
import cn.lihongjie.coal.acDevice.service.AcDeviceService;
|
||||||
import cn.lihongjie.coal.acDeviceData.service.AcDeviceDataService;
|
import cn.lihongjie.coal.acDeviceData.service.AcDeviceDataService;
|
||||||
|
import cn.lihongjie.coal.common.IntsCompression;
|
||||||
import cn.lihongjie.coal.dataCollector.entity.DataCollectorEntity;
|
import cn.lihongjie.coal.dataCollector.entity.DataCollectorEntity;
|
||||||
import cn.lihongjie.coal.dataCollector.service.DataCollectorService;
|
import cn.lihongjie.coal.dataCollector.service.DataCollectorService;
|
||||||
import cn.lihongjie.coal.dataCollectorLog.entity.DataCollectorLogEntity;
|
import cn.lihongjie.coal.dataCollectorLog.entity.DataCollectorLogEntity;
|
||||||
@@ -15,6 +16,7 @@ import cn.lihongjie.coal.weightDeviceData.service.WeightDeviceDataService;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
import io.vavr.control.Try;
|
import io.vavr.control.Try;
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ import org.springframework.amqp.rabbit.annotation.Exchange;
|
|||||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.convert.ConversionService;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -63,6 +66,9 @@ public class WeightListener {
|
|||||||
|
|
||||||
@Autowired WeightDeviceService weightDeviceService;
|
@Autowired WeightDeviceService weightDeviceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConversionService conversionService;
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@RabbitListener(
|
@RabbitListener(
|
||||||
bindings = {
|
bindings = {
|
||||||
@@ -142,6 +148,10 @@ public class WeightListener {
|
|||||||
case "weight20.weightinvalid" -> {
|
case "weight20.weightinvalid" -> {
|
||||||
handleWeightInvalid((ArrayNode) jsonNode, logEntity, device);
|
handleWeightInvalid((ArrayNode) jsonNode, logEntity, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "weight20.seqSync" -> {
|
||||||
|
seqSync( jsonNode, logEntity, device);
|
||||||
|
}
|
||||||
default -> {
|
default -> {
|
||||||
log.warn("unknown message type: {}", rk);
|
log.warn("unknown message type: {}", rk);
|
||||||
}
|
}
|
||||||
@@ -150,6 +160,45 @@ public class WeightListener {
|
|||||||
dataCollectorLogService.save(logEntity);
|
dataCollectorLogService.save(logEntity);
|
||||||
|
|
||||||
// log.info("new message from pms: {}", body);
|
// log.info("new message from pms: {}", body);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void seqSync(JsonNode jsonNode, DataCollectorLogEntity logEntity, WeightDeviceEntity device) {
|
||||||
|
|
||||||
|
|
||||||
|
ObjectNode node = (ObjectNode) jsonNode;
|
||||||
|
|
||||||
|
LocalDateTime start = conversionService.convert(node.get("start").asText(), LocalDateTime.class);
|
||||||
|
LocalDateTime end = conversionService.convert(node.get("end").asText(), LocalDateTime.class);
|
||||||
|
|
||||||
|
int[] seqs = objectMapper.convertValue(node.get("seqs"), int[].class);
|
||||||
|
|
||||||
|
node.remove("seqs");
|
||||||
|
|
||||||
|
if (start == null || end == null){
|
||||||
|
logEntity.setContent("start or end is null " + node.toPrettyString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (seqs == null){
|
||||||
|
logEntity.setContent("seqs is null " + node.toPrettyString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
seqs = IntsCompression.decompress(seqs);
|
||||||
|
|
||||||
|
|
||||||
|
log.info("seqs: {} {} {} ", start, end, seqs.length);
|
||||||
|
|
||||||
|
logEntity.setContent("seqs: " + seqs.length + " " + start + " " + end);
|
||||||
|
|
||||||
|
|
||||||
|
weightDeviceDataService.invalidate(start, end, seqs, device.getId());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleWeightInvalid(
|
private void handleWeightInvalid(
|
||||||
|
|||||||
@@ -71,7 +71,13 @@ public class DeviceDto extends OrgCommonDto {
|
|||||||
|
|
||||||
private String deviceStatus;
|
private String deviceStatus;
|
||||||
|
|
||||||
@JsonProperty("dReserve1") private Double dReserve1;
|
@DictTranslate(dictKey = DictCode.DEVICE_STATUS)
|
||||||
|
private String deviceStatusName;
|
||||||
|
|
||||||
|
@JsonProperty("dReserve1")
|
||||||
|
private Double dReserve1;
|
||||||
|
|
||||||
|
|
||||||
@JsonProperty("dReserve2") private Double dReserve2;
|
@JsonProperty("dReserve2") private Double dReserve2;
|
||||||
@JsonProperty("dReserve3") private Double dReserve3;
|
@JsonProperty("dReserve3") private Double dReserve3;
|
||||||
@JsonProperty("dReserve4") private Double dReserve4;
|
@JsonProperty("dReserve4") private Double dReserve4;
|
||||||
|
|||||||
@@ -40,6 +40,13 @@ public class DictionaryController extends BaseController {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/initDefault")
|
||||||
|
@SysLog(action = "初始化默认数据")
|
||||||
|
public Object initDefault() {
|
||||||
|
this.service.initDefault();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/tree")
|
@PostMapping("/tree")
|
||||||
public DictionaryTreeDto tree(@RequestBody DictTreeRequest dto) {
|
public DictionaryTreeDto tree(@RequestBody DictTreeRequest dto) {
|
||||||
return this.service.tree(dto);
|
return this.service.tree(dto);
|
||||||
|
|||||||
@@ -45,6 +45,14 @@ public class ScriptController extends BaseController {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/initFromResource")
|
||||||
|
@SysLog(action = "初始化")
|
||||||
|
public Object initFromResource() {
|
||||||
|
this.service.initFromResource();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public Page<ScriptDto> list(@RequestBody CommonQuery dto) {
|
public Page<ScriptDto> list(@RequestBody CommonQuery dto) {
|
||||||
return this.service.list(dto);
|
return this.service.list(dto);
|
||||||
|
|||||||
@@ -37,13 +37,20 @@ hour
|
|||||||
|
|
||||||
/** 过滤条件 */
|
/** 过滤条件 */
|
||||||
private String plateNo;
|
private String plateNo;
|
||||||
|
private List<String> plateNoList;
|
||||||
|
|
||||||
private String sendOrganization;
|
private String sendOrganization;
|
||||||
|
private List<String> sendOrganizationList;
|
||||||
private String receiveOrganization;
|
private String receiveOrganization;
|
||||||
|
private List<String> receiveOrganizationList;
|
||||||
private String goods;
|
private String goods;
|
||||||
|
private List<String> goodsList;
|
||||||
private String specification;
|
private String specification;
|
||||||
|
private List<String> specificationList;
|
||||||
private String mzUser;
|
private String mzUser;
|
||||||
|
private List<String> mzUserList;
|
||||||
private String pzUser;
|
private String pzUser;
|
||||||
|
private List<String> pzUserList;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class FieldInfo {
|
public static class FieldInfo {
|
||||||
|
|||||||
@@ -429,6 +429,37 @@ where 更新时间>='%s' and 更新时间<='%s'
|
|||||||
where += " and d.specification = :specification ";
|
where += " and d.specification = :specification ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getPlateNoList())) {
|
||||||
|
where += " and d.plate_no like :plateNoList ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getSendOrganizationList())) {
|
||||||
|
where += " and d.send_organization like :sendOrganizationList ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getReceiveOrganizationList())) {
|
||||||
|
where += " and d.receive_organization like :receiveOrganizationList ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getGoodsList())) {
|
||||||
|
where += " and d.goods like :goodsList ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getSpecificationList())) {
|
||||||
|
where += " and d.specification = :specificationList ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
where += " and ( d.invalid is null or not d.invalid ) ";
|
where += " and ( d.invalid is null or not d.invalid ) ";
|
||||||
where += " and ( d.finished is null or d.finished ) ";
|
where += " and ( d.finished is null or d.finished ) ";
|
||||||
|
|
||||||
@@ -503,6 +534,52 @@ where 更新时间>='%s' and 更新时间<='%s'
|
|||||||
countQuery.setParameter("specification", "%" + request.getSpecification() + "%");
|
countQuery.setParameter("specification", "%" + request.getSpecification() + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getPlateNoList())) {
|
||||||
|
selectQuery.setParameter("plateNoList", request.getPlateNoList());
|
||||||
|
countQuery.setParameter("plateNoList", request.getPlateNoList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getSendOrganizationList())) {
|
||||||
|
selectQuery.setParameter("sendOrganizationList", request.getSendOrganizationList());
|
||||||
|
countQuery.setParameter("sendOrganizationList", request.getSendOrganizationList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getReceiveOrganizationList())) {
|
||||||
|
selectQuery.setParameter("receiveOrganizationList", request.getReceiveOrganizationList());
|
||||||
|
countQuery.setParameter("receiveOrganizationList", request.getReceiveOrganizationList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getGoodsList())) {
|
||||||
|
selectQuery.setParameter("goodsList", request.getGoodsList());
|
||||||
|
countQuery.setParameter("goodsList", request.getGoodsList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getSpecificationList())) {
|
||||||
|
selectQuery.setParameter("specificationList", request.getSpecificationList());
|
||||||
|
countQuery.setParameter("specificationList", request.getSpecificationList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getMzUserList())){
|
||||||
|
selectQuery.setParameter("mzUserList", request.getMzUserList());
|
||||||
|
countQuery.setParameter("mzUserList", request.getMzUserList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(request.getPzUserList())){
|
||||||
|
selectQuery.setParameter("pzUserList", request.getPzUserList());
|
||||||
|
countQuery.setParameter("pzUserList", request.getPzUserList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var resultList = JpaUtils.convertTuplesToMap(selectQuery.getResultList());
|
var resultList = JpaUtils.convertTuplesToMap(selectQuery.getResultList());
|
||||||
|
|
||||||
var ans =
|
var ans =
|
||||||
@@ -529,4 +606,36 @@ where 更新时间>='%s' and 更新时间<='%s'
|
|||||||
PageRequest.of(0, request.getPageSize()),
|
PageRequest.of(0, request.getPageSize()),
|
||||||
Integer.parseInt(countQuery.getSingleResult().toString()));
|
Integer.parseInt(countQuery.getSingleResult().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int invalidate(LocalDateTime start, LocalDateTime end, int[] seqs, String id) {
|
||||||
|
|
||||||
|
int cnt =
|
||||||
|
em.createQuery(
|
||||||
|
"update WeightDeviceDataEntity d set d.invalid = true where d.sequenceNumber not in :ids and d.dataUpdateTime >= :start and d.dataUpdateTime <= :end and d.device.id = :id and d.archiveStatus = '0'")
|
||||||
|
.setParameter("ids", seqs)
|
||||||
|
.setParameter("start", start)
|
||||||
|
.setParameter("end", end)
|
||||||
|
.setParameter("id", id)
|
||||||
|
.executeUpdate();
|
||||||
|
|
||||||
|
log.info("invalidate {} records, start {} end {} deviceId {} seqsLen {} ", cnt, start, end, id, seqs.length);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int cnt2 =
|
||||||
|
em.createQuery(
|
||||||
|
"update WeightDeviceDataEntity d set d.invalid = false where d.sequenceNumber in :ids and d.dataUpdateTime >= :start and d.dataUpdateTime <= :end and d.device.id = :id and d.archiveStatus = '0'")
|
||||||
|
.setParameter("ids", seqs)
|
||||||
|
.setParameter("start", start)
|
||||||
|
.setParameter("end", end)
|
||||||
|
.setParameter("id", id)
|
||||||
|
.executeUpdate();
|
||||||
|
|
||||||
|
log.info("validate {} records, start {} end {} deviceId {} seqsLen {} ", cnt2, start, end, id, seqs.length);
|
||||||
|
|
||||||
|
return cnt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package scripts.dict
|
||||||
|
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.common.Ctx
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode
|
||||||
|
import jakarta.persistence.EntityManager
|
||||||
|
import org.springframework.context.ApplicationContext
|
||||||
|
|
||||||
|
ApplicationContext ioc = ioc
|
||||||
|
|
||||||
|
|
||||||
|
EntityManager em = ioc.getBean(EntityManager.class)
|
||||||
|
|
||||||
|
|
||||||
|
return em.createQuery("select distinct goods from WeightDeviceDataEntity where goods like :q and organizationId = :organizationId order by goods limit 10")
|
||||||
|
.setParameter("q", "%${(params as JsonNode).get("q").asText('')}%" as String)
|
||||||
|
.setParameter("organizationId", Ctx.currentUser().organizationId)
|
||||||
|
.resultList
|
||||||
|
.collect { it as String }
|
||||||
|
.sort()
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package scripts.dict
|
||||||
|
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.common.Ctx
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode
|
||||||
|
import jakarta.persistence.EntityManager
|
||||||
|
import org.springframework.context.ApplicationContext
|
||||||
|
|
||||||
|
ApplicationContext ioc = ioc
|
||||||
|
|
||||||
|
|
||||||
|
EntityManager em = ioc.getBean(EntityManager.class)
|
||||||
|
|
||||||
|
|
||||||
|
return em.createQuery("select distinct mzUser from WeightDeviceDataEntity where mzUser like :q and organizationId = :organizationId order by mzUser limit 10")
|
||||||
|
.setParameter("q", "%${(params as JsonNode).get("q").asText('')}%" as String)
|
||||||
|
.setParameter("organizationId", Ctx.currentUser().organizationId)
|
||||||
|
.resultList
|
||||||
|
.collect { it as String }
|
||||||
|
.sort()
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package scripts.dict
|
||||||
|
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.common.Ctx
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode
|
||||||
|
import jakarta.persistence.EntityManager
|
||||||
|
import org.springframework.context.ApplicationContext
|
||||||
|
|
||||||
|
ApplicationContext ioc = ioc
|
||||||
|
|
||||||
|
|
||||||
|
EntityManager em = ioc.getBean(EntityManager.class)
|
||||||
|
|
||||||
|
|
||||||
|
return em.createQuery("select distinct plateNo from WeightDeviceDataEntity where plateNo like :q and organizationId = :organizationId order by plateNo limit 10")
|
||||||
|
.setParameter("q", "%${(params as JsonNode).get("q").asText('')}%" as String)
|
||||||
|
.setParameter("organizationId", Ctx.currentUser().organizationId)
|
||||||
|
.resultList
|
||||||
|
.collect { it as String }
|
||||||
|
.sort()
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package scripts.dict
|
||||||
|
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.common.Ctx
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode
|
||||||
|
import jakarta.persistence.EntityManager
|
||||||
|
import org.springframework.context.ApplicationContext
|
||||||
|
|
||||||
|
ApplicationContext ioc = ioc
|
||||||
|
|
||||||
|
|
||||||
|
EntityManager em = ioc.getBean(EntityManager.class)
|
||||||
|
|
||||||
|
|
||||||
|
return em.createQuery("select distinct pzUser from WeightDeviceDataEntity where pzUser like :q and organizationId = :organizationId order by pzUser limit 10")
|
||||||
|
.setParameter("q", "%${(params as JsonNode).get("q").asText('')}%" as String)
|
||||||
|
.setParameter("organizationId", Ctx.currentUser().organizationId)
|
||||||
|
.resultList
|
||||||
|
.collect { it as String }
|
||||||
|
.sort()
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package scripts.dict
|
||||||
|
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.common.Ctx
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode
|
||||||
|
import jakarta.persistence.EntityManager
|
||||||
|
import org.springframework.context.ApplicationContext
|
||||||
|
|
||||||
|
ApplicationContext ioc = ioc
|
||||||
|
|
||||||
|
|
||||||
|
EntityManager em = ioc.getBean(EntityManager.class)
|
||||||
|
|
||||||
|
|
||||||
|
return em.createQuery("select distinct receiveOrganization from WeightDeviceDataEntity where receiveOrganization like :q and organizationId = :organizationId order by receiveOrganization limit 10")
|
||||||
|
.setParameter("q", "%${(params as JsonNode).get("q").asText('')}%" as String)
|
||||||
|
.setParameter("organizationId", Ctx.currentUser().organizationId)
|
||||||
|
.resultList
|
||||||
|
.collect { it as String }
|
||||||
|
.sort()
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package scripts.dict
|
||||||
|
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.common.Ctx
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode
|
||||||
|
import jakarta.persistence.EntityManager
|
||||||
|
import org.springframework.context.ApplicationContext
|
||||||
|
|
||||||
|
ApplicationContext ioc = ioc
|
||||||
|
|
||||||
|
|
||||||
|
EntityManager em = ioc.getBean(EntityManager.class)
|
||||||
|
|
||||||
|
|
||||||
|
return em.createQuery("select distinct sendOrganization from WeightDeviceDataEntity where sendOrganization like :q and organizationId = :organizationId order by sendOrganization limit 10")
|
||||||
|
.setParameter("q", "%${(params as JsonNode).get("q").asText('')}%" as String)
|
||||||
|
.setParameter("organizationId", Ctx.currentUser().organizationId)
|
||||||
|
.resultList
|
||||||
|
.collect { it as String }
|
||||||
|
.sort()
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package scripts.dict
|
||||||
|
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.common.Ctx
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode
|
||||||
|
import jakarta.persistence.EntityManager
|
||||||
|
import org.springframework.context.ApplicationContext
|
||||||
|
|
||||||
|
ApplicationContext ioc = ioc
|
||||||
|
|
||||||
|
|
||||||
|
EntityManager em = ioc.getBean(EntityManager.class)
|
||||||
|
|
||||||
|
|
||||||
|
return em.createQuery("select distinct specification from WeightDeviceDataEntity where specification like :q and organizationId = :organizationId order by specification limit 10")
|
||||||
|
.setParameter("q", "%${(params as JsonNode).get("q").asText('')}%" as String)
|
||||||
|
.setParameter("organizationId", Ctx.currentUser().organizationId)
|
||||||
|
.resultList
|
||||||
|
.collect { it as String }
|
||||||
|
.sort()
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user