Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

hzp 8 years ago
parent
commit
9dd0cf600e

+ 73 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackController.java

@ -3,7 +3,7 @@ package com.yihu.wlyy.web.patient.feedback;
import com.yihu.wlyy.service.app.feedback.AppealService;
import com.yihu.wlyy.service.app.feedback.FeedbackService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping(value = "/patient/feedback")
@Api(description = "居民端意见反馈与账号申诉")
public class PatientFeedbackController extends BaseController {
public class PatientFeedbackController extends WeixinBaseController {
    @Autowired
    private FeedbackService feedbackService;
    @Autowired
@ -45,12 +45,28 @@ public class PatientFeedbackController extends BaseController {
            @RequestParam(required = false) String contact) {
        try {
//        图片上传
            String photos="";
            if (StringUtils.isNotEmpty(images)) {
                images = CommonUtil.copyTempImage(images);
                String[] mediaIds = images.split(",");
                for (String mediaId : mediaIds) {
                    if (StringUtils.isEmpty(mediaId)) {
                        continue;
                    }
                    String temp = saveImageToDisk(mediaId);
                    if (StringUtils.isNotEmpty(temp)) {
                        if (photos.length() == 0) {
                            photos = temp;
                        } else {
                            photos += "," + temp;
                        }
                    }
                }
            }
            if (StringUtils.isNotEmpty(photos)) {
                photos = CommonUtil.copyTempImage(photos);
            }
//        保存到数据库
            feedbackService.saveFeedback(getUID(),1,description,type,images,contact);
            feedbackService.saveFeedback(getUID(),1,description,type,photos,contact);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
@ -77,16 +93,66 @@ public class PatientFeedbackController extends BaseController {
            @RequestParam String phone) {
        try {
//        图片上传
            String photos="";
            if (StringUtils.isNotEmpty(images)) {
                images = CommonUtil.copyTempImage(images);
                String[] mediaIds = images.split(",");
                for (String mediaId : mediaIds) {
                    if (StringUtils.isEmpty(mediaId)) {
                        continue;
                    }
                    String temp = saveImageToDisk(mediaId);
                    if (StringUtils.isNotEmpty(temp)) {
                        if (photos.length() == 0) {
                            photos = temp;
                        } else {
                            photos += "," + temp;
                        }
                    }
                }
            }
            if (StringUtils.isNotEmpty(photos)) {
                photos = CommonUtil.copyTempImage(photos);
            }
//             保存到数据库
            appealService.saveAppeal(getUID(),description,type,images,phone,1);
            appealService.saveAppeal(getUID(),description,type,photos,phone,1);
            return write(200, "保存成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存失败!");
        }
    }
    /**
     * 获取微信服务器图片
     *
     * @return
     */
    public String fetchWxImages() {
        String photos = "";
        try {
            String images = request.getParameter("mediaIds");
            if (StringUtils.isEmpty(images)) {
                return photos;
            }
            String[] mediaIds = images.split(",");
            for (String mediaId : mediaIds) {
                if (StringUtils.isEmpty(mediaId)) {
                    continue;
                }
                String temp = saveImageToDisk(mediaId);
                if (StringUtils.isNotEmpty(temp)) {
                    if (photos.length() == 0) {
                        photos = temp;
                    } else {
                        photos += "," + temp;
                    }
                }
            }
        } catch (Exception e) {
            error(e);
        }
        return photos;
    }
}