Commit 0678b7da authored by yanghao's avatar yanghao

Merge branch 'release-fix' into release

parents eab50492 cb90d9cb
...@@ -5,3 +5,10 @@ INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type ...@@ -5,3 +5,10 @@ INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type
VALUES (23, '23', '设置默认付款', 'Set Customer Default Pay', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0'); VALUES (23, '23', '设置默认付款', 'Set Customer Default Pay', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (24, '24', '设置默认开票', 'Set Customer Default Billing', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0'); VALUES (24, '24', '设置默认开票', 'Set Customer Default Billing', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (25, '25', '新增跟进纪录', 'Create Customer Followup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (26, '26', '编辑跟进纪录', 'Update Customer Followup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (27, '27', '提交跟进纪录', 'Commit Customer Followup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
...@@ -9,8 +9,14 @@ import javax.annotation.Resource; ...@@ -9,8 +9,14 @@ import javax.annotation.Resource;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage; import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.mysql.customer.CustomerMapper;
import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService;
import cn.iocoder.yudao.module.customer.vo.customerOperateLog.CustomerOperateLogCreateReqVO;
import cn.iocoder.yudao.module.ecw.enums.CustomerFollowupStatusEnum; import cn.iocoder.yudao.module.ecw.enums.CustomerFollowupStatusEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -36,6 +42,13 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu ...@@ -36,6 +42,13 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Resource @Resource
private CustomerFollowupMapper followupMapper; private CustomerFollowupMapper followupMapper;
@Resource
private CustomerOperateLogService customerOperateLogService;
@Resource
private CustomerMapper customerMapper;
/** /**
* 跟进单编号生成方式:GJ+年份+六位数字,按年份累计 * 跟进单编号生成方式:GJ+年份+六位数字,按年份累计
* @return * @return
...@@ -66,6 +79,31 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu ...@@ -66,6 +79,31 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 插入 // 插入
CustomerFollowupDO followup = CustomerFollowupConvert.INSTANCE.convert(createReqVO); CustomerFollowupDO followup = CustomerFollowupConvert.INSTANCE.convert(createReqVO);
followupMapper.insert(followup); followupMapper.insert(followup);
Long customerId = createReqVO.getCustomerId();
if (customerId != null) {
CustomerDO customer = customerMapper.selectById(customerId);
if (customer == null) {
// 插入日志
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//保存客户捞取记录
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customer.getId())
.setNumber(customer.getNumber())
.setName(customer.getName())
.setNewCustomerService(customer.getCustomerService())
.setOldCustomerService(customer.getCustomerService())
.setOldEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setNewEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setOperateType(CustomerOperateTypeEnum.FOLLOWUP_CREATE.getValue())
.setRemark("新增跟进纪录" + (CustomerFollowupStatusEnum.UnCommited.getValue().equals(createReqVO.getStatus()) ? "" : ",并提交"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
}
}
// 返回 // 返回
return followup.getId(); return followup.getId();
} }
...@@ -84,6 +122,30 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu ...@@ -84,6 +122,30 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 更新 // 更新
CustomerFollowupDO updateObj = CustomerFollowupConvert.INSTANCE.convert(updateReqVO); CustomerFollowupDO updateObj = CustomerFollowupConvert.INSTANCE.convert(updateReqVO);
followupMapper.updateById(updateObj); followupMapper.updateById(updateObj);
Long customerId = updateReqVO.getCustomerId();
if (customerId != null) {
CustomerDO customer = customerMapper.selectById(customerId);
if (customer == null) {
// 插入日志
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//保存客户捞取记录
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customer.getId())
.setNumber(customer.getNumber())
.setName(customer.getName())
.setNewCustomerService(customer.getCustomerService())
.setOldCustomerService(customer.getCustomerService())
.setOldEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setNewEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setOperateType(CustomerOperateTypeEnum.FOLLOWUP_UPDATE.getValue())
.setRemark("更新跟进纪录" + (CustomerFollowupStatusEnum.UnCommited.getValue().equals(updateReqVO.getStatus()) ? "" : ",并提交"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
}
}
} }
@Override @Override
...@@ -94,8 +156,39 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu ...@@ -94,8 +156,39 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
if (customerFollowupDO == null) { if (customerFollowupDO == null) {
throw exception(FOLLOWUP_NOT_EXISTS); throw exception(FOLLOWUP_NOT_EXISTS);
} }
if (CustomerFollowupStatusEnum.Commited.getValue().equals(customerFollowupDO.getStatus())) {
throw exception(FOLLOWUP_ALREADY_SUBMITTED);
}
customerFollowupDO.setStatus(updateStatusReqVO.getStatus()); customerFollowupDO.setStatus(updateStatusReqVO.getStatus());
followupMapper.updateById(customerFollowupDO); followupMapper.updateById(customerFollowupDO);
Long customerId = customerFollowupDO.getCustomerId();
if (customerId != null) {
CustomerDO customer = customerMapper.selectById(customerId);
if (customer == null) {
// 插入日志
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//保存客户捞取记录
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customer.getId())
.setNumber(customer.getNumber())
.setName(customer.getName())
.setNewCustomerService(customer.getCustomerService())
.setOldCustomerService(customer.getCustomerService())
.setOldEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setNewEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setOperateType(CustomerOperateTypeEnum.FOLLOWUP_COMMIT.getValue())
.setRemark("提交跟进纪录");
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
}
}
} }
@Override @Override
......
...@@ -54,6 +54,10 @@ public enum CustomerOperateTypeEnum { ...@@ -54,6 +54,10 @@ public enum CustomerOperateTypeEnum {
CHANGE_DEFAULT_BILLING(24, "设置默认开票"), CHANGE_DEFAULT_BILLING(24, "设置默认开票"),
FOLLOWUP_CREATE(25, "新增跟进纪录"),
FOLLOWUP_UPDATE(26, "编辑跟进纪录"),
FOLLOWUP_COMMIT(27, "提交跟进纪录"),
DELETE(100, "删除"), DELETE(100, "删除"),
......
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