| | |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.model.Company; |
| | | import com.dsh.course.feignClient.activity.CompanyClient; |
| | | import com.dsh.course.feignClient.activity.DriverClient; |
| | | import com.dsh.course.feignClient.activity.model.CompanyInfoRes; |
| | | import com.dsh.course.feignClient.activity.model.CompanyQueryStateAndFlgReq; |
| | | import com.dsh.course.feignClient.activity.model.UpdateCompanyDriverReq; |
| | | import com.dsh.course.mapper.UserMapper; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.config.properties.GunsProperties; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.naming.NoPermissionException; |
| | | import javax.validation.Valid; |
| | | import java.io.File; |
| | | import java.util.*; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 系统管理员控制器 |
| | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @Resource |
| | | private DriverClient itDriverService; |
| | | |
| | | @Autowired |
| | | private IRoleService roleService; |
| | | |
| | | @Resource |
| | | private CompanyClient itCompanyService; |
| | | |
| | | |
| | | /** |
| | |
| | | User objectUser = UserFactory.createUser(user); |
| | | //查找平台所属公司 |
| | | //Search for the company that owns the platform. |
| | | Company company = itCompanyService.getCompanyByTypeAndFlag(new CompanyQueryStateAndFlgReq(1,3)); |
| | | if (SinataUtil.isNotEmpty(company)){ |
| | | objectUser.setObjectId(company.getId()); |
| | | } |
| | | objectUser.setPassWordUpdate(new Date()); |
| | | this.userService.save(objectUser); |
| | | |
| | |
| | | |
| | | User user = userService.getById(userId); |
| | | if (user.getRoleType() == 2){ |
| | | //查询分公司 Query branch office |
| | | CompanyInfoRes company = itCompanyService.queryById(user.getObjectId()); |
| | | company.setState(1); |
| | | itCompanyService.updateCompany(company); |
| | | |
| | | //设置该分公司下的所有司机状态 |
| | | //Set the status of all drivers under this branch |
| | | itDriverService.updateCompanyDriverState(new UpdateCompanyDriverReq(3,company.getId())); |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | //查询加盟商 |
| | | //Search for franchisees |
| | | CompanyInfoRes franchisee = itCompanyService.queryById(user.getObjectId()); |
| | | franchisee.setState(1); |
| | | itCompanyService.updateCompany(franchisee); |
| | | |
| | | //设置该加盟商下的所有司机状态 |
| | | //Set the status of all drivers under this franchisee |
| | | itDriverService.updateFranchiseeDriverState(new UpdateCompanyDriverReq(3,franchisee.getId())); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | |
| | | User user = userService.getById(userId); |
| | | if (user.getRoleType() == 2){ |
| | | //查询分公司 |
| | | //Query branch office |
| | | CompanyInfoRes company = itCompanyService.queryById(user.getObjectId()); |
| | | company.setState(0); |
| | | itCompanyService.updateCompany(company); |
| | | |
| | | //设置该分公司下的所有司机状态 |
| | | ////Set the status of all drivers under this branch |
| | | itDriverService.updateCompanyDriverState(new UpdateCompanyDriverReq(2,company.getId())); |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | //查询加盟商 |
| | | ////Search for franchisees |
| | | CompanyInfoRes franchisee = itCompanyService.queryById(user.getObjectId()); |
| | | franchisee.setState(0); |
| | | itCompanyService.updateCompany(franchisee); |
| | | |
| | | //设置该加盟商下的所有司机状态 |
| | | //Set the status of all drivers under this branch |
| | | itDriverService.updateFranchiseeDriverState(new UpdateCompanyDriverReq(2,franchisee.getId())); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |