‘linchangsheng’ há 8 meses atrás
pai
commit
a163c3c0d3

+ 89 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/workorder/DispatchVO.java

@@ -0,0 +1,89 @@
+package com.gree.mall.manager.bean.workorder;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel
+public class DispatchVO {
+
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "省份")
+    private String provinceName;
+
+
+    @ZfireField(tbName = "a",hide = true)
+    @ApiModelProperty(value = "省")
+    private String pid;
+
+
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "城市")
+    private String cityName;
+
+
+    @ZfireField(tbName = "a",hide = true)
+    @ApiModelProperty(value = "市id")
+    private String cityCode;
+
+
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "区域")
+    private String areaName;
+
+    @ZfireField(tbName = "a",hide = true)
+    @ApiModelProperty(value = "区域id")
+    private String areaCode;
+
+
+    @ZfireField(tbName = "a",hide = true,colName = "id")
+    @ApiModelProperty(value = "街道id")
+    private String streetCode;
+
+
+    @ZfireField(tbName = "a",colName = "name")
+    @ApiModelProperty(value = "街道")
+    private String streetName;
+
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "工单渠道")
+    private String dictValue;
+
+
+    @ZfireField(tbName = "b",hide = true)
+    @ApiModelProperty(value = "工单渠道id")
+    private String dictCode;
+
+
+    @ZfireField(tbName = "c")
+    @ApiModelProperty(value = "工单类型")
+    private String orderSmallTypeText;
+
+    @ZfireField(tbName = "c",hide = true,colName = "id")
+    @ApiModelProperty(value = "工单类型id")
+    private String orderSmallId;
+
+    @ZfireField(tbName = "d")
+    @ApiModelProperty(value = "产品大类")
+    private String categoryName;
+
+    @ZfireField(tbName = "d",hide = true)
+    @ApiModelProperty(value = "产品大类id")
+    private String categoryId;
+
+
+    @ZfireField(tbName = "e")
+    @ApiModelProperty(value = "工单来源")
+    private String orderSource;
+
+    @ZfireField(tbName = "e",hide = true)
+    @ApiModelProperty(value = "工单来源id")
+    private String orderSourceId;
+
+
+
+
+}

+ 3 - 0
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/workorder/IncreMapper.java

@@ -3,6 +3,7 @@ package com.gree.mall.manager.commonmapper.workorder;
 import com.baomidou.mybatisplus.annotation.SqlParser;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.workorder.DispatchVO;
 import com.gree.mall.manager.bean.workorder.IncreVO;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import org.apache.ibatis.annotations.Mapper;
@@ -16,4 +17,6 @@ public interface IncreMapper {
     @SqlParser(filter = true)
     IPage<IncreVO> list(IPage page, @Param("ex")ZfireParamBean zfireParam, @Param("adminCompanyIds")List<String> adminCompanyIds);
 
+    @SqlParser(filter = true)
+    IPage<DispatchVO> listDispatch(Page page,@Param("ex") ZfireParamBean zfireParam, @Param("adminCompanyIds") List<String> adminCompanyIds);
 }

+ 64 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/workerorder/DispatchController.java

@@ -0,0 +1,64 @@
+package com.gree.mall.manager.controller.workerorder;
+
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.annotation.ZfireList;
+import com.gree.mall.manager.bean.listvo.param.WorkOrderZfireParam;
+import com.gree.mall.manager.bean.listvo.workorder.OrderBaseVO;
+import com.gree.mall.manager.bean.workorder.*;
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.logic.workorder.ChangeOrderLogic;
+import com.gree.mall.manager.plus.entity.PgOrderProductDetail;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.ParseException;
+import java.util.List;
+
+@Slf4j
+@RestController
+@Api(value = "自动派工配置", tags = {"自动派工配置"})
+@RequestMapping(value = "/dispatch", produces = "application/json; charset=utf-8")
+public class DispatchController {
+
+    @Autowired
+    private ChangeOrderLogic changeOrderLogic;
+
+
+    @ZfireList
+    @PostMapping("/list")
+    @ApiOperation(value = "列表")
+    public ResponseHelper<Page<DispatchVO>> list(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) {
+        IPage<DispatchVO> orderBaseVOIPage = changeOrderLogic.list(zfireParamBean);
+        return ResponseHelper.success(orderBaseVOIPage, new TypeReference<DispatchVO>() {});
+    }
+
+
+    @PostMapping("/list/export")
+    @ApiOperation(value = "导出")
+    public void listExport(@RequestBody ZfireParamBean zfireParamBean,
+                           HttpServletRequest request, HttpServletResponse response) throws Exception {
+        //1.组装查询条件
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        //2.查询要导出的内容
+        IPage<DispatchVO> page = changeOrderLogic.list(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(page.getRecords(), zfireParam.getExportFields(), request, response);
+    }
+
+
+
+
+
+}

+ 30 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/ChangeOrderLogic.java

@@ -1,17 +1,25 @@
 package com.gree.mall.manager.logic.workorder;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.SyncOrderDto;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.workorder.DispatchVO;
+import com.gree.mall.manager.bean.workorder.IncreVO;
 import com.gree.mall.manager.bean.workorder.PgOrderProductDetailVO;
 import com.gree.mall.manager.bean.workorder.WorkerOrderDetail;
+import com.gree.mall.manager.commonmapper.workorder.IncreMapper;
 import com.gree.mall.manager.enums.PayStatusEnum;
 import com.gree.mall.manager.enums.admin.AdminWebsitTypeEnum;
 import com.gree.mall.manager.enums.workorder.OrderBaseStatusEnum;
 import com.gree.mall.manager.enums.workorder.OrderOperatorLogTypeEnum;
+import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.*;
 import com.gree.mall.manager.plus.service.*;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -66,6 +74,13 @@ public class ChangeOrderLogic {
     @Autowired
     PgOrderOperatorLogService pgOrderOperatorLogService;
 
+    @Autowired
+    CommonLogic commonLogic;
+
+
+    @Autowired
+    IncreMapper increMapper;
+
 
     @Transactional(rollbackFor = Exception.class)
     public void changeAppointmentTime(String id, String appointmentTime, String appointmentEndTime,String remark) {
@@ -223,4 +238,19 @@ public class ChangeOrderLogic {
 
     }
 
+    public IPage<DispatchVO> list(ZfireParamBean zfireParam) {
+
+        //获取当前登录企业id
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        List<String> adminCompanyIds = adminUser.getCompanyWechatIds();
+        //1.组装查询条件
+        zfireParam = FieldUtils.supplyParam(zfireParam, DispatchVO.class);
+
+        IPage<DispatchVO> dispatchVOIPage = increMapper.listDispatch(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam,adminCompanyIds);
+
+        return dispatchVOIPage;
+
+
+    }
 }

+ 8 - 4
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseExcelLogic.java

@@ -1316,14 +1316,18 @@ public class OrderBaseExcelLogic {
             pgOrderBase.setIsThreeOrder(true);
         }
 
+        for (PgOrderOperatorLog pgOrderOperatorLog : syncOrderDto.getPgOrderOperatorLogs()) {
+            pgOrderOperatorLog.setIsThreeOrder(true);
+        }
+
 
-        pgOrderBaseService.saveOrUpdateBatch(syncOrderDto.getPgOrderBases());
+        pgOrderBaseService.saveBatch(syncOrderDto.getPgOrderBases().stream().distinct().collect(Collectors.toList()));
 
-        pgOrderWorkerService.saveOrUpdateBatch(syncOrderDto.getOrderWorkers());
+        pgOrderWorkerService.saveBatch(syncOrderDto.getOrderWorkers().stream().distinct().collect(Collectors.toList()));
 
-        pgOrderProductService.saveOrUpdateBatch(syncOrderDto.getOrderProducts());
+        pgOrderProductService.saveBatch(syncOrderDto.getOrderProducts().stream().distinct().collect(Collectors.toList()));
 
-        pgOrderOperatorLogService.saveOrUpdateBatch(syncOrderDto.getPgOrderOperatorLogs());
+        pgOrderOperatorLogService.saveBatch(syncOrderDto.getPgOrderOperatorLogs().stream().distinct().collect(Collectors.toList()));
 
     }
 

+ 54 - 0
mall-server-api/src/main/resources/mapper/workorder/IncreMapper.xml

@@ -19,4 +19,58 @@
         </if>
         ${ex.orderBy}
     </select>
+    <select id="listDispatch" resultType="com.gree.mall.manager.bean.workorder.DispatchVO">
+        SELECT
+        a.province_name,
+        a.pid,
+        a.city_name,
+        a.city_code,
+        a.area_name,
+        a.area_code,
+        a.name as streetName,
+        a.id as streetCode,
+        b.dict_value,
+        b.dict_code,
+        c.order_small_type_text,
+        c.id as orderSmallId,
+        d.name as categoryName,
+        d.category_id,
+        e.dict_value as order_source,
+        e.dict_code as order_source_id
+        FROM
+        region a
+        join sys_dict_company b on b.dict_type = 'ORDER_CHANNEL'
+        <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
+            AND b.company_wechat_id IN
+            <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        join order_small_type c
+        <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
+            on c.company_wechat_id IN
+            <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        join goods_category d on d.type = 2 and d.del =0 and d.`level` = 1
+        <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
+            AND d.company_wechat_id IN
+            <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        join sys_dict_company e on e.dict_type = 'WORKER_ORDER_SOURCE'
+        <if test="adminCompanyIds != null and adminCompanyIds.size > 0">
+            AND e.company_wechat_id IN
+            <foreach item="item" index="index" collection="adminCompanyIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        where
+        a.city_name IN ( '广州市', '清远市', '韶关市', '佛山市', '肇庆市', '云浮市' )
+        AND a.`level` = 4
+
+
+    </select>
 </mapper>