zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java | ●●●●● patch | view | raw | blame | history | |
zq-erp/src/main/java/com/matrix/system/app/vo/ParameterSettingVo.java | ●●●●● patch | view | raw | blame | history | |
zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java | ●●●●● patch | view | raw | blame | history | |
zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java | ●●●●● patch | view | raw | blame | history | |
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductCommentAction.java | ●●●●● patch | view | raw | blame | history | |
zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java | ●●●●● patch | view | raw | blame | history | |
zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java | ●●●●● patch | view | raw | blame | history |
zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
@@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSONObject; import com.matrix.component.redis.RedisClient; import com.matrix.core.constance.MatrixConstance; import com.matrix.core.pojo.AjaxResult; import com.matrix.core.tools.*; import com.matrix.system.app.authority.AppAuthorityManager; @@ -11,10 +12,11 @@ import com.matrix.system.app.dto.UploadPhotoDto; import com.matrix.system.app.utils.Sms106Send; import com.matrix.system.app.vo.UserInfoVo; import com.matrix.system.common.authority.DefaultAuthorityManager; import com.matrix.system.common.authority.strategy.AccountPasswordLogin; import com.matrix.system.common.authority.strategy.LoginStrategy; 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.service.SysUsersService; import com.matrix.system.common.tools.PasswordUtil; import com.matrix.system.common.tools.UploadUtil; @@ -62,6 +64,9 @@ @Autowired private AppAuthorityManager authorityManager; @Autowired private BusParameterSettingsDao busParameterSettingsDao; @Autowired private RedisClient redisClient; @@ -220,4 +225,21 @@ public AjaxResult findAppVersion() { return AjaxResult.buildSuccessInstance(sysUsersService.findAppVersion()); } @ApiOperation(value = "获取app配置", notes = "获取app配置") @ApiResponses({ @ApiResponse(code = 200, message = "ok", response = AppVersion.class) }) @GetMapping(value = "/findAppSettings") public AjaxResult findAppSettings() { SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); AjaxResult result = AjaxResult.buildSuccessInstance("查询成功"); result.putInMap(AppConstance.APP_BANNER_GL, busParameterSettingsDao.selectCompanyParamByCode(AppConstance.APP_BANNER_GL,user.getCompanyId())); return result; } } zq-erp/src/main/java/com/matrix/system/app/vo/ParameterSettingVo.java
New file @@ -0,0 +1,39 @@ package com.matrix.system.app.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * jyy */ @Data @ApiModel(value = "ParameterSettingVo", description = "配置返回参数类") public class ParameterSettingVo { @ApiModelProperty(value = "参数编码ID") private Long paramId; @ApiModelProperty(value = "参数编码") private String paramCode; @ApiModelProperty(value = "参数值") private String paramValue; @ApiModelProperty(value = "值1") private String paramValue1; @ApiModelProperty(value = "值2") private String paramValue2; @ApiModelProperty(value = "值3") private String paramValue3; } zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java
@@ -553,6 +553,14 @@ */ public static final String WECHARPAY_CERTLOCAL_PATH = "certLocalPath"; /** * APP管理模块Banner */ public static final String APP_BANNER_GL = "APP_BANNER_GL"; zq-erp/src/main/java/com/matrix/system/score/service/ScoreVipDetailService.java
@@ -6,9 +6,11 @@ import com.matrix.core.constance.MatrixConstance; import com.matrix.core.exception.GlobleException; import com.matrix.core.tools.DateUtil; import com.matrix.core.tools.StringUtils; import com.matrix.system.common.bean.BusParameterSettings; import com.matrix.system.common.dao.BusParameterSettingsDao; import com.matrix.system.common.dao.SysUsersDao; import com.matrix.system.hive.bean.SysVipInfo; import com.matrix.system.hive.dao.SysVipInfoDao; import com.matrix.system.score.constant.ScoreSettingConstant; import com.matrix.system.score.dao.ScoreUseRecordDao; @@ -86,8 +88,6 @@ scoreVipDetailDao.updateById(scoreVipDetail); score=Math.abs(surplus); } //新增扣除记录 @@ -180,6 +180,65 @@ } /** * 根据固定等级规则新增用户积分 */ @Transactional(rollbackFor = Exception.class) public void addScoreByParamSetting(Long vipId, Long oprationUserId, Long shopId, Integer firstScore, Long businessId, int type, String remark, BusParameterSettings parameterSetting) { SysVipInfo vipInfo = sysVipInfoDao.selectById(vipId); //添加自己的积分 if (firstScore > 0) { addScore( vipInfo.getId(), oprationUserId, shopId, firstScore, businessId, type, remark ); } if (StringUtils.isNotBlank(parameterSetting.getParamValue()) && vipInfo.getRecommendId() != null) { //推荐注册老带新积分奖励 SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId()); Integer secondScore = new Integer(parameterSetting.getParamValue()); if (secondScore > 0) { addScore( referrerVip.getId(), oprationUserId, shopId, secondScore, businessId, type, remark ); } //推荐注册二级带新积分奖励 if (StringUtils.isNotBlank(parameterSetting.getParamValue1()) && referrerVip.getRecommendId() != null) { Integer threeScore = new Integer(parameterSetting.getParamValue()); if (threeScore > 0) { addScore( referrerVip.getRecommendId(), oprationUserId, shopId, threeScore, businessId, type, remark ); } } } } /** * 退积分 */ public void refundScore(Long vipId, Integer score, Long oldBusinessId, int type){ zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxProductCommentAction.java
@@ -5,6 +5,7 @@ import com.matrix.component.redis.RedisUserLoginUtils; import com.matrix.system.common.constance.AppConstance; import com.matrix.system.score.service.ScoreVipDetailService; import com.matrix.system.shopXcx.bean.ShopOrder; import com.matrix.system.shopXcx.bean.ShopProductComment; import com.matrix.system.shopXcx.dao.ShopOrderDao; @@ -52,6 +53,9 @@ return new AjaxResult(AjaxResult.STATUS_SUCCESS, "删除成功"); } @Autowired ScoreVipDetailService scoreVipDetailService; /** * 接收保存产品评价数据 */ @@ -81,6 +85,10 @@ modifyMap.put("id", orderId); modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_ALREADY_REMARK); shopOrderDao.updateByMap(modifyMap); //scoreVipDetailService.addScoreByParamSetting(loginUser.getId(),null,); return new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功"); } zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxUserAction.java
@@ -108,10 +108,10 @@ sysVipInfo.setSessionKey(sessionKey); sysVipInfo.setCompanyId(HostInterceptor.getCompanyId()); sysVipInfo.setArrivalWay("微商城"); sysVipInfo.setVipName("微信用户"); sysVipInfo.setVipState(Dictionary.VIP_STATE_HY); sysVipInfo.setVipType(Dictionary.VIP_TYPE_NOCARD); sysVipInfo.setIsDeal(SysVipInfo.UNDEAL_VIP); sysVipInfo.setVipNo(openId); sysVipInfoService.add(sysVipInfo); @@ -177,7 +177,7 @@ BeanUtil.copyProperties(xcxUserSaveUserInfoDto,sysVipInfo); sysVipInfo.setPhone(xcxUserSaveUserInfoDto.getPhoneNumber()); if(StringUtils.isBlank(loginUser.getVipName())){ if(StringUtils.isBlank(loginUser.getVipName())||loginUser.getVipName().equals("微信用户")){ sysVipInfo.setVipName(xcxUserSaveUserInfoDto.getNickName()); } if(StringUtils.isBlank(loginUser.getSex())){ zq-erp/src/test/java/com/matrix/ParameterSettingsTool.java
New file @@ -0,0 +1,92 @@ package com.matrix; import cn.hutool.core.collection.CollectionUtil; import com.matrix.system.common.bean.BusParameterSettings; import com.matrix.system.common.bean.SysCompany; import com.matrix.system.common.dao.BusParameterSettingsDao; import com.matrix.system.common.dao.SysCompanyDao; import com.matrix.system.hive.bean.ParameterSettings; import com.matrix.system.hive.dao.ParameterSettingsDao; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.ArrayList; import java.util.List; /** * 配置工具 * * @author jiangyouyao * @email 512061637@qq.com * @date 2019年2月25日 */ @RunWith(SpringRunner.class) @SpringBootTest(classes = {ZqErpApplication.class},webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT) public class ParameterSettingsTool { @Autowired private ParameterSettingsDao parameterSettingsDao; @Autowired private BusParameterSettingsDao busParameterSettingsDao; @Autowired private SysCompanyDao sysCompanyDao; /* 给所有公司加上多个配置,如果已经存在则跳过 */ @Test public void addSettings(){ List<ParameterSettings> newSettings=new ArrayList<>(); ParameterSettings newSetting1=new ParameterSettings(); newSetting1.setCode("APP_BANNER_GL"); newSetting1.setName("APP管理模块Banner"); newSetting1.setType(1); newSetting1.setCategory("APP设置"); newSettings.add(newSetting1); for (ParameterSettings newSetting : newSettings) { List<ParameterSettings> parameterSettings = parameterSettingsDao.selectByModel(newSetting); if(CollectionUtil.isEmpty(parameterSettings)){ parameterSettingsDao.insert(newSetting); System.out.println("新增配置"+newSetting.getName()); }else { System.out.println("配置"+newSetting.getName()+"已经存在"); } addSettingsTOAllCompany(newSetting); } } private void addSettingsTOAllCompany(ParameterSettings newSetting) { List<SysCompany> allCompany = sysCompanyDao.selectByModel(null); for (SysCompany sysCompany : allCompany) { BusParameterSettings checkExist = busParameterSettingsDao.selectCompanyParamByCode(newSetting.getCode(), sysCompany.getComId()); if(checkExist==null){ BusParameterSettings busParameterSettings=new BusParameterSettings(); busParameterSettings.setCompanyId(sysCompany.getComId()); busParameterSettings.setParamCode(newSetting.getCode()); busParameterSettings.setParamValue(""); busParameterSettingsDao.insert(busParameterSettings); System.out.println(sysCompany.getComName()+"新增成功"); }else{ System.out.println("公司"+sysCompany.getComName()+"已经存在配置"+newSetting.getName()); } } } }