提交代码

dev_xds
姜玉琦 2024-04-08 23:34:04 +08:00
parent 963d86f209
commit 8810677ca7
10 changed files with 132 additions and 37 deletions

View File

@ -19,6 +19,14 @@ public interface SysUserOpenidMapper
*/
public SysUserOpenid selectSysUserOpenidById(Long id);
/**
* openId
*
* @param openId openId
* @return openId
*/
public SysUserOpenid selectSysUserOpenidByOpenId(String openId);
/**
* openId
*

View File

@ -19,6 +19,14 @@ public interface ISysUserOpenidService
*/
public SysUserOpenid selectSysUserOpenidById(Long id);
/**
* openId
*
* @param openId openId
* @return openId
*/
public SysUserOpenid selectSysUserOpenidByOpenId(String openId);
/**
* openId
*

View File

@ -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
*

View File

@ -57,6 +57,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysUserOpenidVo"/>
where id = #{id}
</select>
<select id="selectSysUserOpenidByOpenId" parameterType="String" resultMap="SysUserOpenidResult">
<include refid="selectSysUserOpenidVo"/>
where openId = #{openId}
</select>
<insert id="insertSysUserOpenid" parameterType="SysUserOpenid" useGeneratedKeys="true" keyProperty="id">
insert into sys_user_openid

View File

@ -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("/")}格式文件!`);

View File

@ -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 }"
>
<i class="el-icon-plus"></i>
</el-upload>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
<template v-if="fileSize">
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
</template>
<template v-if="fileType">
格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
</template>
的文件
</div>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false"
<el-dialog
:close-on-click-modal="false"
:close-on-press-escape="false"
:visible.sync="dialogVisible"
title="预览"
width="800"
@ -55,7 +61,7 @@ export default {
},
// (MB)
fileSize: {
type: Number,
type: Number,
default: 5,
},
// , ['png', 'jpg', 'jpeg']
@ -66,8 +72,13 @@ export default {
//
isShowTip: {
type: Boolean,
default: true
}
default: true,
},
//
fileNameChk: {
type: Boolean,
default: true,
},
},
data() {
return {
@ -81,7 +92,7 @@ export default {
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: []
fileList: [],
};
},
watch: {
@ -89,14 +100,14 @@ export default {
handler(val) {
if (val) {
//
const list = Array.isArray(val) ? val : this.value.split(',');
const list = Array.isArray(val) ? val : this.value.split(",");
//
this.fileList = list.map(item => {
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) : "";
},
},
};
</script>
<style scoped lang="scss">
// .el-upload--picture-card
::v-deep.hide .el-upload--picture-card {
display: none;
display: none;
}
//
::v-deep .el-list-enter-active,
::v-deep .el-list-leave-active {
transition: all 0s;
transition: all 0s;
}
::v-deep .el-list-enter, .el-list-leave-active {
opacity: 0;
transform: translateY(0);
::v-deep .el-list-enter,
.el-list-leave-active {
opacity: 0;
transform: translateY(0);
}
</style>

View File

@ -1,7 +1,21 @@
<template>
<div class="app-content">
<div>
</div>
<el-row>
<el-col :sm="24" :lg="24">
<el-result icon="success" title="消息授权成功">
<template slot="extra">
<el-button type="primary" size="medium" round>返回小程序</el-button>
</template>
</el-result>
</el-col>
<el-col :sm="24" :lg="24">
<el-result icon="error" title="消息授权失败" subTitle="请关注公众号并进行网页授权">
<template slot="extra">
<el-button type="primary" size="medium" round>返回小程序</el-button>
</template>
</el-result>
</el-col>
</el-row>
</div>
</template>

View File

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

View File

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

View File

@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--普通用户查询项目人员-->
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> left join sur_project_userinfo spu on spu.project_id = sp.id</if>
<where>
sp.isDel = 0 and sp.progressVisible=0
sp.isDel = 0
<if test="deptId != null "> and sp.deptId like concat('%', #{deptId}, '%')</if>
<if test="projectName != null and projectName != ''"> and sp.projectName like concat('%', #{projectName}, '%')</if>
<if test="projectCode != null and projectCode != ''"> and sp.projectCode = #{projectCode}</if>
@ -79,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="projiectLevel != null and projiectLevel != ''"> and sp.projiectLevel = #{projiectLevel}</if>
<if test="projectRegional != null and projectRegional != ''"> and sp.projectRegional = #{projectRegional}</if>
<if test="projectAddress != null and projectAddress != ''"> and sp.projectAddress = #{projectAddress}</if>
<if test="progressVisible != null and progressVisible != ''"> and sp.progressVisible = #{progressVisible}</if>
<if test="projectNature != null and projectNature != ''"> and sp.projectNature = #{projectNature}</if>
<if test="licenceNumber != null and licenceNumber != ''"> and sp.licenceNumber = #{licenceNumber}</if>
<if test="projectApproval != null and projectApproval != ''"> and sp.projectApproval = #{projectApproval}</if>