| | |
| | | package com.matrix.system.app.action; |
| | | |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.system.app.dto.ServiceOrderListDto; |
| | | import com.matrix.system.app.mapper.SysProjUseMapper; |
| | | import com.matrix.system.app.vo.ServiceOrderListVo; |
| | | import com.matrix.system.app.vo.ServiceProductListVo; |
| | | import com.matrix.system.app.vo.ServiceProjVo; |
| | | import com.matrix.system.app.vo.ServiceTcVo; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.SysProjUse; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.hive.service.SysProjServicesService; |
| | | import com.matrix.system.hive.service.SysProjUseService; |
| | | import com.matrix.system.hive.service.SysVipInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | @RequestMapping(value = "/api/serviceOrder") |
| | | public class ApiServiceOrderAction { |
| | | |
| | | @Autowired |
| | | private SysProjUseService projUseService; |
| | | |
| | | @Autowired |
| | | private SysVipInfoService sysVipInfoService; |
| | | |
| | | @Autowired |
| | | private SysProjServicesService projServicesService; |
| | | |
| | | @ApiOperation(value ="获取用户项目/套餐列表", notes = "获取用户项目/套餐列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = ServiceProductListVo.class) |
| | | }) |
| | | @GetMapping(value = "/findVipProject/{vipId}") |
| | | public AjaxResult findVipProject(@PathVariable("vipId") Long vipId) { |
| | | SysVipInfo vipInfo = sysVipInfoService.findById(vipId); |
| | | |
| | | if (vipInfo == null) { |
| | | throw new GlobleException("会员不存在"); |
| | | } |
| | | |
| | | ServiceProductListVo productListVo = new ServiceProductListVo(); |
| | | productListVo.setName(vipInfo.getVipName()); |
| | | productListVo.setVipId(vipId); |
| | | |
| | | SysProjUse queryUse = new SysProjUse(); |
| | | queryUse.setVipId(vipId); |
| | | queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | queryUse.setTaocanId(-1L); |
| | | queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | queryUse.setIsOver(Dictionary.FLAG_NO_N); |
| | | List<SysProjUse> projList = projUseService.findInPage(queryUse, null); |
| | | List<ServiceProjVo> serviceProjVos = SysProjUseMapper.INSTANCE.entityListToProjVoList(projList); |
| | | |
| | | queryUse.setTaocanId(null); |
| | | queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_TC); |
| | | List<SysProjUse> taoCanList = projUseService.findInPage(queryUse, null); |
| | | List<ServiceTcVo> serviceTcVos = SysProjUseMapper.INSTANCE.entityListToTcVoList(taoCanList); |
| | | |
| | | if (CollectionUtils.isNotEmpty(serviceTcVos)) { |
| | | serviceTcVos.forEach(item -> { |
| | | List<SysProjUse> sysProjUses = projUseService.selectTaocanProjUse(item.getId()); |
| | | List<ServiceProjVo> taocanProj = SysProjUseMapper.INSTANCE.entityListToProjVoList(sysProjUses); |
| | | item.setProj(taocanProj); |
| | | }); |
| | | } |
| | | |
| | | productListVo.setProj(serviceProjVos); |
| | | productListVo.setComposeProj(serviceTcVos); |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功"); |
| | | ajaxResult.putInMap("proj", productListVo); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | @ApiOperation(value = "提交服务单", notes = "提交服务单") |
| | | @PostMapping(value = "/createServiceOrder") |
| | | public AjaxResult createServiceOrder() { |
| | | return null; |
| | | } |
| | | |
| | | @ApiOperation(value = "查询服务单列表", notes = "查询服务单列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = ServiceOrderListVo.class) |
| | | }) |
| | | @PostMapping(value = "/findServiceOrderList") |
| | | public AjaxResult findServiceOrderList(@RequestBody @Validated ServiceOrderListDto orderListDto) { |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | int offset = (orderListDto.getPageNum() - 1) * orderListDto.getPageSize(); |
| | | int limit = orderListDto.getPageSize(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | return AjaxResult.buildSuccessInstance(projServicesService.findApiServiceOrderListInPage(orderListDto, pageVo), projServicesService.findApiServiceOrderListTotal(orderListDto)); |
| | | } |
| | | |
| | | } |