zouxuan 5 năm trước cách đây
mục cha
commit
76d0f50d8f

+ 2 - 2
edu-cms/src/main/resources/application.yml

@@ -58,8 +58,8 @@ swagger:
 security:
   oauth2:
     client:
-      client-id: app
-      client-secret: app
+      client-id: student
+      client-secret: student
     resource:
       token-info-uri: http://localhost:8001/oauth/check_token
   

+ 25 - 0
edu-common/src/main/java/com/keao/edu/common/dal/dao/SysConfigDao.java

@@ -0,0 +1,25 @@
+package com.keao.edu.common.dal.dao;
+
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.entity.SysConfig;
+
+public interface SysConfigDao extends BaseDAO<Long, SysConfig> {
+
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/10/9
+     * @params [paramName]
+     * @return com.ym.mec.biz.dal.entity.SysConfig
+     * @describe 根据配置名称获取配置信息
+     */
+    SysConfig findByParamName(String paramName);
+
+    /**
+     * 获取value
+     * @param paramName
+     * @return
+     */
+    String findConfigValue(String paramName);
+	
+}

+ 104 - 0
edu-common/src/main/java/com/keao/edu/common/entity/SysConfig.java

@@ -0,0 +1,104 @@
+package com.keao.edu.common.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(sys_config):
+ */
+public class SysConfig {
+
+	/**  */
+	private Long id;
+	
+	/** 参数名称 */
+	@ApiModelProperty(value = "参数名称", required = true)
+	private String paramName;
+	
+	/** 参数值 */
+	@ApiModelProperty(value = "参数值", required = true)
+	private String paranValue;
+	
+	/** 描述 */
+	@ApiModelProperty(value = "描述", required = true)
+	private String description;
+	
+	/** 创建时间 */
+	private java.util.Date createOn;
+	
+	/** 修改时间 */
+	private java.util.Date modifyOn;
+	
+	@ApiModelProperty(value = "消息组", required = true)
+	private String group;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setParamName(String paramName){
+		this.paramName = paramName;
+	}
+	
+	public String getParamName(){
+		return this.paramName;
+	}
+			
+	public void setParanValue(String paranValue){
+		this.paranValue = paranValue;
+	}
+	
+	public String getParanValue(){
+		return this.paranValue;
+	}
+
+	public <T> T getParanValue(Class<T> cla){
+		try {
+			return cla.cast(cla.getMethod("valueOf", String.class).invoke(cla.getInterfaces(),this.paranValue));
+		} catch (Exception e) {
+			return (T)this.paranValue.getClass();
+		}
+	}
+			
+	public void setDescription(String description){
+		this.description = description;
+	}
+	
+	public String getDescription(){
+		return this.description;
+	}
+			
+	public void setCreateOn(java.util.Date createOn){
+		this.createOn = createOn;
+	}
+	
+	public java.util.Date getCreateOn(){
+		return this.createOn;
+	}
+			
+	public void setModifyOn(java.util.Date modifyOn){
+		this.modifyOn = modifyOn;
+	}
+	
+	public java.util.Date getModifyOn(){
+		return this.modifyOn;
+	}
+			
+	public String getGroup() {
+		return group;
+	}
+
+	public void setGroup(String group) {
+		this.group = group;
+	}
+
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 14 - 0
edu-common/src/main/java/com/keao/edu/common/service/SysConfigService.java

@@ -0,0 +1,14 @@
+package com.keao.edu.common.service;
+
+
+import com.keao.edu.common.entity.SysConfig;
+
+public interface SysConfigService extends BaseService<Long, SysConfig> {
+
+    /**
+     * @return com.ym.mec.biz.dal.entity.SysConfig
+     * @params paramName
+     * @describe 根据配置名称获取配置信息
+     */
+    SysConfig findByParamName(String paramName);
+}

+ 26 - 0
edu-common/src/main/java/com/keao/edu/common/service/impl/SysConfigServiceImpl.java

@@ -0,0 +1,26 @@
+package com.keao.edu.common.service.impl;
+
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.dal.dao.SysConfigDao;
+import com.keao.edu.common.entity.SysConfig;
+import com.keao.edu.common.service.SysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SysConfigServiceImpl extends BaseServiceImpl<Long, SysConfig>  implements SysConfigService {
+	
+	@Autowired
+	private SysConfigDao sysConfigDao;
+
+	@Override
+	public BaseDAO<Long, SysConfig> getDAO() {
+		return sysConfigDao;
+	}
+
+	@Override
+	public SysConfig findByParamName(String paramName) {
+		return sysConfigDao.findByParamName(paramName);
+	}
+}

+ 85 - 0
edu-common/src/main/resources/config.mybatis/SysConfigMapper.xml

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
+<mapper namespace="com.keao.edu.common.dal.dao.SysConfigDao">
+
+	<resultMap type="com.keao.edu.common.entity.SysConfig" id="SysConfig">
+		<result column="id_" property="id" />
+		<result column="param_name_" property="paramName" />
+		<result column="paran_value_" property="paranValue" />
+		<result column="description_" property="description" />
+		<result column="create_on_" property="createOn" />
+		<result column="modify_on_" property="modifyOn" />
+		<result column="group_" property="group" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="SysConfig">
+		SELECT * FROM sys_config WHERE id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="SysConfig">
+		SELECT * FROM sys_config where 1=1
+		<if test="group != null">
+			and group_ = #{group}
+		</if>
+		ORDER BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.keao.edu.common.entity.SysConfig"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO sys_config
+		(id_,param_name_,paran_value_,description_,create_on_,modify_on_,group_)
+		VALUES(#{id},#{paramName},#{paranValue},#{description},#{createOn},#{modifyOn},#{group})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.keao.edu.common.entity.SysConfig">
+		UPDATE sys_config
+		<set>
+			<if test="modifyOn != null">
+				modify_on_ = #{modifyOn},
+			</if>
+			<if test="paranValue != null">
+				paran_value_ = #{paranValue},
+			</if>
+			<if test="description != null">
+				description_ = #{description},
+			</if>
+			<if test="paramName != null">
+				param_name_ = #{paramName},
+			</if>
+			<if test="group != null">
+				group_ = #{group},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM sys_config WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="SysConfig" parameterType="map">
+		SELECT * FROM sys_config ORDER BY id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM sys_config
+	</select>
+	
+	<select id="findByParamName" resultMap="SysConfig">
+		SELECT * FROM sys_config WHERE param_name_ = #{paramName}
+	</select>
+    <select id="findConfigValue" resultType="java.lang.String">
+		SELECT paran_value_ FROM sys_config WHERE param_name_ = #{paramName}
+	</select>
+</mapper>

+ 2 - 2
edu-im/edu-im-server/src/main/resources/application.yml

@@ -74,8 +74,8 @@ swagger:
 security:
   oauth2:
     client:
-      client-id: app
-      client-secret: app
+      client-id: student
+      client-secret: student
     resource:
       token-info-uri: http://localhost:8001/oauth/check_token
 

+ 2 - 2
edu-task/src/main/resources/application.yml

@@ -79,8 +79,8 @@ task:
 security:
   oauth2:
     client:
-      client-id: app
-      client-secret: app
+      client-id: student
+      client-secret: student
     resource:
       token-info-uri: http://localhost:8001/oauth/check_token
 

+ 56 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/AgencyController.java

@@ -0,0 +1,56 @@
+package com.keao.edu.user.controller;
+
+
+import com.keao.edu.common.controller.BaseController;
+import com.keao.edu.common.page.QueryInfo;
+import com.keao.edu.user.entity.Agency;
+import com.keao.edu.user.service.AgencyService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 代理商服务
+ */
+@RestController
+@Api(tags = "代理商服务")
+@RequestMapping(value = "agency")
+public class AgencyController extends BaseController {
+
+	@Autowired
+	private AgencyService agencyService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "list")
+    @PreAuthorize("@pcs.hasPermissions('agency/list')")
+	public Object configList(QueryInfo queryInfo) {
+		return succeed(agencyService.queryPage(queryInfo));
+	}
+
+	@ApiOperation(value = "修改参数")
+	@PostMapping(value = "update")
+    @PreAuthorize("@pcs.hasPermissions('agency/update')")
+	public Object update(Agency agency) {
+		agencyService.update(agency);
+		return succeed();
+	}
+
+	@ApiOperation(value = "新增参数")
+	@PostMapping(value = "add")
+    @PreAuthorize("@pcs.hasPermissions('agency/add')")
+	public Object addConfig(Agency agency) {
+		return agencyService.insert(agency);
+	}
+
+	@ApiOperation(value = "查询参数")
+	@GetMapping(value = "get")
+    @PreAuthorize("@pcs.hasPermissions('agency/get')")
+	public Object getConfig(Integer id) {
+		return succeed(agencyService.get(id));
+	}
+}

+ 87 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/SysConfigController.java

@@ -0,0 +1,87 @@
+package com.keao.edu.user.controller;
+
+
+import com.keao.edu.common.controller.BaseController;
+import com.keao.edu.common.entity.SysConfig;
+import com.keao.edu.common.service.SysConfigService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "系统参数设置")
+@RequestMapping(value = "sysConfig")
+public class SysConfigController extends BaseController {
+
+	@Autowired
+	private SysConfigService sysConfigService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "list")
+    @PreAuthorize("@pcs.hasPermissions('sysConfig/list')")
+	public Object configList(String group) {
+		Map<String,Object> params = new HashMap<String, Object>();
+		params.put("group", group);
+		List<SysConfig> configs = sysConfigService.findAll(params);
+		return succeed(configs);
+	}
+
+	@ApiOperation(value = "修改参数")
+	@PostMapping(value = "update")
+    @PreAuthorize("@pcs.hasPermissions('sysConfig/update')")
+	public Object update(SysConfig config) {
+		config.setModifyOn(new Date());
+		sysConfigService.update(config);
+		return succeed();
+	}
+
+	@ApiOperation(value = "新增参数")
+	@PostMapping(value = "add")
+    @PreAuthorize("@pcs.hasPermissions('sysConfig/add')")
+	public Object addConfig(SysConfig config) {
+		if (config == null)
+			return failed("参数无效");
+		if (StringUtils.isBlank(config.getParamName())) {
+			return failed("参数名称不能为空");
+		}
+		if (StringUtils.isBlank(config.getParanValue())) {
+			return failed("参数值不能为空");
+		}
+		config.setCreateOn(new Date());
+		config.setModifyOn(new Date());
+		return sysConfigService.insert(config) > 0 ? succeed() : failed("添加失败");
+	}
+
+	@ApiOperation(value = "查询参数")
+	@GetMapping(value = "get")
+    @PreAuthorize("@pcs.hasPermissions('sysConfig/get')")
+	public Object getConfig(Long id) {
+		if (id == null || id <= 0)
+			return failed("请检查输入的ID");
+		return succeed(sysConfigService.get(id));
+	}
+
+	@ApiOperation(value = "查询参数")
+	@GetMapping(value = "queryByParamName")
+    @PreAuthorize("@pcs.hasPermissions('sysConfig/queryByParamName')")
+	public Object queryByParamName(String paramName) {
+		if(StringUtils.isBlank(paramName)){
+			return failed("参数不能为空");
+		}
+		return succeed(sysConfigService.findByParamName(paramName));
+	}
+}

+ 10 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/AgencyDao.java

@@ -0,0 +1,10 @@
+package com.keao.edu.user.dao;
+
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.entity.Agency;
+
+public interface AgencyDao extends BaseDAO<Integer, Agency> {
+
+	
+}

+ 103 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/Agency.java

@@ -0,0 +1,103 @@
+package com.keao.edu.user.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(agency):
+ */
+public class Agency {
+
+	/**  */
+	private Integer id;
+	
+	/**  */
+	private String name;
+	
+	/**  */
+	private String contactName;
+	
+	/**  */
+	private String contactPhone;
+	
+	/** 结算类型(按人/按利润比例) */
+	private String settlementType;
+	
+	/**  */
+	private java.math.BigDecimal shareProfitAmount;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setName(String name){
+		this.name = name;
+	}
+	
+	public String getName(){
+		return this.name;
+	}
+			
+	public void setContactName(String contactName){
+		this.contactName = contactName;
+	}
+	
+	public String getContactName(){
+		return this.contactName;
+	}
+			
+	public void setContactPhone(String contactPhone){
+		this.contactPhone = contactPhone;
+	}
+	
+	public String getContactPhone(){
+		return this.contactPhone;
+	}
+			
+	public void setSettlementType(String settlementType){
+		this.settlementType = settlementType;
+	}
+	
+	public String getSettlementType(){
+		return this.settlementType;
+	}
+			
+	public void setShareProfitAmount(java.math.BigDecimal shareProfitAmount){
+		this.shareProfitAmount = shareProfitAmount;
+	}
+	
+	public java.math.BigDecimal getShareProfitAmount(){
+		return this.shareProfitAmount;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 9 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/AgencyService.java

@@ -0,0 +1,9 @@
+package com.keao.edu.user.service;
+
+
+import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.entity.Agency;
+
+public interface AgencyService extends BaseService<Integer, Agency> {
+
+}

+ 23 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/AgencyServiceImpl.java

@@ -0,0 +1,23 @@
+package com.keao.edu.user.service.impl;
+
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.user.dao.AgencyDao;
+import com.keao.edu.user.entity.Agency;
+import com.keao.edu.user.service.AgencyService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AgencyServiceImpl extends BaseServiceImpl<Integer, Agency> implements AgencyService {
+	
+	@Autowired
+	private AgencyDao agencyDao;
+
+	@Override
+	public BaseDAO<Integer, Agency> getDAO() {
+		return agencyDao;
+	}
+	
+}

+ 2 - 2
edu-user/edu-user-server/src/main/resources/application.yml

@@ -75,8 +75,8 @@ swagger:
 security:
   oauth2:
     client:
-      client-id: app
-      client-secret: app
+      client-id: student
+      client-secret: student
     resource:
       token-info-uri: http://localhost:8001/oauth/check_token
   

+ 84 - 0
edu-user/edu-user-server/src/main/resources/config.mybatis/AgencyMapper.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.keao.edu.user.dao.AgencyDao">
+	
+	<resultMap type="com.keao.edu.user.entity.Agency" id="Agency">
+		<result column="id_" property="id" />
+		<result column="name_" property="name" />
+		<result column="contact_name_" property="contactName" />
+		<result column="contact_phone_" property="contactPhone" />
+		<result column="settlement_type_" property="settlementType" />
+		<result column="share_profit_amount" property="shareProfitAmount" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="Agency" >
+		SELECT * FROM agency WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="Agency">
+		SELECT * FROM agency ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.keao.edu.datasource.dal.entity.Agency" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!--
+		<selectKey resultClass="int" keyProperty="id" > 
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
+		</selectKey>
+		-->
+		INSERT INTO agency (id_,name_,contact_name_,contact_phone_,settlement_type_,share_profit_amount,create_time_,update_time_) VALUES(#{id},#{name},#{contactName},#{contactPhone},#{settlementType},#{shareProfitAmount},#{createTime},#{updateTime})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.keao.edu.datasource.dal.entity.Agency">
+		UPDATE agency <set>
+<if test="id != null">
+id_ = #{id},
+</if>
+<if test="updateTime != null">
+update_time_ = #{updateTime},
+</if>
+<if test="contactPhone != null">
+contact_phone_ = #{contactPhone},
+</if>
+<if test="settlementType != null">
+settlement_type_ = #{settlementType},
+</if>
+<if test="contactName != null">
+contact_name_ = #{contactName},
+</if>
+<if test="shareProfitAmount != null">
+share_profit_amount = #{shareProfitAmount},
+</if>
+<if test="name != null">
+name_ = #{name},
+</if>
+<if test="createTime != null">
+create_time_ = #{createTime},
+</if>
+</set> WHERE id_ = #{id} 
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM agency WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="Agency" parameterType="map">
+		SELECT * FROM agency ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM agency
+	</select>
+</mapper>