no message

This commit is contained in:
cb 2025-09-26 18:06:05 +08:00
parent 8148a59e83
commit eced56a427
7 changed files with 184 additions and 55 deletions

View File

@ -514,12 +514,13 @@ public class GoodsController extends BaseController {
.filter(goods -> goods.getStatus() != null && goods.getStatus() == 0) .filter(goods -> goods.getStatus() != null && goods.getStatus() == 0)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
logger.info("获取到的服务类目id{} 取到的商品列表:{}", serviceCategoryId,goodsList);
// 3. 提取所有店铺ID去重 // 3. 提取所有店铺ID去重
Set<Long> shopIds = goodsList.stream() Set<Long> shopIds = goodsList.stream()
.filter(g -> g.getShopId() != null) .filter(g -> g.getShopId() != null)
.map(Goods::getShopId) .map(Goods::getShopId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
logger.info("取到的店铺列表:{}", shopIds);
if (!shopIds.isEmpty()) { if (!shopIds.isEmpty()) {
// 找到最近的店铺 // 找到最近的店铺
Shop nearestShop = null; Shop nearestShop = null;

View File

@ -489,10 +489,41 @@ public class OrderController extends BaseController {
orderGoods.setGoodsName(goodsStandard.getGoodsStandardName()); orderGoods.setGoodsName(goodsStandard.getGoodsStandardName());
orderGoods.setOrderDetailId(od.getId()); orderGoods.setOrderDetailId(od.getId());
// 立即发货时设置已发货数量为商品数量否则设置为0 // 立即发货时计算可发货数量主单商品数量减去已分配给其他子单的数量否则设置为0
if (request.getIsQuicklyDelivery() != null && request.getIsQuicklyDelivery() == 1) { if (request.getIsQuicklyDelivery() != null && request.getIsQuicklyDelivery() == 1) {
orderGoods.setServerGoodsNum(goods.getNum()); // 获取主单中该商品的总数量
logger.info("立即发货订单[{}]商品[{}]设置已发货数量:{}", od.getCode(), goodsStandard.getGoodsStandardName(), goods.getNum()); List<OrderGoods> masterOrderGoodsList = orderGoodsService.selectByOrderMasterId(om.getId());
Integer masterGoodsNum = 0;
for (OrderGoods masterGoods : masterOrderGoodsList) {
if (Objects.equals(masterGoods.getGoodsStandardId(), goods.getGoodsStandardId())) {
masterGoodsNum = masterGoods.getGoodsNum();
break;
}
}
// 获取该商品已经分配给其他子单的数量
List<OrderDetail> existingOrderDetails = orderDetailService.selectByOrderMasterId(om.getId());
Integer allocatedGoodsNum = 0;
for (OrderDetail existingDetail : existingOrderDetails) {
// 排除当前正在创建的子单
if (!existingDetail.getId().equals(od.getId())) {
List<OrderGoods> existingOrderGoods = orderGoodsService.selectByOrderDetailId(existingDetail.getId());
for (OrderGoods existingGoods : existingOrderGoods) {
if (Objects.equals(existingGoods.getGoodsStandardId(), goods.getGoodsStandardId())) {
allocatedGoodsNum += existingGoods.getGoodsNum();
}
}
}
}
// 计算剩余可发货数量 = 主单商品数量 - 已分配给其他子单的数量
Integer availableGoodsNum = masterGoodsNum - allocatedGoodsNum;
// 取当前子单商品数量和剩余可发货数量的最小值
Integer serverGoodsNum = Math.min(goods.getNum(), Math.max(0, availableGoodsNum));
orderGoods.setServerGoodsNum(serverGoodsNum);
logger.info("立即发货订单[{}]商品[{}]主单总数量:{},已分配数量:{},当前子单数量:{},设置已发货数量:{}",
od.getCode(), goodsStandard.getGoodsStandardName(), masterGoodsNum, allocatedGoodsNum, goods.getNum(), serverGoodsNum);
} else { } else {
orderGoods.setServerGoodsNum(0); orderGoods.setServerGoodsNum(0);
} }
@ -2170,7 +2201,8 @@ public class OrderController extends BaseController {
return AjaxResult.error("该配件订单已经派发过服务订单,不能重复操作"); return AjaxResult.error("该配件订单已经派发过服务订单,不能重复操作");
} }
Shop goodsShop=shopService.getShop(accessoryOrderMaster.getGoods().getShopId()); Goods goods=goodsService.selectById(accessoryOrderMaster.getGoodsId());
Shop goodsShop=shopService.getShop(goods.getShopId());
String phone= goodsShop.getPhone(); String phone= goodsShop.getPhone();
// 获取服务店铺信息 // 获取服务店铺信息

View File

@ -520,7 +520,9 @@ public class OrderDetailController extends BaseController {
// 计算主单地址与店铺的距离 // 计算主单地址与店铺的距离
shop = calculateShopDistance(orderMaster, shop); shop = calculateShopDistance(orderMaster, shop);
Shop serviceShop = shopService.getShop(orderMaster.getServiceShopId());
serviceShop=calculateShopDistance(orderMaster, serviceShop);
orderListResponse.setServiceShop(serviceShop);
orderListResponse.setShop(shop); orderListResponse.setShop(shop);
// 编辑返回属性 // 编辑返回属性
orderListResponse.setTrackingNumber(detail.getTrackingNumber()); orderListResponse.setTrackingNumber(detail.getTrackingNumber());

View File

@ -90,8 +90,9 @@ public class WorkerController extends BaseController {
if(loginWorker.getStatus() == WorkerStatus.DELETED.getCode()){ if(loginWorker.getStatus() == WorkerStatus.DELETED.getCode()){
return AjaxResult.error("账户已被删除,无法登录!"); return AjaxResult.error("账户已被删除,无法登录!");
} }
if(loginWorker.getStatus() == WorkerStatus.DISABLE.getCode()){ // 检查登录状态0=允许登录,1=禁止登录
return AjaxResult.error("账户已被冻结,无法登录!"); if(loginWorker.getLoginStatus() != null && loginWorker.getLoginStatus() == 1){
return AjaxResult.error("账户登录已被禁用,无法登录!");
} }
return AjaxResult.success(loginWorker); return AjaxResult.success(loginWorker);
}else { }else {
@ -420,6 +421,18 @@ public class WorkerController extends BaseController {
} }
} }
@PostMapping("/changeLoginStatus")
@ResponseBody
public AjaxResult changeLoginStatus(Worker worker){
try {
workerService.updateWorker(worker);
return AjaxResult.success("登录状态修改成功");
}catch (Exception e){
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/settled") @PostMapping("/settled")
@ResponseBody @ResponseBody
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -469,6 +482,33 @@ public class WorkerController extends BaseController {
return AjaxResult.success("保存成功"); return AjaxResult.success("保存成功");
} }
/**
* 通过师傅ID获取师傅详情
* @param workerId 师傅ID
* @return 师傅实体对象
*/
@GetMapping("/detail/{workerId}")
@ResponseBody
public AjaxResult getWorkerDetailById(@PathVariable("workerId") Long workerId) {
try {
// 参数校验
if (workerId == null) {
return AjaxResult.error("师傅ID不能为空");
}
// 查询师傅基本信息
Worker worker = workerService.selectById(workerId);
if (worker == null) {
return AjaxResult.error("师傅不存在");
}
return AjaxResult.success(worker);
} catch (Exception e) {
logger.error("获取师傅详情失败: " + ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error("获取师傅详情失败: " + e.getMessage());
}
}
/** /**
* 删除师傅软删除 * 删除师傅软删除
*/ */

View File

@ -232,6 +232,14 @@
return statusTools(row); return statusTools(row);
} }
}, },
{
visible: editFlag == 'hidden' ? false : true,
title: '登录状态',
align: 'center',
formatter: function (value, row, index) {
return loginStatusTools(row);
}
},
{ {
field: 'createTime', field: 'createTime',
title: '创建时间', title: '创建时间',
@ -284,7 +292,7 @@
/* 用户管理-停用 */ /* 用户管理-停用 */
function disable(workerId) { function disable(workerId) {
$.modal.confirm("确认关闭,前端不再显示师傅/商家信息", function() { $.modal.confirm("确认要停用用户吗?", function() {
$.operate.post(prefix + "/changeStatus", { "workerId": workerId, "status": 1 }); $.operate.post(prefix + "/changeStatus", { "workerId": workerId, "status": 1 });
}) })
} }
@ -296,6 +304,29 @@
}) })
} }
/* 登录状态显示 */
function loginStatusTools(row) {
if (row.loginStatus == null || row.loginStatus == 0) {
return '<i class="fa fa-toggle-on text-success fa-2x" onclick="disableLogin(\'' + row.workerId + '\')" title="点击禁用登录"></i> ';
} else {
return '<i class="fa fa-toggle-off text-danger fa-2x" onclick="enableLogin(\'' + row.workerId + '\')" title="点击启用登录"></i> ';
}
}
/* 禁用登录 */
function disableLogin(workerId) {
$.modal.confirm("确认要禁用该师傅的登录权限吗?", function() {
$.operate.post(prefix + "/changeLoginStatus", { "workerId": workerId, "loginStatus": 1 });
})
}
/* 启用登录 */
function enableLogin(workerId) {
$.modal.confirm("确认要启用该师傅的登录权限吗?", function() {
$.operate.post(prefix + "/changeLoginStatus", { "workerId": workerId, "loginStatus": 0 });
})
}
// 区域联动处理 // 区域联动处理
function areaChange(obj, nextId) { function areaChange(obj, nextId) {
var parentCode = $(obj).val(); var parentCode = $(obj).val();

View File

@ -59,6 +59,9 @@ public class Worker extends BaseEntity {
@Excel(name = "用户状态 0生效 1冻结 2删除", readConverterExp = "0=生效,1=冻结,2=删除") @Excel(name = "用户状态 0生效 1冻结 2删除", readConverterExp = "0=生效,1=冻结,2=删除")
private Integer status; private Integer status;
@Excel(name = "登录状态 0允许登录 1禁止登录", readConverterExp = "0=允许登录,1=禁止登录")
private Integer loginStatus;
@Excel(name = "店铺状态") @Excel(name = "店铺状态")
private Integer storeStatus; private Integer storeStatus;

View File

@ -14,6 +14,7 @@
<result property="alipayName" column="alipay_name"/> <result property="alipayName" column="alipay_name"/>
<result property="password" column="password"/> <result property="password" column="password"/>
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="loginStatus" column="login_status"/>
<result property="type" column="type"/> <result property="type" column="type"/>
<result property="deptName" column="dept_name"/> <result property="deptName" column="dept_name"/>
<result property="deptId" column="dept_id"/> <result property="deptId" column="dept_id"/>
@ -31,7 +32,7 @@
<sql id="selectWorker"> <sql id="selectWorker">
SELECT SELECT
w.worker_id, w.name, w.account, w.phone, w.password, w.open_id, w.wx_open_id, w.dept_id, w.status, w.worker_logo_url, w.worker_id, w.name, w.account, w.phone, w.password, w.open_id, w.wx_open_id, w.dept_id, w.status, w.login_status, w.worker_logo_url,
w.leader_team_rate, w.leader_team_money, w.create_by, w.create_time, w.update_by, w.update_time, w.leader_team_rate, w.leader_team_money, w.create_by, w.create_time, w.update_by, w.update_time,
w.remark, w.type, w.store_status, w.alipay_account, w.alipay_name, w.remark, w.type, w.store_status, w.alipay_account, w.alipay_name,
sd.dept_name, sdc.banner_url sd.dept_name, sdc.banner_url
@ -42,7 +43,7 @@
<sql id="selectBasic"> <sql id="selectBasic">
SELECT SELECT
w.worker_id, w.name, w.account, w.phone, w.password, w.open_id, w.wx_open_id, w.dept_id, w.status, w.worker_logo_url, w.worker_id, w.name, w.account, w.phone, w.password, w.open_id, w.wx_open_id, w.dept_id, w.status, w.login_status, w.worker_logo_url,
w.leader_team_rate, w.leader_team_money, w.create_by, w.create_time, w.update_by, w.update_time, w.leader_team_rate, w.leader_team_money, w.create_by, w.create_time, w.update_by, w.update_time,
w.remark, w.type, w.store_status, w.alipay_account, w.alipay_name w.remark, w.type, w.store_status, w.alipay_account, w.alipay_name
FROM worker w FROM worker w
@ -50,7 +51,7 @@
<select id="getWorkerList" parameterType="com.ghy.worker.domain.Worker" resultMap="WorkerResult"> <select id="getWorkerList" parameterType="com.ghy.worker.domain.Worker" resultMap="WorkerResult">
SELECT SELECT
w.worker_id, w.name, w.account, w.phone, w.password, w.open_id, w.wx_open_id, w.dept_id, w.status, w.worker_logo_url, w.worker_id, w.name, w.account, w.phone, w.password, w.open_id, w.wx_open_id, w.dept_id, w.status, w.login_status, w.worker_logo_url,
w.leader_team_rate, w.leader_team_money, w.create_by, w.create_time, w.update_by, w.update_time, w.leader_team_rate, w.leader_team_money, w.create_by, w.create_time, w.update_by, w.update_time,
w.remark, w.type, w.store_status, w.alipay_account, w.alipay_name,concat(wc.surname, wc.name) as realName, w.remark, w.type, w.store_status, w.alipay_account, w.alipay_name,concat(wc.surname, wc.name) as realName,
sd.dept_name, sdc.banner_url sd.dept_name, sdc.banner_url
@ -141,55 +142,74 @@
</select> </select>
<insert id="insertWorker" parameterType="com.ghy.worker.domain.Worker" useGeneratedKeys="true" keyProperty="workerId"> <insert id="insertWorker" parameterType="com.ghy.worker.domain.Worker" useGeneratedKeys="true" keyProperty="workerId">
insert into worker( insert into worker
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if> <if test="name != null and name != ''">name,</if>
<if test="account != null and account != ''">account,</if> <if test="account != null and account != ''">account,</if>
<if test="phone != null and phone != ''">phone,</if> <if test="phone != null and phone != ''">phone,</if>
<if test="password != null and password != ''">password,</if> <if test="password != null and password != ''">password,</if>
<if test="openId != null and openId != ''">open_id,</if> <if test="openId != null and openId != ''">open_id,</if>
<if test="wxOpenId != null and wxOpenId != ''">wx_open_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="status != null">status,</if>
<if test="loginStatus != null">login_status,</if>
<if test="workerLogoUrl != null and workerLogoUrl != ''">worker_logo_url,</if>
<if test="leaderTeamRate != null">leader_team_rate,</if>
<if test="leaderTeamMoney != null">leader_team_money,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="type != null">type,</if>
<if test="storeStatus != null">store_status,</if>
<if test="alipayAccount != null and alipayAccount != ''">alipay_account,</if> <if test="alipayAccount != null and alipayAccount != ''">alipay_account,</if>
<if test="alipayName != null and alipayName != ''">alipay_name,</if> <if test="alipayName != null and alipayName != ''">alipay_name,</if>
<if test="deptId != null and deptId != ''">dept_id,</if> create_time,
<if test="status != null and status != ''">status,</if> </trim>
<if test="workerLogoUrl != null and workerLogoUrl != ''">worker_logo_url,</if> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
<if test="account != null and account != ''">#{account},</if> <if test="account != null and account != ''">#{account},</if>
<if test="phone != null and phone != ''">#{phone},</if> <if test="phone != null and phone != ''">#{phone},</if>
<if test="password != null and password != ''">#{password},</if> <if test="password != null and password != ''">#{password},</if>
<if test="openId != null and openId != ''">#{openId},</if> <if test="openId != null and openId != ''">#{openId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if> <if test="wxOpenId != null and wxOpenId != ''">#{wxOpenId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="status != null">#{status},</if>
<if test="loginStatus != null">#{loginStatus},</if>
<if test="workerLogoUrl != null and workerLogoUrl != ''">#{workerLogoUrl},</if>
<if test="leaderTeamRate != null">#{leaderTeamRate},</if>
<if test="leaderTeamMoney != null">#{leaderTeamMoney},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="type != null">#{type},</if>
<if test="storeStatus != null">#{storeStatus},</if>
<if test="alipayAccount != null and alipayAccount != ''">#{alipayAccount},</if> <if test="alipayAccount != null and alipayAccount != ''">#{alipayAccount},</if>
<if test="alipayName != null and alipayName != ''">#{alipayName},</if> <if test="alipayName != null and alipayName != ''">#{alipayName},</if>
<if test="status != null and status != ''">#{status},</if> sysdate(),
<if test="workerLogoUrl != null and workerLogoUrl != ''">#{workerLogoUrl},</if> </trim>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert> </insert>
<update id="updateWorker" > <update id="updateWorker" parameterType="com.ghy.worker.domain.Worker">
update worker update worker
<set> <trim prefix="SET" suffixOverrides=",">
<if test="type != null"> type = #{type},</if> <if test="name != null and name != ''">name = #{name},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if> <if test="account != null and account != ''">account = #{account},</if>
<if test="status != null"> status = #{status},</if> <if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="wxOpenId != null"> wx_open_id = #{wxOpenId},</if> <if test="password != null and password != ''">password = #{password},</if>
<if test="storeStatus != null"> store_status = #{storeStatus},</if> <if test="openId != null and openId != ''">open_id = #{openId},</if>
<if test="account != null and account != ''"> account = #{account},</if> <if test="wxOpenId != null and wxOpenId != ''">wx_open_id = #{wxOpenId},</if>
<if test="phone != null and phone != ''"> phone = #{phone},</if> <if test="deptId != null">dept_id = #{deptId},</if>
<if test="password != null and password != ''"> password = #{password},</if> <if test="status != null">status = #{status},</if>
<if test="name != null and name != ''"> name = #{name},</if> <if test="loginStatus != null">login_status = #{loginStatus},</if>
<if test="workerLogoUrl != null and workerLogoUrl != ''">worker_logo_url = #{workerLogoUrl},</if> <if test="workerLogoUrl != null and workerLogoUrl != ''">worker_logo_url = #{workerLogoUrl},</if>
<if test="leaderTeamRate != null and leaderTeamRate != ''"> leader_team_rate = #{leaderTeamRate},</if> <if test="leaderTeamRate != null">leader_team_rate = #{leaderTeamRate},</if>
<if test="leaderTeamMoney != null and leaderTeamMoney != ''"> leader_team_money = #{leaderTeamMoney},</if> <if test="leaderTeamMoney != null">leader_team_money = #{leaderTeamMoney},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="type != null">type = #{type},</if>
<if test="storeStatus != null">store_status = #{storeStatus},</if>
<if test="alipayAccount != null and alipayAccount != ''">alipay_account = #{alipayAccount},</if> <if test="alipayAccount != null and alipayAccount != ''">alipay_account = #{alipayAccount},</if>
<if test="alipayName != null and alipayName != ''">alipay_name = #{alipayName},</if> <if test="alipayName != null and alipayName != ''">alipay_name = #{alipayName},</if>
</set> update_time = sysdate()
</trim>
where worker_id = #{workerId} where worker_id = #{workerId}
</update> </update>