update
This commit is contained in:
parent
f2f6078600
commit
7e32f84cf1
@ -33,7 +33,6 @@ public class UserServiceImpl implements UserService {
|
||||
@Autowired
|
||||
private RoleDao roleDao;
|
||||
|
||||
|
||||
@Override
|
||||
public LoginVO matchAuth(LoginDTO loginDTO) {
|
||||
if (!userDao.existUser(loginDTO.getPhone())) {
|
||||
@ -45,22 +44,23 @@ public class UserServiceImpl implements UserService {
|
||||
}
|
||||
|
||||
LoginVO loginVO = new LoginVO();
|
||||
//判断是否已经登录过
|
||||
String newToken = null;
|
||||
// 判断是否已经登录过
|
||||
if (TokenUtil.existKey(user.getPhone())) {
|
||||
String oldToken = (String) TokenUtil.get(user.getPhone());
|
||||
if (TokenUtil.existKey(oldToken)) {
|
||||
//已经登录,将旧token过期,
|
||||
TokenUtil.expireKey(oldToken);
|
||||
TokenUtil.expireKey(oldToken + " : USER_PHONE");
|
||||
}
|
||||
newToken = (String) TokenUtil.get(user.getPhone());
|
||||
// if (TokenUtil.existKey(oldToken)) {
|
||||
// // 已经登录,将旧token过期,
|
||||
// TokenUtil.expireKey(oldToken);
|
||||
// TokenUtil.expireKey(oldToken + " : USER_PHONE");
|
||||
// }
|
||||
} else {
|
||||
// 生成新的token并存入redis
|
||||
newToken = UUID.randomUUID().toString();
|
||||
TokenUtil.set(user.getPhone(), newToken);
|
||||
TokenUtil.set(newToken + " : USER_PHONE", user.getPhone());
|
||||
}
|
||||
|
||||
//生成新的token并存入redis
|
||||
String newToken = UUID.randomUUID().toString();
|
||||
TokenUtil.set(user.getPhone(), newToken);
|
||||
TokenUtil.set(newToken + " : USER_PHONE", user.getPhone());
|
||||
|
||||
//生成角色列表
|
||||
// 生成角色列表
|
||||
Set<String> roleNameSet = new HashSet<>();
|
||||
for (Role role : user.getRoleSet()) {
|
||||
Set<String> routeSet = new HashSet<>();
|
||||
@ -77,17 +77,13 @@ public class UserServiceImpl implements UserService {
|
||||
loginVO.setIdNumber(user.getIdNumber());
|
||||
loginVO.setPhone(user.getPhone());
|
||||
if (user.getRoleSet() != null) {
|
||||
loginVO.setRoleSet(user.getRoleSet().stream()
|
||||
.map(role -> {
|
||||
RoleVO roleVO = new RoleVO();
|
||||
roleVO.setName(role.getName());
|
||||
roleVO.setAuthoritySet(role.getAuthoritySet().stream()
|
||||
.map(AuthEnum::getName)
|
||||
.collect(Collectors.toSet())
|
||||
);
|
||||
return roleVO;
|
||||
})
|
||||
.collect(Collectors.toSet()));
|
||||
loginVO.setRoleSet(user.getRoleSet().stream().map(role -> {
|
||||
RoleVO roleVO = new RoleVO();
|
||||
roleVO.setName(role.getName());
|
||||
roleVO.setAuthoritySet(
|
||||
role.getAuthoritySet().stream().map(AuthEnum::getName).collect(Collectors.toSet()));
|
||||
return roleVO;
|
||||
}).collect(Collectors.toSet()));
|
||||
}
|
||||
loginVO.setDepartmentList(user.getDepartmentList());
|
||||
loginVO.setAdministrativeArea(user.getAdministrativeArea());
|
||||
@ -136,18 +132,13 @@ public class UserServiceImpl implements UserService {
|
||||
userVO.setIdNumber(user.getIdNumber());
|
||||
userVO.setAdministrativeArea(user.getAdministrativeArea());
|
||||
if (user.getRoleSet() != null) {
|
||||
userVO.setRoleSet(user.getRoleSet().stream()
|
||||
.map(role -> {
|
||||
RoleVO roleVO = new RoleVO();
|
||||
roleVO.setName(role.getName());
|
||||
roleVO.setAuthoritySet(role.getAuthoritySet().stream()
|
||||
.map(AuthEnum::getName)
|
||||
.collect(Collectors.toSet())
|
||||
);
|
||||
return roleVO;
|
||||
})
|
||||
.collect(Collectors.toSet())
|
||||
);
|
||||
userVO.setRoleSet(user.getRoleSet().stream().map(role -> {
|
||||
RoleVO roleVO = new RoleVO();
|
||||
roleVO.setName(role.getName());
|
||||
roleVO.setAuthoritySet(
|
||||
role.getAuthoritySet().stream().map(AuthEnum::getName).collect(Collectors.toSet()));
|
||||
return roleVO;
|
||||
}).collect(Collectors.toSet()));
|
||||
}
|
||||
return userVO;
|
||||
}).collect(Collectors.toList());
|
||||
@ -200,5 +191,4 @@ public class UserServiceImpl implements UserService {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.util.Map;
|
||||
import com.example.survey.dao.RecordDao;
|
||||
import com.example.survey.entity.Record;
|
||||
import com.example.survey.enumeration.RecordStateEnum;
|
||||
import com.google.common.collect.Multiset.Entry;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -21,7 +22,7 @@ public class CaseQuestionnaireUtil implements Runnable {
|
||||
|
||||
public static void main() {
|
||||
CaseQuestionnaireUtil c = new CaseQuestionnaireUtil();
|
||||
// Record record =
|
||||
// Record record =
|
||||
// c.setRecord(record);
|
||||
c.start();
|
||||
}
|
||||
@ -50,12 +51,17 @@ public class CaseQuestionnaireUtil implements Runnable {
|
||||
String outputPath = this.report + record.getUuid() + ".docx";
|
||||
try {
|
||||
Map<String, Object> values = record.getValues();
|
||||
if (!values.containsKey("调查人"))
|
||||
values.put("调查人", record.getOperationList().get(0).getUser().getUsername());
|
||||
if (!values.containsKey("调查日期"))
|
||||
values.put("调查日期", new SimpleDateFormat("yyyy年MM月dd日").format(new java.util.Date()));
|
||||
Map<String, Object> newValues = new HashMap<String, Object>();
|
||||
for (Map.Entry<String, Object> entry : values.entrySet()) {
|
||||
newValues.put(entry.getKey().trim(), entry.getValue());
|
||||
}
|
||||
|
||||
WordUtil wordUtil = new WordUtil(values, templatePath, outputPath);
|
||||
if (!newValues.containsKey("调查人"))
|
||||
newValues.put("调查人", record.getOperationList().get(0).getUser().getUsername());
|
||||
if (!newValues.containsKey("调查日期"))
|
||||
newValues.put("调查日期", new SimpleDateFormat("yyyy年MM月dd日").format(new java.util.Date()));
|
||||
|
||||
WordUtil wordUtil = new WordUtil(newValues, templatePath, outputPath);
|
||||
wordUtil.export2QuestionnaireWord();
|
||||
record.setState(RecordStateEnum.REVIEWED.getValue());
|
||||
recordDao.saveRecord(record);
|
||||
|
@ -127,7 +127,7 @@ public class WordUtil {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
if (valueObj instanceof ArrayList<?>) {
|
||||
for (Object o : (List<?>) valueObj) {
|
||||
String value = o.toString();
|
||||
String value = o.toString().trim();
|
||||
try {
|
||||
Date date = dateFormat.parse(value);
|
||||
replaceInParagragh(paragraph, key, new SimpleDateFormat("yyyy年MM月dd日").format(date));
|
||||
@ -139,13 +139,13 @@ public class WordUtil {
|
||||
} else if (valueObj.getClass().isArray()) {
|
||||
Object[] arr = (Object[]) valueObj;
|
||||
try {
|
||||
Date date = dateFormat.parse(arr[0].toString());
|
||||
Date date = dateFormat.parse(arr[0].toString().trim());
|
||||
replaceInParagragh(paragraph, key, new SimpleDateFormat("yyyy年MM月dd日").format(date));
|
||||
} catch (Exception e) {
|
||||
replaceInParagragh(paragraph, key, arr[0].toString());
|
||||
replaceInParagragh(paragraph, key, arr[0].toString().trim());
|
||||
}
|
||||
} else {
|
||||
String value = valueObj.toString();
|
||||
String value = valueObj.toString().trim();
|
||||
try {
|
||||
Date date = dateFormat.parse(value);
|
||||
replaceInParagragh(paragraph, key, new SimpleDateFormat("yyyy年MM月dd日").format(date));
|
||||
@ -171,17 +171,17 @@ public class WordUtil {
|
||||
Object valueObj = values.get(trueKey);
|
||||
if (valueObj instanceof ArrayList<?>) {
|
||||
for (Object o : (List<?>) valueObj) {
|
||||
String oldText = o.toString() + "□";
|
||||
String oldText = o.toString().trim() + "□";
|
||||
TextSegment tSegment = paragraph.searchText(oldText,
|
||||
new PositionInParagraph(startPosRun, 0, 0));
|
||||
if (tSegment != null) {
|
||||
String newText = o.toString();
|
||||
String newText = o.toString().trim();
|
||||
replaceInParagragh(paragraph, tSegment, oldText, newText);
|
||||
} else {
|
||||
oldText = "□" + o.toString();
|
||||
oldText = "□" + o.toString().trim();
|
||||
tSegment = paragraph.searchText(oldText, new PositionInParagraph(startPosRun, 0, 0));
|
||||
if (tSegment != null) {
|
||||
String newText = o.toString();
|
||||
String newText = o.toString().trim();
|
||||
replaceInParagragh(paragraph, tSegment, oldText, newText);
|
||||
}
|
||||
}
|
||||
@ -189,33 +189,33 @@ public class WordUtil {
|
||||
} else if (valueObj.getClass().isArray()) {
|
||||
Object[] arr = (Object[]) valueObj;
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
String oldText = arr[i] + "□";
|
||||
String oldText = arr[i].toString().trim() + "□";
|
||||
TextSegment tSegment = paragraph.searchText(oldText,
|
||||
new PositionInParagraph(startPosRun, 0, 0));
|
||||
if (tSegment != null) {
|
||||
String newText = arr[i].toString();
|
||||
String newText = arr[i].toString().trim();
|
||||
replaceInParagragh(paragraph, tSegment, oldText, newText);
|
||||
} else {
|
||||
oldText = "□" + arr[i];
|
||||
oldText = "□" + arr[i].toString().trim();
|
||||
tSegment = paragraph.searchText(oldText, new PositionInParagraph(startPosRun, 0, 0));
|
||||
if (tSegment != null) {
|
||||
String newText = arr[i].toString();
|
||||
String newText = arr[i].toString().trim();
|
||||
replaceInParagragh(paragraph, tSegment, oldText, newText);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String oldText = valueObj.toString() + "□";
|
||||
String oldText = valueObj.toString().trim() + "□";
|
||||
TextSegment tSegment = paragraph.searchText(oldText,
|
||||
new PositionInParagraph(startPosRun, 0, 0));
|
||||
if (tSegment != null) {
|
||||
String newText = valueObj.toString();
|
||||
String newText = valueObj.toString().trim();
|
||||
replaceInParagragh(paragraph, tSegment, oldText, newText);
|
||||
} else {
|
||||
oldText = "□" + valueObj.toString();
|
||||
oldText = "□" + valueObj.toString().trim();
|
||||
tSegment = paragraph.searchText(oldText, new PositionInParagraph(startPosRun, 0, 0));
|
||||
if (tSegment != null) {
|
||||
String newText = valueObj.toString();
|
||||
String newText = valueObj.toString().trim();
|
||||
replaceInParagragh(paragraph, tSegment, oldText, newText);
|
||||
}
|
||||
}
|
||||
|
BIN
template/58种流行病学调查表-传染病.doc
Normal file
BIN
template/58种流行病学调查表-传染病.doc
Normal file
Binary file not shown.
Binary file not shown.
BIN
template/HIV/AIDS个案调查表.docx
Normal file
BIN
template/HIV/AIDS个案调查表.docx
Normal file
Binary file not shown.
BIN
template/传染性非典型肺炎病例个案调查表.docx
Normal file
BIN
template/传染性非典型肺炎病例个案调查表.docx
Normal file
Binary file not shown.
BIN
template/急性弛缓性麻痹病例麻痹60天后随访调查表.docx
Normal file
BIN
template/急性弛缓性麻痹病例麻痹60天后随访调查表.docx
Normal file
Binary file not shown.
BIN
template/流行性乙型脑炎流行病学个案调查表.docx
Normal file
BIN
template/流行性乙型脑炎流行病学个案调查表.docx
Normal file
Binary file not shown.
BIN
template/流行性出血热流行病学个案调查表.docx
Normal file
BIN
template/流行性出血热流行病学个案调查表.docx
Normal file
Binary file not shown.
BIN
template/流行病学调查表-传染病.doc
Normal file
BIN
template/流行病学调查表-传染病.doc
Normal file
Binary file not shown.
BIN
template/狂犬病流行病学个案调查表.docx
Normal file
BIN
template/狂犬病流行病学个案调查表.docx
Normal file
Binary file not shown.
BIN
template/登革热(登革出血热)个案调查表.docx
Normal file
BIN
template/登革热(登革出血热)个案调查表.docx
Normal file
Binary file not shown.
BIN
template/细菌性痢疾流行病学个案调查表.docx
Normal file
BIN
template/细菌性痢疾流行病学个案调查表.docx
Normal file
Binary file not shown.
BIN
template/经体液—皮肤(粘膜)传播病毒性肝炎病人个案调查表.docx
Normal file
BIN
template/经体液—皮肤(粘膜)传播病毒性肝炎病人个案调查表.docx
Normal file
Binary file not shown.
BIN
template/经粪一口途径传播的病毒性肝炎个案调查表.docx
Normal file
BIN
template/经粪一口途径传播的病毒性肝炎个案调查表.docx
Normal file
Binary file not shown.
BIN
template/肺结核流行病学个案调查表.docx
Normal file
BIN
template/肺结核流行病学个案调查表.docx
Normal file
Binary file not shown.
BIN
template/霍乱流行病学个案调查表.docx
Normal file
BIN
template/霍乱流行病学个案调查表.docx
Normal file
Binary file not shown.
BIN
template/鼠疫个案调查表.docx
Normal file
BIN
template/鼠疫个案调查表.docx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user