PC下单接口

This commit is contained in:
kuang.yife 2023-05-21 22:14:44 +08:00
parent d78b636d6b
commit eb8a213cc4
6 changed files with 65 additions and 3 deletions

View File

@ -171,6 +171,8 @@ public class OrderController extends BaseController {
customerAddress.setCountryId(request.getDistrictId()); customerAddress.setCountryId(request.getDistrictId());
customerAddress.setAddress(request.getFullAddress()); customerAddress.setAddress(request.getFullAddress());
customerAddress.setIsDefault(0); customerAddress.setIsDefault(0);
customerAddress.setPhone(request.getCustomerPhone());
customerAddress.setName(request.getCustomerName());
customerAddressService.insertCustomerAddress(customerAddress); customerAddressService.insertCustomerAddress(customerAddress);
} }
@ -205,13 +207,12 @@ public class OrderController extends BaseController {
standard.setGoodsPrice(goodsPrice); standard.setGoodsPrice(goodsPrice);
standard.setGoodsId(goods.getGoodsId()); standard.setGoodsId(goods.getGoodsId());
standard.setExtMoney(BigDecimal.ZERO); standard.setExtMoney(BigDecimal.ZERO);
standard.setGoodsNum(999); standard.setGoodsNum(list.getGoodsStandardNum());
standard.setSaleNum(0); standard.setSaleNum(0);
goodsStandardService.insertGoodsStandard(standard);
goodsStandards.add(standard); goodsStandards.add(standard);
}); });
goodsStandardService.batchInsert(goodsStandards);
// 生成主单 // 生成主单
OrderMaster orderMaster = new OrderMaster(); OrderMaster orderMaster = new OrderMaster();
orderMaster.setDeptId(deptId); orderMaster.setDeptId(deptId);
@ -223,6 +224,14 @@ public class OrderController extends BaseController {
orderMaster.setCreateTime(new Date()); orderMaster.setCreateTime(new Date());
orderMaster.setCustomerId(customer.getCustomerId()); orderMaster.setCustomerId(customer.getCustomerId());
orderMaster.setGoodsId(goods.getGoodsId()); orderMaster.setGoodsId(goods.getGoodsId());
// 服务时间
String[] split = request.getServTime().split("-");
try {
orderMaster.setExpectTimeStart(DateUtils.parseDate(request.getServDate()+" "+split[0], "yyyy-MM-dd hh:mm"));
orderMaster.setExpectTimeEnd(DateUtils.parseDate(request.getServDate()+" "+split[1], "yyyy-MM-dd hh:mm"));
}catch (Exception e){
}
orderMasterService.insertOrderMaster(orderMaster); orderMasterService.insertOrderMaster(orderMaster);
Assert.notNull(orderMaster.getId(), "OrderMaster.id is null!"); Assert.notNull(orderMaster.getId(), "OrderMaster.id is null!");

View File

@ -1,5 +1,6 @@
package com.ghy.goods.mapper; package com.ghy.goods.mapper;
import com.ghy.goods.domain.Goods;
import com.ghy.goods.domain.GoodsStandard; import com.ghy.goods.domain.GoodsStandard;
import com.ghy.goods.request.AppGoodsRequest; import com.ghy.goods.request.AppGoodsRequest;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -14,6 +15,12 @@ import java.util.List;
*/ */
public interface GoodsStandardMapper { public interface GoodsStandardMapper {
/**
* @param goodsStandard 规格属性
* @return 成功条数
*/
int insertGoodsStandard(GoodsStandard goodsStandard);
/** /**
* @param goodsStandardId 规格id * @param goodsStandardId 规格id
* @return 规格实体 * @return 规格实体

View File

@ -40,6 +40,7 @@ public interface GoodsStandardService {
*/ */
int batchInsert(List<GoodsStandard> goodsStandardList); int batchInsert(List<GoodsStandard> goodsStandardList);
int insertGoodsStandard(GoodsStandard goodsStandard);
void deleteByGoodsId(Long goodsId); void deleteByGoodsId(Long goodsId);

View File

@ -52,6 +52,11 @@ public class GoodsStandardServiceImpl implements GoodsStandardService {
return goodsStandardMapper.batchInsert(goodsStandardList); return goodsStandardMapper.batchInsert(goodsStandardList);
} }
@Override
public int insertGoodsStandard(GoodsStandard goodsStandard) {
return goodsStandardMapper.insertGoodsStandard(goodsStandard);
}
@Override @Override
public void deleteByGoodsId(Long goodsId) { public void deleteByGoodsId(Long goodsId) {
goodsStandardMapper.deleteByGoodsId(goodsId); goodsStandardMapper.deleteByGoodsId(goodsId);

View File

@ -79,6 +79,38 @@
</where> </where>
</select> </select>
<insert id="insertGoodsStandard" parameterType="com.ghy.goods.domain.GoodsStandard" useGeneratedKeys="true" keyProperty="goodsStandardId">
insert into goods_standard (
<if test="goodsStandardName != null and goodsStandardName != ''">goods_standard_name,</if>
<if test="goodsId != null and goodsId != ''">goods_id,</if>
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">dept_goods_category_id,</if>
<if test="goodsPrice != null and goodsPrice != ''">goods_price,</if>
<if test="extMoney != null and extMoney != ''">ext_money,</if>
<if test="discountPrice != null and discountPrice != ''">discount_price,</if>
<if test="groupPrice != null and groupPrice != ''">group_price,</if>
<if test="goodsUnit != null and goodsUnit != ''">goods_unit,</if>
<if test="goodsNum != null and goodsNum != ''">goods_num,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="goodsStandardName != null and goodsStandardName != ''">#{goodsStandardName},</if>
<if test="goodsId != null and goodsId != ''">#{goodsId},</if>
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">#{deptGoodsCategoryId},</if>
<if test="goodsPrice != null and goodsPrice != ''">#{goodsPrice},</if>
<if test="extMoney != null and extMoney != ''">#{extMoney},</if>
<if test="discountPrice != null and discountPrice != ''">#{discountPrice},</if>
<if test="groupPrice != null and groupPrice != ''">#{groupPrice},</if>
<if test="goodsUnit != null and goodsUnit != ''">#{goodsUnit},</if>
<if test="goodsNum != null and goodsNum != ''">#{goodsNum},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<insert id="batchInsert" parameterType="list"> <insert id="batchInsert" parameterType="list">
INSERT INTO goods_standard ( INSERT INTO goods_standard (
goods_standard_name, goods_id, dept_goods_category_id, goods_price, ext_money, discount_price, group_price, goods_unit, goods_num, goods_standard_name, goods_id, dept_goods_category_id, goods_price, ext_money, discount_price, group_price, goods_unit, goods_num,

View File

@ -39,4 +39,12 @@ public class SysOrderAssignRequest {
// 详细地址 // 详细地址
private String fullAddress; private String fullAddress;
private String customerPhone;
private String customerName;
private String servDate;
private String servTime;
} }