|
@@ -19,6 +19,9 @@ import com.szwl.util.IDGenerator;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.amqp.core.AmqpAdmin;
|
|
|
+import org.springframework.amqp.core.Binding;
|
|
|
+import org.springframework.amqp.core.Queue;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -44,10 +47,13 @@ import java.util.stream.Collectors;
|
|
|
@Api(value = "/tEquipmentApply", tags = {"设备连接申请表"})
|
|
|
@RequestMapping("/tEquipmentApply")
|
|
|
public class TEquipmentApplyController {
|
|
|
+
|
|
|
@Autowired
|
|
|
TAdminService adminService;
|
|
|
+
|
|
|
@Autowired
|
|
|
TEquipmentApplyService equipmentApplyService;
|
|
|
+
|
|
|
@Autowired
|
|
|
TEquipmentService equipmentService;
|
|
|
|
|
@@ -56,11 +62,16 @@ public class TEquipmentApplyController {
|
|
|
|
|
|
@Autowired
|
|
|
TProportionService proportionService;
|
|
|
+
|
|
|
@Autowired
|
|
|
TEquipmentDescService equipmentDescService;
|
|
|
+
|
|
|
@Autowired
|
|
|
EsTEquipmentService esTEquipmentService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ AmqpAdmin amqpAdmin;
|
|
|
+
|
|
|
@ApiOperation(value = "查找机器审核列表")
|
|
|
@GetMapping("/pageTEquipmentApply")
|
|
|
public ResponseModel<IPage<?>> pageTEquipmentApply(String adminId, String clientId, String userName,String managerId,String statusType, long current, long size ) {
|
|
@@ -138,7 +149,7 @@ public class TEquipmentApplyController {
|
|
|
String adminUserName = equipmentApply.getAdminUserName();
|
|
|
Integer type = tAdmin.getType();
|
|
|
String gtClientId = equipmentApply.getGtClientId();
|
|
|
- String equimentType = equipmentApply.getEquimentType();
|
|
|
+ String equipmentType = equipmentApply.getEquimentType();
|
|
|
String machineType = equipmentApply.getMachineType();
|
|
|
String clientId1 = equipmentApply.getClientId();
|
|
|
//判断是否已经生成
|
|
@@ -170,7 +181,7 @@ public class TEquipmentApplyController {
|
|
|
equipment.setCompanyType(companyType);
|
|
|
// 设备类型
|
|
|
equipment.setMachineType(machineType);
|
|
|
- if(equimentType.equals("MG320-1")){
|
|
|
+ if(equipmentType.equals("MG320-1")){
|
|
|
if(!equipmentApply.getEquimentType().equals(equipment.getEquimentType())&&equipment.getEquimentType().equals("MG320")){
|
|
|
LambdaQueryWrapper<TProduct> queryProduct = Wrappers.lambdaQuery();
|
|
|
queryProduct.eq(TProduct::getEquipmentId,equipment.getId());
|
|
@@ -182,7 +193,7 @@ public class TEquipmentApplyController {
|
|
|
}
|
|
|
equipment.setEquimentType("MG320");
|
|
|
} else {
|
|
|
- equipment.setEquimentType(equimentType);
|
|
|
+ equipment.setEquimentType(equipmentType);
|
|
|
}
|
|
|
|
|
|
equipmentService.updateById(equipment);
|
|
@@ -245,12 +256,12 @@ public class TEquipmentApplyController {
|
|
|
equipment.setMachineType(machineType); // 设备类型
|
|
|
//设置默认规则
|
|
|
equipment.setTimeRuleId(1L);
|
|
|
- if(equimentType.equals("MG320-1")){
|
|
|
+ if(equipmentType.equals("MG320-1")){
|
|
|
equipment.setEquimentType("MG320");
|
|
|
}else {
|
|
|
- equipment.setEquimentType(equimentType);
|
|
|
+ equipment.setEquimentType(equipmentType);
|
|
|
}
|
|
|
- if(!StringUtils.isEmpty(equimentType)&&equimentType.equals("MG280")){
|
|
|
+ if(!StringUtils.isEmpty(equipmentType)&&equipmentType.equals("MG280")){
|
|
|
Long monthBegin = getMonthBegin(new Date());
|
|
|
long time = System.currentTimeMillis();
|
|
|
if(time<monthBegin){
|
|
@@ -275,13 +286,13 @@ public class TEquipmentApplyController {
|
|
|
}
|
|
|
//获取设备的id
|
|
|
Long equipmentId = equipment.getId();
|
|
|
- if(StringUtils.isNotEmpty(equimentType) && equimentType.equals("MG280")){
|
|
|
+ if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("MG280")){
|
|
|
saveProductMG280(equipmentId);
|
|
|
- } else if(StringUtils.isNotEmpty(equimentType) && equimentType.equals("MG320-1")){
|
|
|
+ } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("MG320-1")){
|
|
|
saveProductMG1(equipmentId);
|
|
|
- } else if(StringUtils.isNotEmpty(equimentType) && equimentType.equals("P30")){
|
|
|
+ } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("P30")){
|
|
|
saveProductP30(equipmentId);
|
|
|
- } else if(StringUtils.isNotEmpty(equimentType) && equimentType.equals("SI320")){
|
|
|
+ } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("SI320")){
|
|
|
saveProductSI320(equipmentId);
|
|
|
} else {
|
|
|
saveProduct(equipmentId);
|
|
@@ -289,6 +300,16 @@ public class TEquipmentApplyController {
|
|
|
LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
|
|
|
query1.eq(TEquipment::getClientId,clientId);
|
|
|
TEquipment tEquipment = equipmentService.getOne(query1);
|
|
|
+ // 删除MQ队列
|
|
|
+ amqpAdmin.deleteQueue(clientId);
|
|
|
+ // 重新创建队列
|
|
|
+ Map<String,Object> arg = new HashMap<>();
|
|
|
+ arg.put("x-message-ttl",1800000);
|
|
|
+ amqpAdmin.declareQueue(new Queue(clientId, true, false, false, arg));
|
|
|
+ HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
|
|
+ amqpAdmin.declareBinding(new Binding(clientId,
|
|
|
+ Binding.DestinationType.QUEUE,
|
|
|
+ equipmentType, clientId, objectObjectHashMap));
|
|
|
try {
|
|
|
if(tEquipment != null) {
|
|
|
esTEquipmentService.insertData(tEquipment);
|