diff --git a/module-form/src/main/java/ink/wgink/module/form/controller/api/docno/DocNoController.java b/module-form/src/main/java/ink/wgink/module/form/controller/api/docno/DocNoController.java new file mode 100644 index 00000000..a3a3acb1 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/controller/api/docno/DocNoController.java @@ -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 list() { + Map 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> listPage(ListPage page) { + Map params = requestParams(); + page.setParams(params); + return docNoService.listPage(page); + } + + @ApiOperation(value = "文号统计", notes = "文号统计接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("count") + SuccessResultData count() { + Map 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 getLatestDocNo(@PathVariable("docNoId") String docNoId) { + DocNoBO latestNewDocNoBO = docNoService.getLatestNewDocNoBO(docNoId); + String latestDocNo; + if (latestNewDocNoBO == null) { + latestDocNo = ""; + } else { + latestDocNo = latestNewDocNoBO.getDocNoFull(); + } + return new SuccessResultData<>(latestDocNo); + } + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/controller/app/api/docno/DocNoAppController.java b/module-form/src/main/java/ink/wgink/module/form/controller/app/api/docno/DocNoAppController.java new file mode 100644 index 00000000..9945bbdc --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/controller/app/api/docno/DocNoAppController.java @@ -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 list(@RequestHeader("token") String token) { + Map 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> listPage(@RequestHeader("token") String token, ListPage page) { + Map params = requestParams(); + page.setParams(params); + return docNoService.listPage(page); + } + + @ApiOperation(value = "文号统计", notes = "文号统计接口") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("count") + SuccessResultData count() { + Map params = requestParams(); + return new SuccessResultData<>(docNoService.count(params)); + } + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/controller/route/docno/DocNoRouteController.java b/module-form/src/main/java/ink/wgink/module/form/controller/route/docno/DocNoRouteController.java new file mode 100644 index 00000000..ef9975ff --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/controller/route/docno/DocNoRouteController.java @@ -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"); + } + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/controller/route/docnolog/DocNoLogRouteController.java b/module-form/src/main/java/ink/wgink/module/form/controller/route/docnolog/DocNoLogRouteController.java new file mode 100644 index 00000000..6fd98207 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/controller/route/docnolog/DocNoLogRouteController.java @@ -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"); + } + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/dao/docno/IDocNoDao.java b/module-form/src/main/java/ink/wgink/module/form/dao/docno/IDocNoDao.java new file mode 100644 index 00000000..c2259202 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/dao/docno/IDocNoDao.java @@ -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 params) throws SaveException; + + /** + * 删除文号 + * + * @param params + * @throws RemoveException + */ + void remove(Map params) throws RemoveException; + + /** + * 删除文号(物理) + * + * @param params + * @throws RemoveException + */ + void delete(Map params) throws RemoveException; + + /** + * 修改文号 + * + * @param params + * @throws UpdateException + */ + void update(Map params) throws UpdateException; + + /** + * 文号详情 + * + * @param params + * @return + * @throws SearchException + */ + DocNoDTO get(Map params) throws SearchException; + + /** + * 文号详情 + * + * @param params + * @return + * @throws SearchException + */ + DocNoPO getPO(Map params) throws SearchException; + + /** + * 文号列表 + * + * @param params + * @return + * @throws SearchException + */ + List list(Map params) throws SearchException; + + /** + * 文号列表 + * + * @param params + * @return + * @throws SearchException + */ + List listPO(Map params) throws SearchException; + + /** + * 文号统计 + * + * @param params + * @return + * @throws SearchException + */ + Integer count(Map params) throws SearchException; + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/dao/docnolog/IDocNoLogDao.java b/module-form/src/main/java/ink/wgink/module/form/dao/docnolog/IDocNoLogDao.java new file mode 100644 index 00000000..24698f1c --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/dao/docnolog/IDocNoLogDao.java @@ -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 params) throws SaveException; + + /** + * 删除文号日志(物理) + * + * @param params + * @throws RemoveException + */ + void delete(Map params) throws RemoveException; + + /** + * 修改文号日志 + * + * @param params + * @throws UpdateException + */ + void update(Map params) throws UpdateException; + + /** + * 文号日志详情 + * + * @param params + * @return + * @throws SearchException + */ + DocNoLogDTO get(Map params) throws SearchException; + + /** + * 文号日志详情 + * + * @param params + * @return + * @throws SearchException + */ + DocNoLogPO getPO(Map params) throws SearchException; + + /** + * 文号日志列表 + * + * @param params + * @return + * @throws SearchException + */ + List list(Map params) throws SearchException; + + /** + * 文号日志列表 + * + * @param params + * @return + * @throws SearchException + */ + List listPO(Map params) throws SearchException; + + /** + * 文号日志统计 + * + * @param params + * @return + * @throws SearchException + */ + Integer count(Map params) throws SearchException; + + /** + * 获取最新的文号日志 + * + * @param params + * @return + * @throws SearchException + */ + DocNoLogPO getLatestPO(Map params) throws SearchException; + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/enums/docno/DocNoTypeEnum.java b/module-form/src/main/java/ink/wgink/module/form/enums/docno/DocNoTypeEnum.java new file mode 100644 index 00000000..d654ccf8 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/enums/docno/DocNoTypeEnum.java @@ -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(); + } +} diff --git a/module-form/src/main/java/ink/wgink/module/form/pojo/bos/docno/DocNoBO.java b/module-form/src/main/java/ink/wgink/module/form/pojo/bos/docno/DocNoBO.java new file mode 100644 index 00000000..63b32ad6 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/pojo/bos/docno/DocNoBO.java @@ -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; + } +} diff --git a/module-form/src/main/java/ink/wgink/module/form/pojo/dtos/docno/DocNoDTO.java b/module-form/src/main/java/ink/wgink/module/form/pojo/dtos/docno/DocNoDTO.java new file mode 100644 index 00000000..9a5cafe2 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/pojo/dtos/docno/DocNoDTO.java @@ -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; + } + + +} diff --git a/module-form/src/main/java/ink/wgink/module/form/pojo/dtos/docnolog/DocNoLogDTO.java b/module-form/src/main/java/ink/wgink/module/form/pojo/dtos/docnolog/DocNoLogDTO.java new file mode 100644 index 00000000..9a6a805c --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/pojo/dtos/docnolog/DocNoLogDTO.java @@ -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; + } + + +} diff --git a/module-form/src/main/java/ink/wgink/module/form/pojo/pos/docno/DocNoPO.java b/module-form/src/main/java/ink/wgink/module/form/pojo/pos/docno/DocNoPO.java new file mode 100644 index 00000000..f6b5ee13 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/pojo/pos/docno/DocNoPO.java @@ -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; + } + + +} diff --git a/module-form/src/main/java/ink/wgink/module/form/pojo/pos/docnolog/DocNoLogPO.java b/module-form/src/main/java/ink/wgink/module/form/pojo/pos/docnolog/DocNoLogPO.java new file mode 100644 index 00000000..6b636960 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/pojo/pos/docnolog/DocNoLogPO.java @@ -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; + } + + +} diff --git a/module-form/src/main/java/ink/wgink/module/form/pojo/vos/docno/DocNoVO.java b/module-form/src/main/java/ink/wgink/module/form/pojo/vos/docno/DocNoVO.java new file mode 100644 index 00000000..6adddfd4 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/pojo/vos/docno/DocNoVO.java @@ -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; + } + + +} diff --git a/module-form/src/main/java/ink/wgink/module/form/pojo/vos/docnolog/DocNoLogVO.java b/module-form/src/main/java/ink/wgink/module/form/pojo/vos/docnolog/DocNoLogVO.java new file mode 100644 index 00000000..cb92ac6e --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/pojo/vos/docnolog/DocNoLogVO.java @@ -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; + } + + +} diff --git a/module-form/src/main/java/ink/wgink/module/form/service/docno/IDocNoService.java b/module-form/src/main/java/ink/wgink/module/form/service/docno/IDocNoService.java new file mode 100644 index 00000000..c1f5f768 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/service/docno/IDocNoService.java @@ -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 ids); + + + /** + * 删除文号 + * + * @param token + * @param ids id列表 + * @return + */ + void remove(String token, List ids); + + /** + * 删除文号(物理删除) + * + * @param ids id列表 + */ + void delete(List 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 params); + + /** + * 文号详情 + * + * @param docNoId + * @return + */ + DocNoDTO get(String docNoId); + + /** + * 文号详情 + * + * @param params 参数Map + * @return + */ + DocNoPO getPO(Map params); + + /** + * 文号详情 + * + * @param docNoId + * @return + */ + DocNoPO getPO(String docNoId); + + /** + * 文号列表 + * + * @param params + * @return + */ + List list(Map params); + + /** + * 文号列表 + * + * @param params + * @return + */ + List listPO(Map params); + + /** + * 文号分页列表 + * + * @param page + * @return + */ + SuccessResultList> listPage(ListPage page); + + /** + * 文号统计 + * + * @param params + * @return + */ + Integer count(Map params); + + /** + * 获取最新文号 + * + * @param docNoId + * @return + */ + DocNoBO getLatestNewDocNoBO(String docNoId); + + /** + * 保存并返回新的文号 + * + * @param docNoId + * @param docNoUsedId + * @return + */ + String saveAndReturnLatestDocNo(String docNoId, String docNoUsedId); + + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/service/docno/impl/DocNoServiceImpl.java b/module-form/src/main/java/ink/wgink/module/form/service/docno/impl/DocNoServiceImpl.java new file mode 100644 index 00000000..08d642ea --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/service/docno/impl/DocNoServiceImpl.java @@ -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 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 ids) { + remove(null, ids); + } + + @Override + public void remove(String token, List ids) { + Map 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 ids) { + Map 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 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 params) { + return docNoDao.get(params); + } + + @Override + public DocNoDTO get(String docNoId) { + Map params = super.getHashMap(2); + params.put("docNoId", docNoId); + return get(params); + } + + @Override + public DocNoPO getPO(Map params) { + return docNoDao.getPO(params); + } + + @Override + public DocNoPO getPO(String docNoId) { + Map params = super.getHashMap(2); + params.put("docNoId", docNoId); + return getPO(params); + } + + @Override + public List list(Map params) { + return docNoDao.list(params); + } + + @Override + public List listPO(Map params) { + return docNoDao.listPO(params); + } + + @Override + public SuccessResultList> listPage(ListPage page) { + PageHelper.startPage(page.getPage(), page.getRows()); + List docNoDTOs = list(page.getParams()); + PageInfo pageInfo = new PageInfo<>(docNoDTOs); + return new SuccessResultList<>(docNoDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); + } + + @Override + public Integer count(Map 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; + } + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/service/docnolog/IDocNoLogService.java b/module-form/src/main/java/ink/wgink/module/form/service/docnolog/IDocNoLogService.java new file mode 100644 index 00000000..be461892 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/service/docnolog/IDocNoLogService.java @@ -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 ids); + + /** + * 文号日志详情 + * + * @param params 参数Map + * @return + */ + DocNoLogDTO get(Map params); + + /** + * 文号日志详情 + * + * @param docNoLogId + * @return + */ + DocNoLogDTO get(String docNoLogId); + + /** + * 文号日志详情 + * + * @param params 参数Map + * @return + */ + DocNoLogPO getPO(Map params); + + /** + * 文号日志详情 + * + * @param docNoLogId + * @return + */ + DocNoLogPO getPO(String docNoLogId); + + /** + * 获取最新的文号日志 + * + * @param docNoId + * @return + */ + DocNoLogPO getLatestPOByDocNoId(String docNoId); + + /** + * 文号日志列表 + * + * @param params + * @return + */ + List list(Map params); + + /** + * 文号日志列表 + * + * @param params + * @return + */ + List listPO(Map params); + + /** + * 文号日志分页列表 + * + * @param page + * @return + */ + SuccessResultList> listPage(ListPage page); + + /** + * 文号日志统计 + * + * @param params + * @return + */ + Integer count(Map params); + +} \ No newline at end of file diff --git a/module-form/src/main/java/ink/wgink/module/form/service/docnolog/impl/DocNoLogServiceImpl.java b/module-form/src/main/java/ink/wgink/module/form/service/docnolog/impl/DocNoLogServiceImpl.java new file mode 100644 index 00000000..f9f77c47 --- /dev/null +++ b/module-form/src/main/java/ink/wgink/module/form/service/docnolog/impl/DocNoLogServiceImpl.java @@ -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 params = HashMapUtil.beanToMap(docNoLogVO); + params.put("docNoLogId", docNoLogId); + setSaveInfoByUserId(params, "1"); + docNoLogDao.save(params); + return docNoLogId; + } + + @Override + public void delete(List ids) { + Map params = getHashMap(2); + params.put("docNoLogIds", ids); + docNoLogDao.delete(params); + } + + @Override + public DocNoLogDTO get(Map params) { + return docNoLogDao.get(params); + } + + @Override + public DocNoLogDTO get(String docNoLogId) { + Map params = super.getHashMap(2); + params.put("docNoLogId", docNoLogId); + return get(params); + } + + @Override + public DocNoLogPO getPO(Map params) { + return docNoLogDao.getPO(params); + } + + @Override + public DocNoLogPO getPO(String docNoLogId) { + Map params = super.getHashMap(2); + params.put("docNoLogId", docNoLogId); + return getPO(params); + } + + @Override + public DocNoLogPO getLatestPOByDocNoId(String docNoId) { + Map params = getHashMap(2); + params.put("docNoId", docNoId); + return docNoLogDao.getLatestPO(params); + } + + @Override + public List list(Map params) { + return docNoLogDao.list(params); + } + + @Override + public List listPO(Map params) { + return docNoLogDao.listPO(params); + } + + @Override + public SuccessResultList> listPage(ListPage page) { + PageHelper.startPage(page.getPage(), page.getRows()); + List docNoLogDTOs = list(page.getParams()); + PageInfo pageInfo = new PageInfo<>(docNoLogDTOs); + return new SuccessResultList<>(docNoLogDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); + } + + @Override + public Integer count(Map params) { + Integer count = docNoLogDao.count(params); + return count == null ? 0 : count; + } + +} \ No newline at end of file diff --git a/module-form/src/main/resources/mybatis/mapper/doc-no-log/doc-no-log-mapper.xml b/module-form/src/main/resources/mybatis/mapper/doc-no-log/doc-no-log-mapper.xml new file mode 100644 index 00000000..62df90de --- /dev/null +++ b/module-form/src/main/resources/mybatis/mapper/doc-no-log/doc-no-log-mapper.xml @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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} + ) + + + + + + DELETE FROM + form_doc_no_log + WHERE + doc_no_log_id IN + + #{docNoLogIds[${index}]} + + + + + + UPDATE + form_doc_no_log + SET + + doc_no_id = #{docNoId}, + + + doc_no_used_id = #{docNoUsedId}, + + + doc_no_year = #{docNoYear}, + + + doc_no_month = #{docNoMonth}, + + + doc_no_day = #{docNoDay}, + + + doc_no_nu = #{docNoNu}, + + + doc_no_full = #{docNoFull}, + + doc_no_log_id = doc_no_log_id + WHERE + doc_no_log_id = #{docNoLogId} + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/module-form/src/main/resources/mybatis/mapper/doc-no/doc-no-mapper.xml b/module-form/src/main/resources/mybatis/mapper/doc-no/doc-no-mapper.xml new file mode 100644 index 00000000..572535c3 --- /dev/null +++ b/module-form/src/main/resources/mybatis/mapper/doc-no/doc-no-mapper.xml @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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} + ) + + + + + UPDATE + form_doc_no + SET + gmt_modified = #{gmtModified}, + modifier = #{modifier}, + is_delete = 1 + WHERE + doc_no_id IN + + #{docNoIds[${index}]} + + + + + + DELETE FROM + form_doc_no + WHERE + doc_no_id IN + + #{docNoIds[${index}]} + + + + + + UPDATE + form_doc_no + SET + + title = #{title}, + + + summary = #{summary}, + + + type = #{type}, + + + template = #{template}, + + + start_nu = #{startNu}, + + + nu_length = #{nuLength}, + + + latest_doc_no = #{latestDocNo}, + + + is_active = #{isActive}, + + gmt_modified = #{gmtModified}, + modifier = #{modifier}, + doc_no_id = doc_no_id + WHERE + doc_no_id = #{docNoId} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/module-form/src/main/resources/static/assets/js/doc-no/doc-no.js b/module-form/src/main/resources/static/assets/js/doc-no/doc-no.js new file mode 100644 index 00000000..490101a3 --- /dev/null +++ b/module-form/src/main/resources/static/assets/js/doc-no/doc-no.js @@ -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; +} + diff --git a/module-form/src/main/resources/templates/doc-no-log/list.html b/module-form/src/main/resources/templates/doc-no-log/list.html new file mode 100644 index 00000000..9895e545 --- /dev/null +++ b/module-form/src/main/resources/templates/doc-no-log/list.html @@ -0,0 +1,299 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+
+ +
+ 新增时间 +
+ +
+
+ +
+ +
+
+ + +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/module-form/src/main/resources/templates/doc-no-log/save.html b/module-form/src/main/resources/templates/doc-no-log/save.html new file mode 100644 index 00000000..5225ec35 --- /dev/null +++ b/module-form/src/main/resources/templates/doc-no-log/save.html @@ -0,0 +1,141 @@ + + + + + + + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/module-form/src/main/resources/templates/doc-no-log/update.html b/module-form/src/main/resources/templates/doc-no-log/update.html new file mode 100644 index 00000000..ffa22a78 --- /dev/null +++ b/module-form/src/main/resources/templates/doc-no-log/update.html @@ -0,0 +1,158 @@ + + + + + + + + + + + + + +
+
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/module-form/src/main/resources/templates/doc-no/list.html b/module-form/src/main/resources/templates/doc-no/list.html new file mode 100644 index 00000000..cd09c098 --- /dev/null +++ b/module-form/src/main/resources/templates/doc-no/list.html @@ -0,0 +1,298 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+
+ +
+ +
+
+ + +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/module-form/src/main/resources/templates/doc-no/save.html b/module-form/src/main/resources/templates/doc-no/save.html new file mode 100644 index 00000000..8ea26a64 --- /dev/null +++ b/module-form/src/main/resources/templates/doc-no/save.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
1.占位符格式必须一致,否则无法正确生成文号。除占位符外,其余符号可按需补充
+
2.模板支持的占位符有:年(完整):yyyy,年(简写):yy,月:MM,日:dd,数字:nn
+
3.年的占位符只能有一个
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
1.开始编号:确定了文号生成的第一个值,后续以此累加
+
2.编号长度:确定了文号累加数字的位数
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ 文号示例: +
+
+ +
+ + +
+
+
+
+ +
+
+ +
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/module-form/src/main/resources/templates/doc-no/update.html b/module-form/src/main/resources/templates/doc-no/update.html new file mode 100644 index 00000000..30a31ba5 --- /dev/null +++ b/module-form/src/main/resources/templates/doc-no/update.html @@ -0,0 +1,199 @@ + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
1.占位符格式必须一致,否则无法正确生成文号。除占位符外,其余符号可按需补充
+
2.模板支持的占位符有:年(完整):yyyy,年(简写):yy,月:MM,日:dd,数字:nn
+
3.年的占位符只能有一个
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
1.开始编号:确定了文号生成的第一个值,后续以此累加
+
2.编号长度:确定了文号累加数字的位数
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ 文号示例: +
+
+ +
+ + +
+
+
+
+
+
+ +
+
+
+
+
+
+ + + + + \ No newline at end of file