| @@ -0,0 +1,2 @@ | |||||
| ALTER TABLE wx_raffle_activity_record_item ADD COLUMN item_size INT(3) NOT NULL DEFAULT 1 COMMENT '数量' AFTER `item_id`; | |||||
| ALTER TABLE wx_raffle_activity_record ADD COLUMN cus_card VARCHAR(100) COMMENT '身份证号' AFTER `cus_name`; | |||||
| @@ -49,7 +49,10 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| private BigDecimal orderMoney; | private BigDecimal orderMoney; | ||||
| @Excel(name="客户姓名",width = 20,orderNum = "6") | @Excel(name="客户姓名",width = 20,orderNum = "6") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "客户姓名", name = "cusName") | @io.swagger.annotations.ApiModelProperty(value = "客户姓名", name = "cusName") | ||||
| private String cusName; | |||||
| private String cusName; | |||||
| @Excel(name="身份证号",width = 20,orderNum = "6") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "身份证号", name = "cusCard") | |||||
| private String cusCard; | |||||
| @Excel(name="客户电话",width = 20,orderNum = "7") | @Excel(name="客户电话",width = 20,orderNum = "7") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "客户电话", name = "phone") | @io.swagger.annotations.ApiModelProperty(value = "客户电话", name = "phone") | ||||
| private String phone; | private String phone; | ||||
| @@ -67,6 +70,10 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| @Excel(name="审核时间",width = 20,format="yyyy-MM-dd HH:mm:ss",orderNum = "12") | @Excel(name="审核时间",width = 20,format="yyyy-MM-dd HH:mm:ss",orderNum = "12") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "审核时间", name = "auditTime") | @io.swagger.annotations.ApiModelProperty(value = "审核时间", name = "auditTime") | ||||
| private Date auditTime; | private Date auditTime; | ||||
| @TableField(exist = false) | |||||
| private Date auditTimeBegin; | |||||
| @TableField(exist = false) | |||||
| private Date auditTimeEnd; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "审核人", name = "auditBy") | @io.swagger.annotations.ApiModelProperty(value = "审核人", name = "auditBy") | ||||
| private Long auditBy; | private Long auditBy; | ||||
| @Excel(name="审核人",width = 20,orderNum = "13") | @Excel(name="审核人",width = 20,orderNum = "13") | ||||
| @@ -84,8 +91,14 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| @Excel(name="提交时间",width = 20,format="yyyy-MM-dd HH:mm:ss", orderNum = "14") | @Excel(name="提交时间",width = 20,format="yyyy-MM-dd HH:mm:ss", orderNum = "14") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "发奖时间", name = "sendTime") | @io.swagger.annotations.ApiModelProperty(value = "发奖时间", name = "sendTime") | ||||
| private Date sendTime; | private Date sendTime; | ||||
| @TableField(exist = false) | |||||
| private Date sendTimeBegin; | |||||
| @TableField(exist = false) | |||||
| private Date sendTimeEnd; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "发奖人", name = "sendBy") | @io.swagger.annotations.ApiModelProperty(value = "发奖人", name = "sendBy") | ||||
| private Long sendBy; | private Long sendBy; | ||||
| @TableField(exist = false) | |||||
| private List<Long> sendByList; | |||||
| @Excel(name="发奖人",width = 20,orderNum = "15") | @Excel(name="发奖人",width = 20,orderNum = "15") | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String sendByName; | private String sendByName; | ||||
| @@ -108,6 +121,8 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| private Map<String,Integer> recordItemIdCountMap; | private Map<String,Integer> recordItemIdCountMap; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Map<String,String> recordItemJiangQuanCountMap; | private Map<String,String> recordItemJiangQuanCountMap; | ||||
| @TableField(exist = false) | |||||
| private Map<String,Integer> recordItemSizeMap; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private List<WxRaffleActivityRecordExtends> recordExtends; | private List<WxRaffleActivityRecordExtends> recordExtends; | ||||
| @@ -142,6 +157,7 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| if (null != recordItemList && recordItemList.size() > 0 ) { | if (null != recordItemList && recordItemList.size() > 0 ) { | ||||
| recordItemIdCountMap = new HashMap<String,Integer>(); | recordItemIdCountMap = new HashMap<String,Integer>(); | ||||
| recordItemJiangQuanCountMap = new HashMap<String,String>(); | recordItemJiangQuanCountMap = new HashMap<String,String>(); | ||||
| recordItemSizeMap = new HashMap<String,Integer>(); | |||||
| for (int i = 0 ; i < recordItemList.size() ; i++) { | for (int i = 0 ; i < recordItemList.size() ; i++) { | ||||
| WxRaffleActivityRecordItem ri = recordItemList.get(i); | WxRaffleActivityRecordItem ri = recordItemList.get(i); | ||||
| String key = this.id+"&"+ri.getItemId(); | String key = this.id+"&"+ri.getItemId(); | ||||
| @@ -160,6 +176,14 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| }else { | }else { | ||||
| recordItemJiangQuanCountMap.put(key, ri.getCode()); | recordItemJiangQuanCountMap.put(key, ri.getCode()); | ||||
| } | } | ||||
| if (recordItemSizeMap.containsKey(key)) { | |||||
| Integer is = recordItemSizeMap.get(key); | |||||
| is = is + ri.getItemSize(); | |||||
| recordItemSizeMap.put(key, is); | |||||
| }else { | |||||
| recordItemSizeMap.put(key, ri.getItemSize()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -173,6 +197,7 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| excelTitle.put("orderNo", "订单号"); | excelTitle.put("orderNo", "订单号"); | ||||
| excelTitle.put("orderMoney", "订单金额"); | excelTitle.put("orderMoney", "订单金额"); | ||||
| excelTitle.put("cusName", "客户姓名"); | excelTitle.put("cusName", "客户姓名"); | ||||
| excelTitle.put("cusCard", "身份证号"); | |||||
| excelTitle.put("phone", "客户电话"); | excelTitle.put("phone", "客户电话"); | ||||
| excelTitle.put("address", "客户地址"); | excelTitle.put("address", "客户地址"); | ||||
| excelTitle.put("createDate", "提交时间"); | excelTitle.put("createDate", "提交时间"); | ||||
| @@ -186,7 +211,9 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| Long itemId = it.next(); | Long itemId = it.next(); | ||||
| WxRaffleActivityItem item = itemMap.get(itemId); | WxRaffleActivityItem item = itemMap.get(itemId); | ||||
| excelTitle.put(String.valueOf(item.getId()),item.getName()); | excelTitle.put(String.valueOf(item.getId()),item.getName()); | ||||
| excelTitle.put(String.valueOf(item.getId())+"_size",item.getName()+"_个数"); | |||||
| excelTitle.put(String.valueOf(item.getId())+"_jiangquan",item.getName()+"_奖券编码"); | excelTitle.put(String.valueOf(item.getId())+"_jiangquan",item.getName()+"_奖券编码"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -210,6 +237,7 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| excelObject.put("orderNo", orderNo); | excelObject.put("orderNo", orderNo); | ||||
| excelObject.put("orderMoney", orderMoney); | excelObject.put("orderMoney", orderMoney); | ||||
| excelObject.put("cusName", cusName); | excelObject.put("cusName", cusName); | ||||
| excelObject.put("cusCard", cusCard); | |||||
| excelObject.put("phone", phone); | excelObject.put("phone", phone); | ||||
| excelObject.put("address", address); | excelObject.put("address", address); | ||||
| excelObject.put("createDate", DateUtils.date2String(createDate)); | excelObject.put("createDate", DateUtils.date2String(createDate)); | ||||
| @@ -236,9 +264,11 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||||
| String key = this.id+"&"+item.getId(); | String key = this.id+"&"+item.getId(); | ||||
| if (null != recordItemIdCountMap && recordItemIdCountMap.containsKey(key)) { | if (null != recordItemIdCountMap && recordItemIdCountMap.containsKey(key)) { | ||||
| excelObject.put(String.valueOf(item.getId()), recordItemIdCountMap.get(key)); | excelObject.put(String.valueOf(item.getId()), recordItemIdCountMap.get(key)); | ||||
| excelObject.put(String.valueOf(item.getId())+"_size", recordItemJiangQuanCountMap.get(key)); | |||||
| excelObject.put(String.valueOf(item.getId())+"_jiangquan", recordItemJiangQuanCountMap.get(key)); | excelObject.put(String.valueOf(item.getId())+"_jiangquan", recordItemJiangQuanCountMap.get(key)); | ||||
| }else { | }else { | ||||
| excelObject.put(String.valueOf(item.getId()), 0); | excelObject.put(String.valueOf(item.getId()), 0); | ||||
| excelObject.put(String.valueOf(item.getId())+"_size", null); | |||||
| excelObject.put(String.valueOf(item.getId())+"_jiangquan", null); | excelObject.put(String.valueOf(item.getId())+"_jiangquan", null); | ||||
| } | } | ||||
| } | } | ||||
| @@ -31,6 +31,8 @@ public class WxRaffleActivityRecordItem extends TenantEntity { | |||||
| private Long itemId; | private Long itemId; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String itemName; | private String itemName; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "数量", name = "itemSize") | |||||
| private Integer itemSize; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "奖券编码", name = "code") | @io.swagger.annotations.ApiModelProperty(value = "奖券编码", name = "code") | ||||
| private String code; | private String code; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "返现金额", name = "cashMoney") | @io.swagger.annotations.ApiModelProperty(value = "返现金额", name = "cashMoney") | ||||
| @@ -54,5 +54,7 @@ public interface MallUserInfoMapper extends CommonMapper<MallUserInfo, String> { | |||||
| * 查询用户的所有菜单ID | * 查询用户的所有菜单ID | ||||
| */ | */ | ||||
| List<Long> queryAllMenuId(Long userId); | List<Long> queryAllMenuId(Long userId); | ||||
| List<Long> findIdList(MallUserInfo mallUserInfo); | |||||
| } | } | ||||
| @@ -206,4 +206,6 @@ public interface MallUserInfoService { | |||||
| Set<String> getUserPermissions(MallUserInfo record, boolean boolNav); | Set<String> getUserPermissions(MallUserInfo record, boolean boolNav); | ||||
| Map<Long,MallUserInfo> getUserMap(MallUserInfo record); | Map<Long,MallUserInfo> getUserMap(MallUserInfo record); | ||||
| List<Long> getUserIdList(MallUserInfo record); | |||||
| } | } | ||||
| @@ -348,4 +348,9 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public List<Long> getUserIdList(MallUserInfo record) { | |||||
| return mallUserInfoMapper.findIdList(record); | |||||
| } | |||||
| } | } | ||||
| @@ -132,7 +132,18 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||||
| }else { | }else { | ||||
| record.setMerchantIdList(mids); | record.setMerchantIdList(mids); | ||||
| } | } | ||||
| } | |||||
| if (StringUtils.isNotBlank(record.getSendByName())) { | |||||
| MallUserInfo userInfo = new MallUserInfo(); | |||||
| userInfo.updateTenantInfo(record); | |||||
| userInfo.setUsername(record.getSendByName()); | |||||
| List<Long> mids = mallUserInfoService.getUserIdList(userInfo); | |||||
| if (null == mids || mids.size() <= 0 ) { | |||||
| record.setId(-1L); | |||||
| }else { | |||||
| record.setSendByList(mids); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -481,14 +492,16 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||||
| record.setMallRate(item.getMallBackRate()); | record.setMallRate(item.getMallBackRate()); | ||||
| record.setMerchantRate(item.getMerchantBackRate()); | record.setMerchantRate(item.getMerchantBackRate()); | ||||
| if (moneyRule == EnumCashBackActivityItemRule.MALL_ONLY) { | if (moneyRule == EnumCashBackActivityItemRule.MALL_ONLY) { | ||||
| record.setMallCashMoney(record.getCashMoney()); | |||||
| record.setMallCashMoney(record.getCashMoney().multiply(new BigDecimal(record.getItemSize()))); | |||||
| record.setMerchantCashMoney(new BigDecimal(0)); | record.setMerchantCashMoney(new BigDecimal(0)); | ||||
| }else if(moneyRule == EnumCashBackActivityItemRule.MERCHANT_ONLY) { | }else if(moneyRule == EnumCashBackActivityItemRule.MERCHANT_ONLY) { | ||||
| record.setMallCashMoney(new BigDecimal(0)); | record.setMallCashMoney(new BigDecimal(0)); | ||||
| record.setMerchantCashMoney(record.getCashMoney()); | |||||
| record.setMerchantCashMoney(record.getCashMoney().multiply(new BigDecimal(record.getItemSize()))); | |||||
| }else if (moneyRule == EnumCashBackActivityItemRule.SHARE) { | }else if (moneyRule == EnumCashBackActivityItemRule.SHARE) { | ||||
| record.setMallCashMoney(record.getCashMoney().multiply(item.getMallBackRate()).divide(new BigDecimal(100)).setScale(3,BigDecimal.ROUND_HALF_UP)); | |||||
| record.setMerchantCashMoney(record.getCashMoney().multiply(item.getMerchantBackRate()).divide(new BigDecimal(100)).setScale(3,BigDecimal.ROUND_HALF_UP)); | |||||
| record.setMallCashMoney(record.getCashMoney().multiply(item.getMallBackRate()).multiply(new BigDecimal(record.getItemSize())) | |||||
| .divide(new BigDecimal(100)).setScale(3,BigDecimal.ROUND_HALF_UP)); | |||||
| record.setMerchantCashMoney(record.getCashMoney().multiply(item.getMerchantBackRate()).multiply(new BigDecimal(record.getItemSize())) | |||||
| .divide(new BigDecimal(100)).setScale(3,BigDecimal.ROUND_HALF_UP)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -113,6 +113,12 @@ | |||||
| from mall_user_info | from mall_user_info | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findIdList" parameterType="com.iformall.domain.po.MallUserInfo" resultType="Long"> | |||||
| select id | |||||
| from mall_user_info | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="selectByUserName" resultMap="BaseResultMap"> | <select id="selectByUserName" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| @@ -9,6 +9,7 @@ | |||||
| <result column="activity_id" jdbcType="BIGINT" property="activityId" /> | <result column="activity_id" jdbcType="BIGINT" property="activityId" /> | ||||
| <result column="record_id" jdbcType="BIGINT" property="recordId" /> | <result column="record_id" jdbcType="BIGINT" property="recordId" /> | ||||
| <result column="item_id" jdbcType="BIGINT" property="itemId" /> | <result column="item_id" jdbcType="BIGINT" property="itemId" /> | ||||
| <result column="item_size" jdbcType="INTEGER" property="itemSize" /> | |||||
| <result column="code" jdbcType="VARCHAR" property="code" /> | <result column="code" jdbcType="VARCHAR" property="code" /> | ||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | ||||
| @@ -22,8 +23,8 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`activity_id`,`record_id`,`item_id`,`code`,`create_date`,`update_date`, | |||||
| `cash_money`,`mall_rate`,`mall_cash_money`,`merchant_rate`,`merchant_cash_money` | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`activity_id`,`record_id`,`item_id`,`item_size`,`code`, | |||||
| `create_date`,`update_date`,`cash_money`,`mall_rate`,`mall_cash_money`,`merchant_rate`,`merchant_cash_money` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -9,6 +9,7 @@ | |||||
| <result column="order_no" jdbcType="VARCHAR" property="orderNo" /> | <result column="order_no" jdbcType="VARCHAR" property="orderNo" /> | ||||
| <result column="order_money" jdbcType="DECIMAL" property="orderMoney" /> | <result column="order_money" jdbcType="DECIMAL" property="orderMoney" /> | ||||
| <result column="cus_name" jdbcType="VARCHAR" property="cusName" /> | <result column="cus_name" jdbcType="VARCHAR" property="cusName" /> | ||||
| <result column="cus_card" jdbcType="VARCHAR" property="cusCard" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | ||||
| <result column="phone" jdbcType="VARCHAR" property="phone" /> | <result column="phone" jdbcType="VARCHAR" property="phone" /> | ||||
| @@ -24,8 +25,8 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`activity_id`,`order_no`,`order_money`,`cus_name`,`create_date`,`update_date`,`phone`, | |||||
| `address`,`audit_remark`,`audit_status`,`audit_by`,`audit_time`,`merchant_id`,`sign_img`,`send_by`,`send_time` | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`activity_id`,`order_no`,`order_money`,`cus_name`,`cus_card`,`create_date`,`update_date`, | |||||
| `phone`,`address`,`audit_remark`,`audit_status`,`audit_by`,`audit_time`,`merchant_id`,`sign_img`,`send_by`,`send_time` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -54,6 +55,22 @@ | |||||
| <if test=" null != createDateEnd"> | <if test=" null != createDateEnd"> | ||||
| and `create_date` <= #{createDateEnd} | and `create_date` <= #{createDateEnd} | ||||
| </if> | </if> | ||||
| <if test=" null != auditTimeBegin"> | |||||
| and `audit_time` >= #{auditTimeBegin} | |||||
| </if> | |||||
| <if test=" null != auditTimeEnd"> | |||||
| and `audit_time` <= #{auditTimeEnd} | |||||
| </if> | |||||
| <if test=" null != sendTimeBegin"> | |||||
| and `send_time` >= #{sendTimeBegin} | |||||
| </if> | |||||
| <if test=" null != sendTimeEnd"> | |||||
| and `send_time` <= #{sendTimeEnd} | |||||
| </if> | |||||
| <if test=" null != cusName and cusName != '' "> | <if test=" null != cusName and cusName != '' "> | ||||
| and `cus_name` like concat('%', #{cusName},'%') | and `cus_name` like concat('%', #{cusName},'%') | ||||
| @@ -91,6 +108,13 @@ | |||||
| #{statusItem} | #{statusItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != sendByList "> | |||||
| and send_by in | |||||
| <foreach collection="sendByList" index="index" item="sendItem" open="(" separator="," close=")"> | |||||
| #{sendItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||