Joburgess 5 年之前
父节点
当前提交
3483dbeec8

+ 3 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/AgencyDao.java → edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/OrganizationDao.java

@@ -2,13 +2,12 @@ package com.keao.edu.user.dao;
 
 
 import com.keao.edu.common.dal.BaseDAO;
-import com.keao.edu.user.entity.Agency;
+import com.keao.edu.user.entity.Organization;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
-import java.util.Map;
 
-public interface AgencyDao extends BaseDAO<Integer, Agency> {
+public interface OrganizationDao extends BaseDAO<Integer, Organization> {
 
     /**
      * @describe 获取指定机构下的所有代理商
@@ -17,6 +16,6 @@ public interface AgencyDao extends BaseDAO<Integer, Agency> {
      * @param tenantId:
      * @return java.util.List<com.keao.edu.user.entity.Agency>
      */
-    List<Agency> getByTenant(@Param("tenantId") String tenantId);
+    List<Organization> getByTenant(@Param("tenantId") String tenantId);
 
 }

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/Agency.java → edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/Organization.java

@@ -8,7 +8,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 /**
  * 对应数据库表(agency):
  */
-public class Agency {
+public class Organization {
 
 	/**  */
 	private Integer id;

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

@@ -1,20 +0,0 @@
-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> {
-
-    /**
-     * 新增代理商
-     * @param agency
-     */
-    void add(Agency agency);
-
-    /**
-     * 修改代理商
-     * @param agency
-     */
-    void updateAgency(Agency agency);
-}

+ 20 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/OrganizationService.java

@@ -0,0 +1,20 @@
+package com.keao.edu.user.service;
+
+
+import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.entity.Organization;
+
+public interface OrganizationService extends BaseService<Integer, Organization> {
+
+    /**
+     * 新增代理商
+     * @param agency
+     */
+    void add(Organization agency);
+
+    /**
+     * 修改代理商
+     * @param organization
+     */
+    void updateOrganization(Organization organization);
+}

+ 1 - 3
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java

@@ -48,9 +48,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
 			}
 		}
 		pageInfo.setRows(dataList);
-		List<Integer> agencyIds = new ArrayList<>();
-		agencyIds.add(3);
-		Map<Integer, String> agencyIdNameMap = this.getMap("agency", "id_", "name_", agencyIds, Integer.class, String.class);
+
 		return pageInfo;
 	}
 }

+ 17 - 17
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/AgencyServiceImpl.java → edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/OrganizationServiceImpl.java

@@ -9,10 +9,10 @@ import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.im.api.client.ImFeignService;
 import com.keao.edu.im.api.entity.ImResult;
 import com.keao.edu.im.api.entity.ImUserModel;
-import com.keao.edu.user.dao.AgencyDao;
+import com.keao.edu.user.dao.OrganizationDao;
 import com.keao.edu.user.dao.SysUserDao;
-import com.keao.edu.user.entity.Agency;
-import com.keao.edu.user.service.AgencyService;
+import com.keao.edu.user.entity.Organization;
+import com.keao.edu.user.service.OrganizationService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -20,31 +20,31 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 @Service
-public class AgencyServiceImpl extends BaseServiceImpl<Integer, Agency> implements AgencyService {
+public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organization> implements OrganizationService {
 	
 	@Autowired
-	private AgencyDao agencyDao;
+	private OrganizationDao agencyDao;
 	@Autowired
 	private ImFeignService imFeignService;
 	@Autowired
 	private SysUserDao sysUserDao;
 
 	@Override
-	public BaseDAO<Integer, Agency> getDAO() {
+	public BaseDAO<Integer, Organization> getDAO() {
 		return agencyDao;
 	}
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void add(Agency agency) {
+	public void add(Organization agency) {
 		SysUser sysUser = agency.getSysUser();
 		String tenantId = TenantContextHolder.getTenantId().toString();
 		agency.setTenantId(tenantId);
 		sysUser.setTenantId(tenantId);
 		SysUser user = sysUserDao.queryByPhone(sysUser.getPhone());
 		if(user != null && user.getId() != null){
-			Agency agency1 = agencyDao.get(user.getId());
-			if(agency1 == null){
+			Organization organization = agencyDao.get(user.getId());
+			if(organization == null){
 				if(StringUtils.isEmpty(user.getPassword())){
 					sysUser.setPassword(new BCryptPasswordEncoder().encode("123456"));
 				}
@@ -81,21 +81,21 @@ public class AgencyServiceImpl extends BaseServiceImpl<Integer, Agency> implemen
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void updateAgency(Agency agency) {
-		SysUser sysUser = agency.getSysUser();
+	public void updateOrganization(Organization organization) {
+		SysUser sysUser = organization.getSysUser();
 		if(null == agencyDao.get(sysUser.getId())){
-			throw new BizException("代理商信息不存在");
+			throw new BizException("合作商信息不存在");
 		}
-		agency.setId(sysUser.getId());
+		organization.setId(sysUser.getId());
 		if(StringUtils.isNotEmpty(sysUser.getPhone())){
 			SysUser queryByPhone = sysUserDao.queryByPhone(sysUser.getPhone());
 			if(queryByPhone != null && !sysUser.getId().equals(queryByPhone.getId())){
 				throw new BizException("手机号已存在");
 			}
 		}
-		sysUser.setRealName(agency.getName());
-		sysUser.setPhone(agency.getContactPhone());
-		agencyDao.update(agency);
+		sysUser.setRealName(organization.getName());
+		sysUser.setPhone(organization.getContactPhone());
+		agencyDao.update(organization);
 		//删除当前用户角色
 		sysUserDao.delEmployeeRole(sysUser.getId());
 		//新增用户角色
@@ -103,4 +103,4 @@ public class AgencyServiceImpl extends BaseServiceImpl<Integer, Agency> implemen
 		sysUserDao.update(sysUser);
 		imFeignService.update(new ImUserModel(sysUser.getId().toString(),sysUser.getRealName(),sysUser.getAvatar()));
 	}
-}
+}

+ 16 - 16
edu-user/edu-user-server/src/main/resources/config/mybatis/AgencyMapper.xml → edu-user/edu-user-server/src/main/resources/config/mybatis/OrganizationMapper.xml

@@ -4,9 +4,9 @@
 这个文件是自动生成的。
 不要修改此文件。所有改动将在下次重新自动生成时丢失。
 -->
-<mapper namespace="com.keao.edu.user.dao.AgencyDao">
+<mapper namespace="com.keao.edu.user.dao.OrganizationDao">
 	
-	<resultMap type="com.keao.edu.user.entity.Agency" id="Agency">
+	<resultMap type="com.keao.edu.user.entity.Organization" id="Organization">
 		<result column="id_" property="id" />
 		<result column="name_" property="name" />
 		<result column="contact_name_" property="contactName" />
@@ -20,25 +20,25 @@
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
-	<select id="get" resultMap="Agency" >
-		SELECT * FROM agency WHERE id_ = #{id} 
+	<select id="get" resultMap="Organization" >
+		SELECT * FROM organization WHERE id_ = #{id}
 	</select>
 	
 	<!-- 全查询 -->
-	<select id="findAll" resultMap="Agency">
-		SELECT * FROM agency WHERE tenant_id_ = #{tenantId} ORDER BY id_
+	<select id="findAll" resultMap="Organization">
+		SELECT * FROM organization WHERE tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
-	<insert id="insert" parameterType="com.keao.edu.user.entity.Agency" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO agency (id_,name_,contact_name_,contact_phone_,settlement_type_,share_profit_amount_,create_time_,update_time_,tenant_id_)
+	<insert id="insert" parameterType="com.keao.edu.user.entity.Organization" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO organization (id_,name_,contact_name_,contact_phone_,settlement_type_,share_profit_amount_,create_time_,update_time_,tenant_id_)
 		VALUES(#{id},#{name},#{contactName},#{contactPhone},#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 		#{shareProfitAmount},NOW(),NOW(),#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
-	<update id="update" parameterType="com.keao.edu.user.entity.Agency">
-		UPDATE agency <set>
+	<update id="update" parameterType="com.keao.edu.user.entity.Organization">
+		UPDATE organization <set>
 		<if test="updateTime != null">
 		update_time_ = #{updateTime},
 		</if>
@@ -65,7 +65,7 @@
 	
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete" >
-		UPDATE agency SET del_flag_ = 1,update_time_ = NOW() WHERE id_ = #{id}
+		UPDATE organization SET del_flag_ = 1,update_time_ = NOW() WHERE id_ = #{id}
 	</delete>
 
 	<sql id="agencyQueryPage">
@@ -83,19 +83,19 @@
 	</sql>
 	
 	<!-- 分页查询 -->
-	<select id="queryPage" resultMap="Agency" parameterType="map">
-		SELECT * FROM agency
+	<select id="queryPage" resultMap="Organization" parameterType="map">
+		SELECT * FROM organization
 		<include refid="agencyQueryPage"/>
 		ORDER BY update_time_ DESC <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM agency
+		SELECT COUNT(*) FROM organization
 		<include refid="agencyQueryPage"/>
 	</select>
 
-	<select id="getByTenant" resultMap="Agency">
-		SELECT * FROM agency WHERE tenant_id_ = #{tenantId} ORDER BY id_
+	<select id="getByTenant" resultMap="Organization">
+		SELECT * FROM organization WHERE tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 </mapper>