| | |
| | | import com.stylefeng.guns.modular.system.controller.resp.TDriverResp; |
| | | import com.stylefeng.guns.modular.system.enums.StatusEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemConfigService; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.service.ITBranchOfficeService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Autowired |
| | | private ITRegionService tRegionService; |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | @Autowired |
| | | private ITDriverWorkService tDriverWorkService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | public String index(Model model) { |
| | | model.addAttribute("userType", Objects.requireNonNull(ShiroKit.getUser()).getRoleType()); |
| | | return PREFIX + "tBranchOffice.html"; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public Object list(String branchOfficeName,String principal,String principalPhone,Integer operatingBusiness ,Integer status) { |
| | | List<TBranchOfficeResp> tBranchOfficeRespList = tBranchOfficeService.getPageList(branchOfficeName,principal,principalPhone,operatingBusiness,status); |
| | | for (TBranchOfficeResp tBranchOfficeResp : tBranchOfficeRespList) { |
| | | tBranchOfficeResp.setUserType(Objects.requireNonNull(ShiroKit.getUser()).getRoleType()); |
| | | } |
| | | // 分公司查询优惠券,订单,司机等信息 |
| | | tBranchOfficeService.queryOtherInfo(tBranchOfficeRespList); |
| | | return tBranchOfficeRespList; |
| | |
| | | TBranchOffice tBranchOffice = tBranchOfficeService.selectById(id); |
| | | tBranchOffice.setStatus(StatusEnum.FREEZE.getCode()); |
| | | tBranchOfficeService.updateById(tBranchOffice); |
| | | List<TDriver> list = tDriverService.selectList(new EntityWrapper<TDriver>() |
| | | .eq("branchOfficeId", tBranchOffice.getId())); |
| | | for (TDriver tDriver : list) { |
| | | String value = redisUtil.getValue("DRIVER_" + tDriver.getPhone()); |
| | | redisUtil.remove(value); |
| | | redisUtil.remove("DRIVER_" + tDriver.getPhone()); |
| | | TDriverWork tDriverWork = tDriverWorkService.selectOne(new EntityWrapper<TDriverWork>() |
| | | .eq("driverId", tDriver.getId()) |
| | | .eq("status", 1) |
| | | .orderBy("workTime", false) |
| | | .last("LIMIT 1")); |
| | | if(Objects.nonNull(tDriverWork)){ |
| | | tDriverWork.setStatus(2); |
| | | tDriverWork.setOffWorkTime(new Date()); |
| | | tDriverWorkService.updateById(tDriverWork); |
| | | } |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |