昨日消耗账分

This commit is contained in:
Lenovo 2024-07-10 15:09:34 +08:00
parent 73bd8df9da
commit 51621e5705
6 changed files with 67 additions and 29 deletions

View File

@ -1,5 +1,8 @@
package com.ruoyi.business.controller; package com.ruoyi.business.controller;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -74,6 +77,17 @@ public class BusAgentInfoController extends BaseController
busStoreInfo.setBindUser(bean.getAgentAccount()); busStoreInfo.setBindUser(bean.getAgentAccount());
List<BusStoreInfo> ll = iBusStoreInfoService.selectBusStoreInfoList(busStoreInfo); List<BusStoreInfo> ll = iBusStoreInfoService.selectBusStoreInfoList(busStoreInfo);
bean.setGrantStoreNum(ll.size()); bean.setGrantStoreNum(ll.size());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
Date minusDay = calendar.getTime();
String date = sdf.format(minusDay);
String startTime = date+" 00:00:00";
String endTime = date+" 23:59:59";
int lastUserIntegralNum = iBusStoreInfoService.lastUserIntegralNum(busAgentInfo.getAgentAccount(),startTime,endTime);
bean.setLastUseIntegralNum(lastUserIntegralNum);
List<BusStoreInfo> lll = ll.stream().filter(f -> "1".equals(f.getReturnVisitStatus())).collect(Collectors.toList()); List<BusStoreInfo> lll = ll.stream().filter(f -> "1".equals(f.getReturnVisitStatus())).collect(Collectors.toList());
bean.setOperateStoreNum(lll.size()); bean.setOperateStoreNum(lll.size());
SysUser user1 = iSysUserService.selectUserById(bean.getId()); SysUser user1 = iSysUserService.selectUserById(bean.getId());

View File

@ -2,18 +2,19 @@ package com.ruoyi.business.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.business.domain.BusStoreInfo; import com.ruoyi.business.domain.BusStoreInfo;
import org.apache.ibatis.annotations.Param;
/** /**
* 店铺信息Mapper接口 * 店铺信息Mapper接口
* *
* @author ruoyi * @author ruoyi
* @date 2024-07-03 * @date 2024-07-03
*/ */
public interface BusStoreInfoMapper public interface BusStoreInfoMapper
{ {
/** /**
* 查询店铺信息 * 查询店铺信息
* *
* @param id 店铺信息主键 * @param id 店铺信息主键
* @return 店铺信息 * @return 店铺信息
*/ */
@ -21,15 +22,16 @@ public interface BusStoreInfoMapper
/** /**
* 查询店铺信息列表 * 查询店铺信息列表
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 店铺信息集合 * @return 店铺信息集合
*/ */
public List<BusStoreInfo> selectBusStoreInfoList(BusStoreInfo busStoreInfo); public List<BusStoreInfo> selectBusStoreInfoList(BusStoreInfo busStoreInfo);
int lastUserIntegralNum(@Param("agentAccount") String agentAccount,@Param("startTime") String startTime,@Param("endTime") String endTime);
/** /**
* 新增店铺信息 * 新增店铺信息
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 结果 * @return 结果
*/ */
@ -37,7 +39,7 @@ public interface BusStoreInfoMapper
/** /**
* 修改店铺信息 * 修改店铺信息
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 结果 * @return 结果
*/ */
@ -45,7 +47,7 @@ public interface BusStoreInfoMapper
/** /**
* 删除店铺信息 * 删除店铺信息
* *
* @param id 店铺信息主键 * @param id 店铺信息主键
* @return 结果 * @return 结果
*/ */
@ -53,7 +55,7 @@ public interface BusStoreInfoMapper
/** /**
* 批量删除店铺信息 * 批量删除店铺信息
* *
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */

View File

@ -7,15 +7,15 @@ import com.ruoyi.business.domain.BusStoreInfo;
/** /**
* 店铺信息Service接口 * 店铺信息Service接口
* *
* @author ruoyi * @author ruoyi
* @date 2024-07-03 * @date 2024-07-03
*/ */
public interface IBusStoreInfoService public interface IBusStoreInfoService
{ {
/** /**
* 查询店铺信息 * 查询店铺信息
* *
* @param id 店铺信息主键 * @param id 店铺信息主键
* @return 店铺信息 * @return 店铺信息
*/ */
@ -31,15 +31,16 @@ public interface IBusStoreInfoService
/** /**
* 查询店铺信息列表 * 查询店铺信息列表
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 店铺信息集合 * @return 店铺信息集合
*/ */
public List<BusStoreInfo> selectBusStoreInfoList(BusStoreInfo busStoreInfo); public List<BusStoreInfo> selectBusStoreInfoList(BusStoreInfo busStoreInfo);
int lastUserIntegralNum(String agentAccount,String startTime,String endTime);
/** /**
* 新增店铺信息 * 新增店铺信息
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 结果 * @return 结果
*/ */
@ -47,7 +48,7 @@ public interface IBusStoreInfoService
/** /**
* 修改店铺信息 * 修改店铺信息
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 结果 * @return 结果
*/ */
@ -55,7 +56,7 @@ public interface IBusStoreInfoService
/** /**
* 批量删除店铺信息 * 批量删除店铺信息
* *
* @param ids 需要删除的店铺信息主键集合 * @param ids 需要删除的店铺信息主键集合
* @return 结果 * @return 结果
*/ */
@ -63,7 +64,7 @@ public interface IBusStoreInfoService
/** /**
* 删除店铺信息信息 * 删除店铺信息信息
* *
* @param id 店铺信息主键 * @param id 店铺信息主键
* @return 结果 * @return 结果
*/ */

View File

@ -43,6 +43,8 @@ public class AiServiceImpl implements IAiService
@Autowired @Autowired
private IBusFifteenInfoService fifteenInfoService; private IBusFifteenInfoService fifteenInfoService;
@Autowired @Autowired
private IBusIntegralRecordService integralRecordService;
@Autowired
private StringRedisTemplate redisTemplate; private StringRedisTemplate redisTemplate;
private String userSn = "SYSUSER|8398f13f3feccef770ee4d465fe22fbf"; private String userSn = "SYSUSER|8398f13f3feccef770ee4d465fe22fbf";
@ -302,6 +304,14 @@ public class AiServiceImpl implements IAiService
int reduce = busAgentInfo.getIntegral() - a; int reduce = busAgentInfo.getIntegral() - a;
busAgentInfo.setIntegral(reduce); busAgentInfo.setIntegral(reduce);
agentInfoService.updateBusAgentInfo(busAgentInfo); agentInfoService.updateBusAgentInfo(busAgentInfo);
BusIntegralRecord record = new BusIntegralRecord();
record.setAccount(busAgentInfo.getAgentAccount());
record.setIntegralUpdateTime(new Date());
record.setUpdateType("消耗账分");
record.setIntegralUpdateNum(a);
record.setIntegralBalance(reduce);
integralRecordService.updateBusIntegralRecord(record);
} }
} }
} }

View File

@ -18,12 +18,12 @@ import org.springframework.transaction.annotation.Transactional;
/** /**
* 店铺信息Service业务层处理 * 店铺信息Service业务层处理
* *
* @author ruoyi * @author ruoyi
* @date 2024-07-03 * @date 2024-07-03
*/ */
@Service @Service
public class BusStoreInfoServiceImpl implements IBusStoreInfoService public class BusStoreInfoServiceImpl implements IBusStoreInfoService
{ {
@Autowired @Autowired
private BusStoreInfoMapper busStoreInfoMapper; private BusStoreInfoMapper busStoreInfoMapper;
@ -36,7 +36,7 @@ public class BusStoreInfoServiceImpl implements IBusStoreInfoService
/** /**
* 查询店铺信息 * 查询店铺信息
* *
* @param id 店铺信息主键 * @param id 店铺信息主键
* @return 店铺信息 * @return 店铺信息
*/ */
@ -53,7 +53,7 @@ public class BusStoreInfoServiceImpl implements IBusStoreInfoService
/** /**
* 查询店铺信息列表 * 查询店铺信息列表
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 店铺信息 * @return 店铺信息
*/ */
@ -63,9 +63,14 @@ public class BusStoreInfoServiceImpl implements IBusStoreInfoService
return busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo); return busStoreInfoMapper.selectBusStoreInfoList(busStoreInfo);
} }
@Override
public int lastUserIntegralNum(String agentAccount,String startTime,String endTime){
return busStoreInfoMapper.lastUserIntegralNum(agentAccount, startTime, endTime);
}
/** /**
* 新增店铺信息 * 新增店铺信息
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 结果 * @return 结果
*/ */
@ -77,7 +82,7 @@ public class BusStoreInfoServiceImpl implements IBusStoreInfoService
/** /**
* 修改店铺信息 * 修改店铺信息
* *
* @param busStoreInfo 店铺信息 * @param busStoreInfo 店铺信息
* @return 结果 * @return 结果
*/ */
@ -90,7 +95,7 @@ public class BusStoreInfoServiceImpl implements IBusStoreInfoService
/** /**
* 批量删除店铺信息 * 批量删除店铺信息
* *
* @param ids 需要删除的店铺信息主键 * @param ids 需要删除的店铺信息主键
* @return 结果 * @return 结果
*/ */
@ -102,7 +107,7 @@ public class BusStoreInfoServiceImpl implements IBusStoreInfoService
/** /**
* 删除店铺信息信息 * 删除店铺信息信息
* *
* @param id 店铺信息主键 * @param id 店铺信息主键
* @return 结果 * @return 结果
*/ */

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.BusStoreInfoMapper"> <mapper namespace="com.ruoyi.business.mapper.BusStoreInfoMapper">
<resultMap type="BusStoreInfo" id="BusStoreInfoResult"> <resultMap type="BusStoreInfo" id="BusStoreInfoResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="platformType" column="platform_type" /> <result property="platformType" column="platform_type" />
@ -32,9 +32,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, platform_type, store_code, store_name, store_account, store_password, store_cookie, store_belong, grant_status, return_visit_status, bind_id, bind_user, bind_time, update_id, update_user, update_time, self_delivery_status, return_visit_user_range, sale_bind_id, sale_bind_name, sale_bind_time from bus_store_info select id, platform_type, store_code, store_name, store_account, store_password, store_cookie, store_belong, grant_status, return_visit_status, bind_id, bind_user, bind_time, update_id, update_user, update_time, self_delivery_status, return_visit_user_range, sale_bind_id, sale_bind_name, sale_bind_time from bus_store_info
</sql> </sql>
<select id="lastUserIntegralNum" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(integral_update_num) from bus_integral_record
where account = #{agentAccount} and update_type = '消耗账分'
and internal_update_time between #{startTime} and #{endTime}
</select>
<select id="selectBusStoreInfoList" parameterType="BusStoreInfo" resultMap="BusStoreInfoResult"> <select id="selectBusStoreInfoList" parameterType="BusStoreInfo" resultMap="BusStoreInfoResult">
<include refid="selectBusStoreInfoVo"/> <include refid="selectBusStoreInfoVo"/>
<where> <where>
<if test="platformType != null and platformType != ''"> and platform_type = #{platformType}</if> <if test="platformType != null and platformType != ''"> and platform_type = #{platformType}</if>
<if test="storeCode != null and storeCode != ''"> and store_code = #{storeCode}</if> <if test="storeCode != null and storeCode != ''"> and store_code = #{storeCode}</if>
<if test="storeName != null and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if> <if test="storeName != null and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>
@ -56,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="saleBindTime != null "> and sale_bind_time = #{saleBindTime}</if> <if test="saleBindTime != null "> and sale_bind_time = #{saleBindTime}</if>
</where> </where>
</select> </select>
<select id="selectBusStoreInfoById" parameterType="Long" resultMap="BusStoreInfoResult"> <select id="selectBusStoreInfoById" parameterType="Long" resultMap="BusStoreInfoResult">
<include refid="selectBusStoreInfoVo"/> <include refid="selectBusStoreInfoVo"/>
where id = #{id} where id = #{id}
@ -153,9 +159,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteBusStoreInfoByIds" parameterType="String"> <delete id="deleteBusStoreInfoByIds" parameterType="String">
delete from bus_store_info where id in delete from bus_store_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>