no message

This commit is contained in:
cb 2025-09-26 11:02:57 +08:00
parent c84c39a28f
commit 8148a59e83
6 changed files with 173 additions and 12 deletions

View File

@ -488,7 +488,15 @@ public class OrderController extends BaseController {
orderGoods.setGoodsNum(goods.getNum());
orderGoods.setGoodsName(goodsStandard.getGoodsStandardName());
orderGoods.setOrderDetailId(od.getId());
orderGoods.setServerGoodsNum(0);
// 立即发货时设置已发货数量为商品数量否则设置为0
if (request.getIsQuicklyDelivery() != null && request.getIsQuicklyDelivery() == 1) {
orderGoods.setServerGoodsNum(goods.getNum());
logger.info("立即发货订单[{}]商品[{}]设置已发货数量:{}", od.getCode(), goodsStandard.getGoodsStandardName(), goods.getNum());
} else {
orderGoods.setServerGoodsNum(0);
}
// orderGoods.setOrderId(om.getId());
orderGoodsService.insertOrderGoods(orderGoods);
});
@ -568,6 +576,50 @@ public class OrderController extends BaseController {
return AjaxResult.success();
}
/**
* 更新订单商品的已发货数量
* @param orderDetailId 子订单ID
* @param isIncrement 是否增加数量true增加false重置为0
*/
@Transactional(rollbackFor = Exception.class)
public void updateOrderGoodsServerNum(Long orderDetailId, boolean isIncrement) {
try {
// 获取子订单商品列表
List<OrderGoods> orderGoodsList = orderGoodsService.selectByOrderDetailId(orderDetailId);
if (CollectionUtils.isEmpty(orderGoodsList)) {
logger.warn("订单详情[{}]未找到关联商品", orderDetailId);
return;
}
// 更新每个商品的已发货数量
for (OrderGoods orderGoods : orderGoodsList) {
if (isIncrement) {
// 增加已发货数量设置为商品总数量
orderGoods.setServerGoodsNum(orderGoods.getGoodsNum());
logger.info("订单商品[{}]已发货数量更新为:{}", orderGoods.getGoodsName(), orderGoods.getGoodsNum());
} else {
// 重置已发货数量为0
orderGoods.setServerGoodsNum(0);
logger.info("订单商品[{}]已发货数量重置为0", orderGoods.getGoodsName());
}
// 更新数据库
int updateResult = orderGoodsService.updateOrderGoods(orderGoods);
if (updateResult <= 0) {
logger.error("更新订单商品[{}]已发货数量失败", orderGoods.getGoodsName());
throw new RuntimeException("更新订单商品已发货数量失败");
}
}
logger.info("订单详情[{}]商品已发货数量更新完成,共更新{}个商品", orderDetailId, orderGoodsList.size());
} catch (Exception e) {
logger.error("更新订单详情[{}]商品已发货数量异常:{}", orderDetailId, e.getMessage(), e);
throw new RuntimeException("更新商品已发货数量失败:" + e.getMessage());
}
}
@PostMapping("/server/app")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
@ -1371,7 +1423,35 @@ public class OrderController extends BaseController {
// GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId());
Goods goods = goodsService.selectById(master.getGoodsId());
if (goods.getDeptGoodsCategoryId() != null) {
Long categoryId = null;
// 前端发单和后台派单
if (com.ghy.common.utils.StringUtils.isEmpty(orderMaster.getOrderMode())) {
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(goods.getDeptGoodsCategoryId());
if (deptGoodsCategory != null) {
categoryId = deptGoodsCategory.getGoodsCategoryId();
}
} else {
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goods.getDeptGoodsCategoryId());
if (deptGoodsCategory != null) {
categoryId = deptGoodsCategory.getGoodsCategoryId();
}
}
if (categoryId != null) {
GoodsCategory one = goodsCategoryService.selectById(categoryId);
if (one != null && one.getParentCategoryId() != null) {
GoodsCategory two = goodsCategoryService.selectById(one.getParentCategoryId());
if (two != null && two.getParentCategoryId() != null) {
GoodsCategory three = goodsCategoryService.selectById(two.getParentCategoryId());
if (three != null) {
goods.setGoodsName(three.getGoodsCategoryName()
+ "-" + two.getGoodsCategoryName()
+ "-" + one.getGoodsCategoryName());
}
}
}
}
}
// 财务信息
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId());
BigDecimal totalPayMoney = financialMaster.getPayMoney();
@ -1509,7 +1589,35 @@ public class OrderController extends BaseController {
// GoodsStandard goodsStandard = goodsStandardService.selectById(orderStandardList.get(0).getGoodsStandardId());
Goods goods = goodsService.selectById(orderMaster.getGoodsId());
if (goods.getDeptGoodsCategoryId() != null) {
Long categoryId = null;
// 前端发单和后台派单
if (com.ghy.common.utils.StringUtils.isEmpty(orderMaster.getOrderMode())) {
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(goods.getDeptGoodsCategoryId());
if (deptGoodsCategory != null) {
categoryId = deptGoodsCategory.getGoodsCategoryId();
}
} else {
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goods.getDeptGoodsCategoryId());
if (deptGoodsCategory != null) {
categoryId = deptGoodsCategory.getGoodsCategoryId();
}
}
if (categoryId != null) {
GoodsCategory one = goodsCategoryService.selectById(categoryId);
if (one != null && one.getParentCategoryId() != null) {
GoodsCategory two = goodsCategoryService.selectById(one.getParentCategoryId());
if (two != null && two.getParentCategoryId() != null) {
GoodsCategory three = goodsCategoryService.selectById(two.getParentCategoryId());
if (three != null) {
goods.setGoodsName(three.getGoodsCategoryName()
+ "-" + two.getGoodsCategoryName()
+ "-" + one.getGoodsCategoryName());
}
}
}
}
}
// 财务信息
FinancialDetail financialDetail = financialDetailService.selectByOrderDetailId(detail.getId());
BigDecimal detailPayMoney = financialDetail.getPayMoney();
@ -2062,6 +2170,9 @@ public class OrderController extends BaseController {
return AjaxResult.error("该配件订单已经派发过服务订单,不能重复操作");
}
Shop goodsShop=shopService.getShop(accessoryOrderMaster.getGoods().getShopId());
String phone= goodsShop.getPhone();
// 获取服务店铺信息
Shop serviceShop = shopService.getShop(serviceShopId);
if (serviceShop == null) {
@ -2097,7 +2208,7 @@ public class OrderController extends BaseController {
serviceOrderMaster.setCreateTime(new Date());
serviceOrderMaster.setWorkerId(serviceWorker.getWorkerId()); // 使用服务店铺的师傅ID
serviceOrderMaster.setServiceShopId(serviceShopId); // 设置服务店铺ID
serviceOrderMaster.setRemark("由配件订单[" + accessoryOrderMaster.getCode() + "]自动生成的服务订单,服务金额:" + serviceMoney);
serviceOrderMaster.setRemark("由配件订单[" + accessoryOrderMaster.getCode() + "]自动生成的服务订单,接单后请约客户上门服务,服务费用已在订单内,完单后会自行结算,请勿重复向客户收取。服务时不要讲产品负面话题,不要生硬推销!杜绝一切不合常理的行为!服务客户过程中有任何问题可致电商品/配件店铺"+phone+"【致电时按商品信息说明是该商品安装服务方】" );
serviceOrderMaster.setExpectTimeStart(accessoryOrderMaster.getExpectTimeStart());
serviceOrderMaster.setExpectTimeEnd(accessoryOrderMaster.getExpectTimeEnd());
serviceOrderMaster.setInsuranceId(accessoryOrderMaster.getInsuranceId());

View File

@ -85,7 +85,15 @@ public class WorkerController extends BaseController {
Assert.notNull(worker.getPhone(), "手机号码为空");
List<Worker> workerList = workerService.getWorkByPhoneAndPwd(worker);
if(workerList.size() > 0){
return AjaxResult.success(workerList.get(0));
Worker loginWorker = workerList.get(0);
// 检查师傅状态0=生效,1=冻结,2=删除
if(loginWorker.getStatus() == WorkerStatus.DELETED.getCode()){
return AjaxResult.error("账户已被删除,无法登录!");
}
if(loginWorker.getStatus() == WorkerStatus.DISABLE.getCode()){
return AjaxResult.error("账户已被冻结,无法登录!");
}
return AjaxResult.success(loginWorker);
}else {
return AjaxResult.error("用户名或密码错误!");
}
@ -460,4 +468,19 @@ public class WorkerController extends BaseController {
return AjaxResult.success("保存成功");
}
/**
* 删除师傅软删除
*/
@RequiresPermissions("worker:worker:remove")
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids) {
try {
return toAjax(workerService.deleteWorkerByIds(ids));
} catch (Exception e) {
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error("删除失败: " + e.getMessage());
}
}
}

View File

@ -72,9 +72,9 @@
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="worker:worker:remove">
<i class="fa fa-remove"></i> 删除
</a>
<!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="worker:worker:remove">
<i class="fa fa-remove"></i> 禁止登录
</a> -->
<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="worker:worker:import">
<i class="fa fa-upload"></i> 导入
</a>
@ -245,7 +245,7 @@
var actions = [];
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="areaDetail(\'' + row.workerId + '\')"><i class="fa fa-info"></i>服务区域</a> ');
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="categoryDetail(\'' + row.workerId + '\')"><i class="fa fa-info"></i>服务技能</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.workerId + '\')"><i class="fa fa-remove"></i>删除</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.workerId + '\')><i class="fa fa-remove"></i>禁止登录</a> ');
return actions.join('');
} else {
return "";
@ -276,15 +276,15 @@
/* 用户状态显示 */
function statusTools(row) {
if (row.status == 0) {
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.workerId + '\')"></i> ';
return '<i class="fa fa-toggle-on text-info fa-2x" onclick="disable(\'' + row.workerId + '\')" title="点击停用"></i> ';
} else {
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.workerId + '\')"></i> ';
return '<i class="fa fa-toggle-off text-info fa-2x" onclick="enable(\'' + row.workerId + '\')" title="点击启用"></i> ';
}
}
/* 用户管理-停用 */
function disable(workerId) {
$.modal.confirm("确认要停用用户吗?", function() {
$.modal.confirm("确认关闭,前端不再显示师傅/商家信息", function() {
$.operate.post(prefix + "/changeStatus", { "workerId": workerId, "status": 1 });
})
}

View File

@ -59,4 +59,12 @@ public interface WorkerService {
Map<Long, Worker> byWorkUserIdInMap(List<Long> workUserIdList);
List<Worker> selectByIds(Set<Long> workerIds);
/**
* 删除师傅软删除
*
* @param ids 师傅ID字符串多个ID用逗号分隔
* @return 删除成功条数
*/
int deleteWorkerByIds(String ids);
}

View File

@ -1,5 +1,7 @@
package com.ghy.worker.service.impl;
import com.ghy.common.core.text.Convert;
import com.ghy.common.enums.WorkerStatus;
import com.ghy.common.utils.StringUtils;
import com.ghy.worker.domain.Worker;
import com.ghy.worker.domain.WorkerTeam;
@ -85,4 +87,17 @@ public class WorkerServiceImpl implements WorkerService {
}
return workerMapper.selectByIds(workerIds);
}
@Override
public int deleteWorkerByIds(String ids) {
Long[] workerIds = Convert.toLongArray(ids);
int result = 0;
for (Long workerId : workerIds) {
Worker worker = new Worker();
worker.setWorkerId(workerId);
worker.setStatus(WorkerStatus.DELETED.getCode());
result += workerMapper.updateWorker(worker);
}
return result;
}
}

View File

@ -64,6 +64,8 @@
LEFT JOIN worker_goods_category wgc ON wgc.worker_id = w.worker_id
LEFT JOIN worker_certification wc on w.worker_id = wc.worker_id
<where>
<!-- 默认过滤已删除的师傅 -->
AND w.status != 2
<if test="status != null">
AND w.status = #{status}
</if>
@ -194,6 +196,8 @@
<select id="selectByIds" resultMap="WorkerResult">
<include refid="selectWorker" />
<where>
<!-- 默认过滤已删除的师傅 -->
w.status != 2
and w.worker_id in
<foreach item="item" index="workIds" collection="workIds" open="(" separator="," close=")">
#{item}