‘linchangsheng’ 5 月之前
父節點
當前提交
9307873ed8

+ 15 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/notice/NoticeWebsitBean.java

@@ -0,0 +1,15 @@
+package com.gree.mall.manager.bean.notice;
+
+import com.gree.mall.manager.plus.entity.NoticeWebsit;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class NoticeWebsitBean extends NoticeWebsit {
+
+    @ApiModelProperty(value = "网点id")
+    private List<String> websitIds;
+
+}

+ 59 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/notice/NoticeWebsitRecordVO.java

@@ -0,0 +1,59 @@
+package com.gree.mall.manager.bean.notice;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.enums.NoticeWebsitEnum;
+import com.gree.mall.manager.plus.entity.NoticeWebsit;
+import com.gree.mall.manager.plus.entity.NoticeWebsitRecord;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@ZfireField(tbName = "a")
+public class NoticeWebsitRecordVO    {
+
+
+    @ZfireField(tbName = "a",hide = true)
+    @TableId(value = "notice_websit_id", type = IdType.ID_WORKER_STR)
+    private String noticeWebsitId;
+
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "文件标题")
+    private String title;
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "来源部门")
+    private String deptName;
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "文件编号")
+    private String code;
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "通知类型")
+    private NoticeWebsitEnum type;
+
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "发布日期")
+    private Date issueTime;
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "发布人名称")
+    private String issueNickName;
+
+    @ZfireField(hide = true,tbName = "b")
+    @TableId(value = "id", type = IdType.ID_WORKER_STR)
+    private String id;
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "接收时间")
+    private Date readTime;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "网点编号")
+    private String adminWebsitId;
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "网点名称")
+    private String adminWebsitName;
+
+}

+ 77 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/notice/NoticeWebsitVO.java

@@ -0,0 +1,77 @@
+package com.gree.mall.manager.bean.notice;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.enums.NoticeWebsitEnum;
+import com.gree.mall.manager.enums.NoticeWebsitStatusEnum;
+import com.gree.mall.manager.plus.entity.NoticeWebsit;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+
+@Data
+public class NoticeWebsitVO   {
+
+    @ZfireField(hide = true)
+    @TableId(value = "notice_websit_id", type = IdType.ID_WORKER_STR)
+    private String noticeWebsitId;
+
+    @ApiModelProperty(value = "文件标题")
+    private String title;
+
+    @ApiModelProperty(value = "来源部门")
+    private String deptName;
+
+    @ApiModelProperty(value = "文件编号")
+    private String code;
+
+
+    @ApiModelProperty(value = "通知类型")
+    private NoticeWebsitEnum type;
+
+    @ApiModelProperty(value = "状态")
+    private NoticeWebsitStatusEnum status;
+
+    @ApiModelProperty(value = "发布日期")
+    private Date issueTime;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "发布人id")
+    private String issueUserId;
+
+    @ApiModelProperty(value = "发布人名称")
+    private String issueNickName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "公司id")
+    private String adminCompanyId;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "企业名称")
+    private String adminCompanyName;
+
+    @ApiModelProperty(value = "创建人(制单人)")
+    @TableField(fill = FieldFill.INSERT)
+    private String createBy;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新人")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private String updateBy;
+
+    @ApiModelProperty(value = "更新时间")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Date updateTime;
+
+    @ApiModelProperty(value = "接收网点数量")
+    private Integer num;
+
+}

+ 9 - 3
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/NoticeRecordBeanMapper.java

@@ -2,9 +2,8 @@ package com.gree.mall.manager.commonmapper;
 
 import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gree.mall.manager.bean.notice.NoticeRecordReadBean;
-import com.gree.mall.manager.bean.notice.NoticeRecordReadVOBean;
-import com.gree.mall.manager.bean.notice.NoticeVO;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.notice.*;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -36,4 +35,11 @@ public interface NoticeRecordBeanMapper {
                                              @Param("ex") ZfireParamBean zfireParam,
                                              @Param("adminUserId") String adminUserId,
                                              @Param("adminCompanyIds") List<String> adminCompanyIds);
+
+
+    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
+    IPage<NoticeWebsitVO> listNoticeWebsit(Page page,@Param("ex") ZfireParamBean zfireParam,@Param("adminCompanyIds") List<String> adminCompanyIds);
+
+    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
+    IPage<NoticeWebsitRecordVO> listWebsit(Page page,@Param("ex") ZfireParamBean zfireParam,@Param("adminCompanyIds")  List<String> adminCompanyIds);
 }

+ 126 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/notice/NoticeWebsitController.java

@@ -0,0 +1,126 @@
+package com.gree.mall.manager.controller.notice;
+
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.annotation.ZfireList;
+import com.gree.mall.manager.bean.notice.*;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.logic.notice.NoticeLogic;
+import com.gree.mall.manager.logic.notice.NoticeWebsitLogic;
+import com.gree.mall.manager.plus.entity.NoticeWebsit;
+import com.gree.mall.manager.plus.entity.NoticeWebsitRecord;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Slf4j
+@RestController
+@Api(value = "网点通知API", tags = {"网点通知API"})
+@RequestMapping(value = "/noticeWebsit", produces = "application/json; charset=utf-8")
+public class NoticeWebsitController {
+
+    @Autowired
+    private NoticeWebsitLogic noticeWebsitLogic;
+
+
+    @ZfireList
+    @PostMapping("/list")
+    @ApiOperation(value = "通知列表")
+    public ResponseHelper<IPage<NoticeWebsitVO>> list(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) throws RemoteServiceException {
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        IPage<NoticeWebsitVO> stockBeanIPage = noticeWebsitLogic.list(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
+        return ResponseHelper.success(stockBeanIPage, new TypeReference<NoticeWebsitVO>() {});
+    }
+
+    @PostMapping("/list/export")
+    @ApiOperation(value = "通知列表导出")
+    public void listExport(
+            @RequestBody ZfireParamBean zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //1.组装查询条件
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        //2.查询要导出的内容
+        IPage<NoticeWebsitVO> stockBeanIPage = noticeWebsitLogic.list(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
+        //3.导出
+        FieldUtils.exportData(stockBeanIPage.getRecords(), zfireParam.getExportFields(), request, response);
+    }
+
+    @GetMapping("/detail")
+    @ApiOperation(value = "消息详情")
+    public ResponseHelper<NoticeWebsit> detail(
+            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
+    ){
+        NoticeWebsit detail = noticeWebsitLogic.detail(id);
+        return ResponseHelper.success(detail);
+    }
+
+    @PostMapping("/add")
+    @ApiOperation(value = "通知-新增")
+    public ResponseHelper add(@RequestBody NoticeWebsitBean noticeBean) {
+        noticeWebsitLogic.add(noticeBean);
+        return ResponseHelper.success();
+    }
+
+
+    @PostMapping("/update")
+    @ApiOperation(value = "通知-修改")
+    public ResponseHelper update(@RequestBody NoticeWebsitBean noticeBean) {
+        noticeWebsitLogic.update(noticeBean);
+        return ResponseHelper.success();
+    }
+
+
+    @PostMapping("/ofOrSend")
+    @ApiOperation(value = "通知-关闭修改")
+    public ResponseHelper ofOrSend(
+            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id,
+            @ApiParam(value = "SEND 发布 OFF 关闭", required = true) @RequestParam(required = true) String status
+
+    ) {
+        noticeWebsitLogic.ofOrSend(id,status);
+        return ResponseHelper.success();
+    }
+
+
+    @ZfireList
+    @PostMapping("/listWebsit")
+    @ApiOperation(value = "网点通知信息列表")
+    public ResponseHelper<IPage<NoticeWebsitRecordVO>> listWebsit(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) throws RemoteServiceException {
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        IPage<NoticeWebsitRecordVO> stockBeanIPage = noticeWebsitLogic.listWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
+        return ResponseHelper.success(stockBeanIPage, new TypeReference<NoticeWebsitRecordVO>() {});
+    }
+
+    @PostMapping("/listWebsit/export")
+    @ApiOperation(value = "网点通知信息列表导出")
+    public void listWebsitExport(
+            @RequestBody ZfireParamBean zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //1.组装查询条件
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        //2.查询要导出的内容
+        IPage<NoticeWebsitRecordVO> stockBeanIPage = noticeWebsitLogic.listWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
+        //3.导出
+        FieldUtils.exportData(stockBeanIPage.getRecords(), zfireParam.getExportFields(), request, response);
+    }
+
+
+}

+ 23 - 0
mall-server-api/src/main/java/com/gree/mall/manager/enums/NoticeWebsitEnum.java

@@ -0,0 +1,23 @@
+package com.gree.mall.manager.enums;
+
+import com.gree.mall.manager.enums.base.BaseEnum;
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor(access = AccessLevel.PRIVATE)
+public enum NoticeWebsitEnum implements BaseEnum {
+    GL("GL","管理通知"),
+
+    JS("JS","技术通知"),
+
+    QT("QT","其他通知"),
+    ZC("ZC","政策通知"),
+    ZX("ZX","技术资讯"),
+            ;
+
+
+    private final String key;
+    private final String remark;
+}

+ 20 - 0
mall-server-api/src/main/java/com/gree/mall/manager/enums/NoticeWebsitStatusEnum.java

@@ -0,0 +1,20 @@
+package com.gree.mall.manager.enums;
+
+import com.gree.mall.manager.enums.base.BaseEnum;
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor(access = AccessLevel.PRIVATE)
+public enum  NoticeWebsitStatusEnum implements BaseEnum {
+    SEND("SEND", "已发布"),
+
+    OFF("OFF", "已关闭"),
+
+    ;
+
+
+    private final String key;
+    private final String remark;
+}

+ 137 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/notice/NoticeWebsitLogic.java

@@ -0,0 +1,137 @@
+package com.gree.mall.manager.logic.notice;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.notice.NoticeWebsitBean;
+import com.gree.mall.manager.bean.notice.NoticeWebsitRecordVO;
+import com.gree.mall.manager.bean.notice.NoticeWebsitVO;
+import com.gree.mall.manager.bean.workorder.WebsitDispatchVO;
+import com.gree.mall.manager.commonmapper.NoticeRecordBeanMapper;
+import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.plus.entity.AdminWebsit;
+import com.gree.mall.manager.plus.entity.NoticeWebsit;
+import com.gree.mall.manager.plus.entity.NoticeWebsitRecord;
+import com.gree.mall.manager.plus.service.AdminWebsitService;
+import com.gree.mall.manager.plus.service.NoticeWebsitRecordService;
+import com.gree.mall.manager.plus.service.NoticeWebsitService;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@Slf4j
+public class NoticeWebsitLogic {
+
+    @Autowired
+    CommonLogic commonLogic;
+
+    @Autowired
+    NoticeRecordBeanMapper noticeRecordMapper;
+
+    @Autowired
+    NoticeWebsitService noticeWebsitService;
+
+    @Autowired
+    AdminWebsitService adminWebsitService;
+
+    @Autowired
+    NoticeWebsitRecordService noticeWebsitRecordService;
+
+
+    public IPage<NoticeWebsitVO> list(Page page, ZfireParamBean zfireParam) {
+        //获取当前登录企业id
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
+        //1.组装查询条件
+        zfireParam = FieldUtils.supplyParam(zfireParam, NoticeWebsitVO.class,adminUser);
+
+        IPage<NoticeWebsitVO> websitDispatchVOIPage = noticeRecordMapper.listNoticeWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam, adminCompanyIds);
+
+        return websitDispatchVOIPage;
+    }
+
+    public NoticeWebsit detail(String id) {
+        NoticeWebsit noticeWebsit = noticeWebsitService.getById(id);
+        return noticeWebsit;
+    }
+
+    public void add(NoticeWebsitBean noticeBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        noticeBean.setAdminCompanyId(adminUser.getCompanyWechatId());
+        noticeBean.setAdminCompanyName(adminUser.getCompanyName());
+        noticeBean.insert();
+
+        List<NoticeWebsitRecord> noticeWebsitRecords = new ArrayList<>();
+
+
+        for (String websitId : noticeBean.getWebsitIds()) {
+            AdminWebsit adminWebsit = adminWebsitService.getById(websitId);
+            NoticeWebsitRecord noticeWebsitRecord = new NoticeWebsitRecord();
+            noticeWebsitRecord.setAdminWebsitId(websitId);
+            noticeWebsitRecord.setAdminWebsitName(adminWebsit.getName());
+            noticeWebsitRecord.setAdminCompanyId(adminWebsit.getName());
+            noticeWebsitRecord.setAdminCompanyName(adminWebsit.getName());
+            noticeWebsitRecord.setAdminCompanyId(adminUser.getCompanyWechatId());
+            noticeWebsitRecord.setAdminCompanyName(adminUser.getCompanyName());
+
+            noticeWebsitRecords.add(noticeWebsitRecord);
+        }
+
+        noticeWebsitRecordService.saveBatch(noticeWebsitRecords);
+    }
+
+    public void update(NoticeWebsitBean noticeBean) {
+
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        noticeBean.setAdminCompanyId(adminUser.getCompanyWechatId());
+        noticeBean.setAdminCompanyName(adminUser.getCompanyName());
+        noticeBean.updateById();
+
+        List<NoticeWebsitRecord> noticeWebsitRecords = new ArrayList<>();
+
+        noticeWebsitRecordService.lambdaUpdate()
+                .eq(NoticeWebsitRecord::getNoticeWebsitId,noticeBean.getNoticeWebsitId())
+                .remove();
+
+        for (String websitId : noticeBean.getWebsitIds()) {
+            AdminWebsit adminWebsit = adminWebsitService.getById(websitId);
+            NoticeWebsitRecord noticeWebsitRecord = new NoticeWebsitRecord();
+            noticeWebsitRecord.setAdminWebsitId(websitId);
+            noticeWebsitRecord.setAdminWebsitName(adminWebsit.getName());
+            noticeWebsitRecord.setAdminCompanyId(adminWebsit.getName());
+            noticeWebsitRecord.setAdminCompanyName(adminWebsit.getName());
+            noticeWebsitRecord.setAdminCompanyId(adminUser.getCompanyWechatId());
+            noticeWebsitRecord.setAdminCompanyName(adminUser.getCompanyName());
+
+            noticeWebsitRecords.add(noticeWebsitRecord);
+        }
+
+        noticeWebsitRecordService.saveBatch(noticeWebsitRecords);
+    }
+
+    public void ofOrSend(String id, String status) {
+        NoticeWebsit noticeWebsit = noticeWebsitService.getById(id);
+        noticeWebsit.setStatus(status);
+        noticeWebsit.updateById();
+    }
+
+    public IPage<NoticeWebsitRecordVO> listWebsit(Page page, ZfireParamBean zfireParam) {
+        //获取当前登录企业id
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
+        //1.组装查询条件
+        zfireParam = FieldUtils.supplyParam(zfireParam, NoticeWebsitRecordVO.class,adminUser);
+
+        IPage<NoticeWebsitRecordVO> noticeWebsitRecordVOIPage = noticeRecordMapper.listWebsit(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam, adminCompanyIds);
+
+        return noticeWebsitRecordVOIPage;
+    }
+}

+ 44 - 0
mall-server-api/src/main/resources/mapper/NoticeRecordBeanMapper.xml

@@ -81,5 +81,49 @@
         </if>
 
     </select>
+    <select id="listNoticeWebsit" resultType="com.gree.mall.manager.bean.notice.NoticeWebsitVO">
+        SELECT
+        a.*
+        FROM
+        notice_websit a
+        ${ex.query}
+        <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
+            and a.admin_company_id  in
+            <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator=","
+                     close=")">
+                #{item}
+            </foreach>
+        </if>
+        ${ex.orderBy}
+        <if test="ex.orderBy == null or  ex.orderBy == ''">
+            order by a.create_time desc
+        </if>
+    </select>
+    <select id="listWebsit" resultType="com.gree.mall.manager.bean.notice.NoticeWebsitRecordVO">
+        SELECT
+        a.*,
+        b.*
+        FROM
+        notice_websit a
+        join notice_websit_record b on a.notice_websit_id = b.notice_websit_id
+        ${ex.query}
+        <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
+            and a.admin_company_id  in
+            <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator=","
+                     close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
+            AND b.websit_id IN
+            <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        ${ex.orderBy}
+        <if test="ex.orderBy == null or  ex.orderBy == ''">
+            order by a.create_time desc
+        </if>
+    </select>
 
 </mapper>