Commit fbd5e21a authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/qionglai' into qionglai

parents 74f097f2 a01f9f74
......@@ -31,4 +31,8 @@ public class ParamKey {
public static String SYS_PARAM_XNJC_URL = "xnjc_url";
public static String STAFF_CARE_BIRTHDAY_SEND = "StaffCareBirthdaySend";
public static String STAFF_CARE_ENTRYDATE_SEND = "StaffCareEntryDateSend";
}
......@@ -12,8 +12,10 @@ import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.service.*;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import io.lettuce.core.RedisCommandTimeoutException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.QueryTimeoutException;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
......@@ -150,8 +152,11 @@ public class StaffCheckSummaryService implements IApplicationStartedService {
}
} catch (Exception e) {
log.error("绩效分数汇总异常", e);
if(e instanceof QueryTimeoutException){
}else {
log.error("绩效分数汇总异常", e);
}
try {
Thread.sleep(waitTime);
} catch (InterruptedException e2) {
......
package com.mortals.xhx.daemon.task;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.staff.model.StaffCareEntity;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffCareService;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
import static com.mortals.xhx.common.key.ParamKey.STAFF_CARE_BIRTHDAY_SEND;
import static com.mortals.xhx.common.key.ParamKey.STAFF_CARE_ENTRYDATE_SEND;
/**
* 员工关怀短信发送
*/
@Slf4j
@Service("SendStaffCareSMSTask")
public class SendStaffCareSMSTaskImpl implements ITaskExcuteService {
@Autowired
private StaffCareService staffCareService;
@Autowired
private ParamService paramService;
@Autowired
private StaffService staffService;
@Value("${sms.smsSendUrl:http://sms.wx3.com.cn/api/index/index}")
private String smsApiUrl;
@Value("${sms.apiId:ADsUXLrS81vZDU95}")
private String appid;
/**
* 短信模板ID
**/
private static String SMS_TPYE = "44";
@Override
public void excuteTask(ITask task) throws AppException {
Calendar calendar = Calendar.getInstance();
int month = calendar.get(Calendar.MONTH)+1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
if(month==1 && day==1){
//每年1月1日重置关怀短信发送状态
staffCareService.getDao().initSendStatus();
}
StaffCareEntity query = new StaffCareEntity();
query.setMonth(month);
query.setDay(day);
String StaffCareBirthdaySend = paramService.getValueByKey(STAFF_CARE_BIRTHDAY_SEND);
if(StringUtils.isEmpty(StaffCareBirthdaySend)){
StaffCareBirthdaySend="1";
}
String StaffCareEntryDateSend = paramService.getValueByKey(STAFF_CARE_ENTRYDATE_SEND);
if(StringUtils.isEmpty(StaffCareEntryDateSend)){
StaffCareEntryDateSend="1";
}
List<StaffCareEntity> staffCareList = staffCareService.getStaffCareList(query);
List<StaffCareEntity> updateList = new ArrayList<>();
if(StaffCareBirthdaySend.equals("1")) {
query.setCareType(1);
if (CollectionUtils.isNotEmpty(staffCareList)) {
for (StaffCareEntity item : staffCareList) {
StaffEntity staffEntity = staffService.getCache(item.getStaffId().toString());
if (staffEntity != null) {
String mobileNumber = staffEntity.getPhoneNumber();
if (StringUtils.isEmpty(mobileNumber)) {
continue;
}
if (PhoneUtil.isPhone(mobileNumber)) {
Map<String, String> params = new HashMap<>();
params.put("appid", appid);
params.put("phone", mobileNumber);
params.put("type", SMS_TPYE);
String[] json = new String[1];
json[0] = String.format("亲爱的[%s],祝你生日快乐!愿你在新的一岁里健康、快乐、成功!公司永远是你坚强的后盾。", item.getStaffName());
params.put("json", JSONObject.toJSON(json).toString());
try {
String resp = HttpUtil.doPost(smsApiUrl, params);
JSONObject respJson = JSONObject.parseObject(resp);
if (respJson.getIntValue("code") == 0) {
log.info("短信发送失败:" + respJson.getString("message"));
} else {
item.setSendStatus(1);
item.setExcuteTime(new Date());
item.setUpdateTime(new Date());
updateList.add(item);
}
} catch (Exception e) {
log.error("短信发送异常", e);
}
}
}
}
}
}
if(StaffCareEntryDateSend.equals("1")) {
query.setCareType(2);
staffCareList = staffCareService.getStaffCareList(query);
for (StaffCareEntity item : staffCareList) {
StaffEntity staffEntity = staffService.getCache(item.getStaffId().toString());
if (staffEntity != null) {
String mobileNumber = staffEntity.getPhoneNumber();
if (StringUtils.isEmpty(mobileNumber)) {
continue;
}
if (PhoneUtil.isPhone(mobileNumber)) {
Map<String, String> params = new HashMap<>();
params.put("appid", appid);
params.put("phone", mobileNumber);
params.put("type", SMS_TPYE);
String[] json = new String[1];
json[0] = String.format("亲爱的[%s],入职周年快乐!愿你一路走来的每一步都铺就了成功的基石,未来继续高飞,前程似锦!", item.getStaffName());
params.put("json", JSONObject.toJSON(json).toString());
try {
String resp = HttpUtil.doPost(smsApiUrl, params);
JSONObject respJson = JSONObject.parseObject(resp);
if (respJson.getIntValue("code") == 0) {
log.info("短信发送失败:" + respJson.getString("message"));
} else {
item.setSendStatus(1);
item.setExcuteTime(new Date());
item.setUpdateTime(new Date());
updateList.add(item);
}
} catch (Exception e) {
log.error("短信发送异常", e);
}
}
}
}
}
if(updateList.size()>0){
staffCareService.update(updateList);
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
......@@ -25,7 +25,7 @@ public class JobServiceImpl extends AbstractCRUDServiceImpl<JobDao, JobEntity, L
protected void findAfter(JobEntity entity, Context context, List<JobEntity> list) throws AppException {
list.stream().peek(item -> {
List<JobEntity> childs = this.find(new JobQuery().groupId(item.getId()));
System.out.println("111"+childs);
//System.out.println("111"+childs);
if (!ObjectUtils.isEmpty(childs)) {
item.setChildren(childs);
} else {
......
......@@ -2,6 +2,8 @@ package com.mortals.xhx.module.staff.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.staff.model.StaffCareEntity;
import com.mortals.xhx.module.staff.model.StaffCareQuery;
import java.util.List;
/**
* 员工关怀信息Dao
......@@ -13,5 +15,9 @@ import java.util.List;
public interface StaffCareDao extends ICRUDDao<StaffCareEntity,Long>{
List<StaffCareEntity> getStaffCareList(StaffCareEntity query);
int getStaffCareListCount(StaffCareEntity query);
int initSendStatus();
}
package com.mortals.xhx.module.staff.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.staff.dao.StaffCareDao;
import com.mortals.xhx.module.staff.model.StaffCareEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 员工关怀信息DaoImpl DAO接口
......@@ -17,5 +17,20 @@ import java.util.List;
public class StaffCareDaoImpl extends BaseCRUDDaoMybatis<StaffCareEntity,Long> implements StaffCareDao {
@Override
public List<StaffCareEntity> getStaffCareList(StaffCareEntity query) {
return this.getSqlSession().selectList(this.getSqlId("getStaffCareList"), query);
}
@Override
public int getStaffCareListCount(StaffCareEntity query) {
return (Integer)this.getSqlSession().selectOne(this.getSqlId("getStaffCareListCount"), query);
}
@Override
public int initSendStatus() {
return this.getSqlSession().update(this.getSqlId("initSendStatus"));
}
}
......@@ -14,7 +14,7 @@ import lombok.Data;
* 员工关怀信息实体对象
*
* @author zxfei
* @date 2025-04-10
* @date 2025-04-15
*/
@Data
public class StaffCareEntity extends StaffCareVo {
......@@ -68,6 +68,10 @@ public class StaffCareEntity extends StaffCareVo {
* 执行时间
*/
private Date excuteTime;
/**
* 员工类型(1.全职,2.兼职,3.实习)
*/
private Integer staffType;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -97,5 +101,6 @@ public class StaffCareEntity extends StaffCareVo {
this.sendStatus = 0;
this.content = "";
this.excuteTime = null;
this.staffType = 0;
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import com.mortals.xhx.module.staff.model.StaffCareEntity;
* 员工关怀信息查询对象
*
* @author zxfei
* @date 2025-04-10
* @date 2025-04-15
*/
public class StaffCareQuery extends StaffCareEntity {
/** 开始 序号,主键,自增长 */
......@@ -180,6 +180,21 @@ public class StaffCareQuery extends StaffCareEntity {
/** 结束 执行时间 */
private String excuteTimeEnd;
/** 开始 员工类型(1.全职,2.兼职,3.实习) */
private Integer staffTypeStart;
/** 结束 员工类型(1.全职,2.兼职,3.实习) */
private Integer staffTypeEnd;
/** 增加 员工类型(1.全职,2.兼职,3.实习) */
private Integer staffTypeIncrement;
/** 员工类型(1.全职,2.兼职,3.实习)列表 */
private List <Integer> staffTypeList;
/** 员工类型(1.全职,2.兼职,3.实习)排除列表 */
private List <Integer> staffTypeNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<StaffCareQuery> orConditionList;
......@@ -1124,6 +1139,87 @@ public class StaffCareQuery extends StaffCareEntity {
this.excuteTimeEnd = excuteTimeEnd;
}
/**
* 获取 开始 员工类型(1.全职,2.兼职,3.实习)
* @return staffTypeStart
*/
public Integer getStaffTypeStart(){
return this.staffTypeStart;
}
/**
* 设置 开始 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeStart
*/
public void setStaffTypeStart(Integer staffTypeStart){
this.staffTypeStart = staffTypeStart;
}
/**
* 获取 结束 员工类型(1.全职,2.兼职,3.实习)
* @return $staffTypeEnd
*/
public Integer getStaffTypeEnd(){
return this.staffTypeEnd;
}
/**
* 设置 结束 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeEnd
*/
public void setStaffTypeEnd(Integer staffTypeEnd){
this.staffTypeEnd = staffTypeEnd;
}
/**
* 获取 增加 员工类型(1.全职,2.兼职,3.实习)
* @return staffTypeIncrement
*/
public Integer getStaffTypeIncrement(){
return this.staffTypeIncrement;
}
/**
* 设置 增加 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeIncrement
*/
public void setStaffTypeIncrement(Integer staffTypeIncrement){
this.staffTypeIncrement = staffTypeIncrement;
}
/**
* 获取 员工类型(1.全职,2.兼职,3.实习)
* @return staffTypeList
*/
public List<Integer> getStaffTypeList(){
return this.staffTypeList;
}
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeList
*/
public void setStaffTypeList(List<Integer> staffTypeList){
this.staffTypeList = staffTypeList;
}
/**
* 获取 员工类型(1.全职,2.兼职,3.实习)
* @return staffTypeNotList
*/
public List<Integer> getStaffTypeNotList(){
return this.staffTypeNotList;
}
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeNotList
*/
public void setStaffTypeNotList(List<Integer> staffTypeNotList){
this.staffTypeNotList = staffTypeNotList;
}
/**
* 设置 序号,主键,自增长
* @param id
......@@ -1637,6 +1733,60 @@ public class StaffCareQuery extends StaffCareEntity {
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffType
*/
public StaffCareQuery staffType(Integer staffType){
setStaffType(staffType);
return this;
}
/**
* 设置 开始 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeStart
*/
public StaffCareQuery staffTypeStart(Integer staffTypeStart){
this.staffTypeStart = staffTypeStart;
return this;
}
/**
* 设置 结束 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeEnd
*/
public StaffCareQuery staffTypeEnd(Integer staffTypeEnd){
this.staffTypeEnd = staffTypeEnd;
return this;
}
/**
* 设置 增加 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeIncrement
*/
public StaffCareQuery staffTypeIncrement(Integer staffTypeIncrement){
this.staffTypeIncrement = staffTypeIncrement;
return this;
}
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeList
*/
public StaffCareQuery staffTypeList(List<Integer> staffTypeList){
this.staffTypeList = staffTypeList;
return this;
}
/**
* 设置 员工类型(1.全职,2.兼职,3.实习)
* @param staffTypeNotList
*/
public StaffCareQuery staffTypeNotList(List<Integer> staffTypeNotList){
this.staffTypeNotList = staffTypeNotList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
package com.mortals.xhx.module.staff.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.staff.model.StaffCareEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -9,6 +11,24 @@ import java.util.List;
* @author zxfei
* @date 2023-04-07
*/
@Data
public class StaffCareVo extends BaseEntityLong {
/**
* 年
*/
private Integer year;
/**
* 月
*/
private Integer month;
/**
* 日
*/
private Integer day;
/** 参数键,*/
private String paramType;
/** 参数值 */
private Integer paramValue;
}
\ No newline at end of file
package com.mortals.xhx.module.staff.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.staff.dao.StaffCareDao;
import com.mortals.xhx.module.staff.model.StaffCareEntity;
import com.mortals.xhx.module.staff.model.StaffCareQuery;
import java.util.List;
/**
* StaffCareService
*
......@@ -11,4 +16,9 @@ import com.mortals.xhx.module.staff.model.StaffCareEntity;
*/
public interface StaffCareService extends ICRUDService<StaffCareEntity,Long>{
StaffCareDao getDao();
List<StaffCareEntity> getStaffCareList(StaffCareEntity query);
int getStaffCareListCount(StaffCareEntity query);
}
\ No newline at end of file
package com.mortals.xhx.module.staff.service.impl;
import com.mortals.xhx.module.staff.model.StaffCareQuery;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -6,6 +7,9 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.staff.dao.StaffCareDao;
import com.mortals.xhx.module.staff.model.StaffCareEntity;
import com.mortals.xhx.module.staff.service.StaffCareService;
import java.util.List;
/**
* StaffCareService
* 员工关怀信息 service实现
......@@ -16,4 +20,13 @@ import com.mortals.xhx.module.staff.service.StaffCareService;
@Service("staffCareService")
public class StaffCareServiceImpl extends AbstractCRUDServiceImpl<StaffCareDao, StaffCareEntity, Long> implements StaffCareService {
@Override
public List<StaffCareEntity> getStaffCareList(StaffCareEntity query) {
return this.dao.getStaffCareList(query);
}
@Override
public int getStaffCareListCount(StaffCareEntity query) {
return this.dao.getStaffCareListCount(query);
}
}
\ No newline at end of file
package com.mortals.xhx.module.staff.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.model.ParamQuery;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.CareTypeEnum;
import com.mortals.xhx.common.code.SendStatusEnum;
......@@ -11,10 +16,12 @@ import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.job.model.JobEntity;
import com.mortals.xhx.module.job.model.JobQuery;
import com.mortals.xhx.module.job.service.JobService;
import com.mortals.xhx.module.staff.model.StaffCareQuery;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -30,19 +37,16 @@ import com.mortals.xhx.module.staff.service.StaffCareService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import static com.mortals.xhx.common.key.ParamKey.*;
/**
* 员工关怀信息
......@@ -64,6 +68,7 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff
@Autowired
private JobService jobService;
public StaffCareController() {
super.setModuleDesc("员工关怀信息");
}
......@@ -75,7 +80,7 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff
this.addDict(model, "deptId", deptService.find(new DeptQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeptName())));
this.addDict(model, "jobId", jobService.find(new JobQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getJobName())));
this.addDict(model, "staffId", staffService.find(new StaffQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getName())));
this.addDict(model, "staffType", paramService.getParamBySecondOrganize("Staff", "staffType"));
super.init(model, context);
}
......@@ -90,6 +95,8 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff
if (!ObjectUtils.isEmpty(entity.getStaffId())) {
StaffEntity staffEntity = staffService.getCache(entity.getStaffId().toString());
entity.setStaffName(staffEntity == null ? "" : staffEntity.getName());
entity.setDeptId(staffEntity == null ? null : staffEntity.getDeptId());
entity.setStaffType(staffEntity == null ? null : staffEntity.getStaffType());
}
if (!ObjectUtils.isEmpty(entity.getDeptId())) {
DeptEntity deptEntity = deptService.get(entity.getDeptId(), context);
......@@ -97,4 +104,66 @@ public class StaffCareController extends BaseCRUDJsonBodyMappingController<Staff
}
}
@Override
protected void doListBefore(StaffCareEntity query, Map<String, Object> model, Context context) throws AppException {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH)+1;
if(query.getYear()==null){
query.setYear(year);
}
if(query.getMonth()==null){
query.setMonth(month);
}
}
@Override
protected int doListAfter(StaffCareEntity query, Map<String, Object> model, Context context) throws AppException {
query.setCareType(1);
int shengri = this.service.getStaffCareListCount(query);
query.setCareType(2);
int ruzhi = this.service.getStaffCareListCount(query);
model.put("shengri", shengri);
model.put("ruzhi", ruzhi);
model.put(STAFF_CARE_BIRTHDAY_SEND, paramService.getValueByKey(STAFF_CARE_BIRTHDAY_SEND));
model.put(STAFF_CARE_ENTRYDATE_SEND, paramService.getValueByKey(STAFF_CARE_ENTRYDATE_SEND));
return 1;
}
/**
* 设置关怀发送开关
* @param query
* @return
*/
@PostMapping({"sendSwitch"})
public String sendSwitch(@RequestBody StaffCareEntity query) {
Map<String, Object> model = new HashMap();
int code = 1;
String busiDesc = "设置关怀发送开关";
try {
if(StringUtils.isNotEmpty(query.getParamType())){
ParamQuery paramQuery = new ParamQuery();
paramQuery.setParamKey(query.getParamType());
ParamEntity paramEntity = paramService.selectOne(paramQuery);
if(paramEntity!=null){
paramEntity.setParamValue(String.valueOf(query.getParamValue()));
paramService.update(paramEntity);
}
}
model.put("message_info", busiDesc + " 【成功】");
this.recordSysLog(this.request, busiDesc + " 【成功】 ");
} catch (Exception var7) {
code = -1;
this.doException(this.request, busiDesc, model, var7);
}
JSONObject ret = new JSONObject();
ret.put("code", Integer.valueOf(code));
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
<!-- 字段和属性映射 -->
<resultMap type="StaffCareEntity" id="StaffCareEntity-Map">
<id property="id" column="id" />
<id property="staffId" column="staffId" />
<result property="staffId" column="staffId" />
<result property="staffName" column="staffName" />
<result property="birthday" column="birthday" />
<result property="deptId" column="deptId" />
......@@ -22,6 +22,7 @@
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
<result property="excuteTime" column="excuteTime" />
<result property="staffType" column="staffType" />
</resultMap>
<!-- 表所有列 -->
......@@ -78,23 +79,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('excuteTime') or colPickMode == 1 and data.containsKey('excuteTime')))">
a.excuteTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('staffType') or colPickMode == 1 and data.containsKey('staffType')))">
a.staffType,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="StaffCareEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_staff_care
(staffId,staffName,birthday,deptId,deptName,jobId,jobName,entryDate,careType,sendStatus,content,createUserId,createTime,updateUserId,updateTime,excuteTime)
(staffId,staffName,birthday,deptId,deptName,jobId,jobName,entryDate,careType,sendStatus,content,createUserId,createTime,updateUserId,updateTime,excuteTime,staffType)
VALUES
(#{staffId},#{staffName},#{birthday},#{deptId},#{deptName},#{jobId},#{jobName},#{entryDate},#{careType},#{sendStatus},#{content},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{excuteTime})
(#{staffId},#{staffName},#{birthday},#{deptId},#{deptName},#{jobId},#{jobName},#{entryDate},#{careType},#{sendStatus},#{content},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{excuteTime},#{staffType})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_staff_care
(staffId,staffName,birthday,deptId,deptName,jobId,jobName,entryDate,careType,sendStatus,content,createUserId,createTime,updateUserId,updateTime,excuteTime)
(staffId,staffName,birthday,deptId,deptName,jobId,jobName,entryDate,careType,sendStatus,content,createUserId,createTime,updateUserId,updateTime,excuteTime,staffType)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.staffId},#{item.staffName},#{item.birthday},#{item.deptId},#{item.deptName},#{item.jobId},#{item.jobName},#{item.entryDate},#{item.careType},#{item.sendStatus},#{item.content},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.excuteTime})
(#{item.staffId},#{item.staffName},#{item.birthday},#{item.deptId},#{item.deptName},#{item.jobId},#{item.jobName},#{item.entryDate},#{item.careType},#{item.sendStatus},#{item.content},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.excuteTime},#{item.staffType})
</foreach>
</insert>
......@@ -173,6 +177,12 @@
<if test="(colPickMode==0 and data.containsKey('excuteTime')) or (colPickMode==1 and !data.containsKey('excuteTime'))">
a.excuteTime=#{data.excuteTime},
</if>
<if test="(colPickMode==0 and data.containsKey('staffType')) or (colPickMode==1 and !data.containsKey('staffType'))">
a.staffType=#{data.staffType},
</if>
<if test="(colPickMode==0 and data.containsKey('staffTypeIncrement')) or (colPickMode==1 and !data.containsKey('staffTypeIncrement'))">
a.staffType=ifnull(a.staffType,0) + #{data.staffTypeIncrement},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
......@@ -332,6 +342,18 @@
</if>
</foreach>
</trim>
<trim prefix="staffType=(case" suffix="ELSE staffType end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('staffType')) or (colPickMode==1 and !item.containsKey('staffType'))">
when a.id=#{item.id} then #{item.staffType}
</when>
<when test="(colPickMode==0 and item.containsKey('staffTypeIncrement')) or (colPickMode==1 and !item.containsKey('staffTypeIncrement'))">
when a.id=#{item.id} then ifnull(a.staffType,0) + #{item.staffTypeIncrement}
</when>
</choose>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
......@@ -827,6 +849,33 @@
<if test="conditionParamRef.containsKey('excuteTimeEnd') and conditionParamRef.excuteTimeEnd != null and conditionParamRef.excuteTimeEnd!=''">
${_conditionType_} a.excuteTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.excuteTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('staffType')">
<if test="conditionParamRef.staffType != null ">
${_conditionType_} a.staffType = #{${_conditionParam_}.staffType}
</if>
<if test="conditionParamRef.staffType == null">
${_conditionType_} a.staffType is null
</if>
</if>
<if test="conditionParamRef.containsKey('staffTypeList') and conditionParamRef.staffTypeList.size() > 0">
${_conditionType_} a.staffType in
<foreach collection="conditionParamRef.staffTypeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('staffTypeNotList') and conditionParamRef.staffTypeNotList.size() > 0">
${_conditionType_} a.staffType not in
<foreach collection="conditionParamRef.staffTypeNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('staffTypeStart') and conditionParamRef.staffTypeStart != null">
${_conditionType_} a.staffType <![CDATA[ >= ]]> #{${_conditionParam_}.staffTypeStart}
</if>
<if test="conditionParamRef.containsKey('staffTypeEnd') and conditionParamRef.staffTypeEnd != null">
${_conditionType_} a.staffType <![CDATA[ <= ]]> #{${_conditionParam_}.staffTypeEnd}
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
......@@ -887,6 +936,13 @@
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('staffTypeList') and conditionParamRef.staffTypeList.size() > 0">
field(a.staffType,
<foreach collection="conditionParamRef.staffTypeList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
a.${item.colName} ${item.sortKind}
......@@ -951,6 +1007,13 @@
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('staffTypeList') and conditionParamRef.staffTypeList.size() > 0">
field(a.staffType,
<foreach collection="conditionParamRef.staffTypeList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')">
a.id
......@@ -1037,6 +1100,11 @@
<if test='orderCol.excuteTime != null and "DESC".equalsIgnoreCase(orderCol.excuteTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('staffType')">
a.staffType
<if test='orderCol.staffType != null and "DESC".equalsIgnoreCase(orderCol.staffType)'>DESC</if>
,
</if>
</trim>
</if>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.staff.dao.ibatis.StaffCareDaoImpl">
<!-- 获取列表 -->
<select id="getStaffCareList" parameterType="com.mortals.xhx.module.staff.model.StaffCareEntity" resultMap="StaffCareEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_staff_care as a
where 1=1
<if test="careType != null and careType ==1">
and MONTH(birthday) = #{month}
<if test="day != null">
and DAY(birthday) = #{day}
</if>
</if>
<if test="careType != null and careType ==2">
and MONTH(entryDate) = #{month}
<if test="day != null">
and DAY(entryDate) = #{day}
</if>
</if>
</select>
<!-- 获取 -->
<select id="getStaffCareListCount" parameterType="com.mortals.xhx.module.staff.model.StaffCareEntity" resultType="int">
select count(1)
from mortals_xhx_staff_care as a
where 1=1
<if test="careType != null and careType ==1">
and MONTH(birthday) = #{month}
<if test="day != null">
and DAY(birthday) = #{day}
</if>
</if>
<if test="careType != null and careType ==2">
and MONTH(entryDate) = #{month}
<if test="day != null">
and DAY(entryDate) = #{day}
</if>
</if>
</select>
<update id="initSendStatus">
update mortals_xhx_staff_care as a set sendStatus = 0
</update>
</mapper>
\ No newline at end of file
......@@ -1429,3 +1429,12 @@ CREATE TABLE `mortals_xhx_device` (
KEY `status` (`status`) USING BTREE,
KEY `enabled` (`enabled`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考勤机管理';
-- ----------------------------
-- 2025-04-15
-- ----------------------------
ALTER TABLE `mortals_xhx_staff_care` ADD COLUMN `staffType` tinyint(2) DEFAULT '0' COMMENT '员工类型(1.全职,2.兼职,3.实习)';
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('生日关怀发送开关', 'StaffCare', 'birthday', 'StaffCareBirthdaySend', '1', '1', '4', '0', '1开启0关闭', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` (`name`, `firstOrganize`, `secondOrganize`, `paramKey`, `paramValue`, `validStatus`, `modStatus`, `displayType`, `remark`, `createTime`, `createUserId`, `createUserName`) VALUES ('入职周年关怀发送开关', 'StaffCare', 'entryDate', 'StaffCareEntryDateSend', '1', '1', '4', '0', '1开启0关闭', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_task` (`name`, `taskKey`, `status`, `excuteService`, `excuteParam`, `excuteHost`, `excuteStrategy`, `excuteDate`, `excuteTime`, `remark`, `lastExcuteHost`, `lastExcuteTime`, `interimExcuteStatus`, `createTime`, `createUserId`, `createUserName`) VALUES ('员工关怀短信发送任务', 'SendStaffCareSMSTask', '0', 'SendStaffCareSMSTask', NULL, NULL, '1', '0', '09:00', NULL, NULL, NULL, '0', NOW(), '1', '系统管理员');
\ No newline at end of file
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