feat 是否置顶
parent
7b0c1f6fbf
commit
02c090a971
|
@ -162,6 +162,7 @@ public class MallProductController extends BaseController {
|
|||
* @param isTop
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "设置模型置顶状态")
|
||||
@PutMapping("/{id}/top")
|
||||
public ResponseEntity<ModelProduct> setModelTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
try {
|
||||
|
@ -177,6 +178,7 @@ public class MallProductController extends BaseController {
|
|||
* 获取置顶的模型列表
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取置顶的模型列表")
|
||||
@GetMapping
|
||||
public ResponseEntity<List<ModelProduct>> fetchModelsSortedByTopStatus() {
|
||||
List<ModelProduct> models = modelService.fetchModelsSortedByTopStatus();
|
||||
|
|
|
@ -105,6 +105,13 @@ public class ModelImageController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置图片置顶
|
||||
* @param id
|
||||
* @param isTop
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "设置图片置顶状态")
|
||||
@PutMapping("/{id}/top")
|
||||
public ResponseEntity<ModelImage> setModelImageTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
try {
|
||||
|
@ -117,9 +124,10 @@ public class ModelImageController {
|
|||
|
||||
|
||||
/**
|
||||
* 获取置顶的模型列表
|
||||
* 获取置顶的图片列表
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取置顶的图片列表")
|
||||
@GetMapping
|
||||
public ResponseEntity<List<ModelImage>> fetchModelImagesSortedByTopStatus() {
|
||||
List<ModelImage> models = modelImageLikeService.fetchModelImageSortedByTopStatus();
|
||||
|
|
|
@ -43,6 +43,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param isTop
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "设置工作流的置顶状态")
|
||||
@PutMapping("/{id}/top")
|
||||
public ResponseEntity<WorkFlow> setworkFlowTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
try {
|
||||
|
@ -58,6 +59,7 @@ public class WorkFlowController extends BaseController {
|
|||
* 获取所有工作流,按照置顶状态排序
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取置顶的模型列表")
|
||||
@GetMapping
|
||||
public ResponseEntity<List<WorkFlow>> fetchWorkFlowSortedByTopStatus() {
|
||||
List<WorkFlow> models = workFlowService.fetchWorkFlowSortedByTopStatus();
|
||||
|
|
|
@ -130,11 +130,6 @@ public class ModelProduct extends BaseEntity {
|
|||
@ApiModelProperty(value = "是否置顶")
|
||||
private Integer isTop;
|
||||
|
||||
/**
|
||||
* 审核(1公开 2自见)
|
||||
*/
|
||||
@ApiModelProperty(value = "审核(1公开 2自见)")
|
||||
private Integer jurisdiction;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
|
|
|
@ -21,4 +21,6 @@ public interface WorkFlowMapper extends BaseMapper<WorkFlow> {
|
|||
List<WorkFlow> fetchWorkFlowSortedByTopStatus();
|
||||
|
||||
|
||||
void setworkFlowTop(Long id, int i);
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
/**
|
||||
* 设置模型置顶状态
|
||||
*
|
||||
* @param modelId 模型ID
|
||||
* @param id 模型ID
|
||||
* @param isTop 是否置顶
|
||||
*/
|
||||
@Override
|
||||
|
@ -229,6 +229,143 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
audit(requestModel);
|
||||
|
||||
}
|
||||
private void audit(RequestModel requestModel) {
|
||||
|
||||
// 执行审核操作
|
||||
threadPoolTaskExecutor.submit(() -> {
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
|
||||
if (modelProduct != null){
|
||||
|
||||
if (modelProduct.getModelName() != null){
|
||||
|
||||
//审核名称
|
||||
String s = BaiduCensor.TextCensor(modelProduct.getModelName()+","+modelProduct.getTags());
|
||||
// 解析 JSON 字符串
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
// 获取 'conclusion' 字段的值
|
||||
String conclusion = jsonObject.getString("conclusion");
|
||||
|
||||
if (conclusion.equals("不合规")) {
|
||||
|
||||
//更改状态,添加原因 -> 结束任务
|
||||
// 获取 'data' 数组
|
||||
JSONArray dataArray = jsonObject.getJSONArray("data");
|
||||
|
||||
// 存储所有的失败原因
|
||||
List<String> failureReasons = new ArrayList<>();
|
||||
// 遍历 'data' 数组中的每个元素
|
||||
for (Object itemObj : dataArray) {
|
||||
JSONObject item = (JSONObject) itemObj;
|
||||
String msg = item.getString("msg");
|
||||
failureReasons.add(msg);
|
||||
}
|
||||
// 使用逗号拼接所有的失败原因
|
||||
String concatenatedReasons = String.join(", ", failureReasons);
|
||||
modelProduct.setAuditText(concatenatedReasons);
|
||||
|
||||
//修改状态以及失败原因
|
||||
modelProduct.setAuditStatus(4);
|
||||
baseMapper.updateById(modelProduct);
|
||||
log.info("模型审核未通过");
|
||||
//结束任务
|
||||
return;
|
||||
}
|
||||
|
||||
//修改为合格
|
||||
modelProduct.setAuditText("");
|
||||
modelProduct.setAuditStatus(modelProduct.getJurisdiction());
|
||||
baseMapper.updateById(modelProduct);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<ModelVersion> modelVersionList = requestModel.getModelVersionList();
|
||||
|
||||
if (modelVersionList != null){
|
||||
//审核版本
|
||||
for (ModelVersion modelVersion : modelVersionList) {
|
||||
modelVersion.setModelId(modelProduct.getId());
|
||||
//版本名称
|
||||
String s1 = BaiduCensor.TextCensor(modelVersion.getVersionName() + "," +
|
||||
modelVersion.getVersionDescription()+","+modelVersion.getTriggerWords());
|
||||
// 解析 JSON 字符串
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(s1);
|
||||
// 获取 'conclusion' 字段的值
|
||||
String conclusion1 = jsonObject1.getString("conclusion");
|
||||
if (conclusion1.equals("不合规")) {
|
||||
|
||||
//更改版本状态->跳出循环 审核下一个版本
|
||||
// 获取 'data' 数组
|
||||
JSONArray dataArray1 = jsonObject1.getJSONArray("data");
|
||||
// 存储所有的失败原因
|
||||
List<String> failureReasons = new ArrayList<>();
|
||||
// 遍历 'data' 数组中的每个元素
|
||||
for (Object itemObj : dataArray1) {
|
||||
JSONObject item = (JSONObject) itemObj;
|
||||
String msg = item.getString("msg");
|
||||
failureReasons.add(msg);
|
||||
}
|
||||
// 使用逗号拼接所有的失败原因
|
||||
String concatenatedReasons = String.join(", ", failureReasons);
|
||||
modelVersion.setAuditText(concatenatedReasons);
|
||||
modelVersion.setAuditStatus(4);
|
||||
//校验id是否存在 区别修改审核或者新增审核
|
||||
if (modelVersion.getId() != null){
|
||||
modelVersionMapper.updateById(modelVersion);
|
||||
}else {
|
||||
modelVersionMapper.updateByName(modelVersion);
|
||||
}
|
||||
log.info("版本审核未通过");
|
||||
continue;
|
||||
}
|
||||
|
||||
//审核版本图片
|
||||
String[] split = modelVersion.getFilePath().split(",");
|
||||
for (String path : split) {
|
||||
String s2 = BaiduCensor.ImageCnesor(path);
|
||||
JSONObject jsonObject2 = JSONObject.parseObject(s2);
|
||||
if (jsonObject2.getString("conclusion").equals("不合规")) {
|
||||
|
||||
//修改状态->跳出循环 判断下一个版本
|
||||
// 获取 'data' 数组
|
||||
JSONArray dataArray2 = jsonObject2.getJSONArray("data");
|
||||
// 存储所有的失败原因
|
||||
List<String> failureReasons = new ArrayList<>();
|
||||
// 遍历 'data' 数组中的每个元素
|
||||
for (Object itemObj : dataArray2) {
|
||||
JSONObject item = (JSONObject) itemObj;
|
||||
String msg = item.getString("msg");
|
||||
failureReasons.add(msg);
|
||||
}
|
||||
// 使用逗号拼接所有的失败原因
|
||||
String concatenatedReasons = String.join(", ", failureReasons);
|
||||
modelVersion.setAuditText(concatenatedReasons);
|
||||
modelVersion.setAuditStatus(4);
|
||||
//校验id是否存在 区别修改审核或者新增审核
|
||||
if (modelVersion.getId() != null){
|
||||
modelVersionMapper.updateById(modelVersion);
|
||||
}else {
|
||||
modelVersionMapper.updateByName(modelVersion);
|
||||
}
|
||||
modelVersionMapper.updateByName(modelVersion);
|
||||
log.info("图片审核未通过");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//修改版本成功审核状态
|
||||
modelProduct.setAuditText("");
|
||||
modelVersion.setAuditStatus(1);
|
||||
modelVersionMapper.updateByName(modelVersion);
|
||||
log.info("全部通过审核");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult selectModelById(Long id) {
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<update id="setworkFlowTop">
|
||||
UPDATE work_flow SET is_top = #{isTop} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="fetchWorkFlowSortedByTopStatus" resultType="com.mcwl.resource.domain.WorkFlow">
|
||||
SELECT is_top FROM work_flow ORDER BY is_top DESC;
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue