|
@@ -0,0 +1,224 @@
|
|
|
+package com.huyi.service.conmany.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.huyi.service.base.entity.SysCompany;
|
|
|
+import com.huyi.service.base.entity.SysUser;
|
|
|
+import com.huyi.service.base.entity.SysUserCompanyRel;
|
|
|
+import com.huyi.service.base.service.ISysCompanyService;
|
|
|
+import com.huyi.service.base.service.ISysUserCompanyRelService;
|
|
|
+import com.huyi.service.base.service.ISysUserService;
|
|
|
+import com.huyi.service.conmany.service.IOwnCompanyManageService;
|
|
|
+import com.keao.tianhu.starter.mybatis.plus.entity.QueryRequest;
|
|
|
+import com.tianhu.common.core.domain.R;
|
|
|
+import com.tianhu.common.core.utils.CommonUtil;
|
|
|
+import com.tianhu.common.core.web.controller.BaseController;
|
|
|
+import com.tianhu.common.security.service.TokenService;
|
|
|
+import com.tianhu.system.api.model.LoginUser;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.lang.reflect.Method;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.LinkedList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 企业信息Controller
|
|
|
+ *
|
|
|
+ * @author ch
|
|
|
+ * @date 2021-09-14
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/companyInformation")
|
|
|
+public class CompanyInformationController extends BaseController {
|
|
|
+ @Autowired
|
|
|
+ private ISysUserCompanyRelService iSysUserCompanyRelService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysCompanyService iSysCompanyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IOwnCompanyManageService iOwnCompanyManageService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysUserService iSysUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TokenService tokenService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业四要素认证状态;未认证
|
|
|
+ */
|
|
|
+ private String NORMAL_STATE = "00";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是经办人
|
|
|
+ */
|
|
|
+ private String HANDER = "1";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取企业明细信息
|
|
|
+ */
|
|
|
+// @PreAuthorize(hasPermi = "service:company:query")
|
|
|
+ @GetMapping()
|
|
|
+ public R getCompanyInfo() throws Exception {
|
|
|
+ //获取当前登录用户企业Id
|
|
|
+ String scyId = tokenService.getLoginUser().getSysUser().getCompanyId();
|
|
|
+ LambdaQueryWrapper<SysCompany> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(SysCompany::getScyId,scyId);
|
|
|
+ List<SysCompany> list = iSysCompanyService.findSysCompanys(queryWrapper);
|
|
|
+ //转为MapList
|
|
|
+ List<Map<String, Object>> result = EntityConvertMap(list);
|
|
|
+ if(list.size() > 0) {
|
|
|
+ for(Map r : result) {
|
|
|
+ //联系人
|
|
|
+ Long userId = list.get(0).getScyContractId();
|
|
|
+ //查询联系人信息
|
|
|
+ LambdaQueryWrapper<SysUser> userQuery = new LambdaQueryWrapper<>();
|
|
|
+ userQuery.eq(SysUser::getUserId, userId);
|
|
|
+ List<SysUser> useList = iSysUserService.findSysUsers(userQuery);
|
|
|
+ if(useList.size() > 0) {
|
|
|
+ //联系电话
|
|
|
+ String userName = useList.get(0).getUserName();
|
|
|
+ //联系人
|
|
|
+ String nickName = useList.get(0).getNickName();
|
|
|
+ //新增值
|
|
|
+ r.put("userName", userName);
|
|
|
+ r.put("nickName", nickName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (NORMAL_STATE.equals(list.get(0).getScyStatus())) {
|
|
|
+ //经办人信息
|
|
|
+ LambdaQueryWrapper<SysUserCompanyRel> sysUserCompanyRel = new LambdaQueryWrapper<>();
|
|
|
+ sysUserCompanyRel.eq(SysUserCompanyRel::getSucrCompanyId,scyId);
|
|
|
+ sysUserCompanyRel.eq(SysUserCompanyRel::getSucrHandler,HANDER);
|
|
|
+ List<SysUserCompanyRel> contactsList = iSysUserCompanyRelService.findSysUserCompanyRels(sysUserCompanyRel);
|
|
|
+ List<Map> userList = null;
|
|
|
+ List<Map> handlerPositiveList = null;
|
|
|
+ List<Map> handlerNegativeList = null;
|
|
|
+
|
|
|
+ Map queryMap = new HashMap();
|
|
|
+ queryMap.put("companyId",scyId);
|
|
|
+ //发票信息
|
|
|
+ List<Map> invoiceList = iOwnCompanyManageService.selectInvoiceList(queryMap);
|
|
|
+ //营业执照信息
|
|
|
+ List<Map> licenseList = iOwnCompanyManageService.selectLicenseFileList(queryMap);
|
|
|
+ //法人证件正面信息
|
|
|
+ List<Map> legalFileList = iOwnCompanyManageService.selectLegalFileList(queryMap);
|
|
|
+ //法人证件反面信息
|
|
|
+ List<Map> legalBackFileList = iOwnCompanyManageService.selectLegalBackFileList(queryMap);
|
|
|
+ //法人授权书信息
|
|
|
+ List<Map> authorizationList = iOwnCompanyManageService.selectAuthorizationFileList(queryMap);
|
|
|
+ //数字证书授权与承诺书信息
|
|
|
+ List<Map> commitmentList = iOwnCompanyManageService.selectCommitmentFileList(queryMap);
|
|
|
+ //其他附件
|
|
|
+ List<Map> appendixList = iOwnCompanyManageService.selectAppendixFileList(queryMap);
|
|
|
+ /*返回结果*/
|
|
|
+ Map map = new HashMap();
|
|
|
+ //基本信息
|
|
|
+ map.put("basicList",result);
|
|
|
+ //经办人信息
|
|
|
+ if(contactsList.size() > 0) {
|
|
|
+ Long sucrUserId = contactsList.get(0).getSucrUserId();
|
|
|
+ Map userMap = new HashMap();
|
|
|
+ userMap.put("userId",sucrUserId);
|
|
|
+ userList = iOwnCompanyManageService.selectUserList(userMap);
|
|
|
+ Map handlerMap = new HashMap();
|
|
|
+ handlerMap.put("userId",sucrUserId);
|
|
|
+ handlerPositiveList = iOwnCompanyManageService.handlerPositiveList(handlerMap);
|
|
|
+ handlerNegativeList = iOwnCompanyManageService.handlerNegativeList(handlerMap);
|
|
|
+ }
|
|
|
+ map.put("contactsList", userList);
|
|
|
+ //发票信息
|
|
|
+ map.put("invoiceList", invoiceList);
|
|
|
+ //营业执照信息
|
|
|
+ map.put("licenseList",licenseList);
|
|
|
+ //法人证件正面信息
|
|
|
+ map.put("legalList",legalFileList);
|
|
|
+ //法人证件反面信息
|
|
|
+ map.put("legalBackList",legalBackFileList);
|
|
|
+ //经办人证件正面信息
|
|
|
+ map.put("handlerPositiveList",handlerPositiveList);
|
|
|
+ //经办人证件反面信息
|
|
|
+ map.put("handlerNegativeList",handlerNegativeList);
|
|
|
+ //法人授权书信息
|
|
|
+ map.put("authorizationList",authorizationList);
|
|
|
+ //数字证书授权与承诺书信息
|
|
|
+ map.put("commitmentList",commitmentList);
|
|
|
+ //其他附件
|
|
|
+ map.put("appendixList",appendixList);
|
|
|
+ return R.ok(map);
|
|
|
+ }if (NORMAL_STATE.equals(list.get(0).getScyAuthStatus())) {
|
|
|
+ return R.ok(result);
|
|
|
+ }else if(!NORMAL_STATE.equals(list.get(0).getScyStatus())){
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ throw new Exception("企业不存在");
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 查询链属列表
|
|
|
+ * @param scySocialCode 社会统一信用代码
|
|
|
+ * @param companyName 企业名称
|
|
|
+ * @param scrType 企业类型
|
|
|
+ * @param scrStatus 链属状态
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/listRel")
|
|
|
+ public R listRel(String scySocialCode, String companyName,
|
|
|
+ String scrType, String scrStatus, QueryRequest request)
|
|
|
+ {
|
|
|
+ //获取当前操作员
|
|
|
+ LoginUser user = tokenService.getLoginUser();
|
|
|
+ String companyId = user.getSysUser().getCompanyId();
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("companyId", companyId);
|
|
|
+ if(CommonUtil.isNotEmpty(companyName)) {
|
|
|
+ map.put("companyName", companyName);
|
|
|
+ }
|
|
|
+ if(CommonUtil.isNotEmpty(scySocialCode)) {
|
|
|
+ map.put("scySocialCode", scySocialCode);
|
|
|
+ }
|
|
|
+ if(CommonUtil.isNotEmpty(scrType)) {
|
|
|
+ map.put("scrType", scrType);
|
|
|
+ }
|
|
|
+ if(CommonUtil.isNotEmpty(scrStatus)) {
|
|
|
+ map.put("scrStatus", scrStatus);
|
|
|
+ }
|
|
|
+ IPage<Map> list = iOwnCompanyManageService.selectCompanyRelList(request,map);
|
|
|
+ return R.ok(list, companyId);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 实体类转Map
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static List<Map<String,Object>> EntityConvertMap(List<SysCompany> list){
|
|
|
+ List<Map<String,Object>> l = new LinkedList<>();
|
|
|
+ try {
|
|
|
+ for(SysCompany t : list){
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ Method[] methods = t.getClass().getMethods();
|
|
|
+ for (Method method : methods) {
|
|
|
+ if (method.getName().startsWith("get")) {
|
|
|
+ String name = method.getName().substring(3);
|
|
|
+ name = name.substring(0, 1).toLowerCase() + name.substring(1);
|
|
|
+ Object value = method.invoke(t);
|
|
|
+ map.put(name,value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ l.add(map);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return l;
|
|
|
+ }
|
|
|
+}
|