| @@ -86,6 +86,9 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantMapper wxMerchantMapper; | private WxMerchantMapper wxMerchantMapper; | ||||
| @Autowired | |||||
| private WxCreditHistoryService wxCreditHistoryService; | |||||
| private void setUserInfoLevel(WxCUserBasicInfo info) { | private void setUserInfoLevel(WxCUserBasicInfo info) { | ||||
| if (info.getPoins() == null || info.getPoins() == 0) { | if (info.getPoins() == null || info.getPoins() == 0) { | ||||
| @@ -129,6 +132,16 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| info.setCarCount(wxCUserCarService.countUserCar(wxCUserCar)); | info.setCarCount(wxCUserCarService.countUserCar(wxCUserCar)); | ||||
| } | } | ||||
| private void setCreditSumDate(WxCUserBasicInfo info){ | |||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||||
| wxCreditHistory.setTenantId(info.getFinalTenantId()); | |||||
| wxCreditHistory.setCUserId(info.getId()); | |||||
| wxCreditHistory.setStartTime(info.getCreditStartTime()); | |||||
| wxCreditHistory.setEndTime(info.getCreditEndTime()); | |||||
| info.setAddCredit(wxCreditHistoryService.getAddCreditSummary(wxCreditHistory)); | |||||
| info.setLesCredit(wxCreditHistoryService.getLesCreditSummary(wxCreditHistory)); | |||||
| } | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -155,6 +168,9 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| for (WxCUserBasicInfo info : page.getList()) { | for (WxCUserBasicInfo info : page.getList()) { | ||||
| // setUserInfoLevel(info); | // setUserInfoLevel(info); | ||||
| setUserInfoCarCount(info); | setUserInfoCarCount(info); | ||||
| info.setCreditStartTime(wxCUserBasicInfo.getCreditStartTime()); | |||||
| info.setCreditEndTime(wxCUserBasicInfo.getCreditEndTime()); | |||||
| setCreditSumDate(info); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -106,6 +106,14 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | ||||
| private Integer credit; | private Integer credit; | ||||
| @io.swagger.annotations.ApiModelProperty(value="扣减积分",name="lesCredit") | |||||
| @TableField(exist = false) | |||||
| private Integer lesCredit; | |||||
| @io.swagger.annotations.ApiModelProperty(value="增加积分",name="addCredit") | |||||
| @TableField(exist = false) | |||||
| private Integer addCredit; | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动记录",name="actRecord") | @io.swagger.annotations.ApiModelProperty(value="活动记录",name="actRecord") | ||||
| private Integer actRecord; | private Integer actRecord; | ||||
| @@ -129,11 +137,20 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Integer carCount; | private Integer carCount; | ||||
| @TableField(exist = false) | |||||
| private String carNumber; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Date startTime; | private Date startTime; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Date endTime; | private Date endTime; | ||||
| @TableField(exist = false) | |||||
| private Date creditStartTime; | |||||
| @TableField(exist = false) | |||||
| private Date creditEndTime; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Integer begin; | private Integer begin; | ||||
| @@ -35,4 +35,7 @@ public interface WxCreditHistoryMapper extends CommonMapper<WxCreditHistory, Lon | |||||
| void userCreditClear(@Param("cutOffDate")String cutOffDate,@Param("finalTableIndex")String finalTableIndex); | void userCreditClear(@Param("cutOffDate")String cutOffDate,@Param("finalTableIndex")String finalTableIndex); | ||||
| Integer getAddCreditSummary(WxCreditHistory wxCreditHistory); | |||||
| Integer getLesCreditSummary(WxCreditHistory wxCreditHistory); | |||||
| } | } | ||||
| @@ -79,4 +79,7 @@ public interface WxCreditHistoryService { | |||||
| ResultData getCreditSummary(WxCreditHistory wxCreditHistory); | ResultData getCreditSummary(WxCreditHistory wxCreditHistory); | ||||
| Integer getAddCreditSummary(WxCreditHistory wxCreditHistory); | |||||
| Integer getLesCreditSummary(WxCreditHistory wxCreditHistory); | |||||
| } | } | ||||
| @@ -134,6 +134,16 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return new ResultData(result); | return new ResultData(result); | ||||
| } | } | ||||
| @Override | |||||
| public Integer getAddCreditSummary(WxCreditHistory wxCreditHistory) { | |||||
| return wxCreditHistoryMapper.getAddCreditSummary(wxCreditHistory); | |||||
| } | |||||
| @Override | |||||
| public Integer getLesCreditSummary(WxCreditHistory wxCreditHistory) { | |||||
| return wxCreditHistoryMapper.getLesCreditSummary(wxCreditHistory); | |||||
| } | |||||
| @Override | @Override | ||||
| public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record)); | ||||
| @@ -116,6 +116,12 @@ | |||||
| <if test=" null != status "> | <if test=" null != status "> | ||||
| and wcubi.`status` = #{status} | and wcubi.`status` = #{status} | ||||
| </if> | </if> | ||||
| <if test=" null != carNumber and '' != carNumber"> | |||||
| and wcubi.id in (select c_user_id from wx_c_user_car | |||||
| where (`tenant_id` = #{finalTenantId} or `parent_tenant_id` = #{finalTenantId}) | |||||
| and car_number like concat('%', #{carNumber},'%')) | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and wcubi.id in | and wcubi.id in | ||||
| @@ -220,6 +226,18 @@ | |||||
| and wcubi.`status` = #{basicInfo.status} | and wcubi.`status` = #{basicInfo.status} | ||||
| </if> | </if> | ||||
| <if test=" null != basicInfo.carNumber and '' != basicInfo.carNumber"> | |||||
| and wcubi.id in (select c_user_id from wx_c_user_car | |||||
| where 1=1 | |||||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||||
| and `tenant_id` = #{tenantInfo.tenantId} | |||||
| </if> | |||||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||||
| and `parent_tenant_id` = #{tenantInfo.parentTenantId} | |||||
| </if> | |||||
| and car_number like concat('%', #{basicInfo.carNumber},'%')) | |||||
| </if> | |||||
| <if test=" null != basicInfo.ids "> | <if test=" null != basicInfo.ids "> | ||||
| and wcubi.id in | and wcubi.id in | ||||
| <foreach collection="basicInfo.ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="basicInfo.ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -247,6 +247,33 @@ | |||||
| <include refid="customWhereConditions"/> | <include refid="customWhereConditions"/> | ||||
| and credit.credit_num < 0 | and credit.credit_num < 0 | ||||
| </select> | </select> | ||||
| <select id="getAddCreditSummary" parameterType="com.iformall.domain.po.WxCreditHistory" | |||||
| resultType="java.lang.Integer"> | |||||
| select ifnull(sum(credit.credit_num),0) amount from wx_credit_history credit | |||||
| where credit.`tenant_id` = #{tenantId} | |||||
| and credit.credit_num > 0 and credit.c_user_id = #{cUserId} | |||||
| <if test=" null != startTime "> | |||||
| and credit.create_date >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and credit.create_date < #{endTime} | |||||
| </if> | |||||
| </select> | |||||
| <select id="getLesCreditSummary" parameterType="com.iformall.domain.po.WxCreditHistory" | |||||
| resultType="java.lang.Integer"> | |||||
| select ifnull(sum(credit.credit_num),0) amount from wx_credit_history credit | |||||
| where credit.`tenant_id` = #{tenantId} | |||||
| and credit.credit_num < 0 and credit.c_user_id = #{cUserId} | |||||
| <if test=" null != startTime "> | |||||
| and credit.create_date >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and credit.create_date < #{endTime} | |||||
| </if> | |||||
| </select> | |||||
| <select id="getPeopleCount" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Long"> | <select id="getPeopleCount" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Long"> | ||||
| select count(1) people from ( | select count(1) people from ( | ||||