From 8810677ca77e6e8cf0340055c95d35c061db0e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?= <7507756+jiang_yuqi@user.noreply.gitee.com> Date: Mon, 8 Apr 2024 23:34:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/mapper/SysUserOpenidMapper.java | 8 ++ .../system/service/ISysUserOpenidService.java | 8 ++ .../impl/SysUserOpenidServiceImpl.java | 10 +++ .../mapper/system/SysUserOpenidMapper.xml | 5 ++ ruoyi-ui/src/components/FileUpload/index.vue | 2 +- ruoyi-ui/src/components/ImageUpload/index.vue | 83 ++++++++++++------- ruoyi-ui/src/views/wxsetting/wxAuth/index.vue | 18 +++- .../web/controller/ProjectController.java | 6 +- .../controller/WxAuthController.java | 26 ++++++ .../mapper/project/SurProjectMapper.xml | 3 +- 10 files changed, 132 insertions(+), 37 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOpenidMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOpenidMapper.java index 270823c0..97e44c5f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOpenidMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOpenidMapper.java @@ -19,6 +19,14 @@ public interface SysUserOpenidMapper */ public SysUserOpenid selectSysUserOpenidById(Long id); + /** + * 查询用户绑定小程序openId + * + * @param openId 用户绑定小程序openId主键 + * @return 用户绑定小程序openId + */ + public SysUserOpenid selectSysUserOpenidByOpenId(String openId); + /** * 查询用户绑定小程序openId列表 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOpenidService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOpenidService.java index b59245c5..92aa8c2f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOpenidService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOpenidService.java @@ -19,6 +19,14 @@ public interface ISysUserOpenidService */ public SysUserOpenid selectSysUserOpenidById(Long id); + /** + * 查询用户绑定小程序openId + * + * @param openId 用户绑定小程序openId主键 + * @return 用户绑定小程序openId + */ + public SysUserOpenid selectSysUserOpenidByOpenId(String openId); + /** * 查询用户绑定小程序openId列表 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOpenidServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOpenidServiceImpl.java index 9cf4e9cb..d98ca9fe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOpenidServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOpenidServiceImpl.java @@ -31,6 +31,16 @@ public class SysUserOpenidServiceImpl implements ISysUserOpenidService return sysUserOpenidMapper.selectSysUserOpenidById(id); } + /** + * 查询用户绑定小程序openId + * + * @param openId 用户绑定小程序openId主键 + * @return 用户绑定小程序openId + */ + public SysUserOpenid selectSysUserOpenidByOpenId(String openId) { + return sysUserOpenidMapper.selectSysUserOpenidByOpenId(openId); + } + /** * 查询用户绑定小程序openId列表 * diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserOpenidMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserOpenidMapper.xml index 12b419f9..2e69f755 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserOpenidMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserOpenidMapper.xml @@ -57,6 +57,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + insert into sys_user_openid diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 5aa6e978..fdf15083 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -120,7 +120,7 @@ export default { // 校检文件类型 if (this.fileType) { const fileName = file.name.split('.'); - const fileExt = fileName[fileName.length - 1]; + const fileExt = fileName[fileName.length - 1].toLocaleLowerCase(); const isTypeOk = this.fileType.indexOf(fileExt) >= 0; if (!isTypeOk) { this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`); diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index cb2b93b9..bd937def 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -15,20 +15,26 @@ :headers="headers" :file-list="fileList" :on-preview="handlePictureCardPreview" - :class="{hide: this.fileList.length >= this.limit}" + :class="{ hide: this.fileList.length >= this.limit }" > - +
请上传 - - + + 的文件
- { + this.fileList = list.map((item) => { if (typeof item === "string") { - if (item.indexOf(this.baseUrl) === -1 && item.indexOf('http') === -1) { - item = { name: this.baseUrl + item, url: this.baseUrl + item }; + if (item.indexOf(this.baseUrl) === -1 && item.indexOf("http") === -1) { + item = { name: this.baseUrl + item, url: this.baseUrl + item }; } else { - item = { name: item, url: item }; + item = { name: item, url: item }; } } return item; @@ -107,8 +118,8 @@ export default { } }, deep: true, - immediate: true - } + immediate: true, + }, }, computed: { // 是否显示提示 @@ -123,10 +134,12 @@ export default { if (this.fileType.length) { let fileExtension = ""; if (file.name.lastIndexOf(".") > -1) { - fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); + fileExtension = file.name + .slice(file.name.lastIndexOf(".") + 1) + .toLocaleLowerCase(); } - isImg = this.fileType.some(type => { - if (file.type.indexOf(type) > -1) return true; + isImg = this.fileType.some((type) => { + if (file.type.toLocaleLowerCase().indexOf(type) > -1) return true; if (fileExtension && fileExtension.indexOf(type) > -1) return true; return false; }); @@ -135,7 +148,9 @@ export default { } if (!isImg) { - this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`); + this.$modal.msgError( + `文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!` + ); return false; } if (this.fileSize) { @@ -145,6 +160,12 @@ export default { return false; } } + if(this.fileNameChk){ + if (file.name.lastIndexOf("[") > -1 || file.name.lastIndexOf("]")) { + this.$modal.msgError(`文件名中不能包含英文[],请修改为中文〔〕或【】!`); + return false; + } + } this.$modal.loading("正在上传图片,请稍候..."); this.number++; }, @@ -167,8 +188,8 @@ export default { }, // 删除图片 handleDelete(file) { - const findex = this.fileList.map(f => f.name).indexOf(file.name); - if(findex > -1) { + const findex = this.fileList.map((f) => f.name).indexOf(file.name); + if (findex > -1) { this.fileList.splice(findex, 1); this.$emit("input", this.listToString(this.fileList)); } @@ -202,25 +223,25 @@ export default { strs += list[i].url.replace(this.baseUrl, "") + separator; } } - return strs != '' ? strs.substr(0, strs.length - 1) : ''; - } - } + return strs != "" ? strs.substr(0, strs.length - 1) : ""; + }, + }, }; - diff --git a/ruoyi-ui/src/views/wxsetting/wxAuth/index.vue b/ruoyi-ui/src/views/wxsetting/wxAuth/index.vue index 0b9a8a82..632da0a8 100644 --- a/ruoyi-ui/src/views/wxsetting/wxAuth/index.vue +++ b/ruoyi-ui/src/views/wxsetting/wxAuth/index.vue @@ -1,7 +1,21 @@ diff --git a/yanzhu-bigscreen/src/main/java/com/yanzhu/jh/bigscreen/web/controller/ProjectController.java b/yanzhu-bigscreen/src/main/java/com/yanzhu/jh/bigscreen/web/controller/ProjectController.java index dcef1542..41492204 100644 --- a/yanzhu-bigscreen/src/main/java/com/yanzhu/jh/bigscreen/web/controller/ProjectController.java +++ b/yanzhu-bigscreen/src/main/java/com/yanzhu/jh/bigscreen/web/controller/ProjectController.java @@ -7,6 +7,7 @@ import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.ShiFouEnum; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.sign.Md5Utils; @@ -43,6 +44,7 @@ public class ProjectController extends BaseController { @GetMapping("/findProjectByDept") public AjaxResult findProjectByDept(Long deptId){ SurProject surProject=new SurProject(); + surProject.setProgressVisible(ShiFouEnum.FOU.getCode()); if(deptId==-1){ long roleId= SecurityUtils.getRoleId(); if(5==roleId||6==roleId||7==roleId){ @@ -57,12 +59,12 @@ public class ProjectController extends BaseController { surProject.setDeptId(deptId); } List list=isurProjectService.selectSurProjectList(surProject); - for (SurProject p :list){ + //for (SurProject p :list){ //DateTime dt1= DateUtil.parse(p.getScheduledStartTime()); //DateTime dt2=DateUtil.parse(p.getPlannedCompletionTime()); //long days= DateUtil.between(dt1,dt2, DateUnit.DAY); //p.setProjectTimeLimit(days); - } + //} return success(list); } diff --git a/yanzhu-jh/src/main/java/com/yanzhu/jh/wxsetting/controller/WxAuthController.java b/yanzhu-jh/src/main/java/com/yanzhu/jh/wxsetting/controller/WxAuthController.java index 1f20eb56..799b61d6 100644 --- a/yanzhu-jh/src/main/java/com/yanzhu/jh/wxsetting/controller/WxAuthController.java +++ b/yanzhu-jh/src/main/java/com/yanzhu/jh/wxsetting/controller/WxAuthController.java @@ -6,6 +6,9 @@ import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysUserOpenid; +import com.ruoyi.system.service.ISysUserOpenidService; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.exception.WxErrorException; @@ -36,6 +39,9 @@ public class WxAuthController extends BaseController { @Autowired private WxMpService wxMpService; + @Autowired + private ISysUserOpenidService sysUserOpenidService; + @Anonymous @GetMapping("/auth") @ResponseBody @@ -123,4 +129,24 @@ public class WxAuthController extends BaseController { response.sendRedirect(returnUrl + "&openid=" + openId); } + /** + * @author :JiangYuQi + * @param: : + * @return: 重定向 + * 获取用户信息类,最后重定向到指定url + */ + @Anonymous + @GetMapping("/binding") + public AjaxResult binding(String openId,String msgOpenId) throws Exception { + /*当用户同意授权后,将小程序openId和公众号OpenId进行绑定*/ + if(StringUtils.isNotBlank(openId)){ + SysUserOpenid sysUserOpenid = sysUserOpenidService.selectSysUserOpenidByOpenId(openId); + if(sysUserOpenid!=null){ + sysUserOpenid.setMsgOpenId(msgOpenId); + return toAjax(sysUserOpenidService.updateSysUserOpenid(sysUserOpenid)); + } + } + return error(); + } + } diff --git a/yanzhu-jh/src/main/resources/mapper/project/SurProjectMapper.xml b/yanzhu-jh/src/main/resources/mapper/project/SurProjectMapper.xml index c29fa2aa..293e6c93 100644 --- a/yanzhu-jh/src/main/resources/mapper/project/SurProjectMapper.xml +++ b/yanzhu-jh/src/main/resources/mapper/project/SurProjectMapper.xml @@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join sur_project_userinfo spu on spu.project_id = sp.id - sp.isDel = 0 and sp.progressVisible=0 + sp.isDel = 0 and sp.deptId like concat('%', #{deptId}, '%') and sp.projectName like concat('%', #{projectName}, '%') and sp.projectCode = #{projectCode} @@ -79,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and sp.projiectLevel = #{projiectLevel} and sp.projectRegional = #{projectRegional} and sp.projectAddress = #{projectAddress} + and sp.progressVisible = #{progressVisible} and sp.projectNature = #{projectNature} and sp.licenceNumber = #{licenceNumber} and sp.projectApproval = #{projectApproval}