考勤推送问题

项目部角色权限相关问题
This commit is contained in:
fl 2024-12-13 21:04:06 +08:00
parent 01a9f56eb8
commit f032ded697
34 changed files with 423 additions and 154 deletions

View File

@ -91,6 +91,10 @@ public class SysUser extends BaseEntity {
*/ */
private List<MapVo> orgList; private List<MapVo> orgList;
/**
* 角色组
*/
private List<String> roleList;
/** /**
* 角色组 * 角色组
*/ */

View File

@ -11,7 +11,7 @@ public enum AttStatus {
临时外出("7"), 临时外出("7"),
出入异常("8"), 出入异常("8"),
打卡地异常("9"), 打卡地异常("9"),
出差("10"), 出差报备("10"),
("11"), ("11"),
("12"), ("12"),
("13"), ("13"),
@ -19,7 +19,8 @@ public enum AttStatus {
("15"), ("15"),
("16"), ("16"),
("17"), ("17"),
("18"); ("18"),
("19");
private String code; private String code;
@ -43,7 +44,7 @@ public enum AttStatus {
return ""; return "";
}else if (this == AttStatus.){ }else if (this == AttStatus.){
return ""; return "";
}else if (this == AttStatus.出差){ }else if (this == AttStatus.出差报备){
return ""; return "";
} }
return this.name(); return this.name();

View File

@ -108,8 +108,10 @@ public class AESCBCUtil {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String jmData= AESCBCUtil.encrypt("Bonus@admin123"); String jmData= AESCBCUtil.encrypt("15240004260wechat");
String jmData1= AESCBCUtil.encrypt("GZkq@123456!");
System.out.println("加密后字符串:" + jmData); System.out.println("加密后字符串:" + jmData);
System.out.println("加密后字符串:" + jmData1);
String data= AESCBCUtil.decrypt(jmData); String data= AESCBCUtil.decrypt(jmData);
System.out.println("解密后的字串是:" + data); System.out.println("解密后的字串是:" + data);

View File

@ -210,6 +210,7 @@ public class AttDetailByMonthController extends BaseController {
attStatus.put("16", "产假"); attStatus.put("16", "产假");
attStatus.put("17", "婚假"); attStatus.put("17", "婚假");
attStatus.put("18", "丧假"); attStatus.put("18", "丧假");
attStatus.put("19", "育儿假");
return attStatus; return attStatus;
} }

View File

@ -198,4 +198,18 @@ public class AttendanceDetailsController extends BaseController {
attendanceDetailsService.exportAttMonthReportData(response, o); attendanceDetailsService.exportAttMonthReportData(response, o);
} }
@RequiresPermissions("att:public:list")
@GetMapping("/getOutCountList")
@Log(title = "考勤报表->公用->外出次数查询", businessType = BusinessType.QUERY)
public TableDataInfo getOutCountList(AttDataDetailsBean bean) {
try{
startPage();
return getDataTable(attendanceDetailsService.getOutCountList(bean));
}catch (Exception e){
log.error(e.toString(),e);
}
return getDataTableError(new ArrayList<>());
}
} }

View File

@ -82,4 +82,6 @@ public interface AttendanceDetailsDao {
* @return list bean * @return list bean
*/ */
List<AttDataDetailsBean> getAttDayReportDetailsList(AttDataDetailsBean bean); List<AttDataDetailsBean> getAttDayReportDetailsList(AttDataDetailsBean bean);
List<AttDataDetailsBean> getOutCountList(AttDataDetailsBean bean);
} }

View File

@ -196,6 +196,9 @@ public class AttDataDetailsBean {
/** 部门列表 */ /** 部门列表 */
private List<String> orgList; private List<String> orgList;
/** 上班时间外出次数 */
private Integer outCount;
public AttDataDetailsBean() { public AttDataDetailsBean() {
} }

View File

@ -80,6 +80,11 @@ public class AttDayReportBean {
*/ */
private String endDate; private String endDate;
/**
* 工作时间外出次数
*/
private Long outCount;
public AttDayReportBean(String attCurrentDay, Long normalNum, Long lateNum, public AttDayReportBean(String attCurrentDay, Long normalNum, Long lateNum,
Long earlyNum, Long skippingNum, Long leaveNum, Long addressErrorNum, Long earlyNum, Long skippingNum, Long leaveNum, Long addressErrorNum,
Long einErrorNum, Long restNum, Long outNum) { Long einErrorNum, Long restNum, Long outNum) {

View File

@ -98,4 +98,9 @@ public class AttDetailByMonthBean {
private int[] orgIds; private int[] orgIds;
/**
* 工作时间外出次数
*/
private int outCount;
} }

View File

@ -98,4 +98,9 @@ public class AttMonthReportBean {
*/ */
private Long groupId; private Long groupId;
/**
* 工作时间外出次数
*/
private Long outCount;
} }

View File

@ -95,4 +95,5 @@ public interface AttendanceDetailsService {
*/ */
List<AttDataDetailsBean> getAttDayReportDetailsList(AttDataDetailsBean bean); List<AttDataDetailsBean> getAttDayReportDetailsList(AttDataDetailsBean bean);
List<AttDataDetailsBean> getOutCountList(AttDataDetailsBean bean);
} }

View File

@ -159,6 +159,11 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
return attendanceDetailsDao.getAttDayReportDetailsList(bean); return attendanceDetailsDao.getAttDayReportDetailsList(bean);
} }
@Override
public List<AttDataDetailsBean> getOutCountList(AttDataDetailsBean bean) {
return attendanceDetailsDao.getOutCountList(bean);
}
public List<AttDayReportBean> getAttDayReportListAll(List<AttDayReportBean> list) { public List<AttDayReportBean> getAttDayReportListAll(List<AttDayReportBean> list) {
List<AttDayReportBean> allList = new ArrayList<>(); List<AttDayReportBean> allList = new ArrayList<>();
Map<String, AttDayReportBean> map = list.stream() Map<String, AttDayReportBean> map = list.stream()

View File

@ -60,7 +60,7 @@ public class AttTasks {
private volatile boolean executed = false; // 标志位表示任务是否已经执行过 private volatile boolean executed = false; // 标志位表示任务是否已经执行过
// @Scheduled(cron = "0 0/10 * * * ?") // @Scheduled(cron = "0 0/10 * * * ?")
// @Scheduled(initialDelay = 60000 * 5, fixedDelay = 60000 * 10) @Scheduled(initialDelay = 6000, fixedDelay = 60000 * 10)
@Async @Async
public void getAttTasks() { public void getAttTasks() {
log.info("--------考勤定时器开启------"); log.info("--------考勤定时器开启------");
@ -72,7 +72,7 @@ public class AttTasks {
/** /**
* 历史考勤数据 * 历史考勤数据
*/ */
@Scheduled(fixedDelay = 60000 * 30) // @Scheduled(initialDelay = 60000 * 4,fixedDelay = 60000 * 30)
@Async @Async
public void getHisAttTasks() { public void getHisAttTasks() {
log.info("--------考勤定时器开启------"); log.info("--------考勤定时器开启------");
@ -80,9 +80,22 @@ public class AttTasks {
return; // 如果任务已经执行过直接返回 return; // 如果任务已经执行过直接返回
} }
executed = true; // 设置标志位表示任务已经执行过 executed = true; // 设置标志位表示任务已经执行过
String startDate = "2024-11-01"; // String startDate = "2024-11-01";
String endDate = "2024-11-05"; // String endDate = "2024-11-05";
List<String> dateList = getStrDateListBetween(startDate, endDate); // List<String> dateList = getStrDateListBetween(startDate, endDate);
List<String> dateList = new ArrayList<>();
dateList.add("2024-11-02");
dateList.add("2024-11-03");
dateList.add("2024-11-09");
dateList.add("2024-11-10");
dateList.add("2024-11-16");
dateList.add("2024-11-17");
dateList.add("2024-11-23");
dateList.add("2024-11-24");
dateList.add("2024-11-30");
dateList.add("2024-12-01");
dateList.add("2024-12-07");
dateList.add("2024-12-08");
// 创建固定大小的线程池 // 创建固定大小的线程池
ExecutorService executorService = Executors.newFixedThreadPool(THREAD_POOL_SIZE); ExecutorService executorService = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
// 分批处理日期列表 // 分批处理日期列表
@ -93,7 +106,7 @@ public class AttTasks {
executorService.submit(() -> { executorService.submit(() -> {
for (String date : batch) { for (String date : batch) {
try { try {
delHisData(date); // delHisData(date);
pushAttData(date, 2); pushAttData(date, 2);
} catch (Exception e) { } catch (Exception e) {
// 记录异常并继续处理下一个日期 // 记录异常并继续处理下一个日期
@ -282,13 +295,13 @@ public class AttTasks {
//开始和结束的那天是否只请了半天 //开始和结束的那天是否只请了半天
if (c.getLeaveStartDate().equals(v)) { if (c.getLeaveStartDate().equals(v)) {
if (c.getLeaveStartInterval().equals("2")) { if (c.getLeaveStartInterval().equals("2")) {
replaceAttData(offWorkBean, 1, pushDate); replaceHolidayData(offWorkBean, 0);
} else { } else {
tf = true; tf = true;
} }
} else if (c.getLeaveEndDate().equals(v)) { } else if (c.getLeaveEndDate().equals(v)) {
if (c.getLeaveEndInterval().equals("1")) { if (c.getLeaveEndInterval().equals("1")) {
replaceAttData(toWorkBean, 1, pushDate); replaceHolidayData(toWorkBean, 0);
} else { } else {
tf = true; tf = true;
} }
@ -297,8 +310,8 @@ public class AttTasks {
} }
if (tf) { if (tf) {
replaceAttData(toWorkBean, 1, pushDate); replaceHolidayData(toWorkBean, 0);
replaceAttData(offWorkBean, 1, pushDate); replaceHolidayData(offWorkBean, 0);
} }
}); });
} }
@ -365,7 +378,7 @@ public class AttTasks {
.findFirst() .findFirst()
.ifPresent(c -> v.setAttStatus("11")); .ifPresent(c -> v.setAttStatus("11"));
v.setAttCurrentDay(pushDate); v.setAttCurrentDay(pushDate);
replaceAttData(v, 0, pushDate); replaceAttData(v, pushDate);
}); });
} }
} }
@ -373,7 +386,7 @@ public class AttTasks {
/** /**
* 新增修改考勤数据 * 新增修改考勤数据
*/ */
private void replaceAttData(AttDataBean v, int type, String pushDate) { private void replaceAttData(AttDataBean v, String pushDate) {
//查询考勤模版数据是否已经插入 //查询考勤模版数据是否已经插入
Boolean isAttExist = attSourceDataDao.selectAttIsExist(v); Boolean isAttExist = attSourceDataDao.selectAttIsExist(v);
if (!isAttExist) { if (!isAttExist) {
@ -386,27 +399,62 @@ public class AttTasks {
attSourceDataDao.insertAttData(v); attSourceDataDao.insertAttData(v);
} else { } else {
if (!v.getAttStatus().equals("0")) { if (!v.getAttStatus().equals("0")) {
attSourceDataDao.updateAttData(v, type); attSourceDataDao.updateAttData(v, 0);
} }
if (v.getAttStatus().equals("0")) { if (v.getAttStatus().equals("0")) {
//将未打卡的全部置为旷工 //将未打卡的全部置为旷工
changeAbsenteeAttStatus(v, type, 0, pushDate); changeAbsenteeAttStatus(v, 0, 0, pushDate);
} }
} }
//查询能修改的考勤模版数据是否已经插入 //查询能修改的考勤模版数据是否已经插入
Boolean isAttUpdateExist = attSourceDataDao.selectAttUpdateIsExist(v); Boolean isAttUpdateExist = attSourceDataDao.selectAttUpdateIsExist(v);
if (!isAttUpdateExist) { if (!isAttUpdateExist) {
// 判断 pushDate 是否在今天之前
boolean isPastDate = isBeforeToday(pushDate);
if (isPastDate) {
v.setAttStatus("3");
}
attSourceDataDao.insertAttUpdateData(v); attSourceDataDao.insertAttUpdateData(v);
} else { } else {
if (!v.getAttStatus().equals("0")) { if (!v.getAttStatus().equals("0")) {
attSourceDataDao.updateAttUpdateData(v, type); attSourceDataDao.updateAttUpdateData(v, 0);
} else { } else {
//将未打卡的全部置为旷工 //将未打卡的全部置为旷工
changeAbsenteeAttStatus(v, type, 1, pushDate); changeAbsenteeAttStatus(v, 0, 1, pushDate);
} }
} }
} }
/**
* 新增修改请假数据更新考勤表
*/
private void replaceHolidayData(AttDataBean v, int type) {
//查询考勤模版数据是否已经插入
Boolean isAttExist = attSourceDataDao.selectAttIsExist(v);
if (!isAttExist) {
//没有基础数据插入基础数据并改状态为对应请假状态
attSourceDataDao.insertAttData(v);
} else {
if (!v.getAttStatus().equals("0")) {
//改状态为对应请假状态
attSourceDataDao.updateAttData(v, type);
}
}
//查询能修改的考勤模版数据是否已经插入
Boolean isAttUpdateExist = attSourceDataDao.selectAttUpdateIsExist(v);
if (!isAttUpdateExist) {
//没有基础数据插入基础数据并改状态为对应请假状态
attSourceDataDao.insertAttUpdateData(v);
} else {
if (!v.getAttStatus().equals("0")) {
//改状态为对应请假状态
attSourceDataDao.updateAttUpdateData(v, type);
}
}
}
/** /**
* 将未打卡的全部置为旷工 * 将未打卡的全部置为旷工
* *
@ -421,22 +469,12 @@ public class AttTasks {
boolean isPastDate = isBeforeToday(pushDate); boolean isPastDate = isBeforeToday(pushDate);
if (isPastDate) { if (isPastDate) {
// 如果 pushDate 是过去的时间直接执行原逻辑 // 如果 pushDate 是过去的时间直接执行原逻辑
if ("1".equals(v.getAttType())) {
v.setAttStatus("3"); v.setAttStatus("3");
if (update == 0) { if (update == 0) {
attSourceDataDao.updateAttData(v, type); attSourceDataDao.updateAttData(v, type);
} else if (update == 1) { } else if (update == 1) {
attSourceDataDao.updateAttUpdateData(v, type); attSourceDataDao.updateAttUpdateData(v, type);
} }
}
if ("2".equals(v.getAttType())) {
v.setAttStatus("3");
if (update == 0) {
attSourceDataDao.updateAttData(v, type);
} else if (update == 1) {
attSourceDataDao.updateAttUpdateData(v, type);
}
}
} else { } else {
LocalTime currentTime; LocalTime currentTime;
// 使用当前时间 // 使用当前时间
@ -653,7 +691,6 @@ public class AttTasks {
} }
) )
)); ));
if (!tf) { if (!tf) {
//固定打卡以最靠近上班打卡时间前的出闸机的时间为基准去除掉之前的所有打卡数据 //固定打卡以最靠近上班打卡时间前的出闸机的时间为基准去除掉之前的所有打卡数据
processGroupedItems(groupedItems, attGroupBean); processGroupedItems(groupedItems, attGroupBean);
@ -669,12 +706,10 @@ public class AttTasks {
.filter(a -> a.getAttType().equals("2")) .filter(a -> a.getAttType().equals("2"))
.collect(Collectors.toList()) .collect(Collectors.toList())
.stream().max(Comparator.comparing(AttSourceDataBean::getAttCurrentTime)).orElse(null); .stream().max(Comparator.comparing(AttSourceDataBean::getAttCurrentTime)).orElse(null);
if (tf) { if (tf) {
//自由打卡不需要去除数据 //自由打卡不需要去除数据
getFreeAttData(newList, frontToWorkBean, backOffWorkBean, attGroupBean); getFreeAttData(newList, frontToWorkBean, backOffWorkBean, attGroupBean);
} else { } else {
if (backOffWorkBean != null) { if (backOffWorkBean != null) {
//最新一次下班时间插入list //最新一次下班时间插入list
newList.add(backOffWorkBean); newList.add(backOffWorkBean);
@ -683,13 +718,18 @@ public class AttTasks {
// System.out.println("c.getAttCurrentTime() = "); // System.out.println("c.getAttCurrentTime() = ");
// } // }
// 处理逻辑 出入异常的逻辑 // 处理逻辑 出入异常的逻辑
Map<Boolean, List<AttSourceDataBean>> result = checkAdjacentAttType1WithGapAndCheckTypesBefore(v, attGroupBean.getEntryAbnormalMinute()); try {
if (result.containsKey(true)) { Map<Boolean, List<AttSourceDataBean>> result = checkAdjacentAttType1WithGapAndCheckTypesBefore(v, attGroupBean.getEntryAbnormalMinute());
List<AttSourceDataBean> matchingItems = result.get(true); if (result.containsKey(true)) {
frontToWorkBean = matchingItems.get(0); List<AttSourceDataBean> matchingItems = result.get(true);
frontToWorkBean.setAbnormalAttTime(matchingItems.get(1).getAttCurrentTime()); frontToWorkBean = matchingItems.get(0);
frontToWorkBean.setAbnormalAttAddress(matchingItems.get(1).getAttAddress()); frontToWorkBean.setAbnormalAttTime(matchingItems.get(1).getAttCurrentTime());
frontToWorkBean.setAttStatus(8); frontToWorkBean.setAbnormalAttAddress(matchingItems.get(1).getAttAddress());
frontToWorkBean.setAttStatus(8);
}
}catch(Exception e){
e.printStackTrace();
log.error("出入异常处理报错");
} }
//没有下班卡则添加第一次打卡数据 //没有下班卡则添加第一次打卡数据
newList.add(frontToWorkBean); newList.add(frontToWorkBean);
@ -697,52 +737,57 @@ public class AttTasks {
LocalTime lastOutTime = null; LocalTime lastOutTime = null;
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
//存储工作异常的list try {
List<AttSourceDataBean> longBreakRecords = new ArrayList<>(); //存储工作异常的list
for (int i = 0; i < v.size(); i++) { List<AttSourceDataBean> longBreakRecords = new ArrayList<>();
AttSourceDataBean record = v.get(i); for (int i = 0; i < v.size(); i++) {
// 如果是的记录保存时间 AttSourceDataBean record = v.get(i);
if ("2".equals(record.getAttType())) { // 如果是的记录保存时间
lastOutTime = LocalDateTime.parse(record.getAttCurrentTime(), dateTimeFormatter).toLocalTime(); if ("2".equals(record.getAttType())) {
if(lastOutTime.isAfter(LocalTime.parse(attGroupBean.getOffWorkTime(), timeFormatter))){ lastOutTime = LocalDateTime.parse(record.getAttCurrentTime(), dateTimeFormatter).toLocalTime();
//进在下班之后不考虑 if(lastOutTime.isAfter(LocalTime.parse(attGroupBean.getOffWorkTime(), timeFormatter))){
break; //进在下班之后不考虑
break;
}
} }
} // 如果是的记录并且之前有的记录
// 如果是的记录并且之前有的记录 else if ("1".equals(record.getAttType()) && lastOutTime != null) {
else if ("1".equals(record.getAttType()) && lastOutTime != null) { LocalTime inTime = LocalDateTime.parse(record.getAttCurrentTime(), dateTimeFormatter).toLocalTime();
LocalTime inTime = LocalDateTime.parse(record.getAttCurrentTime(), dateTimeFormatter).toLocalTime(); // 计算实际工作时间不包括午休时间
// 计算实际工作时间不包括午休时间
// if(record.getName().equals("何波")){ // if(record.getName().equals("何波")){
// System.out.println("11111111111"); // System.out.println("11111111111");
// } // }
// - 的时间在上班时间前去除 // - 的时间在上班时间前去除
if(inTime.isBefore(LocalTime.parse(attGroupBean.getToWorkTime(), timeFormatter))){ if(inTime.isBefore(LocalTime.parse(attGroupBean.getToWorkTime(), timeFormatter))){
//进在上班之后不考虑 //进在上班之后不考虑
break; break;
}
Duration workDuration = calculateWorkDuration(lastOutTime, inTime, attGroupBean);
// 如果工作时间外出超过了规定时间记录下这对
if (workDuration != null && !workDuration.isNegative() && workDuration.toMinutes() > attGroupBean.getWorkAbnormalMinute()) {
AttSourceDataBean longBreakRecord = new AttSourceDataBean();
longBreakRecord.setUserId(record.getUserId());
longBreakRecord.setName(record.getName());
longBreakRecord.setOrgId(attGroupBean.getOrgId());
longBreakRecord.setAttCurrentDay(record.getAttCurrentDay());
longBreakRecord.setAttCurrentTime(v.get(i - 1).getAttCurrentTime() + " " + record.getAttCurrentTime());
longBreakRecord.setAttAddress(v.get(i - 1).getAttAddress() + " " + record.getAttAddress());
longBreakRecords.add(longBreakRecord);
}
// 更新lastOutTime为null因为已经处理了这一对
lastOutTime = null;
} }
Duration workDuration = calculateWorkDuration(lastOutTime, inTime, attGroupBean); }
// 如果工作时间外出超过了规定时间记录下这对 //判断有没有临时外出请假等等
if (workDuration != null && !workDuration.isNegative() && workDuration.toMinutes() > attGroupBean.getWorkAbnormalMinute()) { if(!longBreakRecords.isEmpty()){
AttSourceDataBean longBreakRecord = new AttSourceDataBean(); int x = attSourceDataDao.getLeaveDataByUserId(longBreakRecords.get(0));
longBreakRecord.setUserId(record.getUserId()); if(x==0){
longBreakRecord.setName(record.getName()); attSourceDataDao.insertWorkAbnormal(longBreakRecords);
longBreakRecord.setOrgId(attGroupBean.getOrgId());
longBreakRecord.setAttCurrentDay(record.getAttCurrentDay());
longBreakRecord.setAttCurrentTime(v.get(i - 1).getAttCurrentTime() + " " + record.getAttCurrentTime());
longBreakRecord.setAttAddress(v.get(i - 1).getAttAddress() + " " + record.getAttAddress());
longBreakRecords.add(longBreakRecord);
} }
// 更新lastOutTime为null因为已经处理了这一对
lastOutTime = null;
}
}
//判断有没有临时外出请假等等
if(!longBreakRecords.isEmpty()){
int x = attSourceDataDao.getLeaveDataByUserId(longBreakRecords.get(0));
if(x==0){
attSourceDataDao.insertWorkAbnormal(longBreakRecords);
} }
}catch(Exception e){
e.printStackTrace();
log.error("工作异常处理报错");
} }
} }

View File

@ -62,8 +62,8 @@ import static com.bonus.system.att.utils.DistanceCalculator.calculateDistance;
*/ */
@Configuration @Configuration
@Slf4j @Slf4j
//@EnableScheduling @EnableScheduling
//@EnableAsync @EnableAsync
public class WechatTasks { public class WechatTasks {
@Resource(name = "WechatPushDao") @Resource(name = "WechatPushDao")
@ -71,14 +71,17 @@ public class WechatTasks {
private String token; private String token;
private int index = 4;
/** /**
* 人员基础数据同步定时器 * 人员基础数据同步定时器
*/ */
// @Scheduled(cron = "0 0/10 * * * ?") // @Scheduled(cron = "0 0/10 * * * ?")
// @Scheduled(initialDelay = 60000 * 1,fixedDelay = 60000 * 1) // @Scheduled(initialDelay = 6000,fixedDelay = 60000 * 10)
@Async @Async
public void pushPersonTask() { public void pushPersonTask() {
log.info("--------人员基础数据同步定时器开启------"); log.info("--------人员基础数据同步定时器开启------");
index=4;
//考勤库人员 //考勤库人员
List<SysUser> list = dao.getPersonList(); List<SysUser> list = dao.getPersonList();
//考勤小程序库人员 //考勤小程序库人员
@ -103,12 +106,12 @@ public class WechatTasks {
/** /**
* 休假出差数据同步定时器 * 休假出差数据同步定时器
*/ */
// @Scheduled(initialDelay = 60000 * 2,fixedDelay = 60000 * 1) // @Scheduled(initialDelay = 60000 * 2,fixedDelay = 60000 * 10)
@Async @Async
public void leaveTask() { public void leaveTask() {
log.info("--------休假出差数据定时器开启------"); log.info("--------休假出差数据定时器开启------");
index=4;
//小程序库人员 //小程序库人员
// List<EvectionBean> list = dao.getWechatLeaveList();
String jsonStr = "{}"; String jsonStr = "{}";
String method = "getWechatLeaveList"; String method = "getWechatLeaveList";
String string = httpPost(method, jsonStr); String string = httpPost(method, jsonStr);
@ -125,16 +128,10 @@ public class WechatTasks {
bean.setOrgName(orgInfo.getOrgName()); bean.setOrgName(orgInfo.getOrgName());
} }
dao.insertWebLeave(bean); dao.insertWebLeave(bean);
// dao.updateWechatLeave(bean);
String jsonStr2 = FastJsonHelper.beanToJsonStr(bean); String jsonStr2 = FastJsonHelper.beanToJsonStr(bean);
String method2 = "updateWechatLeave"; String method2 = "updateWechatLeave";
String string2 = httpPost(method2, jsonStr2); String string2 = httpPost(method2, jsonStr2);
} }
//删除所有已经同步过去的数据
// dao.deleteWechatLeave();
// String jsonStr3 = "{}";
// String method3 = "deleteWechatLeave";
// String string3 = httpPost(method3, jsonStr3);
//在将所有数据同步过去 //在将所有数据同步过去
List<EvectionBean> webList = dao.getWebLeaveList(); List<EvectionBean> webList = dao.getWebLeaveList();
String jsonStr2 = "{}"; String jsonStr2 = "{}";
@ -161,11 +158,9 @@ public class WechatTasks {
log.info("插入请假数据到小程序:"+string2); log.info("插入请假数据到小程序:"+string2);
} else { } else {
// 如果存在则判断时间是否后于小程序时间 // 如果存在则判断时间是否后于小程序时间
// 如果 userId 存在于 wechatList则比较 updateTime
EvectionBean wechatUser = wechatUserMap.get(id); EvectionBean wechatUser = wechatUserMap.get(id);
if (bean.getUpdateTime().after(wechatUser.getUpdateTime())) { if (bean.getUpdateTime().after(wechatUser.getUpdateTime())) {
// 如果 list 中的 updateTime 更新则更新数据库 a // 如果 list 中的 updateTime 更新则更新数据库 a
// dao.updateWechatPerson(user);
String jsonStr = FastJsonHelper.beanToJsonStr(bean); String jsonStr = FastJsonHelper.beanToJsonStr(bean);
String method = "updateWechatLeaveMsg"; String method = "updateWechatLeaveMsg";
String string = httpPost(method, jsonStr); String string = httpPost(method, jsonStr);
@ -182,10 +177,11 @@ public class WechatTasks {
/** /**
* 考勤数据同步定时器 * 考勤数据同步定时器
*/ */
// @Scheduled(initialDelay = 60000 * 3,fixedDelay = 60000 * 1) // @Scheduled(initialDelay = 60000 * 3,fixedDelay = 60000 * 10)
@Async @Async
public void wechatAttTask() { public void wechatAttTask() {
log.info("--------考勤数据定时器开启------"); log.info("--------考勤数据定时器开启------");
index=4;
// //小程序库人员考勤 // //小程序库人员考勤
String jsonStr = "{}"; String jsonStr = "{}";
String method = "getWechatAttList"; String method = "getWechatAttList";
@ -217,7 +213,6 @@ public class WechatTasks {
//外勤 //外勤
bean.setIsOutsideAtt("1"); bean.setIsOutsideAtt("1");
} }
}); });
//新增数据 //新增数据
attSourceList.forEach(c -> { attSourceList.forEach(c -> {
@ -270,7 +265,8 @@ public class WechatTasks {
private void syncListsToDatabase(List<SysUser> list, List<SysUser> wechatList) { private void syncListsToDatabase(List<SysUser> list, List<SysUser> wechatList) {
// wechatList 转换为 Map以便快速查找 // wechatList 转换为 Map以便快速查找
Map<Long, SysUser> wechatUserMap = wechatList.stream() Map<Long, SysUser> wechatUserMap = Optional.ofNullable(wechatList)
.orElse(Collections.emptyList()).stream()
.collect(Collectors.toMap(SysUser::getUserId, user -> user, (existing, replacement) -> existing)); .collect(Collectors.toMap(SysUser::getUserId, user -> user, (existing, replacement) -> existing));
// 遍历 list检查每个用户是否存在于 wechatList // 遍历 list检查每个用户是否存在于 wechatList
@ -337,20 +333,31 @@ public class WechatTasks {
// .header("Content-Type", "application/json") // .header("Content-Type", "application/json")
// .body(jsonStr) // .body(jsonStr)
// .execute(); // .execute();
HttpResponse response = HttpRequest.post(IpAndPathConfig.getWechatUrl() + "/wechatData/" + method) if(index > 0){
.header("Content-Type", "application/json") HttpResponse response = HttpRequest.post(IpAndPathConfig.getWechatUrl() + "/wechatData/" + method)
.header("token",token) // 添加Token到请求头 .header("Content-Type", "application/json")
.body(jsonStr) .header("token",token) // 添加Token到请求头
.execute(); .body(jsonStr)
int statusCode = response.getStatus(); .execute();
System.out.println(response.body()); int statusCode = response.getStatus();
JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(response.body()); System.out.println(response.body());
return jsonObject.getString("obj"); JSONObject jsonObject = FastJsonHelper.jsonStrToJsonObj(response.body());
if("401".equals(jsonObject.getString("code"))){
wechatLogin();
index--;
return httpPost(method, jsonStr);
}
if("200".equals(jsonObject.getString("code") ) ){
index = 4;
}
return jsonObject.getString("obj");
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
// 处理异常例如记录日志或抛出自定义异常 // 处理异常例如记录日志或抛出自定义异常
return ""; return "";
} }
return "";
} }
/** /**
@ -385,12 +392,6 @@ public class WechatTasks {
} }
} }
@Scheduled(initialDelay = 1000,fixedDelay = 60000 * 10)
@Async
public void login() {
wechatLogin();
}
public void wechatLogin() { public void wechatLogin() {
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
.build(); .build();
@ -398,7 +399,7 @@ public class WechatTasks {
RequestBody body = null; RequestBody body = null;
try { try {
// body = RequestBody.create(mediaType, "username=15240004260&password=GZkq@123456!"); // body = RequestBody.create(mediaType, "username=15240004260&password=GZkq@123456!");
body = RequestBody.create(mediaType, "username="+ AESCBCUtil.encrypt("15240004260")+"&password="+AESCBCUtil.encrypt("GZkq@123456!")); body = RequestBody.create(mediaType, "username="+ AESCBCUtil.encrypt("15240004260wechat")+"&password="+AESCBCUtil.encrypt("GZkq@123456!"));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -424,9 +425,5 @@ public class WechatTasks {
} }
public static void main(String[] args) throws Exception {
String encrypt = AESCBCUtil.encrypt("GZkq@123456!");
System.out.println(encrypt);
}
} }

View File

@ -23,7 +23,7 @@ public class IpAndPathConfig {
public static String wechatTestUrl = "http://192.168.0.14:1907/gz_att_wechat"; public static String wechatTestUrl = "http://192.168.0.14:1907/gz_att_wechat";
public static String wechatProdUrl = "http://112.29.103.165:21880/wcd/getWorkerCard"; public static String wechatProdUrl = "https://jj.jypxks.com/gz_att_wechat";
public static String getWechatUrl(){ public static String getWechatUrl(){
if(environment.contains("prod")){ if(environment.contains("prod")){

View File

@ -234,6 +234,8 @@ public class SysUserController extends BaseController {
} }
// 角色集合 // 角色集合
Set<String> roles = sysMenuService.getRolePermission(user); Set<String> roles = sysMenuService.getRolePermission(user);
List<String> roleList = userService.getRoleList(user);
user.setRoleList(roleList);
// 权限集合 // 权限集合
Set<String> permissions = sysMenuService.getMenuPermission(user); Set<String> permissions = sysMenuService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();

View File

@ -226,4 +226,6 @@ public interface SysUserMapper
Long getUserAttGroupByUserId(Long userId); Long getUserAttGroupByUserId(Long userId);
void updateAttOrgByUserId(OrgChangeBean item); void updateAttOrgByUserId(OrgChangeBean item);
List<String> getRoleListById(SysUser user);
} }

View File

@ -144,4 +144,6 @@ public interface SysUserService {
List<MapVo> getAttGroupByUserId(SysUser user); List<MapVo> getAttGroupByUserId(SysUser user);
int updatePermission(SysUser user); int updatePermission(SysUser user);
List<String> getRoleList(SysUser user);
} }

View File

@ -108,14 +108,14 @@ public class SysOrgServiceImpl implements SysOrgService {
@Override @Override
public int updateOrg(SysOrg org) { public int updateOrg(SysOrg org) {
if (org.getLat() == null || org.getLon()== null){ // if (org.getLat() == null || org.getLon()== null){
Map<String, BigDecimal> map = AddressCoordinateFormatUtil.addressToCoordinate(org.getAddress()); Map<String, BigDecimal> map = AddressCoordinateFormatUtil.addressToCoordinate(org.getAddress());
if (map == null) { if (map == null) {
return 3; return 3;
} }
org.setLon(map.get("longitude")); org.setLon(map.get("longitude"));
org.setLat(map.get("latitude")); org.setLat(map.get("latitude"));
} // }
int i = orgDao.updateOrg(org); int i = orgDao.updateOrg(org);
if (i > 0) { if (i > 0) {
if (StringUtils.isNotBlank(org.getOrgHeadUserId())) { if (StringUtils.isNotBlank(org.getOrgHeadUserId())) {

View File

@ -84,6 +84,8 @@ public class SysUserServiceImpl implements SysUserService
sysUser.setAttGroupId(attGroupList.get(0).getId()); sysUser.setAttGroupId(attGroupList.get(0).getId());
sysUser.setAttGroupName(attGroupList.get(0).getName()); sysUser.setAttGroupName(attGroupList.get(0).getName());
} }
List<String> roleList = userMapper.getRoleListById(sysUser);
sysUser.setRoleList(roleList);
// 权限集合 // 权限集合
Set<String> permissions = sysMenuService.getMenuPermission(sysUser); Set<String> permissions = sysMenuService.getMenuPermission(sysUser);
LoginUser sysUserVo = new LoginUser(); LoginUser sysUserVo = new LoginUser();
@ -250,6 +252,11 @@ public class SysUserServiceImpl implements SysUserService
} }
} }
@Override
public List<String> getRoleList(SysUser user) {
return userMapper.getRoleListById(user);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int deleteUserByIds(Long userId) { public int deleteUserByIds(Long userId) {

View File

@ -134,6 +134,24 @@ public class ProDeptRoleController extends BaseController {
return error(); return error();
} }
/**
* 获取项目部角色列表(表格)
*/
@RequiresPermissions("dept:role:list")
@GetMapping("/getRoleUserNoManagerList")
@Log(title = "项目部管理->项目部角色管理->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getRoleUserNoManagerList(ProDeptRoleBean bean) {
try{
List<ProDeptRoleBean> roleUserList = proDeptRoleService.getRoleUserNoManagerList(bean);
return endPage(roleUserList);
}catch (Exception e){
log.error(e.toString(),e);
}
return getDataTableError(new ArrayList<>());
}
/** /**
* 查询八大员数据列表 * 查询八大员数据列表
*/ */

View File

@ -22,6 +22,8 @@ public interface ProDeptRoleDao {
*/ */
List<ProDeptRoleBean> getRoleUserList(@Param("bean") ProDeptRoleBean bean); List<ProDeptRoleBean> getRoleUserList(@Param("bean") ProDeptRoleBean bean);
List<ProDeptRoleBean> getRoleUserNoManagerList(@Param("bean")ProDeptRoleBean bean);
/** /**
* 查询组织选择列表 * 查询组织选择列表
* @return list bean * @return list bean
@ -95,4 +97,5 @@ public interface ProDeptRoleDao {
Long getParentOrgById(MapVo mapVo); Long getParentOrgById(MapVo mapVo);
String getOrgChildById(Long orgId); String getOrgChildById(Long orgId);
} }

View File

@ -44,4 +44,6 @@ public interface ProDeptRoleService {
List<ProDeptRoleBean> getMoreOrgData(ProDeptRoleBean bean); List<ProDeptRoleBean> getMoreOrgData(ProDeptRoleBean bean);
ProDeptRoleBean getInfoById(ProDeptRoleBean o); ProDeptRoleBean getInfoById(ProDeptRoleBean o);
List<ProDeptRoleBean> getRoleUserNoManagerList(ProDeptRoleBean bean);
} }

View File

@ -7,6 +7,7 @@ import com.bonus.common.core.utils.BuildTreeUtil;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.system.api.domain.MapVo; import com.bonus.system.api.domain.MapVo;
import com.bonus.system.api.domain.SysUser;
import com.bonus.system.basic.domain.SysNotice; import com.bonus.system.basic.domain.SysNotice;
import com.bonus.system.basic.domain.SysOrg; import com.bonus.system.basic.domain.SysOrg;
import com.bonus.system.basic.service.SysNoticeService; import com.bonus.system.basic.service.SysNoticeService;
@ -40,21 +41,49 @@ public class ProDeptRoleServiceImpl implements ProDeptRoleService {
@Override @Override
public List<ProDeptRoleBean> getRoleUserList(ProDeptRoleBean bean) { public List<ProDeptRoleBean> getRoleUserList(ProDeptRoleBean bean) {
//只能查自己分公司的人 //只能查自己分公司的人
List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList(); SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
if(!orgList.isEmpty()){ List<String> roleId = sysUser.getRoleList();
ArrayList<String> ids = new ArrayList<>(); if (Collections.frequency(roleId, 1L)>0) {
for (MapVo mapVo : orgList) { List<MapVo> orgList = sysUser.getOrgList();
Long orgId = proDeptRoleDao.getParentOrgById(mapVo); if (!orgList.isEmpty()) {
String id = proDeptRoleDao.getOrgChildById(orgId); ArrayList<String> ids = new ArrayList<>();
// 使用 Arrays.asList() 将数组转换为 ArrayList for (MapVo mapVo : orgList) {
ArrayList<String> idList = new ArrayList<>(Arrays.asList(id.split(","))); // Long orgId = proDeptRoleDao.getParentOrgById(mapVo);
ids.addAll(idList); // String id = proDeptRoleDao.getOrgChildById(orgId);
// // 使用 Arrays.asList() 将数组转换为 ArrayList
// ArrayList<String> idList = new ArrayList<>(Arrays.asList(id.split(",")));
// ids.addAll(idList);
ids.add(String.valueOf(mapVo.getId()));
}
bean.setOrgList(ids);
} }
bean.setOrgList(ids);
} }
return proDeptRoleDao.getRoleUserList(bean); return proDeptRoleDao.getRoleUserList(bean);
} }
public List<ProDeptRoleBean> getRoleUserNoManagerList(ProDeptRoleBean bean) {
//只能查自己分公司的人
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
List<String> roleId = sysUser.getRoleList();
if (Collections.frequency(roleId, 1L)>0) {
List<MapVo> orgList = sysUser.getOrgList();
if (!orgList.isEmpty()) {
ArrayList<String> ids = new ArrayList<>();
for (MapVo mapVo : orgList) {
// String id = proDeptRoleDao.getOrgChildById(orgId);
// // 使用 Arrays.asList() 将数组转换为 ArrayList
// ArrayList<String> idList = new ArrayList<>(Arrays.asList(id.split(",")));
// ids.addAll(idList);
ids.add(String.valueOf(mapVo.getId()));
}
bean.setOrgList(ids);
}
}
return proDeptRoleDao.getRoleUserNoManagerList(bean);
}
/** /**
* 更新项目部角色人员 * 更新项目部角色人员
* *
@ -67,7 +96,7 @@ public class ProDeptRoleServiceImpl implements ProDeptRoleService {
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public int updatePersonAssignment(ProDeptRoleDo bean,String personStatus) { public int updatePersonAssignment(ProDeptRoleDo bean, String personStatus) {
int result = 0; int result = 0;
Long loginId = SecurityUtils.getLoginUser().getSysUser().getUserId(); Long loginId = SecurityUtils.getLoginUser().getSysUser().getUserId();
bean.setCreateUserId(loginId); bean.setCreateUserId(loginId);
@ -98,11 +127,11 @@ public class ProDeptRoleServiceImpl implements ProDeptRoleService {
Map<String, List<String>> stringListMap = compareLists(oldCheckList, checkList); Map<String, List<String>> stringListMap = compareLists(oldCheckList, checkList);
delList = stringListMap.get("onlyInList1"); delList = stringListMap.get("onlyInList1");
addList = stringListMap.get("onlyInList2"); addList = stringListMap.get("onlyInList2");
if (result > 0 ) { if (result > 0) {
//获取部门负责人 //获取部门负责人
List<Long> userList = noticeService.getUserIdByOrgId(bean.getOrgId()); List<Long> userList = noticeService.getUserIdByOrgId(bean.getOrgId());
// List 转换为数组 // List 转换为数组
if(!userList.isEmpty()){ if (!userList.isEmpty()) {
Long[] userIds = userList.toArray(new Long[0]); Long[] userIds = userList.toArray(new Long[0]);
//发送审批消息 //发送审批消息
SysNotice notice = new SysNotice(); SysNotice notice = new SysNotice();
@ -233,10 +262,10 @@ public class ProDeptRoleServiceImpl implements ProDeptRoleService {
orgList = Arrays.asList(moreOrgId.split(",")); orgList = Arrays.asList(moreOrgId.split(","));
} }
//这一块要组装数据需要先处理分页让框架自动分页 //这一块要组装数据需要先处理分页让框架自动分页
List<String> list = proDeptRoleDao.getOrgEightRoleDetail(orgList,bean.getParentOrgName()); List<String> list = proDeptRoleDao.getOrgEightRoleDetail(orgList, bean.getParentOrgName());
//再去查真实数据处理 //再去查真实数据处理
List<ProDeptRoleBean> resultList = new ArrayList<>(); List<ProDeptRoleBean> resultList = new ArrayList<>();
if(!list.isEmpty()){ if (!list.isEmpty()) {
resultList = proDeptRoleDao.getDataDetail(list); resultList = proDeptRoleDao.getDataDetail(list);
} }
return rowSwitch(resultList); return rowSwitch(resultList);
@ -245,7 +274,7 @@ public class ProDeptRoleServiceImpl implements ProDeptRoleService {
@Override @Override
public List<ProDeptRoleBean> getMoreOrgData(ProDeptRoleBean bean) { public List<ProDeptRoleBean> getMoreOrgData(ProDeptRoleBean bean) {
List<ProDeptRoleBean> moreOrgData = proDeptRoleDao.getMoreOrgData(bean); List<ProDeptRoleBean> moreOrgData = proDeptRoleDao.getMoreOrgData(bean);
if(!moreOrgData.isEmpty()){ if (!moreOrgData.isEmpty()) {
moreOrgData = proDeptRoleDao.getMoreOrgDataByUserName(bean, moreOrgData); moreOrgData = proDeptRoleDao.getMoreOrgDataByUserName(bean, moreOrgData);
} }
return moreOrgData; return moreOrgData;
@ -258,6 +287,7 @@ public class ProDeptRoleServiceImpl implements ProDeptRoleService {
/** /**
* 列转行 * 列转行
*
* @param resultList * @param resultList
* @return * @return
*/ */
@ -278,7 +308,7 @@ public class ProDeptRoleServiceImpl implements ProDeptRoleService {
if (StringUtils.isEmpty(userName)) { if (StringUtils.isEmpty(userName)) {
// 如果存在 null 用户名添加缺员角色 // 如果存在 null 用户名添加缺员角色
bean.setUserName("缺员"); bean.setUserName("缺员");
}else{ } else {
//将人名称添加到集合中 //将人名称添加到集合中
// 如果有非 null 的用户名并且存在相同字段 // 如果有非 null 的用户名并且存在相同字段
String[] split = userName.split(","); String[] split = userName.split(",");
@ -295,7 +325,7 @@ public class ProDeptRoleServiceImpl implements ProDeptRoleService {
List<String> duplicates = new ArrayList<>(); List<String> duplicates = new ArrayList<>();
for (Map.Entry<String, Integer> entryMap : countMap.entrySet()) { for (Map.Entry<String, Integer> entryMap : countMap.entrySet()) {
if (entryMap.getValue() > 1) { if (entryMap.getValue() > 1) {
duplicates.add(entryMap.getKey()); duplicates.add(entryMap.getKey());
} }
} }
//将名字与重复集合比较包含重复元素的将其改为"兼职" //将名字与重复集合比较包含重复元素的将其改为"兼职"

View File

@ -344,7 +344,7 @@ public class ExportFileController {
writer.merge(rowNum + listData.size(), rowNum + listData.size() + 1, 0, 0, writer.merge(rowNum + listData.size(), rowNum + listData.size() + 1, 0, 0,
"说明", false); "说明", false);
writer.merge(rowNum + listData.size(), rowNum + listData.size(), 1, 2 + days.size(), writer.merge(rowNum + listData.size(), rowNum + listData.size(), 1, 2 + days.size(),
"1.考勤记录:出勤记“√”,出差记“Δ”,年休假记“年”,探亲假记“探”,事假记“事”,法定假记“法”,病假记“病”,产假记“产”,婚假记“婚”,丧假记“丧”,补休记“补”,旷工记“旷”,迟到记“迟”,早退记“退”,省内工地记“工”,省外工地记“外”,出差需在备注栏备注清楚出差地点。", false); "1.考勤记录:出勤记“√”,出差记“Δ”,年休假记“年”,探亲假记“探”,事假记“事”,法定假记“法”,病假记“病”,产假记“产”,婚假记“婚”,丧假记“丧”,育儿假记“育”,补休记“补”,旷工记“旷”,迟到记“迟”,早退记“退”,省内工地记“工”,省外工地记“外”,出差需在备注栏备注清楚出差地点。", false);
writer.merge(rowNum + listData.size() + 1, rowNum + listData.size() + 1, 1, 2 + days.size(), writer.merge(rowNum + listData.size() + 1, rowNum + listData.size() + 1, 1, 2 + days.size(),
"2.员工有关请假凭证记录清楚准确与本表于次月3日前一并报人力资源管理部门专业分公司报送时间为30日前", false); "2.员工有关请假凭证记录清楚准确与本表于次月3日前一并报人力资源管理部门专业分公司报送时间为30日前", false);
writer.autoSizeColumn(3); writer.autoSizeColumn(3);

View File

@ -122,7 +122,7 @@ public class HolidayController extends BaseController {
@Log(title = "流程管理->假期管理->列表查询", businessType = BusinessType.QUERY) @Log(title = "流程管理->假期管理->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo checkList(HolidayBean bean) { public TableDataInfo checkList(HolidayBean bean) {
try{ try{
List<HolidayBean> holidayList = holidayService.getHolidayList(bean); List<HolidayBean> holidayList = holidayService.getHolidayListCheck(bean);
return endPage(holidayList); return endPage(holidayList);
}catch (Exception e){ }catch (Exception e){
log.error(e.toString(),e); log.error(e.toString(),e);

View File

@ -62,4 +62,6 @@ public interface HolidayService {
int changeStatus(HolidayBean o); int changeStatus(HolidayBean o);
AjaxResult excelUpload(MultipartFile file, HttpServletRequest request, HttpServletResponse response); AjaxResult excelUpload(MultipartFile file, HttpServletRequest request, HttpServletResponse response);
List<HolidayBean> getHolidayListCheck(HolidayBean bean);
} }

View File

@ -55,6 +55,12 @@ public class HolidayServiceImpl implements HolidayService {
@Override @Override
public List<HolidayBean> getHolidayList(HolidayBean bean) { public List<HolidayBean> getHolidayList(HolidayBean bean) {
//只能查自己部门的人
return holidayDao.getHolidayList(bean);
}
@Override
public List<HolidayBean> getHolidayListCheck(HolidayBean bean) {
//只能查自己部门的人 //只能查自己部门的人
List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList(); List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList();
if(!orgList.isEmpty()){ if(!orgList.isEmpty()){

View File

@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
org_id as orgId, org_id as orgId,
org_name as orgName, org_name as orgName,
att_current_month as attCurrentMonth, att_current_month as attCurrentMonth,
count(awa.user_id) as outCount,
coalesce(required_days,0) as requiredDays, coalesce(required_days,0) as requiredDays,
coalesce(normal_num,0) as normalNum, coalesce(normal_num,0) as normalNum,
coalesce(late_num,0) as lateNum, coalesce(late_num,0) as lateNum,
@ -61,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
coalesce(address_error_num,0) as addressErrorNum, coalesce(address_error_num,0) as addressErrorNum,
coalesce(ein_error_num,0) as einErrorNum coalesce(ein_error_num,0) as einErrorNum
from att_month_report amr from att_month_report amr
LEFT JOIN att_work_abnormal awa ON LOCATE(amr.att_current_month,awa.att_current_day) and awa.user_id = amr.user_id
where amr.is_active = 1 where amr.is_active = 1
and amr.required_days != amr.normal_num and amr.required_days != amr.normal_num
<if test="attCurrentMonth != null and attCurrentMonth != '' "> <if test="attCurrentMonth != null and attCurrentMonth != '' ">
@ -72,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="name != null and name != '' "> <if test="name != null and name != '' ">
and INSTR(amr.name,#{name}) > 0 and INSTR(amr.name,#{name}) > 0
</if> </if>
group by user_id GROUP BY amr.att_current_month,amr.user_id
</select> </select>
<select id="getOrgParentId" resultType="com.bonus.system.basic.domain.SysOrg"> <select id="getOrgParentId" resultType="com.bonus.system.basic.domain.SysOrg">
@ -165,7 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and vat.user_id = #{userId} and vat.user_id = #{userId}
</if> </if>
<if test='attStatis != null and attStatis == "6"'> <if test='attStatis != null and attStatis == "6"'>
and (vat.toWorkAttStatus in (12,13,14,15,16,17,18) or vat.offWorkAttStatus in (12,13,14,15,16,17,18)) and (vat.toWorkAttStatus in (12,13,14,15,16,17,18,19) or vat.offWorkAttStatus in (12,13,14,15,16,17,18,19))
</if> </if>
<if test='attStatis != null and attStatis != "6"'> <if test='attStatis != null and attStatis != "6"'>
<if test='attStatis == "1"'> <if test='attStatis == "1"'>

View File

@ -69,7 +69,7 @@
data_source = #{params.dataSource}, data_source = #{params.dataSource},
error_remake = #{params.errorRemake}, error_remake = #{params.errorRemake},
att_status = CASE att_status = CASE
WHEN att_status in (11,12,13,14,15,16,17,18) THEN att_status WHEN att_status in (11,12,13,14,15,16,17,18,19) THEN att_status
ELSE #{params.attStatus} ELSE #{params.attStatus}
END END
where user_id = #{params.userId} and org_id = #{params.orgId} where user_id = #{params.userId} and org_id = #{params.orgId}
@ -79,7 +79,7 @@
data_source = #{params.dataSource}, data_source = #{params.dataSource},
error_remake = #{params.errorRemake}, error_remake = #{params.errorRemake},
att_status = CASE att_status = CASE
WHEN att_status in (11,12,13,14,15,16,17,18) THEN att_status WHEN att_status in (11,12,13,14,15,16,17,18,19) THEN att_status
ELSE #{params.attStatus} ELSE #{params.attStatus}
END END
where is_update = 0 and user_id = #{params.userId} and org_id = #{params.orgId} where is_update = 0 and user_id = #{params.userId} and org_id = #{params.orgId}
@ -122,7 +122,7 @@
attendance_date as attCurrentDay, attendance_time as attCurrentTime, attendance_date as attCurrentDay, attendance_time as attCurrentTime,
CASE attendance_type WHEN '上班' THEN 1 ELSE 2 END as attType, CASE attendance_type WHEN '上班' THEN 1 ELSE 2 END as attType,
'0' as attAddress, lon as attLon, lat as attLat, '1' as dataSource '0' as attAddress, lon as attLon, lat as attLat, '1' as dataSource
from gz_cloud_test.fc_sup_attendance sup from gz_cloud.fc_sup_attendance sup
where sup.attendance_date where sup.attendance_date
<if test=' pushType == "1" '> <if test=' pushType == "1" '>
>= #{pushDate} >= #{pushDate}
@ -315,7 +315,8 @@
SELECT la.*, SELECT la.*,
sdd.dict_value AS attStatus sdd.dict_value AS attStatus
FROM leave_apply la FROM leave_apply la
LEFT JOIN sys_dict_data sdd ON sdd.dict_label = la.leave_type LEFT JOIN sys_dict_data sdd ON sdd.dict_label = if(la.type is not null,la.type,la.leave_type)
AND sdd.dict_type = 'att_status'
LEFT JOIN att_group_person_relation agpr ON la.user_id = agpr.user_id LEFT JOIN att_group_person_relation agpr ON la.user_id = agpr.user_id
WHERE la.is_active = 1 WHERE la.is_active = 1
AND la.examine_status = 1 AND la.examine_status = 1

View File

@ -5,9 +5,11 @@
<mapper namespace="com.bonus.system.att.dao.AttendanceDetailsDao"> <mapper namespace="com.bonus.system.att.dao.AttendanceDetailsDao">
<select id="selectAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean"> <select id="selectAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
select su.user_name, so.org_name, v.* from v_att_update_data v select su.user_name, so.org_name,COUNT( awa.user_id ) as outCount, v.* from v_att_update_data v
left join sys_user su on su.user_id = v.user_id left join sys_user su on su.user_id = v.user_id
left join sys_organization so on so.id = v.org_id left join sys_organization so on so.id = v.org_id
LEFT JOIN att_work_abnormal awa ON v.user_id = awa.user_id
AND v.att_current_day = awa.att_current_day
where v.att_current_day BETWEEN #{startDate} AND #{endDate} where v.att_current_day BETWEEN #{startDate} AND #{endDate}
<if test="orgId != null and orgId != ''"> <if test="orgId != null and orgId != ''">
AND v.org_id = #{orgId} AND v.org_id = #{orgId}
@ -16,7 +18,7 @@
AND su.user_name like concat('%', #{userName}, '%') AND su.user_name like concat('%', #{userName}, '%')
</if> </if>
<if test='attStatus != null and attStatus == "6"'> <if test='attStatus != null and attStatus == "6"'>
and (v.toWorkAttStatus in (12,13,14,15,16,17,18) or v.offWorkAttStatus in (12,13,14,15,16,17,18)) and (v.toWorkAttStatus in (12,13,14,15,16,17,18,19) or v.offWorkAttStatus in (12,13,14,15,16,17,18,19))
</if> </if>
<if test='attStatus != null and attStatus != "6"'> <if test='attStatus != null and attStatus != "6"'>
<if test='attStatus == "1"'> <if test='attStatus == "1"'>
@ -26,7 +28,11 @@
and ( toWorkAttStatus = #{attStatus} or offWorkAttStatus = #{attStatus} ) and ( toWorkAttStatus = #{attStatus} or offWorkAttStatus = #{attStatus} )
</if> </if>
</if> </if>
ORDER BY att_current_day DESC GROUP BY
v.att_current_day,
v.user_id
ORDER BY
v.att_current_day DESC
</select> </select>
<select id="exportAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean"> <select id="exportAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
@ -135,14 +141,22 @@
</select> </select>
<select id="getAttDayReportList" resultType="com.bonus.system.att.entity.AttDayReportBean"> <select id="getAttDayReportList" resultType="com.bonus.system.att.entity.AttDayReportBean">
select * SELECT
from att_day_report adr.*,
where att_current_day BETWEEN #{startDate} AND #{endDate} COUNT( awa.user_id ) as outCount
FROM
att_day_report adr
LEFT JOIN att_work_abnormal awa ON awa.att_current_day = adr.att_current_day and awa.org_id = adr.org_id
WHERE
adr.att_current_day BETWEEN #{startDate} AND #{endDate}
GROUP BY
adr.att_current_day
</select> </select>
<select id="getAttMonthReportList" resultType="com.bonus.system.att.entity.AttMonthReportBean"> <select id="getAttMonthReportList" resultType="com.bonus.system.att.entity.AttMonthReportBean">
select v.*, v.name as userName from att_month_report v select v.*, v.name as userName,count(awa.user_id) as outCount from att_month_report v
left join att_group_person_relation p on p.user_id = v.user_id and p.is_active = 1 left join att_group_person_relation p on p.user_id = v.user_id and p.is_active = 1
LEFT JOIN att_work_abnormal awa ON LOCATE(v.att_current_month,awa.att_current_day) and awa.user_id = v.user_id
where v.att_current_month = #{month} and p.group_id is not null where v.att_current_month = #{month} and p.group_id is not null
<if test="orgId != null and orgId != ''"> <if test="orgId != null and orgId != ''">
AND v.org_id = #{orgId} AND v.org_id = #{orgId}
@ -150,6 +164,7 @@
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
AND v.name like concat('%', #{userName}, '%') AND v.name like concat('%', #{userName}, '%')
</if> </if>
GROUP BY v.att_current_month,v.user_id
</select> </select>
<select id="getAttDayReportDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean"> <select id="getAttDayReportDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
@ -164,7 +179,7 @@
AND att_current_day between #{startDate} AND #{endDate} AND att_current_day between #{startDate} AND #{endDate}
</if> </if>
<if test='attStatus != null and attStatus == "6"'> <if test='attStatus != null and attStatus == "6"'>
and (toWorkAttStatus in (12,13,14,15,16,17,18) or offWorkAttStatus in (12,13,14,15,16,17,18)) and (toWorkAttStatus in (12,13,14,15,16,17,18,19) or offWorkAttStatus in (12,13,14,15,16,17,18,19))
</if> </if>
<if test='attStatus != null and attStatus != "6"'> <if test='attStatus != null and attStatus != "6"'>
<if test='attStatus == "1"'> <if test='attStatus == "1"'>
@ -180,6 +195,30 @@
</where> </where>
ORDER BY att_current_day DESC ORDER BY att_current_day DESC
</select> </select>
<select id="getOutCountList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
SELECT
awa.user_name,
so.org_name,
awa.att_current_day,
awa.att_current_time,
awa.att_address
FROM
att_work_abnormal awa
LEFT JOIN sys_organization so ON so.id = awa.org_id and so.is_active = '1'
<where>
<if test="attCurrentDay != null and attCurrentDay != ''">
and awa.att_current_day = #{attCurrentDay}
</if>
<if test="userId != null and userId != ''">
and awa.user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
and locate(#{userName},awa.user_name)
</if>
</where>
ORDER BY
awa.att_current_day DESC
</select>
<update id="updateAttDetailsData"> <update id="updateAttDetailsData">

View File

@ -33,7 +33,7 @@
<insert id="pushAttDataToQsy"> <insert id="pushAttDataToQsy">
<foreach collection="list" item="item" separator=";"> <foreach collection="list" item="item" separator=";">
replace INTO gz_cloud_test.fc_sup_attendance ( replace INTO gz_cloud.fc_sup_attendance (
name, name,
id_number, id_number,
org_id, org_id,
@ -175,7 +175,7 @@
If(PROJECT_ID is null,0,PROJECT_ID) AS proId, If(PROJECT_ID is null,0,PROJECT_ID) AS proId,
If(ORG_ID is null,0,ORG_ID) AS orgId If(ORG_ID is null,0,ORG_ID) AS orgId
FROM FROM
gz_cloud_test.bm_sup_attend_history gz_cloud.bm_sup_attend_history
WHERE WHERE
ID_NUMBER = #{idNumber} ID_NUMBER = #{idNumber}
limit 1 limit 1

View File

@ -300,4 +300,8 @@
select org_id from att_group_person_relation where user_id=#{userId} and is_active = 1 limit 1 select org_id from att_group_person_relation where user_id=#{userId} and is_active = 1 limit 1
</select> </select>
<select id="getRoleListById" resultType="java.lang.String">
select role_id from sys_user_role
where user_id = #{userId}
</select>
</mapper> </mapper>

View File

@ -63,6 +63,65 @@
Order BY aa.update_time DESC Order BY aa.update_time DESC
</select> </select>
<select id="getRoleUserNoManagerList" resultType="com.bonus.system.dept.entity.ProDeptRoleBean">
select * from(
SELECT
so.id AS orgId,
so.org_name,
sdr.id as departmentId,
sdr.reviewer_status,
sd.id AS deptRoleId,
sd.`value` as deptRoleName,
GROUP_CONCAT( DISTINCT if(sdr.reviewer_status = 1, su.user_name,null) ) AS userName,
su2.user_name AS createUser,
so.update_time
FROM
sys_organization so
LEFT JOIN sys_dict sd ON sd.type = 'deptRole'
AND sd.is_active = '1'
LEFT JOIN sys_department_role sdr ON so.id = sdr.org_id
AND sd.id = sdr.department_role_id
AND sdr.is_active = '1'
LEFT JOIN sys_user su2 ON su2.user_id = sdr.update_user_id
AND su2.is_active = '1'
LEFT JOIN sys_department_user sdu ON sdr.id = sdu.department_id
AND sdu.is_active = '1'
LEFT JOIN sys_user su ON su.user_id = sdu.user_id
AND su.is_active = '1'
where
so.is_department = '1'
AND so.is_active = '1'
and so.reviewer_status = '1'
GROUP BY
so.id,
sd.id ) aa
<where>
<if test="bean.orgName != null and bean.orgName != '' ">
and locate(#{bean.orgName},aa.org_name)
</if>
<if test="bean.deptRoleName != null and bean.deptRoleName != '' ">
and locate(#{bean.deptRoleName},aa.deptRoleName)
</if>
<if test="bean.userName != null and bean.userName != '' ">
and locate(#{bean.userName},userName)
</if>
<if test="bean.reviewerStatus != null and bean.reviewerStatus != '' ">
and aa.reviewer_status = #{bean.reviewerStatus}
</if>
<if test='bean.departmentId == -1L'>
and (aa.departmentId is null or userName is null or aa.reviewer_status !='1')
</if>
<if test='bean.orgList != null and bean.orgList.size() > 0'>
and orgId in (
<foreach collection="bean.orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
</where>
Order BY aa.update_time DESC
</select>
<select id="selectOrgUserList" resultType="com.bonus.system.dept.entity.OrgUserVo"> <select id="selectOrgUserList" resultType="com.bonus.system.dept.entity.OrgUserVo">
SELECT SELECT
CONCAT( 'o', id ) AS id, CONCAT( 'o', id ) AS id,