提交代码
parent
f974e753d1
commit
8b751cd807
|
@ -1,33 +1,66 @@
|
||||||
package com.ruoyi.common.config;
|
package com.ruoyi.common.config;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import java.util.Map;
|
|
||||||
/**
|
/**
|
||||||
* Created by tao.
|
* Created by tao.
|
||||||
* Date: 2023/3/21 15:02
|
* Date: 2023/3/21 15:02
|
||||||
* 描述:
|
* 描述:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
|
||||||
@Component
|
@Component
|
||||||
//从配置文件里获取
|
|
||||||
@ConfigurationProperties(prefix = "wechat")
|
@ConfigurationProperties(prefix = "wechat")
|
||||||
public class WechatAccountConfig {
|
public class WechatAccountConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公众平台id
|
* 公众平台id
|
||||||
*/
|
*/
|
||||||
private String mpAppId;
|
private static String mpAppId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公众平台密钥
|
* 公众平台密钥
|
||||||
*/
|
*/
|
||||||
private String mpAppSecret;
|
private static String mpAppSecret;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信模版id
|
* 公众号Token
|
||||||
*/
|
*/
|
||||||
private Map<String, String> templateId;
|
private static String myToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AccessToken
|
||||||
|
*/
|
||||||
|
private static String myAccessToken;
|
||||||
|
|
||||||
|
public static String getMpAppId() {
|
||||||
|
return mpAppId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMpAppId(String mpAppId) {
|
||||||
|
WechatAccountConfig.mpAppId = mpAppId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMpAppSecret() {
|
||||||
|
return mpAppSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMpAppSecret(String mpAppSecret) {
|
||||||
|
WechatAccountConfig.mpAppSecret = mpAppSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMyToken() {
|
||||||
|
return myToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMyToken(String myToken) {
|
||||||
|
WechatAccountConfig.myToken = myToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMyAccessToken() {
|
||||||
|
return myAccessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMyAccessToken(String myAccessToken) {
|
||||||
|
WechatAccountConfig.myAccessToken = myAccessToken;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -45,6 +45,8 @@ public class WechatMpConfig {
|
||||||
WxMpInMemoryConfigStorage wxMpConfigStorage = new WxMpInMemoryConfigStorage();
|
WxMpInMemoryConfigStorage wxMpConfigStorage = new WxMpInMemoryConfigStorage();
|
||||||
wxMpConfigStorage.setAppId(accountConfig.getMpAppId());
|
wxMpConfigStorage.setAppId(accountConfig.getMpAppId());
|
||||||
wxMpConfigStorage.setSecret(accountConfig.getMpAppSecret());
|
wxMpConfigStorage.setSecret(accountConfig.getMpAppSecret());
|
||||||
|
wxMpConfigStorage.setToken(accountConfig.getMyToken());
|
||||||
|
wxMpConfigStorage.setAccessToken(accountConfig.getMyAccessToken());
|
||||||
return wxMpConfigStorage;
|
return wxMpConfigStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,4 +46,39 @@ public class CacheConstants
|
||||||
* yanzhu系统应用注册 redis key
|
* yanzhu系统应用注册 redis key
|
||||||
*/
|
*/
|
||||||
public static final String YANZHU_SYSTEM_CONFIG = "yanzhu_system_config:";
|
public static final String YANZHU_SYSTEM_CONFIG = "yanzhu_system_config:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号模板消息 redis key
|
||||||
|
*/
|
||||||
|
public static final String WX_MPMESSAGE_KEY = "wx.mpmessage.key::";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送openId
|
||||||
|
*/
|
||||||
|
public static final String WX_MPMESSAGE_OPENID = "wx.mpmessage.openId::";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送通知人名称
|
||||||
|
*/
|
||||||
|
public static final String WX_MPMESSAGE_UNAME = "wx.mpmessage.uname::";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送项目名称
|
||||||
|
*/
|
||||||
|
public static final String WX_MPMESSAGE_PNAME = "wx.mpmessage.pname::";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送单位名称
|
||||||
|
*/
|
||||||
|
public static final String WX_MPMESSAGE_DNAME = "wx.mpmessage.dname::";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送项目总监
|
||||||
|
*/
|
||||||
|
public static final String WX_MPMESSAGE_P_SUP = "wx.mpmessage.p.sup::";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送项目甲代
|
||||||
|
*/
|
||||||
|
public static final String WX_MPMESSAGE_P_MAG = "wx.mpmessage.p.mag::";
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.ruoyi.common.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板消息枚举
|
||||||
|
*
|
||||||
|
* @author JiangYuQi
|
||||||
|
*/
|
||||||
|
public enum MessageTypeEnum {
|
||||||
|
|
||||||
|
AQYHZG("10", "安全隐患整改"),
|
||||||
|
ZLYHZG("20", "质量隐患整改"),
|
||||||
|
CSCLSP("30", "实测实量审批"),
|
||||||
|
JPYSSP("40", "举牌验收审批"),
|
||||||
|
CLFYSP("50", "材料封样审批"),
|
||||||
|
QYFSSP("60", "取样复试审批");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
MessageTypeEnum(String code, String name)
|
||||||
|
{
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode()
|
||||||
|
{
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getYHPCLX(Long infoType){
|
||||||
|
if(infoType==0){
|
||||||
|
return MessageTypeEnum.AQYHZG.code;
|
||||||
|
}else{
|
||||||
|
return MessageTypeEnum.ZLYHZG.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.ruoyi.common.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板消息枚举
|
||||||
|
*
|
||||||
|
* @author JiangYuQi
|
||||||
|
*/
|
||||||
|
public enum TemplateMessageEnum {
|
||||||
|
|
||||||
|
TROUBLE_DEFAULT("f3saBGJCnUAjXHw1KooxEUuRGv-a_8MG9dXfQvkRTBE", "隐患整改通知"),
|
||||||
|
APPLY_DEFAULT("KY7oAHgqFxUSaE3ByxFJfv_0U3LnSWfgUCwV-CZyEdo", "系统流程审批提醒");
|
||||||
|
|
||||||
|
private final String id;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
TemplateMessageEnum(String id, String name)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,152 @@
|
||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户绑定小程序openId对象 sys_user_openid
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-04-01
|
||||||
|
*/
|
||||||
|
public class SysUserOpenid extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 小程序openId */
|
||||||
|
@Excel(name = "小程序openId")
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/** 公众号openId(消息) */
|
||||||
|
@Excel(name = "公众号openId", readConverterExp = "消=息")
|
||||||
|
private String msgOpenId;
|
||||||
|
|
||||||
|
/** 用户Id */
|
||||||
|
@Excel(name = "用户Id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/** 用户登录名 */
|
||||||
|
@Excel(name = "用户登录名")
|
||||||
|
private String loginName;
|
||||||
|
|
||||||
|
/** 小程序昵称 */
|
||||||
|
@Excel(name = "小程序昵称")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
/** 删除状态(0:未删除;1:删除) */
|
||||||
|
@Excel(name = "删除状态", readConverterExp = "0=:未删除;1:删除")
|
||||||
|
private Long isDel;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date creatTime;
|
||||||
|
|
||||||
|
/** 唯一应用id */
|
||||||
|
@Excel(name = "唯一应用id")
|
||||||
|
private String unionid;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setOpenId(String openId)
|
||||||
|
{
|
||||||
|
this.openId = openId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenId()
|
||||||
|
{
|
||||||
|
return openId;
|
||||||
|
}
|
||||||
|
public void setMsgOpenId(String msgOpenId)
|
||||||
|
{
|
||||||
|
this.msgOpenId = msgOpenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsgOpenId()
|
||||||
|
{
|
||||||
|
return msgOpenId;
|
||||||
|
}
|
||||||
|
public void setUserId(String userId)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId()
|
||||||
|
{
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
public void setLoginName(String loginName)
|
||||||
|
{
|
||||||
|
this.loginName = loginName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLoginName()
|
||||||
|
{
|
||||||
|
return loginName;
|
||||||
|
}
|
||||||
|
public void setNickname(String nickname)
|
||||||
|
{
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickname()
|
||||||
|
{
|
||||||
|
return nickname;
|
||||||
|
}
|
||||||
|
public void setIsDel(Long isDel)
|
||||||
|
{
|
||||||
|
this.isDel = isDel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getIsDel()
|
||||||
|
{
|
||||||
|
return isDel;
|
||||||
|
}
|
||||||
|
public void setCreatTime(Date creatTime)
|
||||||
|
{
|
||||||
|
this.creatTime = creatTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreatTime()
|
||||||
|
{
|
||||||
|
return creatTime;
|
||||||
|
}
|
||||||
|
public void setUnionid(String unionid)
|
||||||
|
{
|
||||||
|
this.unionid = unionid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUnionid()
|
||||||
|
{
|
||||||
|
return unionid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("openId", getOpenId())
|
||||||
|
.append("msgOpenId", getMsgOpenId())
|
||||||
|
.append("userId", getUserId())
|
||||||
|
.append("loginName", getLoginName())
|
||||||
|
.append("nickname", getNickname())
|
||||||
|
.append("isDel", getIsDel())
|
||||||
|
.append("creatTime", getCreatTime())
|
||||||
|
.append("unionid", getUnionid())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.domain.SysUserOpenid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户绑定小程序openIdMapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-04-01
|
||||||
|
*/
|
||||||
|
public interface SysUserOpenidMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param id 用户绑定小程序openId主键
|
||||||
|
* @return 用户绑定小程序openId
|
||||||
|
*/
|
||||||
|
public SysUserOpenid selectSysUserOpenidById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId列表
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 用户绑定小程序openId集合
|
||||||
|
*/
|
||||||
|
public List<SysUserOpenid> selectSysUserOpenidList(SysUserOpenid sysUserOpenid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId列表
|
||||||
|
*
|
||||||
|
* @param userName 用户登录名
|
||||||
|
* @return 用户绑定小程序openId集合
|
||||||
|
*/
|
||||||
|
public List<SysUserOpenid> findSysUserOpenidsByUser(String userName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId列表[项目总监]
|
||||||
|
*
|
||||||
|
* @param proId 项目信息
|
||||||
|
* @return 用户绑定小程序openId集合
|
||||||
|
*/
|
||||||
|
public List<SysUserOpenid> findMsgProSupUsers(Long proId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId列表[项目甲代]
|
||||||
|
*
|
||||||
|
* @param proId 项目信息
|
||||||
|
* @return 用户绑定小程序openId集合
|
||||||
|
*/
|
||||||
|
public List<SysUserOpenid> findMsgProMagUsers(Long proId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysUserOpenid(SysUserOpenid sysUserOpenid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysUserOpenid(SysUserOpenid sysUserOpenid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param id 用户绑定小程序openId主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysUserOpenidById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysUserOpenidByIds(Long[] ids);
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.system.domain.SysUserOpenid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户绑定小程序openIdService接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-04-01
|
||||||
|
*/
|
||||||
|
public interface ISysUserOpenidService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param id 用户绑定小程序openId主键
|
||||||
|
* @return 用户绑定小程序openId
|
||||||
|
*/
|
||||||
|
public SysUserOpenid selectSysUserOpenidById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId列表
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 用户绑定小程序openId集合
|
||||||
|
*/
|
||||||
|
public List<SysUserOpenid> selectSysUserOpenidList(SysUserOpenid sysUserOpenid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysUserOpenid(SysUserOpenid sysUserOpenid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysUserOpenid(SysUserOpenid sysUserOpenid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的用户绑定小程序openId主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysUserOpenidByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户绑定小程序openId信息
|
||||||
|
*
|
||||||
|
* @param id 用户绑定小程序openId主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysUserOpenidById(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.system.mapper.SysUserOpenidMapper;
|
||||||
|
import com.ruoyi.system.domain.SysUserOpenid;
|
||||||
|
import com.ruoyi.system.service.ISysUserOpenidService;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
/**
|
||||||
|
* 用户绑定小程序openIdService业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2024-04-01
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysUserOpenidServiceImpl implements ISysUserOpenidService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private SysUserOpenidMapper sysUserOpenidMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param id 用户绑定小程序openId主键
|
||||||
|
* @return 用户绑定小程序openId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUserOpenid selectSysUserOpenidById(Long id)
|
||||||
|
{
|
||||||
|
return sysUserOpenidMapper.selectSysUserOpenidById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户绑定小程序openId列表
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 用户绑定小程序openId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysUserOpenid> selectSysUserOpenidList(SysUserOpenid sysUserOpenid)
|
||||||
|
{
|
||||||
|
return sysUserOpenidMapper.selectSysUserOpenidList(sysUserOpenid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSysUserOpenid(SysUserOpenid sysUserOpenid)
|
||||||
|
{
|
||||||
|
return sysUserOpenidMapper.insertSysUserOpenid(sysUserOpenid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param sysUserOpenid 用户绑定小程序openId
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSysUserOpenid(SysUserOpenid sysUserOpenid)
|
||||||
|
{
|
||||||
|
return sysUserOpenidMapper.updateSysUserOpenid(sysUserOpenid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户绑定小程序openId
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的用户绑定小程序openId主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysUserOpenidByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return sysUserOpenidMapper.deleteSysUserOpenidByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户绑定小程序openId信息
|
||||||
|
*
|
||||||
|
* @param id 用户绑定小程序openId主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysUserOpenidById(Long id)
|
||||||
|
{
|
||||||
|
return sysUserOpenidMapper.deleteSysUserOpenidById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -130,7 +130,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_name = #{userName} and u.del_flag = '0'
|
where u.user_name = #{userName} and u.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findProjectUser" resultMap="SysUserResult">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
where u.user_name = #{userName} and u.del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_id = #{userId}
|
where u.user_id = #{userId}
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.system.mapper.SysUserOpenidMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysUserOpenid" id="SysUserOpenidResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="openId" column="openId" />
|
||||||
|
<result property="msgOpenId" column="msgOpenId" />
|
||||||
|
<result property="userId" column="userId" />
|
||||||
|
<result property="loginName" column="loginName" />
|
||||||
|
<result property="nickname" column="nickname" />
|
||||||
|
<result property="isDel" column="isDel" />
|
||||||
|
<result property="creatTime" column="creatTime" />
|
||||||
|
<result property="unionid" column="unionid" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysUserOpenidVo">
|
||||||
|
select id, openId, msgOpenId, userId, loginName, nickname, isDel, creatTime, unionid from sys_user_openid
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysUserOpenidList" parameterType="SysUserOpenid" resultMap="SysUserOpenidResult">
|
||||||
|
<include refid="selectSysUserOpenidVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="openId != null and openId != ''"> and openId = #{openId}</if>
|
||||||
|
<if test="msgOpenId != null and msgOpenId != ''"> and msgOpenId = #{msgOpenId}</if>
|
||||||
|
<if test="userId != null and userId != ''"> and userId = #{userId}</if>
|
||||||
|
<if test="loginName != null and loginName != ''"> and loginName = #{loginName}</if>
|
||||||
|
<if test="isDel != null "> and isDel = #{isDel}</if>
|
||||||
|
<if test="unionid != null and unionid != ''"> and unionid = #{unionid}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findSysUserOpenidsByUser" parameterType="String" resultMap="SysUserOpenidResult">
|
||||||
|
<include refid="selectSysUserOpenidVo"/>
|
||||||
|
where loginName = #{loginName} and isDel = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findMsgProSupUsers" parameterType="Long" resultMap="SysUserOpenidResult">
|
||||||
|
select suo.id, suo.openId, suo.msgOpenId, suo.userId, suo.loginName, suo.nickname, suo.isDel, suo.creatTime, suo.unionid
|
||||||
|
from sys_user_openid suo
|
||||||
|
left join sys_user su on su.phonenumber = suo.loginName
|
||||||
|
left join sur_project_userinfo spu on spu.user_id = su.user_id
|
||||||
|
where spu.project_id = #{proId} and spu.job_type=1 and spu.is_del = 0 and su.del_flag = '0' and suo.isDel=0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findMsgProMagUsers" parameterType="Long" resultMap="SysUserOpenidResult">
|
||||||
|
select suo.id, suo.openId, suo.msgOpenId, suo.userId, suo.loginName, suo.nickname, suo.isDel, suo.creatTime, suo.unionid
|
||||||
|
from sys_user_openid suo
|
||||||
|
left join sys_user su on su.phonenumber = suo.loginName
|
||||||
|
left join sur_project_userinfo spu on spu.user_id = su.user_id
|
||||||
|
where spu.project_id = #{proId} and spu.job_type=21 and spu.is_del = 0 and su.del_flag = '0' and suo.isDel=0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysUserOpenidById" parameterType="Long" resultMap="SysUserOpenidResult">
|
||||||
|
<include refid="selectSysUserOpenidVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysUserOpenid" parameterType="SysUserOpenid" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_user_openid
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="openId != null">openId,</if>
|
||||||
|
<if test="msgOpenId != null">msgOpenId,</if>
|
||||||
|
<if test="userId != null">userId,</if>
|
||||||
|
<if test="loginName != null">loginName,</if>
|
||||||
|
<if test="nickname != null">nickname,</if>
|
||||||
|
<if test="isDel != null">isDel,</if>
|
||||||
|
<if test="creatTime != null">creatTime,</if>
|
||||||
|
<if test="unionid != null">unionid,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="openId != null">#{openId},</if>
|
||||||
|
<if test="msgOpenId != null">#{msgOpenId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="loginName != null">#{loginName},</if>
|
||||||
|
<if test="nickname != null">#{nickname},</if>
|
||||||
|
<if test="isDel != null">#{isDel},</if>
|
||||||
|
<if test="creatTime != null">#{creatTime},</if>
|
||||||
|
<if test="unionid != null">#{unionid},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysUserOpenid" parameterType="SysUserOpenid">
|
||||||
|
update sys_user_openid
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="openId != null">openId = #{openId},</if>
|
||||||
|
<if test="msgOpenId != null">msgOpenId = #{msgOpenId},</if>
|
||||||
|
<if test="userId != null">userId = #{userId},</if>
|
||||||
|
<if test="loginName != null">loginName = #{loginName},</if>
|
||||||
|
<if test="nickname != null">nickname = #{nickname},</if>
|
||||||
|
<if test="isDel != null">isDel = #{isDel},</if>
|
||||||
|
<if test="creatTime != null">creatTime = #{creatTime},</if>
|
||||||
|
<if test="unionid != null">unionid = #{unionid},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSysUserOpenidById" parameterType="Long">
|
||||||
|
delete from sys_user_openid where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSysUserOpenidByIds" parameterType="String">
|
||||||
|
delete from sys_user_openid where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -8,7 +8,7 @@ export default {
|
||||||
name: "build",
|
name: "build",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
userOpenId:"",
|
uId:null,
|
||||||
show: true,
|
show: true,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
bindPhoneVo: {
|
bindPhoneVo: {
|
||||||
|
@ -19,10 +19,7 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
this.userOpenId = this.$route.query.userOpenId;
|
this.uId=this.getQueryString('userOpenId') || '';
|
||||||
console.log("userOpenId====>",userOpenId);
|
|
||||||
let qs = this.getQueryString('userOpenId');
|
|
||||||
console.log("getQueryString====>",qs);
|
|
||||||
this.wechatLogin();
|
this.wechatLogin();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -32,14 +29,12 @@ export default {
|
||||||
// token === '' && openId != '' 只要这种情况,未绑定账号
|
// token === '' && openId != '' 只要这种情况,未绑定账号
|
||||||
if(openId != '') {
|
if(openId != '') {
|
||||||
// 绑定账号
|
// 绑定账号
|
||||||
this.bindPhoneVo.openId = openId
|
console.log("dialogVisible===>",openId,this.uId);
|
||||||
this.dialogVisible = false
|
|
||||||
console.log("dialogVisible===>");
|
|
||||||
} else {
|
} else {
|
||||||
// 如果绑定了,返回成功
|
// 如果绑定了,返回成功
|
||||||
console.log("我要去登录了===>");
|
console.log("我要去登录了===>");
|
||||||
let _baseUrl = "https://szgc.jhncidg.com";
|
let _baseUrl = "https://szgc.jhncidg.com";
|
||||||
window.location = _baseUrl + '/jhapi/wxAuth/authorize?returnUrl=' + _baseUrl + "/#/wxAuth"
|
window.location = _baseUrl + '/jhapi/wxAuth/authorize?returnUrl=' + _baseUrl + "/#/wxAuth?uid="+this.uId
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveBind() {
|
saveBind() {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
|
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
|
||||||
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
|
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
|
||||||
|
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.jh.project.mapper.SurProjectCheckDetectionMapper;
|
import com.yanzhu.jh.project.mapper.SurProjectCheckDetectionMapper;
|
||||||
|
@ -25,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
* @date 2023-08-31
|
* @date 2023-08-31
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SurProjectCheckDetectionServiceImpl implements ISurProjectCheckDetectionService
|
public class SurProjectCheckDetectionServiceImpl extends WxMessageImpl implements ISurProjectCheckDetectionService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;
|
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;
|
||||||
|
@ -73,7 +74,12 @@ public class SurProjectCheckDetectionServiceImpl implements ISurProjectCheckDete
|
||||||
surProjectCheckDetection.setCreateBy(SecurityUtils.getUsername());
|
surProjectCheckDetection.setCreateBy(SecurityUtils.getUsername());
|
||||||
}
|
}
|
||||||
surProjectCheckDetection.setCreateTime(DateUtils.getNowDate());
|
surProjectCheckDetection.setCreateTime(DateUtils.getNowDate());
|
||||||
return surProjectCheckDetectionMapper.insertSurProjectCheckDetection(surProjectCheckDetection);
|
int res = surProjectCheckDetectionMapper.insertSurProjectCheckDetection(surProjectCheckDetection);
|
||||||
|
|
||||||
|
if(res>0){
|
||||||
|
super.send(surProjectCheckDetection);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,6 +93,17 @@ public class SurProjectCheckDetectionServiceImpl implements ISurProjectCheckDete
|
||||||
public int updateSurProjectCheckDetection(SurProjectCheckDetection surProjectCheckDetection)
|
public int updateSurProjectCheckDetection(SurProjectCheckDetection surProjectCheckDetection)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//修改人和修改时间为登记检测结果信息,审批合格或不合格时不修改这个字段
|
||||||
|
if(PublicStateEnum.AUDITINFO_DSH.getCode().equals(surProjectCheckDetection.getApproveStatus())){
|
||||||
|
// 非提交时保存最后修改人
|
||||||
|
if(surProjectCheckDetection.getUpdateBy()==null){
|
||||||
|
surProjectCheckDetection.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
}
|
||||||
|
surProjectCheckDetection.setUpdateTime(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
int res = surProjectCheckDetectionMapper.updateSurProjectCheckDetection(surProjectCheckDetection);
|
||||||
|
|
||||||
//操作日志
|
//操作日志
|
||||||
if(StringUtils.isNotBlank(surProjectCheckDetection.getApproveStatus())){
|
if(StringUtils.isNotBlank(surProjectCheckDetection.getApproveStatus())){
|
||||||
SurProjectAuditinfo surProjectAuditinfo = new SurProjectAuditinfo();
|
SurProjectAuditinfo surProjectAuditinfo = new SurProjectAuditinfo();
|
||||||
|
@ -99,18 +116,15 @@ public class SurProjectCheckDetectionServiceImpl implements ISurProjectCheckDete
|
||||||
surProjectAuditinfo.setCreateBy(surProjectCheckDetection.getUpdateBy());
|
surProjectAuditinfo.setCreateBy(surProjectCheckDetection.getUpdateBy());
|
||||||
surProjectAuditinfo.setCreateTime(new Date());
|
surProjectAuditinfo.setCreateTime(new Date());
|
||||||
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
||||||
}
|
|
||||||
|
|
||||||
//修改人和修改时间为登记检测结果信息,审批合格或不合格时不修改这个字段
|
//推送代办消息
|
||||||
if(PublicStateEnum.AUDITINFO_DSH.getCode().equals(surProjectCheckDetection.getApproveStatus())){
|
if(res>0){
|
||||||
// 非提交时保存最后修改人
|
surProjectCheckDetection = surProjectCheckDetectionMapper.selectSurProjectCheckDetectionById(surProjectCheckDetection.getId());
|
||||||
if(surProjectCheckDetection.getUpdateBy()==null){
|
super.send(surProjectCheckDetection);
|
||||||
surProjectCheckDetection.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
}
|
}
|
||||||
surProjectCheckDetection.setUpdateTime(new Date());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return surProjectCheckDetectionMapper.updateSurProjectCheckDetection(surProjectCheckDetection);
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
|
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
|
||||||
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
|
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
|
||||||
|
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.jh.project.mapper.SurProjectCheckingMapper;
|
import com.yanzhu.jh.project.mapper.SurProjectCheckingMapper;
|
||||||
|
@ -26,7 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
* @date 2023-08-18
|
* @date 2023-08-18
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SurProjectCheckingServiceImpl implements ISurProjectCheckingService
|
public class SurProjectCheckingServiceImpl extends WxMessageImpl implements ISurProjectCheckingService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;
|
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;
|
||||||
|
@ -157,6 +158,9 @@ public class SurProjectCheckingServiceImpl implements ISurProjectCheckingService
|
||||||
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(res>0){
|
||||||
|
super.send(surProjectChecking);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +181,7 @@ public class SurProjectCheckingServiceImpl implements ISurProjectCheckingService
|
||||||
surProjectChecking.setUpdateBy(SecurityUtils.getUsername());
|
surProjectChecking.setUpdateBy(SecurityUtils.getUsername());
|
||||||
}
|
}
|
||||||
surProjectChecking.setUpdateTime(DateUtils.getNowDate());
|
surProjectChecking.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
int res = surProjectCheckingMapper.updateSurProjectChecking(surProjectChecking);
|
||||||
|
|
||||||
//操作日志
|
//操作日志
|
||||||
if(StringUtils.isNotBlank(surProjectChecking.getApproveStatus())){
|
if(StringUtils.isNotBlank(surProjectChecking.getApproveStatus())){
|
||||||
|
@ -190,9 +195,15 @@ public class SurProjectCheckingServiceImpl implements ISurProjectCheckingService
|
||||||
surProjectAuditinfo.setCreateBy(surProjectChecking.getUpdateBy());
|
surProjectAuditinfo.setCreateBy(surProjectChecking.getUpdateBy());
|
||||||
surProjectAuditinfo.setCreateTime(new Date());
|
surProjectAuditinfo.setCreateTime(new Date());
|
||||||
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
||||||
|
|
||||||
|
//推送代办消息
|
||||||
|
if(res>0){
|
||||||
|
surProjectChecking = surProjectCheckingMapper.selectSurProjectCheckingById(surProjectChecking.getId());
|
||||||
|
super.send(surProjectChecking);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return surProjectCheckingMapper.updateSurProjectChecking(surProjectChecking);
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
|
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
|
||||||
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
|
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
|
||||||
|
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.jh.project.mapper.SurProjectMaterialSealMapper;
|
import com.yanzhu.jh.project.mapper.SurProjectMaterialSealMapper;
|
||||||
|
@ -25,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
* @date 2023-08-22
|
* @date 2023-08-22
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SurProjectMaterialSealServiceImpl implements ISurProjectMaterialSealService
|
public class SurProjectMaterialSealServiceImpl extends WxMessageImpl implements ISurProjectMaterialSealService
|
||||||
{
|
{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -116,6 +117,9 @@ public class SurProjectMaterialSealServiceImpl implements ISurProjectMaterialSea
|
||||||
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(res>0){
|
||||||
|
super.send(surProjectMaterialSeal);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +140,7 @@ public class SurProjectMaterialSealServiceImpl implements ISurProjectMaterialSea
|
||||||
surProjectMaterialSeal.setMainImage(surProjectMaterialSeal.getImageUrls().split(",")[0]);
|
surProjectMaterialSeal.setMainImage(surProjectMaterialSeal.getImageUrls().split(",")[0]);
|
||||||
}
|
}
|
||||||
surProjectMaterialSeal.setUpdateTime(DateUtils.getNowDate());
|
surProjectMaterialSeal.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
int res = surProjectMaterialSealMapper.updateSurProjectMaterialSeal(surProjectMaterialSeal);
|
||||||
|
|
||||||
//操作日志
|
//操作日志
|
||||||
if(StringUtils.isNotBlank(surProjectMaterialSeal.getApproveStatus())){
|
if(StringUtils.isNotBlank(surProjectMaterialSeal.getApproveStatus())){
|
||||||
|
@ -149,9 +154,14 @@ public class SurProjectMaterialSealServiceImpl implements ISurProjectMaterialSea
|
||||||
surProjectAuditinfo.setCreateBy(surProjectMaterialSeal.getUpdateBy());
|
surProjectAuditinfo.setCreateBy(surProjectMaterialSeal.getUpdateBy());
|
||||||
surProjectAuditinfo.setCreateTime(new Date());
|
surProjectAuditinfo.setCreateTime(new Date());
|
||||||
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
||||||
}
|
|
||||||
|
|
||||||
return surProjectMaterialSealMapper.updateSurProjectMaterialSeal(surProjectMaterialSeal);
|
//推送代办消息
|
||||||
|
if(res>0){
|
||||||
|
surProjectMaterialSeal = surProjectMaterialSealMapper.selectSurProjectMaterialSealById(surProjectMaterialSeal.getId());
|
||||||
|
super.send(surProjectMaterialSeal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
|
import com.yanzhu.jh.project.domain.SurProjectAuditinfo;
|
||||||
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
|
import com.yanzhu.jh.project.mapper.SurProjectAuditinfoMapper;
|
||||||
|
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.jh.project.mapper.SurProjectMeasureMapper;
|
import com.yanzhu.jh.project.mapper.SurProjectMeasureMapper;
|
||||||
|
@ -25,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
* @date 2023-08-22
|
* @date 2023-08-22
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SurProjectMeasureServiceImpl implements ISurProjectMeasureService
|
public class SurProjectMeasureServiceImpl extends WxMessageImpl implements ISurProjectMeasureService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;
|
private SurProjectAuditinfoMapper surProjectAuditinfoMapper;
|
||||||
|
@ -115,6 +116,9 @@ public class SurProjectMeasureServiceImpl implements ISurProjectMeasureService
|
||||||
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(res>0){
|
||||||
|
super.send(surProjectMeasure);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +139,7 @@ public class SurProjectMeasureServiceImpl implements ISurProjectMeasureService
|
||||||
surProjectMeasure.setMainImage(surProjectMeasure.getImageUrls().split(",")[0]);
|
surProjectMeasure.setMainImage(surProjectMeasure.getImageUrls().split(",")[0]);
|
||||||
}
|
}
|
||||||
surProjectMeasure.setUpdateTime(DateUtils.getNowDate());
|
surProjectMeasure.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
int res = surProjectMeasureMapper.updateSurProjectMeasure(surProjectMeasure);
|
||||||
|
|
||||||
//操作日志
|
//操作日志
|
||||||
if(StringUtils.isNotBlank(surProjectMeasure.getApproveStatus())){
|
if(StringUtils.isNotBlank(surProjectMeasure.getApproveStatus())){
|
||||||
|
@ -148,9 +153,14 @@ public class SurProjectMeasureServiceImpl implements ISurProjectMeasureService
|
||||||
surProjectAuditinfo.setCreateBy(surProjectMeasure.getUpdateBy());
|
surProjectAuditinfo.setCreateBy(surProjectMeasure.getUpdateBy());
|
||||||
surProjectAuditinfo.setCreateTime(new Date());
|
surProjectAuditinfo.setCreateTime(new Date());
|
||||||
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
surProjectAuditinfoMapper.insertSurProjectAuditinfo(surProjectAuditinfo);
|
||||||
}
|
|
||||||
|
|
||||||
return surProjectMeasureMapper.updateSurProjectMeasure(surProjectMeasure);
|
//推送代办消息
|
||||||
|
if(res>0){
|
||||||
|
surProjectMeasure = surProjectMeasureMapper.selectSurProjectMeasureById(surProjectMeasure.getId());
|
||||||
|
super.send(surProjectMeasure);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.yanzhu.jh.trouble.domain.SmzSspFileinfo;
|
||||||
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
||||||
import com.yanzhu.jh.trouble.mapper.SmzSspAuditinfoMapper;
|
import com.yanzhu.jh.trouble.mapper.SmzSspAuditinfoMapper;
|
||||||
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper;
|
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper;
|
||||||
|
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyDraftMapper;
|
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyDraftMapper;
|
||||||
|
@ -36,7 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
* @date 2023-10-15
|
* @date 2023-10-15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SmzSspProblemmodifyDraftServiceImpl implements ISmzSspProblemmodifyDraftService
|
public class SmzSspProblemmodifyDraftServiceImpl extends WxMessageImpl implements ISmzSspProblemmodifyDraftService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptMapper deptMapper;
|
private SysDeptMapper deptMapper;
|
||||||
|
@ -113,7 +114,8 @@ public class SmzSspProblemmodifyDraftServiceImpl implements ISmzSspProblemmodify
|
||||||
insert.setMarksPicture(urls.get(0));
|
insert.setMarksPicture(urls.get(0));
|
||||||
insert.setProblemType("1");
|
insert.setProblemType("1");
|
||||||
insert.setRoleType(Convert.toLong(roleType));
|
insert.setRoleType(Convert.toLong(roleType));
|
||||||
count.addAndGet(smzSspProblemmodifyDraftMapper.insertSmzSspProblemmodifyDraft(insert));
|
int res = smzSspProblemmodifyDraftMapper.insertSmzSspProblemmodifyDraft(insert);
|
||||||
|
count.addAndGet(res);
|
||||||
}
|
}
|
||||||
return count.intValue();
|
return count.intValue();
|
||||||
}
|
}
|
||||||
|
@ -127,7 +129,7 @@ public class SmzSspProblemmodifyDraftServiceImpl implements ISmzSspProblemmodify
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int batchUpdateSmzSspProblemmodifyDraft(List<SmzSspProblemmodify> smzSspProblemmodifyList) {
|
public int batchUpdateSmzSspProblemmodifyDraft(List<SmzSspProblemmodify> smzSspProblemmodifyList) {
|
||||||
int res = 0;
|
AtomicInteger count = new AtomicInteger();
|
||||||
for(SmzSspProblemmodify smzSspProblemmodify:smzSspProblemmodifyList){
|
for(SmzSspProblemmodify smzSspProblemmodify:smzSspProblemmodifyList){
|
||||||
if(smzSspProblemmodify.getId()!=null){
|
if(smzSspProblemmodify.getId()!=null){
|
||||||
//删除草稿
|
//删除草稿
|
||||||
|
@ -143,17 +145,22 @@ public class SmzSspProblemmodifyDraftServiceImpl implements ISmzSspProblemmodify
|
||||||
SurProject surProject = surProjectMapper.selectSurProjectById(smzSspProblemmodify.getProjectId());
|
SurProject surProject = surProjectMapper.selectSurProjectById(smzSspProblemmodify.getProjectId());
|
||||||
smzSspProblemmodify.setProblemArea(surProject.getProjectName());
|
smzSspProblemmodify.setProblemArea(surProject.getProjectName());
|
||||||
}
|
}
|
||||||
smzSspProblemmodifyMapper.insertSmzSspProblemmodify(smzSspProblemmodify);
|
int res = smzSspProblemmodifyMapper.insertSmzSspProblemmodify(smzSspProblemmodify);
|
||||||
SmzSspAuditinfo smzSspAuditinfo = new SmzSspAuditinfo();
|
if(res>0){
|
||||||
smzSspAuditinfo.setMainId(smzSspProblemmodify.getId());
|
SmzSspAuditinfo smzSspAuditinfo = new SmzSspAuditinfo();
|
||||||
smzSspAuditinfo.setProcessState("1");
|
smzSspAuditinfo.setMainId(smzSspProblemmodify.getId());
|
||||||
smzSspAuditinfo.setCreateUser(smzSspProblemmodify.getCreateUser());
|
smzSspAuditinfo.setProcessState("1");
|
||||||
smzSspAuditinfo.setCreateTime(new Date());
|
smzSspAuditinfo.setCreateUser(smzSspProblemmodify.getCreateUser());
|
||||||
res = smzSspAuditinfoMapper.insertSmzSspAuditinfo(smzSspAuditinfo);
|
smzSspAuditinfo.setCreateTime(new Date());
|
||||||
smzSspAuditinfo.setFileUrls(smzSspProblemmodify.getSmarkUrl());
|
smzSspAuditinfoMapper.insertSmzSspAuditinfo(smzSspAuditinfo);
|
||||||
insertSmzSspFileinfo(smzSspAuditinfo);
|
smzSspAuditinfo.setFileUrls(smzSspProblemmodify.getSmarkUrl());
|
||||||
|
insertSmzSspFileinfo(smzSspAuditinfo);
|
||||||
|
|
||||||
|
super.send(smzSspProblemmodify);
|
||||||
|
}
|
||||||
|
count.addAndGet(res);
|
||||||
}
|
}
|
||||||
return res;
|
return count.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,15 +226,19 @@ public class SmzSspProblemmodifyDraftServiceImpl implements ISmzSspProblemmodify
|
||||||
if(smzSspProblemmodify.getRoleType()==null || smzSspProblemmodify.getRoleType()<1){
|
if(smzSspProblemmodify.getRoleType()==null || smzSspProblemmodify.getRoleType()<1){
|
||||||
smzSspProblemmodify.setRoleType(Convert.toInt(getRoleType(smzSspProblemmodify.getProjectId(),smzSspProblemmodify.getCreateUser())));
|
smzSspProblemmodify.setRoleType(Convert.toInt(getRoleType(smzSspProblemmodify.getProjectId(),smzSspProblemmodify.getCreateUser())));
|
||||||
}
|
}
|
||||||
smzSspProblemmodifyMapper.insertSmzSspProblemmodify(smzSspProblemmodify);
|
int res = smzSspProblemmodifyMapper.insertSmzSspProblemmodify(smzSspProblemmodify);
|
||||||
SmzSspAuditinfo smzSspAuditinfo = new SmzSspAuditinfo();
|
if(res>0){
|
||||||
smzSspAuditinfo.setMainId(smzSspProblemmodify.getId());
|
SmzSspAuditinfo smzSspAuditinfo = new SmzSspAuditinfo();
|
||||||
smzSspAuditinfo.setProcessState("1");
|
smzSspAuditinfo.setMainId(smzSspProblemmodify.getId());
|
||||||
smzSspAuditinfo.setCreateUser(smzSspProblemmodify.getCreateUser());
|
smzSspAuditinfo.setProcessState("1");
|
||||||
smzSspAuditinfo.setCreateTime(new Date());
|
smzSspAuditinfo.setCreateUser(smzSspProblemmodify.getCreateUser());
|
||||||
int res = smzSspAuditinfoMapper.insertSmzSspAuditinfo(smzSspAuditinfo);
|
smzSspAuditinfo.setCreateTime(new Date());
|
||||||
smzSspAuditinfo.setFileUrls(smzSspProblemmodify.getSmarkUrl());
|
smzSspAuditinfoMapper.insertSmzSspAuditinfo(smzSspAuditinfo);
|
||||||
insertSmzSspFileinfo(smzSspAuditinfo);
|
smzSspAuditinfo.setFileUrls(smzSspProblemmodify.getSmarkUrl());
|
||||||
|
insertSmzSspFileinfo(smzSspAuditinfo);
|
||||||
|
|
||||||
|
super.send(smzSspProblemmodify);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import com.yanzhu.jh.trouble.domain.SmzSspAuditinfo;
|
||||||
import com.yanzhu.jh.trouble.domain.SmzSspFileinfo;
|
import com.yanzhu.jh.trouble.domain.SmzSspFileinfo;
|
||||||
import com.yanzhu.jh.trouble.domain.where.SmzSspProblemmodifyWhere;
|
import com.yanzhu.jh.trouble.domain.where.SmzSspProblemmodifyWhere;
|
||||||
import com.yanzhu.jh.trouble.mapper.SmzSspAuditinfoMapper;
|
import com.yanzhu.jh.trouble.mapper.SmzSspAuditinfoMapper;
|
||||||
|
import com.yanzhu.jh.wxsetting.service.impl.WxMessageImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper;
|
import com.yanzhu.jh.trouble.mapper.SmzSspProblemmodifyMapper;
|
||||||
|
@ -31,7 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
* @date 2023-07-28
|
* @date 2023-07-28
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SmzSspProblemmodifyServiceImpl implements ISmzSspProblemmodifyService
|
public class SmzSspProblemmodifyServiceImpl extends WxMessageImpl implements ISmzSspProblemmodifyService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptMapper deptMapper;
|
private SysDeptMapper deptMapper;
|
||||||
|
@ -162,15 +163,20 @@ public class SmzSspProblemmodifyServiceImpl implements ISmzSspProblemmodifyServi
|
||||||
}
|
}
|
||||||
smzSspProblemmodify.setRoleType(Convert.toInt(roleType));
|
smzSspProblemmodify.setRoleType(Convert.toInt(roleType));
|
||||||
smzSspProblemmodify.setCreateTime(DateUtils.getNowDate());
|
smzSspProblemmodify.setCreateTime(DateUtils.getNowDate());
|
||||||
smzSspProblemmodifyMapper.insertSmzSspProblemmodify(smzSspProblemmodify);
|
int res = smzSspProblemmodifyMapper.insertSmzSspProblemmodify(smzSspProblemmodify);
|
||||||
SmzSspAuditinfo smzSspAuditinfo = new SmzSspAuditinfo();
|
if(res>0){
|
||||||
smzSspAuditinfo.setMainId(smzSspProblemmodify.getId());
|
SmzSspAuditinfo smzSspAuditinfo = new SmzSspAuditinfo();
|
||||||
smzSspAuditinfo.setProcessState("1");
|
smzSspAuditinfo.setMainId(smzSspProblemmodify.getId());
|
||||||
smzSspAuditinfo.setCreateUser(smzSspProblemmodify.getCreateUser());
|
smzSspAuditinfo.setProcessState("1");
|
||||||
smzSspAuditinfo.setCreateTime(new Date());
|
smzSspAuditinfo.setCreateUser(smzSspProblemmodify.getCreateUser());
|
||||||
int res = smzSspAuditinfoMapper.insertSmzSspAuditinfo(smzSspAuditinfo);
|
smzSspAuditinfo.setCreateTime(new Date());
|
||||||
smzSspAuditinfo.setFileUrls(smzSspProblemmodify.getSmarkUrl());
|
smzSspAuditinfoMapper.insertSmzSspAuditinfo(smzSspAuditinfo);
|
||||||
insertSmzSspFileinfo(smzSspAuditinfo);
|
smzSspAuditinfo.setFileUrls(smzSspProblemmodify.getSmarkUrl());
|
||||||
|
insertSmzSspFileinfo(smzSspAuditinfo);
|
||||||
|
|
||||||
|
super.send(smzSspProblemmodify);
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +190,12 @@ public class SmzSspProblemmodifyServiceImpl implements ISmzSspProblemmodifyServi
|
||||||
public int updateSmzSspProblemmodify(SmzSspProblemmodify smzSspProblemmodify)
|
public int updateSmzSspProblemmodify(SmzSspProblemmodify smzSspProblemmodify)
|
||||||
{
|
{
|
||||||
smzSspProblemmodify.setUpdateTime(DateUtils.getNowDate());
|
smzSspProblemmodify.setUpdateTime(DateUtils.getNowDate());
|
||||||
return smzSspProblemmodifyMapper.updateSmzSspProblemmodify(smzSspProblemmodify);
|
int res = smzSspProblemmodifyMapper.updateSmzSspProblemmodify(smzSspProblemmodify);
|
||||||
|
|
||||||
|
if(res>0){
|
||||||
|
super.send(smzSspProblemmodify);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package com.yanzhu.jh.wxsetting.controller;
|
package com.yanzhu.jh.wxsetting.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.constant.CacheConstants;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
|
@ -9,9 +13,10 @@ import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,27 +26,55 @@ import java.net.URLEncoder;
|
||||||
* @date 2023-08-24
|
* @date 2023-08-24
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@Controller
|
||||||
@RequestMapping("/wxAuth")
|
@RequestMapping("/wxAuth")
|
||||||
public class WxAuthController extends BaseController {
|
public class WxAuthController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WxMpService wxMpService;
|
private WxMpService wxMpService;
|
||||||
|
|
||||||
|
@Anonymous
|
||||||
@GetMapping("/auth")
|
@GetMapping("/auth")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String auth(@RequestParam(value = "echostr", defaultValue = "没有获取到") String echostr) {
|
public String auth(@RequestParam(value = "echostr", defaultValue = "没有获取到") String echostr) {
|
||||||
return echostr;
|
return echostr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Anonymous
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/getWxAccessToken")
|
||||||
|
public AjaxResult getWxAccessToken(){
|
||||||
|
try {
|
||||||
|
return success(wxMpService.getAccessToken());
|
||||||
|
}catch (Exception e){
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Anonymous
|
||||||
|
@ResponseBody
|
||||||
|
@GetMapping("/deleteTestCache")
|
||||||
|
public AjaxResult deleteTestCache(){
|
||||||
|
redisCache.deleteObject(CacheConstants.WX_MPMESSAGE_UNAME+"*");
|
||||||
|
redisCache.deleteObject(CacheConstants.WX_MPMESSAGE_PNAME+"*");
|
||||||
|
redisCache.deleteObject(CacheConstants.WX_MPMESSAGE_DNAME+"*");
|
||||||
|
redisCache.deleteObject(CacheConstants.WX_MPMESSAGE_P_SUP+"*");
|
||||||
|
redisCache.deleteObject(CacheConstants.WX_MPMESSAGE_P_MAG+"*");
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author :tao
|
* @author :tao
|
||||||
* @param: :
|
* @param: :
|
||||||
* @return: 重定向到获取用户信息的类
|
* @return: 重定向到获取用户信息的类
|
||||||
* 微信授权登录
|
* 微信授权登录
|
||||||
*/
|
*/
|
||||||
|
@Anonymous
|
||||||
@GetMapping("/authorize")
|
@GetMapping("/authorize")
|
||||||
public String authorize(@RequestParam(value = "returnUrl", defaultValue = "https://szgc.jhncidg.com/jhapi/") String returnUrl) throws UnsupportedEncodingException {
|
public void authorize(@RequestParam(value = "returnUrl", defaultValue = "https://szgc.jhncidg.com/jhapi/") String returnUrl, HttpServletResponse response) throws Exception {
|
||||||
log.info("【微信网页授权】进来了,参数={}", returnUrl);
|
log.info("【微信网页授权】进来了,参数={}", returnUrl);
|
||||||
//1. 配置
|
//1. 配置
|
||||||
//2. 调用方法
|
//2. 调用方法
|
||||||
|
@ -53,7 +86,7 @@ public class WxAuthController extends BaseController {
|
||||||
*/
|
*/
|
||||||
String redirectUrl = wxMpService.oauth2buildAuthorizationUrl(url, WxConsts.OAUTH2_SCOPE_USER_INFO, URLEncoder.encode(returnUrl, "utf-8"));
|
String redirectUrl = wxMpService.oauth2buildAuthorizationUrl(url, WxConsts.OAUTH2_SCOPE_USER_INFO, URLEncoder.encode(returnUrl, "utf-8"));
|
||||||
log.info("【微信网页授权】获取code,result={}", redirectUrl);
|
log.info("【微信网页授权】获取code,result={}", redirectUrl);
|
||||||
return "redirect:" + redirectUrl;
|
response.sendRedirect(redirectUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,9 +95,10 @@ public class WxAuthController extends BaseController {
|
||||||
* @return: 重定向
|
* @return: 重定向
|
||||||
* 获取用户信息类,最后重定向到指定url
|
* 获取用户信息类,最后重定向到指定url
|
||||||
*/
|
*/
|
||||||
|
@Anonymous
|
||||||
@GetMapping("/userInfo")
|
@GetMapping("/userInfo")
|
||||||
public String userInfo(@RequestParam("code") String code,
|
public void userInfo(@RequestParam("code") String code,
|
||||||
@RequestParam("state") String returnUrl) throws WxErrorException {
|
@RequestParam("state") String returnUrl,HttpServletResponse response) throws Exception {
|
||||||
/*当用户同意授权后,会回调所设置的url并把authorization code传过来,
|
/*当用户同意授权后,会回调所设置的url并把authorization code传过来,
|
||||||
然后用这个code获得access token,其中也包含用户的openid等信息*/
|
然后用这个code获得access token,其中也包含用户的openid等信息*/
|
||||||
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken();
|
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken();
|
||||||
|
@ -86,7 +120,7 @@ public class WxAuthController extends BaseController {
|
||||||
|
|
||||||
//注意拼接参数,第一个参数需要加问号,之后参数使用&拼接的问题
|
//注意拼接参数,第一个参数需要加问号,之后参数使用&拼接的问题
|
||||||
//return "redirect:" + returnUrl + "/#/?openid=" + openId;
|
//return "redirect:" + returnUrl + "/#/?openid=" + openId;
|
||||||
return "redirect:" + returnUrl + "&openid=" + openId;
|
response.sendRedirect(returnUrl + "&openid=" + openId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
package com.yanzhu.jh.wxsetting.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
|
||||||
import me.chanjar.weixin.mp.api.WxMpService;
|
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信openId绑定
|
|
||||||
*
|
|
||||||
* @author JiangYuQi
|
|
||||||
* @date 2023-08-24
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/wxAuth")
|
|
||||||
public class WxBindingController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WxMpService wxMpService;
|
|
||||||
|
|
||||||
@GetMapping("/auth")
|
|
||||||
@ResponseBody
|
|
||||||
public String auth(@RequestParam(value = "echostr", defaultValue = "没有获取到") String echostr) {
|
|
||||||
return echostr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author :tao
|
|
||||||
* @param: :
|
|
||||||
* @return: 重定向到获取用户信息的类
|
|
||||||
* 微信授权登录
|
|
||||||
*/
|
|
||||||
@GetMapping("/authorize")
|
|
||||||
public String authorize(@RequestParam(value = "returnUrl", defaultValue = "https://szgc.jhncidg.com/jhapi/") String returnUrl) throws UnsupportedEncodingException {
|
|
||||||
log.info("【微信网页授权】进来了,参数={}", returnUrl);
|
|
||||||
//1. 配置
|
|
||||||
//2. 调用方法
|
|
||||||
String url = RuoYiConfig.getProjectUrl() + "wxAuth/userInfo";
|
|
||||||
/*
|
|
||||||
* 相当于这种形式
|
|
||||||
* URLEncoder.decode(returnUrl,"UTF-8"
|
|
||||||
* https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
|
|
||||||
*/
|
|
||||||
String redirectUrl = wxMpService.oauth2buildAuthorizationUrl(url, WxConsts.OAUTH2_SCOPE_USER_INFO, URLEncoder.encode(returnUrl, "utf-8"));
|
|
||||||
log.info("【微信网页授权】获取code,result={}", redirectUrl);
|
|
||||||
return "redirect:" + redirectUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author :tao
|
|
||||||
* @param: :
|
|
||||||
* @return: 重定向
|
|
||||||
* 获取用户信息类,最后重定向到指定url
|
|
||||||
*/
|
|
||||||
@GetMapping("/userInfo")
|
|
||||||
public String userInfo(@RequestParam("code") String code,
|
|
||||||
@RequestParam("state") String returnUrl) throws WxErrorException {
|
|
||||||
/*当用户同意授权后,会回调所设置的url并把authorization code传过来,
|
|
||||||
然后用这个code获得access token,其中也包含用户的openid等信息*/
|
|
||||||
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken();
|
|
||||||
try {
|
|
||||||
//获取access token
|
|
||||||
wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
|
|
||||||
log.info("【AccessToken:】{}", wxMpOAuth2AccessToken.getAccessToken());
|
|
||||||
} catch (WxErrorException e) {
|
|
||||||
log.error("【微信网页授权】{}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 拿到openid
|
|
||||||
String openId = wxMpOAuth2AccessToken.getOpenId();
|
|
||||||
log.info("【openid:】{}", openId);
|
|
||||||
log.info("【我是前端要回调的地址:】{}", returnUrl + "&openid=" + openId);
|
|
||||||
// 顺便获取一下用户信息
|
|
||||||
WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, "zh_CN");
|
|
||||||
log.info("【用户信息:】{}", wxMpUser.toString());
|
|
||||||
|
|
||||||
//注意拼接参数,第一个参数需要加问号,之后参数使用&拼接的问题
|
|
||||||
//return "redirect:" + returnUrl + "/#/?openid=" + openId;
|
|
||||||
return "redirect:" + returnUrl + "&openid=" + openId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.yanzhu.jh.wxsetting.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Builder
|
||||||
|
public class WxMpTemplate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 337800069603349L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key
|
||||||
|
*/
|
||||||
|
private String keyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板id
|
||||||
|
*/
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转url
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公众号模板
|
||||||
|
*/
|
||||||
|
private String wxMpTemplateDataJson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.yanzhu.jh.wxsetting.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Builder
|
||||||
|
public class WxMpTemplateData implements Serializable {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
private String color;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.yanzhu.jh.wxsetting.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Builder
|
||||||
|
public class WxMpTemplateMsgConfig implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5063374783759519418L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收者openid.
|
||||||
|
*/
|
||||||
|
private String toUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板ID.
|
||||||
|
*/
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板跳转链接.
|
||||||
|
* <pre>
|
||||||
|
* url和miniprogram都是非必填字段,若都不传则模板无跳转;若都传,会优先跳转至小程序。
|
||||||
|
* 开发者可根据实际需要选择其中一种跳转方式即可。当用户的微信客户端版本不支持跳小程序时,将会跳转至url。
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳小程序所需数据,不需跳小程序可不用传该数据.
|
||||||
|
*
|
||||||
|
* @see #url
|
||||||
|
*/
|
||||||
|
private me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage.MiniProgram miniProgram;
|
||||||
|
}
|
|
@ -0,0 +1,653 @@
|
||||||
|
package com.yanzhu.jh.wxsetting.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.constant.CacheConstants;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
import com.ruoyi.common.enums.MessageTypeEnum;
|
||||||
|
import com.ruoyi.common.enums.PublicStateEnum;
|
||||||
|
import com.ruoyi.common.enums.TemplateMessageEnum;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.DictUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.domain.SysUserOpenid;
|
||||||
|
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||||
|
import com.ruoyi.system.mapper.SysUserMapper;
|
||||||
|
import com.ruoyi.system.mapper.SysUserOpenidMapper;
|
||||||
|
import com.yanzhu.jh.project.domain.*;
|
||||||
|
import com.yanzhu.jh.project.mapper.SurProjectMapper;
|
||||||
|
import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
|
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
|
||||||
|
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑处理完毕
|
||||||
|
* 这里使用Async修饰为异步方法
|
||||||
|
* JiangYuQi
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class WxMessageImpl{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WxMpService wxMpService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDeptMapper sysDeptMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SurProjectMapper surProjectMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserOpenidMapper sysUserOpenidMapper;
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void send(SmzSspProblemmodify smzSspProblemmodify){
|
||||||
|
List<WxMpTemplateMessage> list = new ArrayList<>();
|
||||||
|
WxMpTemplateMessage mpTemplateMessage;
|
||||||
|
Long state = smzSspProblemmodify.getCheckState();
|
||||||
|
/**
|
||||||
|
* 提交隐患通知整改人
|
||||||
|
*/
|
||||||
|
if(state==0){
|
||||||
|
//通知整改人
|
||||||
|
mpTemplateMessage = new WxMpTemplateMessage();
|
||||||
|
mpTemplateMessage.setToUser(this.getMsgId(smzSspProblemmodify.getLordSentUser()));
|
||||||
|
mpTemplateMessage.setTemplateId(TemplateMessageEnum.TROUBLE_DEFAULT.getId());
|
||||||
|
//模板数据
|
||||||
|
List<WxMpTemplateData> datas = new ArrayList<>();
|
||||||
|
WxMpTemplateData data = new WxMpTemplateData();
|
||||||
|
data.setValue(this.getMsgProName(smzSspProblemmodify.getProjectId()));
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(DateUtils.getTime());
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(this.getMsgName(smzSspProblemmodify.getCreateUser()));
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,smzSspProblemmodify.getNickedTime()));
|
||||||
|
datas.add(data);
|
||||||
|
String typeName = smzSspProblemmodify.getInfoType()==0?"安全隐患":"安全隐患";
|
||||||
|
data.setValue(typeName+"-"+ DictUtils.getDictLabel(smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx",smzSspProblemmodify.getDangerType()));
|
||||||
|
datas.add(data);
|
||||||
|
//TODO:这里缺少小程序跳转连接...
|
||||||
|
mpTemplateMessage.setData(datas);
|
||||||
|
list.add(mpTemplateMessage);
|
||||||
|
|
||||||
|
//通知抄送人
|
||||||
|
mpTemplateMessage = new WxMpTemplateMessage();
|
||||||
|
mpTemplateMessage.setToUser(this.getMsgId(smzSspProblemmodify.getCopySendUser()));
|
||||||
|
mpTemplateMessage.setTemplateId(TemplateMessageEnum.TROUBLE_DEFAULT.getId());
|
||||||
|
//模板数据
|
||||||
|
datas = new ArrayList<>();
|
||||||
|
data.setValue(this.getMsgProName(smzSspProblemmodify.getProjectId()));
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(DateUtils.getTime());
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(this.getMsgName(smzSspProblemmodify.getCreateUser()));
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,smzSspProblemmodify.getNickedTime()));
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(typeName+"-"+ DictUtils.getDictLabel(smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx",smzSspProblemmodify.getDangerType()));
|
||||||
|
datas.add(data);
|
||||||
|
mpTemplateMessage.setData(datas);
|
||||||
|
list.add(mpTemplateMessage);
|
||||||
|
} else if(state==1){
|
||||||
|
//通知复检人
|
||||||
|
mpTemplateMessage = new WxMpTemplateMessage();
|
||||||
|
mpTemplateMessage.setToUser(this.getMsgId(smzSspProblemmodify.getRecheckSendUser()));
|
||||||
|
mpTemplateMessage.setTemplateId(TemplateMessageEnum.TROUBLE_DEFAULT.getId());
|
||||||
|
//模板数据
|
||||||
|
List<WxMpTemplateData> datas = new ArrayList<>();
|
||||||
|
WxMpTemplateData data = new WxMpTemplateData();
|
||||||
|
data.setValue(this.getMsgProName(smzSspProblemmodify.getProjectId()));
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(DateUtils.getTime());
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(this.getMsgName(smzSspProblemmodify.getCreateUser()));
|
||||||
|
datas.add(data);
|
||||||
|
data.setValue(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,smzSspProblemmodify.getNickedTime()));
|
||||||
|
datas.add(data);
|
||||||
|
String typeName = smzSspProblemmodify.getInfoType()==0?"安全隐患":"安全隐患";
|
||||||
|
data.setValue(typeName+"-"+ DictUtils.getDictLabel(smzSspProblemmodify.getInfoType()==0?"ssp_aqyhlx":"ssp_zlyhlx",smzSspProblemmodify.getDangerType()));
|
||||||
|
datas.add(data);
|
||||||
|
//TODO:这里缺少小程序跳转连接...
|
||||||
|
mpTemplateMessage.setData(datas);
|
||||||
|
list.add(mpTemplateMessage);
|
||||||
|
|
||||||
|
} else if(state==3){
|
||||||
|
|
||||||
|
} else if(state==4){
|
||||||
|
//通知提交人
|
||||||
|
}
|
||||||
|
this.send(list, MessageTypeEnum.getYHPCLX(smzSspProblemmodify.getInfoType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 举牌验收操作时推送信息
|
||||||
|
* @param surProjectChecking
|
||||||
|
*/
|
||||||
|
@Async
|
||||||
|
public void send(SurProjectChecking surProjectChecking){
|
||||||
|
List<WxMpTemplateMessage> list = new ArrayList<>();
|
||||||
|
String stateStr = surProjectChecking.getApproveStatus();
|
||||||
|
if(Objects.equals(PublicStateEnum.AUDITINFO_DSH.getCode(),stateStr)){
|
||||||
|
/**
|
||||||
|
* 监理审批待审批
|
||||||
|
*/
|
||||||
|
String supMsgId = this.getMsgId(surProjectChecking.getSuperviseUser());
|
||||||
|
//模板数据
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(supMsgId)
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectChecking.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", "待"+surProjectChecking.getSuperviseUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectChecking.getCreateBy())+"["+this.getMsgDepName(surProjectChecking.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄送项目甲代
|
||||||
|
*/
|
||||||
|
templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgProMagUsers(surProjectChecking.getProjectId()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectChecking.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", "待"+surProjectChecking.getSuperviseUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectChecking.getCreateBy())+"["+this.getMsgDepName(surProjectChecking.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄送项目总监
|
||||||
|
* 非审批人时推送消息
|
||||||
|
*/
|
||||||
|
String _supMsgId = this.getMsgProSupUsers(surProjectChecking.getProjectId());
|
||||||
|
if(StringUtils.isEmpty(_supMsgId)){
|
||||||
|
_supMsgId = "";
|
||||||
|
}
|
||||||
|
if(!Objects.equals(supMsgId,_supMsgId)){
|
||||||
|
templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(_supMsgId)
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectChecking.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", "待"+surProjectChecking.getSuperviseUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectChecking.getCreateBy())+"["+this.getMsgDepName(surProjectChecking.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}
|
||||||
|
}else if(Objects.equals(PublicStateEnum.AUDITINFO_SHTG.getCode(),stateStr)){
|
||||||
|
/**
|
||||||
|
* 审批通过
|
||||||
|
* 通知提交人审核通过
|
||||||
|
*/
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgId(surProjectChecking.getCreateBy()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectChecking.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectChecking.getSuperviseUserName()+"审批通过"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectChecking.getCreateBy())+"["+this.getMsgDepName(surProjectChecking.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}else{
|
||||||
|
/**
|
||||||
|
* 审批驳回
|
||||||
|
* 通知提交人审核驳回
|
||||||
|
*/
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgId(surProjectChecking.getCreateBy()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectChecking.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectChecking.getSuperviseUserName()+"审批驳回"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectChecking.getCreateBy())+"["+this.getMsgDepName(surProjectChecking.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}
|
||||||
|
this.send(list,MessageTypeEnum.JPYSSP.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实测实量操作时推送信息
|
||||||
|
* @param surProjectMeasure
|
||||||
|
*/
|
||||||
|
@Async
|
||||||
|
public void send(SurProjectMeasure surProjectMeasure){
|
||||||
|
List<WxMpTemplateMessage> list = new ArrayList<>();
|
||||||
|
String stateStr = surProjectMeasure.getApproveStatus();
|
||||||
|
if(Objects.equals(PublicStateEnum.AUDITINFO_DSH.getCode(),stateStr)){
|
||||||
|
/**
|
||||||
|
* 监理审批待审批
|
||||||
|
*/
|
||||||
|
String supMsgId = this.getMsgId(surProjectMeasure.getSuperviseUser());
|
||||||
|
//模板数据
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(supMsgId)
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMeasure.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", "待"+surProjectMeasure.getSuperviseUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMeasure.getCreateBy())+"["+this.getMsgDepName(surProjectMeasure.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄送项目甲代
|
||||||
|
*/
|
||||||
|
templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgProMagUsers(surProjectMeasure.getProjectId()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMeasure.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", "待"+surProjectMeasure.getSuperviseUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMeasure.getCreateBy())+"["+this.getMsgDepName(surProjectMeasure.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄送项目总监
|
||||||
|
* 非审批人时推送消息
|
||||||
|
*/
|
||||||
|
String _supMsgId = this.getMsgProSupUsers(surProjectMeasure.getProjectId());
|
||||||
|
if(StringUtils.isEmpty(_supMsgId)){
|
||||||
|
_supMsgId = "";
|
||||||
|
}
|
||||||
|
if(!Objects.equals(supMsgId,_supMsgId)){
|
||||||
|
templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(_supMsgId)
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMeasure.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", "待"+surProjectMeasure.getSuperviseUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMeasure.getCreateBy())+"["+this.getMsgDepName(surProjectMeasure.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}
|
||||||
|
}else if(Objects.equals(PublicStateEnum.AUDITINFO_SHTG.getCode(),stateStr)){
|
||||||
|
/**
|
||||||
|
* 审批通过
|
||||||
|
* 通知提交人审核通过
|
||||||
|
*/
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgId(surProjectMeasure.getCreateBy()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMeasure.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectMeasure.getSuperviseUserName()+"审批通过"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMeasure.getCreateBy())+"["+this.getMsgDepName(surProjectMeasure.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}else{
|
||||||
|
/**
|
||||||
|
* 审批驳回
|
||||||
|
* 通知提交人审核驳回
|
||||||
|
*/
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgId(surProjectMeasure.getCreateBy()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMeasure.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectMeasure.getSuperviseUserName()+"审批驳回"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMeasure.getCreateBy())+"["+this.getMsgDepName(surProjectMeasure.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}
|
||||||
|
this.send(list,MessageTypeEnum.JPYSSP.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料封样操作时推送信息
|
||||||
|
* @param surProjectMaterialSeal
|
||||||
|
*/
|
||||||
|
@Async
|
||||||
|
public void send(SurProjectMaterialSeal surProjectMaterialSeal){
|
||||||
|
List<WxMpTemplateMessage> list = new ArrayList<>();
|
||||||
|
String stateStr = surProjectMaterialSeal.getApproveStatus();
|
||||||
|
if(Objects.equals(PublicStateEnum.AUDITINFO_DSH.getCode(),stateStr)){
|
||||||
|
/**
|
||||||
|
* 监理审批待审批
|
||||||
|
*/
|
||||||
|
String supMsgId = this.getMsgId(surProjectMaterialSeal.getWitnessUser());
|
||||||
|
//模板数据
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(supMsgId)
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMaterialSeal.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectMaterialSeal.getWitnessUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMaterialSeal.getCreateBy())+"["+this.getMsgDepName(surProjectMaterialSeal.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄送项目甲代
|
||||||
|
*/
|
||||||
|
templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgProMagUsers(surProjectMaterialSeal.getProjectId()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMaterialSeal.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectMaterialSeal.getWitnessUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMaterialSeal.getCreateBy())+"["+this.getMsgDepName(surProjectMaterialSeal.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄送项目总监
|
||||||
|
* 非审批人时推送消息
|
||||||
|
*/
|
||||||
|
String _supMsgId = this.getMsgProSupUsers(surProjectMaterialSeal.getProjectId());
|
||||||
|
if(StringUtils.isEmpty(_supMsgId)){
|
||||||
|
_supMsgId = "";
|
||||||
|
}
|
||||||
|
if(!Objects.equals(supMsgId,_supMsgId)){
|
||||||
|
templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(_supMsgId)
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMaterialSeal.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectMaterialSeal.getWitnessUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMaterialSeal.getCreateBy())+"["+this.getMsgDepName(surProjectMaterialSeal.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}
|
||||||
|
}else if(Objects.equals(PublicStateEnum.AUDITINFO_SHTG.getCode(),stateStr)){
|
||||||
|
/**
|
||||||
|
* 审批通过
|
||||||
|
* 通知提交人审核通过
|
||||||
|
*/
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgId(surProjectMaterialSeal.getCreateBy()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMaterialSeal.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectMaterialSeal.getWitnessUserName()+"审批通过"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMaterialSeal.getCreateBy())+"["+this.getMsgDepName(surProjectMaterialSeal.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}else{
|
||||||
|
/**
|
||||||
|
* 审批驳回
|
||||||
|
* 通知提交人审核驳回
|
||||||
|
*/
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgId(surProjectMaterialSeal.getCreateBy()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectMaterialSeal.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectMaterialSeal.getWitnessUserName()+"审批驳回"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectMaterialSeal.getCreateBy())+"["+this.getMsgDepName(surProjectMaterialSeal.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}
|
||||||
|
this.send(list,MessageTypeEnum.JPYSSP.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取样复试操作时推送信息
|
||||||
|
* @param surProjectCheckDetection
|
||||||
|
*/
|
||||||
|
@Async
|
||||||
|
public void send(SurProjectCheckDetection surProjectCheckDetection){
|
||||||
|
List<WxMpTemplateMessage> list = new ArrayList<>();
|
||||||
|
String stateStr = surProjectCheckDetection.getApproveStatus();
|
||||||
|
if(Objects.equals(PublicStateEnum.AUDITINFO_DSH.getCode(),stateStr)){
|
||||||
|
/**
|
||||||
|
* 监理审批待审批
|
||||||
|
*/
|
||||||
|
String supMsgId = this.getMsgId(surProjectCheckDetection.getWitnessUser());
|
||||||
|
//模板数据
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(supMsgId)
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectCheckDetection.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectCheckDetection.getWitnessUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectCheckDetection.getCreateBy())+"["+this.getMsgDepName(surProjectCheckDetection.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄送项目甲代
|
||||||
|
*/
|
||||||
|
templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgProMagUsers(surProjectCheckDetection.getProjectId()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectCheckDetection.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectCheckDetection.getWitnessUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectCheckDetection.getCreateBy())+"["+this.getMsgDepName(surProjectCheckDetection.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄送项目总监
|
||||||
|
* 非审批人时推送消息
|
||||||
|
*/
|
||||||
|
String _supMsgId = this.getMsgProSupUsers(surProjectCheckDetection.getProjectId());
|
||||||
|
if(StringUtils.isEmpty(_supMsgId)){
|
||||||
|
_supMsgId = "";
|
||||||
|
}
|
||||||
|
if(!Objects.equals(supMsgId,_supMsgId)){
|
||||||
|
templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(_supMsgId)
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectCheckDetection.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectCheckDetection.getWitnessUserName()+"审批"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectCheckDetection.getCreateBy())+"["+this.getMsgDepName(surProjectCheckDetection.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}
|
||||||
|
}else if(Objects.equals(PublicStateEnum.AUDITINFO_SHTG.getCode(),stateStr)){
|
||||||
|
/**
|
||||||
|
* 审批通过
|
||||||
|
* 通知提交人审核通过
|
||||||
|
*/
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgId(surProjectCheckDetection.getCreateBy()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectCheckDetection.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectCheckDetection.getWitnessUserName()+"审批通过"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectCheckDetection.getCreateBy())+"["+this.getMsgDepName(surProjectCheckDetection.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}else{
|
||||||
|
/**
|
||||||
|
* 审批驳回
|
||||||
|
* 通知提交人审核驳回
|
||||||
|
*/
|
||||||
|
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
|
||||||
|
.toUser(this.getMsgId(surProjectCheckDetection.getCreateBy()))
|
||||||
|
.templateId(TemplateMessageEnum.APPLY_DEFAULT.getId()).build();
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing14", this.getMsgProName(surProjectCheckDetection.getProjectId())));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing1", MessageTypeEnum.JPYSSP.getName()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing2", surProjectCheckDetection.getWitnessUserName()+"审批驳回"));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("time4", DateUtils.getTime()));
|
||||||
|
templateMessage.addWxMpTemplateData(new WxMpTemplateData("thing10", this.getMsgName(surProjectCheckDetection.getCreateBy())+"["+this.getMsgDepName(surProjectCheckDetection.getDeptId())+"]"));
|
||||||
|
list.add(templateMessage);
|
||||||
|
}
|
||||||
|
this.send(list,MessageTypeEnum.JPYSSP.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目监理
|
||||||
|
* @param proId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getMsgProSupUsers(Long proId){
|
||||||
|
List<SysUserOpenid> list = redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_P_SUP +proId);
|
||||||
|
if(list!=null){
|
||||||
|
List<String> strs = list.stream().map(SysUserOpenid :: getMsgOpenId).collect(Collectors.toList());
|
||||||
|
return String.join(",",strs);
|
||||||
|
}else{
|
||||||
|
list = sysUserOpenidMapper.findMsgProSupUsers(proId);
|
||||||
|
if(StringUtils.isNotEmpty(list)){
|
||||||
|
//设置30分钟有效期
|
||||||
|
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_P_SUP +proId,list,1, TimeUnit.MINUTES);
|
||||||
|
List<String> strs = list.stream().map(SysUserOpenid :: getMsgOpenId).collect(Collectors.toList());
|
||||||
|
return String.join(",",strs);
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目甲代
|
||||||
|
* @param proId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getMsgProMagUsers(Long proId){
|
||||||
|
List<SysUserOpenid> list = redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_P_MAG +proId);
|
||||||
|
if(list!=null){
|
||||||
|
List<String> strs = list.stream().map(SysUserOpenid :: getMsgOpenId).collect(Collectors.toList());
|
||||||
|
return String.join(",",strs);
|
||||||
|
}else{
|
||||||
|
list = sysUserOpenidMapper.findMsgProMagUsers(proId);
|
||||||
|
if(StringUtils.isNotEmpty(list)){
|
||||||
|
//设置30分钟有效期
|
||||||
|
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_P_MAG +proId,list,1, TimeUnit.MINUTES);
|
||||||
|
List<String> strs = list.stream().map(SysUserOpenid :: getMsgOpenId).collect(Collectors.toList());
|
||||||
|
return String.join(",",strs);
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询单位名称
|
||||||
|
* @param depId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getMsgDepName(Long depId){
|
||||||
|
String name = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_DNAME +depId));
|
||||||
|
if(StringUtils.isNotEmpty(name)){
|
||||||
|
return name;
|
||||||
|
}else{
|
||||||
|
SysDept sysDept = sysDeptMapper.selectDeptById(depId);
|
||||||
|
//项目名称截取&&超过20字符微信限制并抛出异常
|
||||||
|
String depName = sysDept.getDeptName();
|
||||||
|
if(depName.length()>13){
|
||||||
|
depName = sysDept.getDeptName().substring(0,13);
|
||||||
|
}
|
||||||
|
//设置30分钟有效期
|
||||||
|
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_DNAME +depId,depName,1, TimeUnit.MINUTES);
|
||||||
|
return depName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目名称
|
||||||
|
* @param proId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getMsgProName(Long proId){
|
||||||
|
String name = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_PNAME +proId));
|
||||||
|
if(StringUtils.isNotEmpty(name)){
|
||||||
|
return name;
|
||||||
|
}else{
|
||||||
|
SurProject surProject = surProjectMapper.selectSurProjectById(proId);
|
||||||
|
//项目名称截取&&超过20字符微信限制并抛出异常
|
||||||
|
String proName = surProject.getProjectName();
|
||||||
|
if(proName.length()>20){
|
||||||
|
proName = surProject.getProjectName().substring(0,20);
|
||||||
|
}
|
||||||
|
//设置30分钟有效期
|
||||||
|
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_PNAME +proId,proName,1, TimeUnit.MINUTES);
|
||||||
|
return proName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信用户名称
|
||||||
|
* @param userName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getMsgName(String userName){
|
||||||
|
String name = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_UNAME +userName));
|
||||||
|
if(StringUtils.isNotEmpty(name)){
|
||||||
|
return name;
|
||||||
|
}else{
|
||||||
|
SysUser sysUser = sysUserMapper.selectUserByUserName(userName);
|
||||||
|
name = sysUser!=null?sysUser.getNickName():"";
|
||||||
|
//设置30分钟有效期
|
||||||
|
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_UNAME +userName,name,1, TimeUnit.MINUTES);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信用户列表
|
||||||
|
* @param userName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getMsgId(String userName){
|
||||||
|
String openIds = Convert.toStr(redisCache.getCacheObject(CacheConstants.WX_MPMESSAGE_OPENID +userName));
|
||||||
|
if(StringUtils.isNotEmpty(openIds)){
|
||||||
|
return openIds;
|
||||||
|
}else{
|
||||||
|
List<SysUserOpenid> list = sysUserOpenidMapper.findSysUserOpenidsByUser(userName);
|
||||||
|
List<String> strs = list.stream().map(SysUserOpenid :: getMsgOpenId).collect(Collectors.toList());
|
||||||
|
openIds = String.join(",",strs);
|
||||||
|
//设置30分钟有效期
|
||||||
|
redisCache.setCacheObject(CacheConstants.WX_MPMESSAGE_OPENID +userName,openIds,1, TimeUnit.MINUTES);
|
||||||
|
return openIds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板消息开关
|
||||||
|
*/
|
||||||
|
private boolean wxSwitch=false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送模板消息
|
||||||
|
* @param lsit
|
||||||
|
*/
|
||||||
|
private void send(List<WxMpTemplateMessage> lsit,String messageType){
|
||||||
|
try {
|
||||||
|
if(wxSwitch && StringUtils.isNotEmpty(lsit)){
|
||||||
|
for(WxMpTemplateMessage message:lsit){
|
||||||
|
if(StringUtils.isNotEmpty(message.getToUser())){
|
||||||
|
String[] toUsers = message.getToUser().split(",");
|
||||||
|
for(String toUser:toUsers){
|
||||||
|
//判断短时间内是否已发送相同类型的消息
|
||||||
|
String key = CacheConstants.WX_MPMESSAGE_KEY +toUser+"-"+messageType;
|
||||||
|
if(Convert.toBool(redisCache.getCacheObject(key),true)){
|
||||||
|
//多个登录账号时批量发送
|
||||||
|
message.setToUser(toUser);
|
||||||
|
wxMpService.getTemplateMsgService().sendTemplateMsg(message);
|
||||||
|
//5分钟内不推送相同类型的消息
|
||||||
|
redisCache.setCacheObject(key,false,30, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.info("出错了...{}",e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
package com.yanzhu.jh.wxsetting.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信消息推送
|
|
||||||
*
|
|
||||||
* @author JiangYuQi
|
|
||||||
* @date 2023-08-24
|
|
||||||
*/
|
|
||||||
public interface wxMessageService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -67,6 +67,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>
|
<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>
|
<where>
|
||||||
|
sp.isDel = 0
|
||||||
<if test="deptId != null "> and sp.deptId like concat('%', #{deptId}, '%')</if>
|
<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="projectName != null and projectName != ''"> and sp.projectName like concat('%', #{projectName}, '%')</if>
|
||||||
<if test="projectCode != null and projectCode != ''"> and sp.projectCode = #{projectCode}</if>
|
<if test="projectCode != null and projectCode != ''"> and sp.projectCode = #{projectCode}</if>
|
||||||
|
@ -97,7 +98,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="onAccountAmount != null and onAccountAmount != ''"> and sp.onAccountAmount = #{onAccountAmount}</if>
|
<if test="onAccountAmount != null and onAccountAmount != ''"> and sp.onAccountAmount = #{onAccountAmount}</if>
|
||||||
<if test="projectSchedule != null and projectSchedule != ''"> and sp.projectSchedule = #{projectSchedule}</if>
|
<if test="projectSchedule != null and projectSchedule != ''"> and sp.projectSchedule = #{projectSchedule}</if>
|
||||||
<if test="projectSummarize != null and projectSummarize != ''"> and sp.projectSummarize = #{projectSummarize}</if>
|
<if test="projectSummarize != null and projectSummarize != ''"> and sp.projectSummarize = #{projectSummarize}</if>
|
||||||
<if test="isDel != null "> and sp.isDel = #{isDel}</if>
|
|
||||||
<if test="projectStatus != null and projectStatus != ''"> and sp.projectStatus = #{projectStatus}</if>
|
<if test="projectStatus != null and projectStatus != ''"> and sp.projectStatus = #{projectStatus}</if>
|
||||||
<if test="createBy != null and createBy != ''"> and sp.create_by = #{createBy}</if>
|
<if test="createBy != null and createBy != ''"> and sp.create_by = #{createBy}</if>
|
||||||
<if test="servicePersonnel != null "> and sp.servicePersonnel = #{servicePersonnel}</if>
|
<if test="servicePersonnel != null "> and sp.servicePersonnel = #{servicePersonnel}</if>
|
||||||
|
|
Loading…
Reference in New Issue