From 0a5801a116be3ae18d7f750bac46f222e337178f Mon Sep 17 00:00:00 2001 From: ChenYan <3139166962@qq.com> Date: Tue, 4 Mar 2025 16:58:47 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=20=E5=B9=B3=E5=8F=B0=E5=AE=98?= =?UTF-8?q?=E6=96=B9=E8=81=94=E7=B3=BB=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../communityCenter/ChatController.java | 20 +++- .../communityCenter/PlaFormController.java | 105 ++++++++++++++++++ .../webSocket/ChatWebSocket.java | 5 +- .../resource/domain/request/PlatForm.java | 32 ++++++ .../mcwl/resource/mapper/PlatFormMapper.java | 22 ++++ .../resource/service/PlatFormService.java | 22 ++++ .../service/impl/PlatFormServiceImpl.java | 99 +++++++++++++++++ .../mapper/resource/PlatFormMapper.xml | 9 ++ 8 files changed, 304 insertions(+), 10 deletions(-) create mode 100644 mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PlaFormController.java create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/request/PlatForm.java create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/mapper/PlatFormMapper.java create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/service/PlatFormService.java create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/service/impl/PlatFormServiceImpl.java create mode 100644 mcwl-resource/src/main/resources/mapper/resource/PlatFormMapper.xml diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/ChatController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/ChatController.java index ff753cb..a960b17 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/ChatController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/ChatController.java @@ -1,8 +1,8 @@ package com.mcwl.web.controller.communityCenter; + import com.mcwl.communityCenter.webSocket.ChatWebSocket; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -13,9 +13,17 @@ public class ChatController { private final ChatWebSocket chatWebSocket; - @GetMapping("/switchUserMode") - public void switchUserMode(String sessionId) throws Exception { - chatWebSocket.switchUserMode(sessionId); - } -} \ No newline at end of file + /** + * 切换用户模式 + * @param sessionId + * @throws Exception + */ +// @GetMapping("/switchUserMode") +// public void switchUserMode(String sessionId) throws Exception { +// chatWebSocket.switchUserMode(sessionId); +// } + + + +} diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PlaFormController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PlaFormController.java new file mode 100644 index 0000000..b7f3fa9 --- /dev/null +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PlaFormController.java @@ -0,0 +1,105 @@ +package com.mcwl.web.controller.communityCenter; + +import com.mcwl.common.core.controller.BaseController; +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; +import com.mcwl.resource.domain.request.PlatForm; +import com.mcwl.resource.service.PlatFormService; +import com.mcwl.web.controller.common.OssUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @Author:ChenYan + * @Project:mcwl-ai + * @Package:com.mcwl.web.controller.communityCenter + * @Filename:PlaFormController + * @Description TODO + * @Date:2025/3/4 16:36 + */ +@Api(tags = "官方app") + @RestController + @RequestMapping("app") +public class PlaFormController extends BaseController { + + @Autowired + private PlatFormService platFormService; + + + /** + * 平台官方联系列表 + */ + @ApiOperation(value = "模型列表") + @PostMapping("/list") + public List list(@RequestBody PlatForm platForm) { + + return platFormService.listplatForm(platForm); + } + + /*** + * + * url + * @param file + * @return + */ + @ApiOperation(value = "官方二维码文件") + @PostMapping("/UrlFile") + public AjaxResult zipUrlFile(@RequestParam MultipartFile file) { + String s = OssUtil.uploadMultipartFile(file); + return AjaxResult.success(s); + } + /** + * 添加平台官方联系 + */ + @ApiOperation(value = "添加") + @PostMapping("/insert") + public R add(@RequestBody PlatForm platForm) { + boolean save = platFormService.save(platForm); + return R.ok(save); + } + + /** + * 修改平台官方联系 + */ + @ApiOperation(value = "修改模型") + @PostMapping("/update") + public AjaxResult updateModel(@RequestBody PlatForm platForm) { + + platFormService.updateById(platForm); + + return AjaxResult.success("修改成功"); + } + + /** + * 查询详情 + * + * @param id + * @return + */ + @ApiOperation(value = "查询平台app详情") + @GetMapping("/selectModelById") + public R selectModelById(@Valid @NotNull(message = "id不能为空") @RequestParam Long id) { + PlatForm byId = platFormService.getById(id); + return R.ok(byId); + } + + /** + * 删除联系 + * */ + @ApiOperation(value = "删除联系") + @GetMapping("delete") + public AjaxResult delete(@Valid @NotNull(message = "id不能为空") @RequestParam Long id) { + platFormService.removeById(id); + return AjaxResult.success(); + } + + + +} diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/webSocket/ChatWebSocket.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/webSocket/ChatWebSocket.java index 76e7d14..dbe9d7e 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/webSocket/ChatWebSocket.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/webSocket/ChatWebSocket.java @@ -65,10 +65,7 @@ public class ChatWebSocket extends AbstractWebSocketHandler { } } - // 添加模式切换方法(根据业务需求) - public void switchUserMode(String sessionId) { - } // 线程安全的发送方法 private void sendText(WebSocketSession session, String text) { @@ -82,4 +79,4 @@ public class ChatWebSocket extends AbstractWebSocketHandler { System.out.println("WebSocket 发送失败: " + e.getMessage()); } } -} \ No newline at end of file +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/PlatForm.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/PlatForm.java new file mode 100644 index 0000000..ab327aa --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/PlatForm.java @@ -0,0 +1,32 @@ +package com.mcwl.resource.domain.request; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/**平台官方app联系 + * @Author:ChenYan + * @Project:mcwl-ai + * @Package:com.mcwl.resource.domain.request + * @Filename:Pic + * @Description TODO + * @Date:2025/3/4 16:00 + */ +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Data +@TableName("p_pic") +@ApiModel(description = "平台官方app联系") +public class PlatForm { + @ApiModelProperty(value = "主键ID") + private Long id; + @ApiModelProperty(value = "平台官方app名称") + private String name; + @ApiModelProperty(value = "图片地址") + private String url; +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/PlatFormMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/PlatFormMapper.java new file mode 100644 index 0000000..989fe16 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/PlatFormMapper.java @@ -0,0 +1,22 @@ +package com.mcwl.resource.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mcwl.resource.domain.request.PlatForm; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author:ChenYan + * @Project:mcwl-ai + * @Package:com.mcwl.resource.mapper + * @Filename:PlatFormMapper + * @Description TODO + * @Date:2025/3/4 16:13 + */ +@Mapper +public interface PlatFormMapper extends BaseMapper { + List listplatForm(PlatForm platForm); + + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/PlatFormService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/PlatFormService.java new file mode 100644 index 0000000..781b0c2 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/PlatFormService.java @@ -0,0 +1,22 @@ +package com.mcwl.resource.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mcwl.resource.domain.request.PlatForm; + +import java.util.List; + +/** + * @Author:ChenYan + * @Project:mcwl-ai + * @Package:com.mcwl.resource.service + * @Filename:PlatFormService + * @Description TODO + * @Date:2025/3/4 16:11 + */ +public interface PlatFormService extends IService { + + List listplatForm(PlatForm platForm); + + + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/PlatFormServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/PlatFormServiceImpl.java new file mode 100644 index 0000000..c9bc841 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/PlatFormServiceImpl.java @@ -0,0 +1,99 @@ +package com.mcwl.resource.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.core.domain.R; +import com.mcwl.resource.domain.ToActivity; +import com.mcwl.resource.domain.request.PlatForm; +import com.mcwl.resource.mapper.PlatFormMapper; +import com.mcwl.resource.service.PlatFormService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +/** + * 平台官方app联系方式 + * + * @Author:ChenYan + * @Project:mcwl-ai + * @Package:com.mcwl.resource.service.impl + * @Filename:PlatFormServiceImpl + * @Description TODO + * @Date:2025/3/4 16:12 + */ +@Service +public class PlatFormServiceImpl extends ServiceImpl implements PlatFormService { + + @Autowired + private PlatFormService platFormService; + + + /** + * 平台官方app联系方式列表 + * + * @param platForm + * @return + */ + @Override + public List listplatForm(PlatForm platForm) { + return platFormService.listplatForm(platForm); + } + + + /** + * 平台官方app联系方式详情 + * + * @param platForm + * @return + */ + @ApiOperation(value = "详情") + @PostMapping("finById") + public R finById(@RequestBody PlatForm platForm) { + platFormService.getById(platForm.getId()); + return R.ok(); + } + + /** + * 平台官方app联系方式添加 + * + * @param platForm + * @return + */ + @ApiOperation(value = "添加") + @PostMapping("add") + public R add(@RequestBody PlatForm platForm) { + platFormService.save(platForm); + return R.ok(); + } + + /** + * 平台官方app联系方式修改 + * + * @param platForm + * @return + */ + @ApiOperation(value = "修改") + @PostMapping("update") + public R update(@RequestBody PlatForm platForm) { + platFormService.updateById(platForm); + return R.ok(); + } + + /** + * 平台官方app联系方式删除 + * + * @param platForm + * @return + */ + @ApiOperation(value = "删除") + @PostMapping("delete") + public R delete(@RequestBody PlatForm platForm) { + platFormService.removeById(platForm); + return R.ok(); + } + + +} diff --git a/mcwl-resource/src/main/resources/mapper/resource/PlatFormMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/PlatFormMapper.xml new file mode 100644 index 0000000..623fa53 --- /dev/null +++ b/mcwl-resource/src/main/resources/mapper/resource/PlatFormMapper.xml @@ -0,0 +1,9 @@ + + + + +