Merge branch 'dev' of http://139.186.142.91:10010/r/productDev/parkBike into dev
| | |
| | | @PostMapping("/getTotalData") |
| | | @RequiresPermissions("business:goodsorder:query") |
| | | public ApiResponse<GoodsorderTotalDataVO> getTotalData (@RequestBody Goodsorder pageWrap) { |
| | | |
| | | pageWrap.setEndDate(pageWrap.getEndDate() != null ? pageWrap.getEndDate():pageWrap.getStartDate()); |
| | | return ApiResponse.success(goodsorderService.getTotalData(pageWrap)); |
| | | } |
| | | |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 自定义Realm,处理认证和权限 |
| | |
| | | * @date 2022/03/15 09:54 |
| | | */ |
| | | @Override |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException{ |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { |
| | | // 获取用户名 |
| | | String username = authenticationToken.getPrincipal().toString(); |
| | | // 根据用户名查询用户对象 |
| | |
| | | if(user == null){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,账号或密码不正确!"); |
| | | } |
| | | if(Objects.equals(user.getStatus(),Constants.ONE)){ |
| | | throw new AuthenticationException("用户已被禁用,请联系管理员"); |
| | | } |
| | | // 获取登录用户信息 |
| | | List<SystemRole> roles = systemRoleService.findByUserId(user.getId()); |
| | | List<SystemPermission> permissions = systemPermissionService.findByUserId(user.getId()); |
| | |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.model.Goodsorder; |
| | | import com.doumee.service.business.GoodsorderService; |
| | | import com.doumee.service.business.MemberRidesService; |
| | | import com.doumee.service.business.WxBillService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private GoodsorderService goodsorderService; |
| | | |
| | | |
| | | @Autowired |
| | | private MemberRidesService memberRidesService; |
| | | /** |
| | | * @throws Exception |
| | | */ |
| | |
| | | log.info("=====================结束每天自动结算======================="); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 定时刷新骑行中的数充值未开锁失败 |
| | | * 30 秒刷新一次 |
| | | * @throws Exception |
| | | */ |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | public void autoRefreshLockStatus() throws Exception { |
| | | log.info("=====================开始每天自动结算======================="); |
| | | memberRidesService.autoRefreshLockStatus(); |
| | | log.info("=====================结束每天自动结算======================="); |
| | | |
| | | } |
| | | } |
| | |
| | | import com.doumee.service.system.SystemPositionUserService; |
| | | import com.doumee.service.system.SystemUserRoleService; |
| | | import com.doumee.service.system.SystemUserService; |
| | | import com.google.common.base.Objects; |
| | | import org.apache.commons.lang3.RandomStringUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | |
| | | } |
| | | if (Constants.formatIntegerNum(user.getFixed())==Constants.ONE ) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "请勿删除" + user.getUsername() + ",因为这是固定用户"); |
| | | } |
| | | if ("admin".equals(user.getUsername())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "超级管理员账号不允许删除"); |
| | | } |
| | | systemUserService.deleteById(id); |
| | | } |
| | |
| | | queryUserDto.setUsername(systemUser.getMobile()); |
| | | SystemUser user = systemUserService.findOne(queryUserDto); |
| | | if (user != null) { |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名已存在"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "手机号码已存在"); |
| | | } |
| | | // 验证工号 |
| | | if (StringUtils.isNotBlank(systemUser.getEmpNo())) { |
| | |
| | | public void updateById(CreateSystemUserDTO systemUser) { |
| | | // 验证用户名 |
| | | SystemUser queryUserDto = new SystemUser(); |
| | | queryUserDto.setId(systemUser.getId()); |
| | | queryUserDto.setUsername(systemUser.getUsername()); |
| | | queryUserDto.setDeleted(Constants.ZERO); |
| | | SystemUser user = systemUserService.findOne(queryUserDto); |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在"); |
| | | } |
| | | } |
| | | if ("admin".equals(user.getUsername()) && Objects.equal(systemUser.getStatus(),1)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "超级管理员账号不允许禁用"); |
| | | } |
| | | // 修改用户 |
| | | systemUserService.updateById(systemUser); |
| | | // 设置部门 |
| | |
| | | public static final String BIKE_TYPE ="1,2,3,4,5,6,7,8" ; |
| | | public static String REDIS_DEBUG_STR="test_"; |
| | | public static final String AD = "AD"; |
| | | public static String REPAIR = "REPAIR"; |
| | | |
| | | public interface MqttTopic{ |
| | | |
| | | String topic_index = "device/lock/"; |
| | |
| | | return (int)diff + 1 ; |
| | | } |
| | | |
| | | public static Integer between(Date begin, Date end) { |
| | | if(begin ==null ){ |
| | | return 0; |
| | | } |
| | | long createTime =begin.getTime();//获取创建时间的时间戳 |
| | | long currentTime =Objects.isNull(end)?System.currentTimeMillis():end.getTime();//获取当前时间的时间戳 |
| | | long diff=(currentTime-createTime)/1000/60;//获取两个时间相差的分钟 |
| | | return (int)diff; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算耗时 |
| | |
| | | public class Goodsorder { |
| | | |
| | | @ApiModelProperty(value = "编码") |
| | | @ExcelColumn(name="订单编号",width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="订单编号",index = 2,width = 10,align = HorizontalAlignment.CENTER) |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | |
| | | private String memberName; |
| | | |
| | | @ApiModelProperty(value = "交易金额") |
| | | @ExcelColumn(name="押金(元)",width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="押金(元)",index = 4,width = 10,align = HorizontalAlignment.CENTER) |
| | | private BigDecimal money; |
| | | |
| | | @ApiModelProperty(value = "状态 0待支付 1已支付 2已取消 3支付失败 4已结算") |
| | |
| | | private String preOrderid; |
| | | |
| | | @ApiModelProperty(value = "在线交易单号") |
| | | @ExcelColumn(name="交易单号",width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="交易单号",index = 3,width = 10,align = HorizontalAlignment.CENTER) |
| | | private String onlineOrderid; |
| | | @ApiModelProperty(value = "支付状态 0待支付 1已支付") |
| | | private Integer payStatus; |
| | |
| | | private Integer payWay; |
| | | |
| | | @ApiModelProperty(value = "支付时间") |
| | | @ExcelColumn(name="交押金时间",width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="交押金时间",index = 5,width = 10,align = HorizontalAlignment.CENTER) |
| | | private Date payDate; |
| | | |
| | | @ApiModelProperty(value = "交易类型 0租车押金") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "结算金额(分)") |
| | | @ExcelColumn(name="结算金额",width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="结算金额(元)",index = 7,width = 10,align = HorizontalAlignment.CENTER) |
| | | private BigDecimal closeMoney; |
| | | |
| | | @ApiModelProperty(value = "结算退款单号(关联refund)") |
| | | private String closeId; |
| | | |
| | | @ApiModelProperty(value = "结算时间") |
| | | // @ExcelColumn(name="退款结算时间",width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="结算时间",index = 8,width = 10,align = HorizontalAlignment.CENTER) |
| | | private Date closeDate; |
| | | @ApiModelProperty(value = "结算备注") |
| | | private String closeInfo; |
| | |
| | | |
| | | @ApiModelProperty(value = "用户openid" ) |
| | | @TableField(exist = false) |
| | | @ExcelColumn(name="用户",index = 1 ,width = 10,align = HorizontalAlignment.CENTER) |
| | | private String openid; |
| | | |
| | | @ApiModelProperty(value = "查询开始日期(包含)", example = "2023-10-01 15:12:01") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | |
| | | @ApiModelProperty(value = "交易笔数", example = "0") |
| | | @TableField(exist = false) |
| | | private int countNum; |
| | | |
| | | @ApiModelProperty(value = "退款总额(分)") |
| | | @TableField(exist = false) |
| | | @ExcelColumn(name="退款总额(元)",width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="退押金(元)",index = 6,width = 10,align = HorizontalAlignment.CENTER) |
| | | private BigDecimal refundMoney; |
| | | |
| | | @ApiModelProperty(value = "最后退款时间") |
| | | @TableField(exist = false) |
| | | @ExcelColumn(name="退款结算时间",width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="退款结算时间",index = 9,width = 10,align = HorizontalAlignment.CENTER) |
| | | private Date refundDate; |
| | | |
| | | @ApiModelProperty(value = "最近骑行状态") |
| | |
| | | |
| | | @ApiModelProperty(value = "是否已删除 0未删除 1已删除", example = "1") |
| | | @ExcelColumn(name="是否已删除 0未删除 1已删除") |
| | | @TableLogic |
| | | // @TableLogic |
| | | private Integer isdeleted; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | |
| | | private String code; |
| | | @ApiModelProperty(value = "用户编码(关联member表)") |
| | | @ExcelColumn(name="用户",width = 10,index = 2,align = HorizontalAlignment.CENTER) |
| | | private String memberOpenid; |
| | | private String openid; |
| | | |
| | | @ApiModelProperty(value = "交易金额") |
| | | @ExcelColumn(name="支付金额",width = 10,index = 3,align = HorizontalAlignment.CENTER) |
| | |
| | | |
| | | |
| | | @ApiModelProperty(value = "支付时间") |
| | | @ExcelColumn(name="支付时间",width = 10,index = 4,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="支付时间",width = 10,index = 4,align = HorizontalAlignment.CENTER,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date payDate; |
| | | |
| | | @ApiModelProperty(value = "结算金额(分)") |
| | |
| | | private BigDecimal closeMoney; |
| | | |
| | | @ApiModelProperty(value = "结算时间") |
| | | @ExcelColumn(name="结算时间",width = 10,index = 6,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="结算时间",width = 10,index = 6,align = HorizontalAlignment.CENTER,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date closeDate; |
| | | |
| | | @ApiModelProperty(value = "退款金额(分)") |
| | |
| | | private BigDecimal refundMoney; |
| | | |
| | | @ApiModelProperty(value = "退款时间") |
| | | @ExcelColumn(name="退款时间",width = 10,index = 8,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="退款时间",width = 10,index = 8,align = HorizontalAlignment.CENTER,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date refundDate; |
| | | |
| | | } |
| | |
| | | @ExcelColumn(name="状态 ", valueMapping = "0=请求开锁中;1=骑行中;2=已还车;3=开锁失败;" ,index = 4,width = 10,align = HorizontalAlignment.CENTER) |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "借出时间起始") |
| | | private Date rentDateStart; |
| | | |
| | | @ApiModelProperty(value = "借出时间结束") |
| | | private Date rentDateEnd; |
| | | // @ApiModelProperty(value = "借出时间起始") |
| | | // private Date rentDateStart; |
| | | // |
| | | // @ApiModelProperty(value = "借出时间结束") |
| | | // private Date rentDateEnd; |
| | | |
| | | @ApiModelProperty(value = "是否归还 [车辆取还记录(站点) 入参]") |
| | | private Boolean hasBack; |
| | |
| | | |
| | | @ApiModelProperty(value = "还车类型 0正常还车 1强制还车") |
| | | private Integer backType; |
| | | |
| | | @ApiModelProperty(value = "借出时间起始") |
| | | private Date startDate; |
| | | |
| | | @ApiModelProperty(value = "借出时间结束") |
| | | private Date endDate; |
| | | } |
| | |
| | | private Date backDate; |
| | | |
| | | @ApiModelProperty(value = "状态 0请求开锁中 1骑行中 2已还车 3开锁失败") |
| | | @ExcelColumn(name="状态 ", valueMapping = "0=请求开锁中;1=骑行中;2=已还车;3=开锁失败;" ,index = 5,width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="状态 ", valueMapping = "0=请求开锁中;1=骑行中;2=已还车;3=开锁失败;" ,width = 10,align = HorizontalAlignment.CENTER) |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "结算状态") |
| | | @ExcelColumn(name="结算状态 ", valueMapping = "0=未结算;1=已结算;" ,index = 4,width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="结算状态 ", valueMapping = "0=未结算;1=已结算;" ,width = 10,align = HorizontalAlignment.CENTER) |
| | | private Integer closeStatus; |
| | | } |
| | |
| | | private Integer closeStatus; |
| | | |
| | | @ApiModelProperty(value = "状态 0请求开锁中 1骑行中 2已还车 3开锁失败") |
| | | @ExcelColumn(name="状态 ", valueMapping = "0=请求开锁中;1=骑行中;2=已还车;3=开锁失败;" ,index = 5,width = 10,align = HorizontalAlignment.CENTER) |
| | | // @ExcelColumn(name="状态 ", valueMapping = "0=请求开锁中;1=骑行中;2=已还车;3=开锁失败;" ,index = 5,width = 10,align = HorizontalAlignment.CENTER) |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "骑行时长") |
| | |
| | | private Integer duration; |
| | | |
| | | @ApiModelProperty(value = "租车时间") |
| | | @ExcelColumn(name="租车时间",index = 8,width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="租车时间",index = 8,width = 10,align = HorizontalAlignment.CENTER,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date rentDate; |
| | | |
| | | @ApiModelProperty(value = "还车时间") |
| | | @ExcelColumn(name="还车时间",index = 9,width = 10,align = HorizontalAlignment.CENTER) |
| | | @ExcelColumn(name="还车时间",index = 9,width = 10,align = HorizontalAlignment.CENTER,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date backDate; |
| | | |
| | | @ApiModelProperty(value = "租车站点编码") |
| | |
| | | @ApiModelProperty(value = "手机号码") |
| | | private String mobile; |
| | | |
| | | @ApiModelProperty(value = "用户状态") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "用户角色") |
| | | private Integer roleId; |
| | | } |
| | |
| | | int mqttCloseBikeEvent(MemberRides bikes); |
| | | |
| | | int mqttLockInfoEvent(Locks locks); |
| | | |
| | | void autoRefreshLockStatus(); |
| | | } |
| | |
| | | .selectAs(BikeRepair::getBinkeId,BikeRepairDTO::getBikeCode) |
| | | .selectAs(BaseParam::getName,BikeRepairDTO::getBikeTypeName); |
| | | queryWrapper.like(StringUtils.isNotEmpty(pageWrap.getModel().getOpenid()),Member::getOpenid,pageWrap.getModel().getOpenid()) |
| | | .like(StringUtils.isNotEmpty(pageWrap.getModel().getBikeCode()),Bikes::getCode,pageWrap.getModel().getBikeCode()) |
| | | .like(StringUtils.isNotEmpty(pageWrap.getModel().getBikeCode()),BikeRepair::getBinkeId,pageWrap.getModel().getBikeCode()) |
| | | .eq( pageWrap.getModel().getStatus() !=null,BikeRepair::getStatus,pageWrap.getModel().getStatus()) |
| | | .ge(Objects.nonNull(pageWrap.getModel().getStartDate()),BikeRepair::getCreateDate,pageWrap.getModel().getStartDate()) |
| | | .le(Objects.nonNull(pageWrap.getModel().getEndDate()),BikeRepair::getCreateDate,pageWrap.getModel().getEndDate()); |
| | |
| | | .eq(Multifile::getIsdeleted,Constants.ZERO); |
| | | List<Multifile> multifiles = multifileMapper.selectList(wrapper); |
| | | //TODO 需要修改 |
| | | String path =systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+ systemDictDataBiz.queryByCode(Constants.OSS, Constants.PROJECT_FILE).getCode(); |
| | | String path =systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode()+ systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.REPAIR).getCode(); |
| | | if (!CollectionUtils.isEmpty(multifiles)){ |
| | | multifiles.forEach(s->{ |
| | | if(StringUtils.isNotBlank(s.getFileurl())){ |
| | |
| | | import com.doumee.dao.business.model.MemberRides; |
| | | import com.doumee.dao.business.vo.GoodsorderExportVO; |
| | | import com.doumee.dao.business.vo.GoodsorderTotalDataVO; |
| | | import com.doumee.dao.business.web.request.BikeRepairDTO; |
| | | import com.doumee.dao.business.web.request.GoodsorderCanBanlanceDTO; |
| | | import com.doumee.dao.business.web.request.MemberRidesQuery; |
| | | import com.doumee.dao.business.web.request.RefundDTO; |
| | |
| | | IPage<Goodsorder> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | pageWrap.getModel().setPayStatus(Constants.ONE); //只查询支付成功的 |
| | | MPJLambdaWrapper<Goodsorder> queryWrapper = initQueryParamByModel(pageWrap.getModel()); |
| | | return PageData.from(goodsorderJoinMapper.selectJoinPage(page, GoodsorderExportVO.class,queryWrapper)); |
| | | IPage<GoodsorderExportVO> goodsorderExportVOIPage = goodsorderJoinMapper.selectJoinPage(page, GoodsorderExportVO.class, queryWrapper); |
| | | if (!CollectionUtils.isEmpty(goodsorderExportVOIPage.getRecords())){ |
| | | goodsorderExportVOIPage.getRecords().forEach(s->{ |
| | | s.setMoney(Constants.translateMoney(s.getMoney())); |
| | | s.setRefundMoney(Constants.translateMoney(s.getRefundMoney())); |
| | | }); |
| | | } |
| | | return PageData.from(goodsorderExportVOIPage); |
| | | } |
| | | @Override |
| | | public List<GoodsorderExportVO> findExportAccountDetailPage(Goodsorder model){ |
| | | model.setPayStatus(Constants.ONE); //只查询支付成功的 |
| | | MPJLambdaWrapper<Goodsorder> queryWrapper = initQueryParamByModel(model); |
| | | List<GoodsorderExportVO> goodsorderList = goodsorderJoinMapper.selectJoinList(GoodsorderExportVO.class,queryWrapper); |
| | | if (!CollectionUtils.isEmpty(goodsorderList)){ |
| | | goodsorderList.forEach(s->{ |
| | | s.setMoney(Constants.translateMoney(s.getMoney())); |
| | | s.setCloseMoney(Constants.translateMoney(s.getCloseMoney())); |
| | | s.setRefundMoney(Constants.translateMoney(s.getRefundMoney())); |
| | | }); |
| | | } |
| | | /* List<GoodsorderExportVO> list = new ArrayList<>(); |
| | | if(goodsorderList!=null){ |
| | | for(Goodsorder order : goodsorderList){ |
| | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | @Override |
| | | public void closeGoodsorder( Goodsorder goodsorder ,int type ) { |
| | | |
| | | // |
| | | List<MemberRides> memberRides = getMemberRidesForClose(goodsorder.getId()); |
| | | //默认结算为押金金额 |
| | | BigDecimal closeMoney = new BigDecimal(0.00); |
| | |
| | | if(Constants.REFUND_TYPE.PLAT_FORCE.getKey() == type){ |
| | | //如果是强制结算 |
| | | update.setCloseType(Constants.ONE); |
| | | LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | update.setEditor(principal.getId()); |
| | | }else if(Constants.REFUND_TYPE.NORMAL.getKey() == type){ |
| | | //如果是自行結算 |
| | | update.setCloseType(Constants.ZERO); |
| | |
| | | refundDTO.setTotalAmount(goodsorder.getMoney()); |
| | | refundDTO.setMemberId(goodsorder.getMemberId()); |
| | | refundDTO.setReason(Constants.REFUND_TYPE.get(type).getName()); |
| | | refundDTO.setCreator(update.getEditor()); |
| | | refundDTO.setType(type); |
| | | Refund refund = wxMiniUtilService.wxRefund(refundDTO); |
| | | update.setCloseId(refund.getId()); |
| | |
| | | BigDecimal refundMoney = total == null?new BigDecimal(0):Constants.formatDecimalNum(total.getMoney()); |
| | | //可退剩余 单位元 |
| | | BigDecimal canBalance =Constants.translateMoney(Constants.formatDecimalNum(goodsorder.getMoney()).subtract(refundMoney)); |
| | | if(canBalance.compareTo(money) > Constants.ZERO){ |
| | | if(canBalance.compareTo(money) >= Constants.ZERO){ |
| | | RefundDTO refundDTO = new RefundDTO(); |
| | | refundDTO.setOrderId(orderId); |
| | | refundDTO.setCanBalance(canBalance); |
| | |
| | | BigDecimal reduce = total!=null?Constants.formatDecimalNum(total.getMoney()):new BigDecimal(0); |
| | | goodsorderCanBanlanceDTO.setHasRefundMoney(Constants.translateMoney(reduce)); |
| | | |
| | | BigDecimal subtract = Constants.translateMoney(goodsorder.getMoney()).subtract(goodsorderCanBanlanceDTO.getCloseMoney()).subtract(goodsorderCanBanlanceDTO.getHasRefundMoney()); |
| | | BigDecimal subtract = Constants.translateMoney(goodsorder.getMoney()).subtract(goodsorderCanBanlanceDTO.getHasRefundMoney()); |
| | | goodsorderCanBanlanceDTO.setCanBanlanceMoney(subtract.compareTo(new BigDecimal("0")) > 0 ? subtract : new BigDecimal("0")); |
| | | return goodsorderCanBanlanceDTO; |
| | | } |
| | |
| | | model.setPayNum(0); |
| | | model.setRefundNum(0); |
| | | QueryWrapper<Goodsorder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.lambda().ge(param.getStartDate() !=null,Goodsorder::getPayDate,DateUtil.getShortDateStr(param.getStartDate())); |
| | | queryWrapper.lambda().le(param.getEndDate() !=null,Goodsorder::getPayDate,DateUtil.getShortDateStr(param.getEndDate())); |
| | | if(Objects.nonNull(param.getStartDate())){ |
| | | queryWrapper.lambda().ge(param.getStartDate() !=null,Goodsorder::getPayDate, Utils.Date.getStart(param.getStartDate())); |
| | | } |
| | | if(Objects.nonNull(param.getEndDate())) { |
| | | queryWrapper.lambda().le(param.getEndDate() != null, Goodsorder::getPayDate, Utils.Date.getEnd(param.getEndDate())); |
| | | } |
| | | queryWrapper.lambda().eq(Goodsorder::getPayStatus, Constants.ONE);//已支付 |
| | | queryWrapper.lambda().eq(Goodsorder::getIsdeleted, Constants.ZERO); |
| | | queryWrapper.lambda().groupBy(Goodsorder::getStatus); |
| | | queryWrapper.select( "count(id) as count_num" |
| | | ,"sum(money) as money" ); |
| | | queryWrapper.select( "status ","count(id) as count_num" |
| | | ,"sum(money) as money","sum(close_money) as close_money" ); |
| | | //按订单状态分组统计 |
| | | List<Goodsorder> detailList = goodsorderMapper.selectList(queryWrapper); |
| | | for(Goodsorder goodsorder : detailList){ |
| | | if(Constants.formatIntegerNum(goodsorder.getStatus()) == Constants.GOODSORDER_STATUS.CLOSE.getKey()){ |
| | | //已结算 |
| | | model.setClosedNum(model.getClosedNum()+goodsorder.getCountNum()); |
| | | model.setClosedMoney(model.getClosedMoney().add(Constants.formatDecimalNum(goodsorder.getCloseMoney()))); |
| | | model.setClosedMoney(model.getClosedMoney().add(Constants.translateMoney(goodsorder.getCloseMoney()))); |
| | | |
| | | model.setPayNum(model.getPayNum()+goodsorder.getCountNum()); |
| | | model.setPayMoney(model.getPayMoney().add(Constants.formatDecimalNum(goodsorder.getMoney()))); |
| | | model.setPayMoney(model.getPayMoney().add(Constants.translateMoney(goodsorder.getMoney()))); |
| | | }else if(Constants.formatIntegerNum(goodsorder.getStatus()) == Constants.GOODSORDER_STATUS.HAVING_PAY.getKey()){ |
| | | //已支付未结算 |
| | | model.setUnClosedNum(model.getUnClosedNum()+goodsorder.getCountNum()); |
| | | model.setUnClosedMoney(model.getUnClosedMoney().add(Constants.formatDecimalNum(goodsorder.getMoney()))); |
| | | model.setUnClosedMoney(model.getUnClosedMoney().add(Constants.translateMoney(goodsorder.getMoney()))); |
| | | |
| | | model.setPayNum(model.getPayNum()+goodsorder.getCountNum()); |
| | | model.setPayMoney(model.getPayMoney().add(Constants.formatDecimalNum(goodsorder.getMoney()))); |
| | | model.setPayMoney(model.getPayMoney().add(Constants.translateMoney(goodsorder.getMoney()))); |
| | | } |
| | | } |
| | | QueryWrapper<Refund> queryWrapper2 = new QueryWrapper<>(); |
| | | queryWrapper2.lambda().ge(param.getStartDate() !=null,Refund::getDoneDate,DateUtil.getShortDateStr(param.getStartDate())); |
| | | queryWrapper2.lambda().le(param.getEndDate() !=null,Refund::getDoneDate,DateUtil.getShortDateStr(param.getEndDate())); |
| | | queryWrapper2.lambda().ge(param.getStartDate() !=null,Refund::getDoneDate,Utils.Date.getStart(param.getStartDate())); |
| | | queryWrapper2.lambda().le(param.getEndDate() !=null,Refund::getDoneDate,Utils.Date.getEnd(param.getEndDate())); |
| | | queryWrapper2.lambda().eq(Refund::getIsdeleted, Constants.ZERO); |
| | | queryWrapper2.select( "count(id) as count_num" |
| | | ,"sum(money) as money" ); |
| | |
| | | Refund refund = refundMapper.selectOne(queryWrapper2.last("limit 1")); |
| | | if(refund !=null){ |
| | | model.setRefundNum(Constants.formatIntegerNum(refund.getCountNum())); |
| | | model.setRefundMoney( Constants.formatDecimalNum(refund.getMoney())); |
| | | model.setRefundMoney(Constants.translateMoney(Constants.formatDecimalNum(refund.getMoney()))); |
| | | } |
| | | return model; |
| | | } |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | |
| | | List<MemberRides> memberRides = memberRidesJoinMapper.selectList(new QueryWrapper<MemberRides>() |
| | | .lambda().eq(MemberRides::getOrdreId,id).orderByDesc(MemberRides::getCreateDate)); |
| | | List<MemberRides> memberRides = memberRidesJoinMapper.selectJoinList(MemberRides.class,new MPJLambdaWrapper<MemberRides>() |
| | | .selectAll(MemberRides.class) |
| | | .selectAs(BaseParam::getName,MemberRides::getParamName) |
| | | .leftJoin(BaseParam.class,BaseParam::getId,MemberRides::getParamId) |
| | | .eq(MemberRides::getOrdreId,id) |
| | | .in(MemberRides::getStatus,Constants.MEMBER_RIDES_STATUS.RIDES_RUNNING.getKey(),Constants.MEMBER_RIDES_STATUS.BACK_CYCLING.getKey()) |
| | | .orderByDesc(MemberRides::getCreateDate)); |
| | | if (!CollectionUtils.isEmpty(memberRides)){ |
| | | //预计结算价格和计算时长 |
| | | int freeTime = 0; |
| | |
| | | .leftJoin(BaseParam.class,BaseParam::getId,MemberRides::getParamId) |
| | | .like(StringUtils.isNotBlank(model.getOpenid()),Member::getOpenid,model.getOpenid()) |
| | | .like(StringUtils.isNotBlank(model.getBikeCode()),MemberRides::getBikeCode,model.getBikeCode()); |
| | | queryWrapper.ge(model.getRentDateStart()!=null, MemberRides::getRentDate,model.getRentDateStart()); |
| | | queryWrapper.le(model.getRentDateEnd()!=null, MemberRides::getRentDate,model.getRentDateEnd()); |
| | | if (Objects.nonNull(model.getStartDate())) { |
| | | queryWrapper.ge(MemberRides::getRentDate, Utils.Date.getStart(model.getStartDate())); |
| | | } |
| | | if (Objects.nonNull(model.getEndDate())) { |
| | | queryWrapper.le(MemberRides::getRentDate, Utils.Date.getStart(model.getEndDate())); |
| | | } |
| | | queryWrapper.eq(model.getCloseStatus()!=null,MemberRides::getCloseStatus, model.getCloseStatus()); |
| | | queryWrapper.eq(model.getStatus()!=null,MemberRides::getStatus, model.getStatus()); |
| | | queryWrapper.eq(model.getGoodsorderId()!=null,MemberRides::getOrdreId, model.getGoodsorderId()); |
| | |
| | | log.setActInfo(memberRides.getBackInfo()); |
| | | log.setActReason(memberRides.getBackReason()); |
| | | log.setIsdeleted(Constants.ZERO); |
| | | log.setCreateDate(update.getBackDate()); |
| | | log.setCreateDate(new Date()); |
| | | log.setCreator(user.getId()); |
| | | log.setBeforeContent(beforeContent); |
| | | log.setAfterContent(after); |
| | |
| | | ActionLog log = new ActionLog(); |
| | | log.setId(Constants.getUUID()); |
| | | log.setIsdeleted(Constants.ZERO); |
| | | log.setCreateDate(update.getBackDate()); |
| | | log.setCreateDate(new Date()); |
| | | log.setCreator(user.getId()); |
| | | log.setBeforeContent(beforeContent); |
| | | log.setAfterContent(after); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void autoRefreshLockStatus() { |
| | | |
| | | QueryWrapper<MemberRides> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(MemberRides::getStatus,Constants.MEMBER_RIDES_STATUS.LOCKING.getKey()) |
| | | .eq(MemberRides::getIsdeleted,Constants.ZERO); |
| | | List<MemberRides> memberRides = memberRidesMapper.selectList(wrapper); |
| | | if (!CollectionUtils.isEmpty(memberRides)){ |
| | | memberRides.forEach(s->{ |
| | | Integer between = DateUtil.between(s.getCreateDate(), new Date()); |
| | | // 大于阈值 |
| | | if (between > 2){ |
| | | s.setStatus(Constants.MEMBER_RIDES_STATUS.LOCKING_DEFEAT.getKey()); |
| | | memberRidesMapper.updateById(s); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | private Bikes dealBikesByParam(Locks model) { |
| | | if(StringUtils.isNotBlank(model.getBikeCode())){ |
| | | UpdateWrapper<Bikes> updateWrapper = new UpdateWrapper<>(); |
| | |
| | | model.setCreateDate(date); |
| | | model.setStatus(locks.getStatus()); |
| | | locksMapper.insert(model); |
| | | //更新 站点锁头数量 |
| | | if(Objects.nonNull(sites)){ |
| | | Sites sites1 = new Sites(); |
| | | sites1.setId(sites.getId()); |
| | | sites1.setLockNum(sites.getLockNum()+1); |
| | | sitesMapper.updateById(sites1); |
| | | } |
| | | }else{ |
| | | UpdateWrapper<Locks> updateWrapper = new UpdateWrapper<Locks>(); |
| | | updateWrapper.lambda().eq(Locks::getCode, locks.getCode() ); |
| | |
| | | insert.setHolidayBasePrice(Constants.formatDecimalNum(pricingDetail.getHolidayBasePrice()).multiply(new BigDecimal(100))); |
| | | insert.setHolidayUnitPrice(Constants.formatDecimalNum(pricingDetail.getHolidayUnitPrice()).multiply(new BigDecimal(100))); |
| | | insert.setInfo(pricingDetail.getInfo()); |
| | | String title = getRoleNameByParam(pricingDetail.getBasePrice(),pricingDetail.getBaseTime(),pricingDetail.getUnitPrice(),pricingDetail.getUnitTime()); |
| | | String info = getRoleNameByParam(pricingDetail.getHolidayBasePrice(),pricingDetail.getHolidayBaseTime(),pricingDetail.getHolidayUnitPrice(),pricingDetail.getHolidayUnitTime());; |
| | | String title = getRoleNameByParam(insert.getBasePrice(),insert.getBaseTime(),insert.getUnitPrice(),insert.getUnitTime()); |
| | | String info = getRoleNameByParam(insert.getHolidayBasePrice(),insert.getHolidayBaseTime(),insert.getHolidayUnitPrice(),insert.getHolidayUnitTime());; |
| | | insert.setTitle(title);//工作日计价配置规则 |
| | | insert.setInfo(info);//节假日计价配置规则 |
| | | pricingDetailMapper.insert(insert); |
| | |
| | | public static String getRoleNameByParam(BigDecimal basePrice, Integer baseTime, BigDecimal unitPrice, Integer unitTime) { |
| | | String title = "计费规则:"; |
| | | if(baseTime < 0){ |
| | | title = basePrice.doubleValue()+"元畅骑一整天"; |
| | | title = (basePrice.divide(new BigDecimal(100))).doubleValue()+"元畅骑一整天"; |
| | | }else { |
| | | title = "起步"; |
| | | int time = baseTime / 60; |
| | |
| | | if(min >0){ |
| | | title += min+"分钟"; |
| | | } |
| | | title += basePrice.doubleValue() |
| | | +"元,超过后"+unitPrice.doubleValue()+"元/" |
| | | title += basePrice.divide(new BigDecimal(100)).doubleValue() |
| | | +"元,超过后"+unitPrice.divide(new BigDecimal(100)).doubleValue()+"元/" |
| | | +unitTime+"分钟"; |
| | | } |
| | | return title; |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"该定价方案下没有配置价格"); |
| | | } |
| | | List<String> collect = pricingDetails.stream().map(s -> s.getBikeTypeId()).collect(Collectors.toList()); |
| | | boolean b = baseParams.stream().map(s -> s.getId()).anyMatch(s -> collect.contains(s)); |
| | | boolean b = baseParams.stream().map(s -> s.getId()).allMatch(s -> collect.contains(s)); |
| | | |
| | | if (b){ |
| | | if (!b){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"该定价方案下没有配置完整"); |
| | | } |
| | | PricingParam pricingParam1 = new PricingParam(); |
| | |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"站点编号已存在"); |
| | | } |
| | | Sites insert = new Sites(); |
| | | insert.setId(sites.getCode()); |
| | | insert.setCreateDate(new Date()); |
| | | insert.setCreator(principal.getId()); |
| | | insert.setEditDate(new Date()); |
| | |
| | | insert.setInfo(sites.getInfo()); |
| | | insert.setName(sites.getName()); |
| | | insert.setCode(sites.getCode()); |
| | | insert.setStatus(sites.getStatus()); |
| | | insert.setStatus(Constants.ZERO); |
| | | insert.setLockNum(sites.getLockNum()); |
| | | insert.setIp(sites.getIp()); |
| | | sitesMapper.insert(sites); |
| | | sitesMapper.insert(insert); |
| | | return sites.getId(); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void updateById(Sites sites) { |
| | | LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | QueryWrapper<Sites> wrapper = new QueryWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(Sites::getCode,sites.getCode()); |
| | | Sites count = sitesMapper.selectOne(wrapper); |
| | | if (Objects.nonNull(count) && !count.getId().equals(sites.getId())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"站点编号已存在"); |
| | | } |
| | | Sites update = new Sites(); |
| | | update.setId(sites.getId()); |
| | | update.setCreateDate(new Date()); |
| | | update.setEditor(principal.getId()); |
| | | update.setName(sites.getName()); |
| | |
| | | QueryWrapper<Sites> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | queryWrapper.select("*,(select count(r.id) from locks r where r.site_id = sites.id) as all_lock_num" + |
| | | ",(select count(r.bike_code) from locks r where r.site_id = sites.id and r.bike_code is null and r.bike_code !='' ) as bikeCount"); |
| | | ",(select count(l.bike_code) from locks l where l.site_id = sites.id and l.bike_code IS NOT NULL and l.bike_code !='' ) as bikeCount"); |
| | | // Page<SitesMonitorDTO> sitesMonitorDTO = sitesMapper.getSitesMonitorDTO(page, pageWrap.getModel().getCode(), pageWrap.getModel().getName()); |
| | | queryWrapper.lambda().like(StringUtils.isNotBlank(pageWrap.getModel().getCode()),Sites::getCode,pageWrap.getModel().getCode()); |
| | | queryWrapper.lambda().like(StringUtils.isNotBlank(pageWrap.getModel().getName()),Sites::getCode,pageWrap.getModel().getName()); |
| | | queryWrapper.lambda().like(StringUtils.isNotBlank(pageWrap.getModel().getName()),Sites::getName,pageWrap.getModel().getName()); |
| | | queryWrapper.lambda().orderByAsc(Sites::getCode); |
| | | IPage<Sites> sitesMonitorDTO = sitesMapper.selectPage(page, queryWrapper); |
| | | if (!CollectionUtils.isEmpty(sitesMonitorDTO.getRecords())){ |
| | | sitesMonitorDTO.getRecords().forEach(s->{ |
| | | if(Constants.formatIntegerNum(s.getAllLockNum()) >0){ |
| | | s.setRate(new BigDecimal(s.getBikeCount()).divide(new BigDecimal(s.getAllLockNum()),BigDecimal.ROUND_UP).setScale(2)); |
| | | s.setRate(new BigDecimal(s.getBikeCount()).divide(new BigDecimal(s.getAllLockNum()),2,BigDecimal.ROUND_HALF_UP)); |
| | | }else{ |
| | | s.setRate(new BigDecimal(0.0)); |
| | | } |
| | |
| | | String jasonStr = MiniProgrammeDTO.toUnderlineJSONString(miniProgrammeDTO); |
| | | JSONObject parse = (JSONObject) JSONObject.parse(jasonStr); |
| | | parse.entrySet().forEach(s->{ |
| | | if (StringUtils.isNotBlank((String)s.getValue())){ |
| | | // if (StringUtils.isNotBlank((String)s.getValue())){ |
| | | UpdateWrapper<SystemDictData> wrapper = new UpdateWrapper<>(); |
| | | wrapper.lambda() |
| | | .eq(SystemDictData::getLabel,s.getKey().toUpperCase()) |
| | | .set(SystemDictData::getCode,s.getValue()); |
| | | systemDictDataMapper.update(null,wrapper); |
| | | } |
| | | // } |
| | | }); |
| | | } catch (JsonProcessingException e) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"字典值解析有误"); |
| | |
| | | loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); |
| | | loginLog.setSuccess(Constants.ONE); |
| | | systemLoginLogService.create(loginLog); |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT.getCode(),e.getCause().getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | mchKey: u4TSNtv0wFP7WRfnxBgijYOtRhS9FvlM |
| | | # notifyUrl: http://xiaopiqiu.natapp1.cc/api/wxPayNotify |
| | | notifyUrl: https://dmtest.ahapp.net/bike_h5_api/api/wxPayNotify |
| | | keyPath: D:\DouMee\config\doumeeTest\apiclient_cert.p12 |
| | | # keyPath: /usr/local/apiclient_cert.p12 |
| | | # keyPath: D:\DouMee\config\doumeeTest\apiclient_cert.p12 |
| | | keyPath: /usr/local/apiclient_cert.p12 |
| | | ########################mqtt相关配置######################## |
| | | mqtt: |
| | | host: tcp://175.27.187.84:1883 |
| | |
| | | select |
| | | distinct |
| | | usr.id, usr.birthday, usr.email, usr.emp_no, usr.mobile, usr.avatar, usr.username, usr.realname, usr.sex, usr.fixed, usr.create_time, usr.update_time, |
| | | usr.nickname, |
| | | usr.nickname,usr.status, |
| | | create_user.id create_user_id, create_user.username create_user_name, |
| | | update_user.id updete_user_id, update_user.username update_user_name |
| | | from "system_user" usr |
| | | left join "system_user" create_user on create_user.id = usr.create_user |
| | | left join "system_user" update_user on update_user.id = usr.update_user |
| | | left join "system_user_role" sur on sur.user_id = usr.id |
| | | <where> |
| | | usr.deleted = 0 |
| | | <if test="dto.username != null and dto.username != ''"> |
| | |
| | | <if test="dto.mobile != null and dto.mobile != ''"> |
| | | AND usr.mobile LIKE '%'||#{dto.mobile}||'%' |
| | | </if> |
| | | <if test="dto.status != null "> |
| | | AND usr.status = #{dto.status} |
| | | </if> |
| | | <if test="dto.roleId != null and dto.roleId != ''"> |
| | | AND sur.role_id = #{dto.roleId} |
| | | </if> |
| | | |
| | | </where> |
| | | </select> |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | JwtPayLoad payLoad = new JwtPayLoad("d0a92489d26d43e182a1b8b75e1d9836"); |
| | | JwtPayLoad payLoad = new JwtPayLoad("07a9f07178864e57bf1fb34e7a321f08"); |
| | | System.out.println(JwtTokenUtil.generateToken(payLoad)); |
| | | } |
| | | |
| | |
| | | # application: |
| | | # name: parkbike |
| | | profiles: |
| | | active: dev |
| | | active: test |
| | | # JSON返回配置 |
| | | jackson: |
| | | # 默认时区 |