فهرست منبع

手动同步申请单接口

yusm 1 هفته پیش
والد
کامیت
dc310fd4a3
11فایلهای تغییر یافته به همراه793 افزوده شده و 12 حذف شده
  1. 204 5
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/AlertTimeController.java
  2. 21 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/ApplyFormController.java
  3. 2 2
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/AttendanceStaffController.java
  4. 99 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/ApplyForm.java
  5. 16 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/mapper/ApplyFormMapper.java
  6. 16 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/ApplyFormService.java
  7. 1 1
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/AttendanceStaffService.java
  8. 20 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ApplyFormServiceImpl.java
  9. 13 3
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/AttendanceStaffServiceImpl.java
  10. 377 1
      fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/task/TimingTask.java
  11. 24 0
      fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ApplyFormMapper.xml

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 204 - 5
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/AlertTimeController.java


+ 21 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/ApplyFormController.java

@@ -0,0 +1,21 @@
+package com.management.platform.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-06-19
+ */
+@RestController
+@RequestMapping("/apply-form")
+public class ApplyFormController {
+
+}
+

+ 2 - 2
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/controller/AttendanceStaffController.java

@@ -38,8 +38,8 @@ public class AttendanceStaffController {
 
     //考勤列表
     @RequestMapping("/getListData")
-    private HttpRespMsg getListData(String month) {
-        return attendanceStaffService.getListData(month);
+    private HttpRespMsg getListData(String month,String userId,Integer pageIndex ,Integer pageSize) {
+        return attendanceStaffService.getListData(month,userId,pageIndex,pageSize);
     }
 
 

+ 99 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/entity/ApplyForm.java

@@ -0,0 +1,99 @@
+package com.management.platform.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-06-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class ApplyForm extends Model<ApplyForm> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 3:请假单;4:加班申请;(存在一张单据多人请假的情况)5:车间提前下班申请单  6考勤证明补卡单
+     */
+    @TableField("type")
+    private Integer type;
+
+    /**
+     * 申请单类型名称
+     */
+    @TableField("type_name")
+    private String typeName;
+
+    /**
+     * 申请单申请名称
+     */
+    @TableField("apply_bill_name")
+    private String applyBillName;
+
+    /**
+     * 申请人的关键信息,(员工工号)
+     */
+    @TableField("apply_id")
+    private String applyId;
+
+    /**
+     * 申请单单号
+     */
+    @TableField("sp_no")
+    private String spNo;
+
+    /**
+     * 申请单内容
+     */
+    @TableField("content")
+    private String content;
+
+    /**
+     * 开始时间
+     */
+    @TableField("start_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime startTime;
+
+    /**
+     * 结束时间
+     */
+    @TableField("end_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime endTime;
+
+    /**
+     * 总时长
+     */
+    @TableField("sum_time")
+    private BigDecimal sumTime;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/mapper/ApplyFormMapper.java

@@ -0,0 +1,16 @@
+package com.management.platform.mapper;
+
+import com.management.platform.entity.ApplyForm;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-06-19
+ */
+public interface ApplyFormMapper extends BaseMapper<ApplyForm> {
+
+}

+ 16 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/ApplyFormService.java

@@ -0,0 +1,16 @@
+package com.management.platform.service;
+
+import com.management.platform.entity.ApplyForm;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-06-19
+ */
+public interface ApplyFormService extends IService<ApplyForm> {
+
+}

+ 1 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/AttendanceStaffService.java

@@ -18,7 +18,7 @@ public interface AttendanceStaffService extends IService<AttendanceStaff> {
 
     HttpRespMsg refreshData(String month);
 
-    HttpRespMsg getListData(String month);
+    HttpRespMsg getListData(String month,String userId,Integer pageIndex ,Integer pageSize);
 
     HttpRespMsg getAttendanceUserData(String month, String date, String userId, HttpServletRequest request);
 }

+ 20 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ApplyFormServiceImpl.java

@@ -0,0 +1,20 @@
+package com.management.platform.service.impl;
+
+import com.management.platform.entity.ApplyForm;
+import com.management.platform.mapper.ApplyFormMapper;
+import com.management.platform.service.ApplyFormService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author Seyason
+ * @since 2025-06-19
+ */
+@Service
+public class ApplyFormServiceImpl extends ServiceImpl<ApplyFormMapper, ApplyForm> implements ApplyFormService {
+
+}

+ 13 - 3
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/AttendanceStaffServiceImpl.java

@@ -1,6 +1,8 @@
 package com.management.platform.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.Attendance;
 import com.management.platform.entity.AttendanceStaff;
 import com.management.platform.entity.DayInfo;
@@ -192,10 +194,18 @@ public class AttendanceStaffServiceImpl extends ServiceImpl<AttendanceStaffMappe
     }
 
     @Override
-    public HttpRespMsg getListData(String month) {
+    public HttpRespMsg getListData(String month,String userId,Integer pageIndex ,Integer pageSize) {
         HttpRespMsg msg = new HttpRespMsg();
-        List<AttendanceStaff> list = list(new QueryWrapper<AttendanceStaff>().eq("month", month));
-        msg.setData(list);
+        QueryWrapper<AttendanceStaff> wrapper = new QueryWrapper<AttendanceStaff>().eq("month", month);
+        if (StringUtils.isNotBlank(userId)) {
+            User user = userService.getById(userId);
+            wrapper.eq("job_number", user.getJobNumber());
+        }
+        IPage<Attendance> iPage = page(new Page(pageIndex, pageSize), wrapper);
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("total", iPage.getTotal());
+        map.put("records", iPage.getRecords());
+        msg.setData(map);
         return msg;
     }
 

+ 377 - 1
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/task/TimingTask.java

@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.injector.methods.SelectById;
 import com.management.platform.controller.WeiXinCorpController;
 import com.management.platform.entity.*;
-import com.management.platform.entity.vo.TokenVo;
+import com.management.platform.entity.vo.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
 import com.management.platform.service.impl.WxCorpInfoServiceImpl;
@@ -113,6 +113,8 @@ public class TimingTask {
     private ReportService reportService;
     @Resource
     private PlanExtraInfoService extraInfoService;
+    @Resource
+    private ApplyFormService applyFormService;
 
     private static final List<Integer> VALID_TOKEN_CHARS = new ArrayList<>();
     static {
@@ -1415,4 +1417,378 @@ public class TimingTask {
 
     }
 
+    public void temporarilyApplyFormData(String endDate, String startDate, Integer templateType) throws Exception {
+        JSONArray jsonArrayFilter = new JSONArray();
+        JSONObject filter1 = new JSONObject();
+        WxCorpTemplate template = wxCorpTemplateService.getOne(new QueryWrapper<WxCorpTemplate>().eq("company_id",7).eq("type",templateType));//3:请假单;4:加班申请;(存在一张单据多人请假的情况)5:车间提前下班申请单  6考勤证明补卡单
+        filter1.put("key","template_id");
+        filter1.put("value",template.getTemplateId());
+        jsonArrayFilter.add(filter1);
+        JSONObject filter2 = new JSONObject();
+        filter2.put("key","sp_status");
+        filter2.put("value","2");
+        jsonArrayFilter.add(filter2);
+        List<String> approvalInfo = wxCorpInfoService.getApprovalInfo(7, startDate, endDate, "", jsonArrayFilter);
+
+        if(approvalInfo!=null&& !approvalInfo.isEmpty()){
+            for (int j = 0; j < approvalInfo.size(); j++) {
+                String codeNum = approvalInfo.get(j);
+                String approvalInfoDetailResp = wxCorpInfoService.getApprovalInfoDetail(7, codeNum);
+                JSONObject jsonObject = JSONObject.parseObject(approvalInfoDetailResp);
+
+                if (templateType==3){
+                    JSONObject info = jsonObject.getJSONObject("info");
+                    String spNo = info.getString("sp_no");
+                    ApplyForm applyForm = new ApplyForm();
+                    int count = applyFormService.count(new QueryWrapper<ApplyForm>().eq("sp_no", spNo));
+                    if (count==0){
+                        String spName = info.getString("sp_name");
+                        applyForm.setType(3);
+                        applyForm.setTypeName(spName);
+                        applyForm.setSpNo(spNo);
+                        JSONObject applyer = info.getJSONObject("applyer");
+                        String applyerId = applyer.getString("userid");
+                        applyForm.setApplyId(applyerId);
+                        JSONObject apply_data = info.getJSONObject("apply_data");
+                        JSONArray contents = apply_data.getJSONArray("contents");
+
+                        for (int i = 0; i < contents.size(); i++) {
+                            JSONObject contentsJSONObject = contents.getJSONObject(i);
+                            JSONArray title = contentsJSONObject.getJSONArray("title");
+                            JSONObject value = contentsJSONObject.getJSONObject("value");
+                            String control = contentsJSONObject.getString("control");
+
+
+                            if (title.getJSONObject(0).getString("text").equals("请假类型")) {
+                                if (control.equals("Vacation")) {
+                                    JSONObject selector = value.getJSONObject("vacation").getJSONObject("selector");
+                                    String type = selector.getString("type");
+
+                                    if (type.equals("single")) {
+                                        JSONObject leaveComment = selector.getJSONArray("options").getJSONObject(0).getJSONArray("value").getJSONObject(0);
+                                        String leaveName = leaveComment.getString("text");
+                                        applyForm.setApplyBillName(leaveName);
+                                    }
+
+                                    JSONObject attendance = value.getJSONObject("vacation").getJSONObject("attendance");
+                                    long begin = attendance.getJSONObject("date_range").getLongValue("new_begin");
+                                    long end = attendance.getJSONObject("date_range").getLongValue("new_end");
+                                    long duration = attendance.getJSONObject("date_range").getLongValue("new_duration");
+
+                                    LocalDateTime startTime = Instant.ofEpochSecond(begin)
+                                            .atZone(ZoneId.systemDefault())
+                                            .toLocalDateTime();
+
+                                    LocalDateTime endTime = Instant.ofEpochSecond(end)
+                                            .atZone(ZoneId.systemDefault())
+                                            .toLocalDateTime();
+                                    // 1. 计算小时(秒 → 小时)
+                                    BigDecimal hours = BigDecimal.valueOf(duration)
+                                            .divide(BigDecimal.valueOf(3600), 1, RoundingMode.HALF_UP);
+                                    applyForm.setStartTime(startTime);
+                                    applyForm.setEndTime(endTime);
+                                    applyForm.setSumTime(hours);
+
+                                }
+                            }
+
+                            if (title.getJSONObject(0).getString("text").equals("请假事由")) {
+                                if (control.equals("Textarea")) {
+                                    String leaveContent = value.getString("text");
+                                    applyForm.setContent(leaveContent);
+                                }
+                            }
+                        }
+
+                        applyFormService.save(applyForm);
+                    }
+                }
+                else if (templateType==4){
+                    OverTimeVo overTimeVo = new OverTimeVo();
+                    ArrayList<DeptVo> deptVoList = new ArrayList<>();
+                    ArrayList<WorkVo> workVoList = new ArrayList<>();
+
+                    JSONObject info = jsonObject.getJSONObject("info");
+                    String spNo = info.getString("sp_no");
+                    Integer spStatus = info.getInteger("sp_status");
+                    String spName = info.getString("sp_name");
+                    Long applyTime = info.getLongValue("apply_time");
+
+                    overTimeVo.setSpNo(spNo);
+                    int count = applyFormService.count(new QueryWrapper<ApplyForm>().eq("sp_no", spNo));
+                    if (count>0){
+                        continue;
+                    }
+                    overTimeVo.setSpName(spName);
+                    overTimeVo.setApplyTime(applyTime);
+                    overTimeVo.setSpStatus(spStatus);
+
+                    JSONObject applyer = info.getJSONObject("applyer");
+                    String applyerId = applyer.getString("userid");
+
+                    overTimeVo.setApplyId(applyerId);
+
+
+                    JSONObject apply_data = info.getJSONObject("apply_data");
+                    JSONArray contents = apply_data.getJSONArray("contents");
+
+                    for (int i = 0; i < contents.size(); i++) {
+                        JSONObject contentsJSONObject = contents.getJSONObject(i);
+                        JSONArray title = contentsJSONObject.getJSONArray("title");
+                        JSONObject value = contentsJSONObject.getJSONObject("value");
+                        String control = contentsJSONObject.getString("control");
+
+
+                        if(title.getJSONObject(0).getString("text").equals("部门(工位)")){
+                            if(control.equals("Contact")){
+                                JSONArray departmentJsons = value.getJSONArray("departments");
+                                for (int i1 = 0; i1 < departmentJsons.size(); i1++) {
+                                    DeptVo deptVo = new DeptVo();
+                                    String dept_openapId = departmentJsons.getJSONObject(i1).getString("openapi_id");
+                                    String name = departmentJsons.getJSONObject(i1).getString("name");
+                                    deptVo.setDeptName(name);
+                                    deptVo.setDeptOpenapId(dept_openapId);
+                                    deptVoList.add(deptVo);
+                                }
+                                overTimeVo.setDeptList(deptVoList);
+                            }
+                        }
+
+                        if(title.getJSONObject(0).getString("text").equals("填报日期")){
+                            if(control.equals("Date")){
+                                JSONObject dateJson = value.getJSONObject("date");
+                                Long submitTime = dateJson.getLongValue("s_timestamp");
+                                overTimeVo.setSubmitTime(submitTime);
+                            }
+                        }
+
+                        if(title.getJSONObject(0).getString("text").equals("明细")){
+                            if(control.equals("Table")){
+                                JSONArray childrens = value.getJSONArray("children");
+                                for (int i1 = 0; i1 < childrens.size(); i1++) {
+                                    JSONArray list = childrens.getJSONObject(i1).getJSONArray("list");
+                                    WorkVo workVo = new WorkVo();
+                                    for (int i2 = 0; i2 < list.size(); i2++) {
+                                        JSONObject workMember = list.getJSONObject(i2);
+                                        //加班成员
+                                        if (workMember.getString("control").equals("Contact")&&workMember.getJSONArray("title").getJSONObject(0).getString("text").equals("加班成员")){
+                                            JSONObject workMemberJSONObjectValue = workMember.getJSONObject("value");
+                                            JSONArray members = workMemberJSONObjectValue.getJSONArray("members");
+                                            ArrayList<MemberVo> memberList = new ArrayList<>();
+                                            for (int i3 = 0; i3 < members.size(); i3++) {
+                                                MemberVo memberVo = new MemberVo();
+                                                String name = members.getJSONObject(i3).getString("name");
+                                                String userid = members.getJSONObject(i3).getString("userid");
+                                                memberVo.setMemberName(name);
+                                                memberVo.setMemberUserId(userid);
+                                                memberList.add(memberVo);
+                                            }
+                                            workVo.setMemberList(memberList);
+                                        }
+                                        //加班事由
+                                        if (workMember.getString("control").equals("Text")&&workMember.getJSONArray("title").getJSONObject(0).getString("text").equals("加班事由")){
+                                            JSONObject workMemberJSONObjectValue = workMember.getJSONObject("value");
+                                            String workCotent = workMemberJSONObjectValue.getString("text");
+                                            workVo.setWorkCotent(workCotent);
+                                        }
+                                        //加班时长
+                                        if (workMember.getString("control").equals("DateRange")&&workMember.getJSONArray("title").getJSONObject(0).getString("text").equals("加班时长")){
+                                            JSONObject workMemberJSONObjectValue = workMember.getJSONObject("value");
+                                            JSONObject workTime = workMemberJSONObjectValue.getJSONObject("date_range");
+                                            workVo.setDuration(workTime.getLongValue("new_duration"));
+                                            workVo.setBeginTime(workTime.getLongValue("new_begin"));
+                                            workVo.setEndTime(workTime.getLongValue("new_end"));
+                                        }
+                                    }
+                                    workVoList.add(workVo);
+                                    overTimeVo.setWorkVoList(workVoList);
+
+                                    List<WorkVo> workVos = overTimeVo.getWorkVoList();
+                                    ArrayList<ApplyForm> applyForms = new ArrayList<>();
+                                    for (WorkVo vo : workVos) {
+                                        String workCotent = vo.getWorkCotent();
+                                        Long beginTime = vo.getBeginTime();
+                                        Long endTime = vo.getEndTime();
+                                        Long duration = vo.getDuration();
+                                        LocalDateTime startTime = Instant.ofEpochSecond(beginTime)
+                                                .atZone(ZoneId.systemDefault())
+                                                .toLocalDateTime();
+
+                                        LocalDateTime end = Instant.ofEpochSecond(endTime)
+                                                .atZone(ZoneId.systemDefault())
+                                                .toLocalDateTime();
+                                        // 1. 计算小时(秒 → 小时)
+                                        BigDecimal hours = BigDecimal.valueOf(duration)
+                                                .divide(BigDecimal.valueOf(3600), 1, RoundingMode.HALF_UP);
+
+                                        List<MemberVo> memberList = vo.getMemberList();
+                                        for (MemberVo memberVo : memberList) {
+                                            ApplyForm applyForm = new ApplyForm();
+                                            applyForm.setStartTime(startTime);
+                                            applyForm.setEndTime(end);
+                                            applyForm.setSumTime(hours);
+                                            applyForm.setApplyId(memberVo.getMemberUserId());
+                                            applyForm.setContent(workCotent);
+                                            applyForm.setApplyBillName(overTimeVo.getLeaveName());
+                                            applyForm.setTypeName(spName);
+                                            applyForm.setSpNo(spNo);
+                                            applyForm.setType(4);
+                                            applyForms.add(applyForm);
+                                        }
+                                    }
+                                    applyFormService.saveBatch(applyForms);
+                                }
+                            }
+                        }
+                    }
+                }
+                else if (templateType == 5) {
+                    JSONObject info = jsonObject.getJSONObject("info");
+                    String spNo = info.getString("sp_no");
+                    int count = applyFormService.count(new QueryWrapper<ApplyForm>().eq("sp_no", spNo));
+                    if (count>0){
+                        continue;
+                    }
+                    Integer spStatus = info.getInteger("sp_status");
+                    String spName = info.getString("sp_name");
+                    Long applyTime = info.getLongValue("apply_time");
+
+                    JSONObject apply_data = info.getJSONObject("apply_data");
+                    JSONArray contents = apply_data.getJSONArray("contents");
+
+                    ArrayList<String> applyIds = new ArrayList<>();//参与人的工号
+                    StringJoiner joiner = new StringJoiner(",");//提前下班原因
+                    long newDuration=0;
+                    long newBegin=0;
+                    long newEnd=0;
+
+                    for (int i = 0; i < contents.size(); i++) {
+                        JSONObject contentsJSONObject = contents.getJSONObject(i);
+                        JSONArray title = contentsJSONObject.getJSONArray("title");
+                        JSONObject value = contentsJSONObject.getJSONObject("value");
+                        String control = contentsJSONObject.getString("control");
+
+                        if (control.equals("Contact")&&title.getJSONObject(0).getString("text").contains("申请人")){
+                            JSONArray members = value.getJSONArray("members");
+                            for (int i1 = 0; i1 < members.size(); i1++) {
+                                String userid = members.getJSONObject(i1).getString("userid");
+                                applyIds.add(userid);
+                            }
+                        }
+
+                        if (control.equals("Selector")&&title.getJSONObject(0).getString("text").contains("提前下班原因")){
+                            JSONArray jsonArray = value.getJSONObject("selector").getJSONArray("options");
+                            for (int i1 = 0; i1 < jsonArray.size(); i1++) {
+                                JSONArray jsonArray1 = jsonArray.getJSONObject(i1).getJSONArray("value");
+                                for (int i2 = 0; i2 < jsonArray1.size(); i2++) {
+                                    joiner.add(jsonArray1.getJSONObject(i2).getString("text"));
+                                }
+                            }
+                        }
+                        if (control.equals("DateRange")&&title.getJSONObject(0).getString("text").contains("提前下班时长")){
+                            JSONObject jsonObject1 = value.getJSONObject("date_range");
+                             newDuration = jsonObject1.getLongValue("new_duration");
+                             newBegin = jsonObject1.getLongValue("new_begin");
+                             newEnd = jsonObject1.getLongValue("new_end");
+                        }
+                    }
+                    ArrayList<ApplyForm> list = new ArrayList<>();
+                    for (String applyId : applyIds) {
+                        ApplyForm applyForm = new ApplyForm();
+                        applyForm.setType(5);
+                        applyForm.setTypeName(spName);
+                        applyForm.setApplyId(applyId);
+                        applyForm.setSpNo(spNo);
+                        applyForm.setContent(joiner.toString());
+                        LocalDateTime startTime = Instant.ofEpochSecond(newBegin)
+                                .atZone(ZoneId.systemDefault())
+                                .toLocalDateTime();
+
+                        LocalDateTime end = Instant.ofEpochSecond(newEnd)
+                                .atZone(ZoneId.systemDefault())
+                                .toLocalDateTime();
+                        // 1. 计算小时(秒 → 小时)
+                        BigDecimal hours = BigDecimal.valueOf(newDuration)
+                                .divide(BigDecimal.valueOf(3600), 1, RoundingMode.HALF_UP);
+                        applyForm.setStartTime(startTime);
+                        applyForm.setEndTime(end);
+                        applyForm.setSumTime(hours);
+                        list.add(applyForm);
+                    }
+                    applyFormService.saveBatch(list);
+                }
+                else if (templateType == 6) {
+                    JSONObject info = jsonObject.getJSONObject("info");
+                    String spNo = info.getString("sp_no");
+                    int count = applyFormService.count(new QueryWrapper<ApplyForm>().eq("sp_no", spNo));
+                    if (count>0){
+                        continue;
+                    }
+
+                    String spName = info.getString("sp_name");
+                    JSONObject apply_data = info.getJSONObject("apply_data");
+                    JSONArray contents = apply_data.getJSONArray("contents");
+
+                    ArrayList<ApplyForm> list = new ArrayList<>();
+
+                    for (int i = 0; i < contents.size(); i++) {
+                        JSONObject contentsJSONObject = contents.getJSONObject(i);
+                        JSONArray title = contentsJSONObject.getJSONArray("title");
+                        JSONObject value = contentsJSONObject.getJSONObject("value");
+                        String control = contentsJSONObject.getString("control");
+
+
+                        if (control.equals("Table")&&title.getJSONObject(0).getString("text").equals("明细")){
+                            JSONArray children = value.getJSONArray("children");
+                            for (int i1 = 0; i1 < children.size(); i1++) {
+                                JSONArray jsonArray = children.getJSONObject(i1).getJSONArray("list");
+                                ArrayList<ApplyForm> subList = new ArrayList<>();
+                                long longValue=0;
+                                String content="";
+                                for (int i2 = 0; i2 < jsonArray.size(); i2++) {
+                                    JSONObject jsonObject1 = jsonArray.getJSONObject(i2);
+                                    if (jsonObject1.getString("control").equals("Contact")&&jsonObject1.getJSONArray("title").getJSONObject(0).getString("text").equals("缺勤人员")){
+                                        JSONArray jsonArray1 = jsonObject1.getJSONObject("value").getJSONArray("members");
+                                        for (int i3 = 0; i3 < jsonArray1.size(); i3++) {
+                                            ApplyForm applyForm = new ApplyForm();
+                                            applyForm.setApplyId(jsonArray1.getJSONObject(i3).getString("userid"));
+                                            subList.add(applyForm);
+                                        }
+                                    }
+                                    if (jsonObject1.getString("control").equals("Date")&&jsonObject1.getJSONArray("title").getJSONObject(0).getString("text").equals("缺勤日期")){
+                                        JSONObject jsonObject2 = jsonObject1.getJSONObject("value").getJSONObject("date");
+                                        longValue = jsonObject2.getLongValue("s_timestamp");
+                                    }
+                                    if (jsonObject1.getString("control").equals("Text")&&jsonObject1.getJSONArray("title").getJSONObject(0).getString("text").equals("缺勤原因")){
+                                        content = jsonObject1.getJSONObject("value").getString("text");
+                                    }
+                                    for (ApplyForm applyForm : subList) {
+                                        applyForm.setContent(content);
+                                        LocalDateTime startTime = Instant.ofEpochSecond(longValue)
+                                                .atZone(ZoneId.systemDefault())
+                                                .toLocalDateTime();
+                                        applyForm.setStartTime(startTime);
+                                        applyForm.setEndTime(startTime);
+
+                                    }
+
+                                }
+                                list.addAll(subList);
+                            }
+
+                        }
+
+                    }
+                    for (ApplyForm applyForm : list) {
+                        applyForm.setType(6);
+                        applyForm.setTypeName(spName);
+                        applyForm.setSpNo(spNo);
+                    }
+                    applyFormService.saveBatch(list);
+                }
+
+            }
+
+        }
+    }
 }

+ 24 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/resources/mapper/ApplyFormMapper.xml

@@ -0,0 +1,24 @@
+<?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.management.platform.mapper.ApplyFormMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.management.platform.entity.ApplyForm">
+        <id column="id" property="id" />
+        <result column="type" property="type" />
+        <result column="type_name" property="typeName" />
+        <result column="apply_bill_name" property="applyBillName" />
+        <result column="apply_id" property="applyId" />
+        <result column="sp_no" property="spNo" />
+        <result column="content" property="content" />
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="sum_time" property="sumTime" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, type, type_name, apply_bill_name, apply_id, sp_no, content, start_time, end_time, sum_time
+    </sql>
+
+</mapper>