增加文号管理

This commit is contained in:
wanggeng 2022-06-29 17:29:47 +08:00
parent 20dbc2faa6
commit 472cb217c6
27 changed files with 3867 additions and 0 deletions

View File

@ -0,0 +1,129 @@
package ink.wgink.module.form.controller.api.docno;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.module.form.pojo.bos.docno.DocNoBO;
import ink.wgink.module.form.pojo.dtos.docno.DocNoDTO;
import ink.wgink.module.form.pojo.vos.docno.DocNoVO;
import ink.wgink.module.form.service.docno.IDocNoService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: DocNoController
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "文号接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/doc-no")
public class DocNoController extends DefaultBaseController {
@Autowired
private IDocNoService docNoService;
@ApiOperation(value = "新增文号", notes = "新增文号接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")
@CheckRequestBodyAnnotation
public SuccessResult save(@RequestBody DocNoVO docNoVO) {
docNoService.save(docNoVO);
return new SuccessResult();
}
@ApiOperation(value = "删除文号", notes = "删除文号接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("remove/{ids}")
public SuccessResult remove(@PathVariable("ids") String ids) {
docNoService.remove(Arrays.asList(ids.split("\\_")));
return new SuccessResult();
}
@ApiOperation(value = "修改文号", notes = "修改文号接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "docNoId", value = "文号ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update/{docNoId}")
@CheckRequestBodyAnnotation
public SuccessResult update(@PathVariable("docNoId") String docNoId, @RequestBody DocNoVO docNoVO) {
docNoService.update(docNoId, docNoVO);
return new SuccessResult();
}
@ApiOperation(value = "文号详情", notes = "文号详情接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "docNoId", value = "文号ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{docNoId}")
public DocNoDTO get(@PathVariable("docNoId") String docNoId) {
return docNoService.get(docNoId);
}
@ApiOperation(value = "文号列表", notes = "文号列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list")
public List<DocNoDTO> list() {
Map<String, Object> params = requestParams();
return docNoService.list(params);
}
@ApiOperation(value = "文号分页列表", notes = "文号分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage")
public SuccessResultList<List<DocNoDTO>> listPage(ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return docNoService.listPage(page);
}
@ApiOperation(value = "文号统计", notes = "文号统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("count")
SuccessResultData<Integer> count() {
Map<String, Object> params = requestParams();
return new SuccessResultData<>(docNoService.count(params));
}
@ApiOperation(value = "获取最新文号", notes = "获取最新文号接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "docNoId", value = "文号ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-latest-doc-no/{docNoId}")
public SuccessResultData<String> getLatestDocNo(@PathVariable("docNoId") String docNoId) {
DocNoBO latestNewDocNoBO = docNoService.getLatestNewDocNoBO(docNoId);
String latestDocNo;
if (latestNewDocNoBO == null) {
latestDocNo = "";
} else {
latestDocNo = latestNewDocNoBO.getDocNoFull();
}
return new SuccessResultData<>(latestDocNo);
}
}

View File

@ -0,0 +1,121 @@
package ink.wgink.module.form.controller.app.api.docno;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.module.form.pojo.dtos.docno.DocNoDTO;
import ink.wgink.module.form.pojo.vos.docno.DocNoVO;
import ink.wgink.module.form.service.docno.IDocNoService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultData;
import ink.wgink.pojo.result.SuccessResultList;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: DocNoAppController
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "文号接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/doc-no")
public class DocNoAppController extends DefaultBaseController {
@Autowired
private IDocNoService docNoService;
@ApiOperation(value = "新增文号", notes = "新增文号接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")
@CheckRequestBodyAnnotation
public SuccessResult save(@RequestHeader("token") String token, @RequestBody DocNoVO docNoVO) {
docNoService.save(token, docNoVO);
return new SuccessResult();
}
@ApiOperation(value = "删除文号(id列表)", notes = "删除文号(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("remove/{ids}")
public SuccessResult remove(@RequestHeader("token") String token, @PathVariable("ids") String ids) {
docNoService.remove(token, Arrays.asList(ids.split("\\_")));
return new SuccessResult();
}
@ApiOperation(value = "修改文号", notes = "修改文号接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "docNoId", value = "文号ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update/{docNoId}")
@CheckRequestBodyAnnotation
public SuccessResult updateDocNo(@RequestHeader("token") String token, @PathVariable("docNoId") String docNoId, @RequestBody DocNoVO docNoVO) {
docNoService.update(token, docNoId, docNoVO);
return new SuccessResult();
}
@ApiOperation(value = "文号详情(通过ID)", notes = "文号详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "docNoId", value = "文号ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{docNoId}")
public DocNoDTO get(@RequestHeader("token") String token, @PathVariable("docNoId") String docNoId) {
return docNoService.get(docNoId);
}
@ApiOperation(value = "文号列表", notes = "文号列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list")
public List<DocNoDTO> list(@RequestHeader("token") String token) {
Map<String, Object> params = requestParams();
return docNoService.list(params);
}
@ApiOperation(value = "文号分页列表", notes = "文号分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage")
public SuccessResultList<List<DocNoDTO>> listPage(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
page.setParams(params);
return docNoService.listPage(page);
}
@ApiOperation(value = "文号统计", notes = "文号统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("count")
SuccessResultData<Integer> count() {
Map<String, Object> params = requestParams();
return new SuccessResultData<>(docNoService.count(params));
}
}

View File

@ -0,0 +1,38 @@
package ink.wgink.module.form.controller.route.docno;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* @ClassName: DocNoController
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "文号路由")
@RestController
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/doc-no")
public class DocNoRouteController extends DefaultBaseController {
@GetMapping("save")
public ModelAndView save() {
return new ModelAndView("doc-no/save");
}
@GetMapping("update")
public ModelAndView update() {
return new ModelAndView("doc-no/update");
}
@GetMapping("list")
public ModelAndView list() {
return new ModelAndView("doc-no/list");
}
}

View File

@ -0,0 +1,38 @@
package ink.wgink.module.form.controller.route.docnolog;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* @ClassName: DocNoLogController
* @Description: 文号日志
* @Author: CodeFactory
* @Date: 2022-06-29 11:25:56
* @Version: 3.0
**/
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "文号日志路由")
@RestController
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/doc-no-log")
public class DocNoLogRouteController extends DefaultBaseController {
@GetMapping("save")
public ModelAndView save() {
return new ModelAndView("doc-no-log/save");
}
@GetMapping("update")
public ModelAndView update() {
return new ModelAndView("doc-no-log/update");
}
@GetMapping("list")
public ModelAndView list() {
return new ModelAndView("doc-no-log/list");
}
}

View File

@ -0,0 +1,101 @@
package ink.wgink.module.form.dao.docno;
import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException;
import ink.wgink.exceptions.UpdateException;
import ink.wgink.module.form.pojo.dtos.docno.DocNoDTO;
import ink.wgink.module.form.pojo.pos.docno.DocNoPO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IDocNoDao
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
@Repository
public interface IDocNoDao {
/**
* 新增文号
*
* @param params
* @throws SaveException
*/
void save(Map<String, Object> params) throws SaveException;
/**
* 删除文号
*
* @param params
* @throws RemoveException
*/
void remove(Map<String, Object> params) throws RemoveException;
/**
* 删除文号物理
*
* @param params
* @throws RemoveException
*/
void delete(Map<String, Object> params) throws RemoveException;
/**
* 修改文号
*
* @param params
* @throws UpdateException
*/
void update(Map<String, Object> params) throws UpdateException;
/**
* 文号详情
*
* @param params
* @return
* @throws SearchException
*/
DocNoDTO get(Map<String, Object> params) throws SearchException;
/**
* 文号详情
*
* @param params
* @return
* @throws SearchException
*/
DocNoPO getPO(Map<String, Object> params) throws SearchException;
/**
* 文号列表
*
* @param params
* @return
* @throws SearchException
*/
List<DocNoDTO> list(Map<String, Object> params) throws SearchException;
/**
* 文号列表
*
* @param params
* @return
* @throws SearchException
*/
List<DocNoPO> listPO(Map<String, Object> params) throws SearchException;
/**
* 文号统计
*
* @param params
* @return
* @throws SearchException
*/
Integer count(Map<String, Object> params) throws SearchException;
}

View File

@ -0,0 +1,102 @@
package ink.wgink.module.form.dao.docnolog;
import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException;
import ink.wgink.exceptions.UpdateException;
import ink.wgink.module.form.pojo.dtos.docnolog.DocNoLogDTO;
import ink.wgink.module.form.pojo.pos.docnolog.DocNoLogPO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IDocNoLogDao
* @Description: 文号日志
* @Author: CodeFactory
* @Date: 2022-06-29 14:19:06
* @Version: 3.0
**/
@Repository
public interface IDocNoLogDao {
/**
* 新增文号日志
*
* @param params
* @throws SaveException
*/
void save(Map<String, Object> params) throws SaveException;
/**
* 删除文号日志物理
*
* @param params
* @throws RemoveException
*/
void delete(Map<String, Object> params) throws RemoveException;
/**
* 修改文号日志
*
* @param params
* @throws UpdateException
*/
void update(Map<String, Object> params) throws UpdateException;
/**
* 文号日志详情
*
* @param params
* @return
* @throws SearchException
*/
DocNoLogDTO get(Map<String, Object> params) throws SearchException;
/**
* 文号日志详情
*
* @param params
* @return
* @throws SearchException
*/
DocNoLogPO getPO(Map<String, Object> params) throws SearchException;
/**
* 文号日志列表
*
* @param params
* @return
* @throws SearchException
*/
List<DocNoLogDTO> list(Map<String, Object> params) throws SearchException;
/**
* 文号日志列表
*
* @param params
* @return
* @throws SearchException
*/
List<DocNoLogPO> listPO(Map<String, Object> params) throws SearchException;
/**
* 文号日志统计
*
* @param params
* @return
* @throws SearchException
*/
Integer count(Map<String, Object> params) throws SearchException;
/**
* 获取最新的文号日志
*
* @param params
* @return
* @throws SearchException
*/
DocNoLogPO getLatestPO(Map<String, Object> params) throws SearchException;
}

View File

@ -0,0 +1,32 @@
package ink.wgink.module.form.enums.docno;
/**
* @ClassName: DocNoTypeEnum
* @Description: 文号类型枚举
* @Author: wanggeng
* @Date: 2022/6/24 15:17
* @Version: 1.0
*/
public enum DocNoTypeEnum {
ALWAYS("always", "一直累加"),
YEAR("year", "按年累加"),
MONTH("month", "按月累加"),
DAY("day", "按日累加"),
MANUAL("manual", "手动");
private String value;
private String text;
DocNoTypeEnum(String value, String text) {
this.value = value;
this.text = text;
}
public String getValue() {
return value == null ? "" : value.trim();
}
public String getText() {
return text == null ? "" : text.trim();
}
}

View File

@ -0,0 +1,57 @@
package ink.wgink.module.form.pojo.bos.docno;
/**
* @ClassName: DocNoBO
* @Description: 文号
* @Author: wanggeng
* @Date: 2022/6/29 16:46
* @Version: 1.0
*/
public class DocNoBO {
private Integer docNoYear;
private Integer docNoMonth;
private Integer docNoDay;
private Integer docNoNu;
private String docNoFull;
public Integer getDocNoYear() {
return docNoYear == null ? 0 : docNoYear;
}
public void setDocNoYear(Integer docNoYear) {
this.docNoYear = docNoYear;
}
public Integer getDocNoMonth() {
return docNoMonth == null ? 0 : docNoMonth;
}
public void setDocNoMonth(Integer docNoMonth) {
this.docNoMonth = docNoMonth;
}
public Integer getDocNoDay() {
return docNoDay == null ? 0 : docNoDay;
}
public void setDocNoDay(Integer docNoDay) {
this.docNoDay = docNoDay;
}
public Integer getDocNoNu() {
return docNoNu == null ? 0 : docNoNu;
}
public void setDocNoNu(Integer docNoNu) {
this.docNoNu = docNoNu;
}
public String getDocNoFull() {
return docNoFull == null ? "" : docNoFull.trim();
}
public void setDocNoFull(String docNoFull) {
this.docNoFull = docNoFull;
}
}

View File

@ -0,0 +1,139 @@
package ink.wgink.module.form.pojo.dtos.docno;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: DocNoDTO
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
@ApiModel
public class DocNoDTO {
@ApiModelProperty(name = "docNoId", value = "主键")
private String docNoId;
@ApiModelProperty(name = "title", value = "标题")
private String title;
@ApiModelProperty(name = "summary", value = "描述")
private String summary;
@ApiModelProperty(name = "type", value = "类型always一直累加year按年累加month按月累加day按日累加manual手动")
private String type;
@ApiModelProperty(name = "template", value = "模板")
private String template;
@ApiModelProperty(name = "startNu", value = "开始编号")
private Integer startNu;
@ApiModelProperty(name = "nuLength", value = "编号长度")
private Integer nuLength;
@ApiModelProperty(name = "latestDocNo", value = "最新文号")
private String latestDocNo;
@ApiModelProperty(name = "isActive", value = "是否激活")
private Integer isActive;
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
private String gmtCreate;
@ApiModelProperty(name = "creator", value = "创建人")
private String creator;
@ApiModelProperty(name = "gmtModified", value = "修改时间")
private String gmtModified;
public String getDocNoId() {
return docNoId == null ? "" : docNoId.trim();
}
public void setDocNoId(String docNoId) {
this.docNoId = docNoId;
}
public String getTitle() {
return title == null ? "" : title.trim();
}
public void setTitle(String title) {
this.title = title;
}
public String getSummary() {
return summary == null ? "" : summary.trim();
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getType() {
return type == null ? "" : type.trim();
}
public void setType(String type) {
this.type = type;
}
public String getTemplate() {
return template == null ? "" : template.trim();
}
public void setTemplate(String template) {
this.template = template;
}
public Integer getStartNu() {
return startNu == null ? 0 : startNu;
}
public void setStartNu(Integer startNu) {
this.startNu = startNu;
}
public Integer getNuLength() {
return nuLength == null ? 0 : nuLength;
}
public void setNuLength(Integer nuLength) {
this.nuLength = nuLength;
}
public String getLatestDocNo() {
return latestDocNo == null ? "" : latestDocNo.trim();
}
public void setLatestDocNo(String latestDocNo) {
this.latestDocNo = latestDocNo;
}
public Integer getIsActive() {
return isActive == null ? 0 : isActive;
}
public void setIsActive(Integer isActive) {
this.isActive = isActive;
}
public String getGmtCreate() {
return gmtCreate == null ? "" : gmtCreate.trim();
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getCreator() {
return creator == null ? "" : creator.trim();
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtModified() {
return gmtModified == null ? "" : gmtModified.trim();
}
public void setGmtModified(String gmtModified) {
this.gmtModified = gmtModified;
}
}

View File

@ -0,0 +1,109 @@
package ink.wgink.module.form.pojo.dtos.docnolog;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: DocNoLogDTO
* @Description: 文号日志
* @Author: CodeFactory
* @Date: 2022-06-29 14:19:06
* @Version: 3.0
**/
@ApiModel
public class DocNoLogDTO {
@ApiModelProperty(name = "docNoLogId", value = "主键")
private String docNoLogId;
@ApiModelProperty(name = "docNoId", value = "文号ID")
private String docNoId;
@ApiModelProperty(name = "docNoUsedId", value = "使用ID同一类的文号相同")
private String docNoUsedId;
@ApiModelProperty(name = "docNoYear", value = "文号年")
private Integer docNoYear;
@ApiModelProperty(name = "docNoMonth", value = "文号月")
private Integer docNoMonth;
@ApiModelProperty(name = "docNoDay", value = "文号日")
private Integer docNoDay;
@ApiModelProperty(name = "docNoNu", value = "文号")
private Integer docNoNu;
@ApiModelProperty(name = "docNoFull", value = "完整文号")
private String docNoFull;
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
private String gmtCreate;
public String getDocNoLogId() {
return docNoLogId == null ? "" : docNoLogId.trim();
}
public void setDocNoLogId(String docNoLogId) {
this.docNoLogId = docNoLogId;
}
public String getDocNoId() {
return docNoId == null ? "" : docNoId.trim();
}
public void setDocNoId(String docNoId) {
this.docNoId = docNoId;
}
public String getDocNoUsedId() {
return docNoUsedId == null ? "" : docNoUsedId.trim();
}
public void setDocNoUsedId(String docNoUsedId) {
this.docNoUsedId = docNoUsedId;
}
public Integer getDocNoYear() {
return docNoYear == null ? 0 : docNoYear;
}
public void setDocNoYear(Integer docNoYear) {
this.docNoYear = docNoYear;
}
public Integer getDocNoMonth() {
return docNoMonth == null ? 0 : docNoMonth;
}
public void setDocNoMonth(Integer docNoMonth) {
this.docNoMonth = docNoMonth;
}
public Integer getDocNoDay() {
return docNoDay == null ? 0 : docNoDay;
}
public void setDocNoDay(Integer docNoDay) {
this.docNoDay = docNoDay;
}
public Integer getDocNoNu() {
return docNoNu == null ? 0 : docNoNu;
}
public void setDocNoNu(Integer docNoNu) {
this.docNoNu = docNoNu;
}
public String getDocNoFull() {
return docNoFull == null ? "" : docNoFull.trim();
}
public void setDocNoFull(String docNoFull) {
this.docNoFull = docNoFull;
}
public String getGmtCreate() {
return gmtCreate == null ? "" : gmtCreate.trim();
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
}

View File

@ -0,0 +1,132 @@
package ink.wgink.module.form.pojo.pos.docno;
/**
*
* @ClassName: DocNoPO
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
public class DocNoPO {
private String docNoId;
private String title;
private String summary;
private String type;
private String template;
private Integer startNu;
private Integer nuLength;
private Integer isActive;
private String gmtCreate;
private String creator;
private String gmtModified;
private String modifier;
private Integer isDelete;
public String getDocNoId() {
return docNoId == null ? "" : docNoId.trim();
}
public void setDocNoId(String docNoId) {
this.docNoId = docNoId;
}
public String getTitle() {
return title == null ? "" : title.trim();
}
public void setTitle(String title) {
this.title = title;
}
public String getSummary() {
return summary == null ? "" : summary.trim();
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getType() {
return type == null ? "" : type.trim();
}
public void setType(String type) {
this.type = type;
}
public String getTemplate() {
return template == null ? "" : template.trim();
}
public void setTemplate(String template) {
this.template = template;
}
public Integer getStartNu() {
return startNu == null ? 0 : startNu;
}
public void setStartNu(Integer startNu) {
this.startNu = startNu;
}
public Integer getNuLength() {
return nuLength == null ? 0 : nuLength;
}
public void setNuLength(Integer nuLength) {
this.nuLength = nuLength;
}
public Integer getIsActive() {
return isActive == null ? 0 : isActive;
}
public void setIsActive(Integer isActive) {
this.isActive = isActive;
}
public String getGmtCreate() {
return gmtCreate == null ? "" : gmtCreate.trim();
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getCreator() {
return creator == null ? "" : creator.trim();
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getGmtModified() {
return gmtModified == null ? "" : gmtModified.trim();
}
public void setGmtModified(String gmtModified) {
this.gmtModified = gmtModified;
}
public String getModifier() {
return modifier == null ? "" : modifier.trim();
}
public void setModifier(String modifier) {
this.modifier = modifier;
}
public Integer getIsDelete() {
return isDelete == null ? 0 : isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
}

View File

@ -0,0 +1,105 @@
package ink.wgink.module.form.pojo.pos.docnolog;
/**
*
* @ClassName: DocNoLogPO
* @Description: 文号日志
* @Author: CodeFactory
* @Date: 2022-06-29 14:19:06
* @Version: 3.0
**/
public class DocNoLogPO {
private String docNoLogId;
private String docNoId;
private String docNoUsedId;
private Integer docNoYear;
private Integer docNoMonth;
private Integer docNoDay;
private Integer docNoNu;
private String docNoFull;
private String gmtCreate;
private String creator;
public String getDocNoLogId() {
return docNoLogId == null ? "" : docNoLogId.trim();
}
public void setDocNoLogId(String docNoLogId) {
this.docNoLogId = docNoLogId;
}
public String getDocNoId() {
return docNoId == null ? "" : docNoId.trim();
}
public void setDocNoId(String docNoId) {
this.docNoId = docNoId;
}
public String getDocNoUsedId() {
return docNoUsedId == null ? "" : docNoUsedId.trim();
}
public void setDocNoUsedId(String docNoUsedId) {
this.docNoUsedId = docNoUsedId;
}
public Integer getDocNoYear() {
return docNoYear == null ? 0 : docNoYear;
}
public void setDocNoYear(Integer docNoYear) {
this.docNoYear = docNoYear;
}
public Integer getDocNoMonth() {
return docNoMonth == null ? 0 : docNoMonth;
}
public void setDocNoMonth(Integer docNoMonth) {
this.docNoMonth = docNoMonth;
}
public Integer getDocNoDay() {
return docNoDay == null ? 0 : docNoDay;
}
public void setDocNoDay(Integer docNoDay) {
this.docNoDay = docNoDay;
}
public Integer getDocNoNu() {
return docNoNu == null ? 0 : docNoNu;
}
public void setDocNoNu(Integer docNoNu) {
this.docNoNu = docNoNu;
}
public String getDocNoFull() {
return docNoFull == null ? "" : docNoFull.trim();
}
public void setDocNoFull(String docNoFull) {
this.docNoFull = docNoFull;
}
public String getGmtCreate() {
return gmtCreate == null ? "" : gmtCreate.trim();
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getCreator() {
return creator == null ? "" : creator.trim();
}
public void setCreator(String creator) {
this.creator = creator;
}
}

View File

@ -0,0 +1,96 @@
package ink.wgink.module.form.pojo.vos.docno;
import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.annotation.CheckNumberAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: DocNoVO
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
@ApiModel
public class DocNoVO {
@ApiModelProperty(name = "title", value = "标题")
@CheckEmptyAnnotation(name = "标题")
private String title;
@ApiModelProperty(name = "summary", value = "描述")
private String summary;
@ApiModelProperty(name = "type", value = "类型always一直累加year按年累加month按月累加day按日累加manual手动")
@CheckEmptyAnnotation(name = "类型", types = {"always", "year", "month", "day", "manual"})
private String type;
@ApiModelProperty(name = "template", value = "模板")
@CheckEmptyAnnotation(name = "模板")
private String template;
@ApiModelProperty(name = "startNu", value = "开始编号")
@CheckNumberAnnotation(name = "开始编号")
private Integer startNu;
@ApiModelProperty(name = "nuLength", value = "编号长度")
@CheckNumberAnnotation(name = "编号长度")
private Integer nuLength;
@ApiModelProperty(name = "isActive", value = "是否激活")
@CheckNumberAnnotation(name = "是否激活", types = {"0", "1"})
private Integer isActive;
public String getTitle() {
return title == null ? "" : title.trim();
}
public void setTitle(String title) {
this.title = title;
}
public String getSummary() {
return summary == null ? "" : summary.trim();
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getType() {
return type == null ? "" : type.trim();
}
public void setType(String type) {
this.type = type;
}
public String getTemplate() {
return template == null ? "" : template.trim();
}
public void setTemplate(String template) {
this.template = template;
}
public Integer getStartNu() {
return startNu == null ? 0 : startNu;
}
public void setStartNu(Integer startNu) {
this.startNu = startNu;
}
public Integer getNuLength() {
return nuLength == null ? 0 : nuLength;
}
public void setNuLength(Integer nuLength) {
this.nuLength = nuLength;
}
public Integer getIsActive() {
return isActive == null ? 0 : isActive;
}
public void setIsActive(Integer isActive) {
this.isActive = isActive;
}
}

View File

@ -0,0 +1,94 @@
package ink.wgink.module.form.pojo.vos.docnolog;
import ink.wgink.annotation.CheckNumberAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: DocNoLogVO
* @Description: 文号日志
* @Author: CodeFactory
* @Date: 2022-06-29 14:19:06
* @Version: 3.0
**/
@ApiModel
public class DocNoLogVO {
@ApiModelProperty(name = "docNoId", value = "文号ID")
private String docNoId;
@ApiModelProperty(name = "docNoUsedId", value = "使用ID同一类的文号相同")
private String docNoUsedId;
@ApiModelProperty(name = "docNoYear", value = "文号年")
@CheckNumberAnnotation(name = "文号年")
private Integer docNoYear;
@ApiModelProperty(name = "docNoMonth", value = "文号月")
@CheckNumberAnnotation(name = "文号月")
private Integer docNoMonth;
@ApiModelProperty(name = "docNoDay", value = "文号日")
@CheckNumberAnnotation(name = "文号日")
private Integer docNoDay;
@ApiModelProperty(name = "docNoNu", value = "文号")
@CheckNumberAnnotation(name = "文号")
private Integer docNoNu;
@ApiModelProperty(name = "docNoFull", value = "完整文号")
private String docNoFull;
public String getDocNoId() {
return docNoId == null ? "" : docNoId.trim();
}
public void setDocNoId(String docNoId) {
this.docNoId = docNoId;
}
public String getDocNoUsedId() {
return docNoUsedId == null ? "" : docNoUsedId.trim();
}
public void setDocNoUsedId(String docNoUsedId) {
this.docNoUsedId = docNoUsedId;
}
public Integer getDocNoYear() {
return docNoYear == null ? 0 : docNoYear;
}
public void setDocNoYear(Integer docNoYear) {
this.docNoYear = docNoYear;
}
public Integer getDocNoMonth() {
return docNoMonth == null ? 0 : docNoMonth;
}
public void setDocNoMonth(Integer docNoMonth) {
this.docNoMonth = docNoMonth;
}
public Integer getDocNoDay() {
return docNoDay == null ? 0 : docNoDay;
}
public void setDocNoDay(Integer docNoDay) {
this.docNoDay = docNoDay;
}
public Integer getDocNoNu() {
return docNoNu == null ? 0 : docNoNu;
}
public void setDocNoNu(Integer docNoNu) {
this.docNoNu = docNoNu;
}
public String getDocNoFull() {
return docNoFull == null ? "" : docNoFull.trim();
}
public void setDocNoFull(String docNoFull) {
this.docNoFull = docNoFull;
}
}

View File

@ -0,0 +1,182 @@
package ink.wgink.module.form.service.docno;
import ink.wgink.module.form.pojo.bos.docno.DocNoBO;
import ink.wgink.module.form.pojo.dtos.docno.DocNoDTO;
import ink.wgink.module.form.pojo.pos.docno.DocNoPO;
import ink.wgink.module.form.pojo.vos.docno.DocNoVO;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IDocNoService
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
public interface IDocNoService {
/**
* 新增文号
*
* @param docNoVO
* @return
*/
void save(DocNoVO docNoVO);
/**
* 新增文号
*
* @param token
* @param docNoVO
* @return
*/
void save(String token, DocNoVO docNoVO);
/**
* 新增文号
*
* @param docNoVO
* @return docNoId
*/
String saveReturnId(DocNoVO docNoVO);
/**
* 新增文号
*
* @param token
* @param docNoVO
* @return docNoId
*/
String saveReturnId(String token, DocNoVO docNoVO);
/**
* 删除文号
*
* @param ids id列表
* @return
*/
void remove(List<String> ids);
/**
* 删除文号
*
* @param token
* @param ids id列表
* @return
*/
void remove(String token, List<String> ids);
/**
* 删除文号物理删除
*
* @param ids id列表
*/
void delete(List<String> ids);
/**
* 修改文号
*
* @param docNoId
* @param docNoVO
* @return
*/
void update(String docNoId, DocNoVO docNoVO);
/**
* 修改文号
*
* @param token
* @param docNoId
* @param docNoVO
* @return
*/
void update(String token, String docNoId, DocNoVO docNoVO);
/**
* 文号详情
*
* @param params 参数Map
* @return
*/
DocNoDTO get(Map<String, Object> params);
/**
* 文号详情
*
* @param docNoId
* @return
*/
DocNoDTO get(String docNoId);
/**
* 文号详情
*
* @param params 参数Map
* @return
*/
DocNoPO getPO(Map<String, Object> params);
/**
* 文号详情
*
* @param docNoId
* @return
*/
DocNoPO getPO(String docNoId);
/**
* 文号列表
*
* @param params
* @return
*/
List<DocNoDTO> list(Map<String, Object> params);
/**
* 文号列表
*
* @param params
* @return
*/
List<DocNoPO> listPO(Map<String, Object> params);
/**
* 文号分页列表
*
* @param page
* @return
*/
SuccessResultList<List<DocNoDTO>> listPage(ListPage page);
/**
* 文号统计
*
* @param params
* @return
*/
Integer count(Map<String, Object> params);
/**
* 获取最新文号
*
* @param docNoId
* @return
*/
DocNoBO getLatestNewDocNoBO(String docNoId);
/**
* 保存并返回新的文号
*
* @param docNoId
* @param docNoUsedId
* @return
*/
String saveAndReturnLatestDocNo(String docNoId, String docNoUsedId);
}

View File

@ -0,0 +1,266 @@
package ink.wgink.module.form.service.docno.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.SearchException;
import ink.wgink.module.form.dao.docno.IDocNoDao;
import ink.wgink.module.form.enums.docno.DocNoTypeEnum;
import ink.wgink.module.form.pojo.bos.docno.DocNoBO;
import ink.wgink.module.form.pojo.dtos.docno.DocNoDTO;
import ink.wgink.module.form.pojo.pos.docno.DocNoPO;
import ink.wgink.module.form.pojo.pos.docnolog.DocNoLogPO;
import ink.wgink.module.form.pojo.vos.docno.DocNoVO;
import ink.wgink.module.form.pojo.vos.docnolog.DocNoLogVO;
import ink.wgink.module.form.service.docno.IDocNoService;
import ink.wgink.module.form.service.docnolog.IDocNoLogService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.UUIDUtil;
import ink.wgink.util.map.HashMapUtil;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @ClassName: DocNoServiceImpl
* @Description: 文号
* @Author: CodeFactory
* @Date: 2022-06-24 15:06:48
* @Version: 3.0
**/
@Service
public class DocNoServiceImpl extends DefaultBaseService implements IDocNoService {
@Autowired
private IDocNoDao docNoDao;
@Autowired
private IDocNoLogService docNoLogService;
@Override
public void save(DocNoVO docNoVO) {
saveReturnId(docNoVO);
}
@Override
public void save(String token, DocNoVO docNoVO) {
saveReturnId(token, docNoVO);
}
@Override
public String saveReturnId(DocNoVO docNoVO) {
return saveReturnId(null, docNoVO);
}
@Override
public String saveReturnId(String token, DocNoVO docNoVO) {
String docNoId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(docNoVO);
params.put("docNoId", docNoId);
if (StringUtils.isBlank(token)) {
setSaveInfo(params);
} else {
setAppSaveInfo(token, params);
}
docNoDao.save(params);
return docNoId;
}
@Override
public void remove(List<String> ids) {
remove(null, ids);
}
@Override
public void remove(String token, List<String> ids) {
Map<String, Object> params = getHashMap(2);
params.put("docNoIds", ids);
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);
} else {
setAppUpdateInfo(token, params);
}
docNoDao.remove(params);
}
@Override
public void delete(List<String> ids) {
Map<String, Object> params = getHashMap(2);
params.put("docNoIds", ids);
docNoDao.delete(params);
}
@Override
public void update(String docNoId, DocNoVO docNoVO) {
update(null, docNoId, docNoVO);
}
@Override
public void update(String token, String docNoId, DocNoVO docNoVO) {
Map<String, Object> params = HashMapUtil.beanToMap(docNoVO);
params.put("docNoId", docNoId);
if (StringUtils.isBlank(token)) {
setUpdateInfo(params);
} else {
setAppUpdateInfo(token, params);
}
docNoDao.update(params);
}
@Override
public DocNoDTO get(Map<String, Object> params) {
return docNoDao.get(params);
}
@Override
public DocNoDTO get(String docNoId) {
Map<String, Object> params = super.getHashMap(2);
params.put("docNoId", docNoId);
return get(params);
}
@Override
public DocNoPO getPO(Map<String, Object> params) {
return docNoDao.getPO(params);
}
@Override
public DocNoPO getPO(String docNoId) {
Map<String, Object> params = super.getHashMap(2);
params.put("docNoId", docNoId);
return getPO(params);
}
@Override
public List<DocNoDTO> list(Map<String, Object> params) {
return docNoDao.list(params);
}
@Override
public List<DocNoPO> listPO(Map<String, Object> params) {
return docNoDao.listPO(params);
}
@Override
public SuccessResultList<List<DocNoDTO>> listPage(ListPage page) {
PageHelper.startPage(page.getPage(), page.getRows());
List<DocNoDTO> docNoDTOs = list(page.getParams());
PageInfo<DocNoDTO> pageInfo = new PageInfo<>(docNoDTOs);
return new SuccessResultList<>(docNoDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public Integer count(Map<String, Object> params) {
Integer count = docNoDao.count(params);
return count == null ? 0 : count;
}
@Override
public DocNoBO getLatestNewDocNoBO(String docNoId) {
DocNoPO docNoPO = getPO(docNoId);
if (docNoPO == null) {
throw new SearchException("文号不存在");
}
if (StringUtils.equals(DocNoTypeEnum.MANUAL.getValue(), docNoPO.getType())) {
LOG.debug("文号类型为手动生成");
return null;
}
int startNu = docNoPO.getStartNu();
int nuLength = docNoPO.getNuLength();
// 文号模板
String template = docNoPO.getTemplate();
// 获取最新的文号
DocNoLogPO latestDocNoLogPO = docNoLogService.getLatestPOByDocNoId(docNoId);
DateTime dateTime = DateTime.now();
int fullYearIndex = template.indexOf("yyyy");
int shortYearIndex = template.indexOf("yy");
int currentDocNoYear = fullYearIndex > -1 ? dateTime.getYear() : shortYearIndex > -1 ? dateTime.getYear() % 100 : 0;
int monthIndex = template.indexOf("MM");
int currentDocNoMonth = monthIndex > -1 ? dateTime.getMonthOfYear() : 0;
int dayIndex = template.indexOf("dd");
int currentDocNoDay = dayIndex > -1 ? dateTime.getDayOfMonth() : 0;
DocNoBO docNoBO = new DocNoBO();
docNoBO.setDocNoYear(currentDocNoYear);
docNoBO.setDocNoMonth(currentDocNoMonth);
docNoBO.setDocNoDay(currentDocNoDay);
int currentDocNoNu;
// 文号不存在
if (latestDocNoLogPO == null) {
currentDocNoNu = startNu;
} else {
// 编号是否重置
boolean isNuReset = false;
// 文号存在计算文号
if (StringUtils.equals(DocNoTypeEnum.YEAR.getValue(), docNoPO.getType())) {
if (latestDocNoLogPO.getDocNoYear() != currentDocNoYear) {
isNuReset = true;
}
} else if (StringUtils.equals(DocNoTypeEnum.MONTH.getValue(), docNoPO.getType())) {
if (latestDocNoLogPO.getDocNoMonth() != currentDocNoDay) {
isNuReset = true;
} else if (latestDocNoLogPO.getDocNoYear() != currentDocNoYear) {
isNuReset = true;
}
} else if (StringUtils.equals(DocNoTypeEnum.DAY.getValue(), docNoPO.getType())) {
if (latestDocNoLogPO.getDocNoDay() != currentDocNoMonth) {
isNuReset = true;
} else if (latestDocNoLogPO.getDocNoMonth() != currentDocNoDay) {
isNuReset = true;
} else if (latestDocNoLogPO.getDocNoYear() != currentDocNoYear) {
isNuReset = true;
}
}
if (isNuReset) {
currentDocNoNu = 1;
} else {
currentDocNoNu = latestDocNoLogPO.getDocNoNu() + 1;
}
}
docNoBO.setDocNoNu(currentDocNoNu);
docNoBO.setDocNoFull(generateDocNo(template, dateTime, String.format("%0" + nuLength + "d", currentDocNoNu)));
return docNoBO;
}
@Override
public synchronized String saveAndReturnLatestDocNo(String docNoId, String docNoUsedId) {
DocNoBO latestNewDocNoBO = getLatestNewDocNoBO(docNoId);
if (latestNewDocNoBO == null) {
return null;
}
DocNoLogVO docNoLogVO = new DocNoLogVO();
BeanUtils.copyProperties(latestNewDocNoBO, docNoLogVO);
docNoLogVO.setDocNoId(docNoId);
docNoLogVO.setDocNoUsedId(docNoUsedId);
docNoLogService.save(docNoLogVO);
return latestNewDocNoBO.getDocNoFull();
}
/**
* 生成文号
*
* @param template 模板
* @param dateTime 时间
* @param latestNo 最新数字
* @return
*/
private String generateDocNo(String template, DateTime dateTime, String latestNo) {
String docNo = template;
if (template.indexOf("yyyy") > -1) {
docNo = docNo.replaceAll("yyyy", String.valueOf(dateTime.getYear()));
} else if (docNo.indexOf("yy") > -1) {
docNo = docNo.replaceAll("yy", String.valueOf(dateTime.getYear()).substring(2, 4));
}
docNo = docNo.replaceAll("MM", dateTime.getMonthOfYear() < 10 ? ("0" + dateTime.getMonthOfYear()) : String.valueOf(dateTime.getMonthOfYear()));
docNo = docNo.replaceAll("dd", dateTime.getDayOfMonth() < 10 ? ("0" + dateTime.getDayOfMonth()) : String.valueOf(dateTime.getDayOfMonth()));
docNo = docNo.replaceAll("nn", latestNo);
return docNo;
}
}

View File

@ -0,0 +1,116 @@
package ink.wgink.module.form.service.docnolog;
import ink.wgink.module.form.pojo.dtos.docnolog.DocNoLogDTO;
import ink.wgink.module.form.pojo.pos.docnolog.DocNoLogPO;
import ink.wgink.module.form.pojo.vos.docnolog.DocNoLogVO;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
import java.util.List;
import java.util.Map;
/**
* @ClassName: IDocNoLogService
* @Description: 文号日志
* @Author: CodeFactory
* @Date: 2022-06-29 14:19:06
* @Version: 3.0
**/
public interface IDocNoLogService {
/**
* 新增文号日志
*
* @param docNoLogVO
* @return
*/
void save(DocNoLogVO docNoLogVO);
/**
* 新增文号日志
*
* @param docNoLogVO
* @return docNoLogId
*/
String saveReturnId(DocNoLogVO docNoLogVO);
/**
* 删除文号日志物理删除
*
* @param ids id列表
*/
void delete(List<String> ids);
/**
* 文号日志详情
*
* @param params 参数Map
* @return
*/
DocNoLogDTO get(Map<String, Object> params);
/**
* 文号日志详情
*
* @param docNoLogId
* @return
*/
DocNoLogDTO get(String docNoLogId);
/**
* 文号日志详情
*
* @param params 参数Map
* @return
*/
DocNoLogPO getPO(Map<String, Object> params);
/**
* 文号日志详情
*
* @param docNoLogId
* @return
*/
DocNoLogPO getPO(String docNoLogId);
/**
* 获取最新的文号日志
*
* @param docNoId
* @return
*/
DocNoLogPO getLatestPOByDocNoId(String docNoId);
/**
* 文号日志列表
*
* @param params
* @return
*/
List<DocNoLogDTO> list(Map<String, Object> params);
/**
* 文号日志列表
*
* @param params
* @return
*/
List<DocNoLogPO> listPO(Map<String, Object> params);
/**
* 文号日志分页列表
*
* @param page
* @return
*/
SuccessResultList<List<DocNoLogDTO>> listPage(ListPage page);
/**
* 文号日志统计
*
* @param params
* @return
*/
Integer count(Map<String, Object> params);
}

View File

@ -0,0 +1,111 @@
package ink.wgink.module.form.service.docnolog.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.module.form.dao.docnolog.IDocNoLogDao;
import ink.wgink.module.form.pojo.dtos.docnolog.DocNoLogDTO;
import ink.wgink.module.form.pojo.pos.docnolog.DocNoLogPO;
import ink.wgink.module.form.pojo.vos.docnolog.DocNoLogVO;
import ink.wgink.module.form.service.docnolog.IDocNoLogService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.util.UUIDUtil;
import ink.wgink.util.map.HashMapUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @ClassName: DocNoLogServiceImpl
* @Description: 文号日志
* @Author: CodeFactory
* @Date: 2022-06-29 14:19:06
* @Version: 3.0
**/
@Service
public class DocNoLogServiceImpl extends DefaultBaseService implements IDocNoLogService {
@Autowired
private IDocNoLogDao docNoLogDao;
@Override
public void save(DocNoLogVO docNoLogVO) {
saveReturnId(docNoLogVO);
}
@Override
public String saveReturnId(DocNoLogVO docNoLogVO) {
String docNoLogId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(docNoLogVO);
params.put("docNoLogId", docNoLogId);
setSaveInfoByUserId(params, "1");
docNoLogDao.save(params);
return docNoLogId;
}
@Override
public void delete(List<String> ids) {
Map<String, Object> params = getHashMap(2);
params.put("docNoLogIds", ids);
docNoLogDao.delete(params);
}
@Override
public DocNoLogDTO get(Map<String, Object> params) {
return docNoLogDao.get(params);
}
@Override
public DocNoLogDTO get(String docNoLogId) {
Map<String, Object> params = super.getHashMap(2);
params.put("docNoLogId", docNoLogId);
return get(params);
}
@Override
public DocNoLogPO getPO(Map<String, Object> params) {
return docNoLogDao.getPO(params);
}
@Override
public DocNoLogPO getPO(String docNoLogId) {
Map<String, Object> params = super.getHashMap(2);
params.put("docNoLogId", docNoLogId);
return getPO(params);
}
@Override
public DocNoLogPO getLatestPOByDocNoId(String docNoId) {
Map<String, Object> params = getHashMap(2);
params.put("docNoId", docNoId);
return docNoLogDao.getLatestPO(params);
}
@Override
public List<DocNoLogDTO> list(Map<String, Object> params) {
return docNoLogDao.list(params);
}
@Override
public List<DocNoLogPO> listPO(Map<String, Object> params) {
return docNoLogDao.listPO(params);
}
@Override
public SuccessResultList<List<DocNoLogDTO>> listPage(ListPage page) {
PageHelper.startPage(page.getPage(), page.getRows());
List<DocNoLogDTO> docNoLogDTOs = list(page.getParams());
PageInfo<DocNoLogDTO> pageInfo = new PageInfo<>(docNoLogDTOs);
return new SuccessResultList<>(docNoLogDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public Integer count(Map<String, Object> params) {
Integer count = docNoLogDao.count(params);
return count == null ? 0 : count;
}
}

View File

@ -0,0 +1,259 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="ink.wgink.module.form.dao.docnolog.IDocNoLogDao">
<resultMap id="docNoLogDTO" type="ink.wgink.module.form.pojo.dtos.docnolog.DocNoLogDTO">
<result column="doc_no_log_id" property="docNoLogId"/>
<result column="doc_no_id" property="docNoId"/>
<result column="doc_no_used_id" property="docNoUsedId"/>
<result column="doc_no_year" property="docNoYear"/>
<result column="doc_no_month" property="docNoMonth"/>
<result column="doc_no_day" property="docNoDay"/>
<result column="doc_no_nu" property="docNoNu"/>
<result column="doc_no_full" property="docNoFull"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<resultMap id="docNoLogPO" type="ink.wgink.module.form.pojo.pos.docnolog.DocNoLogPO">
<result column="doc_no_log_id" property="docNoLogId"/>
<result column="doc_no_id" property="docNoId"/>
<result column="doc_no_used_id" property="docNoUsedId"/>
<result column="doc_no_year" property="docNoYear"/>
<result column="doc_no_month" property="docNoMonth"/>
<result column="doc_no_day" property="docNoDay"/>
<result column="doc_no_nu" property="docNoNu"/>
<result column="doc_no_full" property="docNoFull"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
</resultMap>
<!-- 新增文号日志 -->
<insert id="save" parameterType="map">
INSERT INTO form_doc_no_log(
doc_no_log_id,
doc_no_id,
doc_no_used_id,
doc_no_year,
doc_no_month,
doc_no_day,
doc_no_nu,
doc_no_full,
gmt_create,
creator
) VALUES(
#{docNoLogId},
#{docNoId},
#{docNoUsedId},
#{docNoYear},
#{docNoMonth},
#{docNoDay},
#{docNoNu},
#{docNoFull},
#{gmtCreate},
#{creator}
)
</insert>
<!-- 删除文号日志(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
form_doc_no_log
WHERE
doc_no_log_id IN
<foreach collection="docNoLogIds" index="index" open="(" separator="," close=")">
#{docNoLogIds[${index}]}
</foreach>
</update>
<!-- 修改文号日志 -->
<update id="update" parameterType="map">
UPDATE
form_doc_no_log
SET
<if test="docNoId != null and docNoId != ''">
doc_no_id = #{docNoId},
</if>
<if test="docNoUsedId != null and docNoUsedId != ''">
doc_no_used_id = #{docNoUsedId},
</if>
<if test="docNoYear != null">
doc_no_year = #{docNoYear},
</if>
<if test="docNoMonth != null">
doc_no_month = #{docNoMonth},
</if>
<if test="docNoDay != null">
doc_no_day = #{docNoDay},
</if>
<if test="docNoNu != null">
doc_no_nu = #{docNoNu},
</if>
<if test="docNoFull != null and docNoFull != ''">
doc_no_full = #{docNoFull},
</if>
doc_no_log_id = doc_no_log_id
WHERE
doc_no_log_id = #{docNoLogId}
</update>
<!-- 文号日志详情 -->
<select id="get" parameterType="map" resultMap="docNoLogDTO">
SELECT
t1.doc_no_id,
t1.doc_no_used_id,
t1.doc_no_year,
t1.doc_no_month,
t1.doc_no_day,
t1.doc_no_nu,
t1.doc_no_full,
t1.doc_no_log_id
FROM
form_doc_no_log t1
WHERE
1 = 1
<if test="docNoLogId != null and docNoLogId != ''">
AND
t1.doc_no_log_id = #{docNoLogId}
</if>
</select>
<!-- 文号日志详情 -->
<select id="getPO" parameterType="map" resultMap="docNoLogPO">
SELECT
t1.doc_no_log_id,
t1.doc_no_id,
t1.doc_no_used_id,
t1.doc_no_year,
t1.doc_no_month,
t1.doc_no_day,
t1.doc_no_nu,
t1.doc_no_full,
t1.gmt_create,
t1.creator
FROM
form_doc_no_log t1
WHERE
1 = 1
<if test="docNoLogId != null and docNoLogId != ''">
AND
t1.doc_no_log_id = #{docNoLogId}
</if>
</select>
<!-- 文号日志列表 -->
<select id="list" parameterType="map" resultMap="docNoLogDTO">
SELECT
t1.doc_no_log_id,
t1.doc_no_id,
t1.doc_no_used_id,
t1.doc_no_year,
t1.doc_no_month,
t1.doc_no_day,
t1.doc_no_nu,
t1.doc_no_full,
t1.gmt_create,
1
FROM
form_doc_no_log t1
WHERE
1 = 1
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="docNoLogIds != null and docNoLogIds.size > 0">
AND
t1.doc_no_log_id IN
<foreach collection="docNoLogIds" index="index" open="(" separator="," close=")">
#{docNoLogIds[${index}]}
</foreach>
</if>
</select>
<!-- 文号日志列表 -->
<select id="listPO" parameterType="map" resultMap="docNoLogPO">
SELECT
t1.doc_no_log_id,
t1.doc_no_id,
t1.doc_no_used_id,
t1.doc_no_year,
t1.doc_no_month,
t1.doc_no_day,
t1.doc_no_nu,
t1.doc_no_full,
t1.gmt_create,
t1.creator
FROM
form_doc_no_log t1
WHERE
1 = 1
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="docNoLogIds != null and docNoLogIds.size > 0">
AND
t1.doc_no_log_id IN
<foreach collection="docNoLogIds" index="index" open="(" separator="," close=")">
#{docNoLogIds[${index}]}
</foreach>
</if>
</select>
<!-- 文号日志统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
form_doc_no_log t1
WHERE
1 = 1
</select>
<!-- 获取最新的文号日志 -->
<select id="getLatestPO" parameterType="map" resultMap="docNoLogPO">
SELECT
t1.doc_no_log_id,
t1.doc_no_id,
t1.doc_no_used_id,
t1.doc_no_year,
t1.doc_no_month,
t1.doc_no_day,
t1.doc_no_nu,
t1.doc_no_full,
t1.gmt_create,
t1.creator
FROM
form_doc_no_log t1
<where>
<if test="docNoId != null and docNoId != ''">
t1.doc_no_id = #{docNoId}
</if>
</where>
ORDER BY
t1.gmt_create DESC
LIMIT 0, 1
</select>
</mapper>

View File

@ -0,0 +1,279 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="ink.wgink.module.form.dao.docno.IDocNoDao">
<resultMap id="docNoDTO" type="ink.wgink.module.form.pojo.dtos.docno.DocNoDTO">
<result column="doc_no_id" property="docNoId"/>
<result column="title" property="title"/>
<result column="summary" property="summary"/>
<result column="type" property="type"/>
<result column="template" property="template"/>
<result column="start_nu" property="startNu"/>
<result column="nu_length" property="nuLength"/>
<result column="latest_doc_no" property="latestDocNo"/>
<result column="is_active" property="isActive"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
</resultMap>
<resultMap id="docNoPO" type="ink.wgink.module.form.pojo.pos.docno.DocNoPO">
<result column="doc_no_id" property="docNoId"/>
<result column="title" property="title"/>
<result column="summary" property="summary"/>
<result column="type" property="type"/>
<result column="template" property="template"/>
<result column="start_nu" property="startNu"/>
<result column="nu_length" property="nuLength"/>
<result column="is_active" property="isActive"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增文号 -->
<insert id="save" parameterType="map">
INSERT INTO form_doc_no(
doc_no_id,
title,
summary,
type,
template,
start_nu,
nu_length,
latest_doc_no,
is_active,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
) VALUES(
#{docNoId},
#{title},
#{summary},
#{type},
#{template},
#{startNu},
#{nuLength},
#{latestDocNo},
#{isActive},
#{gmtCreate},
#{creator},
#{gmtModified},
#{modifier},
#{isDelete}
)
</insert>
<!-- 删除文号 -->
<update id="remove" parameterType="map">
UPDATE
form_doc_no
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
doc_no_id IN
<foreach collection="docNoIds" index="index" open="(" separator="," close=")">
#{docNoIds[${index}]}
</foreach>
</update>
<!-- 删除文号(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
form_doc_no
WHERE
doc_no_id IN
<foreach collection="docNoIds" index="index" open="(" separator="," close=")">
#{docNoIds[${index}]}
</foreach>
</update>
<!-- 修改文号 -->
<update id="update" parameterType="map">
UPDATE
form_doc_no
SET
<if test="title != null and title != ''">
title = #{title},
</if>
<if test="summary != null and summary != ''">
summary = #{summary},
</if>
<if test="type != null and type != ''">
type = #{type},
</if>
<if test="template != null and template != ''">
template = #{template},
</if>
<if test="startNu != null">
start_nu = #{startNu},
</if>
<if test="nuLength != null">
nu_length = #{nuLength},
</if>
<if test="latestDocNo != null and latestDocNo != ''">
latest_doc_no = #{latestDocNo},
</if>
<if test="isActive != null">
is_active = #{isActive},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
doc_no_id = doc_no_id
WHERE
doc_no_id = #{docNoId}
</update>
<!-- 文号详情 -->
<select id="get" parameterType="map" resultMap="docNoDTO">
SELECT
t1.title,
t1.summary,
t1.type,
t1.template,
t1.start_nu,
t1.nu_length,
t1.latest_doc_no,
t1.is_active,
t1.doc_no_id
FROM
form_doc_no t1
WHERE
t1.is_delete = 0
<if test="docNoId != null and docNoId != ''">
AND
t1.doc_no_id = #{docNoId}
</if>
</select>
<!-- 文号详情 -->
<select id="getPO" parameterType="map" resultMap="docNoPO">
SELECT
t1.doc_no_id,
t1.title,
t1.summary,
t1.type,
t1.template,
t1.start_nu,
t1.nu_length,
t1.latest_doc_no,
t1.is_active,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
form_doc_no t1
WHERE
t1.is_delete = 0
<if test="docNoId != null and docNoId != ''">
AND
t1.doc_no_id = #{docNoId}
</if>
</select>
<!-- 文号列表 -->
<select id="list" parameterType="map" resultMap="docNoDTO">
SELECT
t1.doc_no_id,
t1.title,
t1.summary,
t1.type,
t1.template,
t1.start_nu,
t1.nu_length,
t1.latest_doc_no,
t1.is_active,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
1
FROM
form_doc_no t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="docNoIds != null and docNoIds.size > 0">
AND
t1.doc_no_id IN
<foreach collection="docNoIds" index="index" open="(" separator="," close=")">
#{docNoIds[${index}]}
</foreach>
</if>
</select>
<!-- 文号列表 -->
<select id="listPO" parameterType="map" resultMap="docNoPO">
SELECT
t1.doc_no_id,
t1.title,
t1.summary,
t1.type,
t1.template,
t1.start_nu,
t1.nu_length,
t1.latest_doc_no,
t1.is_active,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
form_doc_no t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="docNoIds != null and docNoIds.size > 0">
AND
t1.doc_no_id IN
<foreach collection="docNoIds" index="index" open="(" separator="," close=")">
#{docNoIds[${index}]}
</foreach>
</if>
</select>
<!-- 文号统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
form_doc_no t1
WHERE
t1.is_delete = 0
</select>
</mapper>

View File

@ -0,0 +1,87 @@
function DocNo($, form) {
var docNo = {
/**
* 获取编码
* @return {string}
*/
getNu: function() {
var startNu = $('#startNu').val();
var nuLength = $('#nuLength').val();
var prefixCount = nuLength - startNu.length;
var prefix = '';
for(var i = 0; i < prefixCount; i++) {
prefix += '0';
}
return prefix + startNu;
},
/**
* 生成文号示例
*/
refreshDocNoDemo: function() {
var template = $('#template').val();
if(!template) {
$('#docNoDemo').text('');
return;
}
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var docNo = template;
if(docNo.indexOf('yyyy') > -1) {
docNo = docNo.replace('yyyy', year);
} else if(docNo.indexOf('yy') > -1) {
docNo = docNo.replace('yy', year % 100);
}
docNo = docNo.replace('MM', month < 10 ? ('0'+ month) : month);
docNo = docNo.replace('dd', day < 10 ? ('0'+ day) : day);
var nu = this.getNu();
docNo = docNo.replace('nn', nu);
$('#docNoDemo').text(docNo);
},
addKeyup: function() {
var self = this;
// 模板输入
$(document).on('keyup', '#template', function() {
self.refreshDocNoDemo();
});
// 开始编号更新
$(document).on('keyup', '#startNu', function() {
var value = this.value;
if(value === '') {
top.dialog.msg('开始编号不能为空');
return;
}
self.refreshDocNoDemo();
})
// 长度更新
$(document).on('keyup', '#nuLength', function() {
var value = this.value;
if(value === '') {
top.dialog.msg('编号长度不能为空');
return;
}
self.refreshDocNoDemo();
})
},
addSelect: function() {
var self = this;
form.on('select(typeSelect)', function(data){
var options = $(data.elem).children();
for(var i = 0, option; option = options[i++];) {
if(option.value == data.value) {
$('#template').val(option.dataset.template)
break;
}
}
self.refreshDocNoDemo();
});
}
}
return docNo;
}

View File

@ -0,0 +1,299 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
</div>
新增时间
<div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item search-item-width-100" placeholder="开始时间" readonly>
</div>
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item search-item-width-100" placeholder="结束时间" readonly>
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
<i class="fa fa-lg fa-edit"></i> 编辑
</button>
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
</div>
</script>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/doc-no-log/listpage';
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [
[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'docNoLogId', width: 180, title: '主键', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'docNoId', width: 180, title: '文号ID', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'docNoUsedId', width: 180, title: '使用ID同一类的文号相同', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'docNoYear', width: 180, title: '文号年', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'docNoMonth', width: 180, title: '文号月', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'docNoDay', width: 180, title: '文号日', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'docNoNu', width: 180, title: '文号', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'docNoFull', width: 180, title: '完整文号', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'gmtCreate', width: 180, title: '创建时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
]
],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
},
page: {
curr: currentPage
},
});
}
// 初始化日期
function initDate() {
// 日期选择
laydate.render({
elem: '#startTime',
format: 'yyyy-MM-dd'
});
laydate.render({
elem: '#endTime',
format: 'yyyy-MM-dd'
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/doc-no-log/remove/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
initTable();
initDate();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/doc-no-log/save', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/doc-no-log/update?docNoLogId={docNoLogId}', [checkDatas[0].docNoLogId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['docNoLogId'];
}
removeData(ids);
}
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,141 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>新增内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">文号ID</label>
<div class="layui-input-block">
<input type="text" id="docNoId" name="docNoId" class="layui-input" value="" placeholder="请输入文号ID" maxlength="36">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">使用ID同一类的文号相同</label>
<div class="layui-input-block">
<input type="text" id="docNoUsedId" name="docNoUsedId" class="layui-input" value="" placeholder="请输入使用ID同一类的文号相同" maxlength="255">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文号年</label>
<div class="layui-input-block">
<input type="number" id="docNoYear" name="docNoYear" class="layui-input" value="" placeholder="请输入文号年" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文号月</label>
<div class="layui-input-block">
<input type="number" id="docNoMonth" name="docNoMonth" class="layui-input" value="" placeholder="请输入文号月" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文号日</label>
<div class="layui-input-block">
<input type="number" id="docNoDay" name="docNoDay" class="layui-input" value="" placeholder="请输入文号日" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文号</label>
<div class="layui-input-block">
<input type="number" id="docNoNu" name="docNoNu" class="layui-input" value="" placeholder="请输入文号" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">完整文号</label>
<div class="layui-input-block">
<input type="text" id="docNoFull" name="docNoFull" class="layui-input" value="" placeholder="请输入完整文号" maxlength="255">
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化内容
function initData() {
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/doc-no-log/save', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,158 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">文号ID</label>
<div class="layui-input-block">
<input type="text" id="docNoId" name="docNoId" class="layui-input" value="" placeholder="请输入文号ID" maxlength="36">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">使用ID同一类的文号相同</label>
<div class="layui-input-block">
<input type="text" id="docNoUsedId" name="docNoUsedId" class="layui-input" value="" placeholder="请输入使用ID同一类的文号相同" maxlength="255">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文号年</label>
<div class="layui-input-block">
<input type="number" id="docNoYear" name="docNoYear" class="layui-input" value="" placeholder="请输入文号年" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文号月</label>
<div class="layui-input-block">
<input type="number" id="docNoMonth" name="docNoMonth" class="layui-input" value="" placeholder="请输入文号月" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文号日</label>
<div class="layui-input-block">
<input type="number" id="docNoDay" name="docNoDay" class="layui-input" value="" placeholder="请输入文号日" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文号</label>
<div class="layui-input-block">
<input type="number" id="docNoNu" name="docNoNu" class="layui-input" value="" placeholder="请输入文号" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">完整文号</label>
<div class="layui-input-block">
<input type="text" id="docNoFull" name="docNoFull" class="layui-input" value="" placeholder="请输入完整文号" maxlength="255">
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var docNoLogId = top.restAjax.params(window.location.href).docNoLogId;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/doc-no-log/get/{docNoLogId}', [docNoLogId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/doc-no-log/update/{docNoLogId}', [docNoLogId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,298 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
<i class="fa fa-lg fa-edit"></i> 编辑
</button>
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
</div>
</script>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/doc-no/listpage';
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [
[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'title', width: 180, title: '标题', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'summary', width: 180, title: '描述', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'type', width: 100, title: '类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(rowData === 'always') {
return '一直累加';
}
if(rowData === 'year') {
return '按年累加';
}
if(rowData === 'month') {
return '按月累加';
}
if(rowData === 'day') {
return '按日累加';
}
if(rowData === 'manual') {
return '手动';
}
return '错误';
}
},
{field: 'template', width: 180, title: '模板', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'startNu', width: 120, title: '开始编号', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'nuLength', width: 120, title: '编号长度', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'isActive', width: 100, title: '是否激活', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(rowData === 0) {
return '<span class="layui-badge"></span>';
}
if(rowData === 1) {
return '<span class="layui-badge layui-bg-green"></span>';
}
return rowData;
}
},
{field: 'gmtCreate', width: 180, title: '创建时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
}
]
],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
},
page: {
curr: currentPage
},
});
}
// 初始化日期
function initDate() {
// 日期选择
laydate.render({
elem: '#startTime',
format: 'yyyy-MM-dd'
});
laydate.render({
elem: '#endTime',
format: 'yyyy-MM-dd'
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/doc-no/remove/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
initTable();
initDate();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/doc-no/save', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/doc-no/update?docNoId={docNoId}', [checkDatas[0].docNoId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['docNoId'];
}
removeData(ids);
}
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,179 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>新增内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-row">
<div class="layui-col-xs8">
<div class="layui-form-item">
<label class="layui-form-label">标题 *</label>
<div class="layui-input-block">
<input type="text" id="title" name="title" class="layui-input" value="" placeholder="请输入标题" maxlength="255" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<input type="text" id="summary" name="summary" class="layui-input" value="" placeholder="请输入描述" maxlength="500">
</div>
</div>
<blockquote class="layui-elem-quote">
<div>1.占位符格式必须一致,否则无法正确生成文号。除占位符外,其余符号可按需补充</div>
<div>2.模板支持的占位符有完整yyyy简写yyMMdd数字nn</div>
<div>3.年的占位符只能有一个</div>
</blockquote>
<div class="layui-row">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">类型 *</label>
<div class="layui-input-block">
<select id="type" name="type" lay-filter="typeSelect" lay-verify="required">
<option value="always" data-template="yyyynn">一直累加</option>
<option value="year" data-template="yyyynn">按年累加</option>
<option value="month" data-template="yyyy-MMnn">按月累加</option>
<option value="day" data-template="yyyy-MM-ddnn">按日累加</option>
<option value="manual" data-template="">手动</option>
</select>
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">模板</label>
<div class="layui-input-block">
<input type="text" id="template" name="template" class="layui-input" value="yyyynn" placeholder="请输入模板" maxlength="255" lay-verify="required">
</div>
</div>
</div>
</div>
<blockquote class="layui-elem-quote">
<div>1.开始编号:确定了文号生成的第一个值,后续以此累加</div>
<div>2.编号长度:确定了文号累加数字的位数</div>
</blockquote>
<div class="layui-row">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">开始编号 *</label>
<div class="layui-input-block">
<input type="number" id="startNu" name="startNu" class="layui-input" value="1" placeholder="请输入开始编号" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">编号长度 *</label>
<div class="layui-input-block">
<input type="number" id="nuLength" name="nuLength" class="layui-input" value="2" placeholder="请输入编号长度" lay-verify="required">
</div>
</div>
</div>
</div>
<blockquote class="layui-elem-quote">
文号示例:<span id="docNoDemo"></span>
</blockquote>
<div class="layui-form-item" pane>
<label class="layui-form-label">是否激活</label>
<div class="layui-input-block">
<input type="radio" name="isActive" value="1" title="是" checked>
<input type="radio" name="isActive" value="0" title="否">
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/doc-no/doc-no.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化内容
function initData() {
var docNo = new DocNo($, form);
docNo.refreshDocNoDemo();
docNo.addKeyup();
docNo.addSelect();
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/doc-no/save', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,199 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-row">
<div class="layui-col-xs8">
<div class="layui-form-item">
<label class="layui-form-label">标题 *</label>
<div class="layui-input-block">
<input type="text" id="title" name="title" class="layui-input" value="" placeholder="请输入标题" maxlength="255" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<input type="text" id="summary" name="summary" class="layui-input" value="" placeholder="请输入描述" maxlength="500">
</div>
</div>
<blockquote class="layui-elem-quote">
<div>1.占位符格式必须一致,否则无法正确生成文号。除占位符外,其余符号可按需补充</div>
<div>2.模板支持的占位符有完整yyyy简写yyMMdd数字nn</div>
<div>3.年的占位符只能有一个</div>
</blockquote>
<div class="layui-row">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">类型 *</label>
<div class="layui-input-block">
<select id="type" name="type" lay-filter="typeSelect" lay-verify="required">
<option value="always" data-template="yyyynn">一直累加</option>
<option value="year" data-template="yyyynn">按年累加</option>
<option value="month" data-template="yyyy-MMnn">按月累加</option>
<option value="day" data-template="yyyy-MM-ddnn">按日累加</option>
<option value="manual" data-template="">手动</option>
</select>
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">模板</label>
<div class="layui-input-block">
<input type="text" id="template" name="template" class="layui-input" value="yyyynn" placeholder="请输入模板" maxlength="255" lay-verify="required">
</div>
</div>
</div>
</div>
<blockquote class="layui-elem-quote">
<div>1.开始编号:确定了文号生成的第一个值,后续以此累加</div>
<div>2.编号长度:确定了文号累加数字的位数</div>
</blockquote>
<div class="layui-row">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">开始编号 *</label>
<div class="layui-input-block">
<input type="number" id="startNu" name="startNu" class="layui-input" value="1" placeholder="请输入开始编号" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">编号长度 *</label>
<div class="layui-input-block">
<input type="number" id="nuLength" name="nuLength" class="layui-input" value="2" placeholder="请输入编号长度" lay-verify="required">
</div>
</div>
</div>
</div>
<blockquote class="layui-elem-quote">
文号示例:<span id="docNoDemo"></span>
</blockquote>
<div class="layui-form-item" pane>
<label class="layui-form-label">是否激活</label>
<div class="layui-input-block">
<input type="radio" name="isActive" value="1" title="是" checked>
<input type="radio" name="isActive" value="0" title="否">
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/doc-no/doc-no.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var docNoId = top.restAjax.params(window.location.href).docNoId;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/doc-no/get/{docNoId}', [docNoId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
var docNo = new DocNo($, form);
docNo.refreshDocNoDemo();
docNo.addKeyup();
docNo.addSelect();
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/doc-no/update/{docNoId}', [docNoId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>