Commit ff9c001f authored by “yiyousong”'s avatar “yiyousong”
parents 3b7782ac f02dab53
package com.mortals.xhx.module.window.service.impl; package com.mortals.xhx.module.window.service.impl;
import cn.hutool.core.collection.ListUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
...@@ -25,6 +26,7 @@ import com.mortals.xhx.module.workman.model.WorkmanEntity; ...@@ -25,6 +26,7 @@ import com.mortals.xhx.module.workman.model.WorkmanEntity;
import com.mortals.xhx.module.workman.model.WorkmanQuery; import com.mortals.xhx.module.workman.model.WorkmanQuery;
import com.mortals.xhx.module.workman.service.WorkmanService; import com.mortals.xhx.module.workman.service.WorkmanService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -209,9 +211,9 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W ...@@ -209,9 +211,9 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
protected void saveAfter(WindowEntity entity, Context context) throws AppException { protected void saveAfter(WindowEntity entity, Context context) throws AppException {
super.saveAfter(entity, context); super.saveAfter(entity, context);
//判断是否存在id,如果不存在 查询后获取 //判断是否存在id,如果不存在 查询后获取
if(entity.newEntity()){ if (entity.newEntity()) {
WindowEntity windowEntity = this.selectOne(new WindowQuery().siteId(entity.getSiteId()).fromnum(entity.getFromnum())); WindowEntity windowEntity = this.selectOne(new WindowQuery().siteId(entity.getSiteId()).fromnum(entity.getFromnum()));
if(!ObjectUtils.isEmpty(windowEntity)){ if (!ObjectUtils.isEmpty(windowEntity)) {
entity.setId(windowEntity.getId()); entity.setId(windowEntity.getId());
} }
} }
...@@ -238,4 +240,37 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W ...@@ -238,4 +240,37 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
log.error("异常:", e); log.error("异常:", e);
} }
} }
/**
* @param list
* @param updateSupport
* @param context
* @return
*/
@Override
public String importList(List<WindowEntity> 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();
for (WindowEntity entity : list) {
entity.setCreateUserId(this.getContextUserId(context));
entity.setCreateTime(new Date());
this.save(entity, context);
successNum++;
}
successMsg.insert(0, "数据导入成功!共 " + successNum + " 条");
if (failureNum > 0) {
failureMsg.insert(0, "导入失败!共 " + failureNum + " 条数据格式不正确");
successMsg.append("\n");
successMsg.append(failureMsg);
}
return successMsg.toString();
}
} }
\ No newline at end of file
...@@ -14,8 +14,9 @@ Content-Type: application/json ...@@ -14,8 +14,9 @@ Content-Type: application/json
{ {
"page":1, "page":1,
"size":10, "size":10,
"andConditionList":[{"name":"%张三%","number":"%123%"}] "andConditionList":[{"name":"%张三%","number":"%123%","deptName":"%123%","windowName":"%123%"}]
} }
......
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