| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import lombok.Data; |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Getter |
| | |
| | | // ç±»å |
| | | @TableField(value = "tree_type") |
| | | private Integer type; |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
| | | @TableField(value = "create_time") |
| | | private Date createTime; |
| | | |
| | | //å±ç¤ºåç§° |
| | | private transient String label; |
| | |
| | | |
| | | private transient List<ProductMix> children = new ArrayList<>(); |
| | | |
| | | public ProductMix(Long id, Long parentId, String name, String code, Integer type) { |
| | | public ProductMix(Long id, Long parentId, String name, String code, Integer type, Date createTime) { |
| | | this.id = id; |
| | | this.parentId = parentId; |
| | | this.name = name; |
| | |
| | | this.type = type; |
| | | this.children = new ArrayList<>(); |
| | | this.label="["+code+"]"+name; |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public void addChild(ProductMix child) { |
| | | this.children.add(child); |
| | | } |
| | | |
| | | |
| | | public ProductMix(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ProductMix{createTime=" + createTime + '}'; |
| | | } |
| | | |
| | | } |
| | |
| | | mix.name, |
| | | mix.parent_id, |
| | | mix.tree_type AS 'type', |
| | | mix.extend |
| | | mix.extend, |
| | | mix.create_time |
| | | FROM |
| | | nc_product_mix mix -- è¿æ¥æé表ï¼çéé¨é¨ç¸å
³è®°å½ |
| | | LEFT JOIN nc_permission_stream_new nps_depart ON mix.id = nps_depart.business_id |
| | |
| | | AND nps_user.delete_flag = '0' |
| | | WHERE |
| | | nps_depart.business_id IS NOT NULL |
| | | AND nps_user.business_id IS NOT NULL; |
| | | AND nps_user.business_id IS NOT NULL |
| | | order by mix.tree_type, mix.create_time asc |
| | | </select> |
| | | <select id="loadProductMixAll" resultType="org.jeecg.modules.dnc.entity.ProductMix"> |
| | | SELECT DISTINCT |
| | |
| | | mix.name, |
| | | mix.parent_id, |
| | | mix.tree_type AS 'type', |
| | | mix.extend |
| | | mix.extend, |
| | | mix.create_time |
| | | FROM |
| | | nc_product_mix mix -- è¿æ¥æé表ï¼çéé¨é¨ç¸å
³è®°å½ |
| | | LEFT JOIN nc_permission_stream_new nps_user ON mix.id = nps_user.business_id |
| | | AND nps_user.user_id = #{userId} |
| | | AND nps_user.delete_flag = '0' |
| | | WHERE |
| | | nps_user.business_id IS NOT NULL; |
| | | nps_user.business_id IS NOT NULL |
| | | order by mix.tree_type, mix.create_time asc |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndDepartIds(List<String> businessIds,List<String> departIds,String businessType); |
| | | |
| | | /** |
| | | * éè¿æ·»å æé |
| | | * @param permissionStream |
| | | * @return |
| | | */ |
| | | boolean addPermissionStreamNew(PermissionStreamNew permissionStream); |
| | | |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class ComponentInfoSeServiceImpl extends ServiceImpl<ComponentInfoMapper, ComponentInfo> implements IComponentInfoService { |
| | |
| | | ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); |
| | | } |
| | | //æ·»å ç»ææ |
| | | ProductMix productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(productInfo.getProductId()) |
| | | ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2); |
| | | ProductMix productMix=null; |
| | | if (componentInfo.getParentId() != null) { |
| | | //åé¨ä»¶ |
| | | productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(componentInfo.getParentId()) |
| | | ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date()); |
| | | }else { |
| | | productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(productInfo.getProductId()) |
| | | ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date()); |
| | | } |
| | | productMixService.save(productMix); |
| | | //æ·»å æé |
| | | PermissionStreamNew stream = new PermissionStreamNew(); |
| | | stream.setUserId(userId); |
| | | stream.setBusinessId(componentInfo.getComponentId()); |
| | | stream.setBusinessType("2"); |
| | | return permissionStreamNewService.save(stream); |
| | | return permissionStreamNewService.addPermissionStreamNew(stream); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.modules.dnc.entity.DevicePermission; |
| | | import org.jeecg.modules.dnc.mapper.DevicePermissionMapper; |
| | | import org.jeecg.modules.dnc.service.IDevicePermissionService; |
| | | import org.jeecg.modules.dnc.ucenter.UserDepartExt; |
| | | import org.jeecg.modules.dnc.utils.ValidateUtil; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | |
| | | import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.dnc.service.IDevicePermissionService; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.IMdcUserProductionService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private IMdcUserProductionService mdcUserProductionService; |
| | | @Resource |
| | | private MdcEquipmentMapper mdcEquipmentMapper; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Override |
| | | public DevicePermission getByUserIdAndDeviceId(String userId, String deviceId) { |
| | |
| | | List<MdcEquipment> equipmentList = mdcEquipmentMapper.queryByProductionIdAndType(mdcEquipmentTree.getKey(),deviceIds); |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | if (mdcEquipment.getCreateBy()!=null&& !mdcEquipment.getCreateBy().isEmpty()){ |
| | | mdcEquipment.setCreateBy(sysUserService.getUserByName(mdcEquipment.getCreateBy()).getRealname()); |
| | | } |
| | | if (mdcEquipment.getUpdateBy()!=null&& !mdcEquipment.getUpdateBy().isEmpty()){ |
| | | mdcEquipment.setUpdateBy(sysUserService.getUserByName(mdcEquipment.getUpdateBy()).getRealname()); |
| | | } |
| | | MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment); |
| | | tree.setParentId(mdcEquipmentTree.getKey()); |
| | | tree.setEntity(mdcEquipment); |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class PartsInfoServiceImpl extends ServiceImpl<PartsInfoMapper, PartsInfo> implements IPartsInfoService { |
| | |
| | | } |
| | | //æ·»å ç»ææ |
| | | ProductMix productMix = new ProductMix(Long.parseLong(partsInfo.getPartsId()),Long.parseLong(partsInfo.getComponentId()) |
| | | ,partsInfo.getPartsName(),partsInfo.getPartsCode(),3); |
| | | ,partsInfo.getPartsName(),partsInfo.getPartsCode(),3,new Date()); |
| | | productMixService.save(productMix); |
| | | //æ·»å ç¨æ·æé |
| | | PermissionStreamNew stream = new PermissionStreamNew(); |
| | | stream.setBusinessId(partsInfo.getPartsId()); |
| | | stream.setBusinessType("3"); |
| | | stream.setUserId(userId); |
| | | return permissionStreamNewService.save(stream); |
| | | return permissionStreamNewService.addPermissionStreamNew(stream); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import org.jeecg.modules.dnc.entity.ProductMix; |
| | | import org.jeecg.modules.dnc.mapper.PermissionStreamNewMapper; |
| | | import org.jeecg.modules.dnc.service.IPermissionStreamNewService; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class PermissionStreamNewServiceImpl extends ServiceImpl<PermissionStreamNewMapper, PermissionStreamNew> implements IPermissionStreamNewService { |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idè·åç»ææ æé |
| | |
| | | return total; |
| | | } |
| | | |
| | | /** |
| | | * éè¿æ·»å æé |
| | | * @param permissionStream |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addPermissionStreamNew(PermissionStreamNew permissionStream) { |
| | | // éªè¯åæ°æææ§ |
| | | if (permissionStream == null) { |
| | | return false; |
| | | } |
| | | // è·å管çåç¨æ· |
| | | SysUser adminUser = sysUserService.getUserByName("admin"); |
| | | if (adminUser == null) { |
| | | // è¥ç®¡çåç¨æ·ä¸åå¨ï¼å¯æ ¹æ®å®é
æ
åµå¤çï¼è¿éç®åè¿å false |
| | | return false; |
| | | } |
| | | try { |
| | | boolean isAdmin = Objects.equals(permissionStream.getUserId(), adminUser.getId()); |
| | | // ä¿åæ¬èº«æé |
| | | super.save(permissionStream); |
| | | if (!isAdmin) { |
| | | // è¥ä¸æ¯ç®¡çåï¼å¤å¶ä¸ä¸ªæ°ç PermissionStreamNew 对象并设置为管çå ID åä¿å |
| | | PermissionStreamNew adminPermissionStream = new PermissionStreamNew(); |
| | | adminPermissionStream.setUserId(adminUser.getId()); |
| | | adminPermissionStream.setBusinessId(permissionStream.getBusinessId()); |
| | | adminPermissionStream.setBusinessType(permissionStream.getBusinessType()); |
| | | super.save(adminPermissionStream); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | // è®°å½å¼å¸¸ä¿¡æ¯ï¼æ¹ä¾¿åç»ææ¥é®é¢ |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class ProcessSpecVersionServiceImpl extends ServiceImpl<ProcessSpecVersionMapper, ProcessSpecVersion> implements IProcessSpecVersionService{ |
| | |
| | | } |
| | | //æ·»å ç»ææ |
| | | ProductMix productMix = new ProductMix(Long.parseLong(ProcessSpecVersion.getId()),Long.parseLong(ProcessSpecVersion.getPartsId()) |
| | | ,ProcessSpecVersion.getProcessSpecVersionName(),ProcessSpecVersion.getProcessSpecVersionCode(),4); |
| | | ,ProcessSpecVersion.getProcessSpecVersionName(), |
| | | ProcessSpecVersion.getProcessSpecVersionCode(),4,new Date()); |
| | | productMixService.save(productMix); |
| | | //æ·»å ç¨æ·æé |
| | | PermissionStreamNew stream = new PermissionStreamNew(); |
| | | stream.setBusinessId(ProcessSpecVersion.getId()); |
| | | stream.setBusinessType("4"); |
| | | stream.setUserId(userId); |
| | | return permissionStreamNewService.save(stream); |
| | | return permissionStreamNewService.addPermissionStreamNew(stream); |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class ProcessStreamServiceImpl extends ServiceImpl<ProcessStreamMapper, ProcessStream> implements IProcessStreamService { |
| | |
| | | ProductMix productMix; |
| | | if (stream.getPsvId() != null) { |
| | | productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getPsvId()) |
| | | ,stream.getProcessName(),stream.getProcessCode(),5); |
| | | ,stream.getProcessName(),stream.getProcessCode(),5,new Date()); |
| | | }else { |
| | | productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getComponentId()) |
| | | ,stream.getProcessName(),stream.getProcessCode(),5); |
| | | ,stream.getProcessName(),stream.getProcessCode(),5,new Date()); |
| | | } |
| | | productMixService.save(productMix); |
| | | //æ·»å æééªè¯ |
| | |
| | | permissionStream.setUserId(userId); |
| | | permissionStream.setBusinessId(stream.getProcessId()); |
| | | permissionStream.setBusinessType("5"); |
| | | return permissionStreamNewService.save(permissionStream); |
| | | return permissionStreamNewService.addPermissionStreamNew(permissionStream); |
| | | } |
| | | |
| | | @Override |
| | |
| | | ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); |
| | | } |
| | | //æ·»å ç»ææ |
| | | ProductMix productMix = new ProductMix(Long.parseLong(productInfo.getProductId()),0L,productInfo.getProductName(),productInfo.getProductNo(),1); |
| | | ProductMix productMix = new ProductMix(Long.parseLong(productInfo.getProductId()),0L, |
| | | productInfo.getProductName(),productInfo.getProductNo(),1,new Date()); |
| | | productMixService.save(productMix); |
| | | //æ·»å ç¨æ·é¨é¨ |
| | | if(StrUtil.isNotBlank(user.getProductionIds())){ |
| | | String[] split = user.getProductionIds().split(","); |
| | | String[] departIds = split; |
| | | for (String departId : departIds) { |
| | | ProductDepartment productDepartment = new ProductDepartment(); |
| | | productDepartment.setProductId(productInfo.getProductId()); |
| | | productDepartment.setDepartId(departId); |
| | | productDepartmentService.save(productDepartment); |
| | | PermissionStreamNew stream = new PermissionStreamNew(); |
| | | stream.setBusinessId(productInfo.getProductId()); |
| | | stream.setDepartId(departId); |
| | | stream.setBusinessType("1"); |
| | | permissionStreamNewService.save(stream); |
| | | } |
| | | } |
| | | //æ·»å ç¨æ·æé |
| | | PermissionStreamNew stream = new PermissionStreamNew(); |
| | | stream.setBusinessId(productInfo.getProductId()); |
| | | stream.setUserId(userId); |
| | | stream.setBusinessType("1"); |
| | | return permissionStreamNewService.save(stream); |
| | | return permissionStreamNewService.addPermissionStreamNew(stream); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class ProductMixServiceImpl extends ServiceImpl<ProductMixMapper, ProductMix> implements IProductMixService { |
| | |
| | | cleanResult.getValidNodes(), |
| | | cleanResult.getNodeMap() |
| | | ); |
| | | return builder.assembleTree(sorted, cleanResult.getNodeMap()); |
| | | List<ProductMix> result =builder.assembleTree(sorted, cleanResult.getNodeMap()); |
| | | result.sort(Comparator.comparing(ProductMix::getCreateTime, Comparator.nullsLast(Date::compareTo))); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | |
| | | pd.setStepId(workStep.getId()); |
| | | workStepDepartmentList.add(pd); |
| | | PermissionStreamNew perm = new PermissionStreamNew(); |
| | | perm.setDepartId(item.getDepartId()); |
| | | perm.setBusinessId(workStep.getId()); |
| | | perm.setBusinessType("6"); |
| | | permissionStreamList.add(perm); |
| | |
| | | } |
| | | //æ·»å ç»ææ |
| | | ProductMix productMix = new ProductMix(Long.parseLong(workStep.getId()),Long.parseLong(workStep.getProcessId()) |
| | | ,workStep.getStepName(),workStep.getStepCode(),6); |
| | | ,workStep.getStepName(),workStep.getStepCode(),6,new Date()); |
| | | productMixService.save(productMix); |
| | | //æ·»å æééªè¯ |
| | | PermissionStreamNew permissionStream = new PermissionStreamNew(); |
| | | permissionStream.setUserId(userId); |
| | | permissionStream.setBusinessId(workStep.getId()); |
| | | permissionStream.setBusinessType("6"); |
| | | return permissionStreamNewService.save(permissionStream); |
| | | return permissionStreamNewService.addPermissionStreamNew(permissionStream); |
| | | } |
| | | |
| | | /** |
| | |
| | | node.getParentId(), |
| | | node.getName(), |
| | | node.getCode(), |
| | | node.getType() |
| | | node.getType(), |
| | | node.getCreateTime() |
| | | ); |
| | | treeMap.put(newNode.getId(), newNode); |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dncFlow.aspect; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.lang.ProceedingJoinPoint; |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.modules.system.aspect.DicAspectService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: Dncåå
¸aopç±» |
| | | * @Version: 1.0 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | @Slf4j |
| | | public class DncFlowDictAspect { |
| | | @Autowired |
| | | private DicAspectService dicAspectService; |
| | | |
| | | // å®ä¹åç¹Pointcut |
| | | @Pointcut("execution(public * org.jeecg.modules.dncFlow..*.*Controller.*(..))") |
| | | public void excudeService() { |
| | | } |
| | | |
| | | @Around("excudeService()") |
| | | public Object doAround(ProceedingJoinPoint pjp) throws Throwable { |
| | | long time1=System.currentTimeMillis(); |
| | | Object result = pjp.proceed(); |
| | | long time2=System.currentTimeMillis(); |
| | | log.debug("è·åJSONæ°æ® èæ¶ï¼"+(time2-time1)+"ms"); |
| | | long start=System.currentTimeMillis(); |
| | | this.parseDictText(result); |
| | | long end=System.currentTimeMillis(); |
| | | log.debug("è§£ææ³¨å
¥JSONæ°æ® èæ¶"+(end-start)+"ms"); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ¬æ¹æ³é对è¿å对象为Result çIPageçå页åè¡¨æ°æ®è¿è¡å¨æåå
¸æ³¨å
¥ |
| | | * åå
¸æ³¨å
¥å®ç° éè¿å¯¹å®ä½ç±»æ·»å 注解@dict æ¥æ è¯éè¦çåå
¸å
容,åå
¸å为ååå
¸codeå³å¯ ï¼tableåå
¸ code table texté
å使ç¨ä¸åæ¥jeecgçç¨æ³ç¸å |
| | | * 示ä¾ä¸ºSysUser åæ®µä¸ºsex æ·»å äºæ³¨è§£@Dict(dicCode = "sex") ä¼å¨åå
¸æå¡ç«é©¬æ¥åºæ¥å¯¹åºçtext ç¶åå¨è¯·æ±listçæ¶åå°è¿ä¸ªåå
¸textï¼å·²å段åç§°å _dictTextå½¢å¼è¿åå°å端 |
| | | * ä¾è¾å
¥å½åè¿åå¼çå°±ä¼å¤åºä¸ä¸ªsex_dictTextåæ®µ |
| | | * { |
| | | * sex:1, |
| | | * sex_dictText:"ç·" |
| | | * } |
| | | * åç«¯ç´æ¥åå¼sext_dictTextå¨tableé颿 éåè¿è¡å端çåå
¸è½¬æ¢äº |
| | | * customRender:function (text) { |
| | | * if(text==1){ |
| | | * return "ç·"; |
| | | * }else if(text==2){ |
| | | * return "女"; |
| | | * }else{ |
| | | * return text; |
| | | * } |
| | | * } |
| | | * ç®åvueæ¯è¿ä¹è¿è¡åå
¸æ¸²æå°tableä¸çå¤äºå°±å¾éº»ç¦äº è¿ä¸ªç´æ¥å¨æå¡ç«¯æ¸²æå®æå端å¯ä»¥ç´æ¥ç¨ |
| | | * @param result |
| | | */ |
| | | private void parseDictText(Object result) { |
| | | if (result instanceof Result) { |
| | | if (((Result) result).getResult() instanceof IPage) { |
| | | List<JSONObject> items = dicAspectService.detailDict(((IPage) ((Result) result).getResult()).getRecords()); |
| | | ((IPage) ((Result) result).getResult()).setRecords(items); |
| | | } |
| | | else if(((Result) result).getResult() instanceof List){ |
| | | List<JSONObject> items = dicAspectService.detailDict(((List) ((Result) result).getResult())); |
| | | ((Result) result).setResult(items); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | return new ResponseResult(CommonCode.FAIL); |
| | | } |
| | | |
| | | // @AutoLog(value = "DNCææ´¾è®¾å¤æµç¨æä½-è·åå½åç¨æ·çå¾
åå坿¾åçä»»å¡") |
| | | // @ApiOperation(value = "DNCææ´¾è®¾å¤æµç¨æä½-è·åå½åç¨æ·çå¾
åå坿¾åçä»»å¡", notes = "DNCææ´¾è®¾å¤æµç¨æä½-è·åå½åç¨æ·çå¾
åå坿¾åçä»»å¡") |
| | | // @GetMapping("/find/task/list") |
| | | // public Result<?> getUndoTaskList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | // @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | // IPage<ActTaskExt> actTaskExtIPage = assignFileStreamService.getUndoTaskList(pageNo,pageSize); |
| | | // return Result.ok(actTaskExtIPage); |
| | | // } |
| | | |
| | | @AutoLog(value = "DNCææ´¾è®¾å¤æµç¨æä½-æ¹éææ´¾å°è®¾å¤") |
| | | @ApiOperation(value = "DNCææ´¾è®¾å¤æµç¨æä½-æ¹éææ´¾å°è®¾å¤", notes = "DNCææ´¾è®¾å¤æµç¨æä½-æ¹éææ´¾å°è®¾å¤") |
| | | @PostMapping("/assign/file/batch/apply") |
| | |
| | | import org.flowable.engine.*; |
| | | import org.flowable.engine.history.HistoricActivityInstance; |
| | | import org.flowable.image.ProcessDiagramGenerator; |
| | | import org.flowable.task.api.Task; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.dncFlow.entity.HisWorkTask; |
| | | import org.jeecg.modules.dncFlow.entity.WorkTaskData; |
| | | import org.jeecg.modules.dncFlow.entity.WorkTaskDataVo; |
| | | import org.jeecg.modules.dncFlow.service.IAssignFileStreamService; |
| | |
| | | Page page = new Page(pageNo, pageSize); |
| | | IPage<FlowMyBusinessDto> pageList = flowMyBusinessService.getPageList(page, flowMyBusinessDto); |
| | | pageList.getRecords().forEach(item -> { |
| | | if (item.getTodoUsers() == null){ |
| | | item.setTodoUsers(""); |
| | | }else{ |
| | | //å»é¤[] |
| | | item.setTodoUsers(item.getTodoUsers().replaceAll("\\[", "").replaceAll("\\]", "")); |
| | | item.setTodoUsers(item.getTodoUsers().replaceAll("\"", "")); |
| | | } |
| | | if (item.getDoneUsers() == null){ |
| | | item.setDoneUsers(""); |
| | | }else { |
| | | //å»é¤[] |
| | | item.setDoneUsers(item.getDoneUsers().replaceAll("\\[", "").replaceAll("\\]", "")); |
| | | item.setDoneUsers(item.getDoneUsers().replaceAll("\"", "")); |
| | | } |
| | | }); |
| | | return Result.OK(pageList); |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "è·åå·²åä»»å¡", response = FlowTaskDto.class) |
| | | @GetMapping(value = "/finishedList") |
| | | public Result finishedList(@ApiParam(value = "å½å页ç ", required = true) @RequestParam Integer pageNo, |
| | | @ApiParam(value = "æ¯é¡µæ¡æ°", required = true) @RequestParam Integer pageSize) { |
| | | return flowTaskService.finishedList(pageNo, pageSize); |
| | | public Result<?> finishedList(@ApiParam(value = "å½å页ç ", required = true) @RequestParam Integer pageNo, |
| | | @ApiParam(value = "æ¯é¡µæ¡æ°", required = true) @RequestParam Integer pageSize, |
| | | FlowMyBusinessDto flowMyBusinessDto) { |
| | | return flowTaskService.finishedList(pageNo, pageSize,flowMyBusinessDto); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "è·å工使µåå²ä»»å¡", response = FlowTaskDto.class) |
| | | @GetMapping(value = "/queryHisTaskList") |
| | | public Result<List<HisWorkTask>> queryHisTaskList(@RequestParam(name = "drapprovedataId") String drapprovedataId) { |
| | | public Result<?> queryHisTaskList(@RequestParam(name = "drapprovedataId") String drapprovedataId) { |
| | | return Result.OK(hisWorkTaskService.queryHisTaskList(drapprovedataId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "审æ¹ä»»å¡-æ¥çæµç¨å¾") |
| | | @GetMapping("/diagramView") |
| | | public void showImages(@RequestParam(name = "taskId") String taskId, HttpServletResponse response) throws IOException { |
| | | Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); |
| | | String processDefinitionId = task.getProcessDefinitionId(); |
| | | public void showImages(@RequestParam(name = "processDefinitionId") String processDefinitionId, |
| | | @RequestParam(name = "processInstanceId") String processInstanceId, |
| | | @RequestParam(name = "TaskDefinitionKey") String TaskDefinitionKey, |
| | | HttpServletResponse response) throws IOException { |
| | | BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); |
| | | String processInstanceId = task.getProcessInstanceId(); |
| | | List<HistoricActivityInstance> historyProcess = historyService.createHistoricActivityInstanceQuery() |
| | | .processInstanceId(processInstanceId) |
| | | .finished() |
| | |
| | | activityIds.add(hi.getActivityId()); |
| | | } |
| | | } |
| | | activityIds.add(task.getTaskDefinitionKey()); |
| | | activityIds.add(TaskDefinitionKey); |
| | | ProcessEngineConfiguration engConf = processEngine.getProcessEngineConfiguration(); |
| | | ProcessDiagramGenerator processDiagramGenerator = engConf.getProcessDiagramGenerator(); |
| | | |
| | |
| | | private String processId; |
| | | @TableField(value = "step_id") |
| | | private String stepId; |
| | | @TableField(value = "device_type_id") |
| | | private String deviceTypeId; |
| | | @TableField(value = "doc_id") |
| | | private String docId; |
| | | @TableField(value = "file_id") |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private String endTime; |
| | | |
| | | @Dict(dicCode = "dnc_assign_stream_status") |
| | | private transient String status; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @ApiModelProperty(value = "æµç¨åç§°") |
| | | private transient String flowName; |
| | | |
| | | @ApiModelProperty(value = "æµç¨ç±»å") |
| | | @Dict(dicCode = "flow_type") |
| | | private transient String category; |
| | | |
| | | /**æµç¨å®ä¹key ä¸ä¸ªkey伿å¤ä¸ªçæ¬çid*/ |
| | | @Excel(name = "æµç¨å®ä¹key ä¸ä¸ªkey伿å¤ä¸ªçæ¬çid", width = 15) |
| | | @ApiModelProperty(value = "æµç¨å®ä¹key ä¸ä¸ªkey伿å¤ä¸ªçæ¬çid") |
| | | private String processDefinitionKey; |
| | | /**æµç¨å®ä¹id ä¸ä¸ªæµç¨å®ä¹å¯ä¸*/ |
| | | @Excel(name = "æµç¨å®ä¹id ä¸ä¸ªæµç¨å®ä¹å¯ä¸", width = 15) |
| | | @ApiModelProperty(value = "æµç¨å®ä¹id ä¸ä¸ªæµç¨å®ä¹å¯ä¸") |
| | | private String processDefinitionId; |
| | | /**æµç¨ä¸å¡å®ä¾id ä¸ä¸ªæµç¨ä¸å¡å¯ä¸ï¼æ¬è¡¨ä¸ä¹å¯ä¸*/ |
| | | @Excel(name = "æµç¨ä¸å¡å®ä¾id ä¸ä¸ªæµç¨ä¸å¡å¯ä¸ï¼æ¬è¡¨ä¸ä¹å¯ä¸", width = 15) |
| | | @ApiModelProperty(value = "æµç¨ä¸å¡å®ä¾id ä¸ä¸ªæµç¨ä¸å¡å¯ä¸ï¼æ¬è¡¨ä¸ä¹å¯ä¸") |
| | | private String processInstanceId; |
| | | |
| | | |
| | | // /**ææ¶ç¨ä¸ä¸*/ |
| | | // @TableField("task_def_id_") |
| | |
| | | private String approveUser; |
| | | private String deviceName; |
| | | private String docSuffix; |
| | | private String deviceManagementName; |
| | | private String deviceManagementCode; |
| | | } |
| | |
| | | , pt.parts_name as partsName |
| | | , ps.process_name as processName |
| | | , wt.step_name as stepName |
| | | , dem.device_management_name as deviceManagementName |
| | | , dem.device_management_code as deviceManagementCode |
| | | , dc.doc_name as docName |
| | | , dc.publish_version as version |
| | | , dc.doc_suffix as docSuffix |
| | |
| | | on a.doc_id=dc.doc_id |
| | | left join mdc_equipment de |
| | | on a.device_id=de.id |
| | | |
| | | left join nc_device_type type |
| | | on a.device_type_id=type.id |
| | | left join nc_device_management dem |
| | | on type.device_management_id=dem.id |
| | | </select> |
| | | |
| | | <select id="findByPage" resultType="org.jeecg.modules.dncFlow.ext.AssignFileStreamExt" parameterType="String"> |
| | |
| | | atask.proc_inst_id_ AS procInstId, |
| | | atask.proc_def_id_ AS procDefId, |
| | | atask.name_ AS name, |
| | | atask.task_def_key_ AS taskDefKey, |
| | | su.realname AS assignee, |
| | | atask.task_def_key_ as taskDefKey, |
| | | su.realname as assignee, |
| | | atask.priority_ AS priority, |
| | | atask.create_time_ AS createTime, |
| | | atask.suspension_state_ AS suspensionState, |
| | | fmb.act_status AS actStatus, |
| | | fmb.title AS title, |
| | | fmb.data_id AS dataId, |
| | | pro.name_ as flowName |
| | | fmb.process_definition_key AS processDefinitionKey, |
| | | fmb.process_definition_id AS processDefinitionId, |
| | | fmb.process_instance_id AS processInstanceId, |
| | | pro.name_ as flowName, |
| | | pro.CATEGORY_ as category |
| | | FROM |
| | | act_ru_task AS atask, |
| | | flow_my_business AS fmb, |
| | |
| | | <if test="flowMy.endTime!= null and flowMy.endTime!= ''"> |
| | | AND atask.create_time_ <= #{flowMy.endTime} |
| | | </if> |
| | | <if test="flowMy.category!= null and flowMy.category!= ''"> |
| | | AND pro.CATEGORY_ = #{flowMy.category} |
| | | </if> |
| | | ORDER BY |
| | | create_time_ DESC |
| | | </select> |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | @Autowired |
| | | private ISynchronizedFlagService synchronizedFlagService; |
| | | @Autowired |
| | | private IDeviceGroupService deviceGroupService; |
| | | @Autowired |
| | | private IDeviceCharactersService iDeviceCharactersService; |
| | | @Autowired |
| | | private IMdcEquipmentService iMdcEquipmentService; |
| | | @Autowired |
| | | private IMdcProductionService iMdcProductionService; |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Resource |
| | |
| | | private IFlowDefinitionService flowDefinitionService; |
| | | @Autowired |
| | | private IFlowTaskService flowTaskService; |
| | | @Autowired |
| | | private IDeviceTypeService deviceTypeService; |
| | | |
| | | @Value("${securedoc.whether}") |
| | | private String whether; |
| | |
| | | DocInfo docInfo = getDocInfo(stream); |
| | | MdcEquipment mdcEquipment = getMdcEquipment(stream); |
| | | DocFile docFile = docFileService.getById(stream.getFileId()); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 7, stream.getDeviceId()); |
| | | if (deviceDoc != null) { |
| | | handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); |
| | | } |
| | | deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); |
| | | deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 7, stream.getDeviceId()); |
| | | if (deviceDoc != null) { |
| | | handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); |
| | | } |
| | | PermissionStreamNew permissionStreams = getPermissionStreams(stream); |
| | | if (permissionStreams==null){ |
| | | return Result.error("ç¨æ·æ²¡ææé"); |
| | | } |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | saveBusinessObject(stream, userId); |
| | |
| | | stream.getStreamId(), "IAssignFileStreamService", "assign_nc_to_device", null); |
| | | Map<String, Object> variables = new HashMap<>(); |
| | | variables.put("dataId", stream.getStreamId()); |
| | | if (stream.getApplyReason() != null) { |
| | | variables.put("organization", stream.getApplyReason()); |
| | | return flowDefinitionService.startProcessInstanceByKey("assign_nc_to_device", variables); |
| | | }else { |
| | | variables.put("organization", ""); |
| | | } |
| | | Result result= flowDefinitionService.startProcessInstanceByKey("assign_nc_to_device", variables); |
| | | if (result.isSuccess()){ |
| | | return Result.OK("æä½æå"); |
| | | }else { |
| | | super.removeById(stream.getStreamId()); |
| | | |
| | | return Result.error("æä½å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | DocInfo docInfo = getDocInfo(stream); |
| | | MdcEquipment mdcEquipment = getMdcEquipment(stream); |
| | | DocFile docFile = getDocFile(stream); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 7, stream.getDeviceId()); |
| | | if(deviceDoc != null) { |
| | | // å é¤ å¤ä»½ è¦ç åæç |
| | | List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | |
| | | docFile.getFileName(), docFile.getFileSuffix()); |
| | | } |
| | | } |
| | | /*deviceDoc = docInfoService.findByAttrAndDocName(docInfo.getDocName(), 4, stream.getDeviceId()); |
| | | if(deviceDoc != null) { |
| | | // å é¤ å¤ä»½ è¦ç åæç |
| | | List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | | boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), |
| | | docFile.getFileName(), docFile.getFileSuffix()); |
| | | } |
| | | }*/ |
| | | getPermissionStreams(stream); |
| | | //æå
¥ææ¡£å°è®¾å¤åéææ¡£ |
| | | if(deviceDoc == null) { |
| | |
| | | DocRelative docRelative = new DocRelative(); |
| | | docRelative.setDocId(docInfo.getDocId()); |
| | | docRelative.setClassificationId(classification.getClassificationId()); |
| | | docRelative.setAttributionType(4); |
| | | docRelative.setAttributionType(7); |
| | | docRelative.setAttributionId(stream.getDeviceId()); |
| | | boolean b = docRelativeService.save(docRelative); |
| | | if(!b) { |
| | |
| | | DocInfo docInfo; |
| | | //åææä½ |
| | | if (StrUtil.isNotEmpty(en.getStepId())){ |
| | | //å·¥æ¥ææ´¾ |
| | | docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), 6, en.getStepId()); |
| | | //å·¥æ¥ä¸è®¾å¤ç±»ææ´¾ |
| | | docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), 6, en.getDeviceTypeId()); |
| | | }else { |
| | | docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), 5, en.getProcessId()); |
| | | docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), 5, en.getDeviceTypeId()); |
| | | } |
| | | if(docInfo == null || docInfo.getDocStatus() == 3) |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); |
| | |
| | | DocFile docFile = docFileService.getById(en.getFileId()); |
| | | if(docFile == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),4, en.getDeviceId()); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),7, en.getDeviceId()); |
| | | if(deviceDoc != null) { |
| | | // å é¤ å¤ä»½ è¦ç åæç |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | |
| | | boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ mdcEquipment.getEquipmentId(), |
| | | docFile.getFileName(), docFile.getFileSuffix()); |
| | | /* //docInfoService.getBaseMapper().deleteById(deviceDoc.getDocId()); |
| | | boolean doc = docRelativeService.deleteCopyDocByAttrNext(deviceDoc.getDocId(),4,stream.getDeviceId()); |
| | | boolean doc = docRelativeService.deleteCopyDocByAttrNext(deviceDoc.getDocId(),7,stream.getDeviceId()); |
| | | if (!doc) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); |
| | | }*/ |
| | |
| | | DocRelative docRelative = new DocRelative(); |
| | | docRelative.setDocId(docInfo.getDocId()); |
| | | docRelative.setClassificationId(classification.getClassificationId()); |
| | | docRelative.setAttributionType(4); |
| | | docRelative.setAttributionType(7); |
| | | docRelative.setAttributionId(en.getDeviceId()); |
| | | b = docRelativeService.save(docRelative); |
| | | } |
| | |
| | | if(deviceInfo == null) |
| | | ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); |
| | | //å é¤åæ¥è®¾å¤ä¸çææææ¡£ |
| | | docRelativeService.deleteByDocAttr(4, deviceInfo.getDeviceId()); |
| | | docRelativeService.deleteByDocAttr(7, deviceInfo.getDeviceId()); |
| | | List<DocInfo> docInfoList = docInfoService.getByProcessIds(streams); |
| | | if(docInfoList == null || docInfoList.isEmpty()) |
| | | ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); |
| | |
| | | DocRelative docRelative = new DocRelative(); |
| | | docRelative.setDocId(docInfo.getDocId()); |
| | | docRelative.setClassificationId(classification.getClassificationId()); |
| | | docRelative.setAttributionType(4); |
| | | docRelative.setAttributionType(7); |
| | | docRelative.setAttributionId(deviceInfo.getDeviceId()); |
| | | boolean b = docRelativeService.save(docRelative); |
| | | if(!b) |
| | |
| | | if (!copyFileNc) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | } else { |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(deviceId, 4, deviceId); |
| | | boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(), 4, deviceId); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(deviceId, 7, deviceId); |
| | | boolean doc = docRelativeService.deleteDocByAttr(deviceDoc.getDocId(), 7, deviceId); |
| | | if (!doc) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR_DELEVE); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | //æéæ ¡éª |
| | | private PermissionStreamNew getPermissionStreams(AssignFileStream stream) { |
| | | PermissionStreamNew permissionStreams; |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | DeviceType deviceType = deviceTypeService.getById(stream.getAttributionId()); |
| | | String attributionId = deviceType != null ? deviceType.getAttributionId() : stream.getAttributionId(); |
| | | |
| | | PermissionStreamNew permissionStreams; |
| | | if (stream.getAttributionType().equals("5")) { |
| | | // å·¥åº |
| | | ProcessStream processStream = processStreamService.getById(stream.getAttributionId()); |
| | | permissionStreams = handleProcess(stream, attributionId, user); |
| | | } else { |
| | | // å·¥æ¥ |
| | | permissionStreams = handleWorkStep(stream, attributionId, user); |
| | | } |
| | | if (permissionStreams == null) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); |
| | | } |
| | | return permissionStreams; |
| | | } |
| | | |
| | | private PermissionStreamNew handleProcess(AssignFileStream stream, String attributionId, LoginUser user) { |
| | | ProcessStream processStream = processStreamService.getById(attributionId); |
| | | if (processStream == null) { |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | } |
| | |
| | | stream.setComponentId(processStream.getComponentId()); |
| | | stream.setPartsId(processStream.getPartsId()); |
| | | stream.setProcessId(processStream.getProcessId()); |
| | | permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(),user.getId(),"5"); |
| | | } else { |
| | | // å·¥æ¥ |
| | | WorkStep workStep = workStepService.getById(stream.getAttributionId()); |
| | | if (deviceTypeService.getById(stream.getAttributionId()) != null) { |
| | | stream.setDeviceTypeId(deviceTypeService.getById(stream.getAttributionId()).getId()); |
| | | } |
| | | return permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), user.getId(), "5"); |
| | | } |
| | | |
| | | private PermissionStreamNew handleWorkStep(AssignFileStream stream, String attributionId, LoginUser user) { |
| | | WorkStep workStep = workStepService.getById(attributionId); |
| | | if (workStep == null) { |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | } |
| | |
| | | stream.setPartsId(workStep.getPartsId()); |
| | | stream.setProcessId(workStep.getProcessId()); |
| | | stream.setStepId(workStep.getId()); |
| | | permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),user.getId(),"6"); |
| | | if (deviceTypeService.getById(stream.getAttributionId()) != null) { |
| | | stream.setDeviceTypeId(deviceTypeService.getById(stream.getAttributionId()).getId()); |
| | | } |
| | | if (permissionStreams == null ) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); |
| | | } |
| | | return permissionStreams; |
| | | return permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(), user.getId(), "6"); |
| | | } |
| | | |
| | | //è·åé¨é¨ä¿¡æ¯ |
| | |
| | | * ç»ææ¶é´ |
| | | */ |
| | | private String endTime; |
| | | /** |
| | | * æµç¨åç±» |
| | | */ |
| | | private String category; |
| | | } |
| | |
| | | @Excel(name = "æµç¨ä¸å¡å®ä¾id ä¸ä¸ªæµç¨ä¸å¡å¯ä¸ï¼æ¬è¡¨ä¸ä¹å¯ä¸", width = 15) |
| | | @ApiModelProperty(value = "æµç¨ä¸å¡å®ä¾id ä¸ä¸ªæµç¨ä¸å¡å¯ä¸ï¼æ¬è¡¨ä¸ä¹å¯ä¸") |
| | | private String processInstanceId; |
| | | @ApiModelProperty(value = "æµç¨ç±»å") |
| | | @Dict(dicCode = "flow_type") |
| | | private String category; |
| | | /**æµç¨ä¸å¡ç®è¦æè¿°*/ |
| | | @Excel(name = "æµç¨ä¸å¡ç®è¦æè¿°", width = 15) |
| | | @ApiModelProperty(value = "æµç¨ä¸å¡ç®è¦æè¿°") |
| | |
| | | @TableField(exist = false) |
| | | private String taskStatus; |
| | | |
| | | @ApiModelProperty("å岿µç¨å®ä¾ID") |
| | | private transient String hisProcInsId; |
| | | |
| | | private transient String flowName; |
| | | |
| | | /**æµç¨å¼å§æ¶é´*/ |
| | | private transient Date startTime; |
| | | private transient String startTime; |
| | | |
| | | /**æµç¨ç»ææ¶é´*/ |
| | | private transient Date endTime; |
| | | private transient String endTime; |
| | | |
| | | /**å½åç¨æ·*/ |
| | | private transient String currentUser; |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.flowable.apithird.business.dto.FlowMyBusinessDto; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.domain.dto.FlowTaskDto; |
| | | |
| | | /** |
| | | * @Description: æµç¨ä¸å¡æ©å±è¡¨ |
| | |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface FlowMyBusinessMapper extends BaseMapper<FlowMyBusiness> { |
| | | /** |
| | | * æµç¨-æçå·²å |
| | | * @param flowMyBusinessDto |
| | | * @param page |
| | | * @return |
| | | */ |
| | | IPage<FlowTaskDto> PageListMyBusiness(@Param("page")Page page, @Param("flowMyBusinessDto") FlowMyBusinessDto flowMyBusinessDto); |
| | | |
| | | /** |
| | | * æµç¨æ»å°è´¦ |
| | |
| | | flow_my_business.*, |
| | | ACT_HI_PROCINST.START_TIME_ as start_time, |
| | | ACT_HI_PROCINST.END_TIME_ as end_time, |
| | | NC_ASSIGN_FILE_STREAM.STATUS as status, |
| | | ACT_RE_PROCDEF.NAME_ as flowName |
| | | ACT_RE_PROCDEF.NAME_ as flowName, |
| | | ACT_RE_PROCDEF.CATEGORY_ as category |
| | | FROM |
| | | flow_my_business |
| | | LEFT JOIN ACT_HI_PROCINST ON flow_my_business.process_instance_id = ACT_HI_PROCINST.ID_ |
| | | LEFT JOIN ACT_RE_PROCDEF ON flow_my_business.process_definition_id = ACT_RE_PROCDEF.ID_ |
| | | LEFT JOIN NC_ASSIGN_FILE_STREAM ON flow_my_business.data_id = NC_ASSIGN_FILE_STREAM.STREAM_ID |
| | | where |
| | | 1 = 1 |
| | | <if test="flowMyBusinessDto.category != null and flowMyBusinessDto.category != ''"> |
| | | and ACT_RE_PROCDEF.CATEGORY_ = #{flowMyBusinessDto.category} |
| | | </if> |
| | | <if test="flowMyBusinessDto.flowName!= null and flowMyBusinessDto.flowName!= ''"> |
| | | AND ACT_RE_PROCDEF.name_ LIKE CONCAT('%',#{flowMyBusinessDto.flowName},'%') |
| | | </if> |
| | | <if test="flowMyBusinessDto.title != null and flowMyBusinessDto.title != ''"> |
| | | AND flow_my_business.title LIKE CONCAT('%',#{flowMyBusinessDto.title},'%') |
| | | </if> |
| | | <if test="flowMyBusinessDto.startTime!= null and flowMyBusinessDto.startTime!= ''"> |
| | | AND ACT_HI_PROCINST.START_TIME_ >= #{flowMyBusinessDto.startTime} |
| | | </if> |
| | | <if test="flowMyBusinessDto.endTime!= null and flowMyBusinessDto.endTime!= ''"> |
| | | AND ACT_HI_PROCINST.END_TIME_ <= #{flowMyBusinessDto.endTime} |
| | | </if> |
| | | ORDER BY |
| | | flow_my_business.create_time desc |
| | | </select> |
| | | <select id="PageListMyBusiness" resultType="org.jeecg.modules.flowable.domain.dto.FlowTaskDto"> |
| | | SELECT |
| | | task.ID_ as 'hisProcInsId', |
| | | TASK.PROC_INST_ID_ AS 'taskId', |
| | | ACT_RE_PROCDEF.CATEGORY_ AS 'category', |
| | | ACT_RE_PROCDEF.NAME_ 'procDefName', |
| | | flow_my_business.title AS 'Description', |
| | | flow_my_business.data_id AS 'dataId', |
| | | flow_my_business.process_definition_key AS 'processDefinitionKey', |
| | | flow_my_business.process_definition_id AS 'processDefinitionId', |
| | | flow_my_business.process_instance_id AS 'processInstanceId', |
| | | TASK.EXECUTION_ID_ AS 'executionId', |
| | | task.NAME_ AS 'taskName', |
| | | task.DURATION_ 'duration', |
| | | task.START_TIME_ AS 'createTime', |
| | | task.END_TIME_ AS 'finishTime', |
| | | task.TASK_DEF_KEY_ AS 'TaskDefKey' |
| | | FROM |
| | | ACT_HI_TASKINST TASK |
| | | LEFT JOIN flow_my_business ON flow_my_business.process_instance_id = TASK.PROC_INST_ID_ |
| | | LEFT JOIN ACT_RE_PROCDEF ON flow_my_business.process_definition_id = ACT_RE_PROCDEF.ID_ |
| | | WHERE |
| | | TASK.END_TIME_ IS NOT NULL |
| | | <if test="flowMyBusinessDto.currentUser != null and flowMyBusinessDto.currentUser != ''"> |
| | | AND TASK.ASSIGNEE_ = #{flowMyBusinessDto.currentUser} |
| | | </if> |
| | | <if test="flowMyBusinessDto.category != null and flowMyBusinessDto.category != ''"> |
| | | and ACT_RE_PROCDEF.CATEGORY_ = #{flowMyBusinessDto.category} |
| | | </if> |
| | | <if test="flowMyBusinessDto.flowName!= null and flowMyBusinessDto.flowName!= ''"> |
| | | AND ACT_RE_PROCDEF.name_ LIKE CONCAT('%',#{flowMyBusinessDto.flowName},'%') |
| | | </if> |
| | | <if test="flowMyBusinessDto.title != null and flowMyBusinessDto.title != ''"> |
| | | AND flow_my_business.title LIKE CONCAT('%',#{flowMyBusinessDto.title},'%') |
| | | </if> |
| | | <if test="flowMyBusinessDto.startTime!= null and flowMyBusinessDto.startTime!= ''"> |
| | | AND TASK.START_TIME_ >= #{flowMyBusinessDto.startTime} |
| | | </if> |
| | | <if test="flowMyBusinessDto.endTime!= null and flowMyBusinessDto.endTime!= ''"> |
| | | AND TASK.END_TIME_ <= #{flowMyBusinessDto.endTime} |
| | | </if> |
| | | ORDER BY |
| | | TASK.END_TIME_ DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.mapper.FlowMyBusinessMapper; |
| | | import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; |
| | | import org.jeecg.modules.flowable.domain.dto.FlowTaskDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | FlowMyBusiness business = this.getOne(flowMyBusinessLambdaQueryWrapper); |
| | | return business; |
| | | } |
| | | |
| | | /** |
| | | * æµç¨-æçå·²å |
| | | * @param flowMyBusinessDto |
| | | * @param page |
| | | * @return |
| | | */ |
| | | public IPage<FlowTaskDto> getPageListMyBusiness(Page page, FlowMyBusinessDto flowMyBusinessDto){ |
| | | return flowMyBusinessMapper.PageListMyBusiness(page,flowMyBusinessDto); |
| | | } |
| | | |
| | | /** |
| | | * æµç¨æ»å°è´¦ |
| | | * @param flowMyBusinessDto |
| | |
| | | return flowTaskService.todoList(pageNum, pageSize); |
| | | } |
| | | |
| | | @ApiOperation(value = "è·åå·²åä»»å¡", response = FlowTaskDto.class) |
| | | @GetMapping(value = "/finishedList") |
| | | public Result finishedList(@ApiParam(value = "å½å页ç ", required = true) @RequestParam Integer pageNum, |
| | | @ApiParam(value = "æ¯é¡µæ¡æ°", required = true) @RequestParam Integer pageSize) { |
| | | return flowTaskService.finishedList(pageNum, pageSize); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "æµç¨å岿µè½¬è®°å½", response = FlowTaskDto.class) |
| | | @GetMapping(value = "/flowRecord") |
| | | public Result flowRecord(String dataId) { |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | |
| | | private String startUserName; |
| | | |
| | | @ApiModelProperty("æµç¨ç±»å") |
| | | @Dict(dicCode = "flow_type") |
| | | private String category; |
| | | |
| | | @ApiModelProperty("æµç¨åéä¿¡æ¯") |
| | |
| | | @ApiModelProperty("åéæ§è¡äºº") |
| | | private String candidate; |
| | | |
| | | @ApiModelProperty("ä¸å¡è¡¨idï¼ç论å¯ä¸") |
| | | private String dataId; |
| | | |
| | | @ApiModelProperty("ä»»å¡å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date finishTime; |
| | | |
| | | /**æµç¨å®ä¹key ä¸ä¸ªkey伿å¤ä¸ªçæ¬çid*/ |
| | | @Excel(name = "æµç¨å®ä¹key ä¸ä¸ªkey伿å¤ä¸ªçæ¬çid", width = 15) |
| | | @ApiModelProperty(value = "æµç¨å®ä¹key ä¸ä¸ªkey伿å¤ä¸ªçæ¬çid") |
| | | private String processDefinitionKey; |
| | | /**æµç¨å®ä¹id ä¸ä¸ªæµç¨å®ä¹å¯ä¸*/ |
| | | @Excel(name = "æµç¨å®ä¹id ä¸ä¸ªæµç¨å®ä¹å¯ä¸", width = 15) |
| | | @ApiModelProperty(value = "æµç¨å®ä¹id ä¸ä¸ªæµç¨å®ä¹å¯ä¸") |
| | | private String processDefinitionId; |
| | | /**æµç¨ä¸å¡å®ä¾id ä¸ä¸ªæµç¨ä¸å¡å¯ä¸ï¼æ¬è¡¨ä¸ä¹å¯ä¸*/ |
| | | @Excel(name = "æµç¨ä¸å¡å®ä¾id ä¸ä¸ªæµç¨ä¸å¡å¯ä¸ï¼æ¬è¡¨ä¸ä¹å¯ä¸", width = 15) |
| | | @ApiModelProperty(value = "æµç¨ä¸å¡å®ä¾id ä¸ä¸ªæµç¨ä¸å¡å¯ä¸ï¼æ¬è¡¨ä¸ä¹å¯ä¸") |
| | | private String processInstanceId; |
| | | |
| | | } |
| | |
| | | |
| | | import org.flowable.task.api.Task; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.modules.flowable.apithird.business.dto.FlowMyBusinessDto; |
| | | import org.jeecg.modules.flowable.domain.dto.FlowViewerDto; |
| | | import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; |
| | | |
| | |
| | | * @param task 请æ±å®ä½åæ° |
| | | */ |
| | | Result complete(FlowTaskVo task); |
| | | |
| | | Result completeByDateId(FlowTaskVo flowTaskVo); |
| | | /** |
| | | * 驳åä»»å¡ |
| | |
| | | * @param pageSize æ¯é¡µæ¡æ° |
| | | * @return |
| | | */ |
| | | Result finishedList(Integer pageNum, Integer pageSize); |
| | | Result finishedList(Integer pageNum, Integer pageSize,FlowMyBusinessDto flowMyBusinessDto); |
| | | |
| | | /** |
| | | * æµç¨å岿µè½¬è®°å½ |
| | | * |
| | | * @param procInsId æµç¨å®ä¾Id |
| | | * @param dataId æµç¨å®ä¾Id |
| | | * @return |
| | | */ |
| | | Result flowRecord(String dataId); |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.google.common.collect.Lists; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.flowable.task.api.Task; |
| | | import org.flowable.task.api.TaskQuery; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.flowable.task.api.history.HistoricTaskInstanceQuery; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.SpringContextUtils; |
| | | import org.jeecg.modules.flowable.apithird.business.dto.FlowMyBusinessDto; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; |
| | | import org.jeecg.modules.flowable.apithird.common.constant.ProcessConstants; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result finishedList(Integer pageNum, Integer pageSize) { |
| | | Page<FlowTaskDto> page = new Page<>(); |
| | | public Result finishedList(Integer pageNum, Integer pageSize, FlowMyBusinessDto flowMyBusinessDto) { |
| | | //ä¿®æ¹æ¥è¯¢ï¼æ·»å æ¥è¯¢æ¡ä»¶ |
| | | Page page = new Page(pageNum, pageSize); |
| | | String username = iFlowThirdService.getLoginUser().getUsername(); |
| | | HistoricTaskInstanceQuery taskInstanceQuery = historyService.createHistoricTaskInstanceQuery() |
| | | .includeProcessVariables() |
| | | .finished() |
| | | .taskAssignee(username) |
| | | .orderByHistoricTaskInstanceEndTime() |
| | | .desc(); |
| | | List<HistoricTaskInstance> historicTaskInstanceList = taskInstanceQuery.listPage((pageNum - 1)*pageSize, pageSize); |
| | | List<FlowTaskDto> hisTaskList = Lists.newArrayList(); |
| | | for (HistoricTaskInstance histTask : historicTaskInstanceList) { |
| | | FlowTaskDto flowTask = new FlowTaskDto(); |
| | | // å½åæµç¨ä¿¡æ¯ |
| | | flowTask.setTaskId(histTask.getId()); |
| | | // 审æ¹äººåä¿¡æ¯ |
| | | flowTask.setCreateTime(histTask.getCreateTime()); |
| | | flowTask.setFinishTime(histTask.getEndTime()); |
| | | flowTask.setDuration(getDate(histTask.getDurationInMillis())); |
| | | flowTask.setProcDefId(histTask.getProcessDefinitionId()); |
| | | flowTask.setTaskDefKey(histTask.getTaskDefinitionKey()); |
| | | flowTask.setTaskName(histTask.getName()); |
| | | FlowMyBusiness flowMyBusiness = flowMyBusinessService.getByProcessInstanceId(histTask.getProcessInstanceId()); |
| | | if (flowMyBusiness != null) { |
| | | flowTask.setDescription(flowMyBusiness.getTitle()); |
| | | } |
| | | flowMyBusinessDto.setCurrentUser(username); |
| | | IPage<FlowTaskDto> flowTaskDtoIPage = flowMyBusinessService.getPageListMyBusiness(page,flowMyBusinessDto); |
| | | flowTaskDtoIPage.getRecords().forEach(flowTaskDto -> { |
| | | // æµç¨å®ä¹ä¿¡æ¯ |
| | | ProcessDefinition pd = repositoryService.createProcessDefinitionQuery() |
| | | .processDefinitionId(histTask.getProcessDefinitionId()) |
| | | .processDefinitionId(flowTaskDto.getProcessDefinitionId()) |
| | | .singleResult(); |
| | | flowTask.setDeployId(pd.getDeploymentId()); |
| | | flowTask.setProcDefName(pd.getName()); |
| | | flowTask.setProcDefVersion(pd.getVersion()); |
| | | flowTask.setProcInsId(histTask.getProcessInstanceId()); |
| | | flowTask.setHisProcInsId(histTask.getProcessInstanceId()); |
| | | |
| | | flowTaskDto.setDeployId(pd.getDeploymentId()); |
| | | flowTaskDto.setProcDefName(pd.getName()); |
| | | flowTaskDto.setProcDefVersion(pd.getVersion()); |
| | | flowTaskDto.setCategory(pd.getCategory()); |
| | | // æµç¨åèµ·äººä¿¡æ¯ |
| | | HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() |
| | | .processInstanceId(histTask.getProcessInstanceId()) |
| | | .processInstanceId(flowTaskDto.getTaskId()) |
| | | .singleResult(); |
| | | SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); |
| | | flowTask.setStartUserId(startUser.getUsername()); |
| | | flowTask.setStartUserName(startUser.getRealname()); |
| | | flowTaskDto.setStartUserId(startUser.getUsername()); |
| | | flowTaskDto.setStartUserName(startUser.getRealname()); |
| | | List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId()); |
| | | flowTask.setStartDeptName(CollUtil.join(departNamesByUsername,"ï¼")); |
| | | hisTaskList.add(flowTask); |
| | | } |
| | | page.setTotal(hisTaskList.size()); |
| | | page.setRecords(hisTaskList); |
| | | // Map<String, Object> result = new HashMap<>(); |
| | | // result.put("result",page); |
| | | // result.put("finished",true); |
| | | flowTaskDto.setStartDeptName(CollUtil.join(departNamesByUsername,"ï¼")); |
| | | flowTaskDto.setTaskId(flowTaskDto.getHisProcInsId()); |
| | | }); |
| | | return Result.OK(page); |
| | | } |
| | | |