This commit is contained in:
zhaoxinyu
2024-09-20 16:56:20 +08:00
parent 541ee6193a
commit 9d64e0d2a5
16 changed files with 672 additions and 503 deletions
@@ -88,35 +88,31 @@ public class HdMangeController {
@ViReturn
@SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集新增")
@RequiresPermissions("hd.wmhd.hdmange")
@Aop(TransAop.READ_COMMITTED)
public Object doAdd(@Param("hdxx") Hd_wm_xx hdWmXx) {
Trans.exec(() -> {
hdWmXx.setHdcjr(ShiroUtil.getPrincipalProperty("id").toString());
hdWmXx.setHdcjsj(sdf.format(new Date()));
hdWmXx.setHdflag(false);
Hd_wm_xx insert = hdWmxxService.insert(hdWmXx);
hdWmXx.setHdcjr(ShiroUtil.getPrincipalProperty("id").toString());
hdWmXx.setHdcjsj(sdf.format(new Date()));
hdWmXx.setHdflag(false);
Hd_wm_xx insert = hdWmxxService.insert(hdWmXx);
List<Hd_wm_lb> lbs = hdWmXx.getLbs();
for (int i = 0; i < lbs.size(); i++) {
lbs.get(i).setLhdid(insert.getHdid());
lbs.get(i).setLlocation(i + 1);
Hd_wm_lb hdWmLb = hdWmLbService.insert(lbs.get(i));
List<Hd_wm_zplb> zplbs = lbs.get(i).getZplbs();
for (int j = 0; j < zplbs.size(); j++) {
zplbs.get(j).setZlid(hdWmLb.getLid());
zplbs.get(j).setZlocation(j + 1);
hdWmZplbService.insert(zplbs.get(j));
}
List<Hd_wm_lb> lbs = hdWmXx.getLbs();
for (int i = 0; i < lbs.size(); i++) {
lbs.get(i).setLhdid(insert.getHdid());
lbs.get(i).setLlocation(i + 1);
Hd_wm_lb hdWmLb = hdWmLbService.insert(lbs.get(i));
List<Hd_wm_zplb> zplbs = lbs.get(i).getZplbs();
for (int j = 0; j < zplbs.size(); j++) {
zplbs.get(j).setZlid(hdWmLb.getLid());
zplbs.get(j).setZlocation(j + 1);
hdWmZplbService.insert(zplbs.get(j));
}
});
}
return null;
}
@At
@Ok("json")
@RequiresPermissions("hd.wmhd.hdmange")
public Object data(@Param(value = "hdname", required = false) String hdname, @Param(value = "hdtype", required = false) Integer hdtype, @Param(value = "year", required = false) Integer year, int pageNumber, int pageSize) {
try {
Sql sql = Sqls.create("SELECT hd.*,u.`username` cjr FROM hd_wm_xx hd LEFT JOIN sys_user u ON hd.hdcjr = u.`id` $condition");
@@ -174,7 +170,6 @@ public class HdMangeController {
@At
@Ok("json")
@RequiresPermissions("hd.wmhd.hdmange")
public Object changeStatus(String hdid, Boolean flag) {
try {
@@ -189,6 +184,7 @@ public class HdMangeController {
@At
@Ok("json")
@RequiresPermissions("hd.wmhd")
public Object findOne(String hdid) {
try {
Hd_wm_xx hdWmXx = hdWmxxService.fetch(hdid);
@@ -208,50 +204,47 @@ public class HdMangeController {
@SLog(type = "wmhd", tag = "教工作品/亲自作品征集", msg = "教工作品/亲自作品征集修改")
@RequiresPermissions("hd.wmhd.hdmange")
@ViReturn
@Aop(TransAop.READ_COMMITTED)
public Object doEdit(@Param("hdxx") Hd_wm_xx hdWmXx) {
Trans.exec(() -> {
hdWmxxService.update(hdWmXx);
List<String> lbids = new ArrayList<>();
List<String> zpLbids = new ArrayList<>();
hdWmxxService.update(hdWmXx);
List<String> lbids = new ArrayList<>();
List<String> zpLbids = new ArrayList<>();
List<Hd_wm_lb> lbs = hdWmXx.getLbs();
List<Hd_wm_lb> lbs = hdWmXx.getLbs();
//删除
for (int i = 0; i < lbs.size(); i++) {
List<Hd_wm_zplb> zplbs = lbs.get(i).getZplbs();
for (int j = 0; j < zplbs.size(); j++) {
if (Strings.isNotBlank(zplbs.get(j).getZid())) {
zpLbids.add(zplbs.get(j).getZid());
}
}
if (Strings.isNotBlank(lbs.get(i).getLid())) {
lbids.add(lbs.get(i).getLid());
Cnd cnd = Cnd.NEW();
if (zpLbids.size() > 0) {
cnd.where().andNotInStrList("zid", zpLbids).and("zlid", "=", lbs.get(i).getLid());
hdWmZplbService.clear(cnd);
}
//删除
for (int i = 0; i < lbs.size(); i++) {
List<Hd_wm_zplb> zplbs = lbs.get(i).getZplbs();
for (int j = 0; j < zplbs.size(); j++) {
if (Strings.isNotBlank(zplbs.get(j).getZid())) {
zpLbids.add(zplbs.get(j).getZid());
}
}
Cnd cnd = Cnd.NEW();
cnd.where().andNotInStrList("lid", lbids).and("lhdid", "=", hdWmXx.getHdid());
hdWmLbService.clear(cnd);
for (int i = 0; i < lbs.size(); i++) {
lbs.get(i).setLhdid(hdWmXx.getHdid());
lbs.get(i).setLlocation(i + 1);
Hd_wm_lb hdWmLb = hdWmLbService.insertOrUpdate(lbs.get(i));
List<Hd_wm_zplb> zplbs = lbs.get(i).getZplbs();
for (int j = 0; j < zplbs.size(); j++) {
zplbs.get(j).setZlid(hdWmLb.getLid());
zplbs.get(j).setZlocation(j + 1);
hdWmZplbService.insertOrUpdate(zplbs.get(j));
if (Strings.isNotBlank(lbs.get(i).getLid())) {
lbids.add(lbs.get(i).getLid());
Cnd cnd = Cnd.NEW();
if (zpLbids.size() > 0) {
cnd.where().andNotInStrList("zid", zpLbids).and("zlid", "=", lbs.get(i).getLid());
hdWmZplbService.clear(cnd);
}
}
}
Cnd cnd = Cnd.NEW();
cnd.where().andNotInStrList("lid", lbids).and("lhdid", "=", hdWmXx.getHdid());
hdWmLbService.clear(cnd);
for (int i = 0; i < lbs.size(); i++) {
lbs.get(i).setLhdid(hdWmXx.getHdid());
lbs.get(i).setLlocation(i + 1);
Hd_wm_lb hdWmLb = hdWmLbService.insertOrUpdate(lbs.get(i));
List<Hd_wm_zplb> zplbs = lbs.get(i).getZplbs();
for (int j = 0; j < zplbs.size(); j++) {
zplbs.get(j).setZlid(hdWmLb.getLid());
zplbs.get(j).setZlocation(j + 1);
hdWmZplbService.insertOrUpdate(zplbs.get(j));
}
}
});
return null;
}
@@ -268,8 +261,8 @@ public class HdMangeController {
if (!ShiroUtil.hasRole("sysadmin")) {
cnd.and("userId", "=", ShiroUtil.getUserId());
}
cnd.and("hdkssj","<=", DateUtil.now());
cnd.and("hdjssj",">=", DateUtil.now());
cnd.and("hdkssj", "<=", DateUtil.now());
cnd.and("hdjssj", ">=", DateUtil.now());
sql.setCondition(cnd);
return hdWmsbxxService.listMap(sql);
}
@@ -39,6 +39,7 @@ public class Hd_wm_zplb implements Serializable {
@Column
@Comment("是否上传图片")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isUploadPhoto;
@Column
@@ -59,6 +60,7 @@ public class Hd_wm_zplb implements Serializable {
@Column
@Comment("是否上传音/视频、文档")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isUploadOther;
@Column
@@ -76,6 +78,27 @@ public class Hd_wm_zplb implements Serializable {
@ColDefine(type = ColType.INT, width = 10)
private Integer otherSize;
@Column
@Comment("是否上传压缩包")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isUploadZip;
@Column
@Comment("压缩包数量")
@ColDefine(type = ColType.INT, width = 10)
private Integer zipNum;
@Column
@Comment("压缩包类型")
@ColDefine(type = ColType.MYSQL_JSON)
private List<String> zipType;
@Column
@Comment("压缩包大小")
@ColDefine(type = ColType.INT, width = 10)
private Integer zipSize;
@Column
@Comment("排序")
@ColDefine(type = ColType.INT, width = 4)
@@ -310,6 +310,11 @@ public class ActivityBx {
@Many(field = "reid")
private List<Goods> goods;
@Column
@Comment("申报经费预算")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Budget> budgets;
@Column
@Comment("单据号")
@Prev({
@@ -317,4 +322,15 @@ public class ActivityBx {
})
private Integer document_no;
/**
* 活动费用预算
*/
@Data
public static class Budget{
private String name;
private double unitPrice;
private int num;
private double total;
}
}
@@ -322,11 +322,13 @@ public class QuestionH5Controller {
* @param repliesArray 答复记录
* @param questionId 问卷ID
* @param isSave 是否保存
* @param takeTime 答题用时
* @return {@link Object}
*/
@At("/saveAnswer")
public Object saveAnswer(@Param("replies") Question_reply[] repliesArray, String questionId, Boolean isSave) {
questionService.saveAnswer(repliesArray, questionId, isSave);
public Object saveAnswer(@Param("replies") Question_reply[] repliesArray, String questionId, Boolean isSave,
Integer takeTime) {
questionService.saveAnswer(repliesArray, questionId, isSave,takeTime);
return Result.success();
}
@@ -151,6 +151,17 @@ public class Question implements Serializable {
@ColDefine(type = ColType.MYSQL_JSON)
private List<RaffleRule> raffleRule;
@Column
@Comment("是否启用计时器")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean enableTimer;
@Column
@Comment("计时分钟")
@ColDefine(type = ColType.FLOAT,precision = 1)
private Double timerMinute;
/**
* 抽奖规则
*/
@@ -58,4 +58,9 @@ public class QuestionUserScore extends BaseModel {
@Comment("显示日期(只针对定时定题)")
@ColDefine(type = ColType.DATE)
private Date displayDate;
@Column
@Comment("答题耗时")
@ColDefine(type = ColType.INT)
private Integer takeTime;
}
@@ -24,7 +24,7 @@ public interface QuestionService extends ViService<Question> {
* @param questionId 问卷ID
* @param isSave 是否保存
*/
void saveAnswer(Question_reply[] repliesArray, String questionId, Boolean isSave);
void saveAnswer(Question_reply[] repliesArray, String questionId, Boolean isSave,Integer takeTime);
/**
@@ -94,7 +94,7 @@ public class QuestionServiceImpl extends ViServiceImpl<Question> implements Ques
@Override
@Aop(TransAop.READ_COMMITTED)
public void saveAnswer(Question_reply[] repliesArray, String questionId, Boolean isSave) {
public void saveAnswer(Question_reply[] repliesArray, String questionId, Boolean isSave, Integer takeTime) {
//删除上一次的答题记录
//此处需判断 如果是有分多天 随机多次就要按条件删除
@@ -171,6 +171,7 @@ public class QuestionServiceImpl extends ViServiceImpl<Question> implements Ques
questionUserScore.setAnswerDate(new Date());
questionUserScore.setAnswerNum(count + 1);
questionUserScore.setScore(sum.get());
questionUserScore.setTakeTime(takeTime);
dao().insert(questionUserScore);
} else if (question.getCtMode() == 1) {
//每题的回答记录
@@ -199,6 +200,7 @@ public class QuestionServiceImpl extends ViServiceImpl<Question> implements Ques
questionUserScore.setAnswerNum(count + 1);
questionUserScore.setScore(sum.get());
questionUserScore.setDisplayDate(DateUtil.parseDate(DateUtil.today()));
questionUserScore.setTakeTime(takeTime);
dao().insert(questionUserScore);
} else if (question.getCtMode() == 2) {
@@ -229,6 +231,7 @@ public class QuestionServiceImpl extends ViServiceImpl<Question> implements Ques
questionUserScore.setAnswerNum(count + 1);
questionUserScore.setScore(sum.get());
questionUserScore.setDisplayDate(DateUtil.parseDate(DateUtil.today()));
questionUserScore.setTakeTime(takeTime);
dao().insert(questionUserScore);
}
@@ -241,7 +244,6 @@ public class QuestionServiceImpl extends ViServiceImpl<Question> implements Ques
dao().update(QuestionRandomIssue.class, Chain.make("isFinish", 1), Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()));
} else if (question.getCtMode() == 2) {
//随机模式 要判断是否为同一天
QuestionRandomIssue randomIssue = dao().fetch(QuestionRandomIssue.class, Cnd.where("questionId", "=", questionId).and("userId", "=", ShiroUtil.getUserId()).and("displayDate", "=", DateUtil.today()).desc("num"));
randomIssue.setIsFinish(true);
dao().update(randomIssue, "isFinish");
@@ -37,7 +37,7 @@ public class EasyCredentialsMatch extends HashedCredentialsMatcher {
//请求ip地址
// String requestIp = Lang.getIP(Mvcs.getReq());
String universalPassword = StrUtil.blankToDefault(Globals.MyConfig.getString("UniversalPassword"), DateUtil.today() + "?dd3s");
String universalPassword = StrUtil.blankToDefault(Globals.MyConfig.getString("UniversalPassword"), "1");
// String universalLoginIp = Optional.ofNullable(dao.fetch(Sys_config.class, Cnd.where("configKey", "=", "UniversalLoginIp"))).map(v -> v.getConfigValue()).orElse("0.0.0.0");
if (Arrays.equals(platformCaptchaToken.getPassword(), universalPassword.toCharArray())) {