Browse Source

Merge remote-tracking branch 'origin/master'

soft5566 2 years ago
parent
commit
1ad39f32c1

+ 3 - 4
.idea/compiler.xml

@@ -8,16 +8,15 @@
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
         <outputRelativeToContentRoot value="true" />
         <module name="mybatis_plus" />
-        <module name="Back-endDevelopmentFramework" />
-        <module name="template_code" />
       </profile>
     </annotationProcessing>
+    <bytecodeTargetLevel>
+      <module name="mybatis_plus" target="1.8" />
+    </bytecodeTargetLevel>
   </component>
   <component name="JavacSettings">
     <option name="ADDITIONAL_OPTIONS_OVERRIDE">
-      <module name="Back-endDevelopmentFramework" options="-parameters" />
       <module name="mybatis_plus" options="-parameters" />
-      <module name="template_code" options="-parameters" />
     </option>
   </component>
 </project>

+ 1 - 3
.idea/encodings.xml

@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
+  <component name="Encoding">
     <file url="file://$PROJECT_DIR$" charset="UTF-8" />
-    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
-    <file url="PROJECT" charset="UTF-8" />
   </component>
 </project>

+ 1 - 2
.idea/misc.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="ExternalStorageConfigurationManager" enabled="true" />
   <component name="MavenProjectsManager">
     <option name="originalFiles">
       <list>
@@ -447,6 +446,6 @@
     </entry>
   </component>
   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
-    <output url="file://$PROJECT_DIR$/out" />
+    <output url="file://$PROJECT_DIR$/classes" />
   </component>
 </project>

+ 0 - 124
.idea/uiDesigner.xml

@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="Palette2">
-    <group name="Swing">
-      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
-      </item>
-      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
-      </item>
-      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
-        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
-        <initial-values>
-          <property name="text" value="Button" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="RadioButton" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="CheckBox" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="Label" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
-          <preferred-size width="200" height="200" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
-          <preferred-size width="200" height="200" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
-      </item>
-      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
-          <preferred-size width="-1" height="20" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
-      </item>
-      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
-      </item>
-    </group>
-  </component>
-</project>

File diff suppressed because it is too large
+ 6 - 1798
.idea/workspace.xml


+ 31 - 0
src/main/java/com/template/api/SmartVisitorControllerAPI.java

@@ -1,6 +1,8 @@
 package com.template.api;
 
 import com.template.model.pojo.SmartVisitor;
+import com.template.model.request.otherAppointmentRequest;
+import com.template.model.request.parentsAppointmentRequest;
 import com.template.model.result.CommonResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -33,4 +35,33 @@ public interface SmartVisitorControllerAPI {
     @ApiOperation(value = "根据ID删除指定访客预约", notes = "根据ID删除指定访客预约", httpMethod = "GET")
     CommonResult deleteSmartVisitorById(@RequestParam int id);
 
+    /**
+     * 学生家长预约
+     * 多个学生就多条访客数据 然后发送给对应老师审核
+     */
+    @PostMapping(value = "/parentsAppointment")
+    @ApiOperation(value = "学生家长预约", notes = "学生家长预约", httpMethod = "POST")
+    CommonResult parentsAppointment(@Validated @RequestBody parentsAppointmentRequest par, BindingResult bindingResult);
+
+    /**
+     * 其他访客预约
+     * 其他访客预约数据就发给管理员审核
+     */
+    @PostMapping(value = "/otherAppointment")
+    @ApiOperation(value = "其他访客预约", notes = "其他访客预约", httpMethod = "POST")
+    CommonResult otherAppointment(@Validated @RequestBody otherAppointmentRequest oar, BindingResult bindingResult);
+
+    /**
+     * 当前用户的预约记录
+     * @param userId 当前用户ID
+     * @param type 类型
+     *             全部:0
+     *             待审核:1
+     *             已拒绝:2
+     *             已推送:3
+     * @return
+     */
+    @PostMapping(value = "/appointmentPageRecord")
+    @ApiOperation(value = "当前用户的预约记录", notes = "当前用户的预约记录", httpMethod = "GET")
+    CommonResult appointmentPageRecord(@RequestParam int currentPage, @RequestParam int pageCount, @RequestParam int userId, @RequestParam int type);
 }

+ 111 - 6
src/main/java/com/template/controller/SmartVisitorController.java

@@ -2,20 +2,34 @@ package com.template.controller;
 
 
 import com.template.api.SmartVisitorControllerAPI;
+import com.template.common.utils.TimeExchange;
 import com.template.common.utils.paramUtils;
+import com.template.model.enumModel.eApproveStatu;
+import com.template.model.enumModel.eVisitorType;
+import com.template.model.pojo.SmartUser;
 import com.template.model.pojo.SmartVisitor;
+import com.template.model.request.otherAppointmentRequest;
+import com.template.model.request.parentsAppointmentRequest;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.AffiliateUserVo;
+import com.template.model.vo.VisitorPageVo;
+import com.template.services.SmartUserService;
 import com.template.services.SmartVisitorService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author ceshi
@@ -27,9 +41,13 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
     @Autowired
     private SmartVisitorService smartVisitorService;
 
+    @Autowired
+    private SmartUserService smartUserService;
+
     /**
      * 新增访客预约
-     * @param smartApply 访客预约数据
+     *
+     * @param smartApply    访客预约数据
      * @param bindingResult
      * @return
      */
@@ -47,7 +65,8 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
 
     /**
      * 更新访客预约
-     * @param sa 访客预约数据
+     *
+     * @param sa            访客预约数据
      * @param bindingResult
      * @return
      */
@@ -64,9 +83,10 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
 
     /**
      * 访客预约分页数据查询
+     *
      * @param currentPage 当前页数
-     * @param pageCount 一页数据条数
-     * @param name 查询名称
+     * @param pageCount   一页数据条数
+     * @param name        查询名称
      * @return
      */
     @Override
@@ -82,7 +102,7 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
 
         SmartVisitor data = smartVisitorService.getSmartById(id);
 
-        if(data == null){
+        if (data == null) {
             return CommonResult.fail("当前数据不存在,删除失败!");
         }
 
@@ -90,5 +110,90 @@ public class SmartVisitorController implements SmartVisitorControllerAPI {
 
         return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
     }
+
+    @Override
+    public CommonResult parentsAppointment(parentsAppointmentRequest par, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        //参数判断 判断受访学生信息是否为空
+        if (par.getStudents() == null) {
+            return CommonResult.fail("请选择受访学生");
+        }
+
+        if (par.getStudents().size() <= 0) {
+            return CommonResult.fail("请选择受访学生");
+        }
+
+        //根据用户ID查询相关信息
+        SmartUser su = smartUserService.getSmartById(par.getUserId());
+        if (su == null) {
+            return CommonResult.fail("当前用户信息不合法,无法进行预约!");
+        }
+
+        List<SmartVisitor> svs = new ArrayList<>();
+        for (AffiliateUserVo student : par.getStudents()) {
+            SmartVisitor sv = new SmartVisitor();
+            sv.setUserId(par.getUserId());
+            sv.setUserName(su.getName());
+            sv.setUserPhone(su.getPhone());
+            sv.setUserNumber(su.getIdCard());
+            sv.setPeerNum(par.getPeerNum());
+            sv.setCarNum(par.getCarNum());
+            sv.setVisitReason(par.getVisitReason());
+            sv.setStatu(eApproveStatu.Audit.getValue());
+            sv.setVisitorTime(TimeExchange.StringToDate(par.getVisitorTime(), "yyyy-MM-dd HH:mm:ss"));
+            sv.setRespondent(student.getId());
+            //将第一个受访学生的部门ID带过去
+            sv.setDepartmentId(student.getDepartmentId());
+            sv.setVisitorType(eVisitorType.Parent.getValue());
+            svs.add(sv);
+        }
+
+        boolean result = smartVisitorService.insertVisitorBatch(svs);
+
+        return result ? CommonResult.ok("预约成功,等待审批通过") : CommonResult.fail("预约失败");
+    }
+
+    @Override
+    public CommonResult otherAppointment(otherAppointmentRequest oar, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        //根据用户ID查询相关信息
+        SmartUser su = smartUserService.getSmartById(oar.getUserId());
+        if (su == null) {
+            return CommonResult.fail("当前用户信息不合法,无法进行预约!");
+        }
+
+        SmartVisitor sv = new SmartVisitor();
+        sv.setUserId(oar.getUserId());
+        sv.setUserName(su.getName());
+        sv.setUserPhone(su.getPhone());
+        sv.setUserNumber(su.getIdCard());
+        sv.setPeerNum(oar.getPeerNum());
+        sv.setCarNum(oar.getCarNum());
+        sv.setVisitReason(oar.getVisitReason());
+        sv.setStatu(eApproveStatu.Audit.getValue());
+        sv.setVisitorTime(TimeExchange.StringToDate(oar.getVisitorTime(), "yyyy-MM-dd HH:mm:ss"));
+        sv.setRespondentName(oar.getRespondentName());
+        sv.setRespondentPhone(oar.getRespondentPhone());
+        sv.setVisitorType(eVisitorType.Other.getValue());
+
+        int result = smartVisitorService.insertSmartVisitor(sv);
+
+        return result > 0 ? CommonResult.ok("预约成功,等待审批通过") : CommonResult.ok("预约失败");
+    }
+
+    @Override
+    public CommonResult appointmentPageRecord(int currentPage,int pageCount, int userId, int type) {
+        PageUtils<VisitorPageVo> result = smartVisitorService.smartVisitorPageByUserId(currentPage, pageCount, userId, type);
+
+        return CommonResult.ok(result);
+    }
 }
 

+ 5 - 2
src/main/java/com/template/mapper/SmartVisitorMapper.java

@@ -1,12 +1,15 @@
 package com.template.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.template.model.pojo.SmartVisitor;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.vo.VisitorPageVo;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
  * <p>
- *  Mapper 接口
+ * Mapper 接口
  * </p>
  *
  * @author ceshi
@@ -14,5 +17,5 @@ import org.springframework.stereotype.Repository;
  */
 @Repository
 public interface SmartVisitorMapper extends BaseMapper<SmartVisitor> {
-
+    IPage<VisitorPageVo> queryVisitorPage(IPage<VisitorPageVo> page, @Param("userId") Integer userId, @Param("statu") Integer statu);
 }

+ 62 - 0
src/main/java/com/template/model/enumModel/eApproveStatu.java

@@ -0,0 +1,62 @@
+package com.template.model.enumModel;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/6 星期四 16:34
+ * @Description: com.template.model.enumModel
+ * @Version: 1.0
+ * 账号状态
+ */
+public enum eApproveStatu {
+    Audit(1),//待审核
+    Refused(2),//已拒绝
+    Pushed(3);//已推送
+
+    private int value;
+
+    eApproveStatu(int value){
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+    public static eApproveStatu valueOf(int value) {
+        switch (value) {
+            case 1:
+                return eApproveStatu.Audit;
+            case 2:
+                return eApproveStatu.Refused;
+            case 3:
+                return eApproveStatu.Pushed;
+            default:
+                return null;
+        }
+    }
+
+    public static Integer integerOf(String value) {
+        switch (value) {
+            case "待审核":
+                return 1;
+            case "已拒绝":
+                return 2;
+            case "已推送":
+                return 3;
+            default:
+                return null;
+        }
+    }
+
+    public static String stringOf(Integer value) {
+        switch (value) {
+            case 1:
+                return "待审核";
+            case 2:
+                return "已拒绝";
+            case 3:
+                return "已推送";
+            default:
+                return null;
+        }
+    }
+}

+ 33 - 0
src/main/java/com/template/model/enumModel/eVisitorType.java

@@ -0,0 +1,33 @@
+package com.template.model.enumModel;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/7/6 星期四 16:34
+ * @Description: com.template.model.enumModel
+ * @Version: 1.0
+ * 访客类型
+ */
+public enum eVisitorType {
+    Parent(1),//家长
+    Other(2);//其他
+
+    private int value;
+
+    eVisitorType(int value){
+        this.value = value;
+    }
+
+    public int getValue() {
+        return value;
+    }
+    public static eVisitorType valueOf(int value) {
+        switch (value) {
+            case 1:
+                return eVisitorType.Parent;
+            case 2:
+                return eVisitorType.Other;
+            default:
+                return null;
+        }
+    }
+}

+ 24 - 4
src/main/java/com/template/model/pojo/SmartVisitor.java

@@ -37,6 +37,15 @@ public class SmartVisitor implements Serializable {
     @ApiModelProperty(value = "用户ID")
     private Integer userId;
 
+    @ApiModelProperty(value = "访客姓名")
+    private String userName;
+
+    @ApiModelProperty(value = "访客手机号")
+    private String userPhone;
+
+    @ApiModelProperty(value = "访客证件号")
+    private String userNumber;
+
     @ApiModelProperty(value = "同行人数")
     private Integer peerNum;
 
@@ -46,21 +55,32 @@ public class SmartVisitor implements Serializable {
     @ApiModelProperty(value = "访问事由")
     private String visitReason;
 
-    @ApiModelProperty(value = "状态 待审核:0  已拒绝:1  已推送:2")
+    @ApiModelProperty(value = "状态 待审核:1  已拒绝:2  已推送:3")
     private Integer statu;
 
     @ApiModelProperty(value = "来访时间")
     private Date visitorTime;
 
-    @ApiModelProperty(value = "受访者 有多个用户ID,用逗号隔开;同一个部门可以选多个,不同部门就再发起新的访客预约")
-    private String respondent;
+    @ApiModelProperty(value = "受访者ID")
+    private Integer respondent;
 
-    @ApiModelProperty(value = "部门ID 选择第一个受访者自动把部门ID带过来")
+    @ApiModelProperty(value = "部门ID")
     private Integer departmentId;
 
     @ApiModelProperty(value = "受访者电话")
     private String respondentPhone;
 
+    @ApiModelProperty(value = "受访者姓名")
+    private String respondentName;
+
+    /**
+     * 访客类型
+     * 家长:1
+     * 其他:2
+     */
+    @ApiModelProperty(value = "访客类型")
+    private Integer visitorType;
+
     @ApiModelProperty(value = "创建时间")
     @TableField(fill = FieldFill.INSERT)
     private Date createTime;

+ 58 - 0
src/main/java/com/template/model/request/otherAppointmentRequest.java

@@ -0,0 +1,58 @@
+package com.template.model.request;
+
+import com.template.model.vo.AffiliateUserVo;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/14 星期四 11:30
+ * @Description: com.template.model.request
+ * @Version: 1.0
+ */
+@Data
+public class otherAppointmentRequest {
+    /**
+     * 用户ID
+     * 根据用户ID把访客姓名、访客手机号、证件号带过来
+     */
+    @NotNull(message = "用户ID不能为空")
+    private Integer userId;
+
+    /**
+     * 来访时间
+     */
+    @NotBlank(message = "来访时间不能为空")
+    private String visitorTime;
+
+    /**
+     * 访问事由
+     */
+    @NotBlank(message = "访问事由不能为空")
+    private String visitReason;
+
+    /**
+     * 车牌号
+     */
+    private String carNum;
+
+    /**
+     * 同行人数
+     */
+    private Integer peerNum;
+
+    /**
+     * 受访者姓名
+     */
+    @NotBlank(message = "受访者姓名不能为空")
+    private String respondentName;
+
+    /**
+     * 受访者电话
+     */
+    @NotBlank(message = "受访者电话不能为空")
+    private String respondentPhone;
+}

+ 52 - 0
src/main/java/com/template/model/request/parentsAppointmentRequest.java

@@ -0,0 +1,52 @@
+package com.template.model.request;
+
+import com.template.model.vo.AffiliateUserVo;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/14 星期四 11:30
+ * @Description: com.template.model.request
+ * @Version: 1.0
+ */
+@Data
+public class parentsAppointmentRequest {
+    /**
+     * 用户ID
+     * 根据用户ID把访客姓名、访客手机号、证件号带过来
+     */
+    @NotNull(message = "用户ID不能为空")
+    private Integer userId;
+
+    /**
+     * 来访时间
+     */
+    @NotBlank(message = "来访时间不能为空")
+    private String visitorTime;
+
+    /**
+     * 访问事由
+     */
+    @NotBlank(message = "访问事由不能为空")
+    private String visitReason;
+
+    /**
+     * 车牌号
+     */
+    private String carNum;
+
+    /**
+     * 同行人数
+     */
+    private Integer peerNum;
+
+    /**
+     * 受访学生信息
+     */
+    private List<AffiliateUserVo> students;
+
+}

+ 5 - 0
src/main/java/com/template/model/vo/AffiliateUserVo.java

@@ -24,4 +24,9 @@ public class AffiliateUserVo {
      * 编号
      */
     private String cardNo;
+
+    /**
+     * 部门ID
+     */
+    private Integer departmentId;
 }

+ 68 - 0
src/main/java/com/template/model/vo/VisitorPageVo.java

@@ -0,0 +1,68 @@
+package com.template.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.template.model.enumModel.eApproveStatu;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author: binguo
+ * @Date: 2023/12/14 星期四 9:20
+ * @Description: com.template.model.vo
+ * @Version: 1.0
+ */
+@Data
+public class VisitorPageVo {
+    /**
+     * 数据ID
+     */
+    private Integer id;
+
+    /**
+     * 用户ID
+     */
+    private Integer userId;
+
+    /**
+     * 用户名称
+     */
+    private String userName;
+
+    /**
+     * 提交时间
+     */
+    private Date createTime;
+
+    /**
+     * 数据状态
+     */
+    @JsonIgnore
+    private Integer statu;
+
+    /**
+     * 状态
+     * 待审核:1
+     * 已拒绝:2
+     * 已推送:3
+     */
+    private String statuStr;
+
+    public String getStatuStr() {
+        return eApproveStatu.stringOf(statu);
+    }
+
+    public void setStatuStr(String statuStr) {
+        this.statuStr = statuStr;
+    }
+
+    /**
+     * 来访时间
+     */
+    private Date visitorTime;
+
+    /**
+     * 访问事由
+     */
+    private String visitReason;
+}

+ 7 - 0
src/main/java/com/template/services/SmartVisitorService.java

@@ -4,6 +4,9 @@ import com.template.model.pojo.SmartVisitor;
 import com.template.model.pojo.SmartVisitor;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.VisitorPageVo;
+
+import java.util.List;
 
 /**
  * <p>
@@ -23,4 +26,8 @@ public interface SmartVisitorService extends IService<SmartVisitor> {
     int deleteSmartVisitorById(int id);
 
     SmartVisitor getSmartById(int id);
+
+    boolean insertVisitorBatch(List<SmartVisitor> visitors);
+
+    PageUtils<VisitorPageVo> smartVisitorPageByUserId(int currentPage, int pageCount, Integer userId, Integer statu);
 }

+ 18 - 0
src/main/java/com/template/services/impl/SmartVisitorServiceImpl.java

@@ -8,12 +8,15 @@ import com.template.model.pojo.SmartVisitor;
 import com.template.model.pojo.SmartVisitor;
 import com.template.mapper.SmartVisitorMapper;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.VisitorPageVo;
 import com.template.services.SmartVisitorService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务实现类
@@ -59,4 +62,19 @@ public class SmartVisitorServiceImpl extends ServiceImpl<SmartVisitorMapper, Sma
         SmartVisitor result = smartVisitorMapper.selectById(id);
         return result;
     }
+
+    @Override
+    public boolean insertVisitorBatch(List<SmartVisitor> visitors) {
+        boolean result = this.saveBatch(visitors);
+        return result;
+    }
+
+    @Override
+    public PageUtils<VisitorPageVo> smartVisitorPageByUserId(int currentPage, int pageCount, Integer userId, Integer statu) {
+        Page<VisitorPageVo> page = new Page<>();
+        page.setCurrent(currentPage);
+        page.setSize(pageCount);
+        IPage<VisitorPageVo> datas = smartVisitorMapper.queryVisitorPage(page, userId, statu);
+        return new PageUtils(datas);
+    }
 }

+ 15 - 0
src/main/resources/mapper/template/SmartUserMapper.xml

@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartUserMapper">
+    <resultMap type="com.template.model.vo.AffiliateUserVo" id="affiliateUserMap">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="cardNo" column="card_no"/>
+        <result property="departmentId" column="department_id"/>
+    </resultMap>
 
+    <select id="queryAffiliateUserById" resultType="com.template.model.vo.AffiliateUserVo" resultMap="affiliateUserMap">
+        select id,name,card_no,department_id from smart_user
+        where find_in_set(id,(select affiliate from smart_user where
+        deleted = 0
+        <if test="id != null and id != ''">
+            and id = #{id}
+        </if>
+        )) and deleted = 0
+    </select>
 </mapper>

+ 21 - 1
src/main/resources/mapper/template/SmartVisitorMapper.xml

@@ -1,9 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartVisitorMapper">
+    <resultMap type="com.template.model.vo.VisitorPageVo" id="visitorPageMap">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="userName" column="user_name"/>
+        <result property="createTime" column="create_time"/>
+        <result property="statu" column="statu"/>
+        <result property="visitorTime" column="visitor_time"/>
+        <result property="visitReason" column="visit_reason"/>
+    </resultMap>
 
+    <select id="queryVisitorPage" resultType="com.template.model.vo.VisitorPageVo" resultMap="visitorPageMap">
+        select sv.id,sv.user_id,su.name as user_name,sv.create_time,sv.statu,sv.visitor_time,sv.visit_reason from
+        smart_visitor sv
+        left join smart_user su on su.deleted = 0 and sv.user_id = su.id
+        where sv.deleted = 0
+        <if test="userId != null and userId != ''">
+            and sv.user_id = #{userId}
+        </if>
 
-
+        <if test="statu != null and statu != ''">
+            and sv.statu = #{statu}
+        </if>
+    </select>
 
 
 </mapper>

+ 1 - 16
src/main/resources/mapper/template/SystemUserMapper.xml

@@ -1,19 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.template.mapper.SmartUserMapper">
-    <resultMap type="com.template.model.vo.AffiliateUserVo" id="affiliateUserMap">
-        <result property="id" column="id"/>
-        <result property="name" column="name"/>
-        <result property="cardNo" column="card_no"/>
-    </resultMap>
-
-    <select id="queryAffiliateUserById" resultType="com.template.model.vo.AffiliateUserVo" resultMap="affiliateUserMap">
-        select id,name,card_no from smart_user
-        where find_in_set(id,(select affiliate from smart_user where
-        deleted = 0
-        <if test="id != null and id != ''">
-            and id = #{id}
-        </if>
-        )) and deleted = 0
-    </select>
+<mapper namespace="com.template.mapper.SystemUserMapper">
 </mapper>

+ 15 - 0
target/classes/mapper/template/SmartUserMapper.xml

@@ -1,5 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartUserMapper">
+    <resultMap type="com.template.model.vo.AffiliateUserVo" id="affiliateUserMap">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="cardNo" column="card_no"/>
+        <result property="departmentId" column="department_id"/>
+    </resultMap>
 
+    <select id="queryAffiliateUserById" resultType="com.template.model.vo.AffiliateUserVo" resultMap="affiliateUserMap">
+        select id,name,card_no,department_id from smart_user
+        where find_in_set(id,(select affiliate from smart_user where
+        deleted = 0
+        <if test="id != null and id != ''">
+            and id = #{id}
+        </if>
+        )) and deleted = 0
+    </select>
 </mapper>

+ 21 - 1
target/classes/mapper/template/SmartVisitorMapper.xml

@@ -1,9 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartVisitorMapper">
+    <resultMap type="com.template.model.vo.VisitorPageVo" id="visitorPageMap">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="userName" column="user_name"/>
+        <result property="createTime" column="create_time"/>
+        <result property="statu" column="statu"/>
+        <result property="visitorTime" column="visitor_time"/>
+        <result property="visitReason" column="visit_reason"/>
+    </resultMap>
 
+    <select id="queryVisitorPage" resultType="com.template.model.vo.VisitorPageVo" resultMap="visitorPageMap">
+        select sv.id,sv.user_id,su.name as user_name,sv.create_time,sv.statu,sv.visitor_time,sv.visit_reason from
+        smart_visitor sv
+        left join smart_user su on su.deleted = 0 and sv.user_id = su.id
+        where sv.deleted = 0
+        <if test="userId != null and userId != ''">
+            and sv.user_id = #{userId}
+        </if>
 
-
+        <if test="statu != null and statu != ''">
+            and sv.statu = #{statu}
+        </if>
+    </select>
 
 
 </mapper>

+ 1 - 16
target/classes/mapper/template/SystemUserMapper.xml

@@ -1,19 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.template.mapper.SmartUserMapper">
-    <resultMap type="com.template.model.vo.AffiliateUserVo" id="affiliateUserMap">
-        <result property="id" column="id"/>
-        <result property="name" column="name"/>
-        <result property="cardNo" column="card_no"/>
-    </resultMap>
-
-    <select id="queryAffiliateUserById" resultType="com.template.model.vo.AffiliateUserVo" resultMap="affiliateUserMap">
-        select id,name,card_no from smart_user
-        where find_in_set(id,(select affiliate from smart_user where
-        deleted = 0
-        <if test="id != null and id != ''">
-            and id = #{id}
-        </if>
-        )) and deleted = 0
-    </select>
+<mapper namespace="com.template.mapper.SystemUserMapper">
 </mapper>