提交 73fb185a 作者: xiaowang

bug修复

上级 1fcda567
package com.mmc.pms.controller.lease;
/**
* @Author LW
* @date 2023/8/4 10:35
* 概要:
*/
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.controller.BaseController;
import com.mmc.pms.model.lease.qo.LeaseGoodsQO;
import com.mmc.pms.model.lease.vo.LeaseGoodsVO;
import com.mmc.pms.service.lease.LeaseGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @Author LW
* @date 2023/7/24 16:56 概要:
*/
@RestController
@RequestMapping("/app/lease/")
@Api(tags = {"V1.0.3-小程序-租赁商品-相关接口"})
public class AppGoodsController extends BaseController {
@Resource
LeaseGoodsService leaseGoodsService;
@ApiOperation(value = "租赁商品详情")
@GetMapping("leaseGoodsDetails")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = LeaseGoodsVO.class)})
public ResultBody<LeaseGoodsVO> leaseGoodsDetails(@RequestParam Integer id) {
return leaseGoodsService.leaseGoodsDetails(id);
}
@ApiOperation(value = "租赁商品列表")
@PostMapping("leaseGoodsList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = LeaseGoodsVO.class)})
public ResultBody leaseGoodsList(@RequestBody LeaseGoodsQO param) {
return leaseGoodsService.leaseGoodsList(param, null);
}
}
......@@ -107,6 +107,10 @@ public class LeaseGoodsDO implements Serializable {
private List<LeaseGoodsResourcesDO> leaseGoodsResources;
// 规格排列组合
private List<LeasePriceStockDO> priceStockList;
private String modeOfDeliveryInfo;
private String brandName;
private String productTypeName;
private String deviceModeName;
/**
* 辅助字段end
......@@ -134,10 +138,10 @@ public class LeaseGoodsDO implements Serializable {
}
public LeaseGoodsVO buildLeaseGoodsVO() {
return LeaseGoodsVO.builder().id(id).tradeName(tradeName).showPrice(showPrice)
.sellingPoint(sellingPoint).level(level).shelfStatus(shelfStatus)
.productTypeId(productTypeId).brandInfoId(brandInfoId).deviceModeId(deviceModeId)
.productParam(productParam).productDetails(productDetails).minLeaseTerm(minLeaseTerm)
return LeaseGoodsVO.builder().id(id).tradeName(tradeName).showPrice(showPrice).deviceModeName(deviceModeName)
.sellingPoint(sellingPoint).level(level).shelfStatus(shelfStatus).modeOfDeliveryInfo(modeOfDeliveryInfo)
.productTypeId(productTypeId).brandInfoId(brandInfoId).deviceModeId(deviceModeId).brandName(brandName)
.productParam(productParam).productDetails(productDetails).minLeaseTerm(minLeaseTerm).productTypeName(productTypeName)
.maxLeaseTerm(maxLeaseTerm).shipAddress(shipAddress).returnAddress(returnAddress)
.logisticsCompany(logisticsCompany).modeOfDelivery(modeOfDelivery).createTime(createTime)
.userAccountId(userAccountId).resourcesList(CollectionUtils.isEmpty(leaseGoodsResources)
......
......@@ -117,4 +117,17 @@ public class LeaseGoodsVO implements Serializable {
@ApiModelProperty(value = "市code编码")
private String districtCode;
@ApiModelProperty(value = "类型名称", hidden = true)
private String productTypeName;
@ApiModelProperty(value = "品牌名称", hidden = true)
private String brandName;
@ApiModelProperty(value = "型号名称", hidden = true)
private String deviceModeName;
@ApiModelProperty(value = "配送方式信息", hidden = true)
private String modeOfDeliveryInfo;
}
......@@ -4,7 +4,6 @@ import com.mmc.pms.auth.dto.LoginSuccessDTO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.dao.lease.LeaseGoodsDao;
import com.mmc.pms.entity.lease.*;
import com.mmc.pms.enums.UserTypeEnums;
import com.mmc.pms.model.lease.qo.LeaseGoodsQO;
import com.mmc.pms.model.lease.vo.LeaseGoodsVO;
import com.mmc.pms.model.lease.vo.LeasePartsListVO;
......@@ -118,17 +117,14 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService {
@Override
public ResultBody leaseGoodsList(LeaseGoodsQO param, LoginSuccessDTO loginSuccessDTO) {
if (loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) {
// 超级管理员获取所有商品信息
if (loginSuccessDTO == null || loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) {
// 小程序和超级管理员获取所有商品信息
return ResultBody.success(getLeaseGoodsInfo(param));
} else if (!loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) {
} else {
// 非超级管理员获取自家的商品信息
param.setUserAccountId(loginSuccessDTO.getUserAccountId());
return ResultBody.success(getLeaseGoodsInfo(param));
} else if (loginSuccessDTO.getPortType().equals(UserTypeEnums.APP.getType())) {
return ResultBody.success(getLeaseGoodsInfo(param));
}
return ResultBody.success();
}
private PageResult getLeaseGoodsInfo(LeaseGoodsQO param) {
......@@ -140,7 +136,8 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService {
param.buildCurrentPage();
List<LeaseGoodsDO> leaseGoodsDOList = leaseGoodsDao.listLeaseGoods(param);
// 转成vo
List<LeaseGoodsVO> leaseGoodsVOList = leaseGoodsDOList.stream().map(LeaseGoodsDO::buildLeaseGoodsVO).collect(Collectors.toList());
List<LeaseGoodsVO> leaseGoodsVOList = leaseGoodsDOList.stream().map(LeaseGoodsDO::buildLeaseGoodsVO)
.skip(param.getPageNo()).limit(param.getPageSize()).collect(Collectors.toList());
leaseGoodsVOList = leaseGoodsVOList.stream().peek(d -> {
// 获取最低押金及最高押金
List<LeasePriceStockVO> list = d.getPriceStock().stream().sorted(Comparator.comparing(LeasePriceStockVO::getCashPledge)).collect(Collectors.toList());
......
......@@ -218,28 +218,36 @@
from lease_term_info
</select>
<select id="getLeaseGoodsBaseInfo" resultType="com.mmc.pms.entity.lease.LeaseGoodsDO">
select id,
trade_name,
selling_point,
`level`,
shelf_status,
product_type_id,
brand_info_id,
device_mode_id,
product_param,
product_details,
min_lease_term,
max_lease_term,
ship_address,
return_address,
logistics_company,
mode_of_delivery,
user_account_id,
create_time,
show_price,
sort
from lease_goods
where id = #{id}
SELECT lg.id,
lg.trade_name,
lg.selling_point,
lg.`level`,
lg.shelf_status,
lg.product_type_id,
lg.brand_info_id,
lg.device_mode_id,
lg.product_param,
lg.product_details,
lg.min_lease_term,
lg.max_lease_term,
lg.ship_address,
lg.return_address,
lg.logistics_company,
lg.mode_of_delivery,
lg.user_account_id,
lg.create_time,
lg.show_price,
lg.sort,
bi.brand_name brandName,
pt.`name` productTypeName,
dm.model_name deviceModeName,
ss.service_name modeOfDeliveryInfo
FROM lease_goods lg
LEFT JOIN sale_service ss ON lg.mode_of_delivery = ss.id
LEFT JOIN brand_info bi ON bi.id = lg.brand_info_id
LEFT JOIN product_type pt ON pt.id = lg.product_type_id
LEFT JOIN device_mode dm ON dm.id = lg.device_mode_id
WHERE lg.id = #{id}
</select>
<select id="getLeaseGoodsResources" resultType="com.mmc.pms.entity.lease.LeaseGoodsResourcesDO">
SELECT id,
......@@ -397,6 +405,5 @@
</if>
</where>
order by lg.shelf_status DESC, lg.sort DESC
limit #{pageNo},#{pageSize}
</select>
</mapper>
\ No newline at end of file
......@@ -22,4 +22,6 @@ data-filter:
- /pms/category/appCategoryInfo
- /pms/app/goods/queryBrandGoods
- /pms/app/goods/queryGoodsInfoByCategorySub
- /pms/mall/goods/feignRemoveGoodsByBackUserAccountId
\ No newline at end of file
- /pms/mall/goods/feignRemoveGoodsByBackUserAccountId
- /pms/app/lease/leaseGoodsDetails
- /pms/app/lease/leaseGoodsList
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论