diff --git a/yanzhu-common/yanzhu-common-core/pom.xml b/yanzhu-common/yanzhu-common-core/pom.xml index 50c3d819..2cfbb8b1 100644 --- a/yanzhu-common/yanzhu-common-core/pom.xml +++ b/yanzhu-common/yanzhu-common-core/pom.xml @@ -113,5 +113,11 @@ swagger-annotations + + + com.belerweb + pinyin4j + + diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/constant/CacheConstants.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/constant/CacheConstants.java index 0d2e2162..3dcc01c3 100644 --- a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/constant/CacheConstants.java +++ b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/constant/CacheConstants.java @@ -72,4 +72,9 @@ public class CacheConstants * 限流 redis key */ public static final String RATE_LIMIT_KEY = "rate_limit:"; + + /** + * 项目管理 cache key + */ + public static final String PRO_PROJECT = "pro_project:"; } diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/TaskStatus.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/ApproveStatus.java similarity index 63% rename from yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/TaskStatus.java rename to yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/ApproveStatus.java index 4ba8f5bc..392113d7 100644 --- a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/TaskStatus.java +++ b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/ApproveStatus.java @@ -1,18 +1,19 @@ package com.yanzhu.common.core.enums; /** - * 任务状态 + * 审批状态 */ -public enum TaskStatus { +public enum ApproveStatus { check(10L, "审核中"), - finish(99L, "已结束"), - active(100L, "发布中"); + refuse(11L, "审核驳回"), + exempt(100L, "审核通过"), + passed(101L, "系统免审"); private final Long code; private final String info; - TaskStatus (Long code, String info) + ApproveStatus(Long code, String info) { this.code = code; this.info = info; diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/OwnerType.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/CardTypeEnums.java similarity index 57% rename from yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/OwnerType.java rename to yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/CardTypeEnums.java index 341875ef..548fc300 100644 --- a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/OwnerType.java +++ b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/CardTypeEnums.java @@ -1,23 +1,22 @@ package com.yanzhu.common.core.enums; /** - * 雇主类型 + * 证件类型 */ -public enum OwnerType { +public enum CardTypeEnums { - GR(1L, "个人"), - QY(2L, "企业"); + SFZ("1", "身份证"); - private final Long code; + private final String code; private final String info; - OwnerType (Long code, String info) + CardTypeEnums(String code, String info) { this.code = code; this.info = info; } - public Long getCode() + public String getCode() { return code; } @@ -26,5 +25,4 @@ public enum OwnerType { { return info; } - } diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/RegisterChannelEnums.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/RegisterChannelEnums.java deleted file mode 100644 index 488a74f7..00000000 --- a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/RegisterChannelEnums.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.yanzhu.common.core.enums; -/** - * 注册渠道 - * - * @author ZhouJiXiang - */ -public enum RegisterChannelEnums { - WXMINI(0L, "微信小程序"); - - private final Long code; - private final String info; - - RegisterChannelEnums(Long code, String info) - { - this.code = code; - this.info = info; - } - - public Long getCode() - { - return code; - } - - public String getInfo() - { - return info; - } -} diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/SignUpTypeEnums.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/SignUpTypeEnums.java deleted file mode 100644 index f79fbc18..00000000 --- a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/SignUpTypeEnums.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.yanzhu.common.core.enums; - -/** - * 报名入围类型 - * - * @author JiangYuQi - */ -public enum SignUpTypeEnums { - - HX(1L, "雇主海选"), - ZJ(2L, "用户自荐"); - - private final Long code; - private final String info; - - SignUpTypeEnums (Long code, String info) - { - this.code = code; - this.info = info; - } - - public Long getCode() - { - return code; - } - - public String getInfo() - { - return info; - } -} diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/UserTypeEnums.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/UserTypeEnums.java new file mode 100644 index 00000000..ae2086cb --- /dev/null +++ b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/enums/UserTypeEnums.java @@ -0,0 +1,32 @@ +package com.yanzhu.common.core.enums; + +/** + * 用户类型 + */ +public enum UserTypeEnums { + + ZSRY("00", "正式人员"), + LSRY("08", "临时人员"), + FBDL("80", "分包代理"), + FBRY("81", "分包人员"); + + private final String code; + private final String info; + + UserTypeEnums(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } + +} diff --git a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/utils/StringUtils.java b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/utils/StringUtils.java index 9ee0b7c9..5d57f227 100644 --- a/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/utils/StringUtils.java +++ b/yanzhu-common/yanzhu-common-core/src/main/java/com/yanzhu/common/core/utils/StringUtils.java @@ -659,4 +659,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils } return sb.toString(); } + + /** + * 根据身份证号判断性别 + * @param idNumber + * @return + */ + public static String judgeGender(String idNumber) throws IllegalArgumentException{ + System.out.println(idNumber.length()); + if(idNumber.length() != 18 && idNumber.length() != 15){ + return "2"; + } + int gender = 0; + if(idNumber.length() == 18){ + //如果身份证号18位,取身份证号倒数第二位 + char c = idNumber.charAt(idNumber.length() - 2); + gender = Integer.parseInt(String.valueOf(c)); + }else{ + //如果身份证号15位,取身份证号最后一位 + char c = idNumber.charAt(idNumber.length() - 1); + gender = Integer.parseInt(String.valueOf(c)); + } + System.out.println("gender = " + gender); + if(gender % 2 == 1){ + return "0"; + }else{ + return "1"; + } + } } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfo.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfo.java index 211b0086..b77cc28f 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfo.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfo.java @@ -56,6 +56,9 @@ public class ProProjectInfo extends BaseEntity @Excel(name = "项目区县") private String projectRegional; + /** 项目包名 */ + private String projectPackage; + /** 项目地址 */ @Excel(name = "项目地址") private String projectAddress; @@ -477,6 +480,14 @@ public class ProProjectInfo extends BaseEntity this.projectDeptsList = projectDeptsList; } + public String getProjectPackage() { + return projectPackage; + } + + public void setProjectPackage(String projectPackage) { + this.projectPackage = projectPackage; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java index 1ae3f853..b59d301e 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/domain/ProProjectInfoSubdepts.java @@ -37,10 +37,6 @@ public class ProProjectInfoSubdepts extends BaseEntity @Excel(name = "项目名称") private String projectName; - /** 分包单位 */ - @Excel(name = "分包单位") - private Long subDeptId; - /** 分包单位类型 */ @Excel(name = "分包单位类型") private String subDeptType; @@ -69,6 +65,17 @@ public class ProProjectInfoSubdepts extends BaseEntity @Excel(name = "负责人电话") private String subDeptLeaderPhone; + /** 委托书 */ + @Excel(name = "委托书") + private String subDeptLeaderPowerPath; + + /** 营业执照 */ + @Excel(name = "营业执照") + private String businessLicensePath; + + /** 单位详情 */ + private String subDeptInfos; + /** 合同承包内容 */ @Excel(name = "合同承包内容") private String contractInfos; @@ -94,6 +101,13 @@ public class ProProjectInfoSubdepts extends BaseEntity @Excel(name = "删除标识") private Long isDel; + /** 委托人正面照片 */ + private String leaderCardImgPos; + /** 委托人反面照片 */ + private String leaderCardImgInv; + /** 委托人半身照片 */ + private String leaderUserPicture; + public void setId(Long id) { this.id = id; @@ -121,15 +135,7 @@ public class ProProjectInfoSubdepts extends BaseEntity { return projectId; } - public void setSubDeptId(Long subDeptId) - { - this.subDeptId = subDeptId; - } - public Long getSubDeptId() - { - return subDeptId; - } public void setSubDeptType(String subDeptType) { this.subDeptType = subDeptType; @@ -194,6 +200,30 @@ public class ProProjectInfoSubdepts extends BaseEntity return subDeptLeaderPhone; } + public String getSubDeptLeaderPowerPath() { + return subDeptLeaderPowerPath; + } + + public void setSubDeptLeaderPowerPath(String subDeptLeaderPowerPath) { + this.subDeptLeaderPowerPath = subDeptLeaderPowerPath; + } + + public String getBusinessLicensePath() { + return businessLicensePath; + } + + public void setBusinessLicensePath(String businessLicensePath) { + this.businessLicensePath = businessLicensePath; + } + + public String getSubDeptInfos() { + return subDeptInfos; + } + + public void setSubDeptInfos(String subDeptInfos) { + this.subDeptInfos = subDeptInfos; + } + public String getContractInfos() { return contractInfos; } @@ -263,13 +293,36 @@ public class ProProjectInfoSubdepts extends BaseEntity this.projectName = projectName; } + public String getLeaderCardImgPos() { + return leaderCardImgPos; + } + + public void setLeaderCardImgPos(String leaderCardImgPos) { + this.leaderCardImgPos = leaderCardImgPos; + } + + public String getLeaderCardImgInv() { + return leaderCardImgInv; + } + + public void setLeaderCardImgInv(String leaderCardImgInv) { + this.leaderCardImgInv = leaderCardImgInv; + } + + public String getLeaderUserPicture() { + return leaderUserPicture; + } + + public void setLeaderUserPicture(String leaderUserPicture) { + this.leaderUserPicture = leaderUserPicture; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) .append("comId", getComId()) .append("projectId", getProjectId()) - .append("subDeptId", getSubDeptId()) .append("subDeptType", getSubDeptType()) .append("subDeptName", getSubDeptName()) .append("subDeptCode", getSubDeptCode()) @@ -277,6 +330,9 @@ public class ProProjectInfoSubdepts extends BaseEntity .append("subDeptLeaderName", getSubDeptLeaderName()) .append("subDeptLeaderCode", getSubDeptLeaderCode()) .append("subDeptLeaderPhone", getSubDeptLeaderPhone()) + .append("subDeptLeaderPowerPath", getSubDeptLeaderPowerPath()) + .append("businessLicensePath", getBusinessLicensePath()) + .append("subDeptInfos", getSubDeptInfos()) .append("contractInfos", getContractInfos()) .append("useDates", getUseDates()) .append("useStatus", getUseStatus()) diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/ProProjectInfoSubdeptsUsersMapper.java b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/ProProjectInfoSubdeptsUsersMapper.java index e5e21603..fa65c709 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/ProProjectInfoSubdeptsUsersMapper.java +++ b/yanzhu-common/yanzhu-common-mapper/src/main/java/com/yanzhu/manage/mapper/ProProjectInfoSubdeptsUsersMapper.java @@ -58,4 +58,12 @@ public interface ProProjectInfoSubdeptsUsersMapper * @return 结果 */ public int deleteProProjectInfoSubdeptsUsersByIds(Long[] ids); + + /** + * 查询用户是否存在 + * + * @param phonenumber 注册电话 + * @return 结果 + */ + public int findUserByUserPhone(String phonenumber); } diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoMapper.xml index 7fc02c71..7ad97600 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoMapper.xml @@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -71,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select pi.id, pi.com_id, sd.dept_name as com_name, pi.dis_dept_id, pi.project_name, pi.project_code, pi.simple_name, pi.project_type, pi.project_level, pi.project_regional, pi.project_address, pi.project_nature, pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment, pi.floor_area, pi.total_output_value, pi.planned_completion_time, pi.scheduled_start_time, pi.actual_operating_time, pi.actual_completion_time, pi.contract_amount, pi.paid_amount, pi.on_account_amount, pi.project_schedule, pi.project_summarize, pi.project_qr_code, pi.project_status, pi.project_sort, pi.is_del, pi.create_by, pi.create_time, pi.update_by, pi.update_time, pi.remark + select pi.id, pi.com_id, sd.dept_name as com_name, pi.dis_dept_id, pi.project_name, pi.project_code, pi.simple_name, pi.project_type, pi.project_level, pi.project_regional, pi.project_package, pi.project_address, pi.project_nature, pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment, pi.floor_area, pi.total_output_value, pi.planned_completion_time, pi.scheduled_start_time, pi.actual_operating_time, pi.actual_completion_time, pi.contract_amount, pi.paid_amount, pi.on_account_amount, pi.project_schedule, pi.project_summarize, pi.project_qr_code, pi.project_status, pi.project_sort, pi.is_del, pi.create_by, pi.create_time, pi.update_by, pi.update_time, pi.remark from pro_project_info pi left join sys_dept sd on sd.dept_id = pi.com_id @@ -100,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select count(1) from sys_user where phonenumber=#{phonenumber} + + \ No newline at end of file diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java index 9c42bfbe..6f66c6bd 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java @@ -45,4 +45,26 @@ public class SysFileController return R.fail(e.getMessage()); } } + + /** + * 文件上传请求 + */ + @PostMapping("uploadPath") + public R uploadPath(MultipartFile file, String path) + { + try + { + // 上传并返回访问地址 + String url = sysFileService.uploadFile(file); + SysFile sysFile = new SysFile(); + sysFile.setName(FileUtils.getName(url)); + sysFile.setUrl(url); + return R.ok(sysFile); + } + catch (Exception e) + { + log.error("上传文件失败", e); + return R.fail(e.getMessage()); + } + } } \ No newline at end of file diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/FastDfsSysFileServiceImpl.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/FastDfsSysFileServiceImpl.java index 9dcdca9d..e46eed0f 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/FastDfsSysFileServiceImpl.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/FastDfsSysFileServiceImpl.java @@ -39,4 +39,9 @@ public class FastDfsSysFileServiceImpl implements ISysFileService FileTypeUtils.getExtension(file), null); return domain + "/" + storePath.getFullPath(); } + + @Override + public String uploadFilePath(MultipartFile file, String path) throws Exception { + return null; + } } diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/ISysFileService.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/ISysFileService.java index b30dc4f1..e88d0286 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/ISysFileService.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/ISysFileService.java @@ -17,4 +17,13 @@ public interface ISysFileService * @throws Exception */ public String uploadFile(MultipartFile file) throws Exception; + + /** + * 文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + */ + public String uploadFilePath(MultipartFile file,String path) throws Exception; } diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/LocalSysFileServiceImpl.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/LocalSysFileServiceImpl.java index 535407bb..2293f3ca 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/LocalSysFileServiceImpl.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/LocalSysFileServiceImpl.java @@ -47,4 +47,18 @@ public class LocalSysFileServiceImpl implements ISysFileService String url = domain + localFilePrefix + name; return url; } + + /** + * 本地文件上传接口 && 自定义目录 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + */ + @Override + public String uploadFilePath(MultipartFile file, String path) throws Exception { + String name = FileUploadUtils.upload(localFilePath+"/"+path, file); + String url = domain + localFilePrefix + name; + return url; + } } diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/MinioSysFileServiceImpl.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/MinioSysFileServiceImpl.java index a2a2ff35..218f92c4 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/MinioSysFileServiceImpl.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/service/MinioSysFileServiceImpl.java @@ -42,4 +42,9 @@ public class MinioSysFileServiceImpl implements ISysFileService client.putObject(args); return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; } + + @Override + public String uploadFilePath(MultipartFile file, String path) throws Exception { + return null; + } } diff --git a/yanzhu-modules/yanzhu-manage/pom.xml b/yanzhu-modules/yanzhu-manage/pom.xml index 42a179a3..3b08d388 100644 --- a/yanzhu-modules/yanzhu-manage/pom.xml +++ b/yanzhu-modules/yanzhu-manage/pom.xml @@ -83,6 +83,12 @@ provided + + com.github.binarywang + weixin-java-mp + 2.7.0 + + com.yanzhu diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatConfig.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatConfig.java new file mode 100644 index 00000000..20a47834 --- /dev/null +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatConfig.java @@ -0,0 +1,30 @@ +package com.yanzhu.manage.config; + +import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 微信配置 + */ +@Configuration +public class WeChatConfig { + + @Autowired + private WeChatProperties weChatProperties; + + @Bean + public WxMpService wxMpService() { + WxMpInMemoryConfigStorage config = new WxMpInMemoryConfigStorage(); + config.setAppId(weChatProperties.getWxAppId()); + config.setSecret(weChatProperties.getWxAppSecret()); + + WxMpServiceImpl wxMpService = new WxMpServiceImpl(); + wxMpService.setWxMpConfigStorage(config); + + return wxMpService; + } +} diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatProperties.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatProperties.java new file mode 100644 index 00000000..f754686d --- /dev/null +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/config/WeChatProperties.java @@ -0,0 +1,26 @@ +package com.yanzhu.manage.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 微信配置文件 + */ +@Data +@Component +@ConfigurationProperties(prefix = "wechat") +public class WeChatProperties { + + /** + * 公众号 + */ + private String mpAppId; + private String mpAppSecret; + + /** + * 小程序 + */ + private String wxAppId; + private String wxAppSecret; +} diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoService.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoService.java index b079ef63..70ad2477 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoService.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/IProProjectInfoService.java @@ -58,4 +58,9 @@ public interface IProProjectInfoService * @return 结果 */ public int deleteProProjectInfoById(Long id); + + /** + * 加载地址信息到缓存 + */ + public void loadingProjectsCache(); } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoServiceImpl.java index 9086868b..7e89b03f 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoServiceImpl.java @@ -1,26 +1,32 @@ package com.yanzhu.manage.service.impl; -import java.util.List; - +import com.yanzhu.common.core.constant.CacheConstants; import com.yanzhu.common.core.constant.SecurityConstants; import com.yanzhu.common.core.domain.R; import com.yanzhu.common.core.exception.ServiceException; import com.yanzhu.common.core.utils.DateUtils; +import com.yanzhu.common.core.utils.StringUtils; +import com.yanzhu.common.redis.service.RedisService; import com.yanzhu.common.security.utils.SecurityUtils; import com.yanzhu.manage.domain.ProDept; +import com.yanzhu.manage.domain.ProProjectInfo; import com.yanzhu.manage.domain.ProProjectInfoDepts; import com.yanzhu.manage.domain.ProProjectInfoSetting; import com.yanzhu.manage.mapper.ProProjectInfoDeptsMapper; +import com.yanzhu.manage.mapper.ProProjectInfoMapper; import com.yanzhu.manage.mapper.ProProjectInfoSettingMapper; +import com.yanzhu.manage.service.IProProjectInfoService; import com.yanzhu.system.api.RemoteDeptService; -import com.yanzhu.system.api.RemoteUserService; import com.yanzhu.system.api.domain.SysDept; import com.yanzhu.system.api.domain.SysUser; +import net.sourceforge.pinyin4j.PinyinHelper; +import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; +import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.yanzhu.manage.mapper.ProProjectInfoMapper; -import com.yanzhu.manage.domain.ProProjectInfo; -import com.yanzhu.manage.service.IProProjectInfoService; + +import javax.annotation.PostConstruct; +import java.util.List; /** * 项目信息Service业务层处理 @@ -31,6 +37,9 @@ import com.yanzhu.manage.service.IProProjectInfoService; @Service public class ProProjectInfoServiceImpl implements IProProjectInfoService { + @Autowired + private RedisService redisService; + @Autowired private ProProjectInfoDeptsMapper deptsMapper; @@ -43,6 +52,28 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService @Autowired private RemoteDeptService remoteDeptService; + /** + * 项目启动时,初始化参数到缓存 + */ + @PostConstruct + public void init() + { + loadingProjectsCache(); + } + + /** + * 加载地址信息到缓存 + */ + @Override + public void loadingProjectsCache(){ + List list = proProjectInfoMapper.selectProProjectInfoList(new ProProjectInfo()); + if(StringUtils.isNotEmpty(list)){ + for(ProProjectInfo info:list){ + redisService.setCacheObject(CacheConstants.PRO_PROJECT+info.getId(),info); + } + } + } + /** * 查询项目信息 * @@ -99,8 +130,11 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService if(res>0){ proProjectInfo.setId(proDept.getDeptId()); proProjectInfo.setComId(sysDept.getComId()); + proProjectInfo.setProjectPackage(projectPackage(proProjectInfo.getProjectName(),proDept.getDeptId())); proProjectInfo.setCreateTime(DateUtils.getNowDate()); - return proProjectInfoMapper.insertProProjectInfo(proProjectInfo); + res = proProjectInfoMapper.insertProProjectInfo(proProjectInfo); + loadingProjectsCache(); + return res; }else{ throw new ServiceException("项目信息保存失败!!!"); } @@ -150,6 +184,7 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService proDept.setPhone(proProjectInfo.getProjectPersonPhone()); proProjectInfoMapper.updateDept(proDept); } + loadingProjectsCache(); return res; } @@ -176,4 +211,31 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService { return proProjectInfoMapper.deleteProProjectInfoById(id); } + + /** + * 查询用户名称 + * @param name + * @return + */ + private String projectPackage(String name,Long deptId){ + // 设置不带声调的输出选项 + HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat(); + format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + + StringBuilder output = new StringBuilder(); + for (char c : name.toCharArray()) { + try { + String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c, format); + if (pinyinArray != null && pinyinArray.length > 0) { + output.append(pinyinArray[0]); + } else { + output.append(c); + } + } catch (Exception e) { + output.append(c); + } + } + output.append("_"+deptId); + return output.toString(); + } } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsServiceImpl.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsServiceImpl.java index a58d1af6..a08f314b 100644 --- a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsServiceImpl.java +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/service/impl/ProProjectInfoSubdeptsServiceImpl.java @@ -1,12 +1,26 @@ package com.yanzhu.manage.service.impl; -import java.util.List; +import com.yanzhu.common.core.constant.CacheConstants; +import com.yanzhu.common.core.constant.SecurityConstants; +import com.yanzhu.common.core.enums.CardTypeEnums; +import com.yanzhu.common.core.enums.UserTypeEnums; import com.yanzhu.common.core.utils.DateUtils; +import com.yanzhu.common.core.utils.StringUtils; +import com.yanzhu.common.redis.service.RedisService; +import com.yanzhu.common.security.utils.SecurityUtils; +import com.yanzhu.manage.domain.ProProjectInfo; +import com.yanzhu.manage.domain.ProProjectInfoSubdepts; +import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsMapper; +import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper; +import com.yanzhu.manage.service.IProProjectInfoSubdeptsService; +import com.yanzhu.system.api.RemoteUserService; +import com.yanzhu.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsMapper; -import com.yanzhu.manage.domain.ProProjectInfoSubdepts; -import com.yanzhu.manage.service.IProProjectInfoSubdeptsService; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; /** * 分包单位Service业务层处理 @@ -17,9 +31,18 @@ import com.yanzhu.manage.service.IProProjectInfoSubdeptsService; @Service public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdeptsService { + @Autowired + private RedisService redisService; + + @Autowired + private RemoteUserService remoteUserService; + @Autowired private ProProjectInfoSubdeptsMapper proProjectInfoSubdeptsMapper; + @Autowired + private ProProjectInfoSubdeptsUsersMapper proProjectInfoSubdeptsUsersMapper; + /** * 查询分包单位 * @@ -41,6 +64,8 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept @Override public List selectProProjectInfoSubdeptsList(ProProjectInfoSubdepts proProjectInfoSubdepts) { + proProjectInfoSubdepts.setActiveComId(SecurityUtils.getLoginUser().getProjectDeptId()); + proProjectInfoSubdepts.setActiveProjectId(SecurityUtils.getLoginUser().getProjectId()); return proProjectInfoSubdeptsMapper.selectProProjectInfoSubdeptsList(proProjectInfoSubdepts); } @@ -51,8 +76,40 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept * @return 结果 */ @Override + @Transactional public int insertProProjectInfoSubdepts(ProProjectInfoSubdepts proProjectInfoSubdepts) { + ProProjectInfo info = redisService.getCacheObject(CacheConstants.PRO_PROJECT+proProjectInfoSubdepts.getProjectId()); + proProjectInfoSubdepts.setComId(info.getComId()); + if(Objects.equals(proProjectInfoSubdepts.getSubDeptType(),"4") || Objects.equals(proProjectInfoSubdepts.getSubDeptType(),"4")){ + // TODO:生成二维码 + + // 单位委托人信息 + if(StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderName()) && StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderCode()) && StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderPhone())){ + // 判断用户是否存在 + SysUser sysUser = new SysUser(); + sysUser.setUserName(proProjectInfoSubdepts.getSubDeptLeaderPhone()); + sysUser.setNickName(proProjectInfoSubdepts.getSubDeptLeaderName()); + sysUser.setUserType(UserTypeEnums.FBDL.getCode()); + sysUser.setCardType(CardTypeEnums.SFZ.getCode()); + sysUser.setCardCode(proProjectInfoSubdepts.getSubDeptLeaderCode()); + sysUser.setUserPicture(proProjectInfoSubdepts.getLeaderUserPicture()); + sysUser.setCardImgPos(proProjectInfoSubdepts.getLeaderCardImgPos()); + sysUser.setCardImgInv(proProjectInfoSubdepts.getLeaderCardImgInv()); + sysUser.setSex(StringUtils.judgeGender(proProjectInfoSubdepts.getSubDeptLeaderCode())); + sysUser.setCreateBy(SecurityUtils.getUsername()); + sysUser.setCreateTime(DateUtils.getNowDate()); + sysUser.setRemark(proProjectInfoSubdepts.getSubDeptName()); + try { + remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER); + }catch (Exception e){ + // 已注册账号!!忽略异常... + } + + // TODO:实名制接入 + } + } + proProjectInfoSubdepts.setCreateBy(SecurityUtils.getUsername()); proProjectInfoSubdepts.setCreateTime(DateUtils.getNowDate()); return proProjectInfoSubdeptsMapper.insertProProjectInfoSubdepts(proProjectInfoSubdepts); } @@ -66,6 +123,37 @@ public class ProProjectInfoSubdeptsServiceImpl implements IProProjectInfoSubdept @Override public int updateProProjectInfoSubdepts(ProProjectInfoSubdepts proProjectInfoSubdepts) { + if(Objects.equals(proProjectInfoSubdepts.getSubDeptType(),"4") || Objects.equals(proProjectInfoSubdepts.getSubDeptType(),"4")){ + if(StringUtils.isEmpty(proProjectInfoSubdepts.getQrCode())){ + // TODO:生成二维码 + + // 单位委托人信息 + if(StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderName()) && StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderCode()) && StringUtils.isNotEmpty(proProjectInfoSubdepts.getSubDeptLeaderPhone())){ + // 判断用户是否存在 + SysUser sysUser = new SysUser(); + sysUser.setUserName(proProjectInfoSubdepts.getSubDeptLeaderPhone()); + sysUser.setNickName(proProjectInfoSubdepts.getSubDeptLeaderName()); + sysUser.setUserType(UserTypeEnums.FBDL.getCode()); + sysUser.setCardType(CardTypeEnums.SFZ.getCode()); + sysUser.setCardCode(proProjectInfoSubdepts.getSubDeptLeaderCode()); + sysUser.setUserPicture(proProjectInfoSubdepts.getLeaderUserPicture()); + sysUser.setCardImgPos(proProjectInfoSubdepts.getLeaderCardImgPos()); + sysUser.setCardImgInv(proProjectInfoSubdepts.getLeaderCardImgInv()); + sysUser.setSex(StringUtils.judgeGender(proProjectInfoSubdepts.getSubDeptLeaderCode())); + sysUser.setCreateBy(SecurityUtils.getUsername()); + sysUser.setCreateTime(DateUtils.getNowDate()); + sysUser.setRemark(proProjectInfoSubdepts.getSubDeptName()); + try { + remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER); + }catch (Exception e){ + // 已注册账号!!忽略异常... + } + + // TODO:实名制接入 + } + } + } + proProjectInfoSubdepts.setUpdateBy(SecurityUtils.getUsername()); proProjectInfoSubdepts.setUpdateTime(DateUtils.getNowDate()); return proProjectInfoSubdeptsMapper.updateProProjectInfoSubdepts(proProjectInfoSubdepts); } diff --git a/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/WxQrCodeUtils.java b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/WxQrCodeUtils.java new file mode 100644 index 00000000..5927b592 --- /dev/null +++ b/yanzhu-modules/yanzhu-manage/src/main/java/com/yanzhu/manage/utils/WxQrCodeUtils.java @@ -0,0 +1,61 @@ +package com.yanzhu.manage.utils; + +import com.alibaba.fastjson2.JSONObject; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; + +public class WxQrCodeUtils { + + /** + * 生成微信小程序二维码 + * + * @param filePath 本地生成二维码路径 + * @param page 当前小程序相对页面 必须是已经发布的小程序存在的页面(否则报错),例如 pages/index/index, 根路径前不要填加 /,不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面 + * @param scene 最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,其它字符请自行编码为合法字符(因不支持%,中文无法使用 urlencode 处理,请使用其他编码方式) + * @param accessToken 接口调用凭证 + */ + public static void generateQrCode(String filePath, String page, String scene, String accessToken) { + try { + //调用微信接口生成二维码 + URL url = new URL("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken); + HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); + httpURLConnection.setRequestMethod("POST");// 提交模式 + // conn.setConnectTimeout(10000);//连接超时 单位毫秒 + // conn.setReadTimeout(2000);//读取超时 单位毫秒 + // 发送POST请求必须设置如下两行 + httpURLConnection.setDoOutput(true); + httpURLConnection.setDoInput(true); + // 获取URLConnection对象对应的输出流 + PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream()); + // 发送请求参数 + JSONObject paramJson = new JSONObject(); + //这就是你二维码里携带的参数 String型 名称不可变 + paramJson.put("scene", scene); + //注意该接口传入的是page而不是path + paramJson.put("page", page); + //这是设置扫描二维码后跳转的页面 + paramJson.put("width", 200); + paramJson.put("is_hyaline", true); + paramJson.put("auto_color", true); + printWriter.write(paramJson.toString()); + // flush输出流的缓冲 + printWriter.flush(); + + //开始获取数据 + BufferedInputStream bis = new BufferedInputStream(httpURLConnection.getInputStream()); + OutputStream os = new FileOutputStream(new File(filePath)); + int len; + byte[] arr = new byte[1024]; + while ((len = bis.read(arr)) != -1) { + os.write(arr, 0, len); + os.flush(); + } + os.close(); + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("打开地址查看生成的二维码:" + filePath); + } +} diff --git a/yanzhu-modules/yanzhu-system/pom.xml b/yanzhu-modules/yanzhu-system/pom.xml index b3bb669f..7ce0bb3c 100644 --- a/yanzhu-modules/yanzhu-system/pom.xml +++ b/yanzhu-modules/yanzhu-system/pom.xml @@ -85,12 +85,6 @@ yanzhu-common-datascope - - - com.belerweb - pinyin4j - - diff --git a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysUserController.java b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysUserController.java index a0324a00..aa98f131 100644 --- a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysUserController.java +++ b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysUserController.java @@ -3,12 +3,14 @@ package com.yanzhu.system.controller; import java.io.IOException; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; import com.yanzhu.common.core.constant.Constants; +import com.yanzhu.common.core.enums.UserTypeEnums; import com.yanzhu.common.core.text.Convert; import com.yanzhu.common.redis.service.RedisService; import com.yanzhu.system.domain.vo.TreeSelect; @@ -49,13 +51,12 @@ import com.yanzhu.system.service.ISysUserService; /** * 用户信息 - * + * * @author ruoyi */ @RestController @RequestMapping("/user") -public class SysUserController extends BaseController -{ +public class SysUserController extends BaseController { @Autowired private RedisService redisService; @@ -82,8 +83,7 @@ public class SysUserController extends BaseController */ @RequiresPermissions("system:user:list") @GetMapping("/list") - public TableDataInfo list(SysUser user) - { + public TableDataInfo list(SysUser user) { startPage(); List list = userService.selectUserList(user); return getDataTable(list); @@ -92,8 +92,7 @@ public class SysUserController extends BaseController @Log(title = "用户管理", businessType = BusinessType.EXPORT) @RequiresPermissions("system:user:export") @PostMapping("/export") - public void export(HttpServletResponse response, SysUser user) - { + public void export(HttpServletResponse response, SysUser user) { List list = userService.selectUserList(user); ExcelUtil util = new ExcelUtil(SysUser.class); util.exportExcel(response, list, "用户数据"); @@ -102,8 +101,7 @@ public class SysUserController extends BaseController @Log(title = "用户管理", businessType = BusinessType.IMPORT) @RequiresPermissions("system:user:import") @PostMapping("/importData") - public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception - { + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { ExcelUtil util = new ExcelUtil(SysUser.class); List userList = util.importExcel(file.getInputStream()); String operName = SecurityUtils.getUsername(); @@ -112,8 +110,7 @@ public class SysUserController extends BaseController } @PostMapping("/importTemplate") - public void importTemplate(HttpServletResponse response) throws IOException - { + public void importTemplate(HttpServletResponse response) throws IOException { ExcelUtil util = new ExcelUtil(SysUser.class); util.importTemplateExcel(response, "用户数据"); } @@ -123,29 +120,25 @@ public class SysUserController extends BaseController */ @InnerAuth @GetMapping("/info/{username}") - public R info(@PathVariable("username") String username) - { + public R info(@PathVariable("username") String username) { SysUser sysUser = userService.selectUserByUserName(username); - if (StringUtils.isNull(sysUser)) - { + if (StringUtils.isNull(sysUser)) { return R.fail("用户名或密码错误"); } - if (StringUtils.isEmpty(sysUser.getRoles())) - { + if (StringUtils.isEmpty(sysUser.getRoles())) { return R.fail("用户未查询到分配角色,请联系管理员!!!"); } // 重写登录方法 - if(!sysUser.isAdmin() && sysUser.getRoles().size()>1){ - List gsAdmins = sysUser.getRoles().stream().filter(role -> role.getRoleId()==2L).collect(Collectors.toList()); - if(StringUtils.isNotEmpty(gsAdmins)){ + if (!sysUser.isAdmin() && sysUser.getRoles().size() > 1) { + List gsAdmins = sysUser.getRoles().stream().filter(role -> role.getRoleId() == 2L).collect(Collectors.toList()); + if (StringUtils.isNotEmpty(gsAdmins)) { // 默认以公司管理员登录 - sysUser = userService.selectUserByUserName(username,sysUser.getComId()); + sysUser = userService.selectUserByUserName(username, sysUser.getComId()); sysUser.setActiveComId(sysUser.getComId()); - }else{ + } else { // 查询用户绑定项目列表 List> list = userService.selectProjectsByUserId(sysUser.getUserId()); - if (StringUtils.isEmpty(list)) - { + if (StringUtils.isEmpty(list)) { return R.fail("用户角色配置异常,请联系管理员!!!"); } // 以项目人员身份登录 @@ -171,8 +164,7 @@ public class SysUserController extends BaseController */ @InnerAuth @GetMapping("/infoAndDept/{username}/{deptId}") - public R infoAndDept(@PathVariable("username") String username,@PathVariable("deptId") Long deptId) - { + public R infoAndDept(@PathVariable("username") String username, @PathVariable("deptId") Long deptId) { // 以项目人员身份登录 SysUser sysUser = userService.selectUserByUserName(username, deptId); List> list = userService.selectProjectsByUserId(sysUser.getUserId()); @@ -197,15 +189,14 @@ public class SysUserController extends BaseController */ @InnerAuth @PostMapping("/register") - public R register(@RequestBody SysUser sysUser) - { + public R register(@RequestBody SysUser sysUser) { String username = sysUser.getUserName(); - if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) - { - return R.fail("当前系统没有开启注册功能!"); + if (Objects.isNull(sysUser.getUserType()) || Objects.equals(UserTypeEnums.ZSRY.getCode(), sysUser.getUserType())) { + if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { + return R.fail("当前系统没有开启注册功能!"); + } } - if (!userService.checkUserNameUnique(sysUser)) - { + if (!userService.checkUserNameUnique(sysUser)) { return R.fail("保存用户'" + username + "'失败,注册账号已存在"); } return R.ok(userService.registerUser(sysUser)); @@ -216,29 +207,27 @@ public class SysUserController extends BaseController */ @InnerAuth @GetMapping("/sysUser/{userId}") - public R getSysUserInfo(@PathVariable("userId") Long userId) - { + public R getSysUserInfo(@PathVariable("userId") Long userId) { SysUser sysUser = userService.selectUserByUserId(userId); return R.ok(sysUser); } /** * 获取用户信息 - * + * * @return 用户信息 */ @GetMapping("getInfo") - public AjaxResult getInfo() - { + public AjaxResult getInfo() { SysUser cache = SecurityUtils.getLoginUser().getSysUser(); SysUser user; - if(SecurityUtils.isAdmin(cache.getUserId())){ + if (SecurityUtils.isAdmin(cache.getUserId())) { user = userService.selectUserById(cache.getUserId()); - }else{ - if(SecurityUtils.isGSAdmin()){ - user = userService.selectUserByIdAndDept(cache.getUserId(),cache.getComId()); - }else{ - user = userService.selectUserByIdAndDept(cache.getUserId(),cache.getActiveProjectId()); + } else { + if (SecurityUtils.isGSAdmin()) { + user = userService.selectUserByIdAndDept(cache.getUserId(), cache.getComId()); + } else { + user = userService.selectUserByIdAndDept(cache.getUserId(), cache.getActiveProjectId()); } } user.setActiveComId(cache.getComId()); @@ -259,22 +248,20 @@ public class SysUserController extends BaseController * 根据用户编号获取详细信息 */ @RequiresPermissions("system:user:query") - @GetMapping(value = { "/", "/{userId}" }) - public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) - { + @GetMapping(value = {"/", "/{userId}"}) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { userService.checkUserDataScope(userId); AjaxResult ajax = AjaxResult.success(); List roles = roleService.selectRoleAll(); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("posts", postService.selectPostAll()); - if (StringUtils.isNotNull(userId)) - { + if (StringUtils.isNotNull(userId)) { SysUser sysUser; - if(SysUser.isAdmin(userId)){ + if (SysUser.isAdmin(userId)) { sysUser = userService.selectUserById(userId); - }else{ + } else { SysUser user = userService.selectUserByUserId(userId); - sysUser = userService.selectUserByIdAndDept(userId,user.getDeptId()); + sysUser = userService.selectUserByIdAndDept(userId, user.getDeptId()); } ajax.put(AjaxResult.DATA_TAG, sysUser); ajax.put("postIds", postService.selectPostListByUserId(userId)); @@ -289,18 +276,12 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:add") @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysUser user) - { - if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) - { + public AjaxResult add(@Validated @RequestBody SysUser user) { + if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) { return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); - } - else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) - { + } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); - } - else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) - { + } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } user.setCreateBy(SecurityUtils.getUsername()); @@ -314,20 +295,14 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:edit") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysUser user) - { + public AjaxResult edit(@Validated @RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); - if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) - { + if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) { return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); - } - else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) - { + } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); - } - else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) - { + } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } user.setUpdateBy(SecurityUtils.getUsername()); @@ -340,10 +315,8 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:remove") @Log(title = "用户管理", businessType = BusinessType.DELETE) @DeleteMapping("/{userIds}") - public AjaxResult remove(@PathVariable Long[] userIds) - { - if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) - { + public AjaxResult remove(@PathVariable Long[] userIds) { + if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { return error("当前用户不能删除"); } return toAjax(userService.deleteUserByIds(userIds)); @@ -355,8 +328,7 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:edit") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping("/resetPwd") - public AjaxResult resetPwd(@RequestBody SysUser user) - { + public AjaxResult resetPwd(@RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); @@ -370,8 +342,7 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:edit") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysUser user) - { + public AjaxResult changeStatus(@RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); user.setUpdateBy(SecurityUtils.getUsername()); @@ -383,8 +354,7 @@ public class SysUserController extends BaseController */ @RequiresPermissions("system:user:query") @GetMapping("/authRole/{userId}") - public AjaxResult authRole(@PathVariable("userId") Long userId) - { + public AjaxResult authRole(@PathVariable("userId") Long userId) { AjaxResult ajax = AjaxResult.success(); SysUser user = userService.selectUserById(userId); List roles = roleService.findDeptRoleListByComId(user.getComId()); @@ -399,8 +369,7 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:edit") @Log(title = "用户管理", businessType = BusinessType.GRANT) @PutMapping("/authRole") - public AjaxResult insertAuthRole(Long userId, Long[] roleIds) - { + public AjaxResult insertAuthRole(Long userId, Long[] roleIds) { userService.checkUserDataScope(userId); userService.insertUserAuth(userId, roleIds); return success(); @@ -411,15 +380,14 @@ public class SysUserController extends BaseController */ @RequiresPermissions("system:user:list") @GetMapping("/deptTree") - public AjaxResult deptTree(SysDept dept) - { - String key = "user.deptTree_"+SecurityUtils.getUserId(); + public AjaxResult deptTree(SysDept dept) { + String key = "user.deptTree_" + SecurityUtils.getUserId(); Object cache = redisService.getCacheObject(key); - if(cache!=null){ + if (cache != null) { return success(cache); } List treeList = deptService.selectDeptTreeList(dept); - redisService.setCacheObject(key,treeList, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + redisService.setCacheObject(key, treeList, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); return success(treeList); } diff --git a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java index 64bd72db..34e04ebf 100644 --- a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java +++ b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java @@ -14,6 +14,7 @@ import com.yanzhu.system.domain.SysUserRole; import com.yanzhu.system.mapper.*; import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; +import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -363,8 +364,8 @@ public class SysUserServiceImpl implements ISysUserService */ private String userNameAndCout(String name){ // 设置不带声调的输出选项 - HanyuPinyinOutputFormat format = new net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat(); - format.setToneType(net.sourceforge.pinyin4j.format.HanyuPinyinToneType.WITHOUT_TONE); + HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat(); + format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); StringBuilder output = new StringBuilder(); for (char c : name.toCharArray()) { diff --git a/yanzhu-modules/yanzhu-system/src/main/resources/mapper/system/SysDeptMapper.xml b/yanzhu-modules/yanzhu-system/src/main/resources/mapper/system/SysDeptMapper.xml index c1f458bb..8c5c99bf 100644 --- a/yanzhu-modules/yanzhu-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/yanzhu-modules/yanzhu-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" parent_id, ancestors, dept_name, - dept_short_name, + dept_short_name, dept_code, dept_type, dept_infos, diff --git a/yanzhu-ui-vue3/src/components/CurrentProject/index.vue b/yanzhu-ui-vue3/src/components/CurrentProject/index.vue index ed6695c8..1fee659e 100644 --- a/yanzhu-ui-vue3/src/components/CurrentProject/index.vue +++ b/yanzhu-ui-vue3/src/components/CurrentProject/index.vue @@ -3,7 +3,7 @@ {{userStore.currentProId?userStore.currentProName:'所有项目'}} - + { if(res.code==200){ - window.location.reload(); + proxy.$modal.loading("正在切换项目信息,请稍后..."); + setTimeout("window.location.reload()", 500); } }) }else{ changeDefaultProject(proId).then(response =>{ switchProject(proId).then(res =>{ if(res.code==200){ - window.location.reload(); + proxy.$modal.loading("正在切换项目信息,请稍后..."); + setTimeout("window.location.reload()", 500); } }) }); @@ -138,7 +140,8 @@ function changeDefault(proId) { function circleClose() { cancelProject().then(res =>{ if(res.code==200){ - window.location.reload(); + proxy.$modal.loading("正在查询所有项目,请稍后..."); + setTimeout("window.location.reload()", 500); } }) } @@ -161,8 +164,9 @@ function initPage() { initPage(); - \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/components/SizeSelect/index.vue b/yanzhu-ui-vue3/src/components/SizeSelect/index.vue index 1ebb2b30..6a628b5d 100644 --- a/yanzhu-ui-vue3/src/components/SizeSelect/index.vue +++ b/yanzhu-ui-vue3/src/components/SizeSelect/index.vue @@ -24,15 +24,15 @@ const route = useRoute(); const router = useRouter(); const { proxy } = getCurrentInstance(); const sizeOptions = ref([ - { label: "ϴ", value: "large" }, - { label: "Ĭ", value: "default" }, - { label: "С", value: "small" }, + { label: "大", value: "large" }, + { label: "中", value: "default" }, + { label: "小", value: "small" }, ]); function handleSetSize(size) { - proxy.$modal.loading("òִСԺ..."); + proxy.$modal.loading("正在切换布局大小,请稍后..."); appStore.setSize(size); - setTimeout("window.location.reload()", 1000); + setTimeout("window.location.reload()", 500); } diff --git a/yanzhu-ui-vue3/src/views/manage/proProjectInfo/index.vue b/yanzhu-ui-vue3/src/views/manage/proProjectInfo/index.vue index 1c4b3b8d..251329a5 100644 --- a/yanzhu-ui-vue3/src/views/manage/proProjectInfo/index.vue +++ b/yanzhu-ui-vue3/src/views/manage/proProjectInfo/index.vue @@ -95,7 +95,7 @@ - + diff --git a/yanzhu-ui-vue3/src/views/manage/proProjectInfoSubdepts/index.vue b/yanzhu-ui-vue3/src/views/manage/proProjectInfoSubdepts/index.vue index 00357075..430574e8 100644 --- a/yanzhu-ui-vue3/src/views/manage/proProjectInfoSubdepts/index.vue +++ b/yanzhu-ui-vue3/src/views/manage/proProjectInfoSubdepts/index.vue @@ -107,14 +107,18 @@ - - + + + + - +