| | |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.model.TDispatch; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | import com.stylefeng.guns.modular.system.service.ITDispatchService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.DeleteStafNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNode; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNodeRequest; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | tDispatch.setCompanyId(objectId1); |
| | | } |
| | | tDispatch.setPassword(ShiroKit.md5(tDispatch.getPassword(), "WL:x9#")); |
| | | tDispatchService.insert(tDispatch); |
| | | |
| | | User user = userService.selectById(shiroExtUtil.getUser().getId()); |
| | | TCompany tCompany = tCompanyService.selectById(user.getObjectId()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(tDispatch.getAccount(), tCompany.getEnterCode()); |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | request.setMobile(user.getPhone()); |
| | | request.setEntercode(tCompany.getEnterCode()); |
| | | request.setEmpName(tDispatch.getName()); |
| | | request.setEmpNickname(tDispatch.getName()); |
| | | request.setLoginNo(tDispatch.getPhone()); |
| | | request.setEmpSex("男"); |
| | | request.setMphone(tDispatch.getPhone()); |
| | | request.setEmail(tDispatch.getPhone() + "@qyt.com"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | SaveStaffNode saveStaffNode = resultUtil.getData(); |
| | | empId = saveStaffNode.getEmpId(); |
| | | empnew = 1; |
| | | } |
| | | tDispatch.setEmpId(empId); |
| | | tDispatch.setEntercode(tCompany.getEnterCode()); |
| | | tDispatch.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | tDispatch.setEmpnew(empnew); |
| | | tDispatchService.insert(tDispatch); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | dispatch.setState(1); |
| | | } |
| | | tDispatchService.updateById(dispatch); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | TCompany tCompany = tCompanyService.selectById(user.getObjectId()); |
| | | if (null != dispatch.getEmpId() && 1 == dispatch.getEmpnew()) { |
| | | //中台先删除司机 |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(dispatch.getPhone(), tCompany.getEnterCode()); |
| | | if (null != userInfoByPhone && 0 < userInfoByPhone.size() && 1 == dispatch.getEmpnew()) { |
| | | DeleteStafNodeRequest deleteStafNodeRequest = new DeleteStafNodeRequest(); |
| | | deleteStafNodeRequest.setEmpId(dispatch.getEmpId()); |
| | | deleteStafNodeRequest.setEntercode(tCompany.getEnterCode()); |
| | | deleteStafNodeRequest.setMobile(tCompany.getPrincipalPhone()); |
| | | ResultUtil resultUtil = EmployeeUtil.ecrmDeleteStafNode(deleteStafNodeRequest); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | return new ErrorTip(500, "账号已存在,请重新输入"); |
| | | } |
| | | } |
| | | Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | if (2 == roleType) { |
| | | tDispatch.setCompanyId(objectId); |
| | | } else if (3 == roleType) { |
| | | TCompany company = tCompanyService.selectById(objectId); |
| | | tDispatch.setCompanyId(company.getSuperiorId()); |
| | | tDispatch.setFranchiseeId(objectId); |
| | | } |
| | | // Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | // Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | // if (2 == roleType) { |
| | | // tDispatch.setCompanyId(objectId); |
| | | // } else if (3 == roleType) { |
| | | // TCompany company = tCompanyService.selectById(objectId); |
| | | // tDispatch.setCompanyId(company.getSuperiorId()); |
| | | // tDispatch.setFranchiseeId(objectId); |
| | | // } |
| | | if (SinataUtil.isNotEmpty(tDispatch.getPassword())) { |
| | | tDispatch.setPassword(ShiroKit.md5(tDispatch.getPassword(), "WL:x9#")); |
| | | } |