Parcourir la source

修复店铺关注个人用户无法取消的BUG

hubert il y a 7 ans
Parent
commit
045fff7de6

+ 1 - 1
src/main/java/com/uas/platform/b2c/trade/presale/controller/StoreFocusController.java

@@ -58,7 +58,7 @@ public class StoreFocusController {
 	 */
 	@RequestMapping(value = "/delete", method = RequestMethod.POST)
 	@ApiOperation(value = "单个/批量删除店铺关注记录", httpMethod = "POST")
-	public String deleteByIds(@ApiParam(required = true, value = "id集合") @RequestBody List<Long> ids) {
+	public String deleteByIds(@ApiParam(required = true, value = "id集合") @RequestBody List<Long> ids ) {
 		return storeFocusService.deleteByIds(ids);
 	}
 

+ 15 - 5
src/main/java/com/uas/platform/b2c/trade/presale/service/impl/StoreFocusServiceImpl.java

@@ -71,17 +71,27 @@ public class StoreFocusServiceImpl implements StoreFocusService {
 		int count = 0;
 		while (it.hasNext()) {
 			Long id = (Long) it.next();
-			List<StoreFocus> list = storeFocusDao.findStoreFocusByUseruuAndEnuuAndStoreid(
-					SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(), id);
-			if (list.size()>0){
-				storeFocusDao.delete(list.get(0).getId());
-				count++;
+			if (SystemSession.getUser().getEnterprise() == null) {
+				List<StoreFocus> list = storeFocusDao.findFocusByUseruuAndDissociativeAndStoreid(
+						SystemSession.getUser().getUserUU(), Type.PERSONAL.value(), id);
+				if (list.size()>0){
+					storeFocusDao.delete(list.get(0).getId());
+					count++;
+				}
+			} else {
+				List<StoreFocus> list = storeFocusDao.findStoreFocusByUseruuAndEnuuAndStoreid(
+						SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(), id);
+				if (list.size()>0){
+					storeFocusDao.delete(list.get(0).getId());
+					count++;
+				}
 			}
 		}
 		System.out.println("删除的条数" + count);
 		return "success";
 	}
 
+
 	@Override
 	public Page<StoreFocus> getPageStoreFocus(final PageInfo info) {
 		if (SystemSession.getUser().getEnterprise() != null) {