Commit 94bb9c1f authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_tzs_register
parents a17a39ad a42a913a
package com.yeejoin.amos.boot.module.jg.api.enums;
import lombok.Getter;
import org.apache.commons.compress.utils.Lists;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* 业务类型枚举
*
* @author Administrator
*/
@Getter
public enum CompanyTypeEnum {
/**
* 单位类型枚举
*/
SUPERVISION("supervision","supervision", "监管机构"),
USE("company","use", "使用单位"),
DESIGN("company","design", "设计单位"),
MANUFACTURE("company","manufacture", "制造单位"),
FILLING("company","filling", "充装单位"),
INDIVIDUAL("company","individual", "个人"),
CONSTRUCTION("company","construction", "安装改造维修单位"),
INSPECTION("company","inspection", "检验检测机构");
private final String level;
private final String code;
private final String name;
CompanyTypeEnum(String level, String code, String name) {
this.level = level;
this.code = code;
this.name = name;
}
public static String getNameByType(String code) {
String name = null;
for (CompanyTypeEnum enumOne : CompanyTypeEnum.values()) {
if (enumOne.getCode().equals(code)) {
name = enumOne.getName();
break;
}
}
return name;
}
public static String decideCompanyLevel(String str) {
List<CompanyTypeEnum> typeList = getCompanyTypeEnums(str);
if (typeList == null) return null;
String result;
Set<String> set = new HashSet<>();
for (CompanyTypeEnum one : typeList) {
set.add(one.getLevel());
}
result = String.join(",", set);
return result;
}
private static List<CompanyTypeEnum> getCompanyTypeEnums(String str) {
if (ValidationUtil.isEmpty(str)) {
return null;
}
String companyType = null;
List<CompanyTypeEnum> typeList = Lists.newArrayList();
for (CompanyTypeEnum enumOne : CompanyTypeEnum.values()) {
if (str.contains(enumOne.getName())) {
typeList.add(enumOne);
}
}
if (ValidationUtil.isEmpty(typeList)) {
return null;
}
return typeList;
}
public static String decideCompanyCode(String str) {
List<CompanyTypeEnum> typeList = getCompanyTypeEnums(str);
if (typeList == null) return null;
String result;
Set<String> set = new HashSet<>();
for (CompanyTypeEnum one : typeList) {
set.add(one.getCode());
}
result = String.join(",", set);
return result;
}
public static String decideCompanyType(String str) {
List<CompanyTypeEnum> typeList = getCompanyTypeEnums(str);
if (typeList == null) return null;
String result;
Set<String> set = new HashSet<>();
for (CompanyTypeEnum one : typeList) {
set.add(one.getName());
}
result = String.join(",", set);
return result;
}
}
......@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgMaintenanceContractDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract;
import com.yeejoin.amos.boot.module.jg.api.vo.EquipMessageVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......
......@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import netscape.javascript.JSObject;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
......@@ -69,4 +68,11 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
* @return pdf文件路径
*/
void generateInstallationNoticeReport(Long sequenceNbr, HttpServletResponse response);
/**
* 获取登录人所在企业类型
*
* @return
*/
Map<String,Object> getCompanyType();
}
......@@ -51,9 +51,15 @@
AND isn.receive_org_credit_code = #{orgCode}
AND isn.instance_id is not null
</if>
<if test="type == 'enterprise'">
<if test="type == 'company'">
AND isn.install_unit_credit_code = #{orgCode}
</if>
<if test="type == 'testAdmin'">
((AND isn.receive_org_credit_code = #{orgCode}
AND isn.instance_id is not null)
or
AND isn.install_unit_credit_code = #{orgCode})
</if>
</where>
ORDER BY
isn.create_date DESC
......
......@@ -3,27 +3,20 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javafx.scene.chart.ValueAxis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -199,8 +192,4 @@ public class CommonController extends BaseController {
return ResponseHelper.buildResponse("");
}
}
......@@ -12,7 +12,6 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import netscape.javascript.JSObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -135,6 +134,7 @@ public class JgInstallationNoticeController extends BaseController {
) {
Page<JgInstallationNotice> page = new Page<>(current, size);
ReginParams reginParams = getSelectedOrgInfo();
type = (String) iJgInstallationNoticeService.getCompanyType().get("companyType");
return ResponseHelper.buildResponse(iJgInstallationNoticeService.queryForJgInstallationNoticePage(page, model, type, reginParams));
}
......
......@@ -10,7 +10,6 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto;
......@@ -20,6 +19,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
......@@ -38,6 +38,7 @@ import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import com.yeejoin.amos.feign.workflow.Workflow;
......@@ -889,3 +890,34 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
@Override
public Map<String, Object> getCompanyType() {
Map<String, Object> result = new HashMap<>();
result.put("companyType", "");
List<CompanyModel> companyModels = FeignUtil.remoteCall(() -> Privilege.companyClient.queryListByChild(RequestContext.getExeUserId()));
if (companyModels.isEmpty()) {
return result;
}
CompanyModel currentCompany = companyModels.get(0);
result.put("creditCode", currentCompany.getCompanyCode());
String companyLevel = CompanyTypeEnum.decideCompanyLevel(currentCompany.getCompanyType());
String companyType = CompanyTypeEnum.decideCompanyCode(currentCompany.getCompanyType());
String companyTypeName = CompanyTypeEnum.decideCompanyType(currentCompany.getCompanyType());
if (!ValidationUtil.isEmpty(companyLevel)) {
result.put("companyLevel", companyLevel);
if (companyLevel.contains(",")) {
result.put("companyLevel", "testAdmin");
}
}
if (!ValidationUtil.isEmpty(companyType)) {
result.put("companyType", companyType);
}
if (!ValidationUtil.isEmpty(companyTypeName)) {
result.put("companyTypeName", companyTypeName);
}
return result;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment