提交 5b3474bf authored 作者: 1239068511@qq.com's avatar 1239068511@qq.com

[代码更新] 完善了这个系统 到目前位置2021.09.15 基础功能大体完成,开始对接其他系统

上级 6186bd96
......@@ -57,7 +57,6 @@
</dependency>
<!--flowable整合springboot-->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
......
......@@ -40,7 +40,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
registry.addResourceHandler("/xml/**")
.addResourceLocations("file:" + System.getProperty("user.dir") + File.separator+"xml"+File.separator);
// .addResourceLocations("file:" + System.getProperty("user.dir") + "\\xml\\");
registry.addResourceHandler("/**")
registry.addResourceHandler("/workflow/**")
.addResourceLocations("classpath:/workflow/");
registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
......
package com.tykj.workflowcore.user;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {
"com.tykj.user",
"com.tykj.swagger"
})
public class UserApplication {
public static void main(String[] args) {
SpringApplication.run(UserApplication.class, args);
}
}
......@@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.tykj.workflowcore.user.authencation.filter.CustomUsernamePasswordAuthenticationFilter;
import com.tykj.workflowcore.user.authencation.filter.SuccessHandler;
import com.tykj.workflowcore.user.authencation.provider.UsernamePasswordAuthenticationProvider;
import com.tykj.workflowcore.user.service.UserService;
import com.tykj.workflowcore.user.service.CenterUserService;
import com.tykj.workflowcore.user.util.AuthenticationUtils;
import com.tykj.workflowcore.user.util.JwtTokenUtils;
import org.springframework.context.annotation.Bean;
......@@ -26,7 +26,6 @@ import org.springframework.security.web.authentication.AuthenticationFailureHand
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
import org.springframework.security.web.session.ConcurrentSessionFilter;
import org.springframework.web.cors.CorsUtils;
......@@ -63,16 +62,16 @@ public class SecurityWebConfig extends WebSecurityConfigurerAdapter {
AuthenticationUtils authenticationUtils;
final
UserService userService;
CenterUserService centerUserService;
final
UsernamePasswordAuthenticationProvider usernamePasswordAuthenticationProvider;
final JwtTokenUtils jwtTokenUtils;
public SecurityWebConfig(UsernamePasswordAuthenticationProvider usernamePasswordAuthenticationProvider, UserService userService, AuthenticationUtils authenticationUtils, JwtTokenUtils jwtTokenUtils) {
public SecurityWebConfig(UsernamePasswordAuthenticationProvider usernamePasswordAuthenticationProvider, CenterUserService centerUserService, AuthenticationUtils authenticationUtils, JwtTokenUtils jwtTokenUtils) {
this.usernamePasswordAuthenticationProvider = usernamePasswordAuthenticationProvider;
this.userService = userService;
this.centerUserService = centerUserService;
this.authenticationUtils = authenticationUtils;
this.jwtTokenUtils = jwtTokenUtils;
}
......@@ -100,7 +99,10 @@ public class SecurityWebConfig extends WebSecurityConfigurerAdapter {
"/app/useApi"
,"/app/useData",
"/app/token").permitAll()
.antMatchers("/**").permitAll()//全部放行
//页面文件访问权限
.antMatchers("/workflow/**").permitAll()
//全部放行
// .antMatchers("/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
......@@ -225,6 +227,7 @@ public class SecurityWebConfig extends WebSecurityConfigurerAdapter {
AuthenticationException e) throws IOException {
httpServletResponse.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, "Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild");
httpServletResponse.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE);
httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value());
ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
Map<String, Object> result = new HashMap<>(2);
result.put("msg", "没有登录");
......
package com.tykj.workflowcore.user.authencation.provider;
import com.tykj.workflowcore.user.authencation.checks.DefaultPreAuthenticationChecks;
import com.tykj.workflowcore.user.service.UserService;
import com.tykj.workflowcore.user.service.CenterUserService;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.springframework.security.authentication.AuthenticationProvider;
......@@ -37,16 +37,16 @@ public class UsernamePasswordAuthenticationProvider implements AuthenticationPro
*/
private final PasswordEncoder passwordEncoder;
private final UserService userService;
private final CenterUserService centerUserService;
/**
* 用户可用性检查类
*/
private final UserDetailsChecker preAuthenticationChecks = new DefaultPreAuthenticationChecks();
public UsernamePasswordAuthenticationProvider(PasswordEncoder passwordEncoder, UserService userService) {
public UsernamePasswordAuthenticationProvider(PasswordEncoder passwordEncoder, CenterUserService centerUserService) {
this.passwordEncoder = passwordEncoder;
this.userService = userService;
this.centerUserService = centerUserService;
}
/***
......@@ -80,7 +80,7 @@ public class UsernamePasswordAuthenticationProvider implements AuthenticationPro
}
protected final UserDetails retrieveUser(String username) {
UserDetails loadedUser = userService.getUserDetail(username);
UserDetails loadedUser = centerUserService.getUserDetail(username);
if (loadedUser == null) {
throw new InternalAuthenticationServiceException(
"UserDetailsService returned null, which is an interface contract violation");
......
......@@ -31,7 +31,7 @@ public class AuthorityOrganizationController {
@Autowired
private UserAuthorityService userAuthorityService;
@Autowired
private UserService userService;
private CenterUserService centerUserService;
@Autowired
private AuthorityService authorityService;
......@@ -80,7 +80,7 @@ public class AuthorityOrganizationController {
}
}
//为组织架构分配完权限之后,也要为该组织架构所有人员分配权限
List<User> userList = userService.findAllByOrganizationId(orgId);
List<User> userList = centerUserService.findAllByOrganizationId(orgId);
if (userList!=null){
for (User user : userList) {
List<Integer> authIdList = userAuthorityService.findAuthByUid(user.getId());
......@@ -157,7 +157,7 @@ public class AuthorityOrganizationController {
//为组织架构分配完权限之后,也要为该组织架构所有人员分配权限
for (Integer orgId : orgIdList) {
List<User> userList = userService.findAllByOrganizationId(orgId);
List<User> userList = centerUserService.findAllByOrganizationId(orgId);
if (userList!=null){
for (User user : userList) {
List<Integer> authIdList = userAuthorityService.findAuthByUid(user.getId());
......
package com.tykj.workflowcore.user.controller;
import com.google.gson.JsonObject;
import com.sun.istack.NotNull;
import com.tykj.workflowcore.user.dao.LogContentDao;
import com.tykj.workflowcore.user.pojo.LogContent;
......@@ -8,7 +7,7 @@ import com.tykj.workflowcore.user.pojo.User;
import com.tykj.workflowcore.user.pojo.vo.ServerResponse;
import com.tykj.workflowcore.user.pojo.vo.UserSelectVo;
import com.tykj.workflowcore.user.pojo.vo.uservo.*;
import com.tykj.workflowcore.user.service.UserService;
import com.tykj.workflowcore.user.service.CenterUserService;
import com.tykj.workflowcore.user.util.UUIDUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -31,7 +30,7 @@ import java.util.List;
@Api(tags = "用户管理")
public class CenterUserController {
@Autowired
private UserService userService;
private CenterUserService centerUserService;
@Autowired
private LogContentDao logContentDao;
@Autowired
......@@ -48,7 +47,7 @@ public class CenterUserController {
user.setPassword(passwordEncoder.encode(user.getPassword()));
user.setId(UUIDUtil.getUUID());
System.out.println("新增用户");
if (userService.addUser(user) !=null){
if (centerUserService.addUser(user) !=null){
logContent.setResult("操作成功");
logContentDao.save(logContent);
return ServerResponse.ok(user);
......@@ -62,7 +61,7 @@ public class CenterUserController {
@ApiOperation("根据用户id 查看用户详情")
@PostMapping("/findById")
public ServerResponse findUserById(@Validated @RequestBody FindUserVo findUserVo){
User user = userService.findById(findUserVo.getId());
User user = centerUserService.findById(findUserVo.getId());
if (user != null){
System.out.println(user.toString());
return ServerResponse.ok(user);
......@@ -78,7 +77,7 @@ public class CenterUserController {
logContent.setOperator(addUserVo.getLoginer());
logContent.setOperateTime(new Date());
logContent.setContent("修改用户详情");
User user1 = userService.update(addUserVo.getUser());
User user1 = centerUserService.update(addUserVo.getUser());
if (user1!=null){
logContent.setResult("操作成功");
logContentDao.save(logContent);
......@@ -93,8 +92,7 @@ public class CenterUserController {
@ApiOperation("查询用户列表 新增时间倒叙排列,可按姓名进行模糊查询")
@PostMapping("/userList")
public ServerResponse userList(@Validated @RequestBody UserSelectVo userSelectVo){
List<User> userList = userService.findByNameLike(userSelectVo.getRealName());
List<User> userList = centerUserService.findByNameLike(userSelectVo.getRealName());
if (userList != null){
return ServerResponse.ok(userList);
}
......@@ -111,7 +109,7 @@ public class CenterUserController {
logContent.setOperateTime(new Date());
logContent.setContent("用户解锁");
Integer unlock = userService.unlock(findUserVo.getId());
Integer unlock = centerUserService.unlock(findUserVo.getId());
if (unlock != null){
logContent.setResult("操作成功");
logContentDao.save(logContent);
......@@ -132,7 +130,7 @@ public class CenterUserController {
logContent.setOperateTime(new Date());
logContent.setContent("用户停用");
Integer unlock = userService.locked(findUserVo.getId());
Integer unlock = centerUserService.locked(findUserVo.getId());
if (unlock != null){
logContent.setResult("操作成功");
logContentDao.save(logContent);
......@@ -155,7 +153,7 @@ public class CenterUserController {
logContent.setOperateTime(new Date());
logContent.setContent("重置用户密码");
User user = userService.resetPassword(findUserVo.getId());
User user = centerUserService.resetPassword(findUserVo.getId());
if (user != null){
logContent.setResult("操作成功");
logContentDao.save(logContent);
......@@ -176,11 +174,11 @@ public class CenterUserController {
logContent.setOperateTime(new Date());
logContent.setContent("修改用户密码");
User user = userService.findById(changePasswordVo.getId());
User user = centerUserService.findById(changePasswordVo.getId());
System.out.println(changePasswordVo.getPassword());
String password = changePasswordVo.getPassword();
user.setPassword(passwordEncoder.encode(password));
User user1 = userService.update(user);
User user1 = centerUserService.update(user);
if (user1 != null){
logContent.setResult("操作成功");
logContentDao.save(logContent);
......@@ -201,7 +199,7 @@ public class CenterUserController {
logContent.setOperateTime(new Date());
logContent.setContent("删除用户");
User user = userService.delete(findUserVo.getId());
User user = centerUserService.delete(findUserVo.getId());
if (user != null){
logContent.setResult("操作成功");
logContentDao.save(logContent);
......@@ -221,7 +219,7 @@ public class CenterUserController {
logContent.setOperateTime(new Date());
logContent.setContent("上传用户头像");
String imagePath = userService.uploadImage(file,loginer);
String imagePath = centerUserService.uploadImage(file,loginer);
if (imagePath != null){
logContent.setResult("操作成功");
......@@ -244,7 +242,7 @@ public class CenterUserController {
Level[] values = Level.values();
for (Level value : values) {
UserLeverVo userLeverVo = new UserLeverVo();
List<User> userList = userService.findByCustomerLeverAndDelStatus(value.getName());
List<User> userList = centerUserService.findByCustomerLeverAndDelStatus(value.getName());
userLeverVo.setCustomerLever(value.getName());
userLeverVo.setUserList(userList);
userLeverVos.add(userLeverVo);
......@@ -259,7 +257,7 @@ public class CenterUserController {
@ApiOperation("查看所有用户")
@GetMapping("/findAll/{loginer}")
public ServerResponse findAll(@NotNull @PathVariable String loginer) {
List<User> userList = userService.findAll();
List<User> userList = centerUserService.findAll();
if (userList != null){
return ServerResponse.ok(userList);
}
......@@ -270,7 +268,7 @@ public class CenterUserController {
@ApiOperation("根据用户真实姓名和密级模糊查询")
@PostMapping("/findRealname")
public ServerResponse findRealname(@Validated @RequestBody RealNameVo realNameVo){
List<User> userList = userService.findByRealName(realNameVo.getRealName());
List<User> userList = centerUserService.findByRealName(realNameVo.getRealName());
if (userList.size()==0){
return ServerResponse.ok(new ArrayList<>() );
}
......
package com.tykj.workflowcore.user.controller;
import com.tykj.workflowcore.user.pojo.vo.OrganizationVo;
import com.tykj.workflowcore.user.pojo.vo.ServerResponse;
import com.tykj.workflowcore.user.service.OrgUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/org")
@Api(tags = "组织人员")
public class OrgUserController {
@Autowired
OrgUser orgTest;
@ApiOperation("查询全部组织架构")
@GetMapping("/findAll")
public ServerResponse findAll(@RequestParam(required = false) String name){
List<OrganizationVo> organizationVos = orgTest.findOrgAndUser(name);
if (organizationVos != null){
return ServerResponse.ok(organizationVos);
}
return ServerResponse.error("查看组织架构失败");
}
@ApiOperation("根据人员名字查询组织架构")
@GetMapping("/findByName")
public ServerResponse findByName(@RequestParam(required = false) String name){
List<OrganizationVo> organizationVos = orgTest.findByUserName(name);
if (organizationVos != null){
return ServerResponse.ok(organizationVos);
}
return ServerResponse.error("查看组织架构失败");
}
}
......@@ -92,13 +92,10 @@ public class OrganizationController {
if (organizationList.size()==0){
organizationList = organizationService.findAll();
}
List<OrganizationVo> organizationVos = organizationService.find(organizationList);
if (organizationVos != null){
//测试一下
return ServerResponse.ok(organizationVos);
}
return ServerResponse.error("查看组织架构失败");
}
......
......@@ -10,5 +10,9 @@ import java.util.List;
@Repository
public interface OrganizationDao extends JpaRepository<Organization, Integer>, JpaSpecificationExecutor<Organization> {
List<Organization> findByOrganizationNameLike(String organizationName);
List<Organization> findAllByCode(String code);
}
......@@ -16,6 +16,7 @@ import java.util.ArrayList;
@AllArgsConstructor
@ApiModel("组织架构")
public class Organization {
@Id
@ApiModelProperty(value = "机构组织id")
private Integer id;
......
......@@ -2,6 +2,7 @@ package com.tykj.workflowcore.user.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.programmaticallyspeaking.aptdemo.NoAutoIncreament;
import com.tykj.workflowcore.user.pojo.vo.OrganizationVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -11,6 +12,7 @@ import org.springframework.data.annotation.CreatedDate;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
@Entity
@Data
......@@ -19,6 +21,7 @@ import java.util.Date;
@ApiModel("用户")
@Table
public class User {
@Id
@ApiModelProperty(value = "用户编号",example = "1")
@NoAutoIncreament
......@@ -83,4 +86,12 @@ public class User {
@ApiModelProperty(value = "用户类型 0普通用户 1管理员 2安全员 3审计员")
private Integer type = 0;
@Transient
private List<Organization> organizationList;
@Transient
private List<String> groupStrings;
}
......@@ -23,6 +23,7 @@ public class UserDetail extends User implements UserDetails {
public Collection<? extends GrantedAuthority> getAuthorities() {
//todo 权限列表
List<GrantedAuthority> simpleGrantedAuthorities = new ArrayList<>();
return simpleGrantedAuthorities;
}
......
......@@ -7,7 +7,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
public interface UserService {
public interface CenterUserService {
/**
* 通過用戶名查詢用戶
* @param username
......
package com.tykj.workflowcore.user.service;
import com.tykj.workflowcore.user.pojo.Organization;
import com.tykj.workflowcore.user.pojo.User;
import com.tykj.workflowcore.user.pojo.vo.OrganizationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@Component
public class OrgUser {
@Autowired
OrganizationService organizationService;
@Autowired
UserService userService;
/**
* 根据人名字查询所有组织机构树
* @param name 人员姓名
* @return 带人员的组织机构树
*/
public List<OrganizationVo> findOrgAndUser(String name){
List<Organization> organizationList = organizationService.findAll();
List<OrganizationVo> organizationVos = organizationService.find(organizationList);
List<User> users;
if (name == null){
users = userService.findAll();
}else {
users = userService.findByRealName(name);
}
if (users == null || users.size() == 0){
return new ArrayList<>();
}
getChild(organizationVos, users);
return organizationVos;
}
/**
* 根据人名字查询只有人的组织机构树
* @param name 人员姓名
* @return 带人员的组织机构树
*/
public List<OrganizationVo> findByUserName(String name){
List<Organization> organizationList = organizationService.findAll();
List<Organization> organizations = new ArrayList<>();
List<User> users;
if (name != null){
users = userService.findByRealName(name);
if (users != null && users.size() > 0){
for (User user : users){
List<Organization> list = organizationList.stream()
.filter(organization -> Objects.equals(user.getOrganizationId(), organization.getId()))
.collect(Collectors.toList());
if (list.size() > 0){
organizations.add(list.get(0));
findOrgFid(list.get(0).getPid(), organizationList, organizations);
}
}
}else {
return new ArrayList<>();
}
}else {
users = userService.findAll();
organizations = organizationList;
}
List<OrganizationVo> organizationVos = organizationService.find(organizations);
getChild(organizationVos, users);
return organizationVos;
}
/**
* 找到机构所有的父级机构
* @param orgId 需要找父级机构的机构编号
* @param o 所有机构列表
* @param re 返回机构列表
*/
private void findOrgFid(int orgId, List<Organization> o, List<Organization> re){
List<Organization> orgs = o.stream()
.filter(organization -> Objects.equals(orgId, organization.getId()))
.collect(Collectors.toList());
if (orgs.size() > 0){
re.addAll(orgs);
findOrgFid(orgs.get(0).getPid(), o, re);
}
}
/**
* 把人员放到组织机构树中
* @param vos 组织机构树列表
* @param users 人员列表
*/
private void getChild(List<OrganizationVo> vos, List<User> users) {
for (OrganizationVo organizationVo : vos) {
List<User> users1 = users.stream().filter(user -> Objects.equals(organizationVo.getId(), user.getOrganizationId()))
.collect(Collectors.toList());
organizationVo.setUsers(users1);
if (organizationVo.getChildNodes().size() > 0) {
getChild(organizationVo.getChildNodes(), users);
}
}
}
}
......@@ -38,17 +38,22 @@ public interface OrganizationService {
*/
Organization findById(Integer id);
/**
* 查询组织架构
* @return
*/
List<OrganizationVo> find(List<Organization> organizationList);
List<Organization> findByOrganizationNameLike(String organizationName);
List<Organization> findByCode(String code);
List<Organization> findByOrganizationNameLike(String organizationName);
/**
* 根据组织code 查出组织code对应的组织已经组织上级的parent
* @param code
* @return
*/
List<Organization> findOrganizationListByCode(String code);
}
package com.tykj.workflowcore.user.service.impl;
import com.tykj.workflowcore.user.dao.UserDao;
import com.tykj.workflowcore.user.pojo.Organization;
import com.tykj.workflowcore.user.pojo.User;
import com.tykj.workflowcore.user.pojo.UserDetail;
import com.tykj.workflowcore.user.service.UserService;
import com.tykj.workflowcore.user.pojo.vo.OrganizationVo;
import com.tykj.workflowcore.user.service.CenterUserService;
import com.tykj.workflowcore.workflow_editer.entity.enums.RoleTypeEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -17,7 +20,7 @@ import java.io.IOException;
import java.util.*;
@Service
public class UserServiceImpl implements UserService {
public class CenterUserServiceImpl implements CenterUserService {
@Value("/home/tykj/Desktop/icon/")
private String path;
......@@ -25,6 +28,8 @@ public class UserServiceImpl implements UserService {
PasswordEncoder passwordEncoder;
@Autowired
UserDao userDao;
@Autowired
OrganizationServiceImpl organizationService;
@Override
public UserDetail selectByUserName(String username) {
......@@ -39,6 +44,17 @@ public class UserServiceImpl implements UserService {
if (userDetail.getDelStatus()==2){
return null;
}
//拼装用户的用户组
List<Organization> organizationListByCode = organizationService.findOrganizationListByCode(userDetail.getOrganizationCode());
userDetail.setOrganizationList(organizationListByCode);
//遍历organizationListByCode 将他拼接成string 例如:organization_code
List<String> groupStringListBuffer = new ArrayList<>();
if (organizationListByCode!=null&&organizationListByCode.size()>0){
for (Organization organization : organizationListByCode) {
groupStringListBuffer.add(RoleTypeEnum.ORGANIZATION.name()+"_"+organization.getCode());
}
}
userDetail.setGroupStrings(groupStringListBuffer);
return userDetail;
}
return null;
......@@ -78,7 +94,6 @@ public class UserServiceImpl implements UserService {
@Override
public User findById(String id) {
User user = userDao.findByIdAndDelStatus(id, 1);
//return userDao.findById(id).get();
return user;
}
......
package com.tykj.workflowcore.user.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.tykj.workflowcore.base.result.ApiException;
import com.tykj.workflowcore.user.dao.AuthorityOrganizationDao;
import com.tykj.workflowcore.user.dao.OrganizationDao;
import com.tykj.workflowcore.user.dao.UserDao;
......@@ -13,6 +14,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import junit.framework.Assert;
import org.springframework.util.StringUtils;
import java.util.*;
......@@ -41,6 +43,9 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
public Organization add(Organization organization) {
if (!checkCodeIsUnique(organization)){
throw new ApiException("机构编码不能重复");
}
Organization organization1 = organizationDao.save(organization);
if (organization1 != null){
return organization1;
......@@ -50,6 +55,9 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
public Organization update(Organization organization) {
if (!checkCodeIsUnique(organization)){
throw new ApiException("机构编码不能重复");
}
Organization organization1 = organizationDao.save(organization);
if (organization1 != null){
return organization1;
......@@ -70,7 +78,6 @@ public class OrganizationServiceImpl implements OrganizationService {
user.setOrganizationPost("");
userDao.save(user);
}
List<AuthorityOrganization> authorityOrganizationList = authorityOrganizationDao.findByOrgId(id);
for (AuthorityOrganization authorityOrganization : authorityOrganizationList) {
authorityOrganizationDao.delete(authorityOrganization);
......@@ -192,8 +199,6 @@ public class OrganizationServiceImpl implements OrganizationService {
StringJoiner joiner = new StringJoiner("\t");
IntStream.range(0, stackDepth).mapToObj(i -> "").forEach(joiner::add);
joiner.add(printProperty.apply(rootNode).toString());
System.out.println(joiner.toString());
for (T childNode : getChild.apply(rootNode)) {
int currentLevel = stackDepth + 1;
printTreeNode(childNode, printProperty, getChild, currentLevel);
......@@ -205,4 +210,49 @@ public class OrganizationServiceImpl implements OrganizationService {
List<Organization> organizationList = organizationDao.findByOrganizationNameLike("%" + organizationName + "%");
return organizationList;
}
@Override
public List<Organization> findByCode(String code) {
List<Organization> allByCode = organizationDao.findAllByCode(code);
return allByCode;
}
@Override
public List<Organization> findOrganizationListByCode(String code){
List<Organization> byCode = findByCode(code);
if (byCode==null||byCode.size()<=0){
return null;
}
Organization organization = byCode.get(0);
List<Organization> all = findAll();
Map<Integer, Organization> nodeCollect =
all.stream().collect(Collectors.toMap(Organization::getId, org->org));
List<Organization> returnList = new ArrayList<>();
returnList.add(organization);
getOrganizationByPid(organization.getPid(), nodeCollect, returnList);
return returnList;
}
public List<Organization> getOrganizationByPid(Integer pid,Map<Integer, Organization> sourceMap,List<Organization> returnList){
Organization organization = sourceMap.get(pid);
if (organization!=null){
returnList.add(organization);
if (organization.getPid()!=null&&organization.getPid()>0){
getOrganizationByPid(organization.getPid(),sourceMap,returnList);
}
}
return returnList;
}
public Boolean checkCodeIsUnique(Organization organization){
if (!StringUtils.isEmpty(organization.getCode())){
List<Organization> allByCode = organizationDao.findAllByCode(organization.getCode());
if (allByCode.size()>0){
return false;
}
}
return true;
}
}
......@@ -10,7 +10,7 @@ import com.tykj.workflowcore.user.pojo.User;
import com.tykj.workflowcore.user.pojo.UserAuthority;
import com.tykj.workflowcore.user.pojo.vo.PageResponse;
import com.tykj.workflowcore.user.service.UserAuthorityService;
import com.tykj.workflowcore.user.service.UserService;
import com.tykj.workflowcore.user.service.CenterUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
......@@ -29,7 +29,7 @@ public class UserAuthorityServiceImpl implements UserAuthorityService {
@Autowired
private AuthorityDao authorityDao;
@Autowired
private UserService userService;
private CenterUserService centerUserService;
@Override
public List<UserAuthority> findByUid(String uid) {
......
......@@ -2,7 +2,7 @@ package com.tykj.workflowcore.user.util;
import com.tykj.workflowcore.user.pojo.User;
import com.tykj.workflowcore.user.pojo.UserDetail;
import com.tykj.workflowcore.user.service.UserService;
import com.tykj.workflowcore.user.service.CenterUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
......@@ -23,10 +23,10 @@ public class AuthenticationUtils {
public static String ANONYMOUS_USER_STRING = "anonymousUser";
private final UserService userService;
private final CenterUserService centerUserService;
public AuthenticationUtils(UserService userService) {
this.userService = userService;
public AuthenticationUtils(CenterUserService centerUserService) {
this.centerUserService = centerUserService;
}
/***
......@@ -43,10 +43,9 @@ public class AuthenticationUtils {
return null;
}
if (userObject instanceof UserDetail) {
return (UserDetail) userObject;
} else {
return userService.getUserDetail(((User) userObject).getUsername());
return centerUserService.getUserDetail(((User) userObject).getUsername());
}
} else {
return null;
......
package com.tykj.workflowcore.user.util;
import com.tykj.workflowcore.user.pojo.StorageKey;
import com.tykj.workflowcore.user.pojo.UserDetail;
import com.tykj.workflowcore.user.pojo.vo.JwtSecurityProperties;
import com.tykj.workflowcore.user.service.UserService;
import com.tykj.workflowcore.user.service.CenterUserService;
import io.jsonwebtoken.*;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.security.Keys;
......@@ -23,7 +22,7 @@ import java.util.*;
@Component
public class JwtTokenUtils implements InitializingBean {
@Autowired
UserService userService;
CenterUserService centerUserService;
private static final String AUTHORITIES_KEY = "VHFBZ2MwbE43NVJFYXVFeFdJMzkxZ2wzNXpRY0N2UmM1T2dPdlYyRnM3T1ZBYmN6cVNtMHhQYTg1dk9zVEgzaGdtc3B0MWIzR3kwNmVGWnlYZ0d3R0ZSc2Z6NnNOdng5aXZBM1JUaURzc21CV2JnSTIxM083Tk8xYzAydmh3bzY==";
private final JwtSecurityProperties jwtSecurityProperties;
......@@ -77,7 +76,7 @@ public class JwtTokenUtils implements InitializingBean {
Claims claims = Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(token).getBody();
HashMap map = (HashMap) claims.get(AUTHORITIES_KEY);
//通过username获取用户信息
UserDetail AuthUser =userService.getUserDetail(map.get("username").toString());
UserDetail AuthUser = centerUserService.getUserDetail(map.get("username").toString());
//将用户信息放入当前用户中
Collection<? extends GrantedAuthority> authorities = AuthUser.getAuthorities();
return new UsernamePasswordAuthenticationToken(AuthUser, token, authorities);
......
package com.tykj.workflowcore.workflow_editer.controller;
import com.tykj.workflowcore.base.result.ResultUtil;
import com.tykj.workflowcore.workflow_editer.entity.ActivityNodeInfo;
import com.tykj.workflowcore.workflow_editer.entity.vo.ActivityNodeInfoSelectVo;
import com.tykj.workflowcore.workflow_editer.service.ActivityNodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Api(tags = "流程节点信息管理")
@RequestMapping("/activeInfo")
public class ActivityNodeController {
@Autowired
ActivityNodeService activityNodeService;
@PostMapping("/save")
@ApiOperation(value = "保存节点信息")
public ResponseEntity getAllUsers(@RequestBody ActivityNodeInfo activityNodeInfo){
ActivityNodeInfo save;
if (activityNodeInfo.getId()!=null){
save = activityNodeService.update(activityNodeInfo);
}else {
save = activityNodeService.save(activityNodeInfo);
}
return ResultUtil.success(save,"保存成功");
}
@PostMapping("/select")
@ApiOperation(value = "获取节点信息")
public ResponseEntity select(@RequestBody ActivityNodeInfoSelectVo activityNodeInfo){
Page<ActivityNodeInfo> all = activityNodeService.findAll(activityNodeInfo);
return ResultUtil.success(all,"查询成功");
}
}
......@@ -25,15 +25,6 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
public class DataHistoryController {
@Autowired
private FlowInfoService flowInfoService;
@Autowired
private WorkFlowService workFlowService;
@Autowired
private NodeInfoService nodeInfoService;
@Autowired
private DataHistoryService dataHistoryService;
......@@ -43,14 +34,5 @@ public class DataHistoryController {
dataHistoryService.save(dataHistory);
}
// @GetMapping("/findByTaskId")
// @ApiOperation(value = "通过任务id查询数据")
// public Map<String,Object> findByTaskId(String taskId){
//
// DataHistory byTaskId = dataHistoryService.findByTaskId(taskId);
// String datas = byTaskId.getDatas();
// Map map = (Map) JSON.parse(datas);
// return map;
// }
}
......@@ -2,6 +2,8 @@ package com.tykj.workflowcore.workflow_editer.controller;
import com.tykj.workflowcore.base.result.ApiException;
import com.tykj.workflowcore.base.result.ResultUtil;
import com.tykj.workflowcore.user.pojo.UserDetail;
import com.tykj.workflowcore.user.util.AuthenticationUtils;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.entity.vo.*;
import com.tykj.workflowcore.workflow_editer.service.*;
......@@ -41,6 +43,9 @@ public class FlowsInfoController {
@Autowired
private RuntimeService runtimeService;
@Autowired
AuthenticationUtils authenticationUtils;
@PostMapping("/searchAllFlowInfo")
@ApiOperation(value = "查询所有流程信息")
......@@ -51,6 +56,9 @@ public class FlowsInfoController {
@PostMapping("/searchFlowInfo")
@ApiOperation(value = "查询可发起流程信息")
public Page<FlowsInfo> searchFlowInfo(@RequestBody SearchFlowInfoVo searchFlowInfoVo){
UserDetail authentication = authenticationUtils.getAuthentication();
searchFlowInfoVo.setGroupStrings(authentication.getGroupStrings());
searchFlowInfoVo.setUserId(authentication.getId());
return flowInfoService.searchFlowInfo(searchFlowInfoVo);
}
......@@ -94,7 +102,7 @@ public class FlowsInfoController {
@PostMapping("/updateByDesc")
@ApiOperation(value = "通过流程描述修改")
public ResponseEntity updateByDesc(@RequestBody FlowsInfoVo flowsInfoVo) {
FlowsInfo flowsInfo = flowInfoService.findByDesc(flowsInfoVo);
FlowsInfo flowsInfo = flowInfoService.updateDesc(flowsInfoVo);
return ResultUtil.success(flowsInfo.getFlowDescribe(),"流程修改成功");
}
......@@ -105,9 +113,9 @@ public class FlowsInfoController {
}
@PostMapping("/updateFlowCandidate")
@ApiOperation("更新流程可发起人")
@ApiOperation("更新流程可发起人")
public ResponseEntity updateFlowCandidate(@RequestBody FlowsInfoVo flowsInfovo){
return ResultUtil.success(flowInfoService.updateCandidate(flowsInfovo.getFlowKey(),flowsInfovo.getCandidateUsers(),flowsInfovo.getCandidateRoleDetail()),"流程创建成功");
return ResultUtil.success(flowInfoService.updateCandidate(flowsInfovo),"更新流程可发起人成功");
}
......
package com.tykj.workflowcore.workflow_editer.controller;
import com.tykj.workflowcore.base.result.ResultUtil;
import com.tykj.workflowcore.user.pojo.UserDetail;
import com.tykj.workflowcore.user.util.AuthenticationUtils;
import com.tykj.workflowcore.workflow_editer.entity.DataHistory;
import com.tykj.workflowcore.workflow_editer.entity.vo.*;
import com.tykj.workflowcore.workflow_editer.service.DataHistoryService;
import com.tykj.workflowcore.workflow_editer.service.WorkFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
......@@ -12,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -31,6 +37,13 @@ public class WorkFlowController {
@Autowired
private WorkFlowService workFlowService;
@Autowired
AuthenticationUtils authenticationUtils;
@Autowired
DataHistoryService dataHistoryService;
@PostMapping("/startFlow")
@ApiOperation("开启流程")
......@@ -49,6 +62,9 @@ public class WorkFlowController {
@PostMapping("/findUserTask")
@ApiOperation("任务个人待办列表")
public List<Map<String,Object>> findUserTask(@RequestBody NextTaskVo nextTaskVo){
UserDetail authentication = authenticationUtils.getAuthentication();
nextTaskVo.setGroupStrings(authentication.getGroupStrings());
nextTaskVo.setUserId(authentication.getId());
return workFlowService.findTaskByUserId(nextTaskVo);
}
......@@ -92,17 +108,22 @@ public class WorkFlowController {
workFlowService.flowProgress(flowProcessVo.getResponse(),flowProcessVo.getProcessInstanceId());
}
@GetMapping("/findHistoryTask")
@PostMapping("/findHistoryTask")
@ApiOperation("已办任务")
public List findHistoryTask() {
return workFlowService.findHistoryTask();
public ResponseEntity findHistoryTask(@RequestBody MyTaskSelectVo myTaskSelectVo) {
UserDetail authentication = authenticationUtils.getAuthentication();
myTaskSelectVo.setUserId(authentication.getId());
return ResultUtil.success(workFlowService.findHistoryTask(myTaskSelectVo),"");
}
@GetMapping("/findStartByUser")
@PostMapping("/findStartByUser")
@ApiOperation("查询我发起的流程")
public List<HistoricProcessInstance> findStartByUser(String userId) {
List<HistoricProcessInstance> startByUser = workFlowService.findStartByUser(userId);
return startByUser;
public ResponseEntity findStartByUser(@RequestBody MyStartProcessSelectVo myStartProcessSelectVo) {
//入参 分页 状态 流程标题
UserDetail authentication = authenticationUtils.getAuthentication();
myStartProcessSelectVo.setUserId(authentication.getId());
PageReturnVo<List<ProcessInstanceReturnVo>> pageReturnVo = workFlowService.findStartByUser(myStartProcessSelectVo);
return ResultUtil.success(pageReturnVo,"查询成功");
}
@GetMapping("/stopProcessInstance")
......@@ -112,6 +133,22 @@ public class WorkFlowController {
return ResultUtil.success("停止成功");
}
@GetMapping("/getProcessInstanceLastInfo")
@ApiOperation("查询流程的最后一个节点")
public ResponseEntity getProcessInstanceLastInfo(String processInstanceId) {
HistoricActivityInstance lastActivityByProcessInstance = workFlowService.findLastActivityByProcessInstance(processInstanceId);
String uniqueString = DataHistory.initUniqueString(lastActivityByProcessInstance.getExecutionId(),lastActivityByProcessInstance.getProcessInstanceId(),lastActivityByProcessInstance.getActivityId());
DataHistory byUniqueString = dataHistoryService.findByUniqueString(uniqueString);
return ResultUtil.success(byUniqueString,"查询成功");
}
@GetMapping("/getActivityHistoryInfo")
@ApiOperation("根据ID查询我执行的任务详情")
public ResponseEntity getActivityHistoryInfo(String id) {
HistoricActivityInstance activityById = workFlowService.findActivityById(id);
String uniqueString = DataHistory.initUniqueString(activityById.getExecutionId(),activityById.getProcessInstanceId(),activityById.getActivityId());
DataHistory byUniqueString = dataHistoryService.findByUniqueString(uniqueString);
return ResultUtil.success(byUniqueString,"查询成功");
}
}
package com.tykj.workflowcore.workflow_editer.dao;
import com.tykj.workflowcore.workflow_editer.entity.ActivityNodeInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface ActivityNodeInfoMapper extends JpaRepository<ActivityNodeInfo,Integer>, JpaSpecificationExecutor<ActivityNodeInfo> {
}
......@@ -15,9 +15,9 @@ public interface DataHistoryMapper extends JpaRepository<DataHistory,Integer>, J
/**
* 根据任务id查询
* @param taskId 任务id
* @param uniqueString 任务id
* @return
*/
// DataHistory findByTaskId(String taskId);
DataHistory findByUniqueString(String uniqueString);
}
......@@ -2,8 +2,10 @@ package com.tykj.workflowcore.workflow_editer.dao;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
/**
* ClassName: FlowsInfoMapper
......@@ -20,6 +22,9 @@ public interface FlowsInfoMapper extends JpaRepository<FlowsInfo,Integer>, JpaSp
*/
FlowsInfo findByFlowKey(String flowKey);
@Query(value = "select * from FLOWSINFO where flowKey=?1",nativeQuery = true)
FlowsInfo findByFlowKeyWithDelete(String flowKey);
/**
* 根据部署流程id查询
* @param deployId 部署id
......
package com.tykj.workflowcore.workflow_editer.dao;
import com.tykj.workflowcore.workflow_editer.entity.NodeInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* ClassName: NodePage
* Package: com.tykj.mapper
* Description:
* Datetime: 2021/3/4 15:31
*
* @Author: zsp
*/
public interface NodePageMapper extends JpaRepository<NodeInfo,Integer>, JpaSpecificationExecutor<NodeInfo> {
/**
* 通过节点id得到pageId
* @param nodeId 节点id
* @return 返回页面id
*/
Integer findByNodeId(String nodeId);
}
package com.tykj.workflowcore.workflow_editer.entity;
import com.tykj.workflowcore.base.entity.BaseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Entity;
import javax.persistence.Lob;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@SQLDelete(sql = "update ACTIVITYNODEINFO set deleted = 1 where id = ?")
@Where(clause = "deleted = 0")
@Api("节点信息")
public class ActivityNodeInfo extends BaseEntity {
@ApiModelProperty("流程Key")
private String processKey;
@Lob
@ApiModelProperty("数据")
private String data;
}
......@@ -24,12 +24,12 @@ import javax.persistence.Lob;
@AllArgsConstructor
@NoArgsConstructor
@Entity
@SQLDelete(sql = "update flows_info set deleted = 1 where id = ?")
@SQLDelete(sql = "update DATAHISTORY set deleted = 1 where id = ?")
@Where(clause = "deleted = 0")
@Api("历史数据")
public class DataHistory extends BaseEntity {
@ApiModelProperty
@ApiModelProperty("执行实例ID")
private String executionId;
@ApiModelProperty("流程实例id")
......@@ -38,6 +38,9 @@ public class DataHistory extends BaseEntity {
@ApiModelProperty("节点Id")
private String activityId;
@ApiModelProperty("执行实例ID_流程实例id_节点Id 用于作为索引")
private String uniqueString;
@ApiModelProperty("页面id")
private String pageId;
......@@ -74,4 +77,8 @@ public class DataHistory extends BaseEntity {
@Lob
private String IndexKey;
public static String initUniqueString(String executionId,String processInstanceId,String activityId){
return executionId+"_"+processInstanceId+"_"+activityId ;
}
}
......@@ -27,7 +27,7 @@ import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@Entity
@SQLDelete(sql = "update flows_info set deleted = 1 where id = ?")
@SQLDelete(sql = "update FLOWSINFO set deleted = 1 where id = ?")
@Where(clause = "deleted = 0")
@Api("流程表")
public class FlowsInfo extends BaseEntity {
......@@ -81,7 +81,6 @@ public class FlowsInfo extends BaseEntity {
private String tableInfoIds;
@ApiModelProperty("是否所有用户都可以发起")
@Lob
private Integer allUser = 0;
@ApiModelProperty("流程可发起用户 示例1,2,3,4,5, 最后一个 , 结尾一定要加上")
......@@ -92,31 +91,9 @@ public class FlowsInfo extends BaseEntity {
@Lob
private String CandidateGroup;
@ApiModelProperty("流程可发起用户组 前端传过来的")
@ApiModelProperty("流程可发起用户前端回显的Json字段 前端传过来的")
@Lob
private String CandidateGroupJson;
public void setCandidateUser(List<String> candidateUsers) {
String userString = candidateUsers.toString();
this.candidateUser = userString.substring(1,userString.length()-1)+",";
}
public void setCandidateGroup(List<CandidateRoleDetailVo> candidateRoleDetailVo ) {
if (candidateRoleDetailVo!=null){
this.CandidateGroupJson = JSONObject.toJSONString(candidateRoleDetailVo);
StringBuffer stringBuffer = new StringBuffer();
for (CandidateRoleDetailVo roleDetailVo : candidateRoleDetailVo) {
String type = roleDetailVo.getType();
List<WorkFlowRole> detail = roleDetailVo.getDetail();
for (WorkFlowRole workFlowRole : detail) {
stringBuffer.append(type+"_"+workFlowRole.getRoleId()+",");
}
}
this.CandidateGroup = stringBuffer.toString();
}else {
this.CandidateGroupJson ="";
this.CandidateGroup ="";
}
}
private String CandidateJson;
}
......@@ -29,7 +29,7 @@ import java.util.stream.Collectors;
@AllArgsConstructor
@NoArgsConstructor
@Entity
@SQLDelete(sql = "update flows_info set deleted = 1 where id = ?")
@SQLDelete(sql = "update FORMPAGE set deleted = 1 where id = ?")
@Where(clause = "deleted = 0")
@Api("表单页面")
public class FormPage extends BaseEntity {
......
package com.tykj.workflowcore.workflow_editer.entity;
import com.tykj.workflowcore.base.entity.BaseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
/**
* ClassName: NodePage
* Package: com.tykj.entity
* Description:
* Datetime: 2021/3/3 13:08
*
* @Author: zsp
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Api("节点信息")
public class NodeInfo extends BaseEntity {
@ApiModelProperty("节点id")
private String nodeId;
@ApiModelProperty("页面id")
private Integer pageId;
@ApiModelProperty("流程key")
private String flowKey;
@ApiModelProperty("流程名")
private String flowName;
// @ApiModelProperty("候选人类型")
// private String candidateType;
//
// @ApiModelProperty("候选人显示值")
// private String candidateLabel;
//
// @ApiModelProperty("候选人显示值")
// private String candidateValue;
//
// @ApiModelProperty("0为默认,1为可视,2为公式")
// private Integer expressionType;
//
// @ApiModelProperty("输入框中的值 例如: 同意,不同意")
// private Integer expressionValue;
//
// @ApiModelProperty("连接条件")
// private String expressionConnectionConditions;
@ApiModelProperty("判断条件拼接字段 例如:[{'resource':'${people.id}','comparator':'>=','value':'10'}]")
private String expressionCondition;
}
......@@ -32,7 +32,7 @@ public class WorkFlowRole {
/**
* 权限的标识
*/
private String roleId;
private String id;
private List<WorkFlowRole> childNodes;
......
......@@ -4,6 +4,9 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
/**
* ClassName: Role
* Package: com.tykj.entity
......@@ -25,5 +28,15 @@ public class WorkFlowRoleType {
*/
private String type;
/**
* 这个字段给前端用的 user,group
*/
private String displayType;
/**
* 这个字段给前端用的 一个空数组
*/
private List<String> children = new ArrayList<>();
}
......@@ -23,7 +23,7 @@ public class WorkFlowUser implements Serializable {
private String id;
private String userName;
private String name;
}
package com.tykj.workflowcore.workflow_editer.entity.enums;
public enum RoleTypeEnum {
ORGANIZATION("organization"),
ROLE("role");
String typeName;
RoleTypeEnum(String typeName) {
this.typeName = typeName;
}
}
package com.tykj.workflowcore.workflow_editer.entity.vo;
import com.tykj.workflowcore.base.page.JpaCustomPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.A;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Api("查询节点数据")
public class ActivityNodeInfoSelectVo extends JpaCustomPage {
@ApiModelProperty("流程key")
private String processKey;
}
......@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import javax.persistence.Lob;
import java.util.List;
/**
......@@ -40,11 +41,17 @@ public class FlowsInfoVo {
@ApiModelProperty("流程XML")
private String fileXml;
@ApiModelProperty("流程可发起用户")
private List<String> candidateUsers ;
@ApiModelProperty("流程可发起用户 示例1,2,3,4,5, 最后一个 , 结尾一定要加上")
@Lob
private String candidateUser;
@ApiModelProperty("流程可发起用户组")
private List<CandidateRoleDetailVo> candidateRoleDetail;
@ApiModelProperty("流程可发起用户组 示例role_1,department_2, 最后一个 , 结尾一定要加上")
@Lob
private String candidateGroup;
@ApiModelProperty("流程可发起用户前端回显的Json字段 前端传过来的")
@Lob
private String candidateJson;
public FlowsInfo toEntity(){
FlowsInfo flowsInfo = new FlowsInfo();
......
package com.tykj.workflowcore.workflow_editer.entity.vo;
import com.tykj.workflowcore.base.page.JpaCustomPage;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MyStartProcessSelectVo extends JpaCustomPage {
@ApiModelProperty("状态 0正在运行 1终止")
private Integer state;
@ApiModelProperty("流程标题")
private String processName;
@ApiModelProperty("用户ID")
private String userId;
}
package com.tykj.workflowcore.workflow_editer.entity.vo;
import com.tykj.workflowcore.base.page.JpaCustomPage;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MyTaskSelectVo extends JpaCustomPage {
@ApiModelProperty("状态 0正在运行 1终止")
private Integer state;
@ApiModelProperty("任务标题")
private String taskName;
@ApiModelProperty("用户ID")
private String userId;
}
package com.tykj.workflowcore.workflow_editer.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -19,9 +20,18 @@ import java.util.List;
@NoArgsConstructor
public class NextTaskVo {
@ApiModelProperty("用户ID")
private String userId;
private List<String> roleId;
@ApiModelProperty("用户组ID 示例:role_admin")
private List<String> groupStrings;
private String taskName;
private String processName;
}
package com.tykj.workflowcore.workflow_editer.entity.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageReturnVo<V> {
private long count;
V content;
}
package com.tykj.workflowcore.workflow_editer.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import liquibase.pro.packaged.S;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProcessInstanceReturnVo {
private String processInstanceId;
@ApiModelProperty("流程名称")
private String processName;
@ApiModelProperty("流程描述")
private String processDescription;
@ApiModelProperty("流程状态 0运行中 1运行完成")
private Integer state;
@ApiModelProperty("流程创建时间")
private Date createTime;
@ApiModelProperty("流程创建用户")
private String createUser;
@ApiModelProperty("流程结束时间")
private Date endTime;
@ApiModelProperty("流程持续时间")
private String durationTime;
}
......@@ -31,6 +31,6 @@ public class SearchFlowInfoVo extends JpaCustomPage {
@ApiModelProperty("用户ID")
private String userId;
@ApiModelProperty("权限ID 示例:role_admin")
private List<String> roleStrings;
@ApiModelProperty("用户组ID 示例:role_admin")
private List<String> groupStrings;
}
package com.tykj.workflowcore.workflow_editer.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaskHistoryReturnVo {
private String Id;
@ApiModelProperty("流程实例ID")
private String processInstanceId;
@ApiModelProperty("流程名称")
private String processName;
@ApiModelProperty("流程描述")
private String processDescription;
@ApiModelProperty("任务名称")
private String taskName;
@ApiModelProperty("任务描述")
private String taskDescription;
@ApiModelProperty("流程状态 0运行中 1运行完成")
private Integer state;
@ApiModelProperty("流程创建时间")
private Date createTime;
@ApiModelProperty("流程创建用户")
private String createUser;
@ApiModelProperty("流程结束时间")
private Date endTime;
@ApiModelProperty("流程持续时间")
private String durationTime;
}
......@@ -136,9 +136,13 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
dataHistory.setProcessInstanceId(execution.getProcessInstanceId());
//设置节点Id
dataHistory.setExecutionId(execution.getId());
dataHistory.setActivityId(execution.getCurrentFlowElement().getId());
dataHistory.setProcessInstanceId(execution.getProcessInstanceId());
BeanUtils.copyProperties(page,dataHistory);
dataHistory.setActivityId(execution.getCurrentFlowElement().getId());
dataHistory.setUniqueString(DataHistory.initUniqueString(dataHistory.getExecutionId(),dataHistory.getProcessInstanceId(),dataHistory.getActivityId()));
dataHistory.setJs(page.getJs());
dataHistory.setCss(page.getCss());
dataHistory.setTemplate(page.getTemplate());
dataHistory.setDescFile(page.getDescFile());
dataHistory.setDatas(JSONObject.toJSONString(variables));
dataHistory.setIndexKey(initDataHistoryIndexKey(dataHistory));
//保存下来
......
package com.tykj.workflowcore.workflow_editer.service;
import com.tykj.workflowcore.workflow_editer.entity.ActivityNodeInfo;
import com.tykj.workflowcore.workflow_editer.entity.vo.ActivityNodeInfoSelectVo;
import org.springframework.data.domain.Page;
public interface ActivityNodeService {
ActivityNodeInfo save(ActivityNodeInfo activityNodeInfo);
ActivityNodeInfo update(ActivityNodeInfo activityNodeInfo);
ActivityNodeInfo findOneById(Integer id );
Page<ActivityNodeInfo> findAll(ActivityNodeInfoSelectVo activityNodeInfoSelectVo);
void delete(Integer id);
}
......@@ -19,12 +19,9 @@ public interface DataHistoryService {
*/
DataHistory save(DataHistory dataHistory);
/**
* 根据任务id查询
* @param taskId 任务id
* @return flowsInfo 对象
*/
// DataHistory findByTaskId(String taskId);
DataHistory findByUniqueString(String uniqueString);
}
......@@ -39,7 +39,7 @@ public interface FlowInfoService {
* @param flowsInfoVo flowsInfo
* @return flowsInfoVo
*/
FlowsInfo findByDesc(@RequestBody FlowsInfoVo flowsInfoVo);
FlowsInfo updateDesc(@RequestBody FlowsInfoVo flowsInfoVo);
/**
* 根据流程部署id查询
......@@ -55,6 +55,13 @@ public interface FlowInfoService {
*/
FlowsInfo findByFlowKey(String flowKey);
/**
* 根据流程主键查询 查出包括被删除的流程
* @param flowKey 流程主键
* @return flowsInfo 对象
*/
FlowsInfo findByFlowKeyWithDelete(String flowKey);
/**
* 停用流程
* @param flowInfoId
......@@ -85,12 +92,11 @@ public interface FlowInfoService {
/**
* 更新流程可发起用户以及用户组
* @param flowKey 流程Key
* @param candidateUsers 流程可发起用户
* @param candidateRoleDetailVo 流程可发起用户组
* @param flowsInfo 流程Vo
* @return
*/
FlowsInfo updateCandidate(String flowKey, List<String> candidateUsers , List<CandidateRoleDetailVo> candidateRoleDetailVo );
FlowsInfo updateCandidate(FlowsInfoVo flowsInfo);
......
package com.tykj.workflowcore.workflow_editer.service;
import com.tykj.workflowcore.workflow_editer.entity.NodeInfo;
import java.util.List;
/**
* ClassName: NodePageService
* Package: com.tykj.service
* Description:
* Datetime: 2021/3/4 15:33
*
* @Author: zsp
*/
public interface NodeInfoService {
/**
* 通过节点id得到pageId
* @param nodeId 节点id
* @return 返回页面id
*/
Integer findByNodeId(String nodeId);
/**
* 保存节点和页面的关系
* @param nodeInfo
*/
void saveNodePage(NodeInfo nodeInfo);
/**
* 保存nodeInfo集合 至数据库中
* @param nodeInfoList 集合
*/
void saveNodeInfoList(List<NodeInfo> nodeInfoList);
}
......@@ -2,6 +2,7 @@ package com.tykj.workflowcore.workflow_editer.service;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.entity.vo.*;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -141,7 +142,7 @@ public interface WorkFlowService {
* 查已办任务
* @return 任务已办列表
*/
List<Object> findHistoryTask();
PageReturnVo<List<TaskHistoryReturnVo>> findHistoryTask(MyTaskSelectVo myTaskSelectVo);
/**
* 获取当前任务节点ID
......@@ -158,7 +159,7 @@ public interface WorkFlowService {
String getCurrentProcId(String taskId);
List<HistoricProcessInstance> findStartByUser(String userId);
PageReturnVo<List<ProcessInstanceReturnVo>> findStartByUser(MyStartProcessSelectVo myStartProcessSelectVo);
/**
* 中止流程
......@@ -172,6 +173,20 @@ public interface WorkFlowService {
*/
List<ProcessInstance> queryUnfinishedProcessInstance(String processKey);
/**
* 根据processInstanceId 查询这个流程的历史最后一个节点
* @param processInstance
* @return
*/
HistoricActivityInstance findLastActivityByProcessInstance(String processInstance);
/**
* 根据processInstanceId 查询这个流程的历史最后一个节点
* @param Id
* @return
*/
HistoricActivityInstance findActivityById(String Id);
}
package com.tykj.workflowcore.workflow_editer.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.workflowcore.base.result.ApiException;
import com.tykj.workflowcore.workflow_editer.dao.ActivityNodeInfoMapper;
import com.tykj.workflowcore.workflow_editer.entity.ActivityNodeInfo;
import com.tykj.workflowcore.workflow_editer.entity.vo.ActivityNodeInfoSelectVo;
import com.tykj.workflowcore.workflow_editer.service.ActivityNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Optional;
@Service
public class ActivityNodeServiceImpl implements ActivityNodeService {
@Autowired
ActivityNodeInfoMapper activityNodeInfoMapper;
@Override
public ActivityNodeInfo save(ActivityNodeInfo activityNodeInfo) {
return activityNodeInfoMapper.save(activityNodeInfo);
}
@Override
public ActivityNodeInfo update(ActivityNodeInfo activityNodeInfo) {
return activityNodeInfoMapper.save(activityNodeInfo);
}
@Override
public ActivityNodeInfo findOneById(Integer id) {
Optional<ActivityNodeInfo> byId = activityNodeInfoMapper.findById(id);
if (!byId.isPresent()){
throw new ApiException("找不到数据");
}
return byId.get();
}
@Override
public Page<ActivityNodeInfo> findAll(ActivityNodeInfoSelectVo activityNodeInfoSelectVo) {
PredicateBuilder<ActivityNodeInfo> predicateBuilder = Specifications.and();
predicateBuilder.eq(!StringUtils.isEmpty(activityNodeInfoSelectVo.getProcessKey()),"processKey", activityNodeInfoSelectVo.getProcessKey());
Page<ActivityNodeInfo> all = activityNodeInfoMapper.findAll(predicateBuilder.build(), activityNodeInfoSelectVo.getPageable());
return all;
}
@Override
public void delete(Integer id) {
try {
activityNodeInfoMapper.deleteById(id);
}catch (Exception e){
e.printStackTrace();
throw new ApiException("删除失败,请联系管理员");
}
}
}
......@@ -19,13 +19,16 @@ public class DataHistoryServiceImpl implements DataHistoryService {
@Autowired
private DataHistoryMapper dataHistoryMapper;
@Override
public DataHistory save(DataHistory dataHistory) {
return dataHistoryMapper.save(dataHistory);
}
// @Override
// public DataHistory findByTaskId(String taskId) {
// return dataHistoryMapper.findByTaskId(taskId);
// }
@Override
public DataHistory findByUniqueString(String uniqueString) {
DataHistory byUniqueString = dataHistoryMapper.findByUniqueString(uniqueString);
return byUniqueString;
}
}
package com.tykj.workflowcore.workflow_editer.service.impl;
import com.tykj.workflowcore.user.controller.OrganizationController;
import com.tykj.workflowcore.user.pojo.Organization;
import com.tykj.workflowcore.user.pojo.User;
import com.tykj.workflowcore.user.pojo.UserDetail;
import com.tykj.workflowcore.user.pojo.vo.OrganizationVo;
import com.tykj.workflowcore.user.pojo.vo.ServerResponse;
import com.tykj.workflowcore.user.service.CenterUserService;
import com.tykj.workflowcore.user.util.AuthenticationUtils;
import com.tykj.workflowcore.workflow_editer.entity.WorkFlowRole;
import com.tykj.workflowcore.workflow_editer.entity.WorkFlowRoleType;
import com.tykj.workflowcore.workflow_editer.entity.WorkFlowUser;
import com.tykj.workflowcore.workflow_editer.entity.enums.RoleTypeEnum;
import com.tykj.workflowcore.workflow_editer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
......@@ -14,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author HuangXiahao
......@@ -28,34 +32,38 @@ public class DefaultUserServiceImpl implements UserService {
@Autowired
OrganizationController organizationController;
@Autowired
AuthenticationUtils authenticationUtils;
@Autowired
CenterUserService centerUserService;
@Override
public WorkFlowUser getCurrentUser() {
UserDetail authentication = authenticationUtils.getAuthentication();
WorkFlowUser workFlowUser = new WorkFlowUser();
workFlowUser.setId("0");
workFlowUser.setUserName("张0");
workFlowUser.setId(authentication.getId());
workFlowUser.setName(authentication.getRealName());
return workFlowUser;
}
@Override
public List<WorkFlowUser> getAllUser() {
List<WorkFlowUser> workFlowUsers = new ArrayList<>();
for (int i = 0; i < 10; i++) {
WorkFlowUser workFlowUser = new WorkFlowUser();
workFlowUser.setUserName("张"+i);
workFlowUser.setId("i"+i);
workFlowUsers.add(workFlowUser);
}
return workFlowUsers;
List<User> all = centerUserService.findAll();
List<WorkFlowUser> collect = all.stream().map(
user -> new WorkFlowUser(user.getId(), user.getRealName())
).collect(Collectors.toList());
return collect;
}
@Override
public List<WorkFlowRole> getAllRole(String roleType) {
List<WorkFlowRole> workFlowUsers = new ArrayList<>();
if (roleType.equals("organization")){
if (roleType.equals(RoleTypeEnum.ORGANIZATION.name())){
List<OrganizationVo> data = (List<OrganizationVo>) organizationController.findByName(null).getData();
List<WorkFlowRole> workFlowRoles = changeOrgToWorkFlowRole(data);
workFlowUsers.addAll(workFlowRoles);
}else {
} else if (roleType.equals(RoleTypeEnum.ROLE.name())){
workFlowUsers.add(new WorkFlowRole("管理员","role","1",null));
workFlowUsers.add(new WorkFlowRole("普通用户","role","2",null));
workFlowUsers.add(new WorkFlowRole("运维人员","role","3",null));
......@@ -67,11 +75,18 @@ public class DefaultUserServiceImpl implements UserService {
@Override
public List<WorkFlowRoleType> getRoleType() {
List<WorkFlowRoleType> workFlowRoleTypes = new ArrayList<>();
workFlowRoleTypes.add(new WorkFlowRoleType("组织架构","organization"));
workFlowRoleTypes.add(new WorkFlowRoleType("角色","role"));
workFlowRoleTypes.add(new WorkFlowRoleType("用户","user","user",new ArrayList<>()));
workFlowRoleTypes.add(new WorkFlowRoleType("组织架构",RoleTypeEnum.ORGANIZATION.name(),"group",new ArrayList<>()));
workFlowRoleTypes.add(new WorkFlowRoleType("角色",RoleTypeEnum.ROLE.name(),"group",new ArrayList<>()));
return workFlowRoleTypes;
}
public List<String> getUserGroupList(){
UserDetail userDetail = authenticationUtils.getAuthentication();
return null;
}
private List<WorkFlowRole> changeOrgToWorkFlowRole(List<OrganizationVo> organizationList) {
List<WorkFlowRole> workFlowRoles = new ArrayList<>();
for (OrganizationVo organization : organizationList) {
......@@ -80,8 +95,8 @@ public class DefaultUserServiceImpl implements UserService {
workFlowRole.setChildNodes(changeOrgToWorkFlowRole(organization.getChildNodes()));
}
workFlowRole.setName(organization.getOrganizationName());
workFlowRole.setRoleId(organization.getCode());
workFlowRole.setRoleType("organization");
workFlowRole.setId(organization.getCode());
workFlowRole.setRoleType(RoleTypeEnum.ORGANIZATION.name());
workFlowRoles.add(workFlowRole);
}
return workFlowRoles;
......
......@@ -5,7 +5,6 @@ import com.github.wenhao.jpa.Specifications;
import com.tykj.workflowcore.base.result.ApiException;
import com.tykj.workflowcore.workflow_editer.dao.FlowsInfoMapper;
import com.tykj.workflowcore.workflow_editer.entity.FlowsInfo;
import com.tykj.workflowcore.workflow_editer.entity.vo.CandidateRoleDetailVo;
import com.tykj.workflowcore.workflow_editer.entity.vo.FlowsInfoVo;
import com.tykj.workflowcore.workflow_editer.entity.vo.SearchAllFlowInfoVo;
import com.tykj.workflowcore.workflow_editer.entity.vo.SearchFlowInfoVo;
......@@ -20,7 +19,6 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.*;
import java.util.stream.Collectors;
/**
* ClassName: FlowInfoServiceImpl
......@@ -34,6 +32,8 @@ import java.util.stream.Collectors;
@Slf4j
public class FlowInfoServiceImpl implements FlowInfoService {
private static String ALL_USER = "ALL_USER";
@Autowired
private FlowsInfoMapper flowsInfoMapper;
......@@ -43,12 +43,15 @@ public class FlowInfoServiceImpl implements FlowInfoService {
@Autowired
private RuntimeService runtimeService;
public FlowsInfo updateCandidate(String flowKey, List<String> candidateUsers , List<CandidateRoleDetailVo> candidateRoleDetailVo ){
FlowsInfo flowsInfo = flowsInfoMapper.findByFlowKey(flowKey);
flowsInfo.setCandidateUser(candidateUsers);
flowsInfo.setCandidateGroup(candidateRoleDetailVo);
FlowsInfo newFlowsInfo = flowsInfoMapper.save(flowsInfo);
return newFlowsInfo;
public FlowsInfo updateCandidate(FlowsInfoVo flowsInfoVo){
if (flowsInfoVo.getId()==null){
throw new ApiException("id 不能为空");
}
FlowsInfo flowsInfo = findById(flowsInfoVo.getId());
flowsInfo.setCandidateUser(flowsInfoVo.getCandidateUser());
flowsInfo.setCandidateGroup(flowsInfoVo.getCandidateGroup());
flowsInfo.setCandidateJson(flowsInfoVo.getCandidateJson());
return flowsInfoMapper.save(flowsInfo);
}
@Override
......@@ -68,8 +71,7 @@ public class FlowInfoServiceImpl implements FlowInfoService {
}
@Override
public FlowsInfo findByDesc(@RequestBody FlowsInfoVo flowsInfoVo) {
public FlowsInfo updateDesc(@RequestBody FlowsInfoVo flowsInfoVo) {
String flowKey = flowsInfoVo.getFlowKey();
String describe = flowsInfoVo.getFlowDescribe();
FlowsInfo byDesc = flowsInfoMapper.findByFlowKey(flowKey);
......@@ -89,6 +91,12 @@ public class FlowInfoServiceImpl implements FlowInfoService {
return flowsInfoMapper.findByFlowKey(flowKey);
}
@Override
public FlowsInfo findByFlowKeyWithDelete(String flowKey) {
FlowsInfo byFlowKeyWithDelete = flowsInfoMapper.findByFlowKeyWithDelete(flowKey);
return byFlowKeyWithDelete;
}
@Override
public FlowsInfo disableFlow(Integer flowInfoId) {
Optional<FlowsInfo> byId = flowsInfoMapper.findById(flowInfoId);
......@@ -118,10 +126,13 @@ public class FlowInfoServiceImpl implements FlowInfoService {
and.eq(!StringUtils.isEmpty(searchFlowInfoVo.getFlowKey()),"flowKey",searchFlowInfoVo.getFlowKey());
and.like(!StringUtils.isEmpty(searchFlowInfoVo.getFlowName()),"flowName","%"+searchFlowInfoVo.getFlowName()+"%");
PredicateBuilder<FlowsInfo> userOr = Specifications.or();
userOr.eq("candidateUser",ALL_USER);
userOr.like(!StringUtils.isEmpty(searchFlowInfoVo.getUserId()),"candidateUser","%"+searchFlowInfoVo.getUserId()+",%");
List<String> roleStrings = searchFlowInfoVo.getRoleStrings();
for (String roleString : roleStrings) {
userOr.like("CandidateGroup","%"+roleString+",%");
List<String> roleStrings = searchFlowInfoVo.getGroupStrings();
if (roleStrings!=null&&roleStrings.size()>0){
for (String roleString : roleStrings) {
userOr.like("CandidateGroup","%"+roleString+",%");
}
}
return flowsInfoMapper.findAll(and.build().and(userOr.build()), searchFlowInfoVo.getPageable());
}
......
......@@ -13,6 +13,7 @@ import com.tykj.workflowcore.workflow_editer.entity.vo.PageFormPageVo;
import com.tykj.workflowcore.workflow_editer.service.FlowInfoService;
import com.tykj.workflowcore.workflow_editer.service.FormPageService;
import com.tykj.workflowcore.workflow_editer.service.WorkFlowService;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.runtime.ProcessInstance;
......@@ -65,17 +66,19 @@ public class FormPageServiceImpl implements FormPageService {
//查询对应的processKey
FlowsInfo byFlowKey = flowInfoService.findByFlowKey(formPage.getProcessKey());
JSONArray pageIdArrays = JSONArray.parseArray(byFlowKey.getPageIds());
if (pageIdArrays.contains(formPage.getId())){
//判断 byFlowKey 是否正在运行
Integer state = byFlowKey.getState();
// 0代表这个流程正在运行过程中
if (state == 0){
throw new ApiException("该页面正在流程中运行,无法被修改");
}
//判断该流程是否存在正在运行的流程实例如果存在将不允许修改页面
List<ProcessInstance> processInstances = workFlowService.queryUnfinishedProcessInstance(formPage.getProcessKey());
if (processInstances.size()>0){
throw new ApiException("该页面正在流程中运行,无法被修改.请先停止所有正在运行的流程实例");
if (pageIdArrays!=null){
if (pageIdArrays.contains(formPage.getId())){
//判断 byFlowKey 是否正在运行
Integer state = byFlowKey.getState();
// 0代表这个流程正在运行过程中
if (state == 0){
throw new ApiException("该页面正在流程中运行,无法被修改");
}
//判断该流程是否存在正在运行的流程实例如果存在将不允许修改页面
List<ProcessInstance> processInstances = workFlowService.queryUnfinishedProcessInstance(formPage.getProcessKey());
if (processInstances.size()>0){
throw new ApiException("该页面正在流程中运行,无法被修改.请先停止所有正在运行的流程实例");
}
}
}
formPageMapper.save(formPage);
......@@ -113,6 +116,7 @@ public class FormPageServiceImpl implements FormPageService {
@Override
public Specification<FormPage> specificationBuild(PageFormPageVo pageFormPageVo) {
PredicateBuilder<FormPage> and = Specifications.and();
and.eq(!StringUtils.isEmpty(pageFormPageVo.getProcessKey()),"processKey",pageFormPageVo.getProcessKey());
and.eq(pageFormPageVo.getPageName()!=null,"pageName",pageFormPageVo.getPageName());
and.eq(pageFormPageVo.getPageDesc()!=null,"pageDesc",pageFormPageVo.getPageDesc());
and.eq(pageFormPageVo.getCreateTime()!=null,"createTime",pageFormPageVo.getCreateTime());
......
package com.tykj.workflowcore.workflow_editer.service.impl;
import com.tykj.workflowcore.workflow_editer.dao.NodePageMapper;
import com.tykj.workflowcore.workflow_editer.entity.NodeInfo;
import com.tykj.workflowcore.workflow_editer.service.NodeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* ClassName: NodePageServiceImpl
* Package: com.tykj.service.impl
* Description:
* Datetime: 2021/3/4 15:34
*
* @Author: zsp
*/
@Service
public class NodeInfoServiceImpl implements NodeInfoService {
@Autowired
private NodePageMapper nodePageMapper;
@Override
public Integer findByNodeId(String nodeId) {
return nodePageMapper.findByNodeId(nodeId);
}
@Override
public void saveNodePage(NodeInfo nodeInfo) {
nodePageMapper.save(nodeInfo);
}
@Override
public void saveNodeInfoList(List<NodeInfo> nodeInfos) {
if (nodeInfos!=null){
nodePageMapper.saveAll(nodeInfos);
}
}
}
......@@ -27,4 +27,6 @@ public class UserServiceBeanUtil {
return beansOfType.get("defaultUserServiceImpl");
}
}
......@@ -48,11 +48,9 @@ public class FlowEventValidator extends ProcessLevelValidator {
if (userTask.getFormKey() == null){
errors.add(createValidationErrorProblem("用户节点未设置表单"));
}
}
}
if (startEvents!=null&&startEvents.size()<=0){
errors.add(createValidationErrorProblem("开始节点不存在"));
}else {
......
.searchBar[data-v-7ef02ce2]{background-color:#fff;width:100%;height:84px;-webkit-box-shadow:0 2px 4px rgba(42,61,179,.1);box-shadow:0 2px 4px rgba(42,61,179,.1);border-radius:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box}.addProcessDialog[data-v-7ef02ce2] .el-input__inner,.addProcessDialog[data-v-7ef02ce2] .el-textarea__inner{font-size:20px;background-color:#f9fafd}.ty_padding_left_right[data-v-7ef02ce2]{padding:0 36px}.checkModel[data-v-7ef02ce2]{width:100%;height:60px}.checkModel .add[data-v-7ef02ce2]{border:1px solid #2a3db3;color:#2a3db3;border-radius:20px}.add[data-v-7ef02ce2]:hover,.checkModel .add[data-v-7ef02ce2]{width:100px;height:40px;text-align:center;line-height:40px;font-size:18px;cursor:pointer}.add[data-v-7ef02ce2]:hover{background-color:#2a3db3;color:#fff;border-radius:20px}.check_byte[data-v-7ef02ce2]{margin-top:30px}.check_byte .item[data-v-7ef02ce2]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:500px;margin-bottom:10px}.item[data-v-7ef02ce2] .el-input__inner{height:50px;font-size:18px}.item .del[data-v-7ef02ce2]{margin-left:40px;width:50px;color:red;font-size:18px;cursor:pointer}.el-dialog__header{background:#e0e8ff;height:36px;padding:10px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-dialog__header>.el-dialog__title{font-size:22px;color:#35435e;font-weight:700;margin-left:30px}.el-dialog__header>.el-dialog__headerbtn>i{border-radius:50%;background:#2a3db3;color:#fff;font-size:22px}.ty_return[data-v-1edc5e91]{display:inline-block;color:#2a3db3;cursor:pointer;font-size:18px}.addDataModel[data-v-1edc5e91]{height:100%}.addDataModel[data-v-1edc5e91] .el-form-item__label{font-size:20px}.searchBar[data-v-1edc5e91] .el-col{margin:10px 0}.searchBar[data-v-1edc5e91] .el-form-item{margin-bottom:0}.searchBar[data-v-1edc5e91] .el-form-item__content{line-height:0}.searchBar[data-v-1edc5e91] .el-input__inner,.searchBar[data-v-1edc5e91] .el-select .el-input__inner{background:#f9fafd;border:1px solid #ebedf1;font-size:20px;color:#a1a8ba}.searchBar[data-v-1edc5e91] .el-input__inner:focus{background-color:#fdfdfd;border:1px solid #a8b0e2;font-size:20px;color:#35435e}.searchBar[data-v-1edc5e91]{background-color:#fff;width:100%;height:90px;-webkit-box-shadow:0 2px 4px rgba(42,61,179,.1);box-shadow:0 2px 4px rgba(42,61,179,.1);border-radius:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box}.basicObject[data-v-1edc5e91]{font-size:20px;color:#606266;line-height:40px;display:-webkit-box;display:-ms-flexbox;display:flex}.basicObject_input[data-v-1edc5e91]{position:relative;width:60%;margin-left:10px}.basicObject_input input[data-v-1edc5e91]{width:98%;background:#f9fafd;border:1px solid #ebedf1;font-size:20px;color:#a1a8ba;height:37px;line-height:37px;border-radius:3px;margin:0;padding-left:16px}.basicObject_input input.active.focus[data-v-1edc5e91],.basicObject_input input.active[data-v-1edc5e91]:focus,.basicObject_input input.focus[data-v-1edc5e91],.basicObject_input input:active.focus[data-v-1edc5e91],.basicObject_input input[data-v-1edc5e91]:active:focus,.basicObject_input input[data-v-1edc5e91]:focus{outline:none;border-color:#ebedf1;-webkit-box-shadow:none;box-shadow:none}.icon_more[data-v-1edc5e91]{background:#fff;right:-13px}.icon-circle-close[data-v-1edc5e91],.icon_more[data-v-1edc5e91]{font-size:20px;width:37px;height:36px;border:0;color:#606266;position:absolute;cursor:pointer;top:3px;border-radius:3px}.icon-circle-close[data-v-1edc5e91]{background:transparent;right:36px}.icon_more.active.focus[data-v-1edc5e91],.icon_more.active[data-v-1edc5e91]:focus,.icon_more.focus[data-v-1edc5e91],.icon_more:active.focus[data-v-1edc5e91],.icon_more[data-v-1edc5e91]:active:focus,.icon_more[data-v-1edc5e91]:focus{outline-color:#2a3db3;outline-width:1px;-webkit-box-shadow:none;box-shadow:none}.ty_span_name[data-v-1edc5e91]{font-size:20px;line-height:40px;color:#a1a8ba}
\ No newline at end of file
.homePage>.el-container[data-v-ef5e00c4],.homePage[data-v-ef5e00c4],.homePage[data-v-ef5e00c4] .el-aside{height:100%}.homePage[data-v-ef5e00c4] .menu{height:100%;width:100%;background-color:#2a3db3}.homePage .title[data-v-ef5e00c4]{width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-bottom:34px}.homePage .title span[data-v-ef5e00c4]{font-size:35px;font-weight:700;color:#fff;text-align:center;margin:44px 0}.homePage .menuItem[data-v-ef5e00c4]{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.homePage .menuItem[data-v-ef5e00c4],.ItemDiv[data-v-ef5e00c4]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ItemDiv[data-v-ef5e00c4]{width:228px;height:56px;border-radius:8px;margin:0;margin-bottom:20px;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.itemDivAct[data-v-ef5e00c4]{background-color:#fff}.itemDivAct .ItemSpanAct[data-v-ef5e00c4]{color:#35435e}.ItemImg[data-v-ef5e00c4]{margin-left:20px;margin-right:10px}.ItemSpan[data-v-ef5e00c4]{font-size:20px;color:#d7dbe3}.header[data-v-ef5e00c4]{width:100%;height:72px!important;padding:0!important;background-color:#f3f2f7}.header>div[data-v-ef5e00c4]{width:100%;height:56px;background-color:#fff;-webkit-box-shadow:0 2px 4px rgba(42,61,179,.1);box-shadow:0 2px 4px rgba(42,61,179,.1);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.ty_return[data-v-ef5e00c4]{display:inline-block;margin-right:40px;color:#2a3db3!important;cursor:pointer}.main[data-v-ef5e00c4] .stripe{background-color:#fcfcfd}.main[data-v-ef5e00c4]{background-color:#f3f2f7;padding:12px 32px 32px;height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;height:94%;-webkit-box-shadow:0 2px 4px rgba(42,61,179,.1);box-shadow:0 2px 4px rgba(42,61,179,.1);border-radius:4px}.main[data-v-ef5e00c4] .el-table .cell{font-size:18px;color:#35435e;line-height:36px;text-align:center}.main[data-v-ef5e00c4] .el-table th{background-color:#dde1f3}.main[data-v-ef5e00c4] .el-table th>.cell{text-align:center;font-size:16px;background-color:#dde1f3;color:#65728a}.main[data-v-ef5e00c4] .el-dialog__header{background:#e0e8ff;height:36px;padding:10px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.main[data-v-ef5e00c4] .el-dialog__header>.el-dialog__title{font-size:20px;color:#35435e;font-weight:700;margin-left:30px}.main[data-v-ef5e00c4] .el-dialog__header>.el-dialog__headerbtn>i{border-radius:50%;background:#2a3db3;color:#fff;font-size:22px}.main[data-v-ef5e00c4] .el-dialog{border-radius:6px;-webkit-box-shadow:4px 4px 8px rgba(42,61,179,.2);box-shadow:4px 4px 8px rgba(42,61,179,.2)}.homePage[data-v-ef5e00c4] .el-dialog__header{border-radius:6px}.main[data-v-ef5e00c4] .el-dialog__header>.el-dialog__headerbtn:hover{opacity:.6}.main[data-v-ef5e00c4] .el-table td{border-bottom:1px solid #e7ebfc}.main[data-v-ef5e00c4] .el-table td,.main[data-v-ef5e00c4] .el-table th{padding:8px 0!important}.main[data-v-ef5e00c4] .el-table tr:hover>td{background-color:#98a9e1!important}.main[data-v-ef5e00c4] .el-table__body tr:hover :not(input,i){color:#fff!important}.time[data-v-ef5e00c4]{height:80px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative}.time span[data-v-ef5e00c4]{font-size:18px;color:#65728a;margin-left:34px}
\ No newline at end of file
<!doctype html><html lang="zh"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=0,maximum-scale=0,user-scalable=yes,shrink-to-fit=no"><link rel="icon" href="favicon.ico"><title>workFlow</title><style>.pre-loader{position:absolute;top:calc(50% - 32px);left:calc(50% - 32px);width:64px;height:64px;border-radius:50%;perspective:800px}.pre-loader .inner{position:absolute;box-sizing:border-box;width:100%;height:100%;border-radius:50%}.pre-loader .inner.one{left:0;top:0;-webkit-animation:rotate-one 1s linear infinite;animation:rotate-one 1s linear infinite;border-bottom:3px solid #bc9048}.pre-loader .inner.two{right:0;top:0;-webkit-animation:rotate-two 1s linear infinite;animation:rotate-two 1s linear infinite;border-right:3px solid #74aeff}.pre-loader .inner.three{right:0;bottom:0;-webkit-animation:rotate-three 1s linear infinite;animation:rotate-three 1s linear infinite;border-top:3px solid #caef74}@keyframes rotate-one{0%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotateZ(0);transform:rotateX(35deg) rotateY(-45deg) rotateZ(0)}100%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotateZ(360deg);transform:rotateX(35deg) rotateY(-45deg) rotateZ(360deg)}}@keyframes rotate-two{0%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotateZ(0);transform:rotateX(50deg) rotateY(10deg) rotateZ(0)}100%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotateZ(360deg);transform:rotateX(50deg) rotateY(10deg) rotateZ(360deg)}}@keyframes rotate-three{0%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotateZ(0);transform:rotateX(35deg) rotateY(55deg) rotateZ(0)}100%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotateZ(360deg);transform:rotateX(35deg) rotateY(55deg) rotateZ(360deg)}}</style><link href="https://lib.baomitu.com/element-ui/2.13.2/theme-chalk/index.css" rel="stylesheet"><link href="https://lib.baomitu.com/monaco-editor/0.19.3/min/vs/editor/editor.main.css" rel="stylesheet"><script src="https://lib.baomitu.com/vue/2.6.11/vue.min.js"></script><script src="https://lib.baomitu.com/vue-router/3.1.3/vue-router.min.js"></script><script src="https://lib.baomitu.com/element-ui/2.13.2/index.js"></script><link href="css/chunk-0267d846.9b86e5cd.css" rel="prefetch"><link href="css/chunk-0cc52324.669a5524.css" rel="prefetch"><link href="css/chunk-3428c1c2.ec920ce8.css" rel="prefetch"><link href="css/chunk-5f2116e7.55076b45.css" rel="prefetch"><link href="css/chunk-79a2a6d4.f7ea5f40.css" rel="prefetch"><link href="css/chunk-7c52297c.61b80532.css" rel="prefetch"><link href="css/chunk-b5da06ba.7a6ae39b.css" rel="prefetch"><link href="css/parser-home.8cdb50e6.css" rel="prefetch"><link href="css/tinymce-example.0e433876.css" rel="prefetch"><link href="js/chunk-0267d846.16236190.js" rel="prefetch"><link href="js/chunk-0cc52324.29bda868.js" rel="prefetch"><link href="js/chunk-3428c1c2.fd5981b1.js" rel="prefetch"><link href="js/chunk-5f2116e7.39e63f89.js" rel="prefetch"><link href="js/chunk-79a2a6d4.b1d5b12d.js" rel="prefetch"><link href="js/chunk-7c52297c.c0a80b51.js" rel="prefetch"><link href="js/chunk-b5da06ba.6d3fd328.js" rel="prefetch"><link href="js/chunk-fec0be80.0583a8a1.js" rel="prefetch"><link href="js/parser-home.8b3caa4d.js" rel="prefetch"><link href="js/tinymce-example.0cafa1e6.js" rel="prefetch"><link href="css/index.d849bf35.css" rel="preload" as="style"><link href="js/chunk-vendors.b6d9e7af.js" rel="preload" as="script"><link href="js/index.1eb421fd.js" rel="preload" as="script"><link href="css/index.d849bf35.css" rel="stylesheet"></head><body><noscript><strong>抱歉,javascript被禁用,请开启后重试。</strong></noscript><div id="app"></div><div class="pre-loader" id="pre-loader"><div class="inner one"></div><div class="inner two"></div><div class="inner three"></div></div><script src="js/chunk-vendors.b6d9e7af.js"></script><script src="js/index.1eb421fd.js"></script></body></html>
\ No newline at end of file
<!doctype html><html lang="zh"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=0,maximum-scale=0,user-scalable=yes,shrink-to-fit=no"><link rel="icon" href="favicon.ico"><title>workFlow</title><style>.pre-loader{position:absolute;top:calc(50% - 32px);left:calc(50% - 32px);width:64px;height:64px;border-radius:50%;perspective:800px}.pre-loader .inner{position:absolute;box-sizing:border-box;width:100%;height:100%;border-radius:50%}.pre-loader .inner.one{left:0;top:0;-webkit-animation:rotate-one 1s linear infinite;animation:rotate-one 1s linear infinite;border-bottom:3px solid #bc9048}.pre-loader .inner.two{right:0;top:0;-webkit-animation:rotate-two 1s linear infinite;animation:rotate-two 1s linear infinite;border-right:3px solid #74aeff}.pre-loader .inner.three{right:0;bottom:0;-webkit-animation:rotate-three 1s linear infinite;animation:rotate-three 1s linear infinite;border-top:3px solid #caef74}@keyframes rotate-one{0%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotateZ(0);transform:rotateX(35deg) rotateY(-45deg) rotateZ(0)}100%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotateZ(360deg);transform:rotateX(35deg) rotateY(-45deg) rotateZ(360deg)}}@keyframes rotate-two{0%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotateZ(0);transform:rotateX(50deg) rotateY(10deg) rotateZ(0)}100%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotateZ(360deg);transform:rotateX(50deg) rotateY(10deg) rotateZ(360deg)}}@keyframes rotate-three{0%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotateZ(0);transform:rotateX(35deg) rotateY(55deg) rotateZ(0)}100%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotateZ(360deg);transform:rotateX(35deg) rotateY(55deg) rotateZ(360deg)}}</style><link href="https://lib.baomitu.com/element-ui/2.13.2/theme-chalk/index.css" rel="stylesheet"><link href="https://lib.baomitu.com/monaco-editor/0.19.3/min/vs/editor/editor.main.css" rel="stylesheet"><script src="https://lib.baomitu.com/vue/2.6.11/vue.min.js"></script><script src="https://lib.baomitu.com/vue-router/3.1.3/vue-router.min.js"></script><script src="https://lib.baomitu.com/element-ui/2.13.2/index.js"></script><link href="css/chunk-049cee69.d76d2b9a.css" rel="prefetch"><link href="css/chunk-06ec14b8.fa77da4b.css" rel="prefetch"><link href="css/chunk-3006e7c0.263a45f1.css" rel="prefetch"><link href="css/chunk-5f2116e7.55076b45.css" rel="prefetch"><link href="css/chunk-75a4e523.a68f5ffa.css" rel="prefetch"><link href="css/chunk-79a2a6d4.f7ea5f40.css" rel="prefetch"><link href="css/chunk-7c52297c.61b80532.css" rel="prefetch"><link href="css/chunk-b5da06ba.7a6ae39b.css" rel="prefetch"><link href="css/parser-home.8cdb50e6.css" rel="prefetch"><link href="css/tinymce-example.0e433876.css" rel="prefetch"><link href="js/chunk-049cee69.436ac7e8.js" rel="prefetch"><link href="js/chunk-06ec14b8.53b2ec94.js" rel="prefetch"><link href="js/chunk-3006e7c0.954089d3.js" rel="prefetch"><link href="js/chunk-5f2116e7.39e63f89.js" rel="prefetch"><link href="js/chunk-75a4e523.42aad87f.js" rel="prefetch"><link href="js/chunk-79a2a6d4.b1d5b12d.js" rel="prefetch"><link href="js/chunk-7c52297c.c0a80b51.js" rel="prefetch"><link href="js/chunk-b5da06ba.6d3fd328.js" rel="prefetch"><link href="js/chunk-fec0be80.0583a8a1.js" rel="prefetch"><link href="js/parser-home.8b3caa4d.js" rel="prefetch"><link href="js/tinymce-example.0cafa1e6.js" rel="prefetch"><link href="css/index.7a9e4f8e.css" rel="preload" as="style"><link href="js/chunk-vendors.0fa4ad9a.js" rel="preload" as="script"><link href="js/index.637817d4.js" rel="preload" as="script"><link href="css/index.7a9e4f8e.css" rel="stylesheet"></head><body><noscript><strong>抱歉,javascript被禁用,请开启后重试。</strong></noscript><div id="app"></div><div class="pre-loader" id="pre-loader"><div class="inner one"></div><div class="inner two"></div><div class="inner three"></div></div><script src="js/chunk-vendors.0fa4ad9a.js"></script><script src="js/index.637817d4.js"></script></body></html>
\ No newline at end of file
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5f2116e7"],{"0383":function(t,e,a){"use strict";a("637b")},"0654":function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"addDataModel"},[a("div",{staticClass:"topDiv"},[t.update?t._e():a("span",{staticClass:"title"},[t._v("基础数据模型添加 ")]),t.update?a("span",{staticClass:"title"},[t._v("基础数据模型修改 ")]):t._e(),a("span",{staticClass:"ty_return",on:{click:function(e){return t.$emit("changeVue",0)}}},[t._v("返回")])]),a("div",{staticClass:"searchBar"},[a("el-form",{ref:"ruleForm",staticStyle:{width:"100%"},attrs:{model:t.fieldTableData,rules:t.rules,"label-width":"100px"}},[a("el-row",[a("el-col",{attrs:{span:7}},[a("el-form-item",{attrs:{label:"名称: ",prop:"name"}},[t.update?t._e():a("el-input",{staticStyle:{width:"80%"},model:{value:t.fieldTableData.name,callback:function(e){t.$set(t.fieldTableData,"name",e)},expression:"fieldTableData.name"}}),t.update?a("span",{staticClass:"ty_span_name"},[t._v(t._s(t.fieldTableData.name))]):t._e()],1)],1),a("el-col",{attrs:{span:7}},[a("el-form-item",{attrs:{label:"标签: ",prop:"alias"}},[a("el-input",{staticStyle:{width:"80%"},model:{value:t.fieldTableData.alias,callback:function(e){t.$set(t.fieldTableData,"alias",e)},expression:"fieldTableData.alias"}})],1)],1),a("el-col",{attrs:{span:7}},[a("el-form-item",{attrs:{label:"描述: ",prop:"description"}},[a("el-input",{staticStyle:{width:"80%"},model:{value:t.fieldTableData.description,callback:function(e){t.$set(t.fieldTableData,"description",e)},expression:"fieldTableData.description"}})],1)],1)],1)],1)],1),a("div",{staticClass:"ty_table",staticStyle:{overflow:"hidden"}},[a("div",{staticClass:"topDiv"},[a("button",{staticClass:"addProcess",on:{click:t.add}},[t._v("新增字段")]),a("button",{staticClass:"preservationButton",on:{click:t.addTable}},[t._v("保存")])]),a("el-table",{staticStyle:{width:"100%","margin-top":"10px"},attrs:{data:t.fieldTableData.columnInfos,height:"540","row-class-name":function(t){t.row;var e=t.rowIndex;return e%2==0?"":"stripe"}}},[a("el-table-column",{attrs:{prop:"name",label:"字段名"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.isPrimary?a("el-input",{model:{value:e.row.name,callback:function(a){t.$set(e.row,"name",a)},expression:"scope.row.name"}}):t._e(),0==e.row.isPrimary?a("span",[t._v(t._s(e.row.name))]):t._e()]}}])}),a("el-table-column",{attrs:{prop:"description",label:"描述"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.isPrimary?a("el-input",{model:{value:e.row.description,callback:function(a){t.$set(e.row,"description",a)},expression:"scope.row.description"}}):t._e(),0==e.row.isPrimary?a("span",[t._v(t._s(e.row.description))]):t._e()]}}])}),a("el-table-column",{attrs:{prop:"pattern",label:"正则"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.isPrimary?a("el-input",{model:{value:e.row.pattern,callback:function(a){t.$set(e.row,"pattern",a)},expression:"scope.row.pattern"}}):t._e(),0==e.row.isPrimary?a("span",[t._v(t._s(e.row.pattern))]):t._e()]}}])}),a("el-table-column",{attrs:{prop:"type",label:"类型"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.isPrimary?a("el-select",{attrs:{placeholder:"请选择数据类型"},on:{change:function(a){return t.changeType(e.$index,e.row.type)}},model:{value:e.row.type,callback:function(a){t.$set(e.row,"type",a)},expression:"scope.row.type"}},t._l(t.type,(function(t){return a("el-option",{key:t.value,attrs:{label:t.lab,value:t.value}})})),1):t._e(),0==e.row.isPrimary?a("span",["java.lang.String"==e.row.type?a("span",[t._v("文本")]):t._e(),"java.lang.Integer"==e.row.type?a("span",[t._v("数字")]):t._e(),"java.util.Date"==e.row.type?a("span",[t._v("时间")]):t._e()]):t._e()]}}])}),a("el-table-column",{attrs:{prop:"length",label:"长度"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.isPrimary?a("el-input",{model:{value:e.row.length,callback:function(a){t.$set(e.row,"length",a)},expression:"scope.row.length"}}):t._e(),0==e.row.isPrimary?a("span",[t._v(t._s(e.row.length))]):t._e()]}}])}),a("el-table-column",{attrs:{label:"引用",width:"130"},scopedSlots:t._u([{key:"default",fn:function(e){return[1==e.row.isPrimary?a("el-button",{staticStyle:{"background-color":"#2a3db3",color:"#fff"},on:{click:function(a){return t.onClick_showOptionSet(e.row.quotes,e.$index)}}},[t._v("设置")]):t._e()]}}])}),a("el-table-column",{attrs:{label:"操作",width:"130"},scopedSlots:t._u([{key:"default",fn:function(e){return[0!=e.row.isPrimary?a("el-button",{staticStyle:{color:"red"},attrs:{type:"text"},on:{click:function(a){return t.del(e.$index)}}},[t._v("删除")]):a("span",{staticStyle:{display:"inline-block",width:"100%",height:"100%"}})]}}])})],1)],1),t.isShowOptionSet?a("option-set-dialog",{attrs:{isShowOptionSet:t.isShowOptionSet,currentIndex:t.currentIndex,optionList:t.optionList,update:t.update},on:{"update:isShowOptionSet":function(e){t.isShowOptionSet=e},"update:is-show-option-set":function(e){t.isShowOptionSet=e},close:t.onClick_closeOption}}):t._e()],1)},n=[],s=(a("c740"),a("a434"),a("b0c0"),function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"addOptionDialog"},[a("el-dialog",{attrs:{title:"引用设置",visible:t.isShowOptionSet,width:"40%",top:"80px","append-to-body":"","before-close":t.showFalse},on:{"update:visible":function(e){t.isShowOptionSet=e}}},[a("div",{staticClass:"ty_padding_left_right"},[a("div",{staticClass:"checkModel"},[a("div",{staticClass:"add",on:{click:t.add}},[t._v("添加")])]),a("div",{staticClass:"check_byte"},t._l(t.inputList,(function(e,i){return a("div",{key:i,staticClass:"item"},[a("el-input",{attrs:{placeholder:"请输入内容"},model:{value:e.value,callback:function(a){t.$set(e,"value",a)},expression:"item.value"}}),a("div",{staticClass:"del",on:{click:function(e){return t.del(i)}}},[t._v("删除")])],1)})),0)]),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("button",{staticClass:"button_ty",on:{click:t.showFalse}},[t._v("取 消")]),a("button",{staticClass:"searchBtn button_ty",on:{click:t.onClick_confrim}},[t._v(" 确定 ")])])])],1)}),l=[],o={props:["isShowOptionSet","currentIndex","optionList","update"],data:function(){return{inputList:[{value:""}]}},created:function(){Array.isArray(this.optionList)&&this.optionList.length>0&&(this.inputList=this.optionList)},methods:{add:function(){this.inputList.push({value:""})},del:function(t){this.inputList.length>1&&this.inputList.splice(t,1)},showFalse:function(){this.$emit("close",!1)},unNull:function(t){for(var e=0;e<t.length;e++)if(t[e].value.length<1)return!0;return!1},onClick_confrim:function(){this.$emit("close",this.inputList,this.currentIndex,!0)}}},r=o,c=(a("5c50"),a("0383"),a("2877")),u=Object(c["a"])(r,s,l,!1,null,"7ef02ce2",null),d=u.exports,p={name:"addFormDialog",components:{OptionSetDialog:d},data:function(){return{update:!1,isShowOptionSet:!1,optionList:[],type:[{lab:"数字",value:"java.lang.Integer",lengths:"11"},{lab:"文本",value:"java.lang.String",lengths:"255"},{lab:"时间",value:"java.util.Date",lengths:"0"}],rules:{name:[{required:!0,message:"请输入表名",trigger:"blur"}],alias:[{required:!0,message:"请输入别名",trigger:"blur"}]},dbId:"",fieldTableData:{name:"",alias:"",description:"",processKey:"",columnInfos:[{name:"",pattern:"",description:"",type:"java.lang.String",length:"255",isPrimary:1,quotes:[{value:""}]}]}}},created:function(){this.$store.state.ty_model.id&&(this.update=!0,this.fieldTableData=this.$store.state.ty_model)},methods:{onClick_showOptionSet:function(t,e){this.currentIndex=e,this.optionList=t,this.isShowOptionSet=!0},onClick_closeOption:function(t,e){this.isShowOptionSet=!1,t&&(this.fieldTableData.columnInfos[e].quotes=t)},changeType:function(t,e){var a=this.type.findIndex((function(t,a,i){return t.value==e}));this.fieldTableData.columnInfos[t].length=this.type[a].lengths},add:function(){var t={name:"",description:"",type:"java.lang.String",length:"255",pattern:"",isPrimary:1,quotes:[{value:""}]};this.fieldTableData.columnInfos.push(t)},del:function(t){this.fieldTableData.columnInfos.length<=1||this.fieldTableData.columnInfos.splice(t,1)},unique:function(t){for(var e=0;e<t.length;e++)for(var a=0;a<t.length;a++)if(t[e].name==t[a].name&&e!=a)return!0;return!1},unNull:function(t){for(var e=0;e<t.length;e++)if(t[e].name.length<1)return!0;return!1},addTable:function(){var t=this;if(this.fieldTableData.name.length<1)this.$message.error("请输入表名");else{var e=/^[A-Za-z]{1}[A-Za-z0-9_]+$/;if(e.test(this.fieldTableData.name))if(this.fieldTableData.alias.length<1)this.$message.error("请输入别名");else if(this.unique(this.fieldTableData.columnInfos))this.$message.error("字段名不能重复");else if(this.unNull(this.fieldTableData.columnInfos))this.$message.error("字段名不能为空");else{var a=JSON.parse(JSON.stringify(this.fieldTableData));if(a.columnInfos.length<1)this.$message.error("字段个数不能少于一个");else{var i=this.$loading({lock:!0,text:"保存中,请稍后",spinner:"el-icon-loading",background:"rgba(0, 0, 0, 0.7)"});this.update?(a.id="",this.$axios.updateModel(a).then((function(e){i.close(),t.$emit("changeVue",0),t.$message({message:e.data.message,type:"success"})})).catch((function(e){i.close(),t.$message.error(e.response.data.data)}))):this.$axios.addModel(a).then((function(e){i.close(),t.$emit("changeVue",0),t.$message({message:e.data.message,type:"success"})})).catch((function(e){i.close(),console.log(e.response),t.$message.error(e.response.data.data)}))}}else this.$message.error("表名格式错误")}}}},f=p,h=(a("2d8d"),a("4cdf"),Object(c["a"])(f,i,n,!1,null,"1edc5e91",null));e["default"]=h.exports},"0f47":function(t,e,a){},"2d8d":function(t,e,a){"use strict";a("ee68")},"4cdf":function(t,e,a){"use strict";a("0f47")},"5c50":function(t,e,a){"use strict";a("bc1e")},"637b":function(t,e,a){},bc1e:function(t,e,a){},ee68:function(t,e,a){}}]);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论