Browse Source

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu 7 months ago
parent
commit
147358c002

+ 17 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/policy/MailboxAdd.java

@@ -0,0 +1,17 @@
+package com.gree.mall.manager.bean.policy;
+
+import com.gree.mall.manager.plus.entity.Mailbox;
+import com.gree.mall.manager.plus.entity.MailboxReceive;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@ApiModel
+@Data
+public class MailboxAdd extends Mailbox {
+
+    @ApiModelProperty(value = "工伤险接收邮箱")
+    private List<MailboxReceive> mailboxReceives;
+}

+ 3 - 3
mall-server-api/src/main/java/com/gree/mall/manager/controller/policy/MailboxController.java

@@ -36,17 +36,17 @@ public class MailboxController {
 
     @PostMapping("/detail")
     @ApiOperation("邮箱配置详情")
-    public ResponseHelper<Mailbox> detail(
+    public ResponseHelper<MailboxAdd> detail(
             HttpServletRequest request
     ) throws ParseException {
-        Mailbox mailbox = agreementLogic.detailMailbox();
+        MailboxAdd mailbox = agreementLogic.detailMailbox();
         return ResponseHelper.success(mailbox);
     }
 
     @PostMapping("/add")
     @ApiOperation("邮箱配置修改")
     public ResponseHelper add(
-            @RequestBody Mailbox mailbox,
+            @RequestBody MailboxAdd mailbox,
             HttpServletRequest request
     ) throws ParseException {
         agreementLogic.addDetail(mailbox);

+ 23 - 4
mall-server-api/src/main/java/com/gree/mall/manager/logic/policy/AgreementLogic.java

@@ -43,6 +43,9 @@ public class AgreementLogic {
     @Autowired
     MailboxSendRecordService mailboxSendRecordService;
 
+    @Autowired
+    MailboxReceiveService mailboxReceiveService;
+
 
 
     public IPage<AgreementVo> list(Page page, ZfireParamBean zfireParam) {
@@ -107,17 +110,24 @@ public class AgreementLogic {
         agreementPolicyService.saveBatch(agreementAddUp.getAgreementPolicies());
     }
 
-    public Mailbox detailMailbox() {
+    public MailboxAdd detailMailbox() {
 
         if (mailboxService.lambdaQuery().eq(Mailbox::getId,"1").count() < 1)
-            return new Mailbox();
+            return new MailboxAdd();
+
+        Mailbox mailbox = mailboxService.getById("1");
+
+        MailboxAdd mailboxAdd = BeanUtil.toBean(mailbox, MailboxAdd.class);
+
+        List<MailboxReceive> list = mailboxReceiveService.lambdaQuery().eq(MailboxReceive::getMailboxId, "1").list();
 
+        mailboxAdd.setMailboxReceives(list);
 
-        return mailboxService.getById("1");
+        return mailboxAdd;
 
     }
 
-    public void addDetail(Mailbox mailbox) {
+    public void addDetail(MailboxAdd mailbox) {
         if (mailboxService.lambdaQuery().eq(Mailbox::getId,"1").count() < 1){
             mailbox.setId("1");
             mailbox.insert();
@@ -126,6 +136,15 @@ public class AgreementLogic {
         mailbox.setId("1");
         mailbox.updateById();
 
+        mailboxReceiveService.lambdaUpdate().eq(MailboxReceive::getMailboxId,"1").remove();
+
+        for (MailboxReceive mailboxReceive : mailbox.getMailboxReceives()) {
+
+            mailboxReceive.setMailboxId("id");
+        }
+
+        mailboxReceiveService.saveBatch(mailbox.getMailboxReceives());
+
     }
 
     public IPage<MailBoxSendRecordVo> listMailBoxRecord(Page page, ZfireParamBean zfireParam) {