Commit ef53beaa authored by huyuchen's avatar huyuchen

优化修改

parent 6a329c40
...@@ -115,7 +115,7 @@ public class YifuTokenEndpoint { ...@@ -115,7 +115,7 @@ public class YifuTokenEndpoint {
user.getNickname(),user.getSystemFlag(), SecurityConstants.BCRYPT + user.getPassword(), user.getNickname(),user.getSystemFlag(), SecurityConstants.BCRYPT + user.getPassword(),
user.getPhone(), true, true, true, user.getPhone(), true, true, true,
CommonConstants.STATUS_NORMAL.equals(user.getLockFlag()), CommonConstants.STATUS_NORMAL.equals(user.getLockFlag()),
user.getUserGroup(),authorities, user.getLdapDn()); user.getUserGroup(),authorities, user.getLdapDn(), info.getClientRoleMap());
thisUser.setClientRoleMap(info.getClientRoleMap()); thisUser.setClientRoleMap(info.getClientRoleMap());
return thisUser; return thisUser;
} }
......
package com.yifu.cloud.plus.v1.business.controller.system;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarning;
import com.yifu.cloud.plus.v1.business.service.system.TBusWarningService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* B端预警表
*
* @author hgw
* @date 2021-08-20 17:39:51
*/
@RestController
@AllArgsConstructor
@RequestMapping("/tbuswarning")
@Tag(name = "B端预警表")
public class TBusWarningController {
private final TBusWarningService tBusWarningService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tBusWarning B端预警表
* @return
*/
@Operation(summary = "简单分页查询", description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TBusWarning>> getTBusWarningPage(Page<TBusWarning> page, TBusWarning tBusWarning) {
return new R<>(tBusWarningService.getTBusWarningPage(page, tBusWarning));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation(summary = "id查询", description = "id查询")
@GetMapping("/{id}")
public R<TBusWarning> getById(@PathVariable("id") String id) {
return new R<>(tBusWarningService.getById(id));
}
/**
* 获取所有要自动发送的主表,以及人员信息进行定时任务发送短信
*
* @return
* @Author:hgw
* @Date 2021-8-24 18:18:01
*/
@Operation(summary = "获取所有要自动发送的主表,以及人员信息进行定时任务发送", description = "获取所有要自动发送的主表,以及人员信息进行定时任务发送")
@PostMapping("/inner/doBatchSendBusSms")
public R<Boolean> doBatchSendBusSms() {
return tBusWarningService.doBatchSendBusSms();
}
/**
* 更新当日所有发送的短信状态
*
* @return
* @Author:hgw
* @Date 2021-8-24 18:18:06
*/
@Operation(summary = "更新当日所有发送的短信状态", description = "更新当日所有发送的短信状态")
@PostMapping("/inner/doUpdateSendBusSmsStatus")
public R<Boolean> doUpdateSendBusSmsStatus() {
return tBusWarningService.doUpdateSendBusSmsStatus(DateUtil.getCurrentDateString(DateUtil.ISO_DATE_FORMAT));
}
}
package com.yifu.cloud.plus.v1.business.controller.system;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningEmployee;
import com.yifu.cloud.plus.v1.business.service.system.TBusWarningEmployeeService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* B端短信发送记录表
*
* @author hgw
* @date 2021-08-23 16:27:34
*/
@RestController
@AllArgsConstructor
@RequestMapping("/tbuswarningemployee")
@Tag(name = "B端短信发送记录表")
public class TBusWarningEmployeeController {
private final TBusWarningEmployeeService tBusWarningEmployeeService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tBusWarningEmployee B端短信发送记录表
* @return
*/
@Operation(summary = "简单分页查询", description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TBusWarningEmployee>> getTBusWarningEmployeePage(Page<TBusWarningEmployee> page, TBusWarningEmployee tBusWarningEmployee) {
return new R<>(tBusWarningEmployeeService.getTBusWarningEmployeePage(page, tBusWarningEmployee));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation(summary = "id查询", description = "id查询")
@GetMapping("/{id}")
public R<TBusWarningEmployee> getById(@PathVariable("id") String id) {
return new R<>(tBusWarningEmployeeService.getById(id));
}
/**
* @param se
* @Description: 手动发送
* @Author: hgw
* @Date: 2021-8-23 17:15:28
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TSmsEmployee>
**/
@Operation(summary = "手动发送-单个", description = "手动发送-单个")
@PostMapping("/sendBusSms")
public R<String> sendBusSms(@RequestBody TBusWarningEmployee se) {
return tBusWarningEmployeeService.sendBusSms(se);
}
}
package com.yifu.cloud.plus.v1.business.controller.system;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningMessage;
import com.yifu.cloud.plus.v1.business.service.system.TBusWarningMessageService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ServiceNameConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* B端预警-系统消息表
*
* @author hgw
* @date 2021-08-20 17:39:51
*/
@RestController
@AllArgsConstructor
@RequestMapping("/tbuswarningMessage")
@Tag(name = "B端预警-系统消息表")
public class TBusWarningMessageController {
private final TBusWarningMessageService tBusWarningMessageService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tBusWarningMessage B端预警-系统消息表
* @return
*/
@Operation(summary = "简单分页查询", description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TBusWarningMessage>> getTBusWarningPage(Page<TBusWarningMessage> page, TBusWarningMessage tBusWarningMessage) {
YifuUser user = SecurityUtils.getUser();
Map<String, List<Long>> roleMap = user.getClientRoleMap();
List<Long> roleList = null;
if (roleMap != null && !roleMap.isEmpty()) {
roleList = roleMap.get(ServiceNameConstants.CLIENT_ID_HR_B);
}
return new R<>(tBusWarningMessageService.getTBusWarningMessagePage(page, tBusWarningMessage, roleList));
}
}
package com.yifu.cloud.plus.v1.business.mapper.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningEmployee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* B端短信发送记录表
*
* @author hgw
* @date 2021-08-23 16:27:34
*/
@Mapper
public interface TBusWarningEmployeeMapper extends BaseMapper<TBusWarningEmployee> {
/**
* B端短信发送记录表简单分页查询
*
* @param tBusWarningEmployee B端短信发送记录表
* @return
*/
IPage<TBusWarningEmployee> getTBusWarningEmployeePage(Page<TBusWarningEmployee> page, @Param("tBusWarningEmployee") TBusWarningEmployee tBusWarningEmployee);
int saveNewEmployee(@Param("se") TBusWarningEmployee se);
/**
* 获取指定日期的发送的短信
* @Author fxj
* @Date 2021-05-11
* @param dateStr
* @return
**/
List<TBusWarningEmployee> getTBusWarningEmployeeListToday(@Param("dateStr") String dateStr);
List<TBusWarningEmployee> getByBizId(@Param("bizId") String bizId);
int updateSendStatusByBizId(@Param("sendStatus")String sendStatus,@Param("updateStatus")String updateStatus,@Param("bizId")String bizId);
/**
* @param newBizId
* @param oldBizId
* @Description: 更新
* @Author: hgw
* @Date: 2021/5/10 14:54
* @return: int
**/
int updateBizIdByBizId(@Param("newBizId") String newBizId, @Param("oldBizId") String oldBizId);
/**
* @param warningId
* @param userId
* @param bizId
* @Description: 复审到期日
* @Author: hgw
* @Date: 2021/8/24 17:51
* @return: int
**/
int insertByReviewDate(@Param("warningId") String warningId, @Param("userId") Integer userId, @Param("bizId") String bizId, @Param("days") Integer days);
/**
* @param warningId
* @param userId
* @param bizId
* @Description: 证件到期日
* @Author: hgw
* @Date: 2021/8/24 17:51
* @return: int
**/
int insertByTermValidityEnd(@Param("warningId") String warningId, @Param("userId") Integer userId, @Param("bizId") String bizId, @Param("days") Integer days);
/**
* @param warningId
* @param userId
* @param bizId
* @Description: 年假未休时长
* @Author: hgw
* @Date: 2021/8/24 17:51
* @return: int
**/
int insertByYearVacation(@Param("warningId") String warningId, @Param("userId") Integer userId, @Param("bizId") String bizId);
/**
* @Description: 获取假期结束人员姓名
* @Author: hgw
* @Date: 2021/8/25 13:13
* @return: java.lang.String
**/
String getVacationInfoEmpName();
}
package com.yifu.cloud.plus.v1.business.mapper.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarning;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* B端预警表
*
* @author hgw
* @date 2021-08-20 17:39:51
*/
@Mapper
public interface TBusWarningMapper extends BaseMapper<TBusWarning> {
/**
* B端预警表简单分页查询
*
* @param tBusWarning B端预警表
* @return
*/
IPage<TBusWarning> getTBusWarningPage(Page<TBusWarning> page, @Param("tBusWarning") TBusWarning tBusWarning);
/**
* @param
* @Description: 自动发送短信的list
* @Author: hgw
* @Date: 2021/8/24 11:41
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusWarning>
**/
List<TBusWarning> getListByAutoSend();
/**
* @param
* @Description: 系统消息
* @Author: hgw
* @Date: 2021/8/25 12:53
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusWarning>
**/
List<TBusWarning> getListBySystem();
}
package com.yifu.cloud.plus.v1.business.mapper.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* B端预警表
*
* @author hgw
* @date 2021-08-20 17:39:51
*/
@Mapper
public interface TBusWarningMessageMapper extends BaseMapper<TBusWarningMessage> {
/**
* B端预警表简单分页查询
*
* @param tBusWarningMessage B端预警表
* @return
*/
IPage<TBusWarningMessage> getTBusWarningMessagePage(Page<TBusWarningMessage> page
, @Param("tBusWarningMessage") TBusWarningMessage tBusWarningMessage
, @Param("roleList") List<Long> roleList);
}
package com.yifu.cloud.plus.v1.business.service.system;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningEmployee;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
/**
* B端短信发送记录表
*
* @author hgw
* @date 2021-08-23 16:27:34
*/
public interface TBusWarningEmployeeService extends IService<TBusWarningEmployee> {
/**
* B端短信发送记录表简单分页查询
*
* @param tBusWarningEmployee B端短信发送记录表
* @return
*/
IPage<TBusWarningEmployee> getTBusWarningEmployeePage(Page<TBusWarningEmployee> page, TBusWarningEmployee tBusWarningEmployee);
/**
* @param dateStr
* @Description: 获取list
* @Author: hgw
* @Date: 2021/8/24 18:09
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusWarningEmployee>
**/
List<TBusWarningEmployee> getTBusWarningEmployeeListToday(String dateStr);
/**
* @param bizId
* @Description: 获取list-根据bizId
* @Author: hgw
* @Date: 2021/8/24 18:08
* @return: java.util.List<com.yifu.cloud.v1.hrobusiness.api.entity.system.TBusWarningEmployee>
**/
List<TBusWarningEmployee> getByBizId(String bizId);
/**
* @param smsEmployee
* @Description: 单个发送
* @Author: hgw
* @Date: 2021/5/10 10:23
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.String>
**/
R<String> sendBusSms(TBusWarningEmployee smsEmployee);
/**
* @param warningId
* @param userId
* @param bizId
* @Description: 复审到期日
* @Author: hgw
* @Date: 2021/8/24 17:51
* @return: int
**/
int insertByReviewDate(String warningId, Integer userId, String bizId, Integer days);
/**
* @param warningId
* @param userId
* @param bizId
* @Description: 证件到期日
* @Author: hgw
* @Date: 2021/8/24 17:51
* @return: int
**/
int insertByTermValidityEnd(String warningId, Integer userId, String bizId, Integer days);
/**
* @param warningId
* @param userId
* @param bizId
* @Description: 年假未休时长
* @Author: hgw
* @Date: 2021/8/24 17:51
* @return: int
**/
int insertByYearVacation(String warningId, Integer userId, String bizId);
/**
* @Description: 获取假期结束人员姓名
* @Author: hgw
* @Date: 2021/8/25 13:14
* @return: java.lang.String
**/
String getVacationInfoEmpName();
}
package com.yifu.cloud.plus.v1.business.service.system;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningMessage;
import java.util.List;
/**
* B端预警表
*
* @author hgw
* @date 2021-08-20 17:39:51
*/
public interface TBusWarningMessageService extends IService<TBusWarningMessage> {
/**
* B端预警表简单分页查询
*
* @param tBusWarningMessage B端预警表
* @return
*/
IPage<TBusWarningMessage> getTBusWarningMessagePage(Page<TBusWarningMessage> page
, TBusWarningMessage tBusWarningMessage, List<Long> roleList);
}
package com.yifu.cloud.plus.v1.business.service.system;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarning;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
/**
* B端预警表
*
* @author hgw
* @date 2021-08-20 17:39:51
*/
public interface TBusWarningService extends IService<TBusWarning> {
/**
* B端预警表简单分页查询
*
* @param tBusWarning B端预警表
* @return
*/
IPage<TBusWarning> getTBusWarningPage(Page<TBusWarning> page, TBusWarning tBusWarning);
/**
* @param
* @Description: 获取所有要自动发送的主表,以及人员信息进行定时任务发送短信
* @Author: hgw
* @Date: 2021/8/25 11:32
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
**/
R<Boolean> doBatchSendBusSms();
/**
* @param dateStr
* @Description: 更新当日所有发送的短信状态
* @Author: hgw
* @Date: 2021/8/25 11:32
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
**/
R<Boolean> doUpdateSendBusSmsStatus(String dateStr);
}
package com.yifu.cloud.plus.v1.business.service.system.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarning;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningEmployee;
import com.yifu.cloud.plus.v1.business.mapper.system.TBusWarningEmployeeMapper;
import com.yifu.cloud.plus.v1.business.mapper.system.TBusWarningMapper;
import com.yifu.cloud.plus.v1.business.service.system.TBusWarningEmployeeService;
import com.yifu.cloud.plus.v1.business.util.SmsTaskExecute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.alisms.AliSmsResult;
import com.yifu.cloud.plus.v1.yifu.common.core.util.alisms.ParamVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.alisms.YiFuSmsTookit;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* B端短信发送记录表
*
* @author hgw
* @date 2021-08-23 16:27:34
*/
@Service("tBusWarningEmployeeService")
public class TBusWarningEmployeeServiceImpl extends ServiceImpl<TBusWarningEmployeeMapper, TBusWarningEmployee> implements TBusWarningEmployeeService {
@Autowired
private TBusWarningMapper busWarningMapper;
@Autowired
private SmsTaskExecute smsTaskExecute;
/**
* B端短信发送记录表简单分页查询
*
* @param tBusWarningEmployee B端短信发送记录表
* @return
*/
@Override
public IPage<TBusWarningEmployee> getTBusWarningEmployeePage(Page<TBusWarningEmployee> page, TBusWarningEmployee tBusWarningEmployee) {
return baseMapper.getTBusWarningEmployeePage(page, tBusWarningEmployee);
}
@Override
public List<TBusWarningEmployee> getTBusWarningEmployeeListToday(String dateStr) {
return baseMapper.getTBusWarningEmployeeListToday(dateStr);
}
@Override
public List<TBusWarningEmployee> getByBizId(String bizId) {
return baseMapper.getByBizId(bizId);
}
/**
* @Description: 手动发送-单个
* @Author: hgw
* @Date: 2021/5/10 9:50
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TBusWarningEmployee>
**/
@Override
public R<String> sendBusSms(TBusWarningEmployee smsEmployee) {
if (smsEmployee.getId() == null) {
return R.failed("员工列表id不可为空!");
}
if (Common.isEmpty(smsEmployee.getWarningId())) {
return R.failed("配置主表id不可为空!");
}
TBusWarning si = busWarningMapper.selectById(smsEmployee.getWarningId());
TBusWarningEmployee se = this.getById(smsEmployee.getId());
if (si == null) {
return R.failed("未找到配置主表");
}
if (se == null) {
return R.failed("未找到员工信息");
}
YifuUser user = SecurityUtils.getUser();
if (user == null || user.getId() == null) {
return R.failed("未找到登录人员信息");
}
// 暂存的毫秒数
String bizId = String.valueOf(System.currentTimeMillis());
TBusWarningEmployee newSe = new TBusWarningEmployee();
newSe.setBusinessTelecomNumber(se.getBusinessTelecomNumber());
newSe.setCertType(se.getCertType());
newSe.setNotUsedVacationDuration(se.getNotUsedVacationDuration());
newSe.setBizId(bizId);
newSe.setSendStatus(CommonConstants.ONE_STRING);
newSe.setCreateUser(String.valueOf(user.getId()));
newSe.setEmpIdcard(se.getEmpIdcard());
newSe.setEmpName(se.getEmpName());
newSe.setEmpPhone(se.getEmpPhone());
newSe.setRemark(se.getRemark());
newSe.setSendDate(LocalDateTime.now());
newSe.setWarningId(si.getId());
newSe.setBusDeptCode(se.getBusDeptCode());
newSe.setBusDeptId(se.getBusDeptId());
newSe.setBusDeptName(se.getBusDeptName());
newSe.setUpdateStatus(CommonConstants.ZERO_STRING);
// 自定义sql新增的,如果有新字段,请记得加sql(因为id是数据库自增的)
baseMapper.saveNewEmployee(newSe);
String empName = se.getEmpName();
if (Common.isNotNull(empName)) {
empName = empName.replaceAll("\\d+", "").replace("X", "");
}
List<String> phones = new ArrayList<>();
phones.add(newSe.getEmpPhone());
ParamVo paramVo = new ParamVo();
paramVo.setName(empName);
List<ParamVo> params = new ArrayList<>();
if (si.getRemindType() != 2) {
paramVo.setZhengjian(newSe.getCertType());
} else {
paramVo.setTime(newSe.getNotUsedVacationDuration());
}
params.add(paramVo);
// 调用发送接口
AliSmsResult asr = YiFuSmsTookit.sendBusBatchSms(phones, params, si.getSignName(), si.getModelCode());
if (asr != null && Common.isNotNull(asr.getBizId())) {
baseMapper.updateBizIdByBizId(asr.getBizId(), bizId);
// 异步更新短信发送状态
smsTaskExecute.querySendDetailTask(baseMapper, asr.getBizId(), se.getEmpPhone());
}
return R.ok(null,"正在发送中,请等待……");
}
/**
* @Description: 复审到期日
* @Author: hgw
* @Date: 2021/8/24 17:54
* @return: int
**/
@Override
public int insertByReviewDate(String warningId, Integer userId, String bizId, Integer days) {
return baseMapper.insertByReviewDate(warningId, userId, bizId, days);
}
/**
* @Description: 证件到期日
* @Author: hgw
* @Date: 2021/8/24 17:54
* @return: int
**/
@Override
public int insertByTermValidityEnd(String warningId, Integer userId, String bizId, Integer days) {
return baseMapper.insertByTermValidityEnd(warningId, userId, bizId, days);
}
/**
* @Description: 年假未休时长
* @Author: hgw
* @Date: 2021/8/24 17:54
* @return: int
**/
@Override
public int insertByYearVacation(String warningId, Integer userId, String bizId) {
return baseMapper.insertByYearVacation(warningId, userId, bizId);
}
/**
* @Description: 获取假期结束人员姓名
* @Author: hgw
* @Date: 2021/8/24 17:54
* @return: int
**/
@Override
public String getVacationInfoEmpName() {
return baseMapper.getVacationInfoEmpName();
}
}
package com.yifu.cloud.plus.v1.business.service.system.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningMessage;
import com.yifu.cloud.plus.v1.business.mapper.system.TBusWarningMessageMapper;
import com.yifu.cloud.plus.v1.business.service.system.TBusWarningMessageService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* B端预警表
*
* @author hgw
* @date 2021-08-20 17:39:51
*/
@Service("tBusWarningMessageService")
public class TBusWarningMessageServiceImpl extends ServiceImpl<TBusWarningMessageMapper, TBusWarningMessage> implements TBusWarningMessageService {
/**
* B端预警表简单分页查询
*
* @param tBusWarningMessage B端预警表
* @return
*/
@Override
public IPage<TBusWarningMessage> getTBusWarningMessagePage(Page<TBusWarningMessage> page
, TBusWarningMessage tBusWarningMessage, List<Long> roleList) {
return baseMapper.getTBusWarningMessagePage(page, tBusWarningMessage, roleList);
}
}
package com.yifu.cloud.plus.v1.business.service.system.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarning;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningEmployee;
import com.yifu.cloud.plus.v1.business.entity.system.TBusWarningMessage;
import com.yifu.cloud.plus.v1.business.mapper.system.TBusWarningMapper;
import com.yifu.cloud.plus.v1.business.service.system.TBusWarningEmployeeService;
import com.yifu.cloud.plus.v1.business.service.system.TBusWarningMessageService;
import com.yifu.cloud.plus.v1.business.service.system.TBusWarningService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.alisms.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
/**
* B端预警表
*
* @author hgw
* @date 2021-08-20 17:39:51
*/
@Service("tBusWarningService")
public class TBusWarningServiceImpl extends ServiceImpl<TBusWarningMapper, TBusWarning> implements TBusWarningService {
@Autowired
private TBusWarningEmployeeService busWarningEmployeeService;
@Autowired
private TBusWarningMessageService busWarningMessageService;
/**
* B端预警表简单分页查询
*
* @param tBusWarning B端预警表
* @return
*/
@Override
public IPage<TBusWarning> getTBusWarningPage(Page<TBusWarning> page, TBusWarning tBusWarning) {
return baseMapper.getTBusWarningPage(page, tBusWarning);
}
/**
* 获取所有要自动发送的主表,以及人员信息进行定时任务发送短信
*
* @return
* @Author:hgw
* @Date 2021-8-23 16:47:44
*/
@Override
public R<Boolean> doBatchSendBusSms() {
List<TBusWarning> smsInfoList = this.getTBusWarningListByAuto();
if (Common.isNotNull(smsInfoList)) {
List<TBusWarningEmployee> smsEmployeeList;
for (TBusWarning smsInfo : smsInfoList) {
smsEmployeeList = smsInfo.getEmpList();
this.doSendOne(smsEmployeeList, smsInfo);
}
}
return R.ok(null,CommonConstants.RESULT_DATA_SUCESS);
}
private void doSendOne(List<TBusWarningEmployee> smsEmployeeList, TBusWarning smsInfo) {
if (Common.isNotNull(smsEmployeeList) && !smsEmployeeList.isEmpty()) {
if (smsEmployeeList.size() > 100) {
int size = smsEmployeeList.size() / 100;
for (int i = 0; i <= size; i++) {
if ((i + 1) * 100 < smsEmployeeList.size()) {
this.saveBizId(smsEmployeeList.subList(i * 100, (i + 1) * 100), smsInfo);
} else {
this.saveBizId(smsEmployeeList.subList(i * 100, smsEmployeeList.size()), smsInfo);
}
}
} else {
this.saveBizId(smsEmployeeList, smsInfo);
}
}
}
private void saveBizId(List<TBusWarningEmployee> smsEmployeeList, TBusWarning smsInfo) {
List<String> phones = new ArrayList<>();
String empName;
ParamVo paramVo;
List<ParamVo> params = new ArrayList<>();
for (TBusWarningEmployee entity : smsEmployeeList) {
phones.add(entity.getEmpPhone());
empName = entity.getEmpName();
if (Common.isNotNull(empName)) {
empName = empName.replaceAll("\\d+", "").replace("X", "");
}
paramVo = new ParamVo();
paramVo.setName(empName);
if (smsInfo.getRemindType() != 2) {
paramVo.setZhengjian(entity.getCertType());
} else {
paramVo.setTime(entity.getNotUsedVacationDuration());
}
params.add(paramVo);
}
AliSmsResult res = YiFuSmsTookit.sendBusBatchSms(phones, params, smsInfo.getSignName(), smsInfo.getModelCode());
if (null != res && null != res.getBizId()) {
for (TBusWarningEmployee smsEmployee : smsEmployeeList) {
smsEmployee.setBizId(res.getBizId());
smsEmployee.setMessage(res.getMessage());
}
}
busWarningEmployeeService.updateBatchById(smsEmployeeList);
}
/**
* 更新当日所有发送的短信状态
*
* @param dateStr 格式 yyyyMMdd
* @return
* @Author:hgw
* @Date 2021-8-23 16:47:52
*/
@Override
public R<Boolean> doUpdateSendBusSmsStatus(String dateStr) {
List<TBusWarningEmployee> smsEmployeeList = busWarningEmployeeService.getTBusWarningEmployeeListToday(dateStr);
if (Common.isNotNull(smsEmployeeList)) {
QuerySendResult res;
for (TBusWarningEmployee smsEmployee : smsEmployeeList) {
res = YiFuSmsUtil.querySendDetail(smsEmployee.getEmpPhone(), smsEmployee.getBizId(), dateStr, null, null);
if (null != res) {
smsEmployee.setMessage(res.getMessage());
if (null != res.getSmsSendDetailDTOs() &&
Common.isNotNull(res.getSmsSendDetailDTOs().getSmsSendDetailDTO())) {
smsEmployee.setSendStatus(res.getSmsSendDetailDTOs().getSmsSendDetailDTO().get(0).getSendStatus().toString());
smsEmployee.setUpdateStatus(CommonConstants.ONE_STRING);
}
}
}
}
busWarningEmployeeService.updateBatchById(smsEmployeeList);
return R.ok(null,CommonConstants.RESULT_DATA_SUCESS);
}
/**
* @param
* @Description: 返回需要发送的主表list
* @Author: hgw
* @Date: 2021-8-24 18:15:02
* @return: java.util.List<com.yifu.cloud.v1.hrms.api.entity.TBusWarning>
**/
private List<TBusWarning> getTBusWarningListByAuto() {
// 回传list
List<TBusWarning> siList = new ArrayList<>();
// 自动发短信的list
List<TBusWarning> autoList = baseMapper.getListByAutoSend();
// 系统消息的list
List<TBusWarning> sysList = baseMapper.getListBySystem();
Map<Integer, TBusWarning> sysMap = new HashMap<>();
for (TBusWarning b : sysList) {
sysMap.put(b.getRemindType(), b);
}
YifuUser user = SecurityUtils.getUser();
Integer userId = 737;
if (user != null && user.getId() != null) {
userId = Integer.valueOf(user.getId());
}
String monthDay = DateUtil.dateToString(new Date(), "MM-dd");
List<TBusWarningEmployee> empList;
// 暂存的id
String bizId;
TBusWarning sysBus;
// 主循环,获取节日人员
// RemindType提醒类型:0复审;1到期;2年假未休;3假期结束日期
for (TBusWarning si : autoList) {
bizId = String.valueOf(System.currentTimeMillis());
sysBus = sysMap.get(si.getRemindType());
if (si.getRemindRules() != null) {
if (si.getRemindType() == 0) {
busWarningEmployeeService.insertByReviewDate(si.getId(), userId, bizId, si.getRemindRules());
} else if (si.getRemindType() == 1) {
busWarningEmployeeService.insertByTermValidityEnd(si.getId(), userId, String.valueOf(System.currentTimeMillis()), si.getRemindRules());
}
}
if (si.getRemindType() == 2 && Common.isNotNull(si.getSendDate()) && si.getSendDate().equals(monthDay)) {
busWarningEmployeeService.insertByYearVacation(si.getId(), userId, String.valueOf(System.currentTimeMillis()));
}
empList = busWarningEmployeeService.getByBizId(bizId);
// 1添加复审、到期、年假系统消息
this.getRemindInfo(empList, sysBus);
si.setEmpList(empList);
siList.add(si);
}
// 2添加假期结束未销假的消息
this.getVacationInfo(sysMap.get(3));
return siList;
}
private void getRemindInfo(List<TBusWarningEmployee> empList, TBusWarning sysBus) {
if (empList != null && !empList.isEmpty()) {
TBusWarningMessage message = new TBusWarningMessage();
message.setRemindContent(empList.get(0).getEmpName() + sysBus.getRemindTemplate());
message.setRemindObject(sysBus.getRemindObject());
message.setRemindType(sysBus.getRemindType());
message.setWarningId(sysBus.getId());
message.setCreateDate(LocalDateTime.now());
busWarningMessageService.save(message);
}
}
/**
* @Description: 获取假期结束未销假的信息
* @Author: hgw
* @Date: 2021/8/25 13:17
* @return: void
**/
private void getVacationInfo(TBusWarning sysBus) {
String empName = busWarningEmployeeService.getVacationInfoEmpName();
if (Common.isNotNull(empName)) {
TBusWarningMessage message = new TBusWarningMessage();
message.setRemindContent(empName + sysBus.getRemindTemplate());
message.setRemindObject(sysBus.getRemindObject());
message.setRemindType(sysBus.getRemindType());
message.setWarningId(sysBus.getId());
message.setCreateDate(LocalDateTime.now());
busWarningMessageService.save(message);
}
}
}
package com.yifu.cloud.plus.v1.business.util;
import com.yifu.cloud.plus.v1.business.mapper.system.TBusWarningEmployeeMapper;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.alisms.QuerySendResult;
import com.yifu.cloud.plus.v1.yifu.common.core.util.alisms.YiFuSmsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
/**
* 异步执行短信发送任务
*
* @Author fxj
* @Date 2021-05-24
* @return
**/
@Component
@Slf4j
public class SmsTaskExecute {
@Async
public void querySendDetailTask(TBusWarningEmployeeMapper mapper, String bizId, String phone) {
try {
TimeUnit.SECONDS.sleep(10);
QuerySendResult res = YiFuSmsUtil.querySendDetail(phone, bizId,
DateUtil.getCurrentDateString(DateUtil.ISO_DATE_FORMAT), null, null);
this.updateSmsResult(mapper, bizId, res);
} catch (Exception ex) {
log.error("查询短信状态异常!", ex);
}
}
private void updateSmsResult(TBusWarningEmployeeMapper mapper, String bizId, QuerySendResult res) {
if (null != res && null != res.getSmsSendDetailDTOs() &&
Common.isNotNull(res.getSmsSendDetailDTOs().getSmsSendDetailDTO())) {
mapper.updateSendStatusByBizId(
res.getSmsSendDetailDTOs().getSmsSendDetailDTO().get(0).getSendStatus().toString(),
CommonConstants.ONE_STRING, bizId);
}
}
}
<?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.yifu.cloud.plus.v1.business.mapper.system.TBusWarningEmployeeMapper">
<resultMap id="tBusWarningEmployeeMap" type="com.yifu.cloud.plus.v1.business.entity.system.TBusWarningEmployee">
<id property="id" column="id"/>
<result property="warningId" column="warning_id"/>
<result property="busDeptId" column="bus_dept_id"/>
<result property="busDeptCode" column="bus_dept_code"/>
<result property="busDeptName" column="bus_dept_name"/>
<result property="empName" column="emp_name"/>
<result property="empIdcard" column="emp_idcard"/>
<result property="empPhone" column="emp_phone"/>
<result property="sendDate" column="send_date"/>
<result property="createUser" column="CREATE_USER"/>
<result property="sendStatus" column="send_status"/>
<result property="remark" column="remark"/>
<result property="bizId" column="Biz_Id"/>
<result property="updateStatus" column="update_status"/>
<result property="message" column="message"/>
<result property="businessTelecomNumber" column="BUSINESS_TELECOM_NUMBER"/>
<result property="certType" column="cert_type"/>
<result property="notUsedVacationDuration" column="NOT_USED_VACATION_DURATION"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.warning_id,
a.bus_dept_id,
a.bus_dept_code,
a.bus_dept_name,
a.emp_name,
a.emp_idcard,
a.emp_phone,
a.send_date,
a.CREATE_USER,
a.send_status,
a.remark,
a.Biz_Id,
a.update_status,
a.message,
a.BUSINESS_TELECOM_NUMBER,
a.cert_type,
a.NOT_USED_VACATION_DURATION
</sql>
<sql id="tBusWarningEmployee_where">
<if test="tBusWarningEmployee != null">
<if test="tBusWarningEmployee.id != null and tBusWarningEmployee.id.trim() != ''">
AND a.id = #{tBusWarningEmployee.id}
</if>
<if test="tBusWarningEmployee.warningId != null and tBusWarningEmployee.warningId.trim() != ''">
AND a.warning_id = #{tBusWarningEmployee.warningId}
</if>
<if test="tBusWarningEmployee.busDeptId != null and tBusWarningEmployee.busDeptId.trim() != ''">
AND a.bus_dept_id = #{tBusWarningEmployee.busDeptId}
</if>
<if test="tBusWarningEmployee.busDeptCode != null and tBusWarningEmployee.busDeptCode.trim() != ''">
AND a.bus_dept_code = #{tBusWarningEmployee.busDeptCode}
</if>
<if test="tBusWarningEmployee.busDeptName != null and tBusWarningEmployee.busDeptName.trim() != ''">
AND a.bus_dept_name = #{tBusWarningEmployee.busDeptName}
</if>
<if test="tBusWarningEmployee.empName != null and tBusWarningEmployee.empName.trim() != ''">
AND a.emp_name = #{tBusWarningEmployee.empName}
</if>
<if test="tBusWarningEmployee.empIdcard != null and tBusWarningEmployee.empIdcard.trim() != ''">
AND a.emp_idcard = #{tBusWarningEmployee.empIdcard}
</if>
<if test="tBusWarningEmployee.empPhone != null and tBusWarningEmployee.empPhone.trim() != ''">
AND a.emp_phone = #{tBusWarningEmployee.empPhone}
</if>
<if test="tBusWarningEmployee.sendDate != null">
AND a.send_date = #{tBusWarningEmployee.sendDate}
</if>
<if test="tBusWarningEmployee.createUser != null and tBusWarningEmployee.createUser.trim() != ''">
AND a.CREATE_USER = #{tBusWarningEmployee.createUser}
</if>
<if test="tBusWarningEmployee.sendStatus != null and tBusWarningEmployee.sendStatus.trim() != ''">
AND a.send_status = #{tBusWarningEmployee.sendStatus}
</if>
<if test="tBusWarningEmployee.remark != null and tBusWarningEmployee.remark.trim() != ''">
AND a.remark = #{tBusWarningEmployee.remark}
</if>
<if test="tBusWarningEmployee.bizId != null and tBusWarningEmployee.bizId.trim() != ''">
AND a.Biz_Id = #{tBusWarningEmployee.bizId}
</if>
<if test="tBusWarningEmployee.updateStatus != null and tBusWarningEmployee.updateStatus.trim() != ''">
AND a.update_status = #{tBusWarningEmployee.updateStatus}
</if>
<if test="tBusWarningEmployee.message != null and tBusWarningEmployee.message.trim() != ''">
AND a.message = #{tBusWarningEmployee.message}
</if>
<if test="null != tBusWarningEmployee.sendDateStart and tBusWarningEmployee.sendDateStart.trim() != ''">
AND a.send_date >= concat(#{tBusWarningEmployee.sendDateStart},' 00:00:00')
</if>
<if test="null != tBusWarningEmployee.sendDateEnd and tBusWarningEmployee.sendDateEnd.trim() != ''">
AND a.send_date <![CDATA[ <= ]]> concat(#{tBusWarningEmployee.sendDateEnd},' 23:59:59')
</if>
<if test="null != tBusWarningEmployee.businessTelecomNumber and tBusWarningEmployee.businessTelecomNumber.trim() != ''">
AND a.BUSINESS_TELECOM_NUMBER like concat('%', #{tBusWarningEmployee.businessTelecomNumber}, '%')
</if>
</if>
</sql>
<!--tBusWarningEmployee简单分页查询-->
<select id="getTBusWarningEmployeePage" resultMap="tBusWarningEmployeeMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_warning_employee a
<where>
1=1
<include refid="tBusWarningEmployee_where"/>
</where>
order by a.send_date desc
</select>
<!--简单list-->
<select id="getTBusWarningEmployeeListToday" resultMap="tBusWarningEmployeeMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_warning_employee a
<where>
DATE_FORMAT(a.send_date,"%Y%m%d") = #{dateStr}
</where>
</select>
<!--简单list-->
<select id="getByBizId" resultMap="tBusWarningEmployeeMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_warning_employee a
where a.Biz_Id = #{bizId}
</select>
<!--更新-->
<update id="updateSendStatusByBizId" >
update t_bus_warning_employee e set e.send_status = #{sendStatus},e.update_status = #{updateStatus} where e.Biz_Id = #{bizId}
</update>
<!-- 基础sql -->
<insert id="saveNewEmployee">
INSERT into
t_bus_warning_employee
set warning_id = #{se.warningId},bus_dept_id = #{se.busDeptId},bus_dept_code = #{se.busDeptCode},bus_dept_name = #{se.busDeptName}
,emp_name = #{se.empName},EMP_IDCARD = #{se.empIdcard},EMP_PHONE = #{se.empPhone},send_date = #{se.sendDate}
,CREATE_USER = #{se.createUser},send_status = #{se.sendStatus},Biz_Id = #{se.bizId},update_status = #{se.updateStatus}
,BUSINESS_TELECOM_NUMBER = #{se.businessTelecomNumber},cert_type = #{se.certType},NOT_USED_VACATION_DURATION = #{se.notUsedVacationDuration}
</insert>
<!--更新-->
<update id="updateBizIdByBizId" >
update t_bus_warning_employee e set e.Biz_Id = #{newBizId} where e.Biz_Id = #{oldBizId}
</update>
<!-- 复审到期日 -->
<insert id="insertByReviewDate">
INSERT into t_bus_warning_employee
(warning_id,bus_dept_id,bus_dept_code,bus_dept_name,emp_name,EMP_IDCARD,EMP_PHONE,send_date,CREATE_USER,send_status,Biz_Id,update_status,business_telecom_number,cert_type)
SELECT #{warningId} warning_id,d.id bus_dept_id,d.tree_logo bus_dept_code,d.name bus_dept_name,c.emp_name,c.EMP_IDCARD,e.phone EMP_PHONE
,now() send_date, #{userId} CREATE_USER,'1' send_status,#{bizId} Biz_Id,'0' update_status,c.business_telecom_number,sd.label cert_type
FROM t_cert_info c
left join t_bus_dept d on d.id=c.organ_id
left join sys_bus_dict sd on sd.value=c.cert_type and sd.item_type = 'cert_type'
join view_employee_phone e on e.dx_no = c.business_telecom_number
where datediff(c.review_date,now()) = #{days} and c.delete_flag ='0'
and not exists (
select 1 from t_bus_leave l where l.tele_no = c.business_telecom_number
)
GROUP BY c.id
</insert>
<!-- 证件到期日 -->
<insert id="insertByTermValidityEnd">
INSERT into t_bus_warning_employee
(warning_id,bus_dept_id,bus_dept_code,bus_dept_name,emp_name,EMP_IDCARD,EMP_PHONE,send_date,CREATE_USER,send_status,Biz_Id,update_status,business_telecom_number,cert_type)
SELECT #{warningId} warning_id,d.id bus_dept_id,d.tree_logo bus_dept_code,d.name bus_dept_name,c.emp_name,c.EMP_IDCARD,e.phone EMP_PHONE
,now() send_date, #{userId} CREATE_USER,'1' send_status,#{bizId} Biz_Id,'0' update_status,c.business_telecom_number,sd.label cert_type
FROM t_cert_info c
left join sys_bus_dict sd on sd.value=c.cert_type and sd.item_type = 'cert_type'
left join t_bus_dept d on d.id=c.organ_id
join view_employee_phone e on e.dx_no = c.business_telecom_number
where datediff(c.term_validity_end,now()) = #{days} and c.delete_flag ='0'
and not exists (
select 1 from t_bus_leave l where l.tele_no = c.business_telecom_number
)
GROUP BY c.id
</insert>
<!-- 年假未休时长 -->
<insert id="insertByYearVacation">
INSERT into t_bus_warning_employee
(warning_id,bus_dept_id,bus_dept_code,bus_dept_name,emp_name,EMP_IDCARD,EMP_PHONE,send_date,CREATE_USER,send_status,Biz_Id,update_status,business_telecom_number,NOT_USED_VACATION_DURATION)
SELECT #{warningId} warning_id,d.id bus_dept_id,d.tree_logo bus_dept_code,d.name bus_dept_name,c.emp_name,c.EMP_IDCARD,e.phone EMP_PHONE
,now() send_date, #{userId} CREATE_USER,'1' send_status,#{bizId} Biz_Id,'0' update_status,c.business_telecom_number,concat(c.NOT_USED_VACATION_DURATION,'小时')
FROM t_vacation_monitor c
left join t_bus_dept d on d.id=c.DEPART_ID
join view_employee_phone e on e.dx_no = c.business_telecom_number
where c.NOT_USED_VACATION_DURATION>0 and DATE_FORMAT(now(),'%Y') = c.VACATION_YEAR
and not exists (
select 1 from t_bus_leave l where l.tele_no = c.business_telecom_number
)
GROUP BY c.id
</insert>
<!--假期结束提醒-->
<select id="getVacationInfoEmpName" resultType="java.lang.String">
SELECT c.EMP_NAME
FROM t_vacation_info c
where c.VACATION_STATUS != '3' and datediff(c.VACATION_END_TIME,now()) = -1 and c.EMP_NAME is not null
and not exists (
select 1 from t_bus_leave l where l.tele_no = c.business_telecom_number
)
limit 1
</select>
</mapper>
<?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.yifu.cloud.plus.v1.business.mapper.system.TBusWarningMapper">
<resultMap id="tBusWarningMap" type="com.yifu.cloud.plus.v1.business.entity.system.TBusWarning">
<id property="id" column="id"/>
<result property="type" column="type"/>
<result property="remindType" column="remind_type"/>
<result property="remindTemplate" column="remind_template"/>
<result property="sendMethod" column="send_method"/>
<result property="remindRules" column="remind_rules"/>
<result property="remindObject" column="remind_object"/>
<result property="modelCode" column="model_code"/>
<result property="signName" column="sign_name"/>
<result property="sendDate" column="send_date"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.type,
a.remind_type,
a.remind_template,
a.send_method,
a.remind_rules,
a.remind_object,
a.model_code,
a.sign_name,
a.send_date,
a.remark
</sql>
<sql id="tBusWarning_where">
<if test="tBusWarning != null">
<if test="tBusWarning.id != null and tBusWarning.id.trim() != ''">
AND a.id = #{tBusWarning.id}
</if>
<if test="tBusWarning.type != null">
AND a.type = #{tBusWarning.type}
</if>
<if test="tBusWarning.remindType != null">
AND a.remind_type = #{tBusWarning.remindType}
</if>
<if test="tBusWarning.remindTemplate != null and tBusWarning.remindTemplate.trim() != ''">
AND a.remind_template = #{tBusWarning.remindTemplate}
</if>
<if test="tBusWarning.sendMethod != null">
AND a.send_method = #{tBusWarning.sendMethod}
</if>
<if test="tBusWarning.remindRules != null">
AND a.remind_rules = #{tBusWarning.remindRules}
</if>
<if test="tBusWarning.remindObject != null and tBusWarning.remindObject.trim() != ''">
AND a.remind_object = #{tBusWarning.remindObject}
</if>
</if>
</sql>
<!--tBusWarning简单分页查询-->
<select id="getTBusWarningPage" resultMap="tBusWarningMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_warning a
<where>
1=1
<include refid="tBusWarning_where"/>
</where>
</select>
<!--自动发送短信的list-->
<select id="getListByAutoSend" resultMap="tBusWarningMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_warning a
where a.type = 0 and a.send_method = 0
</select>
<!--系统消息的list-->
<select id="getListBySystem" resultMap="tBusWarningMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_warning a
where a.type = 1
</select>
</mapper>
<?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.yifu.cloud.plus.v1.business.mapper.system.TBusWarningMessageMapper">
<resultMap id="tBusWarningMessageMap" type="com.yifu.cloud.plus.v1.business.entity.system.TBusWarningMessage">
<id property="id" column="id"/>
<result property="warningId" column="warning_id"/>
<result property="remindType" column="remind_type"/>
<result property="remindContent" column="remind_content"/>
<result property="remindObject" column="remind_object"/>
<result property="remark" column="remark"/>
<result property="createDate" column="create_date"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
a.warning_id,
a.remind_type,
a.remind_content,
a.remind_object,
a.remark,
a.create_date
</sql>
<!--tBusWarningMessage简单分页查询-->
<select id="getTBusWarningMessagePage" resultMap="tBusWarningMessageMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_bus_warning_message a
where 1=1
<if test="tBusWarningMessage != null and tBusWarningMessage.createDate != null">
and a.create_date = #{tBusWarning.createDate}
</if>
<if test="roleList != null and roleList != '' ">
and ( 1=2
<foreach item="item" index="index" collection="roleList" >
or locate('${item}',a.remind_object)
</foreach>
)
</if>
order by a.create_date desc
</select>
</mapper>
...@@ -101,12 +101,4 @@ public class YifuUser extends User { ...@@ -101,12 +101,4 @@ public class YifuUser extends User {
this.ldapDn = ldapDn; this.ldapDn = ldapDn;
this.clientRoleMap=clientRoleMap; this.clientRoleMap=clientRoleMap;
} }
/**
* key是客户端id,val是角色id数组
*/
@Getter
@Setter
private Map<String, List<Integer>> clientRoleMap;
} }
...@@ -45,11 +45,6 @@ public class UserInfo implements Serializable { ...@@ -45,11 +45,6 @@ public class UserInfo implements Serializable {
*/ */
private String[] permissions; private String[] permissions;
/**
* key是客户端id,val是角色id数组
*/
private Map<String,List<Integer>> clientRoleMap;
/** /**
* 角色集合 * 角色集合
*/ */
......
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