提交 6aa55e59 作者: xiaowang

修复bug

上级 2c2c5730
...@@ -17,6 +17,7 @@ import com.mmc.pms.service.lease.LeaseGoodsService; ...@@ -17,6 +17,7 @@ import com.mmc.pms.service.lease.LeaseGoodsService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -83,4 +84,12 @@ public class LeaseGoodsController extends BaseController { ...@@ -83,4 +84,12 @@ public class LeaseGoodsController extends BaseController {
@ApiParam(value = "商品id数组", required = true) @RequestBody List<Integer> list) { @ApiParam(value = "商品id数组", required = true) @RequestBody List<Integer> list) {
return leaseGoodsService.batchRemoveWareInfo(list); return leaseGoodsService.batchRemoveWareInfo(list);
} }
@ApiOperation(value = "feign-根据地址id查询是否有商品绑定")
@GetMapping("feignLeaseGoodsInfoByAddressId")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = LeaseGoodsVO.class)})
@ApiIgnore
public Integer feignLeaseGoodsInfoByAddressId(@RequestParam Integer id) {
return leaseGoodsService.feignLeaseGoodsInfoByAddressId(id);
}
} }
...@@ -31,4 +31,6 @@ public interface ProductAttributeDao { ...@@ -31,4 +31,6 @@ public interface ProductAttributeDao {
int updateProductAttribute(Integer id, Date createTime); int updateProductAttribute(Integer id, Date createTime);
int countLeaseGoodsByTypeId(Integer id); int countLeaseGoodsByTypeId(Integer id);
int countDeviceMode(Integer id);
} }
...@@ -71,4 +71,5 @@ public interface LeaseGoodsDao { ...@@ -71,4 +71,5 @@ public interface LeaseGoodsDao {
void removeWareInfo(List<Integer> list); void removeWareInfo(List<Integer> list);
Integer feignLeaseGoodsInfoByAddressId(Integer id);
} }
...@@ -49,7 +49,8 @@ public class ProductAttributeServiceImpl implements ProductAttributeService { ...@@ -49,7 +49,8 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
public ResultBody removeType(Integer id) { public ResultBody removeType(Integer id) {
// 判断该类型是否绑定产品信息 // 判断该类型是否绑定产品信息
int count = productAttributeDao.countLeaseGoodsByTypeId(id); int count = productAttributeDao.countLeaseGoodsByTypeId(id);
if (count > 0) { int deviceModeCount = productAttributeDao.countDeviceMode(id);
if (count > 0 || deviceModeCount > 0) {
return ResultBody.error(ResultEnum.TYPE_DELETE_FAIL); return ResultBody.error(ResultEnum.TYPE_DELETE_FAIL);
} }
productAttributeDao.removeType(id); productAttributeDao.removeType(id);
......
...@@ -26,4 +26,6 @@ public interface LeaseGoodsService { ...@@ -26,4 +26,6 @@ public interface LeaseGoodsService {
ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status); ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status);
ResultBody batchRemoveWareInfo(List<Integer> list); ResultBody batchRemoveWareInfo(List<Integer> list);
Integer feignLeaseGoodsInfoByAddressId(Integer id);
} }
...@@ -188,4 +188,9 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService { ...@@ -188,4 +188,9 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService {
leaseGoodsDao.removeWareInfo(list); leaseGoodsDao.removeWareInfo(list);
return ResultBody.success(); return ResultBody.success();
} }
@Override
public Integer feignLeaseGoodsInfoByAddressId(Integer id) {
return leaseGoodsDao.feignLeaseGoodsInfoByAddressId(id);
}
} }
...@@ -48,15 +48,17 @@ public class AppMallGoodsServiceImpl implements AppMallGoodsService { ...@@ -48,15 +48,17 @@ public class AppMallGoodsServiceImpl implements AppMallGoodsService {
@Override @Override
public ResultBody<GoodsListVO> brandStoreList(List<Integer> userAccountIds) { public ResultBody<GoodsListVO> brandStoreList(List<Integer> userAccountIds) {
List<GoodsListVO> goodsList = new ArrayList<>(); List<GoodsListVO> goodsList = new ArrayList<>();
List<MallGoodsDO> mallGoodsDOList = appMallGoodsDao.brandStoreList(userAccountIds); if (CollectionUtils.isNotEmpty(userAccountIds)){
List<MallGoodsVO> list = mallGoodsDOList.stream().map(MallGoodsDO::buildListMallGoodsVO).collect(Collectors.toList()); List<MallGoodsDO> mallGoodsDOList = appMallGoodsDao.brandStoreList(userAccountIds);
Map<Integer, List<MallGoodsVO>> map = list. List<MallGoodsVO> list = mallGoodsDOList.stream().map(MallGoodsDO::buildListMallGoodsVO).collect(Collectors.toList());
stream().collect(Collectors.groupingBy(MallGoodsVO::getUserAccountId)); Map<Integer, List<MallGoodsVO>> map = list.
for (Map.Entry<Integer, List<MallGoodsVO>> entry : map.entrySet()) { stream().collect(Collectors.groupingBy(MallGoodsVO::getUserAccountId));
GoodsListVO goodsListVO = new GoodsListVO(); for (Map.Entry<Integer, List<MallGoodsVO>> entry : map.entrySet()) {
goodsListVO.setUserAccountId(entry.getKey()); GoodsListVO goodsListVO = new GoodsListVO();
goodsListVO.setMallGoodsVOList(entry.getValue()); goodsListVO.setUserAccountId(entry.getKey());
goodsList.add(goodsListVO); goodsListVO.setMallGoodsVOList(entry.getValue());
goodsList.add(goodsListVO);
}
} }
return ResultBody.success(goodsList); return ResultBody.success(goodsList);
} }
......
...@@ -58,4 +58,7 @@ ...@@ -58,4 +58,7 @@
from lease_goods from lease_goods
where product_type_id = #{id} where product_type_id = #{id}
</select> </select>
<select id="countDeviceMode" resultType="java.lang.Integer">
select count(*) from device_mode where product_type_id = #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -410,4 +410,10 @@ ...@@ -410,4 +410,10 @@
</where> </where>
order by lg.shelf_status DESC, lg.sort DESC order by lg.shelf_status DESC, lg.sort DESC
</select> </select>
<select id="feignLeaseGoodsInfoByAddressId" resultType="java.lang.Integer">
select count(*)
from lease_goods
where ship_address = #{id}
or return_address = #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -33,4 +33,5 @@ data-filter: ...@@ -33,4 +33,5 @@ data-filter:
- /pms/company-inspection/listInspectionPriceUnit - /pms/company-inspection/listInspectionPriceUnit
- /pms/company-inspection/listAPPCompanyInspectionPage - /pms/company-inspection/listAPPCompanyInspectionPage
- /pms/company-inspection/getCompanyInspectionById - /pms/company-inspection/getCompanyInspectionById
- /pms/company-inspection/listInspectionPriceUnit - /pms/company-inspection/listInspectionPriceUnit
\ No newline at end of file - /pms/lease/goods/feignLeaseGoodsInfoByAddressId
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论