diff --git a/sf-payment/src/main/java/com/sf/payment/service/impl/HuaweiPaymentServiceImpl.java b/sf-payment/src/main/java/com/sf/payment/service/impl/HuaweiPaymentServiceImpl.java index c7c2abe..473d026 100644 --- a/sf-payment/src/main/java/com/sf/payment/service/impl/HuaweiPaymentServiceImpl.java +++ b/sf-payment/src/main/java/com/sf/payment/service/impl/HuaweiPaymentServiceImpl.java @@ -128,7 +128,7 @@ public class HuaweiPaymentServiceImpl implements IHuaweiPaymentService { bodyMap.put("purchaseOrderId", lastPurchaseOrder.getPurchaseOrderId()); // construct the Authorization in Header Map headers = buildAuthorization(huaweiPaymentConfig.getAppId(), bodyMap); - + log.info("调用华为主动续期入惨:{}", JSON.toJSONString(bodyMap)); // 订阅状态查询 String response = HttpUtil.createPost(ROOT_URL + SUBSCRIPTION_STATUS_QUERY_URL) .addHeaders(headers) diff --git a/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentServicePublishController.java b/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentServicePublishController.java index 89406df..0dd8fa3 100644 --- a/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentServicePublishController.java +++ b/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentServicePublishController.java @@ -123,7 +123,7 @@ public class DeploymentServicePublishController extends BaseController } /** - * 获取发布列表详细信息 + * 下架 */ @PreAuthorize("@ss.hasPermi('deployment:publish:sold:out')") @GetMapping(value = "/sold/out/{id}") diff --git a/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentWhitelistInfoController.java b/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentWhitelistInfoController.java new file mode 100644 index 0000000..8619710 --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentWhitelistInfoController.java @@ -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 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 list = deploymentWhitelistInfoService.selectDeploymentWhitelistInfoList(deploymentWhitelistInfo); + ExcelUtil util = new ExcelUtil(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)); + } + +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentWhitelistListController.java b/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentWhitelistListController.java new file mode 100644 index 0000000..0f0c786 --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/controller/DeploymentWhitelistListController.java @@ -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 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 list = deploymentWhitelistListService.selectDeploymentWhitelistListList(deploymentWhitelistList); + ExcelUtil util = new ExcelUtil(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())); + } +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/domain/DeploymentWhitelistInfo.java b/sf-system/src/main/java/com/sf/system/deployment/domain/DeploymentWhitelistInfo.java new file mode 100644 index 0000000..c515aaf --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/domain/DeploymentWhitelistInfo.java @@ -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 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(); + } +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/domain/DeploymentWhitelistList.java b/sf-system/src/main/java/com/sf/system/deployment/domain/DeploymentWhitelistList.java new file mode 100644 index 0000000..a24aae5 --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/domain/DeploymentWhitelistList.java @@ -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(); + } +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/domain/rqs/AddWhiteMemberRequest.java b/sf-system/src/main/java/com/sf/system/deployment/domain/rqs/AddWhiteMemberRequest.java new file mode 100755 index 0000000..05984bf --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/domain/rqs/AddWhiteMemberRequest.java @@ -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; +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/mapper/DeploymentWhitelistInfoMapper.java b/sf-system/src/main/java/com/sf/system/deployment/mapper/DeploymentWhitelistInfoMapper.java new file mode 100644 index 0000000..1f0e884 --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/mapper/DeploymentWhitelistInfoMapper.java @@ -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 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 deploymentWhitelistListList); + + + /** + * 通过白名单列表主键删除白名单成员列信息 + * + * @param id 白名单列表ID + * @return 结果 + */ + public int deleteDeploymentWhitelistListByWhitelistId(Long id); +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/mapper/DeploymentWhitelistListMapper.java b/sf-system/src/main/java/com/sf/system/deployment/mapper/DeploymentWhitelistListMapper.java new file mode 100644 index 0000000..d242af0 --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/mapper/DeploymentWhitelistListMapper.java @@ -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 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); +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/service/IDeploymentWhitelistInfoService.java b/sf-system/src/main/java/com/sf/system/deployment/service/IDeploymentWhitelistInfoService.java new file mode 100644 index 0000000..5f337e7 --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/service/IDeploymentWhitelistInfoService.java @@ -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 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); + +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/service/IDeploymentWhitelistListService.java b/sf-system/src/main/java/com/sf/system/deployment/service/IDeploymentWhitelistListService.java new file mode 100644 index 0000000..b6bd394 --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/service/IDeploymentWhitelistListService.java @@ -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 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; +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/service/impl/DeploymentWhitelistInfoServiceImpl.java b/sf-system/src/main/java/com/sf/system/deployment/service/impl/DeploymentWhitelistInfoServiceImpl.java new file mode 100644 index 0000000..bf7b3c8 --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/service/impl/DeploymentWhitelistInfoServiceImpl.java @@ -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 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 deploymentWhitelistListList = deploymentWhitelistInfo.getDeploymentWhitelistListList(); + Long id = deploymentWhitelistInfo.getId(); + if (StringUtils.isNotNull(deploymentWhitelistListList)) { + List list = new ArrayList(); + for (DeploymentWhitelistList deploymentWhitelistList : deploymentWhitelistListList) { + deploymentWhitelistList.setWhitelistId(id); + list.add(deploymentWhitelistList); + } + if (list.size() > 0) { + deploymentWhitelistInfoMapper.batchDeploymentWhitelistList(list); + } + } + } +} diff --git a/sf-system/src/main/java/com/sf/system/deployment/service/impl/DeploymentWhitelistListServiceImpl.java b/sf-system/src/main/java/com/sf/system/deployment/service/impl/DeploymentWhitelistListServiceImpl.java new file mode 100644 index 0000000..812b7ad --- /dev/null +++ b/sf-system/src/main/java/com/sf/system/deployment/service/impl/DeploymentWhitelistListServiceImpl.java @@ -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 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; + } +} diff --git a/sf-system/src/main/resources/mapper/system/deployment/DeploymentWhitelistInfoMapper.xml b/sf-system/src/main/resources/mapper/system/deployment/DeploymentWhitelistInfoMapper.xml new file mode 100644 index 0000000..b1f28ce --- /dev/null +++ b/sf-system/src/main/resources/mapper/system/deployment/DeploymentWhitelistInfoMapper.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into DEPLOYMENT_WHITELIST_INFO + + app_id, + app_code, + whitelist_name, + whitelist_type, + whitelist_mode, + status, + remarks, + order_num, + is_delete, + created, + modified, + create_time, + update_time, + + + #{appId}, + #{appCode}, + #{whitelistName}, + #{whitelistType}, + #{whitelistMode}, + #{status}, + #{remarks}, + #{orderNum}, + #{isDelete}, + #{created}, + #{modified}, + #{createTime}, + #{updateTime}, + + + + + + update DEPLOYMENT_WHITELIST_INFO + + app_id = #{appId}, + app_code = #{appCode}, + whitelist_name = #{whitelistName}, + whitelist_type = #{whitelistType}, + whitelist_mode = #{whitelistMode}, + status = #{status}, + remarks = #{remarks}, + order_num = #{orderNum}, + is_delete = #{isDelete}, + created = #{created}, + modified = #{modified}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from DEPLOYMENT_WHITELIST_INFO where id = #{id} + + + + delete from DEPLOYMENT_WHITELIST_INFO where id in + + #{id} + + + + + delete from DEPLOYMENT_WHITELIST_LIST where whitelist_id in + + #{whitelistId} + + + + + delete from DEPLOYMENT_WHITELIST_LIST where whitelist_id = #{whitelistId} + + + + 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 + + ( #{item.id}, #{item.whitelistId}, #{item.appId}, #{item.appCode}, #{item.user}, #{item.remarks}, #{item.orderNum}, #{item.isDelete}, #{item.created}, #{item.modified}, #{item.createTime}, #{item.updateTime}) + + + \ No newline at end of file diff --git a/sf-system/src/main/resources/mapper/system/deployment/DeploymentWhitelistListMapper.xml b/sf-system/src/main/resources/mapper/system/deployment/DeploymentWhitelistListMapper.xml new file mode 100644 index 0000000..9229e3b --- /dev/null +++ b/sf-system/src/main/resources/mapper/system/deployment/DeploymentWhitelistListMapper.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + select id, whitelist_id, app_id, app_code, user, remarks, order_num, is_delete, created, modified, create_time, update_time from DEPLOYMENT_WHITELIST_LIST + + + + + + + + insert into DEPLOYMENT_WHITELIST_LIST + + whitelist_id, + app_id, + app_code, + user, + remarks, + order_num, + is_delete, + created, + modified, + create_time, + update_time, + + + #{whitelistId}, + #{appId}, + #{appCode}, + #{user}, + #{remarks}, + #{orderNum}, + #{isDelete}, + #{created}, + #{modified}, + #{createTime}, + #{updateTime}, + + + + + update DEPLOYMENT_WHITELIST_LIST + + whitelist_id = #{whitelistId}, + app_id = #{appId}, + app_code = #{appCode}, + user = #{user}, + remarks = #{remarks}, + order_num = #{orderNum}, + is_delete = #{isDelete}, + created = #{created}, + modified = #{modified}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from DEPLOYMENT_WHITELIST_LIST where id = #{id} + + + + delete from DEPLOYMENT_WHITELIST_LIST where id in + + #{id} + + + \ No newline at end of file