Commit 4d8412dd by Administrator

Merge branch 'tzq' into 'develop'

Tzq

See merge request 8timerv2/8timerapiv200!39
parents 2a5b8754 c5dd34a9
......@@ -276,13 +276,13 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok-maven-plugin -->
......
......@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
......@@ -22,7 +23,7 @@ import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import cn.hutool.core.net.NetUtil;
@MapperScan("cn.timer.api.dao") // 扫描的mapper
//@ComponentScan(basePackages = {"cn.timer.api.controller"})
@ComponentScan(basePackages = {"cn.timer.api"})
@SpringBootApplication
@EnableScheduling
@EnableTransactionManagement
......
......@@ -2,12 +2,13 @@ package cn.timer.api.bean.spmk;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -61,9 +62,11 @@ public class SpmkApprovalTemplate extends Model<SpmkApprovalTemplate> {
@ApiModelProperty(value = "审批意见 是否必填 意见 0是 1否", example = "101")
private Integer isOpinion;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "更新时间 ", example = "更新时间")
private Date updateTime;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
......
......@@ -2,12 +2,13 @@ package cn.timer.api.bean.spmk;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -46,6 +47,7 @@ public class SpmkApprovalTemplateG extends Model<SpmkApprovalTemplateG> {
@ApiModelProperty(value = "排序 排序", example = "101")
private Integer ranks;
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value = "编辑时间 ", example = "编辑时间")
private Date updateTime;
......
package cn.timer.api.bean.spmk;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
......@@ -55,5 +54,8 @@ public class SpmkApproveDetail extends Model<SpmkApproveDetail> {
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
private byte[] router;
@ApiModelProperty(value = "通过节点 ", example = "通过节点")
private byte[] flowChildren;
}
\ No newline at end of file
......@@ -2,12 +2,13 @@ package cn.timer.api.bean.spmk;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -52,6 +53,7 @@ public class SpmkApproveExecuteRecord extends Model<SpmkApproveExecuteRecord> {
@ApiModelProperty(value = "状态 0未执行 1审批中 2同意 3拒绝", example = "101")
private Integer sts;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
......
......@@ -2,12 +2,13 @@ package cn.timer.api.bean.spmk;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -42,7 +43,7 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
@ApiModelProperty(value = "企业组织代码", example = "123")
private Integer orgCode;
@ApiModelProperty(value = "发起人id 用于搜索(所在部门)", example = "101")
private Integer empNum;
......@@ -56,11 +57,13 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
private String initiator;
@ApiModelProperty(value = "发起时间 ", example = "发起时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "审批名称 ", example = "审批名称")
private String approveName;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "状态 0审批中 1审批撤销 2审批拒绝 3审批通过/审批完成", example = "101")
private Integer sts;
......@@ -70,6 +73,7 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
@ApiModelProperty(value = "历史审批人 ", example = "历史审批人")
private String historyApprover;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "最近处理时间 ", example = "最近处理时间")
private Date updateTime;
......
......@@ -2,12 +2,13 @@ package cn.timer.api.bean.spmk;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -64,9 +65,11 @@ public class SpmkCustomApproval extends Model<SpmkCustomApproval> {
@ApiModelProperty(value = "审批意见 是否必填 意见 0是 1否", example = "101")
private Integer isOpinion;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "更新时间 ", example = "更新时间")
private Date updateTime;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
......
......@@ -7,7 +7,9 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -59,6 +61,7 @@ public class SpmkExecutor extends Model<SpmkExecutor> {
@ApiModelProperty(value = "状态 0未执行 1执行中 2同意 3拒接", example = "101")
private Integer sts;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
......
package cn.timer.api.bean.spmk;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......
package cn.timer.api.config.autofill;
import java.util.Date;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
@Slf4j
......@@ -15,16 +16,17 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
log.info("start insert fill ....");
this.setInsertFieldValByName("createTime", DateUtil.date(), metaObject);//3.0.7版本后
this.setInsertFieldValByName("regTime", DateUtil.date(), metaObject);//3.0.7版本后
this.setInsertFieldValByName("addtime", DateUtil.date(), metaObject);//薪资档案-定薪
Date date = new Date();
this.strictInsertFill(metaObject, "createTime", Date.class, date); // 起始版本 3.3.0(推荐使用)
this.strictInsertFill(metaObject, "sts", Integer.class, 0); // 起始版本 3.3.0(推荐使用)
}
@Override
public void updateFill(MetaObject metaObject) {
log.info("start update fill ....");
this.setUpdateFieldValByName("createTime", DateUtil.date(), metaObject);//3.0.7版本后
this.setUpdateFieldValByName("updateTime", DateUtil.date(), metaObject);//3.0.7版本后
Date date = new Date();
this.strictUpdateFill(metaObject, "updateTime", Date.class, date); // 起始版本 3.3.0(推荐使用)
}
}
......@@ -28,6 +28,7 @@ import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.dzht.DzhtAssoHtmb;
import cn.timer.api.bean.spmk.SpmkApprovalG;
import cn.timer.api.bean.spmk.SpmkApprovalTemplate;
import cn.timer.api.bean.spmk.SpmkApprovalTemplateG;
......@@ -59,6 +60,7 @@ import cn.timer.api.dao.spmk.SpmkExecutorMapper;
import cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper;
import cn.timer.api.dao.spmk.SpmkSpglMapper;
import cn.timer.api.dao.spmk.SpmkSpzMapper;
import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.Router;
import cn.timer.api.dto.spmk.Spmk;
import cn.timer.api.dto.spmk.SpmkApprovalTemplateDto;
......@@ -72,6 +74,7 @@ import cn.timer.api.dto.spmk.SpmkSpglSortDto;
import cn.timer.api.dto.spmk.SpmkSpzDto;
import cn.timer.api.dto.spmk.SpmkSpzSortDto;
import cn.timer.api.dto.spmk.SpmkSpzSpglDto;
import cn.timer.api.dto.spmk.SummaryQueryDto;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.RouterUtils;
......@@ -95,7 +98,6 @@ public class SpmkServiceImpl {
*/
@GetMapping(value = "/spzs")
@ApiOperation(value = "审批组-列表",httpMethod = "GET")
@ApiOperationSupport(order = 2)
public Result<List<SpmkSpzSpglDto>> selectListspz(@CurrentUser UserBean userBean) {
Integer orgCode = userBean.getOrgCode();
......@@ -109,7 +111,6 @@ public class SpmkServiceImpl {
*/
@PostMapping(value = "/spzs")
@ApiOperation(value = "审批组-新建",httpMethod = "POST")
@ApiOperationSupport(order = 3)
public Result<SpmkSpz> addspz(@CurrentUser UserBean userBean ,@RequestBody SpmkSpz spmkSpz) {
Integer orgCode = userBean.getOrgCode();
......@@ -142,7 +143,6 @@ public class SpmkServiceImpl {
*/
@DeleteMapping(value = "/spzs/{id}")
@ApiOperation(value = "审批组-删除",httpMethod = "DELETE")
@ApiOperationSupport(order = 4)
public Result<SpmkSpz> delspz(@CurrentUser UserBean userBean ,@PathVariable("id") Integer id){
Integer orgCode = userBean.getOrgCode();
SpmkSpz spmkSpz = SpmkSpz.builder().build();
......@@ -174,7 +174,6 @@ public class SpmkServiceImpl {
*/
@PutMapping(value = "/spgl")
@ApiOperation(value = "审批管理-编辑", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 9)
public Result<SpmkSpgl> updateSpgl(@CurrentUser UserBean userBean,@RequestBody SpmkSpglDto spmkSpglDto){
@SuppressWarnings("unused")
Integer orgCode = userBean.getOrgCode();
......@@ -198,7 +197,6 @@ public class SpmkServiceImpl {
*/
@PutMapping(value = "/mb")
@ApiOperation(value = "审批模版-新增/编辑", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 10)
public Result<SpmkSpgl> updateMb(@CurrentUser UserBean userBean,@RequestBody SpmkMbKjDto spmkMbKjDto) {
// TODO Auto-generated method stub
......@@ -217,7 +215,6 @@ public class SpmkServiceImpl {
*/
@PutMapping(value = "/updatespz")
@ApiOperation(value = "审批组-重命名", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 5)
public Result<SpmkSpzDto> updatespz(@CurrentUser UserBean userBean,@RequestBody SpmkSpzDto spmkSpzDto) {
// TODO Auto-generated method stub
......@@ -240,7 +237,6 @@ public class SpmkServiceImpl {
*/
@PutMapping(value = "/updatespzsort")
@ApiOperation(value = "审批组-排序", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 6)
public Result<Void> updatespzsort(@CurrentUser UserBean userBean,@RequestBody List<SpmkSpzSortDto> spmkSpzSortDtos) {
Integer orgCode = userBean.getOrgCode();
SpmkSpz.builder().sort(CommonEnum.SPZ_OTHER.getType()).build().update(new UpdateWrapper<SpmkSpz>().eq("org_code", orgCode).eq("name", "其他"));
......@@ -255,7 +251,6 @@ public class SpmkServiceImpl {
*/
@PutMapping(value = "/updatespglsort")
@ApiOperation(value = "审批管理-排序", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 8)
public Result<Void> updatespglsort(@CurrentUser UserBean userBean,@RequestBody List<SpmkSpglSortDto> spmkSpglSortDtos) {
Integer count = spmkSpglMapper.updateListSortById(spmkSpglSortDtos);
System.out.println(count);
......@@ -267,7 +262,6 @@ public class SpmkServiceImpl {
*/
@GetMapping(value = "/spgl/{id}")
@ApiOperation(value = "审批管理-查询", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 11)
public Result<SpmkSpglDto> selectspgl(@CurrentUser UserBean userBean,@PathVariable("id") Integer id) {
SpmkSpgl spmkSpgl = spmkSpglMapper.selectSpglById2(id);
......@@ -333,7 +327,6 @@ public class SpmkServiceImpl {
@Transactional
@PostMapping(value = "/lcjd")
@ApiOperation(value = "流程节点-批量添加/更新", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 12)
public Result<Void> addlistlcjd(@CurrentUser UserBean userBean,@RequestBody SpmkLcjd spmkLcjd) {
return null;
}
......@@ -343,7 +336,6 @@ public class SpmkServiceImpl {
*/
@PostMapping(value = "/spcz")
@ApiOperation(value = "审批操作-发起审批", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 13)
public Result<Void> addspcz(@CurrentUser UserBean userBean,@RequestBody SpmkSpcz spmkSpcz) {
return ResultUtil.success("审批操作-发起审批成功");
}
......@@ -353,7 +345,6 @@ public class SpmkServiceImpl {
*/
@PostMapping(value = "/sphz")
@ApiOperation(value = "审批汇总-流程", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 14)
public Result<Void> sphz(@CurrentUser UserBean userBean) {
return null;
......@@ -364,7 +355,6 @@ public class SpmkServiceImpl {
*/
@PutMapping(value = "/movespgl")
@ApiOperation(value = "移动到", httpMethod = "PUT", notes = "接口发布说明")
@ApiOperationSupport(order = 7)
public Result<SpmkSpgl> moveSpgl(@CurrentUser UserBean userBean,@RequestBody SpmkSpglMoveDto spmkSpglMoveDto) {
Integer id = spmkSpglMoveDto.getId();
......@@ -391,7 +381,6 @@ public class SpmkServiceImpl {
*/
@GetMapping(value = "/icon")
@ApiOperation(value = "图标列表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<List<SpmkIcon>> selectListIcon(@CurrentUser UserBean userBean){
List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll();
......@@ -404,7 +393,6 @@ public class SpmkServiceImpl {
*/
@GetMapping(value = "/jqgz")
@ApiOperation(value = "假期规则列表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 1)
public Result<Object> selectListjqgz(
@RequestParam(defaultValue = "1") Integer currentPage,
@RequestParam(defaultValue = "10") Integer totalPage, @RequestParam Integer id,
......@@ -450,9 +438,8 @@ public class SpmkServiceImpl {
*/
@PostMapping(value = "/deptSelectEmp")
@ApiOperation(value = "部门id 查询 员工", httpMethod = "POST", notes = "流程节点解析_plus")
@ApiOperationSupport(order = 1)
public Result<Object> selectEmpBydept(@RequestParam Integer id){
List<YgglMainEmp> ygglMainEmp = RouterUtils.selectOtherlistent(4,id);
List<YgglMainEmp> ygglMainEmp = RouterUtils.selectOtherlistent(117,id);
return ResultUtil.data(ygglMainEmp, "解析成功!");
}
......@@ -465,7 +452,6 @@ public class SpmkServiceImpl {
*/
@PostMapping(value = "/jsonparse_plus_plus")
@ApiOperation(value = "jsonparse_plus_plus", httpMethod = "POST", notes = "流程节点解析_plus")
@ApiOperationSupport(order = 1)
public Result<Object> jsonToObj123(@CurrentUser UserBean userBean, @RequestBody Spmk spmk){
List<Router> listRouter = new ArrayList<Router>();
......@@ -474,12 +460,9 @@ public class SpmkServiceImpl {
JSONObject jSONObject = spmk.getData();
jSONObject.put("orgCode", userBean.getOrgCode());
return ResultUtil.data(RouterUtils.NextNode(listRouter, jSONObject), "解析成功!");
return ResultUtil.data(RouterUtils.NextNode(listRouter, jSONObject, ISNOTFIRST), "解析成功!");
}
@Autowired
private SpmkApprovalTemplateGMapper spmkApprovalTemplateGMapper;
......@@ -501,7 +484,7 @@ public class SpmkServiceImpl {
* 新增或编辑-审批模板组
*/
@PostMapping(value = "/save_approval_template_g")
@ApiOperation(value = "新增或编辑-审批模板组", httpMethod = "POST", notes = "新增或编辑-审批模板组")
@ApiOperation(value = "1.新增或编辑-审批模板组", httpMethod = "POST", notes = "新增或编辑-审批模板组")
@ApiOperationSupport(order = 1)
public Result<Object> saveAtg(@RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){
......@@ -513,10 +496,14 @@ public class SpmkServiceImpl {
* 删除-审批模板组
*/
@DeleteMapping(value = "/delete_approval_template_g/{id}")
@ApiOperation(value = "删除-审批模板组", httpMethod = "DELETE", notes = "删除-审批模板组")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "2.删除-审批模板组", httpMethod = "DELETE", notes = "删除-审批模板组")
@ApiOperationSupport(order = 2)
public Result<Object> deleteAtgById(@PathVariable int id){
if (spmkApprovalTemplateMapper.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda().eq(SpmkApprovalTemplate::getApprovalTemplateGId, id)) > 0 )
return ResultUtil.error("审批模板组存在 模板,不可直接删除!");
return SpmkApprovalTemplateG.builder().id(id).build().deleteById() ? ResultUtil.success("操作成功!") : ResultUtil.error("没有找到该对象");
}
......@@ -525,8 +512,8 @@ public class SpmkServiceImpl {
* 查询列表-审批模板组
*/
@GetMapping(value = "/list_approval_template_g")
@ApiOperation(value = "查询列表-审批模板组", httpMethod = "GET", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "3.查询列表-审批模板组", httpMethod = "GET", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 3)
public Result<Object> selectListAtg(){
return ResultUtil.data(spmkApprovalTemplateGMapper.selectListAtInAtg(),"操作成功!");
......@@ -536,8 +523,8 @@ public class SpmkServiceImpl {
* 排序-审批模板组
*/
@PutMapping(value = "/update_approval_template_g")
@ApiOperation(value = "排序-审批模板组", httpMethod = "PUT", notes = "排序-审批模板组")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "4.排序-审批模板组", httpMethod = "PUT", notes = "排序-审批模板组")
@ApiOperationSupport(order = 4)
public Result<Object> ranksAtg(@RequestBody List<SpmkApprovalTemplateG> list){
return spmkApprovalTemplateGMapper.updateListRandsById(list) ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
......@@ -548,8 +535,8 @@ public class SpmkServiceImpl {
* 新增或编辑-审批模板
*/
@PostMapping(value = "/save_approval_template")
@ApiOperation(value = "新增或编辑-审批模板", httpMethod = "POST", notes = "新增或编辑-审批模板")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "5.新增或编辑-审批模板", httpMethod = "POST", notes = "新增或编辑-审批模板")
@ApiOperationSupport(order = 5)
public Result<Object> saveAt(@RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto){
Integer approvalTemplateGId = spmkApprovalTemplateDto.getApprovalTemplateGId();
if (ObjectUtil.isNull(approvalTemplateGId))
......@@ -557,7 +544,9 @@ public class SpmkServiceImpl {
SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().build();
// 克隆 SpmkApprovalTemplateDto对象 到 SpmkApprovalTemplate对象,排除属性froms,router
BeanUtil.copyProperties(spmkApprovalTemplateDto, at , "froms","router");
// 序列化 后 写入 SpmkApprovalTemplate对象
at.setFroms(ObjectUtil.serialize(spmkApprovalTemplateDto.getFroms()));
at.setRouter(ObjectUtil.serialize(spmkApprovalTemplateDto.getRouter()));
......@@ -569,8 +558,8 @@ public class SpmkServiceImpl {
* 删除-审批模板
*/
@DeleteMapping(value = "/delete_approval_template/{id}")
@ApiOperation(value = "删除-审批模板", httpMethod = "DELETE", notes = "删除-审批模板")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "6.删除-审批模板", httpMethod = "DELETE", notes = "删除-审批模板")
@ApiOperationSupport(order = 6)
public Result<Object> deleteAtById(@PathVariable int id){
return SpmkApprovalTemplate.builder().id(id).build().deleteById() ? ResultUtil.success("操作成功!") : ResultUtil.error("没有找到该对象");
......@@ -581,8 +570,8 @@ public class SpmkServiceImpl {
* id查询-审批模板
*/
@GetMapping(value = "/select_approval_template")
@ApiOperation(value = "id查询-审批模板", httpMethod = "GET", notes = "id查询-审批模板")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "7.id查询-审批模板", httpMethod = "GET", notes = "id查询-审批模板")
@ApiOperationSupport(order = 7)
public Result<Object> selectAtById(@PathVariable int id){
return ResultUtil.data(SpmkApprovalTemplate.builder().id(id).build().selectById(),"操作成功!");
......@@ -593,8 +582,8 @@ public class SpmkServiceImpl {
* 排序-审批模板
*/
@PutMapping(value = "/update_approval_template")
@ApiOperation(value = "查询列表-审批模板组", httpMethod = "PUT", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "8.查询列表-审批模板组", httpMethod = "PUT", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 8)
public Result<Object> ranksAt(@RequestBody List<SpmkApprovalTemplate> list){
return spmkApprovalTemplateMapper.updateListRandsById(list) ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
......@@ -608,8 +597,8 @@ public class SpmkServiceImpl {
* 新增或编辑-审批组
*/
@PostMapping(value = "/save_approval_g")
@ApiOperation(value = "新增或编辑-审批组", httpMethod = "POST", notes = "新增或编辑-审批组")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "9.新增或编辑-审批组", httpMethod = "POST", notes = "新增或编辑-审批组")
@ApiOperationSupport(order = 9)
public Result<Object> saveAg(@CurrentUser UserBean userBean,@RequestBody SpmkApprovalG spmkApprovalG){
spmkApprovalG.setOrgCode(userBean.getOrgCode());
return spmkApprovalG.insertOrUpdate() ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
......@@ -620,10 +609,13 @@ public class SpmkServiceImpl {
* 删除-审批组
*/
@DeleteMapping(value = "/delete_approval_g/{id}")
@ApiOperation(value = "删除-审批组", httpMethod = "DELETE", notes = "删除-审批组")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "10.删除-审批组", httpMethod = "DELETE", notes = "删除-审批组")
@ApiOperationSupport(order = 10)
public Result<Object> deleteAgById(@PathVariable int id){
if (spmkCustomApprovalMapper.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda().eq(SpmkCustomApproval::getApprovalGId, id)) > 0 )
return ResultUtil.error("审批组存在 自定义审批,不可直接删除!");
return SpmkApprovalG.builder().id(id).build().deleteById() ? ResultUtil.success("操作成功!") : ResultUtil.error("没有找到该对象");
}
......@@ -632,8 +624,8 @@ public class SpmkServiceImpl {
* 查询列表-审批组
*/
@GetMapping(value = "/list_approval_g")
@ApiOperation(value = "查询列表-审批组", httpMethod = "GET", notes = "查询列表-审批组")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "11.查询列表-审批组", httpMethod = "GET", notes = "查询列表-审批组")
@ApiOperationSupport(order = 11)
public Result<Object> selectListAg(@CurrentUser UserBean userBean){
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum()),"操作成功!");
......@@ -644,8 +636,8 @@ public class SpmkServiceImpl {
* 排序-审批组
*/
@PutMapping(value = "/update_approval_g")
@ApiOperation(value = "排序-审批组", httpMethod = "PUT", notes = "排序-审批组")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "12.排序-审批组", httpMethod = "PUT", notes = "排序-审批组")
@ApiOperationSupport(order = 12)
public Result<Object> ranksAg(@RequestBody List<SpmkApprovalG> list){
return spmkApprovalGMapper.updateListRandsById(list) ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
......@@ -657,8 +649,8 @@ public class SpmkServiceImpl {
* 新增或编辑-自定义审批
*/
@PostMapping(value = "/save_custom_approval")
@ApiOperation(value = "新增或编辑-自定义审批", httpMethod = "POST", notes = "新增或编辑-自定义审批")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "13.新增或编辑-自定义审批", httpMethod = "POST", notes = "新增或编辑-自定义审批")
@ApiOperationSupport(order = 13)
@Transactional(rollbackFor = Exception.class)
public Result<Object> saveCa(@RequestBody SpmkCustomApprovalDto spmkCustomApprovalDto) throws Exception{
Integer approvalGId = spmkCustomApprovalDto.getApprovalGId();
......@@ -703,8 +695,8 @@ public class SpmkServiceImpl {
* 删除-自定义审批
*/
@DeleteMapping(value = "/delete_custom_approval/{id}")
@ApiOperation(value = "删除-自定义审批", httpMethod = "DELETE", notes = "删除-自定义审批")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "14.删除-自定义审批", httpMethod = "DELETE", notes = "删除-自定义审批")
@ApiOperationSupport(order = 14)
public Result<Object> deleteCaById(@PathVariable int id){
return SpmkCustomApproval.builder().id(id).build().deleteById() &&
......@@ -716,9 +708,9 @@ public class SpmkServiceImpl {
/**
* id查询-自定义审批
*/
@GetMapping(value = "/select_custom_approval")
@ApiOperation(value = "id查询-审批模板", httpMethod = "GET", notes = "id查询-审批模板")
@ApiOperationSupport(order = 1)
@GetMapping(value = "/select_custom_approval/{id}")
@ApiOperation(value = "15.id查询-自定义审批", httpMethod = "GET", notes = "id查询-自定义审批")
@ApiOperationSupport(order = 15)
public Result<Object> selectCaById(@PathVariable int id){
return ResultUtil.data(SpmkCustomApproval.builder().id(id).build().selectById(),"操作成功!");
......@@ -729,8 +721,8 @@ public class SpmkServiceImpl {
* 排序-自定义审批
*/
@PutMapping(value = "/update_custom_approval")
@ApiOperation(value = "排序-自定义审批", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "16.排序-自定义审批", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 16)
public Result<Object> ranksCa(@RequestBody List<SpmkCustomApproval> list){
return spmkCustomApprovalMapper.updateListRandsById(list) ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
......@@ -748,52 +740,102 @@ public class SpmkServiceImpl {
@Autowired
private SpmkInitiatorConfigMapper spmkInitiatorConfigMapper;
private boolean ISFIRST = true; // 第一次启动审批流程
private boolean ISNOTFIRST = false;
// TODO 审批汇总(发起审批)
/**
* 发起审批
* @throws Exception
*/
@PostMapping(value = "/start_approval")
@ApiOperation(value = "新增或编辑-自定义审批", httpMethod = "POST", notes = "新增或编辑-自定义审批")
@ApiOperationSupport(order = 1)
public Result<Object> saveCa(@CurrentUser UserBean userBean, @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto){
SpmkApproveSummary as = spmkApproveSummaryDto.getSpmkApproveSummary();
as.setOrgCode(userBean.getOrgCode());
// 待补充
@ApiOperation(value = "17.发起审批", httpMethod = "POST", notes = "发起审批")
@ApiOperationSupport(order = 17)
@Transactional(rollbackFor = Exception.class)
public Result<Object> saveCa(@CurrentUser UserBean userBean, @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception{
SpmkApproveDetailDto adD = spmkApproveSummaryDto.getSpmkApproveDetailDto();
List<Router> listRouter = new ArrayList<Router>();
listRouter.add(spmkApproveSummaryDto.getSpmkApproveDetailDto().getRouter());
JSONObject jSONObject = spmkApproveSummaryDto
.getSpmkApproveDetailDto()
.getRequestData()
.put("orgCode", userBean.getOrgCode());
listRouter.add(spmkApproveSummaryDto.getRouter());
JSONObject jSONObject = spmkApproveSummaryDto.getRequestData().put("orgCode", userBean.getOrgCode());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
SpmkApproveDetail ad = SpmkApproveDetail.builder().build();
BeanUtil.copyProperties(adD, ad , "requestData","froms","router");
ad.setRequestData(ObjectUtil.serialize(adD.getRequestData()));
ad.setFroms(ObjectUtil.serialize(adD.getFroms()));
ad.setRouter(ObjectUtil.serialize(adD.getRouter()));
System.out.println(jSONObject);
System.out.println(listRouter);
System.out.println(listFlowChildren);
// 当前审批人
String currentApprover = jSONObject.getStr("current_approver");
// 封装 审批汇总
SpmkApproveSummary as = SpmkApproveSummary
.builder()
.orgCode(userBean.getOrgCode())
.empNum(userBean.getEmpNum())
.title(spmkApproveSummaryDto.getTitle())
.initiator(spmkApproveSummaryDto.getInitiator())
.approveName(spmkApproveSummaryDto.getApproveName())
.currentApprover(currentApprover).build();
if (!as.insert()) {
return ResultUtil.error("操作失败!");
}
// 封装 审批详情
SpmkApproveDetail ad = SpmkApproveDetail.builder().build();
ad.setApproveSummaryId(as.getId());
ad.setName(spmkApproveSummaryDto.getTitle());
ad.setRequestData(ObjectUtil.serialize(spmkApproveSummaryDto.getRequestData()));
ad.setFroms(ObjectUtil.serialize(spmkApproveSummaryDto.getFroms()));
ad.setRouter(ObjectUtil.serialize(listRouter.get(0)));
ad.setFlowChildren(ObjectUtil.serialize(listFlowChildren));
if (!ad.insert())
throw new Exception();
return ResultUtil.success("操作成功!");
// Integer approvalGId = spmkCustomApproval.getApprovalGId();
//
// if (approvalGId == null || approvalGId.equals("")) {
// return ResultUtil.error("操作失败!-1");
// }
return null;
// return spmkCustomApproval.insertOrUpdate() ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!-2");
}
//TODO 审批汇总
/**
* 审批汇总
*/
@PostMapping(value = "/select_approve_summary")
@ApiOperation(value = "18.审批汇总", httpMethod = "POST", notes = "审批汇总")
@ApiOperationSupport(order = 18)
public Result<Object> selectAs(@CurrentUser UserBean userBean, @RequestBody SummaryQueryDto summaryQueryDto) {
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(
summaryQueryDto.getCurrentPage() == null ? 1 : summaryQueryDto.getCurrentPage(),
summaryQueryDto.getTotalPage() == null ? 10 : summaryQueryDto.getTotalPage());
summaryQueryDto.setOrgCode(userBean.getOrgCode());
// 缺-部门id 搜索
List<SpmkApproveSummary> listAs = spmkApproveSummaryMapper.selectPageByQuery(page, summaryQueryDto);
return ResultUtil.data(listAs, "操作成功!");
}
//TODO 审批详情
/**
* 审批详情
*/
@GetMapping(value = "/select_approve_detail/{id}")
@ApiOperation(value = "19.审批详情", httpMethod = "GET", notes = "审批详情")
@ApiOperationSupport(order = 19)
public Result<Object> selectAd(@PathVariable Integer id) {
SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, id));
SpmkApproveDetailDto adD = SpmkApproveDetailDto.builder().build();
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord");
adD.setRequestData(ObjectUtil.unserialize(ad.getRequestData()));
adD.setFroms(ObjectUtil.unserialize(ad.getFroms()));
adD.setRouter((Router)ObjectUtil.unserialize(ad.getRouter()));
adD.setListFlowChildren((List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren()));
return ResultUtil.data(adD, "操作成功!");
}
......
......@@ -17,7 +17,7 @@ import cn.timer.api.dto.spmk.SpmkApprovalTemplateGDto;
@Repository
public interface SpmkApprovalTemplateGMapper extends BaseMapper<SpmkApprovalTemplateG> {
SpmkApprovalTemplateGDto selectListAtInAtg();
List<SpmkApprovalTemplateGDto> selectListAtInAtg();
boolean updateListRandsById(List<SpmkApprovalTemplateG> list);
......
package cn.timer.api.dao.spmk;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.dto.spmk.SummaryQueryDto;
/**
* 审批汇总
......@@ -14,4 +19,6 @@ import cn.timer.api.bean.spmk.SpmkApproveSummary;
@Repository
public interface SpmkApproveSummaryMapper extends BaseMapper<SpmkApproveSummary> {
List<SpmkApproveSummary> selectPageByQuery(IPage<SpmkApproveSummary> page,@Param("param") SummaryQueryDto summaryQueryDto);
}
package cn.timer.api.dto.spmk;
import java.util.List;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -11,12 +11,17 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Condition {
public class Condition implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String key;
private String format;
private String value;
}
package cn.timer.api.dto.spmk;
import java.io.Serializable;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FlowChildren implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 节点类型 1.creator-发起 2.audit-审批 3.copy-抄送 4.rules-规则
*/
private String className;
/**
* 执行
*/
private String execute;
/**
* 通过
*/
private Boolean flow;
/**
* 关系
*/
private List<Relation> relation;
}
package cn.timer.api.dto.spmk;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FromData implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String value;
private String id;
}
package cn.timer.api.dto.spmk;
import java.io.Serializable;
import java.util.List;
import lombok.AllArgsConstructor;
......@@ -11,9 +12,13 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Relation {
public class Relation implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 类型
*/
private String type;
......
package cn.timer.api.dto.spmk;
import java.io.Serializable;
import java.util.List;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONSupport;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -12,7 +14,12 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Router extends JSONSupport {
public class Router extends JSONSupport implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 节点类型
......
package cn.timer.api.dto.spmk;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import cn.timer.api.bean.spmk.SpmkApprovalTemplate;
import cn.timer.api.bean.spmk.SpmkApprovalTemplateG;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SpmkApprovalTemplateGDto extends SpmkApprovalTemplateG{
public class SpmkApprovalTemplateGDto implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "编号 编号", example = "101")
private Integer id;
@ApiModelProperty(value = "组名 ", example = "组名")
private String name;
@ApiModelProperty(value = "排序 排序", example = "101")
private Integer ranks;
@TableField(fill = FieldFill.INSERT_UPDATE)
@ApiModelProperty(value = "编辑时间 ", example = "编辑时间")
private Date updateTime;
private List<SpmkApprovalTemplate> spmkApprovalTemplates;
}
package cn.timer.api.dto.spmk;
import javax.persistence.Entity;
import java.util.List;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.SpmkApproveDetail;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
......@@ -38,5 +37,10 @@ public class SpmkApproveDetailDto {
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
private Router router;
@ApiModelProperty(value = "通过节点", example = "通过节点")
private List<FlowChildren> listFlowChildren;
@ApiModelProperty(value = "审批执行记录 ", example = "审批执行记录")
private SpmkApproveExecuteRecord spmkApproveExecuteRecord;
}
package cn.timer.api.dto.spmk;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -13,8 +20,29 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class SpmkApproveSummaryDto{
private SpmkApproveSummary spmkApproveSummary;
/*
* 审批汇总
*/
@ApiModelProperty(value = "标题 ", example = "标题")
private String title;
@ApiModelProperty(value = "审批名称 ", example = "审批名称")
private String approveName;
@ApiModelProperty(value = "发起人名称 ", example = "发起人名称")
private String initiator;
@ApiModelProperty(value = "申请数据 ", example = "申请数据")
private JSONObject requestData;
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
private JSONObject froms;
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
private Router router;
private SpmkApproveDetailDto spmkApproveDetailDto;
}
package cn.timer.api.dto.spmk;
import cn.hutool.json.JSONObject;
import cn.timer.api.utils.Page;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SummaryQueryDto extends Page{
private Integer orgCode;
private String query;
private Integer deptId;
private Integer sts;
private String startTime;
private String endTime;
private String[] empNums;
}
package cn.timer.api.dto.spmk;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -9,7 +11,12 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class User{
public class User implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
......
......@@ -6,12 +6,17 @@ import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.dto.spmk.Condition;
import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.dto.spmk.Relation;
import cn.timer.api.dto.spmk.Router;
import cn.timer.api.dto.spmk.User;
......@@ -34,9 +39,12 @@ public class RouterUtils {
private final static String RELATION_TYPE_DEPARTMENT = "department";
private final static String RELATION_TYPE_USERS = "users";
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse) {
return NextNode(listRouter, obj, isFirse, false);
}
// 执行下一个节点
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj) {
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse, boolean isAuditNext) {
Router router;
if (listRouter != null && listRouter.size() != 0) {
......@@ -55,8 +63,9 @@ public class RouterUtils {
Console.log("发起人逻辑");
router.setExecute(EXECUTED);
router.setFlow(true);
router.getRelation().get(0).setName(obj.get("name",String.class));
NextNode(router.getChildren(),obj);
router.getRelation().get(0).setName(obj.get("initiator",FromData.class).getValue());
NextNode(router.getChildren(),obj, isFirse, isAuditNext);
break;
case AUDIT:
Console.log("审批人逻辑");
......@@ -70,23 +79,30 @@ public class RouterUtils {
switch (execute) {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
// 首次发起申请时,写入 审批人名称 至 obj 中
if (isFirse) {
obj.put("current_approver", listUser.get(i).getName());
}
break user;
case EXECUTING:
listUser.get(i).setExecute(EXECUTED);
break;
// case EXECUTING:
// listUser.get(i).setExecute(EXECUTED);
// break;
}
}
isAuditNext = true;
NextNode(router.getChildren(),obj, isFirse, isAuditNext);
break;
case COPY:
if (!isAuditNext) {
router.setExecute(EXECUTED);
}
Console.log("抄送人逻辑");
router.setExecute(EXECUTED);
router.setFlow(true);
List<Relation> listRelations = router.getRelation();
for (int i = 0; i < listRelations.size(); i++) {
// 装配 部门人员
if (RELATION_TYPE_DEPARTMENT.equals(listRelations.get(i).getType())) {
List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(obj.get("orgCode",Integer.class), Integer.valueOf(listRelations.get(i).getDepartmentId()));
List<User> listUsers = new ArrayList<User>();
for (YgglMainEmp emp : listYgglMainEmp) {
User user = new User();
......@@ -99,47 +115,44 @@ public class RouterUtils {
// 直接跳过,此处 else if代码段 只做说明,可不写
}
}
NextNode(router.getChildren(),obj);
break;
default:
NextNode(router.getChildren(),obj, isFirse, isAuditNext);
break;
}
break;
case EXECUTING:
switch (router.getClassName()) {
case AUDIT:
Console.log("下一个审批人逻辑");
router.setFlow(true);
boolean executeFlog = true;
List<User> listUser = router.getRelation().get(0).getUsers();
user:
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
switch (execute) {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
if (!EXECUTED.equals(listUser.get(i).getExecute())) {
if (!isFirse) {
Console.log("下一个审批人逻辑");
boolean executeFlog = true;
List<User> listUser = router.getRelation().get(0).getUsers();
user:
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
switch (execute) {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
executeFlog = false;
break user;
case EXECUTING:
listUser.get(i).setExecute(EXECUTED);
break;
}
break user;
case EXECUTING:
listUser.get(i).setExecute(EXECUTED);
break;
}
if (executeFlog) {
router.setExecute(EXECUTED);
}
if (executeFlog) {
router.setExecute(EXECUTED);
}
NextNode(router.getChildren(),obj);
break;
default:
NextNode(router.getChildren(),obj, isFirse, isAuditNext);
break;
}
break;
case EXECUTED:
Console.log("下一个节点");
NextNode(router.getChildren(),obj);
NextNode(router.getChildren(),obj, isFirse, isAuditNext);
break;
}
......@@ -156,7 +169,7 @@ public class RouterUtils {
}else {
for (Condition condition : listCondition) {
// 判断条件
if (!stringCompare(obj.get(condition.getKey(),String.class), condition.getValue(), condition.getFormat())) {
if (!stringCompare(obj.get(condition.getKey(),FromData.class).getValue(), condition.getValue(), condition.getFormat())) {
condition_b = false;
}
}
......@@ -164,169 +177,29 @@ public class RouterUtils {
routerRule.setFlow(condition_b);
routerRule.setExecute(EXECUTED);
if (routerRule.getFlow() == true) {
if (routerRule.getFlow()) {
Console.log("条件逻辑");
NextNode(routerRule.getChildren(),obj);
NextNode(routerRule.getChildren(),obj, isFirse, isAuditNext);
}
break;
case EXECUTED:
NextNode(routerRule.getChildren(),obj);
if (routerRule.getFlow()) {
NextNode(routerRule.getChildren(),obj, isFirse, isAuditNext);
}
break rulefor;
}
}
Console.log("特殊情况!");
Console.log("最后节点");
}
}
return listRouter;
};
// 执行下一个节点
public static List<Router> NextNode_bak(List<Router> listRouter,JSONObject obj) {
Router router;
if (listRouter != null && listRouter.size() != 0) {
// 非条件节点
if (listRouter.size() == 1) {
router = listRouter.get(0);
// 0未执行 1执行中 2已执行
switch (router.getExecute()) {
case UNEXECUTED:
switch (router.getClassName()) {
case CREATOR:
Console.log("发起人逻辑");
router.setExecute(EXECUTED);
router.setFlow(true);
router.getRelation().get(0).setName(obj.get("name",String.class));
NextNode(router.getChildren(),obj);
break;
case AUDIT:
Console.log("审批人逻辑");
router.setExecute(EXECUTING);
router.setFlow(true);
List<User> listUser = router.getRelation().get(0).getUsers();
user:
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
switch (execute) {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
break user;
case EXECUTING:
listUser.get(i).setExecute(EXECUTED);
break;
}
}
break;
case COPY:
Console.log("抄送人逻辑");
router.setExecute(EXECUTED);
router.setFlow(true);
List<Relation> listRelations = router.getRelation();
for (int i = 0; i < listRelations.size(); i++) {
// 装配 部门人员
if (RELATION_TYPE_DEPARTMENT.equals(listRelations.get(i).getType())) {
List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(obj.get("orgCode",Integer.class), Integer.valueOf(listRelations.get(i).getDepartmentId()));
List<User> listUsers = new ArrayList<User>();
for (YgglMainEmp emp : listYgglMainEmp) {
User user = new User();
user.setName(emp.getName());
user.setId(String.valueOf(emp.getEmpNum()));
listUsers.add(user);
}
}else if (RELATION_TYPE_USERS.equals(listRelations.get(i).getType())) {
}
}
NextNode(router.getChildren(),obj);
break;
default:
break;
}
break;
case EXECUTING:
switch (router.getClassName()) {
case AUDIT:
Console.log("下一个审批人逻辑");
router.setFlow(true);
boolean executeFlog = true;
List<User> listUser = router.getRelation().get(0).getUsers();
user:
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
switch (execute) {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
if (!EXECUTED.equals(listUser.get(i).getExecute())) {
executeFlog = false;
}
break user;
case EXECUTING:
listUser.get(i).setExecute(EXECUTED);
break;
}
}
if (executeFlog) {
router.setExecute(EXECUTED);
}
NextNode(router.getChildren(),obj);
break;
default:
break;
}
break;
case EXECUTED:
Console.log("下一个节点");
NextNode(router.getChildren(),obj);
break;
}
} else {
// 条件节点
rulefor:
for (Router routerRule : listRouter) {
switch (routerRule.getExecute()) {
case UNEXECUTED:
boolean condition_b = true;
List<Condition> listCondition = routerRule.getCondition();
if (listCondition == null || listCondition.size() == 0) {
routerRule.setFlow(true);
}else {
for (Condition condition : listCondition) {
// 判断条件
if (!stringCompare(obj.get(condition.getKey(),String.class), condition.getValue(), condition.getFormat())) {
condition_b = false;
}
}
}
routerRule.setFlow(condition_b);
routerRule.setExecute(EXECUTED);
if (routerRule.getFlow() == true) {
Console.log("条件逻辑");
NextNode(routerRule.getChildren(),obj);
}
break;
case EXECUTED:
NextNode(routerRule.getChildren(),obj);
break rulefor;
}
}
Console.log("特殊情况!");
}
}
return listRouter;
};
public static List<YgglMainEmp> selectOtherlistent(Integer orgCode, Integer id){
ArrayList<Integer> list = new ArrayList<Integer>();
......@@ -380,6 +253,46 @@ public class RouterUtils {
}
return false;
}
public static void getIsFlowChildren(List<Router> listRouter, List<FlowChildren> listFlowChildren) {
// TODO Auto-generated method stub
Router router;
if (listRouter != null && listRouter.size() == 1) {
router = listRouter.get(0);
if (router.getFlow()) {
FlowChildren fc = FlowChildren.builder().build();
BeanUtil.copyProperties(router, fc, "condition","children");
listFlowChildren.add(fc);
getIsFlowChildren(router.getChildren(), listFlowChildren);
}
}else if (listRouter.size() > 1) {
for (Router router2 : listRouter) {
if (router2.getFlow()) {
// FlowChildren fc = FlowChildren.builder().build();
// BeanUtil.copyProperties(router2, fc, "condition","children");
// listFlowChildren.add(fc);
getIsFlowChildren(router2.getChildren(), listFlowChildren);
}
}
}
};
......
......@@ -4,7 +4,6 @@
<mapper namespace="cn.timer.api.dao.spmk.SpmkApprovalGMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApprovalG" >
<id column="id" property="id" />
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="name" property="name" />
......@@ -13,14 +12,13 @@
</resultMap>
<resultMap id="BaseResultMapDto" type="cn.timer.api.dto.spmk.SpmkApprovalGDto" >
<id column="id" property="id" />
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="name" property="name" />
<result column="ranks" property="ranks" />
<result column="is_editable" property="isEditable" />
<collection column="SpmkCustomApproval_id" property="spmkCustomApprovals" ofType="cn.timer.api.bean.spmk.SpmkCustomApproval"
resultMap="cn.timer.api.bean.spmk.SpmkCustomApproval.BaseResultMap" columnPrefix="SpmkCustomApproval_">
resultMap="cn.timer.api.dao.spmk.SpmkCustomApprovalMapper.BaseResultMap" columnPrefix="SpmkCustomApproval_">
</collection>
</resultMap>
......@@ -42,35 +40,44 @@
is_editable SpmkApprovalG_is_editable
</sql>
<sql id="Base_Column_List_Alias_ca">
id SpmkCustomApproval_id,
org_code SpmkCustomApproval_org_code,
approval_g_id SpmkCustomApproval_approval_g_id,
icon_url SpmkCustomApproval_icon_url,
name SpmkCustomApproval_name,
description SpmkCustomApproval_description,
is_open SpmkCustomApproval_is_open,
ranks SpmkCustomApproval_ranks,
is_opinion SpmkCustomApproval_is_opinion,
update_time SpmkCustomApproval_update_time,
create_time SpmkCustomApproval_create_time,
asso_type SpmkCustomApproval_asso_type,
froms SpmkCustomApproval_froms,
router SpmkCustomApproval_router
<sql id="Base_Column_List_Alias_a">
a.id,
a.org_code,
a.name,
a.ranks,
a.is_editable
</sql>
<sql id="Base_Column_List_Alias_ca">
b.id SpmkCustomApproval_id,
b.org_code SpmkCustomApproval_org_code,
b.approval_g_id SpmkCustomApproval_approval_g_id,
b.icon_url SpmkCustomApproval_icon_url,
b.name SpmkCustomApproval_name,
b.description SpmkCustomApproval_description,
b.is_open SpmkCustomApproval_is_open,
b.ranks SpmkCustomApproval_ranks,
b.is_opinion SpmkCustomApproval_is_opinion,
b.update_time SpmkCustomApproval_update_time,
b.create_time SpmkCustomApproval_create_time,
b.asso_type SpmkCustomApproval_asso_type,
b.froms SpmkCustomApproval_froms,
b.router SpmkCustomApproval_router
</sql>
<select id="selectListAgInCa" resultMap="BaseResultMapDto">
SELECT
<include refid="Base_Column_List_Alias" />,
<include refid="Base_Column_List_Alias_a" />,
<include refid="Base_Column_List_Alias_ca" />
FROM spmk_approval_g a
LEFT JOIN spmk_custom_approval b IN a.id = b.approval_g_id
LEFT JOIN spmk_custom_approval b ON a.id = b.approval_g_id
WHERE b.org_code = #{org_code} AND b.id in
(
SELECT custom_approval_id FROM spmk_initiator_config WHERE emp_num = #{emp_num} GROUP BY custom_approval_id
)
ORDER BY a.ranks, b.ranks
</select>
<update id="updateListRandsById" parameterType="list">
......
......@@ -4,7 +4,6 @@
<mapper namespace="cn.timer.api.dao.spmk.SpmkApprovalTemplateGMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApprovalTemplateG" >
<id column="id" property="id" />
<id column="id" property="id" />
<result column="name" property="name" />
<result column="ranks" property="ranks" />
......@@ -12,13 +11,12 @@
</resultMap>
<resultMap id="BaseResultMapDto" type="cn.timer.api.dto.spmk.SpmkApprovalTemplateGDto" >
<id column="id" property="id" />
<id column="id" property="id" />
<result column="name" property="name" />
<result column="ranks" property="ranks" />
<result column="update_time" property="updateTime" />
<collection column="SpmkApprovalTemplate_id" property="spmkApprovalTemplates" ofType="cn.timer.api.bean.spmk.SpmkApprovalTemplate"
resultMap="cn.timer.api.bean.spmk.SpmkApprovalTemplate.BaseResultMap" columnPrefix="SpmkApprovalTemplate_">
resultMap="cn.timer.api.dao.spmk.SpmkApprovalTemplateMapper.BaseResultMap" columnPrefix="SpmkApprovalTemplate_">
</collection>
</resultMap>
......@@ -36,29 +34,36 @@
update_time SpmkApprovalTemplateG_update_time
</sql>
<sql id="Base_Column_List_Alias_a">
a.id,
a.name,
a.ranks,
a.update_time
</sql>
<sql id="Base_Column_List_Alias_at">
id SpmkApprovalTemplate_id,
approval_template_g_id SpmkApprovalTemplate_approval_template_g_id,
icon_url SpmkApprovalTemplate_icon_url,
name SpmkApprovalTemplate_name,
description SpmkApprovalTemplate_description,
is_open SpmkApprovalTemplate_is_open,
ranks SpmkApprovalTemplate_ranks,
is_opinion SpmkApprovalTemplate_is_opinion,
update_time SpmkApprovalTemplate_update_time,
create_time SpmkApprovalTemplate_create_time,
asso_type SpmkApprovalTemplate_asso_type,
froms SpmkApprovalTemplate_froms,
router SpmkApprovalTemplate_router
b.id SpmkApprovalTemplate_id,
b.approval_template_g_id SpmkApprovalTemplate_approval_template_g_id,
b.icon_url SpmkApprovalTemplate_icon_url,
b.name SpmkApprovalTemplate_name,
b.description SpmkApprovalTemplate_description,
b.is_open SpmkApprovalTemplate_is_open,
b.ranks SpmkApprovalTemplate_ranks,
b.is_opinion SpmkApprovalTemplate_is_opinion,
b.update_time SpmkApprovalTemplate_update_time,
b.create_time SpmkApprovalTemplate_create_time,
b.asso_type SpmkApprovalTemplate_asso_type,
b.froms SpmkApprovalTemplate_froms,
b.router SpmkApprovalTemplate_router
</sql>
<select id="selectListAtInAtg" resultMap="BaseResultMapDto">
SELECT
<include refid="Base_Column_List_Alias" />,
<include refid="Base_Column_List_Alias_a" />,
<include refid="Base_Column_List_Alias_at" />
FROM spmk_approval_template_g a
LEFT JOIN spmk_approval_template b IN a.id = b.approval_template_g_id
LEFT JOIN spmk_approval_template b ON a.id = b.approval_template_g_id
ORDER BY a.ranks, b.ranks
</select>
<update id="updateListRandsById" parameterType="list">
......
......@@ -4,7 +4,6 @@
<mapper namespace="cn.timer.api.dao.spmk.SpmkApprovalTemplateMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApprovalTemplate" >
<id column="id" property="id" />
<id column="id" property="id" />
<result column="approval_template_g_id" property="approvalTemplateGId" />
<result column="icon_url" property="iconUrl" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.spmk.SpmkApproveSummaryMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApproveSummary" >
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="emp_num" property="empNum" />
<result column="title" property="title" />
<result column="department_name" property="departmentName" />
<result column="initiator" property="initiator" />
<result column="create_time" property="createTime" />
<result column="approve_name" property="approveName" />
<result column="sts" property="sts" />
<result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" />
<result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" />
<result column="digest" property="digest" />
</resultMap>
<sql id="Base_Column_List">
id,
org_code,
emp_num,
title,
department_name,
initiator,
create_time,
approve_name,
sts,
current_approver,
history_approver,
update_time,
end_time,
digest
</sql>
<sql id="Base_Column_List_a">
a.id,
a.org_code,
a.emp_num,
a.title,
a.department_name,
a.initiator,
a.create_time,
a.approve_name,
a.sts,
a.current_approver,
a.history_approver,
a.update_time,
a.end_time,
a.digest
</sql>
<sql id="Base_Column_List_Alias">
id SpmkApproveSummary_id,
org_code SpmkApproveSummary_org_code,
emp_num SpmkApproveSummary_emp_num,
title SpmkApproveSummary_title,
department_name SpmkApproveSummary_department_name,
initiator SpmkApproveSummary_initiator,
create_time SpmkApproveSummary_create_time,
approve_name SpmkApproveSummary_approve_name,
sts SpmkApproveSummary_sts,
current_approver SpmkApproveSummary_current_approver,
history_approver SpmkApproveSummary_history_approver,
update_time SpmkApproveSummary_update_time,
end_time SpmkApproveSummary_end_time,
digest SpmkApproveSummary_digest
</sql>
<select id="selectPageByQuery" resultMap="BaseResultMap" >
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num)) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num) )) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num) )) as bm_name
FROM spmk_approve_summary a
WHERE 1 = 1
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT(#{param.query},'%') or
a.initiator like CONCAT(#{param.query},'%') or
a.id like CONCAT(#{param.query},'%')
)
</if>
<if test="param.startTime != null and param.startTime != ''">
and a.create_time <![CDATA[ >= ]]> #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and qlb.create_time <![CDATA[ <= ]]> #{param.endTime}
</if>
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkApproveSummary">
INSERT INTO spmk_approve_summary
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != orgCode'>
org_code,
</if>
<if test ='null != empNum'>
emp_num,
</if>
<if test ='null != title'>
title,
</if>
<if test ='null != departmentName'>
department_name,
</if>
<if test ='null != initiator'>
initiator,
</if>
<if test ='null != createTime'>
create_time,
</if>
<if test ='null != approveName'>
approve_name,
</if>
<if test ='null != sts'>
sts,
</if>
<if test ='null != currentApprover'>
current_approver,
</if>
<if test ='null != historyApprover'>
history_approver,
</if>
<if test ='null != updateTime'>
update_time,
</if>
<if test ='null != endTime'>
end_time,
</if>
<if test ='null != digest'>
digest
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != orgCode'>
#{orgCode},
</if>
<if test ='null != empNum'>
#{empNum},
</if>
<if test ='null != title'>
#{title},
</if>
<if test ='null != departmentName'>
#{departmentName},
</if>
<if test ='null != initiator'>
#{initiator},
</if>
<if test ='null != createTime'>
#{createTime},
</if>
<if test ='null != approveName'>
#{approveName},
</if>
<if test ='null != sts'>
#{sts},
</if>
<if test ='null != currentApprover'>
#{currentApprover},
</if>
<if test ='null != historyApprover'>
#{historyApprover},
</if>
<if test ='null != updateTime'>
#{updateTime},
</if>
<if test ='null != endTime'>
#{endTime},
</if>
<if test ='null != digest'>
#{digest}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM spmk_approve_summary
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.spmk.SpmkApproveSummary">
UPDATE spmk_approve_summary
<set>
<if test ='null != orgCode'>org_code = #{orgCode},</if>
<if test ='null != empNum'>emp_num = #{empNum},</if>
<if test ='null != title'>title = #{title},</if>
<if test ='null != departmentName'>department_name = #{departmentName},</if>
<if test ='null != initiator'>initiator = #{initiator},</if>
<if test ='null != createTime'>create_time = #{createTime},</if>
<if test ='null != approveName'>approve_name = #{approveName},</if>
<if test ='null != sts'>sts = #{sts},</if>
<if test ='null != currentApprover'>current_approver = #{currentApprover},</if>
<if test ='null != historyApprover'>history_approver = #{historyApprover},</if>
<if test ='null != updateTime'>update_time = #{updateTime},</if>
<if test ='null != endTime'>end_time = #{endTime},</if>
<if test ='null != digest'>digest = #{digest}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM spmk_approve_summary
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM spmk_approve_summary
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM spmk_approve_summary
</select>
-->
</mapper>
\ No newline at end of file
......@@ -4,7 +4,6 @@
<mapper namespace="cn.timer.api.dao.spmk.SpmkCustomApprovalMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkCustomApproval" >
<id column="id" property="id" />
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="approval_g_id" property="approvalGId" />
......
......@@ -4,7 +4,6 @@
<mapper namespace="cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkInitiatorConfig" >
<id column="id" property="id" />
<id column="id" property="id" />
<result column="custom_approval_id" property="customApprovalId" />
<result column="asso_id" property="assoId" />
......
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