提交 6aa55e59 作者: xiaowang

修复bug

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