Commit b1e4ef50 by HlQ

[add]

1.添加表单相关代码
2.添加 InspectVO,InspectController 返回值改用 VO
1 parent ecbfc658
package vion.config;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;
import org.postgresql.util.PGobject;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@MappedTypes({Object.class})
public class JsonbTypeHandler extends JacksonTypeHandler {
private static final PGobject jsonObject = new PGobject();
public JsonbTypeHandler(Class<?> type) {
super(type);
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException {
if (ps != null) {
jsonObject.setType("jsonb");
jsonObject.setValue(toJson(parameter));
ps.setObject(i, jsonObject);
}
}
}
\ No newline at end of file \ No newline at end of file
package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.FormDTO;
import vion.service.IFormService;
import vion.vo.FormVO;
/**
* 表单集合
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class FormController {
private final IFormService formService;
@GetMapping("/form")
@SaCheckPermission(value = "form:list", orRole = "admin")
public Page<FormVO> list(FormDTO dto) {
return formService.list(dto);
}
@PostMapping("/form")
@SaCheckPermission(value = "form:save", orRole = "admin")
public Object save(@RequestBody FormDTO dto) {
return formService.save(dto);
}
@PostMapping("/form/{id}")
@SaCheckPermission(value = "form:edit", orRole = "admin")
public String updateById(@PathVariable Long id, @RequestBody FormDTO dto) {
return formService.updateById(id, dto);
}
@GetMapping("/form/{id}")
@SaCheckPermission(value = "form:query", orRole = "admin")
public FormVO getById(@PathVariable Long id) {
return formService.getByUniqueId(id, null);
}
@DeleteMapping("/form/{id}")
@SaCheckPermission(value = "form:remove", orRole = "admin")
public String removeById(@PathVariable Long id) {
return formService.removeById(id) ? "删除成功" : "删除失败";
}
@GetMapping("/form/sign/{uuid}")
public FormVO getByUuid(@PathVariable String uuid) {
return formService.getByUniqueId(null, uuid);
}
/**
* 签字专用更新接口
*
* @param uuid uuid
* @param dto dto
* @return java.lang.String
*/
@PostMapping("/form/sign/{uuid}")
public String updByUuid(@PathVariable String uuid, @RequestBody FormDTO dto) {
return formService.updByUuid(uuid, dto);
}
}
...@@ -10,6 +10,7 @@ import vion.Global; ...@@ -10,6 +10,7 @@ import vion.Global;
import vion.dto.InspectDTO; import vion.dto.InspectDTO;
import vion.model.Inspect; import vion.model.Inspect;
import vion.service.IInspectService; import vion.service.IInspectService;
import vion.vo.InspectVO;
import java.util.Date; import java.util.Date;
...@@ -24,13 +25,13 @@ public class InspectController { ...@@ -24,13 +25,13 @@ public class InspectController {
@GetMapping("/inspects") @GetMapping("/inspects")
@SaCheckPermission(value = "inspect:list", orRole = "admin") @SaCheckPermission(value = "inspect:list", orRole = "admin")
public Page<Inspect> getInspectList(InspectDTO data) { public Page<InspectVO> getInspectList(InspectDTO data) {
return inspectService.getInspectList(data); return inspectService.getInspectList(data);
} }
@GetMapping("/inspect") @GetMapping("/inspect")
@SaCheckPermission(value = "inspect:query", orRole = "admin") @SaCheckPermission(value = "inspect:query", orRole = "admin")
public Inspect getProductById(@RequestParam(name = "id") Integer id) { public InspectVO getById(@RequestParam(name = "id") Long id) {
return inspectService.getById(id); return inspectService.getById(id);
} }
......
...@@ -5,7 +5,6 @@ import lombok.Setter; ...@@ -5,7 +5,6 @@ import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Getter @Getter
...@@ -34,37 +33,6 @@ public class ContractDTO extends BaseDTO { ...@@ -34,37 +33,6 @@ public class ContractDTO extends BaseDTO {
private Integer status; private Integer status;
/** /**
* 合同总金额
*/
private BigDecimal totalAmount;
/**
* 合同已收金额:人工编辑
*/
private BigDecimal paidAmount;
/**
* 合同应收金额:
* 根据【合同进度】,由系统判断出应该收到的金额
*/
private BigDecimal receivableAmount;
/**
* 合同未收金额:total-(paid+receivable)
*/
private BigDecimal outstandingAmount;
/**
* 合同签订主体
*/
private String subject;
/**
* 合同甲方名称
*/
private String customerName;
/**
* 销售人员名称 * 销售人员名称
*/ */
private String saleName; private String saleName;
......
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
public class FormDTO extends BaseDTO {
private Long id;
/**
* 集团id
*/
private Long accountId;
/**
* 项目id
*/
private Long storeId;
/**
* 类型
*/
private Integer type;
/**
* 具体内容
*/
private String info;
/**
* 签字图片
*/
private String signPic;
/**
* 签字时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date signTime;
/**
* 来源,1:任务管理,2:巡检管理
*/
private Integer sourceId;
/**
* 级联id
*/
private Long pid;
}
\ No newline at end of file \ No newline at end of file
...@@ -15,6 +15,7 @@ public class InterceptorConfig implements WebMvcConfigurer { ...@@ -15,6 +15,7 @@ public class InterceptorConfig implements WebMvcConfigurer {
.addPathPatterns("/api/**") .addPathPatterns("/api/**")
.excludePathPatterns("/api/upLoadFile", "/api/ding/callback/**", "/api/wechat/**", "/error") .excludePathPatterns("/api/upLoadFile", "/api/ding/callback/**", "/api/wechat/**", "/error")
.excludePathPatterns("/api/order/sign/*") .excludePathPatterns("/api/order/sign/*")
.excludePathPatterns("/api/form/sign/*")
.excludePathPatterns("/api/taskTemp", "/api/taskTemp/wechatCallback"); .excludePathPatterns("/api/taskTemp", "/api/taskTemp/wechatCallback");
} }
} }
package vion.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import vion.model.Form;
public interface FormMapper extends MPJBaseMapper<Form> {
}
\ No newline at end of file \ No newline at end of file
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper; import com.github.yulichang.base.MPJBaseMapper;
import vion.model.Invoice; import vion.model.Invoice;
...@@ -8,5 +7,5 @@ import vion.model.Invoice; ...@@ -8,5 +7,5 @@ import vion.model.Invoice;
* @author HlQ * @author HlQ
* @date 2023/12/5 * @date 2023/12/5
*/ */
public interface InvoiceMapper extends BaseMapper<Invoice>, MPJBaseMapper<Invoice> { public interface InvoiceMapper extends MPJBaseMapper<Invoice> {
} }
\ No newline at end of file \ No newline at end of file
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper; import com.github.yulichang.base.MPJBaseMapper;
import vion.model.Payment; import vion.model.Payment;
...@@ -8,5 +7,5 @@ import vion.model.Payment; ...@@ -8,5 +7,5 @@ import vion.model.Payment;
* @author HlQ * @author HlQ
* @date 2023/12/5 * @date 2023/12/5
*/ */
public interface PaymentMapper extends BaseMapper<Payment>, MPJBaseMapper<Payment> { public interface PaymentMapper extends MPJBaseMapper<Payment> {
} }
\ No newline at end of file \ No newline at end of file
...@@ -86,7 +86,7 @@ public class Contract { ...@@ -86,7 +86,7 @@ public class Contract {
private BigDecimal receivableAmount; private BigDecimal receivableAmount;
/** /**
* 合同未收金额:total-(paid+receivable) * 合同未收金额:total-paid
*/ */
@TableField(value = "outstanding_amount") @TableField(value = "outstanding_amount")
private BigDecimal outstandingAmount; private BigDecimal outstandingAmount;
......
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.config.JsonbTypeHandler;
import vion.dto.FormDTO;
import vion.vo.FormVO;
import java.util.Date;
/**
* 表单集合表
*/
@Data
@TableName(value = "tbl_form", autoResultMap = true)
@AutoMappers({
@AutoMapper(target = FormVO.class),
@AutoMapper(target = FormDTO.class),
})
public class Form {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 集团id
*/
@TableField(value = "account_id")
private Long accountId;
/**
* 项目id
*/
@TableField(value = "store_id")
private Long storeId;
/**
* 类型
*/
@TableField(value = "\"type\"")
private Integer type;
/**
* 具体内容
*/
@TableField(value = "info", typeHandler = JsonbTypeHandler.class)
private String info;
/**
* 签字图片
*/
@TableField(value = "sign_pic")
private String signPic;
/**
* 签字时间
*/
@TableField(value = "sign_time")
private Date signTime;
/**
* 唯一uuid
*/
@TableField(value = "uuid")
private String uuid;
/**
* 来源,1:任务管理,2:巡检管理
*/
@TableField(value = "source_id")
private Integer sourceId;
/**
* 级联id
*/
@TableField(value = "pid")
private Long pid;
@TableField(value = "create_user")
private Long createUser;
@TableField(value = "update_user")
private Long updateUser;
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}
\ No newline at end of file \ No newline at end of file
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers; import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import vion.dto.InspectDTO; import vion.dto.InspectDTO;
import vion.vo.InspectVO;
import java.util.Date; import java.util.Date;
...@@ -16,6 +15,7 @@ import java.util.Date; ...@@ -16,6 +15,7 @@ import java.util.Date;
@Data @Data
@TableName(value = "tbl_inspect_info") @TableName(value = "tbl_inspect_info")
@AutoMappers({ @AutoMappers({
@AutoMapper(target = InspectVO.class),
@AutoMapper(target = InspectDTO.class), @AutoMapper(target = InspectDTO.class),
}) })
public class Inspect { public class Inspect {
...@@ -26,7 +26,6 @@ public class Inspect { ...@@ -26,7 +26,6 @@ public class Inspect {
private Long storeId; private Long storeId;
/** 巡检时间 */ /** 巡检时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@OrderBy @OrderBy
private Date inspectDate; private Date inspectDate;
...@@ -40,31 +39,20 @@ public class Inspect { ...@@ -40,31 +39,20 @@ public class Inspect {
private Integer reviewer; private Integer reviewer;
/** 巡检时间 */ /** 巡检时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date finishDate; private Date finishDate;
/** 审核时间 */ /** 审核时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date auditDate; private Date auditDate;
/** 创建时间 */ /** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT) @TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; private Date createTime;
/** 修改时间 */ /** 修改时间 */
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE) @TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime; private Date modifyTime;
/** 备注 */ /** 备注 */
private String remark; private String remark;
/** 集团id */ /** 集团id */
private Long accountId; private Long accountId;
@TableField(exist = false)
private String accountName;
@TableField(exist = false)
private String storeName;
} }
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers; import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
...@@ -57,9 +54,9 @@ public class Invoice { ...@@ -57,9 +54,9 @@ public class Invoice {
@TableField(value = "remark") @TableField(value = "remark")
private String remark; private String remark;
@TableField(value = "create_time") @TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime; private Date createTime;
@TableField(value = "update_time") @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
} }
\ No newline at end of file \ No newline at end of file
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers; import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
...@@ -56,9 +53,9 @@ public class Payment { ...@@ -56,9 +53,9 @@ public class Payment {
@TableField(value = "remark") @TableField(value = "remark")
private String remark; private String remark;
@TableField(value = "create_time") @TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime; private Date createTime;
@TableField(value = "update_time") @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
} }
\ No newline at end of file \ No newline at end of file
package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseService;
import vion.dto.FormDTO;
import vion.model.Form;
import vion.vo.FormVO;
public interface IFormService extends MPJBaseService<Form> {
Page<FormVO> list(FormDTO dto);
Object save(FormDTO dto);
String updateById(Long id, FormDTO dto);
FormVO getByUniqueId(Long id, String uuid);
String updByUuid(String uuid, FormDTO dto);
}
\ No newline at end of file \ No newline at end of file
...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseService; import com.github.yulichang.base.MPJBaseService;
import vion.dto.InspectDTO; import vion.dto.InspectDTO;
import vion.model.Inspect; import vion.model.Inspect;
import vion.vo.InspectVO;
public interface IInspectService extends MPJBaseService<Inspect> { public interface IInspectService extends MPJBaseService<Inspect> {
Page<Inspect> getInspectList(InspectDTO data); Page<InspectVO> getInspectList(InspectDTO data);
InspectVO getById(Long id);
} }
package vion.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import vion.dto.FormDTO;
import vion.mapper.FormMapper;
import vion.model.Account;
import vion.model.Form;
import vion.model.Store;
import vion.service.IFormService;
import vion.vo.FormVO;
/**
* @author HlQ
* @date 2023/12/12
*/
@Service
@RequiredArgsConstructor
public class FormServiceImpl extends MPJBaseServiceImpl<FormMapper, Form> implements IFormService {
private final Converter converter;
@Override
public Page<FormVO> list(FormDTO dto) {
MPJLambdaWrapper<Form> wrapper = new MPJLambdaWrapper<>(converter.convert(dto, Form.class))
.selectAll(Form.class)
.selectAs(Account::getName, FormVO::getAccountName)
.selectAs(Store::getName, FormVO::getStoreName)
.leftJoin(Account.class, Account::getId, Form::getAccountId)
.leftJoin(Store.class, Store::getId, Form::getStoreId);
return this.selectJoinListPage(Page.of(dto.getPageNum(), dto.getPageSize()), FormVO.class, wrapper);
}
@Override
public Object save(FormDTO dto) {
Form form = converter.convert(dto, Form.class);
String nanoId = IdUtil.nanoId();
form.setUuid(nanoId);
return this.save(form) ? JSONUtil.createObj().set("id", form.getId()).set("uuid", nanoId) : "创建失败";
}
@Override
public String updateById(Long id, FormDTO dto) {
Form form = converter.convert(dto, Form.class);
form.setId(id);
return this.updateById(form) ? "更新成功" : "更新失败";
}
@Override
public FormVO getByUniqueId(Long id, String uuid) {
MPJLambdaWrapper<Form> wrapper = new MPJLambdaWrapper<Form>()
.selectAll(Form.class)
.selectAs(Account::getName, FormVO::getAccountName)
.selectAs(Store::getName, FormVO::getStoreName)
.leftJoin(Account.class, Account::getId, Form::getAccountId)
.leftJoin(Store.class, Store::getId, Form::getStoreId)
.eq(ObjUtil.isNotNull(id), Form::getId, id)
.eq(StrUtil.isNotBlank(uuid), Form::getUuid, uuid);
return this.selectJoinOne(FormVO.class, wrapper);
}
@Override
public String updByUuid(String uuid, FormDTO dto) {
Form form = converter.convert(dto, Form.class);
return this.lambdaUpdate().eq(Form::getUuid, uuid).update(form) ? "提交成功" : "提交失败";
}
}
package vion.service.impl; package vion.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Opt;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.github.linpeilie.Converter; import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.dto.InspectDTO; import vion.dto.InspectDTO;
import vion.mapper.InspectMapper; import vion.mapper.InspectMapper;
import vion.model.Account; import vion.model.Account;
import vion.model.Form;
import vion.model.Inspect; import vion.model.Inspect;
import vion.model.Store; import vion.model.Store;
import vion.service.IAccountService; import vion.service.IFormService;
import vion.service.IInspectService; import vion.service.IInspectService;
import vion.service.IStoreService; import vion.vo.FormVO;
import vion.vo.InspectVO;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class InspectServiceImpl extends MPJBaseServiceImpl<InspectMapper, Inspect> implements IInspectService { public class InspectServiceImpl extends MPJBaseServiceImpl<InspectMapper, Inspect> implements IInspectService {
private final IStoreService storeService; private final IFormService formService;
private final IAccountService accountService;
private final Converter converter; private final Converter converter;
@Override @Override
public Page<Inspect> getInspectList(InspectDTO data) { public Page<InspectVO> getInspectList(InspectDTO data) {
Page<Inspect> inspectList = this.lambdaQuery(converter.convert(data, new Inspect())) MPJLambdaWrapper<Inspect> wrapper = new MPJLambdaWrapper<>(converter.convert(data, Inspect.class))
.between(data.getStartdate() != null && data.getEnddate() != null, Inspect::getInspectDate, data.getStartdate(), data.getEnddate()) .selectAll(Inspect.class)
.page(Page.of(data.getPageNum(), data.getPageSize())); .selectAs(Account::getName, InspectVO::getAccountName)
.selectAs(Store::getName, InspectVO::getStoreName)
List<Store> storeList = storeService.list(); .leftJoin(Account.class, Account::getId, Inspect::getAccountId)
List<Account> accountList = accountService.list(); .leftJoin(Store.class, Store::getId, Inspect::getStoreId)
inspectList.getRecords().forEach(item -> { .between(data.getStartdate() != null && data.getEnddate() != null, Inspect::getInspectDate, data.getStartdate(), data.getEnddate());
item.setAccountName(accountList.stream().filter(v -> v.getId().equals(item.getAccountId())).map(Account::getName).findFirst().orElse("--"));
item.setStoreName(storeList.stream().filter(v -> v.getId().equals(item.getStoreId())).map(Store::getName).findFirst().orElse("--")); Page<InspectVO> inspectVOPage = this.selectJoinListPage(Page.of(data.getPageNum(), data.getPageSize()), InspectVO.class, wrapper);
});
return inspectList; Opt.ofEmptyAble(inspectVOPage.getRecords())
.map(l -> l.stream().map(InspectVO::getId).collect(Collectors.toList()))
.map(idList -> formService.lambdaQuery().eq(Form::getSourceId, 2).in(Form::getPid, idList).list())
.filter(CollUtil::isNotEmpty)
.ifPresent(formList -> {
Map<Long, List<FormVO>> inspectId2FormIdMap = formList.stream().collect(Collectors.groupingBy(Form::getPid, Collectors.mapping(form -> converter.convert(form, FormVO.class), Collectors.toList())));
inspectVOPage.getRecords().forEach(inspectVO -> {
inspectVO.setFormList(inspectId2FormIdMap.getOrDefault(inspectVO.getId(), ListUtil.empty()));
});
});
return inspectVOPage;
}
@Override
public InspectVO getById(Long id) {
MPJLambdaWrapper<Inspect> wrapper = new MPJLambdaWrapper<Inspect>()
.selectAll(Inspect.class)
.selectAs(Account::getName, InspectVO::getAccountName)
.selectAs(Store::getName, InspectVO::getStoreName)
.leftJoin(Account.class, Account::getId, Inspect::getAccountId)
.leftJoin(Store.class, Store::getId, Inspect::getStoreId)
.eq(Inspect::getId, id);
return this.selectJoinOne(InspectVO.class, wrapper);
} }
} }
...@@ -48,7 +48,7 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem ...@@ -48,7 +48,7 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
.selectAll(Role.class) .selectAll(Role.class)
.select(RUserRole::getUserId) .select(RUserRole::getUserId)
.leftJoin(RUserRole.class, RUserRole::getRoleId, Role::getId) .leftJoin(RUserRole.class, RUserRole::getRoleId, Role::getId)
.in(RUserRole::getUserId, userVOS.getRecords().stream().map(UserVO::getId).collect(Collectors.toList())); .in(RUserRole::getUserId, Opt.ofEmptyAble(userVOS.getRecords().stream().map(UserVO::getId).collect(Collectors.toList())).orElse(ListUtil.of(-1L)));
List<RoleVO> roleVOList = roleService.selectJoinList(RoleVO.class, roleWrapper); List<RoleVO> roleVOList = roleService.selectJoinList(RoleVO.class, roleWrapper);
Opt.ofEmptyAble(roleVOList) Opt.ofEmptyAble(roleVOList)
.map(l -> l.stream().collect(Collectors.groupingBy(RoleVO::getUserId))) .map(l -> l.stream().collect(Collectors.groupingBy(RoleVO::getUserId)))
......
package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
public class FormVO {
private Long id;
/**
* 集团id
*/
private Long accountId;
private String accountName;
/**
* 项目id
*/
private Long storeId;
private String storeName;
/**
* 类型
*/
private Integer type;
/**
* 具体内容
*/
private String info;
/**
* 签字图片
*/
private String signPic;
/**
* 签字时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date signTime;
/**
* 唯一uuid
*/
private String uuid;
/**
* 来源,1:任务管理,2:巡检管理
*/
private Integer sourceId;
/**
* 级联id
*/
private Long pid;
private Long createUser;
private Long updateUser;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
\ No newline at end of file \ No newline at end of file
package vion.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.List;
@Getter
@Setter
public class InspectVO {
private Long id;
private Long storeId;
/** 巡检时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date inspectDate;
/** 巡检方式(0远程、1现场) */
private Integer type;
/** 状态(0进行中、1待审核、2已完成、3、驳回) */
private Integer status;
/** 巡检人 */
private Integer inspectUser;
/** 审核人 */
private Integer reviewer;
/** 巡检时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date finishDate;
/** 审核时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date auditDate;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
/** 备注 */
private String remark;
/** 集团id */
private Long accountId;
private String accountName;
private String storeName;
private List<FormVO> formList;
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!