review-list: 二级类目,散户端;回收端确认回收todo

master
jevononlie 6 months ago
parent fe6fbda463
commit 7021b2864e

@ -113,6 +113,7 @@ public class CommonUtil {
public static <T> List<T> getChildrenList(String parentId, List<T> dataList) {
List<T> voList = new ArrayList<>();
dataList.forEach(v -> {
if(v != null) {
String pid = (String) obtainField(v, "parentId");
if (Objects.equals(pid, parentId)) {
String id = (String) obtainField(v, "id");
@ -120,6 +121,27 @@ public class CommonUtil {
assignField(v, "children", children);
voList.add(v);
}
}
});
return voList;
}
/**
*
* @param parentId
* @param dataList
* @return
*/
public static <T> List<T> getChildrenList2(String parentId, List<T> dataList) {
List<T> voList = new ArrayList<>();
dataList.forEach(v -> {
String pid = (String) obtainField(v, "parentId");
if (Objects.equals(pid, parentId)) {
String id = (String) obtainField(v, "id");
List<T> children = getChildrenList2(id, dataList);
assignField(v, "children", children);
voList.add(v);
}
});
return voList;
}

@ -66,6 +66,22 @@ public class RecycleStationController {
}
@ApiOperation("回收站详情")
@GetMapping("/info2")
public CommonResult<RecycleStationRespVO> stationInfo2(@RequestParam("stationId") String stationId, @Valid LocationDTO location) {
RecycleStation station = recycleStationService.getStationById(stationId);
RecycleStationRespVO recycleStationRespVO = BeanUtils.copyBean(station, RecycleStationRespVO.class);
if (ObjectUtil.isNotEmpty(station)) {
recycleStationRespVO = BeanUtils.copyBean(station, RecycleStationRespVO.class);
List<ProductRespVO> productList = recycleStationService.getStationProduct(station.getId());
List<ProductRespVO> productTreeList = CommonUtil.getChildrenList(null, productList);
recycleStationRespVO.setStationProducts(productTreeList);
this.computeStationDistance(recycleStationRespVO, location);
}
return CommonResult.success(recycleStationRespVO);
}
@ApiOperation("回收站详情")
@GetMapping("/info")
public CommonResult<RecycleStationRespVO> stationInfo(@RequestParam("stationId") String stationId, @Valid LocationDTO location) {
@ -73,7 +89,7 @@ public class RecycleStationController {
RecycleStationRespVO recycleStationRespVO = BeanUtils.copyBean(station, RecycleStationRespVO.class);
if (ObjectUtil.isNotEmpty(station)) {
recycleStationRespVO = BeanUtils.copyBean(station, RecycleStationRespVO.class);
List<ProductRespVO> productList = recycleStationService.getStationProduct(station.getId());
List<ProductRespVO> productList = recycleStationService.getStationProductAllByStationId(station.getId());
List<ProductRespVO> productTreeList = CommonUtil.getChildrenList(null, productList);
recycleStationRespVO.setStationProducts(productTreeList);
this.computeStationDistance(recycleStationRespVO, location);
@ -85,12 +101,11 @@ public class RecycleStationController {
@ApiOperation("回收站废品价格类目")
@GetMapping("/price-product")
public CommonResult<List<ProductRespVO>> stationProduct(@RequestParam("stationId") String stationId) {
List<ProductRespVO> productList = recycleStationService.getStationProduct(stationId);
List<ProductRespVO> productList = recycleStationService.getStationProductAllByStationId(stationId);
List<ProductRespVO> productTreeList = CommonUtil.getChildrenList(null, productList);
return CommonResult.success(productTreeList);
}
@ApiOperation("附近的回收站")
@GetMapping("/nearby")
public CommonResult<RecycleStationRespVO> stationNearby(@Valid LocationDTO location) {
@ -98,7 +113,8 @@ public class RecycleStationController {
RecycleStationRespVO stationRespVO = null;
if (ObjectUtil.isNotEmpty(nearbyStation)) {
stationRespVO = BeanUtils.copyBean(nearbyStation, RecycleStationRespVO.class);
List<ProductRespVO> produceList = recycleStationService.getStationProduct(nearbyStation.getId());
List<ProductRespVO> produceList = recycleStationService.getStationProductFirstByStationId(nearbyStation.getId());
stationRespVO.setStationProducts(produceList);
this.computeStationDistance(stationRespVO, location);
}

@ -9,8 +9,8 @@ import cc.yunxi.domain.dto.UserDTO;
import cc.yunxi.domain.query.TestQuery;
import cc.yunxi.enums.UserTypeEnum;
import cc.yunxi.service.ITestService;
import cc.yunxi.test.AppConfig;
import cc.yunxi.test.dal.Animal;
//import cc.yunxi.test.AppConfig;
//import cc.yunxi.test.dal.Animal;
import cc.yunxi.utils.JwtTool;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
@ -71,9 +71,9 @@ public class TestController {
@ApiOperation("测试接口成功")
@GetMapping("/test01")
public CommonResult<String> success() {
Animal animal = SpringUtil.getBean("animalObj", Animal.class);
AppConfig appConfig = SpringUtil.getBean("appConfig", AppConfig.class);
log.info("animal bean: {}, appConfig bean: {}", animal, appConfig);
// Animal animal = SpringUtil.getBean("animalObj", Animal.class);
// AppConfig appConfig = SpringUtil.getBean("appConfig", AppConfig.class);
// log.info("animal bean: {}, appConfig bean: {}", animal, appConfig);
return CommonResult.success("ok");
}

@ -27,9 +27,9 @@ public class RecycleOrderDetailCreateVO {
// @NotBlank(message = "商品名称不能为空")
// private String productName;
@ApiModelProperty(value = "下单时回收单价", required = true)
@NotNull(message = "下单时回收单价不能为空")
@DecimalMin(value = "0.01", message = "下单时回收单价数值错误")
@ApiModelProperty(value = "下单时回收单价", required = false)
// @NotNull(message = "下单时回收单价不能为空")
// @DecimalMin(value = "0.01", message = "下单时回收单价数值错误")
private BigDecimal recoveryPrice;
@ApiModelProperty(value = "创建时间", hidden = true)

@ -4,6 +4,7 @@ import cc.yunxi.domain.po.Price;
import cc.yunxi.domain.po.PriceProduct;
import cc.yunxi.domain.po.RecycleStation;
import cc.yunxi.domain.po.RecycleStationPrice;
import cc.yunxi.domain.vo.priceproduct.ProductRespVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -12,6 +13,8 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper
@ -32,4 +35,22 @@ public interface RecycleStationPriceMapper extends BaseMapper<RecycleStationPric
@Param("stationId") String stationId,
@Param(Constants.WRAPPER) Wrapper<Price> wrapper);
/**
* id
* @param stationId
* @return stationInfo
*/
List<ProductRespVO> getStationInfoByStationId(
@Param("stationId") String stationId,
@Param(Constants.WRAPPER) Wrapper<Price> wrapper);
/**
* id
* @param stationId
* @return stationInfo
*/
List<ProductRespVO> getStationInfoFirstByStationId(
@Param("stationId") String stationId,
@Param(Constants.WRAPPER) Wrapper<Price> wrapper);
}

@ -59,4 +59,22 @@ public interface IRecycleStationService extends IService<RecycleStation> {
*/
List<ProductRespVO> getStationProduct(String stationId);
/**
*
* @param stationId
* @return RecycleOrder
*/
List<ProductRespVO> getStationProductAllByStationId(String stationId);
/**
*
* @param stationId
* @return RecycleOrder
*/
List<ProductRespVO> getStationProductFirstByStationId(String stationId);
}

@ -106,7 +106,6 @@ public class RecycleStationServiceImpl extends ServiceImpl<RecycleStationMapper,
return list(wrapperX);
}
@Override
public List<ProductRespVO> getStationProduct(String stationId) {
QueryWrapper<Price> wrapper = new QueryWrapper<Price>().eq("a.status", GlobalStatusEnum.VALID);
@ -142,4 +141,18 @@ public class RecycleStationServiceImpl extends ServiceImpl<RecycleStationMapper,
return productRespVOList;
}
@Override
public List<ProductRespVO> getStationProductAllByStationId(String stationId) {
QueryWrapper<Price> wrapper = new QueryWrapper<Price>().eq("a.status", GlobalStatusEnum.VALID);
List<ProductRespVO> res = recycleStationPriceMapper.getStationInfoByStationId(stationId, wrapper);
return res;
}
@Override
public List<ProductRespVO> getStationProductFirstByStationId(String stationId) {
QueryWrapper<Price> wrapper = new QueryWrapper<Price>().eq("a.status", GlobalStatusEnum.VALID);
List<ProductRespVO> info = recycleStationPriceMapper.getStationInfoFirstByStationId(stationId, wrapper);
return info;
}
}

@ -22,4 +22,37 @@
LIMIT 1;
</select>
<select id="getStationInfoByStationId" resultType="cc.yunxi.domain.vo.priceproduct.ProductRespVO">
select id,name,photo,parent_id, 0 recovery_price from nx_product as f where exists(
select e.parent_id
from nx_enterprise_recycle_station as a
left join nx_price_recycle as b on a.id=b.recycle_id
left join nx_price_product as c on b.price_id= c.price_id
left join nx_price as d on d.id=b.price_id
left join nx_product as e on e.id=c.product_id
where a.id=#{stationId} and e.parent_id=f.id
)
union all
select e.id,e.name,e.photo,e.parent_id, c.recovery_price
from nx_enterprise_recycle_station as a
left join nx_price_recycle as b on a.id=b.recycle_id
left join nx_price_product as c on b.price_id= c.price_id
left join nx_price as d on d.id=b.price_id
left join nx_product as e on e.id=c.product_id
where a.id=#{stationId}
</select>
<select id="getStationInfoFirstByStationId" resultType="cc.yunxi.domain.vo.priceproduct.ProductRespVO">
select f.* , p.product_id, p.recovery_price from nx_product as f left join nx_price_product as p on f.id = p.product_id where exists(
select e.parent_id
from nx_enterprise_recycle_station as a
left join nx_price_recycle as b on a.id=b.recycle_id
left join nx_price_product as c on b.price_id= c.price_id
left join nx_price as d on d.id=b.price_id
left join nx_product as e on e.id=c.product_id
where a.id=#{stationId} and e.parent_id=f.id
)
</select>
</mapper>

Loading…
Cancel
Save