• 代码备份


    package com.huajun.event.service.impl;
    
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Date;
    import java.util.List;
    
    import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
    import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
    import com.huajun.system.api.RemoteSmsService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import com.huajun.event.mapper.EvnConsultationArrangeMapper;
    import com.huajun.event.domain.EvnConsultationArrange;
    import com.huajun.event.service.IEvnConsultationArrangeService;
    import org.springframework.transaction.annotation.Transactional;
    import com.huajun.system.api.domain.SysSms;
    
    /**
     * 会商安排Service业务层处理
     *
     * @author 于吉利
     * @date 2021-06-08
     */
    @Service
    public class EvnConsultationArrangeServiceImpl extends ServiceImpl<EvnConsultationArrangeMapper, EvnConsultationArrange> implements IEvnConsultationArrangeService {
        @Autowired
        private EvnConsultationArrangeMapper evnConsultationArrangeMapper;
    
        @Autowired
        RemoteSmsService remoteSmsService;
    
        /**
         * 查询会商安排列表
         *
         * @param evnConsultationArrange 会商安排
         * @return 会商安排
         */
        @Override
        public List<EvnConsultationArrange> selectEvnConsultationArrangeList(EvnConsultationArrange evnConsultationArrange) {
            return evnConsultationArrangeMapper.selectEvnConsultationArrangeList(evnConsultationArrange);
        }
    
        /**
         * 重写mybatis plus save 方法
         * 2021-06-09
         *
         * @param entity
         * @return
         */
        @Override
        @Transactional
        public boolean save(EvnConsultationArrange entity) {
            super.save(entity);
    
            if (entity.getArrangeState().equals("2"))//草稿1,进行中2,完成3,进行发送短信操作
            {
                Collection collectionSms = new ArrayList<>();
                String receiverNames = entity.getArrangeReceivernames();//得到短信接收人姓名
                String receiverPhoness = entity.getArrangeReceiverphones();//得到短信接收人手机
                String[] phonesArray = receiverPhoness.split(",");
                String[] namesArray = receiverNames.split(",");
                for (int i = 0; i < namesArray.length; i++) {
                    String phone= phonesArray[i];
                    String name = namesArray[i];
                    SysSms sysSms = new SysSms();
                    sysSms.setBusinessId(entity.getId());//业务主键
                    sysSms.setMessageContent(entity.getArrangeSmscontent());//短信内容
                    sysSms.setMessageReceiver(phone);//接收人电话
                    sysSms.setMessageTitle(name);//接收人
                    sysSms.setMessageType("2");//短信消息
                    sysSms.setMessageState("0");//未发送
                    sysSms.setMessageSender(entity.getCreateBy());//发送人
                    sysSms.setMessageSendtime(new Date());
                    collectionSms.add(sysSms);
                }
                remoteSmsService.addBatchSms(collectionSms);
            }
            return true;
        }
    
        /**
         * 重写mybatis plus updateById 方法
         * 2021-06-09
         *
         * @param entity
         * @return
         */
        @Override
        @Transactional
        public boolean updateById(EvnConsultationArrange entity) {
            super.updateById(entity);
            if (entity.getArrangeState().equals("2"))//草稿1,进行中2,完成3,进行发送短信操作
            {
                Collection collectionSms = new ArrayList<>();
                String receiverNames = entity.getArrangeReceivernames();//得到短信接收人姓名
                String receiverPhoness = entity.getArrangeReceiverphones();//得到短信接收人手机
                String[] phonesArray = receiverPhoness.split(",");
                String[] namesArray = receiverNames.split(",");
                for (int i = 0; i < namesArray.length; i++) {
                    String phone= phonesArray[i];
                    String name = namesArray[i];
                    SysSms sysSms = new SysSms();
                    sysSms.setBusinessId(entity.getId());//业务主键
                    sysSms.setMessageContent(entity.getArrangeSmscontent());//短信内容
                    sysSms.setMessageReceiver(phone);//接收人电话
                    sysSms.setMessageTitle(name);//接收人
                    sysSms.setMessageType("2");//短信消息
                    sysSms.setMessageState("0");//未发送
                    sysSms.setMessageSender(entity.getCreateBy());//发送人
                    sysSms.setMessageSendtime(new Date());
                    collectionSms.add(sysSms);
                }
                remoteSmsService.addBatchSms(collectionSms);
    
            }
            return true;
        }
    
    
    }
  • 相关阅读:
    ZT 二叉树先序,中序,后序遍历非递归实现
    二叉树的遍历(一)
    Z :彻底了解指针数组,数组指针以及函数指针 [复
    ZT 复杂的函数指针例子分析 2008
    D:hunting2014小题目字符串倒序
    本周实验的PSP0过程文档
    构建之法阅读笔记02
    第二周学习进度
    实现自动生成30道四则运算题目(2)
    实现自动生成30道四则运算题目
  • 原文地址:https://www.cnblogs.com/Jeely/p/14868599.html
Copyright © 2020-2023  润新知