|
@@ -92,6 +92,9 @@ public class IndexController {
|
|
TDiyFlowerService diyFlowerService;
|
|
TDiyFlowerService diyFlowerService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ TNameDictionaryService nameDictionaryService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private AmqpAdmin amqpAdmin;
|
|
private AmqpAdmin amqpAdmin;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
@@ -971,11 +974,11 @@ public class IndexController {
|
|
@RequestMapping(value = "/updateProduct.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
|
|
@RequestMapping(value = "/updateProduct.htm", method = RequestMethod.POST, produces = "text/html;charset=utf-8")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String updateProduct(@RequestBody List<ProductVo> productVos) {
|
|
public String updateProduct(@RequestBody List<ProductVo> productVos) {
|
|
- Double f = 0.00;
|
|
|
|
- int num = 0;
|
|
|
|
- int n = 0;
|
|
|
|
- HashSet<Double> price = new HashSet<Double>();
|
|
|
|
- HashSet<Double> minprice = new HashSet<Double>();
|
|
|
|
|
|
+// Double f = 0.00;
|
|
|
|
+// int num = 0;
|
|
|
|
+// int n = 0;
|
|
|
|
+// HashSet<Double> price = new HashSet<Double>();
|
|
|
|
+// HashSet<Double> minprice = new HashSet<Double>();
|
|
for (ProductVo product : productVos) {
|
|
for (ProductVo product : productVos) {
|
|
String clientId = product.getClientId();
|
|
String clientId = product.getClientId();
|
|
LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
|
|
@@ -984,22 +987,43 @@ public class IndexController {
|
|
Long id = equipment.getId();
|
|
Long id = equipment.getId();
|
|
if (StringUtils.isNotEmpty(product.getShowType())) {
|
|
if (StringUtils.isNotEmpty(product.getShowType())) {
|
|
LambdaQueryWrapper<TProduct> queryProduct = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<TProduct> queryProduct = Wrappers.lambdaQuery();
|
|
- queryProduct.eq(TProduct::getEquipmentId, equipment.getId());
|
|
|
|
|
|
+ queryProduct.eq(TProduct::getEquipmentId, id);
|
|
queryProduct.eq(TProduct::getProductName, product.getProductName());
|
|
queryProduct.eq(TProduct::getProductName, product.getProductName());
|
|
- List<TProduct> productList = productService.list(queryProduct);
|
|
|
|
- TProduct tProduct = productList.get(0);
|
|
|
|
|
|
+// List<TProduct> productList = productService.list(queryProduct);
|
|
|
|
+// TProduct tProduct = productList.get(0);
|
|
|
|
+ TProduct tProduct = productService.getOnly(queryProduct);
|
|
|
|
+ if (tProduct == null) {
|
|
|
|
+ LambdaQueryWrapper<TNameDictionary> wrapper = Wrappers.lambdaQuery();
|
|
|
|
+ wrapper.eq(TNameDictionary::getLanguage, "zh");
|
|
|
|
+ wrapper.eq(TNameDictionary::getName, product.getProductName());
|
|
|
|
+ TNameDictionary nameDictionary = nameDictionaryService.getOne(wrapper);
|
|
|
|
+ LambdaQueryWrapper<TProduct> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ queryWrapper.eq(TProduct::getEquipmentId, id);
|
|
|
|
+ queryWrapper.eq(TProduct::getNo, nameDictionary.getNo());
|
|
|
|
+ tProduct = productService.getOnly(queryWrapper);
|
|
|
|
+ }
|
|
tProduct.setRmbPrice(BigDecimal.valueOf(product.getRmbPrice()));
|
|
tProduct.setRmbPrice(BigDecimal.valueOf(product.getRmbPrice()));
|
|
tProduct.setCodePrice(BigDecimal.valueOf(product.getCodePrice()));
|
|
tProduct.setCodePrice(BigDecimal.valueOf(product.getCodePrice()));
|
|
tProduct.setShowType(product.getShowType());
|
|
tProduct.setShowType(product.getShowType());
|
|
tProduct.setSellStatus(product.getSellStatus());
|
|
tProduct.setSellStatus(product.getSellStatus());
|
|
productService.updateById(tProduct);
|
|
productService.updateById(tProduct);
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
LambdaQueryWrapper<TProduct> queryProduct = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<TProduct> queryProduct = Wrappers.lambdaQuery();
|
|
- queryProduct.eq(TProduct::getEquipmentId, equipment.getId());
|
|
|
|
|
|
+ queryProduct.eq(TProduct::getEquipmentId, id);
|
|
queryProduct.eq(TProduct::getProductName, product.getProductName());
|
|
queryProduct.eq(TProduct::getProductName, product.getProductName());
|
|
- List<TProduct> productList = productService.list(queryProduct);
|
|
|
|
- TProduct tProduct = productList.get(0);
|
|
|
|
|
|
+// List<TProduct> productList = productService.list(queryProduct);
|
|
|
|
+// TProduct tProduct = productList.get(0);
|
|
|
|
+ TProduct tProduct = productService.getOnly(queryProduct);
|
|
|
|
+ if (tProduct == null) {
|
|
|
|
+ LambdaQueryWrapper<TNameDictionary> wrapper = Wrappers.lambdaQuery();
|
|
|
|
+ wrapper.eq(TNameDictionary::getLanguage, "zh");
|
|
|
|
+ wrapper.eq(TNameDictionary::getName, product.getProductName());
|
|
|
|
+ TNameDictionary nameDictionary = nameDictionaryService.getOne(wrapper);
|
|
|
|
+ LambdaQueryWrapper<TProduct> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ queryWrapper.eq(TProduct::getEquipmentId, id);
|
|
|
|
+ queryWrapper.eq(TProduct::getNo, nameDictionary.getNo());
|
|
|
|
+ tProduct = productService.getOnly(queryWrapper);
|
|
|
|
+ }
|
|
tProduct.setRmbPrice(BigDecimal.valueOf(product.getRmbPrice()));
|
|
tProduct.setRmbPrice(BigDecimal.valueOf(product.getRmbPrice()));
|
|
tProduct.setCodePrice(BigDecimal.valueOf(product.getCodePrice()));
|
|
tProduct.setCodePrice(BigDecimal.valueOf(product.getCodePrice()));
|
|
tProduct.setSellStatus(product.getSellStatus());
|
|
tProduct.setSellStatus(product.getSellStatus());
|
|
@@ -2209,8 +2233,28 @@ public class IndexController {
|
|
return "fail";
|
|
return "fail";
|
|
}
|
|
}
|
|
TEquipmentDesc equipmentDesc = equipmentDescService.getById(equipment.getId());
|
|
TEquipmentDesc equipmentDesc = equipmentDescService.getById(equipment.getId());
|
|
- equipmentDesc.setLanguage(language);
|
|
|
|
- equipmentDescService.updateById(equipmentDesc);
|
|
|
|
|
|
+ if (equipmentDesc.getLanguage() == null || !(equipmentDesc.getLanguage().equals(language))) {
|
|
|
|
+ equipmentDesc.setLanguage(language);
|
|
|
|
+ equipmentDescService.updateById(equipmentDesc);
|
|
|
|
+ LambdaQueryWrapper<TProduct> wrapper = Wrappers.lambdaQuery();
|
|
|
|
+ wrapper.eq(TProduct::getEquipmentId, equipment.getId());
|
|
|
|
+ List<TProduct> products = productService.list(wrapper);
|
|
|
|
+ for (TProduct product : products) {
|
|
|
|
+ String no = product.getNo();
|
|
|
|
+ // 如果没改过名才更改
|
|
|
|
+ if (StringUtils.isEmpty(product.getName())) {
|
|
|
|
+ LambdaQueryWrapper<TNameDictionary> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ lambdaQueryWrapper.eq(TNameDictionary::getLanguage, language);
|
|
|
|
+ lambdaQueryWrapper.eq(TNameDictionary::getNo, no);
|
|
|
|
+ TNameDictionary nameDictionary = nameDictionaryService.getOne(lambdaQueryWrapper);
|
|
|
|
+ if (nameDictionary != null) {
|
|
|
|
+ product.setModifyDate(new Date());
|
|
|
|
+ product.setProductName(nameDictionary.getName());
|
|
|
|
+ productService.updateById(product);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return "success";
|
|
return "success";
|
|
}
|
|
}
|
|
return "fail";
|
|
return "fail";
|