ソースを参照

还款提醒跑批

ch 3 年 前
コミット
90f80e6e7a

+ 191 - 117
taskMan/src/main/java/com/huyi/task/taskMan/controller/TimedTaskController.java

@@ -1,117 +1,191 @@
-//package com.huyi.task.taskMan.controller;
-//
-//import com.huyi.task.taskMan.service.IOwnTaskManService;
-//import com.tianhu.common.core.utils.CommonUtil;
-//import com.tianhu.common.core.utils.DateUtils;
-//import com.tianhu.system.api.RemoteSystemService;
-//import lombok.SneakyThrows;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.scheduling.annotation.EnableScheduling;
-//import org.springframework.scheduling.annotation.Scheduled;
-//
-//import java.util.ArrayList;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//@Configuration      //1.主要用于标记配置类,兼备Component的效果。
-//@EnableScheduling   // 2.开启定时任务
-//public class TimedTaskController {
-//    private static final Logger log = LoggerFactory.getLogger(TimedTaskController.class);
-//
-//    @Autowired
-//    private IOwnTaskManService ownTaskManService;
-//    @Autowired
-//    private RemoteSystemService remoteSystemService;
-//
-//    /**
-//     * 还款提醒跑批
-//     */
-//    @SneakyThrows
-//    @Scheduled(cron = "0 */10 * * * ?")
-//    private void repaymentRemind(){
-//        Map map = new HashMap();
-//        //据当前时间还有30天的日期
-//        String day = DateUtils.getFetureDate(30);
-//        map.put("day",day);
-//        //查询还款列表
-//        List<Map> list = ownTaskManService.selectRepaymentList(map);
-//        if(list.size()>0){
-//            for(Map res :list){
-//                //主键
-//                String zfrId = CommonUtil.objToString(res.get("zfrId"));
-//                //经办人Id
-//                String user = CommonUtil.objToString(res.get("userId"));
-//                //企业
-//                String companyId = CommonUtil.objToString(res.get("companyId"));
-//                List userList = new ArrayList();
-//                userList.add(user);
-//                //到期前30天发送消息
-//                remoteSystemService.sendNotice(companyId, zfrId,"","01","02","","0",userList);
-//            }
-//        }
-//        //据当前日期7天
-//        day = DateUtils.getFetureDate(7);
-//        map.put("day",day);
-//        //查询还款列表
-//        list = ownTaskManService.selectRepaymentList(map);
-//        if(list.size()>0){
-//            for(Map res :list){
-//                //主键
-//                String zfrId = CommonUtil.objToString(res.get("zfrId"));
-//                //经办人Id
-//                String user = CommonUtil.objToString(res.get("userId"));
-//                //企业
-//                String companyId = CommonUtil.objToString(res.get("companyId"));
-//                List userList = new ArrayList();
-//                userList.add(user);
-//                //到期前7天生成待办
-//                remoteSystemService.sendNotice(companyId, zfrId,"","00","03","","0",userList);
-//            }
-//        }
-//        //据当前日期5天
-//        day = DateUtils.getFetureDate(5);
-//        map.put("day",day);
-//        //查询还款列表
-//        list = ownTaskManService.selectRepaymentList(map);
-//        if(list.size()>0){
-//            for(Map res :list){
-//                //主键
-//                String zfrId = CommonUtil.objToString(res.get("zfrId"));
-//                //经办人Id
-//                String user = CommonUtil.objToString(res.get("userId"));
-//                //企业
-//                String companyId = CommonUtil.objToString(res.get("companyId"));
-//                List userList = new ArrayList();
-//                userList.add(user);
-//                //到期前5天发送信息
-//                remoteSystemService.sendNotice(companyId, zfrId,"","","","","1",userList);
-//            }
-//        }
-//        //据当前日期3天
-//        day = DateUtils.getFetureDate(3);
-//        map.put("day",day);
-//        //查询还款列表
-//        list = ownTaskManService.selectRepaymentList(map);
-//        if(list.size()>0){
-//            for(Map res :list){
-//                //主键
-//                String zfrId = CommonUtil.objToString(res.get("zfrId"));
-//                //经办人Id
-//                String user = CommonUtil.objToString(res.get("userId"));
-//                //企业
-//                String companyId = CommonUtil.objToString(res.get("companyId"));
-//                List userList = new ArrayList();
-//                userList.add(user);
-//                //到期前3天发送信息  企业,表主键,标题,类型(00:待办 01:消息),消息类型(00:费用提醒01:发票寄出02:到期还款)
-//                //代办类型(00:待审批01:链属企业申请02:融信失效03:还款),是否发送短信(0:不发1:发),收到信息用户集合
-//                remoteSystemService.sendNotice(companyId, zfrId,"","00","","03","0",userList);
-//            }
-//        }
-//    }
-//
-//}
-//
+package com.huyi.task.taskMan.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.huyi.task.base.entity.SysCompany;
+import com.huyi.task.base.entity.SysUser;
+import com.huyi.task.base.service.ISysCompanyService;
+import com.huyi.task.base.service.ISysUserService;
+import com.huyi.task.taskMan.service.IOwnTaskManService;
+import com.keao.tianhu.core.util.AmtUtil;
+import com.tianhu.common.core.utils.CommonUtil;
+import com.tianhu.common.core.utils.DateUtils;
+import com.tianhu.common.redis.common.RedisUtils;
+import com.tianhu.system.api.RemoteSystemService;
+import lombok.SneakyThrows;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Configuration      //1.主要用于标记配置类,兼备Component的效果。
+@EnableScheduling   // 2.开启定时任务
+public class TimedTaskController {
+    private static final Logger log = LoggerFactory.getLogger(TimedTaskController.class);
+
+    @Autowired
+    private IOwnTaskManService ownTaskManService;
+      @Autowired
+    private RemoteSystemService remoteSystemService;
+    @Autowired
+    private ISysCompanyService sysCompanyService;
+    @Autowired
+    private ISysUserService sysUserService;
+
+    /**
+     * 还款提醒跑批
+     */
+    @SneakyThrows
+    @Scheduled(cron = "0 0 2 0 * ? ")
+    private void repaymentRemind(){
+        Map map = new HashMap();
+        //据当前时间还有30天的日期
+        String day = DateUtils.getFetureDate(30);
+        map.put("day",day);
+        //查询还款列表
+        List<Map> list = ownTaskManService.selectRepaymentList(map);
+        if(list.size()>0){
+            for(Map res :list){
+                //主键
+                String zfrId = CommonUtil.objToString(res.get("zfrId"));
+                //创建类型 0:供应商申请, 1:核心企业开立, 2:供应商开立
+                String createType = CommonUtil.objToString(res.get("zfiCreateType"));
+                //供应商经办人Id
+                String user = CommonUtil.objToString(res.get("userId"));
+                //核心企业经办人
+                String handler = CommonUtil.objToString(res.get("handler"));
+                //供应商企业
+                String companyId = CommonUtil.objToString(res.get("companyId"));
+                //核心企业
+                String coreCompany = CommonUtil.objToString(res.get("coreCompany"));
+                //还款时间
+                String repaymentDate = CommonUtil.objToString(res.get("zfrRepaymentDate"));
+                //还款金额
+                String amount = CommonUtil.objToString(res.get("loanAmount"));
+                //供应商名称
+                SysCompany sysCompany = sysCompanyService.getById(companyId);
+                String companyName = sysCompany.getScyName();
+                //核心企业名称
+                SysCompany core = sysCompanyService.getById(coreCompany);
+                String coreName = core.getScyName();
+                //融信编号
+                String number = CommonUtil.objToString(res.get("zfiNumber"));
+                if("2".equals(createType)){
+                    //到期前30天发送消息
+                    String title = "【到期还款】您开立给【"+companyName+"】的一笔【"+amount+"】(大写:"+ AmtUtil.convert(amount)+")的融信【"+number+"】,将于【"+repaymentDate+"】还款,请尽快处理;";
+                    remoteSystemService.sendNotice(companyId, zfrId,title,"01","06","","0",user,"","","");
+                }else{
+                    //到期前30天发送消息
+                    String title = "【到期还款】您开立给【"+companyName+"】的一笔【"+amount+"】(大写:"+AmtUtil.convert(amount)+")的融信【"+number+"】,将于【"+repaymentDate+"】还款,请尽快处理;";
+                    remoteSystemService.sendNotice(coreCompany, zfrId,title,"01","06","","0",handler,"","","");
+                }
+            }
+        }
+        //据当前日期7天
+        day = DateUtils.getFetureDate(7);
+        map.put("day",day);
+        //查询还款列表
+        list = ownTaskManService.selectRepaymentList(map);
+        if(list.size()>0){
+            for(Map res :list){
+                //主键
+                String zfrId = CommonUtil.objToString(res.get("zfrId"));
+                //融信编号
+                String number = CommonUtil.objToString(res.get("zfiNumber"));
+                //还款时间
+                String repaymentDate = CommonUtil.objToString(res.get("zfrRepaymentDate"));
+                //还款金额
+                String amount = CommonUtil.objToString(res.get("loanAmount"));
+                //创建类型 0:供应商申请, 1:核心企业开立, 2:供应商开立
+                String createType = CommonUtil.objToString(res.get("zfiCreateType"));
+                //供应商经办人Id
+                String user = CommonUtil.objToString(res.get("userId"));
+                //核心企业经办人
+                String handler = CommonUtil.objToString(res.get("handler"));
+                //供应商企业
+                String companyId = CommonUtil.objToString(res.get("companyId"));
+                //核心企业
+                String coreCompany = CommonUtil.objToString(res.get("coreCompany"));
+                //到期前7天生成待办
+                if("2".equals(createType)){
+                    //到期前7天发送消息
+                    String title = "【还款待办】您签发的融信【"+number+"】将于【"+repaymentDate+"】还款,还款金额【"+amount+"】(大写:"+AmtUtil.convert(amount)+"),请尽快处理;";
+                    remoteSystemService.sendNotice(companyId, zfrId,title,"00","","06","0",user,"","","");
+                }else{
+                    //到期前7天发送消息
+                    String title = "【还款待办】您签发的融信【"+number+"】将于【"+repaymentDate+"】还款,还款金额【"+amount+"】(大写:"+AmtUtil.convert(amount)+"),请尽快处理;";
+                    remoteSystemService.sendNotice(coreCompany, zfrId,title,"00","","06","0",handler,"","","");
+                }
+
+            }
+        }
+        //据当前日期5天
+        day = DateUtils.getFetureDate(5);
+        map.put("day",day);
+        //查询还款列表
+        list = ownTaskManService.selectRepaymentList(map);
+        if(list.size()>0){
+            for(Map res :list){
+                //融信编号
+                String number = CommonUtil.objToString(res.get("zfiNumber"));
+                //还款时间
+                String repaymentDate = CommonUtil.objToString(res.get("zfrRepaymentDate"));
+                //还款金额
+                String amount = CommonUtil.objToString(res.get("loanAmount"));
+                //创建类型 0:供应商申请, 1:核心企业开立, 2:供应商开立
+                String createType = CommonUtil.objToString(res.get("zfiCreateType"));
+                //供应商经办人Id
+                String user = CommonUtil.objToString(res.get("userId"));
+                //供应商经办人手机号
+                SysUser sysUser = sysUserService.getById(user);
+                String phone = sysUser.getUserName();
+                //核心企业经办人
+                String handler = CommonUtil.objToString(res.get("handler"));
+                //核心企业经办人手机号
+                SysUser core = sysUserService.getById(handler);
+                String corePhone = core.getUserName();
+                //模板
+                String mould = RedisUtils.getDictValue("aliyun_message_code","zhuce");
+                //参数
+                Map result = new HashMap();
+                result.put("融信编号",number);
+                result.put("还款金额",amount);
+                result.put("还款日期",repaymentDate);
+                String json = JSONObject.toJSONString(result);
+                if("2".equals(createType)){
+                    //到期前5天发送短信
+                    remoteSystemService.sendAliMessage(phone,mould,json,"");
+                }else{
+                    //到期前5天发送短信
+                    remoteSystemService.sendAliMessage(corePhone,mould,json,"");
+                }
+
+            }
+        }
+        //据当前日期3天
+        day = DateUtils.getFetureDate(3);
+        map.put("day",day);
+        //查询还款列表
+        list = ownTaskManService.selectRepaymentList(map);
+        if(list.size()>0){
+            for(Map res :list){
+                //主键
+                String zfrId = CommonUtil.objToString(res.get("zfrId"));
+                //经办人Id
+                String user = CommonUtil.objToString(res.get("userId"));
+                List userList = new ArrayList();
+                userList.add(user);
+                //到期前3天平台内部待办  参数: 企业,表主键,标题,类型(00:待办 01:消息),消息类型(00:费用提醒01:发票寄出02:到期还款)
+                //待办类型(00:待审批01:链属企业申请02:融信失效03:还款),是否发送短信(0:不发1:发),收到信息用户集合,短信模板
+                remoteSystemService.sendNotice("000000", zfrId,"","00","","07","0",user,"","","");
+            }
+        }
+    }
+}
+

+ 9 - 5
taskMan/src/main/resources/mapper/taskMan/OwnTaskManMapper.xml

@@ -5,17 +5,21 @@
     <select id="selectRepaymentList" parameterType="map" resultType="map">
         select
             r.zfr_id 'zfrId',
-            r.zfr_number 'zfrNumber',
+            i.zfi_number 'zfiNumber',
             r.zfr_repayment_date 'zfrRepaymentDate',
+            r.zfr_loan_amount 'loanAmount',
+            i.zfi_create_type 'zfiCreateType',
             s.sucr_user_id 'userId',
-            s.sucr_company_id 'companyId'
+            s.sucr_company_id 'companyId',
+            sys.sucr_user_id 'handler',
+            sys.sucr_company_id 'coreCompany'
         from zc_finance_record r
         left join zc_finance_inf i
         on r.zfr_finance_id = i.zfi_id
-        left join zc_finance_pro_com_rel zfpcr
-        on i.zfi_core_quota_id = zfpcr.zfpcr_id
         left join sys_user_company_rel s
-        on zfpcr.zfpcr_company_id = s.sucr_company_id
+        on i.zfi_supplier_id = s.sucr_company_id
+        left join sys_user_company_rel sys
+        on i.zfi_core_id = sys.sucr_company_id
         where 1=1
         and s.sucr_handler = '1'
         and zfr_apply_status = '00'