diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/controller/CustOrgController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/controller/CustOrgController.java new file mode 100644 index 00000000..4a2fe512 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/controller/CustOrgController.java @@ -0,0 +1,119 @@ +package com.bonus.canteen.core.customer.controller; + +import cn.hutool.core.lang.tree.Tree; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.bonus.canteen.core.common.base.BaseController; +import com.bonus.canteen.core.customer.dto.CustOrgPageDTO; +import com.bonus.canteen.core.customer.service.CustOrgService; +import com.bonus.canteen.core.customer.vo.CustOrgVO; +import com.bonus.common.houqin.utils.AesEncryptUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping({"/custOrg"}) +@Api("customer-组织机构(部门)控制器") +public class CustOrgController extends BaseController { + private static final Logger log = LoggerFactory.getLogger(CustOrgController.class); + @Autowired + @Lazy + private CustOrgService custOrgService; + @Autowired + @Lazy + private AesEncryptUtil aesEncryptUtil; + + @ApiOperation("分页查询组织") + @PostMapping({"/queryPageCustOrg"}) + public Page queryPageCustOrg(@RequestBody CustOrgPageDTO content) { + Page custOrgVOPage = this.custOrgService.pageCustOrgByParams(new Page(content.getCurrent(), content.getSize()), content); + Iterator var4 = custOrgVOPage.getRecords().iterator(); + + while(var4.hasNext()) { + CustOrgVO custOrgVO = (CustOrgVO)var4.next(); + custOrgVO.setOrgTel(this.aesEncryptUtil.aesEncrypt(custOrgVO.getOrgTel())); + } + + return custOrgVOPage; + } + + +// @RequiresGuest +// @ApiOperation("根据id查询组织") +// @GetMapping({"/queryCustOrgById"}) +// public CustOrg queryCustOrgById(LeRequest request) { +// Map contentMap = (Map)this.gson.fromJson((String)request.getContent(), Map.class); +// return this.custOrgService.getCustOrg(((JSONObject)contentMap.get("object")).getLong("id")); +// } +// +// @RequiresPermissions({"cust:org:add"}) +// @RequiresAuthentication +// @ApiOperation("新增") +// @PostMapping({"/addCustOrg"}) +// public void addCustOrg(@Validated({ValidationGroups.Insert.class}) @RequestBody LeRequest request) { +// CustOrg content = (CustOrg)request.getContent(); +// content.setOrgTel(this.aesEncryptUtil.aesDecode(content.getOrgTel())); +// this.custOrgService.addCustOrg(content); +// } +// +// @RequiresPermissions({"cust:org:edit"}) +// @ApiOperation("根据id修改") +// @PutMapping({"/updateCustOrgById"}) +// @RequiresAuthentication +// public void updateCustOrgById(@Validated({ValidationGroups.Update.class}) @RequestBody LeRequest request) { +// CustOrg content = (CustOrg)request.getContent(); +// content.setOrgTel(this.aesEncryptUtil.aesDecode(content.getOrgTel())); +// this.custOrgService.updateOrg(content); +// } +// +// @RequiresPermissions({"cust:org:del"}) +// @ApiOperation("根据组织id删除") +// @DeleteMapping({"/deleteCustOrgByOrgId"}) +// @RequiresAuthentication +// public void deleteCustOrgByOrgId(@Validated({ValidationGroups.Delete.class}) @RequestBody LeRequest request) { +// this.custOrgService.deleteByOrdId(((CustOrg)request.getContent()).getOrgId()); +// } +// +// @ApiOperation("系统组织树") +// @GetMapping({"/system/tree"}) +// @RequiresGuest +// public List> getSystemOrgTree() { +// return this.custOrgService.getSystemOrgTree(); +// } +// +// @ApiOperation("商户权限组织树") +// @GetMapping({"/tenant/tree"}) +// @RequiresAuthentication +// public List> getTenantOrgTree() { +// return this.custOrgService.getTenantOrgTree(); +// } +// +// @ApiOperation("查询组织下默认就餐地") +// @GetMapping({"/query/diningPlace"}) +// @RequiresGuest +// @RequiresAuthentication +// public JsonNode queryDiningPlace(@RequestParam("orgId") Long orgId) { +// return this.custOrgService.queryDiningPlaceByOrgId(orgId); +// } +// +// @ApiOperation("根据superId查询懒加载子级组织树") +// @PostMapping({"/lazy/org/tree"}) +// public List getPlaceLazyTree(@RequestBody LeRequest request) { +// return this.custOrgService.getOrgLazyTree((CustOrgTreeDTO)request.getContent()); +// } +// +// @ApiOperation("组织树同层级拖动排序") +// @PostMapping({"/dragOrgSort"}) +// public void dragOrgSort(@RequestBody LeRequest request) { +// this.custOrgService.dragOrgSort((CustOrgTreeDTO)request.getContent()); +// } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/mapper/CustInfoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/mapper/CustInfoMapper.java index e1ec7d6f..64021b3b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/mapper/CustInfoMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/mapper/CustInfoMapper.java @@ -7,6 +7,7 @@ import com.bonus.canteen.core.customer.dto.CustInfoDTO; import com.bonus.canteen.core.customer.dto.CustInfoParam; import com.bonus.canteen.core.customer.dto.CustPayDTO; import com.bonus.canteen.core.customer.model.CustInfo; +import com.bonus.canteen.core.customer.po.CustomerNumByOrgIdMapperPO; import com.bonus.canteen.core.customer.vo.CustInfoForRechargeVO; import com.bonus.canteen.core.customer.vo.CustInfoVo; import com.bonus.canteen.core.customer.vo.CustPayVO; @@ -17,6 +18,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import java.util.Collection; import java.util.List; @Mapper @@ -61,6 +63,8 @@ public interface CustInfoMapper extends BaseMapper { int updateCustCasual(CustCasual custCasual); + List getCustomerNumByOrgIdList(@Param("orgIdList") Collection orgIdList); + @LeNiuDataPermission( alias = "ci", permissionType = DataPermissionTypeEnum.PERMISSION_ORG diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/po/CustomerNumByOrgIdMapperPO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/po/CustomerNumByOrgIdMapperPO.java new file mode 100644 index 00000000..a90cad5e --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/po/CustomerNumByOrgIdMapperPO.java @@ -0,0 +1,23 @@ +package com.bonus.canteen.core.customer.po; + +public class CustomerNumByOrgIdMapperPO { + private Long orgId; + private Integer customerNum; + + public Long getOrgId() { + return this.orgId; + } + + public Integer getCustomerNum() { + return this.customerNum; + } + + public void setOrgId(final Long orgId) { + this.orgId = orgId; + } + + public void setCustomerNum(final Integer customerNum) { + this.customerNum = customerNum; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/service/impl/CustInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/service/impl/CustInfoServiceImpl.java index 85426251..e631f7f1 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/service/impl/CustInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/service/impl/CustInfoServiceImpl.java @@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.bonus.canteen.core.customer.constants.*; +import com.bonus.canteen.core.customer.po.CustomerNumByOrgIdMapperPO; import com.bonus.canteen.core.customer.vo.PageCustInfoPhotoVO; import com.bonus.common.core.constant.CacheConstants; import com.bonus.common.core.exception.ServiceException; @@ -466,7 +467,8 @@ public class CustInfoServiceImpl extends ServiceImpl i @Override public Map getCustomerNumBelongOrg() { - return null; + List customerNumByOrgIdList = ((CustInfoMapper)this.baseMapper).getCustomerNumByOrgIdList((Collection)null); + return (Map)(CollUtil.isEmpty(customerNumByOrgIdList) ? new HashMap() : (Map)customerNumByOrgIdList.stream().collect(Collectors.toMap(CustomerNumByOrgIdMapperPO::getOrgId, CustomerNumByOrgIdMapperPO::getCustomerNum))); } @Override diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/customer/CustInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/customer/CustInfoMapper.xml index 708a7f99..16491a8c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/customer/CustInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/customer/CustInfoMapper.xml @@ -246,6 +246,24 @@ where casual_id = #{casualId} + +