| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | 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.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EnterpriseUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.CheckEnterExist; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.CreateEnterprise; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.CreateEnterpriseRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.ModifyEnterpriseInfoRequest; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | */ |
| | | @RequestMapping("/tCompany_addFranchisee") |
| | | public String tCompany_addFranchisee(Model model) { |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | Integer roleType = ShiroExtUtil.getUser().getRoleType(); |
| | | if (1 == roleType){ |
| | | //查询分公司 |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | }else if (2 == roleType){ |
| | | TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | TCompany tCompany = tCompanyService.selectById(ShiroExtUtil.getUser().getObjectId()); |
| | | model.addAttribute("company",tCompany); |
| | | } |
| | | model.addAttribute("roleType",roleType); |
| | |
| | | */ |
| | | @RequestMapping("/tCompany_detailFranchisee/{tCompanyId}") |
| | | public String tCompany_detailFranchisee(@PathVariable Integer tCompanyId, Model model) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | model.addAttribute("item",tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | |
| | | TCompany obj = tCompanyService.selectById(tCompany.getSuperiorId()); |
| | | if (SinataUtil.isNotEmpty(obj)){ |
| | | model.addAttribute("companyName",obj.getName()); |
| | | }else { |
| | | model.addAttribute("companyName","平台"); |
| | | } |
| | | |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 3).eq("objectId", tCompanyId)); |
| | | model.addAttribute("user",user); |
| | | return PREFIX + "tCompany_detailFranchisee.html"; |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | model.addAttribute("item", tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | Integer roleType = ShiroExtUtil.getUser().getRoleType(); |
| | | model.addAttribute("roleType", roleType); |
| | | |
| | | TCompany obj = tCompanyService.selectById(tCompany.getSuperiorId()); |
| | | if (SinataUtil.isNotEmpty(obj)) { |
| | | model.addAttribute("companyName", obj.getName()); |
| | | } else { |
| | | model.addAttribute("companyName", "平台"); |
| | | } |
| | | |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 3).eq("objectId", tCompanyId)); |
| | | model.addAttribute("user", user); |
| | | return PREFIX + "tCompany_detailFranchisee.html"; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RequestMapping("/tCompany_updateFranchisee/{tCompanyId}") |
| | | public String tCompany_updateFranchisee(@PathVariable Integer tCompanyId, Model model) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | model.addAttribute("item",tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | if (1 == roleType){ |
| | | //查询分公司 |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | }else if (2 == roleType){ |
| | | TCompany obj = tCompanyService.selectById(ShiroKit.getUser().getObjectId()); |
| | | model.addAttribute("company",obj); |
| | | } |
| | | model.addAttribute("roleType",roleType); |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 3).eq("objectId", tCompanyId)); |
| | | model.addAttribute("user",user); |
| | | |
| | | return PREFIX + "tCompany_updateFranchisee.html"; |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | model.addAttribute("item", tCompany); |
| | | LogObjectHolder.me().set(tCompany); |
| | | |
| | | Integer roleType = ShiroExtUtil.getUser().getRoleType(); |
| | | if (1 == roleType) { |
| | | //查询分公司 |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList", companyList); |
| | | } else if (2 == roleType) { |
| | | TCompany obj = tCompanyService.selectById(ShiroExtUtil.getUser().getObjectId()); |
| | | model.addAttribute("company", obj); |
| | | } |
| | | model.addAttribute("roleType", roleType); |
| | | |
| | | //系统用户对象 |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("roleType", 3).eq("objectId", tCompanyId)); |
| | | model.addAttribute("user", user); |
| | | |
| | | return PREFIX + "tCompany_updateFranchisee.html"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/change") |
| | |
| | | String principalPhone, |
| | | String serviceStr, |
| | | Integer state) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() == 3){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tCompanyService.getFranchiseeList(page,beginTime,endTime,name,account,principalName,principalPhone,serviceStr,state,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId())); |
| | | } |
| | | return super.packForBT(page); |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)) { |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroExtUtil.getUser().getRoleType() == 3) { |
| | | page.setRecords(null); |
| | | } else { |
| | | page.setRecords(tCompanyService.getFranchiseeList(page, beginTime, endTime, name, account, principalName, principalPhone, serviceStr, state, ShiroExtUtil.getUser().getRoleType(), ShiroExtUtil.getUser().getObjectId())); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TCompany tCompany,@RequestParam String subArr,String account,String password) { |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | tCompany.setType(2); //2:分公司 |
| | | tCompany.setState(0); //0:正常 |
| | | tCompany.setInsertTime(new Date()); |
| | | tCompany.setUpdateTime(new Date()); |
| | | tCompanyService.insert(tCompany); |
| | | // 添加拼单设置 |
| | | SpellOrderRule spellOrderRule = new SpellOrderRule(); |
| | | spellOrderRule.setCompanyId(tCompany.getId()); |
| | | spellOrderRuleService.insert(spellOrderRule); |
| | | |
| | | Integer paymentDays = tCompany.getPaymentDays(); |
| | | // 过期时间 |
| | | // Long time = getTime(paymentDays); |
| | | //// redisTemplate.opsForValue().set("company_"+tCompany.getId(),tCompany.getId(),60, TimeUnit.SECONDS); |
| | | // sendHandler.messageSend("company_add_"+tCompany.getId(), time.intValue()); |
| | | //添加User对象 |
| | | User user = new User(); |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setRoleid("2"); |
| | | user.setDeptid(25); |
| | | user.setStatus(1); |
| | | user.setCreatetime(new Date()); |
| | | user.setRoleType(2); |
| | | user.setObjectId(tCompany.getId()); |
| | | user.setName(tCompany.getName()); |
| | | user.setSex(1); |
| | | userService.insert(user); |
| | | |
| | | // redisUtil.setStrValue("company_"+tCompany.getId(),tCompany.getPaymentDays().toString(),); |
| | | |
| | | //添加经营区域 |
| | | addSocpe(subArr,tCompany.getId()); |
| | | return SUCCESS_TIP; |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0) { |
| | | return "error"; |
| | | } |
| | | //调用中台接口创建企业 |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterNameExist(tCompany.getName()); |
| | | String enterCode = ""; |
| | | //企业未注册,进行注册 |
| | | if (null == checkEnterExist || "0".equals(checkEnterExist.getIsReg())) { |
| | | CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | request.setName(tCompany.getName()); |
| | | request.setNickName(tCompany.getName()); |
| | | request.setIndustry_code("123456"); |
| | | request.setMobile(tCompany.getPrincipalPhone()); |
| | | CreateEnterprise enterprise = EnterpriseUtil.createEnterprise(request); |
| | | enterCode = enterprise.getIdCode(); |
| | | } |
| | | //企业已注册 |
| | | if (null != checkEnterExist && "1".equals(checkEnterExist.getIsReg())) { |
| | | enterCode = checkEnterExist.getEnterCode(); |
| | | } |
| | | |
| | | tCompany.setEnterCode(enterCode); |
| | | tCompany.setType(2); //2:分公司 |
| | | tCompany.setState(0); //0:正常 |
| | | tCompany.setInsertTime(new Date()); |
| | | tCompany.setUpdateTime(new Date()); |
| | | tCompanyService.insert(tCompany); |
| | | // 添加拼单设置 |
| | | SpellOrderRule spellOrderRule = new SpellOrderRule(); |
| | | spellOrderRule.setCompanyId(tCompany.getId()); |
| | | spellOrderRuleService.insert(spellOrderRule); |
| | | |
| | | //添加User对象 |
| | | User user = new User(); |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setRoleid("2"); |
| | | user.setDeptid(25); |
| | | user.setStatus(1); |
| | | user.setCreatetime(new Date()); |
| | | user.setRoleType(2); |
| | | user.setObjectId(tCompany.getId()); |
| | | user.setName(tCompany.getName()); |
| | | user.setSex(1); |
| | | userService.insert(user); |
| | | |
| | | //添加经营区域 |
| | | addSocpe(subArr, tCompany.getId()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | //添加经营区域 |
| | | public void addSocpe(String subArr,Integer id){ |
| | |
| | | @RequestMapping(value = "/addFranchisee") |
| | | @ResponseBody |
| | | public Object addFranchisee(TCompany tCompany,String account,String password) { |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | tCompany.setType(3); //2:分公司 |
| | | if (ShiroKit.getUser().getRoleType() == 2){ |
| | | tCompany.setSuperiorId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | tCompany.setState(0); //0:正常 |
| | | tCompany.setInsertTime(new Date()); |
| | | tCompanyService.insert(tCompany); |
| | | |
| | | //添加User对象 |
| | | User user = new User(); |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setRoleid("3"); |
| | | user.setDeptid(26); |
| | | user.setStatus(1); |
| | | user.setCreatetime(new Date()); |
| | | user.setRoleType(3); |
| | | user.setObjectId(tCompany.getId()); |
| | | user.setName(tCompany.getName()); |
| | | user.setSex(1); |
| | | userService.insert(user); |
| | | |
| | | return SUCCESS_TIP; |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0) { |
| | | return "error"; |
| | | } |
| | | //调用中台接口创建企业 |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterNameExist(tCompany.getName()); |
| | | String enterCode = ""; |
| | | //企业未注册,进行注册 |
| | | if (null == checkEnterExist || "0".equals(checkEnterExist.getIsReg())) { |
| | | CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | request.setName(tCompany.getName()); |
| | | request.setNickName(tCompany.getName()); |
| | | request.setIndustry_code("123456"); |
| | | request.setMobile(tCompany.getPrincipalPhone()); |
| | | CreateEnterprise enterprise = EnterpriseUtil.createEnterprise(request); |
| | | enterCode = enterprise.getIdCode(); |
| | | } |
| | | //企业已注册 |
| | | if (null != checkEnterExist && "1".equals(checkEnterExist.getIsReg())) { |
| | | enterCode = checkEnterExist.getEnterCode(); |
| | | } |
| | | |
| | | tCompany.setEnterCode(enterCode); |
| | | tCompany.setType(3); //2:分公司 |
| | | if (ShiroExtUtil.getUser().getRoleType() == 2) { |
| | | tCompany.setSuperiorId(ShiroExtUtil.getUser().getObjectId()); |
| | | } |
| | | tCompany.setState(0); //0:正常 |
| | | tCompany.setInsertTime(new Date()); |
| | | tCompanyService.insert(tCompany); |
| | | |
| | | //添加User对象 |
| | | User user = new User(); |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setRoleid("3"); |
| | | user.setDeptid(26); |
| | | user.setStatus(1); |
| | | user.setCreatetime(new Date()); |
| | | user.setRoleType(3); |
| | | user.setObjectId(tCompany.getId()); |
| | | user.setName(tCompany.getName()); |
| | | user.setSex(1); |
| | | userService.insert(user); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tCompanyId) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | tCompany.setFlag("3"); |
| | | tCompanyService.updateById(tCompany); |
| | | return SUCCESS_TIP; |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | //调用中台接口创建企业 |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterNameExist(tCompany.getName()); |
| | | if (null != checkEnterExist && "1".equals(checkEnterExist.getIsReg())) { |
| | | |
| | | } |
| | | |
| | | tCompany.setFlag("3"); |
| | | tCompanyService.updateById(tCompany); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestMapping(value = "/update") |
| | | @ResponseBody |
| | | public Object update(TCompany tCompany,@RequestParam String subArr,String account,String password,Integer userId) { |
| | | //判断账号 |
| | | User user = userService.selectById(userId); |
| | | if (SinataUtil.isNotEmpty(account) && SinataUtil.isNotEmpty(password)){ |
| | | if (!user.getAccount().equals(account)){ |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | } |
| | | //修改账号密码 |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | } |
| | | TCompany company = tCompanyService.selectById(tCompany.getId()); |
| | | company.setUpdateTime(new Date()); |
| | | tCompany.setVersion(company.getVersion()+1); |
| | | tCompanyService.updateById(tCompany); |
| | | // long time = getTime(paymentDays); |
| | | // redisTemplate.opsForValue().set("company_"+tCompany.getId(),tCompany.getId(),60, TimeUnit.SECONDS); |
| | | // sendHandler.messageSend("company_update_"+tCompany.getId()+"_"+tCompany.getVersion(),5000); |
| | | user.setName(tCompany.getName()); |
| | | |
| | | userService.updateById(user); |
| | | |
| | | //添加经营区域 |
| | | addSocpe(subArr,tCompany.getId()); |
| | | |
| | | TCompany tCompany1 = tCompanyService.selectById(tCompany.getId()); |
| | | if(tCompany1.getType() == 1){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传平台数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyPay();//上传网约车平台公司支付信息 |
| | | pushMinistryOfTransportUtil.baseInfoCompany(tCompany.getId()); |
| | | pushMinistryOfTransportUtil.baseInfoCompanyService(); |
| | | pushMinistryOfTransportUtil.baseInfoCompanyPermit(tCompany.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | //判断账号 |
| | | User user = userService.selectById(userId); |
| | | if (SinataUtil.isNotEmpty(account) && SinataUtil.isNotEmpty(password)) { |
| | | if (!user.getAccount().equals(account)) { |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0) { |
| | | return "error"; |
| | | } |
| | | } |
| | | //修改账号密码 |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | } |
| | | TCompany company = tCompanyService.selectById(tCompany.getId()); |
| | | //调用中台接口创建企业 |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterNameExist(company.getName()); |
| | | String enterCode = null; |
| | | //企业已存在,编辑企业 |
| | | if (null != checkEnterExist && "1".equals(checkEnterExist.getIsReg())) { |
| | | ModifyEnterpriseInfoRequest request = new ModifyEnterpriseInfoRequest(); |
| | | request.setEnter_code(company.getEnterCode()); |
| | | request.setOperator(user.getPhone()); |
| | | request.setEnter_name(tCompany.getName()); |
| | | request.setEnter_nickname(tCompany.getName()); |
| | | EnterpriseUtil.modifyEnterpriseInfo(request); |
| | | enterCode = checkEnterExist.getEnterCode(); |
| | | } |
| | | //企业不存在,新增企业 |
| | | if (null == checkEnterExist || "0".equals(checkEnterExist.getIsReg())) { |
| | | CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | request.setName(tCompany.getName()); |
| | | request.setNickName(tCompany.getName()); |
| | | request.setIndustry_code("123456"); |
| | | request.setMobile(tCompany.getPrincipalPhone()); |
| | | CreateEnterprise enterprise = EnterpriseUtil.createEnterprise(request); |
| | | enterCode = enterprise.getIdCode(); |
| | | } |
| | | |
| | | company.setEnterCode(enterCode); |
| | | company.setUpdateTime(new Date()); |
| | | tCompany.setVersion(company.getVersion() + 1); |
| | | tCompanyService.updateById(tCompany); |
| | | |
| | | user.setName(tCompany.getName()); |
| | | userService.updateById(user); |
| | | |
| | | //添加经营区域 |
| | | addSocpe(subArr, tCompany.getId()); |
| | | |
| | | TCompany tCompany1 = tCompanyService.selectById(tCompany.getId()); |
| | | if (tCompany1.getType() == 1) { |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (pushMinistryOfTransport) {//上传平台数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyPay();//上传网约车平台公司支付信息 |
| | | pushMinistryOfTransportUtil.baseInfoCompany(tCompany.getId()); |
| | | pushMinistryOfTransportUtil.baseInfoCompanyService(); |
| | | pushMinistryOfTransportUtil.baseInfoCompanyPermit(tCompany.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestMapping(value = "/updateFranchisee") |
| | | @ResponseBody |
| | | public Object updateFranchisee(TCompany tCompany,String account,String password,Integer userId) { |
| | | //判断账号 |
| | | User user = userService.selectById(userId); |
| | | if (!user.getAccount().equals(account)){ |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | } |
| | | tCompanyService.updateById(tCompany); |
| | | |
| | | //修改账号密码 |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setName(tCompany.getName()); |
| | | userService.updateById(user); |
| | | |
| | | return SUCCESS_TIP; |
| | | //判断账号 |
| | | User user = userService.selectById(userId); |
| | | if (!user.getAccount().equals(account)) { |
| | | //判断账号是否已存在 |
| | | int count = userService.selectCount(new EntityWrapper<User>().eq("account", account)); |
| | | if (count > 0) { |
| | | return "error"; |
| | | } |
| | | } |
| | | TCompany company = tCompanyService.selectById(tCompany.getId()); |
| | | //调用中台接口创建企业 |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterNameExist(company.getName()); |
| | | String enterCode = null; |
| | | //企业已存在,编辑企业 |
| | | if (null != checkEnterExist && "1".equals(checkEnterExist.getIsReg())) { |
| | | ModifyEnterpriseInfoRequest request = new ModifyEnterpriseInfoRequest(); |
| | | request.setEnter_code(company.getEnterCode()); |
| | | request.setOperator(user.getPhone()); |
| | | request.setEnter_name(tCompany.getName()); |
| | | request.setEnter_nickname(tCompany.getName()); |
| | | EnterpriseUtil.modifyEnterpriseInfo(request); |
| | | enterCode = checkEnterExist.getEnterCode(); |
| | | } |
| | | //企业不存在,添加企业 |
| | | if (null == checkEnterExist || "0".equals(checkEnterExist.getIsReg())) { |
| | | CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | request.setName(tCompany.getName()); |
| | | request.setNickName(tCompany.getName()); |
| | | request.setIndustry_code("123456"); |
| | | request.setMobile(tCompany.getPrincipalPhone()); |
| | | CreateEnterprise enterprise = EnterpriseUtil.createEnterprise(request); |
| | | enterCode = enterprise.getIdCode(); |
| | | } |
| | | tCompany.setEnterCode(enterCode); |
| | | tCompanyService.updateById(tCompany); |
| | | |
| | | //修改账号密码 |
| | | user.setAccount(account); |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | | user.setPassword(ShiroKit.md5(password, user.getSalt())); |
| | | user.setName(tCompany.getName()); |
| | | userService.updateById(user); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | } |
| | | |
| | | private long getTime(Integer day){ |
| | | Date date = new Date(); |
| | | LocalDate now = LocalDate.now(); |
| | | LocalDate localDate = now.plusDays(day); |
| | | LocalDateTime localDateTime = localDate.atTime(1, 0, 0); |
| | | long time = date.getTime(); |
| | | long l = localDateTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli(); |
| | | return l-time; |
| | | } |
| | | |
| | | } |