Commit 8aadd0a9 authored by huagnxiner's avatar huagnxiner

平台管理批量软删除公海的客户信息

parent 27c9301d
...@@ -964,4 +964,25 @@ public class PlatformManagementController extends BaseController { ...@@ -964,4 +964,25 @@ public class PlatformManagementController extends BaseController {
return result; return result;
} }
/**
* 逻辑删除平台客户
*
* @param idList 客户idList
* @return
*/
@RequestMapping(value = "deleteIdList",method=RequestMethod.POST)
@ResponseBody
public HResult deleteByIdList(@RequestBody() List<Integer>idList, HttpServletRequest request) {
HResult result = new HResult();
try {
UserEntity userEntity = (UserEntity) request.getSession().getAttribute(SessionConstants.THREAD_USER_KEY);
result = customer.deleteIdList(idList, userEntity.getId(), userEntity.getRealName());
} catch (Exception e) {
logger.error(e.getMessage(), e);
result.setStatus(500);
result.setErrorMessage("删除失败");
}
return result;
}
} }
...@@ -473,8 +473,9 @@ ...@@ -473,8 +473,9 @@
</li> </li>
</ul> </ul>
<div class="bottomBtn" style="overflow: hidden"> <div class="bottomBtn" style="overflow: hidden">
<div class="checkAll">选择全部:<input type="checkbox" onclick="checkAll(this)"/></div> <div class="checkAll">选择全部:<input type="checkbox" id="memberCheckAll" onclick="checkAll(this)"/></div>
<div class="bottomBtnR" onclick="assignManager()">批量转移</div> <div class="bottomBtnR" onclick="assignManager()">批量转移</div>
<div class="bottomBtnR" name="batchDel" onclick="batchDel()">批量删除</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -963,6 +964,53 @@ ...@@ -963,6 +964,53 @@
}); });
$(".modal").css("width", "560px"); $(".modal").css("width", "560px");
} }
//批量删除
function batchDel() {
var customerIdArr = [],
mangerIdStateArr=[];
for (i = 0; i < document.getElementsByName('memberCheck').length; i++) {
if (document.getElementsByName('memberCheck')[i].checked) {
customerIdArr.push(document.getElementsByName('memberCheck')[i].value);
mangerIdStateArr.push(document.getElementsByClassName('mangerId_state')[i].textContent.replace(/[\r\n\s]/g, "").trim());
}
}
if (customerIdArr.length<=0) {
alert("请至少选择一个客户!");
return false;
}
//不能删除非公海状态的用户
for(j = 0,len=mangerIdStateArr.length; j < len; j++) {
if (mangerIdStateArr[j]!='回公海') {
alert("无法删除在跟进客户!");
return false;
}else {
continue;
}
}
House365Util.createModal("批量删除客户", "确认是否删除所选客户?", function () {
var url = "${ctx}/platformmanagement/deleteIdList";
$.ajax({
url: url,
type: 'post',
contentType: 'application/json',
data: JSON.stringify(customerIdArr),
dataType: 'json',
cache: false,
success: function (result) {
if (result.status == 0) {
alert("删除成功");
window.location.reload();
} else{
alert(result.errorMessage);
}
}
});
});
}
//全选 //全选
var checkNum = 0; var checkNum = 0;
function checkAll(btn) { function checkAll(btn) {
...@@ -996,6 +1044,7 @@ ...@@ -996,6 +1044,7 @@
document.getElementById("memberCheckAll").checked = false; document.getElementById("memberCheckAll").checked = false;
} }
} }
</script> </script>
<script src="${static_common}/jquery-ui/jquery-ui.min.js" type="text/javascript"></script> <script src="${static_common}/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
......
...@@ -266,4 +266,6 @@ public interface ICustomer extends IService { ...@@ -266,4 +266,6 @@ public interface ICustomer extends IService {
HResult deleteById(int id, int userId, String userName); HResult deleteById(int id, int userId, String userName);
HResult deleteIdList(List<Integer> idList, int userId, String userName);
} }
package com.house365.ws.dao.mapper; package com.house365.ws.dao.mapper;
import com.house365.beans.entity.CustomerEntity; import com.house365.beans.entity.CustomerEntity;
import com.house365.beans.entity.UserEntity;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -93,4 +92,6 @@ public interface CustomerMapper { ...@@ -93,4 +92,6 @@ public interface CustomerMapper {
int querySeaCount(Map<String, Object> map); int querySeaCount(Map<String, Object> map);
int updateIdList(List<Integer> idList);
} }
...@@ -3098,6 +3098,28 @@ public class CustomerImpl implements ICustomer { ...@@ -3098,6 +3098,28 @@ public class CustomerImpl implements ICustomer {
return result; return result;
} }
/**
* 批量软删除customerid
* @param idList
* @param userId
* @param userName
* @return
*/
@Override
public HResult deleteIdList(List<Integer> idList, int userId, String userName) {
HResult result = new HResult();
try {
int updateCount=customerMapper.updateIdList(idList);
LOGGER.info("updateCount:"+updateCount);
result.setStatus(0);
result.setData(updateCount);
}catch (Exception e){
LOGGER.error(e.getMessage(), e);
result.fail(500,e.getMessage());
}
return result;
}
/** /**
* 以下均为自动生成 * 以下均为自动生成
*/ */
......
...@@ -850,4 +850,12 @@ ...@@ -850,4 +850,12 @@
</if> </if>
</select> </select>
<update id="updateIdList" parameterType="list">
update customer set is_delete=1
WHERE
id
<foreach collection="list" item="id" open="in (" close=")" separator=",">
#{id}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -850,4 +850,12 @@ ...@@ -850,4 +850,12 @@
</if> </if>
</select> </select>
<update id="updateIdList" parameterType="list">
update customer set is_delete=1
WHERE
id
<foreach collection="list" item="id" open="in (" close=")" separator=",">
#{id}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -850,4 +850,12 @@ ...@@ -850,4 +850,12 @@
</if> </if>
</select> </select>
<update id="updateIdList" parameterType="list">
update customer set is_delete=1
WHERE
id
<foreach collection="list" item="id" open="in (" close=")" separator=",">
#{id}
</foreach>
</update>
</mapper> </mapper>
\ No newline at end of file
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