新增通过消费订单明细id获取明细
This commit is contained in:
@@ -7,6 +7,7 @@ import com.zt.plat.module.base.controller.admin.templtp.onlyoffice.service.OnlyO
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/base/onlyoffice")
|
||||
@Tag(name = "管理后台 - onlyOffice回调")
|
||||
@@ -31,19 +33,21 @@ public class OnlyOfficeCallbackController {
|
||||
@PostMapping("/callback/{id}")
|
||||
@PermitAll
|
||||
@TenantIgnore
|
||||
public ResponseEntity<Map<String, Integer>> handleCallback(@RequestBody OnlyOfficeCallback callback, @PathVariable String id,@RequestParam("fileName") String fileName) {
|
||||
public ResponseEntity<Map<String, Object>> handleCallback(@RequestBody OnlyOfficeCallback callback, @PathVariable String id,@RequestParam("fileName") String fileName) {
|
||||
// 处理回调逻辑
|
||||
callbackService.processCallback(callback,id,fileName);
|
||||
log.info("回调参数:【{}】",callback.toString());
|
||||
// 返回必须的响应,否则OnlyOffice会显示错误
|
||||
Map<String, Integer> response = new HashMap<>();
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("error", 0);
|
||||
// response.put("version", 100);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理OnlyOffice文档编辑服务发送的回调
|
||||
*/
|
||||
@PostMapping("/contract /callback/{id}")
|
||||
@PostMapping("/contract/callback/{id}")
|
||||
@PermitAll
|
||||
@TenantIgnore
|
||||
public ResponseEntity<Map<String, Integer>> handleContractCallback(@RequestBody OnlyOfficeCallback callback, @PathVariable String id,@RequestParam("fileName") String fileName) {
|
||||
@@ -52,6 +56,7 @@ public class OnlyOfficeCallbackController {
|
||||
// 返回必须的响应,否则OnlyOffice会显示错误
|
||||
Map<String, Integer> response = new HashMap<>();
|
||||
response.put("error", 0);
|
||||
// response.put("version", 0);
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +168,7 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
|
||||
fileInfo.put("id",String.valueOf(fileRespDTO.getId()));
|
||||
fileInfo.put("name", fileRespDTO.getName());
|
||||
fileInfo.put("directory", fileRespDTO.getDirectory());
|
||||
fileInfo.put("key", callback.getKey());
|
||||
templateInstanceService.updateTemplateInstanceFileUrlByInstanceId(id, JSONObject.toJSONString(fileInfo));
|
||||
} else {
|
||||
// 创建文件失败,处理错误
|
||||
@@ -352,6 +353,7 @@ public class OnlyOfficeCallbackServiceImpl implements OnlyOfficeCallbackService
|
||||
fileInfo.put("id",String.valueOf(fileRespDTO.getId()));
|
||||
fileInfo.put("name", fileRespDTO.getName());
|
||||
fileInfo.put("directory", fileRespDTO.getDirectory());
|
||||
fileInfo.put("key", callback.getKey());
|
||||
templateInstanceService.updateTemplateInstanceFileUrlByInstanceId(id, JSONObject.toJSONString(fileInfo));
|
||||
} else {
|
||||
// 创建文件失败,处理错误
|
||||
|
||||
@@ -16,6 +16,11 @@ public class TemplateInstanceDataRespVO {
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "字段名字", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("字段名字")
|
||||
private String fldName;
|
||||
|
||||
@Schema(description = "关联实例主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25824")
|
||||
@ExcelProperty("关联实例主键")
|
||||
private String inscId;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.base.controller.admin.templtp.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
|
||||
@@ -44,4 +44,8 @@ public class TemplateInstanceDataDO extends BusinessBaseDO {
|
||||
@TableField("FLD_VAL")
|
||||
private String fldVal;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String fldName;
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class TemplateInstanceItemServiceImpl implements TemplateInstanceItemServ
|
||||
@Override
|
||||
public void updateTemplateInstanceItem(TemplateInstanceItemSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTemplateInstanceItemExists(updateReqVO.getInscId());
|
||||
validateTemplateInstanceItemExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TemplateInstanceItemDO updateObj = BeanUtils.toBean(updateReqVO, TemplateInstanceItemDO.class);
|
||||
templateInstanceItemMapper.updateById(updateObj);
|
||||
|
||||
@@ -217,18 +217,18 @@ public class TemplateInstanceServiceImpl implements TemplateInstanceService {
|
||||
// 校验当前状态是否能够进行发布
|
||||
publishReqVOS.forEach(reqVO -> {
|
||||
TemplateInstanceDO templateInstanceDO = templateInstanceMapper.selectById(reqVO.getId());
|
||||
if (templateInstanceDO.getCntt()==null||templateInstanceDO.getCntt().isEmpty()){
|
||||
if (templateInstanceDO.getCntt() == null || templateInstanceDO.getCntt().isEmpty()) {
|
||||
throw exception(TEMPLATE_INSTANCE_FILE_NOT_EXISTS);
|
||||
}
|
||||
String currentStatus = reqVO.getCurrentStatus();
|
||||
if (currentStatus.isEmpty()) {
|
||||
currentStatus =templateInstanceDO.getSts();
|
||||
currentStatus = templateInstanceDO.getSts();
|
||||
}
|
||||
PublishStatusEnum status = PublishStatusEnum.fromCode(currentStatus);
|
||||
boolean transitionAllowed = false;
|
||||
if (status != null) {
|
||||
transitionAllowed = status.isTransitionAllowed(TmplStsEnum.DRAFT.getCode());
|
||||
if (!transitionAllowed){
|
||||
if (!transitionAllowed) {
|
||||
transitionAllowed = status.isTransitionAllowed(TmplStsEnum.START.getCode());
|
||||
}
|
||||
}
|
||||
@@ -286,7 +286,7 @@ public class TemplateInstanceServiceImpl implements TemplateInstanceService {
|
||||
newTpInstanceDO.setTenantId(templateInstanceDO.getTenantId());
|
||||
newTpInstanceDO.setVer(incrementVersion(templateInstanceDO.getVer()));
|
||||
newTpInstanceDO.setPublishTime(LocalDateTime.now());
|
||||
newTpInstanceDO.setOrigCntt(templateInstanceDO.getCntt()!=null?templateInstanceDO.getCntt():templateInstanceDO.getOrigCntt());//模板实例内容,默认为上一个版本的当前文件内容
|
||||
newTpInstanceDO.setOrigCntt(templateInstanceDO.getCntt() != null ? templateInstanceDO.getCntt() : templateInstanceDO.getOrigCntt());//模板实例内容,默认为上一个版本的当前文件内容
|
||||
newTpInstanceDO.setCreateTime(null);
|
||||
newTpInstanceDO.setUpdateTime(null);
|
||||
templateInstanceMapper.insert(newTpInstanceDO);
|
||||
@@ -409,9 +409,18 @@ public class TemplateInstanceServiceImpl implements TemplateInstanceService {
|
||||
|
||||
// 实例数据
|
||||
private List<TemplateInstanceDataRespVO> setTemplateInstanceDataRespVOS(Long id) {
|
||||
return BeanUtils.toBean(templateInstanceDataMapper.selectList(new LambdaQueryWrapper<TemplateInstanceDataDO>()
|
||||
List<TemplateInstanceDataRespVO> templateInstanceDataRespVOS = BeanUtils.toBean(templateInstanceDataMapper.selectList(new LambdaQueryWrapper<TemplateInstanceDataDO>()
|
||||
.eq(TemplateInstanceDataDO::getInscId, id)
|
||||
.eq(TemplateInstanceDataDO::getCompanyId, CompanyContextHolder.getCompanyId())), TemplateInstanceDataRespVO.class);
|
||||
List<TmplTpFldDO> tmplTpListByValKeys = tmplTpFldService.getTmplTpListByValKeys(templateInstanceDataRespVOS.stream().map(TemplateInstanceDataRespVO::getFldKy).toList());
|
||||
templateInstanceDataRespVOS.forEach(templateInstanceDataRespVO -> {
|
||||
tmplTpListByValKeys.forEach(tmplTpFldDO -> {
|
||||
if (templateInstanceDataRespVO.getFldKy().equals(tmplTpFldDO.getFldKy())) {
|
||||
templateInstanceDataRespVO.setFldName(tmplTpFldDO.getFldName());
|
||||
}
|
||||
});
|
||||
});
|
||||
return templateInstanceDataRespVOS;
|
||||
}
|
||||
|
||||
private void validateStatusCanDelete(List<Long> ids) {
|
||||
@@ -470,11 +479,11 @@ public class TemplateInstanceServiceImpl implements TemplateInstanceService {
|
||||
List<String> itmIds = templateInstanceItemMapper.selectList(new LambdaQueryWrapper<TemplateInstanceItemDO>().eq(TemplateInstanceItemDO::getInscId, id)).stream().map(TemplateInstanceItemDO::getItmId).toList();
|
||||
|
||||
// 例模版条款去条款库查询条款信息
|
||||
if (!itmIds.isEmpty()){
|
||||
if (!itmIds.isEmpty()) {
|
||||
List<TmplItmRespVO> tmplItmRespVOS = BeanUtils.toBean(tmplItmService.listTmplItmByIds(itmIds), TmplItmRespVO.class);
|
||||
fieldAndClauseRespVO.setTmplItmRespVOS(BeanUtils.toBean(tmplItmRespVOS, TmplItmRespVO.class));
|
||||
}
|
||||
if (!valKeys.isEmpty()){
|
||||
if (!valKeys.isEmpty()) {
|
||||
//例模版字段去字段库查询字段信息
|
||||
List<TmplTpFldDO> tmplTpListByValKeys = tmplTpFldService.getTmplTpListByValKeys(valKeys);
|
||||
fieldAndClauseRespVO.setTmplFldRespVOS(BeanUtils.toBean(tmplTpListByValKeys, TmplFldRespVO.class));
|
||||
|
||||
@@ -96,6 +96,9 @@ public class TmplTpFldServiceImpl extends ServiceImpl<TmplTpFldMapper, TmplTpFld
|
||||
|
||||
@Override
|
||||
public List<TmplTpFldDO> getTmplTpListByValKeys(List<String> valNames) {
|
||||
if (CollUtil.isEmpty(valNames)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<TmplTpFldDO>().in(TmplTpFldDO::getFldKy, valNames));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user