From f9662eab1855bfa2350681cde00b19a79108e694 Mon Sep 17 00:00:00 2001 From: "382696293@qq.com" <382696293@qq.com> Date: Wed, 13 Dec 2023 10:00:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8F=82=E6=95=B0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/entity/WxParameterSetting.java | 221 ++++++++++ .../mapper/WxParameterSettingMapper.java | 61 +++ .../hzMapper/WxParameterSettingMapper.xml | 133 ++++++ .../config/properties/WxConfig.java | 26 -- .../miniProgram/utils/MiniProgramUtils.java | 22 +- .../WxParameterSettingController.java | 99 +++++ .../service/IWxParameterSettingService.java | 61 +++ .../impl/WxParameterSettingServiceImpl.java | 90 ++++ flossom-ui/src/api/system/wxSetting.js | 44 ++ .../src/views/system/wxSetting/index.vue | 397 ++++++++++++++++++ 10 files changed, 1127 insertions(+), 27 deletions(-) create mode 100644 flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxParameterSetting.java create mode 100644 flossom-common/flossom-common-hzMapper/src/main/java/com/flossom/hzMapper/mapper/WxParameterSettingMapper.java create mode 100644 flossom-common/flossom-common-hzMapper/src/main/resources/mapper/hzMapper/WxParameterSettingMapper.xml create mode 100644 flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxParameterSettingController.java create mode 100644 flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxParameterSettingService.java create mode 100644 flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxParameterSettingServiceImpl.java create mode 100644 flossom-ui/src/api/system/wxSetting.js create mode 100644 flossom-ui/src/views/system/wxSetting/index.vue diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxParameterSetting.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxParameterSetting.java new file mode 100644 index 0000000..ae3f817 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxParameterSetting.java @@ -0,0 +1,221 @@ +package com.flossom.common.core.domain.entity; + +import com.flossom.common.core.annotation.Excel; +import com.flossom.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 微信参数配属对象 wx_parameter_setting + * + * @author flossom + * @date 2023-12-13 + */ +public class WxParameterSetting extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 小程序appid + */ + @Excel(name = "小程序appid") + private String appid; + + /** + * 小程序密钥 + */ + @Excel(name = "小程序密钥") + private String appkey; + + /** + * 商户号 + */ + @Excel(name = "商户号") + private String merchantId; + + /** + * 商户号API密钥 + */ + @Excel(name = "商户号API密钥") + private String merchantApiKey; + + /** + * 开放key(32位) + */ + @Excel(name = "开放key(32位)") + private String openKey; + + /** + * 开放密钥(64位) + */ + @Excel(name = "开放密钥(64位)") + private String openSecret; + + /** + * 绑定ip,多个ip“;“分割 + */ + @Excel(name = "绑定ip,多个ip“;“分割") + private String bindingIp; + + /** + * 数云key + */ + @Excel(name = "数云key") + private String syKey; + + /** + * 数云密钥 + */ + @Excel(name = "数云密钥") + private String sySecret; + + /** + * 数云请求地址 + */ + @Excel(name = "数云请求地址") + private String syUrl; + + /** + * 数云店铺id + */ + @Excel(name = "数云店铺id") + private String syShopId; + + /** + * 状态(0正常 1停用) + */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private Integer status; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getAppid() { + return appid; + } + + public void setAppkey(String appkey) { + this.appkey = appkey; + } + + public String getAppkey() { + return appkey; + } + + public void setMerchantId(String merchantId) { + this.merchantId = merchantId; + } + + public String getMerchantId() { + return merchantId; + } + + public void setMerchantApiKey(String merchantApiKey) { + this.merchantApiKey = merchantApiKey; + } + + public String getMerchantApiKey() { + return merchantApiKey; + } + + public void setOpenKey(String openKey) { + this.openKey = openKey; + } + + public String getOpenKey() { + return openKey; + } + + public void setOpenSecret(String openSecret) { + this.openSecret = openSecret; + } + + public String getOpenSecret() { + return openSecret; + } + + public void setBindingIp(String bindingIp) { + this.bindingIp = bindingIp; + } + + public String getBindingIp() { + return bindingIp; + } + + public void setSyKey(String syKey) { + this.syKey = syKey; + } + + public String getSyKey() { + return syKey; + } + + public void setSySecret(String sySecret) { + this.sySecret = sySecret; + } + + public String getSySecret() { + return sySecret; + } + + public void setSyUrl(String syUrl) { + this.syUrl = syUrl; + } + + public String getSyUrl() { + return syUrl; + } + + public void setSyShopId(String syShopId) { + this.syShopId = syShopId; + } + + public String getSyShopId() { + return syShopId; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Integer getStatus() { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("appid", getAppid()) + .append("appkey", getAppkey()) + .append("merchantId", getMerchantId()) + .append("merchantApiKey", getMerchantApiKey()) + .append("openKey", getOpenKey()) + .append("openSecret", getOpenSecret()) + .append("bindingIp", getBindingIp()) + .append("syKey", getSyKey()) + .append("sySecret", getSySecret()) + .append("syUrl", getSyUrl()) + .append("syShopId", getSyShopId()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/flossom-common/flossom-common-hzMapper/src/main/java/com/flossom/hzMapper/mapper/WxParameterSettingMapper.java b/flossom-common/flossom-common-hzMapper/src/main/java/com/flossom/hzMapper/mapper/WxParameterSettingMapper.java new file mode 100644 index 0000000..4f60c33 --- /dev/null +++ b/flossom-common/flossom-common-hzMapper/src/main/java/com/flossom/hzMapper/mapper/WxParameterSettingMapper.java @@ -0,0 +1,61 @@ +package com.flossom.hzMapper.mapper; + +import com.flossom.common.core.domain.entity.WxParameterSetting; + +import java.util.List; + +/** + * 微信参数配属Mapper接口 + * + * @author flossom + * @date 2023-12-13 + */ +public interface WxParameterSettingMapper { + /** + * 查询微信参数配属 + * + * @param id 微信参数配属主键 + * @return 微信参数配属 + */ + public WxParameterSetting selectWxParameterSettingById(Long id); + + /** + * 查询微信参数配属列表 + * + * @param wxParameterSetting 微信参数配属 + * @return 微信参数配属集合 + */ + public List selectWxParameterSettingList(WxParameterSetting wxParameterSetting); + + /** + * 新增微信参数配属 + * + * @param wxParameterSetting 微信参数配属 + * @return 结果 + */ + public int insertWxParameterSetting(WxParameterSetting wxParameterSetting); + + /** + * 修改微信参数配属 + * + * @param wxParameterSetting 微信参数配属 + * @return 结果 + */ + public int updateWxParameterSetting(WxParameterSetting wxParameterSetting); + + /** + * 删除微信参数配属 + * + * @param id 微信参数配属主键 + * @return 结果 + */ + public int deleteWxParameterSettingById(Long id); + + /** + * 批量删除微信参数配属 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWxParameterSettingByIds(Long[] ids); +} diff --git a/flossom-common/flossom-common-hzMapper/src/main/resources/mapper/hzMapper/WxParameterSettingMapper.xml b/flossom-common/flossom-common-hzMapper/src/main/resources/mapper/hzMapper/WxParameterSettingMapper.xml new file mode 100644 index 0000000..82bad66 --- /dev/null +++ b/flossom-common/flossom-common-hzMapper/src/main/resources/mapper/hzMapper/WxParameterSettingMapper.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, appid, appkey, merchant_id, merchant_api_key, open_key, open_secret, binding_ip, sy_key, sy_secret, sy_url, sy_shop_id, status, create_by, create_time, update_by, update_time, remark from wx_parameter_setting + + + + + + + + insert into wx_parameter_setting + + id, + appid, + appkey, + merchant_id, + merchant_api_key, + open_key, + open_secret, + binding_ip, + sy_key, + sy_secret, + sy_url, + sy_shop_id, + status, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{id}, + #{appid}, + #{appkey}, + #{merchantId}, + #{merchantApiKey}, + #{openKey}, + #{openSecret}, + #{bindingIp}, + #{syKey}, + #{sySecret}, + #{syUrl}, + #{syShopId}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update wx_parameter_setting + + appid = #{appid}, + appkey = #{appkey}, + merchant_id = #{merchantId}, + merchant_api_key = #{merchantApiKey}, + open_key = #{openKey}, + open_secret = #{openSecret}, + binding_ip = #{bindingIp}, + sy_key = #{syKey}, + sy_secret = #{sySecret}, + sy_url = #{syUrl}, + sy_shop_id = #{syShopId}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + + delete from wx_parameter_setting where id = #{id} + + + + delete from wx_parameter_setting where id in + + #{id} + + + \ No newline at end of file diff --git a/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/config/properties/WxConfig.java b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/config/properties/WxConfig.java index 4f7c88c..c705df8 100644 --- a/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/config/properties/WxConfig.java +++ b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/config/properties/WxConfig.java @@ -14,16 +14,6 @@ import org.springframework.context.annotation.Configuration; @ConfigurationProperties(prefix = "wx.config") public class WxConfig { - /** - * appid - */ - private String appId; - - /** - * appkey - */ - private String appKey; - /** * jscode2session * 通过 code 去微信服务器换取 openid 和 session_key @@ -35,22 +25,6 @@ public class WxConfig { */ private String obtainPhoneUrl; - public String getAppId() { - return appId; - } - - public void setAppId(String appId) { - this.appId = appId; - } - - public String getAppKey() { - return appKey; - } - - public void setAppKey(String appKey) { - this.appKey = appKey; - } - public String getLoginUrl() { return loginUrl; } diff --git a/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/utils/MiniProgramUtils.java b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/utils/MiniProgramUtils.java index 7dab9ea..b4a0053 100644 --- a/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/utils/MiniProgramUtils.java +++ b/flossom-modules/flossom-mini-program/src/main/java/com/flossom/miniProgram/utils/MiniProgramUtils.java @@ -1,11 +1,14 @@ package com.flossom.miniProgram.utils; +import com.flossom.common.core.domain.entity.WxParameterSetting; +import com.flossom.hzMapper.mapper.WxParameterSettingMapper; import com.flossom.miniProgram.config.properties.WxConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -16,13 +19,30 @@ public class MiniProgramUtils { private static WxConfig wxConfig; + private static WxParameterSettingMapper wxParameterSettingMapper; + + /** + * 注入 微信配置mapper,获取 appId,appKey(该配置在数据库) + * @param wxParameterSettingMapper + */ + @Autowired + public void setWxConfig(WxParameterSettingMapper wxParameterSettingMapper) { + MiniProgramUtils.wxParameterSettingMapper = wxParameterSettingMapper; + } + + /** + * 注入 微信配置类,读取请求路径(该配置在 nacos) + * @param wxConfig + */ @Autowired public void setWxConfig(WxConfig wxConfig) { MiniProgramUtils.wxConfig = wxConfig; } + public static String getSessionKeyAndOpenId(String jsCode) throws Exception { - return getSessionKeyAndOpenId(wxConfig.getAppId(), wxConfig.getAppKey(), jsCode, "authorization_code"); + WxParameterSetting wxParameterSetting = wxParameterSettingMapper.selectWxParameterSettingById(1L); + return getSessionKeyAndOpenId(wxParameterSetting.getAppid(), wxParameterSetting.getAppkey(), jsCode, "authorization_code"); } /** diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxParameterSettingController.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxParameterSettingController.java new file mode 100644 index 0000000..4513c11 --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxParameterSettingController.java @@ -0,0 +1,99 @@ +package com.flossom.system.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import com.flossom.common.core.domain.entity.WxParameterSetting; +import com.flossom.common.core.utils.poi.ExcelUtil; +import com.flossom.common.core.web.controller.BaseController; +import com.flossom.common.core.web.domain.AjaxResult; +import com.flossom.common.core.web.page.TableDataInfo; +import com.flossom.common.log.annotation.Log; +import com.flossom.common.log.enums.BusinessType; +import com.flossom.common.security.annotation.RequiresPermissions; +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.flossom.system.service.IWxParameterSettingService; + +/** + * 微信参数配属Controller + * + * @author flossom + * @date 2023-12-13 + */ +@RestController +@RequestMapping("/wxSetting") +public class WxParameterSettingController extends BaseController { + @Autowired + private IWxParameterSettingService wxParameterSettingService; + + /** + * 查询微信参数配属列表 + */ + @RequiresPermissions("system:wxSetting:list") + @GetMapping("/list") + public TableDataInfo list(WxParameterSetting wxParameterSetting) { + startPage(); + List list = wxParameterSettingService.selectWxParameterSettingList(wxParameterSetting); + return getDataTable(list); + } + + /** + * 导出微信参数配属列表 + */ + @RequiresPermissions("system:wxSetting:export") + @Log(title = "微信参数配属", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WxParameterSetting wxParameterSetting) { + List list = wxParameterSettingService.selectWxParameterSettingList(wxParameterSetting); + ExcelUtil util = new ExcelUtil(WxParameterSetting.class); + util.exportExcel(response, list, "微信参数配属数据"); + } + + /** + * 获取微信参数配属详细信息 + */ + @RequiresPermissions("system:wxSetting:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(wxParameterSettingService.selectWxParameterSettingById(id)); + } + + /** + * 新增微信参数配属 + */ + @RequiresPermissions("system:wxSetting:add") + @Log(title = "微信参数配属", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WxParameterSetting wxParameterSetting) { + return toAjax(wxParameterSettingService.insertWxParameterSetting(wxParameterSetting)); + } + + /** + * 修改微信参数配属 + */ + @RequiresPermissions("system:wxSetting:edit") + @Log(title = "微信参数配属", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WxParameterSetting wxParameterSetting) { + return toAjax(wxParameterSettingService.updateWxParameterSetting(wxParameterSetting)); + } + + /** + * 删除微信参数配属 + */ + @RequiresPermissions("system:wxSetting:remove") + @Log(title = "微信参数配属", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(wxParameterSettingService.deleteWxParameterSettingByIds(ids)); + } +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxParameterSettingService.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxParameterSettingService.java new file mode 100644 index 0000000..cdff0fd --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxParameterSettingService.java @@ -0,0 +1,61 @@ +package com.flossom.system.service; + +import com.flossom.common.core.domain.entity.WxParameterSetting; + +import java.util.List; + +/** + * 微信参数配属Service接口 + * + * @author flossom + * @date 2023-12-13 + */ +public interface IWxParameterSettingService { + /** + * 查询微信参数配属 + * + * @param id 微信参数配属主键 + * @return 微信参数配属 + */ + public WxParameterSetting selectWxParameterSettingById(Long id); + + /** + * 查询微信参数配属列表 + * + * @param wxParameterSetting 微信参数配属 + * @return 微信参数配属集合 + */ + public List selectWxParameterSettingList(WxParameterSetting wxParameterSetting); + + /** + * 新增微信参数配属 + * + * @param wxParameterSetting 微信参数配属 + * @return 结果 + */ + public int insertWxParameterSetting(WxParameterSetting wxParameterSetting); + + /** + * 修改微信参数配属 + * + * @param wxParameterSetting 微信参数配属 + * @return 结果 + */ + public int updateWxParameterSetting(WxParameterSetting wxParameterSetting); + + /** + * 批量删除微信参数配属 + * + * @param ids 需要删除的微信参数配属主键集合 + * @return 结果 + */ + public int deleteWxParameterSettingByIds(Long[] ids); + + /** + * 删除微信参数配属信息 + * + * @param id 微信参数配属主键 + * @return 结果 + */ + public int deleteWxParameterSettingById(Long id); +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxParameterSettingServiceImpl.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxParameterSettingServiceImpl.java new file mode 100644 index 0000000..3c7981d --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxParameterSettingServiceImpl.java @@ -0,0 +1,90 @@ +package com.flossom.system.service.impl; + +import java.util.List; + +import com.flossom.common.core.domain.entity.WxParameterSetting; +import com.flossom.common.core.utils.DateUtils; +import com.flossom.hzMapper.mapper.WxParameterSettingMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.flossom.system.service.IWxParameterSettingService; + +/** + * 微信参数配属Service业务层处理 + * + * @author flossom + * @date 2023-12-13 + */ +@Service +public class WxParameterSettingServiceImpl implements IWxParameterSettingService { + @Autowired + private WxParameterSettingMapper wxParameterSettingMapper; + + /** + * 查询微信参数配属 + * + * @param id 微信参数配属主键 + * @return 微信参数配属 + */ + @Override + public WxParameterSetting selectWxParameterSettingById(Long id) { + return wxParameterSettingMapper.selectWxParameterSettingById(id); + } + + /** + * 查询微信参数配属列表 + * + * @param wxParameterSetting 微信参数配属 + * @return 微信参数配属 + */ + @Override + public List selectWxParameterSettingList(WxParameterSetting wxParameterSetting) { + return wxParameterSettingMapper.selectWxParameterSettingList(wxParameterSetting); + } + + /** + * 新增微信参数配属 + * + * @param wxParameterSetting 微信参数配属 + * @return 结果 + */ + @Override + public int insertWxParameterSetting(WxParameterSetting wxParameterSetting) { + wxParameterSetting.setCreateTime(DateUtils.getNowDate()); + return wxParameterSettingMapper.insertWxParameterSetting(wxParameterSetting); + } + + /** + * 修改微信参数配属 + * + * @param wxParameterSetting 微信参数配属 + * @return 结果 + */ + @Override + public int updateWxParameterSetting(WxParameterSetting wxParameterSetting) { + wxParameterSetting.setUpdateTime(DateUtils.getNowDate()); + return wxParameterSettingMapper.updateWxParameterSetting(wxParameterSetting); + } + + /** + * 批量删除微信参数配属 + * + * @param ids 需要删除的微信参数配属主键 + * @return 结果 + */ + @Override + public int deleteWxParameterSettingByIds(Long[] ids) { + return wxParameterSettingMapper.deleteWxParameterSettingByIds(ids); + } + + /** + * 删除微信参数配属信息 + * + * @param id 微信参数配属主键 + * @return 结果 + */ + @Override + public int deleteWxParameterSettingById(Long id) { + return wxParameterSettingMapper.deleteWxParameterSettingById(id); + } +} diff --git a/flossom-ui/src/api/system/wxSetting.js b/flossom-ui/src/api/system/wxSetting.js new file mode 100644 index 0000000..77d6e85 --- /dev/null +++ b/flossom-ui/src/api/system/wxSetting.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询微信参数配属列表 +export function listWxSetting(query) { + return request({ + url: '/system/wxSetting/list', + method: 'get', + params: query + }) +} + +// 查询微信参数配属详细 +export function getWxSetting(id) { + return request({ + url: '/system/wxSetting/' + id, + method: 'get' + }) +} + +// 新增微信参数配属 +export function addWxSetting(data) { + return request({ + url: '/system/wxSetting', + method: 'post', + data: data + }) +} + +// 修改微信参数配属 +export function updateWxSetting(data) { + return request({ + url: '/system/wxSetting', + method: 'put', + data: data + }) +} + +// 删除微信参数配属 +export function delWxSetting(id) { + return request({ + url: '/system/wxSetting/' + id, + method: 'delete' + }) +} diff --git a/flossom-ui/src/views/system/wxSetting/index.vue b/flossom-ui/src/views/system/wxSetting/index.vue new file mode 100644 index 0000000..f252fe2 --- /dev/null +++ b/flossom-ui/src/views/system/wxSetting/index.vue @@ -0,0 +1,397 @@ + + +