This commit is contained in:
2024-08-02 17:54:32 +08:00
parent efdedc3405
commit 9955741921
2 changed files with 45 additions and 4 deletions
@@ -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<CommentNr> 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<CommentBz> 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;
}
@@ -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<CommentPeo> 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();