diff --git a/src/main/java/com/ydool/boot/api/controller/ApiContactDbController.java b/src/main/java/com/ydool/boot/api/controller/ApiContactDbController.java index ea11816..02c88f9 100644 --- a/src/main/java/com/ydool/boot/api/controller/ApiContactDbController.java +++ b/src/main/java/com/ydool/boot/api/controller/ApiContactDbController.java @@ -180,6 +180,15 @@ public class ApiContactDbController extends ApiBaseController { render(ret); } + @ApiOperation("是否通过") + @PutMapping("evaluate/status/{id}/{status") + @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "常委会联系代表id"), @ApiImplicitParam(name = "status", value = + "是否通过: 1通过,0不通过")}) + public void evaluateStatus(@PathVariable("id") String id,@PathVariable("status") Integer status) { + Ret ret = contactDbService.evaluateStatus(id,status,getApiUser()); + render(ret); + } + @ApiOperation("通知") @PostMapping("send_msg/{id}") @ApiImplicitParam(name = "id", value = "常委会联系代表id") @@ -188,4 +197,6 @@ public class ApiContactDbController extends ApiBaseController { Ret ret = contactDbService.sendMsg(id, getApiUser()); render(ret); } + + } diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/ContactDb.java b/src/main/java/com/ydool/boot/modules/rddb/entity/ContactDb.java index c74a0fd..ef38b1c 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/entity/ContactDb.java +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/ContactDb.java @@ -181,4 +181,10 @@ public class ContactDb extends BaseEntity{ @ApiModelProperty(value = "admin机关办公/ rddb代表/ voter选民 多个用英文逗号间隔") private String obj; + /** + * 是否通过 + */ + @ApiModelProperty(value = "是否通过") + private Boolean status; + } diff --git a/src/main/java/com/ydool/boot/modules/rddb/service/ContactDbService.java b/src/main/java/com/ydool/boot/modules/rddb/service/ContactDbService.java index 870f879..241e631 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/service/ContactDbService.java +++ b/src/main/java/com/ydool/boot/modules/rddb/service/ContactDbService.java @@ -61,7 +61,8 @@ public class ContactDbService extends BaseService { public boolean del(String id) { contactDbUserService.remove(new LambdaQueryWrapper().eq(ContactDbUser::getContactDbId, id)); contactDbAttachmentService.remove(new LambdaQueryWrapper().eq(ContactDbAttachment::getContactDbId, id)); - contactDbCommentService.remove(new LambdaQueryWrapper().eq(ContactDbComment::getContactDbId, id)); + contactDbCommentService.remove(new LambdaQueryWrapper().eq(ContactDbComment::getContactDbId + , id)); return removeById(id); } @@ -92,8 +93,10 @@ public class ContactDbService extends BaseService { saveUser(contactDbBo.getId(), evaluateUserIds, loginUser, ContactDb.STATE_EVALUATE); //保存附件 - saveAttachment(contactDbBo.getId(), contactDbBo.getConferenceRecordAttachmentArrStr(), loginUser, ContactDbAttachment.TYPE_CONFERENCE_RECORD); - saveAttachment(contactDbBo.getId(), contactDbBo.getConferencePhotoAttachmentArrStr(), loginUser, ContactDbAttachment.TYPE_CONFERENCE_PHOTO); + saveAttachment(contactDbBo.getId(), contactDbBo.getConferenceRecordAttachmentArrStr(), loginUser, + ContactDbAttachment.TYPE_CONFERENCE_RECORD); + saveAttachment(contactDbBo.getId(), contactDbBo.getConferencePhotoAttachmentArrStr(), loginUser, + ContactDbAttachment.TYPE_CONFERENCE_PHOTO); return Ret.ok(); } @@ -131,8 +134,10 @@ public class ContactDbService extends BaseService { contactDb.setState(ContactDb.STATE_SIGN); contactDb.setUpdatedId(loginUser.getId()); saveOrUpdate(contactDb); - saveUser(contactDb.getId(), contactDbChooseRequest.getChooseAdminUserIds(), loginUser, ContactDb.STATE_CHOOSE, Const.TYPE_ADMIN); - saveUser(contactDb.getId(), contactDbChooseRequest.getChooseDbUserIds(), loginUser, ContactDb.STATE_CHOOSE, Const.TYPE_RDDB); + saveUser(contactDb.getId(), contactDbChooseRequest.getChooseAdminUserIds(), loginUser, ContactDb.STATE_CHOOSE + , Const.TYPE_ADMIN); + saveUser(contactDb.getId(), contactDbChooseRequest.getChooseDbUserIds(), loginUser, ContactDb.STATE_CHOOSE, + Const.TYPE_RDDB); return contactDb; } @@ -158,7 +163,8 @@ public class ContactDbService extends BaseService { contactDb.setState(ContactDb.STATE_EVALUATE); contactDb.setUpdatedId(loginUser.getId()); saveOrUpdate(contactDb); - saveUser(contactDb.getId(), contactDbConferenceRequest.getConferenceUserIds(), loginUser, ContactDb.STATE_CONFERENCE); + saveUser(contactDb.getId(), contactDbConferenceRequest.getConferenceUserIds(), loginUser, + ContactDb.STATE_CONFERENCE); saveAttachment(contactDb.getId(), contactDbConferenceRequest.getConferenceRecordAttachmentName(), contactDbConferenceRequest.getConferenceRecordAttachmentPath(), loginUser, ContactDbAttachment.TYPE_CONFERENCE_RECORD, @@ -200,7 +206,9 @@ public class ContactDbService extends BaseService { boolean flag = contactDbUserService.saveOrUpdate(contactDbUser); //自动进入下一环节 - int waitCount = contactDbUserService.count(Wrappers.lambdaQuery(ContactDbUser.class).eq(ContactDbUser::getContactDbId, contactDb.getId()).eq(ContactDbUser::getType, ContactDb.STATE_SIGN).isNull(ContactDbUser::getSign)); + int waitCount = + contactDbUserService.count(Wrappers.lambdaQuery(ContactDbUser.class).eq(ContactDbUser::getContactDbId + , contactDb.getId()).eq(ContactDbUser::getType, ContactDb.STATE_SIGN).isNull(ContactDbUser::getSign)); if (waitCount == 0) { contactDb.setState(ContactDb.STATE_CONFERENCE); saveOrUpdate(contactDb); @@ -233,7 +241,9 @@ public class ContactDbService extends BaseService { boolean flag = contactDbUserService.saveOrUpdate(contactDbUser); //自动进入下一环节 - int waitCount = contactDbUserService.count(Wrappers.lambdaQuery(ContactDbUser.class).eq(ContactDbUser::getContactDbId, contactDb.getId()).eq(ContactDbUser::getType, ContactDb.STATE_EVALUATE).isNull(ContactDbUser::getScore)); + int waitCount = + contactDbUserService.count(Wrappers.lambdaQuery(ContactDbUser.class).eq(ContactDbUser::getContactDbId + , contactDb.getId()).eq(ContactDbUser::getType, ContactDb.STATE_EVALUATE).isNull(ContactDbUser::getScore)); if (waitCount == 0) { contactDb.setState(ContactDb.STATE_END); saveOrUpdate(contactDb); @@ -252,6 +262,24 @@ public class ContactDbService extends BaseService { return !flag ? Ret.fail("操作失败") : Ret.ok().data(ContactDbWrapper.build().entityVO(contactDb)); } + public Ret evaluateStatus(String id, Integer status, User loginUser) { + ContactDb contactDb = getById(id); + Assert.notNull(contactDb, "未找到该记录"); + if (!loginUser.getId().equals(contactDb.getCreatedId())) return Ret.fail("您不是创建人,不能操作"); + if (ContactDb.STATE_CONFERENCE != contactDb.getState()) + throw new ResultException(Ret.fail("当前环节不能提交该信息")); + if (status == 0) { + contactDb.setState(ContactDb.STATE_END); + contactDb.setStatus(false); + }else if (status == 1){ + contactDb.setStatus(false); + }else { + return Ret.fail("status传输数据有误"); + } + boolean flag = saveOrUpdate(contactDb); + return !flag ? Ret.fail("操作失败") : Ret.ok().data(ContactDbWrapper.build().entityVO(contactDb)); + } + public Ret sendMsg(String id, User loginUser) { ContactDb contactDb = getById(id); Assert.notNull(contactDb, "未找到该记录"); @@ -330,11 +358,14 @@ public class ContactDbService extends BaseService { } } //3.删除本来有而现在没有的 - contactDbUserService.remove(new LambdaQueryWrapper().eq(ContactDbUser::getContactDbId, contactDbId).eq(ContactDbUser::getType, type).notIn(ContactDbUser::getUserId, userIdList).eq(StrUtil.isNotBlank(identity), ContactDbUser::getIdentity, identity)); + contactDbUserService.remove(new LambdaQueryWrapper().eq(ContactDbUser::getContactDbId, + contactDbId).eq(ContactDbUser::getType, type).notIn(ContactDbUser::getUserId, userIdList).eq(StrUtil.isNotBlank(identity), ContactDbUser::getIdentity, identity)); contactDbUserService.saveBatch(userList); } else { //4.删除全部 - contactDbUserService.remove(new LambdaQueryWrapper().eq(ContactDbUser::getContactDbId, contactDbId).eq(ContactDbUser::getType, type).eq(StrUtil.isNotBlank(identity), ContactDbUser::getIdentity, identity)); + contactDbUserService.remove(new LambdaQueryWrapper().eq(ContactDbUser::getContactDbId, + contactDbId).eq(ContactDbUser::getType, type).eq(StrUtil.isNotBlank(identity), + ContactDbUser::getIdentity, identity)); } } @@ -360,7 +391,8 @@ public class ContactDbService extends BaseService { item.setCreatedId(loginUser.getId()); item.setCreatedAt(LocalDateTime.now()); if (StrUtil.isNotBlank(item.getConferenceId())) { - conferenceAttachmentService.associationMeeting(item.getConferenceId(), item.getAttachment(), item.getTitle(), "常委会联系代表附件", loginUser.getId()); + conferenceAttachmentService.associationMeeting(item.getConferenceId(), item.getAttachment(), + item.getTitle(), "常委会联系代表附件", loginUser.getId()); } }); contactDbAttachmentService.saveBatch(attachmentList); @@ -375,12 +407,12 @@ public class ContactDbService extends BaseService { * @param type */ private void saveAttachment(String contactDbId, String attachmentName, String attachmentPath, User loginUser, - String type,String conferenceId,String conferenceName) { + String type, String conferenceId, String conferenceName) { contactDbAttachmentService.remove(new LambdaQueryWrapper().eq(ContactDbAttachment::getContactDbId, contactDbId).eq(ContactDbAttachment::getType, type)); if (StrUtil.isNotBlank(attachmentName)) { String[] nameArr = attachmentName.split(","); String[] pathArr = attachmentPath.split(","); - if(StrUtil.isNotBlank(conferenceId)){ + if (StrUtil.isNotBlank(conferenceId)) { String[] conferenceIdArr = conferenceId.split(","); String[] conferenceNameArr = conferenceName.split(","); for (int i = 0; i < nameArr.length; i++) { @@ -389,11 +421,12 @@ public class ContactDbService extends BaseService { .setConferenceName(conferenceNameArr[i]). setContactDbId(contactDbId).setTitle(nameArr[i]).setAttachment(pathArr[i]).setCreatedId(loginUser.getId()).setCreatedAt(LocalDateTime.now()); if (StrUtil.isNotBlank(conferenceIdArr[i])) { - conferenceAttachmentService.associationMeeting(conferenceIdArr[i], conferenceNameArr[i], nameArr[i], "常委会联系代表附件", loginUser.getId()); + conferenceAttachmentService.associationMeeting(conferenceIdArr[i], conferenceNameArr[i], + nameArr[i], "常委会联系代表附件", loginUser.getId()); } contactDbAttachmentService.save(contactDbAttachment); } - }else{ + } else { for (int i = 0; i < nameArr.length; i++) { ContactDbAttachment contactDbAttachment = new ContactDbAttachment(); contactDbAttachment.setType(type)