123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- package net.chenlin.dp.modules;
- import com.mysql.cj.util.StringUtils;
- import com.taobao.api.ApiException;
- import net.chenlin.dp.common.exception.RRException;
- import net.chenlin.dp.common.openapi4j.exception.OpenAPIException;
- import net.chenlin.dp.common.support.orm.db.DynamicDataSource;
- import net.chenlin.dp.common.utils.DateUtils;
- import net.chenlin.dp.modules.api.controller.*;
- import net.chenlin.dp.modules.api.service.PettyCashService;
- import net.chenlin.dp.modules.api.service.ReimbursementService;
- import net.chenlin.dp.modules.sys.service.testU8Service;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Component;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- @Component("TaskDemo")
- public class TaskDemo {
- @Autowired
- private testU8Service testU8Mapper;
- private SaleOrderController controller=new SaleOrderController();
- /**
- * 定时任务 银行回单 同步至 u8凭证(江苏)
- */
- public static void autoReimbursementNew(String upTime) throws Exception {
- System.out.println("=================================="+upTime);
- if(StringUtils.isNullOrEmpty(upTime) || upTime.equals("无")){
- throw new RRException("参数不能为空");
- }
- upTime = upTime.trim();
- if(!DateUtils.isValidDate(upTime)){
- throw new RRException("日期格式不正确");
- }
- ReimbursementService reimbursementService = new ReimbursementService();
- reimbursementService.autoReimbursementNew("js",upTime);
- System.out.println("==================================");
- System.out.println("===========银行回单(江苏) 同步至 u8凭证任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 银行回单 同步至 u8凭证(山东)
- */
- public static void autoReimbursementNewSd(String upTime) throws Exception {
- if(StringUtils.isNullOrEmpty(upTime) || upTime.equals("无")){
- throw new RRException("参数不能为空");
- }
- upTime = upTime.trim();
- if(DateUtils.isValidDate(upTime)){
- throw new RRException("日期格式不正确");
- }
- ReimbursementService reimbursementService = new ReimbursementService();
- reimbursementService.autoReimbursementNew("sd",upTime);
- System.out.println("==================================");
- System.out.println("===========银行回单(山东) 同步至 u8凭证任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 备用金 同步至 银行回单
- */
- public static void autoOABankPetty() throws Exception {
- PettyCashService pettyCashService = new PettyCashService();
- pettyCashService.autoOABankPetty();
- System.out.println("==================================");
- System.out.println("===========备用金定时任务执行 "+ DateUtils.getNowTime()+" ============");
- System.out.println("==================================");
- }
- /**
- * 定时任务 报销申请 同步至 银行回单
- */
- public static void autoOABankReceipt() throws Exception {
- ReimbursementService reimbursementService = new ReimbursementService();
- reimbursementService.autoOABankReceipt();
- System.out.println("==================================");
- System.out.println("===========报销申请定时任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 销售订单同步至 钉钉
- */
- public static void autoSaleToDingJob() throws OpenAPIException, ApiException {
- SaleOrderController saleOrderController=new SaleOrderController();
- saleOrderController.dingSaleOrder("slave-data-source","1");
- saleOrderController.dingSaleOrder("slave-data-source03","3");
- System.out.println("===========销售订单同步至钉钉定时任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 采购订单同步至 钉钉
- */
- public static void autoOrderToDingJob() throws OpenAPIException, ApiException {
- PurchaseOrderController purchaseOrderController=new PurchaseOrderController();
- purchaseOrderController.dingPurchaseOrder("slave-data-source","1");
- purchaseOrderController.dingPurchaseOrder("slave-data-source03","3");
- System.out.println("===========采购订单同步至钉钉定时任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 付款申请单同步至 钉钉
- */
- public static void autoFkdToDingJob() throws OpenAPIException, ApiException {
- PayrequestController payrequestController=new PayrequestController();
- payrequestController.dingPayrequest("slave-data-source","1");
- payrequestController.dingPayrequest("slave-data-source03","3");
- System.out.println("===========付款申请单同步至钉钉定时任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 钉钉销售订单审核回写至U8
- */
- public static void autoSaleToU8Job() throws OpenAPIException {
- SaleOrderController saleOrderController=new SaleOrderController();
- saleOrderController.saleOrderShenhe();
- System.out.println("===========钉钉销售订单回写至U8定时任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 钉钉采购订单回写至U8
- */
- public static void autoOrderToU8Job() throws OpenAPIException {
- PurchaseOrderController purchaseOrderController=new PurchaseOrderController();
- purchaseOrderController.purchaseOrderShenhe();
- System.out.println("===========钉钉采购订单回写至U8定时任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 钉钉付款申请单回写至U8
- */
- public static void autoFkdToU8Job() throws OpenAPIException {
- PayrequestController payrequestController=new PayrequestController();
- payrequestController.PayrequestOrderShenhe();
- System.out.println("===========钉钉付款申请单回写至U8定时任务执行 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm调用存储过程 同步存货档案
- */
- public void autoCallProductIn(String upTime) throws OpenAPIException {
- if(StringUtils.isNullOrEmpty(upTime) || upTime.equals("无")){
- upTime = DateUtils.format(new Date());
- }
- testU8Mapper.callProductIn(upTime);
- System.out.println("===========crm调用存储过程 同步存货档案 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================参数"+upTime);
- }
- /**
- * 定时任务 crm调用存储过程 同步项目大类
- */
- public void autoCallProMaxClassIn() throws OpenAPIException {
- testU8Mapper.callProMaxClassIn();
- System.out.println("===========crm调用存储过程 同步项目大类 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm调用存储过程 同步项目档案
- */
- public void autoCallProMinClassIn() throws OpenAPIException {
- testU8Mapper.callProMinClassIn();
- System.out.println("===========crm调用存储过程 同步项目档案 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm调用存储过程 同步 现存量
- */
- public void autoCallCurrentStock() throws OpenAPIException {
- testU8Mapper.callCurrentStockJiangSu(); //001 金米龙(江苏)科技材料有限公司
- testU8Mapper.callCurrentStockShanDong(); //003 金米龙(山东)新型建筑材料有限公司
- System.out.println("===========crm调用存储过程 同步项目档案 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm调用存储过程 销售订单回写
- */
- public void autoCallSaleBack() throws OpenAPIException {
- testU8Mapper.callSaleBack();
- System.out.println("===========crm调用存储过程 销售订单回写 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm 同步客户档案
- * @throws OpenAPIException
- */
- public void autoCallCustomer() throws OpenAPIException {
- CustomerController customerController=new CustomerController();
- customerController.addCustomer();
- System.out.println("===========crm调用存储过程 同步客户档案 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm 同步客诉单-退款
- * @throws OpenAPIException
- */
- public void autoCallAcceptOrder() throws OpenAPIException {
- AcceptOrderController acceptOrderController=new AcceptOrderController();
- acceptOrderController.addAcceptOrder();
- System.out.println("===========crm调用存储过程 同步客诉单-退款 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm 同步销售订单
- * @throws OpenAPIException
- */
- public void autoCallSaleOrder() throws OpenAPIException {
- controller.SaleOrder();
- System.out.println("===========crm调用存储过程 同步销售订单 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm 同步销售报价订单
- * @throws OpenAPIException
- */
- public void autoCallSaleOrderBJ() throws OpenAPIException {
- controller.SaleOrderBJ();
- System.out.println("===========crm调用存储过程 同步销售报价订单 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm 同步打样单
- * @throws OpenAPIException
- */
- public void autoCallDYD() throws OpenAPIException {
- controller.DYDOrder();
- System.out.println("===========crm调用存储过程 同步打样单 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm 同步送样单
- * @throws OpenAPIException
- */
- public void autoCallSYD() throws OpenAPIException {
- controller.SYDOrder();
- System.out.println("===========crm调用存储过程 同步送样单 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm 同步客诉单-抵扣
- * @throws OpenAPIException
- */
- public void autoCallKSDDK() throws OpenAPIException {
- controller.KSDOrder();
- System.out.println("===========crm调用存储过程 同步客诉单-抵扣 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- /**
- * 定时任务 crm 同步客诉单-退货
- * @throws OpenAPIException
- */
- public void autoCallKSDTH() throws OpenAPIException {
- controller.KSDTHOrder();
- System.out.println("===========crm调用存储过程 同步客诉单-退货 "+ DateUtils.getNowTime()+" ============" );
- System.out.println("==================================");
- }
- public static void main(String[] args) throws Exception {
- autoReimbursementNew("2022-01-21");
- String aa = "2021-11-12";
- // 2022-01-21
- String[] aaa = aa.split("-");
- System.out.println(aaa[0]);
- System.out.println(aaa[1]);
- System.out.println(aaa[2]);
- // System.out.println(aa.substring(0,4));
- // System.out.println("=================================="+DateUtils.isValidDate("2021-11-12"));
- // SaleOrderService saleOrderService = new SaleOrderService();
- // saleOrderService.shenghe("","");
- // autoCallProductIn("");
- /* DingdingOpenInterface dingdingOpenInterface = new DingdingOpenInterface();
- dingdingOpenInterface.getToken();
- for (int i = 0; i < 4; i++) {
- try{
- Integer.parseInt("0.1111");
- }catch (Exception e){
- System.out.println("111111111111111111111111");
- e.printStackTrace();
- System.out.println("2222222222222222222222");
- }
- System.out.println("33333333333333333");
- }
- System.out.println("44444444444444");*/
- }
- }
|