白名单后端接口

This commit is contained in:
pengren 2024-05-07 09:30:18 +08:00
parent a7396698f8
commit df7faa8536
15 changed files with 1345 additions and 2 deletions

View File

@ -128,7 +128,7 @@ public class HuaweiPaymentServiceImpl implements IHuaweiPaymentService {
bodyMap.put("purchaseOrderId", lastPurchaseOrder.getPurchaseOrderId());
// construct the Authorization in Header
Map<String, String> headers = buildAuthorization(huaweiPaymentConfig.getAppId(), bodyMap);
log.info("调用华为主动续期入惨:{}", JSON.toJSONString(bodyMap));
// 订阅状态查询
String response = HttpUtil.createPost(ROOT_URL + SUBSCRIPTION_STATUS_QUERY_URL)
.addHeaders(headers)

View File

@ -123,7 +123,7 @@ public class DeploymentServicePublishController extends BaseController
}
/**
* 获取发布列表详细信息
* 下架
*/
@PreAuthorize("@ss.hasPermi('deployment:publish:sold:out')")
@GetMapping(value = "/sold/out/{id}")

View File

@ -0,0 +1,128 @@
package com.sf.system.deployment.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.sf.common.enums.RequestHeaderEnums;
import com.sf.common.utils.http.RequestUtils;
import com.sf.system.deployment.domain.DeploymentWhitelistInfo;
import com.sf.system.deployment.service.IDeploymentWhitelistInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sf.common.annotation.Log;
import com.sf.common.core.controller.BaseController;
import com.sf.common.core.domain.AjaxResult;
import com.sf.common.enums.BusinessType;
import com.sf.common.utils.poi.ExcelUtil;
import com.sf.common.core.page.TableDataInfo;
/**
* 白名单列表Controller
*
* @author ztzh
* @date 2024-05-06
*/
@RestController
@RequestMapping("/deployment/whitelist")
public class DeploymentWhitelistInfoController extends BaseController
{
@Autowired
private IDeploymentWhitelistInfoService deploymentWhitelistInfoService;
/**
* 查询白名单列表列表
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelist:list')")
@GetMapping("/list")
public TableDataInfo list(DeploymentWhitelistInfo deploymentWhitelistInfo)
{
deploymentWhitelistInfo.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
startPage();
List<DeploymentWhitelistInfo> list = deploymentWhitelistInfoService.selectDeploymentWhitelistInfoList(deploymentWhitelistInfo);
return getDataTable(list);
}
/**
* 导出白名单列表列表
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelist:export')")
@Log(title = "白名单列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DeploymentWhitelistInfo deploymentWhitelistInfo)
{
deploymentWhitelistInfo.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
List<DeploymentWhitelistInfo> list = deploymentWhitelistInfoService.selectDeploymentWhitelistInfoList(deploymentWhitelistInfo);
ExcelUtil<DeploymentWhitelistInfo> util = new ExcelUtil<DeploymentWhitelistInfo>(DeploymentWhitelistInfo.class);
util.exportExcel(response, list, "白名单列表数据");
}
/**
* 获取白名单列表详细信息
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelist:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(deploymentWhitelistInfoService.selectDeploymentWhitelistInfoById(id));
}
/**
* 新增白名单列表
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelist:add')")
@Log(title = "白名单列表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DeploymentWhitelistInfo deploymentWhitelistInfo)
{
deploymentWhitelistInfo.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
return toAjax(deploymentWhitelistInfoService.insertDeploymentWhitelistInfo(deploymentWhitelistInfo));
}
/**
* 修改白名单列表
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelist:edit')")
@Log(title = "白名单列表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DeploymentWhitelistInfo deploymentWhitelistInfo)
{
return toAjax(deploymentWhitelistInfoService.updateDeploymentWhitelistInfo(deploymentWhitelistInfo));
}
/**
* 删除白名单列表
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelist:remove')")
@Log(title = "白名单列表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(deploymentWhitelistInfoService.deleteDeploymentWhitelistInfoByIds(ids));
}
/**
* 发布功能
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelist:publish')")
@GetMapping(value = "/publish/{id}")
public AjaxResult publish(@PathVariable("id") Long id) throws Exception {
return success(deploymentWhitelistInfoService.publish(id));
}
/**
* 下架功能
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelist:sold:out')")
@GetMapping(value = "/sold/out/{id}")
public AjaxResult soldOut(@PathVariable("id") Long id)
{
return success(deploymentWhitelistInfoService.soldOut(id));
}
}

View File

@ -0,0 +1,121 @@
package com.sf.system.deployment.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.ObjectUtil;
import com.sf.common.exception.ServiceException;
import com.sf.system.deployment.domain.DeploymentWhitelistList;
import com.sf.system.deployment.service.IDeploymentWhitelistListService;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.sf.common.annotation.Log;
import com.sf.common.core.controller.BaseController;
import com.sf.common.core.domain.AjaxResult;
import com.sf.common.enums.BusinessType;
import com.sf.common.utils.poi.ExcelUtil;
import com.sf.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 白名单成员列Controller
*
* @author ztzh
* @date 2024-05-06
*/
@RestController
@RequestMapping("/deployment/whitelistMember")
public class DeploymentWhitelistListController extends BaseController
{
@Autowired
private IDeploymentWhitelistListService deploymentWhitelistListService;
/**
* 查询白名单成员列列表
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelistMember:list')")
@GetMapping("/list")
public TableDataInfo list(DeploymentWhitelistList deploymentWhitelistList)
{
if(null == deploymentWhitelistList.getWhitelistId()){
throw new SecurityException("参数异常WhitelistId为空");
}
startPage();
List<DeploymentWhitelistList> list = deploymentWhitelistListService.selectDeploymentWhitelistListList(deploymentWhitelistList);
return getDataTable(list);
}
/**
* 导出白名单成员列列表
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelistMember:export')")
@Log(title = "白名单成员列", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DeploymentWhitelistList deploymentWhitelistList)
{
List<DeploymentWhitelistList> list = deploymentWhitelistListService.selectDeploymentWhitelistListList(deploymentWhitelistList);
ExcelUtil<DeploymentWhitelistList> util = new ExcelUtil<DeploymentWhitelistList>(DeploymentWhitelistList.class);
util.exportExcel(response, list, "白名单成员列数据");
}
/**
* 获取白名单成员列详细信息
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelistMember:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(deploymentWhitelistListService.selectDeploymentWhitelistListById(id));
}
/**
* 新增白名单成员列
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelistMember:add')")
@Log(title = "白名单成员列", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DeploymentWhitelistList deploymentWhitelistList)
{
return toAjax(deploymentWhitelistListService.insertDeploymentWhitelistList(deploymentWhitelistList,getUsername()));
}
/**
* 修改白名单成员列
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelistMember:edit')")
@Log(title = "白名单成员列", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DeploymentWhitelistList deploymentWhitelistList)
{
return toAjax(deploymentWhitelistListService.updateDeploymentWhitelistList(deploymentWhitelistList));
}
/**
* 删除白名单成员列
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelistMember:remove')")
@Log(title = "白名单成员列", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(deploymentWhitelistListService.deleteDeploymentWhitelistListByIds(ids));
}
/**
* 批量导入
*
* @param file 文件
*/
@PreAuthorize("@ss.hasPermi('deployment:whitelistMember:batch:import')")
@Log(title = "批量上传", businessType = BusinessType.INSERT)
@PostMapping(value = "/batch/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public AjaxResult batchImport(@RequestPart("file") MultipartFile file,Long whitelistId) throws IOException {
if (ObjectUtil.isNull(file)) {
throw new ServiceException("上传文件不能为空");
}
return toAjax(deploymentWhitelistListService.batchImport(file,whitelistId,getUsername()));
}
}

View File

@ -0,0 +1,95 @@
package com.sf.system.deployment.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.sf.common.annotation.Excel;
import com.sf.common.core.domain.BaseEntity;
/**
* 白名单列表对象 DEPLOYMENT_WHITELIST_INFO
*
* @author ztzh
* @date 2024-05-06
*/
@Data
public class DeploymentWhitelistInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 应用id */
private Long appId;
/** 应用id */
@Excel(name = "应用id")
private String appCode;
/** 白名单名称 */
@Excel(name = "白名单名称")
private String whitelistName;
/** 白名单类型 */
@Excel(name = "白名单类型")
private Long whitelistType;
/** 白名单模式 */
@Excel(name = "白名单模式")
private Long whitelistMode;
/** 状态 */
@Excel(name = "状态")
private Long status;
/** 备注 */
@Excel(name = "备注")
private String remarks;
/** 排序 */
private Long orderNum;
/** 逻辑删除,0:未删除,1:删除 */
private Long isDelete;
/** 创建人 */
private String created;
/** 更新人 */
private String modified;
/** 白名单成员列信息 */
private List<DeploymentWhitelistList> deploymentWhitelistListList;
/** 开始时间 */
private Date beginTime;
/** 开始时间 */
private Date endTime;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("appId", getAppId())
.append("appCode", getAppCode())
.append("whitelistName", getWhitelistName())
.append("whitelistType", getWhitelistType())
.append("whitelistMode", getWhitelistMode())
.append("status", getStatus())
.append("remarks", getRemarks())
.append("orderNum", getOrderNum())
.append("isDelete", getIsDelete())
.append("created", getCreated())
.append("modified", getModified())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("deploymentWhitelistListList", getDeploymentWhitelistListList())
.toString();
}
}

View File

@ -0,0 +1,165 @@
package com.sf.system.deployment.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.sf.common.annotation.Excel;
import com.sf.common.core.domain.BaseEntity;
/**
* 白名单成员列对象 DEPLOYMENT_WHITELIST_LIST
*
* @author ztzh
* @date 2024-05-06
*/
public class DeploymentWhitelistList extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 白名单id */
@Excel(name = "白名单id")
private Long whitelistId;
/** 应用id */
@Excel(name = "应用id")
private Long appId;
/** 应用code */
@Excel(name = "应用code")
private String appCode;
/** 人员或设备id */
@Excel(name = "人员或设备id")
private String user;
/** 备注 */
@Excel(name = "备注")
private String remarks;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 逻辑删除,0:未删除,1:删除 */
@Excel(name = "逻辑删除,0:未删除,1:删除")
private Long isDelete;
/** 创建人 */
@Excel(name = "创建人")
private String created;
/** 更新人 */
@Excel(name = "更新人")
private String modified;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setWhitelistId(Long whitelistId)
{
this.whitelistId = whitelistId;
}
public Long getWhitelistId()
{
return whitelistId;
}
public void setAppId(Long appId)
{
this.appId = appId;
}
public Long getAppId()
{
return appId;
}
public void setAppCode(String appCode)
{
this.appCode = appCode;
}
public String getAppCode()
{
return appCode;
}
public void setUser(String user)
{
this.user = user;
}
public String getUser()
{
return user;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setIsDelete(Long isDelete)
{
this.isDelete = isDelete;
}
public Long getIsDelete()
{
return isDelete;
}
public void setCreated(String created)
{
this.created = created;
}
public String getCreated()
{
return created;
}
public void setModified(String modified)
{
this.modified = modified;
}
public String getModified()
{
return modified;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("whitelistId", getWhitelistId())
.append("appId", getAppId())
.append("appCode", getAppCode())
.append("user", getUser())
.append("remarks", getRemarks())
.append("orderNum", getOrderNum())
.append("isDelete", getIsDelete())
.append("created", getCreated())
.append("modified", getModified())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,16 @@
package com.sf.system.deployment.domain.rqs;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class AddWhiteMemberRequest {
@NotBlank
private Long whitelistId;
@NotBlank
private String userId;
}

View File

@ -0,0 +1,89 @@
package com.sf.system.deployment.mapper;
import com.sf.system.deployment.domain.DeploymentWhitelistInfo;
import com.sf.system.deployment.domain.DeploymentWhitelistList;
import java.util.List;
/**
* 白名单列表Mapper接口
*
* @author ztzh
* @date 2024-05-06
*/
public interface DeploymentWhitelistInfoMapper
{
/**
* 查询白名单列表
*
* @param id 白名单列表主键
* @return 白名单列表
*/
public DeploymentWhitelistInfo selectDeploymentWhitelistInfoById(Long id);
/**
* 查询白名单列表列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 白名单列表集合
*/
public List<DeploymentWhitelistInfo> selectDeploymentWhitelistInfoList(DeploymentWhitelistInfo deploymentWhitelistInfo);
/**
* 新增白名单列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 结果
*/
public int insertDeploymentWhitelistInfo(DeploymentWhitelistInfo deploymentWhitelistInfo);
/**
* 修改白名单列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 结果
*/
public int updateDeploymentWhitelistInfo(DeploymentWhitelistInfo deploymentWhitelistInfo);
/**
* 删除白名单列表
*
* @param id 白名单列表主键
* @return 结果
*/
public int deleteDeploymentWhitelistInfoById(Long id);
/**
* 批量删除白名单列表
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDeploymentWhitelistInfoByIds(Long[] ids);
/**
* 批量删除白名单成员列
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDeploymentWhitelistListByWhitelistIds(Long[] ids);
/**
* 批量新增白名单成员列
*
* @param deploymentWhitelistListList 白名单成员列列表
* @return 结果
*/
public int batchDeploymentWhitelistList(List<DeploymentWhitelistList> deploymentWhitelistListList);
/**
* 通过白名单列表主键删除白名单成员列信息
*
* @param id 白名单列表ID
* @return 结果
*/
public int deleteDeploymentWhitelistListByWhitelistId(Long id);
}

View File

@ -0,0 +1,62 @@
package com.sf.system.deployment.mapper;
import com.sf.system.deployment.domain.DeploymentWhitelistList;
import java.util.List;
/**
* 白名单成员列Mapper接口
*
* @author ztzh
* @date 2024-05-06
*/
public interface DeploymentWhitelistListMapper
{
/**
* 查询白名单成员列
*
* @param id 白名单成员列主键
* @return 白名单成员列
*/
public DeploymentWhitelistList selectDeploymentWhitelistListById(Long id);
/**
* 查询白名单成员列列表
*
* @param deploymentWhitelistList 白名单成员列
* @return 白名单成员列集合
*/
public List<DeploymentWhitelistList> selectDeploymentWhitelistListList(DeploymentWhitelistList deploymentWhitelistList);
/**
* 新增白名单成员列
*
* @param deploymentWhitelistList 白名单成员列
* @return 结果
*/
public int insertDeploymentWhitelistList(DeploymentWhitelistList deploymentWhitelistList);
/**
* 修改白名单成员列
*
* @param deploymentWhitelistList 白名单成员列
* @return 结果
*/
public int updateDeploymentWhitelistList(DeploymentWhitelistList deploymentWhitelistList);
/**
* 删除白名单成员列
*
* @param id 白名单成员列主键
* @return 结果
*/
public int deleteDeploymentWhitelistListById(Long id);
/**
* 批量删除白名单成员列
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDeploymentWhitelistListByIds(Long[] ids);
}

View File

@ -0,0 +1,77 @@
package com.sf.system.deployment.service;
import com.sf.system.deployment.domain.DeploymentWhitelistInfo;
import java.util.List;
/**
* 白名单列表Service接口
*
* @author ztzh
* @date 2024-05-06
*/
public interface IDeploymentWhitelistInfoService
{
/**
* 查询白名单列表
*
* @param id 白名单列表主键
* @return 白名单列表
*/
public DeploymentWhitelistInfo selectDeploymentWhitelistInfoById(Long id);
/**
* 查询白名单列表列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 白名单列表集合
*/
public List<DeploymentWhitelistInfo> selectDeploymentWhitelistInfoList(DeploymentWhitelistInfo deploymentWhitelistInfo);
/**
* 新增白名单列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 结果
*/
public int insertDeploymentWhitelistInfo(DeploymentWhitelistInfo deploymentWhitelistInfo);
/**
* 修改白名单列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 结果
*/
public int updateDeploymentWhitelistInfo(DeploymentWhitelistInfo deploymentWhitelistInfo);
/**
* 发布功能
* @param id
* @return
*/
public int publish(Long id);
/**
* 下架功能
* @param id
* @return
*/
public int soldOut(Long id);
/**
* 批量删除白名单列表
*
* @param ids 需要删除的白名单列表主键集合
* @return 结果
*/
public int deleteDeploymentWhitelistInfoByIds(Long[] ids);
/**
* 删除白名单列表信息
*
* @param id 白名单列表主键
* @return 结果
*/
public int deleteDeploymentWhitelistInfoById(Long id);
}

View File

@ -0,0 +1,67 @@
package com.sf.system.deployment.service;
import com.sf.system.deployment.domain.DeploymentWhitelistList;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
/**
* 白名单成员列Service接口
*
* @author ztzh
* @date 2024-05-06
*/
public interface IDeploymentWhitelistListService
{
/**
* 查询白名单成员列
*
* @param id 白名单成员列主键
* @return 白名单成员列
*/
public DeploymentWhitelistList selectDeploymentWhitelistListById(Long id);
/**
* 查询白名单成员列列表
*
* @param deploymentWhitelistList 白名单成员列
* @return 白名单成员列集合
*/
public List<DeploymentWhitelistList> selectDeploymentWhitelistListList(DeploymentWhitelistList deploymentWhitelistList);
/**
* 新增白名单成员列
*
* @param deploymentWhitelistList 白名单成员列
* @param username
* @return 结果
*/
public int insertDeploymentWhitelistList(DeploymentWhitelistList deploymentWhitelistList, String username);
/**
* 修改白名单成员列
*
* @param deploymentWhitelistList 白名单成员列
* @return 结果
*/
public int updateDeploymentWhitelistList(DeploymentWhitelistList deploymentWhitelistList);
/**
* 批量删除白名单成员列
*
* @param ids 需要删除的白名单成员列主键集合
* @return 结果
*/
public int deleteDeploymentWhitelistListByIds(Long[] ids);
/**
* 删除白名单成员列信息
*
* @param id 白名单成员列主键
* @return 结果
*/
public int deleteDeploymentWhitelistListById(Long id);
public int batchImport(MultipartFile file, Long whitelistId, String username) throws IOException;
}

View File

@ -0,0 +1,142 @@
package com.sf.system.deployment.service.impl;
import java.util.List;
import com.sf.common.utils.DateUtils;
import com.sf.system.deployment.domain.DeploymentWhitelistInfo;
import com.sf.system.deployment.domain.DeploymentWhitelistList;
import com.sf.system.deployment.mapper.DeploymentWhitelistInfoMapper;
import com.sf.system.deployment.service.IDeploymentWhitelistInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.sf.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* 白名单列表Service业务层处理
*
* @author ztzh
* @date 2024-05-06
*/
@Service
public class DeploymentWhitelistInfoServiceImpl implements IDeploymentWhitelistInfoService {
@Autowired
private DeploymentWhitelistInfoMapper deploymentWhitelistInfoMapper;
/**
* 查询白名单列表
*
* @param id 白名单列表主键
* @return 白名单列表
*/
@Override
public DeploymentWhitelistInfo selectDeploymentWhitelistInfoById(Long id) {
return deploymentWhitelistInfoMapper.selectDeploymentWhitelistInfoById(id);
}
/**
* 查询白名单列表列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 白名单列表
*/
@Override
public List<DeploymentWhitelistInfo> selectDeploymentWhitelistInfoList(DeploymentWhitelistInfo deploymentWhitelistInfo) {
return deploymentWhitelistInfoMapper.selectDeploymentWhitelistInfoList(deploymentWhitelistInfo);
}
/**
* 新增白名单列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 结果
*/
@Transactional
@Override
public int insertDeploymentWhitelistInfo(DeploymentWhitelistInfo deploymentWhitelistInfo) {
deploymentWhitelistInfo.setCreateTime(DateUtils.getNowDate());
int rows = deploymentWhitelistInfoMapper.insertDeploymentWhitelistInfo(deploymentWhitelistInfo);
insertDeploymentWhitelistList(deploymentWhitelistInfo);
return rows;
}
/**
* 修改白名单列表
*
* @param deploymentWhitelistInfo 白名单列表
* @return 结果
*/
@Transactional
@Override
public int updateDeploymentWhitelistInfo(DeploymentWhitelistInfo deploymentWhitelistInfo) {
deploymentWhitelistInfo.setUpdateTime(DateUtils.getNowDate());
deploymentWhitelistInfoMapper.deleteDeploymentWhitelistListByWhitelistId(deploymentWhitelistInfo.getId());
insertDeploymentWhitelistList(deploymentWhitelistInfo);
return deploymentWhitelistInfoMapper.updateDeploymentWhitelistInfo(deploymentWhitelistInfo);
}
@Override
public int publish(Long id) {
DeploymentWhitelistInfo deploymentWhitelistInfo = deploymentWhitelistInfoMapper.selectDeploymentWhitelistInfoById(id);
deploymentWhitelistInfo.setStatus(1L);
return deploymentWhitelistInfoMapper.updateDeploymentWhitelistInfo(deploymentWhitelistInfo);
}
@Override
public int soldOut(Long id) {
DeploymentWhitelistInfo deploymentWhitelistInfo = deploymentWhitelistInfoMapper.selectDeploymentWhitelistInfoById(id);
deploymentWhitelistInfo.setStatus(0L);
return deploymentWhitelistInfoMapper.updateDeploymentWhitelistInfo(deploymentWhitelistInfo);
}
/**
* 批量删除白名单列表
*
* @param ids 需要删除的白名单列表主键
* @return 结果
*/
@Transactional
@Override
public int deleteDeploymentWhitelistInfoByIds(Long[] ids) {
deploymentWhitelistInfoMapper.deleteDeploymentWhitelistListByWhitelistIds(ids);
return deploymentWhitelistInfoMapper.deleteDeploymentWhitelistInfoByIds(ids);
}
/**
* 删除白名单列表信息
*
* @param id 白名单列表主键
* @return 结果
*/
@Transactional
@Override
public int deleteDeploymentWhitelistInfoById(Long id) {
deploymentWhitelistInfoMapper.deleteDeploymentWhitelistListByWhitelistId(id);
return deploymentWhitelistInfoMapper.deleteDeploymentWhitelistInfoById(id);
}
/**
* 新增白名单成员列信息
*
* @param deploymentWhitelistInfo 白名单列表对象
*/
public void insertDeploymentWhitelistList(DeploymentWhitelistInfo deploymentWhitelistInfo) {
List<DeploymentWhitelistList> deploymentWhitelistListList = deploymentWhitelistInfo.getDeploymentWhitelistListList();
Long id = deploymentWhitelistInfo.getId();
if (StringUtils.isNotNull(deploymentWhitelistListList)) {
List<DeploymentWhitelistList> list = new ArrayList<DeploymentWhitelistList>();
for (DeploymentWhitelistList deploymentWhitelistList : deploymentWhitelistListList) {
deploymentWhitelistList.setWhitelistId(id);
list.add(deploymentWhitelistList);
}
if (list.size() > 0) {
deploymentWhitelistInfoMapper.batchDeploymentWhitelistList(list);
}
}
}
}

View File

@ -0,0 +1,132 @@
package com.sf.system.deployment.service.impl;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import com.sf.common.enums.RequestHeaderEnums;
import com.sf.common.utils.DateUtils;
import com.sf.common.utils.StringUtils;
import com.sf.common.utils.http.RequestUtils;
import com.sf.system.deployment.domain.DeploymentWhitelistList;
import com.sf.system.deployment.mapper.DeploymentWhitelistListMapper;
import com.sf.system.deployment.service.IDeploymentWhitelistListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
/**
* 白名单成员列Service业务层处理
*
* @author ztzh
* @date 2024-05-06
*/
@Service
public class DeploymentWhitelistListServiceImpl implements IDeploymentWhitelistListService
{
@Autowired
private DeploymentWhitelistListMapper deploymentWhitelistListMapper;
/**
* 查询白名单成员列
*
* @param id 白名单成员列主键
* @return 白名单成员列
*/
@Override
public DeploymentWhitelistList selectDeploymentWhitelistListById(Long id)
{
return deploymentWhitelistListMapper.selectDeploymentWhitelistListById(id);
}
/**
* 查询白名单成员列列表
*
* @param deploymentWhitelistList 白名单成员列
* @return 白名单成员列
*/
@Override
public List<DeploymentWhitelistList> selectDeploymentWhitelistListList(DeploymentWhitelistList deploymentWhitelistList)
{
return deploymentWhitelistListMapper.selectDeploymentWhitelistListList(deploymentWhitelistList);
}
/**
* 新增白名单成员列
*
* @param member 白名单成员列
* @param username
* @return 结果
*/
@Override
public int insertDeploymentWhitelistList(DeploymentWhitelistList member, String username)
{
if(null == member.getWhitelistId()){
throw new SecurityException("参数异常WhitelistId为空");
}
member.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
member.setCreated(username);
member.setCreateTime(DateUtils.getNowDate());
member.setModified(username);
member.setUpdateTime(DateUtils.getNowDate());
member.setCreateTime(DateUtils.getNowDate());
return deploymentWhitelistListMapper.insertDeploymentWhitelistList(member);
}
/**
* 修改白名单成员列
*
* @param deploymentWhitelistList 白名单成员列
* @return 结果
*/
@Override
public int updateDeploymentWhitelistList(DeploymentWhitelistList deploymentWhitelistList)
{
deploymentWhitelistList.setUpdateTime(DateUtils.getNowDate());
return deploymentWhitelistListMapper.updateDeploymentWhitelistList(deploymentWhitelistList);
}
/**
* 批量删除白名单成员列
*
* @param ids 需要删除的白名单成员列主键
* @return 结果
*/
@Override
public int deleteDeploymentWhitelistListByIds(Long[] ids)
{
return deploymentWhitelistListMapper.deleteDeploymentWhitelistListByIds(ids);
}
/**
* 删除白名单成员列信息
*
* @param id 白名单成员列主键
* @return 结果
*/
@Override
public int deleteDeploymentWhitelistListById(Long id)
{
return deploymentWhitelistListMapper.deleteDeploymentWhitelistListById(id);
}
@Override
public int batchImport(MultipartFile file, Long whitelistId, String username) throws IOException {
String content = "";
try {
byte[] data = file.getBytes();
content = new String(data, StandardCharsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
}
content.replaceAll("/n","");
String[] split = StringUtils.split(content, ",");
for (String user : split) {
DeploymentWhitelistList menber = new DeploymentWhitelistList();
menber.setWhitelistId(whitelistId);
menber.setUser(user.trim());
insertDeploymentWhitelistList(menber, username);
}
return 1;
}
}

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sf.system.deployment.mapper.DeploymentWhitelistInfoMapper">
<resultMap type="DeploymentWhitelistInfo" id="DeploymentWhitelistInfoResult">
<result property="id" column="id" />
<result property="appId" column="app_id" />
<result property="appCode" column="app_code" />
<result property="whitelistName" column="whitelist_name" />
<result property="whitelistType" column="whitelist_type" />
<result property="whitelistMode" column="whitelist_mode" />
<result property="status" column="status" />
<result property="remarks" column="remarks" />
<result property="orderNum" column="order_num" />
<result property="isDelete" column="is_delete" />
<result property="created" column="created" />
<result property="modified" column="modified" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="DeploymentWhitelistInfoDeploymentWhitelistListResult" type="DeploymentWhitelistInfo" extends="DeploymentWhitelistInfoResult">
<collection property="deploymentWhitelistListList" notNullColumn="sub_id" javaType="java.util.List" resultMap="DeploymentWhitelistListResult" />
</resultMap>
<resultMap type="DeploymentWhitelistList" id="DeploymentWhitelistListResult">
<result property="id" column="sub_id" />
<result property="whitelistId" column="sub_whitelist_id" />
<result property="appId" column="sub_app_id" />
<result property="appCode" column="sub_app_code" />
<result property="user" column="sub_user_id" />
<result property="remarks" column="sub_remarks" />
<result property="orderNum" column="sub_order_num" />
<result property="isDelete" column="sub_is_delete" />
<result property="created" column="sub_created" />
<result property="modified" column="sub_modified" />
<result property="createTime" column="sub_create_time" />
<result property="updateTime" column="sub_update_time" />
</resultMap>
<sql id="selectDeploymentWhitelistInfoVo">
select id, app_id, app_code, whitelist_name, whitelist_type, whitelist_mode, status, remarks, order_num, is_delete, created, modified, create_time, update_time from DEPLOYMENT_WHITELIST_INFO
</sql>
<select id="selectDeploymentWhitelistInfoList" parameterType="DeploymentWhitelistInfo" resultMap="DeploymentWhitelistInfoResult">
<include refid="selectDeploymentWhitelistInfoVo"/>
<where>
<if test="appCode != null and appCode != ''"> and app_code = #{appCode}</if>
<if test="whitelistName != null and whitelistName != ''"> and whitelist_name like concat('%', #{whitelistName}, '%')</if>
<if test="whitelistType != null "> and whitelist_type = #{whitelistType}</if>
<if test="whitelistMode != null "> and whitelist_mode = #{whitelistMode}</if>
<if test="status != null "> and status = #{status}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
<if test="beginTime != null">and create_time <![CDATA[>]]> #{beginTime}</if>
<if test="endTime != null">and create_time <![CDATA[<]]> #{endTime}</if>
</where>
</select>
<select id="selectDeploymentWhitelistInfoById" parameterType="Long" resultMap="DeploymentWhitelistInfoDeploymentWhitelistListResult">
select a.id, a.app_id, a.app_code, a.whitelist_name, a.whitelist_type, a.whitelist_mode, a.status, a.remarks, a.order_num, a.is_delete, a.created, a.modified, a.create_time, a.update_time,
b.id as sub_id, b.whitelist_id as sub_whitelist_id, b.app_id as sub_app_id, b.app_code as sub_app_code, b.user as sub_user, b.remarks as sub_remarks, b.order_num as sub_order_num, b.is_delete as sub_is_delete, b.created as sub_created, b.modified as sub_modified, b.create_time as sub_create_time, b.update_time as sub_update_time
from DEPLOYMENT_WHITELIST_INFO a
left join DEPLOYMENT_WHITELIST_LIST b on b.whitelist_id = a.id
where a.id = #{id}
</select>
<insert id="insertDeploymentWhitelistInfo" parameterType="DeploymentWhitelistInfo" useGeneratedKeys="true" keyProperty="id">
insert into DEPLOYMENT_WHITELIST_INFO
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="appId != null">app_id,</if>
<if test="appCode != null">app_code,</if>
<if test="whitelistName != null and whitelistName != ''">whitelist_name,</if>
<if test="whitelistType != null">whitelist_type,</if>
<if test="whitelistMode != null">whitelist_mode,</if>
<if test="status != null">status,</if>
<if test="remarks != null">remarks,</if>
<if test="orderNum != null">order_num,</if>
<if test="isDelete != null">is_delete,</if>
<if test="created != null">created,</if>
<if test="modified != null">modified,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="appId != null">#{appId},</if>
<if test="appCode != null">#{appCode},</if>
<if test="whitelistName != null and whitelistName != ''">#{whitelistName},</if>
<if test="whitelistType != null">#{whitelistType},</if>
<if test="whitelistMode != null">#{whitelistMode},</if>
<if test="status != null">#{status},</if>
<if test="remarks != null">#{remarks},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="created != null">#{created},</if>
<if test="modified != null">#{modified},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDeploymentWhitelistInfo" parameterType="DeploymentWhitelistInfo">
update DEPLOYMENT_WHITELIST_INFO
<trim prefix="SET" suffixOverrides=",">
<if test="appId != null">app_id = #{appId},</if>
<if test="appCode != null">app_code = #{appCode},</if>
<if test="whitelistName != null and whitelistName != ''">whitelist_name = #{whitelistName},</if>
<if test="whitelistType != null">whitelist_type = #{whitelistType},</if>
<if test="whitelistMode != null">whitelist_mode = #{whitelistMode},</if>
<if test="status != null">status = #{status},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="created != null">created = #{created},</if>
<if test="modified != null">modified = #{modified},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDeploymentWhitelistInfoById" parameterType="Long">
delete from DEPLOYMENT_WHITELIST_INFO where id = #{id}
</delete>
<delete id="deleteDeploymentWhitelistInfoByIds" parameterType="String">
delete from DEPLOYMENT_WHITELIST_INFO where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteDeploymentWhitelistListByWhitelistIds" parameterType="String">
delete from DEPLOYMENT_WHITELIST_LIST where whitelist_id in
<foreach item="whitelistId" collection="array" open="(" separator="," close=")">
#{whitelistId}
</foreach>
</delete>
<delete id="deleteDeploymentWhitelistListByWhitelistId" parameterType="Long">
delete from DEPLOYMENT_WHITELIST_LIST where whitelist_id = #{whitelistId}
</delete>
<insert id="batchDeploymentWhitelistList">
insert into DEPLOYMENT_WHITELIST_LIST( id, whitelist_id, app_id, app_code, user, remarks, order_num, is_delete, created, modified, create_time, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.whitelistId}, #{item.appId}, #{item.appCode}, #{item.user}, #{item.remarks}, #{item.orderNum}, #{item.isDelete}, #{item.created}, #{item.modified}, #{item.createTime}, #{item.updateTime})
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sf.system.deployment.mapper.DeploymentWhitelistListMapper">
<resultMap type="DeploymentWhitelistList" id="DeploymentWhitelistListResult">
<result property="id" column="id" />
<result property="whitelistId" column="whitelist_id" />
<result property="appId" column="app_id" />
<result property="appCode" column="app_code" />
<result property="user" column="user" />
<result property="remarks" column="remarks" />
<result property="orderNum" column="order_num" />
<result property="isDelete" column="is_delete" />
<result property="created" column="created" />
<result property="modified" column="modified" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDeploymentWhitelistListVo">
select id, whitelist_id, app_id, app_code, user, remarks, order_num, is_delete, created, modified, create_time, update_time from DEPLOYMENT_WHITELIST_LIST
</sql>
<select id="selectDeploymentWhitelistListList" parameterType="DeploymentWhitelistList" resultMap="DeploymentWhitelistListResult">
<include refid="selectDeploymentWhitelistListVo"/>
<where>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="user != null "> and user = #{user}</if>
</where>
</select>
<select id="selectDeploymentWhitelistListById" parameterType="Long" resultMap="DeploymentWhitelistListResult">
<include refid="selectDeploymentWhitelistListVo"/>
where id = #{id}
</select>
<insert id="insertDeploymentWhitelistList" parameterType="DeploymentWhitelistList" useGeneratedKeys="true" keyProperty="id">
insert into DEPLOYMENT_WHITELIST_LIST
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="whitelistId != null">whitelist_id,</if>
<if test="appId != null">app_id,</if>
<if test="appCode != null">app_code,</if>
<if test="user != null and user != ''">user,</if>
<if test="remarks != null">remarks,</if>
<if test="orderNum != null">order_num,</if>
<if test="isDelete != null">is_delete,</if>
<if test="created != null">created,</if>
<if test="modified != null">modified,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="whitelistId != null">#{whitelistId},</if>
<if test="appId != null">#{appId},</if>
<if test="appCode != null">#{appCode},</if>
<if test="user != null and user != ''">#{user},</if>
<if test="remarks != null">#{remarks},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="created != null">#{created},</if>
<if test="modified != null">#{modified},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDeploymentWhitelistList" parameterType="DeploymentWhitelistList">
update DEPLOYMENT_WHITELIST_LIST
<trim prefix="SET" suffixOverrides=",">
<if test="whitelistId != null">whitelist_id = #{whitelistId},</if>
<if test="appId != null">app_id = #{appId},</if>
<if test="appCode != null">app_code = #{appCode},</if>
<if test="user != null and user != ''">user = #{user},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="created != null">created = #{created},</if>
<if test="modified != null">modified = #{modified},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDeploymentWhitelistListById" parameterType="Long">
delete from DEPLOYMENT_WHITELIST_LIST where id = #{id}
</delete>
<delete id="deleteDeploymentWhitelistListByIds" parameterType="String">
delete from DEPLOYMENT_WHITELIST_LIST where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>