|
@@ -100,6 +100,9 @@ public class IndexController {
|
|
|
@Resource
|
|
|
TLocationCheckService locationCheckService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ TGoodsDataService goodsDataService;
|
|
|
+
|
|
|
private static final String appid = "07784f5fedb508046c841b391005b7de";
|
|
|
|
|
|
@ApiOperation(value = "心跳")
|
|
@@ -692,6 +695,34 @@ public class IndexController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 添加商品
|
|
|
+ * @param id
|
|
|
+ * @param machineType
|
|
|
+ * @param number
|
|
|
+ */
|
|
|
+ private void saveProduct(Long id, String machineType, Integer number) {
|
|
|
+ LambdaQueryWrapper<TGoodsData> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(TGoodsData::getNumber, number);
|
|
|
+ wrapper.eq(TGoodsData::getMachineType, machineType);
|
|
|
+ TGoodsData goodsData = goodsDataService.getOne(wrapper);
|
|
|
+ String goods = goodsData.getGoods();
|
|
|
+ String[] str = goods.split(",");
|
|
|
+
|
|
|
+ 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 id
|
|
@@ -945,22 +976,28 @@ public class IndexController {
|
|
|
for (TProduct product : productList) {
|
|
|
productService.removeById(product.getId());
|
|
|
}
|
|
|
- //创建花型
|
|
|
- if (number.equals("18")) {
|
|
|
- saveProduct(id);
|
|
|
- }
|
|
|
- if (number.equals("22")) {
|
|
|
- saveProductMG22(id);
|
|
|
- }
|
|
|
- if (number.equals("26")) {
|
|
|
- saveProductMG26(id);
|
|
|
- }
|
|
|
- if (number.equals("30")) {
|
|
|
- saveProductMG1(id);
|
|
|
- }
|
|
|
- if (number.equals("42")) {
|
|
|
- saveProductMG42(id);
|
|
|
+ // 机器类型
|
|
|
+ String machineType = equipment.getMachineType();
|
|
|
+ if(StringUtils.isEmpty(equipment.getMachineType())) {
|
|
|
+ machineType = "0";
|
|
|
}
|
|
|
+ //创建花型
|
|
|
+ saveProduct(id, machineType, Integer.parseInt(number));
|
|
|
+// if (number.equals("18")) {
|
|
|
+// saveProduct(id);
|
|
|
+// }
|
|
|
+// if (number.equals("22")) {
|
|
|
+// saveProductMG22(id);
|
|
|
+// }
|
|
|
+// if (number.equals("26")) {
|
|
|
+// saveProductMG26(id);
|
|
|
+// }
|
|
|
+// if (number.equals("30")) {
|
|
|
+// saveProductMG1(id);
|
|
|
+// }
|
|
|
+// if (number.equals("42")) {
|
|
|
+// saveProductMG42(id);
|
|
|
+// }
|
|
|
return "success";
|
|
|
} else {
|
|
|
return "error";
|