委托管理多选
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
yudao-ui-admin CI / build (14.x) (push) Has been cancelled
yudao-ui-admin CI / build (16.x) (push) Has been cancelled
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
yudao-ui-admin CI / build (14.x) (push) Has been cancelled
yudao-ui-admin CI / build (16.x) (push) Has been cancelled
This commit is contained in:
parent
babb54e5fd
commit
69654b72c4
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.home.controller.admin.wtgl;
|
package cn.iocoder.yudao.module.home.controller.admin.wtgl;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -33,6 +34,7 @@ import cn.iocoder.yudao.module.home.service.wtgl.WtglService;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/home/wtgl")
|
@RequestMapping("/home/wtgl")
|
||||||
@Validated
|
@Validated
|
||||||
|
@Slf4j
|
||||||
public class WtglController {
|
public class WtglController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -67,16 +69,15 @@ public class WtglController {
|
|||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('home:wtgl:query')")
|
@PreAuthorize("@ss.hasPermission('home:wtgl:query')")
|
||||||
public CommonResult<WtglRespVO> getWtgl(@RequestParam("id") Long id) {
|
public CommonResult<WtglRespVO> getWtgl(@RequestParam("id") Long id) {
|
||||||
WtglDO wtgl = wtglService.getWtgl(id);
|
return success(wtglService.getWtglNew(id));
|
||||||
return success(BeanUtils.toBean(wtgl, WtglRespVO.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得委托分页")
|
@Operation(summary = "获得委托分页")
|
||||||
@PreAuthorize("@ss.hasPermission('home:wtgl:query')")
|
@PreAuthorize("@ss.hasPermission('home:wtgl:query')")
|
||||||
public CommonResult<PageResult<WtglRespVO>> getWtglPage(@Valid WtglPageReqVO pageReqVO) {
|
public CommonResult<PageResult<WtglPageRespVO>> getWtglPage(@Valid WtglPageReqVO pageReqVO) {
|
||||||
PageResult<WtglDO> pageResult = wtglService.getWtglPage(pageReqVO);
|
PageResult<WtglDO> pageResult = wtglService.getWtglPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, WtglRespVO.class));
|
return success(BeanUtils.toBean(pageResult, WtglPageRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@ -88,8 +89,8 @@ public class WtglController {
|
|||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<WtglDO> list = wtglService.getWtglPage(pageReqVO).getList();
|
List<WtglDO> list = wtglService.getWtglPage(pageReqVO).getList();
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "委托.xls", "数据", WtglRespVO.class,
|
ExcelUtils.write(response, "委托.xls", "数据", WtglPageRespVO.class,
|
||||||
BeanUtils.toBean(list, WtglRespVO.class));
|
BeanUtils.toBean(list, WtglPageRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.yudao.module.home.controller.admin.wtgl.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "多选数据类型")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class WtglMultiItem {
|
||||||
|
|
||||||
|
@Schema(description = "委托任务id")
|
||||||
|
@ExcelProperty("委托人id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "委托表单名")
|
||||||
|
@ExcelProperty("委托表单名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "表单路径")
|
||||||
|
@ExcelProperty("表单路径")
|
||||||
|
private String createPath;
|
||||||
|
}
|
@ -54,8 +54,8 @@ public class WtglPageReqVO extends PageParam {
|
|||||||
@Schema(description = "formName")
|
@Schema(description = "formName")
|
||||||
private String formName;
|
private String formName;
|
||||||
|
|
||||||
@Schema(description = "test2")
|
@Schema(description = "多表单数据")
|
||||||
private String test2;
|
private String multiData;
|
||||||
|
|
||||||
@Schema(description = "test3")
|
@Schema(description = "test3")
|
||||||
private String test3;
|
private String test3;
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
package cn.iocoder.yudao.module.home.controller.admin.wtgl.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 委托 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class WtglPageRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26152")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "委托人id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14947")
|
||||||
|
@ExcelProperty("委托人id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "委托人姓名", example = "王五")
|
||||||
|
@ExcelProperty("委托人姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Schema(description = "被委托人id", requiredMode = Schema.RequiredMode.REQUIRED, example = "4045")
|
||||||
|
@ExcelProperty("被委托人id")
|
||||||
|
private Long delegateId;
|
||||||
|
|
||||||
|
@Schema(description = "被委托人名字", example = "王五")
|
||||||
|
@ExcelProperty("被委托人名字")
|
||||||
|
private String delegateName;
|
||||||
|
|
||||||
|
@Schema(description = "委托开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("委托开始时间")
|
||||||
|
private LocalDateTime statTime;
|
||||||
|
|
||||||
|
@Schema(description = "委托结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("委托结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@Schema(description = "委托总时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("委托总时间")
|
||||||
|
private Integer date;
|
||||||
|
|
||||||
|
@Schema(description = "创建表单")
|
||||||
|
@ExcelProperty("委托表单")
|
||||||
|
private String createPath;
|
||||||
|
|
||||||
|
@Schema(description = "详情表单")
|
||||||
|
@ExcelProperty("委托流程")
|
||||||
|
private String detailPath;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "formName")
|
||||||
|
@ExcelProperty("formName")
|
||||||
|
private String formName;
|
||||||
|
|
||||||
|
@Schema(description = "多表单数据")
|
||||||
|
@ExcelProperty("多表单数据")
|
||||||
|
private String multiData;
|
||||||
|
|
||||||
|
@Schema(description = "test3")
|
||||||
|
@ExcelProperty("test3")
|
||||||
|
private String test3;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -60,9 +60,9 @@ public class WtglRespVO {
|
|||||||
@ExcelProperty("formName")
|
@ExcelProperty("formName")
|
||||||
private String formName;
|
private String formName;
|
||||||
|
|
||||||
@Schema(description = "test2")
|
@Schema(description = "多表单数据")
|
||||||
@ExcelProperty("test2")
|
@ExcelProperty("多表单数据")
|
||||||
private String test2;
|
private List<WtglMultiItem> multiData;
|
||||||
|
|
||||||
@Schema(description = "test3")
|
@Schema(description = "test3")
|
||||||
@ExcelProperty("test3")
|
@ExcelProperty("test3")
|
||||||
|
@ -44,22 +44,19 @@ public class WtglSaveReqVO {
|
|||||||
private Integer date;
|
private Integer date;
|
||||||
|
|
||||||
@Schema(description = "创建表单")
|
@Schema(description = "创建表单")
|
||||||
@NotNull(message = "创建表单不能为空")
|
|
||||||
private String createPath;
|
private String createPath;
|
||||||
|
|
||||||
@Schema(description = "详情表单")
|
@Schema(description = "详情表单")
|
||||||
@NotNull(message = "详情表单不能为空")
|
|
||||||
private String detailPath;
|
private String detailPath;
|
||||||
|
|
||||||
@Schema(description = "备注", example = "随便")
|
@Schema(description = "备注", example = "随便")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "formName")
|
@Schema(description = "formName")
|
||||||
@NotNull(message = "表单名字不能为空")
|
|
||||||
private String formName;
|
private String formName;
|
||||||
|
|
||||||
@Schema(description = "test2")
|
@Schema(description = "多表单数据")
|
||||||
private String test2;
|
private List<WtglMultiItem> multiData;
|
||||||
|
|
||||||
@Schema(description = "test3")
|
@Schema(description = "test3")
|
||||||
private String test3;
|
private String test3;
|
||||||
|
@ -74,9 +74,9 @@ public class WtglDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String formName;
|
private String formName;
|
||||||
/**
|
/**
|
||||||
* test2
|
* 多表单数据
|
||||||
*/
|
*/
|
||||||
private String test2;
|
private String multiData;
|
||||||
/**
|
/**
|
||||||
* test3
|
* test3
|
||||||
*/
|
*/
|
||||||
|
@ -31,7 +31,7 @@ public interface WtglMapper extends BaseMapperX<WtglDO> {
|
|||||||
.eqIfPresent(WtglDO::getDetailPath, reqVO.getDetailPath())
|
.eqIfPresent(WtglDO::getDetailPath, reqVO.getDetailPath())
|
||||||
.eqIfPresent(WtglDO::getRemark, reqVO.getRemark())
|
.eqIfPresent(WtglDO::getRemark, reqVO.getRemark())
|
||||||
.eqIfPresent(WtglDO::getFormName, reqVO.getFormName())
|
.eqIfPresent(WtglDO::getFormName, reqVO.getFormName())
|
||||||
.eqIfPresent(WtglDO::getTest2, reqVO.getTest2())
|
.eqIfPresent(WtglDO::getMultiData, reqVO.getMultiData())
|
||||||
.eqIfPresent(WtglDO::getTest3, reqVO.getTest3())
|
.eqIfPresent(WtglDO::getTest3, reqVO.getTest3())
|
||||||
.betweenIfPresent(WtglDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(WtglDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.orderByDesc(WtglDO::getId));
|
.orderByDesc(WtglDO::getId));
|
||||||
|
@ -52,4 +52,9 @@ public interface WtglService {
|
|||||||
*/
|
*/
|
||||||
PageResult<WtglDO> getWtglPage(WtglPageReqVO pageReqVO);
|
PageResult<WtglDO> getWtglPage(WtglPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @return 委托
|
||||||
|
*/
|
||||||
|
WtglRespVO getWtglNew(Long id);
|
||||||
}
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.home.service.wtgl;
|
package cn.iocoder.yudao.module.home.service.wtgl;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -24,15 +27,26 @@ import static cn.iocoder.yudao.module.home.enums.ErrorCodeConstants.*;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
|
@Slf4j
|
||||||
public class WtglServiceImpl implements WtglService {
|
public class WtglServiceImpl implements WtglService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WtglMapper wtglMapper;
|
private WtglMapper wtglMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createWtgl(WtglSaveReqVO createReqVO) {
|
public Long createWtgl(WtglSaveReqVO createReqVO) {
|
||||||
// 插入
|
|
||||||
WtglDO wtgl = BeanUtils.toBean(createReqVO, WtglDO.class);
|
WtglDO wtgl = BeanUtils.toBean(createReqVO, WtglDO.class);
|
||||||
|
// 将 List<WtglMultiItem> 转换为 JSON 字符串
|
||||||
|
try {
|
||||||
|
String multiDataJson = objectMapper.writeValueAsString(createReqVO.getMultiData()); // 正确序列化为 JSON 字符串
|
||||||
|
wtgl.setMultiData(multiDataJson); // 将 JSON 字符串赋值给 WtglDO
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 错误信息
|
||||||
|
log.error("处理异常: {}", e.getMessage());
|
||||||
|
}
|
||||||
wtglMapper.insert(wtgl);
|
wtglMapper.insert(wtgl);
|
||||||
// 返回
|
// 返回
|
||||||
return wtgl.getId();
|
return wtgl.getId();
|
||||||
@ -66,6 +80,28 @@ public class WtglServiceImpl implements WtglService {
|
|||||||
return wtglMapper.selectById(id);
|
return wtglMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WtglRespVO getWtglNew (Long id) {
|
||||||
|
WtglDO wtgl = getWtgl(id);
|
||||||
|
// 反序列化 JSON 字符串
|
||||||
|
try {
|
||||||
|
List<WtglMultiItem> formItems = objectMapper.readValue(wtgl.getMultiData(), new TypeReference<List<WtglMultiItem>>() {});
|
||||||
|
// 创建响应对象
|
||||||
|
WtglRespVO responseVO = new WtglRespVO();
|
||||||
|
// 手动设置属性值
|
||||||
|
responseVO.setId(wtgl.getId()).setUserId(wtgl.getUserId()).setUserName(wtgl.getUserName())
|
||||||
|
.setDelegateId(wtgl.getDelegateId()).setDelegateName(wtgl.getDelegateName())
|
||||||
|
.setStatTime(wtgl.getStatTime()).setEndTime(wtgl.getEndTime()).setRemark(wtgl.getRemark())
|
||||||
|
.setFormName(wtgl.getFormName()).setMultiData(formItems).setCreateTime(wtgl.getCreateTime());
|
||||||
|
return responseVO;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 错误信息
|
||||||
|
log.error("反序列化错误: {}", e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<WtglDO> getWtglPage(WtglPageReqVO pageReqVO) {
|
public PageResult<WtglDO> getWtglPage(WtglPageReqVO pageReqVO) {
|
||||||
return wtglMapper.selectPage(pageReqVO);
|
return wtglMapper.selectPage(pageReqVO);
|
||||||
|
Loading…
Reference in New Issue
Block a user