同步处理明细

dev
ic_excellent 2023-07-19 17:19:33 +08:00
parent 6d9f347911
commit fe37d194a3
4 changed files with 45 additions and 16 deletions

View File

@ -117,6 +117,7 @@ public class ResponseMappingDeal {
.tableDefinitionCallback(this.tableCallback) .tableDefinitionCallback(this.tableCallback)
.tableType(responseConfig.getTableType()) .tableType(responseConfig.getTableType())
.assignType(ResponseConfigConstant.NO_HANDLE) .assignType(ResponseConfigConstant.NO_HANDLE)
.tableDefinitionCallback(tableCallback)
.assignTable(responseConfig.getModelTableName()).build(); .assignTable(responseConfig.getModelTableName()).build();
} }
// 做数据处理 // 做数据处理

View File

@ -65,17 +65,23 @@ public class InsertSate extends State{
flag = this.configMapper.executeUpdateBatchCusSql(updateSql, updateList, whereList); flag = this.configMapper.executeUpdateBatchCusSql(updateSql, updateList, whereList);
String modeId = Util.getModeIdByTableName(assignTable); String modeId = Util.getModeIdByTableName(assignTable);
Util.rebuildModeDataShareByAsyncList(1,modeId,dataIdList); Util.rebuildModeDataShareByAsyncList(1,modeId,dataIdList);
}else {
String insertSql = MapperBuilderSql.builderInsertSql(assignTable, tempRowDefinition.getUpdateParam(),"item");
List<Map<String, Object>> insertList = rowDefinitionList.stream().map(RowDefinition::getUpdateParam).collect(Collectors.toList());
rowDefinitionList.forEach(item ->{
if(mainOrDetail == ResponseConfigConstant.MAIN_TABLE){
detailTableDeal(item,detailTableMap);
}
insertList.add(item.getUpdateParam());
});
flag = this.configMapper.executeInsertBatchCusSql(insertSql, insertList);
}
if(ResponseUtil.parameterIsNotNull(detailTableMap) && flag){ if(ResponseUtil.parameterIsNotNull(detailTableMap) && flag){
detailTableMap.forEach((key,value)->{ detailTableMap.forEach((key,value)->{
value.setDefaultState(null); value.setDefaultState(null);
value.dataProcess(); value.dataProcess();
}); });
} }
}else {
String insertSql = MapperBuilderSql.builderInsertSql(assignTable, tempRowDefinition.getUpdateParam(),"item");
List<Map<String, Object>> insertList = rowDefinitionList.stream().map(RowDefinition::getUpdateParam).collect(Collectors.toList());
flag = this.configMapper.executeInsertBatchCusSql(insertSql, insertList);
}
if(ResponseUtil.parameterIsNotNull(this.context.getTableDefinitionCallback())){ if(ResponseUtil.parameterIsNotNull(this.context.getTableDefinitionCallback())){
this.context.getTableDefinitionCallback().afterHandle(this.context,flag); this.context.getTableDefinitionCallback().afterHandle(this.context,flag);
} }

View File

@ -1,8 +1,30 @@
package aiyh.utils.response_deal.state;/** package aiyh.utils.response_deal.state;
import aiyh.utils.response_deal.constant.ResponseConfigConstant;
import aiyh.utils.response_deal.entity.TableDefinition;
import aiyh.utils.response_deal.util.ResponseUtil;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName NoHandleState * @ClassName NoHandleState
* @Author * @Author
* @Date 2023/7/19 16:51 * @Date 2023/7/19 16:51
* @Description <h1></h1> * @Description <h1></h1>
**/ **/
public class NoHandleState { public class NoHandleState extends State{
@Override
public void handle() {
if(this.context.getMainOrDetail() == ResponseConfigConstant.MAIN_TABLE) {
Map<String, TableDefinition> detailTableMap = this.context.getDetailTableMap();
if (ResponseUtil.parameterIsNotNull(detailTableMap)) {
detailTableMap.forEach((key, value) -> {
value.setDefaultState(null);
value.dataProcess();
});
}
}
}
} }

View File

@ -37,13 +37,13 @@ public interface ReportMapper {
@CaseConversion(value = false) @CaseConversion(value = false)
List<Map<String, Object>> queryReportData2(@ParamMapper("param") Map<String,Object> param,@ParamMapper("uid") int uid); List<Map<String, Object>> queryReportData2(@ParamMapper("param") Map<String,Object> param,@ParamMapper("uid") int uid);
@Select("select main.* " + @Select("select main.*," +
" (select lastname from hrmresource where id = dyjbr) dyjbr_span," + " (select lastname from hrmresource where id = dyjbr) dyjbr_span," +
" (select lastname from hrmresource where id = djr) djr_span," + " (select lastname from hrmresource where id = djr) djr_span," +
" (select LISTAGG(concat(wb, ',', dw), '-') WITHIN GROUP (ORDER BY wb) from uf_zwfwdjjmb_dt1 where mainid = main.id) ysdx," + " (select LISTAGG(concat(wb, ',', dw), '-') WITHIN GROUP (ORDER BY wb) from uf_zwfwdjjmb_dt1 where mainid = main.id) ysdx," +
" (select LISTAGG(concat(dwclwb,'(', dwcljsywb,')'), ',') WITHIN GROUP (ORDER BY wb) from uf_zwfwdjjmb_dt3 where mainid = main.id) car_people," + " (select LISTAGG(concat(dwclwb,'(', dwcljsywb,')'), ',') WITHIN GROUP (ORDER BY dwclwb) from uf_zwfwdjjmb_dt3 where mainid = main.id) car_people," +
" (select LISTAGG(concat(gzclwb,'(', gzcljsywb,')'), ',') WITHIN GROUP (ORDER BY wb) from uf_zwfwdjjmb_dt4 where mainid = main.id) work_people," + " (select LISTAGG(concat(gzclwb,'(', gzcljsywb,')'), ',') WITHIN GROUP (ORDER BY gzclwb) from uf_zwfwdjjmb_dt4 where mainid = main.id) work_people," +
" (select LISTAGG(concat(fjhwb,'(', ysdxwb,')'), ',') WITHIN GROUP (ORDER BY wb) from uf_zwfwdjjmb_dt2 where mainid = main.id) put_up" + " (select LISTAGG(concat(fjhwb,'(', ysdxwb,')'), ',') WITHIN GROUP (ORDER BY fjhwb) from uf_zwfwdjjmb_dt2 where mainid = main.id) put_up " +
"from uf_zwfwdjjmb main $t{param.whereSql} " + "from uf_zwfwdjjmb main $t{param.whereSql} " +
"order by dlsk1 ") "order by dlsk1 ")
@CaseConversion(value = false) @CaseConversion(value = false)