优化代码

master
zengwh 5 years ago
parent b48853980c
commit d887e5dd59

2
.gitignore vendored

@ -1,3 +1,3 @@
/target/ target
/.idea/ /.idea/
*.iml *.iml

@ -449,16 +449,16 @@ public class FontController {
userVo.setMenus(menus); userVo.setMenus(menus);
//设置科室 //设置科室
String power_depts = ""; StringBuilder power_depts = new StringBuilder();
List<Power_Dept> power_depts1 = power_deptService.selectByPrimaryKeys(userVo.getDeptId()); List<Power_Dept> power_depts1 = power_deptService.selectByPrimaryKeys(userVo.getDeptId());
for(int j=0;j<power_depts1.size();j++){ for(int j=0;j<power_depts1.size();j++){
if(j<power_depts1.size()-1){ if(j<power_depts1.size()-1){
power_depts += power_depts1.get(j).getDeptName()+","; power_depts.append(power_depts1.get(j).getDeptName()).append(",");
}else{ }else{
power_depts += power_depts1.get(j).getDeptName(); power_depts.append(power_depts1.get(j).getDeptName());
} }
} }
userVo.setRemark(power_depts); userVo.setRemark(power_depts.toString());
//移除缓存 //移除缓存
CacheManager.removeCacheByObject(userVo); CacheManager.removeCacheByObject(userVo);
CacheManager.putCache(date,new Cache(date,userVo,TOKEN_EXPIRE_TIME)); CacheManager.putCache(date,new Cache(date,userVo,TOKEN_EXPIRE_TIME));

@ -109,16 +109,16 @@ public class LoginController {
user.setMenus(menus); user.setMenus(menus);
//设置科室 //设置科室
String power_depts = ""; StringBuilder power_depts = new StringBuilder();
List<Power_Dept> power_depts1 = power_deptService.selectByPrimaryKeys(user.getDeptId()); List<Power_Dept> power_depts1 = power_deptService.selectByPrimaryKeys(user.getDeptId());
for(int j=0;j<power_depts1.size();j++){ for(int j=0;j<power_depts1.size();j++){
if(j<power_depts1.size()-1){ if(j<power_depts1.size()-1){
power_depts += power_depts1.get(j).getDeptName()+","; power_depts.append(power_depts1.get(j).getDeptName()).append(",");
}else{ }else{
power_depts += power_depts1.get(j).getDeptName(); power_depts.append(power_depts1.get(j).getDeptName());
} }
} }
user.setRemark(power_depts); user.setRemark(power_depts.toString());
//设置进缓存 //设置进缓存
CacheManager.putCache(date,new Cache(date,user,TOKEN_EXPIRE_TIME)); CacheManager.putCache(date,new Cache(date,user,TOKEN_EXPIRE_TIME));

@ -161,17 +161,17 @@ public class Power_LogController {
public Msg deleteLogByIds(@PathVariable("ids")String ids){ public Msg deleteLogByIds(@PathVariable("ids")String ids){
try{ try{
String[] idList = ids.split(","); String[] idList = ids.split(",");
String str = ""; StringBuilder str = new StringBuilder();
for (int i = 0; i < idList.length; i++) { for (int i = 0; i < idList.length; i++) {
if(StringUtils.isNoneBlank(idList[i])){ if(StringUtils.isNoneBlank(idList[i])){
if(i != idList.length - 1){ if(i != idList.length - 1){
str += idList[i] + ","; str.append(idList[i]).append(",");
}else{ }else{
str += idList[i]; str.append(idList[i]);
} }
} }
} }
logService.deleteLogByIds(str); logService.deleteLogByIds(str.toString());
CacheManager.addExcCount("noExc"); CacheManager.addExcCount("noExc");
return Msg.success(); return Msg.success();
}catch (Exception e){ }catch (Exception e){

@ -9,8 +9,8 @@ TOKEN_EXPIRE_TIME = 1200000
##################################################\u670D\u52A1\u5668ip########################################################## ##################################################\u670D\u52A1\u5668ip##########################################################
#\u901A\u7528\u670D\u52A1\u5668IP\u4E0E\u901A\u7528\u670D\u52A1\u5668\u7AEF\u53E3 #\u901A\u7528\u670D\u52A1\u5668IP\u4E0E\u901A\u7528\u670D\u52A1\u5668\u7AEF\u53E3
SERVER_IP = 192.168.1.3 SERVER_IP = 120.27.212.36
SERVER_PORT = 8081 SERVER_PORT = 8082
#power\u6743\u9650\u7CFB\u7EDFip #power\u6743\u9650\u7CFB\u7EDFip
POWER_IP = ${SERVER_IP} POWER_IP = ${SERVER_IP}
@ -20,12 +20,12 @@ POWER_PORT = ${SERVER_PORT}
#\u75C5\u6848\u5F52\u6863\u7CFB\u7EDFip #\u75C5\u6848\u5F52\u6863\u7CFB\u7EDFip
EMRMEDICALRECORD_IP = ${SERVER_IP} EMRMEDICALRECORD_IP = ${SERVER_IP}
#\u75C5\u6848\u5F52\u6863\u7CFB\u7EDF\u7AEF\u53E3 #\u75C5\u6848\u5F52\u6863\u7CFB\u7EDF\u7AEF\u53E3
EMRMEDICALRECORD_PORT = 8082 EMRMEDICALRECORD_PORT = ${SERVER_PORT}
#\u75C5\u6848\u7BA1\u7406\u7CFB\u7EDFip #\u75C5\u6848\u7BA1\u7406\u7CFB\u7EDFip
EMRRECORD_IP = ${SERVER_IP} EMRRECORD_IP = ${SERVER_IP}
#\u75C5\u6848\u7BA1\u7406\u7CFB\u7EDF\u7AEF\u53E3 #\u75C5\u6848\u7BA1\u7406\u7CFB\u7EDF\u7AEF\u53E3
EMRRECORD_PORT = 8083 EMRRECORD_PORT = ${SERVER_PORT}
#\u75C5\u6848\u590D\u5370\u9884\u7EA6ip #\u75C5\u6848\u590D\u5370\u9884\u7EA6ip
EMRAPPLYCOPY_IP = ${SERVER_IP} EMRAPPLYCOPY_IP = ${SERVER_IP}

@ -0,0 +1,14 @@
CREATE VIEW power_user_dict AS
SELECT
`power_user`.`user_id` AS `user_id`,
`power_dept`.`dict_id` AS `dict_id`
FROM
((
`power_user`
JOIN `mysql`.`help_topic` `b` ON ((
`b`.`help_topic_id` < (( length( `power_user`.`dept_id` ) - length( REPLACE ( `power_user`.`dept_id`, _latin1 ',', _latin1 '' ))) + 1 ))))
LEFT JOIN `power_dept` ON ((
`power_dept`.`dept_id` = `power_user`.`dept_id`
)))
GROUP BY
`power_user`.`user_id`

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

@ -76,13 +76,13 @@ public class ImportExcelUtil {
boolean flag = isRowEmpty(row); boolean flag = isRowEmpty(row);
if(!flag){ if(!flag){
if(row.getPhysicalNumberOfCells() !=0){ if(row.getPhysicalNumberOfCells() !=0){
String wrongStr = ""; StringBuilder wrongStr = new StringBuilder();
for (int k = 0; k < fieldNames.length; k++) { for (int k = 0; k < fieldNames.length; k++) {
//对象赋值后返回错误对象 //对象赋值后返回错误对象
wrongStr += getValueByField(object, fieldNames[k], getCellValue(row.getCell(k)), getCellValue(head.getCell(k)),judgeMethods[k]); wrongStr.append(getValueByField(object, fieldNames[k], getCellValue(row.getCell(k)), getCellValue(head.getCell(k)), judgeMethods[k]));
} }
//有错误信息在行尾创建cell并标红提示文字 //有错误信息在行尾创建cell并标红提示文字
if(StringUtils.isNotBlank(wrongStr)){ if(StringUtils.isNotBlank(wrongStr.toString())){
//设置错误信息字体为红色加粗 //设置错误信息字体为红色加粗
Font font = workbook.createFont(); Font font = workbook.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
@ -92,8 +92,8 @@ public class ImportExcelUtil {
Cell cell = row.createCell( fieldNames.length); Cell cell = row.createCell( fieldNames.length);
cell.setCellStyle(cellStyle); cell.setCellStyle(cellStyle);
cell.setCellType(HSSFCell.CELL_TYPE_STRING); cell.setCellType(HSSFCell.CELL_TYPE_STRING);
wrongStr = wrongStr.substring(0,wrongStr.length()-1); wrongStr = new StringBuilder(wrongStr.substring(0, wrongStr.length() - 1));
cell.setCellValue(wrongStr); cell.setCellValue(wrongStr.toString());
wrongCount++; wrongCount++;
}else{ }else{
successCount++; successCount++;
@ -182,7 +182,7 @@ public class ImportExcelUtil {
* object:fieldName:value:excel,head:()judgeMethod: * object:fieldName:value:excel,head:()judgeMethod:
* */ * */
private static String getValueByField(Object object,String fieldName,String value,String head,String judgeMethod){ private static String getValueByField(Object object,String fieldName,String value,String head,String judgeMethod){
String wrongStr = ""; StringBuilder wrongStr = new StringBuilder();
try { try {
Class<?> clazz = object.getClass(); Class<?> clazz = object.getClass();
for (; clazz != Object.class; clazz = clazz.getSuperclass()) { for (; clazz != Object.class; clazz = clazz.getSuperclass()) {
@ -200,7 +200,7 @@ public class ImportExcelUtil {
//执行方法 //执行方法
String returnWrongStr = (String)method.invoke(importExcelJudgeMethod, fieldName, value, f, object, head); String returnWrongStr = (String)method.invoke(importExcelJudgeMethod, fieldName, value, f, object, head);
if(StringUtils.isNotBlank(returnWrongStr)){ if(StringUtils.isNotBlank(returnWrongStr)){
wrongStr+=returnWrongStr; wrongStr.append(returnWrongStr);
} }
}else{ }else{
if(StringUtils.isNotBlank(value)){ if(StringUtils.isNotBlank(value)){
@ -219,9 +219,9 @@ public class ImportExcelUtil {
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
wrongStr+="\""+head+"\"格式不正确,"; wrongStr.append("\"").append(head).append("\"格式不正确,");
} }
return wrongStr; return wrongStr.toString();
} }
/** /**

@ -84,18 +84,18 @@ public class Power_UserServiceImpl implements Power_UserService {
@Override @Override
public Power_UserVo selectByPrimaryKey(Integer userId) { public Power_UserVo selectByPrimaryKey(Integer userId) {
String power_depts = ""; StringBuilder power_depts = new StringBuilder();
Power_UserVo power_user = powerUserMapper.selectByPrimaryKey(userId); Power_UserVo power_user = powerUserMapper.selectByPrimaryKey(userId);
power_user.setUserPwd(MD5.JM(Base64.decode(power_user.getUserPwd()))); power_user.setUserPwd(MD5.JM(Base64.decode(power_user.getUserPwd())));
List<Power_Dept> power_depts1 = power_deptService.selectByPrimaryKeys(power_user.getDeptId()); List<Power_Dept> power_depts1 = power_deptService.selectByPrimaryKeys(power_user.getDeptId());
for(int j=0;j<power_depts1.size();j++){ for(int j=0;j<power_depts1.size();j++){
if(j<power_depts1.size()-1){ if(j<power_depts1.size()-1){
power_depts += power_depts1.get(j).getDeptName()+","; power_depts.append(power_depts1.get(j).getDeptName()).append(",");
}else{ }else{
power_depts += power_depts1.get(j).getDeptName(); power_depts.append(power_depts1.get(j).getDeptName());
} }
} }
power_user.setPowerDepts(power_depts); power_user.setPowerDepts(power_depts.toString());
return power_user; return power_user;
} }

Loading…
Cancel
Save