Commit d9e6f880 by 龙于生

新增h5颜色测评接口 模板消息 公众号绑定

parent 8e1c60c3
...@@ -436,6 +436,12 @@ ...@@ -436,6 +436,12 @@
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId> <artifactId>spring-test</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.9</version>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
......
...@@ -212,6 +212,13 @@ public class ZpglRcxx extends Model<ZpglRcxx> { ...@@ -212,6 +212,13 @@ public class ZpglRcxx extends Model<ZpglRcxx> {
*/ */
@ApiModelProperty(value = "招聘渠道ID") @ApiModelProperty(value = "招聘渠道ID")
private Integer zpglZpqdId; private Integer zpglZpqdId;
/**
* 签名图片
*/
@ApiModelProperty(value = "签名图片")
private String signatureImg;
/** /**
* 文件名 * 文件名
*/ */
......
...@@ -67,7 +67,7 @@ public class ZpglWxgzptEmpRcxx extends Model<ZpglWxgzptEmpRcxx> { ...@@ -67,7 +67,7 @@ public class ZpglWxgzptEmpRcxx extends Model<ZpglWxgzptEmpRcxx> {
* 组织机构代码 * 组织机构代码
*/ */
@ApiModelProperty(value = "组织机构代码") @ApiModelProperty(value = "组织机构代码")
private String orgCode; private Integer orgCode;
/** /**
* 逻辑删除标记0.未删除 1.删除 * 逻辑删除标记0.未删除 1.删除
*/ */
......
...@@ -52,7 +52,12 @@ public class WebSecurityConfig implements WebMvcConfigurer { ...@@ -52,7 +52,12 @@ public class WebSecurityConfig implements WebMvcConfigurer {
.excludePathPatterns("/webjars/**") .excludePathPatterns("/webjars/**")
.excludePathPatterns("/zpgl/h5/**") .excludePathPatterns("/zpgl/h5/**")
.excludePathPatterns("/yggl/mz/*") .excludePathPatterns("/yggl/mz/*")
.excludePathPatterns("/yggl/sysRegion"); .excludePathPatterns("/yggl/sysRegion")
.excludePathPatterns("/wxgzh/**")
.excludePathPatterns("/wxgzpt/**")
.excludePathPatterns("/MP_verify_VohzppEKB3VfeKxw.txt")
.excludePathPatterns("/evaluation/**")
.excludePathPatterns("/oss/uploadImg");
// registry.addInterceptor(getSessionInterceptor()).addPathPatterns("/**").excludePathPatterns("/swagger-ui*"); // registry.addInterceptor(getSessionInterceptor()).addPathPatterns("/**").excludePathPatterns("/swagger-ui*");
} }
......
...@@ -7,11 +7,13 @@ import java.util.Date; ...@@ -7,11 +7,13 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import cn.timer.api.utils.redis.RedisUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -169,6 +171,9 @@ public class LoginController { ...@@ -169,6 +171,9 @@ public class LoginController {
@Autowired @Autowired
private AliyunSMS aliyunSMS; private AliyunSMS aliyunSMS;
@Resource
private RedisUtil redisUtil;
// @Autowired // @Autowired
// private DataSourceTransactionManager transactionManager; // private DataSourceTransactionManager transactionManager;
...@@ -253,9 +258,52 @@ public class LoginController { ...@@ -253,9 +258,52 @@ public class LoginController {
String message = j.getString("Message"); String message = j.getString("Message");
if ("OK".equals(message)) { if ("OK".equals(message)) {
session.setAttribute(phone, code); session.setAttribute(phone, code);
// redisTemplate.set(phone, code); // redisTemplate.set(phone, code);
// redisTemplate.expire(phone, 60); // redisTemplate.expire(phone, 60);
return ResultUtil.data("发送验证码成功");
} else {
return ResultUtil.error("发送验证码失败");
}
} catch (Exception e) {
e.printStackTrace();
return ResultUtil.error("发送验证码失败");
}
}
/**
* 发送验证码
*
* @param entRegisterDto
* @return
*/
@PostMapping(value = "/sendcode1")
@ApiOperation(value = "1.发送验证码", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
@Log(title = "发送验证码", businessType = BusinessType.SEND_CODE)
public Result<String> sendCode1(@RequestBody EntRegisterDto entRegisterDto) {
String phone = entRegisterDto.getPhone();
if (phone == null || StrUtil.hasBlank(phone)) {
return ResultUtil.error("请输入手机号");
}
// 6位随机数验证码
try {
Integer code = (int) ((Math.random() * 9 + 1) * 100000);
if (phone == null || "".equals(phone)) {
phone = entRegisterDto.getUsername();
entRegisterDto.setPhone(phone);
}
List<Object> list = aliyunSMS.authCode(entRegisterDto, entRegisterDto.getTc(), code);
Integer useId = (Integer) list.get(0);
JSONObject j = (JSONObject) list.get(1);
// 获取当前日期的字符串格式
String message = j.getString("Message");
if ("OK".equals(message)) {
session.setAttribute(phone, code);
redisUtil.set(phone, code,60*5);
return ResultUtil.data("发送验证码成功"); return ResultUtil.data("发送验证码成功");
} else { } else {
return ResultUtil.error("发送验证码失败"); return ResultUtil.error("发送验证码失败");
......
package cn.timer.api.controller.oss; package cn.timer.api.controller.oss;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import cn.timer.api.service.OSSService; import cn.timer.api.service.OSSService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -20,6 +21,8 @@ import cn.timer.api.utils.aliyun.OSSUtil; ...@@ -20,6 +21,8 @@ import cn.timer.api.utils.aliyun.OSSUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
@Api(tags = "9.0阿里云OSS操作") @Api(tags = "9.0阿里云OSS操作")
@Transactional @Transactional
@RequestMapping(value = "/oss", produces = { "application/json" }) @RequestMapping(value = "/oss", produces = { "application/json" })
...@@ -176,4 +179,33 @@ public class OSSController { ...@@ -176,4 +179,33 @@ public class OSSController {
return data; return data;
} }
@PostMapping(value = "/uploadImg")
@ApiOperation(value = "上传图片", httpMethod = "POST", notes = "接口发布说明")
@ResponseBody
public Result<String> uploadImg(@RequestParam(required = true) String param,@RequestParam(required = false) String moudle, @Param("file") MultipartFile file) throws Exception {
if (file == null || file.getSize() <= 0) {
return ResultUtil.error("上传的文件为空,请重新选择!");
}
Set<String> typeSet = new HashSet<>();
typeSet.add(".jpg");
typeSet.add(".png");
typeSet.add(".gif");
String fileName = file.getOriginalFilename();
int index = fileName.lastIndexOf(".");
String fileType = fileName.substring(index);
//校验图片类型是否有效
if (!typeSet.contains(fileType)) {
return ResultUtil.error("只能上传图片文件!");
}
JSONObject jsonObject = JSON.parseObject(param);
Integer id = jsonObject.getInteger("id");
String orgid = jsonObject.getString("orgid");
moudle=id+"";
Result<String> data = ossService.upload(1, moudle, file);
return data;
}
} }
package cn.timer.api.controller.verify;
import cn.timer.api.utils.wxgzh.SignUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
/**
*
* @author longys
* @date 2022/3/30 15:35
*/
@RestController
@RequestMapping("/")
public class VerifyController {
/**
* 网页授权域名
* 验证文件
* @param response
*/
@GetMapping("/MP_verify_VohzppEKB3VfeKxw.txt")
public void verify(HttpServletResponse response){
PrintWriter out = null;
try {
out = response.getWriter();
out.write("VohzppEKB3VfeKxw");
} catch (IOException e) {
e.printStackTrace();
} finally {
out.close();
}
}
}
package cn.timer.api.controller.zpgl;
import cn.timer.api.bean.zpgl.ZpglCptk;
import cn.timer.api.bean.zpgl.ZpglDtk;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author longys
* @date 2022/4/14 15:48
*/
@Api(tags = "性格颜色测评")
@RestController
@RequestMapping(value = "/evaluation")
public class ZpglEvaluationController {
@ApiOperation(value = "获取测评题库", httpMethod = "GET", notes = "获取测评题库")
@RequestMapping("/get_cptk_list")
public Result<List<ZpglCptk>> getCptkList(){
List<ZpglCptk> zpglCptks = ZpglCptk.builder().build()
.selectList(new QueryWrapper<ZpglCptk>().lambda().orderByAsc(ZpglCptk::getSort));
return ResultUtil.data(zpglCptks);
}
@ApiOperation(value = "提交测评", httpMethod = "POST", notes = "提交测评")
@RequestMapping("/add_evaluation")
public Result<Object> addEvaluation(@RequestBody ZpglDtk zpglDtk){
ZpglDtk dtk = zpglDtk.selectOne(new QueryWrapper<ZpglDtk>()
.lambda().eq(ZpglDtk::getZpglRcxxId, zpglDtk.getZpglRcxxId()));
if (dtk!=null){
return ResultUtil.error("你已提交测评!");
}
try {
zpglDtk.insert();
} catch (Exception e) {
e.printStackTrace();
return ResultUtil.error();
}
return ResultUtil.success();
}
}
package cn.timer.api.controller.zpgl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zpgl.ZpglRcxx;
import cn.timer.api.bean.zpgl.ZpglWxgzptEmpRcxx;
import cn.timer.api.controller.zpgl.sevice.ZpglWxgzptService;
import cn.timer.api.dto.template.TemplateData;
import cn.timer.api.dto.template.TemplateMessage;
import cn.timer.api.dto.wxgzh.LoginDto;
import cn.timer.api.dto.wxgzh.MessageQueueDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.redis.RedisUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author longys
* @date 2022/3/25 17:18
*/
@Api(tags = "微信公众平台")
@RestController
@RequestMapping(value = "/wxgzpt")
public class ZpglWxgzptController {
@Value("${wxgzh.appid}")
private String appid;
@Value("${wxgzh.appSecret}")
private String appSecret;
@Value("${config-8timer.authentication-code}")
public String authentication_code;
@Value("${h5.url}")
public String h5Url;
public static final String OAUTH_GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
@Resource
private ZpglWxgzptService zpglWxgzptService;
@Resource
private RedisUtil redisUtil;
/**
* 重定向到绑定登录页面
* @param request
* @return
*/
@RequestMapping("/toLoginPage")
@ApiOperation(value = "重定向到绑定登录页面", httpMethod = "GET", notes = "重定向到绑定登录页面")
public ModelAndView toLoginPage(HttpServletRequest request){
String state = request.getParameter("state");
String code = request.getParameter("code");
//用code获取openid
String url = OAUTH_GET_ACCESS_TOKEN_URL.replace("APPID",appid).replace("SECRET",appSecret).replace("CODE",code);
String s = HttpUtil.get(url);
JSONObject jsonObject = JSON.parseObject(s);
String openid = jsonObject.getString("openid");
//查询是否已绑定人才信息
ZpglWxgzptEmpRcxx wxgzptEmpRcxx = ZpglWxgzptEmpRcxx.builder().build()
.selectOne(new QueryWrapper<ZpglWxgzptEmpRcxx>().lambda()
.eq(ZpglWxgzptEmpRcxx::getOpenid, openid));
ModelAndView mav = new ModelAndView();
mav.addObject("openid",openid);
if (wxgzptEmpRcxx != null){
mav.setViewName("redirect:"+h5Url+"/#/wxgzhIndex");
}else {
mav.setViewName("redirect:"+h5Url+"/#/wxgzhLogin");
}
return mav;
}
/**
* 重定向到绑定登录页面
* @param request
* @return
*/
@RequestMapping("/basic_info")
@ApiOperation(value = "重定向到面试申请页面", httpMethod = "GET", notes = "重定向到面试申请页面")
public ModelAndView basicInfo(HttpServletRequest request){
String mobile = request.getParameter("mobile");
String orgId = request.getParameter("orgId");
ModelAndView mav = new ModelAndView();
mav.addObject("mobile",mobile);
mav.addObject("orgId",Integer.valueOf(orgId));
mav.setViewName("redirect:"+h5Url+"/#/basicInfo");
return mav;
}
/**
* 查询是否已绑定人才信息
* @param openid
* @return
*/
@RequestMapping("/checkBind")
@ApiOperation(value = "查询是否已绑定人才信息", httpMethod = "GET", notes = "查询是否已绑定人才信息")
public Result<Object> checkBind(String openid){
ZpglWxgzptEmpRcxx wxgzptEmpRcxx = ZpglWxgzptEmpRcxx.builder().build()
.selectOne(new QueryWrapper<ZpglWxgzptEmpRcxx>().lambda()
.eq(ZpglWxgzptEmpRcxx::getOpenid, openid)
.eq(ZpglWxgzptEmpRcxx::getDeleteFlag, 0));
if (wxgzptEmpRcxx == null)
return ResultUtil.error("25001","未绑定");
return ResultUtil.success("已绑定.");
}
/**
* 查询已绑定信息
* @param openid
* @return
*/
@RequestMapping("/getBindInfo")
@ApiOperation(value = "查询已绑定信息", httpMethod = "GET", notes = "查询已绑定信息")
public Result<LoginDto> getBindInfo(String openid){
//查询是否已绑定人才信息
ZpglWxgzptEmpRcxx wxgzptEmpRcxx = ZpglWxgzptEmpRcxx.builder().build()
.selectOne(new QueryWrapper<ZpglWxgzptEmpRcxx>().lambda()
.eq(ZpglWxgzptEmpRcxx::getOpenid, openid)
.eq(ZpglWxgzptEmpRcxx::getDeleteFlag, 0));
if (wxgzptEmpRcxx != null){
LoginDto loginDao = new LoginDto();
YgglMainEmp userInfo = new YgglMainEmp();
//判断是否有人才信息表id
if(wxgzptEmpRcxx.getZpglRcxxId() != null && wxgzptEmpRcxx.getZpglRcxxId() != 0){
//查询人才信息表
ZpglRcxx zpglRcxx = ZpglRcxx.builder().build().selectOne(new QueryWrapper<ZpglRcxx>()
.lambda().eq(ZpglRcxx::getId, wxgzptEmpRcxx.getZpglRcxxId()));
userInfo.setPhone(zpglRcxx.getMobile());
userInfo.setName(zpglRcxx.getName());
}
//判断员工档案ID不等于空
if(wxgzptEmpRcxx.getYgglMainEmpId() != null){
userInfo = userInfo.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.select(YgglMainEmp::getId,YgglMainEmp::getEmpNum, YgglMainEmp::getName, YgglMainEmp::getPhone, YgglMainEmp::getBmgwId, YgglMainEmp::getOrgCode)
.eq(YgglMainEmp::getId, wxgzptEmpRcxx.getYgglMainEmpId())
.eq(YgglMainEmp::getOrgCode, wxgzptEmpRcxx.getOrgCode()));
loginDao.setUserName(userInfo.getName());
loginDao.setPhone(userInfo.getPhone());
loginDao.setAvatar(userInfo.getHeadUrl());
}else {
loginDao.setPhone(wxgzptEmpRcxx.getMobile());
}
return ResultUtil.data(loginDao);
}
return null;
}
/**
* 公众号登录绑定
*/
@RequestMapping("/login")
@ApiOperation(value = "公众号登录绑定", httpMethod = "POST", notes = "公众号登录绑定")
public Result<Object> login(@RequestBody LoginDto loginDao, HttpServletRequest request){
System.out.println(loginDao);
HttpSession session = request.getSession();
String code = loginDao.getCode();
String phone = loginDao.getPhone();
String openid = loginDao.getOpenid();
if (StringUtils.isEmpty(code)) {
return ResultUtil.error("请输入验证码");
}
//String codeRedis = session.getAttribute(phone) != null ? session.getAttribute(phone).toString() : "";
String codeRedis = redisUtil.get(phone) != null ? redisUtil.get(phone).toString() : null;
if(authentication_code !=null && !("").equals(authentication_code)) {
if (authentication_code.equals(code)) {
return loginhan(phone,openid);
}
}
if (codeRedis == null || !code.equals(codeRedis)){
return ResultUtil.error("验证码不符");
}
return loginhan(phone,openid);
}
public Result<Object> loginhan(String phone, String openid) {
//查询该手机号是否绑定了公众号
ZpglWxgzptEmpRcxx wxgzptEmpRcxx = ZpglWxgzptEmpRcxx.builder().build()
.selectOne(new QueryWrapper<ZpglWxgzptEmpRcxx>().lambda()
.eq(ZpglWxgzptEmpRcxx::getMobile, phone)
.eq(ZpglWxgzptEmpRcxx::getDeleteFlag,0));
//如果绑定过其他微信openid 替换成当前的openid
if (wxgzptEmpRcxx != null){
wxgzptEmpRcxx.setOpenid(openid);
wxgzptEmpRcxx.updateById();
}else {
//查询员工登录表
QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().build()
.selectOne(new QueryWrapper<QyzxEmpLogin>().lambda()
.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone));
YgglMainEmp userInfo = null;
if (qyzxEmpLogin != null){
//查询员工档案表
userInfo = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.select(YgglMainEmp::getId,YgglMainEmp::getEmpNum, YgglMainEmp::getName, YgglMainEmp::getPhone, YgglMainEmp::getBmgwId, YgglMainEmp::getOrgCode)
.eq(YgglMainEmp::getEmpNum, qyzxEmpLogin.getId())
.eq(YgglMainEmp::getOrgCode, qyzxEmpLogin.getOrgId()));
}
//查询人才信息表
ZpglRcxx zpglRcxx = ZpglRcxx.builder().build().selectOne(new QueryWrapper<ZpglRcxx>()
.lambda().eq(!StrUtil.hasBlank(phone), ZpglRcxx::getMobile, phone));
//没有加入企业
/*if (userInfo == null && zpglRcxx == null){
return ResultUtil.error("25002","没有找到匹配的企业");
}*/
ZpglWxgzptEmpRcxx empRcxx = new ZpglWxgzptEmpRcxx();
empRcxx.setZpglRcxxId(zpglRcxx!=null?zpglRcxx.getId():null);
empRcxx.setYgglMainEmpId(userInfo!=null?userInfo.getId():null);
empRcxx.setOrgCode(userInfo!=null?userInfo.getOrgCode():null);
empRcxx.setOpenid(openid);
empRcxx.setMobile(phone);
empRcxx.insert();
}
return ResultUtil.success();
}
/**
*根据手机号查询绑定的openid
* @return
*/
@GetMapping(value = "/getOpenid")
@ApiOperation(value = "获取openid", httpMethod = "POST", notes = "根据手机号查询绑定的openid")
public Result<ZpglWxgzptEmpRcxx> getOpenid(String phone){
//查询该手机号是否绑定了公众号
ZpglWxgzptEmpRcxx wxgzptEmpRcxx = ZpglWxgzptEmpRcxx.builder().build()
.selectOne(new QueryWrapper<ZpglWxgzptEmpRcxx>().lambda()
.eq(ZpglWxgzptEmpRcxx::getMobile, phone)
.eq(ZpglWxgzptEmpRcxx::getDeleteFlag,0));
return ResultUtil.data(wxgzptEmpRcxx);
}
@RequestMapping("/addMessageQueue")
public Result<Object> addMessageQueue(){
//消息队列对象
MessageQueueDto mqd = new MessageQueueDto();
/**
* 模板消息内容 start
*/
List<TemplateData> templateData = new ArrayList<>();
TemplateData key1 = new TemplateData("first", "您好,JAVA工程师张三已安排由您面试", "#000000");
TemplateData key2 = new TemplateData("keyword1", "JAVA工程师", "#000000");
TemplateData key3 = new TemplateData("keyword2", "2021-03-23 10:00", "#000000");
TemplateData key4 = new TemplateData("remark", "点击填写面试申请", "#000000");
templateData.add(key1);
templateData.add(key2);
templateData.add(key3);
templateData.add(key4);
//数据处理成固定好的json格式
String content = mqd.getContentJson(templateData);
/**
* 模板消息内容 end
*/
mqd.setContent(content);//消息内容模板消息 json格式 普通消息字符串类型
mqd.setMobile("18212310017");//手机号
mqd.setType(2);//类型(1 短信,2 邮件,3 微信模板消息)
mqd.setWxgzhType(1);//公众号类型 1:8小时企业管理 2:优领人才网
mqd.setTemplateId("Uz6mVUYk9Tu7EO2V1pqiQ3x4EudDJTYWdaFtdf64h3M");//模板id
mqd.setUrl(null);//网页地址
mqd.setWxxcxPageId(null);//小程序页面地址
Map map = JSON.parseObject(JSON.toJSONString(mqd), Map.class);
String s = zpglWxgzptService.addMessageQueue(map);
return ResultUtil.success(s);
}
}
package cn.timer.api.controller.zpgl.sevice;
import cn.hutool.http.HttpUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @author longys
* @date 2022/3/25 18:08
*/
@Service
public class ZpglWxgzptService {
@Value("${youling.serverUrl}")
private String serverUrl;
/**
* 添加消息队列
* @param map
* @return
*/
public String addMessageQueue(Map<String,Object> map){
return HttpUtil.post(serverUrl+"/wxgzh/addMessageQueue", map);
}
}
package cn.timer.api.dto.template;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 跳小程序所需数据
* @author longys
* @date 2022/3/23 15:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Miniprogram implements Serializable {
/**
*所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系)
*/
private String appid;
/**
* 所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar),要求该小程序已发布
*/
private String pagepath;
}
package cn.timer.api.dto.template;
import lombok.Data;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author longys
* @date 2022/3/22 16:52
*/
@Data
public class TemplateData implements Serializable {
// 参数名称
private String name;
// 参数值
private String value;
// 颜色
private String color;
public TemplateData(String name, String value, String color) {
this.name = name;
this.value = value;
this.color = color;
}
public TemplateData(List<TemplateData> dateList){
Map<String, Map<String,Object>> nameMap = new HashMap<>();
for(TemplateData date : dateList){
Map<String,Object> map = new HashMap<>();
map.put("value",date.getValue());
map.put("color",date.getColor());
nameMap.put(date.getName(),map);
}
}
}
package cn.timer.api.dto.template;
import lombok.Data;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 模版消息发送对象
* @author longys
* @date 2022/3/22 16:51
*/
@Data
public class TemplateMessage implements Serializable {
/**
* 接收者openid
*/
private String touser;
/**
* 模版ID
*/
private String template_id;
/**
* 跳转URL
*/
private String url;
/**
* 跳小程序所需数据 不需跳小程序可不用传该数据
*/
private Miniprogram miniprogram;
/**
* 模板数据
*/
private Map<String, Map<String,Object>> data;
public TemplateMessage(List<TemplateData> dateList, String touser, String templateId, String url, Miniprogram miniprogram){
Map<String, Map<String,Object>> nameMap = new HashMap<>();
for(TemplateData date : dateList){
Map<String,Object> map = new HashMap<>();
map.put("value",date.getValue());
map.put("color",date.getColor());
nameMap.put(date.getName(),map);
}
this.data = nameMap;
this.touser = touser;
this.template_id = templateId;
//以下不需要跳转传 null
this.url = url;
this.miniprogram = miniprogram;
};
public TemplateMessage(Map<String, Map<String,Object>> data, String touser, String templateId, String url, Miniprogram miniprogram){
this.data = data;
this.touser = touser;
this.template_id = templateId;
//以下不需要跳转传 null
this.url = url;
this.miniprogram = miniprogram;
};
}
\ No newline at end of file
package cn.timer.api.dto.wxgzh;
import cn.timer.api.dto.login.QysDto;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author longys
* @date 2022/3/30 16:46
*/
@Data
public class LoginDto {
private String phone;
private String code;
private String openid;
/**
* 姓名
*/
private String userName;
/**
* 个人头像
*/
private String avatar;
}
package cn.timer.api.dto.wxgzh;
import cn.timer.api.dto.template.Miniprogram;
import cn.timer.api.dto.template.TemplateData;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author longys
* @date 2022/4/2 17:31
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MessageQueueDto {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 内容 、 公众号模板消息内容 是JSON格式
*/
private String content;
/**
* 类型(1 短信,2 邮件,3 微信模板消息)
*/
private Integer type;
/**
* 状态(0 发送成功,1 未发送,2 发送失败)
*/
private Integer status;
/**
* 手机号码
*/
private String mobile;
/**
* 邮箱
*/
private String email;
/**
* 微信openid
*/
private String openid;
/**
* 模版消息id (发送公众号模板消息用到)
*/
private String templateId;
/**
* 业务类型
*/
private Integer tos;
/**
* 公众号配置表id
*/
private Integer wxgzhType;
/**
* 网页地址
*/
private String url;
/**
* 小程序页面配置表id
*/
private Long wxxcxPageId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/**
* 转json格式模板消息内容
* @param dateList
* @return
*/
public String getContentJson(List<TemplateData> dateList){
Map<String, Map<String,Object>> nameMap = new HashMap<>();
for(TemplateData date : dateList){
Map<String,Object> map = new HashMap<>();
map.put("value",date.getValue());
map.put("color",date.getColor());
nameMap.put(date.getName(),map);
}
return JSON.toJSONString(nameMap);
};
}
...@@ -240,6 +240,12 @@ public class InterviewApplicationDto implements Serializable { ...@@ -240,6 +240,12 @@ public class InterviewApplicationDto implements Serializable {
private Integer zpglZpqdId; private Integer zpglZpqdId;
/** /**
* 签名图片
*/
@ApiModelProperty(value = "签名图片")
private String signatureImg;
/**
* 职位信息ID * 职位信息ID
*/ */
@ApiModelProperty(value = "职位信息ID") @ApiModelProperty(value = "职位信息ID")
...@@ -268,4 +274,6 @@ public class InterviewApplicationDto implements Serializable { ...@@ -268,4 +274,6 @@ public class InterviewApplicationDto implements Serializable {
@ApiModelProperty(value = "家庭资料") @ApiModelProperty(value = "家庭资料")
private List<ZpglRcxxJtzl> zpglRcxxJtzls; private List<ZpglRcxxJtzl> zpglRcxxJtzls;
} }
...@@ -240,3 +240,19 @@ sftp: ...@@ -240,3 +240,19 @@ sftp:
targetPath: '/disk' targetPath: '/disk'
reservedName: false reservedName: false
#微信公众号(服务号)
wxgzh:
appid: 'wxd331ab19a67e2319'
appSecret: '31259f6fee0c0771d6f48c3d5159c551'
#我方token 在微信公众号基本配置里面配置( token = 8timer123 md5加密得)
token: 'af37997effca937229453180e830b164'
#消息加解密密钥
encodingAesKey: 'chAbt69dLAtk8HH0oGMuZwHzK2SuhnxZI5Jbzc4nNzX'
youling:
serverUrl: 'http://227387db45.51vip.biz'
#h5服务地址
h5:
url: 'http://javays.com'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment