|
|
@@ -14,10 +14,12 @@ import com.iformall.domain.po.WxBillAction; |
|
|
import com.iformall.domain.po.WxFlowModel; |
|
|
import com.iformall.domain.po.WxFlowModel; |
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
import com.iformall.domain.po.WxMerchant; |
|
|
import com.iformall.domain.po.WxMerchantBUser; |
|
|
import com.iformall.domain.po.WxMerchantBUser; |
|
|
|
|
|
import com.iformall.domain.po.WxShop; |
|
|
import com.iformall.domain.po.WxUserDataRule; |
|
|
import com.iformall.domain.po.WxUserDataRule; |
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
import com.iformall.domain.vo.WxBillAll; |
|
|
import com.iformall.domain.vo.WxBillAll; |
|
|
import com.iformall.domain.vo.WxBillHotNotify; |
|
|
import com.iformall.domain.vo.WxBillHotNotify; |
|
|
|
|
|
import com.iformall.domain.vo.WxBillSum; |
|
|
import com.iformall.enums.EnumBillAllType; |
|
|
import com.iformall.enums.EnumBillAllType; |
|
|
import com.iformall.enums.EnumBillOweOrNearType; |
|
|
import com.iformall.enums.EnumBillOweOrNearType; |
|
|
import com.iformall.enums.EnumBillUpdateType; |
|
|
import com.iformall.enums.EnumBillUpdateType; |
|
|
@@ -35,6 +37,7 @@ import com.iformall.service.SysConfigService; |
|
|
import com.iformall.service.WxBillActionService; |
|
|
import com.iformall.service.WxBillActionService; |
|
|
import com.iformall.service.WxBillAllService; |
|
|
import com.iformall.service.WxBillAllService; |
|
|
import com.iformall.service.WxBillSettleService; |
|
|
import com.iformall.service.WxBillSettleService; |
|
|
|
|
|
import com.iformall.service.WxChartDataService; |
|
|
import com.iformall.service.WxFlowService; |
|
|
import com.iformall.service.WxFlowService; |
|
|
import com.iformall.service.WxMerchantService; |
|
|
import com.iformall.service.WxMerchantService; |
|
|
import com.iformall.service.WxUserDataRuleService; |
|
|
import com.iformall.service.WxUserDataRuleService; |
|
|
@@ -51,7 +54,9 @@ import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
@@ -82,13 +87,10 @@ public class WxMallAdminController extends BaseController { |
|
|
private MallPermissionService mallPermissionService; |
|
|
private MallPermissionService mallPermissionService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
WxUserDataRuleService wxUserDataRuleService; |
|
|
WxUserDataRuleService wxUserDataRuleService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WxChartDataService wxChartDataService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MallUserInfo getMallUserByPhone(String phone,TenantEntity tenantEntity) { |
|
|
|
|
|
MallUserInfo user = mallUserInfoService.getByPhone(phone, tenantEntity); |
|
|
|
|
|
return user; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private WxUserDataRule getCurrentDataFloors(MallUserInfo user) { |
|
|
private WxUserDataRule getCurrentDataFloors(MallUserInfo user) { |
|
|
if (null != user.getIsAdmin() && user.getIsAdmin().intValue() == EnumYesOrNo.YES.getCode().intValue()) { |
|
|
if (null != user.getIsAdmin() && user.getIsAdmin().intValue() == EnumYesOrNo.YES.getCode().intValue()) { |
|
|
return null; |
|
|
return null; |
|
|
@@ -100,6 +102,16 @@ public class WxMallAdminController extends BaseController { |
|
|
} |
|
|
} |
|
|
return byUserId; |
|
|
return byUserId; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setQueryDataRule(TenantEntity tenantEntity) { |
|
|
|
|
|
MallUserInfo userInfo = this.getLoginMallUserInfo(); |
|
|
|
|
|
tenantEntity.updateTenantInfo(userInfo); |
|
|
|
|
|
WxUserDataRule dataRule = this.getCurrentDataFloors(userInfo); |
|
|
|
|
|
if (null != dataRule) { |
|
|
|
|
|
tenantEntity.setFloorForRule(dataRule.getFloorIds()); |
|
|
|
|
|
tenantEntity.setBusinessForRule(dataRule.getBussinessIds()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取权限 |
|
|
* 获取权限 |
|
|
@@ -107,16 +119,8 @@ public class WxMallAdminController extends BaseController { |
|
|
*/ |
|
|
*/ |
|
|
@GetMapping("menus") |
|
|
@GetMapping("menus") |
|
|
public ResultData menus(String phone) { |
|
|
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+"]非绑定后台管理员账号"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MallUserInfo userInfo = this.getLoginMallUserInfo(); |
|
|
List<Long> bpermissions = mallPermissionService.getIdsByParentId(EnumMenuType.MOBILE_ADMIN.getCode().longValue()); |
|
|
List<Long> bpermissions = mallPermissionService.getIdsByParentId(EnumMenuType.MOBILE_ADMIN.getCode().longValue()); |
|
|
|
|
|
|
|
|
MallUserRole ur = new MallUserRole(); |
|
|
MallUserRole ur = new MallUserRole(); |
|
|
ur.setUid(userInfo.getId()); |
|
|
ur.setUid(userInfo.getId()); |
|
|
List<MallUserRole> userRoles = mallUserRoleService.getList(ur); |
|
|
List<MallUserRole> userRoles = mallUserRoleService.getList(ur); |
|
|
@@ -142,21 +146,101 @@ public class WxMallAdminController extends BaseController { |
|
|
*/ |
|
|
*/ |
|
|
@GetMapping("notifyList") |
|
|
@GetMapping("notifyList") |
|
|
public ResultData notifyList(@ModelAttribute WxMerchant wxMerchant) { |
|
|
public ResultData notifyList(@ModelAttribute WxMerchant wxMerchant) { |
|
|
if (StringUtils.isBlank(wxMerchant.getPhone()) || "undefined".equals(wxMerchant.getPhone())) { |
|
|
|
|
|
return new ResultData(Result.ERROR,"参数非法"); |
|
|
|
|
|
|
|
|
setQueryDataRule(wxMerchant); |
|
|
|
|
|
return new ResultData(billAllHelper.getBillNotifyList(wxMerchant,EnumYesOrNo.YES.getCode())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Integer getOweBillBeforeDays() { |
|
|
|
|
|
SysConfig config = sysConfigService.getByKey(SysConfigConstant.bill_before_days, getTenantInfo()); |
|
|
|
|
|
Integer oweBillBeforeDays = 0 ; |
|
|
|
|
|
if (null != config && null != config.getConfigItemValue()) { |
|
|
|
|
|
oweBillBeforeDays = Integer.parseInt(config.getConfigItemValue()); |
|
|
|
|
|
} |
|
|
|
|
|
return oweBillBeforeDays; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Integer getNearBillBeforeDays() { |
|
|
|
|
|
SysConfig lqconfig = sysConfigService.getByKey(SysConfigConstant.bill_near_days, getTenantInfo()); |
|
|
|
|
|
Integer nearBillBeforeDays = Constant.bill_near_default_days ; |
|
|
|
|
|
if (null != lqconfig && null != lqconfig.getConfigItemValue()) { |
|
|
|
|
|
nearBillBeforeDays = Integer.parseInt(lqconfig.getConfigItemValue()); |
|
|
|
|
|
} |
|
|
|
|
|
return nearBillBeforeDays; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<WxBillHotNotify> getHots(Integer nearBillBeforeDays) { |
|
|
|
|
|
WxMerchant wxMerchant = new WxMerchant(); |
|
|
|
|
|
setQueryDataRule(wxMerchant); |
|
|
|
|
|
wxMerchant.setOweBillBeforeDays(getOweBillBeforeDays()); |
|
|
|
|
|
wxMerchant.setNearBillBeforeDays(nearBillBeforeDays); |
|
|
|
|
|
return billAllHelper.getHotNotify(wxMerchant); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//逾期账单 |
|
|
|
|
|
@GetMapping("oweBillHot") |
|
|
|
|
|
public ResultData oweBillHot() { |
|
|
|
|
|
return new ResultData(getHots(null)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//临期账单 |
|
|
|
|
|
@GetMapping("nearBillHot") |
|
|
|
|
|
public ResultData nearBillHot() { |
|
|
|
|
|
return new ResultData(getHots(getNearBillBeforeDays())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("分类查询账单") |
|
|
|
|
|
@GetMapping("listBill") |
|
|
|
|
|
public ResultData listBill(@ModelAttribute WxMerchant wxMerchant,Integer billTypeValue, Integer pageNum, Integer pageSize) { |
|
|
|
|
|
setQueryDataRule(wxMerchant); |
|
|
|
|
|
if (null == billTypeValue) { |
|
|
|
|
|
return new ResultData(Result.ERROR,"请选择分类"); |
|
|
} |
|
|
} |
|
|
MallUserInfo userInfo = getMallUserByPhone(wxMerchant.getPhone(),this.getTenantInfo()); |
|
|
|
|
|
if (null == userInfo) { |
|
|
|
|
|
return new ResultData(Result.ERROR,"手机号["+wxMerchant.getPhone()+"]非绑定后台管理员账号"); |
|
|
|
|
|
|
|
|
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,"分类非法"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
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())); |
|
|
|
|
|
|
|
|
return new ResultData(billAllHelper.getBillList(btype, wxMerchant,pageNum,pageSize)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//账单汇总 |
|
|
|
|
|
@GetMapping("billSum") |
|
|
|
|
|
public ResultData billSum(@ModelAttribute WxMerchant wxMerchant) { |
|
|
|
|
|
setQueryDataRule(wxMerchant); |
|
|
|
|
|
Date starttime = wxMerchant.getStarttime(); |
|
|
|
|
|
Date enttime = wxMerchant.getEndtime(); |
|
|
|
|
|
WxBillSum rentSum = billAllHelper.getBillRentSum(wxMerchant,starttime, enttime); |
|
|
|
|
|
WxBillSum rentManageSum = billAllHelper.getBillRentManageSum(wxMerchant, starttime, enttime,null); |
|
|
|
|
|
WxBillSum rentDepositSum = billAllHelper.getBillDepositSum(wxMerchant, starttime, enttime); |
|
|
|
|
|
WxBillSum propertySum = billAllHelper.getBillPropertySum(wxMerchant, starttime, enttime); |
|
|
|
|
|
WxBillSum propertyDepositSum = billAllHelper.getBillPropertyDepositSum(wxMerchant, starttime, enttime); |
|
|
|
|
|
WxBillSum dailySum = billAllHelper.getBillDailySum(wxMerchant, starttime, enttime,null); |
|
|
|
|
|
WxBillSum otherSum = billAllHelper.getBillOtherSum(wxMerchant, starttime, enttime); |
|
|
|
|
|
WxBillSum otherDepositSum = billAllHelper.getBillOtherDepositSum(wxMerchant, starttime, enttime); |
|
|
|
|
|
|
|
|
|
|
|
String needpay = billAllHelper.calcuteSum(rentSum.getNeedPay(),rentManageSum.getNeedPay(),rentDepositSum.getNeedPay(),propertySum.getNeedPay(), |
|
|
|
|
|
propertyDepositSum.getNeedPay(),dailySum.getNeedPay(),otherSum.getNeedPay(),otherDepositSum.getNeedPay()); |
|
|
|
|
|
String paid = billAllHelper.calcuteSum(rentSum.getPaid(),rentManageSum.getPaid(),rentDepositSum.getPaid(),propertySum.getPaid(), |
|
|
|
|
|
propertyDepositSum.getPaid(),dailySum.getPaid(),otherSum.getPaid(),otherDepositSum.getPaid()); |
|
|
|
|
|
String owe = billAllHelper.calcuteSum(rentSum.getOwe(),rentManageSum.getOwe(),rentDepositSum.getOwe(),propertySum.getOwe(), |
|
|
|
|
|
propertyDepositSum.getOwe(),dailySum.getOwe(),otherSum.getOwe(),otherDepositSum.getOwe()); |
|
|
|
|
|
Map retMap = new HashMap(); |
|
|
|
|
|
retMap.put("needPay", needpay); |
|
|
|
|
|
retMap.put("paid", paid); |
|
|
|
|
|
retMap.put("owe", owe); |
|
|
|
|
|
return new ResultData(retMap); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//租赁情况汇总 |
|
|
|
|
|
@GetMapping("rent") |
|
|
|
|
|
public ResultData rent(@ModelAttribute WxShop wxMerchant) { |
|
|
|
|
|
WxShop wxShop = new WxShop(); |
|
|
|
|
|
setQueryDataRule(wxShop); |
|
|
|
|
|
return wxChartDataService.getIndexShopRentData(wxShop); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |