Commit fe1e188b authored by suhuiguang's avatar suhuiguang

1.大屏-详情-检验检测-监查值守接口迁移

parent c898d6ea
......@@ -134,26 +134,6 @@ public class JyjcInspectionApplicationController extends BaseController {
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.selectBySeq(sequenceNbr, getSelectedOrgInfo().getCompany().getCompanyType()));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/selectOneForBigScreen/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<Map<String, Object>> selectOneForBigScreen(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.selectOneForBigScreen(sequenceNbr, getSelectedOrgInfo().getCompany().getCompanyType()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/selectOneForBigScreenEqu/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<Page> selectOneForBigScreenEqu(@PathVariable Long sequenceNbr,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
return ResponseHelper.buildResponse(jyjcInspectionApplicationServiceImpl.selectOneForBigScreenEqu(current, size, sequenceNbr, getSelectedOrgInfo().getCompany().getCompanyType()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/pageList")
......
......@@ -19,7 +19,6 @@ import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.jyjc.api.entity.*;
import com.yeejoin.amos.boot.module.jyjc.api.enums.*;
import com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcBaseMapper;
......@@ -46,7 +45,6 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
......@@ -70,20 +68,16 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
/**
* 服务实现类
......@@ -135,8 +129,6 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
@Value("classpath:/json/bizTypeInfo.json")
private Resource bizTypeInfo;
@Value("classpath:/json/bigScreenDetail.json")
private Resource bigScreenDetail;
@Autowired
private JyjcInspectionApplicationEquipMapper jyjcInspectionApplicationEquipMapper;
......@@ -580,81 +572,6 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
this.setPlanData(sequenceNbr, map);
return map;
}
public Map<String, Object> selectOneForBigScreen(Long sequenceNbr, String companyType) {
JyjcInspectionApplicationModel model = this.getBaseMapper().selectDataBySeq(sequenceNbr);
Map<String, Object> map = BeanUtil.beanToMap(model);
// 附件
Map<String, Object> attMap = getAttachmentMap(sequenceNbr);
// 设备
List<Map<String, Object>> arrayList = getEquipInfoList(sequenceNbr);
map.put("equip", arrayList);
map.putAll(attMap);
map.put("companyType", companyType);
this.setPlanData(sequenceNbr, map);
Map<String,Object> resultMap = new HashMap<>();
Map<String, Object> workflowResult = workflowFeignService.getFlowLogger(model.getProcessInstanceId()).getResult();
ArrayList<Map<String, Object>> flowLogger = (ArrayList) workflowResult.get("flowLogger");
ArrayList<Map<String, Object>> records = new ArrayList<>();
List<FormValue> jsonData = getJsonData(bigScreenDetail);
jsonData.forEach(f -> {
Object o = map.get(f.getKey());
if (!ObjectUtils.isEmpty(o)) {
if (f.getKey().equals("applicationDate")){
try {
f.setValue(DateUtil.formatDate((Date) o, DateUtil.Y_M_D));
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
f.setValue(o.toString());
}
}
});
if(!CollectionUtils.isEmpty(flowLogger)){
for(int i = flowLogger.size()-1;i>=0;i--){
HashMap<String, Object> data = new HashMap<>();
data.put("label", flowLogger.get(i).get("approvalStatue"));
data.put("operatingTime", flowLogger.get(i).get("operateDate"));
if(null != flowLogger.get(i).get("assignee")) {
data.put("operater", ((Map<String, Object>) flowLogger.get(i).get("assignee")).get("orgNamesWithoutRole") + "【" + flowLogger.get(i).get("taskName") + "】");
}else if(null != flowLogger.get(i).get("companyName")){
data.put("operater", flowLogger.get(i).get("companyName") + "【" + flowLogger.get(i).get("taskName") + "】");
}
records.add(data);
}
}
HashMap<String, Object> datas = new HashMap<>();
datas.put("datas", records);
datas.put("title", "审批进度");
datas.put("renderType", "timeline");
resultMap.put("title", map.get("applicationUnitName"));
resultMap.put("infoRecords", datas);
resultMap.put("keyParams", jsonData);
return resultMap;
}
public Page selectOneForBigScreenEqu(int current, int size, Long sequenceNbr, String companyType) {
// 设备
List<Map<String, Object>> arrayList = getEquipInfoList(sequenceNbr);
Page<Map<String, Object>> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
page.setTotal(arrayList.size());
page.setRecords(arrayList.subList((current - 1) * size, arrayList.size() > current * size ? current * size : arrayList.size()));
return page;
}
private List<FormValue> getJsonData(Resource resource) {
String json;
try {
json = IOUtils.toString(resource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(e);
}
return parseArray(json, FormValue.class);
}
private List<Map<String, Object>> getEquipInfoList(Long sequenceNbr) {
Iterable<ESEquipmentCategoryDto> equips = getEsEquipmentCategoryDtos(sequenceNbr);
......
package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.EnterpriseDetailServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
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;
/**
* @author Administrator
*/
@RestController
@RequestMapping(value = "/dp/enterprise")
@Api(tags = "大屏-企业-详情API")
public class EnterpriseDetailController {
private EnterpriseDetailServiceImpl enterpriseDetailService;
public EnterpriseDetailController(EnterpriseDetailServiceImpl enterpriseDetailService) {
this.enterpriseDetailService = enterpriseDetailService;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/page", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<IPage<TzBaseEnterpriseInfoDto>> page(PageParam pageParam,
TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto) {
return ResponseHelper.buildResponse(enterpriseDetailService.page(pageParam, tzBaseEnterpriseInfoDto));
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.InspectionDetailServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.Map;
/**
* @author Administrator
*/
@RestController
@RequestMapping("/dp/inspection-detail")
@Api(tags = "大屏检验检测-详情API")
public class InspectionDetailController extends BaseController {
private InspectionDetailServiceImpl inspectionDetailService;
public InspectionDetailController(InspectionDetailServiceImpl inspectionDetailService) {
this.inspectionDetailService = inspectionDetailService;
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/selectOneForBigScreen/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<Map<String, Object>> selectOneForBigScreen(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(inspectionDetailService.selectOneForBigScreen(sequenceNbr, getSelectedOrgInfo().getCompany().getCompanyType()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/selectOneForBigScreenEqu/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<Page> selectOneForBigScreenEqu(@PathVariable Long sequenceNbr,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
return ResponseHelper.buildResponse(inspectionDetailService.selectOneForBigScreenEqu(current, size, sequenceNbr, getSelectedOrgInfo().getCompany().getCompanyType()));
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.List;
/**
* @author Administrator
*/
@Service
public class EnterpriseDetailServiceImpl {
private RedisUtils redisUtils;
private StCommonServiceImpl stCommonService;
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
public EnterpriseDetailServiceImpl(RedisUtils redisUtils, StCommonServiceImpl stCommonService, TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper) {
this.redisUtils = redisUtils;
this.stCommonService = stCommonService;
this.tzBaseEnterpriseInfoMapper = tzBaseEnterpriseInfoMapper;
}
public IPage<TzBaseEnterpriseInfoDto> page(PageParam pageParam, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto) {
List<String> orgCodeList = new ArrayList<>();
if (tzBaseEnterpriseInfoDto.getSuperviseKey() != null) {
FeignClientResult<CompanyModel> result = Privilege.companyClient
.seleteOne(Long.valueOf(tzBaseEnterpriseInfoDto.getSuperviseKey()));
if (result.getResult() != null) {
tzBaseEnterpriseInfoDto.setSuperviseOrgCode(result.getResult().getOrgCode());
}
}
Page<TzBaseEnterpriseInfoDto> page = new Page<>(pageParam.getCurrent(), pageParam.getSize());
List<JSONObject> companyType1 = this.getCompanyType();
if (!ValidationUtil.isEmpty(companyType1)) {
for (JSONObject jsonObject : companyType1) {
String orgCode = jsonObject.getString("orgCode");
if (!ValidationUtil.isEmpty(orgCode)) {
orgCodeList.add(orgCode);
}
}
}
if (tzBaseEnterpriseInfoDto.getCityCode() != null) {
String orgCode = stCommonService.getAndSetOrgCode(tzBaseEnterpriseInfoDto.getCityCode());
if (orgCode == null) {
return page;
}
orgCodeList.add(orgCode);
}
return tzBaseEnterpriseInfoMapper.pageList2(page, tzBaseEnterpriseInfoDto, orgCodeList);
}
/**
* 获取当前登录人单位类型
*
* @return
*/
public List<JSONObject> getCompanyType() {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<CompanyModel> companys = reginParams.getUserModel().getCompanys();
List<JSONObject> objectList = new ArrayList<>();
for (CompanyModel company : companys) {
JSONObject object = new JSONObject();
object.put("level", company.getLevel());
object.put("orgCode", company.getOrgCode());
object.put("companyCode", company.getCompanyCode());
objectList.add(object);
}
return objectList;
}
}
[
{ "key": "applicationNo", "label": "报检单号" , "type": "text"},
{ "key": "applicationDate", "label": "报检日期" , "type": "text"},
{ "key": "inspectionTypeName", "label": "检验类型" , "type": "text"},
{ "key": "applicationUnitName", "label": "申报单位名称" , "type": "text"},
{ "key": "applicationUnitCode", "label": "单位统一信用代码" , "type": "text"},
{ "key": "address", "label": "单位地址" , "type": "text"},
{ "key": "superviseOrgName", "label": "监管单位名称" , "type": "text"},
{ "key": "applicationContactName", "label": "单位联系人" , "type": "text"},
{ "key": "applicationContactPhone", "label": "联系电话" , "type": "text"},
{ "key": "inspectionUnitName", "label": "检验机构名称" , "type": "text"},
{ "key": "applicationRemark", "label": "备注" , "type": "text"}
]
\ No newline at end of file
......@@ -305,4 +305,7 @@ public class TzBaseEnterpriseInfoDto extends BaseDto {
@ApiModelProperty(value = "use_code下滑线use_unit")
private String useCodeAndName;
@ApiModelProperty(value = "单位所在城市Code")
private String cityCode;
}
......@@ -52,6 +52,16 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
/**
* 监查值守迁移接口
* @param page 分页参数
* @param tzBaseEnterpriseInfoDto 筛选条件
* @param orgCodeList 机构
* @return 分页
*/
IPage<TzBaseEnterpriseInfoDto> pageList2(Page<TzBaseEnterpriseInfoDto> page, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, List orgCodeList);
/**
* 查找企业关联设备详情列表
*/
List<TzBaseEnterpriseInfoDto> getInspectionUnitList(String openBizType);
......
......@@ -84,6 +84,66 @@
</select>
<select id="pageList2"
resultType="com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto">
SELECT
*,
CONCAT(province,'/',city,'/',district) AS region,
CONCAT(street,'/',address) AS full_address
FROM
tz_base_enterprise_info
<where>
<if
test="tzBaseEnterpriseInfoDto.unitType!=null and tzBaseEnterpriseInfoDto.unitType!='' ">
AND unit_type LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.unitType},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.useUnit!=null and tzBaseEnterpriseInfoDto.useUnit!='' ">
AND use_unit LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.useUnit},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.useUnitCertificate!=null and tzBaseEnterpriseInfoDto.useUnitCertificate!='' ">
AND use_unit_certificate = #{tzBaseEnterpriseInfoDto.useUnitCertificate}
</if>
<if
test="tzBaseEnterpriseInfoDto.useCode!=null and tzBaseEnterpriseInfoDto.useCode!='' ">
AND use_code LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.useCode},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.region!=null and tzBaseEnterpriseInfoDto.region!='' ">
AND CONCAT(province,'/',city,'/',district) LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.region},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.legalPerson!=null and tzBaseEnterpriseInfoDto.legalPerson!='' ">
AND legal_person LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.legalPerson},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.legalPhone!=null and tzBaseEnterpriseInfoDto.legalPhone!='' ">
AND legal_phone LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.legalPhone},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.superviseOrgCode!=null and tzBaseEnterpriseInfoDto.superviseOrgCode!='' ">
AND supervise_org_code LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.superviseOrgCode},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.address!=null and tzBaseEnterpriseInfoDto.address!='' ">
AND address LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.address},'%')
</if>
<if test="tzBaseEnterpriseInfoDto.regulatoryLabels!=null and tzBaseEnterpriseInfoDto.regulatoryLabels!='' ">
AND regulatory_labels LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.regulatoryLabels},'%')
</if>
<if test="orgCodeList != null and !orgCodeList.isEmpty()">
AND (
<foreach collection="orgCodeList" item="item" separator=" OR ">
supervise_org_code LIKE CONCAT('%', #{item}, '%')
</foreach>
)
</if>
AND is_delete = 0
</where>
order by rec_date desc
</select>
<select id="pageList"
resultType="com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto">
......
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