小程序代码移植

This commit is contained in:
张恒 2023-09-26 10:44:29 +08:00
parent 6f07765227
commit 05fa888bbe
10 changed files with 966 additions and 21 deletions

View File

@ -40,9 +40,9 @@ xinelu:
evaluate-picture-url: /evaluatePictureUrl
# 护理项目分类图标存放地址
nurseitem-classify-url: /nurseItemClassifyUrl
#海报图片存放路径
# 海报图片存放路径
poster-picture-url: /posterPictureUrl
#海报视频存放路径
# 海报视频存放路径
poster-video-url: /posterVideoUrl
# 商城店铺默认名称
yiLuYouPinStoreName: 医路优品
@ -54,29 +54,19 @@ xinelu:
nurse-station-classify-url: /nurseStationClassifyUrl
# 资讯分类图片地址
lead-thumbnail-url: /leadThumbnailUrl
#在线客服群二维码存放路径
# 在线客服群二维码存放路径
group-qr-code-url: /groupQrCodeUrl
#科室人员证书图片存放路径
# 科室人员证书图片存放路径
certificate-url: /certificateUrl
#小程序好友邀请二维码存放地址
# 小程序好友邀请二维码存放地址
personal-wechat-code-url: /personalWechatCodeUrl
#健康咨询科室人员头像地址
# 健康咨询科室人员头像地址
person-picture-url: /personPictureUrl
#护理人员证书图片存放路径
# 护理人员证书图片存放路径
person-certificate-url: /personCertificateUrl
#审核护理人员证书图片存放路径
# 审核护理人员证书图片存放路径
person-certificate-check-url: /personCertificateCheckUrl
#培训分类图片路径
training-category-picture-url: /trainingCategoryPictureUrl
#培训项目logo图片路径
training-item-cover-url: /trainingItemCoverUrl
#培训项目海报图片路径
training-item-poster-url: /trainingItemPosterUrl
#培训项目内容图片路径
training-item-content-url: /trainingItemContentUrl
#培训项目章节视频存放地址
item_directory_url: /itemDirectoryUrl
#护理站二维码存放地址
# 护理站二维码存放地址
station-wechat-code-url: /stationWechatCodeUrl
# 开发环境配置
@ -115,9 +105,9 @@ spring:
servlet:
multipart:
# 单个文件大小
max-file-size: 200MB
max-file-size: 200MB
# 设置总上传的文件大小
max-request-size: 500MB
max-request-size: 500MB
# 服务模块
devtools:
restart:

View File

@ -0,0 +1,30 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* @Description 是否偏远地区枚举
* @Author zhangHeng
* @Date 2023-1-3
* @Version 1.0
*/
@Getter
public enum RemoteSignsEnum {
/**
* 偏远地区
*/
REMOTE(1),
/**
* 非偏远地区
*/
NOT_REMOTE(0),
;
final private Integer info;
RemoteSignsEnum(Integer info) {
this.info = info;
}
}

View File

@ -0,0 +1,63 @@
package com.xinelu.applet.controller.mobileAuthorization;
import com.xinelu.applet.vo.mobileAuthorization.MobileAuthorizationVO;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.utils.uuid.IdUtils;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @Description 移动端权限认证控制器
* @Author 纪寒
* @Date 2022-12-09 09:47:06
* @Version 1.0
*/
@Slf4j
@RestController
@RequestMapping("/nurseApplet/authorization")
public class MobileAuthorizationController {
/**
* 令牌秘钥标识
*/
@Value("${token.secret}")
private String secret;
@Resource
private RedisTemplate<String, String> redisTemplate;
/**
* 移动端令牌生成接口
*
* @return 令牌信息
*/
@GetMapping("/createMobileToken")
public AjaxResult createMobileAuthorization() {
//随机字符串
String uuid = IdUtils.fastUUID();
//JWT链
Map<String, Object> claims = new HashMap<>();
claims.put(Constants.MOBILE_AUTHORIZATION_PREFIX, uuid);
//使用JWT生成token信息
String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact();
//将token存入Redis中默认有效期为1个月
String tokenKey = Constants.MOBILE_AUTHORIZATION_KEY + uuid;
//将token的有效期设置为10天
redisTemplate.opsForValue().set(tokenKey, token, 240, TimeUnit.HOURS);
MobileAuthorizationVO authorizationVO = new MobileAuthorizationVO();
authorizationVO.setToken(token);
return AjaxResult.success(authorizationVO);
}
}

View File

@ -0,0 +1,134 @@
package com.xinelu.applet.controller.nurseappletpersoncenter;
import com.xinelu.applet.service.nurseappletpersoncenter.NurseAppletPersonCenterService;
import com.xinelu.common.annotation.MobileRequestAuthorization;
import com.xinelu.common.annotation.RepeatSubmit;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.manage.domain.nursestationperson.NurseStationPerson;
import com.xinelu.manage.dto.nursestationperson.NurseStationPersonCheckDTO;
import com.xinelu.manage.vo.nursestationpersonrevenue.RevenueTimeDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.Objects;
/**
* 护理员个人中心
*
* @author ljh
* @version 1.0
* Create by 2023/3/30 17:03
*/
@RestController
@RequestMapping("/nurseApplet/personCenter")
public class NurseAppletPersonCenterController extends BaseController {
@Resource
private NurseAppletPersonCenterService nurseAppletPersonCenterService;
/**
* 个人信息查询护理站人员的个人信息
*
* @param nursePersonId 个人信息
* @return com.xinyilu.nurseapplet.domain.vo.nursepersonapplogin.NursePersonAppLoginsUserVO
**/
@MobileRequestAuthorization
@GetMapping("/nurseAppletPersonCenter")
public AjaxResult nurseAppletPersonCenter(Long nursePersonId) {
if (Objects.isNull(nursePersonId)) {
return AjaxResult.error("护理人员id不能为空");
}
return AjaxResult.success(nurseAppletPersonCenterService.nurseAppletPersonCenter(nursePersonId));
}
/**
* 个人中心-我的收益功能
*/
@MobileRequestAuthorization
@GetMapping("/personRevenue")
public AjaxResult selectPersonRevenue(RevenueTimeDTO revenueTime) {
if (Objects.isNull(revenueTime) || Objects.isNull(revenueTime.getNurseStationPersonId())) {
return AjaxResult.error("护理员信息不能为空!");
}
return AjaxResult.success(nurseAppletPersonCenterService.selectPersonRevenue(revenueTime));
}
/**
* 个人中心-我的收益功能明细
*
* @param revenueTime 用户信息及时间
* @return AjaxResult
*/
@GetMapping("/personRevenueDetails")
public TableDataInfo selectPersonRevenueDetails(RevenueTimeDTO revenueTime) {
return nurseAppletPersonCenterService.selectPersonRevenueDetails(revenueTime);
}
/**
* 护理员App和小程序修改护理员信息以及上传证书
*
* @param nurseStationPersonCheckDTO 护理人员主表信息与证书信息
* @return 上传结果
*/
@RepeatSubmit
@MobileRequestAuthorization
@PostMapping("/updateNursePersonCheck")
public AjaxResult updateNursePersonCheck(@RequestBody NurseStationPersonCheckDTO nurseStationPersonCheckDTO) {
if (Objects.isNull(nurseStationPersonCheckDTO)) {
return AjaxResult.error("信息不能为空!");
}
if (Objects.isNull(nurseStationPersonCheckDTO.getId())) {
return AjaxResult.error("护理人员id信息不能为空");
}
return nurseAppletPersonCenterService.updateNursePersonCheck(nurseStationPersonCheckDTO);
}
/**
* 护理员App和小程序护理员修改状态
*
* @param nurseStationPerson 护理人员主表信息修改状态
* @return 上传结果
*/
@MobileRequestAuthorization
@PostMapping("/updateNursePersonWorkStatus")
public AjaxResult updateNursePersonWorkStatus(@RequestBody NurseStationPerson nurseStationPerson) {
if (Objects.isNull(nurseStationPerson)) {
return AjaxResult.error("护理员信息不存在,无法修改,请联系管理员!");
}
if (Objects.isNull(nurseStationPerson.getId())) {
return AjaxResult.error("护理员信息不存在,无法修改,请联系管理员!");
}
if (Objects.isNull(nurseStationPerson.getWorkStatus())) {
return AjaxResult.error("护理员状态信息不能为空!");
}
return nurseAppletPersonCenterService.updateNursePersonWorkStatus(nurseStationPerson);
}
/**
* 护理员App和小程序护理员上传证书
*
* @param file 图片文件
* @param nursePersonId 护理员id
* @return 上传结果
*/
@PostMapping("/uploadNurseStationPersonCertificateUrl")
public AjaxResult uploadNurseStationPersonCertificateUrl(MultipartFile file, Long nursePersonId) throws Exception {
if (Objects.isNull(nursePersonId)) {
return AjaxResult.error("请选择要上传的人员id");
}
if (Objects.isNull(file) || StringUtils.isBlank(file.getOriginalFilename())) {
return AjaxResult.error("当前文件不存在,无法上传!");
}
if (file.getOriginalFilename().contains(Constants.EMPTY)) {
return AjaxResult.error("当前文件名含有空格,请先去除空格在上传!");
}
return nurseAppletPersonCenterService.uploadNurseStationPersonCertificateUrl(file, nursePersonId);
}
}

View File

@ -0,0 +1,69 @@
package com.xinelu.applet.service.nurseappletpersoncenter;
import com.xinelu.applet.vo.nursepersonapplogin.NurseStationPersonUserVO;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.manage.domain.nursestationperson.NurseStationPerson;
import com.xinelu.manage.dto.nursestationperson.NurseStationPersonCheckDTO;
import com.xinelu.manage.vo.nursestationpersonrevenue.PersonRevenueCountVO;
import com.xinelu.manage.vo.nursestationpersonrevenue.RevenueTimeDTO;
import org.springframework.web.multipart.MultipartFile;
/**
* @Description 护理人员登录个人中心
* @Author ljh
*/
public interface NurseAppletPersonCenterService {
/**
* 护理人员登录个人中心
*
* @param nursePersonId 护理员id
* @return 结果
*/
NurseStationPersonUserVO nurseAppletPersonCenter(Long nursePersonId);
/**
* 个人中心-我的收益功能
*
* @param revenueTime 护理员信息
* @return NurseStationPersonRevenueVO
*/
PersonRevenueCountVO selectPersonRevenue(RevenueTimeDTO revenueTime);
/**
* 我的收益功能明细
*
* @param revenueTime 护理员信息
* @return NurseStationPersonRevenueVO
*/
TableDataInfo selectPersonRevenueDetails(RevenueTimeDTO revenueTime);
/**
* 小程序app更新护理人员主表信息与证书信息
*
* @param nurseStationPersonCheckDTO 护理人员主表信息与证书信息
* @return AjaxResult
*/
AjaxResult updateNursePersonCheck(NurseStationPersonCheckDTO nurseStationPersonCheckDTO);
/**
* 修改护理站人员状态信息
*
* @param nurseStationPerson 护理站人员信息
* @return 结果
*/
AjaxResult updateNursePersonWorkStatus(NurseStationPerson nurseStationPerson);
/**
* 护理员App和小程序护理员上传证书
*
* @param file 图片文件
* @param nursePersonId 护理员id
* @return 结果
* @throws Exception 异常信息
*/
AjaxResult uploadNurseStationPersonCertificateUrl(MultipartFile file, Long nursePersonId) throws Exception;
}

View File

@ -0,0 +1,257 @@
package com.xinelu.applet.service.nurseappletpersoncenter.impl;
import com.xinelu.applet.mapper.nursepersonapplogin.NursePersonAppLoginMapper;
import com.xinelu.applet.service.nurseappletpersoncenter.NurseAppletPersonCenterService;
import com.xinelu.applet.vo.nursepersonapplogin.NurseStationPersonUserVO;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.ModifyCheckStatusEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.AgeUtil;
import com.xinelu.common.utils.PageServiceUtil;
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
import com.xinelu.common.utils.file.FileUploadUtils;
import com.xinelu.common.utils.file.FileUtils;
import com.xinelu.common.utils.file.MimeTypeUtils;
import com.xinelu.manage.domain.nursestationperson.NurseStationPerson;
import com.xinelu.manage.domain.nursestationpersoncheck.NurseStationPersonCheck;
import com.xinelu.manage.dto.nursestationperson.NurseStationPersonCheckDTO;
import com.xinelu.manage.mapper.nursestation.NurseStationMapper;
import com.xinelu.manage.mapper.nursestationperson.NurseStationPersonMapper;
import com.xinelu.manage.mapper.nursestationpersoncheck.NurseStationPersonCheckMapper;
import com.xinelu.manage.mapper.nursestationpersonrevenue.NurseStationPersonRevenueMapper;
import com.xinelu.manage.vo.nursestation.NurseStationSysUserVO;
import com.xinelu.manage.vo.nursestationpersonrevenue.NurseStationPersonRevenueVO;
import com.xinelu.manage.vo.nursestationpersonrevenue.PersonRevenueCountVO;
import com.xinelu.manage.vo.nursestationpersonrevenue.RevenueTimeDTO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 护理人员登录个人中心
*
* @author ljh
* @version 1.0
* Create by 2023/3/30 17:05
*/
@Service
public class NurseAppletPersonCenterServiceImpl implements NurseAppletPersonCenterService {
@Resource
private NursePersonAppLoginMapper nursePersonAppLoginMapper;
@Resource
private NurseStationMapper nurseStationMapper;
@Resource
private NurseStationPersonRevenueMapper nurseStationPersonRevenueMapper;
@Resource
private XinELuConfig xinELuConfig;
@Resource
private NurseStationPersonMapper nurseStationPersonMapper;
@Resource
private NurseStationPersonCheckMapper nurseStationPersonCheckMapper;
@Resource
private GenerateSystemCodeUtil generateSystemCodeUtil;
@Resource
private PageServiceUtil pageServiceUtil;
/**
* 护理人员登录个人中心
*
* @param nursePersonId 护理员id
* @return 结果
*/
@Override
public NurseStationPersonUserVO nurseAppletPersonCenter(Long nursePersonId) {
NurseStationPersonUserVO nurseStationPersonById = nursePersonAppLoginMapper.getNurseStationPersonById(nursePersonId);
//算出年龄以及平均星级评价
if (Objects.nonNull(nurseStationPersonById) && Objects.nonNull(nurseStationPersonById.getBirthDate())) {
nurseStationPersonById.setAge(AgeUtil.getAgeMonth(String.valueOf(nurseStationPersonById.getBirthDate())));
}
int avgEvaluateSatisfaction = nurseStationPersonMapper.selectAvgEvaluateSatisfaction(nursePersonId);
nurseStationPersonById.setEvaluateStarCount(Math.round(avgEvaluateSatisfaction));
//查询所属的护理站信息
if (StringUtils.isBlank(nurseStationPersonById.getNurseStationIds())) {
return nurseStationPersonById;
}
List<String> nurseTypeCodeList = Arrays.asList(StringUtils.split(nurseStationPersonById.getNurseStationIds(), ","));
List<Long> stationIdList = nurseTypeCodeList.stream().map(s -> Long.parseLong(s.trim())).distinct().collect(Collectors.toList());
List<NurseStationSysUserVO> stationIds = nurseStationMapper.getNurseStationIds(stationIdList);
nurseStationPersonById.setNurseStationSysUserVOList(stationIds);
//根据护理员id更新星级评级
NurseStationPerson nurseStationPerson = new NurseStationPerson();
nurseStationPerson.setId(nursePersonId);
nurseStationPerson.setEvaluateStarCount(avgEvaluateSatisfaction);
nurseStationPersonMapper.updateNurseStationPerson(nurseStationPerson);
return nurseStationPersonById;
}
/**
* 个人中心-我的收益功能
*
* @param revenueTime 护理员信息
* @return NurseStationPersonRevenueVO
*/
@Override
public PersonRevenueCountVO selectPersonRevenue(RevenueTimeDTO revenueTime) {
revenueTime.setStartTime(LocalDate.now().atTime(0, 0, 0));
revenueTime.setEndTime(LocalDateTime.now());
if (Objects.nonNull(revenueTime.getMonthTime())) {
revenueTime.setMonthStartDateTime(revenueTime.getMonthTime().with(TemporalAdjusters.firstDayOfMonth()).atTime(0, 0, 0));
revenueTime.setMonthEndDateTime(revenueTime.getMonthTime().with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59));
return nurseStationPersonRevenueMapper.selectRevenueAmountById(revenueTime);
}
if (Objects.nonNull(revenueTime.getMonthStartTime()) && Objects.nonNull(revenueTime.getMonthEndTime())) {
revenueTime.setMonthStartDateTime(revenueTime.getMonthStartTime().atTime(0, 0, 0));
revenueTime.setMonthEndDateTime(revenueTime.getMonthEndTime().atTime(23, 59, 59));
return nurseStationPersonRevenueMapper.selectRevenueAmountById(revenueTime);
}
revenueTime.setMonthStartDateTime(LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()).atTime(0, 0, 0));
revenueTime.setMonthEndDateTime(LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59));
return nurseStationPersonRevenueMapper.selectRevenueAmountById(revenueTime);
}
/**
* 我的收益功能明细
*
* @param revenueTime 护理员信息
* @return NurseStationPersonRevenueVO
*/
@Override
public TableDataInfo selectPersonRevenueDetails(RevenueTimeDTO revenueTime) {
if (Objects.isNull(revenueTime) || Objects.isNull(revenueTime.getNurseStationPersonId())) {
return pageServiceUtil.getDataTable(new ArrayList<>());
}
if (Objects.nonNull(revenueTime.getMonthTime())) {
revenueTime.setMonthStartDateTime(revenueTime.getMonthTime().with(TemporalAdjusters.firstDayOfMonth()).atTime(0, 0, 0));
revenueTime.setMonthEndDateTime(revenueTime.getMonthTime().with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59));
pageServiceUtil.startPage();
List<NurseStationPersonRevenueVO> list = nurseStationPersonRevenueMapper.selectRevenueDetails(revenueTime);
return pageServiceUtil.getDataTable(list);
}
if (Objects.nonNull(revenueTime.getMonthStartTime()) && Objects.nonNull(revenueTime.getMonthEndTime())) {
revenueTime.setMonthStartDateTime(revenueTime.getMonthStartTime().atTime(0, 0, 0));
revenueTime.setMonthEndDateTime(revenueTime.getMonthEndTime().atTime(23, 59, 59));
pageServiceUtil.startPage();
List<NurseStationPersonRevenueVO> list = nurseStationPersonRevenueMapper.selectRevenueDetails(revenueTime);
return pageServiceUtil.getDataTable(list);
}
revenueTime.setMonthStartDateTime(LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()).atTime(0, 0, 0));
revenueTime.setMonthEndDateTime(LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59));
pageServiceUtil.startPage();
List<NurseStationPersonRevenueVO> list = nurseStationPersonRevenueMapper.selectRevenueDetails(revenueTime);
return pageServiceUtil.getDataTable(list);
}
/**
* 小程序app更新护理人员主表信息与证书信息
*
* @param nurseStationPersonCheckDTO 护理人员主表信息与证书信息
* @return AjaxResult
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult updateNursePersonCheck(NurseStationPersonCheckDTO nurseStationPersonCheckDTO) {
//更新护理人员主表信息
nurseStationPersonCheckDTO.setModifyInfoFlag(1);
nurseStationPersonCheckDTO.setModifyCheckStatus(ModifyCheckStatusEnum.NOT_CHECK.getInfo());
nurseStationPersonMapper.updateNursePersonCheck(nurseStationPersonCheckDTO);
//更新sysUser表信息
nursePersonAppLoginMapper.updateHeadAvatarHeadUserId(nurseStationPersonCheckDTO.getUserId(), nurseStationPersonCheckDTO.getAvatar());
if (CollectionUtils.isEmpty(nurseStationPersonCheckDTO.getNurseStationPersonCheckList())) {
return AjaxResult.success();
}
//根据护理人员id去查询护理人员信息修改审核信息表信息
NurseStationPersonCheck nurseStationPersonCheck = new NurseStationPersonCheck();
nurseStationPersonCheck.setNurseStationPersonId(nurseStationPersonCheckDTO.getId());
List<NurseStationPersonCheck> nurseStationPersonChecks = nurseStationPersonCheckMapper.selectNurseStationPersonCheckList(nurseStationPersonCheck);
if (CollectionUtils.isNotEmpty(nurseStationPersonChecks)) {
//根据护理人员id筛选护理人员信息修改审核信息表的数据 有就删 确保信息是最新的
Long[] longList = nurseStationPersonChecks.stream().filter(Objects::nonNull).filter(check -> (Objects.nonNull(check.getId()))).map(NurseStationPersonCheck::getId).toArray(Long[]::new);
int deleteNurseStationPersonCheckByIds = nurseStationPersonCheckMapper.deleteNurseStationPersonCheckByIds(longList);
if (deleteNurseStationPersonCheckByIds <= 0) {
throw new ServiceException("修改护理人员个人信息失败,请联系管理员!");
}
}
List<NurseStationPersonCheck> nurseStationPersonCheckList = nurseStationPersonCheckDTO.getNurseStationPersonCheckList();
if (CollectionUtils.isNotEmpty(nurseStationPersonCheckList)) {
nurseStationPersonCheckList.forEach(item -> {
item.setNurseStationPersonId(nurseStationPersonCheckDTO.getId());
item.setCreateTime(LocalDateTime.now());
item.setCertificateCode(Constants.PERSON_CERTIFICATE_CODE + generateSystemCodeUtil.generateSystemCode(Constants.PERSON_CERTIFICATE_CODE));
item.setCertificateName("资质证书" + Constants.PERSON_CERTIFICATE_CODE + generateSystemCodeUtil.generateSystemCode(Constants.PERSON_CERTIFICATE_CODE));
});
int stationPersonCheckList = nurseStationPersonCheckMapper.insertNurseStationPersonCheckList(nurseStationPersonCheckList);
if (stationPersonCheckList <= 0) {
throw new ServiceException("修改护理人员个人信息失败,请联系管理员!");
}
}
//删除原有的审核图片文件
if (CollectionUtils.isNotEmpty(nurseStationPersonChecks)) {
List<String> pageCertificateUrlList = nurseStationPersonCheckDTO.getNurseStationPersonCheckList().stream().filter(item -> StringUtils.isNotBlank(item.getCertificateUrl())).map(NurseStationPersonCheck::getCertificateUrl).collect(Collectors.toList());
List<String> certificateUrlList = nurseStationPersonChecks.stream().filter(Objects::nonNull).filter(check -> (StringUtils.isNotBlank(check.getCertificateUrl()))).map(NurseStationPersonCheck::getCertificateUrl).collect(Collectors.toList());
List<String> subtractList = new ArrayList<>(CollectionUtils.subtract(certificateUrlList, pageCertificateUrlList));
for (String certificateUrl : subtractList) {
FileUtils.deleteSystemFile(certificateUrl);
}
}
return AjaxResult.success();
}
/**
* 修改护理站人员状态信息
*
* @param nurseStationPerson 护理站人员信息
* @return 结果
*/
@Override
public AjaxResult updateNursePersonWorkStatus(NurseStationPerson nurseStationPerson) {
//更新护理人员主表信息
int personWorkStatusWorkStatus = nurseStationPersonMapper.updateNursePersonWorkStatus(nurseStationPerson);
if (personWorkStatusWorkStatus <= 0) {
throw new ServiceException("更新护理人员状态信息失败,请联系管理员!");
}
return AjaxResult.success();
}
/**
* 护理员App和小程序护理员上传证书
*
* @param file 图片文件
* @param nursePersonId 护理员id
* @return 结果
* @throws Exception 异常信息
*/
@Override
public AjaxResult uploadNurseStationPersonCertificateUrl(MultipartFile file, Long nursePersonId) throws Exception {
if (StringUtils.isBlank(file.getOriginalFilename())) {
return AjaxResult.error("请选择所要上传的证书图片!");
}
//获取路径名称
String uploadPathUrl = XinELuConfig.getProfile() + xinELuConfig.getPersonCertificateCheckUrl();
//上传图片
String pictureName = FileUploadUtils.uploadNurseStationPath(uploadPathUrl, file, MimeTypeUtils.IMAGE_EXTENSION);
if (StringUtils.isBlank(pictureName)) {
throw new ServiceException(pictureName + "证书图片上传失败,请联系管理员!");
}
//获取返回值
AjaxResult ajax = AjaxResult.success("上传成功!");
ajax.put("imgUrl", pictureName);
return ajax;
}
}

View File

@ -0,0 +1,20 @@
package com.xinelu.applet.vo.mobileAuthorization;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 移动端令牌实体类
* @Author 纪寒
* @Date 2022-12-09 10:21:50
* @Version 1.0
*/
@Data
public class MobileAuthorizationVO implements Serializable {
private static final long serialVersionUID = 2689553419792246833L;
/**
* token信息
*/
private String token;
}

View File

@ -0,0 +1,129 @@
package com.xinelu.manage.controller.sysarea;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.sysarea.SysArea;
import com.xinelu.manage.service.sysarea.ISysAreaService;
import net.sf.jsqlparser.statement.update.Update;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 区域Controller
*
* @author jihan
* @date 2022-09-02
*/
@RestController
@RequestMapping("/system/area")
public class SysAreaController extends BaseController {
@Resource
private ISysAreaService sysAreaService;
/**
* 查询区域列表
*/
@PreAuthorize("@ss.hasPermi('system:area:list')")
@GetMapping("/list")
public TableDataInfo list(SysArea sysArea) {
startPage();
List<SysArea> list = sysAreaService.selectSysAreaList(sysArea);
return getDataTable(list);
}
/**
* 导出区域列表
*/
@PreAuthorize("@ss.hasPermi('system:area:export')")
@Log(title = "区域", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysArea sysArea) {
List<SysArea> list = sysAreaService.selectSysAreaList(sysArea);
ExcelUtil<SysArea> util = new ExcelUtil<>(SysArea.class);
util.exportExcel(response, list, "区域数据");
}
/**
* 获取区域详细信息
*/
@PreAuthorize("@ss.hasPermi('system:area:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(sysAreaService.selectSysAreaById(id));
}
/**
* 新增区域
*/
@PreAuthorize("@ss.hasPermi('system:area:add')")
@Log(title = "区域", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody @Validated(Insert.class) SysArea sysArea) {
return sysAreaService.insertSysArea(sysArea);
}
/**
* 修改区域
*/
@PreAuthorize("@ss.hasPermi('system:area:edit')")
@Log(title = "区域", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public AjaxResult edit(@RequestBody @Validated(Update.class) SysArea sysArea) {
return sysAreaService.updateSysArea(sysArea);
}
/**
* 删除区域
*/
@PreAuthorize("@ss.hasPermi('system:area:remove')")
@Log(title = "区域", businessType = BusinessType.DELETE)
@PostMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sysAreaService.deleteSysAreaByIds(ids));
}
/**
* 获取区域详细信息
*/
@GetMapping("/getSubordinateRegions")
public AjaxResult getSubordinateRegionsFindSuperiorRegions(@RequestParam("areaCode") String areaCode) {
if (StringUtils.isBlank(areaCode)) {
return AjaxResult.error("区域编码不能为空!");
}
return AjaxResult.success(sysAreaService.getSubordinateRegionsFindSuperiorRegions(areaCode));
}
/**
* 查询区域信息(不分页
*
* @param sysArea 区域信息
* @return AjaxResult
*/
@GetMapping("/selectAreaList")
public AjaxResult selectAreaList(SysArea sysArea) {
return sysAreaService.selectAreaList(sysArea);
}
/**
* 是否是偏远地区状态修改
*
* @param sysArea 区域信息
* @return AjaxResult
*/
@PostMapping("/updateRemoteSigns")
public AjaxResult updateRemoteSigns(SysArea sysArea) {
return sysAreaService.updateRemoteSigns(sysArea);
}
}

View File

@ -0,0 +1,90 @@
package com.xinelu.manage.service.sysarea;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.sysarea.SysArea;
import com.xinelu.manage.vo.sysarea.ParentAreaVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import java.util.List;
/**
* 区域Service接口
*
* @author jihan
* @date 2022-09-02
*/
public interface ISysAreaService {
/**
* 查询区域
*
* @param id 区域主键
* @return 区域
*/
ParentAreaVO selectSysAreaById(Long id);
/**
* 查询区域列表
*
* @param sysArea 区域
* @return 区域集合
*/
List<SysArea> selectSysAreaList(SysArea sysArea);
/**
* 新增区域
*
* @param sysArea 区域
* @return 结果
*/
AjaxResult insertSysArea(SysArea sysArea);
/**
* 修改区域
*
* @param sysArea 区域
* @return 结果
*/
AjaxResult updateSysArea(SysArea sysArea);
/**
* 批量删除区域
*
* @param ids 需要删除的区域主键集合
* @return 结果
*/
public int deleteSysAreaByIds(Long[] ids);
/**
* 删除区域信息
*
* @param id 区域主键
* @return 结果
*/
public int deleteSysAreaById(Long id);
/**
* 下级区域寻找上级区域
*
* @param areaCode 区域编码
* @return com.xinyilu.base.domain.vo.sysarea.SysAreaVO
**/
SysAreaVO getSubordinateRegionsFindSuperiorRegions(String areaCode);
/**
* 查询区域信息(不分页
*
* @param sysArea 区域信息
* @return AjaxResult
*/
AjaxResult selectAreaList(SysArea sysArea);
/**
* 是否是偏远地区状态修改
*
* @param sysArea 区域信息
* @return AjaxResult
*/
AjaxResult updateRemoteSigns(SysArea sysArea);
}

View File

@ -0,0 +1,163 @@
package com.xinelu.manage.service.sysarea.impl;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.RemoteSignsEnum;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.manage.domain.sysarea.SysArea;
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
import com.xinelu.manage.service.sysarea.ISysAreaService;
import com.xinelu.manage.vo.sysarea.ParentAreaVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
* 区域Service业务层处理
*
* @author jihan
* @date 2022-09-02
*/
@Service
public class SysAreaServiceImpl implements ISysAreaService {
@Resource
private SysAreaMapper sysAreaMapper;
/**
* 查询区域
*
* @param id 区域主键
* @return 区域
*/
@Override
public ParentAreaVO selectSysAreaById(Long id) {
return sysAreaMapper.selectParentName(id);
}
/**
* 查询区域列表
*
* @param sysArea 区域
* @return 区域
*/
@Override
public List<SysArea> selectSysAreaList(SysArea sysArea) {
return sysAreaMapper.selectSysAreaList(sysArea);
}
/**
* 新增区域
*
* @param sysArea 区域
* @return 结果
*/
@Override
public AjaxResult insertSysArea(SysArea sysArea) {
//检验区域编码是否重复添加
SysArea sysAreaByCode = sysAreaMapper.selectSysAreaById(null, sysArea.getAreaCode());
if (Objects.nonNull(sysAreaByCode)) {
return AjaxResult.error("区域编码已存在,请勿重新添加!");
}
//是否是偏远地区
if (sysArea.getRemoteSigns().equals(RemoteSignsEnum.REMOTE.getInfo())) {
sysArea.setRemoteSigns(RemoteSignsEnum.REMOTE.getInfo());
} else {
sysArea.setRemoteSigns(RemoteSignsEnum.NOT_REMOTE.getInfo());
}
//若父级区域级别为空子级区域级别为零父级区域不为空子级区域级别加1
if (Objects.nonNull(sysArea.getAreaLevel())) {
sysArea.setAreaLevel(sysArea.getAreaLevel() + 1);
}
sysArea.setCreateTime(LocalDateTime.now());
sysArea.setCreateBy(SecurityUtils.getUsername());
return AjaxResult.success(sysAreaMapper.insertSysArea(sysArea));
}
/**
* 修改区域
*
* @param sysArea 区域
* @return 结果
*/
@Override
public AjaxResult updateSysArea(SysArea sysArea) {
//检验修改后区域编码是否与其他编码重复
SysArea sysAreaByCode = sysAreaMapper.selectSysAreaById(null, sysArea.getAreaCode());
if (Objects.nonNull(sysAreaByCode) && !sysArea.getId().equals(sysAreaByCode.getId())) {
return AjaxResult.error("区域编码已存在,请勿重新添加!");
}
//是否是偏远地区
if (sysArea.getRemoteSigns().equals(RemoteSignsEnum.REMOTE.getInfo())) {
sysArea.setRemoteSigns(RemoteSignsEnum.REMOTE.getInfo());
} else {
sysArea.setRemoteSigns(RemoteSignsEnum.NOT_REMOTE.getInfo());
}
sysArea.setUpdateTime(LocalDateTime.now());
sysArea.setUpdateBy(SecurityUtils.getUsername());
return AjaxResult.success(sysAreaMapper.updateSysArea(sysArea));
}
/**
* 批量删除区域
*
* @param ids 需要删除的区域主键
* @return 结果
*/
@Override
public int deleteSysAreaByIds(Long[] ids) {
return sysAreaMapper.deleteSysAreaByIds(ids);
}
/**
* 删除区域信息
*
* @param id 区域主键
* @return 结果
*/
@Override
public int deleteSysAreaById(Long id) {
return sysAreaMapper.deleteSysAreaById(id);
}
/**
* 下级区域寻找上级区域
*
* @param areaCode 区域编码
* @return com.xinyilu.base.domain.vo.sysarea.SysAreaVO
**/
@Override
public SysAreaVO getSubordinateRegionsFindSuperiorRegions(String areaCode) {
return sysAreaMapper.getSubordinateRegionsFindSuperiorRegions(areaCode);
}
/**
* 查询区域信息(不分页
*
* @param sysArea 区域信息
* @return AjaxResult
*/
@Override
public AjaxResult selectAreaList(SysArea sysArea) {
return AjaxResult.success(sysAreaMapper.selectSysAreaList(sysArea));
}
/**
* 偏远地区状态修改
*
* @param sysArea 区域信息
* @return AjaxResult
*/
@Override
public AjaxResult updateRemoteSigns(SysArea sysArea) {
if (Objects.isNull(sysArea) || Objects.isNull(sysArea.getId())) {
return AjaxResult.success();
}
sysArea.setUpdateTime(LocalDateTime.now());
sysArea.setUpdateBy(SecurityUtils.getUsername());
return AjaxResult.success(sysAreaMapper.updateSysArea(sysArea));
}
}