提交 4558db0e 编写于 作者: Skyeye云's avatar Skyeye云

问卷回答完成

上级 c317b240
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
package com.skyeye.common.util;
public class IPEntry {
public String beginIp;
public String endIp;
public String country;
public String area;
public IPEntry() {
beginIp = endIp = country = area = "";
}
public String toString() {
return this.area + " " + this.country + "IP范围:" + this.beginIp + "-" + this.endIp;
}
}
package com.skyeye.common.util;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteOrder;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import org.springframework.stereotype.Component;
@Component
public class IPSeeker {
private static class IPLocation {
public String country;
public String area;
public IPLocation() {
country = area = "";
}
public IPLocation getCopy() {
IPLocation ret = new IPLocation();
ret.country = country;
ret.area = area;
return ret;
}
}
private static final String IP_FILE = IPSeeker.class.getResource("qqwry.dat").toString().substring(5);
// 一些固定常量,比如记录长度等等
private static final int IP_RECORD_LENGTH = 7;
private static final byte AREA_FOLLOWED = 0x01;
private static final byte NO_AREA = 0x2;
// 用来做为cache,查询一个ip时首先查看cache,以减少不必要的重复查找
@SuppressWarnings("rawtypes")
private static Hashtable ipCache;
// 随机文件访问类
private static RandomAccessFile ipFile;
// 内存映射文件
private static MappedByteBuffer mbb;
// 单一模式实例
private static IPSeeker instance = new IPSeeker();
// 起始地区的开始和结束的绝对偏移
private static long ipBegin, ipEnd;
// 为提高效率而采用的临时变量
private static IPLocation loc;
private static byte[] buf;
private static byte[] b4;
private static byte[] b3;
/**
* 私有构造函数
*/
private IPSeeker() {
ipCache = new Hashtable<>();
loc = new IPLocation();
buf = new byte[100];
b4 = new byte[4];
b3 = new byte[3];
try {
ipFile = new RandomAccessFile(IP_FILE, "r");
} catch (FileNotFoundException e) {
System.out.println(IPSeeker.class.getResource("qqwry.dat")
.toString());
System.out.println(IP_FILE);
System.out.println("IP地址信息文件没有找到,IP显示功能将无法使用");
ipFile = null;
}
// 如果打开文件成功,读取文件头信息
if (ipFile != null) {
try {
ipBegin = readLong4(0);
ipEnd = readLong4(4);
if (ipBegin == -1 || ipEnd == -1) {
ipFile.close();
ipFile = null;
}
} catch (IOException e) {
System.out.println("IP地址信息文件格式有错误,IP显示功能将无法使用");
ipFile = null;
}
}
}
/**
* @return 单一实例
*/
public static IPSeeker getInstance() {
return instance;
}
/**
* 给定一个地点的不完全名字,得到一系列包含s子串的IP范围记录
*
* @param s
* 地点子串
* @return 包含IPEntry类型的List
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public List getIPEntriesDebug(String s) {
List ret = new ArrayList();
long endOffset = ipEnd + 4;
for (long offset = ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) {
// 读取结束IP偏移
long temp = readLong3(offset);
// 如果temp不等于-1,读取IP的地点信息
if (temp != -1) {
IPLocation loc = getIPLocation(temp);
// 判断是否这个地点里面包含了s子串,如果包含了,添加这个记录到List中,如果没有,继续
if (loc.country.indexOf(s) != -1 || loc.area.indexOf(s) != -1) {
IPEntry entry = new IPEntry();
entry.country = loc.country;
entry.area = loc.area;
// 得到起始IP
readIP(offset - 4, b4);
entry.beginIp = Utils.getIpStringFromBytes(b4);
// 得到结束IP
readIP(temp, b4);
entry.endIp = Utils.getIpStringFromBytes(b4);
// 添加该记录
ret.add(entry);
}
}
}
return ret;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static List getIPEntries(String s) {
List ret = new ArrayList();
try {
// 映射IP信息文件到内存中
if (mbb == null) {
FileChannel fc = ipFile.getChannel();
mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, ipFile.length());
mbb.order(ByteOrder.LITTLE_ENDIAN);
}
int endOffset = (int) ipEnd;
for (int offset = (int) ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) {
int temp = readInt3(offset);
if (temp != -1) {
IPLocation loc = getIPLocation(temp);
// 判断是否这个地点里面包含了s子串,如果包含了,添加这个记录到List中,如果没有,继续
if (loc.country.indexOf(s) != -1
|| loc.area.indexOf(s) != -1) {
IPEntry entry = new IPEntry();
entry.country = loc.country;
entry.area = loc.area;
// 得到起始IP
readIP(offset - 4, b4);
entry.beginIp = Utils.getIpStringFromBytes(b4);
// 得到结束IP
readIP(temp, b4);
entry.endIp = Utils.getIpStringFromBytes(b4);
// 添加该记录
ret.add(entry);
}
}
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
return ret;
}
private static int readInt3(int offset) {
mbb.position(offset);
return mbb.getInt() & 0x00FFFFFF;
}
/**
* 从内存映射文件的当前位置开始的3个字节读取一个int
*
* @return
*/
private static int readInt3() {
return mbb.getInt() & 0x00FFFFFF;
}
/**
* 根据IP得到国家名
*
* @param ip
* ip的字节数组形式
* @return 国家名字符串
*/
@SuppressWarnings("unchecked")
public static String getCountry(byte[] ip) {
// 检查ip地址文件是否正常
if (ipFile == null)
return "错误的IP数据库文件";
// 保存ip,转换ip字节数组为字符串形式
String ipStr = Utils.getIpStringFromBytes(ip);
// 先检查cache中是否已经包含有这个ip的结果,没有再搜索文件
if (ipCache.containsKey(ipStr)) {
IPLocation loc = (IPLocation) ipCache.get(ipStr);
return loc.country;
} else {
IPLocation loc = getIPLocation(ip);
ipCache.put(ipStr, loc.getCopy());
return loc.country;
}
}
/**
* 根据IP得到国家名
*
* @param ip
* IP的字符串形式
* @return 国家名字符串
*/
public static String getCountry(String ip) {
return getCountry(Utils.getIpByteArrayFromString(ip));
}
/**
* 根据IP得到地区名
*
* @param ip
* ip的字节数组形式
* @return 地区名字符串
*/
@SuppressWarnings("unchecked")
public String getArea(byte[] ip) {
// 检查ip地址文件是否正常
if (ipFile == null)
return "错误的IP数据库文件";
// 保存ip,转换ip字节数组为字符串形式
String ipStr = Utils.getIpStringFromBytes(ip);
// 先检查cache中是否已经包含有这个ip的结果,没有再搜索文件
if (ipCache.containsKey(ipStr)) {
IPLocation loc = (IPLocation) ipCache.get(ipStr);
return loc.area;
} else {
IPLocation loc = getIPLocation(ip);
ipCache.put(ipStr, loc.getCopy());
return loc.area;
}
}
/**
* 根据IP得到地区名
*
* @param ip
* IP的字符串形式
* @return 地区名字符串
*/
public String getArea(String ip) {
return getArea(Utils.getIpByteArrayFromString(ip));
}
/**
* 根据ip搜索ip信息文件,得到IPLocation结构,所搜索的ip参数从类成员ip中得到
*
* @param ip
* 要查询的IP
* @return IPLocation结构
*/
private static IPLocation getIPLocation(byte[] ip) {
IPLocation info = null;
long offset = locateIP(ip);
if (offset != -1)
info = getIPLocation(offset);
if (info == null) {
info = new IPLocation();
info.country = "未知国家";
info.area = "未知地区";
}
return info;
}
/**
* 从offset位置读取4个字节为一个long,因为java为big-endian格式,所以没办法 用了这么一个函数来做转换
*
* @param offset
* @return 读取的long值,返回-1表示读取文件失败
*/
private static long readLong4(long offset) {
long ret = 0;
try {
ipFile.seek(offset);
ret |= (ipFile.readByte() & 0xFF);
ret |= ((ipFile.readByte() << 8) & 0xFF00);
ret |= ((ipFile.readByte() << 16) & 0xFF0000);
ret |= ((ipFile.readByte() << 24) & 0xFF000000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从offset位置读取3个字节为一个long,因为java为big-endian格式,所以没办法 用了这么一个函数来做转换
*
* @param offset
* @return 读取的long值,返回-1表示读取文件失败
*/
private static long readLong3(long offset) {
long ret = 0;
try {
ipFile.seek(offset);
ipFile.readFully(b3);
ret |= (b3[0] & 0xFF);
ret |= ((b3[1] << 8) & 0xFF00);
ret |= ((b3[2] << 16) & 0xFF0000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从当前位置读取3个字节转换成long
*
* @return
*/
private static long readLong3() {
long ret = 0;
try {
ipFile.readFully(b3);
ret |= (b3[0] & 0xFF);
ret |= ((b3[1] << 8) & 0xFF00);
ret |= ((b3[2] << 16) & 0xFF0000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从offset位置读取四个字节的ip地址放入ip数组中,读取后的ip为big-endian格式,但是
* 文件中是little-endian形式,将会进行转换
*
* @param offset
* @param ip
*/
private static void readIP(long offset, byte[] ip) {
try {
ipFile.seek(offset);
ipFile.readFully(ip);
byte temp = ip[0];
ip[0] = ip[3];
ip[3] = temp;
temp = ip[1];
ip[1] = ip[2];
ip[2] = temp;
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
/**
* 从offset位置读取四个字节的ip地址放入ip数组中,读取后的ip为big-endian格式,但是
* 文件中是little-endian形式,将会进行转换
*
* @param offset
* @param ip
*/
private static void readIP(int offset, byte[] ip) {
mbb.position(offset);
mbb.get(ip);
byte temp = ip[0];
ip[0] = ip[3];
ip[3] = temp;
temp = ip[1];
ip[1] = ip[2];
ip[2] = temp;
}
/**
* 把类成员ip和beginIp比较,注意这个beginIp是big-endian的
*
* @param ip
* 要查询的IP
* @param beginIp
* 和被查询IP相比较的IP
* @return 相等返回0,ip大于beginIp则返回1,小于返回-1。
*/
private static int compareIP(byte[] ip, byte[] beginIp) {
for (int i = 0; i < 4; i++) {
int r = compareByte(ip[i], beginIp[i]);
if (r != 0)
return r;
}
return 0;
}
/**
* 把两个byte当作无符号数进行比较
*
* @param b1
* @param b2
* @return 若b1大于b2则返回1,相等返回0,小于返回-1
*/
private static int compareByte(byte b1, byte b2) {
if ((b1 & 0xFF) > (b2 & 0xFF)) // 比较是否大于
return 1;
else if ((b1 ^ b2) == 0)// 判断是否相等
return 0;
else
return -1;
}
/**
* 这个方法将根据ip的内容,定位到包含这个ip国家地区的记录处,返回一个绝对偏移 方法使用二分法查找。
*
* @param ip
* 要查询的IP
* @return 如果找到了,返回结束IP的偏移,如果没有找到,返回-1
*/
private static long locateIP(byte[] ip) {
long m = 0;
int r;
// 比较第一个ip项
readIP(ipBegin, b4);
r = compareIP(ip, b4);
if (r == 0)
return ipBegin;
else if (r < 0)
return -1;
// 开始二分搜索
for (long i = ipBegin, j = ipEnd; i < j;) {
m = getMiddleOffset(i, j);
readIP(m, b4);
r = compareIP(ip, b4);
// log.debug(Utils.getIpStringFromBytes(b));
if (r > 0)
i = m;
else if (r < 0) {
if (m == j) {
j -= IP_RECORD_LENGTH;
m = j;
} else
j = m;
} else
return readLong3(m + 4);
}
// 如果循环结束了,那么i和j必定是相等的,这个记录为最可能的记录,但是并非
// 肯定就是,还要检查一下,如果是,就返回结束地址区的绝对偏移
m = readLong3(m + 4);
readIP(m, b4);
r = compareIP(ip, b4);
if (r <= 0)
return m;
else
return -1;
}
/**
* 得到begin偏移和end偏移中间位置记录的偏移
*
* @param begin
* @param end
* @return
*/
private static long getMiddleOffset(long begin, long end) {
long records = (end - begin) / IP_RECORD_LENGTH;
records >>= 1;
if (records == 0)
records = 1;
return begin + records * IP_RECORD_LENGTH;
}
/**
* 给定一个ip国家地区记录的偏移,返回一个IPLocation结构
*
* @param offset
* @return
*/
private static IPLocation getIPLocation(long offset) {
try {
// 跳过4字节ip
ipFile.seek(offset + 4);
// 读取第一个字节判断是否标志字节
byte b = ipFile.readByte();
if (b == AREA_FOLLOWED) {
// 读取国家偏移
long countryOffset = readLong3();
// 跳转至偏移处
ipFile.seek(countryOffset);
// 再检查一次标志字节,因为这个时候这个地方仍然可能是个重定向
b = ipFile.readByte();
if (b == NO_AREA) {
loc.country = readString(readLong3());
ipFile.seek(countryOffset + 4);
} else
loc.country = readString(countryOffset);
// 读取地区标志
loc.area = readArea(ipFile.getFilePointer());
} else if (b == NO_AREA) {
loc.country = readString(readLong3());
loc.area = readArea(offset + 8);
} else {
loc.country = readString(ipFile.getFilePointer() - 1);
loc.area = readArea(ipFile.getFilePointer());
}
return loc;
} catch (IOException e) {
return null;
}
}
/**
* @param offset
* @return
*/
private static IPLocation getIPLocation(int offset) {
// 跳过4字节ip
mbb.position(offset + 4);
// 读取第一个字节判断是否标志字节
byte b = mbb.get();
if (b == AREA_FOLLOWED) {
// 读取国家偏移
int countryOffset = readInt3();
// 跳转至偏移处
mbb.position(countryOffset);
// 再检查一次标志字节,因为这个时候这个地方仍然可能是个重定向
b = mbb.get();
if (b == NO_AREA) {
loc.country = readString(readInt3());
mbb.position(countryOffset + 4);
} else
loc.country = readString(countryOffset);
// 读取地区标志
loc.area = readArea(mbb.position());
} else if (b == NO_AREA) {
loc.country = readString(readInt3());
loc.area = readArea(offset + 8);
} else {
loc.country = readString(mbb.position() - 1);
loc.area = readArea(mbb.position());
}
return loc;
}
/**
* 从offset偏移开始解析后面的字节,读出一个地区名
*
* @param offset
* @return 地区名字符串
* @throws IOException
*/
private static String readArea(long offset) throws IOException {
ipFile.seek(offset);
byte b = ipFile.readByte();
if (b == 0x01 || b == 0x02) {
long areaOffset = readLong3(offset + 1);
if (areaOffset == 0)
return "未知地区";
else
return readString(areaOffset);
} else
return readString(offset);
}
/**
* @param offset
* @return
*/
private static String readArea(int offset) {
mbb.position(offset);
byte b = mbb.get();
if (b == 0x01 || b == 0x02) {
int areaOffset = readInt3();
if (areaOffset == 0)
return "未知地区";
else
return readString(areaOffset);
} else
return readString(offset);
}
/**
* 从offset偏移处读取一个以0结束的字符串
*
* @param offset
* @return 读取的字符串,出错返回空字符串
*/
private static String readString(long offset) {
try {
ipFile.seek(offset);
int i;
for (i = 0, buf[i] = ipFile.readByte(); buf[i] != 0; buf[++i] = ipFile
.readByte())
;
if (i != 0)
return Utils.getString(buf, 0, i, "GBK");
} catch (IOException e) {
System.out.println(e.getMessage());
}
return "";
}
/**
* 从内存映射文件的offset位置得到一个0结尾字符串
*
* @param offset
* @return
*/
private static String readString(int offset) {
try {
mbb.position(offset);
int i;
for (i = 0, buf[i] = mbb.get(); buf[i] != 0; buf[++i] = mbb.get())
;
if (i != 0)
return Utils.getString(buf, 0, i, "GBK");
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
}
return "";
}
public static String getAddress(String ip) {
String country = getCountry(ip).equals(" CZ88.NET") ? "" : getCountry(ip);
String address = country;// + " " + area;
return address.trim();
}
}
\ No newline at end of file
...@@ -983,6 +983,62 @@ public class ToolUtil { ...@@ -983,6 +983,62 @@ public class ToolUtil {
return textStr;// 返回文本字符串 return textStr;// 返回文本字符串
} }
/**
* 两个时间之间相差距离多少分
*
* @param one
* 时间参数 1:
* @param two
* 时间参数 2:
* @return 相差天数
*/
public static long getDistanceDays(String str1, String str2) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date one;
Date two;
long min = 0;
try {
one = df.parse(str1);
two = df.parse(str2);
long time1 = one.getTime();
long time2 = two.getTime();
long diff;
if (time1 < time2) {
diff = time2 - time1;
} else {
diff = time1 - time2;
}
min = diff / (1000 * 60);
} catch (ParseException e) {
e.printStackTrace();
}
return min;
}
/**
*
* @Title: compare
* @Description: 时间字符串比较大小
* @param @param time1
* @param @param time2
* @param @return
* @param @throws ParseException 参数
* @return boolean 返回类型
* @throws
*/
public static boolean compare(String time1, String time2) throws ParseException {
// 如果想比较日期则写成"yyyy-MM-dd"就可以了
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
// 将字符串形式的时间转化为Date类型的时间
Date a = sdf.parse(time1);
Date b = sdf.parse(time2);
// Date类的一个方法,如果a早于b返回true,否则返回false
if (a.before(b))
return true;
else
return false;
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
List<Map<String, Object>> data = new ArrayList<>(); List<Map<String, Object>> data = new ArrayList<>();
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
......
package com.skyeye.common.util;
import java.io.UnsupportedEncodingException;
import org.springframework.beans.factory.annotation.Autowired;
public class Utils {
@Autowired
private IPSeeker ipSeeker;
/**
* 从ip的字符串形式得到字节数组形式
* @param ip 字符串形式的ip
* @return 字节数组形式的ip
*/
public static byte[] getIpByteArrayFromString(String ip) {
byte[] ret = new byte[4];
java.util.StringTokenizer st = new java.util.StringTokenizer(ip, ".");
try {
ret[0] = (byte)(Integer.parseInt(st.nextToken()) & 0xFF);
ret[1] = (byte)(Integer.parseInt(st.nextToken()) & 0xFF);
ret[2] = (byte)(Integer.parseInt(st.nextToken()) & 0xFF);
ret[3] = (byte)(Integer.parseInt(st.nextToken()) & 0xFF);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return ret;
}
public static void main(String args[]){
byte[] a=getIpByteArrayFromString(args[0]);
for(int i=0;i< a.length;i++)
System.out.println(a[i]);
System.out.println(getIpStringFromBytes(a));
}
/**
* 对原始字符串进行编码转换,如果失败,返回原始的字符串
* @param s 原始字符串
* @param srcEncoding 源编码方式
* @param destEncoding 目标编码方式
* @return 转换编码后的字符串,失败返回原始字符串
*/
public static String getString(String s, String srcEncoding, String destEncoding) {
try {
return new String(s.getBytes(srcEncoding), destEncoding);
} catch (UnsupportedEncodingException e) {
return s;
}
}
/**
* 根据某种编码方式将字节数组转换成字符串
* @param b 字节数组
* @param encoding 编码方式
* @return 如果encoding不支持,返回一个缺省编码的字符串
*/
public static String getString(byte[] b, String encoding) {
try {
return new String(b, encoding);
} catch (UnsupportedEncodingException e) {
return new String(b);
}
}
/**
* 根据某种编码方式将字节数组转换成字符串
* @param b 字节数组
* @param offset 要转换的起始位置
* @param len 要转换的长度
* @param encoding 编码方式
* @return 如果encoding不支持,返回一个缺省编码的字符串
*/
public static String getString(byte[] b, int offset, int len, String encoding) {
try {
return new String(b, offset, len, encoding);
} catch (UnsupportedEncodingException e) {
return new String(b, offset, len);
}
}
/**
* @param ip ip的字节数组形式
* @return 字符串形式的ip
*/
public static String getIpStringFromBytes(byte[] ip) {
StringBuffer sb = new StringBuffer();
sb.append(ip[0] & 0xFF);
sb.append('.');
sb.append(ip[1] & 0xFF);
sb.append('.');
sb.append(ip[2] & 0xFF);
sb.append('.');
sb.append(ip[3] & 0xFF);
return sb.toString();
}
}
...@@ -448,4 +448,36 @@ public class DwSurveyDirectoryController { ...@@ -448,4 +448,36 @@ public class DwSurveyDirectoryController {
dwSurveyDirectoryService.insertSurveyMationCopyById(inputObject, outputObject); dwSurveyDirectoryService.insertSurveyMationCopyById(inputObject, outputObject);
} }
/**
*
* @Title: queryAnswerSurveyMationByIp
* @Description: 判断该ip的用户是否回答过此问卷
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DwSurveyDirectoryController/queryAnswerSurveyMationByIp")
@ResponseBody
public void queryAnswerSurveyMationByIp(InputObject inputObject, OutputObject outputObject) throws Exception{
dwSurveyDirectoryService.queryAnswerSurveyMationByIp(inputObject, outputObject);
}
/**
*
* @Title: insertAnswerSurveyMationByIp
* @Description: 用户回答问卷
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DwSurveyDirectoryController/insertAnswerSurveyMationByIp")
@ResponseBody
public void insertAnswerSurveyMationByIp(InputObject inputObject, OutputObject outputObject) throws Exception{
dwSurveyDirectoryService.insertAnswerSurveyMationByIp(inputObject, outputObject);
}
} }
...@@ -194,4 +194,48 @@ public interface DwSurveyDirectoryDao { ...@@ -194,4 +194,48 @@ public interface DwSurveyDirectoryDao {
public int addQuestionOrderByMationCopyList(List<Map<String, Object>> questionOrderBys) throws Exception; public int addQuestionOrderByMationCopyList(List<Map<String, Object>> questionOrderBys) throws Exception;
public int editSurveyAnswerNumById(Map<String, Object> surveyMation) throws Exception;
public int saveAnYesnoMaps(List<Map<String, Object>> beans) throws Exception;
public int saveAnRadioMaps(List<Map<String, Object>> beans) throws Exception;
public int saveAnMultiFillMaps(List<Map<String, Object>> beans) throws Exception;
public int saveScoreMaps(List<Map<String, Object>> beans) throws Exception;
public int saveChenCheckboxMaps(List<Map<String, Object>> beans) throws Exception;
public int saveCompAnRadioMaps(List<Map<String, Object>> beans) throws Exception;
public int saveCompChehRadioMaps(List<Map<String, Object>> beans) throws Exception;
public int saveChenScoreMaps(List<Map<String, Object>> beans) throws Exception;
public int saveAnCheckboxMaps(List<Map<String, Object>> beans) throws Exception;
public int saveAnFillMaps(List<Map<String, Object>> beans) throws Exception;
public int saveAnAnswerMaps(List<Map<String, Object>> beans) throws Exception;
public int saveCompAnCheckboxMaps(List<Map<String, Object>> beans) throws Exception;
public int saveEnumMaps(List<Map<String, Object>> beans) throws Exception;
public int saveQuOrderMaps(List<Map<String, Object>> beans) throws Exception;
public int saveChenRadioMaps(List<Map<String, Object>> beans) throws Exception;
public int saveChenFbkMaps(List<Map<String, Object>> beans) throws Exception;
public int insertSurveyAnswer(Map<String, Object> surveyAnswer) throws Exception;
public Map<String, Object> querySurveyAnswerMationByIp(Map<String, Object> map) throws Exception;
public List<Map<String, Object>> querySurveyAnswerMationOverFiveMinByIp(Map<String, Object> map) throws Exception;
public int editSurveyStateToEndNumById(Map<String, Object> surveyMation) throws Exception;
public int editSurveyStateToEndNumZdById(Map<String, Object> map) throws Exception;
} }
...@@ -59,4 +59,8 @@ public interface DwSurveyDirectoryService { ...@@ -59,4 +59,8 @@ public interface DwSurveyDirectoryService {
public void insertSurveyMationCopyById(InputObject inputObject, OutputObject outputObject) throws Exception; public void insertSurveyMationCopyById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryAnswerSurveyMationByIp(InputObject inputObject, OutputObject outputObject) throws Exception;
public void insertAnswerSurveyMationByIp(InputObject inputObject, OutputObject outputObject) throws Exception;
} }
...@@ -5,11 +5,14 @@ import java.util.HashMap; ...@@ -5,11 +5,14 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.util.WebUtils;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
...@@ -17,9 +20,12 @@ import com.skyeye.common.constans.CheckType; ...@@ -17,9 +20,12 @@ import com.skyeye.common.constans.CheckType;
import com.skyeye.common.constans.QuType; import com.skyeye.common.constans.QuType;
import com.skyeye.common.object.InputObject; import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject; import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.IPSeeker;
import com.skyeye.common.util.ToolUtil; import com.skyeye.common.util.ToolUtil;
import com.skyeye.eve.dao.DwSurveyDirectoryDao; import com.skyeye.eve.dao.DwSurveyDirectoryDao;
import com.skyeye.eve.service.DwSurveyDirectoryService; import com.skyeye.eve.service.DwSurveyDirectoryService;
import com.skyeye.quartz.config.QuartzService;
import com.skyeye.quartz.entity.SysQuartz;
@Service @Service
...@@ -27,6 +33,9 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{ ...@@ -27,6 +33,9 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{
@Autowired @Autowired
private DwSurveyDirectoryDao dwSurveyDirectoryDao; private DwSurveyDirectoryDao dwSurveyDirectoryDao;
@Autowired
private QuartzService quartzService;
/** /**
* *
...@@ -1174,8 +1183,23 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{ ...@@ -1174,8 +1183,23 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{
Map<String, Object> map = inputObject.getParams(); Map<String, Object> map = inputObject.getParams();
Map<String, Object> surveyMation = dwSurveyDirectoryDao.querySurveyMationById(map);//获取问卷信息 Map<String, Object> surveyMation = dwSurveyDirectoryDao.querySurveyMationById(map);//获取问卷信息
if("0".equals(surveyMation.get("surveyState").toString())){//设计状态可以发布问卷 if("0".equals(surveyMation.get("surveyState").toString())){//设计状态可以发布问卷
map.put("startTime", ToolUtil.getTimeAndToString()); List<Map<String, Object>> questions = dwSurveyDirectoryDao.queryQuestionListByBelongId(map);//获取问卷中的题
dwSurveyDirectoryDao.editSurveyStateToReleaseById(map); if(!questions.isEmpty()){
map.put("startTime", ToolUtil.getTimeAndToString());
map.put("questionNum", questions.size());
dwSurveyDirectoryDao.editSurveyStateToReleaseById(map);
if("1".equals(surveyMation.get("ynEndTime").toString())){//是否依据时间结束
SysQuartz sysQuartz = new SysQuartz();
sysQuartz.setId(ToolUtil.getSurFaceId());
sysQuartz.setName(surveyMation.get("id").toString());
sysQuartz.setRemark("问卷调查-【" + surveyMation.get("surveyName").toString() + "】");
sysQuartz.setGroups("endSurveyMation");
sysQuartz.setCron(ToolUtil.getCrons1(surveyMation.get("endTime").toString()));
quartzService.addJob(sysQuartz);
}
}else{
outputObject.setreturnMessage("该问卷没有调查项,无法发布问卷。");
}
}else{ }else{
outputObject.setreturnMessage("该问卷已发布,请刷新数据。"); outputObject.setreturnMessage("该问卷已发布,请刷新数据。");
} }
...@@ -1344,13 +1368,14 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{ ...@@ -1344,13 +1368,14 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{
} }
count += Integer.parseInt(row.get("anCount").toString()); count += Integer.parseInt(row.get("anCount").toString());
} }
for(Map<String, Object> row : rows){ for(Map<String, Object> bean : beans){
row.put("anAllCount", count); bean.put("anAllCount", count);
List<Map<String, Object>> columns = (List<Map<String, Object>>) row.get("questionChenColumn"); for(Map<String, Object> row : rows){
for(Map<String, Object> column : columns){ if(row.get("id").toString().equals(bean.get("quRowId").toString()))
column.put("anChenRadios", beans); bean.put("anCount", row.get("anCount").toString());
} }
} }
question.put("anChenRadios", beans);
} else if (quType.equals(QuType.CHENFBK.getActionName())){//矩阵填空题 } else if (quType.equals(QuType.CHENFBK.getActionName())){//矩阵填空题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenFbkGroupStat(question); List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenFbkGroupStat(question);
List<Map<String, Object>> rows = (List<Map<String, Object>>) question.get("questionChenRow"); List<Map<String, Object>> rows = (List<Map<String, Object>>) question.get("questionChenRow");
...@@ -1364,13 +1389,14 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{ ...@@ -1364,13 +1389,14 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{
} }
count += Integer.parseInt(row.get("anCount").toString()); count += Integer.parseInt(row.get("anCount").toString());
} }
for(Map<String, Object> row : rows){ for(Map<String, Object> bean : beans){
row.put("anAllCount", count); bean.put("anAllCount", count);
List<Map<String, Object>> columns = (List<Map<String, Object>>) row.get("questionChenColumn"); for(Map<String, Object> row : rows){
for(Map<String, Object> column : columns){ if(row.get("id").toString().equals(bean.get("quRowId").toString()))
column.put("anChenFbks", beans); bean.put("anCount", row.get("anCount").toString());
} }
} }
question.put("anChenFbks", beans);
} else if(quType.equals(QuType.CHENCHECKBOX.getActionName())){//矩阵多选题 } else if(quType.equals(QuType.CHENCHECKBOX.getActionName())){//矩阵多选题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenCheckBoxGroupStat(question); List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenCheckBoxGroupStat(question);
List<Map<String, Object>> rows = (List<Map<String, Object>>) question.get("questionChenRow"); List<Map<String, Object>> rows = (List<Map<String, Object>>) question.get("questionChenRow");
...@@ -1384,22 +1410,17 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{ ...@@ -1384,22 +1410,17 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{
} }
count += Integer.parseInt(row.get("anCount").toString()); count += Integer.parseInt(row.get("anCount").toString());
} }
for(Map<String, Object> row : rows){ for(Map<String, Object> bean : beans){
row.put("anAllCount", count); bean.put("anAllCount", count);
List<Map<String, Object>> columns = (List<Map<String, Object>>) row.get("questionChenColumn"); for(Map<String, Object> row : rows){
for(Map<String, Object> column : columns){ if(row.get("id").toString().equals(bean.get("quRowId").toString()))
column.put("anChenCheckboxs", beans); bean.put("anCount", row.get("anCount").toString());
} }
} }
question.put("anChenCheckboxs", beans);
} else if(quType.equals(QuType.CHENSCORE.getActionName())){//矩阵评分题 } else if(quType.equals(QuType.CHENSCORE.getActionName())){//矩阵评分题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenScoreGroupStat(question); List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenScoreGroupStat(question);
List<Map<String, Object>> rows = (List<Map<String, Object>>) question.get("questionChenRow"); question.put("anChenScores", beans);
for(Map<String, Object> row : rows){
List<Map<String, Object>> columns = (List<Map<String, Object>>) row.get("questionChenColumn");
for(Map<String, Object> column : columns){
column.put("anChenScores", beans);
}
}
}else if (quType.equals(QuType.SCORE.getActionName())) {//评分题 }else if (quType.equals(QuType.SCORE.getActionName())) {//评分题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryScoreGroupStat(question); List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryScoreGroupStat(question);
List<Map<String, Object>> scores = (List<Map<String, Object>>) question.get("quScores"); List<Map<String, Object>> scores = (List<Map<String, Object>>) question.get("quScores");
...@@ -1552,4 +1573,891 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{ ...@@ -1552,4 +1573,891 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{
} }
} }
/**
*
* @Title: queryAnswerSurveyMationByIp
* @Description: 判断该ip的用户是否回答过此问卷
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryAnswerSurveyMationByIp(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> surveyMation = dwSurveyDirectoryDao.querySurveyMationById(map);//获取问卷信息
if("4".equals(surveyMation.get("effective").toString()) || "1".equals(surveyMation.get("effectiveIp").toString())){//每台电脑或手机只能答一次
Map<String, Object> answerMation = dwSurveyDirectoryDao.querySurveyAnswerMationByIp(map);
if(answerMation != null && !answerMation.isEmpty()){
outputObject.setreturnMessage("您已参与过该问卷,请休息一会儿。");
return;
}
}else{//不做ip限制,则默认每五分钟才能答一次
List<Map<String, Object>> answerMation = dwSurveyDirectoryDao.querySurveyAnswerMationOverFiveMinByIp(map);
if(answerMation != null && !answerMation.isEmpty()){
outputObject.setreturnMessage("您已参与过该问卷,请休息一会儿。");
return;
}
}
if("1".equals(surveyMation.get("ynEndNum").toString())){//是否依据收到的份数结束
if(Integer.parseInt(surveyMation.get("answerNum").toString()) + 1 > Integer.parseInt(surveyMation.get("endNum").toString())){
outputObject.setreturnMessage("问卷已结束。");
return;
}
}
if("1".equals(surveyMation.get("ynEndTime").toString())){//是否依据时间结束
if(ToolUtil.compare(surveyMation.get("endTime").toString(), ToolUtil.getTimeAndToString())){//当前时间和设置的结束时间作比较
outputObject.setreturnMessage("问卷已结束。");
return;
}
}
outputObject.setBean(surveyMation);
}
/**
*
* @Title: insertAnswerSurveyMationByIp
* @Description: 用户回答问卷
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@SuppressWarnings({ "static-access", "unchecked" })
@Override
public void insertAnswerSurveyMationByIp(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> data = JSONObject.fromObject(map.get("jsonData").toString());
map.put("id", data.get("surveyId"));
Map<String, Object> surveyMation = dwSurveyDirectoryDao.querySurveyMationById(map);//获取问卷信息
if("4".equals(surveyMation.get("effective").toString()) || "1".equals(surveyMation.get("effectiveIp").toString())){//每台电脑或手机只能答一次
Map<String, Object> answerMation = dwSurveyDirectoryDao.querySurveyAnswerMationByIp(map);
if(answerMation != null && !answerMation.isEmpty()){
outputObject.setreturnMessage("您已参与过该问卷,请休息一会儿。");
return;
}
}else{//不做ip限制,则默认每五分钟才能答一次
List<Map<String, Object>> answerMation = dwSurveyDirectoryDao.querySurveyAnswerMationOverFiveMinByIp(map);
if(answerMation != null && !answerMation.isEmpty()){
outputObject.setreturnMessage("您已参与过该问卷,请休息一会儿。");
return;
}
}
if("1".equals(surveyMation.get("ynEndNum").toString())){//是否依据收到的份数结束
if(Integer.parseInt(surveyMation.get("answerNum").toString()) + 1 > Integer.parseInt(surveyMation.get("endNum").toString())){
outputObject.setreturnMessage("问卷已结束。");
return;
}
}
if("1".equals(surveyMation.get("ynEndTime").toString())){//是否依据时间结束
if(ToolUtil.compare(surveyMation.get("endTime").toString(), ToolUtil.getTimeAndToString())){//当前时间和设置的结束时间作比较
outputObject.setreturnMessage("问卷已结束。");
return;
}
}
String ipAddr = map.get("ip").toString();//问卷调查ip
HttpServletRequest request = inputObject.getRequest();
Map<String, Map<String, Object>> quMaps = buildSaveSurveyMap(request, data);
//问卷答卷信息
Map<String, Object> surveyAnswer = new HashMap<>();
String addr = IPSeeker.getCountry(ipAddr);
String city = getCurCityByCountry(addr);
surveyAnswer.put("ipAddr", ipAddr);
surveyAnswer.put("addr", addr);
surveyAnswer.put("city", city);
surveyAnswer.put("id", data.get("surveyId"));
surveyAnswer.put("dataSource", 0);
surveyAnswer.put("bgAnDate", map.get("bgAnDate"));
saveAnswer(surveyAnswer, quMaps);
}
/**
*
* @Title: getCurCityByCountry
* @Description: 获取城市
* @param @param country
* @param @return 参数
* @return String 返回类型
* @throws
*/
public String getCurCityByCountry(String country) {
String city = country;
city = city.replaceAll("\\S+省|市.*|[内蒙古|广西]", "");
city = city.replaceAll("清华大学.*", "北京");
return city;
}
/**
*
* @Title: buildSaveSurveyMap
* @Description: 用户回答问卷时获取key-value值
* @param @param request
* @param @return
* @param @throws Exception 参数
* @return Map<String,Map<String,Object>> 返回类型
* @throws
*/
public Map<String, Map<String, Object>> buildSaveSurveyMap(HttpServletRequest request, Map<String, Object> params) throws Exception {
Map<String, Map<String, Object>> quMaps = new HashMap<String, Map<String, Object>>();
Map<String, Object> yesnoMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.YESNO.getIndex() + "_");// 是非
quMaps.put("yesnoMaps", yesnoMaps);
Map<String, Object> radioMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.RADIO.getIndex() + "_");// 单选
Map<String, Object> checkboxMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.CHECKBOX.getIndex() + "_");// 多选
Map<String, Object> fillblankMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.FILLBLANK.getIndex() + "_");// 填空
quMaps.put("fillblankMaps", fillblankMaps);
Map<String, Object> dfillblankMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.MULTIFILLBLANK.getIndex() + "_");// 多项填空
for (String key : dfillblankMaps.keySet()) {
String dfillValue = dfillblankMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, dfillValue);
dfillblankMaps.put(key, map);
}
quMaps.put("multifillblankMaps", dfillblankMaps);
Map<String, Object> answerMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.ANSWER.getIndex() + "_");// 多行填空
quMaps.put("answerMaps", answerMaps);
Map<String, Object> compRadioMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.COMPRADIO.getIndex() + "_");// 复合单选
for (String key : compRadioMaps.keySet()) {
String enId = key;
String quItemId = compRadioMaps.get(key).toString();
String otherText = params.get("text_qu_" + QuType.COMPRADIO.getIndex() + "_" + enId + "_" + quItemId).toString();
Map<String, Object> anRadio = new HashMap<>();
anRadio.put("quId", enId);
anRadio.put("quItemId", quItemId);
anRadio.put("otherText", otherText);
compRadioMaps.put(key, anRadio);
}
quMaps.put("compRadioMaps", compRadioMaps);
Map<String, Object> compCheckboxMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.COMPCHECKBOX.getIndex() + "_");// 复合多选
for (String key : compCheckboxMaps.keySet()) {
String dfillValue = compCheckboxMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, "tag_" + dfillValue);
for (String key2 : map.keySet()) {
String quItemId = map.get(key2).toString();
String otherText = params.get("text_" + dfillValue + quItemId).toString();
Map<String, Object> anCheckbox = new HashMap<>();
anCheckbox.put("quItemId", quItemId);
anCheckbox.put("otherText", otherText);
map.put(key2, anCheckbox);
}
compCheckboxMaps.put(key, map);
}
quMaps.put("compCheckboxMaps", compCheckboxMaps);
Map<String, Object> enumMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.ENUMQU.getIndex() + "_");// 枚举
quMaps.put("enumMaps", enumMaps);
Map<String, Object> scoreMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.SCORE.getIndex() + "_");// 分数
for (String key : scoreMaps.keySet()) {
String tag = scoreMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, tag);
scoreMaps.put(key, map);
}
quMaps.put("scoreMaps", scoreMaps);
Map<String, Object> quOrderMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.ORDERQU.getIndex() + "_");// 排序
for (String key : quOrderMaps.keySet()) {
String tag = quOrderMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, tag);
quOrderMaps.put(key, map);
}
quMaps.put("quOrderMaps", quOrderMaps);
Map<String, Object> chenRadioMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.CHENRADIO.getIndex() + "_");
for (String key : chenRadioMaps.keySet()) {
String tag = chenRadioMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, tag);
chenRadioMaps.put(key, map);
}
quMaps.put("chenRadioMaps", chenRadioMaps);
Map<String, Object> chenCheckboxMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.CHENCHECKBOX.getIndex() + "_");
for (String key : chenCheckboxMaps.keySet()) {
String tag = chenCheckboxMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, tag);
for (String keyRow : map.keySet()) {
String tagRow = map.get(keyRow).toString();
Map<String, Object> mapRow = WebUtils.getParametersStartingWith(request, tagRow);
map.put(keyRow, mapRow);
}
chenCheckboxMaps.put(key, map);
}
quMaps.put("chenCheckboxMaps", chenCheckboxMaps);
Map<String, Object> chenScoreMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.CHENSCORE.getIndex() + "_");
for (String key : chenScoreMaps.keySet()) {
String tag = chenScoreMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, tag);
for (String keyRow : map.keySet()) {
String tagRow = map.get(keyRow).toString();
Map<String, Object> mapRow = WebUtils.getParametersStartingWith(request, tagRow);
map.put(keyRow, mapRow);
}
chenScoreMaps.put(key, map);
}
quMaps.put("chenScoreMaps", chenScoreMaps);
Map<String, Object> chenFbkMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.CHENFBK.getIndex() + "_");
for (String key : chenFbkMaps.keySet()) {
String tag = chenFbkMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, tag);
for (String keyRow : map.keySet()) {
String tagRow = map.get(keyRow).toString();
Map<String, Object> mapRow = WebUtils.getParametersStartingWith(request, tagRow);
map.put(keyRow, mapRow);
}
chenFbkMaps.put(key, map);
}
quMaps.put("chenFbkMaps", chenFbkMaps);
for (String key : radioMaps.keySet()) {
String enId = key;
String quItemId = radioMaps.get(key).toString();
String otherText = params.get("text_qu_" + QuType.RADIO.getIndex() + "_" + enId + "_" + quItemId).toString();
Map<String, Object> anRadio = new HashMap<>();
anRadio.put("quId", enId);
anRadio.put("quItemId", quItemId);
anRadio.put("otherText", otherText);
radioMaps.put(key, anRadio);
}
quMaps.put("compRadioMaps", radioMaps);
for (String key : checkboxMaps.keySet()) {
String dfillValue = checkboxMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, dfillValue);
for (String key2 : map.keySet()) {
String quItemId = map.get(key2).toString();
String otherText = params.get("text_" + dfillValue + quItemId).toString();
Map<String, Object> anCheckbox = new HashMap<>();
anCheckbox.put("quItemId", quItemId);
anCheckbox.put("otherText", otherText);
map.put(key2, anCheckbox);
}
checkboxMaps.put(key, map);
}
quMaps.put("compCheckboxMaps", checkboxMaps);
Map<String, Object> chenCompChenRadioMaps = WebUtils.getParametersStartingWith(request, "qu_" + QuType.COMPCHENRADIO.getIndex() + "_");
for (String key : chenCompChenRadioMaps.keySet()) {
String tag = chenCompChenRadioMaps.get(key).toString();
Map<String, Object> map = WebUtils.getParametersStartingWith(request, tag);
for (String keyRow : map.keySet()) {
String tagRow = map.get(keyRow).toString();
Map<String, Object> mapRow = WebUtils.getParametersStartingWith(request, tagRow);
map.put(keyRow, mapRow);
}
chenCompChenRadioMaps.put(key, map);
}
quMaps.put("compChenRadioMaps", chenCompChenRadioMaps);
return quMaps;
}
/**
* @throws Exception
*
* @Title: saveAnswer
* @Description: 保存答案
* @param @param surveyAnswer
* @param @param quMaps 参数
* @return void 返回类型
* @throws
*/
public void saveAnswer(Map<String, Object> surveyAnswer, Map<String, Map<String, Object>> quMaps) throws Exception{
Map<String, Object> surveyMation = dwSurveyDirectoryDao.querySurveyMationById(surveyAnswer);//获取问卷信息
surveyMation.put("answerNum", Integer.parseInt(surveyMation.get("answerNum").toString()) + 1);
dwSurveyDirectoryDao.editSurveyAnswerNumById(surveyMation);//修改回答数量
if("1".equals(surveyMation.get("ynEndNum").toString())){//是否依据收到的份数结束
if(Integer.parseInt(surveyMation.get("answerNum").toString()) + 1 >= Integer.parseInt(surveyMation.get("endNum").toString())){
surveyMation.put("realEndTime", ToolUtil.getTimeAndToString());
dwSurveyDirectoryDao.editSurveyStateToEndNumById(surveyMation);//结束调查
}
}
//问卷答案
surveyAnswer.put("bgAnDate", surveyAnswer.get("bgAnDate"));
surveyAnswer.put("endAnDate", ToolUtil.getTimeAndToString());
surveyAnswer.put("totalTime", ToolUtil.getDistanceDays(surveyAnswer.get("bgAnDate").toString(), surveyAnswer.get("endAnDate").toString()));//分钟
surveyAnswer.put("answerId", ToolUtil.getSurFaceId());
int anCount = 0;//回答的题目数,包含多个答案的数量
// 保存答案
// 是非题
Map<String, Object> yesnoMaps = quMaps.get("yesnoMaps");
anCount += saveAnYesnoMaps(surveyAnswer, yesnoMaps);
// 单选题
Map<String, Object> radioMaps = quMaps.get("radioMaps");
anCount += saveAnRadioMaps(surveyAnswer, radioMaps);
// 多选题
Map<String, Object> checkboxMaps = quMaps.get("checkboxMaps");
anCount += saveAnCheckboxMaps(surveyAnswer, checkboxMaps);
// 填空题
Map<String, Object> fillblankMaps = quMaps.get("fillblankMaps");
anCount += saveAnFillMaps(surveyAnswer, fillblankMaps);
// 多项填空题
Map<String, Object> multifillblankMaps = quMaps.get("multifillblankMaps");
anCount += saveAnMultiFillMaps(surveyAnswer, multifillblankMaps);
// 问答题
Map<String, Object> answerMaps = quMaps.get("answerMaps");
anCount += saveAnAnswerMaps(surveyAnswer, answerMaps);
// 复合单选题
Map<String, Object> compRadioMaps = quMaps.get("compRadioMaps");
anCount += saveCompAnRadioMaps(surveyAnswer, compRadioMaps);
// 复合多选题
Map<String, Object> compCheckboxMaps = quMaps.get("compCheckboxMaps");
anCount += saveCompAnCheckboxMaps(surveyAnswer, compCheckboxMaps);
// 枚举题
Map<String, Object> enumMaps = quMaps.get("enumMaps");
anCount += saveEnumMaps(surveyAnswer, enumMaps);
// 评分题
Map<String, Object> scoreMaps = quMaps.get("scoreMaps");
anCount += saveScoreMaps(surveyAnswer, scoreMaps);
// 排序题 quOrderMaps
Map<String, Object> quOrderMaps = quMaps.get("quOrderMaps");
anCount += saveQuOrderMaps(surveyAnswer, quOrderMaps);
// 矩阵单选题
Map<String, Object> chehRadioMaps = quMaps.get("chenRadioMaps");
anCount += saveChenRadioMaps(surveyAnswer, chehRadioMaps);
// 矩阵多选题
Map<String, Object> chehCheckboxMaps = quMaps.get("chenCheckboxMaps");
anCount += saveChenCheckboxMaps(surveyAnswer, chehCheckboxMaps);
// 矩阵填空题
Map<String, Object> chenFbkMaps = quMaps.get("chenFbkMaps");
anCount += saveChenFbkMaps(surveyAnswer, chenFbkMaps);
// 复合矩阵单选题
Map<String, Object> compChehRadioMaps = quMaps.get("compChenRadioMaps");
anCount += saveCompChehRadioMaps(surveyAnswer, compChehRadioMaps);
// 矩阵填空题
Map<String, Object> chenScoreMaps = quMaps.get("chenScoreMaps");
anCount += saveChenScoreMaps(surveyAnswer, chenScoreMaps);
surveyAnswer.put("completeItemNum", anCount);
int isComplete = 0;
if(anCount >= Integer.parseInt(surveyMation.get("anItemLeastNum").toString())){
isComplete = 1;
}
surveyAnswer.put("isComplete", isComplete);
int isEffective = 0;
if(anCount >= 0){//只要回答一题即为有效
isEffective = 1;
}
surveyAnswer.put("isEffective", isEffective);
surveyAnswer.put("completeNum", surveyMation.get("surveyQuNum"));
surveyAnswer.put("quNum", surveyMation.get("surveyQuNum"));
dwSurveyDirectoryDao.insertSurveyAnswer(surveyAnswer);
}
/**
* 保存是非题答案
* @param exambatchUser
* @param yesnoMaps
* @param session
* @throws Exception
*/
public int saveAnYesnoMaps(Map<String, Object> surveyAnswer,Map<String,Object> yesnoMaps) throws Exception{
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if (yesnoMaps != null)
for (String key : yesnoMaps.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("yesnoAnswer", yesnoMaps.get(key).toString());
beans.add(bean);
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveAnYesnoMaps(beans);
return answerQuCount;
}
/**
* 保存单选题答案
* @param exambatchUser
* @param radioMaps
* @param session
* @throws Exception
*/
private int saveAnRadioMaps(Map<String, Object> surveyAnswer,Map<String,Object> radioMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if (radioMaps != null)
for (String key : radioMaps.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("quItemId", radioMaps.get(key).toString());
beans.add(bean);
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveAnRadioMaps(beans);
return answerQuCount;
}
/**
* 保存多项填空题答案
* @param exambatchUser
* @param dfillMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveAnMultiFillMaps(Map<String, Object> surveyAnswer,Map<String,Object> dfillMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if (dfillMaps != null)
for (String key : dfillMaps.keySet()) {
Map<String, Object> map= (Map<String, Object>) dfillMaps.get(key);
if(map != null && map.size() > 0){
for (String keyMap : map.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("quItemId", keyMap);
bean.put("answerValue", map.get(key).toString());
beans.add(bean);
}
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveAnMultiFillMaps(beans);
return answerQuCount;
}
/**
* 保存评分题
* @param surveyAnswer
* @param scoreMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveScoreMaps(Map<String, Object> surveyAnswer,Map<String,Object> scoreMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if (scoreMaps != null)
for (String key : scoreMaps.keySet()) {
Map<String,Object> mapRows = (Map<String, Object>) scoreMaps.get(key);
for (String keyRow : mapRows.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("rowId", keyRow);
bean.put("scoreValue", mapRows.get(keyRow).toString());
beans.add(bean);
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveScoreMaps(beans);
return answerQuCount;
}
/**
* 保存矩阵多选题
* @param surveyAnswer
* @param scoreMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveChenCheckboxMaps(Map<String, Object> surveyAnswer,Map<String,Object> chenCheckboxMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(chenCheckboxMaps != null)
for (String key : chenCheckboxMaps.keySet()) {
Map<String,Object> mapRows = (Map<String, Object>) chenCheckboxMaps.get(key);
for (String keyRow : mapRows.keySet()) {
Map<String, Object> mapRow=(Map<String, Object>) mapRows.get(keyRow);
for (String keyCol : mapRow.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("rowId", keyRow);
bean.put("colId", keyCol);
beans.add(bean);
}
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveChenCheckboxMaps(beans);
return answerQuCount;
}
/**
* 复合单选题
* @param surveyAnswer
* @param compRadioMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveCompAnRadioMaps(Map<String, Object> surveyAnswer,Map<String,Object> compRadioMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(compRadioMaps != null)
for (String key : compRadioMaps.keySet()) {
answerQuCount++;
Map<String, Object> tempAnRadio = (Map<String, Object>) compRadioMaps.get(key);
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("quItemId", tempAnRadio.get("quItemId"));
bean.put("otherText", tempAnRadio.get("otherText"));
beans.add(bean);
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveCompAnRadioMaps(beans);
return answerQuCount;
}
/**
* 复合矩阵单选题
* @param surveyAnswer
* @param compRadioMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveCompChehRadioMaps(Map<String, Object> surveyAnswer,Map<String,Object> compChenRadioMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(compChenRadioMaps != null)
for (String key : compChenRadioMaps.keySet()) {
Map<String,Object> mapRows = (Map<String, Object>) compChenRadioMaps.get(key);
for (String keyRow : mapRows.keySet()) {
Map<String, Object> mapRow = (Map<String, Object>) mapRows.get(keyRow);
for (String keyCol : mapRow.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("rowId", keyRow);
bean.put("colId", keyCol);
bean.put("optionId", mapRow.get(keyCol).toString());
beans.add(bean);
}
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveCompChehRadioMaps(beans);
return answerQuCount;
}
/**
* 矩陈评分题
* @param surveyAnswer
* @param chenScoreMaps
* @param session
* @throws Exception
* @return
*/
@SuppressWarnings("unchecked")
private int saveChenScoreMaps(Map<String, Object> surveyAnswer,Map<String,Object> chenScoreMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(chenScoreMaps != null)
for (String key : chenScoreMaps.keySet()) {
Map<String,Object> mapRows = (Map<String, Object>) chenScoreMaps.get(key);
for (String keyRow : mapRows.keySet()) {
Map<String, Object> mapRow = (Map<String, Object>) mapRows.get(keyRow);
for (String keyCol : mapRow.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("rowId", keyRow);
bean.put("colId", keyCol);
bean.put("answerValue", mapRow.get(keyCol).toString());
beans.add(bean);
}
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveChenScoreMaps(beans);
return answerQuCount;
}
/**
* 保存多选题答案
* @param exambatchUser
* @param checkboxMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveAnCheckboxMaps(Map<String, Object> surveyAnswer,Map<String,Object> checkboxMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(checkboxMaps != null)
for (String key : checkboxMaps.keySet()) {
Map<String, Object> map = (Map<String, Object>) checkboxMaps.get(key);
for (String keyMap : map.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("quItemId", map.get(keyMap).toString());
beans.add(bean);
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveAnCheckboxMaps(beans);
return answerQuCount;
}
/**
* 保存单项填空题答案
* @param exambatchUser
* @param fillMaps
* @param session
* @throws Exception
*/
private int saveAnFillMaps(Map<String, Object> surveyAnswer,Map<String,Object> fillMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(fillMaps != null)
for (String key : fillMaps.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("answerValue", fillMaps.get(key).toString());
beans.add(bean);
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveAnFillMaps(beans);
return answerQuCount;
}
/**
* 保存判断题答案
* @param exambatchUser
* @param anAnswerMaps
* @param session
* @throws Exception
*/
private int saveAnAnswerMaps(Map<String, Object> surveyAnswer,Map<String,Object> anAnswerMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(anAnswerMaps != null)
for (String key : anAnswerMaps.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("answerValue", anAnswerMaps.get(key).toString());
beans.add(bean);
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveAnAnswerMaps(beans);
return answerQuCount;
}
/**
* 保存复合多选题答案
* @param exambatchUser
* @param checkboxMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveCompAnCheckboxMaps(Map<String, Object> surveyAnswer,Map<String,Object> compCheckboxMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(compCheckboxMaps != null)
for (String key : compCheckboxMaps.keySet()) {
Map<String, Object> map = (Map<String, Object>) compCheckboxMaps.get(key);
for (String keyMap : map.keySet()) {
answerQuCount++;
Map<String, Object> tempAnCheckbox = (Map<String, Object>) map.get(keyMap);
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("quItemId", tempAnCheckbox.get("quItemId"));
bean.put("otherText", tempAnCheckbox.get("otherText"));
beans.add(bean);
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveCompAnCheckboxMaps(beans);
return answerQuCount;
}
/**
* 保存枚举题
* @param surveyAnswer
* @param enumMaps
* @param session
* @throws Exception
*/
private int saveEnumMaps(Map<String, Object> surveyAnswer,Map<String,Object> enumMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(enumMaps != null)
for (String key : enumMaps.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("quItemNum", Integer.parseInt(key.split("_")[1]));
bean.put("answerValue", enumMaps.get(key).toString());
beans.add(bean);
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveEnumMaps(beans);
return answerQuCount;
}
/**
* 保存排序题
* @param surveyAnswer
* @param enumMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveQuOrderMaps(Map<String, Object> surveyAnswer,Map<String,Object> quOrderMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(quOrderMaps != null)
for (String key : quOrderMaps.keySet()) {
Map<String,Object> mapRows = (Map<String, Object>) quOrderMaps.get(key);
for (String keyRow : mapRows.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("rowId", keyRow);
bean.put("orderNumValue", mapRows.get(keyRow).toString());
beans.add(bean);
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveQuOrderMaps(beans);
return answerQuCount;
}
/**
* 保存矩阵单选题
* @param surveyAnswer
* @param chehRadioMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveChenRadioMaps(Map<String, Object> surveyAnswer,Map<String,Object> chenRadioMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(chenRadioMaps != null)
for (String key : chenRadioMaps.keySet()) {
Map<String,Object> mapRows = (Map<String, Object>) chenRadioMaps.get(key);
for (String keyRow : mapRows.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("rowId", keyRow);
bean.put("colId", mapRows.get(keyRow).toString());
beans.add(bean);
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveChenRadioMaps(beans);
return answerQuCount;
}
/**
* 保存矩阵填空题
* @param surveyAnswer
* @param chehRadioMaps
* @param session
* @throws Exception
*/
@SuppressWarnings("unchecked")
private int saveChenFbkMaps(Map<String, Object> surveyAnswer,Map<String,Object> chenFbkMaps) throws Exception {
String surveyId = surveyAnswer.get("id").toString();
String surveyAnswerId = surveyAnswer.get("answerId").toString();
int answerQuCount = 0;
List<Map<String, Object>> beans = new ArrayList<>();
if(chenFbkMaps != null)
for (String key : chenFbkMaps.keySet()) {
Map<String,Object> mapRows = (Map<String, Object>) chenFbkMaps.get(key);
for (String keyRow : mapRows.keySet()) {
Map<String, Object> mapRow=(Map<String, Object>) mapRows.get(keyRow);
for (String keyCol : mapRow.keySet()) {
answerQuCount++;
Map<String, Object> bean = new HashMap<>();
bean.put("id", ToolUtil.getSurFaceId());
bean.put("surveyId", surveyId);
bean.put("surveyAnswerId", surveyAnswerId);
bean.put("quId", key);
bean.put("rowId", keyRow);
bean.put("colId", keyCol);
bean.put("answerValue", mapRow.get(keyCol).toString());
beans.add(bean);
}
}
}
if(!beans.isEmpty())
dwSurveyDirectoryDao.saveChenFbkMaps(beans);
return answerQuCount;
}
} }
package com.skyeye.quartz.config; package com.skyeye.quartz.config;
import java.util.HashMap;
import java.util.Map;
import org.quartz.DisallowConcurrentExecution; import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobDataMap; import org.quartz.JobDataMap;
...@@ -8,6 +11,8 @@ import org.quartz.SchedulerException; ...@@ -8,6 +11,8 @@ import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.eve.dao.DwSurveyDirectoryDao;
import com.skyeye.eve.dao.SysQuartzDao; import com.skyeye.eve.dao.SysQuartzDao;
import com.skyeye.quartz.entity.SysQuartz; import com.skyeye.quartz.entity.SysQuartz;
...@@ -22,6 +27,9 @@ public class QuartzJobFactory implements Job{ ...@@ -22,6 +27,9 @@ public class QuartzJobFactory implements Job{
@Autowired @Autowired
private SysQuartzDao sysQuartzDao; private SysQuartzDao sysQuartzDao;
@Autowired
private DwSurveyDirectoryDao dwSurveyDirectoryDao;
/** /**
* 任务监听 * 任务监听
*/ */
...@@ -49,9 +57,9 @@ public class QuartzJobFactory implements Job{ ...@@ -49,9 +57,9 @@ public class QuartzJobFactory implements Job{
* @throws * @throws
*/ */
private void handleJob(SysQuartz sysQuartz) throws SchedulerException { private void handleJob(SysQuartz sysQuartz) throws SchedulerException {
if("test".equals(sysQuartz.getGroups())){//根据分组进行任务调度 if("endSurveyMation".equals(sysQuartz.getGroups())){//文件调查
try { try {
test(sysQuartz); endSurveyMation(sysQuartz);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -59,13 +67,18 @@ public class QuartzJobFactory implements Job{ ...@@ -59,13 +67,18 @@ public class QuartzJobFactory implements Job{
} }
/** /**
* 测试 * 问卷调查
* @param sysQuartz * @param sysQuartz
* @throws Exception * @throws Exception
*/ */
private void test(SysQuartz sysQuartz) throws Exception{ private void endSurveyMation(SysQuartz sysQuartz) throws Exception{
System.out.println(sysQuartz.getName()); Map<String, Object> map = new HashMap<>();
System.out.println("我是任务,执行完成拉"); map.put("id", sysQuartz.getName());
Map<String, Object> surveyMation = dwSurveyDirectoryDao.querySurveyMationById(map);//获取问卷信息
if("1".equals(surveyMation.get("surveyState").toString())){//执行中
map.put("realEndTime", ToolUtil.getTimeAndToString());
dwSurveyDirectoryDao.editSurveyStateToEndNumZdById(map);
}
quartzService.delete(sysQuartz); quartzService.delete(sysQuartz);
sysQuartzDao.deleteByPrimaryKey(sysQuartz.getId()); sysQuartzDao.deleteByPrimaryKey(sysQuartz.getId());
} }
......
...@@ -176,7 +176,8 @@ ...@@ -176,7 +176,8 @@
a.option_title optionTitle, a.option_title optionTitle,
a.order_by_id orderById, a.order_by_id orderById,
a.qu_id quId, a.qu_id quId,
a.visibility a.visibility,
#{quType} quType
FROM FROM
dw_qu_checkbox a dw_qu_checkbox a
WHERE WHERE
...@@ -208,7 +209,8 @@ ...@@ -208,7 +209,8 @@
a.option_title optionTitle, a.option_title optionTitle,
a.order_by_id orderById, a.order_by_id orderById,
a.visibility, a.visibility,
#{paramInt02} paramInt02 #{paramInt02} paramInt02,
#{quType} quType
FROM FROM
dw_qu_score a dw_qu_score a
WHERE WHERE
...@@ -281,6 +283,7 @@ ...@@ -281,6 +283,7 @@
a.survey_name surveyName, a.survey_name surveyName,
a.survey_note surveyNote, a.survey_note surveyNote,
a.survey_qu_num surveyQuNum, a.survey_qu_num surveyQuNum,
a.survey_state surveyState,
a.an_item_least_num anItemLeastNum, a.an_item_least_num anItemLeastNum,
a.an_item_most_num anItemMostNum, a.an_item_most_num anItemMostNum,
a.effective, a.effective,
...@@ -874,6 +877,8 @@ ...@@ -874,6 +877,8 @@
<set> <set>
survey_state = '1', survey_state = '1',
real_start_time = #{startTime}, real_start_time = #{startTime},
survey_qu_num = #{questionNum},
an_item_least_num = #{questionNum},
</set> </set>
WHERE id = #{id} WHERE id = #{id}
</update> </update>
...@@ -976,7 +981,8 @@ ...@@ -976,7 +981,8 @@
SELECT SELECT
qu_row_id quRowId, qu_row_id quRowId,
qu_col_id quColId, qu_col_id quColId,
count(qu_col_id) count count(qu_col_id) count,
#{quType} quType
FROM FROM
dw_an_chen_radio dw_an_chen_radio
WHERE WHERE
...@@ -991,7 +997,8 @@ ...@@ -991,7 +997,8 @@
SELECT SELECT
qu_row_id quRowId, qu_row_id quRowId,
qu_col_id quColId, qu_col_id quColId,
count(qu_col_id) count count(qu_col_id) count,
#{quType} quType
FROM FROM
dw_an_chen_fbk dw_an_chen_fbk
WHERE WHERE
...@@ -1006,7 +1013,8 @@ ...@@ -1006,7 +1013,8 @@
SELECT SELECT
qu_row_id quRowId, qu_row_id quRowId,
qu_col_id quColId, qu_col_id quColId,
count(qu_col_id) count count(qu_col_id) count,
#{quType} quType
FROM FROM
dw_an_chen_checkbox dw_an_chen_checkbox
WHERE WHERE
...@@ -1021,7 +1029,8 @@ ...@@ -1021,7 +1029,8 @@
SELECT SELECT
qu_row_id quRowId, qu_row_id quRowId,
qu_col_id quColId, qu_col_id quColId,
AVG(answser_score) avgScore AVG(answser_score) avgScore,
#{quType} quType
FROM FROM
dw_an_chen_score dw_an_chen_score
WHERE WHERE
...@@ -1332,4 +1341,204 @@ ...@@ -1332,4 +1341,204 @@
</foreach> </foreach>
</insert> </insert>
<update id="editSurveyAnswerNumById" parameterType="java.util.Map">
UPDATE dw_survey_directory
<set>
answer_num = #{answerNum},
</set>
WHERE id = #{id}
</update>
<insert id="saveAnYesnoMaps" parameterType="java.util.Map">
insert into dw_an_yesno
(id, belong_answer_id, belong_id, qu_id, visibility, yesno_answer)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.quId}, '1', #{item.yesnoAnswer})
</foreach>
</insert>
<insert id="saveAnRadioMaps" parameterType="java.util.Map">
insert into dw_an_radio
(id, belong_answer_id, belong_id, other_text, qu_id, visibility, qu_item_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.otherText}, #{item.quId}, '1', #{item.quItemId})
</foreach>
</insert>
<insert id="saveAnMultiFillMaps" parameterType="java.util.Map">
insert into dw_an_dfillblank
(id, answer, belong_answer_id, belong_id, qu_id, visibility, qu_item_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.answerValue}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.quId}, '1', #{item.quItemId})
</foreach>
</insert>
<insert id="saveScoreMaps" parameterType="java.util.Map">
insert into dw_an_score
(id, answser_score, belong_answer_id, belong_id, qu_id, visibility, qu_row_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.scoreValue}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.quId}, '1', #{item.rowId})
</foreach>
</insert>
<insert id="saveChenCheckboxMaps" parameterType="java.util.Map">
insert into dw_an_chen_checkbox
(id, belong_answer_id, belong_id, qu_id, visibility, qu_row_id, qu_col_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.quId}, '1', #{item.rowId}, #{item.colId})
</foreach>
</insert>
<insert id="saveCompAnRadioMaps" parameterType="java.util.Map">
insert into dw_an_radio
(id, belong_answer_id, belong_id, other_text, qu_id, visibility, qu_item_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.otherText}, #{item.quId}, '1', #{item.quItemId})
</foreach>
</insert>
<insert id="saveCompChehRadioMaps" parameterType="java.util.Map">
insert into dw_an_comp_chen_radio
(id, belong_answer_id, belong_id, qu_col_id, qu_id, visibility, qu_option_id, qu_row_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.colId}, #{item.quId}, '1', #{item.optionId}, #{item.rowId})
</foreach>
</insert>
<insert id="saveChenScoreMaps" parameterType="java.util.Map">
insert into dw_an_chen_score
(id, belong_answer_id, belong_id, qu_col_id, qu_id, visibility, answser_score, qu_row_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.colId}, #{item.quId}, '1', #{item.answerValue}, #{item.rowId})
</foreach>
</insert>
<insert id="saveAnCheckboxMaps" parameterType="java.util.Map">
insert into dw_an_checkbox
(id, belong_answer_id, belong_id, other_text, qu_id, visibility, qu_item_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.otherText}, #{item.quId}, '1', #{item.quItemId})
</foreach>
</insert>
<insert id="saveAnFillMaps" parameterType="java.util.Map">
insert into dw_an_fillblank
(id, belong_answer_id, belong_id, answer, qu_id, visibility)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.answerValue}, #{item.quId}, '1')
</foreach>
</insert>
<insert id="saveAnAnswerMaps" parameterType="java.util.Map">
insert into dw_an_answer
(id, belong_answer_id, belong_id, answer, qu_id, visibility)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.answerValue}, #{item.quId}, '1')
</foreach>
</insert>
<insert id="saveCompAnCheckboxMaps" parameterType="java.util.Map">
insert into dw_an_checkbox
(id, belong_answer_id, belong_id, other_text, qu_id, visibility, qu_item_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.otherText}, #{item.quId}, '1', #{item.quItemId})
</foreach>
</insert>
<insert id="saveEnumMaps" parameterType="java.util.Map">
insert into dw_an_enumqu
(id, belong_answer_id, belong_id, answer, qu_id, visibility, enum_item)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.answerValue}, #{item.quId}, '1', #{item.quItemNum})
</foreach>
</insert>
<insert id="saveQuOrderMaps" parameterType="java.util.Map">
insert into dw_an_order
(id, belong_answer_id, belong_id, ordery_num, qu_id, visibility, qu_row_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.orderNumValue}, #{item.quId}, '1', #{item.rowId})
</foreach>
</insert>
<insert id="saveChenRadioMaps" parameterType="java.util.Map">
insert into dw_an_chen_radio
(id, belong_answer_id, belong_id, qu_col_id, qu_id, visibility, qu_row_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.colId}, #{item.quId}, '1', #{item.rowId})
</foreach>
</insert>
<insert id="saveChenFbkMaps" parameterType="java.util.Map">
insert into dw_an_chen_fbk
(id, answer_value, belong_answer_id, belong_id, qu_col_id, qu_id, visibility, qu_row_id)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id}, #{item.answerValue}, #{item.surveyAnswerId}, #{item.surveyId}, #{item.colId}, #{item.quId}, '1', #{item.rowId})
</foreach>
</insert>
<insert id="insertSurveyAnswer" parameterType="java.util.Map">
INSERT into dw_survey_answer
(id, survey_id, bg_an_date, end_an_date, complete_num, complete_item_num, data_source, handle_state, ip_addr, addr, city, is_complete, is_effective,
qu_num, total_time, create_id)
VALUES
(#{answerId}, #{id}, #{bgAnDate}, #{endAnDate}, #{completeNum}, #{completeItemNum}, '0', '1', #{ipAddr}, #{addr}, #{city}, #{isComplete}, #{isEffective},
#{quNum}, #{totalTime}, #{createId})
</insert>
<select id="querySurveyAnswerMationByIp" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id
FROM
dw_survey_answer a
WHERE a.ip_addr = #{ip}
AND a.survey_id = #{id}
</select>
<select id="querySurveyAnswerMationOverFiveMinByIp" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id
FROM
dw_survey_answer a
WHERE a.ip_addr = #{ip}
AND a.survey_id = #{id}
AND a.end_an_date >= DATE_SUB(NOW(), INTERVAL 5 MINUTE)
</select>
<update id="editSurveyStateToEndNumById" parameterType="java.util.Map">
UPDATE dw_survey_directory
<set>
real_end_time = #{realEndTime},
survey_state = '2',
end_type = '3',
</set>
WHERE id = #{id}
</update>
<update id="editSurveyStateToEndNumZdById" parameterType="java.util.Map">
UPDATE dw_survey_directory
<set>
real_end_time = #{realEndTime},
survey_state = '2',
end_type = '2',
</set>
WHERE id = #{id}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
<url id="dwsurveydirectory023" path="/post/DwSurveyDirectoryController/editSurveyStateToReleaseById" val="问卷发布" allUse="1"> <url id="dwsurveydirectory023" path="/post/DwSurveyDirectoryController/editSurveyStateToReleaseById" val="问卷发布" allUse="1">
<property id="rowId" name="id" ref="required" var="问卷id"/> <property id="rowId" name="id" ref="required" var="问卷id"/>
</url> </url>
<url id="dwsurveydirectory024" path="/post/DwSurveyDirectoryController/queryDwSurveyDirectoryMationByIdToHTML" val="获取调查问卷题目信息用来生成html页面" allUse="1"> <url id="dwsurveydirectory024" path="/post/DwSurveyDirectoryController/queryDwSurveyDirectoryMationByIdToHTML" val="获取调查问卷题目信息用来生成html页面" allUse="0">
<property id="rowId" name="id" ref="required" var="问卷id"/> <property id="rowId" name="id" ref="required" var="问卷id"/>
</url> </url>
<url id="dwsurveydirectory025" path="/post/DwSurveyDirectoryController/deleteSurveyMationById" val="删除问卷" allUse="1"> <url id="dwsurveydirectory025" path="/post/DwSurveyDirectoryController/deleteSurveyMationById" val="删除问卷" allUse="1">
...@@ -200,6 +200,15 @@ ...@@ -200,6 +200,15 @@
<property id="rowId" name="surveyCopyId" ref="required" var="问卷id"/> <property id="rowId" name="surveyCopyId" ref="required" var="问卷id"/>
<property id="surveyName" name="surveyName" ref="required" var="问卷名称"/> <property id="surveyName" name="surveyName" ref="required" var="问卷名称"/>
</url> </url>
<url id="dwsurveydirectory028" path="/post/DwSurveyDirectoryController/queryAnswerSurveyMationByIp" val="判断该ip的用户是否回答过此问卷" allUse="0">
<property id="surveyId" name="id" ref="required" var="问卷id"/>
<property id="ip" name="ip" ref="required,ip" var="ip"/>
</url>
<url id="dwsurveydirectory029" path="/post/DwSurveyDirectoryController/insertAnswerSurveyMationByIp" val="用户回答问卷" allUse="0">
<property id="jsonData" name="jsonData" ref="required" var="问卷回答json串"/>
<property id="ip" name="ip" ref="required,ip" var="ip"/>
<property id="bgAnDate" name="bgAnDate" ref="required" var="答卷开始时间"/>
</url>
<!-- 问卷调查结束 --> <!-- 问卷调查结束 -->
</controller> </controller>
\ No newline at end of file
...@@ -34,5 +34,5 @@ listToTree(); 将JSONArray数组转为树状结 ...@@ -34,5 +34,5 @@ listToTree(); 将JSONArray数组转为树状结
javaBean2Map(); 实体类转map javaBean2Map(); 实体类转map
randomStr(); 获取指定的随机值 randomStr(); 获取指定的随机值
removeTagFromText(); 过滤html内容 removeTagFromText(); 过滤html内容
getDistanceDays(); 两个时间之间相差距离多少分
...@@ -81,6 +81,77 @@ function _openNewWindows(mation){ ...@@ -81,6 +81,77 @@ function _openNewWindows(mation){
}}); }});
} }
function _openNewWindowsNoRel(mation){
var index = layer.load(1);
if(isNull(mation.url)){
top.winui.window.msg("页面路径不能为空", {icon: 2,time: 2000});
return;
}
if(isNull(mation.pageId)){
top.winui.window.msg("缺少页面ID", {icon: 2,time: 2000});
return;
}
if(isNull(mation.title)){
mation.title = "窗口";
}
if(!isNull(mation.params)){
var s = "";
for(var param in mation.params)
s += "&" + param + "=" + mation.params[param];
mation.url = mation.url + "?" + s.slice(1);
}
if(isNull(mation.area)){
mation.area = [window.screen.width / 3 * 2 + 'px', (layui.$(window.parent.window).height() - 200) + 'px'];
}
if(isNull(mation.offset)){
mation.offset = 'auto';
}
if(isNull(mation.maxmin)){//是否最大化
mation.maxmin = false;
}
if(isNull(mation.shade)){//遮罩层
mation.shade = 0.5;
}
if(isNull(mation.closeBtn) && mation.closeBtn != '0'){//关闭按钮
mation.closeBtn = 1;
}
var index = layer.load(1);
refreshCode = "";
layui.$.ajax({
type: 'get',
url: mation.url,
async: true,
success: function (data) {
layer.close(index);
var pageIndex = layer.open({
id: mation.pageId,
type: 2,
title: mation.title,
content: mation.url,
area: mation.area,
offset: mation.offset,
maxmin: mation.maxmin,
shade: mation.shade,
zIndex: 20000000000,
scrollbar: false,
closeBtn: mation.closeBtn,
end: function(){
if(typeof(mation.callBack) == "function") {
mation.callBack(refreshCode);
}
}
});
if(mation.maxmin){
layer.full(pageIndex);
}
},
error: function (xml) {
layer.close(index);
top.winui.window.msg("获取页面失败", {icon: 2,time: 2000});
}
});
}
/** /**
* 非表格分页加载插件 * 非表格分页加载插件
*/ */
......
...@@ -1080,4 +1080,19 @@ function date(format, timestamp){ ...@@ -1080,4 +1080,19 @@ function date(format, timestamp){
}); });
} }
/**
* 获取当前时间
* @returns {String}
*/
function getFormatDate(){
var nowDate = new Date();
var year = nowDate.getFullYear();
var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) : nowDate.getMonth() + 1;
var date = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
var hour = nowDate.getHours()< 10 ? "0" + nowDate.getHours() : nowDate.getHours();
var minute = nowDate.getMinutes()< 10 ? "0" + nowDate.getMinutes() : nowDate.getMinutes();
var second = nowDate.getSeconds()< 10 ? "0" + nowDate.getSeconds() : nowDate.getSeconds();
return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
}
...@@ -6109,6 +6109,15 @@ select option{ ...@@ -6109,6 +6109,15 @@ select option{
box-shadow: none! important; box-shadow: none! important;
} }
.messageSpan{
margin: 0 auto;
width: 100%;
text-align: center;
display: block;
margin-top: 200px;
font-size: 25px;
font-family: serif;
}
/*******************************************自定义样式end********************************************/ /*******************************************自定义样式end********************************************/
......
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$,
form = layui.form;
form.render();
form.on('submit(formAddBean)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
if($("#surveyName").val() == parent.ruleCode){
parent.layer.close(index);
parent.refreshCode = '0';
} else{
layer.msg("密码输入错误。", {icon: 2,time: 2000});
}
}
return false;
});
//取消
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
...@@ -47,14 +47,6 @@ layui.config({ ...@@ -47,14 +47,6 @@ layui.config({
} }
}); });
hdb.registerHelper('compare8', function(v1, v2, v31, v4, options) {
if(v1 == v3 && v2 == v4){
return options.fn(this);
}else{
return options.inverse(this);
}
});
}, },
ajaxSendAfter:function(json){ ajaxSendAfter:function(json){
...@@ -98,8 +90,10 @@ layui.config({ ...@@ -98,8 +90,10 @@ layui.config({
} }
return false; return false;
}); });
$(".columnchart_pic").click(); setTimeout(function(){
resetQuNum(); $(".columnchart_pic").click();
}, 2000);
resetQuNum();
} }
}); });
...@@ -171,7 +165,7 @@ layui.config({ ...@@ -171,7 +165,7 @@ layui.config({
anCount = 0; anCount = 0;
} }
categories.push(quOptionName); categories.push(quOptionName);
if(quType === "SCORE") { if(quType === "8") {
var avgScore = $(this).find("input[name='quItemAvgScore']").val(); var avgScore = $(this).find("input[name='quItemAvgScore']").val();
//平均分 setAvgScore //平均分 setAvgScore
avgScore = parseFloat(avgScore).toFixed(2); avgScore = parseFloat(avgScore).toFixed(2);
...@@ -187,7 +181,7 @@ layui.config({ ...@@ -187,7 +181,7 @@ layui.config({
seriesData.push(parseFloat(avgScore)); seriesData.push(parseFloat(avgScore));
} }
tagText = "分数"; tagText = "分数";
} else if(quType === "ORDERQU") { } else if(quType === "9") {
if(charType === "PIE") { if(charType === "PIE") {
var data = {}; var data = {};
data["value"] = parseInt(anCount); data["value"] = parseInt(anCount);
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div style="padding-top:20px; padding-left: 10px; padding-right: 10px">
<form class="layui-form" action="" id="showForm" autocomplete="off">
<div class="layui-form-item">
<input type="text" id="surveyName" name="surveyName" win-verify="required" placeholder="请输入密钥" class="layui-input" maxlength="50"/>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" lay-submit lay-filter="formAddBean">确定</button>
</div>
</div>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/dwsurveydesign/'}).use('dwsurveydesignrulecode');
</script>
</body>
</html>
\ No newline at end of file
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
<table class="suQuTable" border="0" cellpadding="0" cellspacing="0" style="border: none! important;margin-top: 8px;"> <table class="suQuTable" border="0" cellpadding="0" cellspacing="0" style="border: none! important;margin-top: 8px;">
<tr> <tr>
<td width="15px">&nbsp;</td> <td width="15px">&nbsp;</td>
<td class="bfbTd">回答数:{{anCount}}条&nbsp;&nbsp;<a href="${ctx}/design/qu-fillblank!answers.action?quId={{id}}&surveyId={{belongId}}" class="fb_answer">查看</a></td> <td class="bfbTd">回答数:{{anCount}}条&nbsp;&nbsp;</td>
<td colspan="4">&nbsp;</td> <td colspan="4">&nbsp;</td>
</tr> </tr>
</table> </table>
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
<tr class="quTrOptions"> <tr class="quTrOptions">
<td width="15px">&nbsp;</td> <td width="15px">&nbsp;</td>
<td width="520px">{{optionName}}</td> <td width="520px">{{optionName}}</td>
<td class="bfbTd">回答数:{{anCount}}条&nbsp;&nbsp;<a href="#">查看</a></td></td> <td class="bfbTd">回答数:{{anCount}}条</td></td>
<td colspan="4"></td> <td colspan="4"></td>
</tr> </tr>
{{/each}} {{/each}}
...@@ -193,37 +193,12 @@ ...@@ -193,37 +193,12 @@
<tr class="columnItemTr"> <tr class="columnItemTr">
<td width="15px">&nbsp;</td> <td width="15px">&nbsp;</td>
<td width="520" class="quChenRowTd" style="padding-left: 15px;"><label class="editAble quCoOptionEdit">{{optionName}}</label></td> <td width="520" class="quChenRowTd" style="padding-left: 15px;"><label class="editAble quCoOptionEdit">{{optionName}}</label></td>
<td width="180px"><div id="bfbTd{{quType}}_{{rowId}}_{{id}}" class="progressbarDiv progress{{showXhIndex @index}}"></div></td> <td width="180px"><div id="bfbTd{{quType}}_{{../id}}_{{id}}" class="progressbarDiv progress{{showXhIndex @index}}"></div></td>
<td width="50px" align="right" id="bfbNum{{quType}}_{{rowId}}_{{id}}" class="bfbTd">0%</td> <td width="50px" align="right" id="bfbNum{{quType}}_{{../id}}_{{id}}" class="bfbTd">0%</td>
<td align="left" id="bfbAnCount{{quType}}_{{rowId}}_{{id}}" class="tdAnCount">&nbsp;0次</td> <td align="left" id="bfbAnCount{{quType}}_{{../id}}_{{id}}" class="tdAnCount">&nbsp;0次</td>
<td> <td>
<div class="columnItemOptionName" style="display: none;">{{optionName}}</div> <div class="columnItemOptionName" style="display: none;">{{optionName}}</div>
<input type="hidden" name="columnItemAnCount" value="0" id="coumneItemAnCount{{quType}}_{{rowId}}_{{id}}"> <input type="hidden" name="columnItemAnCount" value="0" id="coumneItemAnCount{{quType}}_{{rowId}}_{{id}}">
{{#each anChenRadios}}
{{#if quRowId}}
{{#compare8 [{{../rowId}}] [{{../id}}] quRowId quColId}}
<script type="text/javascript">
layui.define(["jquery", 'jqueryUI'], function(exports) {
var jQuery = layui.jquery;
(function($) {
var count = parseInt("[{{../../anCount}}]");
var anCount = parseInt("{{anCount}}");
var bfbFloat = anCount / count * 100;
var bfbVal = bfbFloat.toFixed(2);
if(bfbVal === "NaN"){
bfbVal = "0.00";
}
$("#bfbNum{{quType}}_{{rowId}}_{{id}}").html(bfbVal + "%");
$("#bfbAnCount{{quType}}_{{rowId}}_{{id}}").html("&nbsp;&nbsp;" + anCount + "");
$("#bfbTd{{quType}}_{{rowId}}_{{id}}").progressbar({value: bfbFloat});
$("#coumneItemAnCount{{quType}}_{{rowId}}_{{id}}").val(anCount);
})(jQuery);
});
</script>
{{else}}
{{/compare8}}
{{/if}}
{{/each}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
...@@ -231,6 +206,26 @@ ...@@ -231,6 +206,26 @@
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
{{#each anChenRadios}}
<script type="text/javascript">
layui.define(["jquery", 'jqueryUI'], function(exports) {
var jQuery = layui.jquery;
(function($) {
var count = parseInt("{{anAllCount}}");
var anCount = parseInt("{{anCount}}");
var bfbFloat = anCount / count * 100;
var bfbVal = bfbFloat.toFixed(2);
if(bfbVal === "NaN"){
bfbVal = "0.00";
}
$("#bfbNum{{quType}}_{{quRowId}}_quColId").html(bfbVal + "%");
$("#bfbAnCount{{quType}}_{{quRowId}}_quColId").html("&nbsp;&nbsp;" + anCount + "");
$("#bfbTd{{quType}}_{{quRowId}}_quColId").progressbar({value: bfbFloat});
$("#coumneItemAnCount{{quType}}_{{quRowId}}_quColId").val(anCount);
})(jQuery);
});
</script>
{{/each}}
</table> </table>
<div class="reportPic"> <div class="reportPic">
<div class="chartBtnEvent"> <div class="chartBtnEvent">
...@@ -262,32 +257,12 @@ ...@@ -262,32 +257,12 @@
<tr class="columnItemTr"> <tr class="columnItemTr">
<td width="15px">&nbsp;</td> <td width="15px">&nbsp;</td>
<td width="520" class="quChenRowTd" style="padding-left: 15px;"><label class="editAble quCoOptionEdit">{{optionName}}</label></td> <td width="520" class="quChenRowTd" style="padding-left: 15px;"><label class="editAble quCoOptionEdit">{{optionName}}</label></td>
<td width="180px"><div id="bfbTd{{quType}}_{{rowId}}_{{id}}" class="progressbarDiv progress{{showXhIndex @index}}"></div></td> <td width="180px"><div id="bfbTd{{quType}}_{{../id}}_{{id}}" class="progressbarDiv progress{{showXhIndex @index}}"></div></td>
<td width="50px" align="right" id="bfbNum{{quType}}_{{rowId}}_{{id}}" class="bfbTd">0%</td> <td width="50px" align="right" id="bfbNum{{quType}}_{{../id}}_{{id}}" class="bfbTd">0%</td>
<td align="left" id="bfbAnCount{{quType}}_{{rowId}}_{{id}}" class="tdAnCount">&nbsp;0次</td> <td align="left" id="bfbAnCount{{quType}}_{{../id}}_{{id}}" class="tdAnCount">&nbsp;0次</td>
<td> <td>
<div class="columnItemOptionName" style="display: none;">{{optionName}}</div> <div class="columnItemOptionName" style="display: none;">{{optionName}}</div>
<input type="hidden" name="columnItemAnCount" value="0" id="coumneItemAnCount{{quType}}_{{rowId}}_{{id}}"> <input type="hidden" name="columnItemAnCount" value="0" id="coumneItemAnCount{{quType}}_{{../id}}_{{id}}">
{{#each anChenCheckboxs}}
{{#if quRowId}}
{{#compare8 [{{../rowId}}] [{{../id}}] quRowId quColId}}
<script type="text/javascript">
var count = parseInt("[{{../../anCount}}]");
var anCount = parseInt("{{anCount}}");
var bfbFloat = anCount/count*100;
var bfbVal = bfbFloat.toFixed(2);
if(bfbVal === "NaN"){
bfbVal = "0.00";
}
$("#bfbNum{{quType}}_{{rowId}}_{{id}}").html(bfbVal + "%");
$("#bfbAnCount{{quType}}_{{rowId}}_{{id}}").html("&nbsp;&nbsp;" + anCount + "");
$("#bfbTd{{quType}}_{{rowId}}_{{id}}").progressbar({value: bfbFloat});
$("#coumneItemAnCount{{quType}}_{{rowId}}_{{id}}").val(anCount);
</script>
{{else}}
{{/compare8}}
{{/if}}
{{/each}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
...@@ -295,6 +270,26 @@ ...@@ -295,6 +270,26 @@
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
{{#each anChenCheckboxs}}
<script type="text/javascript">
layui.define(["jquery", 'jqueryUI'], function(exports) {
var jQuery = layui.jquery;
(function($) {
var count = parseInt("{{anAllCount}}");
var anCount = parseInt("{{anCount}}");
var bfbFloat = anCount / count * 100;
var bfbVal = bfbFloat.toFixed(2);
if(bfbVal === "NaN"){
bfbVal = "0.00";
}
$("#bfbNum{{quType}}_{{quRowId}}_{{quColId}}").html(bfbVal + "%");
$("#bfbAnCount{{quType}}_{{quRowId}}_{{quColId}}").html("&nbsp;&nbsp;" + anCount + "");
$("#bfbTd{{quType}}_{{quRowId}}_{{quColId}}").progressbar({value: bfbFloat});
$("#coumneItemAnCount{{quType}}_{{quRowId}}_{{quColId}}").val(anCount);
})(jQuery);
});
</script>
{{/each}}
</table> </table>
<div class="reportPic"> <div class="reportPic">
<div class="chartBtnEvent"> <div class="chartBtnEvent">
...@@ -320,30 +315,23 @@ ...@@ -320,30 +315,23 @@
<tr class="columnItemTr"> <tr class="columnItemTr">
<td width="15px">&nbsp;</td> <td width="15px">&nbsp;</td>
<td width="520" class="quChenRowTd" style="padding-left: 15px;"><label class="editAble quCoOptionEdit">{{optionName}}</label></td> <td width="520" class="quChenRowTd" style="padding-left: 15px;"><label class="editAble quCoOptionEdit">{{optionName}}</label></td>
<td width="120px" align="left" id="bfbNum{{quType}}_{{rowId}}_{{id}}" class="bfbTd">0%</td> <td width="120px" align="left" id="bfbNum{{quType}}_{{../id}}_{{id}}" class="bfbTd">0%</td>
<td align="left" id="bfbAnCount{{quType}}_{{rowId}}_{{id}}" class="tdAnCount">&nbsp;0次</td> <td align="left" id="bfbAnCount{{quType}}_{{../id}}_{{id}}" class="tdAnCount">&nbsp;0次</td>
<td width="40px">&nbsp;</td> <td width="40px">&nbsp;</td>
<td> <td></td>
{{#each anChenFbks}}
{{#if quRowId}}
{{#compare8 [{{../rowId}}] [{{../id}}] quRowId quColId}}
<script type="text/javascript">
layui.define(["jquery"], function(exports) {
var jQuery = layui.jquery;
(function($) {
$("#bfbNum{{quType}}_{{rowId}}_{{id}}").html("回答数:{{anCount}}条");
$("#bfbAnCount{{quType}}_{{rowId}}_{{id}}").html("&nbsp;&nbsp;<a href=\"#\">查看</a>");
})(jQuery);
});
</script>
{{else}}
{{/compare8}}
{{/if}}
{{/each}}
</td>
</tr> </tr>
{{/each}} {{/each}}
{{/each}} {{/each}}
{{#each anChenFbks}}
<script type="text/javascript">
layui.define(["jquery"], function(exports) {
var jQuery = layui.jquery;
(function($) {
$("#bfbNum{{quType}}_{{quRowId}}_{{quColId}}").html("回答数:{{anCount}}条");
})(jQuery);
});
</script>
{{/each}}
</table> </table>
<div class="reportPic"></div> <div class="reportPic"></div>
<div style="clear:both;"></div> <div style="clear:both;"></div>
...@@ -367,38 +355,13 @@ ...@@ -367,38 +355,13 @@
<tr class="columnItemTr"> <tr class="columnItemTr">
<td width="15px">&nbsp;</td> <td width="15px">&nbsp;</td>
<td width="520" class="quChenRowTd" style="padding-left: 15px;"><label class="editAble quCoOptionEdit">{{optionName}}</label></td> <td width="520" class="quChenRowTd" style="padding-left: 15px;"><label class="editAble quCoOptionEdit">{{optionName}}</label></td>
<td width="180px"><div id="bfbTd{{quType}}{{rowId}}_{{id}}" class="progressbarDiv progress{{../_index}}"></div></td> <td width="180px"><div id="bfbTd{{quType}}{{../id}}_{{id}}" class="progressbarDiv progress{{../_index}}"></div></td>
<td width="60px" align="right" id="bfbNum{{quType}}{{rowId}}_{{id}}" class="bfbTd">0%</td> <td width="60px" align="right" id="bfbNum{{quType}}{{../id}}_{{id}}" class="bfbTd">0%</td>
<td align="left" class="tdAnCount">&nbsp;&nbsp;平均</td> <td align="left" class="tdAnCount">&nbsp;&nbsp;平均</td>
<td width="40px">&nbsp;</td> <td width="40px">&nbsp;</td>
<td> <td>
<div class="columnItemOptionName" style="display: none;">{{optionName}}</div> <div class="columnItemOptionName" style="display: none;">{{optionName}}</div>
<input type="hidden" name="columnItemAnCount" value="0" id="coumneItemAnCount{{quType}}{{rowId}}_{{id}}"> <input type="hidden" name="columnItemAnCount" value="0" id="coumneItemAnCount{{quType}}{{../id}}_{{id}}">
{{#each anChenScores}}
{{#if quRowId}}
{{#compare8 [{{../rowId}}] [{{../id}}] quRowId quColId}}
<script type="text/javascript">
layui.define(["jquery", 'jqueryUI'], function(exports) {
var jQuery = layui.jquery;
(function($) {
var avgScore = parseFloat("{{avgScore}}");
var bfbFloat = avgScore / 5 * 100;
var bfbVal = bfbFloat.toFixed(2);
//平均分 setAvgScore
avgScore=avgScore.toFixed(2);
if(avgScore === "NaN"){
avgScore = "0.00";
}
$("#bfbNum{{quType}}{{rowId}}_{{id}}").html(avgScore + "");
$("#bfbTd{{quType}}{{rowId}}_{{id}}").progressbar({value: bfbFloat});
$("#coumneItemAnCount{{quType}}{{rowId}}_{{id}}").val(avgScore);
})(jQuery);
});
</script>
{{else}}
{{/compare8}}
{{/if}}
{{/each}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
...@@ -406,6 +369,26 @@ ...@@ -406,6 +369,26 @@
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
{{#each anChenScores}}
<script type="text/javascript">
layui.define(["jquery", 'jqueryUI'], function(exports) {
var jQuery = layui.jquery;
(function($) {
var avgScore = parseFloat("{{avgScore}}");
var bfbFloat = avgScore / 5 * 100;
var bfbVal = bfbFloat.toFixed(2);
//平均分 setAvgScore
avgScore = avgScore.toFixed(2);
if(avgScore === "NaN"){
avgScore = "0.00";
}
$("#bfbNum{{quType}}{{quRowId}}_{{quColId}}").html(avgScore + "");
$("#bfbTd{{quType}}{{quRowId}}_{{quColId}}").progressbar({value: bfbFloat});
$("#coumneItemAnCount{{quType}}{{quRowId}}_{{quColId}}").val(avgScore);
})(jQuery);
});
</script>
{{/each}}
</table> </table>
<div class="reportPic"> <div class="reportPic">
<div class="chartBtnEvent"> <div class="chartBtnEvent">
...@@ -442,7 +425,7 @@ ...@@ -442,7 +425,7 @@
var count = parseInt("{{anCount}}"); var count = parseInt("{{anCount}}");
var anCount = parseInt("{{anAllCount}}"); var anCount = parseInt("{{anAllCount}}");
var avgScore = parseFloat("{{avgScore}}"); var avgScore = parseFloat("{{avgScore}}");
var bfbFloat = avgScore / "[{{../paramInt02}}]" * 100; var bfbFloat = avgScore / {{../paramInt02}} * 100;
var bfbVal = bfbFloat.toFixed(2); var bfbVal = bfbFloat.toFixed(2);
//平均分 setAvgScore //平均分 setAvgScore
avgScore = avgScore.toFixed(2); avgScore = avgScore.toFixed(2);
......
...@@ -80,6 +80,10 @@ ...@@ -80,6 +80,10 @@
var quIndex = 0;//问题序号 var quIndex = 0;//问题序号
var pageNum = 1;//模拟页码 var pageNum = 1;//模拟页码
var nowPageNum = 1;//当前页码 var nowPageNum = 1;//当前页码
var ruleCode = "";//密码
var bgAnDate = "";//答卷开始时间
layui.config({ layui.config({
base: basePath, base: basePath,
version: skyeyeVersion version: skyeyeVersion
...@@ -89,142 +93,163 @@ ...@@ -89,142 +93,163 @@
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$, var $ = layui.$,
form = layui.form; form = layui.form;
bgAnDate = getFormatDate();
showGrid({ AjaxPostUtil.request({url:reqBasePath + "dwsurveydirectory028", params: {surveyId: getUrlParam("rowId"), ip: returnCitySN["cip"]}, type:'json', callback:function(json){
id: "wrap", if(json.returnCode == 0){
url: reqBasePath + "dwsurveydirectory024", showGrid({
params: { id: "wrap",
rowId: getUrlParam("rowId") url: reqBasePath + "dwsurveydirectory024",
}, params: {
pagination: false, rowId: getUrlParam("rowId")
template: getFileContent('tpl/dwsurveydesign/surveyTemplate.tpl'), },
ajaxSendLoadBefore: function(hdb) { pagination: false,
hdb.registerHelper("showQuestionIndex", function(v1, options) { template: getFileContent('tpl/dwsurveydesign/surveyTemplate.tpl'),
if(v1 == '16' || v1 == '17'){ ajaxSendLoadBefore: function(hdb) {
}else{ hdb.registerHelper("showQuestionIndex", function(v1, options) {
quIndex++; if(v1 == '16' || v1 == '17'){
return quIndex; }else{
} quIndex++;
}); return quIndex;
}
hdb.registerHelper("showXhIndex", function(v1, options) { });
return parseInt(v1) + 1;
}); hdb.registerHelper("showXhIndex", function(v1, options) {
return parseInt(v1) + 1;
hdb.registerHelper("showParamInt02", function(v1, options) { });
var str = "";
for(var i = 1; i <= v1; i++) { hdb.registerHelper("showParamInt02", function(v1, options) {
str += "<td style='background-color: white;'>" + i + "</td>"; var str = "";
} for(var i = 1; i <= v1; i++) {
return str; str += "<td style='background-color: white;'>" + i + "</td>";
}); }
return str;
hdb.registerHelper('compare1', function(v1, v2, options) { });
if(v1 == v2) {
return options.fn(this); hdb.registerHelper('compare1', function(v1, v2, options) {
} else { if(v1 == v2) {
return options.inverse(this); return options.fn(this);
} } else {
}); return options.inverse(this);
}
hdb.registerHelper('compare2', function(v1, v2, options) { });
if(v1 == v2) {
return 'display: none;'; hdb.registerHelper('compare2', function(v1, v2, options) {
} else { if(v1 == v2) {
return ''; return 'display: none;';
} } else {
}); return '';
}
hdb.registerHelper('compare3', function(v1, v2, options) { });
if(v1 > v2) {
return options.fn(this); hdb.registerHelper('compare3', function(v1, v2, options) {
} else { if(v1 > v2) {
return options.inverse(this); return options.fn(this);
} } else {
}); return options.inverse(this);
}
hdb.registerHelper('compare4', function(v1, options) { });
if(v1 == nowPageNum) {
return ''; hdb.registerHelper('compare4', function(v1, options) {
} else { if(v1 == nowPageNum) {
return 'display: none;'; return '';
} } else {
}); return 'display: none;';
}
hdb.registerHelper('compare5', function(v1, options) { });
if(v1 == '16'){
if(pageNum == '1'){ hdb.registerHelper('compare5', function(v1, options) {
pageNum++; if(v1 == '16'){
return ''; if(pageNum == '1'){
}else{ pageNum++;
pageNum++; return '';
} }else{
} pageNum++;
if(pageNum == '1'){ }
return ''; }
}else{ if(pageNum == '1'){
return 'display: none;'; return '';
} }else{
}); return 'display: none;';
}
hdb.registerHelper('compare6', function(v1, options) { });
return pageNum;
}); hdb.registerHelper('compare6', function(v1, options) {
return pageNum;
hdb.registerHelper('compare7', function(v1, options) { });
if(nowPageNum == '1'){
return options.inverse(this); hdb.registerHelper('compare7', function(v1, options) {
}else{ if(nowPageNum == '1'){
return options.fn(this); return options.inverse(this);
} }else{
}); return options.fn(this);
}
hdb.registerHelper("cellCount001", function(v1, options) { });
var str = "";
var width = 600 / v1; hdb.registerHelper("cellCount001", function(v1, options) {
for(var i = 1; i <= v1; i++) { var str = "";
str += '<td width="' + width + 'px">' + var width = 600 / v1;
'<div class="dwQuOptionItemContent">' + for(var i = 1; i <= v1; i++) {
'<label class="dwRedioStyle dwQuInputLabel" ></label>' + str += '<td width="' + width + 'px">' +
'<input type="radio" name="qu_{{quType}}_{{quId}}" value="{{id}}" >' + '<div class="dwQuOptionItemContent">' +
'<label style="width:' + (width - 10) + 'px;" class="editAble quCoOptionEdit quCoOptionPadding">{{optionName}}</label>' + '<label class="dwRedioStyle dwQuInputLabel" ></label>' +
'<input type="text" class="inputSytle_1" style="width:200px;padding:5px;{{#compare2 isNote 0}}{{/compare2}}" name="text_qu_{{quType}}_{{quId}}_{{id}}" />' + '<input type="radio" name="qu_{{quType}}_{{quId}}" value="{{id}}" >' +
'</div>' + '<label style="width:' + (width - 10) + 'px;" class="editAble quCoOptionEdit quCoOptionPadding">{{optionName}}</label>' +
'</td>'; '<input type="text" class="inputSytle_1" style="width:200px;padding:5px;{{#compare2 isNote 0}}{{/compare2}}" name="text_qu_{{quType}}_{{quId}}_{{id}}" />' +
} '</div>' +
str += '<div class="emptyTd"></div>'; '</td>';
return str; }
}); str += '<div class="emptyTd"></div>';
return str;
hdb.registerHelper("cellCount002", function(v1, options) { });
var str = "";
var width = 600 / v1; hdb.registerHelper("cellCount002", function(v1, options) {
for(var i = 1; i <= v1; i++) { var str = "";
str += '<td width="' + width + 'px">' + var width = 600 / v1;
'<div class="dwQuOptionItemContent">' + for(var i = 1; i <= v1; i++) {
'<label class="dwCheckboxStyle dwQuInputLabel" ></label>' + str += '<td width="' + width + 'px">' +
'<input type="checkbox" name="tag_qu_{{quType}}_{{quId}}" value="{{id}}" >' + '<div class="dwQuOptionItemContent">' +
'<label style="width:' + (width - 10) + 'px;" class="editAble quCoOptionEdit quCoOptionPadding">{{optionName}}</label>' + '<label class="dwCheckboxStyle dwQuInputLabel" ></label>' +
'<input type="text" class="inputSytle_1" style="width:200px;padding:5px;{{#compare2 isNote 0}}{{/compare2}}" name="text_tag_qu_{{quType}}_{{quId}}_{{id}}" />' + '<input type="checkbox" name="tag_qu_{{quType}}_{{quId}}" value="{{id}}" >' +
'</div>' + '<label style="width:' + (width - 10) + 'px;" class="editAble quCoOptionEdit quCoOptionPadding">{{optionName}}</label>' +
'</td>'; '<input type="text" class="inputSytle_1" style="width:200px;padding:5px;{{#compare2 isNote 0}}{{/compare2}}" name="text_tag_qu_{{quType}}_{{quId}}_{{id}}" />' +
} '</div>' +
str += '<div class="emptyTd"></div>'; '</td>';
return str; }
}); str += '<div class="emptyTd"></div>';
return str;
hdb.registerHelper("scoreNum001", function(v1, options) { });
var str = "";
for(var i = 1; i <= v1; i++) { hdb.registerHelper("scoreNum001", function(v1, options) {
str += '<option value="' + i + '">' + i + '分</option>'; var str = "";
for(var i = 1; i <= v1; i++) {
str += '<option value="' + i + '">' + i + '分</option>';
}
return str;
});
},
ajaxSendAfter: function(json) {
loadModel();
} }
return str;
}); });
}, ruleCode = json.bean.ruleCode;
ajaxSendAfter: function(json) { if(json.bean.rule == '3'){
_openNewWindowsNoRel({
} url: "../../tpl/dwsurveydesign/dwsurveydesignrulecode.html",
}); title: "问卷密钥",
area: ['300px', '200px'],
closeBtn: 0,
pageId: "dwsurveydesignrulecode",
callBack: function(refreshCode){
if (refreshCode == '0') {
} else if (refreshCode == '-9999') {
layer.msg("操作失败", {icon: 2,time: 2000});
}
}});
}
}else{
$("#wrap").html('<span class="messageSpan">' + json.returnMessage + '</span>');
}
}});
//获取url中的参数 //获取url中的参数
function getUrlParam(name) { function getUrlParam(name) {
...@@ -235,7 +260,7 @@ ...@@ -235,7 +260,7 @@
} }
//分页设置 nextPage_a prevPage_a //分页设置 nextPage_a prevPage_a
$(".nextPage_a").click(function() { $("body").on("click", ".nextPage_a", function(e) {
if(validateForms()){ if(validateForms()){
var thParent = $(this).parent(); var thParent = $(this).parent();
nowPageNum = nowPageNum + 1; nowPageNum = nowPageNum + 1;
...@@ -247,7 +272,7 @@ ...@@ -247,7 +272,7 @@
return false; return false;
} }
}); });
$(".prevPage_a").click(function() { $("body").on("click", ".prevPage_a", function(e) {
var thParent = $(this).parent(); var thParent = $(this).parent();
nowPageNum = nowPageNum - 1; nowPageNum = nowPageNum - 1;
$(".li_surveyQuItemBody").hide(); $(".li_surveyQuItemBody").hide();
...@@ -255,189 +280,270 @@ ...@@ -255,189 +280,270 @@
$(window).scrollTop(10); $(window).scrollTop(10);
return false; return false;
}); });
var prevHost = $("#prevHost").val(); $.fn.serializeJson = function() {
//初始化弹出窗口参数 var serializeObj = {};
var surveyStyleId = $("#surveyStyleId").val(); var array = this.serializeArray();
if(surveyStyleId != "") { var str = this.serialize();
/** 背景样式 **/ $(array).each(function() {
var showBodyBi = "${surveyStyle.showBodyBi}"; if (serializeObj[this.name]) {
var bodyBgColor = "${surveyStyle.bodyBgColor}"; if ($.isArray(serializeObj[this.name])) {
var bodyBgColorObj = $("input[name='bodyBgColor']"); serializeObj[this.name].push(this.value);
bodyBgColorObj.val(bodyBgColor); } else {
var bodyBCThemeParamObj = bodyBgColorObj.parents(".theme_param"); serializeObj[this.name] = [
bodyBCThemeParamObj.find(".color_box").css({ serializeObj[this.name], this.value ];
"background-color": bodyBgColor }
}); } else {
$("body").css({ serializeObj[this.name] = this.value;
"background-color": bodyBgColor }
}); });
return serializeObj;
var bodyBgImage = "${surveyStyle.bodyBgImage}"; };
var bodyBgImageObj = $("input[name='bodyBgImage']");
var bodyBIThemeParamObj = bodyBgImageObj.parents(".theme_param"); function loadModel(){
bodyBgImageObj.val(bodyBgImage); var prevHost = $("#prevHost").val();
bodyBIThemeParamObj.find(".previewImage").attr("src", prevHost + bodyBgImage); //初始化弹出窗口参数
if(showBodyBi == 1) { var surveyStyleId = $("#surveyStyleId").val();
if(surveyStyleId != "") {
/** 背景样式 **/
var showBodyBi = "${surveyStyle.showBodyBi}";
var bodyBgColor = "${surveyStyle.bodyBgColor}";
var bodyBgColorObj = $("input[name='bodyBgColor']");
bodyBgColorObj.val(bodyBgColor);
var bodyBCThemeParamObj = bodyBgColorObj.parents(".theme_param");
bodyBCThemeParamObj.find(".color_box").css({
"background-color": bodyBgColor
});
$("body").css({ $("body").css({
"background-image": "url(" + prevHost + bodyBgImage + ")" "background-color": bodyBgColor
});
var bodyBgImage = "${surveyStyle.bodyBgImage}";
var bodyBgImageObj = $("input[name='bodyBgImage']");
var bodyBIThemeParamObj = bodyBgImageObj.parents(".theme_param");
bodyBgImageObj.val(bodyBgImage);
bodyBIThemeParamObj.find(".previewImage").attr("src", prevHost + bodyBgImage);
if(showBodyBi == 1) {
$("body").css({
"background-image": "url(" + prevHost + bodyBgImage + ")"
});
$("input[name='showBodyBi']").prop("checked", true);
}
/** 表头样式 **/
var showSurveyHbgi = "${surveyStyle.showSurveyHbgi}";
var surveyHeadBgColor = "${surveyStyle.surveyHeadBgColor}";
var surveyHeadBgColorObj = $("input[name='surveyHeadBgColor']");
var surveyHBCThemeParamObj = surveyHeadBgColorObj.parents(".theme_param");
surveyHeadBgColorObj.val(surveyHeadBgColor);
surveyHBCThemeParamObj.find(".color_box").css({
"background-color": surveyHeadBgColor
}); });
$("input[name='showBodyBi']").prop("checked", true);
}
/** 表头样式 **/
var showSurveyHbgi = "${surveyStyle.showSurveyHbgi}";
var surveyHeadBgColor = "${surveyStyle.surveyHeadBgColor}";
var surveyHeadBgColorObj = $("input[name='surveyHeadBgColor']");
var surveyHBCThemeParamObj = surveyHeadBgColorObj.parents(".theme_param");
surveyHeadBgColorObj.val(surveyHeadBgColor);
surveyHBCThemeParamObj.find(".color_box").css({
"background-color": surveyHeadBgColor
});
$("#dwSurveyHeader").css({
"background-color": surveyHeadBgColor
});
var surveyHeadBgImage = "${surveyStyle.surveyHeadBgImage}";
var surveyHeadBgImageObj = $("input[name='surveyHeadBgImage']");
var surveyHBIThemeParamObj = surveyHeadBgImageObj.parents(".theme_param");
surveyHeadBgImageObj.val(surveyHeadBgImage);
surveyHBIThemeParamObj.find(".previewImage").attr("src", prevHost + surveyHeadBgImage);
if(showSurveyHbgi == 1) {
$("#dwSurveyHeader").css({ $("#dwSurveyHeader").css({
"background-image": "url(" + prevHost + surveyHeadBgImage + ")" "background-color": surveyHeadBgColor
}); });
$("input[name='showSurveyHbgi']").prop("checked", true);
} var surveyHeadBgImage = "${surveyStyle.surveyHeadBgImage}";
var surveyHeadBgImageObj = $("input[name='surveyHeadBgImage']");
var surveyHeadPaddingTop = "${surveyStyle.surveyHeadPaddingTop}"; var surveyHBIThemeParamObj = surveyHeadBgImageObj.parents(".theme_param");
var surveyHeadPaddingBottom = "${surveyStyle.surveyHeadPaddingBottom}"; surveyHeadBgImageObj.val(surveyHeadBgImage);
$("#dwSurveyHeader").css({ surveyHBIThemeParamObj.find(".previewImage").attr("src", prevHost + surveyHeadBgImage);
"padding-top": surveyHeadPaddingTop + "px" if(showSurveyHbgi == 1) {
}); $("#dwSurveyHeader").css({
$("#dwSurveyHeader").css({ "background-image": "url(" + prevHost + surveyHeadBgImage + ")"
"padding-bottom": surveyHeadPaddingBottom + "px" });
}); $("input[name='showSurveyHbgi']").prop("checked", true);
}
/** 内容中间样式 **/
var showSurveyCbim = "${surveyStyle.showSurveyCbim}"; var surveyHeadPaddingTop = "${surveyStyle.surveyHeadPaddingTop}";
var surveyContentBgColorMiddle = "${surveyStyle.surveyContentBgColorMiddle}"; var surveyHeadPaddingBottom = "${surveyStyle.surveyHeadPaddingBottom}";
var surveyContentBgColorMiddleObj = $("input[name='surveyContentBgColorMiddle']"); $("#dwSurveyHeader").css({
var surveyCBCMThemeParamObj = surveyContentBgColorMiddleObj.parents(".theme_param"); "padding-top": surveyHeadPaddingTop + "px"
surveyContentBgColorMiddleObj.val(surveyContentBgColorMiddle); });
surveyCBCMThemeParamObj.find(".color_box").css({ $("#dwSurveyHeader").css({
"background-color": surveyContentBgColorMiddle "padding-bottom": surveyHeadPaddingBottom + "px"
});; });
$("#dwSurveyQuContentBg").css({
"background-color": surveyContentBgColorMiddle /** 内容中间样式 **/
}); var showSurveyCbim = "${surveyStyle.showSurveyCbim}";
var surveyContentBgColorMiddle = "${surveyStyle.surveyContentBgColorMiddle}";
var surveyContentBgImageMiddle = "${surveyStyle.surveyContentBgImageMiddle}"; var surveyContentBgColorMiddleObj = $("input[name='surveyContentBgColorMiddle']");
var surveyContentBgImageMiddleObj = $("input[name='surveyContentBgImageMiddle']"); var surveyCBCMThemeParamObj = surveyContentBgColorMiddleObj.parents(".theme_param");
var surveyCBIMThemeParamObj = surveyContentBgImageMiddleObj.parents(".theme_param"); surveyContentBgColorMiddleObj.val(surveyContentBgColorMiddle);
surveyContentBgImageMiddleObj.val(surveyContentBgImageMiddle); surveyCBCMThemeParamObj.find(".color_box").css({
surveyCBIMThemeParamObj.find(".previewImage").attr("src", prevHost + surveyContentBgImageMiddle); "background-color": surveyContentBgColorMiddle
if(showSurveyCbim == 1) { });;
$("#dwSurveyQuContentBg").css({ $("#dwSurveyQuContentBg").css({
"background-image": "url(" + prevHost + surveyContentBgImageMiddle + ")" "background-color": surveyContentBgColorMiddle
});
var surveyContentBgImageMiddle = "${surveyStyle.surveyContentBgImageMiddle}";
var surveyContentBgImageMiddleObj = $("input[name='surveyContentBgImageMiddle']");
var surveyCBIMThemeParamObj = surveyContentBgImageMiddleObj.parents(".theme_param");
surveyContentBgImageMiddleObj.val(surveyContentBgImageMiddle);
surveyCBIMThemeParamObj.find(".previewImage").attr("src", prevHost + surveyContentBgImageMiddle);
if(showSurveyCbim == 1) {
$("#dwSurveyQuContentBg").css({
"background-image": "url(" + prevHost + surveyContentBgImageMiddle + ")"
});
$("input[name='showSurveyCbim']").prop("checked", true);
}
/** 文本样式 **/
var questionTitleTextColor = "${surveyStyle.questionTitleTextColor}";
var questionTitleTextColorObj = $("input[name='questionTitleTextColor']");
var questionTTCThemeParamObj = questionTitleTextColorObj.parents(".theme_param");
questionTitleTextColorObj.val(questionTitleTextColor);
questionTTCThemeParamObj.find(".color_box").css({
"background-color": questionTitleTextColor
});
$(".quCoTitle").css({
"color": questionTitleTextColor
});
var questionOptionTextColor = "${surveyStyle.questionOptionTextColor}";
var questionOptionTextColorObj = $("input[name='questionOptionTextColor']");
var questionOTCThemeParamObj = questionOptionTextColorObj.parents(".theme_param");
questionOptionTextColorObj.val(questionOptionTextColor);
questionOTCThemeParamObj.find(".color_box").css({
"background-color": questionOptionTextColor
}); });
$("input[name='showSurveyCbim']").prop("checked", true); $(".quCoOptionEdit").css({
"color": questionOptionTextColor
});
var surveyTitleTextColor = "${surveyStyle.surveyTitleTextColor}";
var surveyTitleTextColorObj = $("input[name='surveyTitleTextColor']");
var surveyTTCThemeParamObj = surveyTitleTextColorObj.parents(".theme_param");
surveyTitleTextColorObj.val(surveyTitleTextColor);
surveyTTCThemeParamObj.find(".color_box").css({
"background-color": surveyTitleTextColor
});
$("#dwSurveyTitle").css({
"color": surveyTitleTextColor
});
var surveyNoteTextColor = "${surveyStyle.surveyNoteTextColor}";
var surveyNoteTextColorObj = $("input[name='surveyNoteTextColor']");
var surveyNTCThemeParamObj = surveyNoteTextColorObj.parents(".theme_param");
surveyNoteTextColorObj.val(surveyNoteTextColor);
surveyNTCThemeParamObj.find(".color_box").css({
"background-color": surveyNoteTextColor
});
$("#dwSurveyNoteEdit").css({
"color": surveyNoteTextColor
});
var surveyBtnBgColor = "${surveyStyle.surveyBtnBgColor}";
if(surveyBtnBgColor !== "") {
$("#dw_body_content .sbtn24,.progressbarDiv .ui-progressbar-value").css({
"background-color": surveyBtnBgColor
});
$(".progressbarDiv").css({
"border-color": surveyBtnBgColor
});
$(".progress-label ").css({
"color": surveyBtnBgColor
});
var surveyBtnBgColorObj = $("input[name='surveyBtnBgColor']");
surveyBtnBgColorObj.val(surveyBtnBgColor);
var btnBcThemeParamObj = surveyBtnBgColorObj.parents(".theme_param");
btnBcThemeParamObj.find(".color_box").css({
"background-color": surveyBtnBgColor
});
}
//显示序号及进度条
var showTiNum = "${surveyStyle.showTiNum}";
var showProgressbar = "${surveyStyle.showProgressbar}";
if(showTiNum == 0) {
$(".quCoNum").hide();
}
if(showProgressbar == 0) {
$("#resultProgressRoot").hide();
}
//表头文本显示
var showSurTitle = "${surveyStyle.showSurTitle}";
var showSurNote = "${surveyStyle.showSurNote}";
if(showSurTitle == 0) {
$("#dwSurveyTitle").hide();
}
if(showSurNote == 0) {
$("#dwSurveyNote").hide();
}
} }
/** 文本样式 **/ bindScoreNumTdHover();
var questionTitleTextColor = "${surveyStyle.questionTitleTextColor}"; //排序题
var questionTitleTextColorObj = $("input[name='questionTitleTextColor']"); bindQuOrderBySorts();
var questionTTCThemeParamObj = questionTitleTextColorObj.parents(".theme_param");
questionTitleTextColorObj.val(questionTitleTextColor); /******************************处理题目逻辑设置 **************************************/
questionTTCThemeParamObj.find(".color_box").css({ //初始化 处理默认逻辑跳转为显示,则先隐藏元素
"background-color": questionTitleTextColor var quLogics = $("#dwSurveyQuContent .quLogicItem");
$.each(quLogics, function() {
var loginItem = $(this);
var cgQuItemId = loginItem.find(".cgQuItemId").val();
var skQuId = loginItem.find(".skQuId").val();
var logicId = loginItem.find(".logicId").val();
var logicType = loginItem.find(".logicType").val();
if(logicType === "2") {
//逻辑类型为“显示”2 则初始化为隐藏
var hidQuItemBody = $(".quId[value='" + skQuId + "']").parents(".li_surveyQuItemBody");
hidQuItemBody.hide();
hidQuItemBody.addClass("hidFor" + logicId);
hidQuItemBody.find(".answerTag").attr("disabled", true);
}
}); });
$(".quCoTitle").css({
"color": questionTitleTextColor //填空题
$(".fillblankInput,.dwMFillblankInput,.dwChenMFillblankInput").blur(function() {
var thVal = $(this).val();
runlogic($(this));
answerProgressbar($(this));
validateCheck($(this).parents(".li_surveyQuItemBody"), false);
}); });
var questionOptionTextColor = "${surveyStyle.questionOptionTextColor}"; $(".quChenScoreSelect").change(function() {
var questionOptionTextColorObj = $("input[name='questionOptionTextColor']"); answerProgressbar($(this));
var questionOTCThemeParamObj = questionOptionTextColorObj.parents(".theme_param"); validateCheck($(this).parents(".li_surveyQuItemBody"), false);
questionOptionTextColorObj.val(questionOptionTextColor);
questionOTCThemeParamObj.find(".color_box").css({
"background-color": questionOptionTextColor
}); });
$(".quCoOptionEdit").css({
"color": questionOptionTextColor resetQuNum();
$("#mobileTdId").click(function() {
$(this).next().slideToggle();
return false;
}); });
var surveyTitleTextColor = "${surveyStyle.surveyTitleTextColor}"; var bfbFloat = 0;
var surveyTitleTextColorObj = $("input[name='surveyTitleTextColor']"); $("#resultProgress").progressbar({
var surveyTTCThemeParamObj = surveyTitleTextColorObj.parents(".theme_param"); value: bfbFloat,
surveyTitleTextColorObj.val(surveyTitleTextColor); orientation: "vertical"
surveyTTCThemeParamObj.find(".color_box").css({
"background-color": surveyTitleTextColor
});
$("#dwSurveyTitle").css({
"color": surveyTitleTextColor
}); });
}
var surveyNoteTextColor = "${surveyStyle.surveyNoteTextColor}"; $("body").on("click", ".submitSurvey", function(e) {
var surveyNoteTextColorObj = $("input[name='surveyNoteTextColor']");
var surveyNTCThemeParamObj = surveyNoteTextColorObj.parents(".theme_param");
surveyNoteTextColorObj.val(surveyNoteTextColor);
surveyNTCThemeParamObj.find(".color_box").css({
"background-color": surveyNoteTextColor
});
$("#dwSurveyNoteEdit").css({
"color": surveyNoteTextColor
});
var surveyBtnBgColor = "${surveyStyle.surveyBtnBgColor}";
if(surveyBtnBgColor !== "") {
$("#dw_body_content .sbtn24,.progressbarDiv .ui-progressbar-value").css({
"background-color": surveyBtnBgColor
});
$(".progressbarDiv").css({
"border-color": surveyBtnBgColor
});
$(".progress-label ").css({
"color": surveyBtnBgColor
});
var surveyBtnBgColorObj = $("input[name='surveyBtnBgColor']");
surveyBtnBgColorObj.val(surveyBtnBgColor);
var btnBcThemeParamObj = surveyBtnBgColorObj.parents(".theme_param");
btnBcThemeParamObj.find(".color_box").css({
"background-color": surveyBtnBgColor
});
}
//显示序号及进度条
var showTiNum = "${surveyStyle.showTiNum}";
var showProgressbar = "${surveyStyle.showProgressbar}";
if(showTiNum == 0) {
$(".quCoNum").hide();
}
if(showProgressbar == 0) {
$("#resultProgressRoot").hide();
}
//表头文本显示
var showSurTitle = "${surveyStyle.showSurTitle}";
var showSurNote = "${surveyStyle.showSurNote}";
if(showSurTitle == 0) {
$("#dwSurveyTitle").hide();
}
if(showSurNote == 0) {
$("#dwSurveyNote").hide();
}
}
$(".submitSurvey").click(function() {
if(validateForms()) { if(validateForms()) {
$("#surveyForm").submit(); var params = {
jsonData: JSON.stringify($("#surveyForm").serializeJson()),
ip: returnCitySN["cip"],
bgAnDate: bgAnDate
};
params = $.extend({}, params, $("#surveyForm").serializeJson());
AjaxPostUtil.request({url:reqBasePath + "dwsurveydirectory029", params: params, type:'json', callback:function(json){
if(json.returnCode == 0){
$("#wrap").html('<span class="messageSpan">' + '答题完成,感谢您的参与。' + '</span>');
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
} }
return false; return false;
}); });
//评分题 //评分题
$(".scoreNumTable tr td").click(function() { $("body").on("click", ".scoreNumTable tr td", function(e) {
var quScoreOptionTr = $(this).parents(".quScoreOptionTr"); var quScoreOptionTr = $(this).parents(".quScoreOptionTr");
var tdText = $(this).text(); var tdText = $(this).text();
quScoreOptionTr.find(".scoreNumTable tr td").css({ quScoreOptionTr.find(".scoreNumTable tr td").css({
...@@ -451,17 +557,13 @@ ...@@ -451,17 +557,13 @@
$(this).css({ $(this).css({
"background": "" "background": ""
}); });
quScoreOptionTr.find(".scoreNumInput").val(tdText); quScoreOptionTr.find(".scoreNumInput").val(tdText);
quScoreOptionTr.find(".scoreNumText").html(tdText + "&nbsp;分"); quScoreOptionTr.find(".scoreNumText").html(tdText + "&nbsp;分");
runlogic($(this)); runlogic($(this));
answerProgressbar($(this)); answerProgressbar($(this));
validateCheck($(this).parents(".li_surveyQuItemBody"), false); validateCheck($(this).parents(".li_surveyQuItemBody"), false);
}); });
bindScoreNumTdHover();
function bindScoreNumTdHover() { function bindScoreNumTdHover() {
$(".scoreNumTable tr td").hover(function() { $(".scoreNumTable tr td").hover(function() {
var quScoreOptionTr = $(this).parents(".quScoreOptionTr"); var quScoreOptionTr = $(this).parents(".quScoreOptionTr");
...@@ -490,9 +592,6 @@ ...@@ -490,9 +592,6 @@
}); });
} }
//排序题
bindQuOrderBySorts();
function bindQuOrderBySorts() { function bindQuOrderBySorts() {
var quOrderByCoItems = $(".quOrderByCoItem"); var quOrderByCoItems = $(".quOrderByCoItem");
$.each(quOrderByCoItems, function() { $.each(quOrderByCoItems, function() {
...@@ -726,26 +825,8 @@ ...@@ -726,26 +825,8 @@
return validateStatus; return validateStatus;
} }
/******************************处理题目逻辑设置 **************************************/
//初始化 处理默认逻辑跳转为显示,则先隐藏元素
var quLogics = $("#dwSurveyQuContent .quLogicItem");
$.each(quLogics, function() {
var loginItem = $(this);
var cgQuItemId = loginItem.find(".cgQuItemId").val();
var skQuId = loginItem.find(".skQuId").val();
var logicId = loginItem.find(".logicId").val();
var logicType = loginItem.find(".logicType").val();
if(logicType === "2") {
//逻辑类型为“显示”2 则初始化为隐藏
var hidQuItemBody = $(".quId[value='" + skQuId + "']").parents(".li_surveyQuItemBody");
hidQuItemBody.hide();
hidQuItemBody.addClass("hidFor" + logicId);
hidQuItemBody.find(".answerTag").attr("disabled", true);
}
});
/** 单选与多选条件触发 自定义单选多选效果 操作结束后得调用逻辑判断 **/ /** 单选与多选条件触发 自定义单选多选效果 操作结束后得调用逻辑判断 **/
$(".dwQuOptionItemContent").click(function() { $("body").on("click", ".dwQuOptionItemContent", function(e) {
var thObj = $(this); var thObj = $(this);
var quItemBody = thObj.parents(".li_surveyQuItemBody"); var quItemBody = thObj.parents(".li_surveyQuItemBody");
var quType = quItemBody.find(".quType").val(); var quType = quItemBody.find(".quType").val();
...@@ -792,19 +873,6 @@ ...@@ -792,19 +873,6 @@
validateCheck(quItemBody, false); validateCheck(quItemBody, false);
}); });
//填空题
$(".fillblankInput,.dwMFillblankInput,.dwChenMFillblankInput").blur(function() {
var thVal = $(this).val();
runlogic($(this));
answerProgressbar($(this));
validateCheck($(this).parents(".li_surveyQuItemBody"), false);
});
$(".quChenScoreSelect").change(function() {
answerProgressbar($(this));
validateCheck($(this).parents(".li_surveyQuItemBody"), false);
});
//只要触发事件 //只要触发事件
function runlogic(thFormElementObj) { function runlogic(thFormElementObj) {
var quItemBody = thFormElementObj.parents(".li_surveyQuItemBody"); var quItemBody = thFormElementObj.parents(".li_surveyQuItemBody");
...@@ -1016,8 +1084,6 @@ ...@@ -1016,8 +1084,6 @@
} }
} }
resetQuNum();
function resetQuNum() { function resetQuNum() {
var quCoNums = $(".quCoNum"); var quCoNums = $(".quCoNum");
$.each(quCoNums, function(i, item) { $.each(quCoNums, function(i, item) {
...@@ -1106,48 +1172,10 @@ ...@@ -1106,48 +1172,10 @@
answerQuSize = answerTag1.size(); answerQuSize = answerTag1.size();
} }
var newValue = parseInt(answerQuSize / totalQuSize * 100); var newValue = parseInt(answerQuSize / totalQuSize * 100);
//console.log(answerQuSize + "/" + totalQuSize + "=" + newValue);
$("#resultProgressRoot .progress-label").text("完成度:" + newValue + "%"); $("#resultProgressRoot .progress-label").text("完成度:" + newValue + "%");
$("#resultProgress").progressbar("option", "value", newValue); $("#resultProgress").progressbar("option", "value", newValue);
} }
$("#mobileTdId").click(function() {
$(this).next().slideToggle();
return false;
});
var bfbFloat = 0;
$("#resultProgress").progressbar({
value: bfbFloat,
orientation: "vertical"
});
function refreshAutoCode(codeImgId) {
var ctx = $("#ctx").val();
$("#" + codeImgId).attr("src", ctx + "/jcaptcha.action");
}
//判则判断
// var url = "${ctx}/response!ajaxCheckSurvey.action";
// var data = "surveyId=${survey.id}";
// $.ajax({
// url: url,
// data: data,
// type: "post",
// success: function(msg) {
// var json = eval("(" + msg + ")");
// if(json.isCheckCode === "3") {
// $("#jcaptchaImgBody").show();
// }
//
// if(json.surveyStatus != "0") {
// $("#fixedMsg").show();
// $("#fixedMsg").html("您已经回答过此问卷!");
// $("#submitSurvey").remove();
// $("form").attr("action", "#");
// }
// }
// });
}); });
}); });
</script> </script>
......
...@@ -424,8 +424,8 @@ ...@@ -424,8 +424,8 @@
<td> <td>
<div class="dwQuOptionItemContent"> <div class="dwQuOptionItemContent">
<label class="dwRedioStyle dwQuInputLabel" ></label> <label class="dwRedioStyle dwQuInputLabel" ></label>
<input type="hidden" class="dwChenInputTemp" disabled="disabled" value="{{rowId}}:{{id}}"> <input type="hidden" class="dwChenInputTemp" disabled="disabled" value="{{../id}}:{{id}}">
<input name="item_qu_{{quType}}_{{quId}}_{{rowId}}" value="{{id}}" type="radio"> <input name="item_qu_{{quType}}_{{quId}}_{{../id}}" value="{{id}}" type="radio">
</div> </div>
</td> </td>
{{/each}} {{/each}}
...@@ -479,15 +479,15 @@ ...@@ -479,15 +479,15 @@
{{#each questionChenRow}} {{#each questionChenRow}}
<tr class="dwQuCoChenRowTr"> <tr class="dwQuCoChenRowTr">
<td class="quChenRowTd"><label class="quCoOptionEdit">{{optionName}}</label> <td class="quChenRowTd"><label class="quCoOptionEdit">{{optionName}}</label>
<input type="hidden" name="item_qu_{{quType}}_{{quId}}_{{rowId}}" value="ck_item_qu_{{quType}}_{{quId}}_{{rowId}}_" /> <input type="hidden" name="item_qu_{{quType}}_{{quId}}_{{id}}" value="ck_item_qu_{{quType}}_{{quId}}_{{id}}_" />
<input type="hidden" class="answerTag" value="0" > <input type="hidden" class="answerTag" value="0" >
</td> </td>
{{#each questionChenColumn}} {{#each questionChenColumn}}
<td> <td>
<div class="dwQuOptionItemContent"> <div class="dwQuOptionItemContent">
<label class="dwCheckboxStyle dwQuInputLabel" ></label> <label class="dwCheckboxStyle dwQuInputLabel" ></label>
<input type="hidden" class="dwChenInputTemp" disabled="disabled" value="{{rowId}}:{{id}}"> <input type="hidden" class="dwChenInputTemp" disabled="disabled" value="{{../id}}:{{id}}">
<input name="ck_item_qu_{{quType}}_{{quId}}_{{rowId}}_{{id}}" value="{{id}}" type="checkbox"> <input name="ck_item_qu_{{quType}}_{{quId}}_{{../id}}_{{id}}" value="{{id}}" type="checkbox">
</div> </div>
</td> </td>
{{/each}} {{/each}}
...@@ -545,8 +545,8 @@ ...@@ -545,8 +545,8 @@
{{#each questionChenColumn}} {{#each questionChenColumn}}
<td> <td>
<div class="dwQuChenFbkOptionItemContent"> <div class="dwQuChenFbkOptionItemContent">
<input type="hidden" class="dwChenInputTemp" disabled="disabled" value="{{rowId}}:{{id}}"> <input type="hidden" class="dwChenInputTemp" disabled="disabled" value="{{../id}}:{{id}}">
<input name="fbk_item_qu_{{quType}}_{{quId}}_{{rowId}}_{{id}}" class="inputSytle_1 dwChenMFillblankInput" type="text"> <input name="fbk_item_qu_{{quType}}_{{quId}}_{{../id}}_{{id}}" class="inputSytle_1 dwChenMFillblankInput" type="text">
<input type="hidden" class="answerTag" value="0" > <input type="hidden" class="answerTag" value="0" >
</div> </div>
</td> </td>
...@@ -605,8 +605,8 @@ ...@@ -605,8 +605,8 @@
{{#each questionChenColumn}} {{#each questionChenColumn}}
<td> <td>
<div class="dwQuScoreOptionItemContent"> <div class="dwQuScoreOptionItemContent">
<input type="hidden" class="dwChenInputTemp" disabled="disabled" value="{{rowId}}:{{id}}"> <input type="hidden" class="dwChenInputTemp" disabled="disabled" value="{{../id}}:{{id}}">
<select name="cs_item_qu_{{quType}}_{{quId}}_{{rowId}}_{{id}}" class="quChenScoreSelect" > <select name="cs_item_qu_{{quType}}_{{quId}}_{{../id}}_{{id}}" class="quChenScoreSelect" >
<option value="0">-评分-</option> <option value="0">-评分-</option>
{{#scoreNum001 5}}{{/scoreNum001}} {{#scoreNum001 5}}{{/scoreNum001}}
</select> </select>
...@@ -709,8 +709,9 @@ ...@@ -709,8 +709,9 @@
<li class="li_surveyQuItemBody surveyQu_{{#compare6 quType}}{{/compare6}}" style="{{#compare4 pageNo}}{{/compare4}}"> <li class="li_surveyQuItemBody surveyQu_{{#compare6 quType}}{{/compare6}}" style="{{#compare4 pageNo}}{{/compare4}}">
<div class="surveyQuItemBody"> <div class="surveyQuItemBody">
<div class="surveyQuItem"> <div class="surveyQuItem">
<input type="hidden" class="quType" value="submitSurveyBtn">
<div class="surveyQuItemContent" style="padding-top: 12px;height: 30px;min-height: 30px;"> <div class="surveyQuItemContent" style="padding-top: 12px;height: 30px;min-height: 30px;">
<a href="#" id="submitSurvey" class="sbtn24 sbtn24_0 submitSurvey" >&nbsp;</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="javascript:;" id="submitSurvey" class="sbtn24 sbtn24_0 submitSurvey" >&nbsp;</a>&nbsp;&nbsp;&nbsp;&nbsp;
{{#if pageNo}} {{#if pageNo}}
{{#compare3 pageNo 1}} {{#compare3 pageNo 1}}
<a href="#" class="sbtn24 sbtn24_1 prevPage_a">上一页</a> <a href="#" class="sbtn24 sbtn24_1 prevPage_a">上一页</a>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册