Ver a proveniência

Merge remote-tracking branch 'origin/4.0' into 4.0

4.0
lip há 2 anos
ascendente
cometimento
131b60330a
6 ficheiros alterados com 78 adições e 7 eliminações
  1. +2
    -2
      smtweb-framework/bpm/pom.xml
  2. +4
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/spring/controller/FileDownloadController.java
  3. +35
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/AuthService.java
  4. +6
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/LoginHelper.java
  5. +23
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/dict/DictService.java
  6. +8
    -0
      smtweb-framework/bpm/src/main/resources/static/event/bpm/sys/base/dict/dictList.js

+ 2
- 2
smtweb-framework/bpm/pom.xml Ver ficheiro

@@ -51,12 +51,12 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.13.4</version>
<!-- 不能指定版本,否则和spring boot冲突,spring-starter-web依赖2.12.5 <version>2.13.4</version>-->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.13.4</version>
<!-- <version>2.13.4</version>-->
</dependency>
<!-- https://mvnrepository.com/artifact/net.jodah/typetools -->
<!-- <dependency>-->


+ 4
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/spring/controller/FileDownloadController.java Ver ficheiro

@@ -38,10 +38,11 @@ public class FileDownloadController {
@GetMapping("/fs/files/**")
public ResponseEntity<InputStreamResource> files(@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "noCache", required = false) Boolean noCache,
@RequestParam(value = "absolutePath", required = false) Boolean absolutePath,
HttpServletRequest request
) throws FileNotFoundException {
String filePath = request.getRequestURI().substring(10);
return download(filePath, name, noCache, request);
return download(filePath, name, noCache,absolutePath, request);
}

/**
@@ -51,9 +52,10 @@ public class FileDownloadController {
public ResponseEntity<InputStreamResource> download(@RequestParam(value = "path") String path,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "noCache", required = false) Boolean noCache,
@RequestParam(value = "absolutePath", required = false) Boolean absolutePath,
HttpServletRequest request
) throws FileNotFoundException {
File file = new File(filePathGenerator.getFileDiskPath(path));
File file = new File(absolutePath? path:filePathGenerator.getFileDiskPath(path));

if (!file.exists()) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).build();


+ 35
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/AuthService.java Ver ficheiro

@@ -14,10 +14,13 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.session.SessionManager;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.system.bpm.web.sys.user.party.Party;
import cc.smtweb.system.bpm.web.sys.user.party.PartyCache;
import cc.smtweb.system.bpm.web.sys.user.role.RoleCache;
import cc.smtweb.system.bpm.web.sys.user.user.User;
import cc.smtweb.system.bpm.web.sys.user.user.UserCache;
import cc.smtweb.system.bpm.web.sys.user.user.UserRoleCache;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
@@ -153,7 +156,39 @@ public class AuthService {
CacheManager.getIntance().refresh();
return R.success();
}
// 加载个人信息
public R userInfo(@SwBody SwMap params, UserSession us) {
SwMap data = new SwMap();

User user = (User) UserCache.getInstance().get(us.getUserId()).clone();
user.setId(us.getUserId());
user.put("create_time", user.getCreate());
user.put("sur_party", PartyCache.getInstance().get(us.getPartyId()));
user.put("sur_roles", RoleCache.getInstance().getNamesByIds(UserRoleCache.getInstance().getRoleIdByUP(us.getUserId(), us.getPartyId())));
data.put("userInfo", user);

return R.success(data);
}
// 修改个人信息
public R saveUser(@SwBody SwMap params, UserSession us) {
SwMap userInfo = params.readMap("userInfo");
User user = UserCache.getInstance().get(us.getUserId());
user.getData().putAll(userInfo);
DbEngine.getInstance().findDao(User.ENTITY_NAME).updateEntity(user);
UserCache.getInstance().put(user);
return R.success();
}
// 修改密码
public R changePwd(@SwBody SwMap params, UserSession us) {
String old_pwd = params.readString("old_pwd");
String new_pwd = params.readString("new_pwd");
User user = UserCache.getInstance().get(us.getUserId());
if (!LoginHelper.verifyPwd(user, old_pwd)) {
return R.error("旧密码错误");
}
LoginHelper.resetUserPwd(user, new_pwd);
return R.success();
}
// 创建前端登录对象值对象
private LoginAckVO createLoginAckVO(User user,UserSession userSession){
LoginAckVO loginAckVO = new LoginAckVO();


+ 6
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/login/LoginHelper.java Ver ficheiro

@@ -165,6 +165,10 @@ public class LoginHelper {
public static void checkPwdSecurity(String pwd) {

}


// 重置密码
public static void resetUserPwd(User user, String pwd) {
user.setPwd(LoginHelper.encodePwd(user.getId(), pwd));
DbEngine.getInstance().findDao(User.ENTITY_NAME).updateEntity(user);
UserCache.getInstance().put(user);
}
}

+ 23
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/dict/DictService.java Ver ficheiro

@@ -1,9 +1,18 @@
package cc.smtweb.system.bpm.web.sys.base.dict;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageLoadHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService;

import java.io.File;
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;

/**
* Created by 1 at 2022-07-28 09:23:54
* 页面【[数据字典]的服务类
@@ -19,5 +28,18 @@ public class DictService extends DynPageService {
}
return super.createHandler(type);
}

//新增
public R exportExcel(@SwBody SwMap params, UserSession us) {
try {
File tempFile = File.createTempFile("xls_", ".txt", new File(System.getProperty("java.io.tmpdir")));
FileOutputStream fs = new FileOutputStream(tempFile);
fs.write("flypht-唐海鹏".getBytes(StandardCharsets.UTF_8));
SwMap swMap = new SwMap();
swMap.put("fileName",tempFile.getName());
swMap.put("filePath",tempFile.getAbsolutePath());
return R.success(swMap);
}catch (Exception e){
return R.error("导出失败!");
}
}
}

+ 8
- 0
smtweb-framework/bpm/src/main/resources/static/event/bpm/sys/base/dict/dictList.js Ver ficheiro

@@ -14,9 +14,17 @@ window.$swEvent.setup("bpm.sys.base.dict.dictList", {
const afterDelDict = () => {
$api.loadOne("dictList");
};
const exportExcel = () => {
$$http.post("bpm/dict/exportExcel").then( (rt) => {
console.info("exportExcel:",rt);
const url = $$http.downloadFileUrl(rt.data.filePath,rt.data.fileName,true);
$$http.downloadFile(url,{fileName: rt.data.fileName});
});
}
return {
afterDelDictType,
afterDelDict,
exportExcel,
}
}
});

Carregando…
Cancelar
Guardar