Helius
2021-11-08 9d1fa7183a25cbef2c6de82fd1f75da4f2353173
Merge branch 'ty_fix' into alpha
15 files modified
1 files added
338 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java 105 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/LoginDto.java 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/bean/SysCompany.java 14 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/bean/SysUsers.java 10 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java 9 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/dao/SysUsersDao.java 1 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/service/SysUsersService.java 1 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/common/service/impl/SysUsersServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java 13 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/WeChatApiTools.java 18 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java 3 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml 8 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml 8 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html 12 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html 106 ●●●●● patch | view | raw | blame | history
zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java 15 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
@@ -1,5 +1,8 @@
package com.matrix.system.app.action;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.matrix.component.tools.HttpCurlUtil;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.*;
import com.matrix.system.app.authority.AppAuthorityManager;
@@ -8,9 +11,14 @@
import com.matrix.system.app.vo.UserInfoVo;
import com.matrix.system.common.authority.strategy.AccountPasswordLogin;
import com.matrix.system.common.authority.strategy.LoginStrategy;
import com.matrix.system.common.bean.SysCompany;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.init.LocalCache;
import com.matrix.system.common.init.UserCacheManager;
import com.matrix.system.common.interceptor.HostInterceptor;
import com.matrix.system.common.service.SysCompanyService;
import com.matrix.system.common.service.SysUsersService;
import com.matrix.system.common.tools.PasswordUtil;
import com.matrix.system.common.tools.UploadUtil;
@@ -19,10 +27,12 @@
import com.matrix.system.hive.plugin.util.CollectionUtils;
import com.matrix.system.hive.plugin.util.ImageUtil;
import com.matrix.system.hive.service.SysShopInfoService;
import com.matrix.system.shopXcx.api.WeChatApiTools;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.sf.json.JSONObject;
import org.apache.commons.fileupload.FileUploadException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -62,6 +72,14 @@
    @Autowired
    private BusParameterSettingsDao busParameterSettingsDao;
    @Autowired
    private SysCompanyService sysCompanyService;;
    @Autowired
    WeChatApiTools weChatApiTools;
    @Autowired
    private UserCacheManager userCacheManager;
    @Value("${file_storage_path}")
    private String fileStoragePath;
@@ -252,6 +270,93 @@
    }
    @ApiOperation(value = "根据企业编码获取对应的请求地址")
    @PostMapping(value = "/getUrlByCompanyCode")
    public AjaxResult getUrlByCompanyCode(@RequestBody SettingDto codeDto) {
        SysCompany query = new SysCompany();
        query.setComCode(codeDto.getCode());
        List<SysCompany> list = sysCompanyService.findByModel(query);
        if (CollUtil.isEmpty(list)) {
            return new AjaxResult(AjaxResult.STATUS_FAIL, "企业编码有误");
        }
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.putInMap("url", list.get(0).getComWebUrl());
        return ajaxResult;
    }
    @ApiOperation(value = "管理端小程序登录")
    @PostMapping(value = "/wxLogin/{code}")
    public AjaxResult wxLogin(@PathVariable("code") String code) throws IOException {
        if (StrUtil.isBlank(code)) {
            return AjaxResult.buildFailInstance("code不存在");
        }
        AjaxResult res = new AjaxResult();
        String requrl = weChatApiTools.getXcxLoginUrl(code, HostInterceptor.getCompanyId(), AppConstance.MINI_PROGRAM_MANAGER_APP_ID);
        String resultData = HttpCurlUtil.sendGetHttp(requrl, null);
        JSONObject json = JSONObject.fromObject(resultData);
        LogUtil.debug("管理端小程序登录获取到登录信息={}", json);
        if (json.containsKey("errcode")) {
            res.setStatus(AjaxResult.STATUS_FAIL);
            res.setInfo("自动登录失败");
            LogUtil.info("微信登录获取到异常信息errcode");
            return res;
        }
        String openId = json.getString("openid");
        res.setStatus(AjaxResult.STATUS_SUCCESS);
        res.putInMap("openId", openId);
        SysUsers hasBind = sysUsersService.findByOpenId(openId, HostInterceptor.getCompanyId());
        if (hasBind == null) {
            res.setInfo("未绑定用户");
            return res;
        }
        String token = userCacheManager.saveUserInfo(hasBind);
        LogUtil.info("用户token={}", token);
        res.putInMap("token", token);
        res.putInMap("userInfo", hasBind);
        return res;
    }
    @ApiOperation(value = "绑定用户")
    @PostMapping(value = "/bindUser")
    public AjaxResult bindUser(@RequestBody @Validated LoginDto loginDto) {
        SysUsers user = new SysUsers();
        user.setSuAccount(loginDto.getUsername());
        user.setSuPassword(loginDto.getPassword());
        LoginStrategy apLogin = new AccountPasswordLogin(user, sysUsersService);
        user = authorityManager.login(apLogin);
        user.setSuPassword(null);
        user.setOpenIds(null);
        String token = userCacheManager.saveUserInfo(user);
        AjaxResult result = AjaxResult.buildSuccessInstance("登陆成功");
        authorityManager.initUserPower(result, user);
        result.putInMap("token", token);
        result.putInMap("userInfo", user);
        synchronized (this) {
            SysUsers hasBind = sysUsersService.findByOpenId(loginDto.getOpenId(), HostInterceptor.getCompanyId());
            if (hasBind != null) {
                if(StrUtil.isNotBlank(hasBind.getOpenIds())) {
                    List<String> openIds = StrUtil.split(hasBind.getOpenIds(), ',');
                    openIds.remove(loginDto.getOpenId());
                    hasBind.setOpenIds(CollUtil.join(openIds, ","));
                    sysUsersService.modifyByModel(hasBind);
                }
            }
            List<String> openIds = StrUtil.split(user.getOpenIds(), ',');
            openIds.add(loginDto.getOpenId());
            user.setOpenIds(CollUtil.join(openIds, ","));
            sysUsersService.modifyByModel(user);
        }
        return result;
    }
}
zq-erp/src/main/java/com/matrix/system/app/dto/LoginDto.java
@@ -20,6 +20,16 @@
    @NotBlank(message = "用户名或密码错误")
    private String password;
    private String openId;
    public String getOpenId() {
        return openId;
    }
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getUsername() {
        return username;
    }
zq-erp/src/main/java/com/matrix/system/common/bean/SysCompany.java
@@ -134,8 +134,16 @@
            
    
    private String  comPlats;
    private String comCode;
    public String getComCode() {
        return comCode;
    }
    public void setComCode(String comCode) {
        this.comCode = comCode;
    }
    public Long getComId() {
        return comId;
@@ -333,7 +341,7 @@
       public void setComPlats(String comPlats) {
        this.comPlats=comPlats;
    }
    @Override
    public String toString() {
zq-erp/src/main/java/com/matrix/system/common/bean/SysUsers.java
@@ -288,6 +288,16 @@
    @Extend
    private SysCompany company;
    private String openIds;
    public String getOpenIds() {
        return openIds;
    }
    public void setOpenIds(String openIds) {
        this.openIds = openIds;
    }
    public String getAllCustomer() {
        return allCustomer;
    }
zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
@@ -606,7 +606,14 @@
     */
    public static final String WX_ORDER_NOTICE_DINGDING_TOKEN = "wxOrderNoticeDingdingToken";
    /**
     * 管理端小程序appid
     */
    public static final String MINI_PROGRAM_MANAGER_APP_ID = "miniProgramManagerAppId";
    /**
     * 管理端小程序secret
     */
    public static final String MINI_PROGRAM_MANAGER_SECRET = "miniProgramManagerSecret";
zq-erp/src/main/java/com/matrix/system/common/dao/SysUsersDao.java
@@ -125,4 +125,5 @@
    public List<AppVersion> selectAppVersion();
    SysUsers selectUserByOpenId(@Param("openId") String openId, @Param("companyId") Long companyId);
}
zq-erp/src/main/java/com/matrix/system/common/service/SysUsersService.java
@@ -173,4 +173,5 @@
    public List<AppVersion> findAppVersion();
    SysUsers findByOpenId(String openId, Long companyId);
}
zq-erp/src/main/java/com/matrix/system/common/service/impl/SysUsersServiceImpl.java
@@ -270,4 +270,9 @@
    public List<AppVersion> findAppVersion() {
        return sysUsersDao.selectAppVersion();
    }
    @Override
    public SysUsers findByOpenId(String openId, Long companyId) {
        return sysUsersDao.selectUserByOpenId(openId);
    }
}
zq-erp/src/main/java/com/matrix/system/hive/bean/ShoppingGoods.java
@@ -449,6 +449,19 @@
     */
    private String payMethods;
    /**
     * 是否合作项目
     */
    private Integer isCooperate;
    public Integer getIsCooperate() {
        return isCooperate;
    }
    public void setIsCooperate(Integer isCooperate) {
        this.isCooperate = isCooperate;
    }
    public String getAchieveRuleName() {
        return achieveRuleName;
    }
zq-erp/src/main/java/com/matrix/system/shopXcx/api/WeChatApiTools.java
@@ -45,9 +45,12 @@
     * @param code
     * @return
     */
    public  String getXcxLoginUrl(String code,Long companyId) {
    public  String getXcxLoginUrl(String code,Long companyId, String type) {
        String wechatLoginUrl = PropertiesUtil.getString(WECHAT_LOGIN_URL);
        return String.format(wechatLoginUrl, getAppid(companyId), getSecret(companyId), code);
        if (AppConstance.MINIPROGRAM_APPID.equals(type)) {
            return String.format(wechatLoginUrl, getAppid(companyId), getSecret(companyId), code);
        } else {
            return String.format(wechatLoginUrl, getManagerAppId(companyId), getManagerSecret(companyId), code);        }
    }
    /**
@@ -68,6 +71,17 @@
        return  secret.getParamValue();
    }
    public String getManagerAppId(Long companyId) {
        BusParameterSettings appId = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.MINI_PROGRAM_MANAGER_APP_ID, companyId);
        return  appId.getParamValue();
    }
    public  String  getManagerSecret(Long companyId){
        BusParameterSettings secret = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.MINI_PROGRAM_MANAGER_SECRET, companyId);
        return  secret.getParamValue();
    }
    /**
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
@@ -2,6 +2,7 @@
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.init.UserCacheManager;
import com.matrix.component.tools.HttpCurlUtil;
import com.matrix.core.pojo.AjaxResult;
@@ -93,7 +94,7 @@
        AjaxResult res = new AjaxResult();
        LogUtil.info("code:{}" + code);
        if (StringUtils.isNotBlank(code)) {
            String requrl = weChatApiTools.getXcxLoginUrl(code, HostInterceptor.getCompanyId());
            String requrl = weChatApiTools.getXcxLoginUrl(code, HostInterceptor.getCompanyId(), AppConstance.MINIPROGRAM_APPID);
            String reslutData = HttpCurlUtil.sendGetHttp(requrl, null);
            JSONObject json = JSONObject.fromObject(reslutData);
            LogUtil.debug("微信登录获取到登录信息={}", json);
zq-erp/src/main/resources/mybatis/mapper/common/SysUsersDao.xml
@@ -1328,4 +1328,12 @@
    <select id="selectAppVersion" resultType="com.matrix.system.hive.bean.AppVersion">
        select * from app_version
    </select>
    <select id="selectUserByOpenId" resultMap="SysUsersMap">
        select * from sys_users where find_in_set(#{openId}, open_ids)
        <if test="companyId != null">
            and company_id=#{companyId}
        </if>
    </select>
</mapper>
zq-erp/src/main/resources/mybatis/mapper/hive/ShoppingGoodsDao.xml
@@ -308,8 +308,8 @@
        invalid_time,
        pay_methods,
        is_infinite,
        achieve_rule_id
        achieve_rule_id,
        is_cooperate
        )
        VALUES (
        #{id},
@@ -371,8 +371,8 @@
            #{invalidTime},
            #{payMethods},
            #{isInfinite},
            #{achieveRuleId}
            #{achieveRuleId},
            #{isCooperate}
        )
    </insert>
zq-erp/src/main/resources/templates/views/admin/hive/products/goods-form.html
@@ -234,6 +234,17 @@
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="10">
                        <el-form-item label="是否合作项目">
                            <el-radio-group v-model="form.isCooperate">
                                <el-radio label="2">否</el-radio>
                                <el-radio label="1">是</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <p class="el-big-title">销售设置</p>
@@ -1145,6 +1156,7 @@
            //表单数据
            form: {
                isPresent: '否',
                isCooperate: '2',
                staus: '上架',
                //产品组合
                assembleGoods: [],
zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-beauty-list.html
New file
@@ -0,0 +1,106 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
    content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
    <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
    <script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
    <script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
    <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
    <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" th:src="@{/js/function/public.js}"></script>
</head>
<style>
    .table-style {
        margin: 20px 0;
        padding: 20px 10px;
        border: 1px solid #DCDFE6;
        background-color: white;
    }
</style>
<body>
<div id="app" style="">
    <el-row class="table-style">
        <el-table :data="tableData" style="width: 100%">
            <el-table-column type="index" width="30" fixed="left"></el-table-column>
            <el-table-column prop="datatime" width="150" label="时间" fixed="left"></el-table-column>
            <el-table-column prop="orderType" label="美疗师" fixed="left"></el-table-column>
            <el-table-column prop="orderType" label="客户" fixed="left"></el-table-column>
            <el-table-column prop="orderType" label="是否指定客" width="100"></el-table-column>
            <el-table-column label="客流">
                <el-table-column prop="orderType" label="是否会员"></el-table-column>
                <el-table-column prop="orderType" label="到店途径"></el-table-column>
                <el-table-column prop="orderType" label="当月到店次数" width="120"></el-table-column>
            </el-table-column>
            <el-table-column label="实操业绩">
                <el-table-column prop="orderType" label="项目->消耗产品" width="130"></el-table-column>
                <el-table-column prop="orderType" label="消费类型"></el-table-column>
                <el-table-column prop="orderType" label="项目数量"></el-table-column>
                <el-table-column prop="orderType" label="手工费"></el-table-column>
                <el-table-column prop="orderType" label="耗卡"></el-table-column>
            </el-table-column>
            <el-table-column label="现金业绩">
                <el-table-column prop="orderType" label="特色项目"></el-table-column>
                <el-table-column prop="orderType" label="团购销售"></el-table-column>
                <el-table-column prop="orderType" label="卡项销售"></el-table-column>
                <el-table-column prop="orderType" label="产品销售"></el-table-column>
                <el-table-column prop="orderType" label="会员充值"></el-table-column>
                <el-table-column prop="orderType" label="总业绩"></el-table-column>
                <el-table-column prop="orderType" label="划卡"></el-table-column>
            </el-table-column>
        </el-table>
        <el-row style="margin-top: 10px;">
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="page.currentPage"
                    :page-sizes="[10, 20, 30, 50]"
                    :page-size="page.size"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="page.total">
            </el-pagination>
        </el-row>
    </el-row>
</div>
<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script>
<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
<script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
<script type="text/javascript">
    var vue = new Vue({
        el : "#app",
        data : {
            tableData : [],
            page : {
                currentPage : 1,
                size : 10,
                total : 0
            }
        },
        created : function() {
        },
        methods : {
            handleSizeChange(val) {
                this.page.size = val;
                this.queryTableData();
            },
            handleCurrentChange(val) {
                this.page.currentPage = val;
                this.queryTableData();
            },
        }
    })
</script>
</body>
</html>
zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java
@@ -126,6 +126,21 @@
        newSetting11.setCategory("店务配置");
        newSettings.add(newSetting11);
        ParameterSettings newSetting12=new ParameterSettings();
        newSetting12.setCode(AppConstance.MINI_PROGRAM_MANAGER_APP_ID);
        newSetting12.setName("管理端小程序AppID");
        newSetting12.setType(1);
        newSetting12.setCategory("微信开发配置");
        newSettings.add(newSetting12);
        ParameterSettings newSetting13=new ParameterSettings();
        newSetting13.setCode(AppConstance.MINI_PROGRAM_MANAGER_SECRET);
        newSetting13.setName("管理端小程序Secret");
        newSetting13.setType(1);
        newSetting13.setCategory("微信开发配置");
        newSettings.add(newSetting13);
        for (ParameterSettings newSetting : newSettings) {