消费者分销审核

This commit is contained in:
kuang.yifei@iwhalecloud.com 2022-08-24 14:19:27 +08:00
parent a6a6c38d4a
commit 56761090e6
6 changed files with 74 additions and 7 deletions

View File

@ -4,8 +4,13 @@ import java.util.List;
import com.ghy.common.enums.PlaceStatus;
import com.ghy.common.utils.CacheUtils;
import com.ghy.common.utils.ExceptionUtil;
import com.ghy.common.utils.ObjectUtils;
import com.ghy.customer.domain.Customer;
import com.ghy.customer.service.CustomerService;
import com.ghy.worker.domain.Worker;
import com.ghy.worker.domain.WorkerBank;
import com.ghy.worker.domain.WorkerCertification;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -170,4 +175,29 @@ public class CustomerPlaceController extends BaseController
{
return toAjax(customerPlaceService.deleteCustomerPlaceByIds(ids));
}
@PostMapping("/changeStatus")
@ResponseBody
public AjaxResult changeStatus(String ids,Integer status){
try {
int result = customerPlaceService.changeStatus(ids, status);
if(result > 0){
String [] idArray = ids.split(",");
for (String id : idArray){
CustomerPlace customerPlace = customerPlaceService.selectCustomerPlaceById(id);
Customer customer = new Customer();
customer.setCustomerId(customerPlace.getCustomerId());
customer.setPlaceStatus(status);
customerService.updateCustomer(customer);
}
return AjaxResult.success("操作成功!");
}else {
return AjaxResult.warn("操作失败!");
}
}catch (Exception e){
e.printStackTrace();
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error("操作失败!");
}
}
}

View File

@ -36,15 +36,15 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="customer:place:add">
<i class="fa fa-plus"></i> 添加
<a class="btn btn-primary multiple disabled" onclick="auditStatus(2)" shiro:hasPermission="customer:place:add">
<i class="fa fa-edit"></i> 通过
</a>
<a class="btn btn-danger multiple disabled" onclick="auditStatus(0)" shiro:hasPermission="customer:place:remove">
<i class="fa fa-remove"></i> 拒绝
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="customer:place:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="customer:place:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="customer:place:export">
<i class="fa fa-download"></i> 导出
</a>
@ -63,9 +63,7 @@
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "分销申请",
columns: [{
@ -109,6 +107,18 @@
};
$.table.init(options);
});
function auditStatus(status){
table.set();
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$.modal.confirm("确认审核吗?", function() {
$.operate.post(prefix + "/changeStatus", { "ids": rows.join(), "status": status });
})
}
</script>
</body>
</html>

View File

@ -2,6 +2,7 @@ package com.ghy.customer.mapper;
import java.util.List;
import com.ghy.customer.domain.CustomerPlace;
import org.apache.ibatis.annotations.Param;
/**
* 分销申请Mapper接口
@ -58,4 +59,12 @@ public interface CustomerPlaceMapper
* @return 结果
*/
public int deleteCustomerPlaceByIds(String[] ids);
/**
* @param ids 需要审核的id
* @param status 审核结果
* @return 结果
*/
public int changeStatus(@Param("ids") String ids, @Param("status") Integer status);
}

View File

@ -58,4 +58,12 @@ public interface ICustomerPlaceService
* @return 结果
*/
public int deleteCustomerPlaceById(String id);
/**
* @param ids 需要审核的id
* @param status 审核结果
* @return 结果
*/
public int changeStatus(String ids,Integer status);
}

View File

@ -93,4 +93,9 @@ public class CustomerPlaceServiceImpl implements ICustomerPlaceService
{
return customerPlaceMapper.deleteCustomerPlaceById(id);
}
@Override
public int changeStatus(String ids, Integer status) {
return customerPlaceMapper.changeStatus(ids, status);
}
}

View File

@ -88,5 +88,10 @@
#{id}
</foreach>
</delete>
<update id="changeStatus">
UPDATE customer_place set status = #{status}
WHERE id in ( #{ids} )
</update>
</mapper>