parent
01287aa2af
commit
4fc200e39c
17 changed files with 599 additions and 203 deletions
@ -0,0 +1,48 @@ |
||||
package com.daqing.financial.guarantee.controller; |
||||
|
||||
import com.daqing.financial.guarantee.model.request.DgFormDesignRequest; |
||||
import com.daqing.financial.guarantee.model.response.DgFormDesignListResponse; |
||||
import com.daqing.financial.guarantee.service.IDgFormDesignService; |
||||
import com.daqing.framework.model.response.ResponseResult; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
/** |
||||
* 表单设计控制层 |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/15 10:38 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/form/design") |
||||
@Api(value = "表单设计", tags = "后台表单设计") |
||||
public class DgFormDesignController { |
||||
|
||||
|
||||
@Autowired |
||||
private IDgFormDesignService dgFormDesignService; |
||||
|
||||
/** |
||||
* 列表 |
||||
*/ |
||||
@GetMapping("/list") |
||||
@ApiOperation(value = "根据节点id返回当前节点的表单字段", response = DgFormDesignListResponse.class) |
||||
public ResponseResult list(@RequestParam("processId") Integer processId) { |
||||
|
||||
return ResponseResult.SUCCESS(dgFormDesignService.list(processId)); |
||||
} |
||||
|
||||
/** |
||||
* 修改 |
||||
*/ |
||||
@PostMapping("/update") |
||||
@ApiOperation(value = "修改操作") |
||||
public ResponseResult update(@RequestBody DgFormDesignRequest dgFormDesignRequest) { |
||||
|
||||
Boolean result = dgFormDesignService.update(dgFormDesignRequest); |
||||
|
||||
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
package com.daqing.financial.guarantee.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.daqing.financial.guarantee.model.request.DgFormDesignRequest; |
||||
import com.daqing.framework.domain.guarantee.DgFormDesign; |
||||
import com.daqing.framework.domain.guarantee.po.DgFormDesignPO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 表单设计持久层接口 |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/15 10:57 |
||||
*/ |
||||
@Mapper |
||||
public interface DgFormDesignMapper extends BaseMapper<DgFormDesign> { |
||||
|
||||
List<DgFormDesignPO> list(Integer processId); |
||||
|
||||
Boolean update(@Param("fd") DgFormDesignRequest dgFormDesignRequest); |
||||
|
||||
Integer getOperationProcessIdById(Integer id); |
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.daqing.financial.guarantee.model.request; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.ToString; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 表单设计请求类 |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/15 15:28 |
||||
*/ |
||||
@Data |
||||
@ToString |
||||
public class DgFormDesignRequest implements Serializable { |
||||
|
||||
@ApiModelProperty("id") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty("名称") |
||||
private String name; |
||||
|
||||
@ApiModelProperty("是否可以隐藏,0:可以但没隐藏,1:不可以,2:可以并已隐藏") |
||||
private Integer ifConceal; |
||||
|
||||
@ApiModelProperty("是否必填,0:是,1:否") |
||||
private Integer ifRequired; |
||||
|
||||
@ApiModelProperty("提示信息") |
||||
private String prompt; |
||||
|
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.daqing.financial.guarantee.model.response; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.ToString; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 表单设计返回列表实体类 |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/15 14:32 |
||||
*/ |
||||
@Data |
||||
@ToString |
||||
public class DgFormDesignListResponse implements Serializable { |
||||
|
||||
@ApiModelProperty("id") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty("名称") |
||||
private String name; |
||||
|
||||
@ApiModelProperty("是否可以隐藏,0:可以但没隐藏,1:不可以,2:可以并已隐藏") |
||||
private Integer ifConceal; |
||||
|
||||
@ApiModelProperty("是否必填,0:是,1:否") |
||||
private Integer ifRequired; |
||||
|
||||
@ApiModelProperty("是否可以操作,0:是,1:否") |
||||
private Integer ifOperation; |
||||
|
||||
@ApiModelProperty("原本名称") |
||||
private String formerName; |
||||
|
||||
@ApiModelProperty("提示信息") |
||||
private String prompt; |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package com.daqing.financial.guarantee.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.daqing.financial.guarantee.model.request.DgFormDesignRequest; |
||||
import com.daqing.financial.guarantee.model.response.DgFormDesignListResponse; |
||||
import com.daqing.framework.domain.guarantee.DgFormDesign; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @auther River |
||||
* @date 2021/1/15 10:39 |
||||
*/ |
||||
public interface IDgFormDesignService extends IService<DgFormDesign> { |
||||
|
||||
List<DgFormDesignListResponse> list(Integer processId); |
||||
|
||||
Boolean update(DgFormDesignRequest dgFormDesignRequest); |
||||
} |
@ -0,0 +1,82 @@ |
||||
package com.daqing.financial.guarantee.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.daqing.financial.guarantee.mapper.DgFormDesignMapper; |
||||
import com.daqing.financial.guarantee.mapper.DgProcessManageMapper; |
||||
import com.daqing.financial.guarantee.model.request.DgFormDesignRequest; |
||||
import com.daqing.financial.guarantee.model.response.DgFormDesignListResponse; |
||||
import com.daqing.financial.guarantee.service.IDgFormDesignService; |
||||
import com.daqing.framework.domain.guarantee.DgFormDesign; |
||||
import com.daqing.framework.domain.guarantee.GuaranteeCode; |
||||
import com.daqing.framework.domain.guarantee.po.DgFormDesignPO; |
||||
import com.daqing.framework.exception.ExceptionCast; |
||||
import com.daqing.framework.model.response.CommonCode; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 表单设计业务层实现类 |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/15 10:40 |
||||
*/ |
||||
@Service |
||||
public class DgFormDesignServiceImpl extends ServiceImpl<DgFormDesignMapper, DgFormDesign> implements IDgFormDesignService { |
||||
|
||||
@Autowired |
||||
private DgProcessManageMapper dgProcessManageMapper; |
||||
|
||||
/** |
||||
* 列表 |
||||
*/ |
||||
@Override |
||||
public List<DgFormDesignListResponse> list(Integer processId) { |
||||
if (processId == null) { |
||||
ExceptionCast.cast(GuaranteeCode.FROM_DESIGN_PROCESS_ERROR); |
||||
} |
||||
List<DgFormDesignListResponse> responseList = new ArrayList<>(); |
||||
List<DgFormDesignPO> list = this.getBaseMapper().list(processId); |
||||
for (DgFormDesignPO dgFormDesignPO : list) { |
||||
DgFormDesignListResponse dgFormDesignListResponse = new DgFormDesignListResponse(); |
||||
// 当可操作节点与当前节点相同时表示可以操作
|
||||
if (processId.equals(dgFormDesignPO.getOperationProcessId())) { |
||||
dgFormDesignListResponse.setIfOperation(0); |
||||
} else { |
||||
dgFormDesignListResponse.setIfOperation(1); |
||||
} |
||||
BeanUtils.copyProperties(dgFormDesignPO, dgFormDesignListResponse); |
||||
responseList.add(dgFormDesignListResponse); |
||||
} |
||||
return responseList; |
||||
} |
||||
|
||||
/** |
||||
* 修改 |
||||
*/ |
||||
@Transactional |
||||
@Override |
||||
public Boolean update(DgFormDesignRequest dgFormDesignRequest) { |
||||
if (dgFormDesignRequest.getId() == null || dgFormDesignRequest.getIfConceal() == null |
||||
|| dgFormDesignRequest.getIfRequired() == null) { |
||||
ExceptionCast.cast(CommonCode.INVALID_PARAM); |
||||
} |
||||
if (dgFormDesignRequest.getName() == null || dgFormDesignRequest.getName().length() == 0) { |
||||
ExceptionCast.cast(GuaranteeCode.FROM_DESIGN_NAME_NOT_NULL); |
||||
} |
||||
// 获取当前字段的操作节点id
|
||||
Integer operationProcessId = this.getBaseMapper().getOperationProcessIdById(dgFormDesignRequest.getId()); |
||||
if (operationProcessId != null) { |
||||
Boolean result = dgProcessManageMapper.updateTimeByModelId(operationProcessId, new Date()); |
||||
if (result) { |
||||
return this.getBaseMapper().update(dgFormDesignRequest); |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,22 @@ |
||||
<?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="com.daqing.financial.guarantee.mapper.DgFormDesignMapper"> |
||||
|
||||
<!-- 根据节点id查询对应的表单字段 --> |
||||
<select id="list" parameterType="integer" resultType="com.daqing.framework.domain.guarantee.po.DgFormDesignPO"> |
||||
SELECT id,name,if_conceal,operation_process_id,if_required,former_name,prompt |
||||
FROM dg_form_design |
||||
WHERE FIND_IN_SET(#{processId},process_id) |
||||
</select> |
||||
|
||||
<update id="update" parameterType="com.daqing.financial.guarantee.model.request.DgFormDesignRequest"> |
||||
UPDATE dg_form_design SET name = #{fd.name},if_conceal = #{fd.ifConceal},if_required = #{fd.ifRequired},prompt = #{fd.prompt} |
||||
WHERE id = #{fd.id} |
||||
</update> |
||||
|
||||
<!-- 根据节点id获取当前操作节点id --> |
||||
<select id="getOperationProcessIdById" parameterType="integer" resultType="integer"> |
||||
SELECT operation_process_id FROM dg_form_design WHERE id = #{id} |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,67 @@ |
||||
package com.daqing.framework.domain.guarantee; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import lombok.ToString; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 表单设计实体类 |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/15 10:47 |
||||
*/ |
||||
@Data |
||||
@ToString |
||||
@TableName("dg_form_design") |
||||
public class DgFormDesign implements Serializable { |
||||
|
||||
private Integer id; |
||||
|
||||
/** |
||||
* 姓名 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 属于节点 |
||||
*/ |
||||
private String processId; |
||||
|
||||
/** |
||||
* 是否可以隐藏 |
||||
*/ |
||||
private Integer ifConceal; |
||||
|
||||
/** |
||||
* 可操作节点 |
||||
*/ |
||||
private Integer operationProcessId; |
||||
|
||||
/** |
||||
* 是否必填 |
||||
*/ |
||||
private Integer ifRequired; |
||||
|
||||
/** |
||||
* 原本名称 |
||||
*/ |
||||
private String formerName; |
||||
|
||||
/** |
||||
* 提示信息 |
||||
*/ |
||||
private String prompt; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
private Date updateTime; |
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.daqing.framework.domain.guarantee.po; |
||||
|
||||
import lombok.Data; |
||||
import lombok.ToString; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 表单设计 |
||||
* |
||||
* @auther River |
||||
* @date 2021/1/15 14:12 |
||||
*/ |
||||
@Data |
||||
@ToString |
||||
public class DgFormDesignPO implements Serializable { |
||||
|
||||
private Integer id; |
||||
|
||||
/** |
||||
* 名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 是否隐藏 |
||||
*/ |
||||
private Integer ifConceal; |
||||
|
||||
/** |
||||
* 是否必填 |
||||
*/ |
||||
private Integer ifRequired; |
||||
|
||||
/** |
||||
* 可操作节点 |
||||
*/ |
||||
private Integer operationProcessId; |
||||
|
||||
/** |
||||
* 原本名称 |
||||
*/ |
||||
private String formerName; |
||||
|
||||
/** |
||||
* 提示信息 |
||||
*/ |
||||
private String prompt; |
||||
} |
Loading…
Reference in new issue