Selaa lähdekoodia

feature 投诉建议

xiahan 4 kuukautta sitten
vanhempi
commit
caadac5761

+ 19 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/dao/SwFeedBackOpinionDao.java

@@ -0,0 +1,19 @@
+package com.rongwei.zhsw.system.dao;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwe.zhsw.system.domain.SwFeedBackOpinionDo;
+
+/**
+ * @author libai
+ * @description 针对表【sw_feed_back_opinion(意见反馈)】的数据库操作Mapper
+ * @createDate 2025-03-17 13:25:25
+ * @Entity generator.domain.SwFeedBackOpinion
+ */
+public interface SwFeedBackOpinionDao extends BaseMapper<SwFeedBackOpinionDo> {
+
+}
+
+
+
+

+ 3 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/RegistrationService.java

@@ -1,5 +1,6 @@
 package com.rongwei.zhsw.system.service;
 
+import com.rongwe.zhsw.system.vo.WeChatFeedbackReportVo;
 import com.rongwe.zhsw.system.vo.WeChatRepairReportVo;
 import com.rongwei.rwcommon.base.R;
 
@@ -11,4 +12,6 @@ import com.rongwei.rwcommon.base.R;
  */
 public interface RegistrationService {
     R repairRegistration(WeChatRepairReportVo weChatRepairReportVo);
+
+    R feedbackRegistration(WeChatFeedbackReportVo weChatFeedbackReportVo);
 }

+ 14 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/SwFeedBackOpinionService.java

@@ -0,0 +1,14 @@
+package com.rongwei.zhsw.system.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwe.zhsw.system.domain.SwFeedBackOpinionDo;
+
+/**
+* @author libai
+* @description 针对表【sw_feed_back_opinion(意见反馈)】的数据库操作Service
+* @createDate 2025-03-17 13:25:25
+*/
+public interface SwFeedBackOpinionService extends IService<SwFeedBackOpinionDo> {
+
+}

+ 58 - 10
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/RegistrationServiceImpl.java

@@ -1,6 +1,8 @@
 package com.rongwei.zhsw.system.service.impl;
 
+import com.rongwe.zhsw.system.domain.SwFeedBackOpinionDo;
 import com.rongwe.zhsw.system.domain.SwUserRepairDo;
+import com.rongwe.zhsw.system.vo.WeChatFeedbackReportVo;
 import com.rongwe.zhsw.system.vo.WeChatRepairReportVo;
 import com.rongwe.zhsw.system.vo.WeChatUploadVo;
 import com.rongwei.rwcommon.base.R;
@@ -37,7 +39,15 @@ public class RegistrationServiceImpl implements RegistrationService {
     private SwUserRepairServiceImpl swUserRepairService;
     @Autowired
     private SysFileItemServiceImpl sysFileItemService;
+    @Autowired
+    private SwFeedBackOpinionServiceImpl swFeedBackOpinionService;
 
+    /**
+     * 用户保修
+     *
+     * @param weChatRepairReportVo
+     * @return
+     */
     @Override
     public R repairRegistration(WeChatRepairReportVo weChatRepairReportVo) {
         log.info("保存用户保修记录");
@@ -57,13 +67,13 @@ public class RegistrationServiceImpl implements RegistrationService {
         swUserRepairDo.setContactnumber(weChatRepairReportVo.getPhone());
         //用户上传的附件
         List<WeChatUploadVo> images = weChatRepairReportVo.getImages();
-        List<SysFileItemDo> fileItemDos=null;
-        if(images!=null && !images.isEmpty()){
+        List<SysFileItemDo> fileItemDos = null;
+        if (images != null && !images.isEmpty()) {
             fileItemDos = images.stream().map(data -> {
-                return imgSave(data, swUserRepairDo.getId());
+                return imgSave(data, swUserRepairDo.getId(),"REPAIR");
             }).collect(Collectors.toList());
         }
-        if(fileItemDos!=null && !fileItemDos.isEmpty()){
+        if (fileItemDos != null && !fileItemDos.isEmpty()) {
             String imagesStr = fileItemDos.stream().map(data -> data.getFilename() + "-;-" + data.getId())
                     .collect(Collectors.joining("^_^"));
             swUserRepairDo.setImages(imagesStr);
@@ -73,22 +83,60 @@ public class RegistrationServiceImpl implements RegistrationService {
         return R.ok();
     }
 
+    /**
+     * 投诉建议
+     *
+     * @param weChatFeedbackReportVo
+     * @return
+     */
+    @Override
+    public R feedbackRegistration(WeChatFeedbackReportVo weChatFeedbackReportVo) {
+        log.info("用户投诉建议保存");
+        SwFeedBackOpinionDo swFeedBackOpinionDo = new SwFeedBackOpinionDo();
+        swFeedBackOpinionDo.setId(SecurityUtil.getUUID());
+        initModelGeneralParameters(swFeedBackOpinionDo, null);
+        swFeedBackOpinionDo.setFeedbackno(uniqueSign());
+        swFeedBackOpinionDo.setFeedbackperson(weChatFeedbackReportVo.getContact());
+        swFeedBackOpinionDo.setContactnumber(weChatFeedbackReportVo.getPhone());
+        swFeedBackOpinionDo.setCategory(weChatFeedbackReportVo.getCategory());
+        swFeedBackOpinionDo.setReplynote(weChatFeedbackReportVo.getDescription());
+        swFeedBackOpinionDo.setIscompleted("2");
+        //用户上传的附件
+        List<WeChatUploadVo> images = weChatFeedbackReportVo.getImages();
+        List<SysFileItemDo> fileItemDos = null;
+        if (images != null && !images.isEmpty()) {
+            fileItemDos = images.stream().map(data -> {
+                return imgSave(data, swFeedBackOpinionDo.getId(),"FEEDBACK");
+            }).collect(Collectors.toList());
+        }
+        if (fileItemDos != null && !fileItemDos.isEmpty()) {
+            String imagesStr = fileItemDos.stream().map(data -> data.getFilename() + "-;-" + data.getId())
+                    .collect(Collectors.joining("^_^"));
+            swFeedBackOpinionDo.setFile(imagesStr);
+
+            sysFileItemService.saveBatch(fileItemDos);
+        }
+        swFeedBackOpinionService.save(swFeedBackOpinionDo);
+        return R.ok();
+    }
+
 
-    public SysFileItemDo imgSave(WeChatUploadVo weChatUploadVo,String id) {
+    public SysFileItemDo imgSave(WeChatUploadVo weChatUploadVo, String id,String pathSuffix) {
         String base64 = weChatUploadVo.getBase64();
+        String filePath="/upload_files/"+pathSuffix+"/";
         // 微信临时文件的目录
         String tempFilePath = weChatUploadVo.getTempFilePath();
-        String fileName =  tempFilePath.substring(tempFilePath.lastIndexOf("tmp/")+4);
+        String fileName = tempFilePath.substring(tempFilePath.lastIndexOf("tmp/") + 4);
         ImageScaleDto scaleDto = ImageScaleDto.builder().scaleFlag(false).build();
-        FileUtil.uploadFile(Base64.getDecoder().decode(base64), "/upload_files/REPAIR", fileName, scaleDto);
+        FileUtil.uploadFile(Base64.getDecoder().decode(base64),filePath , fileName, scaleDto);
 
-        SysFileItemDo sysFileItem= new SysFileItemDo();
+        SysFileItemDo sysFileItem = new SysFileItemDo();
         sysFileItem.setFilename(fileName);
         sysFileItem.setFilesize(weChatUploadVo.getSize());
         sysFileItem.setFiletype(fileName.substring(fileName.lastIndexOf(".") + 1));
         sysFileItem.setStoragetype("1");
-        sysFileItem.setFullpath("/upload_files/REPAIR" + fileName);
-        sysFileItem.setUrlpath("/files/REPAIR" + fileName);
+        sysFileItem.setFullpath(filePath + fileName);
+        sysFileItem.setUrlpath("/files/"+pathSuffix+"/" + fileName);
         sysFileItem.setRelationid(id);
         sysFileItem.setId(SecurityUtil.getUUID());
         sysFileItem.setCreatedate(new Date());

+ 22 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwFeedBackOpinionServiceImpl.java

@@ -0,0 +1,22 @@
+package com.rongwei.zhsw.system.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwe.zhsw.system.domain.SwFeedBackOpinionDo;
+import com.rongwei.zhsw.system.dao.SwFeedBackOpinionDao;
+import com.rongwei.zhsw.system.service.SwFeedBackOpinionService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author libai
+ * @description 针对表【sw_feed_back_opinion(意见反馈)】的数据库操作Service实现
+ * @createDate 2025-03-17 13:25:25
+ */
+@Service
+public class SwFeedBackOpinionServiceImpl extends ServiceImpl<SwFeedBackOpinionDao, SwFeedBackOpinionDo>
+        implements SwFeedBackOpinionService {
+
+}
+
+
+
+

+ 35 - 0
zhsw-entity/src/main/java/com/rongwe/zhsw/system/vo/WeChatFeedbackReportVo.java

@@ -0,0 +1,35 @@
+package com.rongwe.zhsw.system.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * WeChatRepairReportVo class
+ *
+ * @author XH
+ * @date 2025/03/16
+ */
+@Data
+public class WeChatFeedbackReportVo {
+    /**
+     * 投诉建议分类
+     */
+    private String category;
+    /**
+     * 联系人
+     */
+    private String contact;
+    /**
+     * 联系电话
+     */
+    private String phone;
+    /**
+     * 描述
+     */
+    private String description;
+    /**
+     * 故障附件
+     */
+    private List<WeChatUploadVo> images;
+}

+ 5 - 0
zhsw-server/src/main/java/com/rongwei/zhsw/system/controller/weChat/RegistrationController.java

@@ -8,6 +8,7 @@ package com.rongwei.zhsw.system.controller.weChat;
  */
 
 import com.rongwe.zhsw.system.vo.BillListSearchVo;
+import com.rongwe.zhsw.system.vo.WeChatFeedbackReportVo;
 import com.rongwe.zhsw.system.vo.WeChatRepairReportVo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.zhsw.system.service.RegistrationService;
@@ -33,4 +34,8 @@ public class RegistrationController {
     private R repairRegistration(@RequestBody WeChatRepairReportVo weChatRepairReportVo) {
         return registrationService.repairRegistration(weChatRepairReportVo);
     }
+    @PostMapping("/feedback")
+    private R feedbackRegistration(@RequestBody WeChatFeedbackReportVo weChatFeedbackReportVo) {
+        return registrationService.feedbackRegistration(weChatFeedbackReportVo);
+    }
 }