Commit c5df897f authored by zhangc's avatar zhangc

添加企业认证接口

parent 7c6d61b0
...@@ -74,5 +74,16 @@ ...@@ -74,5 +74,16 @@
<version>RELEASE</version> <version>RELEASE</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!--阿里云服务器短信平台-->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -72,6 +72,10 @@ public class MallCustomer implements Serializable { ...@@ -72,6 +72,10 @@ public class MallCustomer implements Serializable {
* 更新时间 * 更新时间
*/ */
private Date uptTime; private Date uptTime;
/**
* 更新时间
*/
private String uptPerson;
/** /**
* 删除标识:Y是,N否 * 删除标识:Y是,N否
*/ */
...@@ -198,4 +202,11 @@ public class MallCustomer implements Serializable { ...@@ -198,4 +202,11 @@ public class MallCustomer implements Serializable {
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPreson) {
this.uptPerson = uptPreson;
}
} }
\ No newline at end of file
...@@ -125,6 +125,9 @@ ...@@ -125,6 +125,9 @@
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.Department;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
/**
* 企业(TDepartment)表数据库访问层
*
* @author Bellamy
* @since 2020-12-01 10:41:35
*/
public interface DepartmentDao extends BaseMapper<Department> {
/**
* 查询企业信息
* @param req
* @return
*/
Department selectDepartmentData(CompanyAddReq req);
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.FinanceCustomerAssets;
/**
* 商城企业客户资产(TFinanceCustomerAssets)表数据库访问层
*
* @author Bellamy
* @since 2020-12-01 10:41:38
*/
public interface FinanceCustomerAssetsDao extends BaseMapper<FinanceCustomerAssets> {
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper; package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper; import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.entity.MallCustomer; import com.jz.common.entity.MallCustomer;
/** /**
* 商城用户(TMallCustomer)表数据库访问层 * 商城用户(TMallCustomer)表数据库访问层
...@@ -12,6 +12,7 @@ import com.jz.dm.mall.moduls.entity.MallCustomer; ...@@ -12,6 +12,7 @@ import com.jz.dm.mall.moduls.entity.MallCustomer;
public interface MallCustomerDao extends BaseMapper<MallCustomer> { public interface MallCustomerDao extends BaseMapper<MallCustomer> {
MallCustomer selectByAccount(String username); MallCustomer selectByAccount(String username);
MallCustomer selectByPhone(String username); MallCustomer selectByPhone(String username);
} }
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.common.entity.Department;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
import com.jz.common.utils.Result;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service
* @PROJECT_NAME: jz-dm-parent
* @NAME: CompanyAuthService
* @USER: key
* @DATE: 2020-12-2/16:34
* @DAY_NAME_SHORT: 周三
* @Description:
**/
public interface CompanyAuthService {
/**
* 添加企业认证
* @param req
* @return
*/
Result addCompanyData(CompanyAddReq req);
/**
* 查询企业认证详情
* @return
*/
Result<Department> selectCompany();
}
package com.jz.dm.mall.moduls.service.impl;
import java.math.BigDecimal;
import com.jz.common.entity.Department;
import com.jz.common.entity.FinanceCustomerAssets;
import com.jz.common.entity.MallCustomer;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
import com.jz.dm.mall.moduls.mapper.DepartmentDao;
import com.jz.dm.mall.moduls.mapper.FinanceCustomerAssetsDao;
import com.jz.dm.mall.moduls.mapper.MallCustomerDao;
import com.jz.dm.mall.moduls.service.CompanyAuthService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
/**
* @author ZC
* @PACKAGE_NAME: com.jz.dm.mall.moduls.service.impl
* @PROJECT_NAME: jz-dm-parent
* @NAME: CompanyAuthServiceImpl
* @USER: key
* @DATE: 2020-12-2/16:35
* @DAY_NAME_SHORT: 周三
* @Description:
**/
@Service("companyAuthService")
@Slf4j
public class CompanyAuthServiceImpl implements CompanyAuthService {
@Resource
private DepartmentDao departmentDao;
@Resource
private FinanceCustomerAssetsDao financeCustomerAssetsDao;
@Resource
private MallCustomerDao mallCustomerDao;
/**
* 添加企业认证
*
* @param req
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW)
public Result addCompanyData(CompanyAddReq req) {
//TODO 获取当前用户ID判断当前用户是否已经关联企业
if (StringUtils.isNotBlank(req.getDepartmentName()) &&
StringUtils.isNotBlank(req.getUnifiedCreditCode())) { //企业名称 && 营业执照
Department department = departmentDao.selectDepartmentData(req);
if (null != department) {
return Result.error("企业用户信息已存在");
}
}
insetCompany(req);
return Result.ok("添加企业用户成功");
}
/**
* 查询企业认证详情
* @return
*/
@Override
public Result<Department> selectCompany() {
//查询用户判断用户是否认证
// if (){
//
// }
return null;
}
/**
* 保存企业信息
* @param req
*/
private void insetCompany(CompanyAddReq req) {
//保存企业信息
Department departmentInset = new Department();
departmentInset.setAuditStatus("01");//待审核
departmentInset.setCreTime(new Date());
departmentInset.setCrePerson("");
BeanUtils.copyProperties(req,departmentInset);
if (departmentDao.insert(departmentInset) != 1){
throw new RuntimeException("保存企业信息失败");
}
//初始化用户资产表
FinanceCustomerAssets finance = new FinanceCustomerAssets();
finance.setDepartmentId(departmentInset.getDepartmentId());//企业ID
finance.setCreTime(new Date());
finance.setCrePerson("");
if (financeCustomerAssetsDao.insert(finance) != 1){
throw new RuntimeException("初始化用户资产失败");
}
//更新用户企业信息
MallCustomer mallCustomer = new MallCustomer();
mallCustomer.setCustomerId(0L);//用户ID
mallCustomer.setDepartmentId(departmentInset.getDepartmentId());
mallCustomer.setUptTime(new Date());
mallCustomer.setUptPerson("");
if (mallCustomerDao.updateById(mallCustomer) != 1){
throw new RuntimeException("更新用户企业信息失败");
}
}
}
<?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.jz.dm.mall.moduls.mapper.DepartmentDao">
<!--<resultMap type="com.jz.manage.moduls.entity.Department" id="TDepartmentMap">
<result property="departmentId" column="department_id" jdbcType="INTEGER"/>
<result property="departmentName" column="department_name" jdbcType="VARCHAR"/>
<result property="legalRepresentative" column="legal_representative" jdbcType="VARCHAR"/>
<result property="province" column="province" jdbcType="VARCHAR"/>
<result property="city" column="city" jdbcType="VARCHAR"/>
<result property="industry" column="industry" jdbcType="VARCHAR"/>
<result property="telephone" column="telephone" jdbcType="VARCHAR"/>
<result property="registeredAddress" column="registered_address" jdbcType="VARCHAR"/>
<result property="zoneCode" column="zone_code" jdbcType="OTHER"/>
<result property="departPicture" column="depart_picture" jdbcType="VARCHAR"/>
<result property="businessLicense" column="business_license" jdbcType="VARCHAR"/>
<result property="taxRegistration" column="tax_registration" jdbcType="VARCHAR"/>
<result property="departPictureTime" column="depart_picture_time" jdbcType="TIMESTAMP"/>
<result property="businessLicenseTime" column="business_license_time" jdbcType="TIMESTAMP"/>
<result property="taxRegistrationTime" column="tax_registration_time" jdbcType="TIMESTAMP"/>
<result property="unifiedCreditCode" column="unified_credit_code" jdbcType="VARCHAR"/>
<result property="bankName" column="bank_name" jdbcType="VARCHAR"/>
<result property="bankCardNumber" column="bank_card_number" jdbcType="VARCHAR"/>
<result property="bankAddress" column="bank_address" jdbcType="VARCHAR"/>
<result property="bankNo" column="bank_no" jdbcType="VARCHAR"/>
<result property="auditStatus" column="audit_status" jdbcType="VARCHAR"/>
<result property="rejectReason" column="reject_reason" jdbcType="VARCHAR"/>
<result property="auditPerson" column="audit_person" jdbcType="VARCHAR"/>
<result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/>
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="crePerson" column="cre_person" jdbcType="VARCHAR"/>
<result property="uptTime" column="upt_time" jdbcType="TIMESTAMP"/>
<result property="uptPerson" column="upt_person" jdbcType="VARCHAR"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap>
-->
<sql id="department">
department_id,department_name,legal_representative,province,city,industry,linkman,telephone,registered_address,
depart_picture,business_license,tax_registration,depart_picture_time,business_license_time,tax_registration_time,
unified_credit_code,bank_name,bank_card_number,bank_address,bank_no,audit_status,audit_status,audit_person,cre_time,
cre_person,del_flag
</sql>
<select id="selectDepartmentData" resultType="com.jz.common.entity.Department">
SELECT
<include refid="department"/>
FROM t_department
WHERE 1=1
<if test="req.departmentName != null and req.departmentName !=''">
AND department_name =#{req.departmentName}
</if>
<if test="req.unifiedCreditCode != null and req.unifiedCreditCode !=''">
AND unified_credit_code =#{req.unifiedCreditCode}
</if>
</select>
</mapper>
\ No newline at end of file
<?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.jz.dm.mall.moduls.mapper.FinanceCustomerAssetsDao">
<!-- <resultMap type="com.jz.manage.moduls.entity.FinanceCustomerAssets" id="TFinanceCustomerAssetsMap">-->
<!-- <result property="assetsId" column="assets_id" jdbcType="INTEGER"/>-->
<!-- <result property="departmentId" column="department_id" jdbcType="INTEGER"/>-->
<!-- <result property="useMoney" column="use_money" jdbcType="NUMERIC"/>-->
<!-- <result property="frozenMoney" column="frozen_money" jdbcType="NUMERIC"/>-->
<!-- <result property="totalMoney" column="total_money" jdbcType="NUMERIC"/>-->
<!-- <result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>-->
<!-- <result property="crePerson" column="cre_person" jdbcType="VARCHAR"/>-->
<!-- <result property="uptTime" column="upt_time" jdbcType="TIMESTAMP"/>-->
<!-- <result property="uptPerson" column="upt_person" jdbcType="VARCHAR"/>-->
<!-- <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>-->
<!-- </resultMap>-->
<!--查询单个-->
<select id="queryById" resultMap="TFinanceCustomerAssetsMap">
select
assets_id, department_id, use_money, frozen_money, total_money, cre_time, cre_person, upt_time, upt_person, del_flag
from t_finance_customer_assets
where assets_id = #{assetsId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TFinanceCustomerAssetsMap">
select
assets_id, department_id, use_money, frozen_money, total_money, cre_time, cre_person, upt_time, upt_person, del_flag
from t_finance_customer_assets
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="TFinanceCustomerAssetsMap">
select
assets_id, department_id, use_money, frozen_money, total_money, cre_time, cre_person, upt_time, upt_person,
del_flag
from t_finance_customer_assets
<where>
<if test="assetsId != null">
and assets_id = #{assetsId}
</if>
<if test="departmentId != null">
and department_id = #{departmentId}
</if>
<if test="useMoney != null">
and use_money = #{useMoney}
</if>
<if test="frozenMoney != null">
and frozen_money = #{frozenMoney}
</if>
<if test="totalMoney != null">
and total_money = #{totalMoney}
</if>
<if test="creTime != null">
and cre_time = #{creTime}
</if>
<if test="crePerson != null and crePerson != ''">
and cre_person = #{crePerson}
</if>
<if test="uptTime != null">
and upt_time = #{uptTime}
</if>
<if test="uptPerson != null and uptPerson != ''">
and upt_person = #{uptPerson}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="assetsId" useGeneratedKeys="true">
insert into t_finance_customer_assets(department_id, use_money, frozen_money, total_money, cre_time, cre_person, upt_time, upt_person, del_flag)
values (#{departmentId}, #{useMoney}, #{frozenMoney}, #{totalMoney}, #{creTime}, #{crePerson}, #{uptTime}, #{uptPerson}, #{delFlag})
</insert>
<insert id="insertBatch" keyProperty="assetsId" useGeneratedKeys="true">
insert into t_finance_customer_assets(department_id, use_money, frozen_money, total_money,
cre_time, cre_person, upt_time, upt_person, del_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.departmentId}, #{entity.useMoney}, #{entity.frozenMoney}, #{entity.totalMoney}, #{entity.creTime},
#{entity.crePerson}, #{entity.uptTime}, #{entity.uptPerson}, #{entity.delFlag})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update t_finance_customer_assets
<set>
<if test="departmentId != null">
department_id = #{departmentId},
</if>
<if test="useMoney != null">
use_money = #{useMoney},
</if>
<if test="frozenMoney != null">
frozen_money = #{frozenMoney},
</if>
<if test="totalMoney != null">
total_money = #{totalMoney},
</if>
<if test="creTime != null">
cre_time = #{creTime},
</if>
<if test="crePerson != null and crePerson != ''">
cre_person = #{crePerson},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
where assets_id = #{assetsId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from t_finance_customer_assets where assets_id = #{assetsId}
</delete>
</mapper>
\ No newline at end of file
...@@ -49,6 +49,13 @@ ...@@ -49,6 +49,13 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-bom</artifactId>
<version>Dysprosium-SR8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- spring-boot-starter-parent --> <!-- spring-boot-starter-parent -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment