|
|
@ -1,9 +1,18 @@ |
|
|
|
package com.yxt.supervise.system.sysflowcc; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: |
|
|
|
* @author: dimengzhe |
|
|
@ -16,4 +25,68 @@ public class SysFlowccService extends MybatisBaseService<SysFlowccMapper,SysFlow |
|
|
|
SysFlowccVo sysFlowccVo = baseMapper.selectByFlowKey(modelId); |
|
|
|
return rb.success().setData(sysFlowccVo); |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<SysFlowccVo> listPageVo(PagerQuery<SysFlowccQuery> pq) { |
|
|
|
SysFlowccQuery query = pq.getParams(); |
|
|
|
QueryWrapper<SysFlowcc> qw = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotBlank(query.getFlowName())) { |
|
|
|
qw.like("flowName", query.getFlowName()); |
|
|
|
} |
|
|
|
IPage<SysFlowcc> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<SysFlowccVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<SysFlowccVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean saveOrUpdateDto(SysFlowccDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
List<String> roleSids = dto.getRoleSids(); |
|
|
|
List<String> roleNames = dto.getRoleNames(); |
|
|
|
StringBuilder roleSidPath = new StringBuilder(); |
|
|
|
StringBuilder roleNamePath = new StringBuilder(); |
|
|
|
if (roleSids.isEmpty()) { |
|
|
|
return rb.setMsg("请选择角色"); |
|
|
|
} |
|
|
|
for (String roleSid : roleSids) { |
|
|
|
roleSidPath.append(roleSid).append(","); |
|
|
|
} |
|
|
|
for (String roleName : roleNames) { |
|
|
|
roleNamePath.append(roleName).append(","); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
SysFlowccVo sysFlowccVo = baseMapper.selectByFlowKey(dto.getFlowKey()); |
|
|
|
if (sysFlowccVo != null) { |
|
|
|
return rb.setMsg("此流程已存在,请重新选择"); |
|
|
|
} |
|
|
|
SysFlowcc sysFlowcc = new SysFlowcc(); |
|
|
|
sysFlowcc.setFlowKey(dto.getFlowKey()); |
|
|
|
sysFlowcc.setFlowName(dto.getFlowName()); |
|
|
|
sysFlowcc.setRoleSid(roleSidPath.substring(0, roleSidPath.lastIndexOf(","))); |
|
|
|
sysFlowcc.setRoleName(roleNamePath.substring(0, roleNamePath.lastIndexOf(","))); |
|
|
|
save(sysFlowcc); |
|
|
|
return rb.success().setMsg("添加成功"); |
|
|
|
} |
|
|
|
SysFlowcc sysFlowcc = fetchBySid(dtoSid); |
|
|
|
if (sysFlowcc == null) { |
|
|
|
return rb.setMsg("流程抄送不存在"); |
|
|
|
} |
|
|
|
SysFlowccVo sysFlowccVo = baseMapper.selectByFlowKeyAndSid(dto.getFlowKey(), dtoSid); |
|
|
|
if (sysFlowccVo != null) { |
|
|
|
return rb.setMsg("此流程已存在,请重新选择"); |
|
|
|
} |
|
|
|
sysFlowcc.setFlowKey(dto.getFlowKey()); |
|
|
|
sysFlowcc.setFlowName(dto.getFlowName()); |
|
|
|
sysFlowcc.setRoleSid(roleSidPath.substring(0, roleSidPath.lastIndexOf(","))); |
|
|
|
sysFlowcc.setRoleName(roleNamePath.substring(0, roleNamePath.lastIndexOf(","))); |
|
|
|
baseMapper.updateById(sysFlowcc); |
|
|
|
return rb.success().setMsg("修改成功"); |
|
|
|
} |
|
|
|
|
|
|
|
public SysFlowccDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
|
SysFlowcc entity = fetchBySid(sid); |
|
|
|
SysFlowccDetailsVo vo = new SysFlowccDetailsVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
} |
|
|
|