提交 6ad41bbc 编写于 作者: Hello 码上秃's avatar Hello 码上秃

功能开发__商机跟进

上级 62daea03
......@@ -140,6 +140,10 @@ public class TbBusinessController extends BaseController {
return AjaxResult.success(tbBusinessService.gain(assignmentVo.getIds(),assignmentVo.getUserId()));
}
@PreAuthorize("@ss.hasPermi('business:business:back')")
@Log(title = "退回公海", businessType = BusinessType.UPDATE)
@PutMapping("/back/{id}/{status}")
public AjaxResult back(@PathVariable("id") Long id, @PathVariable("status") String status) {
return AjaxResult.success(tbBusinessService.back(id, status));
}
}
\ No newline at end of file
......@@ -40,23 +40,29 @@ public class TbBusinessTrackRecordController extends BaseController {
@Autowired
private ISysDictDataService sysDictDataService;
/**
* 查询商机跟进记录列表
* @param id 商机ID
* @return AjaxResult
*/
@PreAuthorize("@ss.hasPermi('business:record:list')")
@GetMapping("/list")
public AjaxResult list(@RequestParam("businessId")Long id){
public AjaxResult list(@RequestParam("businessId") Long id) {
return null;
return AjaxResult.success(tbBusinessTrackRecordService.getByBusinessId(id));
}
/**
* 新增商机跟进记录
* @param businessTrackVo 商机跟进记录信息
* @return AjaxResult
*/
@PreAuthorize("@ss.hasPermi('business:record:add')")
@Log(title = "商机跟进记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BusinessTrackVo businessTrackVo){
return null;
public AjaxResult add(@RequestBody BusinessTrackVo businessTrackVo) {
return toAjax(tbBusinessTrackRecordService.add(businessTrackVo));
}
}
\ No newline at end of file
......@@ -79,4 +79,7 @@ public interface TbBusinessMapper {
public void updateBusinessEndTimeById(@Param("id")Long id, @Param("endTime")Date endTime);
int back(@Param("id") Long id,@Param("status") String status);
List<Map<String, String>> getSysDictData();
}
package com.huike.business.mapper;
import java.util.List;
import com.huike.business.domain.TbBusiness;
import com.huike.business.domain.TbBusinessTrackRecord;
/**
......@@ -9,4 +11,23 @@ import com.huike.business.domain.TbBusinessTrackRecord;
*/
public interface TbBusinessTrackRecordMapper {
/**
* 更新商机中的客户信息
* @param tbBusiness 商机信息
* @return Integer
*/
Integer updateTbBusinessById(TbBusiness tbBusiness);
/** 新增商机跟进记录
* @param tbBusinessTrackRecord 商机跟进记录
* @return Integer
*/
Integer addTbBusinessTrackRecord(TbBusinessTrackRecord tbBusinessTrackRecord);
/**
* 查询商机跟进记录列表
* @param id 商机ID
* @return TbBusinessTrackRecord 商机跟进记录列表
*/
List<TbBusinessTrackRecord> getByBusinessId(Long id);
}
\ No newline at end of file
......@@ -73,4 +73,6 @@ public interface ITbBusinessService
public int changeBusiness(Long clueId);
public int updateStatus(Long id, String status);
int back(Long id, String status);
}
package com.huike.business.service;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.domain.vo.BusinessTrackVo;
import java.util.List;
/**
* 商机跟进记录Service接口
* @date 2021-04-28
*/
public interface ITbBusinessTrackRecordService {
/**
* 新增商机跟进记录
* @param businessTrackVo 商机跟进记录信息
* @return AjaxResult
*/
Integer add(BusinessTrackVo businessTrackVo);
/**
* 查询商机跟进记录列表
* @param id 商机ID
* @return TbBusinessTrackRecord 商机跟进记录列表
*/
List<TbBusinessTrackRecord> getByBusinessId(Long id);
}
......@@ -2,7 +2,10 @@ package com.huike.business.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.strategy.Rule;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -66,7 +69,7 @@ public class TbBusinessServiceImpl implements ITbBusinessService {
/**
* 查询商机
*
*
* @param id 商机ID
* @return 商机
*/
......@@ -78,7 +81,7 @@ public class TbBusinessServiceImpl implements ITbBusinessService {
/**
* 查询商机列表
*
*
* @param tbBusiness 商机
* @return 商机
*/
......@@ -97,7 +100,7 @@ public class TbBusinessServiceImpl implements ITbBusinessService {
/**
* 新增商机
*
*
* @param tbBusiness 商机
* @return 结果
*/
......@@ -126,7 +129,7 @@ public class TbBusinessServiceImpl implements ITbBusinessService {
/**
* 修改商机
*
*
* @param tbBusiness 商机
* @return 结果
*/
......@@ -138,7 +141,7 @@ public class TbBusinessServiceImpl implements ITbBusinessService {
/**
* 批量删除商机
*
*
* @param ids 需要删除的商机ID
* @return 结果
*/
......@@ -150,7 +153,7 @@ public class TbBusinessServiceImpl implements ITbBusinessService {
/**
* 删除商机信息
*
*
* @param id 商机ID
* @return 结果
*/
......@@ -287,4 +290,20 @@ public class TbBusinessServiceImpl implements ITbBusinessService {
public int updateStatus(Long clueId,String status){
return tbBusinessMapper.resetNextTimeAndStatus(clueId,status);
}
@Override
@Transactional
public int back(Long id, String status) {
List<Map<String, String>> sysDictData = tbBusinessMapper.getSysDictData();
Map<String, String> collect = sysDictData.stream().collect(Collectors.toMap(item -> item.get("status"), item -> item.get("statusMsg")));
TbBusinessTrackRecord tbBusinessTrackRecord = new TbBusinessTrackRecord();
tbBusinessTrackRecord.setRecord("退回公海: " + collect.get(status));
tbBusinessTrackRecord.setBusinessId(id);
tbBusinessTrackRecord.setCreateBy(SecurityUtils.getUsername());
tbBusinessTrackRecord.setCreateTime(new Date(System.currentTimeMillis()));
tbBusinessTrackRecordMapper.addTbBusinessTrackRecord(tbBusinessTrackRecord);
return tbBusinessMapper.back(id, status);
}
}
package com.huike.business.service.impl;
import com.huike.business.domain.TbBusiness;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.domain.vo.BusinessTrackVo;
import com.huike.business.mapper.TbBusinessTrackRecordMapper;
import com.huike.business.service.ITbBusinessTrackRecordService;
import com.huike.common.utils.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 商机跟进记录Service业务层处理
*
......@@ -13,4 +22,38 @@ import org.springframework.stereotype.Service;
@Service
public class TbBusinessTrackRecordServiceImpl implements ITbBusinessTrackRecordService {
@Autowired
private TbBusinessTrackRecordMapper tbBusinessTrackRecordMapper;
/**
* 新增商机跟进记录
* @param businessTrackVo 商机跟进记录信息
* @return AjaxResult
*/
@Override
public Integer add(BusinessTrackVo businessTrackVo) {
TbBusiness tbBusiness = new TbBusiness();
TbBusinessTrackRecord tbBusinessTrackRecord = new TbBusinessTrackRecord();
BeanUtils.copyProperties(businessTrackVo, tbBusiness);
tbBusiness.setId(businessTrackVo.getBusinessId());
// 更新商机中的客户信息
tbBusinessTrackRecordMapper.updateTbBusinessById(tbBusiness);
BeanUtils.copyProperties(businessTrackVo, tbBusinessTrackRecord);
tbBusinessTrackRecord.setCreateBy(SecurityUtils.getUsername());
// 插入商机跟进记录
return tbBusinessTrackRecordMapper.addTbBusinessTrackRecord(tbBusinessTrackRecord);
}
/**
* 查询商机跟进记录列表
* @param id 商机ID
* @return TbBusinessTrackRecord 商机跟进记录列表
*/
@Override
public List<TbBusinessTrackRecord> getByBusinessId(Long id) {
return tbBusinessTrackRecordMapper.getByBusinessId(id);
}
}
......@@ -302,5 +302,14 @@
update tb_business set end_time=#{endTime},next_time = null where id = #{id}
</update>
<update id="back">
update tb_business set next_time= null, status=4 where id = #{id}
</update>
<select id="getSysDictData" resultType="java.util.Map">
select dict_value status, dict_label statusMsg
from sys_dict_data
where dict_type = "reasons_for_business_reporting"
</select>
</mapper>
\ No newline at end of file
......@@ -15,5 +15,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="nextTime" column="next_time" />
</resultMap>
<sql id="selectTbBusinessTrackRecord">
select id, business_id, create_by, key_items, record, track_status, create_time, next_time from tb_business_track_record
</sql>
<select id="getByBusinessId" resultType="com.huike.business.domain.TbBusinessTrackRecord">
<include refid="selectTbBusinessTrackRecord"></include>
where business_id = #{id}
</select>
<update id="updateTbBusinessById">
update tb_business
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="channel != null">channel = #{channel},</if>
<if test="activityId != null">activity_id = #{activityId},</if>
<if test="provinces != null">provinces = #{provinces},</if>
<if test="city != null">city = #{city},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="age != null">age = #{age},</if>
<if test="weixin != null">weixin = #{weixin},</if>
<if test="qq != null">qq = #{qq},</if>
<if test="level != null">level = #{level},</if>
<if test="subject != null">subject = #{subject},</if>
<if test="courseId != null">course_id = #{courseId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="occupation != null">occupation = #{occupation},</if>
<if test="education != null">education = #{education},</if>
<if test="job != null">job = #{job},</if>
<if test="salary != null">salary = #{salary},</if>
<if test="major != null">major = #{major},</if>
<if test="expectedSalary != null">expected_salary = #{expectedSalary},</if>
<if test="reasons != null">reasons = #{reasons},</if>
<if test="plan != null">plan = #{plan},</if>
<if test="planTime != null">plan_time = #{planTime},</if>
<if test="otherIntention != null">other_intention = #{otherIntention},</if>
<if test="nextTime != null">next_time = #{nextTime},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<insert id="addTbBusinessTrackRecord" useGeneratedKeys="true" keyProperty="id">
insert into tb_business_track_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="businessId != null and businessId != ''">business_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="keyItems != null and keyItems != ''">key_items,</if>
<if test="record != null and record != ''">record,</if>
<if test="trackStatus != null and trackStatus != ''">track_status,</if>
<if test="createTime != null">create_time,</if>
<if test="nextTime != null">next_time</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="businessId != null and businessId != ''">#{businessId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="keyItems != null and keyItems != ''">#{keyItems},</if>
<if test="record != null and record != ''">#{record},</if>
<if test="trackStatus != null and trackStatus != ''">#{trackStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="nextTime != null">#{nextTime},</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册