developrelease_toaliyun_real
| @@ -125,22 +125,22 @@ | |||||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | ||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | ||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 and status!=6 | |||||
| group by tenant_id | group by tenant_id | ||||
| </select> | </select> | ||||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | ||||
| select round(sum(receive_pay)/100,2) receivepay,round(sum(pay)/100,2) pay,tenant_id from wx_bill_property | |||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_property | |||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 and status!=6 | |||||
| </select> | </select> | ||||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | ||||
| select IFNULL(round(sum(owe)/100,2),0) owe,tenant_id from wx_bill_property | |||||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_property | |||||
| where status = 1 and tenant_id=#{tenantId} | where status = 1 and tenant_id=#{tenantId} | ||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 and status!=6 | |||||
| </select> | </select> | ||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| @@ -138,21 +138,21 @@ | |||||
| <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | <select id="queryPayInfo" resultType="hashmap" parameterType="hashmap"> | ||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | ||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 and status!=6 | |||||
| group by tenant_id | group by tenant_id | ||||
| </select> | </select> | ||||
| <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | <select id="queryPayInfoTotal" resultType="hashmap" parameterType="hashmap"> | ||||
| select round(sum(receive_pay)/100,2) receivepay,round(sum(pay)/100,2) pay,tenant_id from wx_bill_rent | |||||
| select IFNULL(sum(receive_pay),0) receivepay,IFNULL(sum(pay),0) pay,tenant_id from wx_bill_rent | |||||
| where tenant_id=#{tenantId} | where tenant_id=#{tenantId} | ||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 and status!=6 | |||||
| </select> | </select> | ||||
| <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | <select id="queryOweInfo" resultType="hashmap" parameterType="hashmap"> | ||||
| select IFNULL(round(sum(owe)/100,2),0) owe,tenant_id from wx_bill_rent | |||||
| select IFNULL(sum(owe),0) owe,tenant_id from wx_bill_rent | |||||
| where status = 1 and tenant_id=#{tenantId} | where status = 1 and tenant_id=#{tenantId} | ||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 | |||||
| and receive_date between #{startdate} and #{enddate} and is_preview = 0 and status!=6 | |||||
| </select> | </select> | ||||
| <update id="updateNotPaidStatus" parameterType="hashmap"> | <update id="updateNotPaidStatus" parameterType="hashmap"> | ||||
| @@ -426,60 +426,28 @@ | |||||
| <select id="userTradeList" parameterType="com.iformall.domain.po.WxMerchant" resultType="com.iformall.domain.vo.WxMerchantTradeVo"> | <select id="userTradeList" parameterType="com.iformall.domain.po.WxMerchant" resultType="com.iformall.domain.vo.WxMerchantTradeVo"> | ||||
| SELECT m.id, m.`img_url` cover, m.`name` merchantName, m.`link_person` linkName, | SELECT m.id, m.`img_url` cover, m.`name` merchantName, m.`link_person` linkName, | ||||
| ifnull(consume.consumeCount,0) consumeCount,ifnull(consumePeople.consumeCountP,0) as consumeCountP, | |||||
| ifnull(price.tradeAmt,0) tradeAmt | |||||
| ifnull(consume.consumeCount,0) consumeCount,ifnull(consume.consumeCountP,0) as consumeCountP, | |||||
| ifnull(consume.tradeAmt,0) tradeAmt | |||||
| FROM wx_merchant m | FROM wx_merchant m | ||||
| left join (SELECT count(*) as consumeCount,cm.merchant_id FROM wx_coupon_order o | |||||
| LEFT JOIN wx_coupon co ON (o.`coupon_id` = co.id) | |||||
| LEFT JOIN wx_coupon_merchant cm ON (cm.product_id = co.id) | |||||
| WHERE o.coupon_order_status = 1 | |||||
| left join (select count(co.c_user_id) AS consumeCountP, | |||||
| count(DISTINCT co.c_user_id) AS consumeCount,sum(co.coupon_price) AS tradeAmt, m.id as merchant_id from | |||||
| wx_coupon_order co | |||||
| left join (select m.id,mbu.id as b_user_id from wx_merchant m | |||||
| left join wx_merchant_b_user mbu on m.id=mbu.merchant_id where mbu.status=0) m | |||||
| on co.b_user_id=m.b_user_id | |||||
| WHERE co.coupon_order_status = 1 | |||||
| <if test="tenantId != null"> | <if test="tenantId != null"> | ||||
| and o.tenant_id = #{tenantId} | |||||
| and co.tenant_id = #{tenantId} | |||||
| </if> | </if> | ||||
| <if test="starttime != null"> | <if test="starttime != null"> | ||||
| and o.create_date >= #{starttime} | |||||
| and co.create_date >= #{starttime} | |||||
| </if> | </if> | ||||
| <if test="endtime != null"> | <if test="endtime != null"> | ||||
| and o.create_date <= #{endtime} | |||||
| and co.create_date <= #{endtime} | |||||
| </if> | </if> | ||||
| group by cm.merchant_id | |||||
| group by m.id | |||||
| ) consume on consume.merchant_id=m.id | ) consume on consume.merchant_id=m.id | ||||
| left join (SELECT count(DISTINCT o.c_user_id) as consumeCountP,cm.merchant_id FROM wx_coupon_order o | |||||
| LEFT JOIN wx_coupon co ON (o.`coupon_id` = co.id) | |||||
| LEFT JOIN wx_coupon_merchant cm ON (cm.product_id = co.id) | |||||
| WHERE o.coupon_order_status = 1 | |||||
| <if test="tenantId != null"> | |||||
| and o.tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test="starttime != null"> | |||||
| and o.create_date >= #{starttime} | |||||
| </if> | |||||
| <if test="endtime != null"> | |||||
| and o.create_date <= #{endtime} | |||||
| </if> | |||||
| group by cm.merchant_id | |||||
| ) consumePeople on consumePeople.merchant_id=m.id | |||||
| left join (SELECT sum(o.coupon_price) as tradeAmt,cm.merchant_id FROM wx_coupon_order o | |||||
| LEFT JOIN wx_coupon co ON (o.`coupon_id` = co.id) | |||||
| LEFT JOIN wx_coupon_merchant cm ON (cm.product_id = co.id) | |||||
| INNER JOIN wx_merchant_b_user mb ON (mb.id = o.b_user_id) | |||||
| WHERE o.coupon_order_status = 1 | |||||
| <if test="tenantId != null"> | |||||
| and o.tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test="starttime != null"> | |||||
| and o.create_date >= #{starttime} | |||||
| </if> | |||||
| <if test="endtime != null"> | |||||
| and o.create_date <= #{endtime} | |||||
| </if> | |||||
| group by cm.merchant_id | |||||
| ) price on price.merchant_id=m.id | |||||
| where m.status=1 | where m.status=1 | ||||
| <if test=" null != name and ''!=name "> | <if test=" null != name and ''!=name "> | ||||
| and `name` like concat('%', #{name},'%') | and `name` like concat('%', #{name},'%') | ||||
| </if> | </if> | ||||
| @@ -498,21 +466,22 @@ | |||||
| co.price tradeAmt,o.create_date tradeDate | co.price tradeAmt,o.create_date tradeDate | ||||
| from wx_coupon_order o | from wx_coupon_order o | ||||
| left join wx_coupon co on(o.`coupon_id`=co.id) | left join wx_coupon co on(o.`coupon_id`=co.id) | ||||
| left join wx_coupon_merchant cm on(cm.product_id=co.id) | |||||
| left join wx_c_user_basic_info cb on o.c_user_id=cb.id | left join wx_c_user_basic_info cb on o.c_user_id=cb.id | ||||
| where o.coupon_order_status=1 | where o.coupon_order_status=1 | ||||
| and o.tenant_id=#{tenantId} | and o.tenant_id=#{tenantId} | ||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and cm.`merchant_id` = #{id} | |||||
| and o.b_user_id in( | |||||
| select id from wx_merchant_b_user where status=0 and merchant_id=#{id} | |||||
| ) | |||||
| </if> | </if> | ||||
| <if test=" null != userName "> | |||||
| <if test=" null != userName and '' != userName "> | |||||
| and cb.`name` like concat('%', #{userName},'%') | and cb.`name` like concat('%', #{userName},'%') | ||||
| </if> | </if> | ||||
| <if test=" null != phone "> | |||||
| <if test=" null != phone and '' != phone"> | |||||
| and cb.`phone` like concat('%', #{phone},'%') | and cb.`phone` like concat('%', #{phone},'%') | ||||
| </if> | </if> | ||||
| <if test=" null != couponName "> | |||||
| <if test=" null != couponName and '' != couponName"> | |||||
| and co.`title` like concat('%', #{couponName},'%') | and co.`title` like concat('%', #{couponName},'%') | ||||
| </if> | </if> | ||||
| <if test="starttime != null"> | <if test="starttime != null"> | ||||
| @@ -114,8 +114,8 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumnsVo"> | <sql id="allColumnsVo"> | ||||
| mtd.id as id, mtd.b_user_id as b_user_id, mtd.trade_amt, mtd.report_date, mtd.trade_count, mtd.proof, | |||||
| mtd.create_date as create_date, mtd.update_date as update_date, | |||||
| mtd.id as id, mtd.b_user_id as b_user_id, ifnull(mtd.trade_amt,0) as trade_amt, mtd.report_date, | |||||
| ifnull(mtd.trade_count,0) as trade_count, mtd.proof,mtd.create_date as create_date, mtd.update_date as update_date, | |||||
| m.tenant_id as tenant_id, m.id as merchant_id, m.name as merchant_name, m.business_id, m.sub_business_id, | m.tenant_id as tenant_id, m.id as merchant_id, m.name as merchant_name, m.business_id, m.sub_business_id, | ||||
| mbu.name as b_user_name, mbu.phone as b_user_phone | mbu.name as b_user_name, mbu.phone as b_user_phone | ||||
| </sql> | </sql> | ||||
| @@ -10,7 +10,7 @@ import com.iformall.enums.EnumMsgModel; | |||||
| import com.iformall.enums.EnumScoreType; | import com.iformall.enums.EnumScoreType; | ||||
| import com.iformall.enums.EnumUserType; | import com.iformall.enums.EnumUserType; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxCreditHistoryService; | |||||
| import com.iformall.service.*; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| @@ -53,9 +53,6 @@ public class DataInitController extends BaseController { | |||||
| @Resource | @Resource | ||||
| private WxMerchantBUserMapper merchantBUserMapper; | private WxMerchantBUserMapper merchantBUserMapper; | ||||
| @Resource | |||||
| private WxMerchantMapper wxMerchantMapper; | |||||
| @PostMapping("/createMsgModel") | @PostMapping("/createMsgModel") | ||||
| public ResultData createMsgModel(@RequestParam String content, @RequestParam Integer code) { | public ResultData createMsgModel(@RequestParam String content, @RequestParam Integer code) { | ||||
| @@ -1,18 +1,17 @@ | |||||
| package com.iformall.controller.sys; | package com.iformall.controller.sys; | ||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.MallPermission; | |||||
| import com.iformall.domain.po.MallRole; | |||||
| import com.iformall.domain.po.MallRolePermission; | |||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.EnumPermissionType; | import com.iformall.enums.EnumPermissionType; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.MallMenuMapper; | import com.iformall.mapper.MallMenuMapper; | ||||
| import com.iformall.mapper.MallPermissionMapper; | import com.iformall.mapper.MallPermissionMapper; | ||||
| import com.iformall.mapper.WxLogicPermissionMapper; | |||||
| import com.iformall.service.MallPermissionService; | import com.iformall.service.MallPermissionService; | ||||
| import com.iformall.service.MallRolePermissionService; | import com.iformall.service.MallRolePermissionService; | ||||
| import com.iformall.service.MallRoleService; | import com.iformall.service.MallRoleService; | ||||
| @@ -63,6 +62,9 @@ public class SysMenuController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private MallPermissionMapper mallPermissionMapper; | private MallPermissionMapper mallPermissionMapper; | ||||
| @Autowired | |||||
| private WxLogicPermissionMapper permissionMapper; | |||||
| @ApiOperation("导航菜单") | @ApiOperation("导航菜单") | ||||
| @GetMapping("/nav") | @GetMapping("/nav") | ||||
| public ResultData nav(){ | public ResultData nav(){ | ||||
| @@ -180,6 +182,9 @@ public class SysMenuController extends BaseController { | |||||
| for(MallPermission mp: mpList) { | for(MallPermission mp: mpList) { | ||||
| if (mallRolePermissionList.stream().anyMatch(mallRolePermission -> mp.getId().equals(mallRolePermission.getPermissionId()))) | if (mallRolePermissionList.stream().anyMatch(mallRolePermission -> mp.getId().equals(mallRolePermission.getPermissionId()))) | ||||
| continue; | continue; | ||||
| // TODO 过滤招商权限 | |||||
| if(Objects.equals(mp.getParentId(),11L)) | |||||
| continue; | |||||
| // 3.1 添加到mall_role_permission | // 3.1 添加到mall_role_permission | ||||
| try { | try { | ||||
| mallRolePermissionService.saveOrUpdate(new MallRolePermission(){{ | mallRolePermissionService.saveOrUpdate(new MallRolePermission(){{ | ||||
| @@ -592,5 +597,68 @@ public class SysMenuController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * 初始化超过招商权限 | |||||
| * | |||||
| * @return | |||||
| */ | |||||
| @GetMapping("/addInvestPerm") | |||||
| public ResultData addInvestPerm() { | |||||
| try { | |||||
| MallUserInfo userInfo = getUser(); | |||||
| if (userInfo.isFmSuperAdmin()) { | |||||
| doAddInvestPerm(); | |||||
| return new ResultData(); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error("SysMenuController::addInvestPerm error ", e); | |||||
| return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR, e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| private void doAddInvestPerm() { | |||||
| WxLogicPermission logicPermissions = permissionMapper.selectById(1L); | |||||
| List<Long> investAdminList = JSON.parseArray(logicPermissions.getPermission(), Long.class); | |||||
| // 1. 获取已有管理员 | |||||
| MallRole mrQ = new MallRole(); | |||||
| mrQ.setName("系统管理员"); | |||||
| mrQ.setAvailable("0"); | |||||
| List<MallRole> mallRoleList = mallRoleService.getList(mrQ); | |||||
| // 2. 获取全部permission | |||||
| MallPermission mpQ = new MallPermission(); | |||||
| mpQ.setAvailable("Y"); | |||||
| List<MallPermission> mpList = mallPermissionService.getList(mpQ); | |||||
| for (MallRole mallRole : mallRoleList) { | |||||
| MallRolePermission qRP = new MallRolePermission(); | |||||
| qRP.setRoleId(mallRole.getId()); | |||||
| List<MallRolePermission> mallRolePermissionList = mallRolePermissionService.getList(qRP); | |||||
| //if (mpList.size() != mallRolePermissionList.size()) { | |||||
| // 3. permission不一致, 添加到mall_role_permission | |||||
| for (MallPermission mp : mpList) { | |||||
| if (mallRolePermissionList.stream().anyMatch(mallRolePermission -> mp.getId().equals(mallRolePermission.getPermissionId()))) | |||||
| continue; | |||||
| //过滤非招商权限 | |||||
| if (!investAdminList.contains(mp.getId())) { | |||||
| continue; | |||||
| } | |||||
| // 3.1 添加到mall_role_permission | |||||
| try { | |||||
| MallRolePermission perm = new MallRolePermission() {{ | |||||
| updateTenantInfo(mallRole); | |||||
| setPermissionId(mp.getId()); | |||||
| setRoleId(mallRole.getId()); | |||||
| }}; | |||||
| mallRolePermissionService.saveOrUpdate(perm); | |||||
| logger.info("add perm {}", JSON.toJSONString(perm)); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| } | |||||
| //} | |||||
| } | |||||
| } | |||||
| } | } | ||||