公众号菜单新增和解析

dongdingding
杜函宇 5 days ago
parent 5e2af5b1b3
commit 203c1b1bc4

@ -16,6 +16,7 @@ import com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo;
import com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo; import com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo;
import com.ruoyi.tc.entity.request.AssetAuditPageRequest; import com.ruoyi.tc.entity.request.AssetAuditPageRequest;
import com.ruoyi.tc.entity.request.AssetAuditRequest; 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.entity.request.AssetOfficialAccountPageRequest;
import com.ruoyi.tc.service.AssetOfficialAccountJyService; import com.ruoyi.tc.service.AssetOfficialAccountJyService;
import com.ruoyi.tc.service.AssetOfficialAccountService; import com.ruoyi.tc.service.AssetOfficialAccountService;
@ -30,6 +31,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.security.Security; import java.security.Security;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.ruoyi.common.core.domain.AjaxResult.success; import static com.ruoyi.common.core.domain.AjaxResult.success;
@ -83,7 +85,20 @@ public class AssetOfficialAccountController {
@ApiOperation(value = "通过主键查询单条公众号数据") @ApiOperation(value = "通过主键查询单条公众号数据")
@GetMapping("/{id}") @GetMapping("/{id}")
public AjaxResult queryById(@PathVariable("id") Long id) { public AjaxResult queryById(@PathVariable("id") Long id) {
return success(assetOfficialAccountService.getById(id)); AssetOfficialAccount byId = assetOfficialAccountService.getById(id);
List<AssetOfficialAccountMenu> 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')") @PreAuthorize("@ss.hasAnyRoles('unit')")
@PostMapping("/unitEdit") @PostMapping("/unitEdit")
public AjaxResult unitEdit(@RequestBody @Valid AssetOfficialAccountJyPo ao) { 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()) AssetOfficialAccountJyPo one = assetOfficialAccountJyService.lambdaQuery().eq(AssetOfficialAccountJyPo::getSsdw,ao.getSsdw())
.eq(AssetOfficialAccountJyPo::getGzhmc,ao.getGzhmc()).isNull(AssetOfficialAccountJyPo::getTaskId).one(); .eq(AssetOfficialAccountJyPo::getGzhmc,ao.getGzhmc()).isNull(AssetOfficialAccountJyPo::getTaskId).one();
ao.setAuditState("1"); ao.setAuditState("1");
@ -138,7 +169,20 @@ public class AssetOfficialAccountController {
@ApiOperation(value = "单位端查看中间数据详情", response = AssetOfficialAccountJyPo.class) @ApiOperation(value = "单位端查看中间数据详情", response = AssetOfficialAccountJyPo.class)
@GetMapping("/lookInfo/{id}") @GetMapping("/lookInfo/{id}")
public AjaxResult lookInfo(@PathVariable Long id) { public AjaxResult lookInfo(@PathVariable Long id) {
return success(assetOfficialAccountJyService.getById(id)); AssetOfficialAccountJyPo byId = assetOfficialAccountJyService.getById(id);
List<AssetOfficialAccountMenu> 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);
} }
/** /**

@ -6,11 +6,13 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.tc.baseClass.BaseClass; import com.ruoyi.tc.baseClass.BaseClass;
import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* (asset_official_account) * (asset_official_account)
@ -166,6 +168,13 @@ public class AssetOfficialAccount extends BaseClass implements Serializable {
@ApiModelProperty("菜单类型") @ApiModelProperty("菜单类型")
private String cdlx; private String cdlx;
/**
*
*/
@TableField(exist = false)
@ApiModelProperty("菜单类型")
private List<AssetOfficialAccountMenu> cdList;
@ApiModelProperty("是否报废") @ApiModelProperty("是否报废")
private Integer isbf=0; private Integer isbf=0;
/** /**

@ -1,14 +1,17 @@
package com.ruoyi.tc.entity.po; package com.ruoyi.tc.entity.po;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.tc.baseClass.BaseClass; import com.ruoyi.tc.baseClass.BaseClass;
import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* (asset_official_account_cp) * (asset_official_account_cp)
@ -148,6 +151,13 @@ public class AssetOfficialAccountCpPo extends BaseClass implements Serializable
@ApiModelProperty("菜单类型") @ApiModelProperty("菜单类型")
private String cdlx; private String cdlx;
/**
*
*/
@TableField(exist = false)
@ApiModelProperty("菜单类型")
private List<AssetOfficialAccountMenu> cdList;
/** /**
* 0 2 * 0 2
*/ */

@ -1,15 +1,18 @@
package com.ruoyi.tc.entity.po; package com.ruoyi.tc.entity.po;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.tc.baseClass.BaseClass; import com.ruoyi.tc.baseClass.BaseClass;
import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* (asset_official_account_cp) * (asset_official_account_cp)
@ -167,6 +170,13 @@ public class AssetOfficialAccountJyPo extends BaseClass implements Serializable
@ApiModelProperty("菜单类型") @ApiModelProperty("菜单类型")
private String cdlx; private String cdlx;
/**
*
*/
@TableField(exist = false)
@ApiModelProperty("菜单类型")
private List<AssetOfficialAccountMenu> cdList;
/** /**
* 0 2 * 0 2
*/ */

@ -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;
}

@ -83,6 +83,21 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
*/ */
@Override @Override
public Boolean add(AssetOfficialAccount assetOfficialAccount) { public Boolean add(AssetOfficialAccount assetOfficialAccount) {
if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) {
StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder();
StringBuilder c = new StringBuilder();
assetOfficialAccount.getCdList().forEach(x -> {
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<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()) List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw())
.eq(Unit::getDelFlag, 0).list(); .eq(Unit::getDelFlag, 0).list();
if (list == null || list.isEmpty()) { if (list == null || list.isEmpty()) {
@ -109,6 +124,21 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl<AssetOfficialAc
@Override @Override
public Boolean edit(AssetOfficialAccount assetOfficialAccount) { public Boolean edit(AssetOfficialAccount assetOfficialAccount) {
if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) {
StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder();
StringBuilder c = new StringBuilder();
assetOfficialAccount.getCdList().forEach(x -> {
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<Unit> list1 = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()).eq(Unit::getDelFlag, 0).list(); List<Unit> list1 = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()).eq(Unit::getDelFlag, 0).list();
if (list1 == null || list1.isEmpty()) { if (list1 == null || list1.isEmpty()) {
throw new ServiceException("请选择已有单位!"); throw new ServiceException("请选择已有单位!");

Loading…
Cancel
Save