|
@@ -143,6 +143,15 @@ public class IndexController { ;
|
|
|
if(StringUtils.isNotEmpty(equipmentVo.getStick())){
|
|
|
equipmentDesc.setStick(equipmentVo.getStick());
|
|
|
}
|
|
|
+ if(equipmentVo.getCupQuantity() != null){
|
|
|
+ equipmentDesc.setCupQuantity(equipmentVo.getCupQuantity());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(equipmentVo.getStirTm())){
|
|
|
+ equipmentDesc.setStirTm(equipmentVo.getStirTm());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(equipmentVo.getCornGeneratorTm())){
|
|
|
+ equipmentDesc.setCornGeneratorTm(equipmentVo.getCornGeneratorTm());
|
|
|
+ }
|
|
|
equipmentDescService.updateById(equipmentDesc);
|
|
|
// return JsonMessage.success("心跳成功");
|
|
|
return "心跳成功";
|
|
@@ -219,6 +228,9 @@ public class IndexController { ;
|
|
|
equipmentApply.setAdminId(adminId);
|
|
|
equipmentApply.setAdminUserName(username);
|
|
|
equipmentApply.setEquimentType(equimentType);
|
|
|
+ if(equimentType.equals("POP320")) {
|
|
|
+ machineType = "1";
|
|
|
+ }
|
|
|
equipmentApply.setMachineType(machineType);
|
|
|
equipmentApply.setCreateDate(new Date());
|
|
|
equipmentApply.setModifyDate(new Date());
|
|
@@ -307,6 +319,9 @@ public class IndexController { ;
|
|
|
if(equipmentApply.getEquimentType().equals("MG330")){
|
|
|
equipment.setEquimentType("MG330");
|
|
|
}
|
|
|
+ if(equipmentApply.getEquimentType().equals("POP320")) {
|
|
|
+ equipment.setEquimentType(equipmentApply.getEquimentType());
|
|
|
+ }
|
|
|
equipmentService.updateById(equipment);
|
|
|
LambdaQueryWrapper<TProportion> queryProportion = Wrappers.lambdaQuery();
|
|
|
queryProportion.eq(TProportion::getEquipmentId,equipment.getId());
|
|
@@ -325,8 +340,13 @@ public class IndexController { ;
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
- PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ if(StringUtils.isEmpty(machineType) || machineType.equals("0")) {
|
|
|
+ equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ } else {
|
|
|
+ equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ }
|
|
|
if(equipment.getEquimentType().equals("280")){
|
|
|
equipmentService.sentMessage(clientId,PushUtils.buildJson("endDate",String.valueOf(equipment.getEndDate().getTime()) ).toString());
|
|
|
PushUtils.push(equipmentApply.getGtClientId(), "", "", PushUtils.buildJson("endDate",String.valueOf(equipment.getEndDate().getTime()) ).toString());
|
|
@@ -357,12 +377,15 @@ public class IndexController { ;
|
|
|
}else {
|
|
|
equipment.setEquimentType(equimentType);
|
|
|
}
|
|
|
- if(equipmentApply.getEquimentType().equals("MG330")){
|
|
|
- equipment.setEquimentType("MG330");
|
|
|
- }
|
|
|
+// if(equimentType.equals("MG330")){
|
|
|
+// equipment.setEquimentType("MG330");
|
|
|
+// }
|
|
|
+// if(equimentType.equals("POP320")){
|
|
|
+// equipment.setEquimentType(equimentType);
|
|
|
+// }
|
|
|
if(!StringUtils.isEmpty(equimentType)&&equimentType.equals("MG280")){
|
|
|
Long monthBegin = getMonthBegin(new Date());
|
|
|
- long time = new Date().getTime();
|
|
|
+ long time = System.currentTimeMillis();
|
|
|
if(time<monthBegin){
|
|
|
equipment.setEndDate(new Date(monthBegin));
|
|
|
}else{
|
|
@@ -372,43 +395,58 @@ public class IndexController { ;
|
|
|
equipmentService.sentMessage(clientId,PushUtils.buildJson("endDate",String.valueOf(equipment.getEndDate().getTime()) ).toString());
|
|
|
PushUtils.push(equipmentApply.getGtClientId(), "", "", PushUtils.buildJson("endDate",String.valueOf(equipment.getEndDate().getTime()) ).toString());
|
|
|
}
|
|
|
+
|
|
|
equipmentService.save(equipment);
|
|
|
- equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
- PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ if(StringUtils.isEmpty(machineType) || machineType.equals("0")) {
|
|
|
+ equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ } else {
|
|
|
+ equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
|
|
|
+ }
|
|
|
// Equipment byClientId = equipmentService.findByClientId(equipment.getClientId());
|
|
|
// String data = com.alibaba.fastjson.JSON.toJSONString(byClientId);
|
|
|
LambdaQueryWrapper<TEquipment> query3 = Wrappers.lambdaQuery();
|
|
|
query3.eq(TEquipment::getClientId,clientId);
|
|
|
- List<TEquipment> list1 = equipmentService.list(query3);
|
|
|
+ TEquipment tEquipment = equipmentService.getOne(query3);
|
|
|
+// List<TEquipment> list1 = equipmentService.list(query3);
|
|
|
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);
|
|
|
}
|
|
|
//获取设备的id
|
|
|
// Long equipmentId = equipmentService.findByClientId(clientId).getId();
|
|
|
LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
|
|
|
query1.eq(TEquipment::getClientId,clientId);
|
|
|
- List<TEquipment> list1 = equipmentService.list(query1);
|
|
|
- Long equipmentId = list1.get(0).getId();
|
|
|
+// List<TEquipment> list1 = equipmentService.list(query1);
|
|
|
+ TEquipment equipment = equipmentService.getOne(query1);
|
|
|
+ Long equipmentId = equipment.getId();
|
|
|
// if (!productService.exists(Filter.eq("equipmentId", equipmentId))) {
|
|
|
- if (true) {
|
|
|
+ if(StringUtils.isEmpty(machineType) || machineType.equals("0")) {
|
|
|
if(equipmentApply.getEquimentType()!=null&&equipmentApply.getEquimentType().equals("MG280")){
|
|
|
saveProductMG280(equipmentId);
|
|
|
- }else if(equipmentApply.getEquimentType()!=null&&equipmentApply.getEquimentType().equals("MG320-1")){
|
|
|
+ } else if (equipmentApply.getEquimentType()!=null&&equipmentApply.getEquimentType().equals("MG320-1")){
|
|
|
saveProductMG1(equipmentId);
|
|
|
} else{
|
|
|
saveProduct(equipmentId);
|
|
|
}
|
|
|
-
|
|
|
+ } else {
|
|
|
+ if(equimentType.equals("POP320")) {
|
|
|
+ saveProductPOP320(equipmentId);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if(String.valueOf(adminId).equals("3")||String.valueOf(adminId).equals("31")||String.valueOf(adminId).equals("506")||String.valueOf(adminId).equals("1090")){
|
|
|
//自动设置分销
|
|
|
setProportion(adminId,equipmentId,clientId);
|
|
@@ -497,8 +535,7 @@ public class IndexController { ;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 添加产品
|
|
|
- *
|
|
|
+ * 添加棉花糖产品
|
|
|
* @param id
|
|
|
*/
|
|
|
private void saveProduct(Long id) {
|
|
@@ -608,11 +645,6 @@ public class IndexController { ;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 42种花型
|
|
|
- * @param id
|
|
|
- */
|
|
|
private void saveProductMG42(Long id) {
|
|
|
String[] str = {"玫瑰精灵-A01", "童心未泯-A02", "五彩缤纷-A03", "天雪恋舞-A04", "水中芙蓉-A05", "烈焰红唇-A06", "美梦成真-A07", "一见钟情-A08", "幽兰爱恋-A09",
|
|
|
"心之守护-A10", "夏日爱恋-A11", "冰美人-A12", "国色天香-A13", "赤子之心-A14", "海洋之心-A15", "水晶之恋-A16", "彩色精灵-A17", "小棉袄-A18",
|
|
@@ -635,6 +667,28 @@ public class IndexController { ;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 添加爆米花产品
|
|
|
+ * @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 指定日期
|
|
|
* @return
|