diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java index 17a95d46..05e8a12c 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java @@ -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("操作失败!"); + } + } } diff --git a/ghy-admin/src/main/resources/templates/customer/place/place.html b/ghy-admin/src/main/resources/templates/customer/place/place.html index b136b562..4bacf724 100644 --- a/ghy-admin/src/main/resources/templates/customer/place/place.html +++ b/ghy-admin/src/main/resources/templates/customer/place/place.html @@ -36,15 +36,15 @@
- - 添加 + + 通过 + + + 拒绝 修改 - - 删除 - 导出 @@ -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 }); + }) + } \ No newline at end of file diff --git a/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerPlaceMapper.java b/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerPlaceMapper.java index 397abb5d..2921b91d 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerPlaceMapper.java +++ b/ghy-custom/src/main/java/com/ghy/customer/mapper/CustomerPlaceMapper.java @@ -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); + } \ No newline at end of file diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java b/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java index 89555c0a..7195f957 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/ICustomerPlaceService.java @@ -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); + } \ No newline at end of file diff --git a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java index 0cfee2a7..31f14085 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java +++ b/ghy-custom/src/main/java/com/ghy/customer/service/impl/CustomerPlaceServiceImpl.java @@ -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); + } } \ No newline at end of file diff --git a/ghy-custom/src/main/resources/mapper/customer/CustomerPlaceMapper.xml b/ghy-custom/src/main/resources/mapper/customer/CustomerPlaceMapper.xml index 7fc723d1..6279103f 100644 --- a/ghy-custom/src/main/resources/mapper/customer/CustomerPlaceMapper.xml +++ b/ghy-custom/src/main/resources/mapper/customer/CustomerPlaceMapper.xml @@ -88,5 +88,10 @@ #{id} + + + UPDATE customer_place set status = #{status} + WHERE id in ( #{ids} ) + \ No newline at end of file