Merge remote-tracking branch 'origin/main'

This commit is contained in:
@jyuhsin
2024-09-20 10:02:18 +08:00
18 changed files with 591 additions and 126 deletions
@@ -1,5 +1,7 @@
package io.v.nutz.lxy.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.wizzer.framework.base.service.BaseService;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.PageUtil;
@@ -11,21 +13,25 @@ import io.v.nutz.lxy.service.LxyMefpService;
import io.v.nutz.sys.models.Sys_file;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.boot.starter.ftp.FtpService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
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.Strings;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.*;
import org.nutz.mvc.upload.TempFile;
import org.nutz.mvc.upload.UploadAdaptor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -91,19 +97,22 @@ public class LxyHdCon {
@At
@POST
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("zgfw.lxy.hdmange")
public Object doAdd(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, Lxy_mefp[] mefp) throws IOException {
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Object doAdd(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files,@Param(value = "mefp") String jsonStr) throws IOException {
hd.setHdcjsj(new Date());
hd = lxyHdService.insert(hd);
for (Lxy_mefp lxyMefp : mefp) {
lxyMefp.setHdid(hd.getId());
lxyMefp.setNumber(lxyMefp.getNumber() == null ? 0 : lxyMefp.getNumber());
lxyMefpService.insert(lxyMefp);
}
lxyMefpService.setMefp(jsonStr, hd.getId());
// for (Lxy_mefp lxyMefp : mefp) {
// lxyMefp.setHdid(hd.getId());
// lxyMefp.setNumber(lxyMefp.getNumber() == null ? 0 : lxyMefp.getNumber());
// lxyMefpService.insert(lxyMefp);
// }
for (TempFile file : files) {
String rid = R.UU32();
@@ -123,19 +132,23 @@ public class LxyHdCon {
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("zgfw.lxy.hdmange")
public Object doEditMefp(Lxy_mefp[] mefp) {
for (Lxy_mefp lxyMefp : mefp) {
baseService.dao().update("lxy_mefp", Chain.make("number", lxyMefp.getNumber()), Cnd.where("ghid", "=", lxyMefp.getGhid()).and("hdid", "=", lxyMefp.getHdid()));
}
public Object doEditMefp(@Param("mefp") String jsonStr, String hdId) {
lxyMefpService.dao().clear(Lxy_mefp.class, Cnd.where("hdid","=",hdId));
lxyMefpService.setMefp(jsonStr, hdId);
// for (Lxy_mefp lxyMefp : mefp) {
// baseService.dao().update("lxy_mefp", Chain.make("number", lxyMefp.getNumber()), Cnd.where("ghid", "=", lxyMefp.getGhid()).and("hdid", "=", lxyMefp.getHdid()));
// }
return null;
}
@At
@POST
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("zgfw.lxy.hdmange")
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Object doEdit(Lxy_hd hd, @Param(value = "files",required = false) TempFile[] files, String[] delFiles) throws IOException {
lxyHdService.updateIgnoreNull(hd);
@@ -163,6 +176,7 @@ public class LxyHdCon {
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
@RequiresPermissions("zgfw.lxy.hdmange")
public Object delete(String id) {
List<Record> files = baseService.dao().query("sys_file", Cnd.where("reid", "=", id));
@@ -235,6 +235,7 @@ public class LxyXghshController {
}
@At
@Ok("void")
@RequiresPermissions("zgfw.lxy.xghsh")
public void downLoadAll(@Param(value = "year", required = false) Integer year,
@Param(value = "hdid", required = false) String hdid,
@@ -5,4 +5,6 @@ import io.v.nutz.lxy.model.Lxy_mefp;
public interface LxyMefpService extends BaseService<Lxy_mefp> {
void setMefp(String jsonStr, String hdId);
}
@@ -1,10 +1,16 @@
package io.v.nutz.lxy.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.wizzer.framework.base.service.BaseServiceImpl;
import io.v.nutz.lxy.model.Lxy_mefp;
import io.v.nutz.lxy.service.LxyMefpService;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: 1V
@@ -16,4 +22,21 @@ public class LxyMefpServiceImpl extends BaseServiceImpl<Lxy_mefp> implements Lxy
public LxyMefpServiceImpl(Dao dao) {
super(dao);
}
@Override
public void setMefp(String jsonStr, String hdId) {
if (StrUtil.isNotBlank(jsonStr)) {
List<NutMap> list = JSONUtil.parseArray(jsonStr).toList(NutMap.class);
List<Lxy_mefp> mefpList = new ArrayList<>();
for (NutMap map : list) {
Lxy_mefp mefp = new Lxy_mefp();
mefp.setGhid(map.getString("id"));
mefp.setHdid(hdId);
mefp.setNumber(map.getInt("limitNum"));
mefpList.add(mefp);
}
dao().insert(mefpList);
}
}
}
@@ -1,18 +1,26 @@
package io.v.nutz.wakershome.controller.review;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.wakershome.model.review.CommentNr;
import io.v.nutz.wakershome.model.review.CommentUnionGrading;
import io.v.nutz.wakershome.model.review.CommentZb;
import io.v.nutz.wakershome.service.review.CommentZbService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.random.R;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName addZbController
* @Description TODO
@@ -44,6 +52,7 @@ public class AddZbController {
nr.getBzs().forEach(v->v.setZb_id(zb.getId()));
commentZbService.insertWith(nr, "bzs");
}
commentZbService.setGrading(zb);
});
return null;
@@ -1,6 +1,7 @@
package io.v.nutz.wakershome.controller.review;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
@@ -11,10 +12,7 @@ import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.wakershome.model.review.CommentBz;
import io.v.nutz.wakershome.model.review.CommentNr;
import io.v.nutz.wakershome.model.review.CommentPeo;
import io.v.nutz.wakershome.model.review.CommentZb;
import io.v.nutz.wakershome.model.review.*;
import io.v.nutz.wakershome.service.review.CommentPeoService;
import io.v.nutz.wakershome.service.review.CommentStatisticsService;
import io.v.nutz.wakershome.service.review.CommentZbService;
@@ -24,6 +22,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.ddr.poi.html.HtmlRenderPolicy;
import org.nutz.boot.starter.ftp.FtpService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
@@ -91,11 +90,14 @@ public class StatisticsZpController {
SELECT
un.id,
un.unionname unionName,
IFNULL(grading.gradingName,'未定级') AS gradingName,
grading.isGrading,
count( peo.id ) num
FROM
sys_union un
LEFT JOIN `user` u ON u.unionId = un.id
LEFT JOIN comment_peo peo ON peo.userId = u.id AND peo.zbId = @zbId
LEFT JOIN comment_union_grading grading on un.id = grading.unionId AND grading.zbId = @zbId
$condition
""").setParam("zbId", zbId);
Cnd cnd = Cnd.NEW();
@@ -413,4 +415,17 @@ public class StatisticsZpController {
// Map<String, List<CommentPeo>> collect = peoList.stream().collect(Collectors.groupingBy(CommentPeo::getUnionId));
}
@At
@RequiresPermissions("wakeshome.review.statistics")
public Object doGrading(CommentUnionGrading grading){
if (StrUtil.isAllBlank(grading.getZbId(),grading.getUnionId(),grading.getGradingName())) {
return Result.error("必要参数为空");
}
commentPeoService.dao().update(CommentUnionGrading.class,
Chain.make("isGrading",true).add("gradingName",grading.getGradingName()).add("gradingTime", DateUtil.now()),
Cnd.where("zbId","=",grading.getZbId()).and("unionId","=",grading.getUnionId()));
return Result.success();
}
}
@@ -151,6 +151,7 @@ public class ViewZbController {
});
}
commentZbService.setGrading(commentZb);
/* for (CommentNr nr : commentZb.getNrs()) {
nr.setZb_id(commentZb.getId());
commentNrService.insertWith(nr, "bzs");
@@ -2,6 +2,7 @@ package io.v.nutz.wakershome.model.review;
import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;
@@ -13,6 +14,7 @@ import org.nutz.dao.entity.annotation.*;
*/
@Data
@Table
@EqualsAndHashCode(callSuper = true)
public class CommentBz extends BaseModel {
@Column
@@ -2,6 +2,7 @@ package io.v.nutz.wakershome.model.review;
import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.DB;
import org.nutz.dao.entity.annotation.*;
@@ -15,6 +16,7 @@ import java.util.List;
*/
@Data
@Table
@EqualsAndHashCode(callSuper = true)
public class CommentNr extends BaseModel {
@@ -0,0 +1,66 @@
package io.v.nutz.wakershome.model.review;
import io.v.nutz.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import java.util.Date;
/**
* @version 1.0
* @Author zzr
* @name:CommentUnionGrading
* @Date 2024/9/19 8:48
* @注释 校工会给分工会定级
*/
@Data
@Table
@Comment("校工会给分工会定级表")
@EqualsAndHashCode(callSuper = true)
public class CommentUnionGrading extends BaseModel {
@Column
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("考核指标id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String zbId;
@Column
@Comment("定级的分工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("分工会名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("分工会编码")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionCode;
@Column
@Comment("定级的名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String gradingName;
@Column
@Default("0")
@Comment("是否定级")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isGrading;
@Column
@Comment("定级时间")
@ColDefine(type = ColType.DATETIME)
private Date gradingTime;
}
@@ -1,9 +1,12 @@
package io.v.nutz.wakershome.service.impl.review;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.service.impl.ViServiceImpl;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.wakershome.model.review.CommentBz;
import io.v.nutz.wakershome.model.review.CommentNr;
import io.v.nutz.wakershome.model.review.CommentUnionGrading;
import io.v.nutz.wakershome.model.review.CommentZb;
import io.v.nutz.wakershome.service.review.CommentNrService;
import io.v.nutz.wakershome.service.review.CommentZbService;
@@ -11,7 +14,9 @@ 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.random.R;
import java.util.ArrayList;
import java.util.List;
/**
@@ -44,4 +49,34 @@ public class CommentZbServiceImpl extends ViServiceImpl<CommentZb> implements Co
return zb;
}
@Override
public void setGrading(CommentZb commentZb) {
int count = dao().count(CommentUnionGrading.class, Cnd.where("zbId", "=", commentZb.getId()));
if (count > 0) {
dao().clear(CommentUnionGrading.class, Cnd.where("zbId", "=", commentZb.getId()));
}
if (ObjectUtil.isNotNull(commentZb.getCommentTarget()) && commentZb.getCommentTarget() != 1) {
List<Sys_union> query = new ArrayList<>();
if (commentZb.getCommentTarget() == 2) {
query = dao().query(Sys_union.class, Cnd.NEW());
} else if (commentZb.getCommentTarget() == 3) {
query = dao().query(Sys_union.class, Cnd.where("id", "in", commentZb.getUnionIds()));
}
List<CommentUnionGrading> commentUnionGradings = new ArrayList<>();
for (Sys_union union : query) {
CommentUnionGrading unionGrading = new CommentUnionGrading();
unionGrading.setId(R.UU32());
unionGrading.setUnionId(union.getId());
unionGrading.setZbId(commentZb.getId());
unionGrading.setUnionName(union.getUnionname());
unionGrading.setUnionCode(union.getUnioncode());
unionGrading.setIsGrading(false);
unionGrading.setGradingTime(null);
commentUnionGradings.add(unionGrading);
}
dao().insert(commentUnionGradings);
}
}
}
@@ -8,4 +8,5 @@ public interface CommentZbService extends ViService<CommentZb> {
CommentZb khzb(String zbid);
void setGrading(CommentZb zb);
}