| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | import com.doumee.core.dingTalk.DingTalkStream; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.haikang.model.HKConstants; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.dto.OptGridDTO; |
| | | import com.doumee.dao.business.dto.CloseGridDTO; |
| | | import com.doumee.dao.business.dto.GetDriverGridDTO; |
| | | import com.doumee.dao.business.dto.OpenGridDriverDTO; |
| | | import com.doumee.dao.business.dao.MemberMapper; |
| | | import com.doumee.dao.business.dto.*; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.system.SystemUserMapper; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.core.utils.Utils; |
| | |
| | | private JkKeysMapper jkKeysMapper; |
| | | |
| | | @Autowired |
| | | private SystemUserMapper systemUserMapper; |
| | | |
| | | @Autowired |
| | | private JkCabinetMapper jkCabinetMapper; |
| | | @Autowired |
| | | private JkCabinetLogMapper jkCabinetLogMapper; |
| | | |
| | | @Autowired |
| | | private WarningMapper warningMapper; |
| | | |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | |
| | | @Autowired |
| | | private WarningRuleMapper warningRuleMapper; |
| | | |
| | | @Autowired |
| | | private DingTalk dingTalk; |
| | | |
| | | @Override |
| | | public Integer create(JkCabinetGrid jkCabinetGrid) { |
| | |
| | | .selectAs(JkKeys::getCarId,JkCabinetGrid::getCarId) |
| | | .leftJoin(JkKeys.class,JkKeys::getId,JkCabinetGrid::getKeyId) |
| | | .eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) |
| | | .eq(JkKeys::getStatus,Constants.ONE) |
| | | .eq(JkKeys::getStatus,Constants.TWO) |
| | | .eq(JkCabinetGrid::getWorkingStatus,Constants.ZERO) |
| | | .eq(JkCabinetGrid::getCabinetId,dto.getCabinetId()) |
| | | .isNotNull(JkCabinetGrid::getKeyId) |
| | |
| | | for (JkCabinetGrid jkCabinetGrid:jkCabinetGridList) { |
| | | jkKeysMapper.update(null,new UpdateWrapper<JkKeys>().lambda() |
| | | .set(JkKeys::getEditDate,DateUtil.getCurrDateTime()) |
| | | .set(JkKeys::getStatus,Constants.TWO) |
| | | .set(JkKeys::getStatus,Constants.THREE) |
| | | .eq(JkKeys::getId,jkCabinetGrid.getKeyId()) |
| | | ); |
| | | } |
| | |
| | | || Objects.isNull(dto.getCabinetId()) |
| | | || Objects.isNull(dto.getKeyStatus()) |
| | | || Objects.isNull(dto.getAuthType()) |
| | | || Objects.isNull(dto.getMemberId()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | |
| | | .selectAs(JkKeys::getCode,JkCabinetGrid::getKeyCode) |
| | | .selectAs(JkKeys::getCarCode,JkCabinetGrid::getCarCode) |
| | | .selectAs(JkKeys::getCarId,JkCabinetGrid::getCarId) |
| | | .selectAs(JkKeys::getStatus,JkCabinetGrid::getKeyStatus) |
| | | .leftJoin(JkKeys.class,JkKeys::getId,JkCabinetGrid::getKeyId) |
| | | .eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) |
| | | .eq(JkCabinetGrid::getWorkingStatus,Constants.ZERO) |
| | |
| | | .in(Constants.equalsInteger(dto.getType(),Constants.ONE),JkKeys::getStatus,Constants.TWO,Constants.THREE) |
| | | .in(Constants.equalsInteger(dto.getType(),Constants.ZERO),JkKeys::getStatus,Constants.ONE) |
| | | .isNotNull(JkCabinetGrid::getKeyId) |
| | | .apply(" t1.car_id in ( select c.CAR_ID from car_driver c left join cars c1 on c.car_id = c1.id where c.ISDELETED = 0 and c.TYPE != 0 and c.MEMBER_ID = "+dto.getMemberId()+" ) ") |
| | | .apply(" t1.car_id in ( select c.id from cars c where c.ISDELETED = 0 and c.MEMBER_ID = "+dto.getMemberId()+" ) ") |
| | | .orderByAsc(JkCabinetGrid::getCode) |
| | | ); |
| | | for (JkCabinetGrid jkCabinetGrid:jkCabinetGridList) { |
| | | jkCabinetGrid.setBindStatus(Objects.isNull(jkCabinetGrid.getKeyId())?Constants.ZERO:Constants.ONE); |
| | | jkCabinetGrid.setKeyStatus(Objects.isNull(jkCabinetGrid.getKeyStatus())?Constants.ZERO:jkCabinetGrid.getKeyStatus()); |
| | | } |
| | | |
| | | } |
| | | return jkCabinetGridList; |
| | | } |
| | |
| | | if(Objects.isNull(jkCabinetGrid)){ |
| | | return ; |
| | | } |
| | | LoginUserInfo loginUserInfo = openGridDriverDTO.getLoginUserInfo(); |
| | | // LoginUserInfo loginUserInfo = openGridDriverDTO.getLoginUserInfo(); |
| | | JkCabinetLog jkCabinetLog = new JkCabinetLog(); |
| | | jkCabinetLog.setCreateDate(new Date()); |
| | | jkCabinetLog.setCreator(loginUserInfo.getId()); |
| | | // jkCabinetLog.setCreator(loginUserInfo.getId()); |
| | | jkCabinetLog.setIsdeleted(Constants.ZERO); |
| | | jkCabinetLog.setCabinetId(openGridDriverDTO.getCabinetId()); |
| | | jkCabinetLog.setGridId(jkCabinetGrid.getId()); |
| | | jkCabinetLog.setAuthType(openGridDriverDTO.getAuthType()); |
| | | jkCabinetLog.setMemberId(loginUserInfo.getMemberId()); |
| | | jkCabinetLog.setMemberId(openGridDriverDTO.getMemberId()); |
| | | jkCabinetLog.setType(Constants.ZERO); |
| | | if(Objects.nonNull(jkCabinetGrid.getKeyId())){ |
| | | JkKeys jkKeys = jkKeysMapper.selectById(jkCabinetGrid.getKeyId()); |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void timeOutUnCloseAlarm(TimeOutCloseGridDTO dto){ |
| | | if(Objects.nonNull(dto) |
| | | && Objects.nonNull(dto.getGridId())){ |
| | | JkCabinetGrid jkCabinetGrid = jkCabinetGridMapper.selectJoinOne(JkCabinetGrid.class, |
| | | new MPJLambdaWrapper<JkCabinetGrid>().selectAll(JkCabinetGrid.class) |
| | | .selectAs(JkCabinet::getName,JkCabinetGrid::getCabinetName) |
| | | .leftJoin(JkCabinet.class,JkCabinet::getId,JkCabinetGrid::getCabinetId) |
| | | .eq(JkCabinetGrid::getIsdeleted,Constants.ZERO) |
| | | .eq(JkCabinetGrid::getId,dto.getGridId()) |
| | | .last(" limit 1 ") |
| | | ); |
| | | |
| | | // if(Objects.nonNull(jkCabinetGrid)){ |
| | | // log.error("柜格开门超时未关闭告警信息:{}"+JSONObject.toJSONString(jkCabinetGrid)); |
| | | // Warning warning = warningMapper.selectOne(new QueryWrapper<Warning>().lambda() |
| | | // .eq(Warning::getType,Constants.THREE).eq(Warning::getCode,Constants.WarningConfig.GRID_TIME_OUT_INFO.getKey()).eq(Warning::getIsdeleted,Constants.ZERO).last("limt 1")); |
| | | // if(Objects.isNull(warning)){ |
| | | // return; |
| | | // } |
| | | // List<Member> memberList = this.getWarningList(warning); |
| | | // if(CollectionUtils.isEmpty(memberList)){ |
| | | // return; |
| | | // } |
| | | // //存储异常日志 |
| | | // |
| | | // |
| | | // }else{ |
| | | // |
| | | // } |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<Member> getWarningList(Warning warning){ |
| | | if(Constants.equalsInteger(warning.getStatus(),Constants.ZERO)){ |
| | | return null; |
| | | } |
| | | //查询通知人员 |
| | | List<WarningRule> warningRuleList = warningRuleMapper.selectList(new QueryWrapper<WarningRule>().lambda() |
| | | .eq(WarningRule::getIsdeleted,Constants.ZERO) |
| | | .apply(" id in ( select w.RULE_ID from warning_rule_detail w where w.WARNING_ID = '"+warning.getId()+"' and w.ISDELETED = 0 ) ") |
| | | ); |
| | | List<Member> memberList = new ArrayList<>(); |
| | | if(org.apache.commons.collections.CollectionUtils.isNotEmpty(warningRuleList)){ |
| | | List<String> memberIdStr = warningRuleList.stream().map(i->i.getMemberIds()).collect(Collectors.toList()); |
| | | if(org.apache.commons.collections.CollectionUtils.isNotEmpty(memberIdStr)){ |
| | | List<String> memberIdList = new ArrayList<>(); |
| | | for (String s:memberIdStr) { |
| | | memberIdList.addAll( |
| | | Arrays.asList(s.split(",")) |
| | | ); |
| | | } |
| | | memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda().eq(Member::getIsdeleted,Constants.ZERO) |
| | | .notIn(Member::getErpId) |
| | | .in(Member::getId,memberIdList) |
| | | ); |
| | | } |
| | | } |
| | | return memberList; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void alcoholTestAlarm(AlcoholTestAlarmDTO dto){ |
| | | if(Objects.nonNull(dto) |
| | | && Objects.nonNull(dto.getMemberId())){ |
| | | |
| | | |
| | | |
| | | SystemUser systemUser = |
| | | systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda() |
| | | .eq(SystemUser::getMemberId,dto.getMemberId()) |
| | | .eq(SystemUser::getDeleted,Constants.ZERO) |
| | | .last(" limit 1 ") |
| | | ); |
| | | |
| | | // Warning warning = warningMapper.selectOne(new QueryWrapper<Warning>().lambda() |
| | | // .eq(Warning::getType,Constants.THREE).eq(Warning::getCode,Constants.WarningConfig.GRID_TIME_OUT_INFO.getKey()).eq(Warning::getIsdeleted,Constants.ZERO).last("limt 1")); |
| | | // if(Objects.isNull(warning)){ |
| | | // return; |
| | | // } |
| | | // List<Member> memberList = this.getWarningList(warning); |
| | | // |
| | | // |
| | | // |
| | | // //存储异常日志 |
| | | // if(Objects.nonNull(systemUser)){ |
| | | // log.error("司机酒精检测,超出酒精值告警信息:{}"+JSONObject.toJSONString(systemUser)); |
| | | // } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |