Administrator hace 1 año
padre
commit
894383ba8f

+ 3 - 3
pom.xml

@@ -8,9 +8,9 @@
     <artifactId>ruoyi</artifactId>
     <version>3.8.6</version>
 
-    <name>ruoyi</name>
-    <url>http://www.ruoyi.vip</url>
-    <description>若依管理系统</description>
+    <name>boman</name>
+    <url>https://lyht.qs163.cn</url>
+    <description>智慧陵园系统</description>
     
     <properties>
         <ruoyi.version>3.8.6</ruoyi.version>

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/reservat/BomanReservatController.java

@@ -78,7 +78,7 @@ public class BomanReservatController extends BaseController
     public AjaxResult add(@RequestBody BomanReservat bomanReservat)
     {
         int i = bomanReservatService.insertBomanReservat(bomanReservat);
-        return  i > 0 ? AjaxResult.success(i) : AjaxResult.error("超过最大可预约人数");
+        return  i > 0 ? AjaxResult.success(i) : AjaxResult.error("超过最大可预约人数或接待人员已满,请重新选择");
     }
 
     /**

+ 4 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -149,4 +149,8 @@ public class Constants
      * 日期+对应时段id的预约人数
      */
     public static final String RESERVAT_NUM = "reservat_num:";
+    /**
+     * 日期+对应时段id的接待人员已满的key value = N/Y
+     */
+    public static final String RESERVAT_PERSONNEL_NUM = "reception_personnel_num:";
 }

+ 1 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/SendSmsUtils.java

@@ -66,7 +66,7 @@ public class SendSmsUtils {
                 //手机号码
                 .setPhoneNumbers(phone)
                 //短信签名名称。中新云
-                .setSignName("中新云")
+                .setSignName("潜山市烈士陵园")
                 //短信模板CODE
                 .setTemplateCode(templateCode);
             if (StringUtils.isNotBlank(templateCode)){

+ 11 - 1
ruoyi-system/src/main/java/com/ruoyi/system/domain/BomanReservatConfigTime.java

@@ -45,12 +45,22 @@ public class BomanReservatConfigTime extends BaseEntity
     /** 当前时段是否可预约 N:不预约  Y:可约 */
     @Excel(name = "当前时段是否可预约 N:不预约  Y:可约")
     private String reservatConfigStatus;
+    /** 当前时段接待人员是否已满 N:未满 Y:已满 */
+    private String receptionPersonnelType;
 
     /** 创建部门 */
     @Excel(name = "创建部门")
     private Long createDept;
 
-    public void setReservatConfigTimeId(Long reservatConfigTimeId) 
+    public String getReceptionPersonnelType() {
+        return receptionPersonnelType;
+    }
+
+    public void setReceptionPersonnelType(String receptionPersonnelType) {
+        this.receptionPersonnelType = receptionPersonnelType;
+    }
+
+    public void setReservatConfigTimeId(Long reservatConfigTimeId)
     {
         this.reservatConfigTimeId = reservatConfigTimeId;
     }

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ReceptionPersonnelMapper.java

@@ -26,6 +26,7 @@ public interface ReceptionPersonnelMapper
      * @return 接待人员信息集合
      */
     public List<ReceptionPersonnel> selectReceptionPersonnelList(ReceptionPersonnel receptionPersonnel);
+    public int selectReceptionPersonnelCount();
 
     /**
      * 新增接待人员信息

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatConfigTimeServiceImpl.java

@@ -147,6 +147,12 @@ public class BomanReservatConfigTimeServiceImpl implements IBomanReservatConfigT
                             }
                         }
                         bomanReservatConfigTimeList.add(bomanReservatConfigTime);
+                        bomanReservatConfigTime.setReceptionPersonnelType("N");
+                        //去查询该时间段接待人员是否已满
+                        Object cacheObject = redisCache.getCacheObject(Constants.RESERVAT_PERSONNEL_NUM + dateMonth + "_" + reservatConfigTime.getReservatConfigTimeId());
+                        if (ObjectUtils.isNotEmpty(cacheObject)){
+                            bomanReservatConfigTime.setReceptionPersonnelType("Y");
+                        }
                     }
                     if (index < bomanReservatConfigTimes.size()){
                         jsonObject.put("title","可预约");

+ 69 - 6
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatServiceImpl.java

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.constant.Constants;
@@ -16,6 +17,7 @@ import com.ruoyi.common.utils.SendSmsUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.BomanReservatConfigTime;
 import com.ruoyi.system.mapper.BomanReservatConfigTimeMapper;
+import com.ruoyi.system.mapper.ReceptionPersonnelMapper;
 import com.ruoyi.system.mapper.SysUserMapper;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.math.NumberUtils;
@@ -25,6 +27,8 @@ import com.ruoyi.system.mapper.BomanReservatMapper;
 import com.ruoyi.system.domain.BomanReservat;
 import com.ruoyi.system.service.IBomanReservatService;
 
+import static com.ruoyi.common.constant.Constants.RESERVAT_PERSONNEL_NUM;
+
 /**
  * 陵园预约Service业务层处理
  *
@@ -44,6 +48,9 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
     @Autowired
     private SysUserMapper userMapper;
 
+    @Autowired
+    private ReceptionPersonnelMapper receptionPersonnelMapper;
+
     /**
      * 查询陵园预约
      *
@@ -102,13 +109,33 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
             return 0;
         }
 
-        //新增预约往redis中存放数据
-        redisCache.setCacheObject(key, numNew);
+
         bomanReservat.setCreateTime(DateUtils.getNowDate());
         String reservatType = bomanReservat.getReservatType();
         if ("2".equals(reservatType)) {
             bomanReservat.setVisitType("3");
         } else {
+            //如果是团队,判断是否需要接待
+            if ("Y".equals(bomanReservat.getIsReception())){
+                BomanReservat br = new BomanReservat();
+                br.setReservatConfigTimeId(bomanReservat.getReservatConfigTimeId());
+                br.setVisitType("3");
+                br.setVisitDate(bomanReservat.getVisitDate());
+                //查询一下,该时段接待人员是否已满
+                List<BomanReservat> bomanReservats = bomanReservatMapper.selectBomanReservatList(br);
+                //再去查询接待人员数量
+                int i = receptionPersonnelMapper.selectReceptionPersonnelCount();
+                if (bomanReservats != null){
+                    if (bomanReservats.size() >= i ){
+                        return 0;
+                    }
+                    if (bomanReservats.size() + 1 == i){
+                        //插入redis该时段接待人员已满
+                        String keyPersonnel = Constants.RESERVAT_PERSONNEL_NUM + bomanReservat.getVisitDate() + "_" + reservatConfigTimeId;
+                        redisCache.setCacheObject(keyPersonnel,"Y",24, TimeUnit.HOURS);
+                    }
+                }
+            }
             //获取管理员账户
             SysUser sysUser = new SysUser();
             sysUser.setUserType("lyManage");
@@ -119,13 +146,15 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
                 //陵园预约通知 = SMS_464376020
                 SendSmsUtils.sendSms(phonenumber, "SMS_464376020", null);
                 System.out.println("给(" + phonenumber + ")陵园管理员发送了("+bomanReservat.getVisitPhone()+")申请预约的短信");
-
             }
+
         }
         int i = bomanReservatMapper.insertBomanReservat(bomanReservat);
         if (i > 0) {
             i = Math.toIntExact(bomanReservat.getReservatId());
         }
+        //新增预约往redis中存放数据
+        redisCache.setCacheObject(key, numNew,24, TimeUnit.HOURS);
         return i;
     }
 
@@ -162,7 +191,12 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
                 if (reservatNumNew < 0) {
                     reservatNumNew = 0;
                 }
-                redisCache.setCacheObject(key, reservatNumNew);
+                redisCache.setCacheObject(key, reservatNumNew,24, TimeUnit.HOURS);
+            }
+            //判断是不是团队需要接待的续约
+            if ("1".equals(bomanReservat.getReservatType()) && "Y".equals(bomanReservat.getIsReception())){
+                String keyPersonnel = Constants.RESERVAT_PERSONNEL_NUM + bomanReservat.getVisitDate() + "_" + reservatConfigTimeId;
+                redisCache.deleteObject(keyPersonnel);
             }
         }
         return bomanReservatMapper.deleteBomanReservatByReservatIds(reservatIds);
@@ -184,18 +218,43 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
 
         BomanReservat reservat = bomanReservatMapper.selectBomanReservatByReservatId(bomanReservat.getReservatId());
 
+        Long reservatConfigTimeId = reservat.getReservatConfigTimeId();
+
         if ("3".equals(bomanReservat.getVisitType()) && "Y".equals(reservat.getIsReception()) && StringUtils.isEmpty(reservat.getReceptionName())) {
             return AjaxResult.error("请先分配接待人员");
         }
+        //如果该时段接待员已满,往redis中插入数据,给前端H5日历进行标识
+        if ("3".equals(bomanReservat.getVisitType()) && "Y".equals(reservat.getIsReception()) && StringUtils.isNotEmpty(reservat.getReceptionName())) {
+            //审核通过且需要接待人员且分配了接待人员
+            BomanReservat br = new BomanReservat();
+            br.setReservatConfigTimeId(reservat.getReservatConfigTimeId());
+            br.setVisitDate(bomanReservat.getVisitDate());
+            br.setVisitType("3");
+            //查询一下,该时段接待人员是否已满
+            List<BomanReservat> bomanReservats = bomanReservatMapper.selectBomanReservatList(br);
+            //再去查询接待人员数量
+            int i = receptionPersonnelMapper.selectReceptionPersonnelCount();
+            if (bomanReservats != null){
+                if (bomanReservats.size() >= i ){
+                    return AjaxResult.error("当前时段接待人员已满");
+                }
+                if (bomanReservats.size() + 1 == i){
+                    //插入redis该时段接待人员已满
+                    String key = Constants.RESERVAT_PERSONNEL_NUM + reservat.getVisitDate() + "_" + reservatConfigTimeId;
+                    redisCache.setCacheObject(key,"Y",24, TimeUnit.HOURS);
+                }
+            }
+        }
         //拒绝,释放名额
         if ("2".equals(bomanReservat.getVisitType())) {
-            Long reservatConfigTimeId = reservat.getReservatConfigTimeId();
             String visitNum = reservat.getVisitNum();
             //去redis找对应日期,对应时段id的预约数量 reservat_num:2023-10-10_1
             String key = Constants.RESERVAT_NUM + reservat.getVisitDate() + "_" + reservatConfigTimeId;
             Object numString = redisCache.getCacheObject(key);
             long num = (long) numString - Long.parseLong(visitNum);
-            redisCache.setCacheObject(key, num < 0 ? 0 : num);
+            redisCache.setCacheObject(key, num < 0 ? 0 : num,24, TimeUnit.HOURS);
+            String keyPersonnel = Constants.RESERVAT_PERSONNEL_NUM + reservat.getVisitDate() + "_" + reservatConfigTimeId;
+            redisCache.deleteObject(keyPersonnel);
         }
         bomanReservat.setUpdateTime(DateUtils.getNowDate());
         int i = bomanReservatMapper.updateBomanReservat(bomanReservat);
@@ -210,6 +269,7 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
             SendSmsUtils.sendSms(visitPhone, "SMS_464336030", jsonObject.toString());
             System.out.println("给(" + visitPhone + ")团队发送了审核通过的短信");
         }
+
         return i > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
@@ -243,6 +303,9 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
     @Override
     public AjaxResult verification(Long reservatId) {
         BomanReservat reservat = bomanReservatMapper.selectBomanReservatByReservatId(reservatId);
+        if (!"3".equals(reservat.getVisitType())){
+            return AjaxResult.error("当前预约未通过,禁止核销");
+        }
         if ("2".equals(reservat.getVisitStatus())) {
             return AjaxResult.error("当前预约已核销,请勿重复操作。");
         }

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/BomanReservatMapper.xml

@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>  
             <if test="visitName != null  and visitName != ''"> and visit_name like concat('%', #{visitName}, '%')</if>
             <if test="visitUnitName != null  and visitUnitName != ''"> and visit_unit_name like concat('%', #{visitUnitName}, '%')</if>
+            <if test="reservatConfigTimeId != null  "> and reservat_config_time_id =#{reservatConfigTimeId}</if>
             <if test="visitPhone != null  and visitPhone != ''"> and visit_phone = #{visitPhone}</if>
             <if test="visitIdCard != null  and visitIdCard != ''"> and visit_id_card = #{visitIdCard}</if>
             <if test="visitNum != null  and visitNum != ''"> and visit_num = #{visitNum}</if>

+ 4 - 1
ruoyi-system/src/main/resources/mapper/system/ReceptionPersonnelMapper.xml

@@ -38,7 +38,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectReceptionPersonnelVo"/>
         where reception_id = #{receptionId}
     </select>
-        
+    <select id="selectReceptionPersonnelCount" resultType="java.lang.Integer">
+        select count(1) from reception_personnel
+    </select>
+
     <insert id="insertReceptionPersonnel" parameterType="ReceptionPersonnel" useGeneratedKeys="true" keyProperty="receptionId">
         insert into reception_personnel
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 	
 	<sql id="selectUserVo">
-        select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, 
+        select u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
         d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
         r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
         from sys_user u