Commit 3f61a227 authored by “yiyousong”'s avatar “yiyousong”
parents 559c732d a96ea319
......@@ -9,4 +9,5 @@ VUE_APP_TBAS_KEY=admin.tabs
VUE_APP_TBAS_TITLES_KEY=admin.tabs.titles
#VUE_APP_API_BASE_URL=http://api.iczer.com
#门户
VUE_APP_API_portal_URL=http://192.168.0.98:11072
\ No newline at end of file
#VUE_APP_API_portal_URL=http://192.168.0.98:11072
VUE_APP_API_portal_URL=http://10.12.185.213:11072
\ No newline at end of file
#开发环境
NODE_ENV = "development"
VUE_APP_API_BASE_URL=http://192.168.0.98:11078
\ No newline at end of file
#VUE_APP_API_BASE_URL=http://192.168.0.98:11078
VUE_APP_API_BASE_URL=http://10.12.185.213:11071
\ No newline at end of file
......@@ -4,11 +4,9 @@ const ThemeColorReplacer = require("webpack-theme-color-replacer");
const { getThemeColors, modifyVars } = require("./src/utils/themeUtil");
const { resolveCss } = require("./src/utils/theme-color-replacer-extend");
const CompressionWebpackPlugin = require("compression-webpack-plugin");
const productionGzipExtensions = ["js", "css"];
const isProd = process.env.NODE_ENV === "production";
const assetsCDN = {
// webpack build externals
// externals: {
......@@ -34,9 +32,8 @@ const assetsCDN = {
],
};
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
module.exports = {
devServer: {
disableHostCheck: true,
......@@ -59,7 +56,15 @@ module.exports = {
patterns: [path.resolve(__dirname, "./src/theme/theme.less")],
},
},
//富文本改变图片大小插件
configureWebpack: {
plugins: [
new webpack.ProvidePlugin({
"window.Quill": "quill/dist/quill.js",
Quill: "quill/dist/quill.js",
}),
],
},
css: {
loaderOptions: {
less: {
......
......@@ -103,11 +103,11 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
@Override
protected void updateBefore(SiteEntity entity, Context context) throws AppException {
//校验下前后名称是否一直 如果不一致 同步修改所以关联
SiteEntity siteEntity = this.get(entity.getId(), context);
if(!siteEntity.getSiteName().equals(entity.getSiteName())){
SiteEntity oldSite = this.get(entity.getId(), context);
if(!oldSite.getSiteName().equals(entity.getSiteName())){
//todo
//更新关联站点名称
updateAssociateSiteName(entity, context);
updateAssociateSiteName(oldSite,entity, context);
//通知设备更新站点信息
DevicePdu devicePdu = new DevicePdu();
devicePdu.setSiteId(entity.getId());
......@@ -116,8 +116,43 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
super.updateBefore(entity, context);
}
private void updateAssociateSiteName(SiteEntity entity, Context context) {
List<WindowEntity> windowEntityList = windowService.find(new WindowQuery().siteId(entity.getId()));
private void updateAssociateSiteName(SiteEntity oldSite,SiteEntity newSite, Context context) {
//更新窗口站点名称
WindowEntity windowEntity = new WindowEntity();
windowEntity.setSiteName(newSite.getSiteName());
WindowEntity condition = new WindowEntity();
condition.setSiteName(oldSite.getSiteName());
windowService.updateBatch(windowEntity,condition,context);
//更新站点业务名称
SiteBusinessEntity siteBusinessEntity = new SiteBusinessEntity();
siteBusinessEntity.setSiteName(newSite.getSiteName());
SiteBusinessEntity siteBusinessCondition = new SiteBusinessEntity();
siteBusinessCondition.setSiteName(oldSite.getSiteName());
siteBusinessService.updateBatch(siteBusinessEntity,siteBusinessCondition,context);
//更新站点事项名称
SiteMatterEntity siteMatterEntity = new SiteMatterEntity();
siteMatterEntity.setSiteName(newSite.getSiteName());
SiteMatterEntity siteMatterCondition = new SiteMatterEntity();
siteMatterCondition.setSiteName(oldSite.getSiteName());
siteMatterService.updateBatch(siteMatterEntity,siteMatterCondition,context);
//更新站点主题事项名称
SiteThemeMatterEntity siteThemeMatterEntity = new SiteThemeMatterEntity();
siteThemeMatterEntity.setSiteName(newSite.getSiteName());
SiteThemeMatterEntity siteThemeMatterCondition = new SiteThemeMatterEntity();
siteThemeMatterCondition.setSiteName(oldSite.getSiteName());
siteThemeMatterService.updateBatch(siteThemeMatterEntity,siteThemeMatterCondition,context);
//更新工作人员站点
WorkmanEntity workmanEntity = new WorkmanEntity();
workmanEntity.setSiteName(newSite.getSiteName());
WorkmanEntity workmanEntityCondition = new WorkmanEntity();
workmanEntityCondition.setSiteName(oldSite.getSiteName());
workmanService.updateBatch(workmanEntity,workmanEntityCondition,context);
/* List<WindowEntity> windowEntityList = windowService.find(new WindowQuery().siteId(entity.getId()));
windowEntityList.forEach(item->item.setSiteName(entity.getSiteName()));
windowService.update(windowEntityList, context);
......@@ -139,7 +174,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
//更新工作人员站点
List<WorkmanEntity> workmanEntities = workmanService.find(new WorkmanQuery().siteId(entity.getId()));
workmanEntities.forEach(item->item.setSiteName(entity.getSiteName()));
workmanService.update(workmanEntities, context);
workmanService.update(workmanEntities, context);*/
}
@Override
......
......@@ -17,6 +17,7 @@ import com.mortals.xhx.module.workman.model.WorkmanQuery;
import com.mortals.xhx.module.workman.service.WorkmanService;
import lombok.Getter;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -52,7 +53,6 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
@Override
protected void saveBefore(WorkmanEntity entity, Context context) throws AppException {
if (StringUtils.isNull(entity.getLoginName())) {
throw new AppException("账号不能为空!");
}
......@@ -60,8 +60,8 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
if (StringUtils.isNull(entity.getLoginPwd())) {
throw new AppException("密码不能为空!");
}
List<WorkmanEntity> list = this.find(new WorkmanQuery().loginName(entity.getLoginName()));
if (CollectionUtils.isNotEmpty(list)) {
int count = this.count(new WorkmanQuery().loginName(entity.getLoginName()),context);
if (count>0) {
throw new AppException("账号已存在!");
}
......@@ -145,7 +145,7 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
*/
@Override
public Rest<Void> doImportPic(String picfilePath) throws AppException {
String disPath = filePath+"/pics/" + FileUtil.getPrefix(picfilePath).trim();
String disPath = filePath + "/pics/" + FileUtil.getPrefix(picfilePath).trim();
String targetFilePath = uploadService.getFilePath(picfilePath);
if (FileUtil.isEmpty(new File(targetFilePath))) {
throw new AppException("文件不存在!");
......@@ -188,4 +188,57 @@ public class WorkmanServiceImpl extends AbstractCRUDCacheServiceImpl<WorkmanDao,
}
}
/**
* @param list
* @param updateSupport
* @param context
* @return
*/
@Override
public String importList(List<WorkmanEntity> list, Boolean updateSupport, Context context) {
if (ObjectUtils.isEmpty(list)) {
throw new AppException("导入数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
StringBuilder failureDetailMsg = new StringBuilder();
for (WorkmanEntity entity : list) {
try {
entity.setCreateUserId(context == null ? 1L : context.getUser() == null ? 1L : context.getUser().getId());
entity.setCreateTime(new Date());
WorkmanEntity save = this.save(entity, context);
if (save != null) {
successNum++;
}
} catch (Exception e) {
log.error("导入异常", e);
failureNum++;
failureDetailMsg.append("\n");
failureDetailMsg.append(String.format("导入工作人员数据失败!用户名:%s", entity.getName()));
failureDetailMsg.append("\n");
}
}
successMsg.insert(0, "数据导入成功!共 " + successNum + " 条");
if (failureNum > 0) {
failureMsg.insert(0, "导入失败!共 " + failureNum + " 条数据格式不正确");
successMsg.append("\n");
successMsg.append(failureMsg);
successMsg.append(failureDetailMsg);
} else {
}
return successMsg.toString();
}
public static void main(String[] args) throws Exception {
System.out.println(SecurityUtil.md5DoubleEncoding(""));
}
}
\ No newline at end of file
package com.mortals.xhx.module.workman.web;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.alibaba.fastjson.JSON;
......@@ -69,7 +70,6 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
private UploadService uploadService;
public WorkmanController() {
super.setModuleDesc("工作人员");
}
......@@ -116,7 +116,7 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
public String doImportPic(@RequestBody WorkmanEntity query) {
JSONObject ret = new JSONObject();
try {
log.info("filePath:"+query.getFilePath());
log.info("filePath:" + query.getFilePath());
Rest<Void> rest = this.service.doImportPic(query.getFilePath());
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
recordSysLog(request, getCurUser(), "解析工作人员图片成功!");
......@@ -183,12 +183,12 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
workmanEntity.setSiteName(siteEntity.getSiteName());
}
if(ObjectUtils.isEmpty(workmanEntity.getLoginName())){
String loginName = PinyinUtil.getPinyin(workmanEntity.getName(),"");
if (ObjectUtils.isEmpty(workmanEntity.getLoginName())) {
String loginName = PinyinUtil.getPinyin(StrUtil.cleanBlank(workmanEntity.getName()), "");
workmanEntity.setLoginName(loginName);
}
if(ObjectUtils.isEmpty(workmanEntity.getLoginPwd())){
if (ObjectUtils.isEmpty(workmanEntity.getLoginPwd())||"".equals(workmanEntity.getLoginPwd().trim())) {
workmanEntity.setLoginPwd("123");
}
......@@ -212,18 +212,23 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
workmanEntity.setPicObj(null);
}
} catch (IOException e) {
log.error("写入证照异常",e);
log.error("写入证照异常", e);
}
}
}
super.doImportDataBefore(list, updateSupport, context);
}
public static void main(String[] args) {
System.out.println( StrUtil.removeAllLineBreaks(PinyinUtil.getPinyin("张三","")));
System.out.println(StrUtil.cleanBlank(PinyinUtil.getPinyin("张 三", "")));
//
// System.out.println(Base64.encode(new JSONObject().toJSONString()));
// System.out.println( com.mortals.framework.util.Base64.encode(new JSONObject().toJSONString().getBytes()));
//
//
System.out.println(Base64.encode("[]"));
}
......
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