师傅发起完单添加完单图片及备注
This commit is contained in:
parent
dbf512677c
commit
c1da7c7eca
|
|
@ -191,7 +191,7 @@ public class OrderController extends BaseController {
|
|||
od.setRevTime(om.getRevTime());
|
||||
od.setExpectTimeStart(om.getExpectTimeStart());
|
||||
od.setExpectTimeEnd(om.getExpectTimeEnd());
|
||||
od.setRemark(om.getRemark());
|
||||
// od.setRemark(om.getRemark());
|
||||
orderDetailService.insertOrderDetail(od);
|
||||
|
||||
// 批量生成订单商品
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import com.ghy.common.core.controller.BaseController;
|
|||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.enums.ImgType;
|
||||
import com.ghy.common.enums.OrderStatus;
|
||||
import com.ghy.common.enums.PayStatus;
|
||||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.common.utils.poi.ExcelUtil;
|
||||
import com.ghy.customer.domain.Customer;
|
||||
|
|
@ -13,12 +16,15 @@ import com.ghy.customer.domain.CustomerAddress;
|
|||
import com.ghy.customer.service.CustomerAddressService;
|
||||
import com.ghy.customer.service.CustomerService;
|
||||
import com.ghy.goods.domain.Goods;
|
||||
import com.ghy.goods.domain.GoodsImgs;
|
||||
import com.ghy.goods.domain.GoodsStandard;
|
||||
import com.ghy.goods.service.GoodsImgsService;
|
||||
import com.ghy.goods.service.GoodsService;
|
||||
import com.ghy.goods.service.GoodsStandardService;
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.domain.OrderGoods;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
import com.ghy.order.request.OrderProcessRequest;
|
||||
import com.ghy.order.service.OrderDetailService;
|
||||
import com.ghy.order.service.OrderGoodsService;
|
||||
import com.ghy.order.service.OrderMasterService;
|
||||
|
|
@ -31,15 +37,19 @@ import com.ghy.web.pojo.vo.OrderStandard;
|
|||
import com.ghy.worker.domain.Worker;
|
||||
import com.ghy.worker.service.WorkerService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.util.Assert;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 详细订单API
|
||||
|
|
@ -69,6 +79,8 @@ public class OrderDetailController extends BaseController {
|
|||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
@Autowired
|
||||
private GoodsImgsService goodsImgsService;
|
||||
@Autowired
|
||||
private GoodsStandardService goodsStandardService;
|
||||
@Autowired
|
||||
private FinancialDetailService financialDetailService;
|
||||
|
|
@ -122,6 +134,17 @@ public class OrderDetailController extends BaseController {
|
|||
SysArea sysArea = sysAreaService.selectById(customerAddress.getCountryId());
|
||||
String completeAddress = sysArea.getMergerName().replaceAll(",", "") + customerAddress.getAddress();
|
||||
|
||||
// 完工图片
|
||||
List<String> finishImgList = null;
|
||||
if (detail.getOrderStatus() > 3) {
|
||||
GoodsImgs qryImgsObj = new GoodsImgs();
|
||||
qryImgsObj.setRemark(request.getId().toString());
|
||||
qryImgsObj.setImgType(ImgType.FINISH_IMG.getId());
|
||||
qryImgsObj.setGoodsId(0l);
|
||||
List<GoodsImgs> goodsImgs = goodsImgsService.qryGoodsImgs(qryImgsObj);
|
||||
finishImgList = goodsImgs.stream().map(GoodsImgs::getImgUrl).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
for (OrderGoods orderGoods : orderStandardList) {
|
||||
OrderStandard orderStandard = new OrderStandard();
|
||||
orderStandard.setStandardName(orderGoods.getGoodsName());
|
||||
|
|
@ -158,6 +181,8 @@ public class OrderDetailController extends BaseController {
|
|||
orderListResponse.setWorkFinishTime(detail.getWorkFinishTime());
|
||||
orderListResponse.setRemark(goods.getRemark());
|
||||
orderListResponse.setCustomerRemark(orderMaster.getRemark());
|
||||
orderListResponse.setFinishImgList(finishImgList);
|
||||
orderListResponse.setWorkerRemark(detail.getRemark());
|
||||
|
||||
return AjaxResult.success(orderListResponse);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -240,6 +265,7 @@ public class OrderDetailController extends BaseController {
|
|||
orderListResponse.setWorkFinishTime(detail.getWorkFinishTime());
|
||||
orderListResponse.setRemark(goods.getRemark());
|
||||
orderListResponse.setCustomerRemark(orderMaster.getRemark());
|
||||
orderListResponse.setOrderType(detail.getOrderType());
|
||||
orderListResponses.add(orderListResponse);
|
||||
});
|
||||
return voDataTable(orderListResponses, list);
|
||||
|
|
@ -337,4 +363,46 @@ public class OrderDetailController extends BaseController {
|
|||
orderDetailService.cancelAgree(orderDetailId, agree);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 师傅发起完单
|
||||
*
|
||||
* @param request 完单发起请求对象
|
||||
*/
|
||||
@PostMapping("/app/applyFinishOrder")
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult applyFinishOrder(@RequestBody OrderProcessRequest request) throws Exception {
|
||||
// 判断工单状态是否为服务中以及是否已支付
|
||||
OrderDetail orderDetail = orderDetailService.selectById(request.getOrderDetailId());
|
||||
OrderMaster orderMaster = orderMasterService.selectById(orderDetail.getOrderMasterId());
|
||||
if (orderDetail.getOrderStatus() != OrderStatus.SERVER.code()
|
||||
|| orderMaster.getPayStatus() != PayStatus.PAID.getCode()) {
|
||||
return AjaxResult.error("未支付订单或非服务中订单,发起完单失败");
|
||||
}
|
||||
|
||||
// 存储完单图
|
||||
List<GoodsImgs> finishImgObjList = new ArrayList<GoodsImgs>();
|
||||
for (String imgUrl: request.getFinishImgList()) {
|
||||
GoodsImgs finishImgObj = new GoodsImgs();
|
||||
finishImgObj.setGoodsId(0l);
|
||||
finishImgObj.setImgType(ImgType.FINISH_IMG.getId());
|
||||
finishImgObj.setImgUrl(imgUrl);
|
||||
finishImgObj.setRemark(String.valueOf(request.getOrderDetailId()));
|
||||
finishImgObjList.add(finishImgObj);
|
||||
}
|
||||
int insertedRows = goodsImgsService.batchInsert(finishImgObjList);
|
||||
Assert.isTrue(insertedRows > 0, "完单图入库失败,request=" + request);
|
||||
|
||||
// 修改子单状态为完单待确认状态,更新完单时间
|
||||
OrderDetail updateOrderDetail = new OrderDetail();
|
||||
updateOrderDetail.setId(request.getOrderDetailId());
|
||||
updateOrderDetail.setWorkFinishTime(new Date());
|
||||
updateOrderDetail.setOrderStatus(OrderStatus.FINISH_CHECK.code());
|
||||
updateOrderDetail.setRemark(request.getRemark());
|
||||
int affectedRow = orderDetailService.updateOrderDetail(updateOrderDetail);
|
||||
Assert.isTrue(affectedRow == 1, "子订单修改失败,orderDetail=" + orderDetail);
|
||||
|
||||
return AjaxResult.success("发起成功");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.ghy.common.core.page.PageDomain;
|
|||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.core.page.TableSupport;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.enums.ImgType;
|
||||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.common.utils.StringUtils;
|
||||
import com.ghy.common.utils.poi.ExcelUtil;
|
||||
|
|
@ -16,7 +17,9 @@ import com.ghy.customer.domain.CustomerAddress;
|
|||
import com.ghy.customer.service.CustomerAddressService;
|
||||
import com.ghy.customer.service.CustomerService;
|
||||
import com.ghy.goods.domain.Goods;
|
||||
import com.ghy.goods.domain.GoodsImgs;
|
||||
import com.ghy.goods.domain.GoodsStandard;
|
||||
import com.ghy.goods.service.GoodsImgsService;
|
||||
import com.ghy.goods.service.GoodsService;
|
||||
import com.ghy.goods.service.GoodsStandardService;
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
|
|
@ -46,6 +49,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 主订单API
|
||||
|
|
@ -75,6 +79,8 @@ public class OrderMasterController extends BaseController {
|
|||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
@Autowired
|
||||
private GoodsImgsService goodsImgsService;
|
||||
@Autowired
|
||||
private FinancialMasterService financialMasterService;
|
||||
@Autowired
|
||||
private GoodsStandardService goodsStandardService;
|
||||
|
|
@ -192,6 +198,17 @@ public class OrderMasterController extends BaseController {
|
|||
standardList.add(orderStandard);
|
||||
}
|
||||
|
||||
// 完工图片
|
||||
List<String> finishImgList = null;
|
||||
if (orderMaster.getOrderStatus() > 3) {
|
||||
GoodsImgs qryImgsObj = new GoodsImgs();
|
||||
qryImgsObj.setRemark(orderDetail.getId().toString());
|
||||
qryImgsObj.setImgType(ImgType.FINISH_IMG.getId());
|
||||
qryImgsObj.setGoodsId(0l);
|
||||
List<GoodsImgs> goodsImgs = goodsImgsService.qryGoodsImgs(qryImgsObj);
|
||||
finishImgList = goodsImgs.stream().map(GoodsImgs::getImgUrl).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
OrderStandardDetail orderStandardDetail = new OrderStandardDetail();
|
||||
orderStandardDetail.setOrderDetailId(orderDetail.getId());
|
||||
orderStandardDetail.setOrderDetailCode(orderDetail.getCode());
|
||||
|
|
@ -203,6 +220,8 @@ public class OrderMasterController extends BaseController {
|
|||
orderStandardDetail.setExpectTimeStart(orderDetail.getExpectTimeStart());
|
||||
orderStandardDetail.setExpectTimeEnd(orderDetail.getExpectTimeEnd());
|
||||
orderStandardDetail.setOrderStandardList(standardList);
|
||||
orderStandardDetail.setFinishImgList(finishImgList);
|
||||
orderStandardDetail.setRemark(orderDetail.getRemark());
|
||||
|
||||
orderStandardDetails.add(orderStandardDetail);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ public class OrderListResponse {
|
|||
|
||||
private String customerRemark;
|
||||
|
||||
private String workerRemark;
|
||||
|
||||
private Date serverTime;
|
||||
|
||||
private Date expectTimeStart;
|
||||
|
|
@ -39,6 +41,8 @@ public class OrderListResponse {
|
|||
|
||||
private String goodsName;
|
||||
|
||||
private Integer orderType;
|
||||
|
||||
private Integer orderStatus;
|
||||
|
||||
private Integer payStatus;
|
||||
|
|
@ -63,4 +67,6 @@ public class OrderListResponse {
|
|||
|
||||
private List<OrderStandardDetail> orderStandardDetailList;
|
||||
|
||||
private List<String> finishImgList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ public class OrderStandardDetail {
|
|||
|
||||
private Date workFinishTime;
|
||||
|
||||
private String remark;
|
||||
|
||||
private List<OrderStandard> orderStandardList;
|
||||
|
||||
private List<String> finishImgList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,4 +129,4 @@ jim:
|
|||
# 百度地图应用api
|
||||
baidu:
|
||||
ak: 'ZQTgMW7W0GTuE7Ripb0HDp5TqRaOI6PZ'
|
||||
url: 'https://api.map.baidu.com/reverse_geocoding/v3/?ak=#AK#&output=json&coordtype=wgs84ll&location='
|
||||
url: 'https://api.map.baidu.com/reverse_geocoding/v3/?ak=#AK#&output=json&coordtype=wgs84ll&location='
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.ghy.common.enums;
|
||||
|
||||
/**
|
||||
* 图片类型
|
||||
*
|
||||
* @author ydq
|
||||
* @date : 2022-07-27 22:14
|
||||
*/
|
||||
public enum ImgType {
|
||||
SWIPER_IMG(0, "轮播图"),
|
||||
DESC_IMG(1, "详情图"),
|
||||
FINISH_IMG(2, "完单图");
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
|
||||
ImgType(Integer id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,14 @@ import java.util.List;
|
|||
*/
|
||||
public interface GoodsImgsMapper {
|
||||
|
||||
/**
|
||||
* 查询符合条件的图片信息
|
||||
*
|
||||
* @param goodsImgs 条件
|
||||
* @return 图片信息列表
|
||||
*/
|
||||
List<GoodsImgs> qryGoodsImgs(GoodsImgs goodsImgs);
|
||||
|
||||
/**
|
||||
* 批量插入商品图片
|
||||
*
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@ import java.util.List;
|
|||
*/
|
||||
public interface GoodsImgsService {
|
||||
|
||||
/**
|
||||
* 查询符合条件的图片信息
|
||||
*
|
||||
* @param goodsImgs 条件
|
||||
* @return 图片信息列表
|
||||
*/
|
||||
List<GoodsImgs> qryGoodsImgs(GoodsImgs goodsImgs);
|
||||
|
||||
/**
|
||||
* 批量插入商品图片信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ public class GoodsImgsServiceImpl implements GoodsImgsService {
|
|||
@Resource
|
||||
GoodsImgsMapper goodsImgsMapper;
|
||||
|
||||
@Override
|
||||
public List<GoodsImgs> qryGoodsImgs(GoodsImgs goodsImgs) {
|
||||
return goodsImgsMapper.qryGoodsImgs(goodsImgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsert(List<GoodsImgs> goodsImgs) {
|
||||
return goodsImgsMapper.batchInsert(goodsImgs);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,21 @@
|
|||
FROM goods_imgs
|
||||
</sql>
|
||||
|
||||
<select id="qryGoodsImgs" parameterType="com.ghy.goods.domain.GoodsImgs" resultMap="GoodsImgsResult">
|
||||
<include refid="selectGoodsImgs"/>
|
||||
<where>
|
||||
<if test="goodsId != null">
|
||||
AND goods_id = #{goodsId}
|
||||
</if>
|
||||
<if test="remark != null and imgType != ''">
|
||||
AND remark = #{remark}
|
||||
</if>
|
||||
<if test="imgType != null">
|
||||
AND img_type = #{imgType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM goods_imgs WHERE goods_imgs_id IN
|
||||
<foreach collection="array" item="goodsImgsId" open="(" separator="," close=")">
|
||||
|
|
@ -73,4 +88,4 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ghy.order.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单流转过程请求参数接收对象
|
||||
*
|
||||
* @author ydq
|
||||
* @date : 2022-07-27 21:55
|
||||
*/
|
||||
@Data
|
||||
public class OrderProcessRequest {
|
||||
// 子订单id
|
||||
private Long orderDetailId;
|
||||
// 服务完成成果图
|
||||
private List<String> finishImgList;
|
||||
// 备注
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -149,6 +149,7 @@
|
|||
<if test="expectTimeEnd != null">expect_time_end = #{expectTimeEnd},</if>
|
||||
<if test="workBeginTime != null">work_begin_time = #{workBeginTime},</if>
|
||||
<if test="workFinishTime != null">work_finish_time = #{workFinishTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = SYSDATE()
|
||||
</set>
|
||||
|
|
|
|||
Loading…
Reference in New Issue