| | |
| | | import com.jilongda.manage.model.TCoupon; |
| | | import com.jilongda.manage.model.TCouponReceive; |
| | | import com.jilongda.manage.model.TOptometryDetail; |
| | | import com.jilongda.manage.model.TOrder; |
| | | import com.jilongda.manage.query.TOptometryQuery; |
| | | import com.jilongda.manage.service.*; |
| | | import com.jilongda.manage.utils.LoginInfoUtil; |
| | | import com.jilongda.manage.vo.TOptometryVO; |
| | | import com.jilongda.manage.vo.TOrderVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private TCouponReceiveService couponReceiveService; |
| | | @Autowired |
| | | private TCouponService couponService; |
| | | @Autowired |
| | | private TOrderService orderService; |
| | | @Autowired |
| | | private TOptometryDetailService optometryDetailService; |
| | | |
| | | @ApiOperation(value = "查询用户信息") |
| | | @GetMapping(value = "/getUserById") |
| | |
| | | @PostMapping(value = "/addOrder") |
| | | public ApiResult addOrder(@RequestBody TOrderDTO dto) { |
| | | |
| | | // 查询店员 |
| | | SecUser user = secUserService.getById(dto.getSysId()); |
| | | if(Objects.nonNull(user)){ |
| | | dto.setStoreId(user.getStoreId()); |
| | | } |
| | | orderService.save(dto); |
| | | |
| | | List<TOptometryDetail> optometryDetails = dto.getOptometryDetails(); |
| | | if (!CollectionUtils.isEmpty(optometryDetails)){ |
| | | for (TOptometryDetail optometryDetail : optometryDetails) { |
| | | optometryDetail.setOrderId(dto.getId()); |
| | | } |
| | | optometryDetailService.saveBatch(optometryDetails); |
| | | } |
| | | |
| | | // TODO 周哥 补库存 |
| | | |
| | | return ApiResult.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "销售订单详情") |
| | | @GetMapping(value = "/getOrderDetailById") |
| | | public ApiResult getOrderDetailById(@RequestParam Integer orderId) { |
| | | |
| | | TOrderVO orderVO = orderService.getOrderDetailById(orderId); |
| | | |
| | | // TODO 周哥 商品信息集合 |
| | | |
| | | // TODO 周哥 验光处方 判断是关联或者手动 |
| | | |
| | | |
| | | return ApiResult.success(orderVO); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.jilongda.manage.dto; |
| | | |
| | | import com.jilongda.manage.model.TOptometryDetail; |
| | | import com.jilongda.manage.model.TOrder; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "添加订单dto") |
| | | public class TOrderDTO extends TOrder { |
| | | |
| | | // @ApiModelProperty(value = "配镜处方") |
| | | // private |
| | | @ApiModelProperty(value = "手动添加配镜处方使用") |
| | | private List<TOptometryDetail> optometryDetails; |
| | | |
| | | } |
| | |
| | | |
| | | import com.jilongda.manage.model.TOrder; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.jilongda.manage.vo.TOrderVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOrderMapper extends BaseMapper<TOrder> { |
| | | |
| | | /** |
| | | * 销售订单详情 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | TOrderVO getOrderDetailById(@Param("orderId") Integer orderId); |
| | | |
| | | } |
| | |
| | | @TableField("optometryId") |
| | | private Integer optometryId; |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | |
| | | @ApiModelProperty(value = "球镜") |
| | | @TableField("ballMirror") |
| | | private Double ballMirror; |
| | |
| | | @ApiModelProperty(value = "微信昵称") |
| | | @TableField("name") |
| | | private Integer name; |
| | | @ApiModelProperty(value = "支付方式") |
| | | @TableField("payTypeName") |
| | | private String payTypeName; |
| | | |
| | | } |
| | |
| | | |
| | | import com.jilongda.manage.model.TOrder; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.jilongda.manage.vo.TOrderVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOrderService extends IService<TOrder> { |
| | | |
| | | /** |
| | | * 销售订单详情 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | TOrderVO getOrderDetailById(Integer orderId); |
| | | |
| | | } |
| | |
| | | import com.jilongda.manage.mapper.TOrderMapper; |
| | | import com.jilongda.manage.service.TOrderService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jilongda.manage.vo.TOrderVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> implements TOrderService { |
| | | |
| | | @Override |
| | | public TOrderVO getOrderDetailById(Integer orderId) { |
| | | return this.baseMapper.getOrderDetailById(orderId); |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "店铺名称") |
| | | private String storeName; |
| | | @ApiModelProperty(value = "员工昵称") |
| | | private String staffName; |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | } |
| | |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="isDelete" property="isDelete" /> |
| | | <result column="orderId" property="orderId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, type, optometryId, ballMirror, columnMirror, axis, add, pupilHeight, pupilDistance, correct, storeId, status, registerTime, createTime, updateTime, createBy, updateBy, isDelete |
| | | id, type, optometryId, ballMirror, columnMirror, axis, add, pupilHeight, pupilDistance, correct, storeId, |
| | | status, registerTime, createTime, updateTime, createBy, updateBy, isDelete,orderId |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | <result column="realName" property="realName" /> |
| | | <result column="age" property="age" /> |
| | | <result column="gender" property="gender" /> |
| | | <result column="payTypeName" property="payTypeName" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, userId, optometryId, storeId, modelId, color, series, rLens, lLens, type, refractiveIndex, createTime, updateTime, createBy, |
| | | id, code, userId, optometryId, storeId, modelId, color, series, rLens, lLens, `type`, refractiveIndex, createTime, updateTime, createBy, |
| | | updateBy, isDelete, sysId, couponId, itemsId, remark, isMail, mailName, mailPhone, mailAddress, orderMoney, couponMoney, payMoney, |
| | | isMachining, machiningCode, isAccounting, accountingName, accountingTime,phone, realName, age, gender |
| | | isMachining, machiningCode, isAccounting, accountingName, accountingTime,phone, realName, age, gender,payTypeName |
| | | </sql> |
| | | <select id="getOrderDetailById" resultType="com.jilongda.manage.vo.TOrderVO"> |
| | | select o.id, o.code, o.userId, o.optometryId, o.storeId, o.modelId, o.color, o.series, o.rLens, o.lLens, o.`type`, o.refractiveIndex, o.createTime, o.updateTime, o.createBy, |
| | | o.updateBy, o.isDelete, o.sysId, o.couponId, o.itemsId, o.remark, o.isMail, o.mailName, o.mailPhone, o.mailAddress, o.orderMoney, o.couponMoney, o.payMoney, |
| | | o.isMachining, o.machiningCode, o.isAccounting, o.accountingName, o.accountingTime,o.phone, o.realName, o.age, o.gender,o.payTypeName, |
| | | su.nick_name AS staffName,s.name AS storeName,tc.name AS couponName |
| | | from t_order o |
| | | left join sec_user su on o.sysId = su.id |
| | | left join t_store s on s.id = o.storeId |
| | | left join t_coupon_receive tcr on tcr.id = o.couponId |
| | | left join t_coupon tc on tc.id = tcr.couponId |
| | | </select> |
| | | |
| | | </mapper> |