| | |
| | | * 项目年综合能源消费量(标准煤当量值) |
| | | */ |
| | | @ExcelProperty(value = "项目年综合能源消费量(标准煤当量值)") |
| | | private BigDecimal annualEnergyConsumption; |
| | | private String annualEnergyConsumption; |
| | | |
| | | /** |
| | | * 项目年电力消耗量(标准煤当量值) |
| | | */ |
| | | @ExcelProperty(value = "项目年电力消耗量(标准煤当量值)") |
| | | private BigDecimal annualElectricityConsumption; |
| | | private String annualElectricityConsumption; |
| | | |
| | | |
| | | /* 相关文书 */ |
| | |
| | | import com.ycl.domain.vo.ProjectProcessVO; |
| | | import com.ycl.domain.form.ProjectProcessForm; |
| | | import com.ycl.domain.query.ProjectProcessQuery; |
| | | import java.io.InputStream; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * @param name_ |
| | | * @param objectToBytes |
| | | */ |
| | | void insertByteArray(@Param("id_") String bytearray_id_, @Param("rev_") int rev_, @Param("name_") String name_, @Param("bytes_") Object objectToBytes); |
| | | void insertByteArray(@Param("id_") String bytearray_id_, @Param("rev_") int rev_, @Param("name_") String name_, @Param("bytes_") InputStream objectToBytes); |
| | | |
| | | |
| | | /** |
| | |
| | | // 其它类型的表单数据:如图片、文件单独存表的。历史、运行中的流程需各存一份 |
| | | v.setVAR_TYPE_("serializable"); |
| | | v.setBYTEARRAY_ID_(new StrongUuidGenerator().getNextId()); |
| | | projectProcessMapper.insertByteArray(v.getBYTEARRAY_ID_(), 1, "hist.var-" + key, newV.get(key)); |
| | | projectProcessMapper.insertByteArray(v.getBYTEARRAY_ID_(), 1, "hist.var-" + key, objectToInputStream(newV.get(key))); |
| | | |
| | | run.setVAR_TYPE_("serializable"); |
| | | run.setBYTEARRAY_ID_(new StrongUuidGenerator().getNextId()); |
| | | projectProcessMapper.insertByteArray(run.getBYTEARRAY_ID_(), 1, "var-" + key, newV.get(key)); |
| | | projectProcessMapper.insertByteArray(run.getBYTEARRAY_ID_(), 1, "var-" + key, objectToInputStream(newV.get(key))); |
| | | } |
| | | |
| | | projectProcessMapper.insertHisFlowableVar(v); |
| | |
| | | oos.flush(); |
| | | return bos.toByteArray(); // 返回字节数组 |
| | | } |
| | | } |
| | | |
| | | // 将对象转换为 InputStream,适配 BLOB 写入 |
| | | public static InputStream objectToInputStream(Object obj) throws IOException { |
| | | byte[] bytes = objectToBytes(obj); |
| | | return Objects.isNull(bytes) ? null : new ByteArrayInputStream(bytes); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (disableInput) { |
| | | options.put("disabled", true); |
| | | } |
| | | // 处理文件上传ip问题 |
| | | if ("file-upload".equals(oldField.get("type"))) { |
| | | options.put("uploadURL", String.format("http://%s:10076/common/upload", this.targetIp)); |
| | | } |
| | | } |
| | | |
| | | formJson.put(ProcessConstants.WIDGET_LIST, oldFields); |
| | | normalizeUploadUrl(formJson); |
| | | newP.put(ProcessConstants.TASK_FORM_KEY, formJson); |
| | | newP.remove(formDetailVO.getBeforeNodeDefId() + "&" + ProcessConstants.TASK_FORM_KEY); |
| | | // 处理已经上传的文件的ip地址 |
| | |
| | | formDetailVO.setFormJsonObj(newP); |
| | | } |
| | | |
| | | } else { |
| | | // 当前节点一般使用模板初始化数据,统一在这里改写上传地址,避免旧IP残留 |
| | | Map<String, Object> formObj = formDetailVO.getFormJsonObj(); |
| | | if (Objects.nonNull(formObj) && Objects.nonNull(formObj.get(ProcessConstants.TASK_FORM_KEY))) { |
| | | JSONObject formJson = JSONObject.parseObject(JSON.toJSONString(formObj.get(ProcessConstants.TASK_FORM_KEY))); |
| | | normalizeUploadUrl(formJson); |
| | | formObj.put(ProcessConstants.TASK_FORM_KEY, formJson); |
| | | formDetailVO.setFormJsonObj(formObj); |
| | | } |
| | | } |
| | | } |
| | | return beforeNodes; |
| | | } |
| | | |
| | | private void normalizeUploadUrl(JSONObject formJson) { |
| | | if (Objects.isNull(formJson)) { |
| | | return; |
| | | } |
| | | List<JSONObject> fields = JSON.parseObject(JSON.toJSONString(formJson.get(ProcessConstants.WIDGET_LIST)), new TypeReference<List<JSONObject>>() { |
| | | }); |
| | | if (CollectionUtils.isEmpty(fields)) { |
| | | return; |
| | | } |
| | | for (JSONObject field : fields) { |
| | | if (!"file-upload".equals(field.get("type"))) { |
| | | continue; |
| | | } |
| | | JSONObject options = field.getJSONObject("options"); |
| | | if (Objects.isNull(options)) { |
| | | continue; |
| | | } |
| | | options.put("uploadURL", String.format("http://%s:10076/common/upload", this.targetIp)); |
| | | } |
| | | formJson.put(ProcessConstants.WIDGET_LIST, fields); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 流程节点信息 |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | // 其它类型的表单数据:如图片、文件单独存表的。历史、运行中的流程需各存一份 |
| | | v.setVAR_TYPE_("serializable"); |
| | | v.setBYTEARRAY_ID_(new StrongUuidGenerator().getNextId()); |
| | | projectProcessMapper.insertByteArray(v.getBYTEARRAY_ID_(), 1, "hist.var-" + key, newV.get(key)); |
| | | try { |
| | | projectProcessMapper.insertByteArray(v.getBYTEARRAY_ID_(), 1, "hist.var-" + key, FlowTaskServiceImpl.objectToInputStream(newV.get(key))); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | run.setVAR_TYPE_("serializable"); |
| | | run.setBYTEARRAY_ID_(new StrongUuidGenerator().getNextId()); |
| | | projectProcessMapper.insertByteArray(run.getBYTEARRAY_ID_(), 1, "var-" + key, newV.get(key)); |
| | | try { |
| | | projectProcessMapper.insertByteArray(run.getBYTEARRAY_ID_(), 1, "var-" + key, FlowTaskServiceImpl.objectToInputStream(newV.get(key))); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | projectProcessMapper.insertHisFlowableVar(v); |
| | |
| | | </insert> |
| | | |
| | | <insert id="insertByteArray"> |
| | | insert into act_ge_bytearray(ID_, REV_, NAME_, BYTES_) values (#{id_}, #{rev_}, #{name_}, #{bytes_, jdbcType=BLOB}) |
| | | insert into act_ge_bytearray(ID_, REV_, NAME_, BYTES_) values (#{id_}, #{rev_}, #{name_}, #{bytes_, javaType=java.io.InputStream, jdbcType=BLOB}) |
| | | </insert> |
| | | |
| | | <delete id="deleteByteArray" parameterType="string"> |
| | |
| | | if (ObjectUtil.isNull(textValue)) { |
| | | return null; |
| | | } |
| | | ExcelEnumFormat anno = getAnnotation(contentProperty.getField()); |
| | | // 字段未配置枚举注解时,按原始值转换,避免空指针导致导入/导出中断 |
| | | if (ObjectUtil.isNull(anno)) { |
| | | return Convert.convert(contentProperty.getField().getType(), textValue); |
| | | } |
| | | Map<Object, String> enumCodeToTextMap = beforeConvert(contentProperty); |
| | | // 从Java输出至Excel是code转text |
| | | // 因此从Excel转Java应该将text与code对调 |
| | |
| | | if (ObjectUtil.isNull(object)) { |
| | | return new WriteCellData<>(""); |
| | | } |
| | | ExcelEnumFormat anno = getAnnotation(contentProperty.getField()); |
| | | // 字段未配置枚举注解时,按原值输出文本 |
| | | if (ObjectUtil.isNull(anno)) { |
| | | return new WriteCellData<>(Convert.toStr(object, "")); |
| | | } |
| | | Map<Object, String> enumValueMap = beforeConvert(contentProperty); |
| | | String value = Convert.toStr(enumValueMap.get(object), ""); |
| | | return new WriteCellData<>(value); |
| | |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | # 实体扫描,多个package用逗号或者分号分隔 |
| | | typeAliasesPackage: com.ycl.**.domain |
| | | type-handlers-package: com.ycl.mybatis.typehandler |
| | | configuration: |
| | | shrink-whitespaces-in-sql: true #从SQL中删除多余的空格字符 |
| | | default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler # 通用枚举处理器 |