根据申请标识获取本次申请的分部门申请信息

This commit is contained in:
wangliwen 2022-07-11 17:52:43 +08:00
parent c27d2c9c78
commit 15cc666261
6 changed files with 294 additions and 194 deletions

View File

@ -14,6 +14,8 @@ import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.excel.TAbilityApplicationExcel;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -26,31 +28,80 @@ import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 能力申请表单
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-04-13
*/
* 能力申请表单
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-04-13
*/
@RestController
@RequestMapping("processForm/tabilityapplication")
@Api(tags="能力申请表单")
@Api(tags = "能力申请表单")
public class TAbilityApplicationController {
@Autowired
private TAbilityApplicationService tAbilityApplicationService;
/**
* 根据申请时的情况做出分页
*
* @param params
* @return
*/
@GetMapping("my_page")
@ApiOperation("我的申请分页")
@LogOperation("我的申请分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
})
public Result<PageData<TAbilityApplicationDTO>> myPage(@ApiIgnore @RequestParam Map<String, Object> params) {
final UserDetail user = SecurityUser.getUser();
params.put("abilityprocess_v2", Boolean.TRUE); // 是否根据流程 abilityprocess_v2 来分页
params.put("user_id", user == null ? null : user.getId());
PageData<TAbilityApplicationDTO> page = tAbilityApplicationService.page(params);
return new Result<PageData<TAbilityApplicationDTO>>().ok(page);
}
@GetMapping("getByApplyFlag/{applyFlag}")
@ApiOperation("根据申请标识获取能力申请信息")
@LogOperation("根据申请标识获取能力申请信息")
public Result<Map<String, List<TAbilityApplicationDTO>>> getByApplyFlag(@PathVariable("applyFlag") String applyFlag) {
final UserDetail user = SecurityUser.getUser();
Map<String, Object> params = new HashMap<String, Object>() {
{
put("apply_flag", applyFlag); // 限定
put("user_id", user == null ? null : user.getId()); // 只出本人
}
};
List<TAbilityApplicationDTO> applicationDTOS = tAbilityApplicationService.list(params);
Map<String, List<TAbilityApplicationDTO>> result =
applicationDTOS.stream().collect(Collectors.groupingBy(t -> {
SysDeptDTO sysDeptDTO = t.getResourceOwnerDept();
if (sysDeptDTO == null) {
return "无部门信息"; // 无部门信息
} else {
return sysDeptDTO.getName();
}
}));
return new Result<Map<String, List<TAbilityApplicationDTO>>>().ok(result);
}
@GetMapping("page")
@ApiOperation("分页")
@LogOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
})
public Result<PageData<TAbilityApplicationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
public Result<PageData<TAbilityApplicationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TAbilityApplicationDTO> page = tAbilityApplicationService.page(params);
return new Result<PageData<TAbilityApplicationDTO>>().ok(page);
@ -59,7 +110,7 @@ public class TAbilityApplicationController {
@GetMapping("{id}")
@ApiOperation("信息")
@LogOperation("信息")
public Result<TAbilityApplicationDTO> get(@PathVariable("id") Long id){
public Result<TAbilityApplicationDTO> get(@PathVariable("id") Long id) {
TAbilityApplicationDTO data = tAbilityApplicationService.get(id);
return new Result<TAbilityApplicationDTO>().ok(data);
@ -68,7 +119,7 @@ public class TAbilityApplicationController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody TAbilityApplicationDTO dto){
public Result save(@RequestBody TAbilityApplicationDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -85,7 +136,7 @@ public class TAbilityApplicationController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody TAbilityApplicationDTO dto){
public Result update(@RequestBody TAbilityApplicationDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -97,7 +148,7 @@ public class TAbilityApplicationController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody Long[] ids){
public Result delete(@RequestBody Long[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@ -110,10 +161,10 @@ public class TAbilityApplicationController {
@ApiOperation("更新实例ID")
@LogOperation("更新实例ID")
@ApiImplicitParams({
@ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", required = true, dataType="String"),
@ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query",required = true, dataType="String")
@ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query", required = true, dataType = "String")
})
public Result updateInstanceId(String businessKey, String processInstanceId){
public Result updateInstanceId(String businessKey, String processInstanceId) {
Long id = Long.valueOf(businessKey);
tAbilityApplicationService.updateInstanceId(processInstanceId, id);
return new Result();

View File

@ -19,7 +19,7 @@ import java.util.List;
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_ability_application")
@TableName(value = "t_ability_application", autoResultMap = true)
public class TAbilityApplicationEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ -98,7 +98,6 @@ public class TAbilityApplicationEntity implements Serializable {
/**
* 摄像头列表
*/
// @TableField(value = "camera_list", typeHandler = FastjsonTypeHandler.class)
private String cameraList;
/**
@ -115,7 +114,7 @@ public class TAbilityApplicationEntity implements Serializable {
/**
* 应用场景
*/
@TableField(value = "application_scene", typeHandler = FastjsonTypeHandler.class)
@TableField(value = "`application_scene`", typeHandler = FastjsonTypeHandler.class)
private List<String> applicationScene;
/**
@ -137,5 +136,6 @@ public class TAbilityApplicationEntity implements Serializable {
/**
* 资源所属部门信息
*/
@TableField(value = "`resource_owner_dept`", typeHandler = FastjsonTypeHandler.class)
private SysDeptDTO resourceOwnerDept;
}

View File

@ -8,6 +8,8 @@ import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.List;
@ -22,15 +24,38 @@ import java.util.stream.Collectors;
*/
@Service
public class TAbilityApplicationServiceImpl extends CrudServiceImpl<TAbilityApplicationDao, TAbilityApplicationEntity, TAbilityApplicationDTO> implements TAbilityApplicationService {
private static final Logger logger = LoggerFactory.getLogger(TAbilityApplicationServiceImpl.class);
@Override
public QueryWrapper<TAbilityApplicationEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<TAbilityApplicationEntity> wrapper = new QueryWrapper<>();
params.keySet().stream().filter(index -> null != params.get(index)).forEach(index -> {
switch (index) { //
case "abilityprocess_v2":
wrapper.select("DISTINCT apply_flag ,id ,`user` ,phone ,unit ,area ,system ,scene ,basis ,attachment ,instance_id ,user_id ,enclosure ,title ,application_system ,application_scene ,application_background ,effect_wish ,apply_number ,resource_owner_dept ,del_flag");
wrapper.isNotNull(Boolean.valueOf(params.get("abilityprocess_v2").toString()), "apply_flag");
wrapper.isNotNull(Boolean.valueOf(params.get("abilityprocess_v2").toString()), "instance_id");
wrapper.groupBy(Boolean.valueOf(params.get("abilityprocess_v2").toString()), "apply_flag")
.groupBy("id");
break;
case "user_id":
wrapper.eq(params.get("user_id") != null, "user_id", Long.valueOf(params.get("user_id").toString()));
break;
case "apply_flag":
wrapper.eq(params.get("apply_flag") != null, "apply_flag", params.get("apply_flag").toString());
break;
}
});
wrapper.orderByDesc("id");
return wrapper;
}
@Override
public List<TAbilityApplicationDTO> list(Map<String, Object> params) {
List<TAbilityApplicationEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, currentDtoClass());
}
@Override
public void updateInstanceId(String instanceId, Long id) {
baseDao.updateInstanceId(instanceId, id);

View File

@ -14,126 +14,126 @@ import java.util.List;
/**
* 资源表
*
* @author dg
* @author dg
* @since 1.0 2022-04-13
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_data_resource")
@EqualsAndHashCode(callSuper = false)
@TableName(value = "tb_data_resource", autoResultMap = true)
public class ResourceEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
* 类型基础设施数据资源等
*/
private String type;
/**
* 名称
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 链接URL
*/
private String link;
/**
* api请求方式
*/
private String apiMethodType;
/**
* apiURL
*/
private String apiUrl;
/**
* groupID
*/
private String groupId;
/**
* 所属部门
*/
private Long deptId;
/**
* 部门联系人
*/
private String deptContacts;
/**
* 联系电话
*/
private String deptPhone;
/**
* 共享类型
*/
private String shareType;
/**
* 共享方式
*/
private String shareMode;
/**
* 共享条件
*/
private String shareCondition;
/**
* 地区编码
*/
private Long districtId;
/**
* 访问量
*/
private Long visits;
/**
* 删除标志0:正常1:已删除9其他
*/
private Integer delFlag;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段
*/
private String note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
/**
* 类型基础设施数据资源等
*/
private String type;
/**
* 名称
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 链接URL
*/
private String link;
/**
* api请求方式
*/
private String apiMethodType;
/**
* apiURL
*/
private String apiUrl;
/**
* groupID
*/
private String groupId;
/**
* 所属部门
*/
private Long deptId;
/**
* 部门联系人
*/
private String deptContacts;
/**
* 联系电话
*/
private String deptPhone;
/**
* 共享类型
*/
private String shareType;
/**
* 共享方式
*/
private String shareMode;
/**
* 共享条件
*/
private String shareCondition;
/**
* 地区编码
*/
private Long districtId;
/**
* 访问量
*/
private Long visits;
/**
* 删除标志0:正常1:已删除9其他
*/
private Integer delFlag;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段
*/
private String note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
/**
* 附件
*/
private String enclosure;
/**
* 附件
*/
private String enclosure;
/**
* 下架理由
*/
private String undercarriageReason;
/**
* 下架理由
*/
private String undercarriageReason;
/**
* 提起下架人员
*/
private String undercarriageUserName;
/**
* 提起下架人员
*/
private String undercarriageUserName;
@TableField(value = "info_list", typeHandler = FastjsonTypeHandler.class)
private List<AttrEntity> infoList;
@TableField(value = "info_list", typeHandler = FastjsonTypeHandler.class)
private List<AttrEntity> infoList;
}

View File

@ -5,74 +5,75 @@ import io.renren.modules.monitor.entity.CameraChannel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import java.util.List;
/**
* 申购记录表
*
* @author dg
* @author dg
* @since 1.0 2022-04-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_resource_car")
@EqualsAndHashCode(callSuper = false)
@TableName(value = "tb_resource_car", autoResultMap = true)
public class ResourceCarEntity {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 用户IDsys_user主键
*/
private Long userId;
/**
* 资源IDtb_data_resource主键
*/
private Long resourceId;
/**
* 删除标志0:正常1:已删除9:其他
*/
private Integer delFlag;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 摄像头列表
*/
@TableField(value = "note1", typeHandler = FastjsonTypeHandler.class)
private List<CameraChannel> note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
@TableId
private Long id;
/**
* 用户IDsys_user主键
*/
private Long userId;
/**
* 资源IDtb_data_resource主键
*/
private Long resourceId;
/**
* 删除标志0:正常1:已删除9:其他
*/
private Integer delFlag;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 摄像头列表
*/
@TableField(value = "note1", typeHandler = FastjsonTypeHandler.class)
private List<CameraChannel> note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
}

View File

@ -27,6 +27,29 @@
<result property="resourceOwnerDept" column="resource_owner_dept"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
</resultMap>
<resultMap id="resourceDTO" type="io.renren.modules.processForm.dto.TAbilityApplicationDTO">
<result property="id" column="id"/>
<result property="user" column="user"/>
<result property="phone" column="phone"/>
<result property="unit" column="unit"/>
<result property="area" column="area"/>
<result property="system" column="system"/>
<result property="scene" column="scene"/>
<result property="basis" column="basis"/>
<result property="attachment" column="attachment"/>
<result property="instanceId" column="instance_id"/>
<result property="resourceId" column="resource_id"/>
<result property="userId" column="user_id"/>
<result property="approveStatus" column="approve_status"/>
<result property="delFlag" column="del_flag"/>
<result property="enclosure" column="enclosure"/>
<result property="cameraList" column="camera_list"/>
<result property="applicationScene" column="application_scene"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyFlag" column="apply_flag"/>
<result property="resourceOwnerDept" column="resource_owner_dept"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
</resultMap>
<update id="updateInstanceId">
update t_ability_application set instance_id = #{instanceId} where id = #{id}