| | |
| | | **/ |
| | | public class QuestionAnswerTitleDto extends PageDto implements Serializable { |
| | | |
| | | public static final String TITLE_TYPE_SINGLE = "1001"; // 单选题 |
| | | public static final String TITLE_TYPE_MULTIPLE = "2002"; // 多选题 |
| | | public static final String TITLE_TYPE_QUESTIONS = "3003"; // 简答题 |
| | | |
| | | |
| | | |
| | | private String titleType; |
| | | private String titleId; |
| | | private String objId; |
| | | private String[] objIds; |
| | | private String objType; |
| | | private String seq; |
| | | private String qaId; |
| | |
| | | public void setStatusCd(String statusCd) { |
| | | this.statusCd = statusCd; |
| | | } |
| | | |
| | | public String[] getObjIds() { |
| | | return objIds; |
| | | } |
| | | |
| | | public void setObjIds(String[] objIds) { |
| | | this.objIds = objIds; |
| | | } |
| | | } |
| | |
| | | package com.java110.po.questionAnswerTitle; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | public class QuestionAnswerTitlePo implements Serializable { |
| | | |
| | | private String titleType; |
| | | private String titleId; |
| | | private String objId; |
| | | private String statusCd = "0"; |
| | | private String objType; |
| | | private String seq; |
| | | private String qaId; |
| | | private String qaTitle; |
| | | public String getTitleType() { |
| | | private String titleId; |
| | | private String objId; |
| | | private String statusCd = "0"; |
| | | private String objType; |
| | | private String seq; |
| | | private String qaId; |
| | | private String qaTitle; |
| | | |
| | | public String getTitleType() { |
| | | return titleType; |
| | | } |
| | | public void setTitleType(String titleType) { |
| | | |
| | | public void setTitleType(String titleType) { |
| | | this.titleType = titleType; |
| | | } |
| | | public String getTitleId() { |
| | | |
| | | public String getTitleId() { |
| | | return titleId; |
| | | } |
| | | public void setTitleId(String titleId) { |
| | | |
| | | public void setTitleId(String titleId) { |
| | | this.titleId = titleId; |
| | | } |
| | | public String getObjId() { |
| | | |
| | | public String getObjId() { |
| | | return objId; |
| | | } |
| | | public void setObjId(String objId) { |
| | | |
| | | public void setObjId(String objId) { |
| | | this.objId = objId; |
| | | } |
| | | public String getStatusCd() { |
| | | |
| | | public String getStatusCd() { |
| | | return statusCd; |
| | | } |
| | | public void setStatusCd(String statusCd) { |
| | | |
| | | public void setStatusCd(String statusCd) { |
| | | this.statusCd = statusCd; |
| | | } |
| | | public String getObjType() { |
| | | |
| | | public String getObjType() { |
| | | return objType; |
| | | } |
| | | public void setObjType(String objType) { |
| | | |
| | | public void setObjType(String objType) { |
| | | this.objType = objType; |
| | | } |
| | | public String getSeq() { |
| | | |
| | | public String getSeq() { |
| | | return seq; |
| | | } |
| | | public void setSeq(String seq) { |
| | | |
| | | public void setSeq(String seq) { |
| | | this.seq = seq; |
| | | } |
| | | public String getQaId() { |
| | | |
| | | public String getQaId() { |
| | | return qaId; |
| | | } |
| | | public void setQaId(String qaId) { |
| | | |
| | | public void setQaId(String qaId) { |
| | | this.qaId = qaId; |
| | | } |
| | | public String getQaTitle() { |
| | | |
| | | public String getQaTitle() { |
| | | return qaTitle; |
| | | } |
| | | public void setQaTitle(String qaTitle) { |
| | | |
| | | public void setQaTitle(String qaTitle) { |
| | | this.qaTitle = qaTitle; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | <mapper namespace="questionAnswerTitleServiceDaoImpl"> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 保存答卷信息 add by wuxw 2018-07-03 --> |
| | | <insert id="saveQuestionAnswerTitleInfo" parameterType="Map"> |
| | | insert into question_answer_title( |
| | | title_type,title_id,obj_id,obj_type,seq,qa_id,qa_title |
| | | ) values ( |
| | | #{titleType},#{titleId},#{objId},#{objType},#{seq},#{qaId},#{qaTitle} |
| | | ) |
| | | title_type,title_id,obj_id,obj_type,seq,qa_id,qa_title |
| | | ) values ( |
| | | #{titleType},#{titleId},#{objId},#{objType},#{seq},#{qaId},#{qaTitle} |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | |
| | | <!-- 查询答卷信息 add by wuxw 2018-07-03 --> |
| | | <select id="getQuestionAnswerTitleInfo" parameterType="Map" resultType="Map"> |
| | | select t.title_type,t.title_type titleType,t.title_id,t.title_id titleId,t.obj_id,t.obj_id objId,t.status_cd,t.status_cd statusCd,t.obj_type,t.obj_type objType,t.seq,t.qa_id,t.qa_id qaId,t.qa_title,t.qa_title qaTitle |
| | | from question_answer_title t |
| | | where 1 =1 |
| | | <if test="titleType !=null and titleType != ''"> |
| | | and t.title_type= #{titleType} |
| | | </if> |
| | | <if test="titleId !=null and titleId != ''"> |
| | | and t.title_id= #{titleId} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | and t.obj_id= #{objId} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | and t.obj_type= #{objType} |
| | | </if> |
| | | <if test="seq !=null and seq != ''"> |
| | | and t.seq= #{seq} |
| | | </if> |
| | | <if test="qaId !=null and qaId != ''"> |
| | | and t.qa_id= #{qaId} |
| | | </if> |
| | | <if test="qaTitle !=null and qaTitle != ''"> |
| | | and t.qa_title= #{qaTitle} |
| | | </if> |
| | | order by t.create_time desc |
| | | <if test="page != -1 and page != null "> |
| | | limit #{page}, #{row} |
| | | </if> |
| | | select t.title_type,t.title_type titleType,t.title_id,t.title_id titleId,t.obj_id,t.obj_id |
| | | objId,t.status_cd,t.status_cd statusCd,t.obj_type,t.obj_type objType,t.seq,t.qa_id,t.qa_id |
| | | qaId,t.qa_title,t.qa_title qaTitle |
| | | from question_answer_title t |
| | | where 1 =1 |
| | | <if test="titleType !=null and titleType != ''"> |
| | | and t.title_type= #{titleType} |
| | | </if> |
| | | <if test="titleId !=null and titleId != ''"> |
| | | and t.title_id= #{titleId} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | and t.obj_id= #{objId} |
| | | </if> |
| | | <if test="objIds !=null "> |
| | | and t.obj_id in |
| | | <foreach collection="objIds" item="item" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | and t.obj_type= #{objType} |
| | | </if> |
| | | <if test="seq !=null and seq != ''"> |
| | | and t.seq= #{seq} |
| | | </if> |
| | | <if test="qaId !=null and qaId != ''"> |
| | | and t.qa_id= #{qaId} |
| | | </if> |
| | | <if test="qaTitle !=null and qaTitle != ''"> |
| | | and t.qa_title= #{qaTitle} |
| | | </if> |
| | | order by t.create_time desc |
| | | <if test="page != -1 and page != null "> |
| | | limit #{page}, #{row} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 修改答卷信息 add by wuxw 2018-07-03 --> |
| | | <update id="updateQuestionAnswerTitleInfo" parameterType="Map"> |
| | | update question_answer_title t set t.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,t.b_id = #{newBId} |
| | | </if> |
| | | <if test="titleType !=null and titleType != ''"> |
| | | , t.title_type= #{titleType} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | , t.obj_id= #{objId} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | , t.obj_type= #{objType} |
| | | </if> |
| | | <if test="seq !=null and seq != ''"> |
| | | , t.seq= #{seq} |
| | | </if> |
| | | <if test="qaId !=null and qaId != ''"> |
| | | , t.qa_id= #{qaId} |
| | | </if> |
| | | <if test="qaTitle !=null and qaTitle != ''"> |
| | | , t.qa_title= #{qaTitle} |
| | | </if> |
| | | where 1=1 <if test="titleId !=null and titleId != ''"> |
| | | and t.title_id= #{titleId} |
| | | </if> |
| | | update question_answer_title t set t.status_cd = #{statusCd} |
| | | <if test="newBId != null and newBId != ''"> |
| | | ,t.b_id = #{newBId} |
| | | </if> |
| | | <if test="titleType !=null and titleType != ''"> |
| | | , t.title_type= #{titleType} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | , t.obj_id= #{objId} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | , t.obj_type= #{objType} |
| | | </if> |
| | | <if test="seq !=null and seq != ''"> |
| | | , t.seq= #{seq} |
| | | </if> |
| | | <if test="qaId !=null and qaId != ''"> |
| | | , t.qa_id= #{qaId} |
| | | </if> |
| | | <if test="qaTitle !=null and qaTitle != ''"> |
| | | , t.qa_title= #{qaTitle} |
| | | </if> |
| | | where 1=1 |
| | | <if test="titleId !=null and titleId != ''"> |
| | | and t.title_id= #{titleId} |
| | | </if> |
| | | |
| | | </update> |
| | | |
| | | <!-- 查询答卷数量 add by wuxw 2018-07-03 --> |
| | | <select id="queryQuestionAnswerTitlesCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from question_answer_title t |
| | | where 1 =1 |
| | | <if test="titleType !=null and titleType != ''"> |
| | | and t.title_type= #{titleType} |
| | | </if> |
| | | <if test="titleId !=null and titleId != ''"> |
| | | and t.title_id= #{titleId} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | and t.obj_id= #{objId} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | and t.obj_type= #{objType} |
| | | </if> |
| | | <if test="seq !=null and seq != ''"> |
| | | and t.seq= #{seq} |
| | | </if> |
| | | <if test="qaId !=null and qaId != ''"> |
| | | and t.qa_id= #{qaId} |
| | | </if> |
| | | <if test="qaTitle !=null and qaTitle != ''"> |
| | | and t.qa_title= #{qaTitle} |
| | | </if> |
| | | <select id="queryQuestionAnswerTitlesCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from question_answer_title t |
| | | where 1 =1 |
| | | <if test="titleType !=null and titleType != ''"> |
| | | and t.title_type= #{titleType} |
| | | </if> |
| | | <if test="titleId !=null and titleId != ''"> |
| | | and t.title_id= #{titleId} |
| | | </if> |
| | | <if test="objId !=null and objId != ''"> |
| | | and t.obj_id= #{objId} |
| | | </if> |
| | | <if test="objIds !=null "> |
| | | and t.obj_id in |
| | | <foreach collection="objIds" item="item" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | </if> |
| | | <if test="objType !=null and objType != ''"> |
| | | and t.obj_type= #{objType} |
| | | </if> |
| | | <if test="seq !=null and seq != ''"> |
| | | and t.seq= #{seq} |
| | | </if> |
| | | <if test="qaId !=null and qaId != ''"> |
| | | and t.qa_id= #{qaId} |
| | | </if> |
| | | <if test="qaTitle !=null and qaTitle != ''"> |
| | | and t.qa_title= #{qaTitle} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | { |
| | | "templateName": "问卷信息", |
| | | "templateName": "问卷题目", |
| | | "directories": "property", |
| | | "templateCode": "questionAnswer", |
| | | "templateKey": "qaId", |
| | | "templateKeyName": "问卷ID", |
| | | "searchCode": "qaId", |
| | | "searchName": "问卷ID", |
| | | "templateCode": "questionAnswerTitle", |
| | | "templateKey": "titleId", |
| | | "templateKeyName": "题目ID", |
| | | "searchCode": "titleId", |
| | | "searchName": "题目ID", |
| | | "conditions": [ |
| | | { |
| | | "name": "问卷类型", |
| | | "name": "题目类型", |
| | | "inputType": "select", |
| | | "selectValue": "1001,2002,3003,4004", |
| | | "selectValueName": "业主问卷,员工自评,业主投票,员工投票", |
| | | "code": "qaType", |
| | | "selectValue": "1001,2002,3003", |
| | | "selectValueName": "单选,多选,简答题", |
| | | "code": "titleType", |
| | | "whereCondition": "equal" |
| | | }, |
| | | { |
| | | "name": "问卷名称", |
| | | "inputType": "input", |
| | | "code": "qaName", |
| | | "code": "qaTitle", |
| | | "whereCondition": "equal" |
| | | }, |
| | | { |
| | | "name": "问卷ID", |
| | | "name": "题目ID", |
| | | "inputType": "input", |
| | | "code": "qaId", |
| | | "code": "titleId", |
| | | "whereCondition": "equal" |
| | | } |
| | | ], |
| | | "columns": [ |
| | | { |
| | | "code": "qaType", |
| | | "cnCode": "问卷类型", |
| | | "desc": "必填,请选择问卷类型", |
| | | "code": "titleType", |
| | | "cnCode": "题目类型", |
| | | "desc": "必填,请选择题目类型", |
| | | "required": true, |
| | | "hasDefaultValue": false, |
| | | "inputType": "select", |
| | | "selectValue": "1001,2002,3003,4004", |
| | | "selectValueName": "业主问卷,员工自评,业主投票,员工投票", |
| | | "selectValue": "1001,2002,3003", |
| | | "selectValueName": "单选,多选,简答题", |
| | | "limit": "num", |
| | | "limitParam": "", |
| | | "limitErrInfo": "问卷类型格式错误", |
| | | "limitErrInfo": "题目类型格式错误", |
| | | "show": true |
| | | }, |
| | | { |
| | | "code": "qaName", |
| | | "cnCode": "问卷名称", |
| | | "desc": "必填,请填写问卷名称", |
| | | "code": "qaTitle", |
| | | "cnCode": "问卷题目", |
| | | "desc": "必填,请填写问卷题目", |
| | | "required": true, |
| | | "hasDefaultValue": false, |
| | | "inputType": "input", |
| | | "limit": "maxLength", |
| | | "limitParam": "256", |
| | | "limitErrInfo": "问卷名称太长", |
| | | "limitErrInfo": "问卷题目太长", |
| | | "show": true |
| | | }, |
| | | { |
| | | "code": "startTime", |
| | | "cnCode": "开始时间", |
| | | "desc": "选填,请填写开始时间", |
| | | "code": "seq", |
| | | "cnCode": "顺序", |
| | | "desc": "必填,请填写顺序", |
| | | "required": true, |
| | | "hasDefaultValue": false, |
| | | "inputType": "input", |
| | | "limit": "datetime", |
| | | "limit": "num", |
| | | "limitParam": "", |
| | | "limitErrInfo": "开始时间错误", |
| | | "limitErrInfo": "顺序必须是数字", |
| | | "show": true |
| | | }, |
| | | { |
| | | "code": "endTime", |
| | | "cnCode": "结束时间", |
| | | "desc": "选填,请选择结束时间", |
| | | "required": true, |
| | | "hasDefaultValue": false, |
| | | "inputType": "input", |
| | | "limit": "datetime", |
| | | "limitParam": "", |
| | | "limitErrInfo": "结束时间错误", |
| | | "show": true |
| | | }, |
| | | { |
| | | "code": "remark", |
| | | "cnCode": "备注", |
| | | "desc": "必填,请选择备注", |
| | | "required": false, |
| | | "hasDefaultValue": false, |
| | | "inputType": "input", |
| | | "limit": "maxLength", |
| | | "limitParam": "512", |
| | | "limitErrInfo": "备注太长", |
| | | "show": false |
| | | } |
| | | ] |
| | | } |
| | |
| | | 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.questionAnswerTitle.QuestionAnswerTitleDto; |
| | |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestHeader; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | |
| | | @RestController |
| | |
| | | */ |
| | | @RequestMapping(value = "/queryQuestionAnswer", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryQuestionAnswer( |
| | | @RequestHeader(value = "store-id",required = false) String storeId, |
| | | @RequestHeader(value = "store-id", required = false) String storeId, |
| | | @RequestParam(value = "communityId", required = false) String communityId, |
| | | @RequestParam(value = "objType", required = false) String objType, |
| | | @RequestParam(value = "page") int page, |
| | |
| | | Assert.hasKeyAndValue(reqJson, "qaId", "请求报文中未包含qaId"); |
| | | Assert.hasKeyAndValue(reqJson, "qaTitle", "请求报文中未包含qaTitle"); |
| | | Assert.hasKeyAndValue(reqJson, "titleType", "请求报文中未包含titleType"); |
| | | Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId"); |
| | | Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType"); |
| | | Assert.hasKeyAndValue(reqJson, "seq", "请求报文中未包含seq"); |
| | | |
| | | JSONArray titleValues = null; |
| | | if (!QuestionAnswerTitleDto.TITLE_TYPE_QUESTIONS.equals(reqJson.getString("titleType"))) { |
| | | titleValues = reqJson.getJSONArray("titleValues"); |
| | | |
| | | if (titleValues.size() < 1) { |
| | | throw new IllegalArgumentException("未包含选项"); |
| | | } |
| | | } |
| | | |
| | | |
| | | QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class); |
| | | return saveQuestionAnswerTitleBMOImpl.save(questionAnswerTitlePo); |
| | | return saveQuestionAnswerTitleBMOImpl.save(questionAnswerTitlePo,titleValues); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @path /app/questionAnswer/queryQuestionAnswerTitle |
| | | */ |
| | | @RequestMapping(value = "/queryQuestionAnswerTitle", method = RequestMethod.GET) |
| | | public ResponseEntity<String> queryQuestionAnswerTitle(@RequestHeader(value = "store-id") String storeId, |
| | | public ResponseEntity<String> queryQuestionAnswerTitle(@RequestHeader(value = "store-id", required = false) String storeId, |
| | | @RequestParam(value = "communityId", required = false) String communityId, |
| | | @RequestParam(value = "objType") String objType, |
| | | @RequestParam(value = "qaId") String qaId, |
| | | @RequestParam(value = "page") int page, |
| | | @RequestParam(value = "row") int row) { |
| | | QuestionAnswerTitleDto questionAnswerTitleDto = new QuestionAnswerTitleDto(); |
| | | questionAnswerTitleDto.setPage(page); |
| | | questionAnswerTitleDto.setRow(row); |
| | | questionAnswerTitleDto.setObjType(objType); |
| | | questionAnswerTitleDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId); |
| | | questionAnswerTitleDto.setQaId(qaId); |
| | | if (!StringUtil.isEmpty(objType)) { |
| | | questionAnswerTitleDto.setObjType(objType); |
| | | questionAnswerTitleDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId); |
| | | } else { |
| | | questionAnswerTitleDto.setObjIds(new String[]{storeId, communityId}); |
| | | } |
| | | |
| | | return getQuestionAnswerTitleBMOImpl.get(questionAnswerTitleDto); |
| | | } |
| | | |
| | |
| | | package com.java110.user.bmo.questionAnswerTitle; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; |
| | | import org.springframework.http.ResponseEntity; |
| | | public interface ISaveQuestionAnswerTitleBMO { |
| | |
| | | * @param questionAnswerTitlePo |
| | | * @return |
| | | */ |
| | | ResponseEntity<String> save(QuestionAnswerTitlePo questionAnswerTitlePo); |
| | | ResponseEntity<String> save(QuestionAnswerTitlePo questionAnswerTitlePo, JSONArray titleValues); |
| | | |
| | | |
| | | } |
| | |
| | | package com.java110.user.bmo.questionAnswerTitle.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto; |
| | | import com.java110.intf.user.IQuestionAnswerInnerServiceSMO; |
| | | import com.java110.intf.user.IQuestionAnswerTitleInnerServiceSMO; |
| | | import com.java110.intf.user.IQuestionAnswerTitleValueInnerServiceSMO; |
| | | import com.java110.po.questionAnswerTitle.QuestionAnswerTitlePo; |
| | | import com.java110.po.questionAnswerTitleValue.QuestionAnswerTitleValuePo; |
| | | import com.java110.user.bmo.questionAnswerTitle.ISaveQuestionAnswerTitleBMO; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private IQuestionAnswerTitleInnerServiceSMO questionAnswerTitleInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IQuestionAnswerTitleValueInnerServiceSMO questionAnswerTitleValueInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IQuestionAnswerInnerServiceSMO questionAnswerInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | @Java110Transactional |
| | | public ResponseEntity<String> save(QuestionAnswerTitlePo questionAnswerTitlePo) { |
| | | public ResponseEntity<String> save(QuestionAnswerTitlePo questionAnswerTitlePo, JSONArray titleValues) { |
| | | |
| | | questionAnswerTitlePo.setTitleId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_titleId)); |
| | | int flag = questionAnswerTitleInnerServiceSMOImpl.saveQuestionAnswerTitle(questionAnswerTitlePo); |
| | | |
| | | if (flag > 0) { |
| | | if (flag < 0) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | |
| | | } |
| | | if (QuestionAnswerTitleDto.TITLE_TYPE_QUESTIONS.equals(questionAnswerTitlePo.getTitleType())) { |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | } |
| | | QuestionAnswerTitleValuePo questionAnswerTitleValuePo = null; |
| | | for (int titleValueIndex = 0; titleValueIndex < titleValues.size(); titleValueIndex++) { |
| | | questionAnswerTitleValuePo = new QuestionAnswerTitleValuePo(); |
| | | questionAnswerTitleValuePo.setQaValue(titleValues.getJSONObject(titleValueIndex).getString("qaValue")); |
| | | questionAnswerTitleValuePo.setSeq(titleValues.getJSONObject(titleValueIndex).getString("seq")); |
| | | questionAnswerTitleValuePo.setTitleId(questionAnswerTitlePo.getTitleId()); |
| | | questionAnswerTitleValuePo.setValueId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_valueId)); |
| | | questionAnswerTitleValuePo.setObjId(questionAnswerTitlePo.getObjId()); |
| | | questionAnswerTitleValuePo.setObjType(questionAnswerTitlePo.getObjType()); |
| | | questionAnswerTitleValueInnerServiceSMOImpl.saveQuestionAnswerTitleValue(questionAnswerTitleValuePo); |
| | | } |
| | | |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败"); |
| | | return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功"); |
| | | |
| | | |
| | | } |
| | | |
| | | } |