Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
em
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ichikawa
em
Commits
d0bbfdf4
Commit
d0bbfdf4
authored
Jan 05, 2024
by
Kim Gyeongeun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#56952 設問設定機能追加
parent
16e32420
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
35 deletions
+119
-35
src/main/java/jp/agentec/sinaburocast/action/user/EnqueteAction.java
+13
-12
src/main/java/jp/agentec/sinaburocast/common/SinaburoConstant.java
+4
-0
src/main/java/jp/agentec/sinaburocast/entity/Answer.java
+5
-0
src/main/java/jp/agentec/sinaburocast/entity/Question.java
+5
-1
src/main/java/jp/agentec/sinaburocast/service/QuestionService.java
+38
-1
src/main/webapp/WEB-INF/view/user/enquete/enquete.html
+54
-21
No files found.
src/main/java/jp/agentec/sinaburocast/action/user/EnqueteAction.java
View file @
d0bbfdf4
...
...
@@ -9,6 +9,17 @@ import java.util.List;
import
javax.mail.MessagingException
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.apache.struts.Globals
;
import
org.apache.struts.action.ActionMessage
;
import
org.apache.struts.action.ActionMessages
;
import
org.apache.struts.util.TokenProcessor
;
import
org.seasar.framework.util.StringUtil
;
import
org.seasar.struts.annotation.ActionForm
;
import
org.seasar.struts.annotation.Execute
;
import
org.seasar.struts.util.RequestUtil
;
import
jp.agentec.sinaburocast.action.AbstractAction
;
import
jp.agentec.sinaburocast.action.admin.enquete.EnqueteRegistAction
;
import
jp.agentec.sinaburocast.action.batch.EnqueteSumBatchAction
;
...
...
@@ -41,17 +52,6 @@ import jp.agentec.sinaburocast.service.ReplyService;
import
jp.agentec.sinaburocast.service.TemplateService
;
import
jp.agentec.sinaburocast.vo.EnqueteKey
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.apache.struts.Globals
;
import
org.apache.struts.action.ActionMessage
;
import
org.apache.struts.action.ActionMessages
;
import
org.apache.struts.util.TokenProcessor
;
import
org.seasar.framework.util.StringUtil
;
import
org.seasar.struts.annotation.ActionForm
;
import
org.seasar.struts.annotation.Execute
;
import
org.seasar.struts.util.RequestUtil
;
/**
* アンケート処理
*
...
...
@@ -193,12 +193,13 @@ public class EnqueteAction extends AbstractAction {
}
}
ArrayList
<
Question
>
questionList
=
questionService
.
findAllOrderByEnqueteId
(
enqueteForm
.
eid
);
for
(
Question
question
:
questionList
)
{
if
(
StringUtil
.
equals
(
"6"
,
question
.
controlId
+
""
)
){
enqueteForm
.
organizationListFor1Percent
=
organizationService
.
findAllOrderByNo
();
}
}
//条件付必須チェック(初期画面表示・非表示セット)
questionService
.
setQuestionDisable
(
questionList
);
//予約語を変更する。
if
(
enquete
.
enqueteType
==
SinaburoConstant
.
EnqueteType
.
PUBLIC_COMMENT
...
...
src/main/java/jp/agentec/sinaburocast/common/SinaburoConstant.java
View file @
d0bbfdf4
...
...
@@ -645,6 +645,10 @@ public interface SinaburoConstant {
String
MEMBER_CARD_RECEIPT_HIDE_DATE
=
"2023/09/11"
;
}
interface
initDisable
{
short
YES
=
1
;
short
NO
=
0
;
}
}
src/main/java/jp/agentec/sinaburocast/entity/Answer.java
View file @
d0bbfdf4
...
...
@@ -14,6 +14,8 @@ import javax.persistence.Transient;
import
org.apache.commons.lang.builder.StandardToStringStyle
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
@Entity
@Table
(
name
=
"m_answer"
)
public
class
Answer
extends
AbstractEntity
{
...
...
@@ -55,6 +57,9 @@ public class Answer extends AbstractEntity {
@Column
(
name
=
"default_flg"
)
public
int
defaultFlg
;
@Transient
public
short
answerInitDisable
=
SinaburoConstant
.
initDisable
.
NO
;
/** MEnquete関連プロパティ */
@ManyToOne
@JoinColumn
(
name
=
"enquete_id"
,
referencedColumnName
=
"enquete_id"
)
...
...
src/main/java/jp/agentec/sinaburocast/entity/Question.java
View file @
d0bbfdf4
...
...
@@ -4,7 +4,6 @@ import java.util.List;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
...
...
@@ -14,6 +13,8 @@ import javax.persistence.Transient;
import
org.apache.commons.lang.StringUtils
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
@Entity
@Table
(
name
=
"m_question"
)
public
class
Question
extends
AbstractEntity
{
...
...
@@ -117,6 +118,9 @@ public class Question extends AbstractEntity {
@Transient
public
Integer
answerCount
;
@Transient
public
short
questionInitDisable
=
SinaburoConstant
.
initDisable
.
NO
;
public
String
getYearRange
()
{
StringBuffer
sb
=
new
StringBuffer
();
if
(
StringUtils
.
isEmpty
(
startymd
))
{
...
...
src/main/java/jp/agentec/sinaburocast/service/QuestionService.java
View file @
d0bbfdf4
package
jp
.
agentec
.
sinaburocast
.
service
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.seasar.extension.jdbc.where.SimpleWhere
;
import
org.seasar.framework.container.annotation.tiger.Component
;
import
org.seasar.framework.container.annotation.tiger.InstanceType
;
import
org.seasar.framework.util.IntegerConversionUtil
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
import
jp.agentec.sinaburocast.entity.AdminUser
;
...
...
@@ -286,7 +290,40 @@ public class QuestionService extends AbstractService<Question> {
}
}
}
/**
* 条件付必須チェック(初期画面表示・非表示セット)
*
* @param questionList
* @return
*/
public
void
setQuestionDisable
(
List
<
Question
>
questionList
)
{
HashMap
<
Integer
,
Integer
>
requiredQuestionInfo
=
new
HashMap
<
Integer
,
Integer
>();
//初期表示情報セット
for
(
Question
question
:
questionList
)
{
for
(
Answer
answer
:
question
.
answerList
)
{
if
(
question
.
condRequiredQuestionNo
!=
null
&&
question
.
condRequiredQuestionNo
==
0
&&
answer
.
defaultFlg
==
1
&&
requiredQuestionInfo
.
get
(
answer
.
answerId
)
==
null
)
{
requiredQuestionInfo
.
put
(
answer
.
answerId
,
answer
.
defaultFlg
);
}
}
}
for
(
Question
question
:
questionList
)
{
//条件付必須チェック(初期画面表示・非表示セット)
for
(
Answer
answer
:
question
.
answerList
)
{
if
(
question
.
condRequiredQuestionNo
!=
null
&&
question
.
condRequiredQuestionNo
!=
0
&&
StringUtils
.
isNotBlank
(
question
.
condRequiredAnswer
))
{
List
<
String
>
requiredAnswerIdList
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
question
.
condRequiredAnswer
.
split
(
","
)));
for
(
String
requiredAnswerId
:
requiredAnswerIdList
)
{
if
(
requiredQuestionInfo
.
get
(
IntegerConversionUtil
.
toInteger
(
requiredAnswerId
))
==
null
)
{
question
.
questionInitDisable
=
SinaburoConstant
.
initDisable
.
YES
;
answer
.
answerInitDisable
=
SinaburoConstant
.
initDisable
.
YES
;
break
;
}
}
}
}
}
}
/**
...
...
src/main/webapp/WEB-INF/view/user/enquete/enquete.html
View file @
d0bbfdf4
...
...
@@ -9,22 +9,57 @@
#set($dateIndex=0)
#foreach($question in $!enqueteForm.questionList)
<script
language=
"javascript"
type=
"text/javascript"
charset=
"utf-8"
>
console
.
log
(
"${question.questionId}"
);
console
.
log
(
"${question.condRequiredQuestionNo}"
);
console
.
log
(
"${question.condRequiredAnswer}"
);
</script>
#if($question.controlId == 5)
#set($dateIndex = $dateIndex+1)
<script
language=
"javascript"
type=
"text/javascript"
charset=
"utf-8"
>
<!--
<!--
$
(
function
()
{
//開始日
$
(
function
()
{
$
(
"#enqStartFrom${dateIndex}"
).
datepick
({
showTrigger
:
"#enqFrom${dateIndex}"
,
yearRange
:
"$question.yearRange"
,
minDate
:
"$question.startymd"
,
maxDate
:
"$question.endymd"
});
});
//-->
</script>
#end
#end
#foreach($question in $!enqueteForm.questionList)
#foreach($answer in $question.answerList)
<script
language=
"javascript"
type=
"text/javascript"
charset=
"utf-8"
>
<!--
$
(
function
()
{
//条件付必須チェック
$
(
"input[type=radio], input[type=checkbox], input[type=select]"
).
click
(
function
()
{
var
thisQuestionId
=
$
(
this
).
attr
(
"class"
);
var
thisAnswerId
=
$
(
this
).
attr
(
"id"
);
//表示、非表示対象
if
(
$
{
question
.
condRequiredQuestionNo
}
&&
$
{
question
.
condRequiredQuestionNo
}
==
thisQuestionId
)
{
if
(
"${question.condRequiredAnswer}"
.
split
(
","
).
indexOf
(
thisAnswerId
)
<
0
)
{
if
(
"${question.controlId}"
==
"0"
||
"${question.controlId}"
==
"1"
)
{
$
(
"#${answer.answerId}"
).
attr
(
"checked"
,
false
);
$
(
"#${answer.answerId}"
).
attr
(
"disabled"
,
true
);
}
else
if
(
"${question.controlId}"
==
"2"
||
"${question.controlId}"
==
"3"
||
"${question.controlId}"
==
"4"
)
{
$
(
"#${question.questionId}"
).
val
(
""
);
$
(
"#${question.questionId}"
).
attr
(
"disabled"
,
true
);
}
else
if
(
"${question.controlId}"
==
"5"
)
{
$
(
".${question.questionId}"
).
val
(
""
);
$
(
".${question.questionId}"
).
attr
(
"disabled"
,
true
);
$
(
".${question.questionId}"
).
next
().
hide
();
}
}
else
{
if
(
"${question.controlId}"
==
"0"
||
"${question.controlId}"
==
"1"
)
{
$
(
"#${answer.answerId}"
).
attr
(
"disabled"
,
false
);
}
else
if
(
"${question.controlId}"
==
"2"
||
"${question.controlId}"
==
"3"
||
"${question.controlId}"
==
"4"
)
{
$
(
"#${question.questionId}"
).
attr
(
"disabled"
,
false
);
}
else
if
(
"${question.controlId}"
==
"5"
)
{
$
(
".${question.questionId}"
).
attr
(
"disabled"
,
false
);
$
(
".${question.questionId}"
).
next
().
show
();
}
}
}
});
});
// -->
</script>
#end
...
...
@@ -187,7 +222,7 @@ $tools.getMsg("errorheader")
#if($!question.controlId == "2")
<td
width=
"$tdWidthPercent%"
valign =
"top"
>
#set($answerIdValueName = "questionList[$questionIndex].answerList[0].answerIdValue")
<select
name=
"$answerIdValueName"
#
if
($!
question
.
condRequiredQuestionNo
!=
"
0
")
disabled=
"disabled"
#
end
>
<select
name=
"$answerIdValueName"
id=
"#he($!question.questionId)"
#
if
($!
question
.
questionInitDisable =
=
"
1
")
disabled
#
end
>
#foreach($selectAnswer in $question.answerList)
<option
value=
"$!selectAnswer.answerId"
#
if
($
enqueteForm
.
initCount =
="2"
&&
$!
selectAnswer
.
answerId =
=
$!
selectAnswer
.
answerIdValue
)
selected
#
elseif
($!
selectAnswer
.
defaultFlg =
=
"
1
"
&&
$
enqueteForm
.
initCount
!="
2
")
selected
#
end
>
$!escape.html($!selectAnswer.answer)
</option>
<!-- <option value="$!selectAnswer.answerId" #if($enqueteForm.initCount =="2" && $!selectAnswer.answerId == $!selectAnswer.answerIdValue) selected $!selectAnswer.answerId , $!selectAnswer.answerIdValue #elseif($!selectAnswer.defaultFlg == "1" ) selected $!selectAnswer.answerId , $!selectAnswer.answerIdValue #end >$!escape.html($!selectAnswer.answer)</option> -->
...
...
@@ -217,41 +252,39 @@ $tools.getMsg("errorheader")
<!-- 0:RADIO インデクスを値にする。 -->
#if($!question.controlId == "0")
##if($!answer.freeTextFlg != "1"
&&
$!answer.freeTextFlg != "2")
<input
type=
"radio"
name=
"$!answerIdValueRadioName"
value=
"$velocityCount"
#
if
($!
answer
.
answerIdValue =
=
$
velocityCount
.
toString
()
&&
$
enqueteForm
.
initCount =
="2")
checked
#{
end
}
#
if
($!
answer
.
defaultFlg =
=
1
&&
$
enqueteForm
.
initCount =
="1")
checked
#
end
#
if
($!
question
.
condRequiredQuestionNo
!=
"
0
")
disabled=
"disabled"
#
end
>
$!escape.html($!answer.answer)
<input
type=
"radio"
class=
"#he($!question.questionId)"
id=
"#he($!answer.answerId)"
name=
"$!answerIdValueRadioName"
value=
"$velocityCount"
#
if
($!
answer
.
answerIdValue =
=
$
velocityCount
.
toString
()
&&
$
enqueteForm
.
initCount =
="2")
checked
#
end
#
if
($!
answer
.
defaultFlg =
=
1
&&
$
enqueteForm
.
initCount =
="1")
checked
#
end
#
if
($!
answer
.
answerInitDisable =
=
"
1
")
disabled
#
end
>
$!escape.html($!answer.answer)
##end
##
<!-- 自由入力欄。freeTextFlg=1(あり)、2(必須) -->
#if($!answer.freeTextFlg == "1" || $!answer.freeTextFlg == "2")
<input
type=
"text"
name=
"$answerValue"
size=
"$!answer.freeTextColWidth"
value=
"$!escape.html($!answer.answerValue)"
/>
<input
type=
"text"
class=
"#he($!question.questionId)"
id=
"#he($!answer.answerId)"
name=
"$answerValue"
size=
"$!answer.freeTextColWidth"
value=
"$!escape.html($!answer.answerValue)"
/>
#end
##
<!-- 1:CHECKBOX answer.answerNo値を値にする。-->
#elseif($!question.controlId == "1")
##if($!answer.freeTextFlg != "1"
&&
$!answer.freeTextFlg != "2")
<input
type=
"checkbox"
name=
"$answerIdValueName"
value=
"$!escape.html($!answer.answerNo)"
#
if
($
answer
.
answerIdValue
!=
""
&&
$
enqueteForm
.
initCount =
="2")
checked
#
end
#
if
($!
answer
.
defaultFlg =
=
1
&&
$
enqueteForm
.
initCount =
="1")
checked
#
end
#
if
($!
question
.
condRequiredQuestionNo
!=
"
0
")
disabled=
"disabled"
#
end
>
$!escape.html($!answer.answer)
<input
type=
"checkbox"
class=
"#he($!question.questionId)"
id=
"#he($!answer.answerId)"
name=
"$answerIdValueName"
value=
"$!escape.html($!answer.answerNo)"
#
if
($
answer
.
answerIdValue
!=
""
&&
$
enqueteForm
.
initCount =
="2")
checked
#
end
#
if
($!
answer
.
defaultFlg =
=
1
&&
$
enqueteForm
.
initCount =
="1")
checked
#
end
#
if
($!
answer
.
answerInitDisable =
=
"
1
")
disabled
#
end
>
$!escape.html($!answer.answer)
##end
##
<!-- 自由入力欄。freeTextFlg=1(あり)、2(必須) -->
#if($!answer.freeTextFlg == "1" || $!answer.freeTextFlg == "2")
<input
type=
"text"
name=
"$answerValue"
size=
"$!answer.freeTextColWidth"
value=
"$!escape.html($!answer.answerValue)"
/>
<input
type=
"text"
class=
"#he($!question.questionId)"
id=
"#he($!answer.answerId)"
name=
"$answerValue"
size=
"$!answer.freeTextColWidth"
value=
"$!escape.html($!answer.answerValue)"
#
if
($!
question
.
questionInitDisable =
=
"
1
")
disabled
#
end
/>
#end
##
<!-- 3:TEXTAREA ユーザー入力値を値にする。-->
#elseif($!question.controlId == "3")
<textArea
type=
"text"
name=
"$answerIdValueName"
cols=
"$!question.dispWitdth"
rows=
"$!question.rowCount"
>
$!answer.answerIdValue
</textarea>
<textArea
type=
"text"
id=
"#he($!question.questionId)"
name=
"$answerIdValueName"
cols=
"$!question.dispWitdth"
rows=
"$!question.rowCount"
#
if
($!
question
.
questionInitDisable =
=
"
1
")
disabled
#
end
>
$!answer.answerIdValue
</textarea>
##
<!-- 4:TEXTFIELD ユーザー入力値を値にする。-->
#elseif($!question.controlId == "4")
<input
type=
"text"
name=
"$answerIdValueName"
value=
"$!escape.html($!answer.answerIdValue)"
size=
"$!question.dispWitdth"
/>
<input
type=
"text"
id=
"#he($!question.questionId)"
name=
"$answerIdValueName"
value=
"$!escape.html($!answer.answerIdValue)"
size=
"$!question.dispWitdth"
#
if
($!
question
.
questionInitDisable =
=
"
1
")
disabled
#
end
/>
##
<!-- 5:日付入力 ユーザー入力値を値にする。-->
#elseif($!question.controlId == "5")
#set($dateIndex = $dateIndex+1)
<input
name=
"$answerValue"
id=
"enqStartFrom${dateIndex}"
type=
"text"
class=
"w100 mgl10
"
value=
"$!escape.html($!answer.answerValue)"
>
<div
style=
"display: none;"
><img
id=
"enqFrom${dateIndex}"
src=
"/em/images/icon_cal.gif"
style=
"padding-left:5px;padding-right:5px; vertical-align: middle;
"
></div>
<input
name=
"$answerValue"
id=
"enqStartFrom${dateIndex}"
type=
"text"
class=
"w100 mgl10
#he($!question.questionId)"
value=
"$!escape.html($!answer.answerValue)"
#
if
($!
question
.
questionInitDisable =
=
"
1
")
disabled
#
end
>
<div
style=
"display: none;"
><img
id=
"enqFrom${dateIndex}"
src=
"/em/images/icon_cal.gif"
style=
"padding-left:5px;padding-right:5px; vertical-align: middle;
#if($!question.questionInitDisable == '1') display: none; #end"
></div>
<input
type=
"hidden"
name=
"$answerIdValueName"
value=
"$!answer.answerId"
/>
#elseif($!question.controlId == "6")
<select
name=
"$answerIdValueName"
>
<select
name=
"$answerIdValueName"
id=
"#he($!question.questionId)"
#
if
($!
question
.
questionInitDisable =
=
"
1
")
disabled
#
end
>
<option
value=
""
>
下記より選択してください
</option>
#foreach($pecent1 in $enqueteForm.organizationListFor1Percent)
<option
value=
"$!pecent1.organizationId"
#
if
($!
answer
.
answerIdValue =
=
$!
pecent1
.
organizationId
)
selected
#
end
>
$!{pecent1.organizationNo} : $!escape.html($!{pecent1.organizationName})
</option>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment