LiGuang 2 years ago
parent
commit
da331f8254
14 changed files with 83 additions and 12 deletions
  1. 1 1
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/makeUpCard/service/impl/MakeUpCardServiceImpl.java
  2. 1 1
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userPrize/service/impl/UserPrizeServiceImpl.java
  3. 23 3
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/mapper/xml/UserShiftMapper.xml
  4. 1 1
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/service/impl/UserShiftServiceImpl.java
  5. 1 1
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/usercontract/service/impl/UserContractServiceImpl.java
  6. 1 1
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userquit/service/impl/UserQuitServiceImpl.java
  7. 28 0
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/controller/VacationController.java
  8. 2 0
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/mapper/VacationMapper.java
  9. 9 0
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/mapper/xml/VacationMapper.xml
  10. 2 0
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/service/IVacationService.java
  11. 11 1
      jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/service/impl/VacationServiceImpl.java
  12. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
  13. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysPositionServiceImpl.java
  14. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/workOvertime/controller/workOvertimeController.java

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/makeUpCard/service/impl/MakeUpCardServiceImpl.java

@@ -33,7 +33,7 @@ public class MakeUpCardServiceImpl extends ServiceImpl<MakeUpCardMapper, MakeUpC
     @Override
     public Page<MakeUpCard> lists(Page<MakeUpCard> page, String code, String username,String dept,String date) {
         List<String> subDepIdsByDepId=null;
-        if (dept!=null){
+        if (dept!=null&&!dept.equals("1")){
             subDepIdsByDepId= makeUpCardMapper.getSubDepIdsByDepId(dept);
        }
         List<MakeUpCard> lists = makeUpCardMapper.lists(page, code, username, subDepIdsByDepId, date);

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userPrize/service/impl/UserPrizeServiceImpl.java

@@ -38,7 +38,7 @@ public class UserPrizeServiceImpl extends ServiceImpl<UserPrizeMapper, UserPrize
         if (userPrize.getDate()!=null){
             date = DateUtils.formatDate(userPrize.getDate());
         }
-        if (userPrize.getDeptId()!=null){
+        if (userPrize.getDeptId()!=null&&!userPrize.getDeptId().equals("1")){
             subDepIdsByDepId= makeUpCardMapper.getSubDepIdsByDepId(userPrize.getDeptId());
         }if(oConvertUtils.isNotEmpty(userPrize.getRealname())){
             userPrize.setRealname(userPrize.getRealname().trim());

+ 23 - 3
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/mapper/xml/UserShiftMapper.xml

@@ -208,16 +208,36 @@ order by a.shift_date desc
         </if>
     </select>
     <select id="getMothsUserShift" resultType="java.util.Map">
-        select a.shift_id as 'id', a.user_id as 'userid',b.shift_type as 'type', ifnull(b.name,'休') as 'name',date_format(b.start_date,'%H:%i:%s') as 'startDate',date_format(b.end_date,'%H:%i:%s') as 'endDate',date_format(b.start2_date,'%H:%i:%s') as 'start2Date',date_format(b.end2_date,'%H:%i:%s') as 'end2Date',DAYOFMONTH(a.shift_date) as 'shiftDate'
+        select a.shift_id as 'id', a.user_id as 'userid',b.shift_type as 'type', ifnull(b.name,'休') as 'name',date_format(b.start_date,'%H:%i:%s') as 'startDate',date_format(b.end_date,'%H:%i:%s') as 'endDate',date_format(b.start2_date,'%H:%i:%s') as 'start2Date',date_format(b.end2_date,'%H:%i:%s') as 'end2Date',DAYOFMONTH(a.shift_date) as 'shiftDate'
         from geke_user_shift a left join geke_shift b on a.shift_id=b.id
-        where 1=1
+        where a.shift_id  not in('0','1')
         <if test="userid!=null and ''!=userid">
             and   a.user_id=#{userid}
         </if>
         <if test="date!=null and ''!=date">
             and  date_format(a.shift_date,'%Y-%m')=date_format(#{date},'%Y-%m')
         </if>
-        order by date_format(b.start_date,'%H:%i:%s') asc
+        UNION ALL
+        select a.shift_id as 'id', a.user_id as 'userid','0' as 'type', '休' as 'name',date_format(b.start_date,'%H:%i:%s') as 'startDate',date_format(b.end_date,'%H:%i:%s') as 'endDate',date_format(b.start2_date,'%H:%i:%s') as 'start2Date',date_format(b.end2_date,'%H:%i:%s') as 'end2Date',DAYOFMONTH(a.shift_date) as 'shiftDate'
+        from geke_user_shift a left join geke_shift b on a.shift_id=b.id
+        where a.shift_id='0'
+        <if test="userid!=null and ''!=userid">
+            and   a.user_id=#{userid}
+        </if>
+        <if test="date!=null and ''!=date">
+            and  date_format(a.shift_date,'%Y-%m')=date_format(#{date},'%Y-%m')
+        </if>
+        UNION ALL
+        select a.shift_id as 'id', a.user_id as 'userid','0' as 'type', '法' as 'name',date_format(b.start_date,'%H:%i:%s') as 'startDate',date_format(b.end_date,'%H:%i:%s') as 'endDate',date_format(b.start2_date,'%H:%i:%s') as 'start2Date',date_format(b.end2_date,'%H:%i:%s') as 'end2Date',DAYOFMONTH(a.shift_date) as 'shiftDate'
+        from geke_user_shift a left join geke_shift b on a.shift_id=b.id
+        where a.shift_id='1'
+        <if test="userid!=null and ''!=userid">
+            and   a.user_id=#{userid}
+        </if>
+        <if test="date!=null and ''!=date">
+            and  date_format(a.shift_date,'%Y-%m')=date_format(#{date},'%Y-%m')
+        </if>
+
     </select>
     <select id="getUserId" resultType="java.util.Map">
         select id,category from sys_user where 1=1

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userShift/service/impl/UserShiftServiceImpl.java

@@ -345,7 +345,7 @@ public class UserShiftServiceImpl extends ServiceImpl<UserShiftMapper, UserShift
         List<String> shiftList = userShiftMapper.getShiftList(dates, userid);
         if (shiftList!=null&&shiftList.size()>0){
             for (String s : shiftList) {
-                if (s.equals("0")||s.equals("1")){
+                if (s.equals("0")){
                     count++;
                 }else {
                     counts++;

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/usercontract/service/impl/UserContractServiceImpl.java

@@ -38,7 +38,7 @@ public class UserContractServiceImpl extends ServiceImpl<UserContractMapper, Use
     @Override
     public Page<UserContract> lists(Page<UserContract> page, UserContract userContract) {
         List<String> subDepIdsByDepId=null;
-        if (userContract.getDeptId()!=null){
+        if (userContract.getDeptId()!=null&&!userContract.getDeptId().equals("1")){
             subDepIdsByDepId= makeUpCardMapper.getSubDepIdsByDepId(userContract.getDeptId());
         }if(oConvertUtils.isNotEmpty(userContract.getRealname())){
             userContract.setRealname(userContract.getRealname().trim());

+ 1 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/userquit/service/impl/UserQuitServiceImpl.java

@@ -48,7 +48,7 @@ public class UserQuitServiceImpl extends ServiceImpl<UserQuitMapper, UserQuit> i
         List<String> subDepIdsByDepId=null;
         String state=null;
         String newDate=null;
-        if (userQuit.getDeptId()!=null){
+        if (userQuit.getDeptId()!=null&&!userQuit.getDeptId().equals("1")){
             subDepIdsByDepId= makeUpCardMapper.getSubDepIdsByDepId(userQuit.getDeptId());
 
         }if (userQuit.getState()!=null){

+ 28 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/controller/VacationController.java

@@ -15,6 +15,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.geke.vacation.entity.Vacation;
 import org.jeecg.modules.geke.vacation.service.IVacationService;
@@ -115,6 +116,11 @@ public class VacationController extends JeecgController<Vacation, IVacationServi
 	@ApiOperation(value="假期表-添加", notes="假期表-添加")
 	@PostMapping(value = "/add")
 	public Result<?> add(@RequestBody Vacation vacation) {
+		List<String> vacationByDate = vacationService.getVacationByDate(vacation.getUserId(), DateUtils.formatDate(vacation.getStartDate(), "yyyy-MM-dd HH:mm:ss"));
+		List<String> vacationByDates = vacationService.getVacationByDate(vacation.getUserId(), DateUtils.formatDate(vacation.getEndDate(), "yyyy-MM-dd HH:mm:ss"));
+		if (vacationByDate.size()>0||vacationByDates.size()>0){
+			return Result.error("该时间段已有请假信息!");
+		}
 		vacation.setState("2");
 		vacation.setUserDate(new Date());
 		vacationService.save(vacation);
@@ -230,4 +236,26 @@ public class VacationController extends JeecgController<Vacation, IVacationServi
       return super.importExcel(request, response, Vacation.class);
   }
 
+
+	 /**
+	  * 分页列表查询
+	  *
+	  * @param vacation
+	  * @param pageNo
+	  * @param pageSize
+	  * @param req
+	  * @return
+	  */
+	 @AutoLog(value = "假期表-查询同一时间是否有重复假期")
+	 @ApiOperation(value="假期表-查询同一时间是否有重复假期", notes="假期表-查询同一时间是否有重复假期")
+	 @GetMapping(value = "/getVa")
+	 public Result<?> getVa(Vacation vacation) {
+	 	if (oConvertUtils.isNotEmpty(vacation.getUserId())&&oConvertUtils.isNotEmpty(vacation.getEnd())){
+			List<String> vacationByDate = vacationService.getVacationByDate(vacation.getUserId(), vacation.getEnd());
+			return  Result.OK(vacation);
+		}
+
+	 	return Result.error("缺少参数!");
+
+	 }
 }

+ 2 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/mapper/VacationMapper.java

@@ -55,4 +55,6 @@ public interface VacationMapper extends BaseMapper<Vacation> {
      * @return
      */
     boolean deleteByDate();
+
+    List<String>getVacationByDate(@Param("userid")String userid,@Param("date")String date);
 }

+ 9 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/mapper/xml/VacationMapper.xml

@@ -146,4 +146,13 @@
             and date_format(a.end_date,'%Y-%m-%d')&lt;=date_format(#{endDate},'%Y-%m-%d')
         </if>
     </select>
+    <select id="getVacationByDate" resultType="java.lang.String">
+        select user_id from geke_vacation_body where 1=1
+        <if test="userid!=null and ''!=userid">
+            and user_id=#{userid}
+        </if>
+        <if test="date!=null and ''!=date">
+            and #{date} BETWEEN date_format(start_date,'%Y-%m-%d %H:%i:%s') AND date_format(end_date,'%Y-%m-%d %H:%i:%s')
+        </if>
+    </select>
 </mapper>

+ 2 - 0
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/service/IVacationService.java

@@ -32,4 +32,6 @@ public interface IVacationService extends IService<Vacation> {
      */
     boolean deleteByDate();
 
+    List<String>getVacationByDate(String userid,String date);
+
 }

+ 11 - 1
jeecg-boot-module-demo/src/main/java/org/jeecg/modules/geke/vacation/service/impl/VacationServiceImpl.java

@@ -68,7 +68,7 @@ public class VacationServiceImpl extends ServiceImpl<VacationMapper, Vacation> i
         List<String> types=null;
         String startDate=null;
         String endDate=null;
-        if (vacation.getDeptname()!=null){
+        if (vacation.getDeptname()!=null&&!vacation.getDeptname().equals("1")){
             subDepIdsByDepId= makeUpCardMapper.getSubDepIdsByDepId(vacation.getDeptname());
         }if (vacation.getHolidayType()!=null){
             types=Arrays.asList(vacation.getHolidayType().split(","));
@@ -107,6 +107,16 @@ public class VacationServiceImpl extends ServiceImpl<VacationMapper, Vacation> i
         return vacationMapper.deleteByDate();
     }
 
+    @Override
+    public List<String> getVacationByDate(String userid, String date) {
+        List<String>list=new ArrayList<>();
+        List<String> vacationByDate = vacationMapper.getVacationByDate(userid, date);
+        if (vacationByDate!=null&&vacationByDate.size()>0){
+            list.addAll(vacationByDate);
+        }
+        return list;
+    }
+
 
     public String days(Date date){
         if (date.getHours() >= 0 && date.getHours() < 12) {

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -373,7 +373,7 @@ public class SysUserController {
             }
         }
         List<String> subDepIdsByDepId=null;
-        if (user.getOrgCodeTxt()!=null){
+        if (user.getOrgCodeTxt()!=null&&!user.getOrgCodeTxt().equals("1")){
             subDepIdsByDepId= sysDepartService.getSubDepIdsByDepId(user.getOrgCodeTxt());
         }if (user.getEmpStatus()!=null&&!"".equals(user.getEmpStatus())){
             status=Arrays.asList(user.getEmpStatus().split(","));

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysPositionServiceImpl.java

@@ -49,7 +49,7 @@ public class SysPositionServiceImpl extends ServiceImpl<SysPositionMapper, SysPo
     @Override
     public Page<SysPosition> lists(Page<SysPosition> page, SysPosition sysPosition) {
         List<String> subDepIdsByDepId=null;
-        if (sysPosition.getDeptId()!=null){
+        if (sysPosition.getDeptId()!=null&&!sysPosition.getDeptId().equals("1")){
             subDepIdsByDepId= sysDepartService.getSubDepIdsByDepId(sysPosition.getDeptId());
         }
         List<SysPosition> lists = positionMapper.lists(page, sysPosition, subDepIdsByDepId);

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/workOvertime/controller/workOvertimeController.java

@@ -128,7 +128,7 @@ public class workOvertimeController extends JeecgController<workOvertime, IworkO
 		 	endDate=DateUtils.formatDate(workOvertime.getEndDate());
 		 }if(oConvertUtils.isNotEmpty(workOvertime.getPerson())){
 			 workOvertime.setPerson(workOvertime.getPerson().trim());
-		 }  if (oConvertUtils.isNotEmpty(workOvertime.getDept())){
+		 }  if (oConvertUtils.isNotEmpty(workOvertime.getDept())&&!workOvertime.getDept().equals("1")){
 			 subDepIdsByDepId = sysDepartService.getMySubDepIdsByDepId(workOvertime.getDept());
 		 }if (oConvertUtils.isNotEmpty(workOvertime.getDemo())){
 		 	types=Arrays.asList(workOvertime.getDemo().split(","));