套餐选择

This commit is contained in:
磷叶 2025-03-03 11:17:49 +08:00
parent ca9f29e63f
commit 35e0086429
4 changed files with 68 additions and 37 deletions

View File

@ -1,14 +1,14 @@
package com.ruoyi.ss.suit.service;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.ruoyi.ss.suit.domain.Suit;
import com.ruoyi.ss.suit.domain.SuitBO;
import com.ruoyi.ss.suit.domain.SuitQuery;
import com.ruoyi.ss.suit.domain.SuitVO;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* 套餐Service接口
*
@ -114,4 +114,9 @@ public interface SuitService
* 设置排序
*/
int setSort(List<? extends Suit> list);
/**
* 根据套餐ID查询套餐列表
*/
List<SuitVO> selectBySuitIds(List<Long> ids);
}

View File

@ -1,5 +1,16 @@
package com.ruoyi.ss.suit.service.impl;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.collection.CollectionUtils;
@ -15,16 +26,6 @@ import com.ruoyi.ss.suit.mapper.SuitMapper;
import com.ruoyi.ss.suit.service.SuitConverter;
import com.ruoyi.ss.suit.service.SuitService;
import com.ruoyi.ss.suit.service.SuitValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 套餐Service业务层处理
@ -115,6 +116,17 @@ public class SuitServiceImpl implements SuitService
return suitMapper.batchUpdateSort(list);
}
@Override
public List<SuitVO> selectBySuitIds(List<Long> ids) {
if (CollectionUtils.isEmptyElement(ids)) {
return Collections.emptyList();
}
SuitQuery query = new SuitQuery();
query.setSuitIds(ids);
return selectSuitList(query);
}
/**
* 插入前操作
*/

View File

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.ss;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@ -101,8 +102,10 @@ public class SmDeviceController extends BaseController
@GetMapping(value = "/{deviceId}")
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
DeviceVO device = deviceService.selectById(deviceId);
deviceAssembler.assembleRealServiceRate(device);
deviceAssembler.assembleBonusList(device);
List<DeviceVO> list = Collections.singletonList(device);
deviceAssembler.assembleRealServiceRate(list);
deviceAssembler.assembleBonusList(list);
deviceAssembler.assembleSuitList(list);
return success(device);
}
@ -276,7 +279,7 @@ public class SmDeviceController extends BaseController
public AjaxResult setWxs(@RequestBody @Validated DeviceWxsDTO dto) {
return toAjax(deviceService.setWxs(dto.getDeviceId(), dto.getWxs(), "管理员设置电量系数:" + dto.getWxs()));
}
@ApiOperation("设置设备反转参数")
@PutMapping("/setSet")
public AjaxResult setSet(@RequestBody @Validated DeviceSetDTO dto) {

View File

@ -3,35 +3,35 @@ package com.ruoyi.web.controller.ss;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ss.suit.domain.SuitBO;
import com.ruoyi.ss.suit.domain.SuitQuery;
import com.ruoyi.ss.suit.domain.SuitVO;
import com.ruoyi.ss.suit.service.SuitAssembler;
import com.ruoyi.ss.suit.service.SuitValidator;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ss.suit.service.SuitService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.ss.suit.service.SuitValidator;
/**
* 套餐Controller
@ -65,6 +65,17 @@ public class SuitController extends BaseController
return getDataTable(list);
}
/**
* 根据套餐ID查询套餐列表
*/
@PreAuthorize("@ss.hasPermi('ss:suit:list')")
@GetMapping("/listByIds/{ids}")
public AjaxResult listByIds(@PathVariable List<Long> ids)
{
List<SuitVO> list = suitService.selectBySuitIds(ids);
return success(list);
}
/**
* 导出套餐列表
*/