| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- package platform.modules.government.web;
- import com.github.pagehelper.PageInfo;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.ModelMap;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import platform.common.Constant;
- import platform.common.annotation.OperationLog;
- import platform.common.base.controller.BaseController;
- import platform.common.base.model.DictionaryItem;
- import platform.common.base.service.DictionaryItemService;
- import platform.common.util.ShiroUtils;
- import platform.modules.build.entity.BuildInfo;
- import platform.modules.build.entity.Company;
- import platform.modules.build.entity.CompanyMaterial;
- import platform.modules.build.service.BuildInfoService;
- import platform.modules.build.service.CompanyContactService;
- import platform.modules.build.service.CompanyMaterialService;
- import platform.modules.build.service.CompanyService;
- import platform.modules.company.service.CompanyInfoManageService;
- import platform.modules.government.dto.CompanyFileDto;
- import platform.modules.government.entity.Attachment;
- import platform.modules.government.entity.FileDown;
- import platform.modules.government.entity.Street;
- import platform.modules.government.entity.User;
- import platform.modules.government.service.AttachmentService;
- import platform.modules.government.service.BuildTypeService;
- import platform.modules.government.service.StreetService;
- import platform.modules.government.service.UserService;
- import platform.modules.sys.entity.Approval;
- import platform.modules.sys.service.ApprovalService;
- import platform.modules.sys.web.ResponseMessage;
- import tk.mybatis.mapper.entity.Example;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Objects;
- @Controller
- @RequestMapping("/register")
- public class RegisterApproval extends BaseController {
- @Autowired
- CompanyInfoManageService companyInfoManageService;
- @Autowired
- CompanyService companyService;
- @Autowired
- CompanyContactService companyContactService;
- @Autowired
- private BuildInfoService buildInfoService;
- @Autowired
- private StreetService streeService;
- @Autowired
- private DictionaryItemService dictionaryItemService;
- @Autowired
- private ApprovalService approvalService;
- @Autowired
- private UserService userService;
- @Autowired
- private AttachmentService attachmentService;
- @Autowired
- private CompanyMaterialService companyMaterialService;
- @OperationLog(value = "查看企业注册列表")
- @RequestMapping("/list")
- public String pageInfo(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, ModelMap modelMap, String keyword, Company searchCondition) {
- PageInfo<Company> pageInfo = companyInfoManageService.findRegisterPage(pageNum, PAGESIZE, keyword, searchCondition);
- modelMap.put("pageInfo", pageInfo);
- modelMap.put("keyword", keyword);
- modelMap.put("searchCondition", searchCondition);
- return "/admin/government/register/index";
- }
- @RequestMapping("/details")
- public String details(Integer id, ModelMap modelMap) {
- Company company = companyService.findById(id);
- //
- if (Objects.equals(company.getIndustry_code(), "Empty")) {
- company.setIndustry_code(company.getIndustry_name());
- } else {
- company.setIndustry_code(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRY_TYPE, company.getIndustry_code()));
- }
- modelMap.put("company", company);
- if (null != company) {
- company.setCompanyContacts(companyContactService.findByCompanyId(id));
- }
- List<Street> streetList = streeService.findList();
- modelMap.addAttribute("streetList", streetList);
- Example example = new Example(BuildInfo.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("del_flag", "0");
- //倒序
- example.orderBy("create_time").desc();
- List<BuildInfo> buildInfo = buildInfoService.selectByExample(example);
- modelMap.put("buildInfo", buildInfo);
- //查询企业性质
- List<DictionaryItem> companyTypeList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.COMPANY_TYPE);
- modelMap.put("companyTypeList", companyTypeList);
- //查询币种单位数据
- List<DictionaryItem> itemList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.CURRENCY_UNIT);
- modelMap.put("itemList", itemList);
- List<Approval> approvalList = approvalService.getRegisterApprovalList(id);
- modelMap.put("approvalList", approvalList);
- Example userexample = new Example(User.class);
- Example.Criteria usercriteria = userexample.createCriteria();
- usercriteria.andEqualTo("del_flag", "0");
- usercriteria.andEqualTo("user_type", Constant.UserType.COMPANY);
- usercriteria.andEqualTo("company_id", id);
- userexample.orderBy("create_time").asc();
- List<User> users = userService.selectByExample(userexample);
- if (null != users && users.size() > 0) {
- modelMap.put("user", users.get(0));
- } else {
- modelMap.put("user", new User());
- }
- modelMap.put("companyContract", companyContactService.findByCompanyId(id));
- modelMap.put("fileUrl", getFileDownloadUri());
- Example materialexample = new Example(CompanyMaterial.class);
- Example.Criteria materialcriteria = materialexample.createCriteria();
- materialcriteria.andEqualTo("del_flag", "0");
- materialcriteria.andEqualTo("company_id", id);
- List<CompanyFileDto> companyFileDtoList = new ArrayList<>();
- List<CompanyMaterial> materialList = companyMaterialService.selectByExample(materialexample);
- List<Attachment> attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.COMPANY_MATERIAL, id, null);
- if (null != attachments && attachments.size() > 0 && null != materialList && materialList.size() > 0) {
- for (Attachment attachment : attachments) {
- for (CompanyMaterial material : materialList) {
- if (Objects.equals(material.getAttachment_id(), attachment.getId())) {
- CompanyFileDto companyFileDto = new CompanyFileDto();
- FileDown fileDown = new FileDown(attachment.getId(), attachment.getFile_name(), attachment.getFile_url(), attachment.getDownload_uri());
- companyFileDto.setFile_name(material.getFile_name());
- companyFileDto.setFileDown(fileDown);
- companyFileDtoList.add(companyFileDto);
- }
- }
- }
- }
- modelMap.put("companyMaterial", companyFileDtoList);
- return "/admin/government/register/details";
- }
- @RequestMapping("/approval")
- public String approval(Integer id, ModelMap modelMap) {
- Company company = companyService.findById(id);
- //
- if (Objects.equals(company.getIndustry_code(), "Empty")) {
- company.setIndustry_code(company.getIndustry_name());
- } else {
- company.setIndustry_code(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.INDUSTRY_TYPE, company.getIndustry_code()));
- }
- modelMap.put("company", company);
- if (null != company) {
- company.setCompanyContacts(companyContactService.findByCompanyId(id));
- }
- List<Street> streetList = streeService.findList();
- modelMap.addAttribute("streetList", streetList);
- Example example = new Example(BuildInfo.class);
- Example.Criteria criteria = example.createCriteria();
- criteria.andEqualTo("del_flag", "0");
- //倒序
- example.orderBy("create_time").desc();
- List<BuildInfo> buildInfo = buildInfoService.selectByExample(example);
- modelMap.put("buildInfo", buildInfo);
- //查询企业性质
- List<DictionaryItem> companyTypeList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.COMPANY_TYPE);
- modelMap.put("companyTypeList", companyTypeList);
- //查询币种单位数据
- List<DictionaryItem> itemList = dictionaryItemService.findListByTypeName(Constant.DictionaryType.CURRENCY_UNIT);
- modelMap.put("itemList", itemList);
- List<Approval> approvalList = approvalService.getRegisterApprovalList(id);
- modelMap.put("approvalList", approvalList);
- Example userexample = new Example(User.class);
- Example.Criteria usercriteria = userexample.createCriteria();
- usercriteria.andEqualTo("del_flag", "0");
- usercriteria.andEqualTo("user_type", Constant.UserType.COMPANY);
- usercriteria.andEqualTo("company_id", id);
- userexample.orderBy("create_time").asc();
- List<User> users = userService.selectByExample(userexample);
- if (null != users && users.size() > 0) {
- modelMap.put("user", users.get(0));
- } else {
- modelMap.put("user", new User());
- }
- modelMap.put("companyContract", companyContactService.findByCompanyId(id));
- modelMap.put("fileUrl", getFileDownloadUri());
- Example materialexample = new Example(CompanyMaterial.class);
- Example.Criteria materialcriteria = materialexample.createCriteria();
- materialcriteria.andEqualTo("del_flag", "0");
- materialcriteria.andEqualTo("company_id", id);
- List<CompanyFileDto> companyFileDtoList = new ArrayList<>();
- List<CompanyMaterial> materialList = companyMaterialService.selectByExample(materialexample);
- List<Attachment> attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.COMPANY_MATERIAL, id, null);
- if (null != attachments && attachments.size() > 0 && null != materialList && materialList.size() > 0) {
- for (Attachment attachment : attachments) {
- for (CompanyMaterial material : materialList) {
- if (Objects.equals(material.getAttachment_id(), attachment.getId())) {
- CompanyFileDto companyFileDto = new CompanyFileDto();
- FileDown fileDown = new FileDown(attachment.getId(), attachment.getFile_name(), attachment.getFile_url(), attachment.getDownload_uri());
- companyFileDto.setFile_name(material.getFile_name());
- companyFileDto.setFileDown(fileDown);
- companyFileDtoList.add(companyFileDto);
- }
- }
- }
- }
- modelMap.put("companyMaterial", companyFileDtoList);
- return "/admin/government/register/approval";
- }
- @OperationLog(value = "企业注册审核")
- @RequestMapping("/submit")
- @ResponseBody
- public ResponseMessage submit(Integer type, Integer id, String approval_comment) {
- try {
- if (IsTooFrequently()) {
- return ResponseMessage.error("操作过于频繁,请稍后再试!");
- }
- return companyService.approval(type, id, approval_comment);
- } catch (Exception e) {
- e.printStackTrace();
- return ResponseMessage.error("审核失败");
- }
- }
- @OperationLog(value = "查看企业注册审核列表")
- @RequestMapping("/already_list")
- public String already_pageInfo(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, ModelMap modelMap, String keyword, Company searchCondition) {
- PageInfo<Company> pageInfo = companyInfoManageService.findAlready_RegisterPage(pageNum, PAGESIZE, keyword, searchCondition);
- modelMap.put("pageInfo", pageInfo);
- modelMap.put("keyword", keyword);
- modelMap.put("searchCondition", searchCondition);
- return "/admin/government/register/index1";
- }
- /**
- * 检验手机号是否存在
- *
- * @param mobile
- * @return
- */
- @ResponseBody
- @GetMapping(value = "/isExistMobile")
- public Boolean isExistMobile(String id, String mobile) throws Exception {
- boolean flag = true;
- log.debug("检验手机号是否存在参数! id= {}, mobile= {}", id, mobile);
- User record = userService.findByMobile(mobile);
- if (null != record) {
- if (StringUtils.isBlank(id)) {
- flag = false;
- } else {
- if (record.getId() != (Integer.parseInt(id))) {
- flag = false;
- }
- }
- }
- log.info("检验用户名是否存在结果! flag = {}", flag);
- return flag;
- }
- /**
- * 检验用户名是否存在
- *
- * @param nick_name
- * @return
- */
- @ResponseBody
- @GetMapping(value = "/isExist")
- public Boolean isExist(String id, String nick_name) throws Exception {
- boolean flag = true;
- log.debug("检验用户名是否存在参数! id= {}, username= {}", id, nick_name);
- User record = userService.findByUserName(nick_name);
- if (null != record) {
- if (StringUtils.isBlank(id)) {
- flag = false;
- } else {
- if (record.getId() != (Integer.parseInt(id))) {
- flag = false;
- }
- }
- }
- log.info("检验用户名是否存在结果! flag = {}", flag);
- return flag;
- }
- /**
- * 检验组织机构代码是否存在
- *
- * @param organization_code
- * @return
- */
- /*@ResponseBody
- @GetMapping(value = "/isExistOrgCode")
- public Boolean isExistOrgCode(String id, String organization_code) throws Exception {
- boolean flag = true;
- log.debug("检验组织机构代码是否存在参数! id= {}, username= {}", id, organization_code);
- Company record = companyService.findByOrgCode(organization_code);
- if (null != record) {
- if (StringUtils.isBlank(id)) {
- flag = false;
- } else {
- if (record.getId() != (Integer.parseInt(id))) {
- flag = false;
- }
- }
- }
- log.info("检验组织机构代码是否存在结果! flag = {}", flag);
- return flag;
- }*/
- }
|