| @@ -5,6 +5,7 @@ import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxFlowConfig; | |||||
| import com.iformall.domain.po.WxFlowModel; | import com.iformall.domain.po.WxFlowModel; | ||||
| import com.iformall.domain.po.WxFlowRecord; | import com.iformall.domain.po.WxFlowRecord; | ||||
| import com.iformall.enums.EnumFlowRecordStatus; | import com.iformall.enums.EnumFlowRecordStatus; | ||||
| @@ -13,6 +14,7 @@ import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.collections.CollectionUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -224,9 +226,9 @@ public class WxFlowAbleController extends BaseController { | |||||
| @ApiOperation(value = "删除模板") | @ApiOperation(value = "删除模板") | ||||
| @PostMapping(value = "delModel") | @PostMapping(value = "delModel") | ||||
| @SystemControllerLog(description = "工作流-删除模板") | @SystemControllerLog(description = "工作流-删除模板") | ||||
| public ResultData delModel(@ModelAttribute WxFlowModel wxFlowModel) { | |||||
| public ResultData delModel(@RequestBody WxFlowModel wxFlowModel) { | |||||
| wxFlowModel.setTenantId(getTenantId()); | wxFlowModel.setTenantId(getTenantId()); | ||||
| return wxFlowService.createModel(wxFlowModel); | |||||
| return wxFlowService.delModel(wxFlowModel); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -255,10 +257,43 @@ public class WxFlowAbleController extends BaseController { | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | ||||
| }) | }) | ||||
| @SystemControllerLog(description = "工作流-配置列表") | @SystemControllerLog(description = "工作流-配置列表") | ||||
| public ResultData configList(@ModelAttribute WxFlowModel wxFlowModel,Integer pageNum, Integer pageSize) { | |||||
| public ResultData configList(@ModelAttribute WxFlowConfig wxFlowConfig, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] FlowAbleController::modelList"); | logger.debug("[" + getIpAddr() + "] FlowAbleController::modelList"); | ||||
| wxFlowModel.setTenantId(getTenantId()); | |||||
| return new ResultData(wxFlowService.modelList(wxFlowModel,pageNum,pageSize)); | |||||
| wxFlowConfig.setTenantId(getTenantId()); | |||||
| if(pageSize == null){ | |||||
| pageSize = 99999999; | |||||
| } | |||||
| if(pageNum == null){ | |||||
| pageNum = 1; | |||||
| } | |||||
| PageInfo<WxFlowConfig> pageInfo = wxFlowService.configList(wxFlowConfig,pageNum,pageSize); | |||||
| List<WxFlowConfig> list = pageInfo.getList(); | |||||
| for (WxFlowConfig c:list) { | |||||
| if(CollectionUtils.isNotEmpty(c.getChilds())){ | |||||
| for (WxFlowConfig ch:c.getChilds()) { | |||||
| if(ch.getModelId() != null){ | |||||
| WxFlowModel query = new WxFlowModel(); | |||||
| query.setId(ch.getModelId()); | |||||
| ch.setWxFlowModel((WxFlowModel)wxFlowService.findModelById(query).data); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| pageInfo.setList(list); | |||||
| return new ResultData(pageInfo); | |||||
| } | } | ||||
| /** | |||||
| * 类型设置 | |||||
| */ | |||||
| @ApiOperation(value = "类型设置") | |||||
| @PostMapping(value = "updateConfig") | |||||
| @SystemControllerLog(description = "工作流-类型设置") | |||||
| public ResultData updateConfig(@RequestBody WxFlowConfig wxFlowConfig) { | |||||
| wxFlowConfig.setTenantId(getTenantId()); | |||||
| return wxFlowService.updateConfig(wxFlowConfig); | |||||
| } | |||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import lombok.ToString; | import lombok.ToString; | ||||
| @@ -36,6 +37,9 @@ public class WxFlowConfig extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="模板id",name="modelId") | @io.swagger.annotations.ApiModelProperty(value="模板id",name="modelId") | ||||
| private Long modelId; | private Long modelId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="父类ID",name="parentId") | |||||
| private Long parentId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建日期",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建日期",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||||
| import com.iformall.domain.vo.UserTaskVo; | import com.iformall.domain.vo.UserTaskVo; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| @@ -10,4 +10,10 @@ import java.util.List; | |||||
| public interface WxFlowConfigMapper extends CommonMapper<WxFlowConfig, Long> { | public interface WxFlowConfigMapper extends CommonMapper<WxFlowConfig, Long> { | ||||
| List<WxFlowConfig> findList(WxFlowConfig wxFlowConfig); | List<WxFlowConfig> findList(WxFlowConfig wxFlowConfig); | ||||
| /** | |||||
| * 查找所有子 | |||||
| * @return | |||||
| */ | |||||
| List<WxFlowConfig> findChildList(); | |||||
| } | } | ||||
| @@ -12,4 +12,5 @@ import java.util.List; | |||||
| public interface WxFlowModelMapper extends CommonMapper<WxFlowModel, Long> { | public interface WxFlowModelMapper extends CommonMapper<WxFlowModel, Long> { | ||||
| List<WxFlowModel> findList(WxFlowModel wxFlowModel); | List<WxFlowModel> findList(WxFlowModel wxFlowModel); | ||||
| WxFlowModel selectById(Long id); | |||||
| } | } | ||||
| @@ -2,10 +2,12 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxFlowConfig; | |||||
| import com.iformall.domain.po.WxFlowModel; | import com.iformall.domain.po.WxFlowModel; | ||||
| import com.iformall.domain.po.WxFlowRecord; | import com.iformall.domain.po.WxFlowRecord; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | import org.springframework.web.bind.annotation.RequestBody; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| /** | /** | ||||
| @@ -112,4 +114,16 @@ public interface WxFlowService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxFlowModel> modelList(WxFlowModel wxFlowModel,Integer pageIndex, Integer pageSize); | PageInfo<WxFlowModel> modelList(WxFlowModel wxFlowModel,Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 配置列表 | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxFlowConfig> configList(WxFlowConfig wxFlowConfig, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 类型配置 | |||||
| * @return | |||||
| */ | |||||
| ResultData updateConfig(WxFlowConfig wxFlowConfig); | |||||
| } | } | ||||
| @@ -97,6 +97,8 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| private WxBillOtherDepositMapper wxBillOtherDepositMapper; | private WxBillOtherDepositMapper wxBillOtherDepositMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxFlowModelMapper wxFlowModelMapper; | private WxFlowModelMapper wxFlowModelMapper; | ||||
| @Autowired | |||||
| private WxFlowConfigMapper wxFlowConfigMapper; | |||||
| /** | /** | ||||
| * 获取流程key | * 获取流程key | ||||
| @@ -1159,9 +1161,9 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| process.addFlowElement(sequenceFlow); | process.addFlowElement(sequenceFlow); | ||||
| wxFlowModel.setFlow(JsonUtil.obj2Json(wxFlowModel)); | wxFlowModel.setFlow(JsonUtil.obj2Json(wxFlowModel)); | ||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| wxFlowModel.setId(idWorker.nextId()); | |||||
| if(wxFlowModel.getId() == null) { | if(wxFlowModel.getId() == null) { | ||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| wxFlowModel.setId(idWorker.nextId()); | |||||
| wxFlowModelMapper.insertSelective(wxFlowModel); | wxFlowModelMapper.insertSelective(wxFlowModel); | ||||
| }else{ | }else{ | ||||
| wxFlowModel.setUpdateDate(new Date()); | wxFlowModel.setUpdateDate(new Date()); | ||||
| @@ -1230,4 +1232,15 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| wxFlowModelMapper.deleteByPrimaryKey(wxFlowModel.getId()); | wxFlowModelMapper.deleteByPrimaryKey(wxFlowModel.getId()); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxFlowConfig> configList(WxFlowConfig wxFlowConfig, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFlowConfigMapper.findList(wxFlowConfig)); | |||||
| } | |||||
| @Override | |||||
| public ResultData updateConfig(WxFlowConfig wxFlowConfig) { | |||||
| wxFlowConfigMapper.updateByPrimaryKeySelective(wxFlowConfig); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||
| @@ -5,20 +5,20 @@ | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFlowConfig"> | <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFlowConfig"> | ||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenantId" property="tenantId" /> | <result column="tenantId" property="tenantId" /> | ||||
| <result column="parent_id" property="parentId" /> | <result column="parent_id" property="parentId" /> | ||||
| <result column="name" property="name" /> | <result column="name" property="name" /> | ||||
| <result column="type" property="type" /> | <result column="type" property="type" /> | ||||
| <result column="status" property="status" /> | <result column="status" property="status" /> | ||||
| <result column="model_id" property="modelId" /> | <result column="model_id" property="modelId" /> | ||||
| <result column="create_date" property="createDate" /> | <result column="create_date" property="createDate" /> | ||||
| <result column="update_date" property="updateDate" /> | <result column="update_date" property="updateDate" /> | ||||
| <collection fetchType="eager" property="childs" ofType="WxFlowConfig" column="id" select="findChildList"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | |||||
| where parent_id =0 | |||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -26,16 +26,16 @@ | |||||
| <if test=" null != name "> and `name` like concat('%', #{name},'%') </if> | <if test=" null != name "> and `name` like concat('%', #{name},'%') </if> | ||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| <if test=" null == sortColumns"> order by id desc </if> | |||||
| <if test=" null == sortColumns"> order by id asc </if> | |||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxFlowModel" resultMap="BaseResultMap"> | |||||
| select * from wx_flow_model | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxFlowConfig" resultMap="BaseResultMap"> | |||||
| select * from wx_flow_config | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findChildList" resultType="WxFlowConfig"> | |||||
| SELECT * FROM wx_flow_config WHERE parent_id = #{id} ORDER BY id ASC | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -5,7 +5,6 @@ | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFlowModel"> | <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxFlowModel"> | ||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenantId" property="tenantId" /> | <result column="tenantId" property="tenantId" /> | ||||
| <result column="name" property="name" /> | <result column="name" property="name" /> | ||||
| <result column="flow" property="flow" /> | <result column="flow" property="flow" /> | ||||
| <result column="create_user" property="createUser" /> | <result column="create_user" property="createUser" /> | ||||
| @@ -32,6 +31,9 @@ | |||||
| </select> | </select> | ||||
| <select id="selectById" resultMap="BaseResultMap"> | |||||
| select * from wx_flow_model where id=#{id} | |||||
| </select> | |||||