|
@@ -135,9 +135,10 @@ public class TEquipmentApplyController {
|
|
|
String companyType = tAdmin.getCompanyType();
|
|
|
String adminLevel = equipmentApply.getAdminLevel();
|
|
|
String adminUserName = equipmentApply.getAdminUserName();
|
|
|
- Integer type = equipmentApply.getType();
|
|
|
+ Integer type = tAdmin.getType();
|
|
|
String gtClientId = equipmentApply.getGtClientId();
|
|
|
String equimentType = equipmentApply.getEquimentType();
|
|
|
+ String machineType = equipmentApply.getMachineType();
|
|
|
String clientId1 = equipmentApply.getClientId();
|
|
|
//判断是否已经生成
|
|
|
LambdaQueryWrapper<TEquipment> query3 = Wrappers.lambdaQuery();
|
|
@@ -167,8 +168,9 @@ public class TEquipmentApplyController {
|
|
|
equipment.setAdminLevel(adminLevel);
|
|
|
equipment.setAdminUserName(adminUserName);
|
|
|
equipment.setType(type);
|
|
|
- equipment.setCompanyType(companyType); //公司平台
|
|
|
- if(equipmentApply.getEquimentType().equals("MG320-1")){
|
|
|
+ equipment.setCompanyType(companyType); // 公司平台
|
|
|
+ equipment.setMachineType(machineType); // 设备类型
|
|
|
+ if(equimentType.equals("MG320-1")){
|
|
|
if(!equipmentApply.getEquimentType().equals(equipment.getEquimentType())&&equipment.getEquimentType().equals("MG320")){
|
|
|
// List<Filter> filter = new ArrayList<>();
|
|
|
// filter.add(Filter.eq("equipmentId", equipment.getId()));
|
|
@@ -184,10 +186,14 @@ public class TEquipmentApplyController {
|
|
|
// saveProductMG12(equipment.getId());
|
|
|
}
|
|
|
equipment.setEquimentType("MG320");
|
|
|
+ } else {
|
|
|
+ equipment.setEquimentType(equimentType);
|
|
|
}
|
|
|
- if(equipmentApply.getEquimentType().equals("MG330")){
|
|
|
- equipment.setEquimentType("MG330");
|
|
|
- }
|
|
|
+// if(equipmentApply.getEquimentType().equals("MG330")){
|
|
|
+// equipment.setEquimentType("MG330");
|
|
|
+// }
|
|
|
+// if(equipmentApply.getEquimentType().equals("POP320")) {
|
|
|
+// }
|
|
|
|
|
|
equipmentService.updateById(equipment);
|
|
|
LambdaQueryWrapper<TProportion> queryProportion = Wrappers.lambdaQuery();
|
|
@@ -204,8 +210,12 @@ public class TEquipmentApplyController {
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- equipmentService.sentMessage(equipmentApply.getClientId(),PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
- PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ if(StringUtils.isEmpty(machineType) || machineType.equals("0")) {
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ } else {
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ }
|
|
|
equipmentApplyService.updateById(equipmentApply);
|
|
|
if(equipment.getEndDate()!=null){
|
|
|
equipmentService.sentMessage(equipmentApply.getClientId(),PushUtils.buildJson("endDate",String.valueOf(equipment.getEndDate().getTime()) ).toString());
|
|
@@ -229,7 +239,8 @@ public class TEquipmentApplyController {
|
|
|
equipment.setChannel("1");
|
|
|
equipment.setProductTotal(0);
|
|
|
equipment.setType(type);
|
|
|
- equipment.setCompanyType(companyType); //公司平台
|
|
|
+ equipment.setCompanyType(companyType); // 公司平台
|
|
|
+ equipment.setMachineType(machineType); // 设备类型
|
|
|
//设置默认规则
|
|
|
equipment.setTimeRuleId(Long.valueOf(1));
|
|
|
if(equimentType.equals("MG320-1")){
|
|
@@ -237,9 +248,9 @@ public class TEquipmentApplyController {
|
|
|
}else {
|
|
|
equipment.setEquimentType(equimentType);
|
|
|
}
|
|
|
- if(equipmentApply.getEquimentType().equals("MG330")){
|
|
|
- equipment.setEquimentType("MG330");
|
|
|
- }
|
|
|
+// if(equipmentApply.getEquimentType().equals("MG330")){
|
|
|
+// equipment.setEquimentType("MG330");
|
|
|
+// }
|
|
|
if(!StringUtils.isEmpty(equimentType)&&equimentType.equals("MG280")){
|
|
|
Long monthBegin = getMonthBegin(new Date());
|
|
|
long time = new Date().getTime();
|
|
@@ -255,41 +266,54 @@ public class TEquipmentApplyController {
|
|
|
}
|
|
|
}
|
|
|
equipmentService.save(equipment);
|
|
|
- equipmentService.sentMessage(equipmentApply.getClientId(), PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
- PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ if(StringUtils.isEmpty(machineType) || machineType.equals("0")) {
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ } else {
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ }
|
|
|
//获取设备的id
|
|
|
Long equipmentId = equipment.getId();
|
|
|
- if(equipmentApply.getEquimentType()!=null&&equipmentApply.getEquimentType().equals("MG280")){
|
|
|
+ if(equimentType !=null && equimentType.equals("MG280")){
|
|
|
saveProductMG280(equipmentId);
|
|
|
- } else if(equipmentApply.getEquimentType()!=null&&equipmentApply.getEquimentType().equals("MG320-1")){
|
|
|
+ } else if(equimentType !=null&& equimentType.equals("MG320-1")){
|
|
|
saveProductMG1(equipmentId);
|
|
|
- } else{
|
|
|
- saveProduct(equipmentId);
|
|
|
+ } else if(equimentType !=null&& equimentType.equals("POP320")){
|
|
|
+ saveProductPOP320(equipmentId);
|
|
|
+ } else {
|
|
|
+ saveProduct(equipmentId);
|
|
|
}
|
|
|
LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
|
|
|
query1.eq(TEquipment::getClientId,clientId);
|
|
|
- List<TEquipment> list1 = equipmentService.list(query1);
|
|
|
+// List<TEquipment> list1 = equipmentService.list(query1);
|
|
|
+ TEquipment tEquipment = equipmentService.getOne(query1);
|
|
|
try {
|
|
|
- if(list1.size()>0){
|
|
|
- TEquipment tEquipment = list1.get(0);
|
|
|
+// if(list1.size()>0){
|
|
|
+// TEquipment tEquipment = list1.get(0);
|
|
|
+// esTEquipmentService.insertData(tEquipment);
|
|
|
+// }
|
|
|
+ if(tEquipment != null) {
|
|
|
esTEquipmentService.insertData(tEquipment);
|
|
|
}
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
TEquipmentDesc equipmentDesc = new TEquipmentDesc();
|
|
|
- equipmentDesc.setEquipmentId(list1.get(0).getId());
|
|
|
+ equipmentDesc.setEquipmentId(tEquipment.getId());
|
|
|
equipmentDescService.save(equipmentDesc);
|
|
|
|
|
|
} else if (status.equals("unAgreed")) {
|
|
|
equipmentApply.setModifyDate(new Date());
|
|
|
equipmentApply.setStatusType(2);
|
|
|
equipmentService.sentMessage(equipmentApply.getClientId(),PushUtils.buildJson("statusType", "rejected").toString());
|
|
|
- PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "拒绝", PushUtils.buildJson("statusType", "rejected").toString());
|
|
|
+ if(StringUtils.isEmpty(equipmentApply.getMachineType()) || equipmentApply.getMachineType().equals("0")) {
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "拒绝", PushUtils.buildJson("statusType", "rejected").toString());
|
|
|
+ } else {
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "拒绝", PushUtils.buildJson("statusType", "rejected").toString());
|
|
|
+ }
|
|
|
}
|
|
|
equipmentApplyService.updateById(equipmentApply);
|
|
|
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -409,6 +433,29 @@ public class TEquipmentApplyController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加爆米花产品
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ private void saveProductPOP320(Long id) {
|
|
|
+ String[] str = {"活力爆米花(正常糖)-B01", "活力爆米花(无糖)-B02", "活力爆米花(巧克力)-B03", "活力爆米花(焦糖)-B04", "活力爆米花(水蜜桃)-B05", "活力爆米花(蓝莓)-B06"};
|
|
|
+
|
|
|
+ for (int i = 0; i < str.length; i++) {
|
|
|
+ TProduct product = new TProduct();
|
|
|
+ product.setCreateDate(new Date());
|
|
|
+ product.setModifyDate(new Date());
|
|
|
+ product.setEquipmentId(id);
|
|
|
+ String[] split = str[i].split("-");
|
|
|
+ product.setProductName(split[0]);
|
|
|
+ product.setNo(split[1]);
|
|
|
+ product.setRmbPrice(BigDecimal.ZERO);
|
|
|
+ product.setCodePrice(BigDecimal.ZERO);
|
|
|
+ productService.save(product);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取指定日期所在月份开始的时间戳
|
|
|
* @param date 指定日期
|