Commit 9118fe96 authored by 王果's avatar 王果

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/JyjcInspectionResultServiceImpl.java
parents f86a4fca 792c9b7d
......@@ -12,10 +12,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
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.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.privilege.model.*;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.ObjectUtils;
......@@ -41,10 +38,12 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* controller层切面 用于用户数据缓存 供 sql自动填充使用 (使用粒度过大的Aop会创建大量代理对象,影响性能,占用内存,考虑使用
......@@ -283,6 +282,14 @@ public class ControllerAop {
stopWatch5.stop();
logger.info("获取用户信息====>{}s", stopWatch5.getTotalTimeSeconds());
List<String> appCodes = new ArrayList<>();
try {
List<ApplicationModel> applicationModelList = Privilege.agencyUserClient.listApps(userList.get(0).getUserId()).getResult();
appCodes = applicationModelList.stream().map(ApplicationModel::getAppCode).collect(Collectors.toList());
} catch (Exception e) {
throw new RuntimeException("获取listApps失败");
}
userList.get(0).setAppCodes(appCodes);
ReginParams regionParams = new ReginParams();
regionParams.setCompany(company);
regionParams.setRole(role);
......
......@@ -62,10 +62,10 @@
isn.install_leader_name AS installLeaderName,
isn.install_leader_phone AS installLeaderPhone,
isn.use_unit_name AS useUnitName,
isn.equ_register_code AS equRegisterCode,
ri.equ_list AS equList,
ri.equ_category AS equCategory,
ri.EQU_DEFINE AS equDefine,
-- 产品编号
ri.product_name AS productName,
ri.brand_name AS brandName,
ri.equ_type AS equType,
......@@ -90,7 +90,13 @@
fi.produce_country AS produceCountry,
fi.factory_standard AS factoryStandard,
fi.product_quality_yield_prove AS productQualityYieldProve,
fi.ins_use_maintain_explain AS insUseMaintainExplain
fi.ins_use_maintain_explain AS insUseMaintainExplain,
ui.safety_manager AS safetyManager,
ui.phone AS safetyManagerPhone,
ui.PROVINCE_NAME AS useUnitProvinceName,
ui.CITY_NAME AS useUnitCityName,
ui.COUNTY_NAME AS useUnitCountyName,
ui.ADDRESS AS useUnitAddress
FROM
tzs_jg_installation_notice isn
LEFT JOIN tzs_jg_relation_equip re ON re.business_id = isn.sequence_nbr
......@@ -98,7 +104,9 @@
LEFT JOIN idx_biz_jg_design_info di ON di.record = re.equip_id
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equip_id
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equip_id
LEFT JOIN idx_biz_jg_use_info ui ON ui.record = re.equip_id
WHERE
isn.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select>
</mapper>
......@@ -310,7 +310,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
placeholders.put("applyNo", getValue.apply("applyNo"));
placeholders.put("productName", getValue.apply("productName"));
placeholders.put("equipType", getValue.apply("equType"));
placeholders.put("equipCode", getValue.apply("equipCode")); // TODO: 设备代码
placeholders.put("equipCode", getValue.apply("equRegisterCode"));
placeholders.put("produceCode", getValue.apply("produceCode")); // TODO: 制造编号
placeholders.put("produceUnitName", getValue.apply("produceUnitName"));
placeholders.put("produceLicenseNum", getValue.apply("produceLicenseNum"));
......@@ -321,11 +321,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
placeholders.put("installLicenseExpirationDate", getValue.apply("installLicenseExpirationDate"));
placeholders.put("installLeaderName", getValue.apply("installLeaderName"));
placeholders.put("installLeaderPhone", getValue.apply("installLeaderPhone"));
placeholders.put("installUnitAddress", getValue.apply("useUnitName")); // TODO: 施工单位地址
placeholders.put("installUnitAddress", getValue.apply("installUnitAddress")); // TODO: 施工单位地址
placeholders.put("useUnitName", getValue.apply("useUnitName"));
placeholders.put("useUnitLeaderName", getValue.apply("useUnitLeaderName")); // TODO: 使用单位联系人
placeholders.put("useUnitLeaderPhone", getValue.apply("useUnitLeaderPhone")); // TODO: 使用单位联系人电话
placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitLeaderAddress")); // TODO: 使用单位联系人地址
placeholders.put("useUnitLeaderName", getValue.apply("safetyManager"));
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitProvinceName") + getValue.apply("useUnitCityName") + getValue.apply("useUnitCountyName") + getValue.apply("useUnitAddress"));
// 生成二维码
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
......
......@@ -66,7 +66,6 @@ public class WordTemplateUtils {
// 获取模板, 生成Word文档
Template freemarkerTemplate = configuration.getTemplate(templatePath, "UTF-8");
map = new HashMap<>(map);
File docFile = createDoc(templatePath, map, freemarkerTemplate);
// 转换Word文档
......
......@@ -7,6 +7,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
import java.util.Map;
/**
*
*
......@@ -45,4 +48,10 @@ public class JyjcInspectionResultAttachment extends BaseEntity {
@TableField("remark")
private String remark;
/**
* 附件地址
*/
@TableField(exist = false)
private List<Object> attachmentUrlList;
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -66,6 +67,7 @@ public class JyjcOpeningApplication extends BaseEntity {
* 有效期至
*/
@TableField("expiry_date")
@JsonFormat (pattern = "yyyy-MM-dd")
private Date expiryDate;
/**
......
......@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
import org.springframework.data.repository.query.Param;
import java.util.Map;
/**
* Mapper 接口
*
......@@ -18,4 +21,6 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
public Page<JyjcInspectionApplication> queryForDataList( Page<JyjcInspectionApplication> page, String applicationNo, String inspectionClassify, String applicationUnitCode,String applicationUnitName, String equipClassify, String inspectionUnitCode,String inspectionUnitName, String applicationDate, String acceptDate, String inspectionChargePerson, String status , String bizType);
Page<JyjcInspectionApplicationEquipModel> listByCategory(Page<JyjcInspectionApplicationEquipModel> page,@Param("equipClassify") String equipClassify);
JyjcInspectionApplicationModel selectDataBySeq(Long sequenceNbr);
}
......@@ -66,6 +66,12 @@ public class JyjcInspectionApplicationModel extends BaseModel {
@ApiModelProperty(value = "报检单位编号")
private String applicationUnitCode;
@ApiModelProperty(value = "报检单位名称")
private String applicationUnitName;
@ApiModelProperty(value = "报检单位地址")
private String address;
@ApiModelProperty(value = "监管单位名称")
private String superviseOrgName;
@ApiModelProperty(value = "包含设备数量(冗余)")
private Integer numberOfEquip;
......@@ -96,7 +102,7 @@ public class JyjcInspectionApplicationModel extends BaseModel {
@ApiModelProperty(value = "操作类型 0 新增 2 编辑 1 暂存")
private String workflowNode;
@ApiModelProperty(value = "告知书")
private List<Map<String,Object>> gzs;
@ApiModelProperty(value = "产品质量证明书")
......
......@@ -128,9 +128,6 @@ public class JyjcInspectionResultModel extends BaseModel {
@ApiModelProperty(value = "检验结果技术参数")
private Map<String,Object> resultParamModelMap;
@ApiModelProperty(value = "检验结果附件")
private List<Map<String,Object>> resultAttachmentModelList;
@ApiModelProperty(value = "附件类型(特种设备检验报告:1,监检证书:2)")
private String attachmentType;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jyjc.api.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
......@@ -44,6 +45,7 @@ public class JyjcOpeningApplicationModel extends BaseModel {
private String resultType;
@ApiModelProperty (value = "有效期至")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date expiryDate;
@ApiModelProperty (value = "受理日期(接收日期)")
......
......@@ -89,4 +89,16 @@
</if>
</where>
</select>
<select id="selectDataBySeq" resultType="com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel">
SELECT
tzjia.*,
tbei.supervise_org_name AS superviseOrgName,
tbei.use_unit AS applicationUnitName,
tbei.address AS address
FROM
tz_jyjc_inspection_application AS tzjia
LEFT JOIN tz_base_enterprise_info tbei ON tzjia.application_unit_code = tbei.use_code
WHERE
tzjia.sequence_nbr = #{sequenceNbr}
</select>
</mapper>
......@@ -144,10 +144,11 @@ public class JyjcInspectionResultController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/updateResult")
@ApiOperation(httpMethod = "PUT", value = "检验结果-上传结果和编辑结果", notes = "检验结果-上传结果和编辑结果")
public ResponseModel<JyjcInspectionResultModel> updateJyjcInspectionResult(@RequestBody JyjcInspectionResultModel model) {
public ResponseModel<JyjcInspectionResultModel> updateJyjcInspectionResult(@RequestBody Map<String, Map<String, Object>> model) {
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.updateJyjcInspectionResult(model));
}
/**
* 获取设备种类列表
*
......
......@@ -205,8 +205,8 @@ public class JyjcOpeningApplicationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "撤回业务开通申请", notes = "撤回业务开通申请")
@GetMapping(value = "/rollBackFlow")
public void overflow( @RequestParam("instanceId") String instanceId) {
jyjcOpeningApplicationServiceImpl.stopFlow(instanceId);
public void overflow( @RequestParam("sequenceNbr") String sequenceNbr) {
jyjcOpeningApplicationServiceImpl.stopFlow(sequenceNbr);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -3,10 +3,13 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.enums.WorkFlowEnum;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplicationEquip;
......@@ -206,12 +209,14 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
public Map<String,Object> selectBySeq(Long sequenceNbr) {
JyjcInspectionApplicationModel model = this.queryBySeq(sequenceNbr);
JyjcInspectionApplicationModel model = this.getBaseMapper().selectDataBySeq(sequenceNbr);
Map<String, Object> map = BeanUtil.beanToMap(model);
List<Map<String, Object>> dataByApplicationSeq = jyjcInspectionApplicationAttachmentService.getBaseMapper().getDataByApplicationSeq(sequenceNbr);
Map<String, Object> attMap = new HashMap<>();
for (Map<String, Object> maps : dataByApplicationSeq) {
attMap.put(maps.get("attachment_type").toString(),maps.get("attachment_url"));
List<AttachmentDto> data = JSONArray.parseArray(maps.get("attachment_url").toString(), AttachmentDto.class);
attMap.put(maps.get("attachment_type").toString(),data);
}
map.putAll(attMap);
return map;
......@@ -312,7 +317,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
public void doRollback(String instanceId) {
try {
// 撤回流程
FeignClientResult feignClientResult = Workflow.taskV2Client.rollBack(instanceId);
FeignClientResult feignClientResult =new FeignClientResult();
if (ObjectUtils.isEmpty(feignClientResult)) {
}
......
......@@ -2,12 +2,12 @@ package com.yeejoin.amos.boot.module.jyjc.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.alibaba.fastjson.JSONArray;
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.jyjc.api.entity.InspectionDetectionInfo;
import com.yeejoin.amos.boot.module.jyjc.api.common.StringUtil;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultAttachment;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResultParam;
......@@ -18,18 +18,17 @@ import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultAttach
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultParamService;
import com.yeejoin.amos.boot.module.jyjc.api.service.IJyjcInspectionResultService;
import com.yeejoin.amos.boot.module.jyjc.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.CategoryOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -67,11 +66,6 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
@Autowired
private RedisUtils redisUtils;
@Autowired
CategoryOtherInfoMapper categoryOtherInfoMapper;
@Autowired
InspectionDetectionInfoServiceImpl inspectionDetectionInfoService;
/**
* 检验检测单位分页查询
*/
......@@ -99,55 +93,35 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
}
@Transactional
public JyjcInspectionResultModel updateJyjcInspectionResult(JyjcInspectionResultModel model) {
public JyjcInspectionResultModel updateJyjcInspectionResult(Map<String, Map<String, Object>> tableModel) {
Map<String, Object> map = tableModel.get("inspectResult");
JyjcInspectionResultModel model = BeanUtil.mapToBean(map, JyjcInspectionResultModel.class, true);
updateWithModel(model);
if (!CollectionUtils.isEmpty(model.getResultAttachmentModelList())){
JyjcInspectionResultAttachment attachment = new JyjcInspectionResultAttachment();
attachment.setResultSeq(model.getSequenceNbr());
attachment.setAttachmentUrl(JSON.toJSONString(model.getResultAttachmentModelList()));
attachment.setAttachmentType(model.getAttachmentType());
attachmentService.save(attachment);
List<JyjcInspectionResultAttachment> attachmentList = new ArrayList<>();
map.forEach((k, v) -> {
if (k.contains("JYJC_") && !ObjectUtils.isEmpty(map.get(k))) {
JyjcInspectionResultAttachment attachment = new JyjcInspectionResultAttachment();
attachment.setResultSeq(model.getSequenceNbr());
attachment.setAttachmentUrl(JSON.toJSONString(map.get(k)));
attachment.setAttachmentType(k);
attachmentList.add(attachment);
}
});
if (!CollectionUtils.isEmpty(attachmentList)) {
attachmentService.saveBatch(attachmentList);
}
if (!CollectionUtils.isEmpty(model.getResultParamModelMap())){
JyjcInspectionResultParam resultParam = new JyjcInspectionResultParam();
resultParam.setResultSeq(model.getSequenceNbr());
resultParam.setParamJson(JSON.toJSONString(model.getResultParamModelMap()));
resultParamService.save(resultParam);
}
InspectionDetectionInfo info = new InspectionDetectionInfo();
QueryWrapper<InspectionDetectionInfo> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(InspectionDetectionInfo::getInspectReportNo,model.getResultNo());
List<InspectionDetectionInfo> list = inspectionDetectionInfoService.list(wrapper);
if(CollectionUtils.isEmpty(list)){
QueryWrapper<CategoryOtherInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(CategoryOtherInfo::getSupervisoryCode,model.getEquipUnicode());
List<CategoryOtherInfo> otherInfos = categoryOtherInfoMapper.selectList(queryWrapper);
if(!CollectionUtils.isEmpty(otherInfos)){
info.setRecord(otherInfos.get(0).getRecord());
}
}else{
info = list.get(0);
}
extracted(model, info);
inspectionDetectionInfoService.save(info);
return model;
}
private void extracted(JyjcInspectionResultModel model, InspectionDetectionInfo info) {
info.setInspectType(model.getInspectionType());
info.setInspectOrgName(model.getInspectionUnitCode());
info.setInspectReport(JSON.toJSONString(model.getResultAttachmentModelList()));
info.setInspectDate(model.getInspectionDate());
info.setInspectConclusion(model.getInspectionConclusion());
info.setProblemRemark(model.getNonConformance());
info.setNextInspectDate(model.getNextInspectionDate());
info.setSequenceCode(model.getEquipUnicode());
info.setInspectOrgCode(model.getUseUnitCreditCode());
info.setInspectReportNo(model.getResultNo());
}
/**
* 列表查询 示例
*/
......@@ -167,7 +141,12 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
// 获取附件
List<JyjcInspectionResultAttachment> attachmentList = iJyjcInspectionResultAttachmentService.getObjByResultSeq(sequenceNbr);
if (!CollectionUtils.isEmpty(attachmentList)) {
Map<String, Object> attachmentMap = attachmentList.stream().collect(Collectors.toMap(JyjcInspectionResultAttachment::getAttachmentType, JyjcInspectionResultAttachment::getAttachmentUrl));
Map<String, Object> attachmentMap = attachmentList.stream().map(obj -> {
if (StringUtil.isNotEmpty(obj.getAttachmentUrl())) {
obj.setAttachmentUrlList(JSONArray.parseArray(obj.getAttachmentUrl()));
}
return obj;
}).collect(Collectors.toMap(JyjcInspectionResultAttachment::getAttachmentType, JyjcInspectionResultAttachment::getAttachmentUrlList));
map.putAll(attachmentMap);
}
......
......@@ -193,9 +193,9 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
public Page<JyjcOpeningApplicationModel> querypageForCompany(Page<JyjcOpeningApplication> page, JyjcOpeningApplicationRequstDto jyjcOpeningApplicationRequstDto) {
//根据申请单中的单位信息对于列表数据进行过滤
CompanyBo companyBo = commonserviceImpl.getReginParamsOfCurrentUser().getCompany();
if (companyBo.getLevel().equals("company")) {
// if (companyBo.getLevel().equals("company")) {
jyjcOpeningApplicationRequstDto.setUnitCode(companyBo.getCompanyCode());
}
// }
String applyStartTime = "";
String applyEndTime = "";
......@@ -221,13 +221,15 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
if (ValidationUtil.isEmpty(reginParams.getCompany())) {
throw new RuntimeException("未指定人员归属单位信息");
}
String unitCode;
JyjcOpeningApplicationModel jyjcOpeningApplicationModel;
if (null != sequenceNbr) {
jyjcOpeningApplicationModel = this.queryBySeq(sequenceNbr);
unitCode = jyjcOpeningApplicationModel.getUnitCode();
} else {
jyjcOpeningApplicationModel = new JyjcOpeningApplicationModel();
unitCode = reginParams.getCompany().getCompanyCode();
}
String unitCode = reginParams.getCompany().getCompanyCode();
// unitCode = "91611103MAC4Q1EG7B"; // 测试用,之后务必删除!!!
QueryWrapper enterpriseInfoQueryWrapper = new QueryWrapper<>();
enterpriseInfoQueryWrapper.eq("use_code", unitCode);
......@@ -290,15 +292,24 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
dto.setProcessDefinitionKey(processDefinitionKey);
dto.setBusinessKey(StringUtils.defaultString(businessKey, "1"));
// dto.setCompleteFirstTask(true);
FeignClientResult ajaxResult = Workflow.taskV2Client.startByVariable(dto);
// FeignClientResult ajaxResult = Workflow.taskV2Client.startByVariable(dto);
//
// if (log.isDebugEnabled()) {
// log.debug("开启工作流结果:{}", ajaxResult);
// }
// if (ajaxResult == null || 200 != ajaxResult.getStatus()) {
// throw new BaseException("开启工作流错误");
// }
// return ((Map) ajaxResult.getResult()).get("id").toString();
// V1
AjaxResult ajaxResult = Workflow.taskClient.startByVariable(dto);
if (log.isDebugEnabled()) {
log.debug("开启工作流结果:{}", ajaxResult);
}
if (ajaxResult == null || 200 != ajaxResult.getStatus()) {
if (ajaxResult == null || (ajaxResult.get(AjaxResult.CODE_TAG) != null && !"200".equals(ajaxResult.get(AjaxResult.CODE_TAG).toString()))) {
throw new BaseException("开启工作流错误");
}
return ((Map) ajaxResult.getResult()).get("id").toString();
return ((Map) ajaxResult.get("data")).get("id").toString();
}
/**
......@@ -347,14 +358,15 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
/**
* 撤回流程办理单
*/
public void stopFlow(String instanceId) {
public void stopFlow(String sequenceNbr) {
JyjcOpeningApplication jyjcOpeningApplication = jyjcOpeningApplicationMapper.selectById(sequenceNbr);
try {
//撤回流程
JSONObject jsonObject = workflowFeignClient.rollBack(instanceId);
JSONObject jsonObject = workflowFeignClient.rollBack(jyjcOpeningApplication.getWorkflowProstanceId());
if (ObjectUtils.isEmpty(jsonObject)) {
}
updateModelByInstanceId(instanceId, FlowStatusEnum.ROLLBACK.getCode() + "");
updateModelByInstanceId(jyjcOpeningApplication.getWorkflowProstanceId(), FlowStatusEnum.ROLLBACK.getCode() + "");
} catch (Exception e) {
e.printStackTrace();
}
......
package com.yeejoin.amos.boot.module.tcm.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor
@Getter
public enum PersonManageRoleEnum {
/**
* 人员管理角色枚举
*/
code("人员管理角色字典code", 6616L),
use("使用单位", 1735591519093547010L),
agw("安装改造维修单位", 1735591458058035201L),
jyjc("检验检测机构", 1735590873120399362L);
String name;
Long id;
public static Map<Long, String> getName = new HashMap<>();
public static Map<String, Long> getId = new HashMap<>();
static {
for (PersonManageRoleEnum e : PersonManageRoleEnum.values()) {
getName.put(e.id, e.name);
getId.put(e.name, e.id);
}
}
}
......@@ -31,4 +31,8 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
List<GroupAndPersonInfoDto> getUnitInfoByUserId(Long groupId);
String selectPostNameByUserId(String userId);
List<Map<String, Object>> getUserTypeList(@Param(value = "typeList") List<String> typeList);
String selectCompanyTypeById(Long companySeq);
}
......@@ -211,4 +211,21 @@
<select id="selectPostNameByUserId" resultType="java.lang.String">
SELECT post_name FROM "tzs_user_info" WHERE amos_user_id = #{userId}
</select>
<select id="getUserTypeList" resultType="java.util.Map">
SELECT
*
FROM
"cb_data_dictionary"
WHERE
type in
<foreach collection="typeList" separator="," item="type" open="(" close=")">
#{type}
</foreach>
</select>
<select id="selectCompanyTypeById" resultType="java.lang.String">
select company_type from privilege_company where sequence_nbr = #{companySeq}
</select>
</mapper>
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
......@@ -82,7 +83,7 @@ public class TzsUserInfoController extends BaseController {
if (ObjectUtils.isEmpty(reginParams)) {
return null;
}
CompanyModel companyModel = reginParams.getUserModel().getCompanys().get(0);
CompanyBo companyModel = reginParams.getCompany();
if(ObjectUtils.isEmpty(companyModel)){
throw new BadRequest("未指定人员归属单位信息");
}
......@@ -218,11 +219,11 @@ public class TzsUserInfoController extends BaseController {
if (ObjectUtils.isEmpty(reginParams)) {
return null;
}
CompanyModel companyModel = reginParams.getUserModel().getCompanys().get(0);
if(ObjectUtils.isEmpty(companyModel)){
CompanyBo company = reginParams.getCompany();
if(ObjectUtils.isEmpty(company)){
throw new BadRequest("未指定人员归属单位信息");
}
dto.setUnitCode(companyModel.getCompanyCode());
dto.setUnitCode(company.getCompanyCode());
Page<TzsUserInfoDto> page = new Page<>();
page.setCurrent(Long.parseLong(current));
page.setSize(Long.parseLong(size));
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
......@@ -15,6 +16,7 @@ import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.*;
import com.yeejoin.amos.boot.module.tcm.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.tcm.api.enums.PersonManageRoleEnum;
import com.yeejoin.amos.boot.module.tcm.api.enums.TwoStipulateGroupEnum;
import com.yeejoin.amos.boot.module.tcm.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsUserEquipMapper;
......@@ -262,6 +264,22 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
});
//添加人员管理角色
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectById(sequenceNbr);
String post = tzsUserInfo.getPost();
if(post.contains(PersonManageRoleEnum.code.getId().toString())){
String companyType = tzsUserInfoMapper.selectCompanyTypeById(companySeq);
if(companyType.contains(PersonManageRoleEnum.jyjc.getName())){
roleIds.add(PersonManageRoleEnum.jyjc.getId());
}
if(companyType.contains(PersonManageRoleEnum.use.getName())){
roleIds.add(PersonManageRoleEnum.use.getId());
}
if(companyType.contains(PersonManageRoleEnum.agw.getName())){
roleIds.add(PersonManageRoleEnum.agw.getId());
}
}
Map<Long, List<Long>> roleSeqMap = new HashMap<>();
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
roleSeqMap.put(companySeq, roleIds);
......@@ -271,7 +289,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
agencyUserModel.setOrgRoleSeqs(roleSeqMap);
userResult = Privilege.agencyUserClient.create(agencyUserModel);
if (userResult.getStatus() == 200) {
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectById(sequenceNbr);
tzsUserInfo.setAmosUserId(userResult.getResult().getUserId());
tzsUserInfo.setAmosUserName(userResult.getResult().getUserName());
tzsUserInfo.setLockStatus(status);
......@@ -284,7 +302,6 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
Privilege.groupUserClient.create(Long.valueOf(roleGroup.getExtend()), userIds);
}
//绑定两个规定用户组
String post = tzsUserInfo.getPost();
post = post.replace("[", "").replace("]", "").replace("\"", "");
for (String code : post.split(",")) {
DataDictionary groupId = iDataDictionaryService
......@@ -366,6 +383,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
boolean productCompany = false;
boolean useCompany = false;
boolean installCompany = false;
boolean inspectionCompany = false;
for (CompanyModel companyModel : companyModels) {
String companyType = companyModel.getCompanyType();
if (companyType.contains("使用单位") || companyType.contains("个人主体")) {
......@@ -377,19 +395,23 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
if (companyType.contains("安装改造维修单位")){
installCompany = true;
}
if (companyType.contains("检验检测机构")){
inspectionCompany = true;
}
}
String companyType = null;
StringBuilder companyType = new StringBuilder();
if (useCompany) {
companyType = "use";
companyType.append("use-");
}
if (productCompany) {
companyType = "pro";
}
if (useCompany && productCompany) {
companyType = "useAndPro";
companyType.append("pro-");
}
if (installCompany) {
companyType = companyType + "AndInstall";
companyType.append("install-");
}
if (inspectionCompany) {
companyType.append("inspection");
}
result.put("companyType", companyType);
return result;
......@@ -526,18 +548,21 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
@Override
public List<Map<String, Object>> getUserType(String unitType) {
if (unitType.equals("pro")) {
return tzsUserInfoMapper.getUserType("QYRYGW-SCDW", null);
} else if (unitType.equals("use")) {
return tzsUserInfoMapper.getUserType("QYRYGW-SYDW", null);
} else if (unitType.equals("useAndInstall")){
return tzsUserInfoMapper.getUserType("QYRYGW-SYDW", "QYRYGW-INSTALL");
} else if (unitType.equals("proAndInstall")){
return tzsUserInfoMapper.getUserType("QYRYGW-SCDW", "QYRYGW-INSTALL");
}else {
return tzsUserInfoMapper.getUserType(null, null);
List<String> type = new ArrayList<>();
type.add("QYRYGW");
if (unitType.contains("use")) {
type.add("QYRYGW-SYDW");
}
if (unitType.contains("pro")) {
type.add("QYRYGW-SCDW");
}
if (unitType.contains("install")) {
type.add("QYRYGW-INSTALL");
}
if (unitType.contains("inspection")) {
type.add("QYRYGW-INSPECTION");
}
return tzsUserInfoMapper.getUserTypeList(type);
}
public List<LinkedHashMap> screenData(List<LinkedHashMap> result, List<LinkedHashMap> data, String id) {
......
......@@ -27,7 +27,7 @@
<springcloud.version>Hoxton.SR8</springcloud.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<tyboot-version>1.1.23-SNAPSHOT</tyboot-version>
<amos.version>1.7.10-SNAPSHOT</amos.version>
<amos.version>1.8.6</amos.version>
<itext.version>7.1.1</itext.version>
<elasticsearch.version>7.15.2</elasticsearch.version>
</properties>
......
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