| | |
| | | public R update(@Valid @RequestBody Permit permit) { |
| | | //审核通过 |
| | | if (permit.getType().equals("0")) { |
| | | //新增组织机构和单位信息 |
| | | Information information = new Information(); |
| | | information.setCreditcode(permit.getCreditcode()); |
| | | information.setEnterprisename(permit.getEnterprisename()); |
| | | information.setRepresentative(permit.getRepresentative()); |
| | | information.setEstablishtime(permit.getEstablishtime()); |
| | | information.setRegisteredcapital(permit.getRegisteredcapital()); |
| | | information.setOrganizationcode(permit.getOrganizationcode()); |
| | | information.setRegistrationnumber(permit.getRegistrationnumber()); |
| | | information.setEnterprises(permit.getEnterprises()); |
| | | information.setAddress(permit.getAddress()); |
| | | information.setBusiness(permit.getBusiness()); |
| | | information.setRegion(permit.getRegion()); |
| | | information.setRegistration(permit.getRegistration()); |
| | | information.setIndustry(permit.getIndustry()); |
| | | information.setRepresentativecell(permit.getRepresentativecell()); |
| | | information.setContacts(permit.getContacts()); |
| | | information.setContactscell(permit.getContactscell()); |
| | | Dept dept = new Dept(); |
| | | //本市公司 |
| | | if (permit.getPtype().equals("0")) { |
| | | Long i = 1413470343230877697L; |
| | | dept.setParentId(i); |
| | | dept.setAncestors("0,1413470343230877697"); |
| | | } |
| | | //培训公司 |
| | | else if (permit.getPtype().equals("1")) { |
| | | Long i = 1418458374477549569L; |
| | | dept.setParentId(i); |
| | | dept.setAncestors("0,1418458374477549569"); |
| | | } else { |
| | | Long i = 1420222961377357825L; |
| | | dept.setParentId(i); |
| | | dept.setAncestors("0,1420222961377357825"); |
| | | } |
| | | dept.setTenantId("000000"); |
| | | dept.setDeptName(information.getEnterprisename()); |
| | | dept.setDeptCategory(1); |
| | | if (iDeptService.submit(dept)) { |
| | | CacheUtil.clear(SYS_CACHE); |
| | | // 返回懒加载树更新节点所需字段 |
| | | Kv kv = Kv.create().set("id", String.valueOf(dept.getId())).set("tenantId", dept.getTenantId()) |
| | | .set("deptCategoryName", DictCache.getValue(DictEnum.ORG_CATEGORY, dept.getDeptCategory())); |
| | | String id = kv.get("id").toString(); |
| | | information.setDepartmentid(id); |
| | | } |
| | | informationService.save(information); |
| | | //注册用户 |
| | | User user = new User(); |
| | | user.setAccount(permit.getEnterprisename()); |
| | | String initPassword = ParamCache.getValue(DEFAULT_PARAM_PASSWORD); |
| | | user.setPassword(initPassword); |
| | | userService.saveOrUpdate(user); |
| | | // //新增组织机构和单位信息 |
| | | // Information information = new Information(); |
| | | // information.setCreditcode(permit.getCreditcode()); |
| | | // information.setEnterprisename(permit.getEnterprisename()); |
| | | // information.setRepresentative(permit.getRepresentative()); |
| | | // information.setEstablishtime(permit.getEstablishtime()); |
| | | // information.setRegisteredcapital(permit.getRegisteredcapital()); |
| | | // information.setOrganizationcode(permit.getOrganizationcode()); |
| | | // information.setRegistrationnumber(permit.getRegistrationnumber()); |
| | | // information.setEnterprises(permit.getEnterprises()); |
| | | // information.setAddress(permit.getAddress()); |
| | | // information.setBusiness(permit.getBusiness()); |
| | | // information.setRegion(permit.getRegion()); |
| | | // information.setRegistration(permit.getRegistration()); |
| | | // information.setIndustry(permit.getIndustry()); |
| | | // information.setRepresentativecell(permit.getRepresentativecell()); |
| | | // information.setContacts(permit.getContacts()); |
| | | // information.setContactscell(permit.getContactscell()); |
| | | // Dept dept = new Dept(); |
| | | // //本市公司 |
| | | // if (permit.getPtype().equals("0")) { |
| | | // Long i = 1413470343230877697L; |
| | | // dept.setParentId(i); |
| | | // dept.setAncestors("0,1413470343230877697"); |
| | | // } |
| | | // //培训公司 |
| | | // else if (permit.getPtype().equals("1")) { |
| | | // Long i = 1418458374477549569L; |
| | | // dept.setParentId(i); |
| | | // dept.setAncestors("0,1418458374477549569"); |
| | | // } else { |
| | | // Long i = 1420222961377357825L; |
| | | // dept.setParentId(i); |
| | | // dept.setAncestors("0,1420222961377357825"); |
| | | // } |
| | | // dept.setTenantId("000000"); |
| | | // dept.setDeptName(information.getEnterprisename()); |
| | | // dept.setDeptCategory(1); |
| | | // if (iDeptService.submit(dept)) { |
| | | // CacheUtil.clear(SYS_CACHE); |
| | | // // 返回懒加载树更新节点所需字段 |
| | | // Kv kv = Kv.create().set("id", String.valueOf(dept.getId())).set("tenantId", dept.getTenantId()) |
| | | // .set("deptCategoryName", DictCache.getValue(DictEnum.ORG_CATEGORY, dept.getDeptCategory())); |
| | | // String id = kv.get("id").toString(); |
| | | // information.setDepartmentid(id); |
| | | // } |
| | | // informationService.save(information); |
| | | // //注册用户 |
| | | // User user = new User(); |
| | | // user.setAccount(permit.getEnterprisename()); |
| | | // String initPassword = ParamCache.getValue(DEFAULT_PARAM_PASSWORD); |
| | | // user.setPassword(initPassword); |
| | | // userService.saveOrUpdate(user); |
| | | //把附件添加单位id |
| | | attachService.updat(information.getDepartmentid(), permit.getCardid()); |
| | | String s1 = "update sys_permit set type = " + "'" + 0 + "'" + ",approve = " + "'" + permit.getApprove() + "'" + |
| | | " " + "where id = " + "'" + permit.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | // attachService.updat(information.getDepartmentid(), permit.getCardid()); |
| | | // String s1 = "update sys_permit set type = " + "'" + permit.getType() + "'" + |
| | | // ",papprove = " + "'" + permit.getPapprove() + "'"+ |
| | | // ",xapprove = " + "'" + permit.getXapprove() + "'"+ |
| | | // ",sapprove = " + "'" + permit.getSapprove() + "'"+ |
| | | // ",popinion = " + "'" + permit.getPopinion() + "'"+ |
| | | // ",sopinion = " + "'" + permit.getSopinion() + "'"+ |
| | | // ",xopinion = " + "'" + permit.getXopinion() + "'"+ |
| | | // " " +"where id = " + "'" + permit.getId() + "'"; |
| | | // FtpUtil.sqlFileUpload(s1); |
| | | } else { |
| | | String s1 = "update sys_permit set type = " + "'" + 1 + "'" + ",approve = " + "'" + permit.getApprove() + "'" + |
| | | " " + "where id = " + "'" + permit.getId() + "'"; |
| | | String s1 = "update sys_permit set type = " + "'" + permit.getType() + "'" + |
| | | ",papprove = " + "'" + permit.getPapprove() + "'"+ |
| | | ",xapprove = " + "'" + permit.getXapprove() + "'"+ |
| | | ",sapprove = " + "'" + permit.getSapprove() + "'"+ |
| | | ",popinion = " + "'" + permit.getPopinion() + "'"+ |
| | | ",sopinion = " + "'" + permit.getSopinion() + "'"+ |
| | | ",xopinion = " + "'" + permit.getXopinion() + "'"+ |
| | | " " +"where id = " + "'" + permit.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | } |
| | | return R.status(permitService.updateById(permit)); |