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
f4bc7ff2
Commit
f4bc7ff2
authored
Dec 12, 2023
by
Kim Gyeongeun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#56950 アンケートの設問コピー機能
parent
a5acc56e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
47 deletions
+85
-47
src/main/java/jp/agentec/sinaburocast/action/admin/enquete/EnqueteRegistAction.java
+11
-11
src/main/java/jp/agentec/sinaburocast/form/admin/enquete/EnqueteRegistForm.java
+9
-11
src/main/java/jp/agentec/sinaburocast/service/AnswerService.java
+9
-3
src/main/java/jp/agentec/sinaburocast/service/EnqueteService.java
+20
-18
src/main/java/jp/agentec/sinaburocast/service/QuestionService.java
+36
-4
No files found.
src/main/java/jp/agentec/sinaburocast/action/admin/enquete/EnqueteRegistAction.java
View file @
f4bc7ff2
...
...
@@ -3,6 +3,17 @@ package jp.agentec.sinaburocast.action.admin.enquete;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
org.apache.commons.collections.CollectionUtils
;
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.beans.util.Beans
;
import
org.seasar.framework.util.StringUtil
;
import
org.seasar.struts.annotation.ActionForm
;
import
org.seasar.struts.annotation.Execute
;
import
jp.agentec.sinaburocast.action.AbstractAction
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
import
jp.agentec.sinaburocast.common.SinaburoConstant.EnqueteType
;
...
...
@@ -20,17 +31,6 @@ import jp.agentec.sinaburocast.service.OrganizationService;
import
jp.agentec.sinaburocast.service.QuestionService
;
import
jp.agentec.sinaburocast.service.ReplyService
;
import
org.apache.commons.collections.CollectionUtils
;
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.beans.util.Beans
;
import
org.seasar.framework.util.StringUtil
;
import
org.seasar.struts.annotation.ActionForm
;
import
org.seasar.struts.annotation.Execute
;
/**
* アンケート登録
*
...
...
src/main/java/jp/agentec/sinaburocast/form/admin/enquete/EnqueteRegistForm.java
View file @
f4bc7ff2
...
...
@@ -3,15 +3,6 @@ package jp.agentec.sinaburocast.form.admin.enquete;
import
java.util.ArrayList
;
import
java.util.List
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
import
jp.agentec.sinaburocast.common.util.PropertyUtil
;
import
jp.agentec.sinaburocast.common.util.SinaburoUtil
;
import
jp.agentec.sinaburocast.entity.Answer
;
import
jp.agentec.sinaburocast.entity.Enquete
;
import
jp.agentec.sinaburocast.entity.Organization
;
import
jp.agentec.sinaburocast.entity.Question
;
import
jp.agentec.sinaburocast.service.QuestionService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.builder.StandardToStringStyle
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
...
...
@@ -21,6 +12,15 @@ import org.apache.velocity.tools.generic.ListTool;
import
org.mobylet.core.util.StringUtils
;
import
org.seasar.framework.util.StringUtil
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
import
jp.agentec.sinaburocast.common.util.PropertyUtil
;
import
jp.agentec.sinaburocast.common.util.SinaburoUtil
;
import
jp.agentec.sinaburocast.entity.Answer
;
import
jp.agentec.sinaburocast.entity.Enquete
;
import
jp.agentec.sinaburocast.entity.Organization
;
import
jp.agentec.sinaburocast.entity.Question
;
import
jp.agentec.sinaburocast.service.QuestionService
;
/**
...
...
@@ -85,8 +85,6 @@ public class EnqueteRegistForm {
public
Question
inputQuestion
=
new
Question
();
// /**
// * 設問一覧から設問内容をクリックした場合更新。
// */
...
...
src/main/java/jp/agentec/sinaburocast/service/AnswerService.java
View file @
f4bc7ff2
...
...
@@ -2,13 +2,13 @@ package jp.agentec.sinaburocast.service;
import
java.util.List
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
import
jp.agentec.sinaburocast.entity.Answer
;
import
org.seasar.extension.jdbc.where.SimpleWhere
;
import
org.seasar.framework.container.annotation.tiger.Component
;
import
org.seasar.framework.container.annotation.tiger.InstanceType
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
import
jp.agentec.sinaburocast.entity.Answer
;
@Component
(
instance
=
InstanceType
.
SINGLETON
)
public
class
AnswerService
extends
AbstractService
<
Answer
>
{
...
...
@@ -36,6 +36,12 @@ public class AnswerService extends AbstractService<Answer> {
public
List
<
Answer
>
findAllByEnqueteId
(
String
eid
)
{
return
select
().
where
(
new
SimpleWhere
().
eq
(
"enqueteId"
,
eid
)).
getResultList
();
}
public
List
<
Answer
>
findAllByEnqueteId
(
Integer
enqueteId
,
Integer
questionId
)
{
return
select
().
where
(
new
SimpleWhere
().
eq
(
"enqueteId"
,
enqueteId
)
.
eq
(
"questionId"
,
questionId
)
.
eq
(
"delFlg"
,
SinaburoConstant
.
DelFlg
.
NOT_DEL
))
.
getResultList
();
}
public
List
<
Answer
>
findAllByQuestionId
(
Integer
questionId
)
{
return
select
().
where
(
new
SimpleWhere
().
eq
(
"questionId"
,
questionId
)).
getResultList
();
...
...
src/main/java/jp/agentec/sinaburocast/service/EnqueteService.java
View file @
f4bc7ff2
...
...
@@ -14,6 +14,19 @@ import java.util.Map;
import
java.util.Properties
;
import
java.util.TreeMap
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.apache.velocity.VelocityContext
;
import
org.apache.velocity.tools.generic.DateTool
;
import
org.apache.velocity.tools.generic.MathTool
;
import
org.seasar.extension.jdbc.AutoSelect
;
import
org.seasar.extension.jdbc.where.SimpleWhere
;
import
org.seasar.framework.beans.util.BeanMap
;
import
org.seasar.framework.beans.util.Beans
;
import
org.seasar.framework.container.annotation.tiger.Component
;
import
org.seasar.framework.container.annotation.tiger.InstanceType
;
import
org.seasar.framework.util.StringUtil
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
import
jp.agentec.sinaburocast.common.SinaburoConstant.EnqueteStatusType
;
import
jp.agentec.sinaburocast.common.exception.ExpectedException
;
...
...
@@ -35,19 +48,6 @@ import jp.agentec.sinaburocast.form.admin.enquete.EnqueteRegistForm;
import
jp.agentec.sinaburocast.form.admin.enquete.EnqueteSearchForm
;
import
jp.agentec.sinaburocast.form.batch.EnqueteSumBatchForm
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.apache.velocity.VelocityContext
;
import
org.apache.velocity.tools.generic.DateTool
;
import
org.apache.velocity.tools.generic.MathTool
;
import
org.seasar.extension.jdbc.AutoSelect
;
import
org.seasar.extension.jdbc.where.SimpleWhere
;
import
org.seasar.framework.beans.util.BeanMap
;
import
org.seasar.framework.beans.util.Beans
;
import
org.seasar.framework.container.annotation.tiger.Component
;
import
org.seasar.framework.container.annotation.tiger.InstanceType
;
import
org.seasar.framework.util.StringUtil
;
@Component
(
instance
=
InstanceType
.
SINGLETON
)
...
...
@@ -81,7 +81,6 @@ public class EnqueteService extends AbstractService<Enquete> {
public
Enquete
findById
(
Integer
enqueteId
)
{
return
select
().
id
(
enqueteId
).
getSingleResult
();
}
...
...
@@ -952,8 +951,8 @@ public class EnqueteService extends AbstractService<Enquete> {
* @param eid
* @param adminLoginId
*/
public
void
enqueteCopy
(
Integer
ei
d
,
String
adminLoginId
){
Enquete
enquete
=
this
.
findById
(
ei
d
);
public
void
enqueteCopy
(
Integer
originEnqueteI
d
,
String
adminLoginId
){
Enquete
enquete
=
this
.
findById
(
originEnqueteI
d
);
enquete
.
enqueteName
=
"コピー"
+
enquete
.
enqueteName
;
enquete
.
version
=
0
;
enquete
.
status
=
0
;
...
...
@@ -962,15 +961,18 @@ public class EnqueteService extends AbstractService<Enquete> {
enquete
.
endDate
=
""
;
this
.
insertEnquete
(
enquete
,
adminLoginId
);
// 設問をコピーする。
questionService
.
questionCopy
(
originEnqueteId
,
enquete
.
enqueteId
,
adminLoginId
);
AdminNotifyMail
adminNotifyMail
=
adminNotifyMailService
.
findByEnqueteId
(
ei
d
);
AdminNotifyMail
adminNotifyMail
=
adminNotifyMailService
.
findByEnqueteId
(
originEnqueteI
d
);
if
(
adminNotifyMail
!=
null
){
adminNotifyMail
.
version
=
0
;
adminNotifyMail
.
enqueteId
=
enquete
.
enqueteId
;
adminNotifyMailService
.
insertAdminNotifyMail
(
adminNotifyMail
,
adminLoginId
);
}
MemberNotifyMail
memberNotifyMail
=
memberNotifyMailService
.
findByEnqueteId
(
ei
d
);
MemberNotifyMail
memberNotifyMail
=
memberNotifyMailService
.
findByEnqueteId
(
originEnqueteI
d
);
if
(
memberNotifyMail
!=
null
){
memberNotifyMail
.
version
=
0
;
...
...
src/main/java/jp/agentec/sinaburocast/service/QuestionService.java
View file @
f4bc7ff2
...
...
@@ -3,16 +3,17 @@ package jp.agentec.sinaburocast.service;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.seasar.extension.jdbc.where.SimpleWhere
;
import
org.seasar.framework.container.annotation.tiger.Component
;
import
org.seasar.framework.container.annotation.tiger.InstanceType
;
import
jp.agentec.sinaburocast.common.SinaburoConstant
;
import
jp.agentec.sinaburocast.entity.AdminUser
;
import
jp.agentec.sinaburocast.entity.Answer
;
import
jp.agentec.sinaburocast.entity.Question
;
import
jp.agentec.sinaburocast.form.admin.enquete.EnqueteRegistForm
;
import
org.seasar.extension.jdbc.where.SimpleWhere
;
import
org.seasar.framework.container.annotation.tiger.Component
;
import
org.seasar.framework.container.annotation.tiger.InstanceType
;
@Component
(
instance
=
InstanceType
.
SINGLETON
)
public
class
QuestionService
extends
AbstractService
<
Question
>
{
...
...
@@ -89,6 +90,10 @@ public class QuestionService extends AbstractService<Question> {
return
select
().
where
(
new
SimpleWhere
().
eq
(
"enqueteId"
,
eid
).
eq
(
"delFlg"
,
SinaburoConstant
.
DelFlg
.
NOT_DEL
)).
getResultList
();
}
public
List
<
Question
>
findAllByEnqueteId
(
Integer
eid
)
{
return
select
().
where
(
new
SimpleWhere
().
eq
(
"enqueteId"
,
eid
).
eq
(
"delFlg"
,
SinaburoConstant
.
DelFlg
.
NOT_DEL
)).
getResultList
();
}
/**
* アンケート検索画面で削除ボタンを押した場合。論理削除
...
...
@@ -255,6 +260,33 @@ public class QuestionService extends AbstractService<Question> {
this
.
questionRegist
(
frm
,
adminUser
.
loginId
,
true
);
return
0
;
}
/**
* 設問をコピーする。
*
* @param questionId 設問ID
* @return
*/
public
void
questionCopy
(
Integer
originEnqueteId
,
Integer
newEnqueteId
,
String
loginId
)
{
List
<
Question
>
questionList
=
findAllByEnqueteId
(
originEnqueteId
);
// アンケートに設問がない場合
if
(
CollectionUtils
.
isEmpty
(
questionList
))
{
return
;}
for
(
Question
question
:
questionList
)
{
question
.
enqueteId
=
newEnqueteId
;
question
.
version
=
0
;
// 詳細項目情報取得
List
<
Answer
>
answerList
=
answerService
.
findAllByEnqueteId
(
originEnqueteId
,
question
.
questionId
);
insertQuestion
(
question
,
loginId
);
for
(
Answer
answer
:
answerList
)
{
// 新しいquestionIdをセット
answer
.
questionId
=
question
.
questionId
;
answer
.
version
=
0
;
answerService
.
insertAnswer
(
answer
,
loginId
);
}
}
}
/**
...
...
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