调整代码结构
This commit is contained in:
parent
cc943e2d2f
commit
d24cbb6dd5
@ -1,33 +0,0 @@
|
|||||||
package ink.wgink.properties.form;
|
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName: FormProperties
|
|
||||||
* @Description: 表单属性
|
|
||||||
* @Author: wanggeng
|
|
||||||
* @Date: 2022/3/10 4:17 PM
|
|
||||||
* @Version: 1.0
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "form")
|
|
||||||
public class FormProperties {
|
|
||||||
|
|
||||||
private String templatePath;
|
|
||||||
|
|
||||||
public String getTemplatePath() {
|
|
||||||
templatePath = templatePath == null ? "" : templatePath.trim();
|
|
||||||
if (!StringUtils.isEmpty(templatePath) && !templatePath.endsWith(File.separator)) {
|
|
||||||
templatePath += File.separator;
|
|
||||||
}
|
|
||||||
return templatePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTemplatePath(String templatePath) {
|
|
||||||
this.templatePath = templatePath;
|
|
||||||
}
|
|
||||||
}
|
|
@ -170,7 +170,8 @@ public class MediaManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
LinkedList<String> ffmpegCmds = new LinkedList<>(commonds);
|
LinkedList<String> ffmpegCmds = new LinkedList<>(commonds);
|
||||||
ffmpegCmds.addFirst(FFMPEG_PATH); // 设置ffmpeg程序所在路径
|
// 设置ffmpeg程序所在路径
|
||||||
|
ffmpegCmds.addFirst(FFMPEG_PATH);
|
||||||
LOG.info("--- 待执行的FFmpeg指令为:---" + ffmpegCmds);
|
LOG.info("--- 待执行的FFmpeg指令为:---" + ffmpegCmds);
|
||||||
|
|
||||||
Runtime runtime = Runtime.getRuntime();
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
@ -68,6 +68,13 @@ public class FormReportController extends DefaultBaseController {
|
|||||||
return formReportService.listPage(formCode, formVersion, page);
|
return formReportService.listPage(formCode, formVersion, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("listpage-all-fields/code/{formCode}/version/{formVersion}")
|
||||||
|
public SuccessResultList<List<Map<String, Object>>> listPageAllField(@PathVariable("formCode") String formCode, @PathVariable("formVersion") Integer formVersion, ListPage page) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return formReportService.listPageAllField(formCode, formVersion, page);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("list-show-field/code/{formCode}/version/{formVersion}")
|
@GetMapping("list-show-field/code/{formCode}/version/{formVersion}")
|
||||||
public List<String> listShowField(@PathVariable("formCode") String formCode, @PathVariable("formVersion") Integer formVersion) {
|
public List<String> listShowField(@PathVariable("formCode") String formCode, @PathVariable("formVersion") Integer formVersion) {
|
||||||
return formReportService.listShowField(formCode, formVersion);
|
return formReportService.listShowField(formCode, formVersion);
|
||||||
|
@ -20,13 +20,13 @@ public class FormDesignRouteController {
|
|||||||
|
|
||||||
@GetMapping("save")
|
@GetMapping("save")
|
||||||
public ModelAndView save() {
|
public ModelAndView save() {
|
||||||
ModelAndView mv = new ModelAndView("/form-design/save");
|
ModelAndView mv = new ModelAndView("form-design/save");
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("update")
|
@GetMapping("update")
|
||||||
public ModelAndView update() {
|
public ModelAndView update() {
|
||||||
ModelAndView mv = new ModelAndView("/form-design/update");
|
ModelAndView mv = new ModelAndView("form-design/update");
|
||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package ink.wgink.module.form.controller.route.report;
|
package ink.wgink.module.form.controller.route.report;
|
||||||
|
|
||||||
|
import ink.wgink.exceptions.SearchException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
|
import ink.wgink.module.form.pojo.pos.design.FormPO;
|
||||||
|
import ink.wgink.module.form.service.design.IFormFieldService;
|
||||||
|
import ink.wgink.module.form.service.design.IFormService;
|
||||||
import ink.wgink.module.form.service.report.IFormReportRouteService;
|
import ink.wgink.module.form.service.report.IFormReportRouteService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -8,10 +12,15 @@ import org.springframework.stereotype.Controller;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName: FormReportRouteController
|
* @ClassName: FormReportRouteController
|
||||||
@ -25,6 +34,10 @@ import javax.servlet.http.HttpSession;
|
|||||||
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/form-report")
|
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/form-report")
|
||||||
public class FormReportRouteController {
|
public class FormReportRouteController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IFormService formService;
|
||||||
|
@Autowired
|
||||||
|
private IFormFieldService formFieldService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IFormReportRouteService formReportService;
|
private IFormReportRouteService formReportService;
|
||||||
|
|
||||||
@ -39,20 +52,44 @@ public class FormReportRouteController {
|
|||||||
|
|
||||||
@GetMapping("update/code/{formCode}/version/{formVersion}")
|
@GetMapping("update/code/{formCode}/version/{formVersion}")
|
||||||
public void update(@PathVariable("formCode") String formCode,
|
public void update(@PathVariable("formCode") String formCode,
|
||||||
@PathVariable("formVersion") Integer formVersion,
|
@PathVariable("formVersion") Integer formVersion,
|
||||||
HttpSession httpSession,
|
HttpSession httpSession,
|
||||||
HttpServletRequest httpServletRequest,
|
HttpServletRequest httpServletRequest,
|
||||||
HttpServletResponse httpServletResponse) {
|
HttpServletResponse httpServletResponse) {
|
||||||
formReportService.update(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse);
|
formReportService.update(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("show/code/{formCode}/version/{formVersion}")
|
@GetMapping("show/code/{formCode}/version/{formVersion}")
|
||||||
public void show(@PathVariable("formCode") String formCode,
|
public void show(@PathVariable("formCode") String formCode,
|
||||||
@PathVariable("formVersion") Integer formVersion,
|
@PathVariable("formVersion") Integer formVersion,
|
||||||
HttpSession httpSession,
|
HttpSession httpSession,
|
||||||
HttpServletRequest httpServletRequest,
|
HttpServletRequest httpServletRequest,
|
||||||
HttpServletResponse httpServletResponse) {
|
HttpServletResponse httpServletResponse) {
|
||||||
formReportService.show(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse);
|
formReportService.show(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("list/code/{formCode}/version/{formVersion}")
|
||||||
|
public ModelAndView list(@PathVariable("formCode") String formCode,
|
||||||
|
@PathVariable("formVersion") Integer formVersion) {
|
||||||
|
FormPO formPO = formService.getPOByCodeAndVersion(formCode, formVersion);
|
||||||
|
if (formPO == null) {
|
||||||
|
throw new SearchException("表单不存在");
|
||||||
|
}
|
||||||
|
List<Map<String, String>> showFields = formFieldService.listByFormId(formPO.getFormId()).stream().map(
|
||||||
|
formFieldDTO -> {
|
||||||
|
Map<String, String> showField = new HashMap<>();
|
||||||
|
showField.put("fieldName", formFieldDTO.getFieldName());
|
||||||
|
showField.put("fieldExplain", formFieldDTO.getFieldExplain());
|
||||||
|
showField.put("fieldTag", formFieldDTO.getFieldTag());
|
||||||
|
return showField;
|
||||||
|
}
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
ModelAndView mv = new ModelAndView("form-report/list");
|
||||||
|
mv.addObject("formCode", formCode);
|
||||||
|
mv.addObject("formVersion", formVersion);
|
||||||
|
mv.addObject("formType", formPO.getFormType());
|
||||||
|
mv.addObject("showFields", showFields);
|
||||||
|
return mv;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,8 @@ public interface IFormFieldService {
|
|||||||
* 字段名列表
|
* 字段名列表
|
||||||
*
|
*
|
||||||
* @param formId 表单ID
|
* @param formId 表单ID
|
||||||
* @param listShow 列表显示状态
|
* @param isListShow 列表显示状态
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<String> listFieldNameByFormIdAndListShow(String formId, String listShow);
|
List<String> listFieldNameByFormIdAndListShow(String formId, Boolean isListShow);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import freemarker.template.Template;
|
|||||||
import freemarker.template.TemplateException;
|
import freemarker.template.TemplateException;
|
||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
import ink.wgink.exceptions.ParamsException;
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.exceptions.PropertiesException;
|
|
||||||
import ink.wgink.exceptions.base.SystemException;
|
import ink.wgink.exceptions.base.SystemException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.module.form.consts.IFormDesignConst;
|
import ink.wgink.module.form.consts.IFormDesignConst;
|
||||||
@ -21,7 +20,6 @@ import ink.wgink.module.form.pojo.vos.design.FormVO;
|
|||||||
import ink.wgink.module.form.service.design.IFormDesignService;
|
import ink.wgink.module.form.service.design.IFormDesignService;
|
||||||
import ink.wgink.module.form.service.design.IFormFieldService;
|
import ink.wgink.module.form.service.design.IFormFieldService;
|
||||||
import ink.wgink.module.form.service.design.IFormService;
|
import ink.wgink.module.form.service.design.IFormService;
|
||||||
import ink.wgink.properties.form.FormProperties;
|
|
||||||
import ink.wgink.util.HtmlHelper;
|
import ink.wgink.util.HtmlHelper;
|
||||||
import ink.wgink.util.date.DateUtil;
|
import ink.wgink.util.date.DateUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -45,8 +43,6 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class FormDesignServiceImpl extends DefaultBaseService implements IFormDesignService {
|
public class FormDesignServiceImpl extends DefaultBaseService implements IFormDesignService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FormProperties formProperties;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IFormService formService;
|
private IFormService formService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -60,9 +56,6 @@ public class FormDesignServiceImpl extends DefaultBaseService implements IFormDe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(FormDesignVO formDesignVO) throws IOException {
|
public void save(FormDesignVO formDesignVO) throws IOException {
|
||||||
if (StringUtils.isBlank(formProperties.getTemplatePath())) {
|
|
||||||
throw new PropertiesException("未配置模板路径");
|
|
||||||
}
|
|
||||||
List<FormFieldVO> formFields = new ArrayList<>();
|
List<FormFieldVO> formFields = new ArrayList<>();
|
||||||
setFormFieldList(formFields, formDesignVO.getData());
|
setFormFieldList(formFields, formDesignVO.getData());
|
||||||
if (formFields.isEmpty()) {
|
if (formFields.isEmpty()) {
|
||||||
|
@ -3,6 +3,7 @@ package ink.wgink.module.form.service.design.impl;
|
|||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.module.form.dao.design.IFormFieldDao;
|
import ink.wgink.module.form.dao.design.IFormFieldDao;
|
||||||
import ink.wgink.module.form.pojo.dtos.design.FormFieldDTO;
|
import ink.wgink.module.form.pojo.dtos.design.FormFieldDTO;
|
||||||
import ink.wgink.module.form.pojo.pos.design.FormFieldPO;
|
import ink.wgink.module.form.pojo.pos.design.FormFieldPO;
|
||||||
@ -121,10 +122,12 @@ public class FormFieldServiceImpl extends DefaultBaseService implements IFormFie
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> listFieldNameByFormIdAndListShow(String formId, String listShow) {
|
public List<String> listFieldNameByFormIdAndListShow(String formId, Boolean isListShow) {
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
params.put("formId", formId);
|
params.put("formId", formId);
|
||||||
params.put("listShow", listShow);
|
params.put("listShow", isListShow ? ISystemConstant.IS_TRUE : ISystemConstant.IS_FALSE);
|
||||||
return listFieldName(params);
|
return listFieldName(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,10 @@ public interface IFormReportService {
|
|||||||
|
|
||||||
SuccessResultList<List<Map<String, Object>>> listPage(String formCode, Integer formVersion, ListPage page);
|
SuccessResultList<List<Map<String, Object>>> listPage(String formCode, Integer formVersion, ListPage page);
|
||||||
|
|
||||||
|
SuccessResultList<List<Map<String, Object>>> listPageAllField(String formCode, Integer formVersion, ListPage page);
|
||||||
|
|
||||||
List<String> listShowField(String formCode, Integer formVersion);
|
List<String> listShowField(String formCode, Integer formVersion);
|
||||||
|
|
||||||
Integer count(String tableName);
|
Integer count(String tableName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import com.github.pagehelper.PageHelper;
|
|||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
import ink.wgink.exceptions.SearchException;
|
import ink.wgink.exceptions.SearchException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
|
||||||
import ink.wgink.module.form.dao.formreport.IFormReportDao;
|
import ink.wgink.module.form.dao.formreport.IFormReportDao;
|
||||||
import ink.wgink.module.form.enums.design.FormStatusEnum;
|
import ink.wgink.module.form.enums.design.FormStatusEnum;
|
||||||
import ink.wgink.module.form.pojo.pos.design.FormPO;
|
import ink.wgink.module.form.pojo.pos.design.FormPO;
|
||||||
@ -20,10 +19,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
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 java.util.ArrayList;
|
import java.sql.Timestamp;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -201,20 +198,52 @@ public class FormReportServiceImpl extends DefaultBaseService implements IFormRe
|
|||||||
public SuccessResultList<List<Map<String, Object>>> listPage(String formCode, Integer formVersion, ListPage page) {
|
public SuccessResultList<List<Map<String, Object>>> listPage(String formCode, Integer formVersion, ListPage page) {
|
||||||
FormPO formPO = formService.getPOByCodeAndVersion(formCode, formVersion);
|
FormPO formPO = formService.getPOByCodeAndVersion(formCode, formVersion);
|
||||||
checkForm(formPO);
|
checkForm(formPO);
|
||||||
|
|
||||||
List<String> queryList = conditionList(page.getParams());
|
List<String> queryList = conditionList(page.getParams());
|
||||||
Map<String, Object> queryParams = getHashMap(6);
|
Map<String, Object> queryParams = getListQueryParams(formPO, queryList);
|
||||||
queryParams.put(IFormDesignService.PARAM_FORM_CODE, formCode);
|
|
||||||
queryParams.put(IFormDesignService.PARAM_FORM_VERSION, formVersion);
|
|
||||||
queryParams.put(IFormDesignService.PARAM_QUERY_LIST, queryList);
|
|
||||||
queryParams.put(IFormDesignService.PARAM_LIST_SHOW_FIELD, listShowField(formPO));
|
queryParams.put(IFormDesignService.PARAM_LIST_SHOW_FIELD, listShowField(formPO));
|
||||||
|
return listPage(page, queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResultList<List<Map<String, Object>>> listPageAllField(String formCode, Integer formVersion, ListPage page) {
|
||||||
|
FormPO formPO = formService.getPOByCodeAndVersion(formCode, formVersion);
|
||||||
|
checkForm(formPO);
|
||||||
|
List<String> queryList = conditionList(page.getParams());
|
||||||
|
Map<String, Object> queryParams = getListQueryParams(formPO, queryList);
|
||||||
|
return listPage(page, queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SuccessResultList<List<Map<String, Object>>> listPage(ListPage page, Map<String, Object> queryParams) {
|
||||||
PageHelper.startPage(page.getPage(), page.getRows());
|
PageHelper.startPage(page.getPage(), page.getRows());
|
||||||
List<Map<String, Object>> mapList = formReportDao.list(queryParams);
|
List<Map<String, Object>> mapList = formReportDao.list(queryParams);
|
||||||
|
mapList.forEach(map -> {
|
||||||
|
if (map.containsKey(IFormDesignService.FIELD_GMT_CREATE) && map.get(IFormDesignService.FIELD_GMT_CREATE) != null) {
|
||||||
|
map.put(IFormDesignService.FIELD_GMT_CREATE, DateUtil.getDateTime(new Date(((Timestamp) map.get(IFormDesignService.FIELD_GMT_CREATE)).getTime())));
|
||||||
|
}
|
||||||
|
if (map.containsKey(IFormDesignService.FIELD_GMT_MODIFIED) && map.get(IFormDesignService.FIELD_GMT_MODIFIED) != null) {
|
||||||
|
map.put(IFormDesignService.FIELD_GMT_MODIFIED, DateUtil.getDateTime(new Date(((Timestamp) map.get(IFormDesignService.FIELD_GMT_MODIFIED)).getTime())));
|
||||||
|
}
|
||||||
|
});
|
||||||
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(mapList);
|
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(mapList);
|
||||||
return new SuccessResultList<>(mapList, pageInfo.getPageNum(), pageInfo.getTotal());
|
return new SuccessResultList<>(mapList, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取列表查询参数
|
||||||
|
*
|
||||||
|
* @param formCode
|
||||||
|
* @param formVersion
|
||||||
|
* @param queryList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<String, Object> getListQueryParams(FormPO formPO, List<String> queryList) {
|
||||||
|
Map<String, Object> queryParams = getHashMap(6);
|
||||||
|
queryParams.put(IFormDesignService.PARAM_FORM_CODE, formPO.getFormCode());
|
||||||
|
queryParams.put(IFormDesignService.PARAM_FORM_VERSION, formPO.getFormVersion());
|
||||||
|
queryParams.put(IFormDesignService.PARAM_QUERY_LIST, queryList);
|
||||||
|
return queryParams;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> listShowField(String formCode, Integer formVersion) {
|
public List<String> listShowField(String formCode, Integer formVersion) {
|
||||||
FormPO formPO = formService.getPOByCodeAndVersion(formCode, formVersion);
|
FormPO formPO = formService.getPOByCodeAndVersion(formCode, formVersion);
|
||||||
@ -249,7 +278,7 @@ public class FormReportServiceImpl extends DefaultBaseService implements IFormRe
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<String> listShowField(FormPO formPO) {
|
private List<String> listShowField(FormPO formPO) {
|
||||||
return formFieldService.listFieldNameByFormIdAndListShow(formPO.getFormId(), ISystemConstant.IS_TRUE);
|
return formFieldService.listFieldNameByFormIdAndListShow(formPO.getFormId(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,10 +66,17 @@
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<select id="list" parameterType="map" resultType="map">
|
<select id="list" parameterType="map" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
<foreach collection="listShowField" index="item" separator=",">
|
<choose>
|
||||||
|
<when test="listShowField != null and listShowField.size > 0">
|
||||||
|
<foreach collection="listShowField" index="item" separator=",">
|
||||||
${item}
|
${item}
|
||||||
</foreach>
|
</foreach>
|
||||||
uid
|
uid
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
*
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
FROM
|
FROM
|
||||||
df_${formCode}_v${formVersion}
|
df_${formCode}_v${formVersion}
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
<div class="layui-anim layui-anim-fadein">
|
||||||
<div class="layui-row">
|
<div class="layui-row">
|
||||||
<div class="layui-col-md12">
|
<div class="layui-col-md12">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
@ -45,27 +45,100 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript" th:inline="javascript">
|
||||||
layui.config({
|
layui.config({
|
||||||
base: 'assets/layuiadmin/'
|
base: 'assets/layuiadmin/'
|
||||||
}).extend({
|
}).extend({
|
||||||
index: 'lib/index'
|
index: 'lib/index'
|
||||||
}).use(['index', 'table', 'laydate', 'ztree'], function() {
|
}).use(['index', 'table', 'laydate', 'ztree', 'common'], function() {
|
||||||
var $ = layui.$;
|
var $ = layui.$;
|
||||||
var $win = $(window);
|
var $win = $(window);
|
||||||
var form = layui.form;
|
var form = layui.form;
|
||||||
var table = layui.table;
|
var table = layui.table;
|
||||||
var admin = layui.admin;
|
var admin = layui.admin;
|
||||||
var laydate = layui.laydate;
|
var laydate = layui.laydate;
|
||||||
|
var common = layui.common;
|
||||||
|
var formCode = [[${formCode}]];
|
||||||
|
var formVersion = [[${formVersion}]];
|
||||||
|
var showFields = [[${showFields}]];
|
||||||
|
|
||||||
// 初始化表格
|
// 初始化表格
|
||||||
function initTable() {
|
function initTable() {
|
||||||
|
console.log(showFields);
|
||||||
|
var cols = [
|
||||||
|
{type:'checkbox', fixed: 'left'},
|
||||||
|
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||||
|
{field:'MAIN_TITLE', width:200, title: '主标题', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(!rowData) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
for(var i = 0, showField; showField = showFields[i++];) {
|
||||||
|
cols.push(
|
||||||
|
{
|
||||||
|
field: showField.fieldName,
|
||||||
|
width:200,
|
||||||
|
title: showField.fieldExplain,
|
||||||
|
align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(!rowData) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
cols.push(
|
||||||
|
{field:'creator', width: 200, title: '创建人', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(!rowData) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'gmt_create', width: 180, title: '创建时间', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(!rowData) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'modifier', width: 200, title: '修改人', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(!rowData) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'gmt_modified', width: 180, title: '修改时间', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(!rowData) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
table.render({
|
table.render({
|
||||||
elem: '#dataTable',
|
elem: '#dataTable',
|
||||||
id: 'dataTable',
|
id: 'dataTable',
|
||||||
url: top.restAjax.path('api/form/listpage', []),
|
url: top.restAjax.path('api/form-report/listpage-all-fields/code/{formCode}/version/{formVersion}', [formCode, formVersion]),
|
||||||
width: admin.screen() > 1 ? '100%' : '',
|
width: admin.screen() > 1 ? '100%' : '',
|
||||||
height: $win.height() - 90,
|
height: $win.height() - 60,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
limits: [20, 40, 60, 80, 100, 200],
|
limits: [20, 40, 60, 80, 100, 200],
|
||||||
toolbar: '#headerToolBar',
|
toolbar: '#headerToolBar',
|
||||||
@ -73,12 +146,7 @@
|
|||||||
pageName: 'page',
|
pageName: 'page',
|
||||||
limitName: 'rows'
|
limitName: 'rows'
|
||||||
},
|
},
|
||||||
cols: [
|
cols: [cols],
|
||||||
[
|
|
||||||
{type:'checkbox', fixed: 'left'},
|
|
||||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
|
||||||
]
|
|
||||||
],
|
|
||||||
page: true,
|
page: true,
|
||||||
parseData: function(data) {
|
parseData: function(data) {
|
||||||
return {
|
return {
|
||||||
|
@ -143,7 +143,7 @@
|
|||||||
{field:'opition', width:210, title: '操作', fixed:'right', align:'center',
|
{field:'opition', width:210, title: '操作', fixed:'right', align:'center',
|
||||||
templet: function(item) {
|
templet: function(item) {
|
||||||
return '<div class="layui-btn-group">' +
|
return '<div class="layui-btn-group">' +
|
||||||
'<button type="button" class="layui-btn layui-btn-xs" lay-event="showFormEvent">数据列表</button>'+
|
'<button type="button" class="layui-btn layui-btn-xs" lay-event="reportListEvent">数据列表</button>'+
|
||||||
'<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="formFieldEvent">字段列表</button>'+
|
'<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="formFieldEvent">字段列表</button>'+
|
||||||
'<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event="deleteEvent" title="该操作将连同物理表(无数据)一并删除">物理删除</button>'+
|
'<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event="deleteEvent" title="该操作将连同物理表(无数据)一并删除">物理删除</button>'+
|
||||||
'</div>';
|
'</div>';
|
||||||
@ -321,8 +321,8 @@
|
|||||||
} else if(event === 'showFormEvent') {
|
} else if(event === 'showFormEvent') {
|
||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
title: '预览',
|
title: '预览',
|
||||||
url: top.restAjax.path('route/form-report/save/code/{formCode}/version/{formVersion}', [data.formCode, data.formVersion]),
|
url: top.restAjax.path('route/form-report/list?formCode={formCode}&formVersion={formVersion}', [data.formCode, data.formVersion]),
|
||||||
width: '50%',
|
width: '80%',
|
||||||
height: '80%',
|
height: '80%',
|
||||||
onClose: function () {
|
onClose: function () {
|
||||||
}
|
}
|
||||||
@ -330,8 +330,8 @@
|
|||||||
} else if(event === 'reportListEvent') {
|
} else if(event === 'reportListEvent') {
|
||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
title: '上报列表',
|
title: '上报列表',
|
||||||
url: top.restAjax.path('route/form-report?formCode={formCode}&version={formVersion}', [data.formCode, data.formVersion]),
|
url: top.restAjax.path('route/form-report/list/code/{formCode}/version/{formVersion}', [data.formCode, data.formVersion]),
|
||||||
width: '50%',
|
width: '70%',
|
||||||
height: '80%',
|
height: '80%',
|
||||||
onClose: function () {
|
onClose: function () {
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package ink.wgink.module.sms.pojo.vos.sms;
|
package ink.wgink.module.sms.pojo.vos.sms;
|
||||||
|
|
||||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
|
||||||
import ink.wgink.annotation.CheckListAnnotation;
|
import ink.wgink.annotation.CheckListAnnotation;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@ -15,23 +14,11 @@ import java.util.List;
|
|||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
**/
|
**/
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class SmsPhoneSendVO {
|
public class SmsPhoneSendVO extends SmsSendBaseVO {
|
||||||
|
|
||||||
@ApiModelProperty(name = "phones", value = "手机列表", required = true)
|
@ApiModelProperty(name = "phones", value = "手机列表", required = true)
|
||||||
@CheckListAnnotation(name = "手机列表")
|
@CheckListAnnotation(name = "手机列表")
|
||||||
private List<String> phones;
|
private List<String> phones;
|
||||||
@ApiModelProperty(name = "content", value = "发送内容", required = true)
|
|
||||||
@CheckEmptyAnnotation(name = "发送内容")
|
|
||||||
private String content;
|
|
||||||
@ApiModelProperty(name = "sendUserId", value = "发送人用户ID", required = true)
|
|
||||||
@CheckEmptyAnnotation(name = "发送人用户ID")
|
|
||||||
private String sendUserId;
|
|
||||||
@ApiModelProperty(name = "sendUserUsername", value = "发送人用户名", required = true)
|
|
||||||
@CheckEmptyAnnotation(name = "发送人用户名")
|
|
||||||
private String sendUserUsername;
|
|
||||||
@ApiModelProperty(name = "sendUserName", value = "发送人昵称", required = true)
|
|
||||||
@CheckEmptyAnnotation(name = "发送人昵称")
|
|
||||||
private String sendUserName;
|
|
||||||
|
|
||||||
public List<String> getPhones() {
|
public List<String> getPhones() {
|
||||||
return phones;
|
return phones;
|
||||||
@ -41,35 +28,4 @@ public class SmsPhoneSendVO {
|
|||||||
this.phones = phones;
|
this.phones = phones;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content == null ? "" : content.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSendUserId() {
|
|
||||||
return sendUserId == null ? "" : sendUserId.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSendUserId(String sendUserId) {
|
|
||||||
this.sendUserId = sendUserId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSendUserUsername() {
|
|
||||||
return sendUserUsername == null ? "" : sendUserUsername.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSendUserUsername(String sendUserUsername) {
|
|
||||||
this.sendUserUsername = sendUserUsername;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSendUserName() {
|
|
||||||
return sendUserName == null ? "" : sendUserName.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSendUserName(String sendUserName) {
|
|
||||||
this.sendUserName = sendUserName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package ink.wgink.module.sms.pojo.vos.sms;
|
||||||
|
|
||||||
|
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: SmsSendBaseVO
|
||||||
|
* @Description: 消息发送
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2022/4/23 11:51
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@ApiModel
|
||||||
|
public class SmsSendBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "content", value = "发送内容", required = true)
|
||||||
|
@CheckEmptyAnnotation(name = "发送内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content == null ? "" : content.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
|
sb.append("\"content\":\"")
|
||||||
|
.append(content).append('\"');
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -12,14 +12,12 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
**/
|
**/
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class SmsSendVO {
|
public class SmsSendVO extends SmsSendBaseVO {
|
||||||
|
|
||||||
@ApiModelProperty(name = "userIds", value = "用户ID列表(下划线分割)", required = true)
|
@ApiModelProperty(name = "userIds", value = "用户ID列表(下划线分割)", required = true)
|
||||||
@CheckEmptyAnnotation(name = "用户ID列表")
|
@CheckEmptyAnnotation(name = "用户ID列表")
|
||||||
private String userIds;
|
private String userIds;
|
||||||
@ApiModelProperty(name = "content", value = "发送内容", required = true)
|
|
||||||
@CheckEmptyAnnotation(name = "发送内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
public String getUserIds() {
|
public String getUserIds() {
|
||||||
return userIds == null ? "" : userIds.trim();
|
return userIds == null ? "" : userIds.trim();
|
||||||
@ -29,12 +27,4 @@ public class SmsSendVO {
|
|||||||
this.userIds = userIds;
|
this.userIds = userIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content == null ? "" : content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import ink.wgink.module.sms.manager.VerifyCodeManager;
|
|||||||
import ink.wgink.module.sms.pojo.dtos.sms.SmsDTO;
|
import ink.wgink.module.sms.pojo.dtos.sms.SmsDTO;
|
||||||
import ink.wgink.module.sms.pojo.pos.sms.SmsPO;
|
import ink.wgink.module.sms.pojo.pos.sms.SmsPO;
|
||||||
import ink.wgink.module.sms.pojo.vos.sms.SmsPhoneSendVO;
|
import ink.wgink.module.sms.pojo.vos.sms.SmsPhoneSendVO;
|
||||||
|
import ink.wgink.module.sms.pojo.vos.sms.SmsSendBaseVO;
|
||||||
import ink.wgink.module.sms.pojo.vos.sms.SmsSendVO;
|
import ink.wgink.module.sms.pojo.vos.sms.SmsSendVO;
|
||||||
import ink.wgink.module.sms.pojo.vos.sms.SmsVO;
|
import ink.wgink.module.sms.pojo.vos.sms.SmsVO;
|
||||||
import ink.wgink.module.sms.service.sms.ISmsService;
|
import ink.wgink.module.sms.service.sms.ISmsService;
|
||||||
@ -160,15 +161,8 @@ public class SmsServiceImpl extends DefaultBaseService implements ISmsService {
|
|||||||
public void send(SmsSendVO smsSendVO) {
|
public void send(SmsSendVO smsSendVO) {
|
||||||
List<String> userIds = Arrays.asList(smsSendVO.getUserIds().split("\\_"));
|
List<String> userIds = Arrays.asList(smsSendVO.getUserIds().split("\\_"));
|
||||||
List<UserDTO> userDTOs = userBaseService.listByUserIds(userIds);
|
List<UserDTO> userDTOs = userBaseService.listByUserIds(userIds);
|
||||||
for (UserDTO userDTO : userDTOs) {
|
|
||||||
if (!RegexUtil.isPhone(userDTO.getUserUsername())) {
|
|
||||||
throw new ParamsException(userDTO.getUserName() + " 的用户名不是手机号");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scheduledExecutorService.schedule(() -> {
|
scheduledExecutorService.schedule(() -> {
|
||||||
for (UserDTO userDTO : userDTOs) {
|
sendSms(userDTOs, smsSendVO);
|
||||||
sendContentByUserIdAndPhoneAndUserName(userDTO.getUserId(), userDTO.getUserUsername(), userDTO.getUserName(), smsSendVO.getContent());
|
|
||||||
}
|
|
||||||
}, 3, TimeUnit.SECONDS);
|
}, 3, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,11 +173,31 @@ public class SmsServiceImpl extends DefaultBaseService implements ISmsService {
|
|||||||
throw new ParamsException(phone + " 不是手机号");
|
throw new ParamsException(phone + " 不是手机号");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<UserDTO> userDTOs = userBaseService.listByUserPhones(smsPhoneSendVO.getPhones());
|
||||||
scheduledExecutorService.schedule(() -> {
|
scheduledExecutorService.schedule(() -> {
|
||||||
sendContentByUserIdAndPhoneAndUserName(smsPhoneSendVO.getSendUserId(), smsPhoneSendVO.getSendUserUsername(), smsPhoneSendVO.getSendUserName(), smsPhoneSendVO.getContent());
|
sendSms(userDTOs, smsPhoneSendVO);
|
||||||
}, 3, TimeUnit.SECONDS);
|
}, 3, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送短信
|
||||||
|
*
|
||||||
|
* @param userDTOs
|
||||||
|
*/
|
||||||
|
private void sendSms(List<UserDTO> userDTOs, SmsSendBaseVO smsSendBaseVO) {
|
||||||
|
userDTOs.forEach(userDTO -> {
|
||||||
|
if (StringUtils.isBlank(userDTO.getUserPhone())) {
|
||||||
|
LOG.info("用户 {}:{} 手机号为空", userDTO.getUserId(), userDTO.getUserUsername());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!RegexUtil.isPhone(userDTO.getUserPhone())) {
|
||||||
|
LOG.info("用户 {}:{} 手机号格式错误", userDTO.getUserId(), userDTO.getUserUsername());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sendContentByUserIdAndPhoneAndUserName(userDTO.getUserId(), userDTO.getUserPhone(), userDTO.getUserName(), smsSendBaseVO.getContent());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SmsPO> listPO(Map<String, Object> params) {
|
public List<SmsPO> listPO(Map<String, Object> params) {
|
||||||
return smsDao.listPO(params);
|
return smsDao.listPO(params);
|
||||||
|
Loading…
Reference in New Issue
Block a user