32 files modified
3 files added
| | |
| | | * 集物员ID |
| | | */ |
| | | private String jhyId; |
| | | private String unitName; |
| | | private String houseNumber; |
| | | |
| | | } |
| | |
| | | private Date qgEndTime; |
| | | |
| | | private Integer isSale; |
| | | private Integer quotaTime; |
| | | public static final Integer ISSALE_YES = 1; |
| | | public static final Integer ISSALE_NO = 2; |
| | | |
| | |
| | | package com.xzx.gc.entity; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xzx.gc.common.entity.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import javax.persistence.Table; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | public static final Integer ISFINISH_YES = 1; |
| | | public static final Integer ISFINISH_NO = 2; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date isFinishTime; |
| | | |
| | | private String remark; |
| | | } |
| | |
| | | public class OrderInfoVo{ |
| | | @ApiModelProperty(value = "订单地址") |
| | | private String address; |
| | | @ApiModelProperty(value = "单元栋") |
| | | private String unitName; |
| | | |
| | | public String getUnitName() { |
| | | return unitName; |
| | | } |
| | | @ApiModelProperty(value = "门牌号") |
| | | private String houseNumber; |
| | | |
| | | public String getHouseNumber() { |
| | | return houseNumber; |
| | | } |
| | | |
| | | @ApiModelProperty(value = "地址区域") |
| | | private String addressArea; |
| | |
| | | } |
| | | |
| | | Integer count = userHeadDetailsMapper.selectDetailsCount(userId); |
| | | // UserInfo userInfo = userMapper.selectByPrimaryKey(userId); |
| | | UserInfo userInfo = userMapper.selectByPrimaryKey(userId); |
| | | AccountInfo accountInfo = accountMapper.selectAccountInfoByUserId(userHeadRelate.getHeadUserId()); |
| | | |
| | | if (AccountInfo.IS_PROHIBIT_Y.equals(accountInfo.getIsProhibit())) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (totalReturnCoin.intValue() == 0 && totalReturnScore.intValue() == 0) { |
| | | return; |
| | | } |
| | | |
| | | UserHeadDetails userHeadDetails = new UserHeadDetails(); |
| | | userHeadDetails.setHeadUserId(userHeadRelate.getHeadUserId()); |
| | | userHeadDetails.setUserId(userId); |
| | |
| | | sysMessage.setUserId(userHeadRelate.getHeadUserId()); |
| | | sysMessage.setMessageType("4"); |
| | | sysMessage.setMessageSubTypeName("返利消息"); |
| | | sysMessage.setMessage("收到用户:" + accountInfo.getAccountName().replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2") + "的订单返利, 积分:" + totalReturnScore +", 环保币:" + totalReturnCoin); |
| | | sysMessage.setMessage("收到用户:" + userInfo.getMobilePhone().replaceAll("(\\w{3})\\w*(\\w{4})", "$1****$2") + "的订单返利, 积分:" + totalReturnScore +", 环保币:" + totalReturnCoin); |
| | | sysMessage.setFlag("2"); |
| | | sysMessageMapper.insert(sysMessage); |
| | | } |
| | |
| | | jhyOrder.setOrderNo(orderNo); |
| | | jhyOrder.setArea(addressInfo.getAddressArea()); |
| | | |
| | | StringBuffer address = new StringBuffer(); |
| | | address.append(addressInfo.getDetailAddress()); |
| | | if (StrUtil.isNotBlank(addressInfo.getTagName())) { |
| | | address.append(StrUtil.isNotBlank(addressInfo.getHouseName()) ? addressInfo.getHouseName() : ""); |
| | | if (Constants.ADDRESS_TYPE_HOME.equals(addressInfo.getTagName())) { |
| | | address.append(StrUtil.isNotBlank(addressInfo.getHouseNumber()) ? addressInfo.getHouseNumber() : ""); |
| | | address.append(StrUtil.isNotBlank(addressInfo.getUnitName()) ? addressInfo.getUnitName() : ""); |
| | | } |
| | | } |
| | | // StringBuffer address = new StringBuffer(); |
| | | // address.append(addressInfo.getDetailAddress()); |
| | | // if (StrUtil.isNotBlank(addressInfo.getTagName())) { |
| | | // address.append(StrUtil.isNotBlank(addressInfo.getHouseName()) ? addressInfo.getHouseName() : ""); |
| | | // if (Constants.ADDRESS_TYPE_HOME.equals(addressInfo.getTagName())) { |
| | | // address.append(StrUtil.isNotBlank(addressInfo.getHouseNumber()) ? addressInfo.getHouseNumber() : ""); |
| | | // address.append(StrUtil.isNotBlank(addressInfo.getUnitName()) ? addressInfo.getUnitName() : ""); |
| | | // } |
| | | // } |
| | | |
| | | List<JhyOrder> addressExist = jhyOrderMapper.selectJhyOrderListByStatus(StrUtil.split("1,2", ','), orderDto.getUserId()); |
| | | if (CollUtil.isNotEmpty(addressExist)) { |
| | | for (JhyOrder order : addressExist) { |
| | | String orderAddr = order.getArea() + order.getAddress(); |
| | | String orderAddr = order.getArea() + order.getAddress() + order.getUnitName() + order.getHouseNumber(); |
| | | |
| | | if (orderAddr.equals(addressInfo.getAddressArea() + address)) { |
| | | if (orderAddr.equals(addressInfo.getAddressArea() + addressInfo.getDetailAddress() + addressInfo.getHouseName() + addressInfo.getUnitName() + addressInfo.getHouseNumber())) { |
| | | throw new RestException(-3, "同一地址仅能有一单在进行中"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | jhyOrder.setAddress(address.toString()); |
| | | |
| | | jhyOrder.setAddress(addressInfo.getDetailAddress()+addressInfo.getHouseName()); |
| | | jhyOrder.setUnitName(addressInfo.getUnitName()); |
| | | jhyOrder.setHouseNumber(addressInfo.getHouseNumber()); |
| | | jhyOrder.setUsername(addressInfo.getRelaName()); |
| | | jhyOrder.setPhone(addressInfo.getMobilePhone()); |
| | | jhyOrder.setLongitude(addressInfo.getLongitude()); |
| | |
| | | detailsVo.setLongitude(order.getLongitude()); |
| | | detailsVo.setLatitude(order.getLatitude()); |
| | | detailsVo.setAddress(order.getArea() + order.getAddress()); |
| | | detailsVo.setUnitName(order.getUnitName()); |
| | | detailsVo.setHouseNumber(order.getHouseNumber()); |
| | | detailsVo.setTotalPrice(total); |
| | | detailsVo.setItems(items); |
| | | return detailsVo; |
| | |
| | | JhyOrder order = jhyOrderMapper.selectByPrimaryKey(confirmDto.getOrderId()); |
| | | AccountInfo jhyAccount = accountMapper.selectAccountInfoByUserId(order.getJhyId()); |
| | | BigDecimal collectScore = StrUtil.isNotBlank(jhyAccount.getCollectScore()) ? new BigDecimal(jhyAccount.getCollectScore()) : BigDecimal.ZERO; |
| | | log.info("===={}======{}====", collectScore, totalScore); |
| | | if (totalScore.compareTo(collectScore) > 0) { |
| | | throw new RestException(-3, "剩余积分不足"); |
| | | } |
| | |
| | | distribService.distribRecord(order.getId(), order.getUserId()); |
| | | // 推荐返利 |
| | | distribService.inviteAddOrderScore(order.getUserId(), order.getId().toString()); |
| | | } catch (RestException e) { |
| | | throw new RestException(e.getMessage()); |
| | | } catch (Exception e) { |
| | | log.error("异常", e); |
| | | throw new RestException("支付失败"); |
| | |
| | | @ApiModelProperty(value = "地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "单元栋") |
| | | private String unitName; |
| | | |
| | | @ApiModelProperty(value = "门牌号") |
| | | private String houseNumber; |
| | | |
| | | @ApiModelProperty(value = "姓名") |
| | | private String username; |
| | | |
| | |
| | | @ApiModelProperty(value = "地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "单元栋") |
| | | private String unitName; |
| | | |
| | | @ApiModelProperty(value = "门牌号") |
| | | private String houseNumber; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String longitude; |
| | | |
| | |
| | | ,a.username |
| | | ,CONCAT(a.area, a.address) address |
| | | ,a.longitude |
| | | ,a.unit_name unitName |
| | | ,a.house_number houseNumber |
| | | ,a.latitude |
| | | ,a.weight |
| | | ,a.status |
| | |
| | | <result column="order_fast_flag" property="orderFastFlag"/> |
| | | <result column="home_appliance_id" property="homeApplianceId"/> |
| | | <result column="change_receiver_flag" property="changeReceiverFlag"/> |
| | | <result column="unit_name" property="unitName"/> |
| | | <result column="house_number" property="houseNumber"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="StorageInfoMap" type="com.xzx.gc.model.order.OrderStorageVo"> |
| | |
| | | a.cancel_user_id, |
| | | a.address_area, |
| | | a.rela_name, |
| | | a.unit_name, |
| | | a.house_number, |
| | | a.order_second_status, |
| | | a.create_type, |
| | | a.store_id, |
| New file |
| | |
| | | package com.xzx.order; |
| | | |
| | | import com.xzx.gc.GcOrderApplication; |
| | | import com.xzx.gc.order.service.DistribService; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.ActiveProfiles; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = {GcOrderApplication.class}) |
| | | @ActiveProfiles(profiles = {"xc"}) |
| | | public class XcTest { |
| | | |
| | | |
| | | @Autowired |
| | | DistribService distribService; |
| | | |
| | | @Test |
| | | public void distribTest() { |
| | | distribService.distribRecord(740L, "YH1402174298026016768"); |
| | | } |
| | | } |
| | |
| | | @ApiResponse(code = 200, message = "success", response = XcxGoodsDetailVo.class) |
| | | ) |
| | | @PostMapping(value = "/goods/goodsDetails/{id}") |
| | | public JsonResult<XcxGoodsDetailVo> goodsDetails(@PathVariable("id") Long id) { |
| | | return JsonResult.success(goodsService.findGoodsDetails(id)); |
| | | public JsonResult<XcxGoodsDetailVo> goodsDetails(@PathVariable("id") Long id ,HttpServletRequest request) { |
| | | String userId = getUserId(request); |
| | | return JsonResult.success(goodsService.findGoodsDetails(id,userId)); |
| | | } |
| | | |
| | | @ApiOperation("商品搜索历史记录") |
| | |
| | | @ApiModelProperty(value="碳排放量",required=true) |
| | | private Integer carbonEmissions; |
| | | |
| | | @ApiModelProperty(value="限购次数") |
| | | private Integer quotaTime; |
| | | |
| | | @ApiModelProperty(value="主图") |
| | | private List<String> goodsImages; |
| | | |
| | |
| | | private String name; |
| | | @ApiModelProperty(value="是否已删除 0:未删除 1:已删除 2全部") |
| | | private Integer delFlag; |
| | | |
| | | @ApiModelProperty(value="是否抢购 1/是 2/否") |
| | | private Integer isQg; |
| | | |
| | | @ApiModelProperty(value="是否上架 1/是 2/否") |
| | | private Integer isSale; |
| | | |
| | | @ApiModelProperty(value="排序字段 1:抢购开始时间 2:抢购结束时间 3:是否上架 4:现价 5:原价 6:库存 7:创建时间") |
| | | private Integer namePx; |
| | | |
| | | @ApiModelProperty(value="排序方式 1: asc , 2 :desc") |
| | | private Integer typePx; |
| | | |
| | | @ApiModelProperty(value="第几页",required=true) |
| | | private int page; |
| | | @ApiModelProperty(value="每一页数量",required=true) |
| | |
| | | @ApiModelProperty(value="碳排放量",required=true) |
| | | private Integer carbonEmissions; |
| | | |
| | | @ApiModelProperty(value="限购次数") |
| | | private Integer quotaTime; |
| | | |
| | | @ApiModelProperty(value="积分商品轮播图") |
| | | private List<String> goodsImages; |
| | | |
| New file |
| | |
| | | package com.xzx.gc.shop.job; |
| | | |
| | | import com.xzx.gc.shop.service.OrderService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.EnableAsync; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @EnableAsync |
| | | @Slf4j |
| | | @Component |
| | | public class ShopJob { |
| | | |
| | | @Resource |
| | | private OrderService orderService; |
| | | /** |
| | | 时间是每天变动一次 |
| | | 自动确认收货 |
| | | */ |
| | | @Scheduled(cron = "0 0 0 * * ? ") |
| | | public void autoConfirmReceipt() { |
| | | log.info("自动确认收货执行"); |
| | | orderService.autoConfirmReceipt(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | } |
| | | } |
| | |
| | | package com.xzx.gc.shop.mapper; |
| | | |
| | | import com.xzx.gc.entity.AddressInfo; |
| | | import com.xzx.gc.entity.JhyInfo; |
| | | import com.xzx.gc.entity.JhyOrder; |
| | | import com.xzx.gc.shop.dto.QueryJhyOrderListDto; |
| | |
| | | BigDecimal selectTotalScoreHasGet(@Param("userId") String userId); |
| | | |
| | | JhyInfo selectJhyInfoByUserId(@Param("jhyId")Long jhyId); |
| | | |
| | | List<AddressInfo> selectAddRessInfoByUserId(@Param("userId")Long userId); |
| | | } |
| | |
| | | |
| | | ScoreGoods selectById(long id); |
| | | |
| | | List<QueryGoodsListVo> queryGoodsList(@Param("name")String name, @Param("delFlag")int delFlag); |
| | | List<QueryGoodsListVo> queryGoodsList(@Param("name")String name, @Param("delFlag")int delFlag |
| | | , @Param("isQg")int isQg, @Param("isSale")int isSale |
| | | , @Param("namePx")int namePx, @Param("typePx")int typePx); |
| | | |
| | | List<XcxGoodsListVo> selectXcxGoodsList(@Param("record") XcxGoodsListDto xcxGoodsListDto); |
| | | |
| | |
| | | |
| | | Integer selectScoreOrderCnt(@Param("userId") String userId); |
| | | |
| | | Integer selectGoodsQuotaTime(@Param("userId")String userId, |
| | | @Param("goodsId")Long id, |
| | | @Param("qgStartTime")Date qgStartTime, |
| | | @Param("qgEndTime")Date qgEndTime); |
| | | |
| | | List<ScoreOrder> selectOrderByIsFinish(@Param("dateTime")Date dateTime); |
| | | |
| | | void updateOrderStatusToDone(@Param("id") Long id); |
| | | } |
| | |
| | | ScoreGoodsStyleMapper scoreGoodsStyleMapper; |
| | | @Resource |
| | | ScoreGoodsSearchMapper scoreGoodsSearchMapper; |
| | | @Resource |
| | | ScoreOrderMapper scoreOrderMapper; |
| | | |
| | | @Autowired |
| | | private MqUtil mqUtil; |
| | |
| | | public Map<String, Object> queryGoodsList(QueryGoodsListDto model) { |
| | | String name = model.getName() == null ? "":model.getName(); |
| | | int delFlag = model.getDelFlag() == null ? 2:model.getDelFlag(); |
| | | int namePx = model.getNamePx() == null ? 7:model.getNamePx(); |
| | | int typePx = model.getTypePx() == null ? 2:model.getTypePx(); |
| | | PageHelper.startPage(model.getPage(), model.getLimit()); |
| | | |
| | | List<QueryGoodsListVo> maps = scoreGoodsMapper.queryGoodsList(name,delFlag); |
| | | if(CollUtil.isNotEmpty(maps)){ |
| | | for(QueryGoodsListVo queryGoodsListVo : maps){ |
| | | long id = queryGoodsListVo.getId(); |
| | | Integer stock = scoreGoodsSkuMapper.selectScoreGoodsSkuMapperByGoodId(id); |
| | | queryGoodsListVo.setStock(stock); |
| | | } |
| | | } |
| | | List<QueryGoodsListVo> maps = scoreGoodsMapper.queryGoodsList(name,delFlag,model.getIsQg(),model.getIsSale(),namePx,typePx); |
| | | // if(CollUtil.isNotEmpty(maps)){ |
| | | // for(QueryGoodsListVo queryGoodsListVo : maps){ |
| | | // long id = queryGoodsListVo.getId(); |
| | | // Integer stock = scoreGoodsSkuMapper.selectScoreGoodsSkuMapperByGoodId(id); |
| | | // queryGoodsListVo.setStock(stock); |
| | | // } |
| | | // } |
| | | PageInfo pageInfo = new PageInfo(maps); |
| | | int count = Convert.toInt(pageInfo.getTotal()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | |
| | | PageHelper.startPage(xcxGoodsListDto.getPageNo(), xcxGoodsListDto.getPageSize()); |
| | | List<XcxGoodsListVo> data = scoreGoodsMapper.selectXcxGoodsList(xcxGoodsListDto); |
| | | if(StrUtil.isNotEmpty(xcxGoodsListDto.getUserId())){ |
| | | if(CollUtil.isNotEmpty(data)){ |
| | | for(XcxGoodsListVo xcxGoodsListVo : data){ |
| | | if(ScoreGoods.ISQG_YES == xcxGoodsListVo.getIsQg()){ |
| | | //抢购时间内,用户购买该商品的数量 |
| | | Integer sumCnt = scoreOrderMapper.selectGoodsQuotaTime(xcxGoodsListDto.getUserId(),xcxGoodsListVo.getId(),xcxGoodsListVo.getQgStartTime(),xcxGoodsListVo.getQgEndTime()); |
| | | xcxGoodsListVo.setAvaQuotaTime( |
| | | ((xcxGoodsListVo.getQuotaTime() == null?0:xcxGoodsListVo.getQuotaTime()) - sumCnt) > 0?((xcxGoodsListVo.getQuotaTime() == null?0:xcxGoodsListVo.getQuotaTime()) - sumCnt):0 |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(StrUtil.isNotEmpty(xcxGoodsListDto.getName())){ |
| | | Example exampleSearch = new Example(ScoreGoodsSearch.class); |
| | | Example.Criteria criteriaSearch = exampleSearch.createCriteria(); |
| | |
| | | return new PageInfo<>(data); |
| | | } |
| | | |
| | | public XcxGoodsDetailVo findGoodsDetails(Long id) { |
| | | public XcxGoodsDetailVo findGoodsDetails(Long id, String userId) { |
| | | XcxGoodsDetailVo data = scoreGoodsMapper.selectGoodsDetailsById(id); |
| | | data.setQuotaTime(data.getQuotaTime() == null ? 0:data.getQuotaTime()); |
| | | XcxGoodsListDto dto = new XcxGoodsListDto(); |
| | | dto.setId(id); |
| | | List<XcxGoodsListVo> list = scoreGoodsMapper.selectXcxGoodsList(dto); |
| | | |
| | | if(StrUtil.isNotEmpty(userId)){ |
| | | if(CollUtil.isNotEmpty(list)){ |
| | | for(XcxGoodsListVo xcxGoodsListVo : list){ |
| | | if(ScoreGoods.ISQG_YES == xcxGoodsListVo.getIsQg()){ |
| | | //抢购时间内,用户购买该商品的数量 |
| | | Integer sumCnt = scoreOrderMapper.selectGoodsQuotaTime(userId,xcxGoodsListVo.getId(),xcxGoodsListVo.getQgStartTime(),xcxGoodsListVo.getQgEndTime()); |
| | | data.setAvaQuotaTime( |
| | | ((xcxGoodsListVo.getQuotaTime() == null?0:xcxGoodsListVo.getQuotaTime()) - sumCnt) > 0?((xcxGoodsListVo.getQuotaTime() == null?0:xcxGoodsListVo.getQuotaTime()) - sumCnt):0 |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<String> images = scoreGoodsImagesMapper.selectScoreGoodsImagesByGoodsId(id); |
| | | data.setImages(images); |
| | | if (CollUtil.isNotEmpty(list)) { |
| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.rabbitmq.client.Address; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.common.exception.RestException; |
| | | import com.xzx.gc.common.utils.StringUtils; |
| | | import com.xzx.gc.entity.*; |
| | | import com.xzx.gc.shop.dto.AssignJhyOrderDto; |
| | | import com.xzx.gc.shop.dto.CancelJhyOrderDto; |
| | | import com.xzx.gc.shop.dto.QueryJhyOrderListDto; |
| | | import com.xzx.gc.shop.mapper.JhyOrderItemsMapper; |
| | | import com.xzx.gc.shop.mapper.JhyOrderMapper; |
| | | import com.xzx.gc.shop.mapper.OrderInfoMapper; |
| | | import com.xzx.gc.shop.mapper.ScoreOrderMapper; |
| | | import com.xzx.gc.shop.mapper.*; |
| | | import com.xzx.gc.shop.vo.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | Long id = queryJhyOrderListVo.getId(); |
| | | List<JhyOrderItemsVo> jhyOrderItemsVos = jhyOrderItemsMapper.selectByOrderId(id); |
| | | queryJhyOrderListVo.setJhyOrderItemsVos(jhyOrderItemsVos); |
| | | // |
| | | // String orderAddr = queryJhyOrderListVo.getArea() + queryJhyOrderListVo.getAddress(); |
| | | // Long userId = queryJhyOrderListVo.getUserId(); |
| | | // List<AddressInfo> addressInfos = jhyOrderMapper.selectAddRessInfoByUserId(userId); |
| | | // if(CollUtil.isNotEmpty(addressInfos)){ |
| | | // for(AddressInfo addressInfo : addressInfos){ |
| | | // StringBuffer address = new StringBuffer(); |
| | | // address.append(addressInfo.getDetailAddress()); |
| | | // if (StrUtil.isNotBlank(addressInfo.getTagName())) { |
| | | // address.append(StrUtil.isNotBlank(addressInfo.getHouseName()) ? addressInfo.getHouseName() : ""); |
| | | // if (Constants.ADDRESS_TYPE_HOME.equals(addressInfo.getTagName())) { |
| | | // address.append(StrUtil.isNotBlank(addressInfo.getHouseNumber()) ? addressInfo.getHouseNumber() : ""); |
| | | // address.append(StrUtil.isNotBlank(addressInfo.getUnitName()) ? addressInfo.getUnitName() : ""); |
| | | // } |
| | | // } |
| | | // if (orderAddr.equals(addressInfo.getAddressArea() + address)) { |
| | | // queryJhyOrderListVo.setUnitName(addressInfo.getUnitName()); |
| | | // queryJhyOrderListVo.setHouseNumber(addressInfo.getHouseNumber()); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | // if(CollUtil.isNotEmpty(maps)){ |
| | |
| | | Integer jhyUserCnt = jhyOrderMapper.selectJhyOrderCnt(userId); |
| | | |
| | | Integer allCnt = scoreOrderMapper.selectScoreOrderCnt(null); |
| | | Integer userCnt = scoreOrderMapper.selectScoreOrderCnt(userId); |
| | | BigDecimal score = jhyOrderMapper.selectTotalScoreHasGet(userId); |
| | | |
| | | StatisticsVo result = new StatisticsVo(); |
| | | result.setTotalReduceCarbon(allCarbon.divide(BigDecimal.valueOf(1000), 2, BigDecimal.ROUND_DOWN)); |
| | | result.setReduceCarbon(userCarbon.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | |
| | | result.setOrderCnt(qsUserCnt + jhyUserCnt); |
| | | result.setTotalOrderCnt(qsAllCnt + jhyAllCnt); |
| | | result.setOrderCnt(qsUserCnt + jhyUserCnt + userCnt); |
| | | result.setTotalOrderCnt(qsAllCnt + jhyAllCnt + allCnt); |
| | | |
| | | result.setTotalBuyCnt(allCnt); |
| | | result.setScore(score); |
| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | |
| | | } |
| | | // scoreOrder.setStatus(ScoreOrder.STATUS_DONE); |
| | | scoreOrder.setIsFinish(ScoreOrder.ISFINISH_YES); |
| | | scoreOrder.setIsFinishTime(new Date()); |
| | | scoreOrder.setVoucherImg(CollUtil.join(model.getVoucherImgs(),",")); |
| | | scoreOrderMapper.updateByPrimaryKeySelective(scoreOrder); |
| | | return scoreOrder.getId(); |
| | |
| | | throw new RestException(-3, "商品不存在或已下架"); |
| | | } |
| | | |
| | | if (ScoreGoods.ISQG_YES.equals(goods.getIsQg())) { |
| | | if (new Date().before(goods.getQgStartTime())) { |
| | | throw new RestException(-3, "抢购未开始"); |
| | | } |
| | | |
| | | if (new Date().after(goods.getQgEndTime())) { |
| | | throw new RestException(-3, "抢购已结束"); |
| | | } |
| | | } |
| | | // if (ScoreGoods.ISQG_YES.equals(goods.getIsQg())) { |
| | | // if (new Date().before(goods.getQgStartTime())) { |
| | | // throw new RestException(-3, "抢购未开始"); |
| | | // } |
| | | // |
| | | // if (new Date().after(goods.getQgEndTime())) { |
| | | // throw new RestException(-3, "抢购已结束"); |
| | | // } |
| | | // } |
| | | |
| | | if (addGoodsOrderDto.getCnt() > sku.getStock()) { |
| | | throw new RestException(-3, "库存不足"); |
| | |
| | | throw new RestException(-3, "积分不足"); |
| | | } |
| | | |
| | | BigDecimal totalPrice = sku.getPresentPrice().multiply(BigDecimal.valueOf(addGoodsOrderDto.getCnt())); |
| | | BigDecimal totalPrice = BigDecimal.ZERO; |
| | | BigDecimal unitPrice = BigDecimal.ZERO; |
| | | if (ScoreGoods.ISQG_YES.equals(goods.getIsQg())) { |
| | | //限购数量 |
| | | Integer quotaTime = goods.getQuotaTime() == null ? 0:goods.getQuotaTime(); |
| | | //不限购 |
| | | if(quotaTime == 0){ |
| | | totalPrice = sku.getPresentPrice().multiply(BigDecimal.valueOf(addGoodsOrderDto.getCnt())); |
| | | unitPrice = sku.getPresentPrice(); |
| | | }else{ |
| | | //抢购时间内,用户购买该商品的数量 |
| | | Integer sumCnt = scoreOrderMapper.selectGoodsQuotaTime(addGoodsOrderDto.getUserId(),goods.getId(),goods.getQgStartTime(),goods.getQgEndTime()); |
| | | //剩余限购数量 |
| | | quotaTime = quotaTime-sumCnt; |
| | | if(goods.getQgStartTime().before(new Date()) && goods.getQgEndTime().after(new Date())){ |
| | | if(addGoodsOrderDto.getCnt() <= quotaTime){ |
| | | totalPrice = sku.getPresentPrice().multiply(BigDecimal.valueOf(addGoodsOrderDto.getCnt())); |
| | | unitPrice = sku.getPresentPrice(); |
| | | }else{ |
| | | if(quotaTime > 0){ |
| | | totalPrice = sku.getPresentPrice().multiply(BigDecimal.valueOf(quotaTime)).add( |
| | | sku.getOriginalPrice().multiply(BigDecimal.valueOf(addGoodsOrderDto.getCnt()-quotaTime))); |
| | | unitPrice = sku.getOriginalPrice(); |
| | | }else{ |
| | | totalPrice = sku.getOriginalPrice().multiply(BigDecimal.valueOf(addGoodsOrderDto.getCnt())); |
| | | unitPrice = sku.getOriginalPrice(); |
| | | } |
| | | } |
| | | }else{ |
| | | //开启抢购,不再时间内,直接原价* 数量 |
| | | totalPrice = sku.getOriginalPrice().multiply(BigDecimal.valueOf(addGoodsOrderDto.getCnt())); |
| | | unitPrice = sku.getOriginalPrice(); |
| | | } |
| | | } |
| | | }else{ |
| | | //没有开启抢购,直接现价* 数量 |
| | | totalPrice = sku.getPresentPrice().multiply(BigDecimal.valueOf(addGoodsOrderDto.getCnt())); |
| | | unitPrice = sku.getPresentPrice(); |
| | | } |
| | | BigDecimal score = new BigDecimal(accountInfo.getCollectScore()); |
| | | if (score.compareTo(totalPrice) < 0) { |
| | | throw new RestException(-3, "积分不足"); |
| | |
| | | orderDetails.setOrderId(order.getId()); |
| | | orderDetails.setCnt(addGoodsOrderDto.getCnt()); |
| | | orderDetails.setTotalPrice(totalPrice); |
| | | orderDetails.setUnitPrice(sku.getPresentPrice()); |
| | | // orderDetails.setUnitPrice(sku.getPresentPrice()); |
| | | orderDetails.setUnitPrice(unitPrice); |
| | | orderDetails.setGoodsId(goods.getId()); |
| | | orderDetails.setSkuId(sku.getId()); |
| | | orderDetails.setThumb(goods.getThumb()); |
| | |
| | | if (StrUtil.isNotBlank(addressInfo.getTagName())) { |
| | | address.append(StrUtil.isNotBlank(addressInfo.getHouseName()) ? addressInfo.getHouseName() : ""); |
| | | if (Constants.ADDRESS_TYPE_HOME.equals(addressInfo.getTagName())) { |
| | | address.append(StrUtil.isNotBlank(addressInfo.getHouseNumber()) ? addressInfo.getHouseNumber() : ""); |
| | | address.append(StrUtil.isNotBlank(addressInfo.getUnitName()) ? addressInfo.getUnitName() : ""); |
| | | address.append(StrUtil.isNotBlank(addressInfo.getHouseNumber()) ? addressInfo.getHouseNumber() : ""); |
| | | } |
| | | } |
| | | expressInfo.setAddress(address.toString()); |
| | |
| | | statisticsVo.setTotalBuyCnt(Integer.parseInt(allData.get("totalBuy").toString())); |
| | | return statisticsVo; |
| | | } |
| | | |
| | | public void autoConfirmReceipt() { |
| | | //获取七天之前后台点击确认提货的订单 |
| | | DateTime dateTime = DateUtil.offsetDay(new Date(), -7); |
| | | // |
| | | List<ScoreOrder> orders = scoreOrderMapper.selectOrderByIsFinish(dateTime); |
| | | if(CollUtil.isNotEmpty(orders)){ |
| | | for(ScoreOrder order : orders){ |
| | | scoreOrderMapper.updateOrderStatusToDone(order.getId()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | // public static void main(String[] args) { |
| | | // DateTime dateTime = DateUtil.offsetDay(new Date(), -7); |
| | | // System.out.println(dateTime); |
| | | // } |
| | | |
| | | } |
| | |
| | | public class QueryJhyOrderListVo { |
| | | |
| | | private Long id; |
| | | private Long userId; |
| | | @ApiModelProperty(value="订单号") |
| | | private String orderNo; |
| | | @ApiModelProperty(value="联系人") |
| | |
| | | private String area; |
| | | @ApiModelProperty(value="详细地址") |
| | | private String address; |
| | | @ApiModelProperty(value="单元栋") |
| | | private String unitName; |
| | | @ApiModelProperty(value="楼门牌号") |
| | | private String houseNumber; |
| | | @ApiModelProperty(value="预约年月日") |
| | | private String reserveDate; |
| | | @ApiModelProperty(value="预约时间") |
| | |
| | | private String expressCom; |
| | | @ApiModelProperty(value="物流单号") |
| | | private String expressNo; |
| | | @ApiModelProperty(value="收货地址") |
| | | private String expressAddress; |
| | | } |
| | |
| | | @ApiModelProperty(value="碳排放量",required=true) |
| | | private Integer carbonEmissions; |
| | | |
| | | @ApiModelProperty(value="限购次数") |
| | | private Integer quotaTime; |
| | | |
| | | @ApiModelProperty(value="积分商品轮播图") |
| | | private List<String> goodsImages; |
| | | |
| | |
| | | @ApiModelProperty(value = "剩余时间") |
| | | private Long remainTime; |
| | | |
| | | @ApiModelProperty(value = "限购数量") |
| | | private Integer quotaTime; |
| | | |
| | | @ApiModelProperty(value = "剩余限购数量") |
| | | private Integer avaQuotaTime; |
| | | |
| | | @ApiModelProperty(value = "样式") |
| | | private List<XcxGoodsDetailStyleVo> styles; |
| | | |
| | |
| | | package com.xzx.gc.shop.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel(value = "XcxGoodsListVo", description = "小程序商品列表返回参数类") |
| | |
| | | @ApiModelProperty(value = "库存") |
| | | private Integer stock; |
| | | |
| | | @ApiModelProperty(value = "限购数量") |
| | | private Integer quotaTime; |
| | | |
| | | @ApiModelProperty(value = "剩余限购数量") |
| | | private Integer avaQuotaTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private Date qgStartTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private Date qgEndTime; |
| | | |
| | | @ApiModelProperty(value = "是否抢购 1-是 2-否") |
| | | private Integer isQg; |
| | | } |
| | |
| | | a.reserve_time reserveTime, |
| | | a.status status, |
| | | a.remark remark, |
| | | a.unit_name unitName, |
| | | a.house_number houseNumber, |
| | | a.username name, |
| | | b.mobile_phone mobilePhone, |
| | | d.mobile jhyMobilePhone, |
| | |
| | | <select id="selectJhyInfoByUserId" resultType="com.xzx.gc.entity.JhyInfo"> |
| | | select * from xzx_jhy_info where id = #{jhyId} |
| | | </select> |
| | | |
| | | <select id="selectAddRessInfoByUserId" resultType="com.xzx.gc.entity.AddressInfo"> |
| | | select * from xzx_user_address_info where user_id = #{userId} |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="queryGoodsList" resultType="com.xzx.gc.shop.vo.QueryGoodsListVo"> |
| | | SELECT |
| | | a.*, |
| | | a.CREATED_TIME createTime |
| | | a.CREATED_TIME createTime, |
| | | ( |
| | | SELECT |
| | | ifnull(sum(b.stock),0) |
| | | FROM |
| | | xzx_score_goods_sku b |
| | | WHERE 1 = 1 |
| | | and b.goods_id = a.id |
| | | ) stock |
| | | FROM |
| | | xzx_score_goods a |
| | | |
| | | WHERE 1 = 1 |
| | | and a.del_flag = 0 |
| | | <if test="name != null and name != ''"> |
| | | and (a.name like concat('%',#{name},'%') or a.goods_no like concat('%',#{name},'%')) |
| | | </if> |
| | | |
| | | <if test="isQg != null and isQg != ''"> |
| | | and a.is_qg= #{isQg} |
| | | </if> |
| | | |
| | | <if test="isSale != null and isSale != ''"> |
| | | and a.is_sale= #{isSale} |
| | | </if> |
| | | |
| | | <!-- <if test="delFlag == 0 or delFlag == 1">--> |
| | | <!-- and a.del_flag = #{delFlag}--> |
| | | <!-- </if>--> |
| | | and a.del_flag = 0 |
| | | order by a.CREATED_TIME desc |
| | | order by |
| | | <if test="namePx != null and namePx != '' and namePx == 1"> |
| | | a.qg_start_time |
| | | </if> |
| | | <if test="namePx != null and namePx != '' and namePx == 2"> |
| | | a.qg_end_time |
| | | </if> |
| | | <if test="namePx != null and namePx != '' and namePx == 3"> |
| | | a.is_sale |
| | | </if> |
| | | <if test="namePx != null and namePx != '' and namePx == 4"> |
| | | a.present_price + 0 |
| | | </if> |
| | | <if test="namePx != null and namePx != '' and namePx == 5"> |
| | | a.original_price + 0 |
| | | </if> |
| | | <if test="namePx != null and namePx != '' and namePx == 6"> |
| | | stock |
| | | </if> |
| | | <if test="namePx != null and namePx != '' and namePx == 7"> |
| | | a.CREATED_TIME |
| | | </if> |
| | | |
| | | <if test="typePx != null and typePx != '' and typePx == 1"> |
| | | asc |
| | | </if> |
| | | <if test="typePx != null and typePx != '' and typePx == 2"> |
| | | desc |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | |
| | | and a.id=#{record.id} |
| | | </if> |
| | | <if test="record.isQg != null and record.isQg != ''"> |
| | | and a.is_qg=#{record.isQg} and a.qg_end_time > now() |
| | | and a.is_qg=#{record.isQg} and a.qg_end_time > now() and a.qg_start_time < now() |
| | | </if> |
| | | <if test="record.cateId != null and record.cateId != ''"> |
| | | and (a.category_id = #{record.cateId} or a.category_id in (select id from xzx_score_goods_category where parent_id=#{record.cateId})) |
| | |
| | | <result property="qgStartTime" column="qg_start_time" /> |
| | | <result property="qgEndTime" column="qg_end_time" /> |
| | | <result property="details" column="details" /> |
| | | <result property="quotaTime" column="quota_time" /> |
| | | <collection property="styles" ofType="com.xzx.gc.shop.vo.XcxGoodsDetailStyleVo" > |
| | | <id property="id" column="s_id" /> |
| | | <result property="name" column="s_name" /> |
| | |
| | | b.nick_name name, |
| | | b.mobile_phone phone, |
| | | d.express_com expressCom, |
| | | d.address expressAddress, |
| | | d.express_no expressNo |
| | | FROM |
| | | xzx_score_order a |
| | |
| | | and user_id=#{userId} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectGoodsQuotaTime" resultType="java.lang.Integer"> |
| | | SELECT |
| | | IFNULL(SUM(a.cnt), 0) |
| | | FROM |
| | | xzx_score_order a |
| | | LEFT JOIN xzx_score_order_details b ON b.order_id = a.id |
| | | WHERE |
| | | a. STATUS IN (1, 2, 3, 4, 5) |
| | | and a.user_id = #{userId} |
| | | AND b.goods_id = #{goodsId} |
| | | and a.CREATED_TIME >= #{qgStartTime} |
| | | and a.CREATED_TIME <= #{qgEndTime} |
| | | </select> |
| | | |
| | | <select id="selectOrderByIsFinish" resultType="com.xzx.gc.entity.ScoreOrder"> |
| | | select |
| | | a.* |
| | | from xzx_score_order a |
| | | where a.is_finish = 1 |
| | | and a.status = 2 |
| | | and a.is_finish_time <= #{dateTime} |
| | | </select> |
| | | |
| | | <update id="updateOrderStatusToDone"> |
| | | update xzx_score_order |
| | | set status = 4 |
| | | where id = #{id} |
| | | </update> |
| | | </mapper> |
| | |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='首页弹窗表'; |
| | | |
| | | ALTER TABLE `xzx_score_goods` |
| | | ADD COLUMN `quota_time` int(11) NULL COMMENT '限购次数' AFTER `present_price`; |
| | | |
| | | ALTER TABLE `xzx_jhy_order` |
| | | ADD COLUMN `unit_name` varchar(32) NULL COMMENT '单元栋' AFTER `username`; |
| | | |
| | | ALTER TABLE `xzx_jhy_order` |
| | | ADD COLUMN `house_number` varchar(32) NULL COMMENT '门牌号' AFTER `unit_name`; |
| | | |
| | | ALTER TABLE `xzx_score_order` |
| | | ADD COLUMN `is_finish_time` datetime NULL COMMENT '确认提货时间' AFTER `is_finish`; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | package com.xzx.gc; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.entity.AddressInfo; |
| | | import com.xzx.gc.shop.dto.QueryGoodsListDto; |
| | | import com.xzx.gc.shop.dto.QueryJhyOrderListDto; |
| | | import com.xzx.gc.shop.mapper.JhyOrderItemsMapper; |
| | | import com.xzx.gc.shop.mapper.JhyOrderMapper; |
| | | import com.xzx.gc.shop.mapper.ScoreGoodsMapper; |
| | | import com.xzx.gc.shop.service.OrderService; |
| | | import com.xzx.gc.shop.vo.JhyOrderItemsVo; |
| | | import com.xzx.gc.shop.vo.QueryGoodsListVo; |
| | | import com.xzx.gc.shop.vo.QueryJhyOrderListVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.ActiveProfiles; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = {GcShopApplication.class}) |
| | | @ActiveProfiles({"dev", "xc"}) |
| | | public class CodeTest { |
| | | |
| | | @Autowired |
| | | private ScoreGoodsMapper scoreGoodsMapper; |
| | | @Autowired |
| | | private JhyOrderMapper jhyOrderMapper; |
| | | @Autowired |
| | | private JhyOrderItemsMapper jhyOrderItemsMapper; |
| | | |
| | | @Test |
| | | public void goodsList(){ |
| | | QueryGoodsListDto model = new QueryGoodsListDto(); |
| | | String name = model.getName() == null ? "":model.getName(); |
| | | int delFlag = model.getDelFlag() == null ? 2:model.getDelFlag(); |
| | | int namePx = model.getNamePx() == null ? 7:model.getNamePx(); |
| | | int typePx = model.getTypePx() == null ? 2:model.getTypePx(); |
| | | PageHelper.startPage(model.getPage(), model.getLimit()); |
| | | |
| | | List<QueryGoodsListVo> maps = scoreGoodsMapper.queryGoodsList(name,delFlag,1,1,namePx,typePx); |
| | | System.out.println(maps.toString()); |
| | | |
| | | } |
| | | @Test |
| | | public void jhyOrderList(){ |
| | | QueryJhyOrderListDto model = new QueryJhyOrderListDto(); |
| | | List<Integer> status = new ArrayList<>(); |
| | | if(CollUtil.isEmpty(model.getStatus())){ |
| | | status.add(1); |
| | | status.add(2); |
| | | status.add(3); |
| | | status.add(4); |
| | | status.add(5); |
| | | status.add(6); |
| | | model.setStatus(status); |
| | | } |
| | | |
| | | List<QueryJhyOrderListVo> maps = jhyOrderMapper.queryOrderList(model); |
| | | if(CollUtil.isNotEmpty(maps)){ |
| | | for(QueryJhyOrderListVo queryJhyOrderListVo : maps){ |
| | | Long id = queryJhyOrderListVo.getId(); |
| | | List<JhyOrderItemsVo> jhyOrderItemsVos = jhyOrderItemsMapper.selectByOrderId(id); |
| | | queryJhyOrderListVo.setJhyOrderItemsVos(jhyOrderItemsVos); |
| | | |
| | | String orderAddr = queryJhyOrderListVo.getAddress(); |
| | | Long userId = queryJhyOrderListVo.getUserId(); |
| | | List<AddressInfo> addressInfos = jhyOrderMapper.selectAddRessInfoByUserId(userId); |
| | | if(CollUtil.isNotEmpty(addressInfos)){ |
| | | for(AddressInfo addressInfo : addressInfos){ |
| | | StringBuffer address = new StringBuffer(); |
| | | address.append(addressInfo.getDetailAddress()); |
| | | if (StrUtil.isNotBlank(addressInfo.getTagName())) { |
| | | address.append(StrUtil.isNotBlank(addressInfo.getHouseName()) ? addressInfo.getHouseName() : ""); |
| | | if (Constants.ADDRESS_TYPE_HOME.equals(addressInfo.getTagName())) { |
| | | address.append(StrUtil.isNotBlank(addressInfo.getHouseNumber()) ? addressInfo.getHouseNumber() : ""); |
| | | address.append(StrUtil.isNotBlank(addressInfo.getUnitName()) ? addressInfo.getUnitName() : ""); |
| | | } |
| | | } |
| | | if (orderAddr.equals(addressInfo.getAddressArea() + address)) { |
| | | queryJhyOrderListVo.setUnitName(addressInfo.getUnitName()); |
| | | System.out.println(orderAddr); |
| | | queryJhyOrderListVo.setHouseNumber(addressInfo.getHouseNumber()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | @Test |
| | | public void autoConfirm() { |
| | | orderService.autoConfirmReceipt(); |
| | | } |
| | | |
| | | } |
| | |
| | | stringBuffer.append(pointReward); |
| | | redPaperRule.setStatus((short) 0); |
| | | redPaperRule.setRuleName("分销规则"); |
| | | redPaperRule.setRuleType("9"); |
| | | redPaperRule.setSharingProfitType("frist_reward,order_num_frist,regular_point,regular_money_percent,point_reward"); |
| | | redPaperRule.setShareRatio(stringBuffer.toString()); |
| | | redPaperRuleMapper.insert(redPaperRule); |
| | |
| | | sysMessage.setFlag("2"); |
| | | sysMessageMapper.insert(sysMessage); |
| | | |
| | | redisUtil.setex(key, times.toString(), 84400); |
| | | Date tomorrow = DateUtil.parse(DateUtil.tomorrow().toString("yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss"); |
| | | long time = DateUtil.between(new Date(), tomorrow, DateUnit.SECOND, false); |
| | | redisUtil.setex(key, times.toString(), (int) time); |
| | | } |
| | | } |
| | | |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | |
| | | String userId = jhyInfoListVo.getUserId(); |
| | | if(StrUtil.isNotEmpty(userId)){ |
| | | AccountInfo accountInfo = accountMapper.selectOneByUserId(userId); |
| | | String collectScore = StrUtil.isEmpty(accountInfo.getCollectScore()) ? "0" : accountInfo.getCollectScore(); |
| | | jhyInfoListVo.setScore(new BigDecimal(collectScore).setScale( 2, BigDecimal.ROUND_DOWN )); |
| | | if(ObjectUtil.isNotEmpty(accountInfo)){ |
| | | String collectScore = StrUtil.isEmpty(accountInfo.getCollectScore()) ? "0" : accountInfo.getCollectScore(); |
| | | jhyInfoListVo.setScore(new BigDecimal(collectScore).setScale( 2, BigDecimal.ROUND_DOWN )); |
| | | } |
| | | |
| | | Example example = new Example(UserLoginInfo.class); |
| | | Example.Criteria criteria = example.createCriteria(); |
| | |
| | | viewJhyInfoVo.setAddress(jhyInfo.getAddress()); |
| | | String userId = jhyInfo.getUserId(); |
| | | AccountInfo accountInfo = accountMapper.selectOneByUserId(userId); |
| | | String collectScore = accountInfo.getCollectScore(); |
| | | BigDecimal bigDecimal = new BigDecimal(StrUtil.isEmpty(collectScore) ? "0" : collectScore).setScale( 2, BigDecimal.ROUND_DOWN ); |
| | | viewJhyInfoVo.setScore(bigDecimal); |
| | | if(ObjectUtil.isNotEmpty(accountInfo)){ |
| | | String collectScore = accountInfo.getCollectScore(); |
| | | BigDecimal bigDecimal = new BigDecimal(StrUtil.isEmpty(collectScore) ? "0" : collectScore).setScale( 2, BigDecimal.ROUND_DOWN ); |
| | | viewJhyInfoVo.setScore(bigDecimal); |
| | | |
| | | } |
| | | |
| | | viewJhyInfoVo.setCreateTime(jhyInfo.getCreatedTime().toString()); |
| | | |
| | | UserInfo userInfo = userMapper.selectByPrimaryKey(userId); |
| | |
| | | import cn.hutool.poi.excel.ExcelUtil;
|
| | | import cn.hutool.poi.excel.ExcelWriter;
|
| | | import com.aliyuncs.exceptions.ClientException;
|
| | | import com.github.pagehelper.PageHelper;
|
| | | import com.xzx.gc.GcUserApplication;
|
| | | import com.xzx.gc.common.Result;
|
| | | import com.xzx.gc.common.constant.Constants;
|
| | | import com.xzx.gc.common.constant.OrderEnum;
|
| | |
| | | import com.xzx.gc.common.utils.gdmap.GdTraceUtil;
|
| | | import com.xzx.gc.common.utils.image.QrCodeBaseUtils;
|
| | | import com.xzx.gc.common.utils.image.QrCodeGraphicsUtils;
|
| | | import com.xzx.gc.entity.AddressInfo;
|
| | | import com.xzx.gc.entity.HomeServiceInfo;
|
| | | import com.xzx.gc.entity.PartnerFence;
|
| | | import com.xzx.gc.entity.UserInfo;
|
| | | import com.xzx.gc.entity.*;
|
| | | import com.xzx.gc.user.dto.JhyInfoListDto;
|
| | | import com.xzx.gc.user.service.JhyInfoService;
|
| | | import com.xzx.gc.user.vo.JhyInfoListVo;
|
| | | import com.xzx.gc.util.BeanUtils;
|
| | | import lombok.Data;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import net.coobird.thumbnailator.Thumbnails;
|
| | | import org.apache.commons.lang3.RandomStringUtils;
|
| | | import org.junit.Test;
|
| | | import org.junit.runner.RunWith;
|
| | | import org.locationtech.spatial4j.context.SpatialContext;
|
| | | import org.locationtech.spatial4j.distance.DistanceUtils;
|
| | | import org.locationtech.spatial4j.shape.Rectangle;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.boot.test.context.SpringBootTest;
|
| | | import org.springframework.test.context.ActiveProfiles;
|
| | | import org.springframework.test.context.junit4.SpringRunner;
|
| | | import sun.misc.Regexp;
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | import javax.imageio.ImageIO;
|
| | | import java.awt.*;
|
| | |
| | | import java.util.regex.Pattern;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | |
|
| | | @Slf4j
|
| | | @RunWith(SpringRunner.class)
|
| | | @SpringBootTest(classes = {GcUserApplication.class})
|
| | | @ActiveProfiles("dev")
|
| | | public class CodeTest {
|
| | |
|
| | | @Autowired
|
| | | private JhyInfoService jhyInfoService;
|
| | |
|
| | | @Test
|
| | | public void jhyList(){
|
| | | JhyInfoListDto jhyInfoListDto = new JhyInfoListDto();
|
| | | jhyInfoListDto.setPage(1);
|
| | | jhyInfoListDto.setLimit(10);
|
| | | jhyInfoListDto.setIsJhy(1);
|
| | | Map<String, Object> stringObjectMap = jhyInfoService.queryList(jhyInfoListDto);
|
| | | System.out.println(stringObjectMap.get("date"));
|
| | | }
|
| | |
|
| | |
|
| | | @Test
|
| | |
| | |
|
| | | @Test
|
| | | public void ex(){
|
| | | Map<String, Object> row1 = new LinkedHashMap<>();
|
| | | row1.put("姓名", "张三");
|
| | | row1.put("年龄", 23);
|
| | | row1.put("成绩", 88.32);
|
| | | row1.put("是否合格", true);
|
| | | row1.put("考试日期", DateUtil.date());
|
| | |
|
| | | Map<String, Object> row2 = new LinkedHashMap<>();
|
| | | row2.put("姓名", "李四");
|
| | | row2.put("年龄", 33);
|
| | | row2.put("成绩", 59.50);
|
| | | row2.put("是否合格", false);
|
| | | row2.put("考试日期", DateUtil.date());
|
| | |
|
| | | ArrayList<Map<String, Object>> rows = CollUtil.newArrayList(row1, row2);
|
| | |
|
| | | System.out.println(rows);
|
| | | ArrayList<Map<String, Object>> rows = new ArrayList<>();
|
| | | String str = null;
|
| | | for(int i = 0;i < 100000;i++){
|
| | | Map<String, Object> row1 = new LinkedHashMap<>();
|
| | | // str = "M0"+RandomUtil.randomString(8).toUpperCase();
|
| | | // str = "M1"+RandomUtil.randomString(8).toUpperCase();
|
| | | // str = "M2"+RandomUtil.randomString(8).toUpperCase();
|
| | | // str = "M3"+RandomUtil.randomString(8).toUpperCase();
|
| | | // str = "M4"+RandomUtil.randomString(8).toUpperCase();
|
| | | // str = "M5"+RandomUtil.randomString(8).toUpperCase();
|
| | | // str = "M6"+RandomUtil.randomString(8).toUpperCase();
|
| | | // str = "M7"+RandomUtil.randomString(8).toUpperCase();
|
| | | // str = "M8"+RandomUtil.randomString(8).toUpperCase();
|
| | | str = "M9"+RandomUtil.randomString(8).toUpperCase();
|
| | | row1.put("编码", str);
|
| | | rows.add(row1);
|
| | | }
|
| | | Set<Map<String, Object>> maps = RandomUtil.randomEleSet(rows, 10000);
|
| | | System.out.println(maps);
|
| | |
|
| | | // 通过工具类创建writer
|
| | | ExcelWriter writer = ExcelUtil.getWriter("d:/writeMapTest.xlsx");
|
| | | ExcelWriter writer = ExcelUtil.getWriter("d:/编码M9.xlsx");
|
| | | // 合并单元格后的标题行,使用默认标题样式
|
| | | writer.merge(row1.size() - 1, "一班成绩单");
|
| | | // writer.merge(maps.size() - 1, "编码");
|
| | | // 一次性写出内容,使用默认样式,强制输出标题
|
| | | writer.write(rows, true);
|
| | | writer.write(maps, true);
|
| | | // 关闭writer,释放内存
|
| | | writer.close();
|
| | |
|