Commit 3f8ceac7 authored by 喻训浩's avatar 喻训浩

fix:启动修改

parent 0b2e127a
......@@ -37,11 +37,11 @@
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- base -->
<dependency>
<groupId>net.vtstar</groupId>
<artifactId>user-spring-boot-starter</artifactId>
<version>0.0.1-mysql-SNAPSHOT</version>
</dependency>
<!--<dependency>-->
<!--<groupId>net.vtstar</groupId>-->
<!--<artifactId>user-spring-boot-starter</artifactId>-->
<!--<version>0.0.1-mysql-SNAPSHOT</version>-->
<!--</dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
......
......@@ -3,7 +3,9 @@ package net.vtstar.zhongtong.avi.equipment.service;
import net.vtstar.zhongtong.avi.stamping.domain.LaserCuttingMachine;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
......@@ -11,6 +13,14 @@ public class EquipmentService {
public <T> T findRealTimeData() {
List<LaserCuttingMachine> ma = new ArrayList<>();
LaserCuttingMachine machine = new LaserCuttingMachine();
machine.setBeginTime(new Date());
machine.setAlias("设备1");
machine.setEquipCode("511111");
machine.setCuttingSpeed(new BigDecimal(555));
machine.setGasPressure(new BigDecimal(477));
machine.setLaserPower(new BigDecimal(77777));
ma.add(machine);
return (T) ma;
}
}
......@@ -5,7 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import net.vtstar.user.search.Search;
import net.vtstar.user.util.ReadAnnotationUtils;
import net.vtstar.zhongtong.avi.global.web.Show;
import net.vtstar.zhongtong.avi.global.web.domain.ShowFiled;
import net.vtstar.zhongtong.avi.global.web.domain.ShowField;
import org.springframework.cache.Cache;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
......@@ -39,10 +39,10 @@ public class WebFiledListener implements ApplicationListener<ContextRefreshedEve
if (StringUtils.isEmpty(clazzAnnotation.code())) {
log.error("{} 类@Search注解code属性未赋值!", clazz);
}
List<ShowFiled> showFileds = new ArrayList<>();
List<ShowField> showFileds = new ArrayList<>();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
ShowFiled showFiled = new ShowFiled();
ShowField showFiled = new ShowField();
Show annotation = field.getAnnotation(Show.class);
if (null == annotation) {
continue;
......
package net.vtstar.zhongtong.avi.global.web.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.vtstar.utils.domain.Return;
import net.vtstar.zhongtong.avi.global.web.service.ShowFieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@Api(description = "获得展示字段")
@RequestMapping("/api/field")
@RestController
public class ShowFieldController {
@Autowired
private ShowFieldService showFieldService;
@ApiOperation(value = "根据searchCode获得此模块需要展示字段")
@GetMapping("/showField")
private Return findShowFieldBySearchCode(@RequestParam("searchCode") String searchCode) {
return Return.success(showFieldService.findShowFieldBySearchCode(searchCode));
}
}
......@@ -6,11 +6,14 @@ import lombok.Data;
@Data
@ApiModel("前端展示字段")
public class ShowFiled {
public class ShowField {
@ApiModelProperty("字段值")
private String value;
@ApiModelProperty("标签名")
private String label;
@ApiModelProperty("是否排序")
private boolean sortable;
}
package net.vtstar.zhongtong.avi.global.web.service;
import net.vtstar.zhongtong.avi.global.web.domain.ShowField;
import org.springframework.cache.Cache;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class ShowFieldService {
@Resource(name = "showFieldCache")
private Cache showFieldCache;
public List<ShowField> findShowFieldBySearchCode(String searchCode) {
List<ShowField> showFields = showFieldCache.get(searchCode, ArrayList<ShowField>::new);
return showFields;
}
}
......@@ -8,6 +8,7 @@ import net.vtstar.user.search.Search;
import net.vtstar.zhongtong.avi.global.web.Show;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Search(code = "LASER")
......@@ -29,5 +30,12 @@ public class LaserCuttingMachine extends EquipmentData {
@ApiModelProperty("气体压力")
private BigDecimal gasPressure;
private Integer state;
@Search
@Show(label = "时间")
@ApiModelProperty("气体压力")
private Date createTime;
private String state;
}
......@@ -28,7 +28,6 @@ public class LaserCuttingMachineJob extends GatherJob {
protected boolean handleObject(EquipmentData equipmentData) {
LaserCuttingMachine data = (LaserCuttingMachine) equipmentData;
Integer state = data.getState();
return false;
}
}
spring.profiles.include=datasource,mybatis,quartz,swagger,security,mqtt
spring.profiles.include=datasource,mybatis,quartz,swagger,security
# Mysql
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
......
......@@ -29,7 +29,8 @@ auth.path-permit-all.method-get=/,\
/**/*.woff,\
/**/*.wav,\
/**/*.gif
auth.path-permit-all.method-all=/auth/**,\
auth.path-permit-all.method-all=/**/**,\
/auth/**,\
/webjars/**/*,\
/v2/api-docs,\
/swagger-ui.html,\
......
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