| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.BalanceAcctExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.MchApplicationExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.WithdrawalExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.system.dao.TCompanyMapper; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TEnterpriseWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.AllocationResp; |
| | | import com.unionpay.upyzt.resp.BalanceAcctResp; |
| | | import com.unionpay.upyzt.resp.MchApplicationResp; |
| | | import com.unionpay.upyzt.resp.WithdrawalResp; |
| | | import com.stylefeng.guns.modular.system.service.ITDriverService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | public class TaskUtil { |
| | | |
| | | @Autowired |
| | | private ITLocationService locationService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | |
| | | |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | |
| | | @Resource |
| | | private ITCompanyService companyMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private ITEnterpriseWithdrawalService tEnterpriseWithdrawalService; |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void taskMinute(){ |
| | | try { |
| | | List<TEnterpriseWithdrawal> isAudit = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("isAudit", 1)); |
| | | for (TEnterpriseWithdrawal enterpriseWithdrawal : isAudit) { |
| | | String mchApplicationId = enterpriseWithdrawal.getMchApplicationId(); |
| | | MchApplicationResp mchApplicationResp = MchApplicationExample.retrieveById(mchApplicationId); |
| | | enterpriseWithdrawal.setApplicationStatus(mchApplicationResp.getApplicationStatus()); |
| | | if("succeeded".equals(mchApplicationResp.getApplicationStatus())){ |
| | | enterpriseWithdrawal.setMchId(mchApplicationResp.getMchId()); |
| | | enterpriseWithdrawal.setBalanceAcctId(mchApplicationResp.getBalanceAcctId()); |
| | | enterpriseWithdrawal.setSettleAcctId(mchApplicationResp.getSettleAcctId()); |
| | | enterpriseWithdrawal.setRelAcctNo(mchApplicationResp.getRelAcctNo()); |
| | | enterpriseWithdrawal.setIsAudit(2); |
| | | } |
| | | tEnterpriseWithdrawalService.updateById(enterpriseWithdrawal); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 每天的凌晨执行的任务 |
| | | */ |
| | | @Scheduled(cron = "0 0 0 * * *") |
| | | // @Scheduled(fixedRate = 1000 * 60) |
| | | public void taskDay(){ |
| | | try { |
| | | // companyMapper.aaa(); |
| | | companyMapper.updateMoney(); // 分账业务 |
| | | locationService.updateFence();//更新线上电子围栏 |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void taskDayFenzhang(){ |
| | | try { |
| | | companyMapper.taskDayFenzhang(); // 分账业务 |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void taskTixian(){ |
| | | try { |
| | | WithdrawalResp withdrawalResp = WithdrawalExample.retrieveById("3708467427201980978"); |
| | | System.out.println(withdrawalResp); |
| | | companyMapper.taskTixian(); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 每月第一天的1点执行的任务 |
| | | */ |