diff --git a/docs/jsh_erp.sql b/docs/jsh_erp.sql index 3156794d..7ffe3e9c 100644 --- a/docs/jsh_erp.sql +++ b/docs/jsh_erp.sql @@ -972,3 +972,21 @@ INSERT INTO `jsh_user_business` VALUES ('66', 'UserRole', '130', '[10]', null, ' INSERT INTO `jsh_user_business` VALUES ('67', 'UserRole', '131', '[17]', null, '0'); INSERT INTO `jsh_user_business` VALUES ('68', 'RoleFunctions', '16', '[210]', null, '0'); INSERT INTO `jsh_user_business` VALUES ('69', 'RoleFunctions', '17', '[210][211][241][33][199][242][41][200][201][202][40][232][233][197][203][204][205][206][212]', '[{\"funId\":\"241\",\"btnStr\":\"1,2\"},{\"funId\":\"33\",\"btnStr\":\"1,2\"},{\"funId\":\"199\",\"btnStr\":\"1,2\"},{\"funId\":\"242\",\"btnStr\":\"1,2\"},{\"funId\":\"41\",\"btnStr\":\"1,2\"},{\"funId\":\"200\",\"btnStr\":\"1,2\"},{\"funId\":\"210\",\"btnStr\":\"1,2\"},{\"funId\":\"211\",\"btnStr\":\"1,2\"},{\"funId\":\"197\",\"btnStr\":\"1\"},{\"funId\":\"203\",\"btnStr\":\"1\"},{\"funId\":\"204\",\"btnStr\":\"1\"},{\"funId\":\"205\",\"btnStr\":\"1\"},{\"funId\":\"206\",\"btnStr\":\"1\"},{\"funId\":\"212\",\"btnStr\":\"1\"},{\"funId\":\"201\",\"btnStr\":\"1,2\"},{\"funId\":\"202\",\"btnStr\":\"1,2\"},{\"funId\":\"40\",\"btnStr\":\"1,2\"},{\"funId\":\"232\",\"btnStr\":\"1,2\"},{\"funId\":\"233\",\"btnStr\":\"1,2\"}]', '0'); + +-- ---------------------------- +-- Table structure for jsh_platform_config +-- ---------------------------- +DROP TABLE IF EXISTS `jsh_platform_config`; +CREATE TABLE `jsh_platform_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `platform_key` varchar(100) DEFAULT NULL COMMENT '关键词', + `platform_key_info` varchar(100) DEFAULT NULL COMMENT '关键词名称', + `platform_value` varchar(200) DEFAULT NULL COMMENT '值', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='平台参数'; + +-- ---------------------------- +-- Records of jsh_platform_config +-- ---------------------------- +INSERT INTO `jsh_platform_config` VALUES ('1', 'platform_name', '平台名称', '华夏ERP'); +INSERT INTO `jsh_platform_config` VALUES ('2', 'activation_code', '激活码', null); diff --git a/docs/数据库更新记录-方便升级.txt b/docs/数据库更新记录-方便升级.txt index dd7e2ef8..71160de2 100644 --- a/docs/数据库更新记录-方便升级.txt +++ b/docs/数据库更新记录-方便升级.txt @@ -1020,4 +1020,22 @@ alter table jsh_depot_item change delete_Flag delete_flag varchar(1) DEFAULT '0' alter table jsh_depot_head add creator bigint(20) DEFAULT NULL COMMENT '操作员' after hands_person_id; alter table jsh_account_head add creator bigint(20) DEFAULT NULL COMMENT '操作员' after hands_person_id; alter table jsh_depot_head drop column oper_person_name; -update jsh_depot_head set creator=hands_person_id; \ No newline at end of file +update jsh_depot_head set creator=hands_person_id; + + +-- -------------------------------------------------------- +-- 时间 2020年10月17日 +-- by jishenghua +-- 增加平台表 +-- -------------------------------------------------------- +DROP TABLE IF EXISTS `jsh_platform_config`; +CREATE TABLE `jsh_platform_config` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `platform_key` varchar(100) DEFAULT NULL COMMENT '关键词', + `platform_key_info` varchar(100) DEFAULT NULL COMMENT '关键词名称', + `platform_value` varchar(200) DEFAULT NULL COMMENT '值', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='平台参数'; + +INSERT INTO `jsh_platform_config` VALUES ('1', 'platform_name', '平台名称', '华夏ERP'); +INSERT INTO `jsh_platform_config` VALUES ('2', 'activation_code', '激活码', null); \ No newline at end of file diff --git a/erp_web/pages/manage/plugin.html b/erp_web/pages/manage/plugin.html index 84f41118..201d6a43 100644 --- a/erp_web/pages/manage/plugin.html +++ b/erp_web/pages/manage/plugin.html @@ -33,7 +33,7 @@ 重置
- 获取序列号 + 填写激活码
@@ -61,6 +61,32 @@ 取消 + +
+
+ + + + + + + + + +
机器码   + +
激活码   + +
+
+
+
+ 保存 + 取消 +
+ \ No newline at end of file diff --git a/src/main/java/com/jsh/erp/config/TenantConfig.java b/src/main/java/com/jsh/erp/config/TenantConfig.java index 94cd09c7..8ef97a2e 100644 --- a/src/main/java/com/jsh/erp/config/TenantConfig.java +++ b/src/main/java/com/jsh/erp/config/TenantConfig.java @@ -63,7 +63,7 @@ public class TenantConfig { // 这里可以判断是否过滤表 if ("jsh_material_property".equals(tableName) || "jsh_sequence".equals(tableName) || "jsh_user_business".equals(tableName) || "jsh_function".equals(tableName) - || "jsh_tenant".equals(tableName)) { + || "jsh_platform_config".equals(tableName)|| "jsh_tenant".equals(tableName)) { return true; } else { return false; diff --git a/src/main/java/com/jsh/erp/controller/DepotItemController.java b/src/main/java/com/jsh/erp/controller/DepotItemController.java index 52a26e5f..5b964700 100644 --- a/src/main/java/com/jsh/erp/controller/DepotItemController.java +++ b/src/main/java/com/jsh/erp/controller/DepotItemController.java @@ -7,13 +7,12 @@ import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.vo.DepotItemStockWarningCount; import com.jsh.erp.exception.BusinessRunTimeException; -import com.jsh.erp.service.MaterialExtend.MaterialExtendService; +import com.jsh.erp.service.materialExtend.MaterialExtendService; import com.jsh.erp.service.depotItem.DepotItemService; import com.jsh.erp.service.material.MaterialService; import com.jsh.erp.utils.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.dao.DataAccessException; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -22,7 +21,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.math.BigDecimal; import java.text.DecimalFormat; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; diff --git a/src/main/java/com/jsh/erp/controller/MaterialExtendController.java b/src/main/java/com/jsh/erp/controller/MaterialExtendController.java index a8728323..7711901f 100644 --- a/src/main/java/com/jsh/erp/controller/MaterialExtendController.java +++ b/src/main/java/com/jsh/erp/controller/MaterialExtendController.java @@ -3,24 +3,19 @@ package com.jsh.erp.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.jsh.erp.datasource.vo.MaterialExtendVo4List; -import com.jsh.erp.service.MaterialExtend.MaterialExtendService; +import com.jsh.erp.service.materialExtend.MaterialExtendService; import com.jsh.erp.utils.BaseResponseInfo; -import com.jsh.erp.utils.ErpInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.dao.DataAccessException; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.jsh.erp.utils.ResponseJsonUtil.returnJson; - /** * @author jijiaqing */ diff --git a/src/main/java/com/jsh/erp/controller/PlatformConfigController.java b/src/main/java/com/jsh/erp/controller/PlatformConfigController.java new file mode 100644 index 00000000..c9a51daf --- /dev/null +++ b/src/main/java/com/jsh/erp/controller/PlatformConfigController.java @@ -0,0 +1,86 @@ +package com.jsh.erp.controller; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.jsh.erp.constants.BusinessConstants; +import com.jsh.erp.constants.ExceptionConstants; +import com.jsh.erp.datasource.entities.PlatformConfig; +import com.jsh.erp.datasource.entities.Supplier; +import com.jsh.erp.exception.BusinessRunTimeException; +import com.jsh.erp.service.platformConfig.PlatformConfigService; +import com.jsh.erp.service.systemConfig.SystemConfigService; +import com.jsh.erp.service.user.UserService; +import com.jsh.erp.utils.*; +import jxl.Sheet; +import jxl.Workbook; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.dao.DataAccessException; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.jsh.erp.utils.ResponseJsonUtil.returnJson; + +/** + * @author ji|sheng|hua 华夏erp + */ +@RestController +@RequestMapping(value = "/platformConfig") +public class PlatformConfigController { + private Logger logger = LoggerFactory.getLogger(PlatformConfigController.class); + + @Resource + private PlatformConfigService platformConfigService; + + /** + * 根据platformKey更新platformValue + * @param platformKey + * @param platformValue + * @param request + * @return + */ + @PostMapping(value = "/updatePlatformConfigByKey") + public String updatePlatformConfigByKey(@RequestParam("platformKey") String platformKey, + @RequestParam("platformValue") String platformValue, + HttpServletRequest request)throws Exception { + Map objectMap = new HashMap(); + int res = platformConfigService.updatePlatformConfigByKey(platformKey, platformValue); + if(res > 0) { + return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); + } else { + return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code); + } + } + + /** + * 根据platformKey查询信息 + * @param platformKey + * @param request + * @return + */ + @GetMapping(value = "/getPlatformConfigByKey") + public BaseResponseInfo getPlatformConfigByKey(@RequestParam("platformKey") String platformKey, + HttpServletRequest request)throws Exception { + BaseResponseInfo res = new BaseResponseInfo(); + try { + PlatformConfig platformConfig = platformConfigService.getPlatformConfigByKey(platformKey); + res.code = 200; + res.data = platformConfig; + } catch(Exception e){ + e.printStackTrace(); + res.code = 500; + res.data = "获取数据失败"; + } + return res; + } +} diff --git a/src/main/java/com/jsh/erp/datasource/entities/PlatformConfig.java b/src/main/java/com/jsh/erp/datasource/entities/PlatformConfig.java new file mode 100644 index 00000000..8905caee --- /dev/null +++ b/src/main/java/com/jsh/erp/datasource/entities/PlatformConfig.java @@ -0,0 +1,43 @@ +package com.jsh.erp.datasource.entities; + +public class PlatformConfig { + private Long id; + + private String platformKey; + + private String platformKeyInfo; + + private String platformValue; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPlatformKey() { + return platformKey; + } + + public void setPlatformKey(String platformKey) { + this.platformKey = platformKey == null ? null : platformKey.trim(); + } + + public String getPlatformKeyInfo() { + return platformKeyInfo; + } + + public void setPlatformKeyInfo(String platformKeyInfo) { + this.platformKeyInfo = platformKeyInfo == null ? null : platformKeyInfo.trim(); + } + + public String getPlatformValue() { + return platformValue; + } + + public void setPlatformValue(String platformValue) { + this.platformValue = platformValue == null ? null : platformValue.trim(); + } +} \ No newline at end of file diff --git a/src/main/java/com/jsh/erp/datasource/entities/PlatformConfigExample.java b/src/main/java/com/jsh/erp/datasource/entities/PlatformConfigExample.java new file mode 100644 index 00000000..106959eb --- /dev/null +++ b/src/main/java/com/jsh/erp/datasource/entities/PlatformConfigExample.java @@ -0,0 +1,469 @@ +package com.jsh.erp.datasource.entities; + +import java.util.ArrayList; +import java.util.List; + +public class PlatformConfigExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public PlatformConfigExample() { + oredCriteria = new ArrayList<>(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andPlatformKeyIsNull() { + addCriterion("platform_key is null"); + return (Criteria) this; + } + + public Criteria andPlatformKeyIsNotNull() { + addCriterion("platform_key is not null"); + return (Criteria) this; + } + + public Criteria andPlatformKeyEqualTo(String value) { + addCriterion("platform_key =", value, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyNotEqualTo(String value) { + addCriterion("platform_key <>", value, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyGreaterThan(String value) { + addCriterion("platform_key >", value, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyGreaterThanOrEqualTo(String value) { + addCriterion("platform_key >=", value, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyLessThan(String value) { + addCriterion("platform_key <", value, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyLessThanOrEqualTo(String value) { + addCriterion("platform_key <=", value, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyLike(String value) { + addCriterion("platform_key like", value, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyNotLike(String value) { + addCriterion("platform_key not like", value, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyIn(List values) { + addCriterion("platform_key in", values, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyNotIn(List values) { + addCriterion("platform_key not in", values, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyBetween(String value1, String value2) { + addCriterion("platform_key between", value1, value2, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyNotBetween(String value1, String value2) { + addCriterion("platform_key not between", value1, value2, "platformKey"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoIsNull() { + addCriterion("platform_key_info is null"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoIsNotNull() { + addCriterion("platform_key_info is not null"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoEqualTo(String value) { + addCriterion("platform_key_info =", value, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoNotEqualTo(String value) { + addCriterion("platform_key_info <>", value, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoGreaterThan(String value) { + addCriterion("platform_key_info >", value, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoGreaterThanOrEqualTo(String value) { + addCriterion("platform_key_info >=", value, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoLessThan(String value) { + addCriterion("platform_key_info <", value, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoLessThanOrEqualTo(String value) { + addCriterion("platform_key_info <=", value, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoLike(String value) { + addCriterion("platform_key_info like", value, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoNotLike(String value) { + addCriterion("platform_key_info not like", value, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoIn(List values) { + addCriterion("platform_key_info in", values, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoNotIn(List values) { + addCriterion("platform_key_info not in", values, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoBetween(String value1, String value2) { + addCriterion("platform_key_info between", value1, value2, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformKeyInfoNotBetween(String value1, String value2) { + addCriterion("platform_key_info not between", value1, value2, "platformKeyInfo"); + return (Criteria) this; + } + + public Criteria andPlatformValueIsNull() { + addCriterion("platform_value is null"); + return (Criteria) this; + } + + public Criteria andPlatformValueIsNotNull() { + addCriterion("platform_value is not null"); + return (Criteria) this; + } + + public Criteria andPlatformValueEqualTo(String value) { + addCriterion("platform_value =", value, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueNotEqualTo(String value) { + addCriterion("platform_value <>", value, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueGreaterThan(String value) { + addCriterion("platform_value >", value, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueGreaterThanOrEqualTo(String value) { + addCriterion("platform_value >=", value, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueLessThan(String value) { + addCriterion("platform_value <", value, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueLessThanOrEqualTo(String value) { + addCriterion("platform_value <=", value, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueLike(String value) { + addCriterion("platform_value like", value, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueNotLike(String value) { + addCriterion("platform_value not like", value, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueIn(List values) { + addCriterion("platform_value in", values, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueNotIn(List values) { + addCriterion("platform_value not in", values, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueBetween(String value1, String value2) { + addCriterion("platform_value between", value1, value2, "platformValue"); + return (Criteria) this; + } + + public Criteria andPlatformValueNotBetween(String value1, String value2) { + addCriterion("platform_value not between", value1, value2, "platformValue"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/jsh/erp/datasource/mappers/PlatformConfigMapper.java b/src/main/java/com/jsh/erp/datasource/mappers/PlatformConfigMapper.java new file mode 100644 index 00000000..08d6062f --- /dev/null +++ b/src/main/java/com/jsh/erp/datasource/mappers/PlatformConfigMapper.java @@ -0,0 +1,30 @@ +package com.jsh.erp.datasource.mappers; + +import com.jsh.erp.datasource.entities.PlatformConfig; +import com.jsh.erp.datasource.entities.PlatformConfigExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface PlatformConfigMapper { + long countByExample(PlatformConfigExample example); + + int deleteByExample(PlatformConfigExample example); + + int deleteByPrimaryKey(Long id); + + int insert(PlatformConfig record); + + int insertSelective(PlatformConfig record); + + List selectByExample(PlatformConfigExample example); + + PlatformConfig selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") PlatformConfig record, @Param("example") PlatformConfigExample example); + + int updateByExample(@Param("record") PlatformConfig record, @Param("example") PlatformConfigExample example); + + int updateByPrimaryKeySelective(PlatformConfig record); + + int updateByPrimaryKey(PlatformConfig record); +} \ No newline at end of file diff --git a/src/main/java/com/jsh/erp/datasource/mappers/PlatformConfigMapperEx.java b/src/main/java/com/jsh/erp/datasource/mappers/PlatformConfigMapperEx.java new file mode 100644 index 00000000..dcedf05d --- /dev/null +++ b/src/main/java/com/jsh/erp/datasource/mappers/PlatformConfigMapperEx.java @@ -0,0 +1,19 @@ +package com.jsh.erp.datasource.mappers; + +import com.jsh.erp.datasource.entities.PlatformConfig; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +public interface PlatformConfigMapperEx { + + List selectByConditionPlatformConfig( + @Param("key") String key, + @Param("offset") Integer offset, + @Param("rows") Integer rows); + + Long countsByPlatformConfig( + @Param("key") String key); + +} \ No newline at end of file diff --git a/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendComponent.java b/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendComponent.java index d4184446..837a79a5 100644 --- a/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendComponent.java +++ b/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendComponent.java @@ -1,4 +1,4 @@ -package com.jsh.erp.service.MaterialExtend; +package com.jsh.erp.service.materialExtend; import com.jsh.erp.service.ICommonQuery; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendResource.java b/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendResource.java index cf919d03..0c666502 100644 --- a/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendResource.java +++ b/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendResource.java @@ -1,4 +1,4 @@ -package com.jsh.erp.service.MaterialExtend; +package com.jsh.erp.service.materialExtend; import com.jsh.erp.service.ResourceInfo; diff --git a/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendService.java b/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendService.java index 4863ad97..1a457f51 100644 --- a/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendService.java +++ b/src/main/java/com/jsh/erp/service/MaterialExtend/MaterialExtendService.java @@ -1,4 +1,4 @@ -package com.jsh.erp.service.MaterialExtend; +package com.jsh.erp.service.materialExtend; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -23,7 +23,6 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java index 7fe6e8f2..260b9caa 100644 --- a/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java +++ b/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java @@ -10,7 +10,7 @@ import com.jsh.erp.datasource.vo.DepotItemStockWarningCount; import com.jsh.erp.datasource.vo.DepotItemVo4Stock; import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.JshException; -import com.jsh.erp.service.MaterialExtend.MaterialExtendService; +import com.jsh.erp.service.materialExtend.MaterialExtendService; import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.material.MaterialService; import com.jsh.erp.service.serialNumber.SerialNumberService; @@ -22,8 +22,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; diff --git a/src/main/java/com/jsh/erp/service/material/MaterialService.java b/src/main/java/com/jsh/erp/service/material/MaterialService.java index 47dc7fff..668742ea 100644 --- a/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -10,7 +10,7 @@ import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.mappers.*; import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.JshException; -import com.jsh.erp.service.MaterialExtend.MaterialExtendService; +import com.jsh.erp.service.materialExtend.MaterialExtendService; import com.jsh.erp.service.depot.DepotService; import com.jsh.erp.service.depotItem.DepotItemService; import com.jsh.erp.service.log.LogService; @@ -20,7 +20,6 @@ import com.jsh.erp.service.user.UserService; import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.ExcelUtils; import com.jsh.erp.utils.StringUtil; -import jxl.Cell; import jxl.Sheet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigComponent.java b/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigComponent.java new file mode 100644 index 00000000..62937fef --- /dev/null +++ b/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigComponent.java @@ -0,0 +1,69 @@ +package com.jsh.erp.service.platformConfig; + +import com.jsh.erp.service.ICommonQuery; +import com.jsh.erp.utils.Constants; +import com.jsh.erp.utils.QueryUtils; +import com.jsh.erp.utils.StringUtil; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Map; + +@Service(value = "platformConfig_component") +@PlatformConfigResource +public class PlatformConfigComponent implements ICommonQuery { + + @Resource + private PlatformConfigService platformConfigService; + + @Override + public Object selectOne(Long id) throws Exception { + return platformConfigService.getPlatformConfig(id); + } + + @Override + public List select(Map map)throws Exception { + return getPlatformConfigList(map); + } + + private List getPlatformConfigList(Map map)throws Exception { + String search = map.get(Constants.SEARCH); + String key = StringUtil.getInfo(search, "key"); + return platformConfigService.select(key, QueryUtils.offset(map), QueryUtils.rows(map)); + } + + @Override + public Long counts(Map map)throws Exception { + String search = map.get(Constants.SEARCH); + String key = StringUtil.getInfo(search, "key"); + return platformConfigService.countPlatformConfig(key); + } + + @Override + public int insert(String beanJson, HttpServletRequest request)throws Exception { + return platformConfigService.insertSystemConfig(beanJson, request); + } + + @Override + public int update(String beanJson, Long id, HttpServletRequest request)throws Exception { + return platformConfigService.updateSystemConfig(beanJson, id, request); + } + + @Override + public int delete(Long id, HttpServletRequest request)throws Exception { + return platformConfigService.deleteSystemConfig(id, request); + } + + @Override + public int batchDelete(String ids, HttpServletRequest request)throws Exception { + return platformConfigService.batchDeleteSystemConfig(ids, request); + } + + @Override + public int checkIsNameExist(Long id, String name)throws Exception { + return 0; + } + +} diff --git a/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigResource.java b/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigResource.java new file mode 100644 index 00000000..85322830 --- /dev/null +++ b/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigResource.java @@ -0,0 +1,15 @@ +package com.jsh.erp.service.platformConfig; + +import com.jsh.erp.service.ResourceInfo; + +import java.lang.annotation.*; + +/** + * @author jishenghua qq752718920 2020-10-16 22:26:27 + */ +@ResourceInfo(value = "platformConfig") +@Inherited +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface PlatformConfigResource { +} diff --git a/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigService.java b/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigService.java new file mode 100644 index 00000000..d75d860e --- /dev/null +++ b/src/main/java/com/jsh/erp/service/platformConfig/PlatformConfigService.java @@ -0,0 +1,149 @@ +package com.jsh.erp.service.platformConfig; + +import com.alibaba.fastjson.JSONObject; +import com.jsh.erp.datasource.entities.PlatformConfig; +import com.jsh.erp.datasource.entities.PlatformConfigExample; +import com.jsh.erp.datasource.mappers.PlatformConfigMapper; +import com.jsh.erp.datasource.mappers.PlatformConfigMapperEx; +import com.jsh.erp.exception.JshException; +import com.jsh.erp.utils.StringUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@Service +public class PlatformConfigService { + private Logger logger = LoggerFactory.getLogger(PlatformConfigService.class); + + @Resource + private PlatformConfigMapper platformConfigMapper; + + @Resource + private PlatformConfigMapperEx platformConfigMapperEx; + + public PlatformConfig getPlatformConfig(long id)throws Exception { + PlatformConfig result=null; + try{ + result=platformConfigMapper.selectByPrimaryKey(id); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return result; + } + + public List getPlatformConfig()throws Exception { + PlatformConfigExample example = new PlatformConfigExample(); + example.createCriteria(); + List list=null; + try{ + list=platformConfigMapper.selectByExample(example); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + + public List select(String key, int offset, int rows)throws Exception { + List list=null; + try{ + list=platformConfigMapperEx.selectByConditionPlatformConfig(key, offset, rows); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return list; + } + + public Long countPlatformConfig(String key)throws Exception { + Long result=null; + try{ + result=platformConfigMapperEx.countsByPlatformConfig(key); + }catch(Exception e){ + JshException.readFail(logger, e); + } + return result; + } + + @Transactional(value = "transactionManager", rollbackFor = Exception.class) + public int insertSystemConfig(String beanJson, HttpServletRequest request) throws Exception{ + PlatformConfig platformConfig = JSONObject.parseObject(beanJson, PlatformConfig.class); + int result=0; + try{ + result=platformConfigMapper.insertSelective(platformConfig); + }catch(Exception e){ + JshException.writeFail(logger, e); + } + return result; + } + + @Transactional(value = "transactionManager", rollbackFor = Exception.class) + public int updateSystemConfig(String beanJson, Long id, HttpServletRequest request) throws Exception{ + PlatformConfig platformConfig = JSONObject.parseObject(beanJson, PlatformConfig.class); + platformConfig.setId(id); + int result=0; + try{ + result = platformConfigMapper.updateByPrimaryKeySelective(platformConfig); + }catch(Exception e){ + JshException.writeFail(logger, e); + } + return result; + } + + @Transactional(value = "transactionManager", rollbackFor = Exception.class) + public int deleteSystemConfig(Long id, HttpServletRequest request)throws Exception { + int result=0; + try{ + result=platformConfigMapper.deleteByPrimaryKey(id); + }catch(Exception e){ + JshException.writeFail(logger, e); + } + return result; + } + + @Transactional(value = "transactionManager", rollbackFor = Exception.class) + public int batchDeleteSystemConfig(String ids, HttpServletRequest request)throws Exception { + List idList = StringUtil.strToLongList(ids); + PlatformConfigExample example = new PlatformConfigExample(); + example.createCriteria().andIdIn(idList); + int result=0; + try{ + result=platformConfigMapper.deleteByExample(example); + }catch(Exception e){ + JshException.writeFail(logger, e); + } + return result; + } + + public int updatePlatformConfigByKey(String platformKey, String platformValue)throws Exception { + int result=0; + try{ + PlatformConfig platformConfig = new PlatformConfig(); + platformConfig.setPlatformValue(platformValue); + PlatformConfigExample example = new PlatformConfigExample(); + example.createCriteria().andPlatformKeyEqualTo(platformKey); + result = platformConfigMapper.updateByExampleSelective(platformConfig, example); + }catch(Exception e){ + JshException.writeFail(logger, e); + } + return result; + } + + public PlatformConfig getPlatformConfigByKey(String platformKey)throws Exception { + PlatformConfig platformConfig = new PlatformConfig(); + try{ + PlatformConfigExample example = new PlatformConfigExample(); + example.createCriteria().andPlatformKeyEqualTo(platformKey); + List list=platformConfigMapper.selectByExample(example); + if(list!=null && list.size()>0){ + platformConfig = list.get(0); + } + }catch(Exception e){ + JshException.readFail(logger, e); + } + return platformConfig; + } +} diff --git a/src/main/resources/mapper_xml/PlatformConfigMapper.xml b/src/main/resources/mapper_xml/PlatformConfigMapper.xml new file mode 100644 index 00000000..d623769c --- /dev/null +++ b/src/main/resources/mapper_xml/PlatformConfigMapper.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, platform_key, platform_key_info, platform_value + + + + + delete from jsh_platform_config + where id = #{id,jdbcType=BIGINT} + + + delete from jsh_platform_config + + + + + + insert into jsh_platform_config (id, platform_key, platform_key_info, + platform_value) + values (#{id,jdbcType=BIGINT}, #{platformKey,jdbcType=VARCHAR}, #{platformKeyInfo,jdbcType=VARCHAR}, + #{platformValue,jdbcType=VARCHAR}) + + + insert into jsh_platform_config + + + id, + + + platform_key, + + + platform_key_info, + + + platform_value, + + + + + #{id,jdbcType=BIGINT}, + + + #{platformKey,jdbcType=VARCHAR}, + + + #{platformKeyInfo,jdbcType=VARCHAR}, + + + #{platformValue,jdbcType=VARCHAR}, + + + + + + update jsh_platform_config + + + id = #{record.id,jdbcType=BIGINT}, + + + platform_key = #{record.platformKey,jdbcType=VARCHAR}, + + + platform_key_info = #{record.platformKeyInfo,jdbcType=VARCHAR}, + + + platform_value = #{record.platformValue,jdbcType=VARCHAR}, + + + + + + + + update jsh_platform_config + set id = #{record.id,jdbcType=BIGINT}, + platform_key = #{record.platformKey,jdbcType=VARCHAR}, + platform_key_info = #{record.platformKeyInfo,jdbcType=VARCHAR}, + platform_value = #{record.platformValue,jdbcType=VARCHAR} + + + + + + update jsh_platform_config + + + platform_key = #{platformKey,jdbcType=VARCHAR}, + + + platform_key_info = #{platformKeyInfo,jdbcType=VARCHAR}, + + + platform_value = #{platformValue,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update jsh_platform_config + set platform_key = #{platformKey,jdbcType=VARCHAR}, + platform_key_info = #{platformKeyInfo,jdbcType=VARCHAR}, + platform_value = #{platformValue,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/src/test/resources/generatorConfig.xml b/src/test/resources/generatorConfig.xml index 3294b55e..de4520f0 100644 --- a/src/test/resources/generatorConfig.xml +++ b/src/test/resources/generatorConfig.xml @@ -67,6 +67,7 @@
+
-->