新增护理站生成二维码
This commit is contained in:
parent
7b11884c74
commit
72ccb547b5
@ -205,4 +205,18 @@ public class NurseStationController extends BaseController {
|
|||||||
public AjaxResult nurseStationByUserId(NurseStationSysUserVO sysUser) {
|
public AjaxResult nurseStationByUserId(NurseStationSysUserVO sysUser) {
|
||||||
return nurseStationService.getNurseStationByUserId(sysUser);
|
return nurseStationService.getNurseStationByUserId(sysUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 护理站生成二维码
|
||||||
|
*
|
||||||
|
* @param nurseStationId 护理站id
|
||||||
|
* @return 邀请码图片地址
|
||||||
|
*/
|
||||||
|
@PostMapping("/nurseStationCode")
|
||||||
|
public AjaxResult nurseStationCode(Long nurseStationId) {
|
||||||
|
if (Objects.isNull(nurseStationId)) {
|
||||||
|
return AjaxResult.error("护理站id不能为空!");
|
||||||
|
}
|
||||||
|
return nurseStationService.nurseStationCode(nurseStationId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,4 +149,12 @@ public interface INurseStationService {
|
|||||||
* @return 护理站信息
|
* @return 护理站信息
|
||||||
*/
|
*/
|
||||||
int getNurseStationById(List<Long> idList);
|
int getNurseStationById(List<Long> idList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 护理站生成二维码
|
||||||
|
*
|
||||||
|
* @param nurseStationId 护理站id
|
||||||
|
* @return 邀请码图片地址
|
||||||
|
*/
|
||||||
|
AjaxResult nurseStationCode(Long nurseStationId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import com.xinelu.common.constant.Constants;
|
|||||||
import com.xinelu.common.core.domain.AjaxResult;
|
import com.xinelu.common.core.domain.AjaxResult;
|
||||||
import com.xinelu.common.enums.NurseClassifyInfoEnum;
|
import com.xinelu.common.enums.NurseClassifyInfoEnum;
|
||||||
import com.xinelu.common.exception.ServiceException;
|
import com.xinelu.common.exception.ServiceException;
|
||||||
|
import com.xinelu.common.utils.AppletChatUtil;
|
||||||
import com.xinelu.common.utils.SecurityUtils;
|
import com.xinelu.common.utils.SecurityUtils;
|
||||||
import com.xinelu.common.utils.bean.BeanUtils;
|
import com.xinelu.common.utils.bean.BeanUtils;
|
||||||
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
|
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
|
||||||
@ -66,6 +67,8 @@ public class NurseStationServiceImpl implements INurseStationService {
|
|||||||
private NurseStationClassifyRelationMapper stationClassifyRelationMapper;
|
private NurseStationClassifyRelationMapper stationClassifyRelationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private AppletPageConfig appletPageConfig;
|
private AppletPageConfig appletPageConfig;
|
||||||
|
@Resource
|
||||||
|
private XinELuConfig xinYiLuConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 护理站营业时间默认值
|
* 护理站营业时间默认值
|
||||||
@ -595,6 +598,47 @@ public class NurseStationServiceImpl implements INurseStationService {
|
|||||||
return nurseStationMapper.getNurseStationCount(idList);
|
return nurseStationMapper.getNurseStationCount(idList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 护理站生成二维码
|
||||||
|
*
|
||||||
|
* @param nurseStationId 护理站id
|
||||||
|
* @return 邀请码图片地址
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult nurseStationCode(Long nurseStationId) {
|
||||||
|
//获取微信小程序AccessToken的值
|
||||||
|
NurseStation nurseStationById = nurseStationMapper.getNurseStationById(nurseStationId);
|
||||||
|
if (Objects.isNull(nurseStationById)) {
|
||||||
|
return AjaxResult.error("当前护理机构信息不存在,请联系管理员!");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(nurseStationById.getStationWechatCodeUrl())) {
|
||||||
|
String fileName = String.valueOf(System.nanoTime()) + nurseStationId + ".png";
|
||||||
|
//小程序跳转路径
|
||||||
|
String appletPageUrl = appletPageConfig.getNurseStationDetailsPageUrl();
|
||||||
|
//机构二维码存放路径
|
||||||
|
String filePathWeChatCodeUrl = xinYiLuConfig.getStationWechatCodeUrl();
|
||||||
|
String appletCodePicture = AppletChatUtil.createAppletCode(nurseStationId, false, fileName, appletPageUrl, filePathWeChatCodeUrl);
|
||||||
|
if (StringUtils.isNotBlank(appletCodePicture) && StringUtils.equals(FAIL, appletCodePicture)) {
|
||||||
|
//第一次调用获取小程序二维码信息失败,重新递归调用一次,第二次失败直接返回提示信息
|
||||||
|
appletCodePicture = AppletChatUtil.createAppletCode(nurseStationId, true, fileName, appletPageUrl, filePathWeChatCodeUrl);
|
||||||
|
if (StringUtils.isNotBlank(appletCodePicture) && StringUtils.equals(FAIL, appletCodePicture)) {
|
||||||
|
return AjaxResult.error("获取小程序二维码信息失败,请联系管理员!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String pictureUrl = "";
|
||||||
|
if (StringUtils.isNotBlank(appletCodePicture)) {
|
||||||
|
pictureUrl = "/profile" + xinYiLuConfig.getStationWechatCodeUrl() + "/" + nurseStationId + "/" + fileName;
|
||||||
|
int updateCount = nurseStationMapper.updateStationWeChatCodeUrl(nurseStationId, pictureUrl);
|
||||||
|
if (updateCount <= 0) {
|
||||||
|
throw new ServiceException("生成机构二维码失败,请联系管理员!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success(pictureUrl);
|
||||||
|
}
|
||||||
|
//直接返回二维码图片信息
|
||||||
|
return AjaxResult.success(nurseStationById.getStationWechatCodeUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增护理站标签信息
|
* 新增护理站标签信息
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user