From 203c1b1bc4d13b12e7c0480b182c1da53da166aa Mon Sep 17 00:00:00 2001 From: du <1725534722@qq.com> Date: Thu, 9 Jan 2025 10:30:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=92=8C=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssetOfficialAccountController.java | 48 ++++++++++++++++++- .../ruoyi/tc/entity/AssetOfficialAccount.java | 9 ++++ .../entity/po/AssetOfficialAccountCpPo.java | 10 ++++ .../entity/po/AssetOfficialAccountJyPo.java | 10 ++++ .../request/AssetOfficialAccountMenu.java | 28 +++++++++++ .../impl/AssetOfficialAccountServiceImpl.java | 30 ++++++++++++ 6 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/tc/entity/request/AssetOfficialAccountMenu.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetOfficialAccountController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetOfficialAccountController.java index 8546ab1..8fb07d9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetOfficialAccountController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetOfficialAccountController.java @@ -16,6 +16,7 @@ import com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo; import com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo; import com.ruoyi.tc.entity.request.AssetAuditPageRequest; import com.ruoyi.tc.entity.request.AssetAuditRequest; +import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu; import com.ruoyi.tc.entity.request.AssetOfficialAccountPageRequest; import com.ruoyi.tc.service.AssetOfficialAccountJyService; import com.ruoyi.tc.service.AssetOfficialAccountService; @@ -30,6 +31,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.security.Security; +import java.util.ArrayList; import java.util.List; import static com.ruoyi.common.core.domain.AjaxResult.success; @@ -83,7 +85,20 @@ public class AssetOfficialAccountController { @ApiOperation(value = "通过主键查询单条公众号数据") @GetMapping("/{id}") public AjaxResult queryById(@PathVariable("id") Long id) { - return success(assetOfficialAccountService.getById(id)); + AssetOfficialAccount byId = assetOfficialAccountService.getById(id); + List a1 = new ArrayList<>(); + String[] s1 = byId.getCdmc().split("\\|"); + String[] s2 = byId.getCdlj().split("\\|"); + String[] s3 = byId.getCdlx().split("\\|"); + for (int i = 0; i < s1.length; i++) { + AssetOfficialAccountMenu as = new AssetOfficialAccountMenu(); + as.setCdmc(s1[i]); + as.setCdlj(s2[i]); + as.setCdlx(s3[i]); + a1.add(as); + } + byId.setCdList(a1); + return success(byId); } //================================================= @@ -94,6 +109,22 @@ public class AssetOfficialAccountController { @PreAuthorize("@ss.hasAnyRoles('unit')") @PostMapping("/unitEdit") public AjaxResult unitEdit(@RequestBody @Valid AssetOfficialAccountJyPo ao) { + + if (ao.getCdList() != null && !ao.getCdList().isEmpty()) { + StringBuilder a = new StringBuilder(); + StringBuilder b = new StringBuilder(); + StringBuilder c = new StringBuilder(); + ao.getCdList().forEach(x -> { + a.append(x.getCdmc()).append("|"); + b.append(x.getCdlj()).append("|"); + c.append(x.getCdlx()).append("|"); + }); + ao.setCdmc(a.toString()); + ao.setCdlj(b.toString()); + ao.setCdlx(c.toString()); + } + + AssetOfficialAccountJyPo one = assetOfficialAccountJyService.lambdaQuery().eq(AssetOfficialAccountJyPo::getSsdw,ao.getSsdw()) .eq(AssetOfficialAccountJyPo::getGzhmc,ao.getGzhmc()).isNull(AssetOfficialAccountJyPo::getTaskId).one(); ao.setAuditState("1"); @@ -138,7 +169,20 @@ public class AssetOfficialAccountController { @ApiOperation(value = "单位端查看中间数据详情", response = AssetOfficialAccountJyPo.class) @GetMapping("/lookInfo/{id}") public AjaxResult lookInfo(@PathVariable Long id) { - return success(assetOfficialAccountJyService.getById(id)); + AssetOfficialAccountJyPo byId = assetOfficialAccountJyService.getById(id); + List a1 = new ArrayList<>(); + String[] s1 = byId.getCdmc().split("\\|"); + String[] s2 = byId.getCdlj().split("\\|"); + String[] s3 = byId.getCdlx().split("\\|"); + for (int i = 0; i < s1.length; i++) { + AssetOfficialAccountMenu as = new AssetOfficialAccountMenu(); + as.setCdmc(s1[i]); + as.setCdlj(s2[i]); + as.setCdlx(s3[i]); + a1.add(as); + } + byId.setCdList(a1); + return success(byId); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/AssetOfficialAccount.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/AssetOfficialAccount.java index 01da433..a9439e9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/AssetOfficialAccount.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/AssetOfficialAccount.java @@ -6,11 +6,13 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.Excel; import com.ruoyi.tc.baseClass.BaseClass; +import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * 公众号资产表(asset_official_account)实体类 @@ -166,6 +168,13 @@ public class AssetOfficialAccount extends BaseClass implements Serializable { @ApiModelProperty("菜单类型") private String cdlx; + /** + * 菜单数组 + */ + @TableField(exist = false) + @ApiModelProperty("菜单类型") + private List cdList; + @ApiModelProperty("是否报废") private Integer isbf=0; /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/po/AssetOfficialAccountCpPo.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/po/AssetOfficialAccountCpPo.java index 94d8f65..97508ed 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/po/AssetOfficialAccountCpPo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/po/AssetOfficialAccountCpPo.java @@ -1,14 +1,17 @@ package com.ruoyi.tc.entity.po; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.tc.baseClass.BaseClass; +import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * 公众号资产表(asset_official_account_cp)实体类 @@ -148,6 +151,13 @@ public class AssetOfficialAccountCpPo extends BaseClass implements Serializable @ApiModelProperty("菜单类型") private String cdlx; + /** + * 菜单数组 + */ + @TableField(exist = false) + @ApiModelProperty("菜单类型") + private List cdList; + /** * 删除标志(0代表存在 2代表删除) */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/po/AssetOfficialAccountJyPo.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/po/AssetOfficialAccountJyPo.java index 0d627aa..ce2bb7a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/po/AssetOfficialAccountJyPo.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/po/AssetOfficialAccountJyPo.java @@ -1,15 +1,18 @@ package com.ruoyi.tc.entity.po; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.Excel; import com.ruoyi.tc.baseClass.BaseClass; +import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * 公众号资产表(asset_official_account_cp)实体类 @@ -167,6 +170,13 @@ public class AssetOfficialAccountJyPo extends BaseClass implements Serializable @ApiModelProperty("菜单类型") private String cdlx; + /** + * 菜单数组 + */ + @TableField(exist = false) + @ApiModelProperty("菜单类型") + private List cdList; + /** * 删除标志(0代表存在 2代表删除) */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/request/AssetOfficialAccountMenu.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/request/AssetOfficialAccountMenu.java new file mode 100644 index 0000000..68f601e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/request/AssetOfficialAccountMenu.java @@ -0,0 +1,28 @@ +package com.ruoyi.tc.entity.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 公众号资产菜单 + * @author du + * @since 2025/1/8 16:45 + */ +@Data +public class AssetOfficialAccountMenu { + /** + * 菜单名称 + */ + @ApiModelProperty("菜单名称") + private String cdmc; + /** + * 菜单链接 + */ + @ApiModelProperty("菜单链接") + private String cdlj; + /** + * 菜单类型 + */ + @ApiModelProperty("菜单类型") + private String cdlx; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetOfficialAccountServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetOfficialAccountServiceImpl.java index 69c86a6..1b4c9b6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetOfficialAccountServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetOfficialAccountServiceImpl.java @@ -83,6 +83,21 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl { + a.append(x.getCdmc()).append("|"); + b.append(x.getCdlj()).append("|"); + c.append(x.getCdlx()).append("|"); + }); + assetOfficialAccount.setCdmc(a.toString()); + assetOfficialAccount.setCdlj(b.toString()); + assetOfficialAccount.setCdlx(c.toString()); + } + + List list = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()) .eq(Unit::getDelFlag, 0).list(); if (list == null || list.isEmpty()) { @@ -109,6 +124,21 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl { + a.append(x.getCdmc()).append("|"); + b.append(x.getCdlj()).append("|"); + c.append(x.getCdlx()).append("|"); + }); + assetOfficialAccount.setCdmc(a.toString()); + assetOfficialAccount.setCdlj(b.toString()); + assetOfficialAccount.setCdlx(c.toString()); + } + + List list1 = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()).eq(Unit::getDelFlag, 0).list(); if (list1 == null || list1.isEmpty()) { throw new ServiceException("请选择已有单位!");