Commit 0a7b0c46 authored by jiangkebao's avatar jiangkebao

Merge branch 'master' into jkb

# Conflicts:
#	src/Service/Interfaces/SocketIoServiceInterface.php
parents 7e64c1b6 c7842f12
<?php
/**
* Created by PhpStorm.
* User: Zero
* Date: 2020/7/3
* Time: 14:27
*/
namespace Meibuyu\Micro\Handler;
use Hyperf\Contract\ConfigInterface;
use Hyperf\Di\Annotation\Inject;
use Meibuyu\Micro\Exceptions\HttpResponseException;
use Meibuyu\Micro\Model\Auth;
use Meibuyu\Micro\Service\Interfaces\MessageServiceInterface;
class MessageHandler
{
/**
* @Inject()
* @var MessageServiceInterface
*/
private $messageService;
/**
* @Inject
* @var ConfigInterface
*/
protected $config;
/**
* 发送模板消息
* @param $receiverIds
* @param $templateId
* @param array $replace
* @throws HttpResponseException
*/
public function sendTemp($receiverIds, $templateId, $replace = [])
{
$application = $this->config->get('app_name');
if (!$application) {
throw new HttpResponseException("请设置应用名app_name");
}
$receiverIds = is_array($receiverIds) ? $receiverIds : [$receiverIds];
$sendUserId = Auth::id();
$this->messageService->send($receiverIds, $application, $templateId, $sendUserId, $replace);
}
}
\ No newline at end of file
...@@ -25,7 +25,7 @@ abstract class BaseRepository implements RepositoryInterface ...@@ -25,7 +25,7 @@ abstract class BaseRepository implements RepositoryInterface
/** /**
* @var ContainerInterface * @var ContainerInterface
*/ */
private $container; protected $container;
/** /**
* @var RequestInterface * @var RequestInterface
......
...@@ -53,6 +53,13 @@ interface BaseInfoServiceInterface ...@@ -53,6 +53,13 @@ interface BaseInfoServiceInterface
*/ */
public function getCurrencyListByIdList(array $idList, array $columns = ['id', 'name']): array; public function getCurrencyListByIdList(array $idList, array $columns = ['id', 'name']): array;
/**
* 通过Keyword获取货币id数组
* @param $keyword
* @return array
*/
public function getCurrencyIdsByKeyword($keyword);
/** /**
* 通过单个id获取岗位信息 * 通过单个id获取岗位信息
* @param int $id 职位id * @param int $id 职位id
...@@ -140,4 +147,19 @@ interface BaseInfoServiceInterface ...@@ -140,4 +147,19 @@ interface BaseInfoServiceInterface
*/ */
public function sites(array $relations = [], array $columns = ['id', "name"]): array; public function sites(array $relations = [], array $columns = ['id', "name"]): array;
/**
* 获取部门领导id数据
* @param array $ids 部门id数组
* @return array
*/
public function getDepartmentLeaderIdsByIds($ids);
/**
* 获取审阅人员
* @param $teamId
* @param $authId
* @return array|bool
*/
public function getReviewUsers($teamId, $authId);
} }
...@@ -11,44 +11,4 @@ namespace Meibuyu\Micro\Service\Interfaces; ...@@ -11,44 +11,4 @@ namespace Meibuyu\Micro\Service\Interfaces;
interface DispatchPlanServiceInterface interface DispatchPlanServiceInterface
{ {
/**
* description:获取退税任务列表
* author: fuyunnan
* @param array $conditions 筛选条件
* @param int $pageSize 默认10
* Date: 2020/6/13
* @return array
*/
public function listRefundTasks(array $conditions, int $pageSize = DEFAULT_PAGE_SIZE) : array;
/**
* description:新建退税单 获取底部产品列表
* author: fuyunnan
* @param array $conditions 请求参数
* @param int $pageSize 请求参数
* Date: 2020/6/13
* @return array
*/
public function listRefundProducts(array $conditions = [], int $pageSize = DEFAULT_PAGE_SIZE ) :array;
/**
* description:删除退税任务
* author: fuyunnan
* @param int $id 计划任务id
* Date: 2020/6/13
* @return bool
*/
public function delete($id) :bool;
/**
* description:获取发货计划详情
* author: fuyunnan
* @param array $idList
* @param array $conditions 将参数条件写成二维数组形式 $conditions = [ ['id','=',1],['name','=',''jack] ]
* Date: 2020/6/13
* @return array
*/
public function getDispatchPlan(array $idList, array $conditions = []):array;
} }
<?php
/**
* Created by PhpStorm.
* User: 姜克保
* Date: 2020/5/20
* Time: 15:48
*/
namespace Meibuyu\Micro\Service\Interfaces;
use phpDocumentor\Reflection\Types\Integer;
interface MessageServiceInterface
{
/**
* @param array $receiveUserId 接收人id
* @param string $application 应用名称
* @param int $sendUserId 发送人id(发送人id等于0时是系统消息)
* @param int $templateId 模板id
* @param array $replace 替换模板内容
*/
public function send(array $receiveUserId, $application, $templateId, $sendUserId = 0, $replace = []): bool;
}
<?php
/**
* Created by PhpStorm.
* User: 姜克保
* Date: 2020/5/20
* Time: 15:48
*/
namespace Meibuyu\Micro\Service\Interfaces;
interface MessageTemplateServiceInterface
{
/**
* 返回替换后的模板内容
* @param int $template_id 模板id
* @param array $replace 替换内容(注意顺序)
* @return string
*/
public function getMessage(int $template_id, array $replace = []): string;
}
...@@ -43,4 +43,25 @@ interface MaterialServiceInterface ...@@ -43,4 +43,25 @@ interface MaterialServiceInterface
*/ */
public function getMaterialNamesByIdList(array $idList, array $columns = ['*']): array; public function getMaterialNamesByIdList(array $idList, array $columns = ['*']): array;
/**
* 获取某原料品类下的所有原料品名
* @param $categoryId
* @return array
*/
public function getMaterialNamesByCategoryId($categoryId);
/**
* 判断产品是否绑定原料品名
* @param $productId
* @return bool
*/
public function hasProductMaterialNames($productId): bool;
/**
* 获取产品绑定的原料品名
* @param $productId
* @return array keyBy('id')
*/
public function getProductMaterialNames($productId);
} }
...@@ -53,4 +53,12 @@ interface PlatformProductChildServiceInterface ...@@ -53,4 +53,12 @@ interface PlatformProductChildServiceInterface
*/ */
public function getBySkuList(array $skuList, $siteId, array $relations = [], $columns = ['*']): array; public function getBySkuList(array $skuList, $siteId, array $relations = [], $columns = ['*']): array;
/**
* 模糊搜索平台子sku,获取id数组
* @param string $childSku 平台子sku
* @param array|null $limitIds 限制id数组,不传为不限制
* @return array
*/
public function getIdsByChildSku(string $childSku, array $limitIds = null);
} }
...@@ -34,10 +34,11 @@ interface PlatformProductServiceInterface ...@@ -34,10 +34,11 @@ interface PlatformProductServiceInterface
public function getByIdList(array $idList, array $relations = [], $columns = ['*']): array; public function getByIdList(array $idList, array $relations = [], $columns = ['*']): array;
/** /**
* 获取全部平台产品状态列表 * 获取申报要素数据
* @param array $columns 默认['id', 'name'] * @param array $idList
* @param bool $groupByFlag
* @return array * @return array
*/ */
public function platformProductStatus(array $columns = ['id', 'name']): array; public function getWithPoint(array $idList, $groupByFlag = false);
} }
...@@ -37,4 +37,50 @@ interface ProductChildServiceInterface ...@@ -37,4 +37,50 @@ interface ProductChildServiceInterface
*/ */
public function getListBySkuList(array $skuList, array $columns = ['id']); public function getListBySkuList(array $skuList, array $columns = ['id']);
/**
* 获取全部尺码列表
* @param array $columns 默认['id', 'name']
* @return array
*/
public function sizes(array $columns = ['id', 'name']): array;
/**
* 获取全部颜色列表
* @param array $columns 默认['id', 'code', 'cn_name', 'en_name']
* @return array
*/
public function colors(array $columns = ['id', 'code', 'cn_name', 'en_name']): array;
/**
* 通过id数组获取尺码列表
* @param array $ids 默认去重
* @param array $columns
* @return array 默认keyBY('id')
*/
public function getSizesByIds(array $ids, $columns = ['id', 'name']): array;
/**
* 通过id数组获取颜色列表
* @param array $ids 默认去重
* @param array $columns
* @return array 默认keyBY('id')
*/
public function getColorsByIds(array $ids, array $columns = ['id', 'code', 'cn_name', 'en_name']): array;
/**
* 通过id获取尺码
* @param int $id
* @param array $columns
* @return array|null
*/
public function getSizeById(int $id, $columns = ['id', 'name']);
/**
* 通过id获取颜色
* @param int $id
* @param array $columns
* @return array|null
*/
public function getColorById(int $id, array $columns = ['id', 'code', 'cn_name', 'en_name']);
} }
...@@ -21,7 +21,7 @@ interface ProductServiceInterface ...@@ -21,7 +21,7 @@ interface ProductServiceInterface
* , 'bar_code', 'bar_code_image', 'creator_id', 'hot'] * , 'bar_code', 'bar_code_image', 'creator_id', 'hot']
* @return array|null * @return array|null
*/ */
public function get($id, array $relations = [], $columns = ['*']); public function get($id, array $relations = [], array $columns = ['*']);
/** /**
* 通过id列表获取产品数组 * 通过id列表获取产品数组
...@@ -35,20 +35,6 @@ interface ProductServiceInterface ...@@ -35,20 +35,6 @@ interface ProductServiceInterface
*/ */
public function getByIdList(array $idList, array $relations = [], array $columns = ['*']): array; public function getByIdList(array $idList, array $relations = [], array $columns = ['*']): array;
/**
* 获取全部尺码列表
* @param array $columns 默认['id', 'name']
* @return array
*/
public function sizes(array $columns = ['id', 'name']): array;
/**
* 获取全部颜色列表
* @param array $columns 默认['id', 'code', 'cn_name', 'en_name']
* @return array
*/
public function colors(array $columns = ['id', 'code', 'cn_name', 'en_name']): array;
/** /**
* 获取全部品类列表 * 获取全部品类列表
* @param bool $asTree 是否作为树返回 * @param bool $asTree 是否作为树返回
...@@ -79,10 +65,55 @@ interface ProductServiceInterface ...@@ -79,10 +65,55 @@ interface ProductServiceInterface
public function ingredients(array $columns = ['id', 'name', 'en_name']): array; public function ingredients(array $columns = ['id', 'name', 'en_name']): array;
/** /**
* 获取全部产品状态列表 * 通过id数组获取品类列表
* @param array $columns 默认['id', 'name'] * @param array $ids 默认去重
* @return array * @param array $columns
* @return array 默认keyBY('id')
*/
public function getCategoriesByIds(array $ids, array $columns = ['id', 'name', 'parent_id']): array;
/**
* 通过id数组获取品名列表
* @param array $ids 默认去重
* @param array $columns
* @param array $relations ['report_points']
* @return array 默认keyBY('id')
*/
public function getProductNamesByIds(array $ids, array $columns = ['id', 'name', 'en_name'], array $relations = []): array;
/**
* 通过id获取品类
* @param int $id
* @param array $columns
* @return array|null
*/
public function getCategoryById(int $id, array $columns = ['id', 'name', 'parent_id']);
/**
* 通过id获取品名
* @param int $id
* @param array $columns
* @param array $relations ['report_points']
* @return array|null
*/
public function getProductNameById(int $id, array $columns = ['id', 'name', 'en_name'], array $relations = []);
/**
* 通过id数组获取申报要素列表
* @param array $ids 默认去重
* @param array $columns
* @param array $relations ['product_name', 'ingredient']
* @return array 默认keyBY('id')
*/
public function getReportPointsByIds(array $ids, array $relations = [], array $columns = ['id', 'hs_code', 'point']): array;
/**
* 通过id获取申报要素
* @param int $id
* @param array $columns
* @param array $relations ['product_name', 'ingredient']
* @return array|null
*/ */
public function productStatus(array $columns = ['id', 'name']): array; public function getReportPointById(int $id, array $relations = [], array $columns = ['id', 'hs_code', 'point']);
} }
<?php
/**
* Created by PhpStorm.
* User: 姜克保
* Date: 2020/5/20
* Time: 15:48
*/
namespace Meibuyu\Micro\Service\Interfaces;
interface SocketIoServiceInterface
{
public function sendToUsers(array $userIdList, $message);
}
...@@ -10,4 +10,24 @@ namespace Meibuyu\Micro\Service\Interfaces; ...@@ -10,4 +10,24 @@ namespace Meibuyu\Micro\Service\Interfaces;
interface StoreServiceInterface interface StoreServiceInterface
{ {
/**
* 通过id列表获取仓库名称
* @param array $idList 仓库id的列表, 默认去重
* @param array $columns 仓库表的字段,默认显示全部
* @return array 默认keyBy('id')
*/
public function getByIdList(array $idList, array $columns = ['*']): array;
/**
* description:创建入库单
* author: fuyunnan
* @param array $data 需要入库的数组 格式请参考yapi 入库添加
* @return array
* @throws
* Date: 2020/7/6
*/
public function createWarehousing(array $data) : array ;
} }
...@@ -124,6 +124,9 @@ class ExcelImporter ...@@ -124,6 +124,9 @@ class ExcelImporter
public function checkRequire($requires, &$errorCount) public function checkRequire($requires, &$errorCount)
{ {
foreach ($requires as $k => $v) { foreach ($requires as $k => $v) {
if ($v == '0') {
continue;
}
if (!$v || $v === '') { if (!$v || $v === '') {
$this->setErrorMessage($k . "不能为空", $errorCount); $this->setErrorMessage($k . "不能为空", $errorCount);
return false; return false;
...@@ -141,7 +144,7 @@ class ExcelImporter ...@@ -141,7 +144,7 @@ class ExcelImporter
public function checkNumeric($data, &$errorCount) public function checkNumeric($data, &$errorCount)
{ {
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!$v || $v === '') { if (!$v || $v === '' || $v == '0') {
continue; continue;
} else { } else {
if (!is_numeric($v)) { if (!is_numeric($v)) {
......
...@@ -266,7 +266,7 @@ class Exporter ...@@ -266,7 +266,7 @@ class Exporter
* @param $pRange * @param $pRange
* @throws \PhpOffice\PhpSpreadsheet\Exception * @throws \PhpOffice\PhpSpreadsheet\Exception
*/ */
private function applyStyle($pRange) public function applyStyle($pRange)
{ {
$styleArray = [ $styleArray = [
'borders' => [ 'borders' => [
......
...@@ -451,6 +451,25 @@ if (!function_exists('putLog')) { ...@@ -451,6 +451,25 @@ if (!function_exists('putLog')) {
} }
if (!function_exists('http_to_server_url')) {
/**
* description:将前端的绝对路径转化为服务端相对路径
* author: fuyunnan
* @param string $path 需要转化的路径
* @return string
* @throws
* Date: 2020/6/24
*/
function http_to_server_url($path)
{
$path =ltrim(parse_url($path,PHP_URL_PATH),'/');
return 'public/'.$path;
}
}
if (!function_exists('empty_string_2_null')) { if (!function_exists('empty_string_2_null')) {
/** /**
* 空字符串转NULL * 空字符串转NULL
...@@ -660,4 +679,23 @@ if (!function_exists('make_has_relation_function')) { ...@@ -660,4 +679,23 @@ if (!function_exists('make_has_relation_function')) {
} }
if (!function_exists('int_to_chr')) {
/**
* 数字转字母 (类似于Excel列标)
* @param $index 索引值
* @param int $start 字母起始值
* @return string 返回字母
*/
function int_to_chr($index, $start = 65)
{
$str = '';
if (floor($index / 26) > 0) {
$str .= int_to_chr(floor($index / 26) - 1);
}
return $str . chr($index % 26 + $start);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment