old mode 100644
new mode 100755
| | |
| | | package com.java110.user.api; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.dto.questionAnswer.QuestionAnswerDto; |
| | | import com.java110.dto.userQuestionAnswer.UserQuestionAnswerDto; |
| | | import com.java110.dto.userQuestionAnswerValue.UserQuestionAnswerValueDto; |
| | | import com.java110.po.userQuestionAnswer.UserQuestionAnswerPo; |
| | | import com.java110.po.userQuestionAnswerValue.UserQuestionAnswerValuePo; |
| | | import com.java110.dto.user.UserQuestionAnswerDto; |
| | | import com.java110.dto.user.UserQuestionAnswerValueDto; |
| | | import com.java110.po.user.UserQuestionAnswerPo; |
| | | import com.java110.po.user.UserQuestionAnswerValuePo; |
| | | import com.java110.user.bmo.userQuestionAnswer.IDeleteUserQuestionAnswerBMO; |
| | | import com.java110.user.bmo.userQuestionAnswer.IGetUserQuestionAnswerBMO; |
| | | import com.java110.user.bmo.userQuestionAnswer.ISaveUserQuestionAnswerBMO; |
| | |
| | | import com.java110.user.bmo.userQuestionAnswerValue.IUpdateUserQuestionAnswerValueBMO; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | * @serviceCode /userQuestionAnswer/queryUserQuestionAnswer |
| | | * @path /app/userQuestionAnswer/queryUserQuestionAnswer |
| | | */ |
| | | @RequestMapping(value = "/queryStaffQuestionAnswer", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryStaffQuestionAnswer(@RequestHeader(value = "store-id") String storeId, |
| | | @RequestHeader(value = "user-id") String userId, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | @RequestMapping(value = "/queryUserQuestionAnswer", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryUserQuestionAnswer(@RequestHeader(value = "store-id") String storeId, |
| | | @RequestHeader(value = "user-id") String userId, |
| | | @RequestParam(value = "communityId", required = false) String communityId, |
| | | @RequestParam(value = "roleCd", required = false) String roleCd, |
| | | @RequestParam(value = "state", required = false) String state, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | UserQuestionAnswerDto userQuestionAnswerDto = new UserQuestionAnswerDto(); |
| | | userQuestionAnswerDto.setPage(page); |
| | | userQuestionAnswerDto.setRow(row); |
| | | userQuestionAnswerDto.setObjType(QuestionAnswerDto.QA_TYPE_STORE); |
| | | userQuestionAnswerDto.setObjId(storeId); |
| | | userQuestionAnswerDto.setPersonId(userId); |
| | | userQuestionAnswerDto.setQaTypes(new String[]{"2002","4004"}); |
| | | return getUserQuestionAnswerBMOImpl.get(userQuestionAnswerDto); |
| | | } |
| | | userQuestionAnswerDto.setState(state); |
| | | if ("owner".equals(roleCd)) { |
| | | userQuestionAnswerDto.setCommunityId(communityId); |
| | | |
| | | /** |
| | | * 微信删除消息模板 |
| | | * |
| | | * @param communityId 小区ID |
| | | * @return |
| | | * @serviceCode /userQuestionAnswer/queryUserQuestionAnswer |
| | | * @path /app/userQuestionAnswer/queryUserQuestionAnswer |
| | | */ |
| | | @RequestMapping(value = "/queryOwnerQuestionAnswer", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryOwnerQuestionAnswer( |
| | | @RequestHeader(value = "user-id") String userId, |
| | | @RequestParam(value = "communityId") String communityId, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | UserQuestionAnswerDto userQuestionAnswerDto = new UserQuestionAnswerDto(); |
| | | userQuestionAnswerDto.setPage(page); |
| | | userQuestionAnswerDto.setRow(row); |
| | | userQuestionAnswerDto.setObjType(QuestionAnswerDto.QA_TYPE_COMMUNITY); |
| | | userQuestionAnswerDto.setObjId(communityId); |
| | | userQuestionAnswerDto.setPersonId(userId); |
| | | userQuestionAnswerDto.setQaTypes(new String[]{"1001","3003"}); |
| | | } else { |
| | | |
| | | } |
| | | return getUserQuestionAnswerBMOImpl.get(userQuestionAnswerDto); |
| | | } |
| | | |
| | |
| | | * @path /app/userQuestionAnswer/saveUserQuestionAnswerValue |
| | | */ |
| | | @RequestMapping(value = "/saveUserQuestionAnswerValue", method = RequestMethod.POST) |
| | | public ResponseEntity<String> saveUserQuestionAnswerValue(@RequestBody JSONObject reqJson) { |
| | | public ResponseEntity<String> saveUserQuestionAnswerValue( |
| | | @RequestHeader(value = "user-id") String userId, |
| | | @RequestBody JSONObject reqJson) { |
| | | |
| | | Assert.hasKeyAndValue(reqJson, "qaId", "请求报文中未包含qaId"); |
| | | Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType"); |
| | | Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId"); |
| | | Assert.hasKeyAndValue(reqJson, "answerType", "请求报文中未包含answerType"); |
| | | Assert.hasKey(reqJson, "questionAnswerTitles", "未包含答案"); |
| | | |
| | | JSONArray questionAnswerTitles = reqJson.getJSONArray("questionAnswerTitles"); |
| | | |
| | | if (questionAnswerTitles == null || questionAnswerTitles.size() < 1) { |
| | | throw new IllegalArgumentException("未包含答案"); |
| | | } |
| | | |
| | | JSONObject titleObj = null; |
| | | for (int questionAnswerTitleIndex = 0; questionAnswerTitleIndex < questionAnswerTitles.size(); questionAnswerTitleIndex++) { |
| | | titleObj = questionAnswerTitles.getJSONObject(questionAnswerTitleIndex); |
| | | if (titleObj.containsKey("qaTitle") && !StringUtil.isEmpty(titleObj.getString("qaTitle"))) { |
| | | Assert.hasKeyAndValue(titleObj, "valueContent", titleObj.getString("qaTitle") + ",未填写答案"); |
| | | } else { |
| | | Assert.hasKeyAndValue(titleObj, "valueContent", "未填写答案"); |
| | | } |
| | | } |
| | | |
| | | UserQuestionAnswerValuePo userQuestionAnswerValuePo = BeanConvertUtil.covertBean(reqJson, UserQuestionAnswerValuePo.class); |
| | | return saveUserQuestionAnswerValueBMOImpl.save(userQuestionAnswerValuePo); |
| | | |
| | | |
| | | |
| | | return saveUserQuestionAnswerValueBMOImpl.save(userQuestionAnswerValuePo, questionAnswerTitles); |
| | | } |
| | | |
| | | /** |
| | |
| | | UserQuestionAnswerValueDto userQuestionAnswerValueDto = new UserQuestionAnswerValueDto(); |
| | | userQuestionAnswerValueDto.setPage(page); |
| | | userQuestionAnswerValueDto.setRow(row); |
| | | userQuestionAnswerValueDto.setObjId(communityId); |
| | | userQuestionAnswerValueDto.setCommunityId(communityId); |
| | | return getUserQuestionAnswerValueBMOImpl.get(userQuestionAnswerValueDto); |
| | | } |
| | | } |