Commit ba505a4a LN

系统设置中:暂停自动任务改为开启自动任务。

1 个父辈 b3f39fa3
......@@ -232,14 +232,15 @@ public class DataInitManager {
Menu sysSetting = new Menu(new ArrayList<Menu>(), 1, "barcode", "条码设置", 1, "barcodeSetting", "system/barcodeSetting/index", "", 0, "database");
Menu outSet = new Menu(new ArrayList<Menu>(), 1, "outSetting", "出库策略", 1, "outSetting", "system/outSetting/index", "", 0, "outSet");
Menu sysSet = new Menu(new ArrayList<Menu>(), 1, "sysSetting", "系统设置", 1, "sysSetting", "system/sysSetting/index", "", 0, "sysSet");
Menu translationSet = new Menu(new ArrayList<Menu>(), 1, "translation", "资源翻译", 1, "translation", "system/translation/index", "", 0, "sysSet");
Menu translationSet = new Menu(new ArrayList<Menu>(), 1, "translation", "资源翻译", 1, "translation", "system/translation/index", "", 0, "translation");
Menu orderSet = new Menu(new ArrayList<Menu>(), 1, "orderSetting", "工单设置", 1, "orderSetting", "system/orderSetting/index", "", 0, "sysSet");
menuMenu.setHidden(true);
outSet.setHidden(true);
sysSet.setHidden(true);
// menuMenu.setHidden(true);
// sysSetting.setHidden(true);
menus.addAll(createMenus(poutSet, menuStorage, menuStoragePos, menuMenu, sysSetting,outSet,sysSet,translationSet));
menus.addAll(createMenus(poutSet, menuStorage, menuStoragePos, menuMenu, sysSetting,outSet,sysSet,translationSet,orderSet));
//用户管理:用户管理,角色管理
......
......@@ -94,10 +94,16 @@ public class Constants {
* 准备进行更新,不允许需求单出库
*/
public static final String CACHE_StopOut="stopOut";
/**
* 停止定时器任务
* 开启自动任务
*/
public static final String CACHE_StopJob="stopJob";
public static final String CACHE_StartJob="startJob";
//
// /**
// * 停止定时器任务
// */
// public static final String CACHE_StopJob="stopJob";
/**
*出库策略配置: 出库方式类型
......@@ -110,6 +116,11 @@ public class Constants {
public static final String CACHE_msdSetting="msdSetting";
/**
*工单设置
*/
public static final String CACHE_OrderSetting="orderSetting";
/**
* 客户端自定义配置
*/
public static final String CACHE_clientSetting="clientSetting";
......
......@@ -86,8 +86,8 @@ public class DataCache {
if (cacheMap.get(Constants.CACHE_StopOut) == null) {
updateCache(Constants.CACHE_StopOut, false);
}
if (cacheMap.get(Constants.CACHE_StopJob) == null) {
updateCache(Constants.CACHE_StopJob, false);
if (cacheMap.get(Constants.CACHE_StartJob) == null) {
updateCache(Constants.CACHE_StartJob, false);
}
}
......
......@@ -12,9 +12,9 @@ import com.neotel.smfcore.core.language.rest.bean.dto.LanguageResourceDto;
import com.neotel.smfcore.core.language.rest.bean.mapstruct.LanguageMsgMapper;
import com.neotel.smfcore.core.language.rest.bean.query.LanguageMsgCriteria;
import com.neotel.smfcore.core.language.service.bean.Content;
import com.neotel.smfcore.core.language.service.bean.LanguageInfo;
import com.neotel.smfcore.core.language.service.nanager.ILanguageMsgManager;
import com.neotel.smfcore.core.language.service.po.LanguageMsg;
import com.neotel.smfcore.core.language.util.MessageService;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.bean.FileProperties;
......@@ -48,23 +48,16 @@ public class LanguageMsgController {
@Autowired
LanguageMsgMapper languageMsgMapper;
@Autowired
MessageService messageService;
@Autowired
private final FileProperties properties;
@Autowired
DataCache dataCache;
public List<String> getAllLanList() {
List<LanguageInfo> lanList = dataCache.getLanguageList();
List<String> list = new ArrayList<>();
for (LanguageInfo lan : lanList
) {
list.add(lan.getLanCode());
}
return list;
}
@ApiOperation("导入资源文件")
@PostMapping(value = "/upload")
......@@ -88,15 +81,15 @@ public class LanguageMsgController {
String lanType = getLanTypeByFileName(uploadFile.getOriginalFilename());
if (smfclientType.contains(fileType)) {
//客户端js文件处理
Map<String, String> proMap = MessageUtils.readJsFile(file);
resultMsg = ResourceUpload(uploadFile.getOriginalFilename(), proMap, lanType, "smfclient");
Map<String, String> proMap = messageService.readJsFile(file);
resultMsg =messageService.resourceUpload(uploadFile.getOriginalFilename(), proMap, lanType, "smfclient");
} else if (smfcoreType.contains(fileType)) {
Map<String, String> proMap = MessageUtils.readPropertiesFile(file);
resultMsg = ResourceUpload(uploadFile.getOriginalFilename(), proMap, lanType, "");
Map<String, String> proMap = messageService.readPropertiesFile(file);
resultMsg = messageService.resourceUpload(uploadFile.getOriginalFilename(), proMap, lanType, "");
}
if(csvType.equals(fileType)){
List<LanguageMsg> list=MessageUtils.readCsvFile(file.getAbsolutePath(),dataCache.getLanguageList());
msgListUpload(list);
List<LanguageMsg> list=messageService.readCsvFile(file.getAbsolutePath(),dataCache.getLanguageList());
messageService.msgListUpload(file.getName(), list);
}
return ResultBean.newOkResult(resultMsg);
}
......@@ -106,7 +99,7 @@ public class LanguageMsgController {
@GetMapping(value = "/download")
public void download(HttpServletResponse response, LanguageMsgCriteria criteria) throws Exception {
Query query = QueryHelp.getQuery(criteria);
int languageSize=getAllLanList().size();
int languageSize=messageService.getAllLanList().size();
if (criteria.getTranslationState() != null) {
if (criteria.getTranslationState() == 1) {
// db.getCollection('languageMsg').find({contentList:{$elemMatch:{lanCode:"en-US"}}})
......@@ -133,7 +126,7 @@ public class LanguageMsgController {
List<String> typeList=languageMsgManager.findTypeList();
int languageSize=getAllLanList().size();
int languageSize=messageService.getAllLanList().size();
Query query= QueryHelp.getQuery(criteria);
if (criteria.getTranslationState() != null) {
if (criteria.getTranslationState() == 1) {
......@@ -190,7 +183,7 @@ public class LanguageMsgController {
lanCode=lanCode.replace("_","-");
List<LanguageMsg> msgList=MessageUtils.getLanMsgByType(type);
Map<String,Map<String,String>> resourceMap=new HashMap<>();
List<String> allLantypeList=getAllLanList();
List<String> allLantypeList=messageService.getAllLanList();
for (LanguageMsg msg :
msgList) {
for (Content con :
......@@ -235,7 +228,7 @@ public class LanguageMsgController {
String type = paramsMap.get("type").toString();
List<String> lanList = getAllLanList();
List<String> lanList =messageService.getAllLanList();
for (String key :
paramsMap.keySet()) {
if (key.toString().equals("type")) {
......@@ -262,7 +255,7 @@ public class LanguageMsgController {
lanResourceMap.put(resKey,resValue.toString());
}
}
ResourceUpload("接口上传", lanResourceMap, lanType, type);
messageService.resourceUpload("接口上传", lanResourceMap, lanType, type);
}
return ResultBean.newOkResult("ok");
}
......@@ -294,7 +287,7 @@ public class LanguageMsgController {
private String getLanTypeByFileName(String orgFilename) {
String tname = orgFilename.replace('_', '-');
for (String lanType :
getAllLanList()) {
messageService.getAllLanList()) {
if(tname.contains(lanType)){
return lanType;
}
......@@ -303,126 +296,5 @@ public class LanguageMsgController {
return "";
}
private String ResourceUpload(String orgFileName,Map<String, String> proMap ,String lanCode, String type) {
List<LanguageMsg> newLanguageList = new ArrayList<>();
List<LanguageMsg> updateLanguageList = new ArrayList<>();
if (proMap != null && proMap.size() > 0) {
for (String key :
proMap.keySet()) {
String msgStr = proMap.get(key);
LanguageMsg msg = MessageUtils.getMsg(type,key);
//导入时只能新增不能修改
if (msg == null) {
msg = new LanguageMsg(key, msgStr,type);
msg.setContent(lanCode, msgStr);
newLanguageList.add(msg);
} else {
String oldMsg = msg.getContent(lanCode);
// if (!oldMsg.equals(msgStr)) {
if(ObjectUtil.isEmpty(oldMsg)){
msg.setContent(lanCode, msgStr);
//内容默认更改为中文
if(lanCode.equals(MessageUtils.ZH_CN)){
if(!msg.getMsg().equals(msgStr)){
msg.setMsg(msgStr);
}
}
updateLanguageList.add(msg);
languageMsgManager.save(msg);
MessageUtils.updateMsg(msg);
}
}
}
}
if (newLanguageList.size() > 0) {
languageMsgManager.insertAll(newLanguageList);
for (LanguageMsg msg :
newLanguageList) {
MessageUtils.updateMsg(msg);
}
}
log.info("导入资源[" + orgFileName + "]["+type+"]["+lanCode+"],共["+proMap.size()+"]条数据,共更新[" + updateLanguageList.size() + "]条资源,新增[" + newLanguageList.size() + "]条资源");
return "ok";
}
private void msgListUpload( List<LanguageMsg> msgList) {
List<LanguageMsg> newLanguageList = new ArrayList<>();
List<LanguageMsg> updateLanguageList = new ArrayList<>();
for (LanguageMsg msg :
msgList) {
if(ObjectUtil.isEmpty(msg.getCode())) {
//code不能为空
continue;
}
if(ObjectUtil.isEmpty(msg.getMsg())){
//内容不能为空
continue;
} if(ObjectUtil.isEmpty(msg.getType())){
//内容不能为空
continue;
}
List<Content> contentList = new ArrayList<>();
for (Content con :
msg.getContentList()) {
if (ObjectUtil.isEmpty(con.getLanCode()) || ObjectUtil.isEmpty(con.getMsg())) {
continue;
}
contentList.add(con);
}
//判断是否是新增
LanguageMsg oldMsg=MessageUtils.getMsg(msg.getType(), msg.getCode());
if(oldMsg==null){
newLanguageList.add(msg);
}
else{
boolean isUpdate=false;
//只新增不修改
List<String> allLanList=getAllLanList();
for (String lanType :
allLanList) {
String oldValue= oldMsg.getContent(lanType);
if(ObjectUtil.isEmpty(oldValue)){
oldMsg.setContent(lanType,msg.getContent(lanType));
isUpdate=true;
//内容默认更改为中文
if(lanType.equals(MessageUtils.ZH_CN)){
if(!oldMsg.getMsg().equals(oldValue)){
oldMsg.setMsg(oldValue);
}
}
}
}
if(isUpdate){
updateLanguageList.add(oldMsg);
languageMsgManager.save(oldMsg);
MessageUtils.updateMsg(oldMsg);
}
}
}
if (newLanguageList.size() > 0) {
languageMsgManager.insertAll(newLanguageList);
for (LanguageMsg msg :
newLanguageList) {
MessageUtils.updateMsg(msg);
}
}
log.info("导入csv资源,共["+msgList.size()+"]条数据,共更新[" + updateLanguageList.size() + "]条资源,新增[" + newLanguageList.size() + "]条资源");
}
}
......@@ -97,9 +97,9 @@ public class LiteOrderCache implements ITaskListener {
if(!isProcessTimer){
isProcessTimer = true;
try {
boolean stopJob = dataCache.getCache(Constants.CACHE_StopJob);
boolean startJob = dataCache.getCache(Constants.CACHE_StartJob);
if(!stopJob){
if(startJob){
//定时执行工单任务
executeOrderTask();
}
......
......@@ -180,7 +180,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
@Override
public void delete(StoragePos object) throws ValidateException {
storagePosDao.removeOneById(object.getId());
}
@Override
......
......@@ -13,6 +13,6 @@ public class SysSettingsDto implements Serializable {
@ApiModelProperty("准备进行更新,不允许需求单出库")
private boolean stopOut = false;
@ApiModelProperty("停止定时器任务")
private boolean stopJob = false;
@ApiModelProperty("开启自动任务")
private boolean startJob = false;
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!