From 9955741921cd79b0c35b4ff28ef5d78e1b6f2c40 Mon Sep 17 00:00:00 2001 From: zhouhefeng Date: Fri, 2 Aug 2024 17:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/review/ViewZbController.java | 42 ++++++++++++++++++- .../impl/review/CommentPeoServiceImpl.java | 7 +++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java b/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java index 1dafb49..f75b3f1 100644 --- a/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java +++ b/src/main/java/io/v/nutz/wakershome/controller/review/ViewZbController.java @@ -1,20 +1,26 @@ package io.v.nutz.wakershome.controller.review; import io.v.nutz.annontation.ViReturn; +import io.v.nutz.wakershome.model.review.CommentBz; import io.v.nutz.wakershome.model.review.CommentNr; import io.v.nutz.wakershome.model.review.CommentZb; import io.v.nutz.wakershome.service.review.CommentBzService; import io.v.nutz.wakershome.service.review.CommentNrService; import io.v.nutz.wakershome.service.review.CommentZbService; +import io.v.nutz.welfare.model.WelfareProjectSubject; +import io.v.nutz.welfare.model.WelfareProjectSubjectOption; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.nutz.aop.interceptor.ioc.TransAop; +import org.nutz.dao.Chain; import org.nutz.dao.Cnd; import org.nutz.dao.Sqls; import org.nutz.dao.sql.Sql; import org.nutz.ioc.aop.Aop; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; import org.nutz.lang.Strings; +import org.nutz.lang.random.R; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Param; @@ -112,11 +118,43 @@ public class ViewZbController { } commentNrService.clear(Cnd.where("zb_id", "=", commentZb.getId())); + List nrs = commentZb.getNrs(); + if (Lang.isNotEmpty(nrs)){ + nrs.forEach(v->{ + if (v.getId() == null) { + v.setId(R.UU32()); + } + Chain chain = Chain.make("id", v.getId()); + chain.add("zb_id",commentZb.getId()); + chain.add("content",v.getContent()); + chain.add("contentNumber",v.getContentNumber()); + chain.add("remark",v.getRemark()); + commentNrService.dao().insert(CommentNr.class, chain); - for (CommentNr nr : commentZb.getNrs()) { + List bzs = v.getBzs(); + bzs.forEach(b->{ + if (b.getId() == null) { + b.setId(R.UU32()); + } + Chain bzChain = Chain.make("id", b.getId()); + bzChain.add("nr_id",v.getId()); + bzChain.add("inspection",b.getInspection()); + bzChain.add("score",b.getScore()); + bzChain.add("single_score",b.getSingle_score()); + bzChain.add("zb_id",commentZb.getId()); + bzChain.add("contentNumber",b.getContentNumber()); + commentNrService.dao().insert(CommentBz.class, bzChain); + + }); + + + }); + + } + /* for (CommentNr nr : commentZb.getNrs()) { nr.setZb_id(commentZb.getId()); commentNrService.insertWith(nr, "bzs"); - } + }*/ return null; } diff --git a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentPeoServiceImpl.java b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentPeoServiceImpl.java index ce84dd2..617d091 100644 --- a/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentPeoServiceImpl.java +++ b/src/main/java/io/v/nutz/wakershome/service/impl/review/CommentPeoServiceImpl.java @@ -13,6 +13,7 @@ import org.nutz.dao.Cnd; import org.nutz.dao.Dao; import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; +import org.nutz.lang.Lang; import org.nutz.lang.util.NutMap; import java.util.List; @@ -48,8 +49,10 @@ public class CommentPeoServiceImpl extends ViServiceImpl implements v.getBzs().forEach(o->{ //赋值测评结果 CommentResult result = commentResultMap.get(o.getId()); - o.setOptions(result.getRecommendation()); - o.setResultScore(result.getAssessResult()); + if (Lang.isNotEmpty(result)){ + o.setOptions(result.getRecommendation()); + o.setResultScore(result.getAssessResult()); + } }); }); NutMap nutMap = new NutMap();