Commit cde6371f by yuwei

项目初始化

parent c039e7e6
package cn.datax.common.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public abstract class DataFlowBaseEntity extends DataScopeBaseEntity {
private static final long serialVersionUID = 1L;
/**
* 工作流状态
*/
@TableField(value = "flow_status", fill = FieldFill.INSERT)
private String flowStatus;
/**
* 流程实例ID
*/
private String processInstanceId;
}
package cn.datax.common.dictionary.config;
import cn.datax.common.annotation.DictAop;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.common.dictionary.annotation.DictAop;
import cn.datax.common.dictionary.utils.DictUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
......
......@@ -24,6 +24,7 @@ public class DataMetaObjectHandler implements MetaObjectHandler {
if (bolCreateDept) {
this.strictInsertFill(metaObject, "createDept", String.class, getUserDeptId());
}
this.strictInsertFill(metaObject, "flowStatus", String.class, DataConstant.AuditState.WAIT);
}
@Override
......
package cn.datax.service.system.api.vo;
import cn.datax.common.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -21,7 +20,6 @@ public class ConfigVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -14,7 +13,6 @@ public class DeptVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -21,7 +20,6 @@ public class DictItemVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -21,7 +20,6 @@ public class DictVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -13,7 +12,6 @@ public class MenuVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
......@@ -25,7 +23,6 @@ public class MenuVo implements Serializable {
private String menuRedirect;
private String menuPerms;
private String menuIcon;
@DictAop(code = "sys_menu_type")
private String menuType;
private String menuCode;
private Integer menuHidden;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -13,7 +12,6 @@ public class PostVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -14,14 +13,12 @@ public class RoleVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String roleName;
private String roleCode;
@DictAop(code = "sys_data_scope")
private String dataScope;
private List<MenuVo> menus;
private List<DeptVo> depts;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -15,7 +14,6 @@ public class UserVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
......
......@@ -79,11 +79,6 @@
<artifactId>datax-common-jasperreport</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>cn.datax</groupId>
<artifactId>datax-common-dictionary</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
......
......@@ -2,7 +2,6 @@ package cn.datax.service.system.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.common.dictionary.utils.ConfigUtil;
import cn.datax.common.validate.ValidationGroups;
import cn.datax.service.system.api.dto.ConfigDto;
import cn.datax.service.system.api.entity.ConfigEntity;
......@@ -135,8 +134,8 @@ public class ConfigController extends BaseController {
*/
@GetMapping("/key/{key}")
public R getConfig(@PathVariable String key) {
Object obj = ConfigUtil.getInstance().getConfig(key);
return R.ok().setData(obj);
String val = configService.getConfig(key);
return R.ok().setData(val);
}
/**
......
......@@ -2,12 +2,14 @@ package cn.datax.service.system.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.common.dictionary.utils.DictUtil;
import cn.datax.common.validate.ValidationGroups;
import cn.datax.service.system.api.dto.DictDto;
import cn.datax.service.system.api.entity.DictEntity;
import cn.datax.service.system.api.entity.DictItemEntity;
import cn.datax.service.system.api.vo.DictItemVo;
import cn.datax.service.system.api.vo.DictVo;
import cn.datax.service.system.api.query.DictQuery;
import cn.datax.service.system.mapstruct.DictItemMapper;
import cn.datax.service.system.mapstruct.DictMapper;
import cn.datax.service.system.service.DictService;
import cn.hutool.core.util.StrUtil;
......@@ -46,6 +48,9 @@ public class DictController extends BaseController {
@Autowired
private DictMapper dictMapper;
@Autowired
private DictItemMapper dictItemMapper;
/**
* 通过ID查询信息
*
......@@ -138,8 +143,9 @@ public class DictController extends BaseController {
*/
@GetMapping("/code/{code}")
public R getDictItems(@PathVariable String code) {
Object list = DictUtil.getInstance().getDictItemList(code);
return R.ok().setData(list);
List<DictItemEntity> list = dictService.getDictItems(code);
List<DictItemVo> collect = list.stream().map(dictItemMapper::toVO).collect(Collectors.toList());
return R.ok().setData(collect);
}
/**
......
......@@ -26,5 +26,7 @@ public interface ConfigService extends BaseService<ConfigEntity> {
void deleteConfigBatch(List<String> ids);
String getConfig(String key);
void refreshConfig();
}
......@@ -3,6 +3,7 @@ package cn.datax.service.system.service;
import cn.datax.service.system.api.entity.DictEntity;
import cn.datax.service.system.api.dto.DictDto;
import cn.datax.common.base.BaseService;
import cn.datax.service.system.api.entity.DictItemEntity;
import java.util.List;
......@@ -24,5 +25,7 @@ public interface DictService extends BaseService<DictEntity> {
void deleteDictBatch(List<String> ids);
List<DictItemEntity> getDictItems(String code);
void refreshDict();
}
......@@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -74,6 +75,12 @@ public class ConfigServiceImpl extends BaseServiceImpl<ConfigDao, ConfigEntity>
}
@Override
public String getConfig(String key) {
Object o = redisService.hget(RedisConstant.SYSTEM_CONFIG_KEY, key);
return (String) Optional.ofNullable(o).orElse("");
}
@Override
public void refreshConfig() {
String key = RedisConstant.SYSTEM_CONFIG_KEY;
Boolean hasKey = redisService.hasKey(key);
......
......@@ -6,6 +6,7 @@ import cn.datax.common.exception.DataException;
import cn.datax.common.redis.service.RedisService;
import cn.datax.service.system.api.entity.DictEntity;
import cn.datax.service.system.api.dto.DictDto;
import cn.datax.service.system.api.entity.DictItemEntity;
import cn.datax.service.system.service.DictService;
import cn.datax.service.system.mapstruct.DictMapper;
import cn.datax.service.system.dao.DictDao;
......@@ -17,6 +18,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
/**
* <p>
......@@ -72,6 +74,16 @@ public class DictServiceImpl extends BaseServiceImpl<DictDao, DictEntity> implem
}
@Override
public List<DictItemEntity> getDictItems(String code) {
List<DictEntity> dictEntityList = (List<DictEntity>) redisService.get(RedisConstant.SYSTEM_DICT_KEY);
Optional<DictEntity> dictEntityOptional = dictEntityList.stream().filter(s -> code.equals(s.getDictCode())).findFirst();
if (dictEntityOptional.isPresent()) {
return dictEntityOptional.get().getItems();
}
return null;
}
@Override
public void refreshDict() {
String key = RedisConstant.SYSTEM_DICT_KEY;
Boolean hasKey = redisService.hasKey(key);
......
......@@ -20,7 +20,8 @@ public class InitialAuditCompleteTaskListener implements TaskListener {
log.info("任务执行人:{}", delegateTask.getAssignee());
log.info("任务配置ID: {}", delegateTask.getTaskDefinitionKey());
Map<String, Object> variables = delegateTask.getVariables();
Boolean approved = (Boolean) Optional.ofNullable(variables).map(s -> s.get(VariablesEnum.approved)).orElse(true);
log.info("获取Variables:{}", variables);
Boolean approved = (Boolean) Optional.ofNullable(variables).map(s -> s.get(VariablesEnum.approved.toString())).orElse(true);
log.info("审核结果: {}", approved);
// 退回操作
if (!approved) {
......
......@@ -22,6 +22,7 @@ public class SubmitCompleteTaskListener implements TaskListener {
// 发送消息队列
String businessKey = (String) variables.get(VariablesEnum.businessKey.toString());
String businessCode = (String) variables.get(VariablesEnum.businessCode.toString());
// 删除审核参数
log.info("业务审核中:{},{}", businessKey, businessCode);
log.info("业务审核中状态:{}", DataConstant.AuditState.AUDIT.getKey());
log.info("退出提交节点用户任务完成监听器");
......
......@@ -129,7 +129,7 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
private void completeFirstTask(String submitter, String processInstanceId){
Task task = taskService.createTaskQuery().taskAssignee(submitter).processInstanceId(processInstanceId).active().singleResult();
if (task != null) {
log.info("自动完成第一个任务,任务ID:{}", task.getId());
log.info("自动完成提交任务,任务ID:{}", task.getId());
Comment comment = taskService.addComment(task.getId(), processInstanceId, "任务提交");
comment.setUserId(submitter);
taskService.saveComment(comment);
......
......@@ -149,7 +149,7 @@ public class FlowTaskServiceImpl implements FlowTaskService {
private void completeTask(String taskId, Map<String, Object> variables, String processInstanceId, String message) {
log.info("完成任务ID:{}", taskId);
Boolean approved = (Boolean) Optional.ofNullable(variables).map(s -> s.get(VariablesEnum.approved)).orElse(true);
Boolean approved = (Boolean) Optional.ofNullable(variables).map(s -> s.get(VariablesEnum.approved.toString())).orElse(true);
this.addComment(ActionEnum.COMPLETE, taskId, processInstanceId, StrUtil.isBlank(message) ? (approved ? "默认同意" : "默认不同意") : message);
taskService.complete(taskId, variables);
}
......
......@@ -219,10 +219,17 @@ export default {
pageNum: 1,
pageSize: 20,
configName: ''
}
},
// 状态数据字典
statusOptions: []
}
},
created() {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList()
},
mounted() {
......@@ -351,11 +358,11 @@ export default {
this.getList()
},
statusFormatter(row, column, cellValue, index) {
const dictText = row.status_dictText
const dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictText}</el-tag>
return <el-tag type='success'>{dictLabel}</el-tag>
} else {
return <el-tag type='warning'>{dictText}</el-tag>
return <el-tag type='warning'>{dictLabel}</el-tag>
}
}
}
......
......@@ -236,10 +236,17 @@ export default {
pageSize: 20,
dictName: '',
dictCode: ''
}
},
// 状态数据字典
statusOptions: []
}
},
created() {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList()
},
mounted() {
......@@ -394,11 +401,11 @@ export default {
this.getList()
},
statusFormatter(row, column, cellValue, index) {
const dictText = row.status_dictText
const dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictText}</el-tag>
return <el-tag type='success'>{dictLabel}</el-tag>
} else {
return <el-tag type='warning'>{dictText}</el-tag>
return <el-tag type='warning'>{dictLabel}</el-tag>
}
}
}
......
......@@ -227,12 +227,19 @@ export default {
dictId: '',
itemText: '',
itemValue: ''
}
},
// 状态数据字典
statusOptions: []
}
},
created() {
console.log('data:' + JSON.stringify(this.data))
this.queryParams.dictId = this.data.dictId
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList()
},
mounted() {
......@@ -367,11 +374,11 @@ export default {
this.getList()
},
statusFormatter(row, column, cellValue, index) {
const dictText = row.status_dictText
const dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictText}</el-tag>
return <el-tag type='success'>{dictLabel}</el-tag>
} else {
return <el-tag type='warning'>{dictText}</el-tag>
return <el-tag type='warning'>{dictLabel}</el-tag>
}
}
}
......
......@@ -210,10 +210,17 @@ export default {
pageNum: 1,
pageSize: 20,
postName: ''
}
},
// 状态数据字典
statusOptions: []
}
},
created() {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList()
},
mounted() {
......@@ -332,7 +339,7 @@ export default {
this.getList()
},
statusFormatter(row, column, cellValue, index) {
const dictText = row.status_dictText
const dictText = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictText}</el-tag>
} else {
......
......@@ -217,10 +217,24 @@ export default {
pageNum: 1,
pageSize: 20,
roleName: ''
}
},
// 状态数据字典
statusOptions: [],
// 数据范围数据字典
dataScopeOptions: []
}
},
created() {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getDicts('sys_data_scope').then(response => {
if (response.success) {
this.dataScopeOptions = response.data
}
})
this.getList()
},
mounted() {
......@@ -339,12 +353,11 @@ export default {
this.getList()
},
dataScopeFormatter(row, column, cellValue, index) {
const dataScope = row.dataScope
const dataScope_dictText = row.dataScope_dictText
return dataScope_dictText
const dictText = this.selectDictLabel(this.dataScopeOptions, cellValue)
return dictText
},
statusFormatter(row, column, cellValue, index) {
const dictText = row.status_dictText
const dictText = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictText}</el-tag>
} else {
......
......@@ -280,10 +280,17 @@ export default {
defaultProps: {
children: 'children',
label: 'deptName'
}
},
// 状态数据字典
statusOptions: []
}
},
created() {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList()
this.getDeptTree()
},
......@@ -433,11 +440,11 @@ export default {
return row.posts.map(item => item.postName).join(',')
},
statusFormatter(row, column, cellValue, index) {
const dictText = row.status_dictText
const dictText = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type="success">{dictText}</el-tag>
return <el-tag type='success'>{dictText}</el-tag>
} else {
return <el-tag type="warning">{dictText}</el-tag>
return <el-tag type='warning'>{dictText}</el-tag>
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment