|
@@ -578,7 +578,7 @@ public class ExcelTabController extends BladeController {
|
|
|
/**
|
|
|
*保存用户填报数据接口
|
|
|
*/
|
|
|
- @PostMapping("/save_buss_data")
|
|
|
+ @PostMapping("/save_buss_data_bak")
|
|
|
@ApiOperationSupport(order = 13)
|
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
|
public R<String> saveBussData(@Valid @RequestBody JSONObject dataInfo, BladeUser bladeUser) throws IOException {
|
|
@@ -1551,4 +1551,150 @@ public class ExcelTabController extends BladeController {
|
|
|
return properties;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/save_buss_data")
|
|
|
+ @ApiOperationSupport(order = 13)
|
|
|
+ @ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
|
+ public R<String> _saveBussData(@Valid @RequestBody JSONObject dataInfo, BladeUser bladeUser) throws IOException {
|
|
|
+
|
|
|
+ JSONArray dataArray = new JSONArray();
|
|
|
+ if(dataInfo.containsKey("dataInfo")){ // 节点保存
|
|
|
+ JSONObject jsonObject = dataInfo.getJSONObject("dataInfo");
|
|
|
+ dataArray = jsonObject.getJSONArray("orderList");
|
|
|
+ }else{ // 单个保存
|
|
|
+ dataArray.add(dataInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int m=0;m<dataArray.size();m++){
|
|
|
+ JSONObject dataInfo2= dataArray.getJSONObject(m);
|
|
|
+ //
|
|
|
+ String contractId = dataInfo2.getString("contractId");
|
|
|
+ String pkeyId = dataInfo2.getString("pkeyId");
|
|
|
+ String projectId = dataInfo2.getString("projectId");
|
|
|
+ //huangjn 填报的类型,施工或监理
|
|
|
+ String classify = dataInfo2.getString("classify");
|
|
|
+
|
|
|
+ //huangjn 填报的类型,施工或监理
|
|
|
+ // 去掉
|
|
|
+ dataInfo2.remove("contractId");
|
|
|
+ dataInfo2.remove("pkeyId");
|
|
|
+ dataInfo2.remove("p_key_id");
|
|
|
+ dataInfo2.remove("projectId");
|
|
|
+ dataInfo2.remove("classify");
|
|
|
+ dataInfo2.remove("pickerKey");
|
|
|
+ dataInfo2.remove("id");
|
|
|
+ dataInfo2.remove("");
|
|
|
+ // 计算数据
|
|
|
+ Map<String,String> dataMap = new HashMap<>();
|
|
|
+ for(String k:dataInfo2.keySet()){
|
|
|
+ if(k.indexOf("__")>=0){
|
|
|
+ String key = k.split("__")[0];
|
|
|
+ if(dataMap.containsKey(key)){
|
|
|
+ dataMap.put(key,dataMap.get(key)+","+k);
|
|
|
+ }else{
|
|
|
+ dataMap.put(key,k);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,String> dataMap2 = new HashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+ // 字段组合
|
|
|
+ for(String k:dataMap.keySet()){
|
|
|
+ if(dataMap.get(k).indexOf(",")>=0 && dataMap.get(k).indexOf("000Z")<0){
|
|
|
+ String [] ziduan= dataMap.get(k).split(",");
|
|
|
+ String temp = "";
|
|
|
+ for(int i = 0; i < ziduan.length - 1; i++) {
|
|
|
+ for (int j = 0; j < ziduan.length - i - 1; j++) {
|
|
|
+ Integer tr = Integer.parseInt((ziduan[j].split("__")[1]).split("_")[0]);
|
|
|
+ Integer td = Integer.parseInt(ziduan[j].split("__")[1].split("_")[1]);
|
|
|
+
|
|
|
+ Integer tr_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[0]);
|
|
|
+ Integer td_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[1]);
|
|
|
+
|
|
|
+ if (tr > tr_1 && td==td_1 ) { //纵向排序
|
|
|
+ temp = ziduan[j];
|
|
|
+ ziduan[j] = ziduan[j + 1];
|
|
|
+ ziduan[j + 1] = temp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String lastStr = dataInfo2.getString(ziduan[0])+"__"+ziduan[0].split("__")[1];
|
|
|
+ for (int i=1 ;i<ziduan.length;i++){
|
|
|
+ String keyData = dataInfo2.getString(ziduan[i]);
|
|
|
+ if(!keyData.equals("")){
|
|
|
+ lastStr+=","+dataInfo2.getString(ziduan[i])+"__"+ziduan[i].split("__")[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ dataMap2.put(k,lastStr);
|
|
|
+ }else{
|
|
|
+ String dataVal = dataInfo2.getString(dataMap.get(k));
|
|
|
+ if(!dataVal.equals("") || !dataVal.equals("[]") ) {
|
|
|
+ System.out.println(k+"__"+dataMap.get(k));
|
|
|
+ dataMap2.put(k, dataVal+"__"+dataMap.get(k).split("__")[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dataMap2.put("p_key_id",pkeyId);
|
|
|
+
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
+ if(wbsTreeContract == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ String tabName = wbsTreeContract.getInitTableName();
|
|
|
+
|
|
|
+ // 判读修改还是 添加
|
|
|
+ String querySql = "select * from "+tabName+" where p_key_id="+pkeyId ;
|
|
|
+ List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
|
|
|
+
|
|
|
+ String sqlInfo="";
|
|
|
+
|
|
|
+ if(dataIn.isEmpty()){ //插入
|
|
|
+ sqlInfo = "INSERT INTO "+tabName+" ( ";
|
|
|
+ String keyStr = "id,";
|
|
|
+ String valStr = SnowFlakeUtil.getId() + ",";
|
|
|
+ for (String keys : dataMap2.keySet()){
|
|
|
+ keyStr += keys+",";
|
|
|
+ valStr += "'"+dataMap2.get(keys)+"',";
|
|
|
+ }
|
|
|
+ keyStr=keyStr.substring(0,keyStr.lastIndexOf(","));
|
|
|
+ valStr=valStr.substring(0,valStr.lastIndexOf(","));
|
|
|
+ sqlInfo = sqlInfo + keyStr+") VALUES (" +valStr +")";
|
|
|
+
|
|
|
+
|
|
|
+ WbsTreeContract wbsTreeContractByP = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getId, wbsTreeContract.getParentId()).eq(WbsTreeContract::getContractId,contractId));
|
|
|
+
|
|
|
+ //huangjn 保存成功后调用生成资料查询列表数据
|
|
|
+ this.informationQueryClient.saveOrUpdateInformationQueryData(wbsTreeContractByP.getPKeyId()+"", "文件名称(后面再完善)", Integer.parseInt(classify), 2);
|
|
|
+ }else{ //更新
|
|
|
+ sqlInfo = "update "+tabName+" set ";
|
|
|
+ for (String keys : dataMap2.keySet()){
|
|
|
+ sqlInfo += keys+"='"+dataMap2.get(keys)+"',";
|
|
|
+ }
|
|
|
+ sqlInfo=sqlInfo.substring(0,sqlInfo.lastIndexOf(","));
|
|
|
+ sqlInfo = sqlInfo + " where p_key_id="+pkeyId;
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.in("p_key_id",pkeyId);
|
|
|
+ updateWrapper.set("is_tab_pdf",2);
|
|
|
+ wbsTreeContractService.update(updateWrapper);
|
|
|
+
|
|
|
+ jdbcTemplate.execute(sqlInfo);
|
|
|
+ // this.getBussPdfInfo(Long.parseLong(pkeyId));
|
|
|
+ }
|
|
|
+ return R.success("1");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|