2025008071805
This commit is contained in:
parent
50216a1806
commit
2892ce9efc
|
|
@ -26,6 +26,8 @@ import com.ruoyi.system.service.IDiyCityService;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义地区Controller
|
* 自定义地区Controller
|
||||||
|
|
@ -37,6 +39,8 @@ import java.util.Objects;
|
||||||
@RequestMapping("/system/DiyCity")
|
@RequestMapping("/system/DiyCity")
|
||||||
public class DiyCityController extends BaseController
|
public class DiyCityController extends BaseController
|
||||||
{
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(DiyCityController.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDiyCityService diyCityService;
|
private IDiyCityService diyCityService;
|
||||||
|
|
||||||
|
|
@ -70,36 +74,61 @@ public class DiyCityController extends BaseController
|
||||||
@PreAuthorize("@ss.hasPermi('system:DiyCity:query')")
|
@PreAuthorize("@ss.hasPermi('system:DiyCity:query')")
|
||||||
@GetMapping("/getTreeData")
|
@GetMapping("/getTreeData")
|
||||||
public AjaxResult getTreeData() {
|
public AjaxResult getTreeData() {
|
||||||
List<DiyCity> list = diyCityService.selectDiyCityList(new DiyCity());
|
try {
|
||||||
|
List<DiyCity> list = diyCityService.selectDiyCityList(new DiyCity());
|
||||||
|
|
||||||
List<Map<String, Object>> rootList = new ArrayList<>();
|
if (list == null || list.isEmpty()) {
|
||||||
for (DiyCity city : list) {
|
return success(new ArrayList<>());
|
||||||
Long parentId = city.getParentId();
|
}
|
||||||
Long id = Long.valueOf(city.getId());
|
|
||||||
// 一级节点
|
// 使用Map优化查找性能
|
||||||
if (parentId == null || parentId == 0L) {
|
Map<Long, Map<String, Object>> nodeMap = new HashMap<>();
|
||||||
|
List<Map<String, Object>> rootList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 第一步:创建所有节点
|
||||||
|
for (DiyCity city : list) {
|
||||||
Map<String, Object> node = toMap(city);
|
Map<String, Object> node = toMap(city);
|
||||||
// 组装children
|
node.put("children", new ArrayList<>());
|
||||||
List<Map<String, Object>> children = new ArrayList<>();
|
nodeMap.put(city.getId().longValue(), node);
|
||||||
for (DiyCity child : list) {
|
}
|
||||||
Long childParentId = child.getParentId();
|
|
||||||
if (id != null && Objects.equals(id, childParentId)) {
|
// 第二步:构建树形结构
|
||||||
children.add(toMap(child));
|
for (DiyCity city : list) {
|
||||||
|
Long parentId = city.getParentId();
|
||||||
|
Long id = city.getId().longValue();
|
||||||
|
|
||||||
|
if (parentId == null || parentId == 0L) {
|
||||||
|
// 根节点
|
||||||
|
rootList.add(nodeMap.get(id));
|
||||||
|
} else {
|
||||||
|
// 子节点,添加到父节点的children中
|
||||||
|
Map<String, Object> parentNode = nodeMap.get(parentId);
|
||||||
|
if (parentNode != null) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
List<Map<String, Object>> children = (List<Map<String, Object>>) parentNode.get("children");
|
||||||
|
children.add(nodeMap.get(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node.put("children", children);
|
|
||||||
rootList.add(node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return success(rootList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("获取树形数据失败", e);
|
||||||
|
return error("获取树形数据失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
return success(rootList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> toMap(DiyCity city) {
|
private Map<String, Object> toMap(DiyCity city) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("id", city.getId());
|
map.put("id", city.getId());
|
||||||
map.put("label", city.getTitle());
|
map.put("label", city.getTitle());
|
||||||
|
map.put("title", city.getTitle()); // 兼容前端
|
||||||
map.put("parentId", city.getParentId());
|
map.put("parentId", city.getParentId());
|
||||||
// 其他字段按需添加
|
map.put("order", city.getOrder());
|
||||||
|
map.put("lat", city.getLat());
|
||||||
|
map.put("lng", city.getLng());
|
||||||
|
map.put("createdAt", city.getCreatedAt());
|
||||||
|
map.put("updatedAt", city.getUpdatedAt());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -122,7 +151,34 @@ public class DiyCityController extends BaseController
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Integer id)
|
public AjaxResult getInfo(@PathVariable("id") Integer id)
|
||||||
{
|
{
|
||||||
return success(diyCityService.selectDiyCityById(id));
|
try {
|
||||||
|
DiyCity diyCity = diyCityService.selectDiyCityById(id);
|
||||||
|
if (diyCity == null) {
|
||||||
|
return error("地区不存在");
|
||||||
|
}
|
||||||
|
return success(diyCity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("获取地区详情失败", e);
|
||||||
|
return error("获取地区详情失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定地区的子地区列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:DiyCity:query')")
|
||||||
|
@GetMapping("/children/{parentId}")
|
||||||
|
public AjaxResult getChildren(@PathVariable("parentId") Long parentId)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DiyCity query = new DiyCity();
|
||||||
|
query.setParentId(parentId);
|
||||||
|
List<DiyCity> children = diyCityService.selectDiyCityList(query);
|
||||||
|
return success(children);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("获取子地区列表失败", e);
|
||||||
|
return error("获取子地区列表失败: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -133,7 +189,26 @@ public class DiyCityController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody DiyCity diyCity)
|
public AjaxResult add(@RequestBody DiyCity diyCity)
|
||||||
{
|
{
|
||||||
return toAjax(diyCityService.insertDiyCity(diyCity));
|
try {
|
||||||
|
// 验证必填字段
|
||||||
|
if (diyCity.getTitle() == null || diyCity.getTitle().trim().isEmpty()) {
|
||||||
|
return error("地区名称不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查同级下是否有重名
|
||||||
|
DiyCity query = new DiyCity();
|
||||||
|
query.setParentId(diyCity.getParentId());
|
||||||
|
query.setTitle(diyCity.getTitle());
|
||||||
|
List<DiyCity> existing = diyCityService.selectDiyCityList(query);
|
||||||
|
if (existing != null && !existing.isEmpty()) {
|
||||||
|
return error("同级下已存在相同名称的地区");
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(diyCityService.insertDiyCity(diyCity));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("新增自定义地区失败", e);
|
||||||
|
return error("新增失败: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -144,7 +219,38 @@ public class DiyCityController extends BaseController
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody DiyCity diyCity)
|
public AjaxResult edit(@RequestBody DiyCity diyCity)
|
||||||
{
|
{
|
||||||
return toAjax(diyCityService.updateDiyCity(diyCity));
|
try {
|
||||||
|
// 验证必填字段
|
||||||
|
if (diyCity.getId() == null) {
|
||||||
|
return error("地区ID不能为空");
|
||||||
|
}
|
||||||
|
if (diyCity.getTitle() == null || diyCity.getTitle().trim().isEmpty()) {
|
||||||
|
return error("地区名称不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否将父级设置为自己或自己的子级(防止循环引用)
|
||||||
|
if (diyCity.getParentId() != null && diyCity.getParentId().equals(diyCity.getId().longValue())) {
|
||||||
|
return error("不能将父级设置为自己");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查同级下是否有重名(排除自己)
|
||||||
|
DiyCity query = new DiyCity();
|
||||||
|
query.setParentId(diyCity.getParentId());
|
||||||
|
query.setTitle(diyCity.getTitle());
|
||||||
|
List<DiyCity> existing = diyCityService.selectDiyCityList(query);
|
||||||
|
if (existing != null && !existing.isEmpty()) {
|
||||||
|
for (DiyCity item : existing) {
|
||||||
|
if (!item.getId().equals(diyCity.getId())) {
|
||||||
|
return error("同级下已存在相同名称的地区");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(diyCityService.updateDiyCity(diyCity));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("修改自定义地区失败", e);
|
||||||
|
return error("修改失败: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -155,7 +261,20 @@ public class DiyCityController extends BaseController
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Integer[] ids)
|
public AjaxResult remove(@PathVariable Integer[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(diyCityService.deleteDiyCityByIds(ids));
|
try {
|
||||||
|
// 检查是否有子节点
|
||||||
|
for (Integer id : ids) {
|
||||||
|
List<DiyCity> children = diyCityService.selectDiyCityList(new DiyCity() {{ setParentId(id.longValue()); }});
|
||||||
|
if (children != null && !children.isEmpty()) {
|
||||||
|
return error("无法删除地区ID " + id + ",该地区下还有子地区,请先删除子地区");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAjax(diyCityService.deleteDiyCityByIds(ids));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("删除自定义地区失败", e);
|
||||||
|
return error("删除失败: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,15 @@ public class GoodsOrderController extends BaseController {
|
||||||
for (GoodsOrder order : orders) {
|
for (GoodsOrder order : orders) {
|
||||||
if (order.getProductId() != null) {
|
if (order.getProductId() != null) {
|
||||||
try {
|
try {
|
||||||
|
UsersPayBefor usersPayBefor = usersPayBeforService.selectUsersPayBeforByOrderId(order.getMainOrderId());
|
||||||
|
if (usersPayBefor != null) {
|
||||||
|
order.setWxmoney(usersPayBefor.getWxmoney());
|
||||||
|
order.setYemoney(usersPayBefor.getYemoney());
|
||||||
|
order.setMembermoney(usersPayBefor.getMembermoney());
|
||||||
|
order.setCouponmoney(usersPayBefor.getCouponmoney());
|
||||||
|
order.setReturnmoney(usersPayBefor.getReturnmoney());
|
||||||
|
}
|
||||||
|
|
||||||
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(order.getProductId());
|
ServiceGoods serviceGoods = serviceGoodsService.selectServiceGoodsById(order.getProductId());
|
||||||
if (serviceGoods != null) {
|
if (serviceGoods != null) {
|
||||||
// 补充商品详细信息
|
// 补充商品详细信息
|
||||||
|
|
@ -227,7 +236,14 @@ public class GoodsOrderController extends BaseController {
|
||||||
goodsOrderdata.setDeliveryName(siteDelivery.getTitle());
|
goodsOrderdata.setDeliveryName(siteDelivery.getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
UsersPayBefor usersPayBefor = usersPayBeforService.selectUsersPayBeforByOrderId(goodsOrderdata.getMainOrderId());
|
||||||
|
if (usersPayBefor != null) {
|
||||||
|
goodsOrderdata.setWxmoney(usersPayBefor.getWxmoney());
|
||||||
|
goodsOrderdata.setYemoney(usersPayBefor.getYemoney());
|
||||||
|
goodsOrderdata.setMembermoney(usersPayBefor.getMembermoney());
|
||||||
|
goodsOrderdata.setCouponmoney(usersPayBefor.getCouponmoney());
|
||||||
|
goodsOrderdata.setReturnmoney(usersPayBefor.getReturnmoney());
|
||||||
|
}
|
||||||
Users users = usersService.selectUsersById(goodsOrderdata.getUid());
|
Users users = usersService.selectUsersById(goodsOrderdata.getUid());
|
||||||
if (users != null) {
|
if (users != null) {
|
||||||
goodsOrderdata.setUname(users.getName());
|
goodsOrderdata.setUname(users.getName());
|
||||||
|
|
|
||||||
|
|
@ -409,7 +409,10 @@ public class OrderController extends BaseController {
|
||||||
logJson.put("type",9);
|
logJson.put("type",9);
|
||||||
orderdata.setLogJson(logJson.toJSONString());
|
orderdata.setLogJson(logJson.toJSONString());
|
||||||
orderdata.setJsonStatus(0);
|
orderdata.setJsonStatus(0);
|
||||||
orderdata.setFileData(order.getFileData());
|
if(StringUtils.isNotBlank(order.getFileData())){
|
||||||
|
orderdata.setFileData(AppletControllerUtil.convertToJSONArray(order.getFileData()).toJSONString());
|
||||||
|
}
|
||||||
|
//orderdata.setFileData(order.getFileData());
|
||||||
orderdata.setOdertype(0);
|
orderdata.setOdertype(0);
|
||||||
orderdata.setReamk(order.getReamk());
|
orderdata.setReamk(order.getReamk());
|
||||||
orderdata.setBigtype(1);
|
orderdata.setBigtype(1);
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ public class ScheduledTaskUtil implements CommandLineRunner {
|
||||||
cleanupSystemData();
|
cleanupSystemData();
|
||||||
healthCheck();
|
healthCheck();
|
||||||
updateWorkerMoneyLook();
|
updateWorkerMoneyLook();
|
||||||
|
DispatchWorkerForOrder();
|
||||||
autoResumeWorkerOrderStatus(); // 添加师傅暂停状态自动恢复任务
|
autoResumeWorkerOrderStatus(); // 添加师傅暂停状态自动恢复任务
|
||||||
log.info("定时任务自动执行完成");
|
log.info("定时任务自动执行完成");
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +140,7 @@ public class ScheduledTaskUtil implements CommandLineRunner {
|
||||||
* 师傅收益7天定时冻结的解冻
|
* 师傅收益7天定时冻结的解冻
|
||||||
* 每10分钟执行一次
|
* 每10分钟执行一次
|
||||||
*/
|
*/
|
||||||
@Scheduled(fixedRate = 10 * 60 * 1000) // 每10分钟执行一次
|
@Scheduled(fixedRate = 20 * 60 * 1000) // 每10分钟执行一次
|
||||||
public void updateWorkerMoneyLook() {
|
public void updateWorkerMoneyLook() {
|
||||||
String taskName = "订单状态超时检查";
|
String taskName = "订单状态超时检查";
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
@ -156,6 +157,32 @@ public class ScheduledTaskUtil implements CommandLineRunner {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 派单10分钟一次对没有派单的进行派单
|
||||||
|
* 每10分钟执行一次
|
||||||
|
*/
|
||||||
|
@Scheduled(fixedRate = 10 * 60 * 1000) // 每10分钟执行一次
|
||||||
|
public void DispatchWorkerForOrder() {
|
||||||
|
String taskName = "订单派单检查并重新派单";
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
try {
|
||||||
|
Order order = new Order();
|
||||||
|
order.setStatus(1L);
|
||||||
|
order.setIsAccept(0);
|
||||||
|
order.setQiangdan("1");
|
||||||
|
List<Order> orders = orderService.selectOrderList(order);
|
||||||
|
for (Order orderdata : orders) {
|
||||||
|
DispatchUtil.dispatchOrder(orderdata.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("{}任务执行失败", taskName, e);
|
||||||
|
updateTaskStatistics(taskName, false, System.currentTimeMillis() - startTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单派单超时处理任务
|
* 订单派单超时处理任务
|
||||||
* 每5分钟执行一次,检查派单超过20分钟的订单
|
* 每5分钟执行一次,检查派单超过20分钟的订单
|
||||||
|
|
|
||||||
|
|
@ -834,7 +834,7 @@ public class WorkerCommissionUtil {
|
||||||
BigDecimal newCommission = currentCommission.add(finalCommissionWithDoorFee);
|
BigDecimal newCommission = currentCommission.add(finalCommissionWithDoorFee);
|
||||||
worker.setCommission(newCommission);
|
worker.setCommission(newCommission);
|
||||||
//累计分佣
|
//累计分佣
|
||||||
worker.setTotalComm(worker.getTotalComm().add(newCommission));
|
worker.setTotalComm(worker.getTotalComm().add(finalCommissionWithDoorFee));
|
||||||
|
|
||||||
// 5. 更新师傅信息
|
// 5. 更新师傅信息
|
||||||
int updateResult = usersService.updateUsers(worker);
|
int updateResult = usersService.updateUsers(worker);
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,10 @@ public class GoodsOrder extends BaseEntity
|
||||||
/** 排序 */
|
/** 排序 */
|
||||||
private Integer forserviceid;
|
private Integer forserviceid;
|
||||||
|
|
||||||
|
private BigDecimal wxmoney;
|
||||||
|
private BigDecimal yemoney;
|
||||||
|
private BigDecimal membermoney;
|
||||||
|
private BigDecimal couponmoney;
|
||||||
|
|
||||||
/** 支付时间 */
|
/** 支付时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
|
@ -753,6 +757,38 @@ public class GoodsOrder extends BaseEntity
|
||||||
this.deliveryName = deliveryName;
|
this.deliveryName = deliveryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCouponmoney() {
|
||||||
|
return couponmoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCouponmoney(BigDecimal couponmoney) {
|
||||||
|
this.couponmoney = couponmoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getMembermoney() {
|
||||||
|
return membermoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMembermoney(BigDecimal membermoney) {
|
||||||
|
this.membermoney = membermoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getYemoney() {
|
||||||
|
return yemoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYemoney(BigDecimal yemoney) {
|
||||||
|
this.yemoney = yemoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getWxmoney() {
|
||||||
|
return wxmoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWxmoney(BigDecimal wxmoney) {
|
||||||
|
this.wxmoney = wxmoney;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="parentId != null"> and parent_id=#{parentId}</if>
|
<if test="parentId != null"> and parent_id=#{parentId}</if>
|
||||||
<if test="city != null and city != ''"> and JSON_CONTAINS(city, #{city})</if>
|
<if test="city != null and city != ''"> and JSON_CONTAINS(city, #{city})</if>
|
||||||
</where>
|
</where>
|
||||||
order by parent_id ASC, sort ASC
|
order by sort ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectServiceCateCiKaList" resultMap="ServiceCateResult">
|
<select id="selectServiceCateCiKaList" resultMap="ServiceCateResult">
|
||||||
<include refid="selectServiceCateVo"/>
|
<include refid="selectServiceCateVo"/>
|
||||||
where id in (select card.type from user_secondary_card card where card.status='1' )
|
where id in (select card.type from user_secondary_card card where card.status='1' )
|
||||||
order by parent_id ASC, sort ASC
|
order by sort ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -46,21 +46,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectServiceCatepintuanList" resultMap="ServiceCateResult">
|
<select id="selectServiceCatepintuanList" resultMap="ServiceCateResult">
|
||||||
<include refid="selectServiceCateVo"/>
|
<include refid="selectServiceCateVo"/>
|
||||||
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.isgroup='1' )
|
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.isgroup='1' )
|
||||||
order by parent_id ASC, sort ASC
|
order by sort ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectServiceCateMiaoshaList" resultMap="ServiceCateResult">
|
<select id="selectServiceCateMiaoshaList" resultMap="ServiceCateResult">
|
||||||
<include refid="selectServiceCateVo"/>
|
<include refid="selectServiceCateVo"/>
|
||||||
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.isfixed='1' )
|
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.isfixed='1' )
|
||||||
order by parent_id ASC, sort ASC
|
order by sort ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectServiceCateBaojiaList" resultMap="ServiceCateResult">
|
<select id="selectServiceCateBaojiaList" resultMap="ServiceCateResult">
|
||||||
<include refid="selectServiceCateVo"/>
|
<include refid="selectServiceCateVo"/>
|
||||||
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.servicetype='2' )
|
where id in (select card.first_cate_id from service_goods card where card.status='1' and card.type='1' and card.servicetype='2' )
|
||||||
order by parent_id ASC, sort ASC
|
order by sort ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="isgroup != null "> and isgroup = #{isgroup}</if>
|
<if test="isgroup != null "> and isgroup = #{isgroup}</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
order by id desc
|
order by sort ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
order by created_at desc
|
order by sort ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ export function delDiyCity(id) {
|
||||||
// 查询城市树结构
|
// 查询城市树结构
|
||||||
export function getDiyCityTree() {
|
export function getDiyCityTree() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/DiyCity/tree',
|
url: '/system/DiyCity/getTreeData',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ export default {
|
||||||
},
|
},
|
||||||
handlefenleiStatusChange(row) {
|
handlefenleiStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用"
|
let text = row.status === "0" ? "启用" : "停用"
|
||||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||||
return changefenleiStatus(row.id, row.status)
|
return changefenleiStatus(row.id, row.status)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$modal.msgSuccess(text + "成功")
|
this.$modal.msgSuccess(text + "成功")
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listDiyCity, getDiyCity, delDiyCity, addDiyCity, updateDiyCity,getTreeDataList } from "@/api/system/DiyCity"
|
import { listDiyCity, getDiyCity, delDiyCity, addDiyCity, updateDiyCity, getDiyCityTree } from "@/api/system/DiyCity"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DiyCity",
|
name: "DiyCity",
|
||||||
|
|
@ -152,6 +152,7 @@ export default {
|
||||||
amap: null,
|
amap: null,
|
||||||
marker: null,
|
marker: null,
|
||||||
geocoder: null,
|
geocoder: null,
|
||||||
|
mapInited: false,
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label'
|
label: 'label'
|
||||||
|
|
@ -207,10 +208,19 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
gettreeDataList(){
|
gettreeDataList(){
|
||||||
getTreeDataList().then(response => {
|
// 使用后端的树形数据接口
|
||||||
this.treeDataList=response.data
|
getDiyCityTree().then(response => {
|
||||||
|
if (response.data && response.data.length > 0) {
|
||||||
|
this.treeDataList = response.data
|
||||||
|
} else {
|
||||||
|
this.treeDataList = []
|
||||||
|
}
|
||||||
// 初始化时不展开任何节点
|
// 初始化时不展开任何节点
|
||||||
this.expandedKeys = []
|
this.expandedKeys = []
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('获取树数据失败:', error)
|
||||||
|
// 如果树形接口失败,回退到列表接口构建树形结构
|
||||||
|
this.fallbackToBuildTree()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -255,12 +265,16 @@ export default {
|
||||||
this.$modal.msgSuccess("修改成功")
|
this.$modal.msgSuccess("修改成功")
|
||||||
this.open = false
|
this.open = false
|
||||||
this.getList()
|
this.getList()
|
||||||
|
this.gettreeDataList() // 刷新树结构
|
||||||
|
this.loadParentOptions() // 刷新父级选项
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
addDiyCity(this.form).then(response => {
|
addDiyCity(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功")
|
this.$modal.msgSuccess("新增成功")
|
||||||
this.open = false
|
this.open = false
|
||||||
this.getList()
|
this.getList()
|
||||||
|
this.gettreeDataList() // 刷新树结构
|
||||||
|
this.loadParentOptions() // 刷新父级选项
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,10 +283,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids
|
const ids = row.id || this.ids
|
||||||
this.$modal.confirm('是否确认删除自定义地区编号为"' + ids + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认删除自定义地区编号为"' + ids + '"的数据项?').then(() => {
|
||||||
return delDiyCity(ids)
|
return delDiyCity(ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList()
|
this.getList()
|
||||||
|
this.gettreeDataList() // 刷新树结构
|
||||||
|
this.loadParentOptions() // 刷新父级选项
|
||||||
this.$modal.msgSuccess("删除成功")
|
this.$modal.msgSuccess("删除成功")
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
},
|
},
|
||||||
|
|
@ -378,6 +394,61 @@ export default {
|
||||||
this.gettreeDataList(); // 重新获取数据
|
this.gettreeDataList(); // 重新获取数据
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 处理节点点击事件 */
|
||||||
|
handleNodeClick(data, node) {
|
||||||
|
// 可以在这里添加节点点击的逻辑
|
||||||
|
console.log('点击节点:', data, node);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 回退到构建树形结构的方法 */
|
||||||
|
fallbackToBuildTree() {
|
||||||
|
listDiyCity({pageSize: 1000}).then(response => {
|
||||||
|
if (response.rows && response.rows.length > 0) {
|
||||||
|
this.treeDataList = this.buildTreeData(response.rows)
|
||||||
|
} else {
|
||||||
|
this.treeDataList = []
|
||||||
|
}
|
||||||
|
this.expandedKeys = []
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('回退构建树形结构也失败:', error)
|
||||||
|
this.treeDataList = []
|
||||||
|
this.expandedKeys = []
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 构建树形结构数据 */
|
||||||
|
buildTreeData(dataList) {
|
||||||
|
const treeData = []
|
||||||
|
const dataMap = new Map()
|
||||||
|
|
||||||
|
// 先建立ID映射
|
||||||
|
dataList.forEach(item => {
|
||||||
|
dataMap.set(item.id, {
|
||||||
|
id: item.id,
|
||||||
|
label: item.title,
|
||||||
|
parentId: item.parentId,
|
||||||
|
children: []
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// 构建树形结构
|
||||||
|
dataList.forEach(item => {
|
||||||
|
const node = dataMap.get(item.id)
|
||||||
|
if (item.parentId === null || item.parentId === 0) {
|
||||||
|
// 根节点
|
||||||
|
treeData.push(node)
|
||||||
|
} else {
|
||||||
|
// 子节点
|
||||||
|
const parent = dataMap.get(item.parentId)
|
||||||
|
if (parent) {
|
||||||
|
parent.children.push(node)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return treeData
|
||||||
|
},
|
||||||
|
|
||||||
decreaseOrder() {
|
decreaseOrder() {
|
||||||
if (this.form.order > 0) {
|
if (this.form.order > 0) {
|
||||||
this.form.order--
|
this.form.order--
|
||||||
|
|
@ -393,23 +464,23 @@ export default {
|
||||||
},
|
},
|
||||||
initMap() {
|
initMap() {
|
||||||
// 销毁旧地图和事件,防止重复绑定
|
// 销毁旧地图和事件,防止重复绑定
|
||||||
if (this.map) {
|
if (this.amap) {
|
||||||
this.map.destroy()
|
this.amap.destroy()
|
||||||
this.map = null
|
this.amap = null
|
||||||
this.marker = null
|
this.marker = null
|
||||||
this.geocoder = null
|
this.geocoder = null
|
||||||
this.mapInited = false
|
this.mapInited = false
|
||||||
}
|
}
|
||||||
this.map = new AMap.Map('map', {
|
this.amap = new AMap.Map('map', {
|
||||||
zoom: 16,
|
zoom: 16,
|
||||||
center: [this.form.longitude || 108.94141, this.form.latitude || 34.209883],
|
center: [this.form.longitude || 108.94141, this.form.latitude || 34.209883],
|
||||||
})
|
})
|
||||||
this.geocoder = new AMap.Geocoder()
|
this.geocoder = new AMap.Geocoder()
|
||||||
// if (this.form.longitude && this.form.latitude) {
|
// if (this.form.longitude && this.form.latitude) {
|
||||||
// this.setMapMarker([this.form.longitude, this.form.latitude]);
|
// this.setMapMarker([this.form.longitude, this.form.latitude]);
|
||||||
// this.map.setCenter([this.form.longitude, this.form.latitude]);
|
// this.amap.setCenter([this.form.longitude, this.form.latitude]);
|
||||||
// }
|
// }
|
||||||
this.map.on('click', (e) => {
|
this.amap.on('click', (e) => {
|
||||||
const lnglat = [e.lnglat.lng, e.lnglat.lat]
|
const lnglat = [e.lnglat.lng, e.lnglat.lat]
|
||||||
this.setMapMarker(lnglat)
|
this.setMapMarker(lnglat)
|
||||||
this.form.longitude = e.lnglat.lng
|
this.form.longitude = e.lnglat.lng
|
||||||
|
|
@ -429,7 +500,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.marker = new AMap.Marker({
|
this.marker = new AMap.Marker({
|
||||||
position: lnglat,
|
position: lnglat,
|
||||||
map: this.map,
|
map: this.amap,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
searchMapAddress() {
|
searchMapAddress() {
|
||||||
|
|
@ -445,7 +516,7 @@ export default {
|
||||||
if (status === 'complete' && result.geocodes.length) {
|
if (status === 'complete' && result.geocodes.length) {
|
||||||
const lnglat = result.geocodes[0].location
|
const lnglat = result.geocodes[0].location
|
||||||
this.setMapMarker([lnglat.lng, lnglat.lat])
|
this.setMapMarker([lnglat.lng, lnglat.lat])
|
||||||
this.map.setCenter([lnglat.lng, lnglat.lat])
|
this.amap.setCenter([lnglat.lng, lnglat.lat])
|
||||||
this.form.longitude = lnglat.lng
|
this.form.longitude = lnglat.lng
|
||||||
this.form.latitude = lnglat.lat
|
this.form.latitude = lnglat.lat
|
||||||
this.latlng = `${lnglat.lng},${lnglat.lat}`
|
this.latlng = `${lnglat.lng},${lnglat.lat}`
|
||||||
|
|
@ -462,9 +533,12 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadParentOptions() {
|
loadParentOptions() {
|
||||||
// 这里假设用listDiyCity获取所有可选父级
|
// 获取所有可选父级
|
||||||
listDiyCity({parentId:0}).then(res => {
|
listDiyCity({parentId: 0, pageSize: 1000}).then(res => {
|
||||||
this.parentOptions = res.rows || []
|
this.parentOptions = res.rows || []
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('加载父级选项失败:', error)
|
||||||
|
this.parentOptions = []
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,18 @@
|
||||||
<label>用户电话:</label>
|
<label>用户电话:</label>
|
||||||
<span class="value">{{ orderData.uphone || "未知" }}</span>
|
<span class="value">{{ orderData.uphone || "未知" }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<label>订单单号:</label>
|
||||||
|
<span class="value">{{ orderData.mainOrderId || "未知" }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<label>下单时间:</label>
|
||||||
|
<span class="value">{{ orderData.createdAt || "未知" }}</span>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="info-item">-->
|
||||||
|
<!-- <label>下单商品:</label>-->
|
||||||
|
<!-- <span class="value">{{ orderData.productName || "未知" }}</span>-->
|
||||||
|
<!-- </div>-->
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- 基础金额信息 -->
|
<!-- 基础金额信息 -->
|
||||||
|
|
@ -91,6 +103,16 @@
|
||||||
}}</span
|
}}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<label>商品数量:</label>
|
||||||
|
<span class="value amount-good"
|
||||||
|
>¥{{
|
||||||
|
orderData.num
|
||||||
|
? orderData.num.toFixed(2)
|
||||||
|
: "0.00"
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -138,7 +160,16 @@
|
||||||
}}</span
|
}}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<label>退款金额:</label>
|
||||||
|
<span class="value amount-coupon"
|
||||||
|
>¥{{
|
||||||
|
orderData.returnmoney
|
||||||
|
? orderData.returnmoney.toFixed(2)
|
||||||
|
: "0.00"
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -157,7 +157,7 @@
|
||||||
<el-form :model="timeForm" label-width="120px" class="tab-form">
|
<el-form :model="timeForm" label-width="120px" class="tab-form">
|
||||||
<el-form-item label="每月提现时间">
|
<el-form-item label="每月提现时间">
|
||||||
<el-select v-model="timeForm.withdrawDays" multiple placeholder="请选择日期" style="width: 300px">
|
<el-select v-model="timeForm.withdrawDays" multiple placeholder="请选择日期" style="width: 300px">
|
||||||
<el-option v-for="d in 31" :key="d" :label="d + '号'" :value="d + '号'" />
|
<el-option v-for="d in 31" :key="d" :label="d + '号'" :value="d.toString()" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="定时接单时长">
|
<el-form-item label="定时接单时长">
|
||||||
|
|
@ -1051,7 +1051,7 @@ export default {
|
||||||
this.$message.success('提交成功(模拟)')
|
this.$message.success('提交成功(模拟)')
|
||||||
},
|
},
|
||||||
resetTime() {
|
resetTime() {
|
||||||
this.timeForm = { withdrawDays: ['8号', '18号', '28号'], autoOrderMinutes: 10, cancelOrderDays: 7 }
|
this.timeForm = { withdrawDays: ['8', '18', '28'], autoOrderMinutes: 10, cancelOrderDays: 7 }
|
||||||
},
|
},
|
||||||
resetMember() {
|
resetMember() {
|
||||||
this.memberForm = { member: '', memberRule: '', recharge: '' }
|
this.memberForm = { member: '', memberRule: '', recharge: '' }
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ export default {
|
||||||
// 任务状态修改
|
// 任务状态修改
|
||||||
handlefenleiStatusChange(row) {
|
handlefenleiStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用"
|
let text = row.status === "0" ? "启用" : "停用"
|
||||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||||
return changefenleiStatus(row.id, row.status)
|
return changefenleiStatus(row.id, row.status)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$modal.msgSuccess(text + "成功")
|
this.$modal.msgSuccess(text + "成功")
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ export default {
|
||||||
// 任务状态修改
|
// 任务状态修改
|
||||||
handlefenleiStatusChange(row) {
|
handlefenleiStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用"
|
let text = row.status === "0" ? "启用" : "停用"
|
||||||
this.$modal.confirm('确认要"' + text + '""' + row.title + '"状态吗?').then(function() {
|
this.$modal.confirm('确认要操作' + row.title + '状态吗?').then(function() {
|
||||||
return changefenleiStatus(row.id, row.status)
|
return changefenleiStatus(row.id, row.status)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$modal.msgSuccess(text + "成功")
|
this.$modal.msgSuccess(text + "成功")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue