|
|
@@ -3,9 +3,8 @@ package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.usoftchina.smartschool.school.po.*;
|
|
|
-import com.usoftchina.smartschool.school.wxschool.basic.service.WxSchoolService;
|
|
|
-import com.usoftchina.smartschool.school.wxschool.mapper.*;
|
|
|
import com.usoftchina.smartschool.school.wxschool.basic.service.WxOaLeaveService;
|
|
|
+import com.usoftchina.smartschool.school.wxschool.mapper.*;
|
|
|
import com.usoftchina.smartschool.school.wxschool.utils.DateFormatUtil;
|
|
|
import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
|
|
|
import com.usoftchina.smartschool.wechat.api.WxPushApi;
|
|
|
@@ -15,7 +14,6 @@ import org.springframework.stereotype.Service;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
|
|
@Service
|
|
|
@@ -46,13 +44,20 @@ public class WxOaLeaveServiceImpl implements WxOaLeaveService {
|
|
|
JSONObject json = JSONObject.parseObject(leaveString);
|
|
|
OaLeaveDO leave = new OaLeaveDO();
|
|
|
leave.setLvTitle(json.getString("lvTitle"));
|
|
|
- leave.setLvDetails(json.getString("lvDetails"));
|
|
|
+ String lvDetails = json.getString("lvDetails");
|
|
|
+ leave.setLvDetails(lvDetails);
|
|
|
leave.setLvType(json.getInteger("lvType"));
|
|
|
leave.setApplyDate(new Date());
|
|
|
Long lvProposer = json.getLong("lvProposer");
|
|
|
leave.setSchoolId(studentMapper.get(lvProposer).getSchoolId());
|
|
|
- leave.setEndDate(DateFormatUtil.string2Date(json.getString("endDate")));
|
|
|
- leave.setStartDate(DateFormatUtil.string2Date(json.getString("startDate")));
|
|
|
+ String endDate = json.getString("endDate");
|
|
|
+ if (ObjectUtils.isNotEmpty(endDate)){
|
|
|
+ leave.setEndDate(DateFormatUtil.string2Date(endDate));
|
|
|
+ }
|
|
|
+ String startDate = json.getString("startDate");
|
|
|
+ if (ObjectUtils.isNotEmpty(startDate)){
|
|
|
+ leave.setStartDate(DateFormatUtil.string2Date(startDate));
|
|
|
+ }
|
|
|
leave.setLvStatus(1);
|
|
|
leave.setLvRemarks(json.getString("lvRemarks"));
|
|
|
String lvFiles = json.getString("lvFiles");
|
|
|
@@ -67,11 +72,12 @@ public class WxOaLeaveServiceImpl implements WxOaLeaveService {
|
|
|
for (Long teacherId : longs) {
|
|
|
TeacherDO teacherDO = teacherMapper.get(teacherId);
|
|
|
SchoolDO schoolDO = wxSchoolMapper.get(teacherDO.getSchoolId());
|
|
|
+ String stuName = studentMapper.get(lvProposer).getStuName();
|
|
|
try {
|
|
|
wxPushApi.wxPush(schoolDO.getSchoolAppid(), schoolDO.getSchoolSecret(), teacherDO.getOpenid(),
|
|
|
"QC8H4hQd1Fh0wqaaE3mbAxvoBC6y-XkHctIe8Kx6gcA", "您好,您有一个来自家长的请假申请",
|
|
|
- studentMapper.get(lvProposer).getStuName(),
|
|
|
- json.getString("startDate") + "-" + json.getString("endDate"), leave.getLvDetails(), "-",
|
|
|
+ stuName,
|
|
|
+ startDate + "-" + endDate, lvDetails, "-",
|
|
|
"点击查看详情", "https://school-wechat.ubtob.com/leavedetail/teacher/" + leave.getLvId());
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|