|
@@ -12,6 +12,7 @@ import com.xc.luckysheet.db.IRecordDataUpdataHandle;
|
|
import com.xc.luckysheet.db.IRecordDelHandle;
|
|
import com.xc.luckysheet.db.IRecordDelHandle;
|
|
import com.xc.luckysheet.db.IRecordSelectHandle;
|
|
import com.xc.luckysheet.db.IRecordSelectHandle;
|
|
import com.xc.luckysheet.dto.CoverageUpdateJsonDataRequest;
|
|
import com.xc.luckysheet.dto.CoverageUpdateJsonDataRequest;
|
|
|
|
+import com.xc.luckysheet.dto.SaveSheetRequest;
|
|
import com.xc.luckysheet.entity.ConfigMergeModel;
|
|
import com.xc.luckysheet.entity.ConfigMergeModel;
|
|
import com.xc.luckysheet.entity.GridRecordDataModel;
|
|
import com.xc.luckysheet.entity.GridRecordDataModel;
|
|
import com.xc.luckysheet.entity.LuckySheetGridModel;
|
|
import com.xc.luckysheet.entity.LuckySheetGridModel;
|
|
@@ -32,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -110,6 +112,49 @@ public class JfGridUpdateService {
|
|
, req.getValue().toString(SerializerFeature.WriteMapNullValue));
|
|
, req.getValue().toString(SerializerFeature.WriteMapNullValue));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 保存sheet
|
|
|
|
+ *
|
|
|
|
+ * @param req
|
|
|
|
+ */
|
|
|
|
+ @Transactional(value = "postgresTxManager",rollbackFor = Exception.class)
|
|
|
|
+ public void saveSheet(SaveSheetRequest req) {
|
|
|
|
+
|
|
|
|
+ //删除历史
|
|
|
|
+ List<String> mongodbKeys = new ArrayList<String>();//mongodb的key,用于删除
|
|
|
|
+ recordSelectHandle.getBlockMergeByGridKey(req.getListId(), req.getIndex(), mongodbKeys);
|
|
|
|
+ recordDelHandle.delDocuments(mongodbKeys);
|
|
|
|
+
|
|
|
|
+ List<JSONObject> blocks = JfGridConfigModel.toDataSplit(req.getRowSize(), req.getColSize(), req.getSheet());
|
|
|
|
+ List<GridRecordDataModel> list = new ArrayList<>(blocks.size());
|
|
|
|
+ for(JSONObject block : blocks) {
|
|
|
|
+ GridRecordDataModel model = new GridRecordDataModel();
|
|
|
|
+
|
|
|
|
+ model.setBlock_id(block.getString("block_id").trim());
|
|
|
|
+ model.setRow_col(null);
|
|
|
|
+ model.setIndex(block.getString("index").trim());
|
|
|
|
+ model.setList_id(req.getListId());
|
|
|
|
+ model.setIs_delete(0);
|
|
|
|
+
|
|
|
|
+ if(block.containsKey("status") && block.get("status")!=null){
|
|
|
|
+ model.setStatus(block.getInteger("status"));
|
|
|
|
+ }else{
|
|
|
|
+ model.setStatus(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(block.containsKey("order") && block.get("order")!=null){
|
|
|
|
+ model.setOrder(block.getInteger("order"));
|
|
|
|
+ }else{
|
|
|
|
+ model.setOrder(null);
|
|
|
|
+ }
|
|
|
|
+ model.setJson_data(block);
|
|
|
|
+
|
|
|
|
+ list.add(model);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ recordDataInsertHandle.InsertIntoBatch(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 生成luckysheet excel
|
|
* 生成luckysheet excel
|
|
*
|
|
*
|