Commit cc7465fc authored by 廖旭伟's avatar 廖旭伟

客户试用申请功能调整,客户作品删除后没有修改作品统计结果的bug修复

parent 4ec518ce
......@@ -1152,13 +1152,14 @@ dict|object|字典对象
参数名称|类型|必填|描述
:---|:---|:---|:-------
memberLevel|Integer|是|会员等级,,0:未开启,1:试用客户,2:VIP,3:设计师,默认0
custName|String|是|客户真实名称
organization|String|是|单位名称
contactTelphone|String|是|联系电话
sex|Integer|是|性别
mailbox|String|是|邮箱
job|String|是|职位
memberLevel|Integer|是|会员等级,0:未开启,1:试用客户,2:VIP,3:设计师,默认0
custName|String|是|客户真实名称,customerId不为空时可以不传该值
organization|String|是|单位名称,customerId不为空时可以不传该值
contactTelphone|String|是|联系电话,customerId不为空时可以不传该值
sex|Integer|是|性别,customerId不为空时可以不传该值
mailbox|String|是|邮箱,customerId不为空时可以不传该值
job|String|是|职位,customerId不为空时可以不传该值
customerId|Long|否|客户id
**请求样例:**
```
......@@ -1242,8 +1243,8 @@ msg|String|消息|-
参数名称|类型|必填|描述
:---|:---|:---|:-------
id|Long|是|客户试用申请主键
loginName|String|否|登陆账号
password|String|否|登陆密码
loginName|String|否|登陆账号,试用申请记录customerId不为空时不传该值
password|String|否|登陆密码,试用申请记录customerId不为空时不传该值
isAccept|Integer|是|受理状态,0:未受理,1:同意,2:不同意。默认:0
**请求样例:**
......
package com.mortals.xhx.module.customer.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import com.mortals.xhx.module.customer.model.CustomerTrialEntityExt;
import java.util.List;
/**
* 客户试用申请Dao
* 客户试用申请 DAO接口
......
package com.mortals.xhx.module.customer.dao.ibatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.customer.model.CustomerTrialEntityExt;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.customer.dao.CustomerTrialDao;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import java.util.ArrayList;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 客户试用申请DaoImpl DAO接口
*
......
......@@ -10,7 +10,7 @@ import com.mortals.xhx.module.customer.model.vo.CustomerTrialVo;
* 客户试用申请实体对象
*
* @author zxfei
* @date 2022-07-26
* @date 2022-07-27
*/
public class CustomerTrialEntity extends CustomerTrialVo {
......@@ -48,6 +48,10 @@ public class CustomerTrialEntity extends CustomerTrialVo {
* 职位
*/
private String job;
/**
* 客户ID
*/
private Long customerId;
......@@ -164,6 +168,20 @@ public class CustomerTrialEntity extends CustomerTrialVo {
public void setJob(String job){
this.job = job;
}
/**
* 获取 客户ID
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 客户ID
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
......@@ -194,6 +212,7 @@ public class CustomerTrialEntity extends CustomerTrialVo {
sb.append(",sex:").append(getSex());
sb.append(",mailbox:").append(getMailbox());
sb.append(",job:").append(getJob());
sb.append(",customerId:").append(getCustomerId());
return sb.toString();
}
......@@ -214,5 +233,7 @@ public class CustomerTrialEntity extends CustomerTrialVo {
this.mailbox = "";
this.job = "";
this.customerId = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.customer.model;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
@Data
public class CustomerTrialEntityExt extends CustomerTrialEntity {
/**
* 客户真实名称
*/
private String custName;
/**
* 单位名称
*/
private String organization;
/**
* 联系电话
*/
private String contactTelphone;
/**
* 邮箱
*/
private String mailbox;
/**
* 职位
*/
private String job;
/**
* 申请时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date applyDate;
}
......@@ -6,7 +6,7 @@ import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
* 客户试用申请查询对象
*
* @author zxfei
* @date 2022-07-26
* @date 2022-07-27
*/
public class CustomerTrialQuery extends CustomerTrialEntity {
/** 开始 主键ID,主键,自增长 */
......@@ -96,6 +96,18 @@ public class CustomerTrialQuery extends CustomerTrialEntity {
/** 职位 */
private List<String> jobList;
/** 开始 客户ID */
private Long customerIdStart;
/** 结束 客户ID */
private Long customerIdEnd;
/** 增加 客户ID */
private Long customerIdIncrement;
/** 客户ID列表 */
private List <Long> customerIdList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<CustomerTrialQuery> orConditionList;
......@@ -563,6 +575,70 @@ public class CustomerTrialQuery extends CustomerTrialEntity {
public void setJobList(List<String> jobList){
this.jobList = jobList;
}
/**
* 获取 开始 客户ID
* @return customerIdStart
*/
public Long getCustomerIdStart(){
return this.customerIdStart;
}
/**
* 设置 开始 客户ID
* @param customerIdStart
*/
public void setCustomerIdStart(Long customerIdStart){
this.customerIdStart = customerIdStart;
}
/**
* 获取 结束 客户ID
* @return $customerIdEnd
*/
public Long getCustomerIdEnd(){
return this.customerIdEnd;
}
/**
* 设置 结束 客户ID
* @param customerIdEnd
*/
public void setCustomerIdEnd(Long customerIdEnd){
this.customerIdEnd = customerIdEnd;
}
/**
* 获取 增加 客户ID
* @return customerIdIncrement
*/
public Long getCustomerIdIncrement(){
return this.customerIdIncrement;
}
/**
* 设置 增加 客户ID
* @param customerIdIncrement
*/
public void setCustomerIdIncrement(Long customerIdIncrement){
this.customerIdIncrement = customerIdIncrement;
}
/**
* 获取 客户ID
* @return customerIdList
*/
public List<Long> getCustomerIdList(){
return this.customerIdList;
}
/**
* 设置 客户ID
* @param customerIdList
*/
public void setCustomerIdList(List<Long> customerIdList){
this.customerIdList = customerIdList;
}
/**
* 设置 主键ID,主键,自增长
* @param id
......@@ -885,6 +961,51 @@ public class CustomerTrialQuery extends CustomerTrialEntity {
return this;
}
/**
* 设置 客户ID
* @param customerId
*/
public CustomerTrialQuery customerId(Long customerId){
setCustomerId(customerId);
return this;
}
/**
* 设置 开始 客户ID
* @param customerIdStart
*/
public CustomerTrialQuery customerIdStart(Long customerIdStart){
this.customerIdStart = customerIdStart;
return this;
}
/**
* 设置 结束 客户ID
* @param customerIdEnd
*/
public CustomerTrialQuery customerIdEnd(Long customerIdEnd){
this.customerIdEnd = customerIdEnd;
return this;
}
/**
* 设置 增加 客户ID
* @param customerIdIncrement
*/
public CustomerTrialQuery customerIdIncrement(Long customerIdIncrement){
this.customerIdIncrement = customerIdIncrement;
return this;
}
/**
* 设置 客户ID
* @param customerIdList
*/
public CustomerTrialQuery customerIdList(List<Long> customerIdList){
this.customerIdList = customerIdList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
......
package com.mortals.xhx.module.customer.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.customer.model.CustomerTrialEntity;
import com.mortals.xhx.module.customer.model.CustomerTrialEntityExt;
/**
* CustomerTrialService
......
......@@ -56,6 +56,18 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr
@Override
protected void saveBefore(CustomerTrialEntity entity, Context context) throws AppException {
entity.setIsAccept(TrialAcceptEnum.NOT_ACCEPTED.getValue());
if(entity.getCustomerId()!=null){
CustomerEntity customerEntity = customerDao.get(entity.getCustomerId());
if(customerEntity==null){
throw new AppException("客户信息不存在");
}
entity.setJob(customerEntity.getJob());
entity.setCustName(customerEntity.getCustName());
entity.setOrganization(customerEntity.getOrganization());
entity.setContactTelphone(customerEntity.getContactTelphone());
entity.setSex(customerEntity.getSex());
entity.setMailbox(customerEntity.getMailbox());
}
super.saveBefore(entity, context);
}
......@@ -72,35 +84,46 @@ public class CustomerTrialServiceImpl extends AbstractCRUDServiceImpl<CustomerTr
throw new AppException("受理意见不能为空");
}
if(entity.getIsAccept()== TrialAcceptEnum.AGREE.getValue()){
if(StringUtils.isEmpty(entity.getLoginName())){
throw new AppException("登录账号不能为空");
}
if(StringUtils.isEmpty(entity.getPassword())){
throw new AppException("登录密码不能为空");
}
if(StringUtils.isEmpty(entity.getEnterpriseConsultant())){
throw new AppException("企业顾问不能为空");
}
CustomerEntity customerEntity = new CustomerEntity();
customerEntity.setJob(entity.getJob());
customerEntity.setCustName(entity.getCustName());
customerEntity.setMemberLevel(entity.getMemberLevel());
customerEntity.setOrganization(entity.getOrganization());
customerEntity.setContactTelphone(entity.getContactTelphone());
customerEntity.setSex(entity.getSex());
customerEntity.setMailbox(entity.getMailbox());
customerEntity.setCustomerSrc(1l);
customerEntity.setStatus(CustomerSatusEnum.NORMAL.getValue());
customerEntity.setEnterpriseConsultant(entity.getEnterpriseConsultant());
customerEntity.setCreateUserId(this.getContextUserId(context));
customerEntity.setCreateTime(new Date());
customerEntity.setLoginName(entity.getLoginName());
try {
customerEntity.setPassword(SecurityUtil.md5DoubleEncoding(entity.getPassword()));
} catch (Exception e) {
throw new AppException("密码转换异常!", e);
if(customerTrialEntity.getCustomerId()!=null){
CustomerEntity update = new CustomerEntity();
update.setId(customerTrialEntity.getCustomerId());
update.setMemberLevel(customerTrialEntity.getMemberLevel());
update.setUpdateTime(new Date());
update.setUpdateUserId(this.getContextUserId(context));
customerDao.update(update);
}else {
if(StringUtils.isEmpty(entity.getLoginName())){
throw new AppException("登录账号不能为空");
}
if(StringUtils.isEmpty(entity.getPassword())){
throw new AppException("登录密码不能为空");
}
if(StringUtils.isEmpty(entity.getEnterpriseConsultant())){
throw new AppException("企业顾问不能为空");
}
CustomerEntity customerEntity = new CustomerEntity();
customerEntity.setJob(customerTrialEntity.getJob());
customerEntity.setCustName(customerTrialEntity.getCustName());
customerEntity.setMemberLevel(customerTrialEntity.getMemberLevel());
customerEntity.setOrganization(customerTrialEntity.getOrganization());
customerEntity.setContactTelphone(customerTrialEntity.getContactTelphone());
customerEntity.setSex(customerTrialEntity.getSex());
customerEntity.setMailbox(customerTrialEntity.getMailbox());
customerEntity.setCustomerSrc(1l);
customerEntity.setStatus(CustomerSatusEnum.NORMAL.getValue());
customerEntity.setEnterpriseConsultant(entity.getEnterpriseConsultant());
customerEntity.setCreateUserId(this.getContextUserId(context));
customerEntity.setCreateTime(new Date());
customerEntity.setLoginName(entity.getLoginName());
try {
customerEntity.setPassword(SecurityUtil.md5DoubleEncoding(entity.getPassword()));
} catch (Exception e) {
throw new AppException("密码转换异常!", e);
}
customerDao.insert(customerEntity);
}
customerDao.insert(customerEntity);
}
CustomerTrialEntity update = new CustomerTrialEntity();
update.setId(customerTrialEntity.getId());
......
......@@ -148,4 +148,26 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
updateEntity.setUpdateTime(new Date());
return dao.update(updateEntity);
}
@Override
public int remove(Long[] ids, Context context) throws AppException {
this.removeBefore(ids, context);
List<CustomerWorkDesignEntity> list = this.get(ids,context);
int iRet = this.dao.delete(ids);
if(CollectionUtils.isNotEmpty(list)){
list.forEach(e->{
CustomerWorkDesignStatEntity cQuery = new CustomerWorkDesignStatEntity();
cQuery.setCustomerId(e.getCustomerId());
List<CustomerWorkDesignStatEntity> cwdList = customerWorkDesignStatService.find(cQuery);
CustomerWorkDesignStatEntity cwdEntity = cwdList.get(0);
CustomerWorkDesignStatQuery updateEntity = new CustomerWorkDesignStatQuery();
updateEntity.setId(cwdEntity.getId());
updateEntity.setCustomerDesignPicturesIncrement(-1);
updateEntity.setUpdateTime(new Date());
customerWorkDesignStatService.update(updateEntity);
});
}
this.removeAfter(ids, context, iRet);
return iRet;
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@
<result property="sex" column="sex" />
<result property="mailbox" column="mailbox" />
<result property="job" column="job" />
<result property="customerId" column="customerId" />
</resultMap>
......@@ -60,23 +61,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('job') or colPickMode == 1 and data.containsKey('job')))">
a.job,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('customerId') or colPickMode == 1 and data.containsKey('customerId')))">
a.customerId,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="CustomerTrialEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_customer_trial
(memberLevel,isAccept,createUserId,createTime,updateTime,custName,organization,contactTelphone,sex,mailbox,job)
(memberLevel,isAccept,createUserId,createTime,updateTime,custName,organization,contactTelphone,sex,mailbox,job,customerId)
VALUES
(#{memberLevel},#{isAccept},#{createUserId},#{createTime},#{updateTime},#{custName},#{organization},#{contactTelphone},#{sex},#{mailbox},#{job})
(#{memberLevel},#{isAccept},#{createUserId},#{createTime},#{updateTime},#{custName},#{organization},#{contactTelphone},#{sex},#{mailbox},#{job},#{customerId})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_customer_trial
(memberLevel,isAccept,createUserId,createTime,updateTime,custName,organization,contactTelphone,sex,mailbox,job)
(memberLevel,isAccept,createUserId,createTime,updateTime,custName,organization,contactTelphone,sex,mailbox,job,customerId)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.memberLevel},#{item.isAccept},#{item.createUserId},#{item.createTime},#{item.updateTime},#{item.custName},#{item.organization},#{item.contactTelphone},#{item.sex},#{item.mailbox},#{item.job})
(#{item.memberLevel},#{item.isAccept},#{item.createUserId},#{item.createTime},#{item.updateTime},#{item.custName},#{item.organization},#{item.contactTelphone},#{item.sex},#{item.mailbox},#{item.job},#{item.customerId})
</foreach>
</insert>
......@@ -131,6 +135,12 @@
<if test="(colPickMode==0 and data.containsKey('job')) or (colPickMode==1 and !data.containsKey('job'))">
a.job=#{data.job},
</if>
<if test="(colPickMode==0 and data.containsKey('customerId')) or (colPickMode==1 and !data.containsKey('customerId'))">
a.customerId=#{data.customerId},
</if>
<if test="(colPickMode==0 and data.containsKey('customerIdIncrement')) or (colPickMode==1 and !data.containsKey('customerIdIncrement'))">
a.customerId=ifnull(a.customerId,0) + #{data.customerIdIncrement},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
......@@ -240,6 +250,18 @@
</if>
</foreach>
</trim>
<trim prefix="customerId=(case" suffix="ELSE customerId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('customerId')) or (colPickMode==1 and !item.containsKey('customerId'))">
when a.id=#{item.id} then #{item.customerId}
</when>
<when test="(colPickMode==0 and item.containsKey('customerIdIncrement')) or (colPickMode==1 and !item.containsKey('customerIdIncrement'))">
when a.id=#{item.id} then ifnull(a.customerId,0) + #{item.customerIdIncrement}
</when>
</choose>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
......@@ -551,6 +573,27 @@
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('customerId')">
<if test="conditionParamRef.customerId != null ">
${_conditionType_} a.customerId = #{${_conditionParam_}.customerId}
</if>
<if test="conditionParamRef.customerId == null">
${_conditionType_} a.customerId is null
</if>
</if>
<if test="conditionParamRef.containsKey('customerIdList')">
${_conditionType_} a.customerId in
<foreach collection="conditionParamRef.customerIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('customerIdStart') and conditionParamRef.customerIdStart != null">
${_conditionType_} a.customerId <![CDATA[ >= ]]> #{${_conditionParam_}.customerIdStart}
</if>
<if test="conditionParamRef.containsKey('customerIdEnd') and conditionParamRef.customerIdEnd != null">
${_conditionType_} a.customerId <![CDATA[ <= ]]> #{${_conditionParam_}.customerIdEnd}
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
......@@ -624,6 +667,11 @@
<if test='orderCol.job != null and "DESC".equalsIgnoreCase(orderCol.job)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('customerId')">
a.customerId
<if test='orderCol.customerId != null and "DESC".equalsIgnoreCase(orderCol.customerId)'>DESC</if>
,
</if>
</trim>
</if>
</sql>
......
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