| @@ -1,9 +1,12 @@ | |||
| package com.xueyi.system.api.digitalmans.domain.dto; | |||
| import com.xueyi.common.core.annotation.Correlation; | |||
| import com.xueyi.common.core.annotation.Excel; | |||
| import com.xueyi.common.core.constant.basic.OperateConstants; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmModelPo; | |||
| import com.xueyi.system.api.digitalmans.domain.vo.DmReceptionVo; | |||
| import com.xueyi.system.api.resource.domain.po.DmResourcesPo; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -24,13 +27,18 @@ public class DmModelDto extends DmModelPo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| /** 模型支持的形象资源ID,多个用,分割 */ | |||
| @Excel(name = "模型支持的动作ID,多个用,分割") | |||
| protected String modelContain; | |||
| // 显示服装路径集 | |||
| protected List<DmResourcesPo> rSuits; | |||
| protected List<DmSuitVo> rSuits; | |||
| // 显示背景图片路径集 | |||
| protected List<DmResourcesPo> rBackgrounds; | |||
| protected List<DmResourcesPo> rScreenOffs; | |||
| // 显示icon路径 | |||
| protected DmResourcesPo rIcon; | |||
| @@ -5,6 +5,7 @@ import com.xueyi.system.api.digitalmans.domain.po.DmDigitalmanWorktimePo; | |||
| import com.xueyi.system.api.digitalmans.domain.vo.DmBroadcastVo; | |||
| import com.xueyi.system.api.organize.domain.vo.SysDeptExt; | |||
| import com.xueyi.system.api.resource.domain.po.DmResourcesPo; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -27,5 +28,7 @@ public class DmSyncDigitalmanDto extends DmDigitalmanPo { | |||
| protected String iconPos; | |||
| protected String direction; | |||
| protected List<DmBroadcastVo> broadcast; | |||
| protected DmSuitVo suit; | |||
| protected Long suitId; | |||
| } | |||
| @@ -0,0 +1,29 @@ | |||
| package com.xueyi.system.api.resource.domain.vo; | |||
| import com.xueyi.common.core.annotation.Excel; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| @Data | |||
| @NoArgsConstructor | |||
| public class DmSuitVo { | |||
| /** 衣服Id */ | |||
| @Excel(name = "衣服Id") | |||
| protected Long id; | |||
| /** 衣服代码 */ | |||
| @Excel(name = "衣服代码") | |||
| protected String code; | |||
| /** 上装颜色 */ | |||
| @Excel(name = "上装颜色") | |||
| protected String topColor; | |||
| /** 下装颜色 */ | |||
| @Excel(name = "下装颜色") | |||
| protected String bottomColor; | |||
| DmResourcesVo model; | |||
| DmResourcesVo suit; | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| package com.xueyi.system.api.resource.feign; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.common.core.constant.basic.ServiceConstants; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import com.xueyi.system.api.resource.feign.factory.RemoteH5ConfigFallbackFactory; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import org.springframework.web.bind.annotation.RequestParam; | |||
| import java.util.List; | |||
| @FeignClient(contextId = "remoteWardrobeService", value = ServiceConstants.SYSTEM_SERVICE, fallbackFactory = RemoteH5ConfigFallbackFactory.class) | |||
| public interface RemoteWardrobeService { | |||
| @GetMapping("/wardrobe/inner/suit_list") | |||
| R<List<DmSuitVo>> suitList(@RequestHeader(SecurityConstants.ENTERPRISE_ID) Long enterpriseId, @RequestHeader(SecurityConstants.SOURCE_NAME) String sourceName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); | |||
| } | |||
| @@ -0,0 +1,25 @@ | |||
| package com.xueyi.system.api.resource.feign.factory; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import com.xueyi.system.api.resource.feign.RemoteH5ConfigService; | |||
| import com.xueyi.system.api.resource.feign.RemoteWardrobeService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.cloud.openfeign.FallbackFactory; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.List; | |||
| @Slf4j | |||
| @Component | |||
| public class RemoteWardrobeFallbackFactory implements FallbackFactory<RemoteWardrobeService> { | |||
| @Override | |||
| public RemoteWardrobeService create(Throwable cause) { | |||
| return new RemoteWardrobeService() { | |||
| @Override | |||
| public R<List<DmSuitVo>> suitList(Long enterpriseId, String sourceName, String source) { | |||
| return R.fail("获取衣柜列表失败:" + cause.getMessage()); | |||
| } | |||
| }; | |||
| } | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.xueyi.system.api.weixin.feign; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.xueyi.system.api.weixin.feign.factory.RemoteWeixinFallbackFactory; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| import org.springframework.web.bind.annotation.*; | |||
| /** | |||
| * 问答服务 | |||
| * @Param man_id 机器人id | |||
| * @Param question 问题 | |||
| * @Param tenant_id 租户id | |||
| * @author yrx | |||
| */ | |||
| @FeignClient(url = "${notification.weixin.url}",name = "weixin", fallbackFactory = RemoteWeixinFallbackFactory.class) | |||
| public interface RemoteWeixinService { | |||
| @GetMapping("/sns/jscode2session") | |||
| @ResponseBody | |||
| JSONObject jscode2session(@RequestParam("appid")String appId,@RequestParam("secret")String secret,@RequestParam("js_code")String code,@RequestParam(value = "grant_type",defaultValue = "authorization_code")String grantType); | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| package com.xueyi.system.api.weixin.feign.factory; | |||
| import com.alibaba.fastjson2.JSONObject; | |||
| import com.xueyi.system.api.weixin.feign.RemoteWeixinService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.cloud.openfeign.FallbackFactory; | |||
| import org.springframework.stereotype.Component; | |||
| /** | |||
| * 会议室服务 降级处理 | |||
| * | |||
| * @author xueyi | |||
| */ | |||
| @Slf4j | |||
| @Component | |||
| public class RemoteWeixinFallbackFactory implements FallbackFactory<RemoteWeixinService> { | |||
| @Override | |||
| public RemoteWeixinService create(Throwable throwable) { | |||
| log.error("短信服务调用失败:{}", throwable.getMessage()); | |||
| return new RemoteWeixinService() { | |||
| @Override | |||
| public JSONObject jscode2session(String appId, String secret, String code, String grantType) { | |||
| return null; | |||
| } | |||
| }; | |||
| } | |||
| } | |||
| @@ -47,12 +47,12 @@ public class HeaderInterceptor implements AsyncHandlerInterceptor { | |||
| if (StrUtil.isNotEmpty(token)) { | |||
| logger.info("IsLessor:{}",JwtUtil.getIsLessor(token)); | |||
| if (!(("Y").equals(JwtUtil.getIsLessor(token))|| JwtUtil.getIsLessor(token).equals("1"))) {//如果是超管租户,则不执行以下 | |||
| SecurityContextHolder.setEnterpriseId(JwtUtil.getEnterpriseId(token)); | |||
| SecurityContextHolder.setSourceName(JwtUtil.getSourceName(token)); | |||
| SecurityContextHolder.setAccountType(JwtUtil.getAccountType(token)); | |||
| SecurityContextHolder.set(SecurityConstants.FROM_SOURCE, SecurityConstants.INNER); | |||
| } | |||
| // if (!(("Y").equals(JwtUtil.getIsLessor(token))|| JwtUtil.getIsLessor(token).equals("1"))) {//如果是超管租户,则不执行以下 | |||
| // SecurityContextHolder.setEnterpriseId(JwtUtil.getEnterpriseId(token)); | |||
| // SecurityContextHolder.setSourceName(JwtUtil.getSourceName(token)); | |||
| // SecurityContextHolder.setAccountType(JwtUtil.getAccountType(token)); | |||
| // SecurityContextHolder.set(SecurityConstants.FROM_SOURCE, SecurityConstants.INNER); | |||
| // } | |||
| TenantConstants.AccountType accountType = TenantConstants.AccountType.getByCode(SecurityUtils.getAccountType()); | |||
| if(ObjectUtil.isNotNull(accountType)) { | |||
| @@ -155,6 +155,7 @@ public class DmDigitalmanManager extends BaseManagerImpl<DmDigitalmanQuery, DmDi | |||
| sdmdto.setScreenOff(screenOffPo); | |||
| sdmdto.setScreenOffList(screenOffList); | |||
| sdmdto.setDirection(mpo.getDirection()); | |||
| sdmdto.setSuitId(mpo.getCurrentSuit()); | |||
| System.out.println(sdmdto); | |||
| return sdmdto; | |||
| } | |||
| @@ -99,12 +99,6 @@ public class DmModelManager extends BaseManagerImpl<DmModelQuery, DmModelDto, Dm | |||
| return null; | |||
| } | |||
| DmModelDto modelDto = items.get(0); | |||
| if (modelDto.getSuitContain().length() > 0) { | |||
| modelDto.setRSuits(new ArrayList<>(modelDto.getSuitContain().split(",").length)); | |||
| Arrays.asList(modelDto.getSuitContain().split(",")).forEach(suitItem-> { | |||
| modelDto.getRSuits().add(dmResourcesMapper.selectById(Long.parseLong(suitItem))); | |||
| }); | |||
| } | |||
| // 获取背景页 | |||
| List<DmBackgroundPo> backgroundPos = backgroundMapper.selectList(null); | |||
| List<DmResourcesPo> bResourcesPos = new ArrayList<>(); | |||
| @@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
| import com.github.pagehelper.Page; | |||
| import com.xueyi.common.core.constant.basic.SqlConstants; | |||
| import com.xueyi.common.core.constant.basic.TenantConstants; | |||
| import com.xueyi.common.core.constant.digitalman.InitConstants; | |||
| import com.xueyi.common.core.constant.digitalman.MessageConstants; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import com.xueyi.message.api.transfer.feign.RemoteTransferService; | |||
| import com.xueyi.system.api.device.domain.po.DmDeviceTenantMergePo; | |||
| @@ -17,6 +19,8 @@ import com.xueyi.system.api.digitalmans.domain.po.DmDigitalmanExtPo; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmDigitalmanPo; | |||
| import com.xueyi.system.api.digitalmans.domain.po.DmManDevicePo; | |||
| import com.xueyi.system.api.resource.domain.po.DmResourcesPo; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import com.xueyi.system.api.resource.feign.RemoteWardrobeService; | |||
| import com.xueyi.system.device.service.IDmDeviceTenantMergeService; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanDto; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmDigitalmanExtDto; | |||
| @@ -82,6 +86,9 @@ public class DmDigitalmanServiceImpl extends BaseServiceImpl<DmDigitalmanQuery, | |||
| @Autowired | |||
| RemoteTransferService transferService; | |||
| @Autowired | |||
| RemoteWardrobeService remoteWardrobeService; | |||
| @Autowired | |||
| IDmResourcesService dmResourcesService; | |||
| @@ -252,7 +259,20 @@ public class DmDigitalmanServiceImpl extends BaseServiceImpl<DmDigitalmanQuery, | |||
| @Override | |||
| public DmSyncDigitalmanDto syncDigitalman(String manCode, String timestamp) { | |||
| return super.baseManager.syncDigitalmanInfo(manCode,timestamp); | |||
| DmSyncDigitalmanDto dto = super.baseManager.syncDigitalmanInfo(manCode,timestamp); | |||
| if (dto != null) { | |||
| // 获取衣服信息 | |||
| R<List<DmSuitVo>> suitVos = remoteWardrobeService.suitList(1L, TenantConstants.Source.SLAVE.getCode(), "inner"); | |||
| if (suitVos.isOk()) { | |||
| List<DmSuitVo> suitVoList = suitVos.getData(); | |||
| if (suitVoList != null && suitVoList.size() > 0) { | |||
| // 获取suitVoList中id与dto.getCurrentSuit相同的对象 | |||
| DmSuitVo suitVo = suitVoList.stream().filter(item->item.getId().equals(dto.getSuitId())).findFirst().get(); | |||
| dto.setSuit(suitVo); | |||
| } | |||
| } | |||
| } | |||
| return dto; | |||
| } | |||
| @Override | |||
| @@ -1,8 +1,16 @@ | |||
| package com.xueyi.system.digitalmans.service.impl; | |||
| import com.xueyi.common.core.constant.basic.SecurityConstants; | |||
| import com.xueyi.common.core.constant.basic.TenantConstants; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmH5MenuDto; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmModelDto; | |||
| import com.xueyi.system.api.digitalmans.domain.dto.DmScreenIconDto; | |||
| import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto; | |||
| import com.xueyi.system.api.organize.feign.RemoteEnterpriseService; | |||
| import com.xueyi.system.api.resource.domain.po.DmResourcesPo; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import com.xueyi.system.api.resource.feign.RemoteWardrobeService; | |||
| import com.xueyi.system.digitalmans.domain.dto.DmModelUploadDto; | |||
| import com.xueyi.system.digitalmans.domain.query.DmModelQuery; | |||
| import com.xueyi.system.digitalmans.service.IDmModelService; | |||
| @@ -12,6 +20,8 @@ import com.xueyi.system.resource.mapper.DmResourcesMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| /** | |||
| @@ -22,6 +32,10 @@ import java.util.List; | |||
| @Service | |||
| public class DmModelServiceImpl extends BaseServiceImpl<DmModelQuery, DmModelDto, IDmModelManager> implements IDmModelService { | |||
| @Autowired | |||
| RemoteEnterpriseService remoteEnterpriseService; | |||
| @Autowired | |||
| RemoteWardrobeService remoteWardrobeService; | |||
| @Autowired | |||
| DmResourcesMapper dmResourcesMapper; | |||
| @Autowired | |||
| @@ -39,6 +53,20 @@ public class DmModelServiceImpl extends BaseServiceImpl<DmModelQuery, DmModelDto | |||
| return baseManager.selectList(dmModel); | |||
| } | |||
| @Override | |||
| public DmModelDto selectById(Serializable id) { | |||
| //获取超管租户信息,用来获取衣服资源 | |||
| R<SysEnterpriseDto> enterpriseDtoR = remoteEnterpriseService.getInfo(1L); | |||
| SysEnterpriseDto enterpriseDto = enterpriseDtoR.getData(); | |||
| DmModelDto dto = super.selectById(id); | |||
| //获取衣服资源 | |||
| R<List<DmSuitVo>> suitListR = remoteWardrobeService.suitList(enterpriseDto.getId(), TenantConstants.Source.SLAVE.getCode(), SecurityConstants.INNER); | |||
| if (suitListR.isOk()) { | |||
| dto.setRSuits(suitListR.getData()); | |||
| } | |||
| return dto; | |||
| } | |||
| @Override | |||
| public int uploadResource(DmModelUploadDto dto) { | |||
| return modelManager.uploadResourceByResourceId(dto); | |||
| @@ -0,0 +1,131 @@ | |||
| package com.xueyi.system.resource.controller; | |||
| import com.xueyi.common.core.web.result.AjaxResult; | |||
| import com.xueyi.common.core.web.result.R; | |||
| import com.xueyi.common.core.web.validate.V_A; | |||
| import com.xueyi.common.core.web.validate.V_E; | |||
| import com.xueyi.common.log.annotation.Log; | |||
| import com.xueyi.common.log.enums.BusinessType; | |||
| import com.xueyi.common.security.annotation.InnerAuth; | |||
| import com.xueyi.common.security.annotation.Logical; | |||
| import com.xueyi.common.security.annotation.RequiresPermissions; | |||
| import com.xueyi.common.web.entity.controller.BaseController; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import com.xueyi.system.resource.domain.dto.DmWardrobeDto; | |||
| import com.xueyi.system.resource.domain.query.DmWardrobeQuery; | |||
| import com.xueyi.system.resource.service.IDmWardrobeService; | |||
| import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * 数字人衣橱管理管理 业务处理 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/wardrobe") | |||
| public class DmWardrobeController extends BaseController<DmWardrobeQuery, DmWardrobeDto, IDmWardrobeService> { | |||
| @InnerAuth | |||
| @GetMapping("/inner/suit_list") | |||
| public R<List<DmSuitVo>> suitList() { | |||
| return R.ok(baseService.getSuitList()); | |||
| } | |||
| /** 定义节点名称 */ | |||
| @Override | |||
| protected String getNodeName() { | |||
| return "数字人衣橱管理" ; | |||
| } | |||
| /** | |||
| * 查询数字人衣橱管理列表 | |||
| */ | |||
| @Override | |||
| @GetMapping("/list") | |||
| @RequiresPermissions(Auth.DM_WARDROBE_LIST) | |||
| public AjaxResult list(DmWardrobeQuery wardrobe) { | |||
| return super.list(wardrobe); | |||
| } | |||
| /** | |||
| * 查询数字人衣橱管理详细 | |||
| */ | |||
| @Override | |||
| @GetMapping(value = "/{id}") | |||
| @RequiresPermissions(Auth.DM_WARDROBE_SINGLE) | |||
| public AjaxResult getInfo(@PathVariable Serializable id) { | |||
| return super.getInfo(id); | |||
| } | |||
| /** | |||
| * 数字人衣橱管理新增 | |||
| */ | |||
| @Override | |||
| @PostMapping | |||
| @RequiresPermissions(Auth.DM_WARDROBE_ADD) | |||
| @Log(title = "数字人衣橱管理管理", businessType = BusinessType.INSERT) | |||
| public AjaxResult add(@Validated({V_A.class}) @RequestBody DmWardrobeDto wardrobe) { | |||
| return super.add(wardrobe); | |||
| } | |||
| /** | |||
| * 数字人衣橱管理修改 | |||
| */ | |||
| @Override | |||
| @PutMapping | |||
| @RequiresPermissions(Auth.DM_WARDROBE_EDIT) | |||
| @Log(title = "数字人衣橱管理管理", businessType = BusinessType.UPDATE) | |||
| public AjaxResult edit(@Validated({V_E.class}) @RequestBody DmWardrobeDto wardrobe) { | |||
| return super.edit(wardrobe); | |||
| } | |||
| /** | |||
| * 数字人衣橱管理修改状态 | |||
| */ | |||
| @Override | |||
| @PutMapping("/status") | |||
| @RequiresPermissions(value = {Auth.DM_WARDROBE_EDIT, Auth.DM_WARDROBE_ES}, logical = Logical.OR) | |||
| @Log(title = "数字人衣橱管理管理", businessType = BusinessType.UPDATE_STATUS) | |||
| public AjaxResult editStatus(@RequestBody DmWardrobeDto wardrobe) { | |||
| return super.editStatus(wardrobe); | |||
| } | |||
| /** | |||
| * 数字人衣橱管理批量删除 | |||
| */ | |||
| @Override | |||
| @DeleteMapping("/batch/{idList}") | |||
| @RequiresPermissions(Auth.DM_WARDROBE_DEL) | |||
| @Log(title = "数字人衣橱管理管理", businessType = BusinessType.DELETE) | |||
| public AjaxResult batchRemove(@PathVariable List<Long> idList) { | |||
| return super.batchRemove(idList); | |||
| } | |||
| /** | |||
| * 获取数字人衣橱管理选择框列表 | |||
| */ | |||
| @Override | |||
| @GetMapping("/option") | |||
| public AjaxResult option() { | |||
| return super.option(); | |||
| } | |||
| interface Auth { | |||
| /** 系统 - 数字人衣橱管理管理 - 列表 */ | |||
| String DM_WARDROBE_LIST = "resource:wardrobe:list"; | |||
| /** 系统 - 数字人衣橱管理管理 - 详情 */ | |||
| String DM_WARDROBE_SINGLE = "resource:wardrobe:single"; | |||
| /** 系统 - 数字人衣橱管理管理 - 新增 */ | |||
| String DM_WARDROBE_ADD = "resource:wardrobe:add"; | |||
| /** 系统 - 数字人衣橱管理管理 - 修改 */ | |||
| String DM_WARDROBE_EDIT = "resource:wardrobe:edit"; | |||
| /** 系统 - 数字人衣橱管理管理 - 修改状态 */ | |||
| String DM_WARDROBE_ES = "resource:wardrobe:es"; | |||
| /** 系统 - 数字人衣橱管理管理 - 删除 */ | |||
| String DM_WARDROBE_DEL = "resource:wardrobe:delete"; | |||
| } | |||
| } | |||
| @@ -0,0 +1,25 @@ | |||
| package com.xueyi.system.resource.domain.dto; | |||
| import com.xueyi.system.resource.domain.po.DmWardrobePo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| /** | |||
| * 数字人衣橱管理 数据传输对象 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class DmWardrobeDto extends DmWardrobePo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| DmResourcesDto model; | |||
| DmResourcesDto suit; | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.xueyi.system.resource.domain.model; | |||
| import com.xueyi.common.core.web.entity.model.BaseConverter; | |||
| import com.xueyi.system.resource.domain.dto.DmWardrobeDto; | |||
| import com.xueyi.system.resource.domain.po.DmWardrobePo; | |||
| import com.xueyi.system.resource.domain.query.DmWardrobeQuery; | |||
| import org.mapstruct.Mapper; | |||
| import org.mapstruct.MappingConstants; | |||
| /** | |||
| * 数字人衣橱管理 对象映射器 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @Mapper(componentModel = MappingConstants.ComponentModel.SPRING) | |||
| public interface DmWardrobeConverter extends BaseConverter<DmWardrobeQuery, DmWardrobeDto, DmWardrobePo> { | |||
| } | |||
| @@ -0,0 +1,51 @@ | |||
| package com.xueyi.system.resource.domain.po; | |||
| import com.xueyi.common.core.web.entity.base.BaseEntity; | |||
| import com.xueyi.system.resource.domain.dto.DmWardrobeDto; | |||
| import com.xueyi.common.core.annotation.Excel; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| import static com.xueyi.common.core.constant.basic.EntityConstants.REMARK; | |||
| /** | |||
| * 数字人衣橱管理 持久化对象 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| @TableName(value = "dm_wardrobe", excludeProperty = { REMARK }) | |||
| public class DmWardrobePo extends BaseEntity { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| /** 衣服代码 */ | |||
| @Excel(name = "衣服代码") | |||
| protected String code; | |||
| /** 上装颜色 */ | |||
| @Excel(name = "上装颜色") | |||
| protected String topColor; | |||
| /** 下装颜色 */ | |||
| @Excel(name = "下装颜色") | |||
| protected String bottomColor; | |||
| /** 状态 */ | |||
| @Excel(name = "状态") | |||
| protected String status; | |||
| /** 数字人模型图片地址 */ | |||
| @Excel(name = "数字人模型图片id") | |||
| protected Long modelId; | |||
| /** 衣服样式图片地址 */ | |||
| @Excel(name = "衣服样式图片id") | |||
| protected Long suitId; | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| package com.xueyi.system.resource.domain.query; | |||
| import com.xueyi.system.resource.domain.po.DmWardrobePo; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.io.Serial; | |||
| /** | |||
| * 数字人衣橱管理 数据查询对象 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class DmWardrobeQuery extends DmWardrobePo { | |||
| @Serial | |||
| private static final long serialVersionUID = 1L; | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.xueyi.system.resource.manager; | |||
| import com.xueyi.system.resource.domain.dto.DmWardrobeDto; | |||
| import com.xueyi.system.resource.domain.query.DmWardrobeQuery; | |||
| import com.xueyi.common.web.entity.manager.IBaseManager; | |||
| /** | |||
| * 数字人衣橱管理管理 数据封装层 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| public interface IDmWardrobeManager extends IBaseManager<DmWardrobeQuery, DmWardrobeDto> { | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| package com.xueyi.system.resource.manager.impl; | |||
| import com.xueyi.system.resource.domain.po.DmWardrobePo; | |||
| import com.xueyi.system.resource.domain.dto.DmWardrobeDto; | |||
| import com.xueyi.system.resource.domain.query.DmWardrobeQuery; | |||
| import com.xueyi.system.resource.domain.model.DmWardrobeConverter; | |||
| import com.xueyi.system.resource.mapper.DmWardrobeMapper; | |||
| import com.xueyi.common.web.entity.manager.impl.BaseManagerImpl; | |||
| import com.xueyi.system.resource.manager.IDmWardrobeManager; | |||
| import org.springframework.stereotype.Component; | |||
| import java.util.List; | |||
| /** | |||
| * 数字人衣橱管理管理 数据封装层处理 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @Component | |||
| public class DmWardrobeManager extends BaseManagerImpl<DmWardrobeQuery, DmWardrobeDto, DmWardrobePo, DmWardrobeMapper, DmWardrobeConverter> implements IDmWardrobeManager { | |||
| @Override | |||
| public List<DmWardrobeDto> selectList(DmWardrobeQuery query) { | |||
| List<DmWardrobeDto> list = super.selectList(query); | |||
| // 根据衣橱id查询衣橱下的套装 | |||
| return super.selectList(query); | |||
| } | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.xueyi.system.resource.mapper; | |||
| import com.xueyi.system.resource.domain.query.DmWardrobeQuery; | |||
| import com.xueyi.system.resource.domain.dto.DmWardrobeDto; | |||
| import com.xueyi.system.resource.domain.po.DmWardrobePo; | |||
| import com.xueyi.common.web.entity.mapper.BaseMapper; | |||
| import com.xueyi.common.datasource.annotation.Master; | |||
| /** | |||
| * 数字人衣橱管理管理 数据层 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @Master | |||
| public interface DmWardrobeMapper extends BaseMapper<DmWardrobeQuery, DmWardrobeDto, DmWardrobePo> { | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.xueyi.system.resource.service; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import com.xueyi.system.resource.domain.query.DmWardrobeQuery; | |||
| import com.xueyi.system.resource.domain.dto.DmWardrobeDto; | |||
| import com.xueyi.common.web.entity.service.IBaseService; | |||
| import java.util.List; | |||
| /** | |||
| * 数字人衣橱管理管理 服务层 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| public interface IDmWardrobeService extends IBaseService<DmWardrobeQuery, DmWardrobeDto> { | |||
| List<DmSuitVo> getSuitList(); | |||
| } | |||
| @@ -0,0 +1,72 @@ | |||
| package com.xueyi.system.resource.service.impl; | |||
| import com.xueyi.system.api.resource.domain.vo.DmResourcesVo; | |||
| import com.xueyi.system.api.resource.domain.vo.DmSuitVo; | |||
| import com.xueyi.system.api.resource.feign.RemoteWardrobeService; | |||
| import com.xueyi.system.resource.domain.dto.DmWardrobeDto; | |||
| import com.xueyi.system.resource.domain.query.DmWardrobeQuery; | |||
| import com.xueyi.system.resource.service.IDmResourcesService; | |||
| import com.xueyi.system.resource.service.IDmWardrobeService; | |||
| import com.xueyi.system.resource.manager.IDmWardrobeManager; | |||
| import com.xueyi.common.web.entity.service.impl.BaseServiceImpl; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.cloud.client.hypermedia.RemoteResource; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| /** | |||
| * 数字人衣橱管理管理 服务层处理 | |||
| * | |||
| * @author yinruoxi | |||
| */ | |||
| @Service | |||
| public class DmWardrobeServiceImpl extends BaseServiceImpl<DmWardrobeQuery, DmWardrobeDto, IDmWardrobeManager> implements IDmWardrobeService { | |||
| @Autowired | |||
| private IDmResourcesService resourcesService; | |||
| /** | |||
| * 查询数字人衣橱管理对象列表 | 数据权限 | |||
| * | |||
| * @param wardrobe 数字人衣橱管理对象 | |||
| * @return 数字人衣橱管理对象集合 | |||
| */ | |||
| @Override | |||
| //@DataScope(userAlias = "createBy", mapperScope = {"DmWardrobeMapper"}) | |||
| public List<DmWardrobeDto> selectListScope(DmWardrobeQuery wardrobe) { | |||
| List<DmWardrobeDto> list = baseManager.selectList(wardrobe); | |||
| list.stream().forEach(item->{ | |||
| item.setSuit(resourcesService.selectById(item.getSuitId())); | |||
| item.setModel(resourcesService.selectById(item.getModelId())); | |||
| }); | |||
| return list; | |||
| } | |||
| @Override | |||
| public List<DmSuitVo> getSuitList() { | |||
| List<DmWardrobeDto> dtoList = selectListScope(new DmWardrobeQuery()); | |||
| List<DmSuitVo> suitList = new ArrayList<>(); | |||
| for (DmWardrobeDto dto : dtoList) { | |||
| DmSuitVo suitVo = new DmSuitVo(); | |||
| suitVo.setId(dto.getId()); | |||
| suitVo.setCode(dto.getCode()); | |||
| suitVo.setTopColor(dto.getTopColor()); | |||
| suitVo.setBottomColor(dto.getBottomColor()); | |||
| DmResourcesVo suit = new DmResourcesVo(); | |||
| // convert(suit, dto.getSuit()); | |||
| suit.setId(dto.getSuit().getId()); | |||
| suit.setName(dto.getSuit().getName()); | |||
| suit.setUrl(dto.getSuit().getUrl()); | |||
| suitVo.setSuit(suit); | |||
| // convert(model, dto.getModel()); | |||
| DmResourcesVo model = new DmResourcesVo(); | |||
| model.setId(dto.getModel().getId()); | |||
| model.setName(dto.getModel().getName()); | |||
| model.setUrl(dto.getModel().getUrl()); | |||
| suitVo.setModel(model); | |||
| suitList.add(suitVo); | |||
| } | |||
| return suitList; | |||
| } | |||
| } | |||