| @@ -36,7 +36,6 @@ public class WxBillActionController extends BaseController { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "账单操作记录-列表") | |||
| public ResultData list(@ModelAttribute WxBillAction wxBillAction, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillActionController::list"); | |||
| if (null == wxBillAction) { | |||
| @@ -7,6 +7,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.common.SysConfigConstant; | |||
| import com.iformall.domain.dto.WxBillPayDTO; | |||
| import com.iformall.domain.po.SysConfig; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxFlowModel; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| @@ -14,12 +15,14 @@ import com.iformall.domain.po.WxUserDataRule; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumBillOweOrNearType; | |||
| import com.iformall.enums.EnumBillUpdateType; | |||
| import com.iformall.enums.EnumFilterSettle; | |||
| import com.iformall.enums.EnumFlowKey; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.SysConfigService; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillAllService; | |||
| import com.iformall.service.WxBillSettleService; | |||
| import com.iformall.service.WxFlowService; | |||
| @@ -52,8 +55,8 @@ public class WxBillController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxBillAllService wxBillAllService; | |||
| //@Autowired | |||
| //WxBillAllService wxBillAllService; | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| @@ -64,6 +67,9 @@ public class WxBillController extends BaseController { | |||
| private SysConfigService sysConfigService; | |||
| @Autowired | |||
| WxBillAllHelper billAllHelper; | |||
| @Autowired | |||
| private WxBillActionService wxBillActionService; | |||
| /** | |||
| * 账单类型 | |||
| @@ -78,6 +84,19 @@ public class WxBillController extends BaseController { | |||
| return new ResultData(tmap); | |||
| } | |||
| /** | |||
| * 账单查询范围 | |||
| * @return | |||
| */ | |||
| @GetMapping("billScales") | |||
| public ResultData billScales() { | |||
| Map<Integer,String> tmap = new HashMap<Integer,String>(); | |||
| for (EnumBillOweOrNearType t : EnumBillOweOrNearType.values()) { | |||
| tmap.put(t.getCode(), t.getMessage()); | |||
| } | |||
| return new ResultData(tmap); | |||
| } | |||
| /** | |||
| * 商户催缴账单列表 | |||
| @@ -158,6 +177,43 @@ public class WxBillController extends BaseController { | |||
| return new ResultData(billAllHelper.getBillList(btype, wxMerchant,pageNum,pageSize)); | |||
| } | |||
| @ApiOperation("账单详情") | |||
| @GetMapping("detail") | |||
| public ResultData detail(@ModelAttribute WxMerchant wxMerchant,Integer billTypeValue,Long billId) { | |||
| if (null == billTypeValue || null == billId) { | |||
| return new ResultData(Result.ERROR,"参数错误"); | |||
| } | |||
| EnumBillAllType btype; | |||
| if (billTypeValue.intValue() == Constant.bill_all_type_manage_fee) { | |||
| btype = EnumBillAllType.RENT_BUSSINESS_MANAGE; | |||
| }else { | |||
| btype = EnumBillAllType.getEnum(billTypeValue); | |||
| if (null == btype) { | |||
| return new ResultData(Result.ERROR,"分类非法"); | |||
| } | |||
| } | |||
| if (null == wxMerchant) { | |||
| wxMerchant = new WxMerchant(); | |||
| } | |||
| wxMerchant.setId(this.getLoginBUser().getMerchantId()); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| return new ResultData(billAllHelper.getBillDetail(btype, wxMerchant,billId)); | |||
| } | |||
| @ApiOperation("账单操作记录列表") | |||
| @GetMapping("billActionlist") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBillAction wxBillAction, Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillAction) { | |||
| wxBillAction = new WxBillAction(); | |||
| } | |||
| wxBillAction.updateTenantInfo(getTenantInfo()); | |||
| PageInfo<WxBillAction> result = wxBillActionService.listAsPage(wxBillAction, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| // @ApiOperation("分类查询账单") | |||
| // @PostMapping("listBill") | |||
| // public ResultData listBill(@RequestBody WxBillAll wxBillAll) { | |||
| @@ -13,6 +13,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumAppPlat; | |||
| import com.iformall.enums.EnumEnableType; | |||
| import com.iformall.enums.EnumMallUserStatus; | |||
| import com.iformall.enums.EnumMenuType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.cuser.CUserServiceFactory; | |||
| @@ -218,7 +219,7 @@ public class WxInfoController extends BaseController { | |||
| } | |||
| if(!mallUserRoleService.checkIsMobileAdmin(user)) { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(),user.getName()+"非超管或者没有数据塔台权限", retMap); | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(),user.getName()+"非超管或者没有"+EnumMenuType.MOBILE_ADMIN.getMessage()+"权限", retMap); | |||
| } | |||
| retMap.put("phone", user.getPhone()); | |||
| @@ -291,7 +292,7 @@ public class WxInfoController extends BaseController { | |||
| mallUserInfoService.saveOrUpdate(user); | |||
| return new ResultData(resultMap); | |||
| } else { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(),user.getName()+"不是超管或者没有数据塔台的权限", resultMap); | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(),user.getName()+"不是超管或者没有"+EnumMenuType.MOBILE_ADMIN.getMessage()+"的权限", resultMap); | |||
| } | |||
| } else { | |||
| return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap); | |||
| @@ -0,0 +1,162 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.common.SysConfigConstant; | |||
| import com.iformall.domain.dto.WxBillPayDTO; | |||
| import com.iformall.domain.po.MallRolePermission; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.MallUserRole; | |||
| import com.iformall.domain.po.SysConfig; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxFlowModel; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxUserDataRule; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillHotNotify; | |||
| import com.iformall.enums.EnumBillAllType; | |||
| import com.iformall.enums.EnumBillOweOrNearType; | |||
| import com.iformall.enums.EnumBillUpdateType; | |||
| import com.iformall.enums.EnumFilterSettle; | |||
| import com.iformall.enums.EnumFlowKey; | |||
| import com.iformall.enums.EnumMenuType; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.enums.EnumUserDataRuleType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.MallPermissionService; | |||
| import com.iformall.service.MallRolePermissionService; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import com.iformall.service.MallUserRoleService; | |||
| import com.iformall.service.SysConfigService; | |||
| import com.iformall.service.WxBillActionService; | |||
| import com.iformall.service.WxBillAllService; | |||
| import com.iformall.service.WxBillSettleService; | |||
| import com.iformall.service.WxFlowService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxUserDataRuleService; | |||
| import com.iformall.service.helper.WxBillAllHelper; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @Api(description = "商管操作台") | |||
| @RequestMapping("/api/mallAdmin") | |||
| public class WxMallAdminController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private SysConfigService sysConfigService; | |||
| @Autowired | |||
| WxBillAllHelper billAllHelper; | |||
| @Autowired | |||
| MallUserInfoService mallUserInfoService; | |||
| @Autowired | |||
| MallUserRoleService mallUserRoleService; | |||
| @Autowired | |||
| MallRolePermissionService mallRolePermissionService; | |||
| @Autowired | |||
| private MallPermissionService mallPermissionService; | |||
| @Autowired | |||
| WxUserDataRuleService wxUserDataRuleService; | |||
| private MallUserInfo getMallUserByPhone(String phone,TenantEntity tenantEntity) { | |||
| MallUserInfo user = mallUserInfoService.getByPhone(phone, tenantEntity); | |||
| return user; | |||
| } | |||
| private WxUserDataRule getCurrentDataFloors(MallUserInfo user) { | |||
| if (null != user.getIsAdmin() && user.getIsAdmin().intValue() == EnumYesOrNo.YES.getCode().intValue()) { | |||
| return null; | |||
| } | |||
| WxUserDataRule byUserId = wxUserDataRuleService.findByUserId(user.getId()); | |||
| //没有配置,默认是全部权限 | |||
| if (byUserId != null && EnumUserDataRuleType.ALL.getCode().intValue() == byUserId.getType().intValue()) { | |||
| return null; | |||
| } | |||
| return byUserId; | |||
| } | |||
| /** | |||
| * 获取权限 | |||
| * @return | |||
| */ | |||
| @GetMapping("menus") | |||
| public ResultData menus(String phone) { | |||
| if (StringUtils.isBlank(phone) || "undefined".equals(phone)) { | |||
| return new ResultData(Result.ERROR,"参数非法"); | |||
| } | |||
| MallUserInfo userInfo = getMallUserByPhone(phone,this.getTenantInfo()); | |||
| if (null == userInfo) { | |||
| return new ResultData(Result.ERROR,"手机号["+phone+"]非绑定后台管理员账号"); | |||
| } | |||
| List<Long> bpermissions = mallPermissionService.getIdsByParentId(EnumMenuType.MOBILE_ADMIN.getCode().longValue()); | |||
| MallUserRole ur = new MallUserRole(); | |||
| ur.setUid(userInfo.getId()); | |||
| List<MallUserRole> userRoles = mallUserRoleService.getList(ur); | |||
| if (userRoles.size() > 0) { | |||
| MallUserRole userRole = userRoles.get(0); | |||
| Long roleId = userRole.getRoleId(); | |||
| MallRolePermission p = new MallRolePermission(); | |||
| p.setRoleId(roleId); | |||
| p.setPermissionIds(bpermissions); | |||
| p.updateTenantInfo(userInfo); | |||
| List<MallRolePermission> rolePermissions = mallRolePermissionService.getList(p); | |||
| return new ResultData(rolePermissions); | |||
| } | |||
| return new ResultData(Result.ERROR,"手机号["+phone+"]绑定的后台管理员无此权限"); | |||
| } | |||
| /** | |||
| * 商户催缴账单列表 | |||
| * @param wxBillAll | |||
| * @param pageNum | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| @GetMapping("notifyList") | |||
| public ResultData notifyList(@ModelAttribute WxMerchant wxMerchant) { | |||
| if (StringUtils.isBlank(wxMerchant.getPhone()) || "undefined".equals(wxMerchant.getPhone())) { | |||
| return new ResultData(Result.ERROR,"参数非法"); | |||
| } | |||
| MallUserInfo userInfo = getMallUserByPhone(wxMerchant.getPhone(),this.getTenantInfo()); | |||
| if (null == userInfo) { | |||
| return new ResultData(Result.ERROR,"手机号["+wxMerchant.getPhone()+"]非绑定后台管理员账号"); | |||
| } | |||
| WxUserDataRule dataRule = this.getCurrentDataFloors(userInfo); | |||
| if (null != dataRule) { | |||
| wxMerchant.setFloorForRule(dataRule.getFloorIds()); | |||
| wxMerchant.setBusinessForRule(dataRule.getBussinessIds()); | |||
| } | |||
| return new ResultData(billAllHelper.getBillNotifyList(wxMerchant,EnumYesOrNo.YES.getCode())); | |||
| } | |||
| } | |||
| @@ -37,7 +37,7 @@ public class MallPermission extends BaseEntity { | |||
| private String permission; | |||
| @TableField(exist = false) | |||
| private List<String> permissions; | |||
| @io.swagger.annotations.ApiModelProperty(value="资源类型0:目录 1:菜单 2:按钮",name="resourceType") | |||
| @io.swagger.annotations.ApiModelProperty(value="资源类型0:目录 1:菜单 2:按钮 EnumPermissionType",name="resourceType") | |||
| private Integer resourceType; | |||
| @io.swagger.annotations.ApiModelProperty(value="菜单背景色-1级菜单使用",name="moduleColor") | |||
| private String moduleColor; | |||
| @@ -24,6 +24,8 @@ public class WxBillNotify implements Serializable { | |||
| private String owe; | |||
| private Long merchantId; | |||
| private String merchantName; | |||
| private String merchantPhone; | |||
| private String merchantLinkPerson; | |||
| public String getOwe() { | |||
| return new BigDecimal(receivePay).subtract(new BigDecimal(pay)).toPlainString(); | |||
| @@ -11,7 +11,7 @@ public enum EnumMenuType { | |||
| MEM_SYSTEM(5, "会员系统"), | |||
| SALE_SYSTEM(6, "营销系统"), | |||
| ACCOUNT_MANAGER(7, "账号管理"), | |||
| MOBILE_ADMIN(8, "移动端数据塔台"), | |||
| MOBILE_ADMIN(8, "移动端商管操作台"), | |||
| HARDWARE(9, "智能硬件"), | |||
| PAGE_MAIN(10, "首页"), | |||
| ; | |||
| @@ -9,7 +9,8 @@ public enum EnumPermissionType { | |||
| CATALOG(0, "目录"), | |||
| MENU(1, "菜单"), | |||
| BUTTON(2,"按钮") | |||
| BUTTON(2,"按钮"), | |||
| B(3,"商户小程序端") | |||
| ; | |||
| public static EnumPermissionType getEnum(Integer code) { | |||
| @@ -8,6 +8,8 @@ import java.util.List; | |||
| public interface MallPermissionMapper extends CommonMapper<MallPermission, String> { | |||
| List<MallPermission> findList(MallPermission mallPermission); | |||
| List<Long> findIdList(MallPermission mallPermission); | |||
| List<MallPermission> queryListParentId(Long parentId); | |||
| @@ -77,6 +77,7 @@ public interface MallPermissionService { | |||
| * @return | |||
| */ | |||
| List<MallPermission> getByParentId(Long parentId); | |||
| List<Long> getIdsByParentId(Long parentId); | |||
| /** | |||
| * 保存或更新实体 | |||
| @@ -634,6 +634,8 @@ public class WxBillAllHelper { | |||
| WxMerchant m = merchantMap.get(bn.getMerchantId()); | |||
| if (null != m) { | |||
| bn.setMerchantName(m.getName()); | |||
| bn.setMerchantPhone(m.getLinkPhone()); | |||
| bn.setMerchantLinkPerson(m.getLinkPerson()); | |||
| } | |||
| } | |||
| } | |||
| @@ -891,4 +893,27 @@ public class WxBillAllHelper { | |||
| wxBillOtherDepositService.updatePayByMerchant(dto, user); | |||
| } | |||
| } | |||
| public WxBillBaseEntity getBillDetail(EnumBillAllType billType,WxMerchant wxMerchant,Long billId) { | |||
| if (billType == EnumBillAllType.RENT) { | |||
| return wxBillRentService.getById(wxMerchant,billId); | |||
| }else if (billType == EnumBillAllType.RENT_BUSSINESS_MANAGE) { | |||
| return wxBillRentManageService.getById(wxMerchant,billId); | |||
| }else if (billType == EnumBillAllType.RENT_OPERATION_MANAGE) { | |||
| return wxBillRentManageService.getById(wxMerchant,billId); | |||
| }else if (billType == EnumBillAllType.RENT_DEPOSIT) { | |||
| return wxBillRentDepositService.getById(wxMerchant,billId); | |||
| }else if (billType == EnumBillAllType.PROPERTY) { | |||
| return wxBillPropertyService.getById(wxMerchant,billId); | |||
| }else if (billType == EnumBillAllType.PROPERTY_DEPOSIT) { | |||
| return wxBillPropertyDepositService.getById(wxMerchant,billId); | |||
| }else if (billType == EnumBillAllType.DAILY) { | |||
| return wxBillDailyService.getById(wxMerchant,billId); | |||
| }else if (billType == EnumBillAllType.OTHER) { | |||
| return wxBillOtherService.getById(wxMerchant,billId); | |||
| }else if (billType == EnumBillAllType.OTHER_DEPOSIT) { | |||
| return wxBillOtherDepositService.getById(wxMerchant,billId); | |||
| } | |||
| return null; | |||
| } | |||
| } | |||
| @@ -54,11 +54,17 @@ public class MallPermissionServiceImpl implements MallPermissionService { | |||
| List<MallPermission> userMenuList = new ArrayList<>(); | |||
| for(MallPermission menu : menuList){ | |||
| if(boolNav) { | |||
| if(menu.getId().longValue() == (long)EnumMenuType.MOBILE_ADMIN.getCode()) { | |||
| // if(boolNav) { | |||
| // if(menu.getId().longValue() == (long)EnumMenuType.MOBILE_ADMIN.getCode()) { | |||
| // continue; | |||
| // } | |||
| // } | |||
| if(boolNav) { | |||
| if (Objects.equals(menu.getResourceType(), EnumPermissionType.B.getCode())) { | |||
| continue; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| if (Objects.equals(menu.getResourceType(), EnumPermissionType.BUTTON.getCode())) { | |||
| continue; | |||
| @@ -239,6 +245,16 @@ public class MallPermissionServiceImpl implements MallPermissionService { | |||
| mpQ.setSortColumns(BaseEntity.SortField.Sort_ASC); | |||
| return mallPermissionMapper.findList(mpQ); | |||
| } | |||
| @Override | |||
| public List<Long> getIdsByParentId(Long parentId) { | |||
| if(parentId == null) { | |||
| parentId = 0L; | |||
| } | |||
| MallPermission mpQ = new MallPermission(); | |||
| mpQ.setParentId(parentId); | |||
| return mallPermissionMapper.findIdList(mpQ); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallPermission record) { | |||
| @@ -88,6 +88,11 @@ | |||
| from mall_permission | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="findIdList" parameterType="com.iformall.domain.po.MallPermission" resultMap="BaseResultMap"> | |||
| select id from mall_permission | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="queryListParentId" parameterType="long" resultMap="BaseResultMap"> | |||
| select | |||
| @@ -34,6 +34,14 @@ | |||
| <if test=" null != roleId "> | |||
| and `role_id` = #{roleId} | |||
| </if> | |||
| <if test=" null != permissionIds "> | |||
| and permission_id in | |||
| <foreach collection="permissionIds" index="index" item="pidItem" open="(" separator="," close=")"> | |||
| #{pidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||