diff --git a/hiver-core/src/main/java/cc/hiver/core/entity/User.java b/hiver-core/src/main/java/cc/hiver/core/entity/User.java index 8c698a39..88a0a80f 100644 --- a/hiver-core/src/main/java/cc/hiver/core/entity/User.java +++ b/hiver-core/src/main/java/cc/hiver/core/entity/User.java @@ -79,7 +79,7 @@ public class User extends HiverBaseEntity { @ApiModelProperty(value = "用户头像") private String avatar = UserConstant.USER_DEFAULT_AVATAR; - @ApiModelProperty(value = "用户类型 0普通用户 1管理员") + @ApiModelProperty(value = "用户类型 0普通用户 1管理员 2客户") private Integer type = UserConstant.USER_TYPE_NORMAL; @ApiModelProperty(value = "状态 默认0正常 -1拉黑") diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java index c8ca9c7d..a1bbac4c 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomerController.java @@ -1,7 +1,10 @@ package cc.hiver.mall.controller; +import cc.hiver.core.common.annotation.SystemLog; +import cc.hiver.core.common.enums.LogType; import cc.hiver.core.common.utils.PageUtil; import cc.hiver.core.common.utils.ResultUtil; +import cc.hiver.core.common.utils.SecurityUtil; import cc.hiver.core.common.utils.StringUtils; import cc.hiver.core.common.vo.PageVo; import cc.hiver.core.common.vo.Result; @@ -14,6 +17,7 @@ import cc.hiver.core.service.UserService; import cc.hiver.mall.entity.Customer; import cc.hiver.mall.pojo.dto.DebtCustomer; import cc.hiver.mall.service.mybatis.CustomerService; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -27,9 +31,11 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; +import java.util.concurrent.TimeUnit; @Slf4j @RestController @@ -49,6 +55,9 @@ public class CustomerController { @Autowired private RoleService roleService; + @Autowired + private SecurityUtil securityUtil; + @RequestMapping(value = "/save", method = RequestMethod.POST) @ApiOperation(value = "新增客户") @Transactional @@ -151,4 +160,21 @@ public class CustomerController { return new ResultUtil>().setData(list); } + + @RequestMapping(value = "/userType", method = RequestMethod.POST) + @ApiOperation(value = "判断登录用户是否为客户,1-是,0-否") + public Result userType(@RequestParam String username, + @RequestParam String password) { + User user = securityUtil.checkUserPassword(username, password); + if(ObjectUtils.isEmpty(user)){ + return ResultUtil.error("账号或密码错误"); + } + if (user.getType() == 2){ + return ResultUtil.success("1"); + }else{ + return ResultUtil.success("0"); + } + } + + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java index 0e1ea0d5..89031749 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java @@ -23,6 +23,8 @@ import cc.hiver.core.common.vo.Result; import cc.hiver.mall.entity.Shop; import cc.hiver.mall.entity.ShopArea; import cc.hiver.mall.entity.ShopUser; +import cc.hiver.mall.pojo.dto.ShopRevenue; +import cc.hiver.mall.pojo.vo.QueryShopRevenueVO; import cc.hiver.mall.service.ShopAreaService; import cc.hiver.mall.service.ShopService; import cc.hiver.mall.service.ShopUserService; @@ -179,4 +181,12 @@ public class ShopController { List list = shopService.getShopInfoByUserid(userId); return new ResultUtil>().setData(list); } + + @RequestMapping(value = "/getShopRevenue", method = RequestMethod.GET) + @ApiOperation(value = "统计店铺营收") + public Result> getShopRevenue(QueryShopRevenueVO queryShopRevenueVO) { + List list = shopService.getShopRevenue(queryShopRevenueVO); + return new ResultUtil>().setData(list); + } + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopDao.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopDao.java index d8469bf3..fd67e81f 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopDao.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopDao.java @@ -17,6 +17,8 @@ package cc.hiver.mall.dao; import cc.hiver.mall.entity.Shop; import cc.hiver.core.base.HiverBaseDao; +import cc.hiver.mall.pojo.dto.ShopRevenue; +import cc.hiver.mall.pojo.vo.QueryShopRevenueVO; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; @@ -51,4 +53,5 @@ public interface ShopDao extends HiverBaseDao { */ @Query(value = "select * from t_shop where id in (select shop_id from t_shop_user where user_id = ?)",nativeQuery = true) List getShopInfoByUserid(String userId); + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java index a25459c7..3cd06fa2 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/SaleMapper.java @@ -2,6 +2,8 @@ package cc.hiver.mall.dao.mapper; import cc.hiver.mall.entity.Sale; import cc.hiver.mall.entity.SaleExample; +import cc.hiver.mall.pojo.dto.ShopRevenue; +import cc.hiver.mall.pojo.vo.QueryShopRevenueVO; import cc.hiver.mall.pojo.vo.SaleAllVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; @@ -36,4 +38,5 @@ public interface SaleMapper extends BaseMapper { SaleAllVO saleMaxAmount(SaleExample example); + List getShopRevenue(QueryShopRevenueVO queryShopRevenueVO); } \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ShopRevenue.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ShopRevenue.java new file mode 100644 index 00000000..c7001aa8 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/ShopRevenue.java @@ -0,0 +1,25 @@ +package cc.hiver.mall.pojo.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @类描述 + * @作者 冯彬 + * @时间 2023/9/25-下午10:41 + */ +@Data +@ApiModel(value = "商铺营收") +public class ShopRevenue { + + @ApiModelProperty(value = "营收") + private BigDecimal realAmount; + + @ApiModelProperty(value = "日期") + private Date dt; + +} diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/QueryShopRevenueVO.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/QueryShopRevenueVO.java new file mode 100644 index 00000000..90acae68 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/QueryShopRevenueVO.java @@ -0,0 +1,27 @@ +package cc.hiver.mall.pojo.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @类描述 + * @作者 冯彬 + * @时间 2023/9/25-下午10:39 + */ +@Data +@ApiModel(value = "商铺营收查询条件") +public class QueryShopRevenueVO { + + @ApiModelProperty(value = "商铺id") + private String shopId; + + @ApiModelProperty(value = "起始日期") + private Date startDate; + + @ApiModelProperty(value = "结束日期") + private Date endDate; + +} diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java index 4f1b15cf..841aa198 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java @@ -17,6 +17,8 @@ package cc.hiver.mall.service; import cc.hiver.mall.entity.Shop; import cc.hiver.core.base.HiverBaseService; +import cc.hiver.mall.pojo.dto.ShopRevenue; +import cc.hiver.mall.pojo.vo.QueryShopRevenueVO; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -57,4 +59,6 @@ public interface ShopService extends HiverBaseService { * @param userId */ List getShopInfoByUserid(String userId); + + List getShopRevenue(QueryShopRevenueVO queryShopRevenueVO); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java index 0f07bf4b..4b3e1776 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java @@ -16,7 +16,10 @@ limitations under the License. package cc.hiver.mall.serviceimpl; import cc.hiver.mall.dao.ShopDao; +import cc.hiver.mall.dao.mapper.SaleMapper; import cc.hiver.mall.entity.Shop; +import cc.hiver.mall.pojo.dto.ShopRevenue; +import cc.hiver.mall.pojo.vo.QueryShopRevenueVO; import cc.hiver.mall.service.ShopService; import cc.hiver.core.base.HiverBaseDao; import cn.hutool.core.util.StrUtil; @@ -43,6 +46,9 @@ public class ShopServiceImpl implements ShopService { @Autowired private ShopDao shopDao; + @Autowired + private SaleMapper saleMapper; + @Override public HiverBaseDao getRepository() { return shopDao; @@ -86,4 +92,9 @@ public class ShopServiceImpl implements ShopService { return shopDao.getShopInfoByUserid(userId); } + @Override + public List getShopRevenue(QueryShopRevenueVO queryShopRevenueVO) { + return saleMapper.getShopRevenue(queryShopRevenueVO); + } + } diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml index 3c33c5fa..994da5d3 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/SaleMapper.xml @@ -495,4 +495,16 @@ + + + + \ No newline at end of file