0325-海宁pad走访
This commit is contained in:
@@ -312,6 +312,13 @@ public class SysCampaignController extends BaseController {
|
||||
.stream().collect(HashMap::new, (m, v) -> m.put(v.getUuid(),v.getModelName()), HashMap::putAll)));
|
||||
}
|
||||
|
||||
@PostMapping("/updateVisitInfoFeedback")
|
||||
@ApiOperation("更新PAD走访反馈")
|
||||
@Log(title ="pad走访记录-更新走访反馈", businessType = BusinessType.UPDATE)
|
||||
public AjaxResult updateVisitInfoFeedback(@RequestBody VisitInfoFeedbackUpdateDTO updateDTO) {
|
||||
return toAjax(sysCampaignService.updateVisitInfoFeedback(updateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("根据campaignId删除任务")
|
||||
@Log(title = "走访-根据campaignId删除任务")
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.ibs.list.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VisitFeedbackItemDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "反馈类型")
|
||||
private String feedbackType;
|
||||
|
||||
@ApiModelProperty(value = "反馈产品列表")
|
||||
private List<String> products;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.ruoyi.ibs.list.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VisitInfoFeedbackUpdateDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "走访记录ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "走访渠道")
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty(value = "客户意愿结构化数据")
|
||||
private List<VisitFeedbackItemDTO> feedbackItems;
|
||||
|
||||
@ApiModelProperty(value = "客户意愿拼接值")
|
||||
private String intentionProductValue;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String userRole;
|
||||
|
||||
private String deptId;
|
||||
}
|
||||
@@ -156,6 +156,8 @@ public interface SysCampaignMapper extends BaseMapper<SysCampaign> {
|
||||
|
||||
List<VisitInfoVO> selectVisitInfoList(VisitInfoDTO visitInfoDTO);
|
||||
|
||||
int updateVisitInfoFeedback(VisitInfoFeedbackUpdateDTO updateDTO);
|
||||
|
||||
@Update("UPDATE sys_campaign SET del_flag = '2' where campaign_id = #{campaignId}")
|
||||
int deleteSysCampaignByCampaignId(@Param("campaignId") String campaignId);
|
||||
|
||||
|
||||
@@ -115,5 +115,7 @@ public interface ISysCampaignService {
|
||||
|
||||
public List<VisitInfoVO> selectVisitInfoVoList(VisitInfoDTO visitInfoDTO);
|
||||
|
||||
int updateVisitInfoFeedback(VisitInfoFeedbackUpdateDTO updateDTO);
|
||||
|
||||
public int deleteSysCampaign(String campaignId);
|
||||
}
|
||||
|
||||
@@ -2178,6 +2178,23 @@ public class SysCampaignServiceImpl implements ISysCampaignService
|
||||
return sysCampaignMapper.selectVisitInfoList(visitInfoDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateVisitInfoFeedback(VisitInfoFeedbackUpdateDTO updateDTO) {
|
||||
if (updateDTO == null || updateDTO.getId() == null) {
|
||||
throw new ServiceException("走访记录ID不能为空");
|
||||
}
|
||||
updateDTO.setUserName(SecurityUtils.getUsername());
|
||||
updateDTO.setUserRole(SecurityUtils.userRole());
|
||||
updateDTO.setDeptId(String.valueOf(SecurityUtils.getDeptId()));
|
||||
updateDTO.setSource(StringUtils.trimToNull(updateDTO.getSource()));
|
||||
updateDTO.setIntentionProductValue(buildIntentionProductValue(updateDTO.getFeedbackItems()));
|
||||
int rows = sysCampaignMapper.updateVisitInfoFeedback(updateDTO);
|
||||
if (rows <= 0) {
|
||||
throw new ServiceException("走访记录不存在或无权限修改");
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteSysCampaign(String campaignId) {
|
||||
SysCampaign sysCampaign = sysCampaignMapper.selectSysCampaignByCampaignId(campaignId);
|
||||
@@ -2186,4 +2203,28 @@ public class SysCampaignServiceImpl implements ISysCampaignService
|
||||
}
|
||||
return sysCampaignMapper.deleteSysCampaignByCampaignId(campaignId);
|
||||
}
|
||||
private String buildIntentionProductValue(List<VisitFeedbackItemDTO> feedbackItems) {
|
||||
if (feedbackItems == null || feedbackItems.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
String joinedValue = feedbackItems.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(item -> {
|
||||
String feedbackType = StringUtils.trimToNull(item.getFeedbackType());
|
||||
List<String> products = Optional.ofNullable(item.getProducts())
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(StringUtils::trimToNull)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (feedbackType == null || products.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return feedbackType + ":" + String.join(",", products);
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.joining(";"));
|
||||
return StringUtils.trimToNull(joinedValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1425,4 +1425,22 @@
|
||||
order by vi.sign_in_time desc
|
||||
</select>
|
||||
|
||||
<update id="updateVisitInfoFeedback" parameterType="VisitInfoFeedbackUpdateDTO">
|
||||
update visit_info vi
|
||||
left join sys_dept d on vi.dept_id = d.dept_id
|
||||
set vi.source = #{source},
|
||||
vi.intention_product_value = #{intentionProductValue},
|
||||
vi.update_by = #{userName},
|
||||
vi.update_time = sysdate()
|
||||
where vi.id = #{id}
|
||||
<if test="userRole != null">
|
||||
<choose>
|
||||
<when test="userRole == 'manager'"> and vi.vis_id = #{userName} </when>
|
||||
<when test="userRole == 'outlet'"> and d.dept_id = #{deptId} </when>
|
||||
<when test="userRole == 'branch'"> and (d.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors)) </when>
|
||||
<when test="userRole in {'head', 'ops', 'public', 'private'}"> and left(d.dept_id,3) = left(#{deptId},3) </when>
|
||||
</choose>
|
||||
</if>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user