xuhy
2023-05-11 9c0566b86975f112a7f0cf044bab322b7ffe4f0a
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TAgentController.java
@@ -13,6 +13,7 @@
import com.stylefeng.guns.modular.system.enums.UserTypeEnum;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.RedisUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -58,6 +59,10 @@
    @Autowired
    private ITDriverService tDriverService;
    @Autowired
    private ITDriverWorkService tDriverWorkService;
    @Autowired
    private RedisUtil redisUtil;
    /**
@@ -158,7 +163,11 @@
        int count = tAgentService.selectCount(new EntityWrapper<TAgent>().eq("provinceName", split1[0]).eq("cityName",split1[1]));
        if(count>0){
            return new SuccessTip(500,"该代理商已存在!");
        }
        tAgent.setPrincipal(tAgent.getPrincipal().replace(" ",""));
        String[] split = tAgent.getAreaId().split("/");
        // 查询省市
@@ -204,6 +213,19 @@
        for (TDriver tDriver : list) {
            if(1 == status){
                tDriver.setStatus(2);
                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);
                }
            }
            if(2 == status){
                tDriver.setStatus(1);
@@ -219,6 +241,7 @@
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(TAgent tAgent) {
        tAgent.setPrincipal(tAgent.getPrincipal().replace(" ",""));
        tAgentService.updateById(tAgent);
        return SUCCESS_TIP;
    }