Commit 893d090d by 吕明尚

新增小程序需求接口

parent 53d83141
......@@ -3,12 +3,16 @@ package share.common.core.domain.entity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import com.baomidou.mybatisplus.annotation.TableField;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import share.common.annotation.Excel;
import share.common.annotation.Excel.ColumnType;
import share.common.core.domain.BaseEntity;
import java.util.List;
/**
* 字典类型表 sys_dict_type
*
......@@ -34,6 +38,18 @@ public class SysDictType extends BaseEntity
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 字典数据 */
@TableField(exist = false)
private List<SysDictData> dictDatas;
public List<SysDictData> getDictDatas() {
return dictDatas;
}
public void setDictDatas(List<SysDictData> dictDatas) {
this.dictDatas = dictDatas;
}
public Long getDictId()
{
return dictId;
......
......@@ -82,7 +82,7 @@ public class SCleanRecordsController extends BaseController
* 开始保洁
*/
@Log(title = "开始保洁", businessType = BusinessType.UPDATE)
@PostMapping(value = "startClean")
@PostMapping(value = "/startClean")
public AjaxResult startClean(@RequestBody SCleanRecords sCleanRecords)
{
sCleanRecords.setStartDate(DateUtil.date());
......@@ -93,8 +93,8 @@ public class SCleanRecordsController extends BaseController
/**
* 结束保洁
*/
@Log(title = "开始保洁", businessType = BusinessType.UPDATE)
@PostMapping(value = "endClean")
@Log(title = "结束保洁", businessType = BusinessType.UPDATE)
@PostMapping(value = "/endClean")
public AjaxResult endClean(@RequestBody SCleanRecords sCleanRecords)
{
sCleanRecords.setEndDate(DateUtil.date());
......@@ -102,5 +102,14 @@ public class SCleanRecordsController extends BaseController
return toAjax(sCleanRecordsService.updateSCleanRecords(sCleanRecords));
}
/**
* 通过房间ID查询保洁记录
*/
@GetMapping(value = "/getByRoomId/{roomId}")
public AjaxResult getByRoomId(@PathVariable("roomId") Long roomId)
{
return success(sCleanRecordsService.getByRoomId(roomId));
}
}
......@@ -39,7 +39,7 @@ public class SConsumerCouponController extends BaseController {
public TableDataInfo list( String useStatus) {
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
if(StringUtils.isNotBlank(useStatus)){
sConsumerCoupon.setUseStatus(useStatus);
sConsumerCoupon.setUseStatus(Integer.valueOf(useStatus));
}
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sConsumerCoupon.setConsumerId(user.getId());
......
......@@ -62,6 +62,15 @@ public class SOrderController extends BaseController
}
/**
* 开门
*/
@ApiOperation(value = "开门")
@RequestMapping(value = "/open/door", method = RequestMethod.POST)
public R<String> openDoor(@RequestBody Long id){
return R.ok(sOrderService.openDoor(id));
}
/**
* 下单
*/
@ApiOperation(value = "下单")
......
......@@ -68,4 +68,14 @@ public class SStoreController extends BaseController
return R.ok(sStoreService.listVo(request));
}
/**
* 保洁负责的门店
*/
@ApiOperation(value = "保洁负责的门店")
@RequestMapping(value = "/listVoByCleaner", method = RequestMethod.GET)
public R<List<SStoreVo>> listVoByCleaner()
{
return R.ok(sStoreService.listVoByCleaner());
}
}
......@@ -28,7 +28,7 @@ import share.system.service.ISysDictTypeService;
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/type")
@RequestMapping("/front/dict/type")
public class SysDictTypeController extends BaseController
{
@Autowired
......
package share.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.SCleanRecords;
import share.system.domain.SRoom;
/**
* 保洁记录Mapper接口
......@@ -9,7 +12,7 @@ import share.system.domain.SCleanRecords;
* @author ruoyi
* @date 2023-09-28
*/
public interface SCleanRecordsMapper
public interface SCleanRecordsMapper extends BaseMapper<SCleanRecords>
{
/**
* 查询保洁记录
......
......@@ -30,4 +30,7 @@ public interface SStoreConsumerMapper {
public int deleteInfo(SStoreConsumer storeConsumer);
public int deleteInfos(@Param("storeId") Long storeId, @Param("consumerIds") Long[] consumerIds);
List<String> selectByConsumerId(Long id);
}
......@@ -70,4 +70,6 @@ public interface ISCleanRecordsService
List<SCleanRecords> unCleanList(SCleanRecords sCleanRecords);
List<SCleanRecords> myCleanList(SCleanRecords sCleanRecords);
SCleanRecords getByRoomId(Long roomId);
}
......@@ -92,8 +92,10 @@ public interface ISOrderService extends IService<SOrder>
/**
* 通过订单编号查询订单
* @param valueOf
* @param orderNo
* @return
*/
SOrder getByOrderNo(String orderNo);
String openDoor(Long id);
}
......@@ -93,4 +93,6 @@ public interface ISStoreService extends IService<SStore>
int deleteStoreConsumers(Long storeId, Long[] consumerIds);
int insertStoreConsumers(Long storeId, Long[] consumerIds);
List<SStoreVo> listVoByCleaner();
}
package share.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.SConsumer;
import share.system.domain.SRoom;
import share.system.mapper.SCleanRecordsMapper;
import share.system.domain.SCleanRecords;
import share.system.mapper.SConsumerMapper;
......@@ -128,6 +131,13 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
return sCleanRecordsMapper.myCleanList(sCleanRecords);
}
@Override
public SCleanRecords getByRoomId(Long roomId) {
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper();
queryWrapper.in(SCleanRecords::getRoomId,roomId);
return sCleanRecordsMapper.selectOne(queryWrapper);
}
private void sendSms(Long storeId) {
List<SConsumer> list = sConsumerMapper.selectListByStoreId(storeId);
for (SConsumer consumer : list) {
......
......@@ -120,9 +120,8 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
public List<SConsumerCoupon> availableCouponList(CouponRequest couponRequest) {
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sConsumerCoupon.setUseStatus("0");
// sConsumerCoupon.setConsumerId(user.getId());
sConsumerCoupon.setConsumerId(1714160213741535234L);
sConsumerCoupon.setUseStatus(0);
sConsumerCoupon.setConsumerId(user.getId());
//查询用户未使用的优惠券
List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponMapper.selectSConsumerCouponList(sConsumerCoupon);
//计算时长
......
......@@ -160,7 +160,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
SConsumer currentUser = getInfo();
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon();
sConsumerCoupon.setConsumerId(currentUser.getId());
sConsumerCoupon.setUseStatus("0");
sConsumerCoupon.setUseStatus(0);
int count = sConsumerCouponService.selectSConsumerCouponConut(sConsumerCoupon);
if(count>0){
currentUser.setNumber(count);
......
......@@ -34,6 +34,7 @@ import share.system.domain.SConsumerCoupon;
import share.system.domain.SRoom;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.MyRecord;
import share.system.domain.vo.SRoomVo;
import share.system.domain.vo.WxPayJsResultVo;
import share.system.mapper.SOrderMapper;
import share.system.domain.SOrder;
......@@ -269,6 +270,29 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
return getOne(lqw);
}
@Override
public String openDoor(Long id) {
SOrder sOrder = sOrderMapper.selectSOrderById(id);
if (Objects.isNull(sOrder)) {
throw new BaseException("订单不存在!");
}
SRoomVo sRoomVo = roomService.selectSRoomById(sOrder.getRoomId());
if (Objects.isNull(sRoomVo)) {
throw new BaseException("房间不存在!");
}
//根据门锁编号,电机控制,密码进行开门
String doorLockCode = sRoomVo.getDoorLockCode();
String electricControlCode = sRoomVo.getElectricControlCode();
String password = sRoomVo.getPassword();
if(true){
//TODO 开门成功
return "开门成功";
}else{
//TODO 开门失败
return "开门失败";
}
}
private BigDecimal computeTotalPrice(BigDecimal unitPrice, Date startTime, Date endTime){
return DateUtils.differentHour(startTime,endTime).multiply(unitPrice);
}
......@@ -298,10 +322,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
if (ObjectUtil.isNull(consumerCoupon) || !consumerCoupon.getCouponId().equals(user.getId())) {
throw new BaseException("优惠券领取记录不存在!");
}
if (CouponStatusEnum.USED.getValue().compareTo(Integer.parseInt(consumerCoupon.getUseStatus())) == 0) {
if (CouponStatusEnum.USED.getValue().compareTo(consumerCoupon.getUseStatus()) == 0) {
throw new BaseException("此优惠券已使用!");
}
if (CouponStatusEnum.EXPIRED.getValue().compareTo(Integer.parseInt(consumerCoupon.getUseStatus())) == 0) {
if (CouponStatusEnum.EXPIRED.getValue().compareTo(consumerCoupon.getUseStatus()) == 0) {
throw new BaseException("此优惠券已失效!");
}
//判断是否在使用时间内
......
......@@ -61,7 +61,11 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
@Override
public List<SysDictType> selectDictTypeAll()
{
return dictTypeMapper.selectDictTypeAll();
List<SysDictType> sysDictTypes = dictTypeMapper.selectDictTypeAll();
sysDictTypes.forEach(item ->{
item.setDictDatas(dictDataMapper.selectDictDataByType(item.getDictType()));
});
return sysDictTypes;
}
/**
......
......@@ -16,6 +16,9 @@
<select id="countByStoreId" resultType="Integer">
select count(1) from s_store_consumer where store_id=#{storeId}
</select>
<select id="selectByConsumerId" resultType="java.lang.String">
select store_id from s_store_consumer where consumer_id=#{consumerId}
</select>
<delete id="deleteSStoreConsumer" parameterType="Long">
delete from s_store_consumer where consumer_id in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment