|
|
|
@ -4,6 +4,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesConfig;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
@ -11,12 +12,16 @@ import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
|
@Api("获取系统配置的模版信息")
|
|
|
|
|
@RestController
|
|
|
|
@ -54,4 +59,31 @@ public class MesLabelTemplateExtController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/label-template/by-module-or-template/get-custom")
|
|
|
|
|
@ApiOperation(value = "获取系统配置的模版信息")
|
|
|
|
|
public ResultBean queryModuleCodeCfg(String organizeCode, String moduleCode, String chooseCodes, String templateCode) {
|
|
|
|
|
try {
|
|
|
|
|
ValidatorBean.checkNotNull(organizeCode, "工厂代码不能为空");
|
|
|
|
|
if (StringUtils.isEmpty(moduleCode) && StringUtils.isEmpty(templateCode)) {
|
|
|
|
|
ValidatorBean.checkNotNull(moduleCode, "模版配置代码不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(chooseCodes)) return queryMesLabelTemplate(organizeCode, moduleCode, templateCode);
|
|
|
|
|
|
|
|
|
|
List<String> chooseCodeList = Arrays.asList(chooseCodes.split(MesPcnExtConstWords.COMMA));
|
|
|
|
|
|
|
|
|
|
List<MesConfig> configList = configService.getMesConfigListByCfgCodeKey(moduleCode, MesPcnExtConstWords.CUSTOM_CFG, organizeCode);
|
|
|
|
|
Optional<MesConfig> optional = CollectionUtils.isEmpty(configList) ? null :
|
|
|
|
|
configList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCfgValue())
|
|
|
|
|
&& !StringUtils.isEmpty(o.getCfgType()) && chooseCodeList.contains(o.getCfgType()))).findFirst();
|
|
|
|
|
|
|
|
|
|
return queryMesLabelTemplate(organizeCode, (null == optional || !optional.isPresent()) ? moduleCode : optional.get().getCfgValue(), templateCode);
|
|
|
|
|
|
|
|
|
|
} catch (ImppBusiException imppException) {
|
|
|
|
|
return ResultBean.fail(imppException);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|