|
@@ -1,13 +1,16 @@
|
|
|
package com.fjhx.victoriatourist.service.jd.impl;
|
|
|
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.common.utils.Assert;
|
|
|
import com.fjhx.item.entity.product.po.ProductInfo;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
+import com.fjhx.item.util.excel.util.ExcelUtil;
|
|
|
import com.fjhx.victoriatourist.entity.jd.dto.JdRefundQualityCheckDto;
|
|
|
import com.fjhx.victoriatourist.entity.jd.dto.JdRefundQualityCheckSelectDto;
|
|
|
import com.fjhx.victoriatourist.entity.jd.po.JdRefundQualityCheck;
|
|
|
+import com.fjhx.victoriatourist.entity.jd.vo.JdRefundQualityCheckExcelVo;
|
|
|
import com.fjhx.victoriatourist.entity.jd.vo.JdRefundQualityCheckVo;
|
|
|
import com.fjhx.victoriatourist.mapper.jd.JdRefundQualityCheckMapper;
|
|
|
import com.fjhx.victoriatourist.service.jd.JdRefundQualityCheckService;
|
|
@@ -22,7 +25,9 @@ import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import static com.fjhx.victoriatourist.service.jd.impl.JdRefundServiceImpl.WAREHOUSE_ID;
|
|
|
import static com.fjhx.victoriatourist.service.jd.impl.JdRefundServiceImpl.getUpdateStockSql;
|
|
@@ -40,6 +45,9 @@ import static com.fjhx.victoriatourist.service.jd.impl.JdRefundServiceImpl.getUp
|
|
|
public class JdRefundQualityCheckServiceImpl extends ServiceImpl<JdRefundQualityCheckMapper, JdRefundQualityCheck> implements JdRefundQualityCheckService {
|
|
|
|
|
|
@Autowired
|
|
|
+ private HttpServletResponse httpServletResponse;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private ProductInfoService productInfoService;
|
|
|
|
|
|
@Autowired
|
|
@@ -54,13 +62,33 @@ public class JdRefundQualityCheckServiceImpl extends ServiceImpl<JdRefundQuality
|
|
|
new SqlField("pi.custom_code"),
|
|
|
new SqlField("su.user_name")
|
|
|
)
|
|
|
+ .eq("json_unquote(pi.victoriatourist_json -> '$.deptId')", dto.getDeptId())
|
|
|
.in("jrqc", JdRefundQualityCheck::getScrappedHandleStatus, dto.getStatus())
|
|
|
+ .eq("jrqc", JdRefundQualityCheck::getScrappedHandleStatus, dto.getScrappedHandleStatus())
|
|
|
.orderByDesc("jrqc", JdRefundQualityCheck::getId);
|
|
|
Page<JdRefundQualityCheckVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void exportExcel(JdRefundQualityCheckSelectDto dto) {
|
|
|
+ IWrapper<JdRefundQualityCheck> wrapper = getWrapper()
|
|
|
+ .keyword(dto.getKeyword(),
|
|
|
+ new SqlField("jrqc.code"),
|
|
|
+ new SqlField("pi.name"),
|
|
|
+ new SqlField("pi.custom_code"),
|
|
|
+ new SqlField("su.user_name")
|
|
|
+ )
|
|
|
+ .eq("json_unquote(pi.victoriatourist_json -> '$.deptId')", dto.getDeptId())
|
|
|
+ .in("jrqc", JdRefundQualityCheck::getScrappedHandleStatus, dto.getStatus())
|
|
|
+ .eq("jrqc", JdRefundQualityCheck::getScrappedHandleStatus, dto.getScrappedHandleStatus())
|
|
|
+ .orderByDesc("jrqc", JdRefundQualityCheck::getId);
|
|
|
+ List<JdRefundQualityCheckExcelVo> list = this.baseMapper.getList(wrapper);
|
|
|
+ ExcelUtil.export(httpServletResponse, list, JdRefundQualityCheckExcelVo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DSTransactional
|
|
|
+ @Override
|
|
|
public synchronized void handle(JdRefundQualityCheckDto dto) {
|
|
|
JdRefundQualityCheck jdRefundQualityCheck = getById(dto.getId());
|
|
|
Assert.notEmpty(jdRefundQualityCheck, "数据不存在");
|
|
@@ -90,9 +118,16 @@ public class JdRefundQualityCheckServiceImpl extends ServiceImpl<JdRefundQuality
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @DSTransactional
|
|
|
@Override
|
|
|
- public void verify(JdRefundQualityCheckDto dto) {
|
|
|
- JdRefundQualityCheck jdRefundQualityCheck = getById(dto.getId());
|
|
|
+ public synchronized void batchHandle(List<JdRefundQualityCheckDto> dto) {
|
|
|
+ dto.forEach(this::handle);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DSTransactional
|
|
|
+ @Override
|
|
|
+ public synchronized void verify(Long id) {
|
|
|
+ JdRefundQualityCheck jdRefundQualityCheck = getById(id);
|
|
|
Assert.notEmpty(jdRefundQualityCheck, "数据不存在");
|
|
|
Assert.eqTrue(jdRefundQualityCheck.getScrappedHandleStatus() == 2, "该记录已处理,请勿重复操作");
|
|
|
|
|
@@ -112,12 +147,18 @@ public class JdRefundQualityCheckServiceImpl extends ServiceImpl<JdRefundQuality
|
|
|
.setSql(getUpdateStockSql(2, scrappedCount))
|
|
|
);
|
|
|
|
|
|
- update(q -> q.eq(BaseIdPo::getId, dto.getId())
|
|
|
+ update(q -> q.eq(BaseIdPo::getId, id)
|
|
|
.set(JdRefundQualityCheck::getScrappedHandleStatus, 3)
|
|
|
.set(JdRefundQualityCheck::getScrappedVerifyTime, new Date())
|
|
|
.set(JdRefundQualityCheck::getScrappedVerifyUserId, SecurityUtils.getUserId())
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ @DSTransactional
|
|
|
+ @Override
|
|
|
+ public synchronized void batchVerify(List<Long> ids) {
|
|
|
+ ids.forEach(this::verify);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|