|
@@ -1038,9 +1038,18 @@ public class ExcelTabController extends BladeController {
|
|
|
//判断高度
|
|
|
String style = data.attr("style");
|
|
|
if (StringUtils.isNotBlank(style)) {
|
|
|
- String substring = style.substring(style.lastIndexOf(":") + 1);
|
|
|
+ int index = style.lastIndexOf(":");
|
|
|
+ String substring = style.substring( index+ 1);
|
|
|
String height = substring.substring(0, substring.length() - 3);
|
|
|
- if (Integer.parseInt(height) > 90) {
|
|
|
+ int i1 = 0;
|
|
|
+ try {
|
|
|
+ i1 = Integer.parseInt(height);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ substring = style.substring(style.lastIndexOf(":",index-1) + 1);
|
|
|
+ height = substring.substring(0,substring.indexOf("px;"));
|
|
|
+ i1 = Integer.parseInt(height);
|
|
|
+ }
|
|
|
+ if (i1 > 90) {
|
|
|
isText = true;
|
|
|
}
|
|
|
}
|
|
@@ -2553,7 +2562,6 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.data(null);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 获取当前用户当前日期的填报记录
|
|
|
*/
|
|
@@ -2933,6 +2941,7 @@ public class ExcelTabController extends BladeController {
|
|
|
})
|
|
|
public R<List<Map<String, Object>>> copyTheLogBusinessData(@RequestParam String theLogId, @RequestParam String nodePrimaryKeyId, @RequestParam String currentTime, @RequestParam String contractId) {
|
|
|
if (StringUtils.isNotEmpty(theLogId) && StringUtils.isNotEmpty(currentTime)) {
|
|
|
+
|
|
|
//复制出来的新日志记录logIds
|
|
|
List<String> logIds = new ArrayList<>();
|
|
|
//复制出来的新增表的实体表SQL集合
|
|
@@ -2941,6 +2950,7 @@ public class ExcelTabController extends BladeController {
|
|
|
List<JSONObject> logWbsList = new ArrayList<>();
|
|
|
//记录第一组
|
|
|
List<JSONObject> oneGroupLogWbsList = new ArrayList<>();
|
|
|
+ ArrayList<String> dataIdList = new ArrayList<>();
|
|
|
|
|
|
//获取所有选择的日志表的数据信息
|
|
|
List<ContractLog> contractLogList = jdbcTemplate.query("select * from u_contract_log where id in(" + theLogId + ")", new BeanPropertyRowMapper<>(ContractLog.class));
|
|
@@ -2954,7 +2964,7 @@ public class ExcelTabController extends BladeController {
|
|
|
for (ContractLog objLog : contractLogList) {
|
|
|
long dataId = 0;
|
|
|
//获取目标数据
|
|
|
- String queryTargetDataSql = "SELECT * FROM " + tableTemp.getInitTableName() + " WHERE id = " + objLog.getDataId();
|
|
|
+ String queryTargetDataSql = "SELECT * FROM " + tableTemp.getInitTableName() + " WHERE id in( " + objLog.getDataId()+")";
|
|
|
List<Map<String, Object>> targetData = this.jdbcTemplate.queryForList(queryTargetDataSql);
|
|
|
|
|
|
//只需要替换group_id和id即可
|
|
@@ -2980,11 +2990,11 @@ public class ExcelTabController extends BladeController {
|
|
|
value = SnowFlakeUtil.getId();
|
|
|
|
|
|
//赋值给log的dataId,也就是businessId要与实体表数据id对应
|
|
|
- dataId = Long.parseLong(String.valueOf(value));
|
|
|
+ dataIdList.add(String.valueOf(value));
|
|
|
|
|
|
//后续关联工序节点businessId赋值,businessId=实体表数据的id
|
|
|
for (JSONObject json : wbsJsonList) {
|
|
|
- json.put("businessId", dataId);
|
|
|
+ json.put("businessId", Long.parseLong(String.valueOf(value)));
|
|
|
}
|
|
|
logWbsList.addAll(wbsJsonList);
|
|
|
}
|
|
@@ -3007,26 +3017,51 @@ public class ExcelTabController extends BladeController {
|
|
|
insertSql.append(" VALUES(").append(valueSql.substring(1)).append(")");
|
|
|
insertSqlList.add(insertSql.toString());
|
|
|
}
|
|
|
-
|
|
|
- if (dataId != 0) {
|
|
|
- //处理log当前表的记录数据
|
|
|
- String id = this.contractLogClient.saveContractLog(new SaveContractLogVO(
|
|
|
- dataId,
|
|
|
- String.valueOf(objLog.getProjectId()),
|
|
|
- String.valueOf(objLog.getContractId()),
|
|
|
- objLog.getWbsNodeId(),
|
|
|
- objLog.getTableId(),
|
|
|
- objLog.getWbsNodeType(),
|
|
|
- currentTime,
|
|
|
- logWbsList,
|
|
|
- theLogId
|
|
|
- ));
|
|
|
- //log记录id
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
+ String dataIds= dataIdList.stream().collect(Collectors.joining(","));
|
|
|
+ if(ObjectUtil.isEmpty(dataIdList)){
|
|
|
+ return fail("没有数据可复制");
|
|
|
+ }else {
|
|
|
+ //查询当前所在日期日志记录
|
|
|
+ List<ContractLog> contractLogs = this.contractLogClient.queryContractLogByPrimaryKeyIdAndRecordTimeList(nodePrimaryKeyId, currentTime, contractId);
|
|
|
+ if(ObjectUtil.isEmpty(contractLogs)){
|
|
|
+ String id = this.contractLogClient.saveContractLog(new SaveContractLogVO(
|
|
|
+ dataIds,
|
|
|
+ String.valueOf(objLog.getProjectId()),
|
|
|
+ String.valueOf(objLog.getContractId()),
|
|
|
+ objLog.getWbsNodeId(),
|
|
|
+ objLog.getTableId(),
|
|
|
+ objLog.getWbsNodeType(),
|
|
|
+ currentTime,
|
|
|
+ logWbsList,
|
|
|
+ theLogId
|
|
|
+ ));
|
|
|
logIds.add(id);
|
|
|
+ }else {
|
|
|
+ //关联dataIds
|
|
|
+ ContractLog contractLog = contractLogs.get(0);
|
|
|
+ String oldDataId = contractLog.getDataId();
|
|
|
+ ArrayList<String> OldDataIdList =new ArrayList<>(Arrays.asList(oldDataId.split(",")));
|
|
|
+ OldDataIdList.addAll(dataIdList);
|
|
|
+ // 将列表重新组合为字符串
|
|
|
+ String updatedDataId = String.join(",", OldDataIdList);
|
|
|
+ jdbcTemplate.execute("update u_contract_log set data_id = '" + updatedDataId + "' where id = " + contractLog.getId());
|
|
|
+ //新增表关联工序节点集合
|
|
|
+ if(ObjectUtil.isNotEmpty(logWbsList)){
|
|
|
+ SaveContractLogVO saveContractLogVO = new SaveContractLogVO(
|
|
|
+ updatedDataId,
|
|
|
+ String.valueOf(contractLog.getProjectId()),
|
|
|
+ String.valueOf(contractLog.getContractId()),
|
|
|
+ contractLog.getWbsNodeId(),
|
|
|
+ contractLog.getTableId(),
|
|
|
+ contractLog.getWbsNodeType(),
|
|
|
+ currentTime,
|
|
|
+ logWbsList,
|
|
|
+ theLogId
|
|
|
+ );
|
|
|
+ this.contractLogClient.saveLogWbsList(saveContractLogVO);
|
|
|
+ }
|
|
|
+ logIds.add(contractLog.getId().toString());
|
|
|
}
|
|
|
- } else {
|
|
|
- var = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3038,7 +3073,6 @@ public class ExcelTabController extends BladeController {
|
|
|
} else {
|
|
|
throw new ServiceException("数据构造失败");
|
|
|
}
|
|
|
-
|
|
|
//返回当前复制的表数据
|
|
|
return this.getTheLogBusinessData(StringUtils.join(logIds, ","), nodePrimaryKeyId, currentTime, contractId);
|
|
|
}
|
|
@@ -3878,16 +3912,34 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiOperation(value = "删除施工日志对应的表数据记录信息等", notes = "传入get-the-log-business-data接口返回的内部id")
|
|
|
@Transactional
|
|
|
public R<Object> removeLogTab(@RequestParam String id) {
|
|
|
+ //todo 这里前端需要改一下 多传一个日志id参数 避免like查询影响性能
|
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
|
- Map<String, Object> obj = jdbcTemplate.queryForMap("select * from u_contract_log where data_id =" + id + " ");
|
|
|
- if (obj!=null && Func.isNotEmpty(obj)) {
|
|
|
+ ContractLog contractLog = jdbcTemplate.queryForObject("select * from u_contract_log where data_id like '%" + id + "%'"
|
|
|
+ , new BeanPropertyRowMapper<>(ContractLog.class));
|
|
|
+ if (contractLog!=null && Func.isNotEmpty(contractLog)) {
|
|
|
//删除施工日志记录信息
|
|
|
- jdbcTemplate.execute("delete from u_contract_log where data_id = " + id);
|
|
|
+ String dataId = contractLog.getDataId();
|
|
|
+ // 将字符串拆分为列表
|
|
|
+ List<String> dataIdList = Arrays.asList(dataId.split(","));
|
|
|
+ if(dataIdList.size() == 1){
|
|
|
+ //删除整条日志
|
|
|
+ jdbcTemplate.execute("delete from u_contract_log where id = " + contractLog.getId());
|
|
|
+ }else {
|
|
|
+ if(dataIdList.size()>1){
|
|
|
+ // 移除指定值
|
|
|
+ List<String> updatedDataIdList = dataIdList.stream()
|
|
|
+ .filter(data -> !data.equals(id))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ // 将列表重新组合为字符串
|
|
|
+ String updatedDataId = String.join(",", updatedDataIdList);
|
|
|
+ jdbcTemplate.execute("update u_contract_log set data_id = '" + updatedDataId + "' where id = " + contractLog.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
//删除关联的工序wbs信息
|
|
|
- jdbcTemplate.execute("delete from u_contract_log_wbs where business_id = " + id + " and contract_log_id = " + obj.get("id").toString());
|
|
|
+ jdbcTemplate.execute("delete from u_contract_log_wbs where business_id = " + id + " and contract_log_id = " + contractLog.getId().toString());
|
|
|
|
|
|
//获取对应表信息
|
|
|
- WbsTreePrivate tableTemp = wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, obj.get("table_id")));
|
|
|
+ WbsTreePrivate tableTemp = wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, contractLog.getTableId()));
|
|
|
if (tableTemp != null && StringUtils.isNotEmpty(tableTemp.getInitTableName())) {
|
|
|
//删除实体表对应的数据信息
|
|
|
jdbcTemplate.execute("delete from " + tableTemp.getInitTableName() + " where id = " + id);
|