liusheng
2024-03-25 be02590dd13a51e6a940738ee91365acd7df2ab0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -1,9 +1,13 @@
package com.ruoyi.quartz.task;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.project.domain.*;
import com.ruoyi.project.domain.vo.DingTalkReqVo;
import com.ruoyi.project.service.*;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysUserService;
import com.taobao.api.ApiException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -42,9 +46,12 @@
    @Autowired
    private IServiceFundflowruleService iServiceFundflowruleService;
    @Autowired
    @Autowired
    private IServiceFundService serviceFundService;
    @Autowired
    private ISysUserService sysUserService;
    @Autowired
@@ -62,7 +69,7 @@
        System.out.println("执行无参方法");
    }
    public void checkReportInfo() {
    public void checkReportInfo() throws ApiException {
        //查出所有被医院退回的Fund数据
        List<ServiceFundShared> serviceFundShareds = serviceFundSharedService.queryFundShareList();
        for (ServiceFundShared serviceFundShared : serviceFundShareds) {
@@ -85,7 +92,9 @@
                serviceFund1.setRecordstatus(-1);
                serviceFund1.setBackflowlevel(199);
                serviceFundService.updateById(serviceFund1);
                sendMeg(split, phone, serviceFundShared.getApplytype(), 2, serviceFundShared.getSerfunid());
                SysUser sysUser = sysUserService.selectUserByUserName(serviceFund1.getUserno());
                sendMeg(split, sysUser.getPhonenumber(), serviceFundShared.getApplytype(), 2, serviceFundShared.getSerfunid());
            } else {
                //不是退回的操作
                if (StringUtils.isNotBlank(serviceFundShared.getZffs()) && serviceFundShared.getSpjg() == 0) {
@@ -312,7 +321,9 @@
                serviceReimbursement1.setBackflowlevel(199L);
                serviceReimbursement1.setRecordstatus(-1);
                serviceReimbursementService.updateById(serviceReimbursement1);
                sendMeg(split, phone, "0", 1, serviceReimbursementShared.getReimid());
                SysUser sysUser = sysUserService.selectUserByUserName(serviceReimbursement1.getUserno());
                sendMeg(split, sysUser.getPhonenumber(), "0", 1, serviceReimbursementShared.getReimid());
            } else {
                //不是退回的操作
@@ -518,12 +529,12 @@
    }
    public void sendMeg(String[] split, String phone, String applyType, Integer fundType, Long fundId) {
    public void sendMeg(String[] split, String phone, String applyType, Integer fundType, Long fundId) throws ApiException {
        //记录操作记录
        ServiceFundflow serviceFundflow = new ServiceFundflow();
        serviceFundflow.setCreateBy("admin");
        serviceFundflow.setCreateBy(split[0]);
        serviceFundflow.setCreateTime(new Date());
        serviceFundflow.setUpdateBy("admin");
        serviceFundflow.setUpdateBy(split[0]);
        serviceFundflow.setUpdateTime(new Date());
        serviceFundflow.setCheckusername(split[0]);
        serviceFundflow.setFlowcontent(split[2]);
@@ -534,17 +545,17 @@
        serviceFundflow.setFundid(fundId);
        fundflowService.save(serviceFundflow);
//        ArrayList<ConcurrentHashMap<String, String>> contentList = new ArrayList<>();
//        ConcurrentHashMap map = new ConcurrentHashMap();
//        map.put("审批人", split[0]);
//        map.put("审批时间", split[1]);
//        map.put("意见", split[2]);
//        contentList.add(map);
//        DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
//        dingTalkReqVo.setTitle("财务系统驳回信息");
//        dingTalkReqVo.setNumber(phone);
//        dingTalkReqVo.setContents(contentList);
//        dingTalkService.sendNotification(dingTalkReqVo);
        ArrayList<ConcurrentHashMap<String, Object>> contentList = new ArrayList<>();
        ConcurrentHashMap map = new ConcurrentHashMap();
        map.put("审批人:", split[0]);
        map.put("审批时间:", split[1]);
        map.put("意见:", split[2]);
        contentList.add(map);
        DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
        dingTalkReqVo.setTitle("财务系统驳回信息");
        dingTalkReqVo.setNumber(phone);
        dingTalkReqVo.setContents(contentList);
        dingTalkService.sendNotification(dingTalkReqVo);
    }
    private ReentrantLock lock = new ReentrantLock();
@@ -675,8 +686,10 @@
                    log.info("serviceReimbursement是否插入成功{},{}", aBoolean, b);
                }
            } catch (Exception e) {
                e.printStackTrace();
                ServiceFund serviceFund2 = new ServiceFund();
                serviceFund2.setId(serviceFund1.getId());
                serviceFund2.setUploadStates(1);
                serviceFund2.setNotes("插入fund分享表失败");
                serviceFundService.updateById(serviceFund2);
            }