Commit 878cfbb5 authored by zhangsen's avatar zhangsen

城燃管道相关业务提交2

parent e32836e9
package com.yeejoin.amos.boot.module.ugp.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum GenStageEnum {
/**
* 质量问题产生阶段
*/
HJGY("1", "焊接工艺"),
HKTS("2", "焊口探伤"),
GDMS("3", "管道埋深"),
NYCS("4", "耐压测试"),
FSDW("5", "敷设定位"),
/**
* 监管指标类型
*/
NUM_TYPE("numType", "数值型"),
SYMBOL_TYPE("symbolType", "符号型");
private final String code;
private final String name;
public String getCode() {
return code;
}
public String getName() {
return name;
}
public static String getTypeByCode(String code){
for (GenStageEnum constants : values()) {
if (constants.getCode().equals(code)) {
return constants.getName();
}
}
return null;
}
}
...@@ -5,7 +5,10 @@ import io.swagger.annotations.ApiModel; ...@@ -5,7 +5,10 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
@Data @Data
@ApiModel(value = "ProblemCodeLibDto", description = "质量问题代码库表") @ApiModel(value = "ProblemCodeLibDto", description = "质量问题代码库表")
...@@ -29,7 +32,7 @@ public class ProblemCodeLibDto extends BaseDto { ...@@ -29,7 +32,7 @@ public class ProblemCodeLibDto extends BaseDto {
private String idxType; private String idxType;
@ApiModelProperty("监管指标阈值") @ApiModelProperty("监管指标阈值")
private String idxThresholds; private List<Map<String, String>> idxThresholds = new ArrayList<>();
@ApiModelProperty("创建日期") @ApiModelProperty("创建日期")
private Date createDate; private Date createDate;
......
package com.yeejoin.amos.boot.module.ugp.api.service; package com.yeejoin.amos.boot.module.ugp.api.service;
public interface IProblemCodeLibService { import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProblemCodeLib;
public interface IProblemCodeLibService extends IService<ProblemCodeLib> {
} }
package com.yeejoin.amos.boot.module.ugp.biz.controller; package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProblemCodeLibDto; import com.yeejoin.amos.boot.module.ugp.api.dto.ProblemCodeLibDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProblemCodeLib; import com.yeejoin.amos.boot.module.ugp.api.entity.ProblemCodeLib;
import com.yeejoin.amos.boot.module.ugp.api.service.IProblemCodeLibService;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProblemCodeLibServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.ProblemCodeLibServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.ApplicationModel; import com.yeejoin.amos.feign.privilege.model.ApplicationModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -37,30 +45,30 @@ public class ProblemCodeLibController extends BaseController { ...@@ -37,30 +45,30 @@ public class ProblemCodeLibController extends BaseController {
@Value("${appCode.gasBottle.image:studio_normalapp_4403119,upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png}") @Value("${appCode.gasBottle.image:studio_normalapp_4403119,upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png}")
private String gasBottleAppImage; private String gasBottleAppImage;
@Resource
private IProblemCodeLibService problemCodeLibService;
/** /**
* 新增质量监检信息表 * 新增质量监检信息表
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增质量问题代码库表", notes = "新增质量问题代码库表") @ApiOperation(httpMethod = "POST", value = "新增或修改质量问题代码库表", notes = "新增或修改质量问题代码库表")
public ResponseModel<ProblemCodeLibDto> save(@RequestBody ProblemCodeLibDto model) { public ResponseModel<ProblemCodeLibDto> save(@RequestBody ProblemCodeLibDto model) {
model = problemCodeLibServiceImpl.createWithModel(model); ProblemCodeLib problemCodeLib = new ProblemCodeLib();
BeanUtils.copyProperties(model, problemCodeLib, "idxThresholds");
List<Map<String, String>> idxThresholds = model.getIdxThresholds();
if (CollectionUtils.isNotEmpty(idxThresholds)) {
for (Map<String, String> idxThreshold : idxThresholds) {
idxThreshold.remove("Symbol_key");
}
problemCodeLib.setIdxThresholds(JSON.toJSONString(idxThresholds));
}
problemCodeLibService.saveOrUpdate(problemCodeLib);
model.setSequenceNbr(problemCodeLib.getSequenceNbr());
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新质量问题代码库表", notes = "根据sequenceNbr更新质量问题代码库表")
public ResponseModel<ProblemCodeLibDto> updateBySequenceNbrQualityInfo(@RequestBody ProblemCodeLibDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(problemCodeLibServiceImpl.updateWithModel(model));
}
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
...@@ -70,11 +78,11 @@ public class ProblemCodeLibController extends BaseController { ...@@ -70,11 +78,11 @@ public class ProblemCodeLibController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除质量问题代码库表", notes = "根据sequenceNbr删除质量问题代码库表") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除质量问题代码库表", notes = "根据sequenceNbr删除质量问题代码库表")
public ResponseModel<ProblemCodeLibDto> deleteBySequenceNbr(@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<Boolean> deleteBySequenceNbr(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
ProblemCodeLibDto model = new ProblemCodeLibDto(); ProblemCodeLib model = new ProblemCodeLib();
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
model.setIsDelete(Boolean.FALSE); model.setIsDelete(Boolean.TRUE);
return ResponseHelper.buildResponse(problemCodeLibServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(problemCodeLibService.updateById(model));
} }
/** /**
...@@ -86,7 +94,14 @@ public class ProblemCodeLibController extends BaseController { ...@@ -86,7 +94,14 @@ public class ProblemCodeLibController extends BaseController {
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个质量问题代码库表", notes = "根据sequenceNbr查询单个质量问题代码库表") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个质量问题代码库表", notes = "根据sequenceNbr查询单个质量问题代码库表")
public ResponseModel<ProblemCodeLibDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<ProblemCodeLibDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(problemCodeLibServiceImpl.queryBySeq(sequenceNbr)); ProblemCodeLib problemCodeLib = problemCodeLibService.getById(sequenceNbr);
ProblemCodeLibDto problemCodeLibDto = new ProblemCodeLibDto();
if (StringUtils.isNotEmpty(problemCodeLib.getIdxThresholds())) {
List<Map<String, String>> listObject = JSON.parseObject(problemCodeLib.getIdxThresholds(), List.class);
problemCodeLibDto.setIdxThresholds(listObject);
}
BeanUtils.copyProperties(problemCodeLib, problemCodeLibDto, "idxThresholds");
return ResponseHelper.buildResponse(problemCodeLibDto);
} }
/** /**
...@@ -147,4 +162,13 @@ public class ProblemCodeLibController extends BaseController { ...@@ -147,4 +162,13 @@ public class ProblemCodeLibController extends BaseController {
resultMap.put("records", resultList); resultMap.put("records", resultList);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getDictDataByCode")
@ApiOperation(httpMethod = "GET", value = "常用功能", notes = "常用功能")
public ResponseModel<Object> getDictDataByCode(@RequestParam String dictCode) {
FeignClientResult<List<DictionarieValueModel>> adminCommonlyUsed = Systemctl.dictionarieClient.dictValues(dictCode);
List<DictionarieValueModel> result = adminCommonlyUsed.getResult();
return ResponseHelper.buildResponse(result);
}
} }
...@@ -3,15 +3,22 @@ package com.yeejoin.amos.boot.module.ugp.biz.service.impl; ...@@ -3,15 +3,22 @@ package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ugp.api.Enum.GenStageEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.ProblemCodeLibDto; import com.yeejoin.amos.boot.module.ugp.api.dto.ProblemCodeLibDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.ProblemCodeLib; import com.yeejoin.amos.boot.module.ugp.api.entity.ProblemCodeLib;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProblemCodeLibMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.ProblemCodeLibMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IProblemCodeLibService; import com.yeejoin.amos.boot.module.ugp.api.service.IProblemCodeLibService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class ProblemCodeLibServiceImpl extends BaseService<ProblemCodeLibDto, ProblemCodeLib, ProblemCodeLibMapper> implements IProblemCodeLibService { public class ProblemCodeLibServiceImpl extends BaseService<ProblemCodeLibDto, ProblemCodeLib, ProblemCodeLibMapper> implements IProblemCodeLibService {
...@@ -19,10 +26,20 @@ public class ProblemCodeLibServiceImpl extends BaseService<ProblemCodeLibDto, Pr ...@@ -19,10 +26,20 @@ public class ProblemCodeLibServiceImpl extends BaseService<ProblemCodeLibDto, Pr
@Resource @Resource
private ProblemCodeLibMapper problemCodeLibMapper; private ProblemCodeLibMapper problemCodeLibMapper;
@Value("${dict.code.unit:UNIT_MANAGE}")
private String unitManage;
public IPage<ProblemCodeLib> queryProblemCodeInfoPage(Page<ProblemCodeLib> page) { public IPage<ProblemCodeLib> queryProblemCodeInfoPage(Page<ProblemCodeLib> page) {
LambdaQueryWrapper<ProblemCodeLib> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ProblemCodeLib> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ProblemCodeLib::getIsDelete, Boolean.FALSE); lambdaQueryWrapper.eq(ProblemCodeLib::getIsDelete, Boolean.FALSE);
return problemCodeLibMapper.selectPage(page, lambdaQueryWrapper); Map<String, String> dictValueMap = getDictInfoMapByCode(unitManage);
IPage<ProblemCodeLib> problemCodeLibIPage = problemCodeLibMapper.selectPage(page, lambdaQueryWrapper);
problemCodeLibIPage.getRecords().forEach(item -> {
item.setGenStage(GenStageEnum.getTypeByCode(item.getGenStage()));
item.setIdxType(GenStageEnum.getTypeByCode(item.getIdxType()));
item.setIdxUnit(dictValueMap.get(item.getIdxUnit()));
});
return problemCodeLibIPage;
} }
public List<ProblemCodeLib> queryProblemCodeInfoList() { public List<ProblemCodeLib> queryProblemCodeInfoList() {
...@@ -30,4 +47,15 @@ public class ProblemCodeLibServiceImpl extends BaseService<ProblemCodeLibDto, Pr ...@@ -30,4 +47,15 @@ public class ProblemCodeLibServiceImpl extends BaseService<ProblemCodeLibDto, Pr
lambdaQueryWrapper.eq(ProblemCodeLib::getIsDelete, Boolean.FALSE); lambdaQueryWrapper.eq(ProblemCodeLib::getIsDelete, Boolean.FALSE);
return problemCodeLibMapper.selectList(lambdaQueryWrapper); return problemCodeLibMapper.selectList(lambdaQueryWrapper);
} }
/**
* 根据字典code获取字典值信息
*
* @param dictCode 字典值编码
* @return key:字典值的key value:字典值的名称
*/
private Map<String, String> getDictInfoMapByCode(String dictCode) {
FeignClientResult<List<DictionarieValueModel>> adminCommonlyUsed = Systemctl.dictionarieClient.dictValues(dictCode);
return adminCommonlyUsed.getResult().stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataValue));
}
} }
...@@ -68,3 +68,6 @@ appCode.pipeline.image=studio_normalapp_4403119,upload/tzs/amos_studio/9C968B74A ...@@ -68,3 +68,6 @@ appCode.pipeline.image=studio_normalapp_4403119,upload/tzs/amos_studio/9C968B74A
# 气瓶安全追溯系统应用key和应用图片地址 用英文逗号隔开 前面为应用code 后面为图片地址 # 气瓶安全追溯系统应用key和应用图片地址 用英文逗号隔开 前面为应用code 后面为图片地址
appCode.gasBottle.image=studio_normalapp_3404491,upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png appCode.gasBottle.image=studio_normalapp_3404491,upload/tzs/amos_studio/9C968B74AC9F8C9F21C8E4A284FDEAB4.png
# 质量代码库单位code:字典code
dict.code.unit=UNIT_MANAGE
\ 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