提交 967b2d95 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码

上级 87def190
......@@ -24,158 +24,96 @@ import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* 实体[工作流任务]
* [工作流任务] 对象
*/
@Builder
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZTASK",resultMap = "WFTaskResultMap")
public class WFTask extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
@AllArgsConstructor
public class WFTask extends EntityBase implements Serializable {
/**
* 任务标识
*/
@DEField(name = "taskid" , isKeyField=true)
@TableId(value= "taskid",type=IdType.ASSIGN_UUID)
@JSONField(name = "id")
@JsonProperty("id")
private String id;
/**
* 状态
*/
@DEField(name = "taskname")
@TableField(value = "taskname")
@JSONField(name = "name")
@JsonProperty("name")
private String name;
/**
* DefinitionId
*/
@DEField(name = "definitionid")
@TableField(value = "definitionid")
@JSONField(name = "processdefinitionid")
@JsonProperty("processdefinitionid")
@JSONField(name = "processDefinitionId")
@JsonProperty("processDefinitionId")
private String processdefinitionid;
/**
* DefinitionKey
*/
@DEField(name = "definitionkey")
@TableField(value = "definitionkey")
@JSONField(name = "processdefinitionkey")
@JsonProperty("processdefinitionkey")
@JSONField(name = "processDefinitionKey")
@JsonProperty("processDefinitionKey")
private String processdefinitionkey;
/**
* 流程
*/
@DEField(name = "definitionname")
@TableField(value = "definitionname")
@JSONField(name = "processdefinitionname")
@JsonProperty("processdefinitionname")
@JSONField(name = "processDefinitionName")
@JsonProperty("processDefinitionName")
private String processdefinitionname;
/**
* TaskDefinitionKey
*/
@TableField(value = "taskdefinitionkey")
@JSONField(name = "taskdefinitionkey")
@JsonProperty("taskdefinitionkey")
@JSONField(name = "taskDefinitionKey")
@JsonProperty("taskDefinitionKey")
private String taskdefinitionkey;
/**
* 待办事项
*/
@TableField(value = "description")
@JSONField(name = "description")
@JsonProperty("description")
private String description;
/**
* 发起时间
*/
@TableField(value = "createtime")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createtime" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createtime")
@JSONField(name = "createTime" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createTime")
private Timestamp createtime;
/**
* 实例标识
*/
@DEField(name = "instanceid")
@TableField(value = "instanceid")
@JSONField(name = "processinstanceid")
@JsonProperty("processinstanceid")
@JSONField(name = "processInstanceId")
@JsonProperty("processInstanceId")
private String processinstanceid;
/**
* 业务键值
*/
@DEField(name = "businesskey")
@TableField(value = "businesskey")
@JSONField(name = "processinstancebusinesskey")
@JsonProperty("processinstancebusinesskey")
@JSONField(name = "processInstanceBusinessKey")
@JsonProperty("processInstanceBusinessKey")
private String processinstancebusinesskey;
/**
* 设置 [状态]
*/
public void setName(String name){
this.name = name ;
this.modify("taskname",name);
}
/**
* 设置 [DefinitionId]
*/
public void setProcessdefinitionid(String processdefinitionid){
this.processdefinitionid = processdefinitionid ;
this.modify("definitionid",processdefinitionid);
}
/**
* 设置 [DefinitionKey]
*/
public void setProcessdefinitionkey(String processdefinitionkey){
this.processdefinitionkey = processdefinitionkey ;
this.modify("definitionkey",processdefinitionkey);
}
/**
* 设置 [流程]
*/
public void setProcessdefinitionname(String processdefinitionname){
this.processdefinitionname = processdefinitionname ;
this.modify("definitionname",processdefinitionname);
}
/**
* 设置 [TaskDefinitionKey]
*/
public void setTaskdefinitionkey(String taskdefinitionkey){
this.taskdefinitionkey = taskdefinitionkey ;
this.modify("taskdefinitionkey",taskdefinitionkey);
}
/**
* 设置 [待办事项]
*/
public void setDescription(String description){
this.description = description ;
this.modify("description",description);
}
/**
* 设置 [发起时间]
*/
public void setCreatetime(Timestamp createtime){
this.createtime = createtime ;
this.modify("createtime",createtime);
}
/**
* 格式化日期 [发起时间]
......@@ -187,23 +125,6 @@ public class WFTask extends EntityMP implements Serializable {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(createtime);
}
/**
* 设置 [实例标识]
*/
public void setProcessinstanceid(String processinstanceid){
this.processinstanceid = processinstanceid ;
this.modify("instanceid",processinstanceid);
}
/**
* 设置 [业务键值]
*/
public void setProcessinstancebusinesskey(String processinstancebusinesskey){
this.processinstancebusinesskey = processinstancebusinesskey ;
this.modify("businesskey",processinstancebusinesskey);
}
}
......@@ -17,118 +17,42 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.workflow.domain.WFTask;
import cn.ibizlab.util.filter.SearchContextBase;
/**
* 关系型数据实体[WFTask] 查询条件对象
* ServiceApi数据实体[WFTask] 查询条件对象
*/
@Slf4j
@Data
public class WFTaskSearchContext extends QueryWrapperContext<WFTask> {
public class WFTaskSearchContext extends SearchContextBase {
private String n_taskname_like;//[状态]
public void setN_taskname_like(String n_taskname_like) {
this.n_taskname_like = n_taskname_like;
if(!ObjectUtils.isEmpty(this.n_taskname_like)){
this.getSearchCond().like("taskname", n_taskname_like);
}
}
private String n_definitionid_eq;//[DefinitionId]
public void setN_definitionid_eq(String n_definitionid_eq) {
this.n_definitionid_eq = n_definitionid_eq;
if(!ObjectUtils.isEmpty(this.n_definitionid_eq)){
this.getSearchCond().eq("definitionid", n_definitionid_eq);
}
}
private String n_definitionkey_eq;//[DefinitionKey]
public void setN_definitionkey_eq(String n_definitionkey_eq) {
this.n_definitionkey_eq = n_definitionkey_eq;
if(!ObjectUtils.isEmpty(this.n_definitionkey_eq)){
this.getSearchCond().eq("definitionkey", n_definitionkey_eq);
}
}
private String n_definitionkey_leftlike;//[DefinitionKey]
public void setN_definitionkey_leftlike(String n_definitionkey_leftlike) {
this.n_definitionkey_leftlike = n_definitionkey_leftlike;
if(!ObjectUtils.isEmpty(this.n_definitionkey_leftlike)){
this.getSearchCond().likeRight("definitionkey", n_definitionkey_leftlike);
}
}
private String n_definitionkey_like;//[DefinitionKey]
public void setN_definitionkey_like(String n_definitionkey_like) {
this.n_definitionkey_like = n_definitionkey_like;
if(!ObjectUtils.isEmpty(this.n_definitionkey_like)){
this.getSearchCond().like("definitionkey", n_definitionkey_like);
}
}
private String n_definitionname_like;//[流程]
public void setN_definitionname_like(String n_definitionname_like) {
this.n_definitionname_like = n_definitionname_like;
if(!ObjectUtils.isEmpty(this.n_definitionname_like)){
this.getSearchCond().like("definitionname", n_definitionname_like);
}
}
private String n_taskdefinitionkey_eq;//[TaskDefinitionKey]
public void setN_taskdefinitionkey_eq(String n_taskdefinitionkey_eq) {
this.n_taskdefinitionkey_eq = n_taskdefinitionkey_eq;
if(!ObjectUtils.isEmpty(this.n_taskdefinitionkey_eq)){
this.getSearchCond().eq("taskdefinitionkey", n_taskdefinitionkey_eq);
}
}
private String n_taskdefinitionkey_like;//[TaskDefinitionKey]
public void setN_taskdefinitionkey_like(String n_taskdefinitionkey_like) {
this.n_taskdefinitionkey_like = n_taskdefinitionkey_like;
if(!ObjectUtils.isEmpty(this.n_taskdefinitionkey_like)){
this.getSearchCond().like("taskdefinitionkey", n_taskdefinitionkey_like);
}
}
private String n_description_like;//[待办事项]
public void setN_description_like(String n_description_like) {
this.n_description_like = n_description_like;
if(!ObjectUtils.isEmpty(this.n_description_like)){
this.getSearchCond().like("description", n_description_like);
}
}
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Timestamp n_createtime_gtandeq;//[发起时间]
public void setN_createtime_gtandeq(Timestamp n_createtime_gtandeq) {
this.n_createtime_gtandeq = n_createtime_gtandeq;
if(!ObjectUtils.isEmpty(this.n_createtime_gtandeq)){
this.getSearchCond().ge("createtime", n_createtime_gtandeq);
}
}
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Timestamp n_createtime_ltandeq;//[发起时间]
public void setN_createtime_ltandeq(Timestamp n_createtime_ltandeq) {
this.n_createtime_ltandeq = n_createtime_ltandeq;
if(!ObjectUtils.isEmpty(this.n_createtime_ltandeq)){
this.getSearchCond().le("createtime", n_createtime_ltandeq);
}
}
private String n_businesskey_eq;//[业务键值]
public void setN_businesskey_eq(String n_businesskey_eq) {
this.n_businesskey_eq = n_businesskey_eq;
if(!ObjectUtils.isEmpty(this.n_businesskey_eq)){
this.getSearchCond().eq("businesskey", n_businesskey_eq);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSearchCond().and( wrapper ->
wrapper.like("taskname", query)
);
}
}
}
}
......@@ -18,12 +18,10 @@ import cn.ibizlab.core.workflow.domain.WFTask;
import cn.ibizlab.core.workflow.filter.WFTaskSearchContext;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[WFTask] 服务对象接口
*/
public interface IWFTaskService extends IService<WFTask>{
public interface IWFTaskService{
boolean create(WFTask et) ;
void createBatch(List<WFTask> list) ;
......@@ -37,21 +35,8 @@ public interface IWFTaskService extends IService<WFTask>{
boolean save(WFTask et) ;
void saveBatch(List<WFTask> list) ;
Page<WFTask> searchDefault(WFTaskSearchContext context) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return select * from table where id = '1'
*/
List<JSONObject> select(String sql, Map param);
/**
*自定义SQL
* @param sql update table set name ='test' where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return update table set name ='test' where id = '1'
*/
boolean execute(String sql, Map param);
}
......@@ -31,73 +31,44 @@ import cn.ibizlab.util.helper.CachedBeanCopier;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ibizlab.core.workflow.mapper.WFTaskMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
/**
* 实体[工作流任务] 服务对象接口实现
* 实体[工作流任务] 无存储服务对象接口实现
*/
@Slf4j
@Service("WFTaskServiceImpl")
public class WFTaskServiceImpl extends ServiceImpl<WFTaskMapper, WFTask> implements IWFTaskService {
@Service
public class WFTaskServiceImpl implements IWFTaskService {
protected int batchSize = 500;
@Override
@Transactional
public boolean create(WFTask et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
//代码实现
return true;
}
@Override
public void createBatch(List<WFTask> list) {
this.saveBatch(list,batchSize);
public void createBatch(List<WFTask> list){
}
@Override
@Transactional
public boolean update(WFTask et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("taskid",et.getId())))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
//代码实现
return true;
}
@Override
public void updateBatch(List<WFTask> list) {
updateBatchById(list,batchSize);
public void updateBatch(List<WFTask> list){
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
return result ;
return true;
}
@Override
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
public void removeBatch(Collection<String> idList){
}
@Override
@Transactional
public WFTask get(String key) {
WFTask et = getById(key);
if(et==null){
et=new WFTask();
WFTask et = new WFTask();
et.setId(key);
}
else{
}
return et;
}
......@@ -108,36 +79,20 @@ public class WFTaskServiceImpl extends ServiceImpl<WFTaskMapper, WFTask> impleme
@Override
public boolean checkKey(WFTask et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
return false;
}
@Override
@Transactional
public boolean save(WFTask et) {
if(!saveOrUpdate(et))
return false;
//代码实现
return true;
}
@Override
@Transactional
public boolean saveOrUpdate(WFTask et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
public void saveBatch(List<WFTask> list) {
}
@Override
public boolean saveBatch(Collection<WFTask> list) {
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<WFTask> list) {
saveOrUpdateBatch(list,batchSize);
}
......@@ -146,42 +101,10 @@ public class WFTaskServiceImpl extends ServiceImpl<WFTaskMapper, WFTask> impleme
*/
@Override
public Page<WFTask> searchDefault(WFTaskSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<WFTask> pages=baseMapper.searchDefault(context.getPages(),context,context.getSelectCond());
return new PageImpl<WFTask>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
@Override
public List<JSONObject> select(String sql, Map param){
return this.baseMapper.selectBySQL(sql,param);
}
@Override
@Transactional
public boolean execute(String sql , Map param){
if (sql == null || sql.isEmpty()) {
return false;
}
if (sql.toLowerCase().trim().startsWith("insert")) {
return this.baseMapper.insertBySQL(sql,param);
}
if (sql.toLowerCase().trim().startsWith("update")) {
return this.baseMapper.updateBySQL(sql,param);
}
if (sql.toLowerCase().trim().startsWith("delete")) {
return this.baseMapper.deleteBySQL(sql,param);
}
log.warn("暂未支持的SQL语法");
return true;
return new PageImpl<WFTask>(new ArrayList(),context.getPageable(),0);
}
}
......@@ -47,7 +47,6 @@ public class WFTaskResource {
@Lazy
public WFTaskMapping wftaskMapping;
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Create-all')")
@ApiOperation(value = "新建工作流任务", tags = {"工作流任务" }, notes = "新建工作流任务")
@RequestMapping(method = RequestMethod.POST, value = "/wftasks")
@Transactional
......@@ -58,7 +57,6 @@ public class WFTaskResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Create-all')")
@ApiOperation(value = "批量新建工作流任务", tags = {"工作流任务" }, notes = "批量新建工作流任务")
@RequestMapping(method = RequestMethod.POST, value = "/wftasks/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFTaskDTO> wftaskdtos) {
......@@ -66,7 +64,6 @@ public class WFTaskResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Update-all')")
@ApiOperation(value = "更新工作流任务", tags = {"工作流任务" }, notes = "更新工作流任务")
@RequestMapping(method = RequestMethod.PUT, value = "/wftasks/{wftask_id}")
@Transactional
......@@ -78,7 +75,6 @@ public class WFTaskResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Update-all')")
@ApiOperation(value = "批量更新工作流任务", tags = {"工作流任务" }, notes = "批量更新工作流任务")
@RequestMapping(method = RequestMethod.PUT, value = "/wftasks/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFTaskDTO> wftaskdtos) {
......@@ -86,7 +82,6 @@ public class WFTaskResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Remove-all')")
@ApiOperation(value = "删除工作流任务", tags = {"工作流任务" }, notes = "删除工作流任务")
@RequestMapping(method = RequestMethod.DELETE, value = "/wftasks/{wftask_id}")
@Transactional
......@@ -94,7 +89,6 @@ public class WFTaskResource {
return ResponseEntity.status(HttpStatus.OK).body(wftaskService.remove(wftask_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Remove-all')")
@ApiOperation(value = "批量删除工作流任务", tags = {"工作流任务" }, notes = "批量删除工作流任务")
@RequestMapping(method = RequestMethod.DELETE, value = "/wftasks/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -102,7 +96,6 @@ public class WFTaskResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Get-all')")
@ApiOperation(value = "获取工作流任务", tags = {"工作流任务" }, notes = "获取工作流任务")
@RequestMapping(method = RequestMethod.GET, value = "/wftasks/{wftask_id}")
public ResponseEntity<WFTaskDTO> get(@PathVariable("wftask_id") String wftask_id) {
......@@ -123,14 +116,12 @@ public class WFTaskResource {
return ResponseEntity.status(HttpStatus.OK).body(wftaskService.checkKey(wftaskMapping.toDomain(wftaskdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Save-all')")
@ApiOperation(value = "保存工作流任务", tags = {"工作流任务" }, notes = "保存工作流任务")
@RequestMapping(method = RequestMethod.POST, value = "/wftasks/save")
public ResponseEntity<Boolean> save(@RequestBody WFTaskDTO wftaskdto) {
return ResponseEntity.status(HttpStatus.OK).body(wftaskService.save(wftaskMapping.toDomain(wftaskdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-Save-all')")
@ApiOperation(value = "批量保存工作流任务", tags = {"工作流任务" }, notes = "批量保存工作流任务")
@RequestMapping(method = RequestMethod.POST, value = "/wftasks/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFTaskDTO> wftaskdtos) {
......@@ -138,7 +129,6 @@ public class WFTaskResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-searchDefault-all')")
@ApiOperation(value = "获取DEFAULT", tags = {"工作流任务" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wftasks/fetchdefault")
public ResponseEntity<List<WFTaskDTO>> fetchDefault(WFTaskSearchContext context) {
......@@ -151,7 +141,6 @@ public class WFTaskResource {
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFTask-searchDefault-all')")
@ApiOperation(value = "查询DEFAULT", tags = {"工作流任务" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wftasks/searchdefault")
public ResponseEntity<Page<WFTaskDTO>> searchDefault(@RequestBody WFTaskSearchContext context) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册