Commit 1ee6f443 by songyinghui

feature: 驼峰字典

parent 4878a1a0
......@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.service.content.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.hologres.client.HoloClient;
import com.alibaba.hologres.client.Put;
import com.alibaba.hologres.client.model.TableSchema;
......@@ -78,11 +80,15 @@ public class TriggerCustomerDetailServiceImpl implements TriggerCustomerDetailSe
return;
}
TableSchema tableSchema = client.getTableSchema("tab_haoban_trigger_customer_detail");
SerializeConfig serializeConfig = new SerializeConfig();
serializeConfig.setPropertyNamingStrategy(PropertyNamingStrategy.SnakeCase);
// id, enterprise_id, wx_enterprise_id, biz_id, biz_type, clerk_id, staff_id,store_id, channel_type, customer_id, create_time, update_time, delete_flag
List<Put> puts = triggerCustomerDetailBos
.stream()
.map(item -> {
Put temp = new Put(tableSchema);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(item));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(item, serializeConfig));
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
temp.setObject(entry.getKey(), entry.getValue());
}
......
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.pojo.bo.content.PotentialCustomerBO;
......@@ -83,5 +85,10 @@ public class PotentialCustomerServiceTest {
triggerCustomerDetailBO.setDeleteFlag(1);
triggerCustomerDetailBO.setId(UniqueIdUtils.uniqueLong());
triggerCustomerDetailService.batchSave(Collections.singletonList(triggerCustomerDetailBO));
SerializeConfig serializeConfig = new SerializeConfig();
serializeConfig.setPropertyNamingStrategy(PropertyNamingStrategy.SnakeCase);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(triggerCustomerDetailBO, serializeConfig));
System.out.println(jsonObject.toJSONString());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment