浏览代码

预约配置修改-首页修改

ChenSir 1 年之前
父节点
当前提交
2941d29a6b
共有 19 个文件被更改,包括 186 次插入32 次删除
  1. 22 0
      aidex-controller/src/main/java/com/aidex/web/controller/app/AppController.java
  2. 2 1
      aidex-controller/src/main/java/com/aidex/web/controller/system/SysProfileController.java
  3. 10 0
      aidex-controller/src/main/java/com/aidex/web/controller/system/SysWharfController.java
  4. 2 0
      aidex-system/src/main/java/com/aidex/common/app/server/IAppService.java
  5. 18 0
      aidex-system/src/main/java/com/aidex/common/app/server/impl/AppService.java
  6. 11 0
      aidex-system/src/main/java/com/aidex/system/domain/SysReservationConfig.java
  7. 9 1
      aidex-system/src/main/java/com/aidex/system/mapper/SysReservationConfigMapper.xml
  8. 3 1
      aidex-system/src/main/java/com/aidex/system/mapper/SysWharfMapper.java
  9. 9 0
      aidex-system/src/main/java/com/aidex/system/mapper/SysWharfMapper.xml
  10. 4 0
      aidex-system/src/main/java/com/aidex/system/req/SysReservationConfigReq.java
  11. 3 0
      aidex-system/src/main/java/com/aidex/system/service/SysWharfService.java
  12. 4 0
      aidex-system/src/main/java/com/aidex/system/service/impl/SysReservationConfigServiceImpl.java
  13. 5 0
      aidex-system/src/main/java/com/aidex/system/service/impl/SysWharfServiceImpl.java
  14. 8 0
      aidex-ui/src/api/system/sysWharf.js
  15. 3 3
      aidex-ui/src/layouts/UserLayout.vue
  16. 10 3
      aidex-ui/src/views/system/sysreservationconfig/index.vue
  17. 13 0
      aidex-ui/src/views/system/sysreservationconfig/modules/SysReservationConfigBatchAddForm.vue
  18. 15 15
      aidex-ui/src/views/system/sysreservationconfig/modules/SysReservationConfigEditForm.vue
  19. 35 8
      aidex-ui/src/views/system/sysreservationconfig/modules/SysReservationConfigForm.js

+ 22 - 0
aidex-controller/src/main/java/com/aidex/web/controller/app/AppController.java

@@ -64,6 +64,9 @@ public class AppController {
     private SysDictDataService sysDictDataService;
 
     @Autowired
+    private SysConfigService sysConfigService;
+
+    @Autowired
     private SysNoticeService noticeService;
 
     @Resource
@@ -102,6 +105,15 @@ public class AppController {
         return R.data(iAppService.findSysWharfList());
     }
 
+    @GetMapping("/wharf/{reservationId}")
+    @ApiOperation(value = "根据预约配置Id获取可预约站点", notes = "根据预约配置Id获取可预约站点", produces = "application/json")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "reservationId", value = "预约配置Id", required = true, dataType = "String")})
+    public R<List<SysWharf>> selectSysWharfListByReservationId(@PathVariable("reservationId") String reservationId)
+    {
+        return R.data(iAppService.selectSysWharfListByReservationId(reservationId));
+    }
+
     @GetMapping("/location")
     @ApiOperation(value = "获取离我最近的船只位置", notes = "获取离我最近的船只位置", produces = "application/json")
     @ApiImplicitParams({
@@ -144,6 +156,14 @@ public class AppController {
         return R.data(iAppService.findNearestStation(lat,lon));
     }
 
+    @GetMapping("/sysreservation/status")
+    @ApiOperation(value = "获取预约状态", notes = "获取预约状态 0 开启 1 关闭", produces = "application/json")
+    public R<SysConfig> getSysreservationStatus()
+    {
+        SysConfig configByKey = sysConfigService.findConfigByKey("sys.mini.app.open");
+        return R.data(configByKey);
+    }
+
     @GetMapping("/route")
     @ApiOperation(value = "获取航线信息", notes = "获取航线信息", produces = "application/json")
     public R<List<SysRouteVo>> getRoute()
@@ -219,6 +239,8 @@ public class AppController {
         return R.data(list);
     }
 
+
+
     @GetMapping("/notice/data")
     @ApiOperation(value = "按信息类型获取信息数据", notes = "按信息类型获取信息数据", produces = "application/json")
     @ApiImplicitParams({

+ 2 - 1
aidex-controller/src/main/java/com/aidex/web/controller/system/SysProfileController.java

@@ -98,7 +98,8 @@ public class SysProfileController extends BaseController
     {
         LoginUser loginUser = getLoginUser();
         String userName = loginUser.getUsername();
-        String password = loginUser.getPassword();
+        SysUser oldUser = userService.get(loginUser.getUserId());
+        String password = oldUser.getPassword();
         if (!SecurityUtils.matchesPassword(oldPassword, password))
         {
             return AjaxResult.error("修改密码失败,旧密码错误");

+ 10 - 0
aidex-controller/src/main/java/com/aidex/web/controller/system/SysWharfController.java

@@ -57,6 +57,16 @@ public class SysWharfController extends BaseController {
     }
 
     /**
+     * 查询码头管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:sysWharf:list')")
+    @GetMapping("/getAllNotDel")
+    public R<List<SysWharf>> getAllNotDel() {
+        SysWharf sysWharf = new SysWharf();
+        return R.data(sysWharfService.findList(sysWharf));
+    }
+
+    /**
      * 获取码头管理详细信息
      */
     @PreAuthorize("@ss.hasPermi('system:sysWharf:query')")

+ 2 - 0
aidex-system/src/main/java/com/aidex/common/app/server/IAppService.java

@@ -44,4 +44,6 @@ public interface IAppService {
     List<SysReservationDataHistoryVO> getHistoryReservationList(String openid, String type);
 
     int insertCameraAlarm(SysCameraAlarm sysCameraAlarm);
+
+    List<SysWharf> selectSysWharfListByReservationId(String reservationId);
 }

+ 18 - 0
aidex-system/src/main/java/com/aidex/common/app/server/impl/AppService.java

@@ -372,4 +372,22 @@ public class AppService implements IAppService {
         return sysCameraAlarmMapper.insertCameraAlarm(sysCameraAlarm);
     }
 
+    @Override
+    public List<SysWharf> selectSysWharfListByReservationId(String reservationId) {
+        List<SysWharf> sysWharves = sysWharfService.selectSysWharfByReservationId(reservationId);
+        SysReservationConfig sysReservationConfig = sysReservationConfigService.get(reservationId);
+        if (DateUtil.isSameDay(sysReservationConfig.getReservationDate(), new Date())){
+            SysWharf sysWharf = new SysWharf();
+            sysWharf.setStatus(BaseEntity.STATUS_NORMAL);
+            List<SysWharf> listByCache = sysWharfService.findList(sysWharf);
+            if (listByCache.size() > 0){
+                List<SysWharf> collect = sysWharves.stream().filter(item -> listByCache.stream().anyMatch(item1 -> item1.getId().equals(item.getId()))).collect(Collectors.toList());
+                return collect;
+            }
+            return sysWharves;
+        }else {
+            return sysWharves;
+        }
+    }
+
 }

+ 11 - 0
aidex-system/src/main/java/com/aidex/system/domain/SysReservationConfig.java

@@ -67,6 +67,17 @@ public class SysReservationConfig extends BaseEntity<SysReservationConfig>
     @FieldRemark(name = "可预约人数",field = "enableNum")
     private Long enableNum;
 
+
+    /** 可预约人数 */
+    @LogField
+    @FieldRemark(name = "可预约码头",field = "enableWharf")
+    private String enableWharf;
+
+    /** 可预约人数 */
+    @Excel(name = "可预约码头")
+    @LogField
+    private String wharfNames;
+
     /** 可预约人数 */
     @Excel(name = "已预约人数")
     @LogField

+ 9 - 1
aidex-system/src/main/java/com/aidex/system/mapper/SysReservationConfigMapper.xml

@@ -11,6 +11,8 @@
 
         a.enable_num as "enableNum",
 
+        a.enable_wharf as "enableWharf",
+
         a.status as "status",
 
         a.remark as "remark",
@@ -33,7 +35,9 @@
 
         a.del_flag as "delFlag",
 
-	    (SELECT COUNT(1) from sys_reservation_data d WHERE a.id = d.reservation_config_id)  as reservationNum
+	    (SELECT COUNT(1) from sys_reservation_data d WHERE a.id = d.reservation_config_id)  as reservationNum,
+
+	    (select group_concat(sw.wharf_nanme SEPARATOR ',' ) from sys_wharf sw where find_in_set(sw.id, a.enable_wharf)) as wharfNames
 
     </sql>
 
@@ -187,6 +191,8 @@
 
             enable_num,
 
+            enable_wharf,
+
             status,
 
             remark,
@@ -219,6 +225,8 @@
 
             #{item.enableNum},
 
+            #{item.enableWharf},
+
             #{item.status},
 
             #{item.remark},

+ 3 - 1
aidex-system/src/main/java/com/aidex/system/mapper/SysWharfMapper.java

@@ -4,6 +4,8 @@ import com.aidex.common.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import com.aidex.system.domain.SysWharf;
 
+import java.util.List;
+
 /**
  * 码头管理Mapper接口
  * @author ChenSir
@@ -22,5 +24,5 @@ public interface SysWharfMapper extends BaseMapper<SysWharf>
 
     public int updateStatus(SysWharf sysWharf);
 
-
+    public List<SysWharf> selectSysWharfByReservationId(String id);
 }

+ 9 - 0
aidex-system/src/main/java/com/aidex/system/mapper/SysWharfMapper.xml

@@ -92,6 +92,15 @@
         </where>
     </select>
 
+    <select id="selectSysWharfByReservationId" resultType="com.aidex.system.domain.SysWharf">
+        select
+            sw.wharf_nanme as "wharfNanme" , sw.id  as "id"
+        from
+            sys_wharf sw
+        where
+            find_in_set(sw.id, (select sc.enable_wharf  from sys_reservation_config sc where sc.id = #{id})) order by sw.wharf_order
+    </select>
+
 
     <insert id="insert">
         INSERT INTO sys_wharf(

+ 4 - 0
aidex-system/src/main/java/com/aidex/system/req/SysReservationConfigReq.java

@@ -46,6 +46,10 @@ public class SysReservationConfigReq implements Serializable {
 	private long enableNum;
 
 	/** 班次可预约人数 */
+	@NotNull(message = "可预约码头不允许为空")
+	private String enableWharf;
+
+	/** 班次可预约人数 */
 	@NotNull(message = "发布状态不可为空")
 	private String status;
 

+ 3 - 0
aidex-system/src/main/java/com/aidex/system/service/SysWharfService.java

@@ -37,4 +37,7 @@ public interface SysWharfService extends BaseService<SysWharf> {
 
 
     List<SysWharf> findListByCache(SysWharf sysWharf);
+
+
+    List<SysWharf> selectSysWharfByReservationId(String id);
 }

+ 4 - 0
aidex-system/src/main/java/com/aidex/system/service/impl/SysReservationConfigServiceImpl.java

@@ -162,6 +162,7 @@ public class SysReservationConfigServiceImpl extends BaseServiceImpl<SysReservat
                         sysReservationConfig.setReservationEndTime(endTime);
                         sysReservationConfig.setId(IdUtil.simpleUUID());
                         sysReservationConfig.setStatus(sysReservationConfigReq.getStatus());
+                        sysReservationConfig.setEnableWharf(sysReservationConfigReq.getEnableWharf());
                         last = endTime;
                         list.add(sysReservationConfig);
                         endTime = DateUtil.offset(endTime, DateField.MINUTE, sysReservationConfigReq.getDuration());
@@ -175,6 +176,7 @@ public class SysReservationConfigServiceImpl extends BaseServiceImpl<SysReservat
                         lastConfig.setEnableNum(sysReservationConfigReq.getEnableNum());
                         lastConfig.setId(IdUtil.simpleUUID());
                         lastConfig.setStatus(sysReservationConfigReq.getStatus());
+                        lastConfig.setEnableWharf(sysReservationConfigReq.getEnableWharf());
                         list.add(lastConfig);
                     }
                 }
@@ -201,6 +203,7 @@ public class SysReservationConfigServiceImpl extends BaseServiceImpl<SysReservat
                     sysReservationConfig.setReservationEndTime(endTime);
                     sysReservationConfig.setId(IdUtil.simpleUUID());
                     sysReservationConfig.setStatus(sysReservationConfigReq.getStatus());
+                    sysReservationConfig.setEnableWharf(sysReservationConfigReq.getEnableWharf());
                     last = endTime;
                     list.add(sysReservationConfig);
                     endTime = DateUtil.offset(endTime, DateField.MINUTE, sysReservationConfigReq.getDuration());
@@ -214,6 +217,7 @@ public class SysReservationConfigServiceImpl extends BaseServiceImpl<SysReservat
                     lastConfig.setEnableNum(sysReservationConfigReq.getEnableNum());
                     lastConfig.setId(IdUtil.simpleUUID());
                     lastConfig.setStatus(sysReservationConfigReq.getStatus());
+                    lastConfig.setEnableWharf(sysReservationConfigReq.getEnableWharf());
                     list.add(lastConfig);
                 }
                 return mapper.batchInsert(list);

+ 5 - 0
aidex-system/src/main/java/com/aidex/system/service/impl/SysWharfServiceImpl.java

@@ -169,6 +169,11 @@ public class SysWharfServiceImpl extends BaseServiceImpl<SysWharfMapper, SysWhar
         return list;
     }
 
+    @Override
+    public List<SysWharf> selectSysWharfByReservationId(String id) {
+        return this.mapper.selectSysWharfByReservationId(id);
+    }
+
     private void loadCache(List<SysWharf> wharfList){
         for (SysWharf sysWharf : wharfList)
         {

+ 8 - 0
aidex-ui/src/api/system/sysWharf.js

@@ -76,3 +76,11 @@ export function getAllSysWharf () {
     method: 'get'
   })
 }
+
+// 查询所有未删除码头
+export function getAllNotDelSysWharf () {
+  return request({
+    url: '/system/sysWharf/getAllNotDel',
+    method: 'get'
+  })
+}

+ 3 - 3
aidex-ui/src/layouts/UserLayout.vue

@@ -16,12 +16,12 @@
 
       <div class="footer">
         <div class="links">
-          <a href="https://github.com/fuzui/AiDex-Antdv" target="_blank">帮助</a>
+<!--          <a href="https://github.com/fuzui/AiDex-Antdv" target="_blank">帮助</a>
           <a href="https://github.com/fuzui/AiDex-Antdv" target="_blank">隐私</a>
-          <a href="https://github.com/fuzui/AiDex-Antdv" target="_blank">条款</a>
+          <a href="https://github.com/fuzui/AiDex-Antdv" target="_blank">条款</a>-->
         </div>
         <div class="copyright">
-          Copyright &copy; 2024 <a target="_blank"></a>
+<!--          Copyright &copy; 2024 <a target="_blank"></a>-->
         </div>
       </div>
     </div>

+ 10 - 3
aidex-ui/src/views/system/sysreservationconfig/index.vue

@@ -189,13 +189,13 @@ export default {
           title: '可预约人数',
           dataIndex: 'enableNum',
           align: 'center',
-          width: '15%'
+          width: '10%'
         },
         {
           title: '已预约人数',
           dataIndex: 'reservationNum',
           align: 'center',
-          width: '15%'
+          width: '10%'
         },
         {
           title: '配置状态',
@@ -205,6 +205,13 @@ export default {
           width: '15%'
         },
         {
+          title: '可预约码头',
+          dataIndex: 'wharfNames',
+          align: 'center',
+          ellipsis: true,
+          width: '15%'
+        },
+        {
           title: '操作',
           dataIndex: 'operation',
           align: 'center',
@@ -218,7 +225,7 @@ export default {
   created () {
     this.getList()
     getInitData('sys_reservation_status').then(response => {
-      this.statusOptions = response.data.sys_normal_disable
+      this.statusOptions = response.data.sys_reservation_status
     })
   },
   methods: {

+ 13 - 0
aidex-ui/src/views/system/sysreservationconfig/modules/SysReservationConfigBatchAddForm.vue

@@ -25,6 +25,19 @@
           </a-form-model-item>
         </a-col>
       </a-row>
+      <a-row :gutter="32">
+        <a-col :span="24">
+          <a-form-model-item label="可预约码头" prop="enableWharf">
+            <a-select
+              mode="multiple"
+              showSearch
+              v-model="batchForm.enableWharf"
+              placeholder="请选择可预约码头"
+              style="width: 100%;">
+              <a-select-option v-for="d in wharfList" :key="d.id" :value="d.id">{{ d.wharfNanme }}</a-select-option>
+            </a-select></a-form-model-item>
+        </a-col>
+      </a-row>
     </a-form-model>
     <template slot="footer">
       <a-button :disabled="disabled" @click="cancel">

+ 15 - 15
aidex-ui/src/views/system/sysreservationconfig/modules/SysReservationConfigEditForm.vue

@@ -14,6 +14,7 @@
             <a-form-model-item label="预约日期" prop="reservationDate">
               <a-date-picker
                 v-model="form.reservationDate"
+                disabled
                 valueFormat="YYYY-MM-DD"
                 :show-today="true"
                 placeholder="选择日期"
@@ -23,24 +24,12 @@
           </a-col>
           <a-col :span="12">
             <a-form-model-item label="预约开始时段" prop="reservationStartTime">
-              <a-date-picker
-                v-model="form.reservationStartTime"
-                valueFormat="YYYY-MM-DD"
-                :show-today="true"
-                placeholder="选择日期"
-                style="width: 100%"
-              />
+              <a-time-picker disabled style="width: 100%;height: 30px;" placeholder="选择日期" format="HH:mm" v-model="form.reservationStartTime"></a-time-picker>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
             <a-form-model-item label="预约结束时段" prop="reservationEndTime">
-              <a-date-picker
-                v-model="form.reservationEndTime"
-                valueFormat="YYYY-MM-DD"
-                :show-today="true"
-                placeholder="选择日期"
-                style="width: 100%"
-              />
+              <a-time-picker disabled style="width: 100%;height: 30px;" placeholder="选择日期" format="HH:mm" v-model="form.reservationEndTime"></a-time-picker>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
@@ -49,7 +38,7 @@
             </a-form-model-item>
           </a-col>
           <a-col :span="12" >
-            <a-form-model-item label="配置状态 0 保存 1 发布" prop="status">
+            <a-form-model-item label="配置状态" prop="status">
               <a-radio-group v-model="form.status">
                 <a-radio
                   v-for="(dict, index) in statusOptions"
@@ -61,6 +50,17 @@
               </a-radio-group>
             </a-form-model-item>
           </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="可预约码头" prop="enableWharf">
+              <a-select
+                mode="multiple"
+                showSearch
+                v-model="form.enableWharf"
+                placeholder="请选择可预约码头"
+                style="width: 100%;">
+                <a-select-option v-for="d in wharfList" :key="d.id" :value="d.id">{{ d.wharfNanme }}</a-select-option>
+              </a-select></a-form-model-item>
+          </a-col>
         </a-row>
       </a-spin>
       <div class="bottom-control">

+ 35 - 8
aidex-ui/src/views/system/sysreservationconfig/modules/SysReservationConfigForm.js

@@ -1,5 +1,11 @@
 import AntModal from '@/components/pt/dialog/AntModal'
-import { getSysReservationConfig, addSysReservationConfig, updateSysReservationConfig, batchAddSysReservationConfig } from '@/api/system/sysReservationConfig'
+import {
+  getSysReservationConfig,
+  addSysReservationConfig,
+  updateSysReservationConfig,
+  batchAddSysReservationConfig
+} from '@/api/system/sysReservationConfig'
+import { getAllNotDelSysWharf } from '@/api/system/sysWharf'
 
 export default {
   name: 'CreateForm',
@@ -26,29 +32,46 @@ export default {
       id: undefined,
       formTitle: '预约配置',
       // 表单参数
-      form: {},
+      form: {
+        enableWharf: []
+      },
       batchForm: {
-        dateRange: []
+        dateRange: [],
+        enableWharf: []
       },
       rules: {
         reservationDate: [{ required: true, message: '预约日期不能为空', trigger: 'blur' }],
         reservationStartTime: [{ required: true, message: '预约开始时段不能为空', trigger: 'blur' }],
         reservationEndTime: [{ required: true, message: '预约结束时段不能为空', trigger: 'blur' }],
-        enableNum: [{ required: true, message: '可预约人数不能为空', trigger: 'blur' }]
+        enableNum: [{ required: true, message: '可预约人数不能为空', trigger: 'blur' }],
+        enableWharf: [{ required: true, message: '可预约码头不能为空', trigger: 'blur' }]
       },
       batchAddRules: {
         dateRange: [{ required: true, message: '预约日期不能为空', trigger: 'blur' }],
         duration: [{ required: true, message: '班次时长不能为空', trigger: 'blur' }],
-        enableNum: [{ required: true, message: '可预约人数不能为空', trigger: 'blur' }]
-      }
+        enableNum: [{ required: true, message: '可预约人数不能为空', trigger: 'blur' }],
+        enableWharf: [{ required: true, message: '可预约码头不能为空', trigger: 'blur' }]
+      },
+      wharfList: []
     }
   },
   filters: {},
-  created () {},
-  computed: {},
+  created () {
+    this.getWharfList()
+    console.log(this.statusOptions)
+  },
+  computed: {
+  },
   watch: {},
   mounted () {},
   methods: {
+    getWharfList () {
+      this.wharfList = []
+      getAllNotDelSysWharf().then(response => {
+        this.wharfList = response.data
+        this.batchForm.enableWharf = this.wharfList.map(item => item.id)
+      })
+    },
     onClose () {
       this.open = false
       this.reset()
@@ -90,6 +113,9 @@ export default {
       const sysReservationConfigId = row.id
       getSysReservationConfig(sysReservationConfigId).then(response => {
         this.form = response.data
+        this.form.reservationStartTime = this.form.reservationDate + ' ' + this.form.reservationStartTime + ':00'
+        this.form.reservationEndTime = this.form.reservationDate + ' ' + this.form.reservationEndTime + ':00'
+        this.form.enableWharf = this.form.enableWharf.split(',')
         this.formTitle = '修改预约配置'
         this.spinning = !this.spinning
       })
@@ -104,6 +130,7 @@ export default {
             endDate: this.batchForm.dateRange[1],
             duration: this.batchForm.duration,
             enableNum: this.batchForm.enableNum,
+            enableWharf: this.batchForm.enableWharf.join(','),
             status: status
           }
           batchAddSysReservationConfig(saveForm).then(response => {