Commit 77d756c5 by zhaopanyu

Merge branch 'master' of 49.232.152.146:xhxy/smart_school

parents 510b4e04 c7c0fb0e
...@@ -3,18 +3,25 @@ package yangtz.cs.liu.campus.controller.schoolSecurity; ...@@ -3,18 +3,25 @@ package yangtz.cs.liu.campus.controller.schoolSecurity;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleInOut; import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleInOut;
import yangtz.cs.liu.campus.service.schoolSecurity.ISchoolVehicleInOutService; import yangtz.cs.liu.campus.service.schoolSecurity.ISchoolVehicleInOutService;
import yangtz.cs.liu.campus.service.teacher.ISchoolTeacherLeaveService;
import yangtz.cs.liu.campus.service.teacher.ISchoolTeacherService;
import yangtz.cs.liu.campus.vo.schoolSecurity.SchoolVehicleInOutVo; import yangtz.cs.liu.campus.vo.schoolSecurity.SchoolVehicleInOutVo;
import yangtz.cs.liu.campus.vo.teacher.SchoolTeacherVO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import static yangtz.cs.liu.campus.constant.GradeConstant.SCHOOLLEADER;
/** /**
* 车辆出入登记Controller * 车辆出入登记Controller
* *
...@@ -28,6 +35,10 @@ public class SchoolVehicleInOutController extends BaseController ...@@ -28,6 +35,10 @@ public class SchoolVehicleInOutController extends BaseController
@Autowired @Autowired
private ISchoolVehicleInOutService schoolVehicleInOutService; private ISchoolVehicleInOutService schoolVehicleInOutService;
@Autowired
private ISchoolTeacherLeaveService schoolTeacherLeaveService;
@Autowired
private ISchoolTeacherService schoolTeacherService;
/** /**
* 查询车辆出入登记列表 * 查询车辆出入登记列表
...@@ -68,7 +79,7 @@ public class SchoolVehicleInOutController extends BaseController ...@@ -68,7 +79,7 @@ public class SchoolVehicleInOutController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SchoolVehicleInOutVo schoolVehicleInOutVo) public AjaxResult add(@RequestBody SchoolVehicleInOutVo schoolVehicleInOutVo)
{ {
return toAjax(schoolVehicleInOutService.insertSchoolVehicleInOut(schoolVehicleInOutVo)); return toAjax(schoolVehicleInOutService.insertSchoolVehicleInOutVo(schoolVehicleInOutVo));
} }
/** /**
...@@ -90,4 +101,32 @@ public class SchoolVehicleInOutController extends BaseController ...@@ -90,4 +101,32 @@ public class SchoolVehicleInOutController extends BaseController
{ {
return toAjax(schoolVehicleInOutService.deleteSchoolVehicleInOutByIds(ids)); return toAjax(schoolVehicleInOutService.deleteSchoolVehicleInOutByIds(ids));
} }
/**
* 获取当前登录人车辆登记信息
*/
@GetMapping("/getUserVehicle")
public AjaxResult getUserVehicle(){
SysUser user = SecurityUtils.getLoginUser().getUser();
return AjaxResult.success(schoolVehicleInOutService.getUserVehicle(user.getUserId()));
}
/**
* 获取级部/处室领导
*/
@GetMapping("/getGradeOrDeptLeader/{applyOrgid}")
public TableDataInfo getGradeOrDeptLeader(@PathVariable Long applyOrgid, SchoolTeacherVO teacherVO){
//判断用户是职工还是教工,来确定传过来的id是级部id还是部门id
String employeeType = getLoginUser().getUser().getEmployeeType();
return getDataTable(schoolTeacherLeaveService.getLeader(applyOrgid,employeeType,teacherVO));
}
/**
* 获取分管领导
* */
@GetMapping("/getSchoolLeader")
public TableDataInfo getSchoolLeader(SchoolTeacherVO teacher) {
return getDataTable(schoolTeacherService.getSectionLeader(null,SCHOOLLEADER,teacher));
}
} }
package yangtz.cs.liu.campus.mapper.schoolSecurity; package yangtz.cs.liu.campus.mapper.schoolSecurity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleInOut; import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleInOut;
import yangtz.cs.liu.campus.vo.schoolSecurity.SchoolVehicleInOutVo; import yangtz.cs.liu.campus.vo.schoolSecurity.SchoolVehicleInOutVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 车辆出入登记Mapper接口 * 车辆出入登记Mapper接口
...@@ -62,4 +64,11 @@ public interface SchoolVehicleInOutMapper extends BaseMapper<SchoolVehicleInOut> ...@@ -62,4 +64,11 @@ public interface SchoolVehicleInOutMapper extends BaseMapper<SchoolVehicleInOut>
* @return 结果 * @return 结果
*/ */
public int deleteSchoolVehicleInOutByIds(Long[] ids); public int deleteSchoolVehicleInOutByIds(Long[] ids);
/**
* 获取当前登录人车辆登记信息
* @param userId
* @return
*/
List<Map<String, String>> getUserVehicle(@Param("userId") Long userId);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import yangtz.cs.liu.campus.domain.schoolInstrument.SchoolInstrument; import yangtz.cs.liu.campus.domain.schoolInstrument.SchoolInstrument;
...@@ -11,6 +12,7 @@ import yangtz.cs.liu.campus.mapper.schoolInstrument.SchoolInstrumentMapper; ...@@ -11,6 +12,7 @@ import yangtz.cs.liu.campus.mapper.schoolInstrument.SchoolInstrumentMapper;
import yangtz.cs.liu.campus.service.schoolInstrument.ISchoolInstrumentService; import yangtz.cs.liu.campus.service.schoolInstrument.ISchoolInstrumentService;
import yangtz.cs.liu.campus.vo.schoolInstrument.SchoolInstrumentVo; import yangtz.cs.liu.campus.vo.schoolInstrument.SchoolInstrumentVo;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -103,11 +105,28 @@ public class SchoolInstrumentServiceImpl extends ServiceImpl<SchoolInstrumentMap ...@@ -103,11 +105,28 @@ public class SchoolInstrumentServiceImpl extends ServiceImpl<SchoolInstrumentMap
return schoolInstrumentMapper.deleteSchoolInstrumentById(id); return schoolInstrumentMapper.deleteSchoolInstrumentById(id);
} }
/**
* 教师借用明细列表
* @param schoolInstrumentVo
* @return
*/
@Override @Override
public List<SchoolInstrument> selectInstrumentList(SchoolInstrumentVo schoolInstrumentVo) { public List<SchoolInstrument> selectInstrumentList(SchoolInstrumentVo schoolInstrumentVo) {
if (schoolInstrumentVo.getIds().size() <= 0){ if (StringUtils.isNull(schoolInstrumentVo.getIds()) || schoolInstrumentVo.getIds().size() <= 0){
schoolInstrumentVo.setIds(null); schoolInstrumentVo.setIds(null);
} }
return schoolInstrumentMapper.selectInstrumentList(schoolInstrumentVo); List<SchoolInstrument> list = new ArrayList<>();
List<SchoolInstrument> schoolInstruments = schoolInstrumentMapper.selectInstrumentList(schoolInstrumentVo);
for (SchoolInstrument schoolInstrument : schoolInstruments) {
if (schoolInstrument.getInstrumentNum()==0){
list.add(schoolInstrument);
}
}
if (list.size() > 0){
for (SchoolInstrument schoolInstrument : list) {
schoolInstruments.remove(schoolInstrument);
}
}
return schoolInstruments;
} }
} }
package yangtz.cs.liu.campus.service.impl.schoolSecurity; package yangtz.cs.liu.campus.service.impl.schoolSecurity;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleInOut; import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleInOut;
import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleRegistration;
import yangtz.cs.liu.campus.mapper.schoolSecurity.SchoolVehicleInOutMapper; import yangtz.cs.liu.campus.mapper.schoolSecurity.SchoolVehicleInOutMapper;
import yangtz.cs.liu.campus.mapper.schoolSecurity.SchoolVehicleRegistrationMapper;
import yangtz.cs.liu.campus.service.schoolSecurity.ISchoolVehicleInOutService; import yangtz.cs.liu.campus.service.schoolSecurity.ISchoolVehicleInOutService;
import yangtz.cs.liu.campus.vo.schoolSecurity.SchoolVehicleInOutVo; import yangtz.cs.liu.campus.vo.schoolSecurity.SchoolVehicleInOutVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 车辆出入登记Service业务层处理 * 车辆出入登记Service业务层处理
...@@ -23,6 +31,8 @@ public class SchoolVehicleInOutServiceImpl extends ServiceImpl<SchoolVehicleInOu ...@@ -23,6 +31,8 @@ public class SchoolVehicleInOutServiceImpl extends ServiceImpl<SchoolVehicleInOu
@Autowired @Autowired
private SchoolVehicleInOutMapper schoolVehicleInOutMapper; private SchoolVehicleInOutMapper schoolVehicleInOutMapper;
@Autowired
private SchoolVehicleRegistrationMapper schoolVehicleRegistrationMapper;
/** /**
* 查询车辆出入登记 * 查询车辆出入登记
...@@ -97,4 +107,43 @@ public class SchoolVehicleInOutServiceImpl extends ServiceImpl<SchoolVehicleInOu ...@@ -97,4 +107,43 @@ public class SchoolVehicleInOutServiceImpl extends ServiceImpl<SchoolVehicleInOu
{ {
return schoolVehicleInOutMapper.deleteSchoolVehicleInOutById(id); return schoolVehicleInOutMapper.deleteSchoolVehicleInOutById(id);
} }
/**
* 获取当前登录人车辆登记信息
* @param userId
* @return
*/
@Override
public List<Map<String, String>> getUserVehicle(Long userId) {
return schoolVehicleInOutMapper.getUserVehicle(userId);
}
/**
* 新增车辆出入登记信息
* @param schoolVehicleInOutVo
* @return
*/
@Override
public int insertSchoolVehicleInOutVo(SchoolVehicleInOutVo schoolVehicleInOutVo) {
SysUser user = SecurityUtils.getLoginUser().getUser();
//判断是否选择级部/处室主任和分管领导
if (StringUtils.isNull(schoolVehicleInOutVo.getHandUserId1())){
throw new ServiceException("请选择级部/处室主任");
}
if (StringUtils.isNull(schoolVehicleInOutVo.getHandUserId2())){
throw new ServiceException("请选择分管领导");
}
//判断已登记车牌号是否保留
if (StringUtils.isNotEmpty(schoolVehicleInOutVo.getOldLicenseNumber())){
if (schoolVehicleInOutVo.getIsRetain().equals("0")){
//不保留,删除已登记车牌号
LambdaQueryWrapper<SchoolVehicleRegistration> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SchoolVehicleRegistration::getUserId,user.getUserId())
.eq(SchoolVehicleRegistration::getLicenseNumber,schoolVehicleInOutVo.getOldLicenseNumber());
schoolVehicleRegistrationMapper.delete(wrapper);
}
}
schoolVehicleInOutVo.setCreateBy(user.getUserName());
return schoolVehicleInOutMapper.insertSchoolVehicleInOut(schoolVehicleInOutVo);
}
} }
...@@ -5,6 +5,7 @@ import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleInOut; ...@@ -5,6 +5,7 @@ import yangtz.cs.liu.campus.domain.schoolSecurity.SchoolVehicleInOut;
import yangtz.cs.liu.campus.vo.schoolSecurity.SchoolVehicleInOutVo; import yangtz.cs.liu.campus.vo.schoolSecurity.SchoolVehicleInOutVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 车辆出入登记Service接口 * 车辆出入登记Service接口
...@@ -62,4 +63,18 @@ public interface ISchoolVehicleInOutService extends IService<SchoolVehicleInOut> ...@@ -62,4 +63,18 @@ public interface ISchoolVehicleInOutService extends IService<SchoolVehicleInOut>
* @return 结果 * @return 结果
*/ */
public int deleteSchoolVehicleInOutById(Long id); public int deleteSchoolVehicleInOutById(Long id);
/**
* 获取当前登录人车辆登记信息
* @param userId
* @return
*/
public List<Map<String,String>> getUserVehicle(Long userId);
/**
* 新增车辆出入登记信息
* @param schoolVehicleInOutVo
* @return
*/
int insertSchoolVehicleInOutVo(SchoolVehicleInOutVo schoolVehicleInOutVo);
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="yangtz.cs.liu.campus.mapper.schoolSecurity.SchoolVehicleInOutMapper"> <mapper namespace="yangtz.cs.liu.campus.mapper.schoolSecurity.SchoolVehicleInOutMapper">
<resultMap type="SchoolVehicleInOutVp" id="SchoolVehicleInOutVoResult"> <resultMap type="SchoolVehicleInOutVo" id="SchoolVehicleInOutVoResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="instanceId" column="instance_id" /> <result property="instanceId" column="instance_id" />
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
...@@ -203,4 +203,8 @@ ...@@ -203,4 +203,8 @@
#{id} #{id}
</foreach> </foreach>
</update> </update>
<select id="getUserVehicle" resultType="Map">
SELECT license_number as licenseNumber FROM school_vehicle_registration WHERE del_flag = '0' and user_id = #{userId}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment