| | |
| | | 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.ObsUploadUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.factory.UserFactory; |
| | | import com.stylefeng.guns.modular.system.model.TAgent; |
| | | import com.stylefeng.guns.modular.system.model.TBranchOffice; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.transfer.UserDto; |
| | | import com.stylefeng.guns.modular.system.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.huawei.OBSUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.NCOSSUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.QianYunTongConfig; |
| | |
| | | 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.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private QianYunTongConfig qianYunTongConfig; |
| | | |
| | | @Autowired |
| | | private ITCompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | |
| | | |
| | | ShiroUser user1 = shiroExtUtil.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TCompany tCompany = companyService.selectById(user2.getObjectId()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(user.getPhone(), tCompany.getEnterCode()); |
| | | TBranchOffice tBranchOffice = branchOfficeService.selectById(user2.getObjectId()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(user.getPhone(), tBranchOffice.getEnterCode()); |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | SaveStaffNodeRequest request1 = new SaveStaffNodeRequest(); |
| | | request1.setMobile(user2.getPhone()); |
| | | request1.setEntercode(tCompany.getEnterCode()); |
| | | request1.setEntercode(tBranchOffice.getEnterCode()); |
| | | request1.setEmpName(user.getName()); |
| | | request1.setEmpNickname(user.getName()); |
| | | request1.setLoginNo(user.getAccount()); |
| | |
| | | objectUser.setPassWordUpdate(new Date()); |
| | | objectUser.setEnterId(empId); |
| | | objectUser.setEmpnew(empnew); |
| | | objectUser.setEntercode(tCompany.getEnterCode()); |
| | | objectUser.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | objectUser.setEntercode(tBranchOffice.getEnterCode()); |
| | | objectUser.setEnterId(Long.valueOf(tBranchOffice.getEnterCode())); |
| | | this.userService.insert(objectUser); |
| | | |
| | | return SUCCESS_TIP; |
| | |
| | | User oldUser = userService.selectById(user.getId()); |
| | | ShiroUser user1 = shiroExtUtil.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TCompany tCompany = companyService.selectById(user2.getObjectId()); |
| | | TBranchOffice tBranchOffice = branchOfficeService.selectById(user2.getObjectId()); |
| | | //调用中台接口 |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(oldUser.getPhone(), tCompany.getEnterCode()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(oldUser.getPhone(), tBranchOffice.getEnterCode()); |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | SaveStaffNodeRequest request1 = new SaveStaffNodeRequest(); |
| | | request1.setMobile(user2.getPhone()); |
| | | request1.setEntercode(tCompany.getEnterCode()); |
| | | request1.setEntercode(tBranchOffice.getEnterCode()); |
| | | request1.setEmpName(user.getName()); |
| | | request1.setEmpNickname(user.getName()); |
| | | request1.setLoginNo(user.getAccount()); |
| | |
| | | empnew = 0; |
| | | } |
| | | oldUser.setEmpId(empId); |
| | | oldUser.setEntercode(tCompany.getEnterCode()); |
| | | oldUser.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | oldUser.setEntercode(tBranchOffice.getEnterCode()); |
| | | oldUser.setEnterId(Long.valueOf(tBranchOffice.getEnterCode())); |
| | | oldUser.setEmpnew(empnew); |
| | | if (ShiroKit.hasRole(Const.ADMIN_NAME)) { |
| | | this.userService.updateById(UserFactory.editUser(user, oldUser)); |
| | |
| | | User user = userService.selectById(userId); |
| | | ShiroUser user1 = shiroExtUtil.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TCompany tCompany = companyService.selectById(user2.getObjectId()); |
| | | TBranchOffice tBranchOffice = branchOfficeService.selectById(user2.getObjectId()); |
| | | //调用中台接口 |
| | | if(1 == user.getEmpnew()){ |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(user.getPhone(), tCompany.getEnterCode()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(user.getPhone(), tBranchOffice.getEnterCode()); |
| | | if (null != userInfoByPhone && 0 < userInfoByPhone.size() && 1 == user.getEmpnew()) { |
| | | DeleteStafNodeRequest request1 = new DeleteStafNodeRequest(); |
| | | request1.setEmpId(user.getEnterId()); |
| | | request1.setMobile(tCompany.getPrincipalPhone()); |
| | | request1.setEntercode(tCompany.getEnterCode()); |
| | | request1.setMobile(tBranchOffice.getPrincipalPhone()); |
| | | request1.setEntercode(tBranchOffice.getEnterCode()); |
| | | ResultUtil resultUtil = EmployeeUtil.ecrmDeleteStafNode(request1); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |