Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
397634d57d
@ -90,6 +90,9 @@ public class DynamicTaskScheduler {
|
||||
commentModel =sxDataService.getCommentModel();
|
||||
}
|
||||
DataBaseInfo dataBaseInfo=sxDataService.getDataBaseInfo(commentModel);
|
||||
if(ObjectUtil.isNotEmpty(dataBaseInfo.getRefreshTime())){
|
||||
commentModel.setSyncTime(DateUtil.formatDateTime(dataBaseInfo.getRefreshTime()));
|
||||
}
|
||||
sxDataService.syncStoreData(dataBaseInfo,commentModel);
|
||||
sxDataService.SyncBranchList(dataBaseInfo,commentModel);
|
||||
sxDataService.SyncCategory(dataBaseInfo,commentModel);
|
||||
|
||||
@ -24,6 +24,8 @@ public class DataBaseInfo {
|
||||
private String cronExpression;
|
||||
@ApiModelProperty(value = "同步模式(1:定时同步,2:间隔同步)")
|
||||
private String syncMode;
|
||||
@ApiModelProperty(value = "是否双向同步(0:否,1:是)")
|
||||
private String isTowSync="1";
|
||||
|
||||
@ApiModelProperty(value = "商品分类")
|
||||
private String categoryName;
|
||||
|
||||
@ -65,4 +65,7 @@ public class StoreDbConfig implements Serializable {
|
||||
@ApiModelProperty(value = "刷新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date refreshTime;
|
||||
|
||||
@ApiModelProperty(value = "是否双向同步(0:否,1:是)")
|
||||
private String isTowSync="1";
|
||||
}
|
||||
|
||||
@ -653,6 +653,7 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
dataBaseInfo.setCronExpression(storeDbConfig.getCronExpression());
|
||||
dataBaseInfo.setCategoryName(storeDbConfig.getCategoryName());
|
||||
dataBaseInfo.setRefreshTime(storeDbConfig.getRefreshTime());
|
||||
dataBaseInfo.setIsTowSync(storeDbConfig.getIsTowSync());
|
||||
return dataBaseInfo;
|
||||
}
|
||||
return new DataBaseInfo();
|
||||
@ -660,6 +661,10 @@ public class SxDataServiceImp extends SxDataAbstService implements SxDataService
|
||||
|
||||
@Override
|
||||
public void syncStoreData(DataBaseInfo dataBaseInfo,CommentModel commentModel) {
|
||||
if(dataBaseInfo.getIsTowSync().equals("0")){
|
||||
log.info("不做双向同步数据库");
|
||||
return;
|
||||
}
|
||||
JSONObject jsonObject= restTemplate.getForObject(remoteIp+HttpUtils.URL_SYNC_GET_STOR_DATA_RELEASE
|
||||
+"?appKey="+commentModel.getAppKey()
|
||||
+"&sign="+commentModel.getSign(),JSONObject.class);
|
||||
|
||||
@ -89,4 +89,8 @@ public class StoreDbConfig implements Serializable {
|
||||
@ApiModelProperty(value = "刷新时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date refreshTime;
|
||||
|
||||
@TableField("is_two_sync")
|
||||
@ApiModelProperty(value = "是否双向同步(0:否,1:是)")
|
||||
private String isTowSync="1";
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.suisung.mall.common.utils;
|
||||
|
||||
import com.github.promeg.pinyinhelper.Pinyin;
|
||||
|
||||
public class TinyPinyinUtils{
|
||||
/**
|
||||
* 获取汉字全拼
|
||||
* @param chinese 中文字符串
|
||||
* @return 拼音字符串(小写)
|
||||
*/
|
||||
public static String getFullPinyin(String chinese) {
|
||||
if (chinese == null || chinese.trim().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return Pinyin.toPinyin(chinese, " ").toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取汉字首字母
|
||||
* @param chinese 中文字符串
|
||||
* @return 首字母字符串(大写)
|
||||
*/
|
||||
public static String getFirstLetters(String chinese) {
|
||||
if (chinese == null || chinese.trim().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder firstLetters = new StringBuilder();
|
||||
for (char c : chinese.toCharArray()) {
|
||||
if (Pinyin.isChinese(c)) {
|
||||
String pinyin = Pinyin.toPinyin(c);
|
||||
if (!pinyin.isEmpty()) {
|
||||
firstLetters.append(pinyin.charAt(0));
|
||||
}
|
||||
} else {
|
||||
firstLetters.append(c);
|
||||
}
|
||||
}
|
||||
return firstLetters.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String text = "其他品牌";
|
||||
|
||||
System.out.println("全拼: " + getFullPinyin(text));
|
||||
// 输出: SHANGPINSHUJUQUANXIANKONGZHI
|
||||
|
||||
System.out.println("首字母: " + getFirstLetters(text));
|
||||
|
||||
System.out.println("首字母: " + getFullPinyin(text).charAt(0));
|
||||
// 输出: SPSJQXKZ
|
||||
}
|
||||
}
|
||||
@ -15,6 +15,7 @@ import com.suisung.mall.common.modules.base.ShopBaseProductCategory;
|
||||
import com.suisung.mall.common.utils.CheckUtil;
|
||||
import com.suisung.mall.common.utils.FilterUtils;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.common.utils.TinyPinyinUtils;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.base.mapper.ShopBaseProductBrandMapper;
|
||||
import com.suisung.mall.shop.base.service.ShopBaseProductBrandService;
|
||||
@ -118,11 +119,8 @@ public class ShopBaseProductBrandServiceImpl extends BaseServiceImpl<ShopBasePro
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean saveOrUpdateBrand(ShopBaseProductBrand shopBaseProductBrand) {
|
||||
|
||||
//shopBaseProductBrand.setBrand_name_pinyin("qi ta pin pai");
|
||||
shopBaseProductBrand.setBrand_name_pinyin(PinyinUtil.getPinyin(shopBaseProductBrand.getBrand_name()));
|
||||
shopBaseProductBrand.setBrand_name_pinyin(TinyPinyinUtils.getFullPinyin(shopBaseProductBrand.getBrand_name()));
|
||||
shopBaseProductBrand.setBrand_initial(Convert.toStr(shopBaseProductBrand.getBrand_name_pinyin().charAt(0)));
|
||||
//shopBaseProductBrand.setBrand_initial("q");
|
||||
|
||||
Integer store_id = shopBaseProductBrand.getStore_id();
|
||||
boolean isPlatform = true;
|
||||
|
||||
1
sql/shop/dev/202506017_ddl.sql
Normal file
1
sql/shop/dev/202506017_ddl.sql
Normal file
@ -0,0 +1 @@
|
||||
alter table store_db_config add column is_two_sync char(1) NOT NULL DEFAULT '1' COMMENT '是否双向同步(0:否,1:是)';
|
||||
Loading…
Reference in New Issue
Block a user