1 files deleted
93 files modified
41 files added
| | |
| | | <include>**/*.woff2</include> |
| | | <include>**/*.ttf</include> |
| | | <include>**/*.xls</include> |
| | | <include>**/*.xml</include> |
| | | </includes> |
| | | </resource> |
| | | |
| | |
| | | </repository> |
| | | |
| | | |
| | | |
| | | <repository> |
| | | <id>repository.jboss.org-public</id> |
| | | <name>JBoss.org Maven repository</name> |
| | | <url>https://repository.jboss.org/nexus/content/groups/public</url> |
| | | </repository> |
| | | |
| | | |
| | | </repositories> |
| | |
| | | |
| | | if (ex instanceof GlobleException) { |
| | | // 如果是内部全局异常 |
| | | LogUtil.warn("#程序抛出全局异常#", ex); |
| | | LogUtil.error("#程序抛出全局异常#", ex); |
| | | GlobleException globleException = (GlobleException) ex; |
| | | attr.put("status", globleException.getErrorCode()); |
| | | attr.put("info", globleException.getMessage()); |
| | |
| | | } else { |
| | | |
| | | // 非内部异常 |
| | | LogUtil.error("#程序抛出未捕获异常#", ex); |
| | | LogUtil.error("#程序抛出未捕获异常#"); |
| | | attr.put("status", 999999); |
| | | attr.put("info", InternationaUtil.getMesssge(SystemErrorCode.SYSTEM_UNKNOW_ERROR)); |
| | | // 发送异常信息到管理群 |
| | |
| | | @Data |
| | | public class VerificationResult { |
| | | |
| | | /** |
| | | * 审核结果 |
| | | */ |
| | | private boolean judgeResult; |
| | | |
| | | private String msg; |
| | | |
| | | private Object info; |
| | | |
| | | |
| | | private VerificationResult(){ |
| | | |
| | | } |
| | | |
| | | public static VerificationResult success(){ |
| | | return buildVerificationResult(true); |
| | | } |
| | | |
| | | public static VerificationResult success(String msg){ |
| | | return buildVerificationResult(true,msg); |
| | | } |
| | | |
| | | |
| | | public static VerificationResult fail(){ |
| | | return buildVerificationResult(false); |
| | | } |
| | | |
| | | public static VerificationResult fail(String msg){ |
| | | return buildVerificationResult(false,msg); |
| | | } |
| | | |
| | | |
| | | public static VerificationResult buildVerificationResult(boolean judgeResult){ |
| | | VerificationResult obj=new VerificationResult(); |
| | | obj.judgeResult =judgeResult; |
New file |
| | |
| | | package com.matrix.core.tools; |
| | | |
| | | import java.util.List; |
| | | import java.util.function.Function; |
| | | |
| | | public class ParamCheckUtil { |
| | | |
| | | /** |
| | | * 校验列表参数不能为空 |
| | | * |
| | | * @param args |
| | | */ |
| | | public static void requireNonNulls(Object... args) { |
| | | if (args == null || args.length < 0) { |
| | | throw new NullPointerException("参数校验列表为空"); |
| | | } |
| | | for (int i = 0; i < args.length; i++) { |
| | | if (args[i] == null) { |
| | | throw new NullPointerException(String.format("参数校验列表第%s个参数为空", i + 1)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验集合中的参数不能为空 |
| | | * requireListElementNonNull(objects, Arrays.asList(OrderItemDto::getCount, OrderItemDto::getGoodsId)); |
| | | * @param |
| | | */ |
| | | public static <T> void requireListElementNonNull(List<T> list, List<Function<? super T, ? extends Object>> getterFunctions) { |
| | | |
| | | requireNonNulls(list,getterFunctions); |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | for (int j = 0; j < getterFunctions.size(); j++) { |
| | | if(getterFunctions.get(j).apply(list.get(i))==null){ |
| | | throw new NullPointerException(String.format("集合中第%s个对象第%s参数为空",i+1,j+1)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.ShoppingGoodsCategory; |
| | | import com.matrix.system.hive.bean.SysOrder; |
| | | import com.matrix.system.hive.bean.SysOrderItem; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.hive.pojo.ShoppingCarItem; |
| | | import com.matrix.system.hive.pojo.ShoppingCarItemsVo; |
| | | import com.matrix.system.hive.service.ShoppingGoodsCategoryService; |
| | | import com.matrix.system.hive.service.ShoppingGoodsService; |
| | |
| | | @ApiOperation(value = "创建订单", notes = "创建订单") |
| | | @PostMapping(value = "/createOrder") |
| | | public AjaxResult createOrder(@RequestBody @Validated CreateOrderDto createOrderDto) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | SysOrder order=new SysOrder(); |
| | | order.setVipId(createOrderDto.getVipId()); |
| | | ShoppingCarItemsVo car = new ShoppingCarItemsVo(); |
| | | car.setVipId(createOrderDto.getVipId()); |
| | | |
| | | if (CollectionUtils.isNotEmpty(createOrderDto.getItems())) { |
| | | List<ShoppingCarItem> list = new ArrayList<>(); |
| | | List<SysOrderItem> list = new ArrayList<>(); |
| | | for (CreateOderItemDto item : createOrderDto.getItems()) { |
| | | ShoppingCarItem carItem = new ShoppingCarItem(); |
| | | carItem.setCount(item.getCount()); |
| | | carItem.setGoodsId(item.getGoodsId()); |
| | | carItem.setIsFree(item.getIsFree()); |
| | | carItem.setType(item.getGoodsType()); |
| | | |
| | | carItem.setShoppingGoods(shoppingGoodsService.findById(item.getGoodsId())); |
| | | list.add(carItem); |
| | | SysOrderItem orderItem = new SysOrderItem(); |
| | | orderItem.setCount(item.getCount()); |
| | | orderItem.setGoodsId(item.getGoodsId()); |
| | | orderItem.setIsFree(item.getIsFree()); |
| | | //jyytodo 这个字段可以不传 |
| | | orderItem.setType(item.getGoodsType()); |
| | | list.add(orderItem); |
| | | } |
| | | car.setCarItems(list); |
| | | order.setItems(list); |
| | | } |
| | | int i = sysOrderService.createOrder(WebUtil.getSession(), car); |
| | | if (i > 0) { |
| | | return AjaxResult.buildSuccessInstance("下单成功"); |
| | | } |
| | | |
| | | return AjaxResult.buildFailInstance("下单失败"); |
| | | sysOrderService.checkAndSaveOrder(order); |
| | | return AjaxResult.buildSuccessInstance("下单成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取订单列表", notes = "获取订单列表") |
| | |
| | | @ApiModelProperty(value = "数量") |
| | | private String count; |
| | | |
| | | @ApiModelProperty(value = "产品类型") |
| | | private String type; |
| | | |
| | | @ApiModelProperty(value = "现金支付") |
| | | private BigDecimal cashPay; |
| | | |
| | |
| | | @ApiModelProperty(value = "订单业绩") |
| | | private List<OrderDetailAchieveItemVo> achieves; |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | |
| | | package com.matrix.system.common.actions; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | 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.enums.BooleanEnum; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.ParameterSettings; |
| | | import com.matrix.system.hive.dao.ParameterSettingsDao; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | BusParameterSettings newParam=new BusParameterSettings(); |
| | | newParam.setParamCode(parameterSetting.getCode()); |
| | | newParam.setCompanyId(user.getCompanyId()); |
| | | newParam.setParamValue(parameterSetting.getUserValue()); |
| | | if(BooleanEnum.TRUE.getDisplayName().equals(parameterSetting.getUserValue())){ |
| | | newParam.setParamValue(String.valueOf(BooleanEnum.TRUE.getValue())); |
| | | }else if(BooleanEnum.FALSE.getDisplayName().equals(parameterSetting.getUserValue())){ |
| | | newParam.setParamValue(String.valueOf(BooleanEnum.FALSE.getValue())); |
| | | }else{ |
| | | newParam.setParamValue(parameterSetting.getUserValue()); |
| | | } |
| | | if(type==SHOP){ |
| | | newParam.setShopId(user.getShopId()); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping(value = "/getSystemName") |
| | | public @ResponseBody |
| | | AjaxResult getSystemName() { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | List codes = new ArrayList<>(); |
| | | codes.add(AppConstance.ADMIN_SYSTEM_TITLE); |
| | | List<BusParameterSettings> dataList = busParameterSettingsDao.selectByCodesAndCompanyId(codes, user.getCompanyId()); |
| | | String paramValue = ""; |
| | | if(CollUtil.isNotEmpty(dataList)){ |
| | | paramValue = dataList.get(0).getParamValue(); |
| | | }else{ |
| | | paramValue = "讯聪管理系统"; |
| | | } |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, paramValue); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | this.paramCode = paramCode; |
| | | } |
| | | |
| | | public Integer getIntParamValue(){ |
| | | return Integer.parseInt(this.paramValue); |
| | | } |
| | | |
| | | public String getParamValue() { |
| | | return paramValue; |
| | |
| | | */ |
| | | public static final String WX_ORDER_NOTICE_DINGDING_TOKEN = "wxOrderNoticeDingdingToken"; |
| | | |
| | | /** |
| | | * 系统名称 |
| | | */ |
| | | public static final String ADMIN_SYSTEM_TITLE = "ADMIN_SYSTEM_TITLE"; |
| | | |
| | | /** |
| | | * 品牌名称 |
| | | */ |
| | | public static final String ADMIN_BRAND_TITLE = "ADMIN_BRAND_TITLE"; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | package com.matrix.system.common.service; |
| | | |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.SysCompany; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant; |
| | | import com.matrix.system.score.constant.ScoreSettingConstant; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | |
| | | return ( |
| | | Objects.nonNull(busParameterSettings) |
| | | && StringUtils.isNotBlank(busParameterSettings.getParamValue()) |
| | | && AppConstance.IS_Y.equals(busParameterSettings.getParamValue()) |
| | | // && AppConstance.IS_Y.equals(busParameterSettings.getParamValue()) |
| | | && BooleanEnum.TRUE.getValue() == busParameterSettings.getIntParamValue() |
| | | ); |
| | | } |
| | | |
| | |
| | | public boolean updateCheckRepeatTowColumn(String tableName, String column1, Object value1, String column2, |
| | | Object value2, String idName, Object idValue) { |
| | | HashMap<String, Object> query = excuteTow(tableName, column1, value1, column2, value2); |
| | | |
| | | |
| | | return query != null && !query.get(idName).equals(idValue); |
| | | } |
| | | |
New file |
| | |
| | | /** |
| | | * projectName: h3-warehouse |
| | | * fileName: GroupValidateStatusCheckUtil.java |
| | | * packageName: com.hydee.h3.warehouse.util |
| | | * date: 2020-05-22 10:48 |
| | | * copyright(c) 2020 http://www.hydee.cn/ Inc. All rights reserved. |
| | | */ |
| | | package com.matrix.system.common.validate; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import org.slf4j.Logger; |
| | | |
| | | /** |
| | | * 参数校验工具 |
| | | **/ |
| | | public class GroupValidateStatusCheckUtil { |
| | | |
| | | public static void check(Object o, Class group) { |
| | | |
| | | LogUtil.info("操作:{},参数:{}", "参数校验", JSON.toJSONString(o)); |
| | | |
| | | ParameterValidate.ValidResult acceptanceResult = ParameterValidate.validateBean(o, group); |
| | | if (acceptanceResult.hasErrors()) { |
| | | throw new GlobleException(acceptanceResult.getErrors()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * projectName: h3-organization |
| | | * fileName: HDValidateResult.java |
| | | * packageName: com.hydee.common.validate |
| | | * date: 2019-06-17 14:46 |
| | | * copyright(c) 2019 http://www.hydee.cn/ Inc. All rights reserved. |
| | | */ |
| | | package com.matrix.system.common.validate; |
| | | |
| | | import org.springframework.beans.PropertyEditorRegistry; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.Errors; |
| | | import org.springframework.validation.FieldError; |
| | | import org.springframework.validation.ObjectError; |
| | | |
| | | import java.beans.PropertyEditor; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @version: V1.0 |
| | | * @author: LiHengye |
| | | * @className: HDValidateResult |
| | | * @packageName: com.hydee.common.validate |
| | | * @description: 校验结果 |
| | | * @data: 2019-06-17 14:46 |
| | | **/ |
| | | public class HDValidateResult implements BindingResult { |
| | | @Override |
| | | public Object getTarget() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getModel() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Object getRawFieldValue(String s) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public PropertyEditor findEditor(String s, Class<?> aClass) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public PropertyEditorRegistry getPropertyEditorRegistry() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String[] resolveMessageCodes(String s) { |
| | | return new String[0]; |
| | | } |
| | | |
| | | @Override |
| | | public String[] resolveMessageCodes(String s, String s1) { |
| | | return new String[0]; |
| | | } |
| | | |
| | | @Override |
| | | public void addError(ObjectError objectError) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public String getObjectName() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void setNestedPath(String s) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public String getNestedPath() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void pushNestedPath(String s) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void popNestedPath() throws IllegalStateException { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void reject(String s) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void reject(String s, String s1) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void reject(String s, Object[] objects, String s1) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void rejectValue(String s, String s1) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void rejectValue(String s, String s1, String s2) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void rejectValue(String s, String s1, Object[] objects, String s2) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void addAllErrors(Errors errors) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasErrors() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public int getErrorCount() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<ObjectError> getAllErrors() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasGlobalErrors() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public int getGlobalErrorCount() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<ObjectError> getGlobalErrors() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public ObjectError getGlobalError() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasFieldErrors() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public int getFieldErrorCount() { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<FieldError> getFieldErrors() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public FieldError getFieldError() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasFieldErrors(String s) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public int getFieldErrorCount(String s) { |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<FieldError> getFieldErrors(String s) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public FieldError getFieldError(String s) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Object getFieldValue(String s) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Class<?> getFieldType(String s) { |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * projectName: h3-organization |
| | | * fileName: ParameterValidate.java |
| | | * packageName: com.hydee.common.validate |
| | | * date: 2019-06-17 10:48 |
| | | * copyright(c) 2019 http://www.hydee.cn/ Inc. All rights reserved. |
| | | */ |
| | | package com.matrix.system.common.validate; |
| | | |
| | | import com.matrix.system.common.validate.beans.ErrorMessage; |
| | | import com.matrix.system.common.validate.group.Group; |
| | | import org.hibernate.validator.HibernateValidator; |
| | | |
| | | import javax.validation.ConstraintViolation; |
| | | import javax.validation.Validation; |
| | | import javax.validation.Validator; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @version: V1.0 |
| | | * @author: LiHengye |
| | | * @className: ParameterValidate |
| | | * @packageName: com.hydee.common.validate |
| | | * @description: 参数验证 |
| | | * @data: 2019-06-17 10:48 |
| | | **/ |
| | | public class ParameterValidate { |
| | | |
| | | |
| | | /** |
| | | * 开启快速结束模式 failFast (true) |
| | | */ |
| | | private static Validator validator = Validation.byProvider(HibernateValidator.class).configure().failFast(true).buildValidatorFactory().getValidator(); |
| | | /** |
| | | * 校验对象 |
| | | * @param t bean |
| | | * @param groups 校验组 |
| | | * @return ValidResult |
| | | */ |
| | | public static <T> ValidResult validateBean(T t,Class<?>...groups) { |
| | | ValidResult result = new ValidResult(); |
| | | Set<ConstraintViolation<T>> violationSet = validator.validate(t,groups); |
| | | boolean hasError = violationSet != null && violationSet.size() > 0; |
| | | result.setHasErrors(hasError); |
| | | if (hasError) { |
| | | for (ConstraintViolation<T> violation : violationSet) { |
| | | result.addError(violation.getPropertyPath().toString(), violation.getMessageTemplate()); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 校验bean的某一个属性 |
| | | * @param obj bean |
| | | * @param propertyName 属性名称 |
| | | * @return ValidResult |
| | | */ |
| | | public static <T> ValidResult validateProperty(T obj, String propertyName) { |
| | | ValidResult result = new ValidResult(); |
| | | Set<ConstraintViolation<T>> violationSet = validator.validateProperty(obj, propertyName, Group.ADD.class); |
| | | boolean hasError = violationSet != null && violationSet.size() > 0; |
| | | result.setHasErrors(hasError); |
| | | if (hasError) { |
| | | for (ConstraintViolation<T> violation : violationSet) { |
| | | result.addError(propertyName, violation.getMessage()); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 校验结果类 |
| | | */ |
| | | public static class ValidResult { |
| | | |
| | | /** |
| | | * 是否有错误 |
| | | */ |
| | | private boolean hasErrors; |
| | | |
| | | /** |
| | | * 错误信息 |
| | | */ |
| | | private List<ErrorMessage> errors; |
| | | |
| | | public ValidResult() { |
| | | this.errors = new ArrayList<>(); |
| | | } |
| | | public boolean hasErrors() { |
| | | return hasErrors; |
| | | } |
| | | |
| | | public void setHasErrors(boolean hasErrors) { |
| | | this.hasErrors = hasErrors; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有验证信息 |
| | | * @return 集合形式 |
| | | */ |
| | | public List<ErrorMessage> getAllErrors() { |
| | | return errors; |
| | | } |
| | | /** |
| | | * 获取所有验证信息 |
| | | * @return 字符串形式 |
| | | */ |
| | | public String getErrors(){ |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (ErrorMessage error : errors) { |
| | | sb.append(error.getPropertyPath()).append(":不能为空"); |
| | | // sb.append(error.getPropertyPath()).append(":").append(error.getMessage()).append(" "); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public String getAllErrorMessage(){ |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (ErrorMessage error : errors) { |
| | | if(error.getMessage() == null || error.getMessage().isEmpty()){ |
| | | sb.append(error.getPropertyPath()).append(":不合法!"); |
| | | }else{ |
| | | sb.append(error.getPropertyPath()).append(":").append(error.getMessage()).append(" "); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public void addError(String propertyPath, String message) { |
| | | this.errors.add(new ErrorMessage(propertyPath, message)); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * projectName: common |
| | | * fileName: ParameterValidateFailNoFast.java |
| | | * packageName: com.hydee.common.validate |
| | | * date: 2021-04-22 9:25 上午 |
| | | * copyright(c) 2021 http://www.hydee.cn/ Inc. All rights reserved. |
| | | */ |
| | | package com.matrix.system.common.validate; |
| | | |
| | | import com.matrix.system.common.validate.beans.ErrorMessage; |
| | | import com.matrix.system.common.validate.group.Group; |
| | | import org.hibernate.validator.HibernateValidator; |
| | | |
| | | import javax.validation.ConstraintViolation; |
| | | import javax.validation.Validation; |
| | | import javax.validation.Validator; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @version: V1.0 |
| | | * @author: LiHengye |
| | | * @className: ParameterValidateFailNoFast |
| | | * @packageName: com.hydee.common.validate |
| | | * @description: 参数校验遇到错误非立刻返回 |
| | | * @data: 2021-04-22 9:25 上午 |
| | | **/ |
| | | public class ParameterValidateFailNoFast { |
| | | |
| | | /** |
| | | * 开启快速结束模式 failFast (true) |
| | | */ |
| | | private static Validator validator = Validation.byProvider(HibernateValidator.class).configure().failFast(false).buildValidatorFactory().getValidator(); |
| | | /** |
| | | * 校验对象 |
| | | * @param t bean |
| | | * @param groups 校验组 |
| | | * @return ValidResult |
| | | */ |
| | | public static <T> ValidResult validateBean(T t, Class<?>...groups) { |
| | | ValidResult result = new ValidResult(); |
| | | Set<ConstraintViolation<T>> violationSet = validator.validate(t,groups); |
| | | boolean hasError = violationSet != null && violationSet.size() > 0; |
| | | result.setHasErrors(hasError); |
| | | if (hasError) { |
| | | for (ConstraintViolation<T> violation : violationSet) { |
| | | result.addError(violation.getPropertyPath().toString(), violation.getMessageTemplate()); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 校验bean的某一个属性 |
| | | * @param obj bean |
| | | * @param propertyName 属性名称 |
| | | * @return ValidResult |
| | | */ |
| | | public static <T> ValidResult validateProperty(T obj, String propertyName) { |
| | | ValidResult result = new ValidResult(); |
| | | Set<ConstraintViolation<T>> violationSet = validator.validateProperty(obj, propertyName, Group.ADD.class); |
| | | boolean hasError = violationSet != null && violationSet.size() > 0; |
| | | result.setHasErrors(hasError); |
| | | if (hasError) { |
| | | for (ConstraintViolation<T> violation : violationSet) { |
| | | result.addError(propertyName, violation.getMessage()); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 校验结果类 |
| | | */ |
| | | public static class ValidResult { |
| | | |
| | | /** |
| | | * 是否有错误 |
| | | */ |
| | | private boolean hasErrors; |
| | | |
| | | /** |
| | | * 错误信息 |
| | | */ |
| | | private List<ErrorMessage> errors; |
| | | |
| | | public ValidResult() { |
| | | this.errors = new ArrayList<>(); |
| | | } |
| | | public boolean hasErrors() { |
| | | return hasErrors; |
| | | } |
| | | |
| | | public void setHasErrors(boolean hasErrors) { |
| | | this.hasErrors = hasErrors; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有验证信息 |
| | | * @return 集合形式 |
| | | */ |
| | | public List<ErrorMessage> getAllErrors() { |
| | | return errors; |
| | | } |
| | | /** |
| | | * 获取所有验证信息 |
| | | * @return 字符串形式 |
| | | */ |
| | | public String getErrors(){ |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (ErrorMessage error : errors) { |
| | | sb.append(error.getPropertyPath()).append(":").append(error.getMessage()).append(" /"); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public String getAllErrorMessage(){ |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (ErrorMessage error : errors) { |
| | | if(error.getMessage() == null || error.getMessage().isEmpty()){ |
| | | sb.append(error.getPropertyPath()).append(":不合法!"); |
| | | }else{ |
| | | sb.append(error.getPropertyPath()).append(":").append(error.getMessage()).append(" "); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public void addError(String propertyPath, String message) { |
| | | this.errors.add(new ErrorMessage(propertyPath, message)); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * projectName: h3-organization |
| | | * fileName: ErrorMessage.java |
| | | * packageName: com.hydee.common.validate.beans |
| | | * date: 2019-06-17 10:42 |
| | | * copyright(c) 2019 http://www.hydee.cn/ Inc. All rights reserved. |
| | | */ |
| | | package com.matrix.system.common.validate.beans; |
| | | |
| | | /** |
| | | * @version: V1.0 |
| | | * @author: LiHengye |
| | | * @className: ErrorMessage |
| | | * @packageName: com.hydee.common.validate.beans |
| | | * @description: 错误信息 |
| | | * @data: 2019-06-17 10:42 |
| | | **/ |
| | | public class ErrorMessage { |
| | | |
| | | private String propertyPath; |
| | | |
| | | private String message; |
| | | |
| | | public ErrorMessage(String propertyPath, String message) { |
| | | this.propertyPath = propertyPath; |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getPropertyPath() { |
| | | return propertyPath; |
| | | } |
| | | |
| | | public void setPropertyPath(String propertyPath) { |
| | | this.propertyPath = propertyPath; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * projectName: h3-organization |
| | | * fileName: Group.java |
| | | * packageName: group |
| | | * date: 2019-06-17 10:43 |
| | | * copyright(c) 2019 http://www.hydee.cn/ Inc. All rights reserved. |
| | | */ |
| | | package com.matrix.system.common.validate.group; |
| | | |
| | | /** |
| | | * @version: V1.0 |
| | | * @author: LiHengye |
| | | * @className: Group |
| | | * @packageName: group |
| | | * @description: 验证信息组 |
| | | * @data: 2019-06-17 10:43 |
| | | **/ |
| | | public interface Group { |
| | | |
| | | /** |
| | | * 默认分组 |
| | | */ |
| | | static interface Default{} |
| | | |
| | | /** |
| | | * 新增分组 |
| | | */ |
| | | static interface ADD{} |
| | | |
| | | /** |
| | | * 修改分组 |
| | | */ |
| | | static interface MODIFY{} |
| | | |
| | | /** |
| | | * 删除分组 |
| | | */ |
| | | static interface DELETE{} |
| | | |
| | | /** |
| | | * 查询分组 |
| | | */ |
| | | static interface SELECT{} |
| | | } |
| | |
| | | * 商城商品-充值卡 |
| | | */ |
| | | String SHOPPING_GOODS_TYPE_CZK = "充值卡"; |
| | | /** |
| | | * 商城商品-综合卡 |
| | | */ |
| | | String SHOPPING_GOODS_TYPE_ZHK = "综合卡"; |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.matrix.system.enums; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.matrix.core.enums.EnumApiShowAble; |
| | | import com.matrix.core.enums.EnumsShowVo; |
| | | import com.matrix.core.exception.GlobleException; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 是否枚举 |
| | | * @author jyy |
| | | */ |
| | | public enum BooleanEnum implements EnumApiShowAble { |
| | | |
| | | TRUE(1, "是"), |
| | | FALSE(2, "否"), |
| | | DEFAULT(3, ""), |
| | | ; |
| | | |
| | | private Integer value; |
| | | |
| | | private String displayName; |
| | | |
| | | BooleanEnum(Integer value, String displayName) { |
| | | this.value = value; |
| | | this.displayName = displayName; |
| | | } |
| | | |
| | | public static String getByValue(Integer value) { |
| | | for (int i = 0; i < values().length; i++) { |
| | | if (value.equals(values()[i].getValue())) { |
| | | return values()[i].displayName; |
| | | } |
| | | } |
| | | throw new GlobleException("无效枚举值"); |
| | | } |
| | | |
| | | @Override |
| | | public String getEnumCode() { |
| | | return "booleanEnum"; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumsShowVo> getEnumsShowVos() { |
| | | return Lists.newArrayList(values()).stream().map(item -> |
| | | EnumsShowVo.builder() |
| | | .displayName(item.getDisplayName()) |
| | | .value(item.value) |
| | | .build() |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getDisplayName() { |
| | | return displayName; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.enums; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.matrix.core.enums.EnumApiShowAble; |
| | | import com.matrix.core.enums.EnumsShowVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 短信平台 |
| | | */ |
| | | public enum TextMessageTypeEnum implements EnumApiShowAble { |
| | | |
| | | TEXT_MESSAGE_TYPE_HYWX(1, "互亿无线"), |
| | | TEXT_MESSAGE_TYPE_ALYDX(2, "阿里云短信"); |
| | | |
| | | private Integer value; |
| | | |
| | | private String displayName; |
| | | |
| | | TextMessageTypeEnum(Integer value, String displayName) { |
| | | this.value = value; |
| | | this.displayName = displayName; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getDisplayName() { |
| | | return displayName; |
| | | } |
| | | |
| | | @Override |
| | | public String getEnumCode() { |
| | | return "textMessageType"; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumsShowVo> getEnumsShowVos() { |
| | | return Lists.newArrayList(values()).stream().map(item -> |
| | | EnumsShowVo.builder() |
| | | .displayName(item.getDisplayName()) |
| | | .value(item.value) |
| | | .build() |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.matrix.system.enums; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.matrix.core.enums.EnumApiShowAble; |
| | | import com.matrix.core.enums.EnumsShowVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | public enum WeekTypeEnum implements EnumApiShowAble { |
| | | |
| | | |
| | | WEEK_TYPE_ONE(1, "周一"), |
| | | WEEK_TYPE_TWO(2, "周二"), |
| | | WEEK_TYPE_THREE(3, "周三"), |
| | | WEEK_TYPE_FOUR(4, "周四"), |
| | | WEEK_TYPE_FIVE(5, "周五"), |
| | | WEEK_TYPE_SIX(6, "周六"), |
| | | WEEK_TYPE_SEVEN(7, "周日"); |
| | | |
| | | private Integer value; |
| | | |
| | | private String displayName; |
| | | |
| | | WeekTypeEnum(Integer value, String displayName) { |
| | | this.value = value; |
| | | this.displayName = displayName; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getDisplayName() { |
| | | return displayName; |
| | | } |
| | | |
| | | @Override |
| | | public String getEnumCode() { |
| | | return "weekType"; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumsShowVo> getEnumsShowVos() { |
| | | return Lists.newArrayList(values()).stream().map(item -> |
| | | EnumsShowVo.builder() |
| | | .displayName(item.getDisplayName()) |
| | | .value(item.value) |
| | | .build() |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.matrix.system.enums; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.matrix.core.enums.EnumApiShowAble; |
| | | import com.matrix.core.enums.EnumsShowVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 是否选择 |
| | | */ |
| | | public enum WhetherTypeEnum implements EnumApiShowAble { |
| | | |
| | | WHETHER_YES(1, "是"), |
| | | WHETHER_NO(2, "否"); |
| | | |
| | | private Integer value; |
| | | |
| | | private String displayName; |
| | | |
| | | WhetherTypeEnum(Integer value, String displayName) { |
| | | this.value = value; |
| | | this.displayName = displayName; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getDisplayName() { |
| | | return displayName; |
| | | } |
| | | |
| | | @Override |
| | | public String getEnumCode() { |
| | | return "whetherType"; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumsShowVo> getEnumsShowVos() { |
| | | return Lists.newArrayList(values()).stream().map(item -> |
| | | EnumsShowVo.builder() |
| | | .displayName(item.getDisplayName()) |
| | | .value(item.value) |
| | | .build() |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | } |
| | |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanApplyDao; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao; |
| | |
| | | |
| | | BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_AUDIT_METHOD, loginUser.getCompanyId()); |
| | | if(busParameterSettings!=null |
| | | &&busParameterSettings.getParamValue().equals("1")){ |
| | | // &&busParameterSettings.getIntParamValue().equals("1")){ |
| | | && BooleanEnum.TRUE.getValue() == busParameterSettings.getIntParamValue()){ |
| | | //自动审核 |
| | | //初始等级ID(公司id,是否为初始等级) |
| | | QueryWrapper<ShopSalesmanGrade> queryWrapperOrepool = new QueryWrapper<>(); |
| | |
| | | |
| | | import com.matrix.component.asyncmessage.AsyncMessageManager; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.WebUtil; |
| | |
| | | @RequestMapping(value = "/cz") |
| | | public @ResponseBody |
| | | AjaxResult cz(@RequestBody CzXkVo czVo) { |
| | | SysOrder order= orderService.updateAddCardMoney(czVo); |
| | | SysOrder order= orderService.moneyCardCz(czVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "充值成功"); |
| | | |
| | | //发送微信公众号提醒 |
| | |
| | | package com.matrix.system.hive.action; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.matrix.component.asyncmessage.AsyncMessageManager; |
| | | import com.matrix.core.exception.GlobleException; |
| | |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.common.tools.ResponseHeadUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.enums.OperationButtonEnum; |
| | | import com.matrix.system.enums.OperationFunctionEnum; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | |
| | | sysOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_N); |
| | | //校验订单是否满足结算调价,新订单则保存订单,已有订单则删除后更新 |
| | | sysOrder = orderService.checkAndSaveOrder(sysOrder); |
| | | orderService.updateReceiptMoney(sysOrder); |
| | | orderService.payOrder(sysOrder); |
| | | |
| | | //发送微信公众号提醒 |
| | | UniformMsgParam uniformMsgParam = new UniformMsgParam(user.getCompanyId(), UniformMsgParam.GZH_GMCG); |
| | |
| | | } |
| | | } |
| | | } |
| | | orderService.refundOrderMoney(sysOrder); |
| | | orderService.orderTk(sysOrder); |
| | | //处理用户购买的产品 |
| | | return AjaxResult.buildSuccessInstance(Arrays.asList(sysOrder), "订单退款成功"); |
| | | } |
| | |
| | | @RequestMapping(value = "/sk") |
| | | public @ResponseBody |
| | | AjaxResult sk(SysOrder order) throws GlobleException { |
| | | orderService.updateReceiptMoney(order); |
| | | orderService.payOrder(order); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "收款成功"); |
| | | } |
| | | |
| | |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "订单不存在!"); |
| | | } |
| | | |
| | | List<SysOrderItem> items = orderItemDao.selectByOrderId(id); |
| | | for (SysOrderItem item : items) { |
| | | List<SysProjServices> sysProjServices = sysProjServicesDao.selectProjServicesByOrderItemId(item.getId()); |
| | | if (CollUtil.isNotEmpty(sysProjServices)) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "订单存在进行中的服务单无法取消/删除"); |
| | | } |
| | | } |
| | | |
| | | |
| | | orderService.cancelOrder(id); |
| | | |
| | |
| | | |
| | | SysOrder order = orderService.findById(id); |
| | | BusParameterSettings shopManageAbleCancelDfkOrder = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_ABLE_CANCEL_DFK_ORDER, order.getCompanyId()); |
| | | // if (StringUtils.isNotBlank(shopManageAbleCancelDfkOrder.getParamValue()) |
| | | // && shopManageAbleCancelDfkOrder.getParamValue().equals(Dictionary.FLAG_YES)) { |
| | | if (StringUtils.isNotBlank(shopManageAbleCancelDfkOrder.getParamValue()) |
| | | && shopManageAbleCancelDfkOrder.getParamValue().equals(Dictionary.FLAG_YES)) { |
| | | && BooleanEnum.TRUE.getValue() == shopManageAbleCancelDfkOrder.getIntParamValue()) { |
| | | |
| | | if (!Dictionary.ORDER_STATU_DFK.equals(order.getStatu())) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "您只能取消待付款订单"); |
| | | } |
| | |
| | | int i=0; |
| | | if (sysOutStore.getId() != null) { |
| | | |
| | | i=currentService.checkInfo(sysOutStore); |
| | | i=currentService.effectOutStore(sysOutStore); |
| | | } |
| | | if(i>0){ |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "审核成功!"); |
| | |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.common.tools.ResponseHeadUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.enums.OperationButtonEnum; |
| | | import com.matrix.system.enums.OperationFunctionEnum; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | |
| | | |
| | | SysProjServices checkProjServices = sysProjServicesDao.selectById(services.getId()); |
| | | BusParameterSettings shopManageAbleCancelDfkOrder = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_ABLE_CANCEL_DFK_ORDER, checkProjServices.getCompanyId()); |
| | | // if (StringUtils.isNotBlank(shopManageAbleCancelDfkOrder.getParamValue()) |
| | | // && shopManageAbleCancelDfkOrder.getParamValue().equals(Dictionary.FLAG_YES)) { |
| | | if (StringUtils.isNotBlank(shopManageAbleCancelDfkOrder.getParamValue()) |
| | | && shopManageAbleCancelDfkOrder.getParamValue().equals(Dictionary.FLAG_YES)) { |
| | | && BooleanEnum.TRUE.getValue() == shopManageAbleCancelDfkOrder.getIntParamValue()) { |
| | | |
| | | if (!checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DYY) |
| | | && !checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DQR)) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "您只能取消待预约订单"); |
| | | } |
| | | }else{ |
| | | if (checkProjServices.getState().equals(Dictionary.SERVICE_STATU_FWWC) |
| | | || checkProjServices.getState().equals(Dictionary.SERVICE_STATU_FFJS)) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "当前状态无法取消订单"); |
| | | } |
| | | } |
| | | return erpCancelOrder(services); |
| | | } |
| | |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.*; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.core.tools.excl.ExcelSheetPO; |
| | | import com.matrix.core.tools.excl.ExcelUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.MoneyCardUseDao; |
| | |
| | | import com.matrix.system.hive.service.MoneyCardUseService; |
| | | import com.matrix.system.hive.service.SysProjUseService; |
| | | import com.matrix.system.hive.service.SysProjuseFreezeService; |
| | | import jodd.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | vipInfo.setPhone(telStr); |
| | | vipInfo.setPhoto(defaultWoman); |
| | | vipInfo.setName(objects.get(0).toString()); |
| | | vipInfo.setIsDelete(Dictionary.DELETED_N); |
| | | vipInfoDao.insert(vipInfo); |
| | | } |
| | | |
| | |
| | | vipInfo.setPhone(telStr); |
| | | vipInfo.setPhoto(defaultWoman); |
| | | vipInfo.setName(objects.get(0).toString()); |
| | | vipInfo.setIsDelete(Dictionary.DELETED_N); |
| | | vipInfoDao.insert(vipInfo); |
| | | } |
| | | String goodNo = String.valueOf(objects.get(3)); |
| | |
| | | shoppingGoods.setAssembleProj(shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(shoppingGoods.getId(), ShoppingGoods.SHOPPING_GOODS_TYPE_XM)); |
| | | } else if ( |
| | | Dictionary.SHOPPING_GOODS_TYPE_XM.equals(shoppingGoods.getGoodType()) |
| | | || Dictionary.SHOPPING_GOODS_TYPE_ZHK.equals(shoppingGoods.getGoodType()) |
| | | ) { |
| | | shoppingGoods.setAssembleGoods(shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(shoppingGoods.getId(), null)); |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_CZK.equals(shoppingGoods.getGoodType())) { |
| | |
| | | } |
| | | } |
| | | shoppingGoods.setIsDel(ShoppingGoods.NORMAL); |
| | | shoppingGoods.setStaus(Dictionary.BUSINESS_STATE_UP); |
| | | List<ShoppingGoods> dataList = shoppingGoodsService.findInPage(shoppingGoods, pageVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, shoppingGoodsService.findTotal(shoppingGoods)); |
| | | return result; |
| | |
| | | shoppingGoods.setAssembleGoods(assembleListGoods); |
| | | List<ShoppingGoodsAssemble> assembleListProj = shoppingGoodsAssembleDao.selectProjByShoppingGoodsId(shoppingGoods.getId()); |
| | | shoppingGoods.setAssembleProj(assembleListProj); |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_ZHK.equals(shoppingGoods.getGoodType())) { |
| | | List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectAssembleShoppingGoodsByShoppingGoodsId(shoppingGoods.getId()); |
| | | shoppingGoods.setZongheCarGoods(assembleList); |
| | | } |
| | | |
| | | |
| | |
| | | // 返回充值卡编辑界面 |
| | | WebUtil.getRequest().setAttribute("obj", shoppingGoods); |
| | | return "admin/hive/products/money-card-form"; |
| | | } else if (shoppingGoods.getGoodType().equals(Dictionary.SHOPPING_GOODS_TYPE_ZHK)) { |
| | | WebUtil.getRequest().setAttribute("obj", shoppingGoods); |
| | | return "admin/hive/products/zonghe-card-form"; |
| | | } |
| | | |
| | | |
| | |
| | | if(vipInfo.getShopId()==null){ |
| | | vipInfo.setShopId(users.getShopId()); |
| | | } |
| | | if(vipInfo.getCompanyId()==null){ |
| | | vipInfo.setCompanyId(users.getCompanyId()); |
| | | } |
| | | return add(vipInfoService, vipInfo, "会员信息"); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * // jyytodo 可以考虑一个已启用未启用的状态,开卡后如果没有使用过就视为未启用 |
| | | * 状态,有效,无效,转让,冻结,退款 |
| | | */ |
| | | private String status; |
| | |
| | | */ |
| | | public class MoneyCardUseFlow implements Serializable{ |
| | | |
| | | //jyytodo 改成枚举 |
| | | public static final String USE_TYPE_CONSUMER = "消费扣款"; |
| | | |
| | | public static final String USE_TYPE_ORDRE_CANCEL = "取消订单"; |
| | | |
| | | public static final String USE_TYPE_ORDRE_TK = "订单退款"; |
| | | |
| | | public static final String USE_TYPE_GM = "购买充值卡"; |
| | | |
| | | public static final String USE_TYPE_CZ = "会员充值"; |
| | | |
| | | public static final String USE_TYPE_CARD_MODIFY = "会员卡调整"; |
| | |
| | | private Integer carMaxSaleCount; |
| | | |
| | | /** |
| | | * 是一卡通吗 |
| | | * 充值卡使用范围 是否所有产品 |
| | | */ |
| | | private String carIsAll; |
| | | |
| | |
| | | */ |
| | | public static final int ORDER_TYPE_REFUND= 2; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 序号 |
| | | */ |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | private String signPic; |
| | | |
| | | /** |
| | | * 序号 |
| | |
| | | */ |
| | | @Extend |
| | | private String pageFlae; |
| | | |
| | | @Extend |
| | | private String queryKey; |
| | | |
| | | public String getQueryKey() { |
| | | return queryKey; |
| | | } |
| | | |
| | | public void setQueryKey(String queryKey) { |
| | | this.queryKey = queryKey; |
| | | } |
| | | |
| | | public Long getStaffId() { |
| | | return staffId; |
| | |
| | | public void setCompanyId(Long companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public String getSignPic() { |
| | | return signPic; |
| | | } |
| | | |
| | | public void setSignPic(String signPic) { |
| | | this.signPic = signPic; |
| | | } |
| | | } |
| | |
| | | */ |
| | | private Integer validFlag; |
| | | |
| | | /** |
| | | * Pad端查询条件 |
| | | */ |
| | | private String padQueryKey; |
| | | |
| | | |
| | | } |
| | |
| | | import com.matrix.system.app.vo.OrderDetailVo; |
| | | import com.matrix.system.app.vo.RankingVo; |
| | | import com.matrix.system.hive.bean.SysOrder; |
| | | import com.matrix.system.padApi.dto.PadOrderListDto; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailVo; |
| | | import com.matrix.system.shopXcx.api.dto.ErpOrderListDto; |
| | | import com.matrix.system.shopXcx.api.vo.ErpOrderDetailVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | |
| | | List<OrderDetailVo> selectApiOrderListInPage(@Param("record") OrderListDto orderListDto, @Param("pageVo") PaginationVO pageVo); |
| | | |
| | | List<PadOrderDetailVo> selectPadApiOrderListInPage(@Param("record") PadOrderListDto orderListDto, @Param("pageVo") PaginationVO pageVo); |
| | | |
| | | int selectApiOrderListTotal(@Param("record") OrderListDto orderListDto); |
| | | |
| | | OrderDetailVo selectApiOrderDetailById(@Param("orderId") Long orderId); |
| | | |
| | | PadOrderDetailVo selectPadApiOrderDetailById(@Param("orderId") Long orderId); |
| | | |
| | | List<RankingVo> selectShopAchieveRanking(@Param("record") SysOrder sysOrder); |
| | | |
| | |
| | | ErpOrderDetailVo findUserOrderById(Long orderId); |
| | | |
| | | BigDecimal selectArrearsByVipId(Long vipId); |
| | | |
| | | int selectPadApiOrderListTotal(@Param("record") PadOrderListDto orderListDto); |
| | | } |
| | |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.system.app.vo.OrderDetailItemVo; |
| | | import com.matrix.system.hive.bean.SysOrderItem; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailItemVo; |
| | | import com.matrix.system.shopXcx.api.vo.ErpOrderDetailItemVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | public int deleteByOrderId(Long id); |
| | | |
| | | List<OrderDetailItemVo> selectApiOrderDetailItemsByOrderId(@Param("orderId") Long orderId); |
| | | List<PadOrderDetailItemVo> selectPadApiOrderDetailItemsByOrderId(@Param("orderId") Long orderId); |
| | | |
| | | List<ErpOrderDetailItemVo> selectErpOrderItemByOrderId(String orderId); |
| | | |
| | | List<SysOrderItem> selectDgd(); |
| | | |
| | | String selectOrderStatusByItemId(Long orderItemId); |
| | | } |
| | |
| | | List<SysProjUse> selectTaoCanListWithProj(@Param("record") SysProjUse sysProjUse); |
| | | |
| | | int selectTaocanCountForCourseAndInfinite(@Param("taocanId") Long taocanId, @Param("vipId") Long vipId); |
| | | |
| | | int selectUseCountByOrderItemId(Long orderItemId); |
| | | |
| | | List<SysProjUse> selectByOrderItemId(Long orderItemId); |
| | | } |
| | |
| | | package com.matrix.system.hive.dao; |
| | | |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.system.app.dto.VipInfoListDto; |
| | | import com.matrix.system.app.vo.VipInfoListVo; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.pojo.VipInfoVo; |
| | | import com.matrix.system.padApi.dto.PadVipListDto; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | public int update(SysVipInfo sysVipInfo); |
| | | |
| | | public int deleteByIds(@Param("list") List<Long> list); |
| | | |
| | | public int deleteLogicByIds(@Param("list") List<Long> list); |
| | | |
| | | public int deleteById(Long id); |
| | | |
| | | public List<SysVipInfo> selectInPage(@Param("record") SysVipInfo sysVipInfo, @Param("pageVo") PaginationVO pageVo); |
| | | |
| | |
| | | List<Map<String, Object>> selectVipArrearsStatistics(@Param("record") SysVipInfo sysVipInfo, @Param("pageVo") PaginationVO pageVo); |
| | | |
| | | Integer selectVipArrearsStatisticsTotal(@Param("record") SysVipInfo sysVipInfo); |
| | | |
| | | AjaxResult selectVipInfoListInPage(@Param("record")PadVipListDto padVipListDto); |
| | | } |
New file |
| | |
| | | package com.matrix.system.hive.dto; |
| | | |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商品限消检测dto |
| | | */ |
| | | @Data |
| | | @ToString |
| | | public class GoodsSealLimitDto { |
| | | |
| | | /** |
| | | * 会员id |
| | | */ |
| | | private Long vipId; |
| | | |
| | | /** |
| | | * 销售明细 |
| | | */ |
| | | private List<SysOrderItemDto> sysOrderItemDtoList; |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * projectName: zq-erp |
| | | * fileName: MoneyCardChangeDto.java |
| | | * packageName: com.matrix.system.hive.dto |
| | | * date: 2022-03-11 10:24 |
| | | * copyright(c) 2022 http://www.hydee.cn/ Inc. All rights reserved. |
| | | */ |
| | | package com.matrix.system.hive.dto; |
| | | |
| | | import com.matrix.system.common.validate.group.Group; |
| | | import com.matrix.system.hive.validation.MoneyCardUseGroup; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @version: V1.0 |
| | | * @author: JiangYouYao |
| | | * @className: MoneyCardChangeDto |
| | | * @packageName: com.matrix.system.hive.dto |
| | | * @description: 储值卡操作DTO |
| | | * @data: 2022-03-11 10:24 |
| | | **/ |
| | | @Data |
| | | public class MoneyCardOperationDto { |
| | | |
| | | /** |
| | | * 储值卡id |
| | | */ |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseOrderChange.class, |
| | | MoneyCardUseGroup.moneyCardUseCz.class,}) |
| | | private Long carUseId; |
| | | /** |
| | | * 会员id |
| | | */ |
| | | @NotNull(groups = { |
| | | Group.ADD.class |
| | | }) |
| | | private Long vipId; |
| | | |
| | | /** |
| | | * 来源,购买,转让,赠送 |
| | | */ |
| | | @NotNull(groups = { |
| | | Group.ADD.class}) |
| | | private String source; |
| | | |
| | | /** |
| | | * 订单明细id |
| | | */ |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseTk.class, |
| | | Group.ADD.class |
| | | }) |
| | | private Long orderItemId; |
| | | |
| | | |
| | | /** |
| | | * 操作类型 |
| | | */ |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseTk.class, |
| | | MoneyCardUseGroup.moneyCardUseOrderChange.class, |
| | | MoneyCardUseGroup.moneyCardUseCz.class, |
| | | Group.ADD.class |
| | | |
| | | }) |
| | | private String type; |
| | | /** |
| | | * 操作人 |
| | | */ |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseTk.class, |
| | | MoneyCardUseGroup.moneyCardUseOrderChange.class, |
| | | MoneyCardUseGroup.moneyCardUseCz.class, |
| | | Group.ADD.class |
| | | }) |
| | | private Long updateUser; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseTk.class, |
| | | MoneyCardUseGroup.moneyCardUseOrderChange.class, |
| | | MoneyCardUseGroup.moneyCardUseCz.class, |
| | | Group.ADD.class |
| | | }) |
| | | private Long orderId; |
| | | /** |
| | | * 订单编号 |
| | | */ |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseTk.class, |
| | | MoneyCardUseGroup.moneyCardUseOrderChange.class, |
| | | MoneyCardUseGroup.moneyCardUseCz.class, |
| | | Group.ADD.class |
| | | }) |
| | | private String orderNo; |
| | | |
| | | /** |
| | | * 充值卡的商品 |
| | | */ |
| | | @NotNull(groups = { |
| | | Group.ADD.class}) |
| | | private Long goodsId; |
| | | |
| | | |
| | | /** |
| | | * 赠送金额扣减 |
| | | */ |
| | | @NotNull(groups = { |
| | | MoneyCardUseGroup.moneyCardUseCz.class, |
| | | MoneyCardUseGroup.moneyCardUseOrderChange.class |
| | | }) |
| | | private Double giftMoney; |
| | | /** |
| | | * 本金扣减 |
| | | */ |
| | | |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseTk.class, |
| | | MoneyCardUseGroup.moneyCardUseCz.class, |
| | | MoneyCardUseGroup.moneyCardUseOrderChange.class |
| | | }) |
| | | private Double realMoney; |
| | | |
| | | /** |
| | | * 次数 |
| | | */ |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseOrderChange.class}) |
| | | private Integer count; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | /** |
| | | * 支付的商品id |
| | | */ |
| | | @NotNull(groups = {MoneyCardUseGroup.moneyCardUseOrderChange.class}) |
| | | private List<Long> goodsIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.hive.dto; |
| | | |
| | | import com.matrix.system.hive.hievEnum.OrderOperationEnum; |
| | | import com.matrix.system.hive.validation.ProjUseGroup; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * 项目操作对象 |
| | | */ |
| | | @Data |
| | | public class ProjUseOperationDto { |
| | | |
| | | /** |
| | | * 客户id |
| | | */ |
| | | @NotNull(groups = {ProjUseGroup.addProject.class, |
| | | ProjUseGroup.addTc.class}) |
| | | private Long vipId; |
| | | |
| | | /** |
| | | * 产品id |
| | | */ |
| | | @NotNull(groups = {ProjUseGroup.addProject.class, |
| | | ProjUseGroup.addTc.class, |
| | | ProjUseGroup.projectTk.class, |
| | | ProjUseGroup.taocanTk.class |
| | | }) |
| | | private Long goodsId; |
| | | |
| | | /** |
| | | * 添加次数 |
| | | */ |
| | | @NotNull(groups = {ProjUseGroup.addProject.class, |
| | | ProjUseGroup.addTc.class, |
| | | ProjUseGroup.projectTk.class, |
| | | ProjUseGroup.taocanTk.class}) |
| | | private Integer count; |
| | | |
| | | /** |
| | | * 购买支付金额 |
| | | */ |
| | | @NotNull(groups = {ProjUseGroup.addProject.class, |
| | | ProjUseGroup.addTc.class}) |
| | | private Double payMoney; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 订单明细id |
| | | */ |
| | | @NotNull(groups = {ProjUseGroup.addProject.class, |
| | | ProjUseGroup.addTc.class, |
| | | ProjUseGroup.projectTk.class, |
| | | ProjUseGroup.taocanTk.class}) |
| | | private Long orderItemId; |
| | | |
| | | /** |
| | | * 是否为赠送 |
| | | */ |
| | | @NotNull(groups = {ProjUseGroup.addProject.class, |
| | | ProjUseGroup.addTc.class}) |
| | | private boolean isFree; |
| | | |
| | | |
| | | /** |
| | | * 操作类型 |
| | | */ |
| | | private OrderOperationEnum orderOperationType; |
| | | |
| | | |
| | | /** |
| | | * 套餐折扣 |
| | | * 设置折扣后,套餐下绑定的项目消耗金额会对应打折 |
| | | * -- 套餐类型必传 |
| | | */ |
| | | @NotNull(groups = {ProjUseGroup.addTc.class}) |
| | | private Double tcZk; |
| | | |
| | | /** |
| | | * 所属套餐id |
| | | * -- 添加套餐下的项目必传 |
| | | */ |
| | | private Long tcId; |
| | | |
| | | /** |
| | | * 项目单次划扣数量,默认设置为1 |
| | | */ |
| | | private Integer deductionNum; |
| | | /** |
| | | * 操作人id |
| | | */ |
| | | @NotNull(groups = {ProjUseGroup.addProject.class, |
| | | ProjUseGroup.addTc.class}) |
| | | private Long updateUserId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.hive.dto; |
| | | |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * 订单明细DTO |
| | | * @author jyy |
| | | */ |
| | | @ToString |
| | | @Data |
| | | public class SysOrderItemDto { |
| | | /** |
| | | * 商城 商品id |
| | | */ |
| | | private Long goodsId; |
| | | |
| | | /** |
| | | * 购买数量 |
| | | */ |
| | | private Integer count; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.hive.hievEnum; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.matrix.core.enums.EnumApiShowAble; |
| | | import com.matrix.core.enums.EnumsShowVo; |
| | | import com.matrix.core.exception.GlobleException; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 订单操作枚举 |
| | | * @author jyy |
| | | */ |
| | | public enum OrderOperationEnum implements EnumApiShowAble { |
| | | |
| | | SAVE(1, "订单保存"), |
| | | PAY(2, "订单付款"), |
| | | RETURN(3, "订单退款"), |
| | | CANCEL(4, "订单取消"), |
| | | BJ(5, "订单补交"), |
| | | ; |
| | | |
| | | private Integer value; |
| | | |
| | | private String displayName; |
| | | |
| | | OrderOperationEnum(Integer value, String displayName) { |
| | | this.value = value; |
| | | this.displayName = displayName; |
| | | } |
| | | |
| | | public static String getByValue(Integer value) { |
| | | for (int i = 0; i < values().length; i++) { |
| | | if (value.equals(values()[i].getValue())) { |
| | | return values()[i].displayName; |
| | | } |
| | | } |
| | | throw new GlobleException("无效枚举值"); |
| | | } |
| | | |
| | | @Override |
| | | public String getEnumCode() { |
| | | return "booleanEnum"; |
| | | } |
| | | |
| | | @Override |
| | | public List<EnumsShowVo> getEnumsShowVos() { |
| | | return Lists.newArrayList(values()).stream().map(item -> |
| | | EnumsShowVo.builder() |
| | | .displayName(item.getDisplayName()) |
| | | .value(item.value) |
| | | .build() |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public String getDisplayName() { |
| | | return displayName; |
| | | } |
| | | |
| | | } |
| | |
| | | List<DailyBeautyListVo> findDailyBeautyList(AchieveNew achieveNew, PaginationVO pageVo); |
| | | int findDailyBeautyListTotal(AchieveNew achieveNew); |
| | | |
| | | void removeByOrderId(Long id); |
| | | } |
| | |
| | | package com.matrix.system.hive.service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.system.hive.bean.MoneyCardUse; |
| | | import com.matrix.system.hive.dto.MoneyCardOperationDto; |
| | | import com.matrix.system.hive.plugin.util.BaseServices; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @date 2016-09-17 10:17 |
| | | */ |
| | | public interface MoneyCardUseService extends BaseServices<MoneyCardUse> { |
| | | |
| | | |
| | | /** |
| | | * 新增MoneyCardUse |
| | | * 扣除储值卡余额 |
| | | */ |
| | | void changeMoneyCard(List<MoneyCardOperationDto> moneyCardOperationDtos); |
| | | |
| | | |
| | | /** |
| | | * 新增用户储值卡 |
| | | * @param moneyCardOperationDtos |
| | | */ |
| | | public void addVipMoneyCard(List<MoneyCardOperationDto> moneyCardOperationDtos) ; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 新增MoneyCardUse |
| | | */ |
| | | public int add(MoneyCardUse moneyCardUse); |
| | | |
| | | /** |
| | |
| | | |
| | | public List<MoneyCardUse> findVipCardUse(MoneyCardUse moneyCardUse); |
| | | |
| | | /** |
| | | * 根据订单id删除充值卡 |
| | | * 只有没有被使用过的储值卡可以删除 |
| | | * @param id |
| | | */ |
| | | void deleteByOrderItemId(Long id); |
| | | |
| | | |
| | | /** |
| | | * 储值卡退款 |
| | | * @param id |
| | | */ |
| | | void moneyCardTk(List<MoneyCardOperationDto> moneyCardOperationDtos); |
| | | } |
| | |
| | | import com.matrix.system.app.vo.ShoppingGoodsDetailVo; |
| | | import com.matrix.system.app.vo.ShoppingGoodsListVo; |
| | | import com.matrix.system.hive.bean.ShoppingGoods; |
| | | import com.matrix.system.hive.dto.GoodsSealLimitDto; |
| | | import com.matrix.system.hive.plugin.util.BaseServices; |
| | | |
| | | import java.util.Date; |
| | |
| | | * @date 2016-07-30 09:54 |
| | | */ |
| | | public interface ShoppingGoodsService extends BaseServices<ShoppingGoods>{ |
| | | |
| | | |
| | | /** |
| | | * 检测商品销售限制 |
| | | * 1、商品是否超出最大销售量 |
| | | * 2、商品是否限购 |
| | | */ |
| | | void checkGoodsSealLimit(GoodsSealLimitDto goodsSealLimitDto); |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 新增ShoppingGoods |
| | | * |
| | | */ |
| | | public int add(ShoppingGoods shoppingGoods); |
| | | int add(ShoppingGoods shoppingGoods); |
| | | |
| | | /** |
| | | * 更新ShoppingGoods |
| | | * |
| | | */ |
| | | public int modify(ShoppingGoods shoppingGoods); |
| | | int modify(ShoppingGoods shoppingGoods); |
| | | |
| | | /** |
| | | * 批量删除ShoppingGoods |
| | | * |
| | | */ |
| | | public int remove(List<Long> list); |
| | | int remove(List<Long> list); |
| | | |
| | | /** |
| | | * 根据id删除ShoppingGoods |
| | | * |
| | | */ |
| | | public int removeById(Long id); |
| | | int removeById(Long id); |
| | | |
| | | /** |
| | | * 分页查询ShoppingGoods |
| | | * |
| | | */ |
| | | public List<ShoppingGoods> findInPage(ShoppingGoods shoppingGoods, PaginationVO pageVo); |
| | | List<ShoppingGoods> findInPage(ShoppingGoods shoppingGoods, PaginationVO pageVo); |
| | | |
| | | /** |
| | | * 根据对象查询ShoppingGoods |
| | | * |
| | | */ |
| | | public List<ShoppingGoods> findByModel(ShoppingGoods shoppingGoods); |
| | | List<ShoppingGoods> findByModel(ShoppingGoods shoppingGoods); |
| | | /** |
| | | * 数据迁移专用 |
| | | * @param shoppingGoods |
| | | * @return |
| | | */ |
| | | public List<ShoppingGoods> findByModelData(ShoppingGoods shoppingGoods); |
| | | List<ShoppingGoods> findByModelData(ShoppingGoods shoppingGoods); |
| | | /** |
| | | * 统计记录数ShoppingGoods |
| | | * |
| | | */ |
| | | public int findTotal(ShoppingGoods shoppingGoods); |
| | | int findTotal(ShoppingGoods shoppingGoods); |
| | | |
| | | /** |
| | | * 根据id查询ShoppingGoods |
| | | * |
| | | */ |
| | | public ShoppingGoods findById(Long id); |
| | | ShoppingGoods findById(Long id); |
| | | |
| | | public int update(Long id); |
| | | int update(Long id); |
| | | |
| | | |
| | | |
| | |
| | | * 数据迁移用 |
| | | * 分页查询查询项目充值卡,去除套餐 |
| | | */ |
| | | public List<ShoppingGoods> findInPageNoTaocan(ShoppingGoods shoppingGoods, PaginationVO pageVo); |
| | | List<ShoppingGoods> findInPageNoTaocan(ShoppingGoods shoppingGoods, PaginationVO pageVo); |
| | | |
| | | /** |
| | | * 数据迁移用 |
| | | * 查询查询项目充值卡,去除套餐 |
| | | * 统计记录数ShoppingGoods |
| | | */ |
| | | public int findTotalNoTaocan(ShoppingGoods shoppingGoods); |
| | | int findTotalNoTaocan(ShoppingGoods shoppingGoods); |
| | | /** |
| | | * 检测是否可以修改 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public boolean checkIsUpdate(Long id); |
| | | boolean checkIsUpdate(Long id); |
| | | /** |
| | | * 查询所有 |
| | | * @author xiaochonggao |
| | |
| | | * @param shoppingGoods |
| | | * @return |
| | | */ |
| | | public List<ShoppingGoods> findAll(ShoppingGoods shoppingGoods); |
| | | List<ShoppingGoods> findAll(ShoppingGoods shoppingGoods); |
| | | |
| | | public ShoppingGoods findByCode(String goodsCode); |
| | | ShoppingGoods findByCode(String goodsCode); |
| | | |
| | | Date calInvalidTime(ShoppingGoods shoppingGoods, Integer type, Date buyDate); |
| | | |
| | |
| | | package com.matrix.system.hive.service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.system.hive.bean.SysBeauticianState; |
| | | import com.matrix.system.hive.plugin.util.BaseServices; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | |
| | | public List<SysBeauticianState> findByTimeAndStaff(Long id, Date beginTime, Date endTime); |
| | | |
| | | |
| | | public List<SysBeauticianState> findBySerId(Long serviceId); |
| | | public List<SysBeauticianState> findBySerId(Long serviceId); |
| | | |
| | | |
| | | } |
| | |
| | | import com.matrix.system.hive.bean.SysOrder; |
| | | import com.matrix.system.hive.plugin.util.BaseServices; |
| | | import com.matrix.system.hive.pojo.CzXkVo; |
| | | import com.matrix.system.hive.pojo.ShoppingCarItemsVo; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.matrix.system.padApi.dto.PadOrderListDto; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailVo; |
| | | |
| | | import javax.servlet.http.HttpSession; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | |
| | | * @date 2016年7月18日 上午11:14:07 |
| | | * @throws |
| | | */ |
| | | public void updateReceiptMoney(SysOrder sysOrder) throws GlobleException; |
| | | public void payOrder(SysOrder sysOrder) throws GlobleException; |
| | | |
| | | public void refundOrderMoney(SysOrder sysOrder); |
| | | |
| | | /** |
| | | * 创建订单 |
| | | * @param session |
| | | * @param car |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int createOrder(HttpSession session, ShoppingCarItemsVo car); |
| | | |
| | | public void orderTk(SysOrder sysOrder); |
| | | |
| | | /** |
| | | * 补交 |
| | |
| | | * @date 2016年9月20日 下午12:07:21 |
| | | * @throws |
| | | */ |
| | | public SysOrder updateAddCardMoney(CzXkVo czVo); |
| | | |
| | | |
| | | public void addMoneyCardUse(SysOrder sourceOrder); |
| | | |
| | | public void addOutStore(SysOrder sourceOrder); |
| | | |
| | | public void addTaocanProj(SysOrder sourceOrder); |
| | | |
| | | public void setShopSelCount(SysOrder sourceOrder); |
| | | |
| | | public SysOrder moneyCardCz(CzXkVo czVo); |
| | | |
| | | /** |
| | | * 校验订单是否满足结算条件 |
| | |
| | | |
| | | List<OrderDetailVo> findApiOrderListInPage(OrderListDto orderListDto, PaginationVO pageVo); |
| | | |
| | | List<PadOrderDetailVo> findPadApiOrderListInPage(PadOrderListDto orderListDto, PaginationVO pageVo); |
| | | |
| | | int findApiOrderListTotal(OrderListDto orderListDto); |
| | | |
| | | OrderDetailVo findApiOrderDetailByOrderId(Long orderId); |
| | |
| | | |
| | | BigDecimal findVipArrearsByVipId(Long vipId); |
| | | |
| | | int findPadApiOrderListTotal(PadOrderListDto orderListDto); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 新增SysOutStore |
| | | * 立即出库 |
| | | * |
| | | */ |
| | | public int add(SysOutStore sysOutStore); |
| | |
| | | */ |
| | | public SysOutStore findById(Long id); |
| | | |
| | | public int checkInfo(SysOutStore sysOutStore); |
| | | |
| | | /** |
| | | * 删除出库单,恢复库存 |
| | | * @param id |
| | | */ |
| | | public void cancelOutStore(Long id); |
| | | |
| | | |
| | | /** |
| | | * 出库单审核通过,并扣减库存 |
| | | * @param sysOutStore |
| | | * @return |
| | | */ |
| | | public int effectOutStore(SysOutStore sysOutStore); |
| | | |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | int confirmServiceOrder(Long id); |
| | | |
| | | int signService(SysProjServices services); |
| | | } |
| | |
| | | |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.system.hive.bean.MoneyCardUse; |
| | | import com.matrix.system.hive.bean.SysProjUse; |
| | | import com.matrix.system.hive.dto.ProjUseOperationDto; |
| | | import com.matrix.system.hive.plugin.util.BaseServices; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | public AjaxResult activeProj(SysProjUse proj); |
| | | |
| | | /** |
| | | * 添加用户套餐和项目 |
| | | * |
| | | * @param projUseDtoList |
| | | * @return |
| | | */ |
| | | public void addUserProjUse(List<ProjUseOperationDto> projUseDtoList) ; |
| | | |
| | | |
| | | public void projectTk(List<ProjUseOperationDto> projUseDtoList); |
| | | |
| | | public int updateProjUseTck(SysProjUse projUse); |
| | | |
| | |
| | | public List<SysProjUse> findTaocaoProjUseWithProj(SysProjUse sysProjUse); |
| | | |
| | | int findTaocanCountForCourseAndInfinite(Long taocanId, Long vipId); |
| | | |
| | | /** |
| | | * 取消订单删除项目 |
| | | * 只有没有使用过的才能被删除 |
| | | * @param id |
| | | */ |
| | | void deleteByOrderItemId(Long id); |
| | | } |
| | |
| | | */ |
| | | public interface SysVipInfoService extends BaseServices<SysVipInfo>{ |
| | | |
| | | /** |
| | | * 更新用户成交状态 |
| | | * @param vipId |
| | | * @param isDeal |
| | | */ |
| | | void updateDealStatus(Long vipId, int isDeal); |
| | | |
| | | public MoneyCardUse addVipDefaultCard(Long vipId); |
| | | /** |
| | | * 新增SysVipInfo |
| | |
| | | List<Map<String, Object>> findVipArrearsStatistics(SysVipInfo sysVipInfo, PaginationVO pageVo); |
| | | |
| | | Integer findVipArrearsStatisticsTotal(SysVipInfo sysVipInfo); |
| | | |
| | | } |
| | |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | |
| | | |
| | | |
| | | @Override |
| | | public void addAchieveByServiceOrder(SysProjServices projServices) { |
| | | public void addAchieveByServiceOrder(SysProjServices projServices) { |
| | | List<AchieveNew> achieveNewList = new ArrayList<>(); |
| | | List<SysBeauticianState> beauticianStateList = sysBeauticianStateDao.selectBySerIds(projServices.getId()); |
| | | int size = beauticianStateList.size(); |
| | |
| | | // 是否为赠送业绩 |
| | | if (Dictionary.TAOCAN_SOURCE_ZS.equals(projUse.getSource())) { |
| | | |
| | | achieveNew.setFreeConsume(projUse.getPrice()*beauticianState.getCount()); |
| | | achieveNew.setFreeConsume(projUse.getPrice() * beauticianState.getCount()); |
| | | //计算提成 |
| | | achieveNew.setProjPercentage( |
| | | calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_ZS,achieveNew.getFreeConsume(),beauticianState.getProjId())); |
| | | calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_ZS, achieveNew.getFreeConsume(), beauticianState.getProjId())); |
| | | |
| | | } else { |
| | | achieveNew.setHisConsume(new BigDecimal(projUse.getPrice()*beauticianState.getCount()).setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue()); |
| | | achieveNew.setHisConsume(new BigDecimal(projUse.getPrice() * beauticianState.getCount()).setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue()); |
| | | //计算提成 |
| | | achieveNew.setProjPercentage( |
| | | calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_BJ,achieveNew.getHisConsume(),beauticianState.getProjId())); |
| | | calculationProjPercentage(AchieveRuleItem.ACHIEVE_TYPE_BJ, achieveNew.getHisConsume(), beauticianState.getProjId())); |
| | | } |
| | | achieveNew.setT2(projUse.getSource()); |
| | | achieveNew.setDatatime(new Date()); |
| | |
| | | |
| | | if (flag) { |
| | | // if (!achieveId.equals(beauticianState.getStaffId())) { |
| | | AchieveNew saleManAchieve = new AchieveNew(); |
| | | BeanUtils.copyProperties(achieveNew, saleManAchieve); |
| | | saleManAchieve.setBeaultId(achieveId); |
| | | AchieveNew saleManAchieve = new AchieveNew(); |
| | | BeanUtils.copyProperties(achieveNew, saleManAchieve); |
| | | saleManAchieve.setBeaultId(achieveId); |
| | | |
| | | saleAchieveNumOfPeople(saleManAchieve); |
| | | //销售人员不计算项目提成 |
| | | saleManAchieve.setProjPercentage(0D); |
| | | achieveNewList.add(saleManAchieve); |
| | | saleAchieveNumOfPeople(saleManAchieve); |
| | | //销售人员不计算项目提成 |
| | | saleManAchieve.setProjPercentage(0D); |
| | | achieveNewList.add(saleManAchieve); |
| | | // } |
| | | } |
| | | |
| | |
| | | AchieveRuleDao achieveRuleDao; |
| | | |
| | | private Double calculationProjPercentage(int type, Double consume, Long goodsId) { |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(goodsId); |
| | | if(shoppingGoods.getAchieveRuleId()!=null){ |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(goodsId); |
| | | if (shoppingGoods.getAchieveRuleId() != null) { |
| | | |
| | | AchieveRule achieveRule = achieveRuleDao.selectById(shoppingGoods.getAchieveRuleId()); |
| | | if(achieveRule!=null){ |
| | | List<AchieveRuleItem> achieveRuleItems = JSONUtil.toList(JSONUtil.parseArray(achieveRule.getRules()), AchieveRuleItem.class); |
| | | double percentage=0D; |
| | | for(AchieveRuleItem item:achieveRuleItems){ |
| | | if(item.getAchieveType()==type |
| | | && (item.getLower() == consume |
| | | || (item.getLower()< consume && consume < item.getUpper() ))){ |
| | | AchieveRule achieveRule = achieveRuleDao.selectById(shoppingGoods.getAchieveRuleId()); |
| | | if (achieveRule != null) { |
| | | List<AchieveRuleItem> achieveRuleItems = JSONUtil.toList(JSONUtil.parseArray(achieveRule.getRules()), AchieveRuleItem.class); |
| | | double percentage = 0D; |
| | | for (AchieveRuleItem item : achieveRuleItems) { |
| | | if (item.getAchieveType() == type |
| | | && (item.getLower() == consume |
| | | || (item.getLower() < consume && consume < item.getUpper()))) { |
| | | |
| | | if(AchieveRuleItem.ACHIEVE_TYPE_FIXED==item.getCalculationType()){ |
| | | percentage=item.getAchieve(); |
| | | }else{ |
| | | percentage= consume * (item.getAchieve()/100); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | return percentage; |
| | | } |
| | | } |
| | | if (AchieveRuleItem.ACHIEVE_TYPE_FIXED == item.getCalculationType()) { |
| | | percentage = item.getAchieve(); |
| | | } else { |
| | | percentage = consume * (item.getAchieve() / 100); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | return percentage; |
| | | } |
| | | } |
| | | return 0D; |
| | | } |
| | | |
| | | /** |
| | | * 顾问人头业绩 |
| | | * |
| | | * @param achieveNew |
| | | */ |
| | | private void saleAchieveNumOfPeople(AchieveNew achieveNew) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 合并订单与服务单人头逻辑,即每一个客户对美疗师/顾问来说,每一天同一个客户只算一个人头。 |
| | | * 如若A给客户X下订单,并给客户X服务,对A来说只算一个人头 |
| | | */ |
| | |
| | | if (orderItem != null && CollectionUtils.isNotEmpty(orderItem.getAchieveList())) { |
| | | |
| | | for (AchieveNew achieveNew : orderItem.getAchieveList()) { |
| | | if (achieveNew !=null && achieveNew.getGoodsCash()!=null) { |
| | | buildAchieve(pageOrder, orderItem, achieveNew); |
| | | if (achieveNew != null && achieveNew.getGoodsCash() != null) { |
| | | buildAchieve(pageOrder, orderItem, achieveNew); |
| | | achieveNewList.add(achieveNew); |
| | | |
| | | beautyIds.add(achieveNew.getBeaultId()); |
| | | } |
| | | } |
| | |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | private void buildAchieve(SysOrder pageOrder, SysOrderItem orderItem, AchieveNew achieveNew) { |
| | | BusParameterSettings shopManageJjcpasConsume =null; |
| | | BusParameterSettings shopManageJjcpasConsume = null; |
| | | if (Dictionary.ORDER_STATU_TK.equals(pageOrder.getStatu())) { |
| | | achieveNew.setId(null); |
| | | achieveNew.setProjPercentage(0 - achieveNew.getProjPercentage()); |
| | |
| | | } |
| | | |
| | | achieveNew.setVipId(pageOrder.getVipId()); |
| | | if(achieveNew.getSaleId()==null){ |
| | | if (achieveNew.getSaleId() == null) { |
| | | achieveNew.setSaleId(pageOrder.getStaffId()); |
| | | } |
| | | |
| | |
| | | } else { |
| | | achieveNew.setDatatime(new Date()); |
| | | } |
| | | if(Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(orderItem.getShoppingGoods().getGoodType())){ |
| | | if(shopManageJjcpasConsume==null){ |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(orderItem.getGoodsId()); |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(shoppingGoods.getGoodType())) { |
| | | if (shopManageJjcpasConsume == null) { |
| | | shopManageJjcpasConsume = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_JJCPAS_CONSUME, pageOrder.getCompanyId()); |
| | | } |
| | | if(AppConstance.IS_Y.equals(shopManageJjcpasConsume.getParamValue())){ |
| | | // if (AppConstance.IS_Y.equals(shopManageJjcpasConsume.getParamValue())) { |
| | | // achieveNew.setHisConsume(achieveNew.getGoodsCash()); |
| | | // } |
| | | if (BooleanEnum.TRUE.getValue() == shopManageJjcpasConsume.getIntParamValue()) { |
| | | achieveNew.setHisConsume(achieveNew.getGoodsCash()); |
| | | } |
| | | |
| | |
| | | Date endTime = calendar.getTime(); |
| | | switch (type) { |
| | | // 本日 |
| | | case 1 : |
| | | case 1: |
| | | break; |
| | | // 昨日 |
| | | case 2: |
| | |
| | | public int findDailyBeautyListTotal(AchieveNew achieveNew) { |
| | | return achieveNewDao.selectDailyBeautyListTotal(achieveNew); |
| | | } |
| | | |
| | | @Override |
| | | public void removeByOrderId(Long orderId) { |
| | | achieveNewDao.deleteByOrderId(orderId); |
| | | } |
| | | } |
| | |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.pojo.VerificationResult; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | | import com.matrix.system.common.validate.GroupValidateStatusCheckUtil; |
| | | import com.matrix.system.common.validate.group.Group; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.MoneyCardUse; |
| | | import com.matrix.system.hive.bean.MoneyCardUseFreeze; |
| | | import com.matrix.system.hive.bean.SysOrderItem; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.dto.MoneyCardOperationDto; |
| | | import com.matrix.system.hive.plugin.util.MoneyUtil; |
| | | import com.matrix.system.hive.service.MoneyCardUseService; |
| | | import com.matrix.system.hive.service.ShoppingGoodsService; |
| | | import com.matrix.system.hive.service.SysOrderService; |
| | | import com.matrix.system.hive.validation.MoneyCardUseGroup; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | |
| | | /** |
| | | * @date 2016-09-17 10:17 |
| | | */ |
| | | @Service("moneyCardUseService") |
| | | public class MoneyCardUseServiceImpl extends ServiceImpl<MoneyCardUseDao,MoneyCardUse> implements MoneyCardUseService { |
| | | public class MoneyCardUseServiceImpl extends ServiceImpl<MoneyCardUseDao, MoneyCardUse> implements MoneyCardUseService { |
| | | |
| | | |
| | | @Autowired |
| | |
| | | private SysOrderItemDao orderItemDao; |
| | | |
| | | @Autowired |
| | | SysOrderService sysOrderService; |
| | | |
| | | @Autowired |
| | | private SysVipLevelDao viplevelDao; |
| | | |
| | | @Autowired |
| | | ShoppingGoodsDao shoppingGoodsDao; |
| | | |
| | | @Autowired |
| | | MoneyCardAssembleDao moneyCardAssembleDao; |
| | | @Autowired |
| | | MoneyCardUseFlowDao moneyCardUseFlowDao; |
| | | |
| | | @Autowired |
| | | SysUsersDao sysUsersDao; |
| | | |
| | | @Autowired |
| | | private ShoppingGoodsService shoppingGoodsService; |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addVipMoneyCard(List<MoneyCardOperationDto> moneyCardOperationDtos) { |
| | | moneyCardOperationDtos.forEach(dto -> { |
| | | |
| | | //参数校验 |
| | | GroupValidateStatusCheckUtil.check(dto,Group.ADD.class); |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(dto.getGoodsId()); |
| | | MoneyCardUse moneyCardUse = new MoneyCardUse(); |
| | | BeanUtil.copyProperties(dto, moneyCardUse); |
| | | moneyCardUse.setGiftMoney(shoppingGoods.getReferencePice()); |
| | | moneyCardUse.setRealMoney(shoppingGoods.getSealPice()); |
| | | moneyCardUse.setGoodsId(shoppingGoods.getId()); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | moneyCardUse.setIsVipCar(Dictionary.FLAG_NO_N); |
| | | moneyCardUse.setCardName(shoppingGoods.getName()); |
| | | |
| | | //余次处理 |
| | | if (shoppingGoods.getCarUseCount() == null || shoppingGoods.getCarUseCount() == 0) { |
| | | moneyCardUse.setUseTotal(999999999); |
| | | moneyCardUse.setLastCount(999999999); |
| | | } else { |
| | | moneyCardUse.setUseTotal(shoppingGoods.getCarUseCount()); |
| | | moneyCardUse.setLastCount(shoppingGoods.getCarUseCount()); |
| | | } |
| | | //失效时间处理 |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 1, null); |
| | | moneyCardUse.setFailTime(invalidTime); |
| | | moneyCardUseDao.insert(moneyCardUse); |
| | | |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByOrderItemId(Long orderItemId) { |
| | | |
| | | List<MoneyCardUse> moneyCardUseList = getMoneyCardUseListByOrderItemId(orderItemId); |
| | | moneyCardUseList.forEach(moneyCardUse -> { |
| | | MoneyCardUseFlow moneyCardUseFlow=new MoneyCardUseFlow(); |
| | | moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); |
| | | int i = moneyCardUseFlowDao.selectTotalRecord(moneyCardUseFlow); |
| | | if(i>0){ |
| | | throw new GlobleException(moneyCardUse.getCardName()+"储值卡已经被启用无法删除"); |
| | | }else { |
| | | LogUtil.info("根据订单明细id{},删除储值卡:{}", orderItemId,moneyCardUse.getCardName()); |
| | | moneyCardUseDao.deleteById(moneyCardUse.getId()); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void moneyCardTk(List<MoneyCardOperationDto> moneyCardOperationDtos) { |
| | | |
| | | moneyCardOperationDtos.forEach(moneyCardOperationDto -> { |
| | | |
| | | GroupValidateStatusCheckUtil.check(moneyCardOperationDto, MoneyCardUseGroup.moneyCardUseTk.class); |
| | | |
| | | List<MoneyCardUse> moneyCardUseList = getMoneyCardUseListByOrderItemId(moneyCardOperationDto.getOrderItemId()); |
| | | for (MoneyCardUse moneyCardUse : moneyCardUseList) { |
| | | //本金扣款 |
| | | if (moneyCardUse.getRealMoney() + moneyCardOperationDto.getRealMoney() >= 0) { |
| | | double surplus = MoneyUtil.add(moneyCardUse.getRealMoney(), moneyCardOperationDto.getRealMoney()); |
| | | moneyCardUse.setRealMoney(surplus); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | //余额为0时充值卡变为无效 |
| | | if (moneyCardUse.getRealMoney().equals(0D)) { |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.TAOCAN_STATUS_TK); |
| | | } |
| | | moneyCardUse.setGiftMoney(0D); |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | saveMoneyCardUseFlow(moneyCardOperationDto,moneyCardUse); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单明细id查询会员卡 |
| | | * @param orderItemId |
| | | * @return |
| | | */ |
| | | private List<MoneyCardUse> getMoneyCardUseListByOrderItemId(Long orderItemId) { |
| | | LambdaQueryWrapper<MoneyCardUse> lambdaQueryChainWrapper = new LambdaQueryWrapper(); |
| | | lambdaQueryChainWrapper.eq(MoneyCardUse::getOrderItemId, orderItemId); |
| | | List<MoneyCardUse> moneyCardUseList = list(lambdaQueryChainWrapper); |
| | | return moneyCardUseList; |
| | | } |
| | | |
| | | /** |
| | | * 保存储值卡流水 |
| | | * @param moneyCardOperationDto |
| | | * @param moneyCardUse |
| | | */ |
| | | private void saveMoneyCardUseFlow(MoneyCardOperationDto moneyCardOperationDto,MoneyCardUse moneyCardUse){ |
| | | MoneyCardUseFlow moneyCardUseFlow=new MoneyCardUseFlow(); |
| | | moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); |
| | | moneyCardUseFlow.setOrderNo(moneyCardOperationDto.getOrderNo()); |
| | | moneyCardUseFlow.setVipId(moneyCardUse.getVipId()); |
| | | moneyCardUseFlow.setTimes(moneyCardUse.getLastCount()); |
| | | moneyCardUseFlow.setType(moneyCardOperationDto.getType()); |
| | | moneyCardUseFlow.setCreateTime(new Date()); |
| | | moneyCardUseFlow.setOperationId(moneyCardOperationDto.getUpdateUser()); |
| | | moneyCardUseFlow.setTotal(moneyCardUse.getRealMoney()); |
| | | moneyCardUseFlow.setGiftMoney(moneyCardUse.getGiftMoney()); |
| | | moneyCardUseFlow.setTotal(moneyCardOperationDto.getRealMoney()); |
| | | moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney()); |
| | | moneyCardUseFlow.setStaffName(sysUsersDao.selectById(moneyCardOperationDto.getUpdateUser()).getSuName()); |
| | | |
| | | |
| | | |
| | | moneyCardUseFlowDao.insert(moneyCardUseFlow); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void changeMoneyCard(List<MoneyCardOperationDto> moneyCardOperationDtoList) { |
| | | moneyCardOperationDtoList.forEach(moneyCardOperationDto -> { |
| | | |
| | | |
| | | if (MoneyCardUseFlow.USE_TYPE_CONSUMER.equals(moneyCardOperationDto.getType())) { |
| | | //储值卡支付订单 扣减储值卡余额 |
| | | GroupValidateStatusCheckUtil.check(moneyCardOperationDto,MoneyCardUseGroup.moneyCardUseOrderChange.class); |
| | | moneyCardPayOrder(moneyCardOperationDto); |
| | | } else if (MoneyCardUseFlow.USE_TYPE_ORDRE_CANCEL.equals(moneyCardOperationDto.getType())) { |
| | | //回退储值卡余额 |
| | | GroupValidateStatusCheckUtil.check(moneyCardOperationDto,MoneyCardUseGroup.moneyCardUseOrderChange.class); |
| | | returnMoneyCard(moneyCardOperationDto); |
| | | } else if (MoneyCardUseFlow.USE_TYPE_CZ.equals(moneyCardOperationDto.getType())) { |
| | | //回退储值卡余额 |
| | | GroupValidateStatusCheckUtil.check(moneyCardOperationDto,MoneyCardUseGroup.moneyCardUseCz.class); |
| | | moneyCardCz(moneyCardOperationDto); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 会员卡充值 |
| | | * @param moneyCardOperationDto |
| | | */ |
| | | private void moneyCardCz(MoneyCardOperationDto moneyCardOperationDto) { |
| | | |
| | | LogUtil.info("会员卡充值 {}", JSON.toJSONString(moneyCardOperationDto)); |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(moneyCardOperationDto.getCarUseId()); |
| | | |
| | | |
| | | if (Objects.nonNull(moneyCardOperationDto.getGiftMoney())) { |
| | | //jyytodo 余额余次的修改和新增在数据库层面做加减 |
| | | moneyCardUse.setGiftMoney(moneyCardUse.getGiftMoney() + moneyCardOperationDto.getGiftMoney()); |
| | | } |
| | | if (Objects.nonNull(moneyCardOperationDto.getRealMoney())) { |
| | | moneyCardUse.setRealMoney(moneyCardUse.getRealMoney() + moneyCardOperationDto.getRealMoney()); |
| | | } |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | //设置卡项使用流水 |
| | | saveMoneyCardUseFlow(moneyCardOperationDto,moneyCardUse); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 回退储值卡余额 |
| | | * |
| | | * @param moneyCardOperationDto |
| | | */ |
| | | private void returnMoneyCard(MoneyCardOperationDto moneyCardOperationDto) { |
| | | LogUtil.info("回退储值卡余额 {}", JSON.toJSONString(moneyCardOperationDto)); |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(moneyCardOperationDto.getCarUseId()); |
| | | MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); |
| | | |
| | | if (Objects.nonNull(moneyCardOperationDto.getGiftMoney())) { |
| | | //jyytodo 余额余次的修改和新增在数据库层面做加减 |
| | | moneyCardUse.setGiftMoney(moneyCardUse.getGiftMoney() + moneyCardOperationDto.getGiftMoney()); |
| | | } |
| | | if (Objects.nonNull(moneyCardOperationDto.getRealMoney())) { |
| | | moneyCardUse.setRealMoney(moneyCardUse.getRealMoney() + moneyCardOperationDto.getRealMoney()); |
| | | } |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | |
| | | |
| | | //设置卡项使用流水 |
| | | saveMoneyCardUseFlow(moneyCardOperationDto,moneyCardUse); |
| | | } |
| | | |
| | | /** |
| | | * 储值卡支付订单 扣减储值卡余额 |
| | | * |
| | | * @param moneyCardOperationDto |
| | | */ |
| | | private void moneyCardPayOrder(MoneyCardOperationDto moneyCardOperationDto) { |
| | | // 判断商品是否在充值卡的限制购买 |
| | | VerificationResult verificationResult = checkIsBangding(moneyCardOperationDto.getCarUseId(), moneyCardOperationDto.getGoodsIds()); |
| | | if (!verificationResult.isJudgeResult()) { |
| | | throw new GlobleException(verificationResult.getMsg()); |
| | | } |
| | | |
| | | LogUtil.info("扣减储值卡余额 {}", JSON.toJSONString(moneyCardOperationDto)); |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(moneyCardOperationDto.getCarUseId()); |
| | | |
| | | // 用户默认储值卡不进行欠款检查 20220512 wzy |
| | | if (Dictionary.FLAG_NO_N.equals(moneyCardUse.getIsVipCar())) { |
| | | //欠款检查 |
| | | checkOrderStatu(moneyCardUse.getOrderItemId()); |
| | | } |
| | | |
| | | //赠送金额扣款 |
| | | if (moneyCardUse.getGiftMoney() + moneyCardOperationDto.getGiftMoney() >= 0) { |
| | | double surplus = MoneyUtil.add(moneyCardUse.getGiftMoney(), moneyCardOperationDto.getGiftMoney()); |
| | | moneyCardUse.setGiftMoney(surplus); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | //本金扣款 |
| | | if (moneyCardUse.getRealMoney() + moneyCardOperationDto.getRealMoney() >= 0) { |
| | | double surplus = MoneyUtil.add(moneyCardUse.getRealMoney(), moneyCardOperationDto.getRealMoney()); |
| | | moneyCardUse.setRealMoney(surplus); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | |
| | | |
| | | if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_NO_N)) { |
| | | //余额为0时充值卡变为无效 |
| | | if (moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)) { |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); |
| | | } |
| | | } |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(moneyCardUse.getGoodsId()); |
| | | if (shoppingGoods != null) { |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime()); |
| | | moneyCardUse.setFailTime(invalidTime); |
| | | } |
| | | |
| | | // 储值卡不减少使用次数 20220512 wzy |
| | | if (Dictionary.FLAG_NO_N.equals(moneyCardUse.getIsVipCar())) { |
| | | moneyCardUse.setLastCount(moneyCardUse.getLastCount() - moneyCardOperationDto.getCount()); |
| | | } |
| | | |
| | | // 更新充值卡信息 |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | //设置卡项使用流水 |
| | | saveMoneyCardUseFlow(moneyCardOperationDto,moneyCardUse); |
| | | } |
| | | |
| | | /** |
| | | * 检查商品是否在储值卡的消费范围内 |
| | | * |
| | | * @param moneyCardUseId 储值卡id |
| | | * @param goodsIds 商品id集合 |
| | | * @return |
| | | */ |
| | | private VerificationResult checkIsBangding(Long moneyCardUseId, List<Long> goodsIds) { |
| | | // 如果是一卡通则肯定在绑定范围内 |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(moneyCardUseId); |
| | | //默认储值卡可以购买所有产品 |
| | | if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y)) { |
| | | return VerificationResult.success(); |
| | | } else { |
| | | // 不是默认储值卡判断卡是否可应用于所有产品 |
| | | ShoppingGoods cardGoods = shoppingGoodsDao.selectById(moneyCardUse.getGoodsId()); |
| | | if (cardGoods != null) { |
| | | if (Dictionary.FLAG_YES.equals(cardGoods.getCarIsAll())) { |
| | | return VerificationResult.success(); |
| | | } |
| | | } |
| | | // 比较分类 |
| | | MoneyCardAssemble moneyCardAssemble = new MoneyCardAssemble(); |
| | | moneyCardAssemble.setCardId(moneyCardUse.getGoodsId()); |
| | | List<MoneyCardAssemble> cardAssembleList = moneyCardAssembleDao.selectByModel(moneyCardAssemble); |
| | | List<ShoppingGoods> yhGoods = shoppingGoodsDao.selectByIds(goodsIds); |
| | | |
| | | StringBuilder msgBuilder = new StringBuilder(); |
| | | |
| | | for (ShoppingGoods goods : yhGoods) { |
| | | boolean isMatch = false; |
| | | for (MoneyCardAssemble cardAssemble : cardAssembleList) { |
| | | // 比较类型 |
| | | if (cardAssemble.getType().equals(Dictionary.CZK_ASSEMBLE_FL)) { |
| | | |
| | | if (goods.getCateId().equals(cardAssemble.getCateId())) { |
| | | isMatch = true; |
| | | break; |
| | | } |
| | | } else { |
| | | // 比较绑定 |
| | | if (goods.getId().equals(cardAssemble.getGoodsId())) { |
| | | isMatch = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (!isMatch) { |
| | | msgBuilder.append(goods.getName() + "不在" + moneyCardUse.getCardName() + "优惠中 "); |
| | | } |
| | | } |
| | | if (msgBuilder.length() > 0) { |
| | | return VerificationResult.fail(msgBuilder.toString()); |
| | | } else { |
| | | return VerificationResult.success(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int add(MoneyCardUse moneyCardUse) { |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void transfer(MoneyCardUse moneyCardUse, Long vipId2, Double money) { |
| | | Long oldId = moneyCardUse.getId(); |
| | | |
| | | moneyCardUse = moneyCardUseDao.selectById(moneyCardUse.getId()); |
| | | if (moneyCardUse.getVipId().equals(vipId2)) { |
| | | throw new GlobleException("转让人不能是该充值卡拥有者!"); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //设置为有效 |
| | | @Override |
| | | public void active(MoneyCardUse proj) { |
| | |
| | | /** |
| | | * 检测订单条目是否已付款完毕 |
| | | */ |
| | | public void checkOrderStatu(Long id) { |
| | | SysOrderItem item = orderItemDao.selectById(id); |
| | | if (!Dictionary.ORDER_STATU_YFK.equals(item.getStatus())) { |
| | | throw new GlobleException("该商品还存在欠款!"); |
| | | public void checkOrderStatu(Long orderItemId) { |
| | | SysOrder order = sysOrderService.findById(orderItemDao.selectById(orderItemId).getOrderId()); |
| | | if (!Dictionary.ORDER_STATU_YFK.equals(order.getStatu())) { |
| | | throw new GlobleException("储值卡购买订单还存在欠款,在补交欠款后才能使用!"); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.core.tools.*; |
| | | import com.matrix.system.app.dto.ShoppingGoodsListDto; |
| | | import com.matrix.system.app.vo.ShoppingGoodsDetailVo; |
| | | import com.matrix.system.app.vo.ShoppingGoodsListVo; |
| | |
| | | import com.matrix.system.hive.bean.ShoppingGoodsAssemble; |
| | | import com.matrix.system.hive.bean.ShoppingGoodsCategory; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.dao.MoneyCardAssembleDao; |
| | | import com.matrix.system.hive.dao.ShoppingGoodsAssembleDao; |
| | | import com.matrix.system.hive.dao.ShoppingGoodsDao; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.dto.GoodsSealLimitDto; |
| | | import com.matrix.system.hive.dto.SysOrderItemDto; |
| | | import com.matrix.system.hive.service.ShoppingGoodsService; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | @Autowired |
| | | private SysShopInfoDao shopInfoDao; |
| | | |
| | | @Autowired |
| | | private SysOrderItemDao orderItemDao; |
| | | |
| | | @Override |
| | | public void checkGoodsSealLimit(GoodsSealLimitDto goodsSealLimitDto) { |
| | | LogUtil.info("开始检测商品销售限制:{}", goodsSealLimitDto.toString()); |
| | | //校验参数不能为空 |
| | | checkGoodsSelLimtParam(goodsSealLimitDto); |
| | | |
| | | goodsSealLimitDto.getSysOrderItemDtoList().forEach(item -> { |
| | | ShoppingGoods shopGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | //最大销售次数检测 |
| | | Integer maxNum = shopGoods.getCarMaxSaleCount(); |
| | | if (maxNum != null && maxNum != 0) { |
| | | Integer buyNum = orderItemDao.selectByGoodsId(shopGoods.getId(), null); |
| | | if (buyNum.equals(maxNum)) { |
| | | if (!shopGoods.getStaus().equals(Dictionary.BUSINESS_STATE_DOWN)) { |
| | | shopGoods.setStaus(Dictionary.BUSINESS_STATE_DOWN); |
| | | shoppingGoodsDao.update(shopGoods); |
| | | LogUtil.info("商品达到最大销售数量自动下架:{}", shopGoods.getName()); |
| | | } |
| | | } else if ((buyNum + item.getCount()) > maxNum) { |
| | | throw new GlobleException(shopGoods.getName() + "已超过最大销售数量"); |
| | | } |
| | | } |
| | | //每人限购次数检测 |
| | | Integer onceCount = shopGoods.getIsOnce(); |
| | | if (onceCount != null && onceCount != 0) { |
| | | Integer buyOnceCount = orderItemDao.selectByGoodsId(shopGoods.getId(), goodsSealLimitDto.getVipId()); |
| | | if ((buyOnceCount + item.getCount()) > onceCount) { |
| | | throw new GlobleException(shopGoods.getName() + "每人限购" + onceCount + "次"); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | private void checkGoodsSelLimtParam(GoodsSealLimitDto goodsSealLimitDto) { |
| | | ParamCheckUtil.requireNonNulls(goodsSealLimitDto, |
| | | goodsSealLimitDto.getVipId(), |
| | | goodsSealLimitDto.getSysOrderItemDtoList()); |
| | | |
| | | |
| | | ParamCheckUtil.requireListElementNonNull(goodsSealLimitDto.getSysOrderItemDtoList(), |
| | | Arrays.asList(SysOrderItemDto::getCount, SysOrderItemDto::getGoodsId)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | SysShopInfo shopInfo = shopInfoDao.selectById(sysUsers.getShopId()); |
| | | |
| | | |
| | | if(shopInfo.getShopType()==SysShopInfo.SHOP_TYPE_ZONGBU){ |
| | | if(shopInfo.getShopType() == SysShopInfo.SHOP_TYPE_ZONGBU){ |
| | | shoppingGoods.setHeadquarters(1); |
| | | }else{ |
| | | } else { |
| | | shoppingGoods.setHeadquarters(2); |
| | | } |
| | | |
| | |
| | | if (shoppingGoods.getReferencePice() == null) { |
| | | shoppingGoods.setReferencePice(0d); |
| | | } |
| | | shoppingGoods.setZjm(StringUtils.toHanyuPinyin(shoppingGoods.getName())+","+StringUtils.toHeadWordHanyuPinyin(shoppingGoods.getName())); |
| | | shoppingGoods.setZjm(StringUtils.toHanyuPinyin(shoppingGoods.getName()) + "," + StringUtils.toHeadWordHanyuPinyin(shoppingGoods.getName())); |
| | | shoppingGoods.setIsDel(ShoppingGoods.NORMAL); |
| | | //新增销售产品 |
| | | int i = shoppingGoodsDao.insert(shoppingGoods); |
| | |
| | | } else { |
| | | setGoodsAssembles(shoppingGoods); |
| | | } |
| | | |
| | | |
| | | |
| | | return i; |
| | |
| | | |
| | | if (ShoppingGoods.SHOPPING_GOODS_TYPE_CZK.equals(shoppingGoods.getGoodType())) { |
| | | setCardAssemble(shoppingGoods); |
| | | }else{ |
| | | } else { |
| | | |
| | | //清除原有绑定关系 |
| | | shoppingGoodsAssembleDao.deleteByGoodsId(shoppingGoods.getId()); |
| | | //合并绑定的产品和项目 |
| | | List<ShoppingGoodsAssemble> assembles = new ArrayList<>(); |
| | | if(CollectionUtils.isNotEmpty(shoppingGoods.getAssembleGoods())){ |
| | | if (CollectionUtils.isNotEmpty(shoppingGoods.getAssembleGoods())) { |
| | | assembles.addAll(shoppingGoods.getAssembleGoods()); |
| | | } |
| | | //如果是套餐叠加套餐绑定的项目部分 |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(shoppingGoods.getGoodType())){ |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(shoppingGoods.getGoodType())) { |
| | | assembles.addAll(shoppingGoods.getAssembleProj()); |
| | | } |
| | | |
| | |
| | | case Dictionary.SHOPPING_GOODS_TYPE_TC: |
| | | shoppingGoods.setIsAssemble(Dictionary.FLAG_YES); |
| | | break; |
| | | case Dictionary.SHOPPING_GOODS_TYPE_ZHK: |
| | | shoppingGoods.setIsAssemble(Dictionary.FLAG_YES); |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | shoppingGoods.setWeiImg(Dictionary.DEFAULT_IMG); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * 计算失效时间 |
| | | * |
| | | * @param shoppingGoods |
| | | * @param type 1 - 购买时 2 - 消耗时 |
| | | * @param buyDate 购买日期, 当计算消耗日期时,不能为空 |
| | | * @param type 1 - 购买时 2 - 消耗时 |
| | | * @param buyDate 购买日期, 当计算消耗日期时,不能为空 |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.constance.Dictionary; |
| | |
| | | sysInstoreInfo.setCheckStatus(Dictionary.CHECK_STATUS_DSH); |
| | | // 设置入库单编号 |
| | | sysInstoreInfo.setInstoreId(DateUtil.getTimeMark()); |
| | | // SysShopInfo info = shopInfoDao.selectByShopName(Dictionary.SHOP_NAME_ZONGDIAN); |
| | | // // 系统限制入库只能入库到总店,总店不存在则 |
| | | // if (info == null) { |
| | | // throw new GlobleException("总店仓库不存在,请添加!"); |
| | | // } |
| | | |
| | | // 插入 |
| | | int i = sysInstoreInfoDao.insert(sysInstoreInfo); |
| | | // 设置总金额,并更新 |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int check(SysInstoreInfo sysInstoreInfo) { |
| | | LogUtil.info("入库单审核:{}", JSON.toJSONString(sysInstoreInfo)); |
| | | // 验证权限 |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | sysInstoreInfo.setAppmanId(user.getSuId()); |
| | |
| | | sysInstoreInfo.setCompanyId(user.getCompanyId()); |
| | | |
| | | SysInstoreInfo checkInStore = sysInstoreInfoDao.selectById(sysInstoreInfo.getId()); |
| | | // if (!checkInStore.getAppmanId().equals(user.getSuId())) { |
| | | // throw new GlobleException("无权审核该单据!"); |
| | | // } |
| | | if (!checkInStore.getCheckStatus().equals(Dictionary.CHECK_STATUS_DSH)) { |
| | | throw new GlobleException("该单据状态为" + checkInStore.getCheckStatus() + ",不可审核!"); |
| | | } |
New file |
| | |
| | | /** |
| | | * projectName: zq-erp |
| | | * fileName: SysOrderServiceHelper.java |
| | | * packageName: com.matrix.system.hive.service.imp |
| | | * date: 2022-03-11 9:33 |
| | | * copyright(c) 2022 http://www.hydee.cn/ Inc. All rights reserved. |
| | | */ |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.common.collect.Lists; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | 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.OperationLogService; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.enums.OperationButtonEnum; |
| | | import com.matrix.system.enums.OperationFunctionEnum; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.dto.MoneyCardOperationDto; |
| | | import com.matrix.system.hive.dto.ProjUseOperationDto; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.hive.plugin.util.MoneyUtil; |
| | | import com.matrix.system.hive.pojo.CzXkVo; |
| | | import com.matrix.system.hive.service.CodeService; |
| | | import com.matrix.system.hive.service.MoneyCardUseService; |
| | | import com.matrix.system.hive.service.SysInstoreInfoService; |
| | | import com.matrix.system.hive.service.SysProjUseService; |
| | | import com.matrix.system.score.constant.ScoreSettingConstant; |
| | | import com.matrix.system.score.entity.ScoreVipDetail; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @version: V1.0 |
| | | * @author: JiangYouYao |
| | | * @className: SysOrderServiceHelper |
| | | * @packageName: com.matrix.system.hive.service.imp |
| | | * @description: 订单服务助手 |
| | | * @data: 2022-03-11 9:33 |
| | | **/ |
| | | @Component |
| | | public class SysOrderServiceHelper { |
| | | |
| | | |
| | | @Autowired |
| | | SysInstoreInfoService sysInstoreInfoService; |
| | | |
| | | @Autowired |
| | | private SysSupplierInfoDao sysSupplierInfoDao; |
| | | |
| | | @Autowired |
| | | ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | @Autowired |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Autowired |
| | | private SysStoreInfoDao storeInfoDao; |
| | | |
| | | @Autowired |
| | | private SysProjUseService sysProjUseService; |
| | | |
| | | @Autowired |
| | | SysOutStoreDao sysOutStoreDao; |
| | | @Autowired |
| | | private CodeService codeService; |
| | | |
| | | @Autowired |
| | | ShoppingGoodsAssembleDao shoppingGoodsAssembleDao; |
| | | |
| | | @Autowired |
| | | SysOutStoreItemDao sysOutStoreItemDao; |
| | | |
| | | @Autowired |
| | | private SysOrderDao sysOrderDao; |
| | | |
| | | @Autowired |
| | | private OperationLogService operationLogService; |
| | | @Autowired |
| | | ShoppingGoodsDao shoppingGoodsDao; |
| | | |
| | | @Autowired |
| | | private SysOrderFlowDao sysOrderFlowDao; |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | private WarehouseDao warehouseDao; |
| | | |
| | | @Autowired |
| | | MoneyCardUseService moneyCardUseService; |
| | | |
| | | @Autowired |
| | | private SysOrderItemDao orderItemDao; |
| | | |
| | | |
| | | @Autowired |
| | | MoneyCardUseDao moneyCardUseDao; |
| | | |
| | | /** |
| | | * 创建支付流水 |
| | | * |
| | | * @author:姜友瑶 |
| | | */ |
| | | public void addOrderFlow(SysOrder sourceOrder, boolean isBj) { |
| | | |
| | | LogUtil.info("创建支付流水 id={}", sourceOrder.getId()); |
| | | //处理支付流水 |
| | | int flowCount = 1; |
| | | for (SysOrderFlow flow : sourceOrder.getFlows()) { |
| | | flow.setFlowNo(codeService.getFlowCode() + "-" + flowCount); |
| | | flow.setVipId(sourceOrder.getVipId()); |
| | | flow.setShopId(sourceOrder.getShopId()); |
| | | flow.setCompanyId(sourceOrder.getCompanyId()); |
| | | //支付内容摘要设置 |
| | | Long goodsId = sourceOrder.getItems().get(0).getGoodsId(); |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); |
| | | flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品"); |
| | | // 若是退款,则取负数 |
| | | if (SysOrder.ORDER_TYPE_REFUND == sourceOrder.getOrderType()) { |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_REFUND); |
| | | flow.setAmount(flow.getAmount().negate()); |
| | | flow.setOrderId(sourceOrder.getOldOrderId()); |
| | | } else { |
| | | if (isBj) {//jyytodo 优化不能根据isbj来判断流水类型 |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_REPAY); |
| | | } else { |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_BUY); |
| | | } |
| | | |
| | | flow.setOrderId(sourceOrder.getId()); |
| | | } |
| | | sysOrderFlowDao.insert(flow); |
| | | flowCount++; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增项目和套餐的余次 |
| | | * |
| | | * @author:姜友瑶 |
| | | * @date 2016年9月2日 |
| | | */ |
| | | public void addTaocanProj(SysOrder order) { |
| | | List<SysOrderItem> itemList = order.getItems(); |
| | | List<ProjUseOperationDto> projUseDtoList = Lists.newArrayList(); |
| | | for (SysOrderItem sysOrderItem : itemList) { |
| | | // 折扣 项目的实际购买除以项目原价,来计算项目的消耗价格 |
| | | // 赠送 计算全额的消耗业绩 |
| | | ProjUseOperationDto projUseOperationDto = new ProjUseOperationDto(); |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0 && !isGiftMoneyPay(order)) { |
| | | projUseOperationDto.setFree(false); |
| | | } else { |
| | | projUseOperationDto.setFree(true); |
| | | } |
| | | if (sysOrderItem.getType().equals(Dictionary.SHOPPING_GOODS_TYPE_TC)) { |
| | | //计算折扣 |
| | | Double zk = sysOrderItem.getZkPrice() / sysOrderItem.getPrice(); |
| | | projUseOperationDto.setTcZk(zk); |
| | | } |
| | | |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | projUseOperationDto.setPayMoney(sysOrderItem.getZkPrice()); |
| | | projUseOperationDto.setGoodsId(sysOrderItem.getGoodsId()); |
| | | projUseOperationDto.setCount(sysOrderItem.getCount()); |
| | | projUseOperationDto.setVipId(order.getVipId()); |
| | | projUseOperationDto.setOrderItemId(sysOrderItem.getId()); |
| | | projUseOperationDto.setUpdateUserId(sysUsers.getSuId()); |
| | | projUseDtoList.add(projUseOperationDto); |
| | | } |
| | | sysProjUseService.addUserProjUse(projUseDtoList); |
| | | } |
| | | |
| | | /** |
| | | * 全是赠送金额,且配置了赠送金额购买计算为赠送 |
| | | * |
| | | * @param order |
| | | * @return |
| | | */ |
| | | private boolean isGiftMoneyPay(SysOrder order) { |
| | | BusParameterSettings giftiIsfree = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_GIFTISFREE, order.getCompanyId()); |
| | | if (BooleanEnum.TRUE.getValue() == giftiIsfree.getIntParamValue()) { |
| | | return order.getFlows().stream().allMatch(item -> SysOrderFlow.IS_GIFT_Y.equals(item.getIsGift()) |
| | | && item.getAmount().doubleValue() > 0D); |
| | | } else { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用充值卡付款操作 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | public void cardPaySk(SysOrder pageOrder) { |
| | | |
| | | |
| | | |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | List<SysOrderFlow> flows = pageOrder.getFlows(); |
| | | List<Long> goodsIds = pageOrder.getItems().stream().map(e -> e.getGoodsId()).collect(Collectors.toList()); |
| | | |
| | | List<MoneyCardOperationDto> moneyCardOperationDtos = Lists.newArrayList(); |
| | | |
| | | flows.forEach(flow -> { |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | if (flow.getCardId() != null) { |
| | | MoneyCardOperationDto dto = new MoneyCardOperationDto(); |
| | | dto.setOrderNo(pageOrder.getOrderNo()); |
| | | dto.setOrderId(pageOrder.getId()); |
| | | dto.setCount(1); |
| | | dto.setCarUseId(flow.getCardId()); |
| | | dto.setType(MoneyCardUseFlow.USE_TYPE_CONSUMER); |
| | | if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { |
| | | dto.setGiftMoney(-flow.getAmount().doubleValue()); |
| | | dto.setRealMoney(0D); |
| | | } else { |
| | | dto.setRealMoney(-flow.getAmount().doubleValue()); |
| | | dto.setGiftMoney(0D); |
| | | } |
| | | dto.setUpdateUser(user.getSuId()); |
| | | dto.setGoodsIds(goodsIds); |
| | | moneyCardOperationDtos.add(dto); |
| | | } else { |
| | | throw new GlobleException("无效的储值卡支付方式"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (CollectionUtils.isNotEmpty(moneyCardOperationDtos)) { |
| | | LogUtil.info("扣除储值卡余额{}", JSON.toJSONString(moneyCardOperationDtos)); |
| | | moneyCardUseService.changeMoneyCard(moneyCardOperationDtos); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 储值卡退款 |
| | | * @param order |
| | | */ |
| | | public void returnMoneyCardPay(SysOrder order) { |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | List<MoneyCardOperationDto> moneyCardOperationDtos = Lists.newArrayList(); |
| | | |
| | | List<SysOrderFlow> flows = sysOrderFlowDao.selectByOrderId(order.getId()); |
| | | // 非现金收款退回扣卡余额 |
| | | for (SysOrderFlow flow : flows) { |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | if (flow.getCardId() != null) { |
| | | MoneyCardOperationDto dto = new MoneyCardOperationDto(); |
| | | dto.setOrderNo(order.getOrderNo()); |
| | | dto.setOrderId(order.getId()); |
| | | dto.setCount(1); |
| | | dto.setCarUseId(flow.getCardId()); |
| | | dto.setType(MoneyCardUseFlow.USE_TYPE_ORDRE_CANCEL); |
| | | if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { |
| | | dto.setGiftMoney(flow.getAmount().doubleValue()); |
| | | } else { |
| | | dto.setRealMoney(flow.getAmount().doubleValue()); |
| | | } |
| | | dto.setUpdateUser(user.getSuId()); |
| | | moneyCardOperationDtos.add(dto); |
| | | } else { |
| | | throw new GlobleException("无效的储值卡支付方式"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(moneyCardOperationDtos)) { |
| | | LogUtil.info("退回储值卡余额{}", JSON.toJSONString(moneyCardOperationDtos)); |
| | | moneyCardUseService.changeMoneyCard(moneyCardOperationDtos); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param sourceOrder 如果购买了充值卡设置会员的充值卡 |
| | | * @author:姜友瑶 |
| | | * @date 2016年9月19日 |
| | | */ |
| | | public void addMoneyCardUse(SysOrder sourceOrder) { |
| | | |
| | | |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | List<MoneyCardOperationDto> moneyCardOperationDtos = Lists.newArrayList(); |
| | | List<SysOrderItem> orderItemList = sourceOrder.getItems(); |
| | | for (SysOrderItem sysOrderItem : orderItemList) { |
| | | // 如果购买的是充值卡 |
| | | if (sysOrderItem.getType().equals(Dictionary.SHOPPING_GOODS_TYPE_CZK)) { |
| | | for (int i = 0; i < sysOrderItem.getCount(); i++) { |
| | | |
| | | MoneyCardOperationDto moneyCardOperationDto = new MoneyCardOperationDto(); |
| | | // 是否为赠送 |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_YES)) { |
| | | moneyCardOperationDto.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | | } else { |
| | | moneyCardOperationDto.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | } |
| | | moneyCardOperationDto.setType(MoneyCardUseFlow.USE_TYPE_GM); |
| | | moneyCardOperationDto.setOrderItemId(sysOrderItem.getId()); |
| | | moneyCardOperationDto.setGoodsId(sysOrderItem.getGoodsId()); |
| | | moneyCardOperationDto.setOrderId(sourceOrder.getId()); |
| | | moneyCardOperationDto.setOrderNo(sourceOrder.getOrderNo()); |
| | | moneyCardOperationDto.setVipId(sourceOrder.getVipId()); |
| | | moneyCardOperationDto.setUpdateUser(user.getSuId()); |
| | | |
| | | moneyCardOperationDtos.add(moneyCardOperationDto); |
| | | } |
| | | } |
| | | } |
| | | if (CollUtil.isNotEmpty(moneyCardOperationDtos)) { |
| | | moneyCardUseService.addVipMoneyCard(moneyCardOperationDtos); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 新增出库单并更新本店库存 |
| | | * jyytodo 继续优化 |
| | | * |
| | | * @param order |
| | | */ |
| | | public void addOutStore(SysOrder order) { |
| | | |
| | | BusParameterSettings manageStockSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WAREHOUSE_MANAGE_STOCK, order.getCompanyId()); |
| | | // if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) { |
| | | if (BooleanEnum.TRUE.getValue() == manageStockSetting.getIntParamValue()) { |
| | | |
| | | List<SysOutStoreItem> storeItemList = new ArrayList<>(); |
| | | |
| | | for (SysOrderItem sysOrderItem : order.getItems()) { |
| | | |
| | | if (ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP.equals(sysOrderItem.getType())) { |
| | | |
| | | SysOutStoreItem storeItem = new SysOutStoreItem(); |
| | | storeItem.setSkuId(sysOrderItem.getGoodsId()); |
| | | storeItem.setAmount(Double.valueOf(sysOrderItem.getCount())); |
| | | storeItemList.add(storeItem); |
| | | |
| | | } else if (ShoppingGoods.SHOPPING_GOODS_TYPE_TC.equals(sysOrderItem.getType()) |
| | | |
| | | || ShoppingGoods.SHOPPING_GOODS_TYPE_ZHK.equals(sysOrderItem.getType())) { |
| | | |
| | | List<ShoppingGoodsAssemble> goodsList = new ArrayList<>(); |
| | | |
| | | goodsList.addAll(shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP)); |
| | | |
| | | if (ShoppingGoods.SHOPPING_GOODS_TYPE_ZHK.equals(sysOrderItem.getType())) { |
| | | //综合卡处理,中的套餐,中的家居产品 |
| | | List<ShoppingGoodsAssemble> zhkAssemble = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_TC); |
| | | zhkAssemble.forEach(item -> { |
| | | goodsList.addAll(shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(item.getAssembleGoodId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP)); |
| | | }); |
| | | } |
| | | |
| | | goodsList.forEach(item -> { |
| | | SysOutStoreItem storeItem = new SysOutStoreItem(); |
| | | storeItem.setSkuId(item.getAssembleGoodId()); |
| | | storeItem.setAmount(Double.valueOf(item.getTotal())); |
| | | storeItemList.add(storeItem); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(storeItemList)) { |
| | | Long warehouseId = warehouseDao.findShopWarehouse(order.getShopId()).get(0).getId(); |
| | | SysOutStore outStore = new SysOutStore(); |
| | | outStore.setOutStoreNo(codeService.getOutStoreCode()); |
| | | outStore.setOrderId(order.getId()); |
| | | outStore.setShopId(order.getShopId()); |
| | | outStore.setShopId(order.getShopId()); |
| | | outStore.setStaffId(order.getStaffId()); |
| | | outStore.setType(Dictionary.OUT_STORE_JJCPCK); |
| | | outStore.setServiceNo(order.getOrderNo()); |
| | | outStore.setTime(new Date()); |
| | | outStore.setCheckStatus(Dictionary.CHECK_STATUS_DSH); |
| | | outStore.setCompanyId(order.getCompanyId()); |
| | | sysOutStoreDao.insert(outStore); |
| | | |
| | | //出库明细,根据批次维度定义 |
| | | List<SysOutStoreItem> realOutStoreItemList = new ArrayList<>(); |
| | | |
| | | storeItemList.forEach(outStoreItem -> { |
| | | |
| | | //设置出库主键 |
| | | outStoreItem.setOutStoreId(outStore.getId()); |
| | | |
| | | //计算库存总数是否满足本次扣减的需求 |
| | | List<SysStoreInfo> stores = storeInfoDao.selectStoInfoBySku(outStoreItem.getSkuId(), warehouseId); |
| | | double sum = stores.stream().mapToDouble(item -> item.getStoreTotal()).sum(); |
| | | if (sum < outStoreItem.getAmount()) { |
| | | ShoppingGoods sysGoods = shoppingGoodsDao.selectById(outStoreItem.getSkuId()); |
| | | if (sysGoods != null) { |
| | | throw new GlobleException("出库失败:【" + sysGoods.getName() + "库存不足】"); |
| | | |
| | | } else { |
| | | throw new GlobleException("出库失败没有找到出库产品"); |
| | | } |
| | | } |
| | | |
| | | //循环获取所有批次产品,并扣减库存 |
| | | Double number = outStoreItem.getAmount(); |
| | | for (SysStoreInfo storeInfo : stores) { |
| | | Double oldStoreTotal = storeInfo.getStoreTotal(); |
| | | Double surplus = storeInfo.getStoreTotal() - number; |
| | | //更新库存 |
| | | storeInfo.setStoreTotal(surplus < 0 ? 0 : surplus); |
| | | |
| | | //每次扣减库存都创建一个出库记录 |
| | | SysOutStoreItem sysOutStoreItem = new SysOutStoreItem(); |
| | | BeanUtils.copyProperties(outStoreItem, sysOutStoreItem); |
| | | sysOutStoreItem.setStoreId(storeInfo.getId()); |
| | | sysOutStoreItem.setAmount(oldStoreTotal - storeInfo.getStoreTotal()); |
| | | realOutStoreItemList.add(sysOutStoreItem); |
| | | |
| | | storeInfoDao.update(storeInfo); |
| | | //扣除后剩余库存大于0则跳出扣除,否则剩余数量的负数的绝对值就是再次扣减的数量 |
| | | if (surplus > 0) { |
| | | break; |
| | | } else { |
| | | number = Math.abs(surplus); |
| | | } |
| | | } |
| | | }); |
| | | sysOutStoreItemDao.batchInsert(realOutStoreItemList); |
| | | } |
| | | |
| | | } else { |
| | | LogUtil.debug("不管理库存"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置会员消费积分 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | public void addVipScore(SysOrder pageOrder) { |
| | | |
| | | SysVipInfo vipInfo = sysVipInfoDao.selectById(pageOrder.getVipId()); |
| | | |
| | | List<SysOrderFlow> flows = pageOrder.getFlows(); |
| | | int[] cashScore = {0, 0, 0}; |
| | | //现金支付金额 |
| | | BigDecimal cashPayAmount = flows.stream() |
| | | .filter(item -> (!item.getPayMethod().equals("储值卡")) && (!item.getPayMethod().equals("欠款"))) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BusParameterSettings cashConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.CASH_CONSUMPTION, vipInfo.getCompanyId()); |
| | | if (cashPayAmount != null |
| | | && cashPayAmount.compareTo(BigDecimal.ZERO) > 0 |
| | | && StringUtils.isNotBlank(cashConsumption.getParamValue())) { |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(cashConsumption.getParamValue()); |
| | | if (scoreSetting0.compareTo(BigDecimal.ZERO) > 0) { |
| | | cashScore[0] = cashPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(cashConsumption.getParamValue1())) { |
| | | BigDecimal scoreSetting1 = new BigDecimal(cashConsumption.getParamValue1()); |
| | | if (scoreSetting1.compareTo(BigDecimal.ZERO) > 0) { |
| | | cashScore[1] = cashPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(cashConsumption.getParamValue2())) { |
| | | BigDecimal scoreSetting2 = new BigDecimal(cashConsumption.getParamValue2()); |
| | | if (scoreSetting2.compareTo(BigDecimal.ZERO) > 0) { |
| | | cashScore[2] = cashPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | int[] cardScore = {0, 0, 0}; |
| | | //储值卡本金支付金额 |
| | | BigDecimal cardPayAmount = flows.stream() |
| | | .filter(item -> item.getPayMethod().equals("储值卡") && item.getIsGift().equals("N")) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | BusParameterSettings principalBalanceConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION, vipInfo.getCompanyId()); |
| | | if (cardPayAmount != null |
| | | && cardPayAmount.compareTo(BigDecimal.ZERO) > 0 |
| | | && StringUtils.isNotBlank(principalBalanceConsumption.getParamValue())) { |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(principalBalanceConsumption.getParamValue()); |
| | | if (scoreSetting0.compareTo(BigDecimal.ZERO) > 0) { |
| | | cardScore[0] = cardPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(principalBalanceConsumption.getParamValue1())) { |
| | | BigDecimal scoreSetting1 = new BigDecimal(principalBalanceConsumption.getParamValue1()); |
| | | if (scoreSetting1.compareTo(BigDecimal.ZERO) > 0) { |
| | | cardScore[1] = cardPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(principalBalanceConsumption.getParamValue2())) { |
| | | BigDecimal scoreSetting2 = new BigDecimal(principalBalanceConsumption.getParamValue2()); |
| | | if (scoreSetting2.compareTo(BigDecimal.ZERO) > 0) { |
| | | cardScore[2] = cardPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | int[] giftScore = {0, 0, 0}; |
| | | //储值卡本赠送付金额 |
| | | BigDecimal giftPayAmount = flows.stream() |
| | | .filter(item -> item.getPayMethod().equals("储值卡") && item.getIsGift().equals("Y")) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BusParameterSettings bonusBalanceConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION, vipInfo.getCompanyId()); |
| | | if (giftPayAmount != null |
| | | && giftPayAmount.compareTo(BigDecimal.ZERO) > 0 |
| | | && StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue())) { |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(bonusBalanceConsumption.getParamValue()); |
| | | if (scoreSetting0.compareTo(BigDecimal.ZERO) > 0) { |
| | | giftScore[0] = giftPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue1())) { |
| | | BigDecimal scoreSetting1 = new BigDecimal(bonusBalanceConsumption.getParamValue1()); |
| | | if (scoreSetting1.compareTo(BigDecimal.ZERO) > 0) { |
| | | giftScore[1] = giftPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue2())) { |
| | | BigDecimal scoreSetting2 = new BigDecimal(bonusBalanceConsumption.getParamValue2()); |
| | | if (scoreSetting2.compareTo(BigDecimal.ZERO) > 0) { |
| | | giftScore[2] = giftPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | int selfScore = cashScore[0] + cardScore[0] + giftScore[0]; |
| | | int parentScore = cashScore[1] + cardScore[1] + giftScore[1]; |
| | | int topParentScore = cashScore[2] + cardScore[2] + giftScore[2]; |
| | | |
| | | |
| | | //添加自己的积分 |
| | | if (selfScore > 0) { |
| | | scoreVipDetailService.addScore( |
| | | vipInfo.getId(), |
| | | pageOrder.getStaffId(), |
| | | pageOrder.getShopId(), |
| | | selfScore, |
| | | pageOrder.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "消费奖励" |
| | | ); |
| | | } |
| | | |
| | | if (vipInfo.getRecommendId() != null) { |
| | | //推荐注册老带新积分奖励 |
| | | SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId()); |
| | | if (parentScore > 0) { |
| | | scoreVipDetailService.addScore( |
| | | referrerVip.getId(), |
| | | pageOrder.getStaffId(), |
| | | pageOrder.getShopId(), |
| | | parentScore, |
| | | pageOrder.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "推荐消费奖励" |
| | | ); |
| | | } |
| | | //推荐注册二级带新积分奖励 |
| | | if (referrerVip.getRecommendId() != null) { |
| | | SysVipInfo topVipInfo = sysVipInfoDao.selectById(referrerVip.getRecommendId()); |
| | | if (topParentScore > 0) { |
| | | scoreVipDetailService.addScore( |
| | | topVipInfo.getId(), |
| | | pageOrder.getStaffId(), |
| | | pageOrder.getShopId(), |
| | | topParentScore, |
| | | pageOrder.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "推荐消费奖励" |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建订单信息 |
| | | * |
| | | * @param sysOrder |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysOrder saveOrder(SysOrder sysOrder) { |
| | | |
| | | //校验参数 jyytodo |
| | | |
| | | // 计算订单折扣金额,收款情况下 计算订单总额 |
| | | double zkTotal = 0.0; |
| | | // 页面的pageOrder 参数只包含支付金额信息,不带有购买商品 |
| | | for (SysOrderItem item : sysOrder.getItems()) { |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | item.setType(shoppingGoods.getGoodType()); |
| | | if (item.getZkPrice() == 0) { |
| | | item.setIsFree(Dictionary.FLAG_YES); |
| | | } |
| | | Double itemZkTotal = MoneyUtil.mul(item.getZkPrice(), Double.valueOf(item.getCount())); |
| | | zkTotal = MoneyUtil.add(zkTotal, itemZkTotal); |
| | | item.setStatus(Dictionary.ORDER_STATU_DFK); |
| | | item.setRefundCount(0); |
| | | } |
| | | |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | sysOrder.setZkTotal(zkTotal); |
| | | sysOrder.setStatu(Dictionary.ORDER_STATU_DFK); |
| | | sysOrder.setShopId(user.getShopId()); |
| | | sysOrder.setStaffId(user.getSuId()); |
| | | sysOrder.setCompanyId(user.getCompanyId()); |
| | | sysOrder.setOrderTime(new Date()); |
| | | sysOrder.setOrderType(SysOrder.ORDER_TYPE_SEAL); |
| | | |
| | | |
| | | //新增订单 |
| | | sysOrder.setOrderNo(codeService.getOrderCode()); |
| | | sysOrderDao.insert(sysOrder); |
| | | |
| | | //保存单据明细 |
| | | sysOrder.getItems().forEach(sysOrderItem -> { |
| | | sysOrderItem.setOrderId(sysOrder.getId()); |
| | | orderItemDao.insert(sysOrderItem); |
| | | }); |
| | | |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(sysOrder.getCompanyId(), sysOrder.getShopId(), user.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.CREATE, |
| | | sysOrder.getId(), |
| | | sysOrder.getOrderNo(), |
| | | sysOrder.getVipId()); |
| | | |
| | | return sysOrder; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改订单信息 |
| | | * |
| | | * @param sysOrder |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysOrder modifyOrder(SysOrder sysOrder) { |
| | | // 计算订单折扣金额,收款情况下 计算订单总额 |
| | | double zkTotal = 0.0; |
| | | for (SysOrderItem item : sysOrder.getItems()) { |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | item.setType(shoppingGoods.getGoodType()); |
| | | if (item.getZkPrice() == 0) { |
| | | item.setIsFree(Dictionary.FLAG_YES); |
| | | } |
| | | Double itemZkTotal = MoneyUtil.mul(item.getZkPrice(), Double.valueOf(item.getCount())); |
| | | zkTotal = MoneyUtil.add(zkTotal, itemZkTotal); |
| | | } |
| | | sysOrder.setZkTotal(zkTotal); |
| | | //更新订单 |
| | | sysOrderDao.update(sysOrder); |
| | | //删除原有订单明细 |
| | | orderItemDao.deleteByOrderId(sysOrder.getId()); |
| | | sysOrder.getItems().forEach(sysOrderItem -> { |
| | | sysOrderItem.setOrderId(sysOrder.getId()); |
| | | orderItemDao.insert(sysOrderItem); |
| | | }); |
| | | |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(sysOrder.getCompanyId(), sysOrder.getShopId(), user.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.UPDATE, |
| | | sysOrder.getId(), |
| | | sysOrder.getOrderNo(), |
| | | sysOrder.getVipId()); |
| | | |
| | | return sysOrder; |
| | | } |
| | | |
| | | /** |
| | | * 创建充值订单 |
| | | * @param czVo |
| | | * @return |
| | | */ |
| | | public SysOrder createCzOrder(CzXkVo czVo){ |
| | | |
| | | MoneyCardUse cardUser = moneyCardUseDao.selectVipCard(czVo.getVipId()); |
| | | |
| | | SysOrder order= new SysOrder(); |
| | | order.setFlows(czVo.getFlows()); |
| | | order.setVipId(czVo.getVipId()); |
| | | order.setRemark(cardUser.getCardName()); |
| | | |
| | | SysOrderItem orderItem = new SysOrderItem(); |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectVipCzGoods(); |
| | | orderItem.setGoodsId(shoppingGoods.getId()); |
| | | orderItem.setType(Dictionary.SHOPPING_GOODS_TYPE_CZK); |
| | | orderItem.setCount(1); |
| | | orderItem.setIsFree(Dictionary.FLAG_NO); |
| | | orderItem.setZkPrice(czVo.getBjmoney()); |
| | | orderItem.setAchieveList(czVo.getAchaeveList()); |
| | | order.setItems(Arrays.asList(orderItem)); |
| | | saveOrder(order); |
| | | return order; |
| | | } |
| | | |
| | | /** |
| | | * 创建退款订单 |
| | | * @return |
| | | */ |
| | | public SysOrder createTkOrder(SysOrder sysOrder){ |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | //原订单设置为退款状态 |
| | | SysOrder sourceOrder = new SysOrder(); |
| | | sourceOrder.setId(sysOrder.getOldOrderId()); |
| | | sourceOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_Y); |
| | | sysOrderDao.update(sourceOrder); |
| | | |
| | | sysOrder.setId(null); |
| | | sysOrder.setStaffId(user.getSuId()); |
| | | sysOrder.setCompanyId(user.getCompanyId()); |
| | | sysOrder.setShopId(user.getShopId()); |
| | | sysOrder.setOrderType(SysOrder.ORDER_TYPE_REFUND); |
| | | sysOrder.setStatu(Dictionary.ORDER_STATU_YFK); |
| | | Date now = new Date(); |
| | | sysOrder.setOrderTime(now); |
| | | sysOrder.setPayTime(now); |
| | | sysOrder.setOrderNo(codeService.getRefundOrderNo()); |
| | | sysOrder.setZkTotal(-sysOrder.getZkTotal()); |
| | | |
| | | double cardPayTotal = 0D; |
| | | double cashPayTotal = 0D; |
| | | for (SysOrderFlow flow : sysOrder.getFlows()) { |
| | | // 若使用储值卡付款 |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | cardPayTotal += flow.getAmount().doubleValue(); |
| | | } else { |
| | | cashPayTotal += flow.getAmount().doubleValue(); |
| | | } |
| | | } |
| | | sysOrder.setCardPay(0-( sourceOrder.getCardPay() == null ? 0 : sourceOrder.getCardPay() + cardPayTotal)); |
| | | sysOrder.setCashPay(0-(sourceOrder.getCashPay() == null ? 0 : sourceOrder.getCashPay() + cashPayTotal)); |
| | | |
| | | |
| | | //新增订单 |
| | | sysOrderDao.insert(sysOrder); |
| | | //插入明细 |
| | | for (SysOrderItem item : sysOrder.getItems()) { |
| | | |
| | | //更新原订单明细的可退数量 |
| | | SysOrderItem oldItem = orderItemDao.selectById(item.getId()); |
| | | if((oldItem.getRefundCount()+item.getCount()) <= oldItem.getCount()){ |
| | | oldItem.setRefundCount(oldItem.getRefundCount()+item.getCount()); |
| | | orderItemDao.update(oldItem); |
| | | }else{ |
| | | throw new GlobleException("退款数量大于购买数量"); |
| | | } |
| | | //插入新的订单明细 |
| | | item.setCount(-item.getCount()); |
| | | item.setZkPrice(-item.getZkPrice()); |
| | | item.setOrderId(sysOrder.getId()); |
| | | orderItemDao.insert(item); |
| | | } |
| | | LogUtil.info("创建退款订单:{} " , JSON.toJSONString(sysOrder) ) ; |
| | | return sysOrder; |
| | | } |
| | | |
| | | /** |
| | | * 退款入库 |
| | | */ |
| | | public void refundInstore(@NotEmpty List<SysOrderItem> items) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysSupplierInfo supplierInfo = new SysSupplierInfo(); |
| | | supplierInfo.setShopId(user.getShopId()); |
| | | supplierInfo = sysSupplierInfoDao.selectByModel(supplierInfo).get(0); |
| | | |
| | | Warehouse warehouse = warehouseDao.findShopWarehouse(user.getShopId()).get(0); |
| | | SysInstoreInfo instoreInfo = new SysInstoreInfo(); |
| | | instoreInfo.setInstoreType(SysInstoreInfo.INSTORE_TYPE_RETURN); |
| | | instoreInfo.setInstoreDate(new Date()); |
| | | instoreInfo.setSupplierId(supplierInfo.getId().toString()); |
| | | instoreInfo.setStoreId(warehouse.getId()); |
| | | instoreInfo.setShopId(user.getShopId()); |
| | | instoreInfo.setCompanyId(user.getCompanyId()); |
| | | |
| | | Double total = 0.0; |
| | | List<SysInstoreDetail> instoreDetails = new ArrayList<>(); |
| | | for (SysOrderItem item : items) { |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | SysInstoreDetail sysInstoreDetail = new SysInstoreDetail(); |
| | | sysInstoreDetail.setAmount(item.getCount().doubleValue()); |
| | | sysInstoreDetail.setPrice(item.getZkPrice()); |
| | | sysInstoreDetail.setSkuId(goods.getId()); |
| | | |
| | | total = MoneyUtil.add(MoneyUtil.mul(Double.parseDouble(sysInstoreDetail.getAmount() + ""), sysInstoreDetail.getPrice()), total); |
| | | sysInstoreDetail.setInstoreId(instoreInfo.getId()); |
| | | // 设置小计 |
| | | sysInstoreDetail.setPriceTotal(MoneyUtil.mul(Double.parseDouble(sysInstoreDetail.getAmount() + ""), sysInstoreDetail.getPrice())); |
| | | instoreDetails.add(sysInstoreDetail); |
| | | |
| | | } |
| | | instoreInfo.setInstoreDetails(instoreDetails); |
| | | instoreInfo.setSumall(total); |
| | | |
| | | sysInstoreInfoService.add(instoreInfo); |
| | | //自动审核单据 |
| | | sysInstoreInfoService.check(instoreInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.common.collect.Lists; |
| | | import com.matrix.component.asyncmessage.AsyncMessageManager; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.app.dto.OrderListDto; |
| | | import com.matrix.system.app.mapper.SysProjUseMapper; |
| | | import com.matrix.system.app.vo.OrderDetailAchieveItemVo; |
| | | import com.matrix.system.app.vo.OrderDetailItemVo; |
| | | import com.matrix.system.app.vo.OrderDetailVo; |
| | |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | | import com.matrix.system.common.service.OperationLogService; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.enums.OperationButtonEnum; |
| | | import com.matrix.system.enums.OperationFunctionEnum; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.dto.GoodsSealLimitDto; |
| | | import com.matrix.system.hive.dto.MoneyCardOperationDto; |
| | | import com.matrix.system.hive.dto.ProjUseOperationDto; |
| | | import com.matrix.system.hive.dto.SysOrderItemDto; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.hive.plugin.util.MoneyUtil; |
| | | import com.matrix.system.hive.pojo.CzXkVo; |
| | | import com.matrix.system.hive.pojo.ShoppingCarItem; |
| | | import com.matrix.system.hive.pojo.ShoppingCarItemsVo; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.score.constant.ScoreSettingConstant; |
| | | import com.matrix.system.score.entity.ScoreVipDetail; |
| | | import com.matrix.system.padApi.dto.PadOrderListDto; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailVo; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | | import com.matrix.system.shopXcx.mqTask.AsyncMessageRouting; |
| | | import com.matrix.system.wechart.templateMsg.UniformMsgParam; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Autowired |
| | | private SysOrderItemDao orderItemDao; |
| | | @Autowired |
| | | private SysProjUseDao sysProjUseDao; |
| | | @Autowired |
| | | private SysStoreInfoDao storeInfoDao; |
| | | @Autowired |
| | | private CodeService codeService; |
| | | private SysProjUseService sysProjUseService; |
| | | |
| | | @Autowired |
| | | SysVipInfoDao sysVipInfoDao; |
| | | @Autowired |
| | | SysOutStoreDao sysOutStoreDao; |
| | | SysOutStoreService sysOutStoreService; |
| | | @Autowired |
| | | SysOutStoreItemDao sysOutStoreItemDao; |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private AchieveNewDao achieveNewDao; |
| | | |
| | | @Autowired |
| | | private WarehouseDao warehouseDao; |
| | | |
| | | @Autowired |
| | | private ShoppingGoodsService shoppingGoodsService; |
| | | |
| | | @Autowired |
| | | private SysOrderFlowDao sysOrderFlowDao; |
| | | |
| | | @Autowired |
| | | private SysSupplierInfoDao sysSupplierInfoDao; |
| | | |
| | | @Autowired |
| | | private SysInstoreInfoDao sysInstoreInfoDao; |
| | | |
| | | @Autowired |
| | | private SysInstoreDetailDao sysInstoreDetailDao; |
| | | |
| | | @Autowired |
| | | private SysInstoreInfoService sysInstoreInfoService; |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao parameterSettingsDao; |
| | |
| | | |
| | | @Autowired |
| | | private OperationLogService operationLogService; |
| | | |
| | | @Autowired |
| | | private SysVipInfoService sysVipInfoService; |
| | | |
| | | @Autowired |
| | | private SysOrderServiceHelper sysOrderServiceHelper; |
| | | |
| | | |
| | | @Autowired |
| | | MoneyCardUseService moneyCardUseService; |
| | | |
| | | |
| | | //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓业务代码区↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysOrder checkAndSaveOrder(SysOrder sysOrder) { |
| | | |
| | | if (Objects.isNull(sysOrder.getId())) { |
| | | LogUtil.info("新增正向订单"); |
| | | return sysOrderServiceHelper.saveOrder(sysOrder); |
| | | } else { |
| | | LogUtil.info("修改订单"); |
| | | return sysOrderServiceHelper.modifyOrder(sysOrder); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 取消订单 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void cancelOrder(Long id) { |
| | | |
| | | SysOrder order = sysOrderDao.selectById(id); |
| | | |
| | | if (order.getStatu().equals(Dictionary.ORDER_STATU_DFK)) { |
| | | //待付款订单取消 |
| | | cancelDFKOrder(order); |
| | | } else { |
| | | //已付款订单取消 |
| | | cancelYFKOrder(order); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 已付款订单取消 |
| | | * |
| | | * @param order |
| | | */ |
| | | private void cancelYFKOrder(SysOrder order) { |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | //一个订单只能被取消一次 |
| | | if (Dictionary.ORDER_STATU_YQX.equals(order.getStatu())) { |
| | | throw new GlobleException("订单已取消"); |
| | | } |
| | | |
| | | //储值卡退款 |
| | | sysOrderServiceHelper.returnMoneyCardPay(order); |
| | | |
| | | //套餐项目取消 |
| | | List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(order.getId()); |
| | | for (SysOrderItem orderItem : sysOrderItems) { |
| | | // 充值卡类型退款 |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_CZK.equals(orderItem.getType())) { |
| | | //删除购买的充值卡 |
| | | moneyCardUseService.deleteByOrderItemId(orderItem.getId()); |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(orderItem.getType()) |
| | | || Dictionary.SHOPPING_GOODS_TYPE_TC.equals(orderItem.getType())) { |
| | | // 项目套餐退款 |
| | | // 删除套餐项目使用情况 |
| | | sysProjUseService.deleteByOrderItemId(orderItem.getId()); |
| | | } |
| | | } |
| | | |
| | | //删除出库单,恢复库存 |
| | | SysOutStore sysOutStore = new SysOutStore(); |
| | | sysOutStore.setOrderId(order.getId()); |
| | | List<SysOutStore> sysOutStores = sysOutStoreService.findByModel(sysOutStore); |
| | | if (sysOutStores.size() == 1) { |
| | | sysOutStore = sysOutStores.get(0); |
| | | sysOutStoreService.cancelOutStore(sysOutStore.getId()); |
| | | } |
| | | |
| | | // 删除业绩 |
| | | achieveNewService.removeByOrderId(order.getId()); |
| | | |
| | | // 删除收款记录 |
| | | sysOrderFlowDao.deleteByOrderId(order.getId()); |
| | | |
| | | //删除积分 |
| | | scoreVipDetailService.removeByBusinessId(order.getVipId(), order.getId()); |
| | | |
| | | // 取消订单 |
| | | order.setStatu(Dictionary.ORDER_STATU_YQX); |
| | | sysOrderDao.update(order); |
| | | |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(order.getCompanyId(), order.getShopId(), sysUsers.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.CANCEL, |
| | | order.getId(), |
| | | order.getOrderNo(), |
| | | order.getVipId(), |
| | | "已付款取消订单"); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 待付款订单取消 |
| | | * |
| | | * @param order |
| | | */ |
| | | private void cancelDFKOrder(SysOrder order) { |
| | | |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | order.setStatu(Dictionary.ORDER_STATU_YQX); |
| | | order.setArrears(0D); |
| | | |
| | | //发送微信公众号提醒 |
| | | UniformMsgParam uniformMsgParam = new UniformMsgParam(order.getCompanyId(), UniformMsgParam.GZH_DDQX); |
| | | uniformMsgParam.put("orderId", order.getId()); |
| | | asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG, uniformMsgParam); |
| | | |
| | | sysOrderDao.update(order); |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(order.getCompanyId(), order.getShopId(), sysUsers.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.CANCEL, |
| | | order.getId(), |
| | | order.getOrderNo(), |
| | | order.getVipId(), |
| | | "未付款取消订单"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * jyy 收款 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void payOrder(SysOrder pageOrder) throws GlobleException { |
| | | |
| | | //校验订单是否满足收款条件 |
| | | checkOrderAblePay(pageOrder); |
| | | |
| | | // 更新订单主表信息 |
| | | payEndUpdateOrderInfo(pageOrder); |
| | | |
| | | //添加支付流水 |
| | | sysOrderServiceHelper.addOrderFlow(pageOrder, false); |
| | | |
| | | //扣除储值卡余额 |
| | | sysOrderServiceHelper.cardPaySk(pageOrder); |
| | | |
| | | // 设置会员充值卡使用情况 |
| | | sysOrderServiceHelper.addMoneyCardUse(pageOrder); |
| | | // 改变客户项目套餐使用情况 |
| | | sysOrderServiceHelper.addTaocanProj(pageOrder); |
| | | |
| | | // 新增出库单 |
| | | sysOrderServiceHelper.addOutStore(pageOrder); |
| | | |
| | | // 设置业绩 |
| | | achieveNewService.addAchaeveByOrder(pageOrder); |
| | | |
| | | //设置会员积分 |
| | | sysOrderServiceHelper.addVipScore(pageOrder); |
| | | |
| | | //保存订单收款日志 |
| | | saveOrderSkLog(pageOrder); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存订单收款日志 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | private void saveOrderSkLog(SysOrder pageOrder) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | operationLogService.saveOperation(pageOrder.getCompanyId(), pageOrder.getShopId(), user.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.ORDER_SK, |
| | | pageOrder.getId(), |
| | | pageOrder.getOrderNo(), |
| | | pageOrder.getVipId()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 付款后更新订单信息 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | private void payEndUpdateOrderInfo(SysOrder pageOrder) { |
| | | LogUtil.info("付款更新订单信息 id={}", pageOrder.getId()); |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | pageOrder.setCashierId(user.getSuId()); |
| | | |
| | | pageOrder.setPayTime(new Date()); |
| | | |
| | | pageOrder.setStatu(Dictionary.ORDER_STATU_YFK); |
| | | List<SysOrderFlow> flows = pageOrder.getFlows(); |
| | | |
| | | BigDecimal cashPayAmount = flows.stream() |
| | | .filter(item -> (!item.getPayMethod().equals("储值卡")) && (!item.getPayMethod().equals("欠款"))) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | BigDecimal cardPayAmount = flows.stream() |
| | | .filter(item -> item.getPayMethod().equals("储值卡")) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | pageOrder.setCardPay(cardPayAmount.doubleValue()); |
| | | pageOrder.setCashPay(cashPayAmount.doubleValue()); |
| | | |
| | | for (SysOrderFlow flow : pageOrder.getFlows()) { |
| | | //欠款处理 |
| | | if (SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod())) { |
| | | pageOrder.setStatu(Dictionary.ORDER_STATU_QK); |
| | | pageOrder.setArrears(flow.getAmount().doubleValue()); |
| | | } |
| | | } |
| | | |
| | | double sum = flows.stream().mapToDouble(item -> item.getAmount().doubleValue()).sum(); |
| | | |
| | | if (sum > 0 && cardPayAmount.doubleValue() == 0 && cashPayAmount.doubleValue() == 0) { |
| | | throw new GlobleException("订单更新失败,支付金额计算错误,请联系管理员"); |
| | | } |
| | | |
| | | |
| | | sysOrderDao.update(pageOrder); |
| | | // 设置用户为成交客户 |
| | | sysVipInfoService.updateDealStatus(pageOrder.getVipId(), BooleanEnum.TRUE.getValue()); |
| | | } |
| | | |
| | | /** |
| | | * 检查订单是否满足支付条件 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | private void checkOrderAblePay(SysOrder pageOrder) { |
| | | |
| | | SysOrder checkOrder = sysOrderDao.selectById(pageOrder.getId()); |
| | | |
| | | //状态校验 |
| | | if (!Dictionary.ORDER_STATU_DFK.equals(checkOrder.getStatu())) { |
| | | throw new GlobleException("该订单已经收过款,请刷新页面再试!"); |
| | | } |
| | | |
| | | //检查交易限制调整 |
| | | GoodsSealLimitDto goodsSealLimitDto = new GoodsSealLimitDto(); |
| | | goodsSealLimitDto.setVipId(pageOrder.getVipId()); |
| | | goodsSealLimitDto.setSysOrderItemDtoList(Lists.newArrayList()); |
| | | pageOrder.getItems().forEach(e -> { |
| | | goodsSealLimitDto.getSysOrderItemDtoList().add(BeanUtil.copyProperties(e, SysOrderItemDto.class)); |
| | | }); |
| | | shoppingGoodsService.checkGoodsSealLimit(goodsSealLimitDto); |
| | | |
| | | //检查业绩设置 |
| | | checkOrderAchieve(pageOrder); |
| | | |
| | | LogUtil.info("订单满足支付条件 id={}", pageOrder.getId()); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检查业绩设置是否合理 |
| | | * 1、每个订单明细都要有至少一个对应的业绩 |
| | | * 2、每个订单明细的同类型业绩金额之和不能大于明细支付金额 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | private void checkOrderAchieve(SysOrder pageOrder) { |
| | | |
| | | pageOrder.getItems().forEach(item -> { |
| | | |
| | | if (CollectionUtil.isEmpty(item.getAchieveList())) { |
| | | ShoppingGoods shopGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | throw GlobleException.instance(shopGoods.getName() + "缺少设置业绩"); |
| | | } |
| | | |
| | | //按业绩类型分组后比较支付金额与业绩金额是否相等 |
| | | Map<String, List<AchieveNew>> achieveTypeMap = item.getAchieveList().stream().collect(Collectors.groupingBy(AchieveNew::getAchieveType)); |
| | | Set<Map.Entry<String, List<AchieveNew>>> entries = achieveTypeMap.entrySet(); |
| | | entries.forEach(entrie -> { |
| | | double sum = entrie.getValue().stream().mapToDouble(AchieveNew::getGoodsCash).sum(); |
| | | //todo 目前使用js计算金额可能存在精度的误差展示用0.1屏蔽 |
| | | if (Math.abs(sum - (item.getZkPrice() * item.getCount())) > 0.1) { |
| | | ShoppingGoods shopGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | throw GlobleException.instance(shopGoods.getName() + "," + entrie.getKey() + "业绩金额与收款金额不一致"); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 补交 |
| | | * |
| | | * @author:姜友瑶 |
| | | * @date 2016年9月19日 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void updateAfterMoney(SysOrder pageOrder) { |
| | | SysOrder sourceOrder = sysOrderDao.selectById(pageOrder.getId()); |
| | | |
| | | //添加支付流水 |
| | | sysOrderServiceHelper.addOrderFlow(pageOrder, true); |
| | | |
| | | //扣除储值卡余额 |
| | | sysOrderServiceHelper.cardPaySk(pageOrder); |
| | | |
| | | |
| | | double refundTotal = 0D; |
| | | double cardPayTotal = 0D; |
| | | double cashPayTotal = 0D; |
| | | for (SysOrderFlow flow : pageOrder.getFlows()) { |
| | | // 若使用储值卡付款 |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | cardPayTotal += flow.getAmount().doubleValue(); |
| | | } else { |
| | | cashPayTotal += flow.getAmount().doubleValue(); |
| | | } |
| | | refundTotal += flow.getAmount().doubleValue(); |
| | | } |
| | | |
| | | if (refundTotal == pageOrder.getArrears()) { |
| | | sourceOrder.setStatu(Dictionary.ORDER_STATU_YFK); |
| | | } else { |
| | | sourceOrder.setStatu(Dictionary.ORDER_STATU_QK); |
| | | } |
| | | sourceOrder.setArrears(sourceOrder.getArrears() - refundTotal); |
| | | sourceOrder.setCardPay(sourceOrder.getCardPay() == null ? 0 : sourceOrder.getCardPay() + cardPayTotal); |
| | | sourceOrder.setCashPay(sourceOrder.getCashPay() == null ? 0 : sourceOrder.getCashPay() + cashPayTotal); |
| | | sysOrderDao.update(sourceOrder); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 会员卡充值 |
| | | * |
| | | * @param czVo |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysOrder moneyCardCz(CzXkVo czVo) { |
| | | |
| | | // 新增一个充值订单 |
| | | SysOrder order = sysOrderServiceHelper.createCzOrder(czVo); |
| | | |
| | | //新增会员卡金额 |
| | | MoneyCardUse cardUser = moneyCardUseDao.selectVipCard(czVo.getVipId()); |
| | | MoneyCardOperationDto moneyCardOperationDto = new MoneyCardOperationDto(); |
| | | moneyCardOperationDto.setRealMoney(czVo.getBjmoney()); |
| | | moneyCardOperationDto.setGiftMoney(czVo.getGiftMoney()); |
| | | moneyCardOperationDto.setCarUseId(cardUser.getId()); |
| | | moneyCardOperationDto.setOrderId(order.getId()); |
| | | moneyCardOperationDto.setOrderNo(order.getOrderNo()); |
| | | moneyCardOperationDto.setType(MoneyCardUseFlow.USE_TYPE_CZ); |
| | | |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | moneyCardOperationDto.setUpdateUser(user.getSuId()); |
| | | moneyCardUseService.changeMoneyCard(Arrays.asList(moneyCardOperationDto)); |
| | | |
| | | // 更新订单主表信息 |
| | | payEndUpdateOrderInfo(order); |
| | | |
| | | //添加支付流水 |
| | | sysOrderServiceHelper.addOrderFlow(order, false); |
| | | |
| | | // 设置业绩 |
| | | achieveNewService.addAchaeveByOrder(order); |
| | | |
| | | //设置会员积分 |
| | | sysOrderServiceHelper.addVipScore(order); |
| | | |
| | | return order; |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public SysOrder findSysOrderTjByVipId(Long vipId) { |
| | | return sysOrderDao.selectVipOrderInfoTotal(vipId); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderDetailVo> findApiOrderListInPage(OrderListDto orderListDto, PaginationVO pageVo) { |
| | | return sysOrderDao.selectApiOrderListInPage(orderListDto, pageVo); |
| | | } |
| | | |
| | | @Override |
| | | public List<PadOrderDetailVo> findPadApiOrderListInPage(PadOrderListDto orderListDto, PaginationVO pageVo) { |
| | | List<PadOrderDetailVo> padOrderDetailVos = sysOrderDao.selectPadApiOrderListInPage(orderListDto, pageVo); |
| | | if(CollUtil.isNotEmpty(padOrderDetailVos)){ |
| | | for(PadOrderDetailVo padOrderDetailVo : padOrderDetailVos){ |
| | | padOrderDetailVo.setItems(orderItemDao.selectApiOrderDetailItemsByOrderId(Long.parseLong(padOrderDetailVo.getOrderId()))); |
| | | } |
| | | } |
| | | |
| | | return padOrderDetailVos; |
| | | } |
| | | |
| | | @Override |
| | | public int findApiOrderListTotal(OrderListDto orderListDto) { |
| | | return sysOrderDao.selectApiOrderListTotal(orderListDto); |
| | | } |
| | | |
| | | @Override |
| | | public int findPadApiOrderListTotal(PadOrderListDto orderListDto) { |
| | | return sysOrderDao.selectPadApiOrderListTotal(orderListDto); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetailVo findApiOrderDetailByOrderId(Long orderId) { |
| | | OrderDetailVo orderDetail = sysOrderDao.selectApiOrderDetailById(orderId); |
| | | |
| | | if (orderDetail == null) { |
| | | throw new GlobleException("该订单不存在"); |
| | | } |
| | | |
| | | List<OrderDetailItemVo> items = orderItemDao.selectApiOrderDetailItemsByOrderId(orderId); |
| | | if (CollectionUtils.isNotEmpty(items)) { |
| | | for (OrderDetailItemVo item : items) { |
| | | List<OrderDetailAchieveItemVo> achieveItems = achieveNewDao.selectApiOrderItemAchieve(item.getId()); |
| | | item.setAchieves(achieveItems); |
| | | } |
| | | } |
| | | |
| | | orderDetail.setItems(items); |
| | | return orderDetail; |
| | | } |
| | | |
| | | @Override |
| | | public List<RankingVo> findApiShopAchieveRanking(SysOrder sysOrder) { |
| | | return sysOrderDao.selectShopAchieveRanking(sysOrder); |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void orderTk(SysOrder sysOrder) { |
| | | |
| | | //创建并保存退款订单 |
| | | sysOrder = sysOrderServiceHelper.createTkOrder(sysOrder); |
| | | // 添加订单收款流水 |
| | | sysOrderServiceHelper.addOrderFlow(sysOrder, false); |
| | | //退款退套餐退项目 |
| | | refundProjUse(sysOrder); |
| | | //删除积分 |
| | | SysOrder oldOrder = sysOrderDao.selectById(sysOrder.getOldOrderId()); |
| | | scoreVipDetailService.removeByBusinessId(oldOrder.getVipId(), oldOrder.getId()); |
| | | |
| | | // 设置业绩 |
| | | achieveNewService.addAchaeveByOrder(sysOrder); |
| | | |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(sysOrder.getCompanyId(), sysOrder.getShopId(), user.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.ORDER_TK, |
| | | sysOrder.getId(), |
| | | sysOrder.getOrderNo(), |
| | | sysOrder.getVipId()); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 退款退项目,套餐,卡项 |
| | | * |
| | | * @param sysOrder |
| | | */ |
| | | private void refundProjUse(SysOrder sysOrder) { |
| | | |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | //记录需要退库存的产品 |
| | | List<SysOrderItem> returnGoodsList = new ArrayList<>(); |
| | | //需要退的套餐和项目 |
| | | List<ProjUseOperationDto> projUseDtoList = Lists.newArrayList(); |
| | | //需要退的储值卡 |
| | | List<MoneyCardOperationDto> moneyCardOperationDtos = Lists.newArrayList(); |
| | | |
| | | for (SysOrderItem item : sysOrder.getItems()) { |
| | | |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(item.getType()) && Dictionary.FLAG_YES_Y.equals(item.getIsReturnStore())) { |
| | | |
| | | returnGoodsList.add(item); |
| | | |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(item.getType()) |
| | | || Dictionary.SHOPPING_GOODS_TYPE_XM.equals(item.getType())) { |
| | | ProjUseOperationDto dto = new ProjUseOperationDto(); |
| | | dto.setGoodsId(item.getGoodsId()); |
| | | dto.setCount(item.getRefundCount()); |
| | | dto.setOrderItemId(item.getOldItemId()); |
| | | dto.setUpdateUserId(user.getSuId()); |
| | | projUseDtoList.add(dto); |
| | | |
| | | }else if (Dictionary.SHOPPING_GOODS_TYPE_CZK.equals(item.getType())) { |
| | | MoneyCardOperationDto moneyCardOperationDto = new MoneyCardOperationDto(); |
| | | moneyCardOperationDto.setOrderId(sysOrder.getId()); |
| | | moneyCardOperationDto.setOrderNo(sysOrder.getOrderNo()); |
| | | moneyCardOperationDto.setOrderItemId(item.getOldItemId()); |
| | | moneyCardOperationDto.setType(MoneyCardUseFlow.USE_TYPE_ORDRE_TK); |
| | | moneyCardOperationDto.setUpdateUser(user.getSuId()); |
| | | moneyCardOperationDto.setOrderNo(sysOrder.getOrderNo()); |
| | | moneyCardOperationDto.setRealMoney(item.getZkPrice()); |
| | | moneyCardOperationDtos.add(moneyCardOperationDto); |
| | | } |
| | | } |
| | | |
| | | BusParameterSettings manageStockSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WAREHOUSE_MANAGE_STOCK, sysOrder.getCompanyId()); |
| | | // if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) { |
| | | if (BooleanEnum.TRUE.getValue() == manageStockSetting.getIntParamValue()) { |
| | | // 家居产品退库存 |
| | | if (CollectionUtils.isNotEmpty(returnGoodsList)) { |
| | | LogUtil.info("订单退款:退产品库存:{}", JSON.toJSONString(returnGoodsList)); |
| | | sysOrderServiceHelper.refundInstore(returnGoodsList); |
| | | } |
| | | } |
| | | |
| | | if(CollUtil.isNotEmpty(projUseDtoList)){ |
| | | LogUtil.info("订单退款:退套餐项目:{}", JSON.toJSONString(projUseDtoList)); |
| | | sysProjUseService.projectTk(projUseDtoList); |
| | | } |
| | | |
| | | if(CollUtil.isNotEmpty(moneyCardOperationDtos)){ |
| | | LogUtil.info("订单退款:储值卡:{}", JSON.toJSONString(moneyCardOperationDtos)); |
| | | moneyCardUseService.moneyCardTk(moneyCardOperationDtos); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public BigDecimal findVipArrearsByVipId(Long vipId) { |
| | | return sysOrderDao.selectArrearsByVipId(vipId); |
| | | } |
| | | |
| | | |
| | | //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓===增删改查代码区↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ |
| | | |
| | | |
| | | @Override |
| | |
| | | public SysOrder findById(Long id) { |
| | | return sysOrderDao.selectById(id); |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysOrder checkAndSaveOrder(SysOrder sysOrder) { |
| | | |
| | | // 计算订单折扣金额,收款情况下 计算订单总额 |
| | | double zkTotal = 0.0; |
| | | |
| | | // 判断是否为退款 |
| | | String orderStatus = Dictionary.ORDER_STATU_DFK; |
| | | if (Dictionary.ORDER_STATU_TK.equals(sysOrder.getStatu())) { |
| | | orderStatus = Dictionary.ORDER_STATU_TK; |
| | | } |
| | | |
| | | // 页面的pageOrder 参数只包含支付金额信息,不带有购买商品 |
| | | for (SysOrderItem item : sysOrder.getItems()) { |
| | | // 若为退款,则先更新原有数量 |
| | | if (orderStatus.equals(Dictionary.ORDER_STATU_TK)) { |
| | | SysOrderItem sysOrderItem = new SysOrderItem(); |
| | | sysOrderItem.setId(item.getId()); |
| | | sysOrderItem.setCount(item.getPreCount() - item.getCount()); |
| | | orderItemDao.update(sysOrderItem); |
| | | } |
| | | item.setId(null); |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | item.setType(shoppingGoods.getGoodType()); |
| | | if (item.getZkPrice() == 0) { |
| | | item.setIsFree(Dictionary.FLAG_YES); |
| | | } |
| | | |
| | | // 订单欠款减去支付金额 设置实际欠款 |
| | | Double itemZkTotal = MoneyUtil.mul(item.getZkPrice(), Double.valueOf(item.getCount())); |
| | | zkTotal = MoneyUtil.add(zkTotal, itemZkTotal); |
| | | item.setStatus(orderStatus); |
| | | } |
| | | |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | sysOrder.setZkTotal(zkTotal); |
| | | sysOrder.setStatu(orderStatus); |
| | | SysOrder source = null; |
| | | if (sysOrder.getId() != null) { |
| | | source = sysOrderDao.selectById(sysOrder.getId()); |
| | | } |
| | | sysOrder.setStaffId(source != null ? source.getStaffId() : user.getSuId()); |
| | | sysOrder.setCompanyId(source != null ? source.getCompanyId() : user.getCompanyId()); |
| | | |
| | | |
| | | if (sysOrder.getId() == null) { |
| | | //新增订单 |
| | | sysOrder.setOrderNo(codeService.getOrderCode()); |
| | | sysOrderDao.insert(sysOrder); |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(sysOrder.getCompanyId(), sysOrder.getShopId(), user.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.CREATE, |
| | | sysOrder.getId(), |
| | | sysOrder.getOrderNo(), |
| | | sysOrder.getVipId()); |
| | | |
| | | } else { |
| | | //更新订单 |
| | | sysOrderDao.update(sysOrder); |
| | | //删除原有订单明细 |
| | | orderItemDao.deleteByOrderId(sysOrder.getId()); |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(sysOrder.getCompanyId(), sysOrder.getShopId(), user.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.UPDATE, |
| | | sysOrder.getId(), |
| | | sysOrder.getOrderNo(), |
| | | sysOrder.getVipId(), |
| | | "修改订单内容"); |
| | | } |
| | | |
| | | sysOrder.getItems().forEach(sysOrderItem -> { |
| | | sysOrderItem.setOrderId(sysOrder.getId()); |
| | | if (sysOrder.getStatu().equals(Dictionary.ORDER_STATU_TK)) { |
| | | // 取负数 |
| | | sysOrderItem.setCount(-sysOrderItem.getCount()); |
| | | orderItemDao.insert(sysOrderItem); |
| | | // 调整回来 |
| | | sysOrderItem.setCount(-sysOrderItem.getCount()); |
| | | } else { |
| | | orderItemDao.insert(sysOrderItem); |
| | | } |
| | | |
| | | }); |
| | | |
| | | return sysOrder; |
| | | } |
| | | |
| | | /** |
| | | * 取消订单 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void cancelOrder(Long id) { |
| | | |
| | | SysOrder order = sysOrderDao.selectById(id); |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | if (order.getStatu().equals(Dictionary.ORDER_STATU_DFK)) { |
| | | |
| | | order.setStatu(Dictionary.ORDER_STATU_YQX); |
| | | order.setArrears(0D); |
| | | |
| | | //发送微信公众号提醒 |
| | | UniformMsgParam uniformMsgParam = new UniformMsgParam(order.getCompanyId(), UniformMsgParam.GZH_DDQX); |
| | | uniformMsgParam.put("orderId", order.getId()); |
| | | asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG, uniformMsgParam); |
| | | |
| | | sysOrderDao.update(order); |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(order.getCompanyId(), order.getShopId(),sysUsers.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.CANCEL, |
| | | order.getId(), |
| | | order.getOrderNo(), |
| | | order.getVipId(), |
| | | "未付款取消订单"); |
| | | } else { |
| | | |
| | | //一个订单只能被取消一次 |
| | | if (Dictionary.ORDER_STATU_YQX.equals(order.getStatu())) { |
| | | throw new GlobleException("订单已取消"); |
| | | } |
| | | |
| | | List<SysOrderFlow> flows = sysOrderFlowDao.selectByOrderId(id); |
| | | // 非现金收款退回扣卡余额 |
| | | for (SysOrderFlow flow : flows) { |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); |
| | | MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); |
| | | |
| | | if (moneyCardUse != null) { |
| | | // 根据订单明细判断是赠送金额购买还是本金购买 |
| | | moneyCardUseFlow.setTotal(flow.getAmount().doubleValue()); |
| | | if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { |
| | | moneyCardUse.setGiftMoney(MoneyUtil.add(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue())); |
| | | } else { |
| | | moneyCardUse.setRealMoney(MoneyUtil.add(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue())); |
| | | } |
| | | |
| | | if (!moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y)) { |
| | | if (moneyCardUse.getLastCount() != null) { |
| | | moneyCardUse.setLastCount(moneyCardUse.getLastCount() + 1); |
| | | moneyCardUseFlow.setTimes(1); |
| | | } |
| | | } |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | //插入充值卡变动流水 |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | moneyCardUseFlow.setOrderNo(order.getOrderNo()); |
| | | moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); |
| | | moneyCardUseFlow.setVipId(order.getVipId()); |
| | | moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_ORDRE_CANCEL); |
| | | moneyCardUseFlow.setCreateTime(new Date()); |
| | | moneyCardUseFlow.setOperationId(user.getSuId()); |
| | | moneyCardUseFlow.setContent(moneyCardUse.getChangeRemark()); |
| | | moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney()); |
| | | moneyCardUseFlowDao.insert(moneyCardUseFlow); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(id); |
| | | for (SysOrderItem orderItem : sysOrderItems) { |
| | | // 充值卡类型退款 |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_CZK.equals(orderItem.getType())) { |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(orderItem.getGoodsId()); |
| | | //删除购买的充值卡 |
| | | moneyCardUseDao.deleteByOrderItemId(orderItem.getId()); |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(orderItem.getType()) |
| | | || Dictionary.SHOPPING_GOODS_TYPE_TC.equals(orderItem.getType())) { |
| | | // 项目套餐退款 |
| | | // 删除套餐项目使用情况 |
| | | sysProjUseDao.deleteByOrderItemId(orderItem.getId()); |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_ZHK.equals(orderItem.getType())) { |
| | | // 综合卡 |
| | | // 删除套餐项目使用情况 |
| | | sysProjUseDao.deleteByOrderItemId(orderItem.getId()); |
| | | // 删除充值卡 |
| | | moneyCardUseDao.deleteByOrderItemId(orderItem.getId()); |
| | | } |
| | | } |
| | | |
| | | //删除出库单,恢复库存 |
| | | SysOutStore sysOutStore = new SysOutStore(); |
| | | sysOutStore.setOrderId(order.getId()); |
| | | List<SysOutStore> sysOutStores = sysOutStoreDao.selectByModel(sysOutStore); |
| | | if (sysOutStores.size() == 1) { |
| | | sysOutStore = sysOutStores.get(0); |
| | | List<SysOutStoreItem> outStoreItemList = sysOutStoreItemDao.selectByOrderId(sysOutStore.getId()); |
| | | for (SysOutStoreItem item : outStoreItemList) { |
| | | SysStoreInfo sysStoreInfo = storeInfoDao.selectById(item.getStoreId()); |
| | | sysStoreInfo.setStoreTotal(sysStoreInfo.getStoreTotal() + item.getAmount()); |
| | | //更新库存 |
| | | storeInfoDao.update(sysStoreInfo); |
| | | } |
| | | sysOutStoreDao.deleteById(sysOutStore.getId()); |
| | | sysOutStoreItemDao.deleteByOrderId(sysOutStore.getId()); |
| | | } |
| | | // 删除业绩 |
| | | AchieveNew achieveNew = new AchieveNew(); |
| | | achieveNew.setOrderId(id); |
| | | achieveNewService.removeByModel(achieveNew); |
| | | |
| | | // 删除收款记录 |
| | | sysOrderFlowDao.deleteByOrderId(id); |
| | | |
| | | //删除积分 |
| | | scoreVipDetailService.removeByBusinessId(order.getVipId(), order.getId()); |
| | | |
| | | // 取消订单 |
| | | order.setStatu(Dictionary.ORDER_STATU_YQX); |
| | | sysOrderDao.update(order); |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(order.getCompanyId(), order.getShopId(),sysUsers.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.CANCEL, |
| | | order.getId(), |
| | | order.getOrderNo(), |
| | | order.getVipId(), |
| | | "已付款取消订单"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建订单 lk |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int createOrder(HttpSession session, ShoppingCarItemsVo car) { |
| | | |
| | | if (car.getCarItems().size() < 1) { |
| | | throw new GlobleException("没用选择购买产品"); |
| | | } |
| | | // 获取会员信息,判断等级 获取相应家居折扣 |
| | | SysVipInfo info = sysVipInfoDao.selectById(car.getVipId()); |
| | | |
| | | //获取折扣----- |
| | | Double zk = zk = 1.0; |
| | | |
| | | SysOrder order = new SysOrder(); |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | order.setShopId(user.getShopId()); |
| | | order.setOrderNo(codeService.getOrderCode()); |
| | | order.setVipId(info.getId()); |
| | | order.setOrderTime(new Date()); |
| | | order.setRemark(car.getRemark()); |
| | | order.setStaffId(user.getSuId()); |
| | | order.setIsCross(2 + ""); |
| | | order.setChangeId(car.getChangeId()); |
| | | order.setStatu(Dictionary.ORDER_STATU_DFK); |
| | | order.setCardPay(0.00); |
| | | order.setCashPay(0.00); |
| | | order.setCompanyId(user.getCompanyId()); |
| | | order.setBeatuyId(car.getBeatuyId() + ""); |
| | | // 根据美疗师id查询美疗师姓名 |
| | | if (car.getBeatuyId() != null) { |
| | | String beatuyName = shopStaffInfoDao.selectById(car.getBeatuyId()).getSuName(); |
| | | System.out.println("美疗师:" + beatuyName); |
| | | order.setBeatuyName(beatuyName); |
| | | } |
| | | int i = sysOrderDao.insert(order); |
| | | // 创建订单明细,并计算总价与折扣总价 |
| | | // 总价 |
| | | double total = 0; |
| | | double zkTotal = 0; |
| | | int count = 0; |
| | | // 设置订单条目 |
| | | for (ShoppingCarItem carItem : car.getCarItems()) { |
| | | |
| | | SysOrderItem orderItem = new SysOrderItem(); |
| | | orderItem.setOrderId(order.getId()); |
| | | orderItem.setCount(carItem.getCount()); |
| | | orderItem.setIsFree(carItem.getIsFree()); |
| | | orderItem.setType(carItem.getType()); |
| | | orderItem.setStatus(Dictionary.ORDER_STATU_DFK); |
| | | // 新增明细 |
| | | // 设置商品id |
| | | orderItem.setGoodsId(carItem.getGoodsId()); |
| | | // 设置assembleId |
| | | orderItem.setAssembleId(carItem.getAssembleId()); |
| | | // 如果是家居产品的话,要取出组合sku中的价格 |
| | | double p = carItem.getShoppingGoods().getSealPice(); |
| | | orderItem.setPrice(p); |
| | | if (carItem.getIsFree().equals(Dictionary.FLAG_NO)) { |
| | | orderItem.setZkPrice(MoneyUtil.mul(p, zk)); |
| | | } else { |
| | | // 如果是免费,则设置为0.0 |
| | | orderItem.setZkPrice(0.0); |
| | | } |
| | | |
| | | |
| | | orderItemDao.insert(orderItem); |
| | | total = MoneyUtil.add(total, |
| | | MoneyUtil.mul(orderItem.getPrice(), Double.parseDouble(carItem.getCount() + ""))); |
| | | zkTotal = MoneyUtil.add(zkTotal, |
| | | MoneyUtil.mul(orderItem.getZkPrice(), Double.parseDouble(carItem.getCount() + ""))); |
| | | } |
| | | |
| | | // 设置订单总价与折后价 |
| | | order.setTotal(total); |
| | | order.setZkTotal(zkTotal); |
| | | sysOrderDao.update(order); |
| | | return i; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * jyy 收款 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateReceiptMoney(SysOrder pageOrder) throws GlobleException { |
| | | |
| | | if (!Dictionary.ORDER_STATU_DFK.equals(pageOrder.getStatu())) { |
| | | throw new GlobleException("该订单已经收过款,请刷新页面再试!"); |
| | | } |
| | | |
| | | |
| | | checkOrder(pageOrder); |
| | | |
| | | |
| | | // 更新收款时间 |
| | | updateOrderInfo(pageOrder); |
| | | |
| | | // 获取用户信息 |
| | | SysVipInfo vipInfo = sysVipInfoDao.selectById(pageOrder.getVipId()); |
| | | if (SysVipInfo.UNDEAL_VIP == vipInfo.getIsDeal()) { |
| | | //非成交客户下单更新客户为成交客户 |
| | | vipInfo.setIsDeal(SysVipInfo.DEAL_VIP); |
| | | sysVipInfoDao.update(vipInfo); |
| | | } |
| | | |
| | | //添加支付流水 |
| | | addOrderFlow(pageOrder); |
| | | |
| | | // 设置会员充值卡使用情况 |
| | | addMoneyCardUse(pageOrder); |
| | | |
| | | // 改变客户项目套餐使用情况 |
| | | addTaocanProj(pageOrder); |
| | | |
| | | // 新增出库单 |
| | | addOutStore(pageOrder); |
| | | |
| | | // 设置业绩 |
| | | achieveNewService.addAchaeveByOrder(pageOrder); |
| | | |
| | | setShopSelCount(pageOrder); |
| | | |
| | | //设置会员积分 |
| | | addVipScore(pageOrder); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 付款后更新订单信息 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | private void updateOrderInfo(SysOrder pageOrder) { |
| | | |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | pageOrder.setCashierId(user.getSuId()); |
| | | |
| | | pageOrder.setPayTime(new Date()); |
| | | |
| | | pageOrder.setStatu(Dictionary.ORDER_STATU_YFK); |
| | | List<SysOrderFlow> flows = pageOrder.getFlows(); |
| | | |
| | | BigDecimal cashPayAmount = flows.stream() |
| | | .filter(item -> (!item.getPayMethod().equals("储值卡")) && (!item.getPayMethod().equals("欠款"))) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | BigDecimal cardPayAmount = flows.stream() |
| | | .filter(item -> item.getPayMethod().equals("储值卡")) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | pageOrder.setCardPay(cardPayAmount.doubleValue()); |
| | | pageOrder.setCashPay(cashPayAmount.doubleValue()); |
| | | //欠款金额在流水处理中处理了 |
| | | |
| | | double sum = flows.stream().mapToDouble(item -> item.getAmount().doubleValue()).sum(); |
| | | |
| | | if (sum > 0 && cardPayAmount.doubleValue() == 0 && cashPayAmount.doubleValue() == 0) { |
| | | throw new GlobleException("订单更新失败,支付金额计算错误,请联系管理员"); |
| | | } |
| | | |
| | | |
| | | sysOrderDao.update(pageOrder); |
| | | |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(pageOrder.getCompanyId(), pageOrder.getShopId(), user.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.ORDER_SK, |
| | | pageOrder.getId(), |
| | | pageOrder.getOrderNo(), |
| | | pageOrder.getVipId()); |
| | | } |
| | | |
| | | private void checkOrder(SysOrder pageOrder) { |
| | | //检查交易限制调整 |
| | | checkSealLimit(pageOrder); |
| | | //检查业绩设置 |
| | | checkOrderAchieve(pageOrder); |
| | | } |
| | | |
| | | /** |
| | | * 检查业绩设置是否合理 |
| | | * 1、每个订单明细都要有至少一个对应的业绩 |
| | | * 2、每个订单明细的同类型业绩金额之和不能大于明细支付金额 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | private void checkOrderAchieve(SysOrder pageOrder) { |
| | | |
| | | pageOrder.getItems().forEach(item -> { |
| | | |
| | | if (CollectionUtil.isEmpty(item.getAchieveList())) { |
| | | ShoppingGoods shopGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | throw GlobleException.instance(shopGoods.getName() + "缺少设置业绩"); |
| | | } |
| | | |
| | | //按业绩类型分组后比较支付金额与业绩金额是否相等 |
| | | Map<String, List<AchieveNew>> achieveTypeMap = item.getAchieveList().stream().collect(Collectors.groupingBy(AchieveNew::getAchieveType)); |
| | | Set<Map.Entry<String, List<AchieveNew>>> entries = achieveTypeMap.entrySet(); |
| | | entries.forEach(entrie -> { |
| | | double sum = entrie.getValue().stream().mapToDouble(AchieveNew::getGoodsCash).sum(); |
| | | //todo 目前使用js计算金额可能存在精度的误差展示用0.1屏蔽 |
| | | if (Math.abs(sum - (item.getZkPrice() * item.getCount())) > 0.1) { |
| | | ShoppingGoods shopGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | throw GlobleException.instance(shopGoods.getName() + "," + entrie.getKey() + "业绩金额与收款金额不一致"); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 检查产品销售次数 |
| | | */ |
| | | private void checkSealLimit(SysOrder pageOrder) { |
| | | pageOrder.getItems().forEach(item -> { |
| | | ShoppingGoods shopGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | |
| | | //最大销售次数检测 |
| | | Integer maxNum = shopGoods.getCarMaxSaleCount(); |
| | | if (maxNum != null && maxNum != 0) { |
| | | Integer buyNum = orderItemDao.selectByGoodsId(shopGoods.getId(), null); |
| | | if ((buyNum + item.getCount()) > maxNum) { |
| | | throw new GlobleException(shopGoods.getName() + "已超过最大销售数量"); |
| | | } |
| | | if ((buyNum + item.getCount()) == maxNum) { |
| | | if (!shopGoods.getStaus().equals(Dictionary.BUSINESS_STATE_DOWN)) { |
| | | shopGoods.setStaus(Dictionary.BUSINESS_STATE_DOWN); |
| | | shoppingGoodsDao.update(shopGoods); |
| | | } |
| | | } |
| | | } |
| | | //每人限购次数检测 |
| | | Integer onceCount = shopGoods.getIsOnce(); |
| | | if (onceCount != null && onceCount != 0) { |
| | | Integer buyOnceCount = orderItemDao.selectByGoodsId(shopGoods.getId(), pageOrder.getVipId()); |
| | | |
| | | if ((buyOnceCount + item.getCount()) > onceCount) { |
| | | throw new GlobleException(shopGoods.getName() + "每人限购" + onceCount + "次"); |
| | | } |
| | | } |
| | | |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置会员消费积分 |
| | | * |
| | | * @param pageOrder |
| | | */ |
| | | private void addVipScore(SysOrder pageOrder) { |
| | | |
| | | SysVipInfo vipInfo = sysVipInfoDao.selectById(pageOrder.getVipId()); |
| | | |
| | | List<SysOrderFlow> flows = pageOrder.getFlows(); |
| | | int[] cashScore = {0, 0, 0}; |
| | | //现金支付金额 |
| | | BigDecimal cashPayAmount = flows.stream() |
| | | .filter(item -> (!item.getPayMethod().equals("储值卡")) && (!item.getPayMethod().equals("欠款"))) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BusParameterSettings cashConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.CASH_CONSUMPTION, vipInfo.getCompanyId()); |
| | | if (cashPayAmount != null |
| | | && cashPayAmount.compareTo(BigDecimal.ZERO) > 0 |
| | | && StringUtils.isNotBlank(cashConsumption.getParamValue())) { |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(cashConsumption.getParamValue()); |
| | | if (scoreSetting0.compareTo(BigDecimal.ZERO) > 0) { |
| | | cashScore[0] = cashPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(cashConsumption.getParamValue1())) { |
| | | BigDecimal scoreSetting1 = new BigDecimal(cashConsumption.getParamValue1()); |
| | | if (scoreSetting1.compareTo(BigDecimal.ZERO) > 0) { |
| | | cashScore[1] = cashPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(cashConsumption.getParamValue2())) { |
| | | BigDecimal scoreSetting2 = new BigDecimal(cashConsumption.getParamValue2()); |
| | | if (scoreSetting2.compareTo(BigDecimal.ZERO) > 0) { |
| | | cashScore[2] = cashPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | int[] cardScore = {0, 0, 0}; |
| | | //储值卡本金支付金额 |
| | | BigDecimal cardPayAmount = flows.stream() |
| | | .filter(item -> item.getPayMethod().equals("储值卡") && item.getIsGift().equals("N")) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | BusParameterSettings principalBalanceConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION, vipInfo.getCompanyId()); |
| | | if (cardPayAmount != null |
| | | && cardPayAmount.compareTo(BigDecimal.ZERO) > 0 |
| | | && StringUtils.isNotBlank(principalBalanceConsumption.getParamValue())) { |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(principalBalanceConsumption.getParamValue()); |
| | | if (scoreSetting0.compareTo(BigDecimal.ZERO) > 0) { |
| | | cardScore[0] = cardPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(principalBalanceConsumption.getParamValue1())) { |
| | | BigDecimal scoreSetting1 = new BigDecimal(principalBalanceConsumption.getParamValue1()); |
| | | if (scoreSetting1.compareTo(BigDecimal.ZERO) > 0) { |
| | | cardScore[1] = cardPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(principalBalanceConsumption.getParamValue2())) { |
| | | BigDecimal scoreSetting2 = new BigDecimal(principalBalanceConsumption.getParamValue2()); |
| | | if (scoreSetting2.compareTo(BigDecimal.ZERO) > 0) { |
| | | cardScore[2] = cardPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | int[] giftScore = {0, 0, 0}; |
| | | //储值卡本赠送付金额 |
| | | BigDecimal giftPayAmount = flows.stream() |
| | | .filter(item -> item.getPayMethod().equals("储值卡") && item.getIsGift().equals("Y")) |
| | | .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BusParameterSettings bonusBalanceConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION, vipInfo.getCompanyId()); |
| | | if (giftPayAmount != null |
| | | && giftPayAmount.compareTo(BigDecimal.ZERO) > 0 |
| | | && StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue())) { |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(bonusBalanceConsumption.getParamValue()); |
| | | if (scoreSetting0.compareTo(BigDecimal.ZERO) > 0) { |
| | | giftScore[0] = giftPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue1())) { |
| | | BigDecimal scoreSetting1 = new BigDecimal(bonusBalanceConsumption.getParamValue1()); |
| | | if (scoreSetting1.compareTo(BigDecimal.ZERO) > 0) { |
| | | giftScore[1] = giftPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue2())) { |
| | | BigDecimal scoreSetting2 = new BigDecimal(bonusBalanceConsumption.getParamValue2()); |
| | | if (scoreSetting2.compareTo(BigDecimal.ZERO) > 0) { |
| | | giftScore[2] = giftPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | int selfScore = cashScore[0] + cardScore[0] + giftScore[0]; |
| | | int parentScore = cashScore[1] + cardScore[1] + giftScore[1]; |
| | | int topParentScore = cashScore[2] + cardScore[2] + giftScore[2]; |
| | | |
| | | |
| | | //添加自己的积分 |
| | | if (selfScore > 0) { |
| | | scoreVipDetailService.addScore( |
| | | vipInfo.getId(), |
| | | pageOrder.getStaffId(), |
| | | pageOrder.getShopId(), |
| | | selfScore, |
| | | pageOrder.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "消费奖励" |
| | | ); |
| | | } |
| | | |
| | | if (vipInfo.getRecommendId() != null) { |
| | | //推荐注册老带新积分奖励 |
| | | SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId()); |
| | | if (parentScore > 0) { |
| | | scoreVipDetailService.addScore( |
| | | referrerVip.getId(), |
| | | pageOrder.getStaffId(), |
| | | pageOrder.getShopId(), |
| | | parentScore, |
| | | pageOrder.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "推荐消费奖励" |
| | | ); |
| | | } |
| | | //推荐注册二级带新积分奖励 |
| | | if (referrerVip.getRecommendId() != null) { |
| | | SysVipInfo topVipInfo = sysVipInfoDao.selectById(referrerVip.getRecommendId()); |
| | | if (topParentScore > 0) { |
| | | scoreVipDetailService.addScore( |
| | | topVipInfo.getId(), |
| | | pageOrder.getStaffId(), |
| | | pageOrder.getShopId(), |
| | | topParentScore, |
| | | pageOrder.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_CASH, |
| | | "推荐消费奖励" |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建支付流水 |
| | | * |
| | | * @author:姜友瑶 |
| | | */ |
| | | private void addOrderFlow(SysOrder sourceOrder) { |
| | | |
| | | |
| | | //处理支付流水 |
| | | int flowCount = 1; |
| | | for (SysOrderFlow flow : sourceOrder.getFlows()) { |
| | | //支付内容摘要设置 |
| | | Long goodsId = sourceOrder.getItems().get(0).getGoodsId(); |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); |
| | | flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品"); |
| | | // 若是退款,则取负数 |
| | | if (SysOrder.ORDER_TYPE_REFUND == sourceOrder.getOrderType()) { |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_REFUND); |
| | | flow.setAmount(flow.getAmount().negate()); |
| | | flow.setOrderId(sourceOrder.getOldOrderId()); |
| | | } else { |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_BUY); |
| | | flow.setOrderId(sourceOrder.getId()); |
| | | } |
| | | |
| | | //欠款处理 |
| | | if (SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod())) { |
| | | sourceOrder.setStatu(Dictionary.ORDER_STATU_QK); |
| | | sourceOrder.setArrears(flow.getAmount().doubleValue()); |
| | | sysOrderDao.update(sourceOrder); |
| | | } |
| | | |
| | | //统计储值卡支付 |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | if (flow.getCardId() != null) { |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); |
| | | //修改储值卡余额 |
| | | cardPaySk(moneyCardUse, sourceOrder, flow); |
| | | } else { |
| | | throw new GlobleException("无效的储值卡支付方式"); |
| | | } |
| | | } |
| | | |
| | | flow.setFlowNo(codeService.getFlowCode() + "-" + flowCount); |
| | | flow.setVipId(sourceOrder.getVipId()); |
| | | flow.setShopId(sourceOrder.getShopId()); |
| | | flow.setCompanyId(sourceOrder.getCompanyId()); |
| | | sysOrderFlowDao.insert(flow); |
| | | flowCount++; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 验证商品是否达到最大发卡限制 |
| | | * |
| | | * @author jiangyouyao |
| | | */ |
| | | private void checkIsArrivedMax(ShoppingCarItem carItem) { |
| | | // 获取该商品的最大购买数量 |
| | | ShoppingGoods shopGoods = shoppingGoodsDao.selectById(carItem.getGoodsId()); |
| | | Integer maxNum = shopGoods.getCarMaxSaleCount(); |
| | | // 最大发卡数量为0代表不做限制 |
| | | if (maxNum != null && maxNum != 0) { |
| | | // 查询该商品已经被购买的次数 |
| | | Integer buyNum = orderItemDao.selectByGoodsId(shopGoods.getId(), null); |
| | | buyNum = (buyNum == null ? 0 : buyNum); |
| | | if ((buyNum + carItem.getCount()) > maxNum) { |
| | | throw new GlobleException(shopGoods.getName() + "已超过最大销售数量"); |
| | | } |
| | | if ((buyNum + carItem.getCount()) == maxNum) { |
| | | if (!shopGoods.getStaus().equals(Dictionary.BUSINESS_STATE_DOWN)) { |
| | | shopGoods.setStaus(Dictionary.BUSINESS_STATE_DOWN); |
| | | shoppingGoodsDao.update(shopGoods); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用充值卡付款操作 |
| | | * |
| | | * @param sourceOrder |
| | | * @param moneyCardUse |
| | | * @param flow |
| | | */ |
| | | private void cardPaySk(MoneyCardUse moneyCardUse, SysOrder sourceOrder, SysOrderFlow flow) { |
| | | // 判断商品是否在充值卡的限制购买,判断分类 |
| | | sourceOrder.getItems().forEach(item -> { |
| | | if (!isInBangding(moneyCardUse, item.getGoodsId())) { |
| | | throw new GlobleException(shoppingGoodsDao.selectById(item.getGoodsId()).getName() + "不在" + moneyCardUse.getCardName() + "优惠中"); |
| | | } |
| | | }); |
| | | |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); |
| | | if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { |
| | | if (moneyCardUse.getGiftMoney() >= flow.getAmount().doubleValue()) { |
| | | double surplus = MoneyUtil.sub(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue()); |
| | | moneyCardUse.setGiftMoney(surplus); |
| | | moneyCardUseFlow.setGiftMoney(0D - flow.getAmount().doubleValue()); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | } else { |
| | | if (moneyCardUse.getRealMoney() >= flow.getAmount().doubleValue()) { |
| | | double surplus = MoneyUtil.sub(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue()); |
| | | moneyCardUse.setRealMoney(surplus); |
| | | moneyCardUseFlow.setTotal(0 - flow.getAmount().doubleValue()); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | } |
| | | |
| | | if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_NO_N)) { |
| | | //余额为0时充值卡变为无效 |
| | | if (moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)) { |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); |
| | | } |
| | | } |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId()); |
| | | if (shoppingGoods != null) { |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime()); |
| | | moneyCardUse.setFailTime(invalidTime); |
| | | } |
| | | // 更新充值卡信息 |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | //设置卡项使用流水 |
| | | moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); |
| | | moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo()); |
| | | moneyCardUseFlow.setVipId(sourceOrder.getVipId()); |
| | | moneyCardUseFlow.setTimes(-1); |
| | | moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_CONSUMER); |
| | | moneyCardUseFlow.setCreateTime(new Date()); |
| | | moneyCardUseFlow.setOperationId(user.getSuId()); |
| | | moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney()); |
| | | moneyCardUseFlowDao.insert(moneyCardUseFlow); |
| | | } |
| | | |
| | | /** |
| | | * @param moneyCardUse |
| | | * @param goodsId |
| | | * @return 返回类型 boolean |
| | | * 判断商品是否在充值卡的优惠中 |
| | | * @author:姜友瑶 |
| | | * @date 2016年9月19日 |
| | | */ |
| | | private boolean isInBangding(MoneyCardUse moneyCardUse, Long goodsId) { |
| | | // 如果是一卡通则肯定在绑定范围内 |
| | | |
| | | if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y)) { |
| | | return true; |
| | | } else { |
| | | // 不是一卡通, |
| | | // 判断卡是否可应用于所有产品 |
| | | ShoppingGoods cardGoods = shoppingGoodsDao.selectById(moneyCardUse.getGoodsId()); |
| | | if (cardGoods != null) { |
| | | if (Dictionary.FLAG_YES.equals(cardGoods.getCarIsAll())) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | // 比较分类 |
| | | MoneyCardAssemble moneyCardAssemble = new MoneyCardAssemble(); |
| | | moneyCardAssemble.setCardId(moneyCardUse.getGoodsId()); |
| | | List<MoneyCardAssemble> cardAssembleList = moneyCardAssembleDao.selectByModel(moneyCardAssemble); |
| | | ShoppingGoods yhGoods = shoppingGoodsDao.selectById(goodsId); |
| | | boolean flag = false; |
| | | for (MoneyCardAssemble cardAssemble : cardAssembleList) { |
| | | // 比较类型 |
| | | if (cardAssemble.getType().equals(Dictionary.CZK_ASSEMBLE_FL)) { |
| | | if (yhGoods.getCateId().equals(cardAssemble.getCateId())) { |
| | | flag = true; |
| | | break; |
| | | } |
| | | } else { |
| | | // 比较绑定 |
| | | if (yhGoods.getId().equals(cardAssemble.getGoodsId())) { |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return flag; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置销量 |
| | | * |
| | | * @param sourceOrder |
| | | */ |
| | | public void setShopSelCount(SysOrder sourceOrder) { |
| | | for (SysOrderItem item : sourceOrder.getItems()) { |
| | | // 正真实销量 |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | if (goods.getRealSealCount() == null) { |
| | | goods.setRealSealCount(item.getCount()); |
| | | } else { |
| | | goods.setRealSealCount(goods.getRealSealCount() + item.getCount()); |
| | | } |
| | | shoppingGoodsDao.update(goods); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param sourceOrder 如果购买了充值卡设置会员的充值卡 |
| | | * @author:姜友瑶 |
| | | * @date 2016年9月19日 |
| | | */ |
| | | public void addMoneyCardUse(SysOrder sourceOrder) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | List<SysOrderItem> orderItemList = sourceOrder.getItems(); |
| | | for (SysOrderItem sysOrderItem : orderItemList) { |
| | | // 如果购买的是充值卡 |
| | | if (sysOrderItem.getType().equals(Dictionary.SHOPPING_GOODS_TYPE_CZK)) { |
| | | |
| | | for (int i = 0; i < sysOrderItem.getCount(); i++) { |
| | | ShoppingGoods moneyCar = shoppingGoodsDao.selectById(sysOrderItem.getGoodsId()); |
| | | MoneyCardUse moneyCardUse = new MoneyCardUse(); |
| | | moneyCardUse.setVipId(sourceOrder.getVipId()); |
| | | moneyCardUse.setGiftMoney(moneyCar.getReferencePice()); |
| | | moneyCardUse.setRealMoney(moneyCar.getSealPice()); |
| | | moneyCardUse.setGoodsId(moneyCar.getId()); |
| | | moneyCardUse.setOrderItemId(sysOrderItem.getId()); |
| | | moneyCardUse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | moneyCardUse.setCardName(moneyCar.getName()); |
| | | moneyCardUse.setIsVipCar(Dictionary.FLAG_NO_N); |
| | | moneyCardUse.setVipId(sourceOrder.getVipId()); |
| | | |
| | | // 是否为赠送 |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_YES)) { |
| | | moneyCardUse.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | | } else { |
| | | moneyCardUse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | } |
| | | //余次处理 |
| | | if (moneyCar.getCarUseCount() == null || moneyCar.getCarUseCount() == 0) { |
| | | moneyCardUse.setUseTotal(999999999); |
| | | moneyCardUse.setLastCount(999999999); |
| | | } else { |
| | | moneyCardUse.setUseTotal(moneyCar.getCarUseCount()); |
| | | moneyCardUse.setLastCount(moneyCar.getCarUseCount()); |
| | | } |
| | | //失效时间处理 |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null); |
| | | moneyCardUse.setFailTime(invalidTime); |
| | | |
| | | moneyCardUseDao.insert(moneyCardUse); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @author:姜友瑶 |
| | | * @date 2016年9月19日 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void updateAfterMoney(SysOrder pageOrder) { |
| | | SysOrder sourceOrder = sysOrderDao.selectById(pageOrder.getId()); |
| | | |
| | | int i = 1; |
| | | double refundTotal = 0D; |
| | | double cardPayTotal = 0D; |
| | | double cashPayTotal = 0D; |
| | | for (SysOrderFlow flow : pageOrder.getFlows()) { |
| | | flow.setFlowNo(codeService.getFlowCode() + "-" + i); |
| | | Long goodsId = pageOrder.getItems().get(0).getGoodsId(); |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); |
| | | flow.setFlowContent(goods.getName() + "等" + pageOrder.getItems().size() + "件产品"); |
| | | |
| | | flow.setOrderId(pageOrder.getId()); |
| | | flow.setVipId(pageOrder.getVipId()); |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_REPAY); |
| | | // 若使用储值卡付款 |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | if (flow.getCardId() != null) { |
| | | cardPayTotal += flow.getAmount().doubleValue(); |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); |
| | | cardPaySk(moneyCardUse, pageOrder, flow); |
| | | } |
| | | } else { |
| | | cashPayTotal += flow.getAmount().doubleValue(); |
| | | } |
| | | |
| | | refundTotal += flow.getAmount().doubleValue(); |
| | | flow.setShopId(sourceOrder.getShopId()); |
| | | flow.setCompanyId(sourceOrder.getCompanyId()); |
| | | sysOrderFlowDao.insert(flow); |
| | | i++; |
| | | } |
| | | |
| | | boolean haQk = false; |
| | | |
| | | if (refundTotal == pageOrder.getArrears()) { |
| | | haQk = true; |
| | | } |
| | | |
| | | //更新收款状态 |
| | | if (haQk) { |
| | | sourceOrder.setStatu(Dictionary.ORDER_STATU_YFK); |
| | | } else { |
| | | sourceOrder.setStatu(Dictionary.ORDER_STATU_QK); |
| | | } |
| | | |
| | | sourceOrder.setArrears(sourceOrder.getArrears() - refundTotal); |
| | | sourceOrder.setCardPay(sourceOrder.getCardPay() == null ? 0 : sourceOrder.getCardPay() + cardPayTotal); |
| | | sourceOrder.setCashPay(sourceOrder.getCashPay() == null ? 0 : sourceOrder.getCashPay() + cashPayTotal); |
| | | sysOrderDao.update(sourceOrder); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param order 新增出库单并更新本店库存 |
| | | * @author:姜友瑶 |
| | | * @date 2016年9月2日 |
| | | */ |
| | | @Override |
| | | public void addOutStore(SysOrder order) { |
| | | |
| | | BusParameterSettings manageStockSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WAREHOUSE_MANAGE_STOCK, order.getCompanyId()); |
| | | if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) { |
| | | |
| | | List<SysOutStoreItem> storeItemList = new ArrayList<>(); |
| | | |
| | | for (SysOrderItem sysOrderItem : order.getItems()) { |
| | | |
| | | if (ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP.equals(sysOrderItem.getType())) { |
| | | |
| | | SysOutStoreItem storeItem = new SysOutStoreItem(); |
| | | storeItem.setSkuId(sysOrderItem.getGoodsId()); |
| | | storeItem.setAmount(Double.valueOf(sysOrderItem.getCount())); |
| | | storeItemList.add(storeItem); |
| | | |
| | | } else if (ShoppingGoods.SHOPPING_GOODS_TYPE_TC.equals(sysOrderItem.getType()) |
| | | |
| | | || ShoppingGoods.SHOPPING_GOODS_TYPE_ZHK.equals(sysOrderItem.getType())) { |
| | | |
| | | List<ShoppingGoodsAssemble> goodsList = new ArrayList<>(); |
| | | |
| | | goodsList.addAll(shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP)); |
| | | |
| | | if (ShoppingGoods.SHOPPING_GOODS_TYPE_ZHK.equals(sysOrderItem.getType())) { |
| | | //综合卡处理,中的套餐,中的家居产品 |
| | | List<ShoppingGoodsAssemble> zhkAssemble = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_TC); |
| | | zhkAssemble.forEach(item -> { |
| | | goodsList.addAll(shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(item.getAssembleGoodId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP)); |
| | | }); |
| | | } |
| | | |
| | | goodsList.forEach(item -> { |
| | | SysOutStoreItem storeItem = new SysOutStoreItem(); |
| | | storeItem.setSkuId(item.getAssembleGoodId()); |
| | | storeItem.setAmount(Double.valueOf(item.getTotal())); |
| | | storeItemList.add(storeItem); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(storeItemList)) { |
| | | Long warehouseId = warehouseDao.findShopWarehouse(order.getShopId()).get(0).getId(); |
| | | SysOutStore outStore = new SysOutStore(); |
| | | outStore.setOutStoreNo(codeService.getOutStoreCode()); |
| | | outStore.setOrderId(order.getId()); |
| | | outStore.setShopId(order.getShopId()); |
| | | outStore.setShopId(order.getShopId()); |
| | | outStore.setStaffId(order.getStaffId()); |
| | | outStore.setType(Dictionary.OUT_STORE_JJCPCK); |
| | | outStore.setServiceNo(order.getOrderNo()); |
| | | outStore.setTime(new Date()); |
| | | outStore.setCheckStatus(Dictionary.CHECK_STATUS_DSH); |
| | | outStore.setCompanyId(order.getCompanyId()); |
| | | sysOutStoreDao.insert(outStore); |
| | | |
| | | //出库明细,根据批次维度定义 |
| | | List<SysOutStoreItem> realOutStoreItemList = new ArrayList<>(); |
| | | |
| | | storeItemList.forEach(outStoreItem -> { |
| | | |
| | | //设置出库主键 |
| | | outStoreItem.setOutStoreId(outStore.getId()); |
| | | |
| | | //计算库存总数是否满足本次扣减的需求 |
| | | List<SysStoreInfo> stores = storeInfoDao.selectStoInfoBySku(outStoreItem.getSkuId(), warehouseId); |
| | | double sum = stores.stream().mapToDouble(item -> item.getStoreTotal()).sum(); |
| | | if (sum < outStoreItem.getAmount()) { |
| | | ShoppingGoods sysGoods = shoppingGoodsDao.selectById(outStoreItem.getSkuId()); |
| | | if (sysGoods != null) { |
| | | throw new GlobleException("出库失败:【" + sysGoods.getName() + "库存不足】"); |
| | | |
| | | } else { |
| | | throw new GlobleException("出库失败没有找到出库产品"); |
| | | } |
| | | } |
| | | |
| | | //循环获取所有批次产品,并扣减库存 |
| | | Double number = outStoreItem.getAmount(); |
| | | for (SysStoreInfo storeInfo : stores) { |
| | | Double oldStoreTotal = storeInfo.getStoreTotal(); |
| | | Double surplus = storeInfo.getStoreTotal() - number; |
| | | //更新库存 |
| | | storeInfo.setStoreTotal(surplus < 0 ? 0 : surplus); |
| | | |
| | | //每次扣减库存都创建一个出库记录 |
| | | SysOutStoreItem sysOutStoreItem = new SysOutStoreItem(); |
| | | BeanUtils.copyProperties(outStoreItem, sysOutStoreItem); |
| | | sysOutStoreItem.setStoreId(storeInfo.getId()); |
| | | sysOutStoreItem.setAmount(oldStoreTotal - storeInfo.getStoreTotal()); |
| | | realOutStoreItemList.add(sysOutStoreItem); |
| | | |
| | | storeInfoDao.update(storeInfo); |
| | | //扣除后剩余库存大于0则跳出扣除,否则剩余数量的负数的绝对值就是再次扣减的数量 |
| | | if (surplus > 0) { |
| | | break; |
| | | } else { |
| | | number = Math.abs(surplus); |
| | | } |
| | | } |
| | | }); |
| | | sysOutStoreItemDao.batchInsert(realOutStoreItemList); |
| | | } |
| | | |
| | | } else { |
| | | LogUtil.debug("不管理库存"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 新增项目和套餐的余次 |
| | | * |
| | | * @author:姜友瑶 |
| | | * @date 2016年9月2日 |
| | | */ |
| | | public void addTaocanProj(SysOrder order) { |
| | | List<SysOrderItem> itemList = order.getItems(); |
| | | for (SysOrderItem sysOrderItem : itemList) { |
| | | // 折扣 项目的实际购买除以项目原价,来计算项目的消耗价格 |
| | | // 赠送 计算全额的消耗业绩 |
| | | if (sysOrderItem.getType().equals(Dictionary.SHOPPING_GOODS_TYPE_XM)) { |
| | | createXmProjuse(order, sysOrderItem); |
| | | } else if (sysOrderItem.getType().equals(Dictionary.SHOPPING_GOODS_TYPE_TC)) { |
| | | //每个套餐独立生成一个明细 |
| | | int orderCount = sysOrderItem.getCount(); |
| | | while (orderCount > 0) { |
| | | createTaocanProjUse(order, sysOrderItem, null); |
| | | orderCount--; |
| | | } |
| | | } else if (sysOrderItem.getType().equals(Dictionary.SHOPPING_GOODS_TYPE_ZHK)) { |
| | | addZongheCarUse(order, sysOrderItem); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | public void addZongheCarUse(SysOrder order, SysOrderItem sysOrderItem) { |
| | | |
| | | |
| | | //处理一个订单买多次 |
| | | int orderCount = sysOrderItem.getCount(); |
| | | while (orderCount < 0) { |
| | | orderCount--; |
| | | //综合卡中包含的项目 |
| | | List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_XM); |
| | | assembleList.forEach(item -> { |
| | | //TODO 补综合卡逻辑 |
| | | createProjuseByAssemble(order, sysOrderItem, item, null, null, null, 0); |
| | | }); |
| | | |
| | | //处理综合卡中包含的套餐 |
| | | List<ShoppingGoodsAssemble> zhkAssemble = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_TC); |
| | | zhkAssemble.forEach(taocan -> { |
| | | int assembleCount = taocan.getTotal(); |
| | | while (assembleCount > 0) { |
| | | assembleCount--; |
| | | createTaocanProjUse(order, sysOrderItem, taocan); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 通过组合关系创建用户项目余次 |
| | | */ |
| | | private SysProjUse createProjuseByAssemble(SysOrder order, SysOrderItem sysOrderItem, |
| | | ShoppingGoodsAssemble goodsAssemble, Long taocanId, Date failTime, String source, Integer maxCount) { |
| | | //计算折扣 |
| | | Double zk = sysOrderItem.getZkPrice() / sysOrderItem.getPrice(); |
| | | |
| | | SysProjUse puse = new SysProjUse(); |
| | | puse.setIsOver(Dictionary.DELETED_N); |
| | | puse.setOrderItemId(sysOrderItem.getId()); |
| | | puse.setProjId(goodsAssemble.getAssembleGoodId()); |
| | | puse.setSurplusCount(goodsAssemble.getTotal() == null ? maxCount : goodsAssemble.getTotal()); |
| | | puse.setDeductionNum(goodsAssemble.getDeductionNum()); |
| | | puse.setProjName(goodsAssemble.getShoppingGoods().getName()); |
| | | puse.setVipId(order.getVipId()); |
| | | puse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | puse.setTaocanId(taocanId); |
| | | puse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | puse.setSource(source); |
| | | |
| | | if (taocanId == null) { |
| | | puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() * zk); |
| | | } else { |
| | | puse.setPrice(goodsAssemble.getPrice() * zk); |
| | | } |
| | | |
| | | |
| | | //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗 |
| | | boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE); |
| | | if (zsConsumeAchieve) { |
| | | if (sysOrderItem.getPrice() <= 0) { |
| | | //等于0取原价 |
| | | if (taocanId == null) { |
| | | puse.setPrice(goodsAssemble.getShoppingGoods().getPrice()); |
| | | } else { |
| | | puse.setPrice(goodsAssemble.getPrice()); |
| | | } |
| | | } |
| | | } else { |
| | | puse.setPrice(0D); |
| | | } |
| | | |
| | | puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount()))); |
| | | puse.setFailTime(failTime); |
| | | sysProjUseDao.insert(puse); |
| | | return puse; |
| | | } |
| | | |
| | | |
| | | private void createTaocanProjUse(SysOrder order, SysOrderItem sysOrderItem, ShoppingGoodsAssemble goodsAssemble) { |
| | | |
| | | //新建套餐 |
| | | SysProjUse taocanProjUse = new SysProjUse(); |
| | | |
| | | ShoppingGoods taocanShoppingGoods = sysOrderItem.getShoppingGoods(); |
| | | |
| | | |
| | | Long projId = sysOrderItem.getGoodsId(); |
| | | |
| | | if (goodsAssemble != null) { |
| | | taocanShoppingGoods = shoppingGoodsDao.selectById(goodsAssemble.getAssembleGoodId()); |
| | | projId = goodsAssemble.getAssembleGoodId(); |
| | | } |
| | | |
| | | taocanProjUse.setProjId(projId); |
| | | taocanProjUse.setIsOver(Dictionary.DELETED_N); |
| | | taocanProjUse.setOrderItemId(sysOrderItem.getId()); |
| | | |
| | | taocanProjUse.setProjName(taocanShoppingGoods.getName()); |
| | | taocanProjUse.setVipId(order.getVipId()); |
| | | taocanProjUse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | taocanProjUse.setType(Dictionary.SHOPPING_GOODS_TYPE_TC); |
| | | taocanProjUse.setIsCourse(taocanShoppingGoods.getIsCourse()); |
| | | taocanProjUse.setIsInfinite(taocanShoppingGoods.getIsInfinite()); |
| | | // 赠送和打折后金额为0的都视为赠送项目 |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0 && !isGiftMoneyPay(order)) { |
| | | taocanProjUse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | } else { |
| | | taocanProjUse.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | | } |
| | | // 失效时间 |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(taocanShoppingGoods, 1, null); |
| | | taocanProjUse.setFailTime(invalidTime); |
| | | sysProjUseDao.insert(taocanProjUse); |
| | | //计划次数 |
| | | int surplusCount = 0; |
| | | //总余额 |
| | | Double sumBanance = 0D; |
| | | //创建套餐绑定的项目 |
| | | List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(projId, ShoppingGoods.SHOPPING_GOODS_TYPE_XM); |
| | | for (ShoppingGoodsAssemble assemble : assembleList) { |
| | | SysProjUse tempUse = createProjuseByAssemble(order, sysOrderItem, assemble, taocanProjUse.getId(), taocanProjUse.getFailTime(), taocanProjUse.getSource(), taocanShoppingGoods.getCarUseCount()); |
| | | sumBanance += tempUse.getBalance(); |
| | | surplusCount += tempUse.getSurplusCount(); |
| | | } |
| | | if (Dictionary.FLAG_NO_N.equals(taocanShoppingGoods.getIsCourse())) { |
| | | //固定套餐,剩余次数等于绑定项目的次数 |
| | | taocanProjUse.setSurplusCount(surplusCount); |
| | | //合计套餐余额 |
| | | taocanProjUse.setBalance(sumBanance); |
| | | } else { |
| | | //任选套餐剩余次数等于最大使用次数 |
| | | taocanProjUse.setSurplusCount(taocanShoppingGoods.getCarUseCount()); |
| | | taocanProjUse.setBalance(sysOrderItem.getZkPrice()); |
| | | } |
| | | |
| | | sysProjUseDao.update(taocanProjUse); |
| | | } |
| | | |
| | | @Autowired |
| | | private SysProjServicesService projServicesService; |
| | | |
| | | /** |
| | | * 根据订单创建用户项目使用情况 |
| | | * |
| | | * @param order |
| | | * @param sysOrderItem |
| | | */ |
| | | private void createXmProjuse(SysOrder order, SysOrderItem sysOrderItem) { |
| | | SysProjUse puse = new SysProjUse(); |
| | | puse.setIsOver(Dictionary.DELETED_N); |
| | | puse.setOrderItemId(sysOrderItem.getId()); |
| | | puse.setProjId(sysOrderItem.getGoodsId()); |
| | | puse.setSurplusCount(sysOrderItem.getCount()); |
| | | puse.setVipId(order.getVipId()); |
| | | puse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | puse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | |
| | | |
| | | puse.setProjName(sysOrderItem.getShoppingGoods().getName()); |
| | | |
| | | |
| | | // 赠送和打折后金额为0的都视为赠送项目 |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0 && !isGiftMoneyPay(order)) { |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | puse.setPrice(sysOrderItem.getZkPrice()); |
| | | } else { |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | | //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗 |
| | | boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE); |
| | | if (zsConsumeAchieve) { |
| | | //赠送情况下,如果收款金额大于0,就是赠送金额划扣的情况,金额即为划扣的折扣金额 |
| | | if (sysOrderItem.getZkPrice() > 0) { |
| | | puse.setPrice(sysOrderItem.getZkPrice()); |
| | | } else { |
| | | puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice()); |
| | | } |
| | | } else { |
| | | puse.setPrice(0D); |
| | | } |
| | | } |
| | | // 设置失效时间 |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null); |
| | | puse.setFailTime(invalidTime); |
| | | puse.setBalance(puse.getPrice() * puse.getSurplusCount()); |
| | | sysProjUseDao.insert(puse); |
| | | } |
| | | |
| | | /** |
| | | * 全是赠送金额,且配置了赠送金额购买计算为赠送 |
| | | * |
| | | * @param order |
| | | * @return |
| | | */ |
| | | private boolean isGiftMoneyPay(SysOrder order) { |
| | | BusParameterSettings giftiIsfree = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_GIFTISFREE, order.getCompanyId()); |
| | | if (giftiIsfree.getParamValue().equals("是")) { |
| | | return order.getFlows().stream().allMatch(item -> SysOrderFlow.IS_GIFT_Y.equals(item.getIsGift()) |
| | | && item.getAmount().doubleValue() > 0D); |
| | | } else { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 会员卡充值 |
| | | * |
| | | * @param czVo |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysOrder updateAddCardMoney(CzXkVo czVo) { |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | // SysVipInfo vip = (SysVipInfo) WebUtil.getSession().getAttribute(SystemConstance.CURRENT_CUSTOMER); |
| | | // czVo.setVipId(vip.getId()); |
| | | |
| | | //更新会员会员卡金额 |
| | | MoneyCardUse cardUser = moneyCardUseDao.selectVipCard(czVo.getVipId()); |
| | | cardUser.setRealMoney(MoneyUtil.add(cardUser.getRealMoney(), czVo.getBjmoney())); |
| | | cardUser.setGiftMoney(MoneyUtil.add(cardUser.getGiftMoney(), czVo.getGiftMoney())); |
| | | moneyCardUseDao.update(cardUser); |
| | | |
| | | |
| | | // 为会员新增积分 |
| | | SysVipInfo vipInfo = sysVipInfoDao.selectById(cardUser.getVipId()); |
| | | vipInfo.setPointAll(vipInfo.getPointAll() == null ? 0 : vipInfo.getPointAll() + czVo.getJf()); |
| | | sysVipInfoDao.update(vipInfo); |
| | | |
| | | |
| | | // 新增一个充值订单 |
| | | SysOrder order = new SysOrder(); |
| | | order.setArrears(0D); |
| | | order.setTotal(czVo.getBjmoney()); |
| | | order.setZkTotal(czVo.getBjmoney()); |
| | | order.setCashPay(czVo.getBjmoney()); |
| | | order.setShopId(user.getShopId()); |
| | | order.setOrderNo(codeService.getOrderCode()); |
| | | order.setVipId(czVo.getVipId()); |
| | | Date orderTime = new Date(); |
| | | if (StringUtils.isNotBlank(czVo.getDateTime())) { |
| | | orderTime = DateUtil.stringToDateNew(czVo.getDateTime(), DateUtil.DATE_FORMAT_DD); |
| | | } |
| | | order.setOrderTime(orderTime); |
| | | order.setPayTime(orderTime); |
| | | order.setRemark(cardUser.getCardName()); |
| | | order.setStaffId(user.getSuId()); |
| | | order.setIsCross(2 + ""); |
| | | order.setOrderType(SysOrder.ORDER_TYPE_SEAL); |
| | | order.setStatu(Dictionary.ORDER_STATU_YFK); |
| | | order.setCompanyId(user.getCompanyId()); |
| | | sysOrderDao.insert(order); |
| | | |
| | | SysOrderItem orderItem = new SysOrderItem(); |
| | | orderItem.setOrderId(order.getId()); |
| | | orderItem.setOrderNo(order.getOrderNo()); |
| | | orderItem.setArrears(0D); |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectVipCzGoods(); |
| | | orderItem.setGoodsId(shoppingGoods.getId()); |
| | | orderItem.setPayMethod(Dictionary.PAY_TYPE_MOENY); |
| | | orderItem.setCashPay(czVo.getBjmoney()); |
| | | orderItem.setZkPrice(czVo.getBjmoney()); |
| | | orderItem.setCardPay(0D); |
| | | orderItem.setType(Dictionary.SHOPPING_GOODS_TYPE_CZK); |
| | | orderItem.setCount(1); |
| | | orderItem.setIsFree(Dictionary.FLAG_NO); |
| | | orderItem.setPrice(czVo.getBjmoney()); |
| | | orderItem.setStatus(Dictionary.ORDER_STATU_YFK); |
| | | orderItem.setAchieveList(czVo.getAchaeveList()); |
| | | orderItem.setShoppingGoods(shoppingGoods); |
| | | orderItemDao.insert(orderItem); |
| | | List<SysOrderItem> items = new ArrayList<>(); |
| | | items.add(orderItem); |
| | | order.setItems(items); |
| | | |
| | | |
| | | //设置卡项使用流水 |
| | | MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); |
| | | moneyCardUseFlow.setTotal(czVo.getBjmoney()); |
| | | moneyCardUseFlow.setGiftMoney(czVo.getGiftMoney()); |
| | | moneyCardUseFlow.setCarUseId(czVo.getCardId()); |
| | | moneyCardUseFlow.setVipId(czVo.getVipId()); |
| | | moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_CZ); |
| | | moneyCardUseFlow.setOrderNo(order.getOrderNo()); |
| | | moneyCardUseFlow.setCreateTime(new Date()); |
| | | moneyCardUseFlow.setOperationId(user.getSuId()); |
| | | moneyCardUseFlow.setBalance(cardUser.getGiftMoney() + cardUser.getRealMoney()); |
| | | moneyCardUseFlow.setCarUseId(cardUser.getId()); |
| | | moneyCardUseFlowDao.insert(moneyCardUseFlow); |
| | | |
| | | order.setFlows(czVo.getFlows()); |
| | | |
| | | addOrderFlow(order); |
| | | |
| | | // 添加员工业绩 |
| | | achieveNewService.addAchaeveByOrder(order); |
| | | |
| | | return order; |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public SysOrder findSysOrderTjByVipId(Long vipId) { |
| | | return sysOrderDao.selectVipOrderInfoTotal(vipId); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderDetailVo> findApiOrderListInPage(OrderListDto orderListDto, PaginationVO pageVo) { |
| | | return sysOrderDao.selectApiOrderListInPage(orderListDto, pageVo); |
| | | } |
| | | |
| | | @Override |
| | | public int findApiOrderListTotal(OrderListDto orderListDto) { |
| | | return sysOrderDao.selectApiOrderListTotal(orderListDto); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetailVo findApiOrderDetailByOrderId(Long orderId) { |
| | | OrderDetailVo orderDetail = sysOrderDao.selectApiOrderDetailById(orderId); |
| | | |
| | | if (orderDetail == null) { |
| | | throw new GlobleException("该订单不存在"); |
| | | } |
| | | |
| | | List<OrderDetailItemVo> items = orderItemDao.selectApiOrderDetailItemsByOrderId(orderId); |
| | | if (CollectionUtils.isNotEmpty(items)) { |
| | | for (OrderDetailItemVo item : items) { |
| | | List<OrderDetailAchieveItemVo> achieveItems = achieveNewDao.selectApiOrderItemAchieve(item.getId()); |
| | | item.setAchieves(achieveItems); |
| | | } |
| | | } |
| | | |
| | | orderDetail.setItems(items); |
| | | return orderDetail; |
| | | } |
| | | |
| | | @Override |
| | | public List<RankingVo> findApiShopAchieveRanking(SysOrder sysOrder) { |
| | | return sysOrderDao.selectShopAchieveRanking(sysOrder); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void refundOrderMoney(SysOrder sysOrder) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | //原订单设置为退款状态 |
| | | SysOrder sourceOrder = new SysOrder(); |
| | | sourceOrder.setId(sysOrder.getOldOrderId()); |
| | | sourceOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_Y); |
| | | // sourceOrder.setStatu(Dictionary.ORDER_STATU_TK); |
| | | sysOrderDao.update(sourceOrder); |
| | | SysOrder oldOrder = sysOrderDao.selectById(sysOrder.getOldOrderId()); |
| | | |
| | | sysOrder.setId(null); |
| | | sysOrder.setStaffId(user.getSuId()); |
| | | sysOrder.setCompanyId(user.getCompanyId()); |
| | | sysOrder.setShopId(user.getShopId()); |
| | | sysOrder.setOrderType(SysOrder.ORDER_TYPE_REFUND); |
| | | sysOrder.setStatu(Dictionary.ORDER_STATU_YFK); |
| | | Date now = new Date(); |
| | | sysOrder.setOrderTime(now); |
| | | sysOrder.setPayTime(now); |
| | | sysOrder.setOrderNo(codeService.getRefundOrderNo()); |
| | | sysOrder.setZkTotal(-sysOrder.getZkTotal()); |
| | | //新增订单 |
| | | sysOrderDao.insert(sysOrder); |
| | | //插入明细 |
| | | for (SysOrderItem item : sysOrder.getItems()) { |
| | | |
| | | //更新原订单明细的可退数量 |
| | | SysOrderItem oldItem = new SysOrderItem(); |
| | | oldItem.setId(item.getId()); |
| | | oldItem.setRefundCount(item.getCount()); |
| | | orderItemDao.update(oldItem); |
| | | |
| | | //插入新的订单明细 |
| | | item.setId(null); |
| | | item.setCount(-item.getCount()); |
| | | item.setOrderId(sysOrder.getId()); |
| | | orderItemDao.insert(item); |
| | | } |
| | | |
| | | |
| | | // 添加订单收款流水 |
| | | addOrderFlow(sysOrder); |
| | | //退款退套餐退项目 |
| | | refundProjUse(sysOrder); |
| | | //删除积分 |
| | | scoreVipDetailService.removeByBusinessId(oldOrder.getVipId(), oldOrder.getId()); |
| | | |
| | | // 设置业绩 |
| | | achieveNewService.addAchaeveByOrder(sysOrder); |
| | | |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(sysOrder.getCompanyId(), sysOrder.getShopId(), user.getSuId(), |
| | | OperationFunctionEnum.ORDER, |
| | | OperationButtonEnum.ORDER_TK, |
| | | sysOrder.getId(), |
| | | sysOrder.getOrderNo(), |
| | | sysOrder.getVipId()); |
| | | |
| | | } |
| | | |
| | | private void addRefundOrderFlow(SysOrder sourceOrder) { |
| | | //处理支付流水 |
| | | int flowCount = 1; |
| | | for (SysOrderFlow flow : sourceOrder.getFlows()) { |
| | | //支付内容摘要设置 |
| | | Long goodsId = sourceOrder.getItems().get(0).getGoodsId(); |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); |
| | | flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品"); |
| | | // 退款,则取负数 |
| | | flow.setFlowType(SysOrderFlow.FLOW_TYPE_REFUND); |
| | | flow.setAmount(flow.getAmount().negate()); |
| | | flow.setOrderId(sourceOrder.getOldOrderId()); |
| | | |
| | | //统计储值卡支付 |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | | if (flow.getCardId() != null) { |
| | | MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); |
| | | //修改储值卡余额 |
| | | cardPaySk(moneyCardUse, sourceOrder, flow); |
| | | } else { |
| | | throw new GlobleException("无效的储值卡支付方式"); |
| | | } |
| | | } |
| | | |
| | | flow.setFlowNo(codeService.getFlowCode() + "-" + flowCount); |
| | | flow.setVipId(sourceOrder.getVipId()); |
| | | flow.setShopId(sourceOrder.getShopId()); |
| | | flow.setCompanyId(sourceOrder.getCompanyId()); |
| | | sysOrderFlowDao.insert(flow); |
| | | flowCount++; |
| | | } |
| | | } |
| | | |
| | | private void refundCard(MoneyCardUse moneyCardUse, SysOrder sourceOrder, SysOrderFlow flow) { |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | MoneyCardUseFlow moneyCardUseFlow = new MoneyCardUseFlow(); |
| | | if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { |
| | | if (moneyCardUse.getGiftMoney() >= flow.getAmount().doubleValue()) { |
| | | double surplus = MoneyUtil.sub(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue()); |
| | | moneyCardUse.setGiftMoney(surplus); |
| | | moneyCardUseFlow.setGiftMoney(0D - flow.getAmount().doubleValue()); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | } else { |
| | | if (moneyCardUse.getRealMoney() >= flow.getAmount().doubleValue()) { |
| | | double surplus = MoneyUtil.sub(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue()); |
| | | moneyCardUse.setRealMoney(surplus); |
| | | moneyCardUseFlow.setTotal(0 - flow.getAmount().doubleValue()); |
| | | } else { |
| | | throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); |
| | | } |
| | | } |
| | | |
| | | if (moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_NO_N)) { |
| | | //余额为0时充值卡变为无效 |
| | | if (moneyCardUse.getRealMoney().equals(0D) && moneyCardUse.getGiftMoney().equals(0D)) { |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); |
| | | } |
| | | } |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsService.findById(moneyCardUse.getGoodsId()); |
| | | if (shoppingGoods != null) { |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 2, moneyCardUse.getFailTime()); |
| | | moneyCardUse.setFailTime(invalidTime); |
| | | } |
| | | // 更新充值卡信息 |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | //设置卡项使用流水 |
| | | moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); |
| | | moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo()); |
| | | moneyCardUseFlow.setVipId(sourceOrder.getVipId()); |
| | | moneyCardUseFlow.setTimes(-1); |
| | | moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_CONSUMER); |
| | | moneyCardUseFlow.setCreateTime(new Date()); |
| | | moneyCardUseFlow.setOperationId(user.getSuId()); |
| | | moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney() + moneyCardUse.getRealMoney()); |
| | | moneyCardUseFlowDao.insert(moneyCardUseFlow); |
| | | } |
| | | |
| | | /** |
| | | * 退款退项目,套餐,卡项 |
| | | * |
| | | * @param sysOrder |
| | | */ |
| | | private void refundProjUse(SysOrder sysOrder) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | //记录需要退库存的产品 |
| | | List<SysOrderItem> returnGoodsList = new ArrayList<>(); |
| | | |
| | | for (SysOrderItem item : sysOrder.getItems()) { |
| | | |
| | | SysProjUse queryProjUse = new SysProjUse(); |
| | | queryProjUse.setOrderItemId(item.getOldItemId()); |
| | | // 修改项目信息 |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(item.getType()) || Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(item.getType())) { |
| | | |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(item.getType())) { |
| | | if (Dictionary.FLAG_YES_Y.equals(item.getIsReturnStore())) { |
| | | returnGoodsList.add(item); |
| | | } |
| | | } else { |
| | | SysProjUse sysProjUse = sysProjUseDao.selectByModel(queryProjUse).get(0); |
| | | |
| | | int sub = sysProjUse.getSurplusCount() - item.getCount(); |
| | | if (sub < 0) { |
| | | throw new GlobleException("项目余次不足"); |
| | | } else if (sub == 0) { |
| | | sysProjUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX); |
| | | } |
| | | sysProjUse.setSurplusCount(sub); |
| | | sysProjUseDao.update(sysProjUse); |
| | | SysProjUseFlow sysProjUseFlow = SysProjUseMapper.INSTANCE.projUseToFlow(sysProjUse); |
| | | sysProjUseFlow.setOptionType("退款修改"); |
| | | sysProjUseFlow.setId(null); |
| | | sysProjUseFlow.setUpdateBy(user.getSuName()); |
| | | sysProjUseFlow.setCreateBy(user.getSuName()); |
| | | sysProjUseDao.insertFlow(sysProjUseFlow); |
| | | } |
| | | } |
| | | |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(item.getType())) { |
| | | queryProjUse.setTaocanId(-1L); |
| | | List<SysProjUse> sysProjUses = sysProjUseDao.selectByModel(queryProjUse); |
| | | |
| | | |
| | | for (int i = 0; i < sysProjUses.size(); i++) { |
| | | |
| | | SysProjUse sysProjUse = sysProjUses.get(i); |
| | | sysProjUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX); |
| | | sysProjUseDao.update(sysProjUse); |
| | | SysProjUseFlow sysProjUseFlow = SysProjUseMapper.INSTANCE.projUseToFlow(sysProjUse); |
| | | sysProjUseFlow.setOptionType("退款修改"); |
| | | sysProjUseFlow.setId(null); |
| | | sysProjUseFlow.setUpdateBy(user.getSuName()); |
| | | sysProjUseFlow.setCreateBy(user.getSuName()); |
| | | sysProjUseDao.insertFlow(sysProjUseFlow); |
| | | } |
| | | } |
| | | |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_CZK.equals(item.getType())) { |
| | | MoneyCardUse queryCardUse = new MoneyCardUse(); |
| | | queryCardUse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | queryCardUse.setOrderItemId(item.getOldItemId()); |
| | | |
| | | List<MoneyCardUse> moneyCardUses = moneyCardUseDao.selectByModel(queryCardUse); |
| | | for (int i = 0; i < item.getCount(); i++) { |
| | | MoneyCardUse moneyCardUse = moneyCardUses.get(i); |
| | | moneyCardUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_WX); |
| | | moneyCardUseDao.update(moneyCardUse); |
| | | } |
| | | } |
| | | |
| | | // TODO 综合卡退款 |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_ZHK.equals(item.getType())) { |
| | | |
| | | } |
| | | |
| | | |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | goods.setRealSealCount(goods.getRealSealCount() - item.getCount()); |
| | | shoppingGoodsDao.update(goods); |
| | | } |
| | | |
| | | BusParameterSettings manageStockSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WAREHOUSE_MANAGE_STOCK, sysOrder.getCompanyId()); |
| | | if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) { |
| | | // 家居产品退库存 |
| | | if (CollectionUtils.isNotEmpty(returnGoodsList)) { |
| | | refundInstore(returnGoodsList); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 退款入库 |
| | | */ |
| | | private void refundInstore(@NotEmpty List<SysOrderItem> items) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysSupplierInfo supplierInfo = new SysSupplierInfo(); |
| | | supplierInfo.setShopId(user.getShopId()); |
| | | supplierInfo = sysSupplierInfoDao.selectByModel(supplierInfo).get(0); |
| | | |
| | | Warehouse warehouse = warehouseDao.findShopWarehouse(user.getShopId()).get(0); |
| | | SysInstoreInfo instoreInfo = new SysInstoreInfo(); |
| | | instoreInfo.setInstoreType(SysInstoreInfo.INSTORE_TYPE_RETURN); |
| | | instoreInfo.setInstoreDate(new Date()); |
| | | instoreInfo.setSupplierId(supplierInfo.getId().toString()); |
| | | instoreInfo.setStoreId(warehouse.getId()); |
| | | instoreInfo.setCheckStatus(Dictionary.CHECK_STATUS_DSH); |
| | | // 设置入库单编号 |
| | | instoreInfo.setInstoreId(DateUtil.getTimeMark()); |
| | | instoreInfo.setShopId(user.getShopId()); |
| | | instoreInfo.setCompanyId(user.getCompanyId()); |
| | | sysInstoreInfoDao.insert(instoreInfo); |
| | | |
| | | Double total = 0.0; |
| | | List<SysInstoreDetail> instoreDetails = new ArrayList<>(); |
| | | for (SysOrderItem item : items) { |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | SysInstoreDetail sysInstoreDetail = new SysInstoreDetail(); |
| | | sysInstoreDetail.setAmount(item.getCount().doubleValue()); |
| | | sysInstoreDetail.setPrice(item.getZkPrice()); |
| | | sysInstoreDetail.setSkuId(goods.getId()); |
| | | |
| | | total = MoneyUtil.add(MoneyUtil.mul(Double.parseDouble(sysInstoreDetail.getAmount() + ""), sysInstoreDetail.getPrice()), total); |
| | | sysInstoreDetail.setInstoreId(instoreInfo.getId()); |
| | | // 设置小计 |
| | | sysInstoreDetail.setPriceTotal(MoneyUtil.mul(Double.parseDouble(sysInstoreDetail.getAmount() + ""), sysInstoreDetail.getPrice())); |
| | | instoreDetails.add(sysInstoreDetail); |
| | | |
| | | } |
| | | instoreInfo.setSumall(total); |
| | | sysInstoreInfoDao.update(instoreInfo); |
| | | sysInstoreDetailDao.batchInsert(instoreDetails); |
| | | |
| | | sysInstoreInfoService.check(instoreInfo); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal findVipArrearsByVipId(Long vipId) { |
| | | return sysOrderDao.selectArrearsByVipId(vipId); |
| | | } |
| | | } |
| | |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | |
| | | |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.SysOutStore; |
| | | import com.matrix.system.hive.bean.SysOutStoreItem; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.bean.SysStoreInfo; |
| | | import com.matrix.system.hive.dao.SysOutStoreDao; |
| | | import com.matrix.system.hive.dao.SysOutStoreItemDao; |
| | | import com.matrix.system.hive.dao.SysStoreInfoDao; |
| | | import com.matrix.system.hive.service.CodeService; |
| | | import com.matrix.system.hive.service.SysOutStoreService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * @date 2016-07-25 12:43 |
| | |
| | | private SysStoreInfoDao storeInfoDao; |
| | | @Autowired |
| | | private CodeService codeService; |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消出库单 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public int checkInfo(SysOutStore sysOutStore) { |
| | | public void cancelOutStore(Long id) { |
| | | List<SysOutStoreItem> outStoreItemList = sysOutStoreItemDao.selectByOrderId(id); |
| | | for (SysOutStoreItem item : outStoreItemList) { |
| | | SysStoreInfo sysStoreInfo = storeInfoDao.selectById(item.getStoreId()); |
| | | sysStoreInfo.setStoreTotal(sysStoreInfo.getStoreTotal() + item.getAmount()); |
| | | //更新库存 |
| | | storeInfoDao.update(sysStoreInfo); |
| | | } |
| | | sysOutStoreDao.deleteById(id); |
| | | sysOutStoreItemDao.deleteByOrderId(id); |
| | | } |
| | | |
| | | @Override |
| | | public int effectOutStore(SysOutStore sysOutStore) { |
| | | |
| | | SysOutStore queryStore = sysOutStoreDao.selectById(sysOutStore.getId()); |
| | | |
| | | if(!queryStore.getCheckStatus().equals(Dictionary.CHECK_STATUS_DSH)){ |
| | | throw new GlobleException("单据状态已更新,请刷新"); |
| | | } |
| | | |
| | | List<SysOutStoreItem> list = queryStore.getOutStoreItems(); |
| | | int flag = 0; |
| | | for (SysOutStoreItem item : list) { |
| | |
| | | import com.matrix.system.common.service.BusParameterSettingService; |
| | | import com.matrix.system.common.service.OperationLogService; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.enums.OperationButtonEnum; |
| | | import com.matrix.system.enums.OperationFunctionEnum; |
| | | import com.matrix.system.hive.bean.*; |
| | |
| | | |
| | | if (CollectionUtils.isNotEmpty(projServicesVo.getOutStoreItem())) { |
| | | BusParameterSettings manageStockSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WAREHOUSE_MANAGE_STOCK, projServicesVo.getCompanyId()); |
| | | if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) { |
| | | // if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) { |
| | | if (BooleanEnum.TRUE.getValue() == manageStockSetting.getIntParamValue()) { |
| | | for (SysOutStoreItem item : projServicesVo.getOutStoreItem()) { |
| | | if (item.getAmount() != null && item.getAmount() > 0) { |
| | | return true; |
| | |
| | | sysProjServicesDao.update(checkprojServices); |
| | | } |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(projServices.getCompanyId(), projServices.getShopId(),users.getSuId(), |
| | | // operationLogService.saveOperation(projServices.getCompanyId(), projServices.getShopId(),users.getSuId(), |
| | | // OperationFunctionEnum.SERVICE_ORDER, |
| | | // OperationButtonEnum.SERVICE_ORDER_END, |
| | | // projServices.getId(), |
| | | // projServices.getServiceNo(), |
| | | // projServices.getVipId()); |
| | | operationLogService.saveOperation(checkprojServices.getCompanyId(), checkprojServices.getShopId(),users.getSuId(), |
| | | OperationFunctionEnum.SERVICE_ORDER, |
| | | OperationButtonEnum.SERVICE_ORDER_END, |
| | | projServices.getId(), |
| | | projServices.getServiceNo(), |
| | | projServices.getVipId()); |
| | | checkprojServices.getId(), |
| | | checkprojServices.getServiceNo(), |
| | | checkprojServices.getVipId()); |
| | | return rerunlt; |
| | | } |
| | | |
| | |
| | | boolean flag = false; |
| | | if (CollUtil.isNotEmpty(settings)) { |
| | | for (ParameterSettings setting : settings) { |
| | | if (step.equals(setting.getCode()) && Dictionary.FLAG_YES.equals(setting.getUserValue())) { |
| | | // if (step.equals(setting.getCode()) && Dictionary.FLAG_YES.equals(setting.getUserValue())) { |
| | | // flag = true; |
| | | // break; |
| | | // } |
| | | if (step.equals(setting.getCode()) && BooleanEnum.TRUE.getValue() == Integer.parseInt(setting.getUserValue())) { |
| | | flag = true; |
| | | break; |
| | | } |
| | |
| | | return i; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int signService(SysProjServices services) { |
| | | SysProjServices projServices =findById(services.getId()); |
| | | projServices.setSignPic(services.getSignPic()); |
| | | return sysProjServicesDao.update(projServices); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.app.mapper.SysProjUseMapper; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | | import com.matrix.system.common.validate.GroupValidateStatusCheckUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.dto.ProjUseOperationDto; |
| | | import com.matrix.system.hive.hievEnum.OrderOperationEnum; |
| | | import com.matrix.system.hive.plugin.util.MoneyUtil; |
| | | import com.matrix.system.hive.service.ShoppingGoodsService; |
| | | import com.matrix.system.hive.service.SysBeauticianStateService; |
| | | import com.matrix.system.hive.service.SysProjServicesService; |
| | | import com.matrix.system.hive.service.SysProjUseService; |
| | | import com.matrix.system.hive.validation.ProjUseGroup; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @date 2016-07-03 20:53 |
| | |
| | | |
| | | @Autowired |
| | | private SysProjUseDao sysProjUseDao; |
| | | @Autowired |
| | | SysProjServicesService projServicesService; |
| | | |
| | | @Autowired |
| | | SysBeauticianStateService sysBeauticianStateService; |
| | | |
| | | @Autowired |
| | | private SysProjuseFreezeDao sysProjuseFreezeDao; |
| | |
| | | @Autowired |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Autowired |
| | | ShoppingGoodsService shoppingGoodsService; |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Autowired |
| | | SysUsersDao sysUsersDao; |
| | | |
| | | @Override |
| | | public int add(SysProjUse sysProjUse) { |
| | |
| | | @Override |
| | | public int modify(SysProjUse sysProjUse) { |
| | | //插入套餐项目操作记录 |
| | | |
| | | |
| | | |
| | | return sysProjUseDao.update(sysProjUse); |
| | |
| | | freeze.setVipId(taocan.getVipId()); |
| | | SysProjuseFreeze freezeProj = sysProjuseFreezeDao.selectByOrderItemId(freeze); |
| | | // todo 因为目前没有在冻结的时候插入冻结记录,所以这里暂时这样处理 |
| | | if(freezeProj!=null){ |
| | | if (freezeProj != null) { |
| | | Date dateAfter = DateUtil.nextNDate(taocan.getFailTime(), freezeProj.getGapDays()); |
| | | taocan.setFailTime(dateAfter); |
| | | } |
| | |
| | | taocan.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | sysProjUseDao.updateProjStatus(taocan); |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysProjUseFlow useFlow=new SysProjUseFlow(); |
| | | SysProjUseFlow useFlow = new SysProjUseFlow(); |
| | | useFlow.setProjName(taocan.getProjName()); |
| | | useFlow.setProjUseId(taocan.getId()); |
| | | useFlow.setOptionType("人工修改"); |
| | |
| | | } |
| | | |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysProjUseFlow useFlow=new SysProjUseFlow(); |
| | | SysProjUseFlow useFlow = new SysProjUseFlow(); |
| | | useFlow.setProjName(taocan.getProjName()); |
| | | useFlow.setProjUseId(taocan.getId()); |
| | | useFlow.setOptionType("人工修改"); |
| | |
| | | if (Dictionary.TAOCAN_SOURCE_QY.equals(projuse.getSource())) { |
| | | return; |
| | | } |
| | | if (projuse.getPlatformFlag().contains(Dictionary.SHOPPING_GOODS_SALE_PLATFORM_XX)) { |
| | | SysOrderItem orderItem = orderItemDao.selectById(projuse.getOrderItemId()); |
| | | if (!Dictionary.ORDER_STATU_YFK.equals(orderItem.getStatus())) { |
| | | throw new GlobleException("该商品存在欠款!"); |
| | | } |
| | | String orderStatus = orderItemDao.selectOrderStatusByItemId(projuse.getOrderItemId()); |
| | | if (!Dictionary.ORDER_STATU_YFK.equals(orderStatus)) { |
| | | throw new GlobleException(projuse.getProjName()+"的购买订单存在欠款!"); |
| | | } |
| | | } |
| | | |
| | |
| | | int i = sysProjUseDao.updateTcStatus(sysProjUse.getId(), "无效"); |
| | | |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysProjUseFlow useFlow=new SysProjUseFlow(); |
| | | SysProjUseFlow useFlow = new SysProjUseFlow(); |
| | | useFlow.setProjName(taocan.getProjName()); |
| | | useFlow.setProjUseId(taocan.getId()); |
| | | useFlow.setOptionType("人工修改"); |
| | |
| | | |
| | | return i; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /*********************以下为项目使用情况操作***********************/ |
| | |
| | | SysProjuseFreeze freeze = new SysProjuseFreeze(); |
| | | freeze.setFreezeTime(new Date()); |
| | | freeze.setVipId(sysProjUse.getVipId()); |
| | | freeze.setOrderItemId(sysProjUse.getId()+""); |
| | | freeze.setOrderItemId(sysProjUse.getId() + ""); |
| | | SysProjuseFreeze getfreeze = sysProjuseFreezeDao.selectByOrderItemId(freeze); |
| | | int i = 0; |
| | | if (getfreeze != null) { |
| | |
| | | i = sysProjuseFreezeDao.insert(freeze); |
| | | } |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysProjUseFlow useFlow=new SysProjUseFlow(); |
| | | SysProjUseFlow useFlow = new SysProjUseFlow(); |
| | | useFlow.setProjName(sysProjUse.getProjName()); |
| | | useFlow.setProjUseId(sysProjUse.getId()); |
| | | useFlow.setOptionType("人工修改"); |
| | |
| | | sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX); |
| | | |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysProjUseFlow useFlow=new SysProjUseFlow(); |
| | | SysProjUseFlow useFlow = new SysProjUseFlow(); |
| | | useFlow.setProjName(sysProjUse.getProjName()); |
| | | useFlow.setProjUseId(sysProjUse.getId()); |
| | | useFlow.setOptionType("人工修改"); |
| | |
| | | sysProjUseDao.insertFlow(useFlow); |
| | | return sysProjUseDao.update(sysProjUse); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | sysProjUseDao.update(proj); |
| | | |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysProjUseFlow useFlow=new SysProjUseFlow(); |
| | | SysProjUseFlow useFlow = new SysProjUseFlow(); |
| | | useFlow.setProjName(proj.getProjName()); |
| | | useFlow.setProjUseId(proj.getId()); |
| | | useFlow.setOptionType("人工修改"); |
| | |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "操作成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 项目套餐退款 |
| | | * @param projUseDtoList |
| | | */ |
| | | @Override |
| | | public void projectTk(List<ProjUseOperationDto> projUseDtoList) { |
| | | |
| | | List<ShoppingGoods> shoppingGoodsList = shoppingGoodsDao.selectByIds(projUseDtoList.stream().map(ProjUseOperationDto::getGoodsId).collect(Collectors.toList())); |
| | | Map<Long, ShoppingGoods> shoppingGoodsMap = shoppingGoodsList.stream().collect(Collectors.toMap(ShoppingGoods::getId, Function.identity())); |
| | | |
| | | |
| | | projUseDtoList.forEach(projUseOperationDto -> { |
| | | //校验参数 |
| | | GroupValidateStatusCheckUtil.check(projUseOperationDto, ProjUseGroup.projectTk.class); |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsMap.get(projUseOperationDto.getGoodsId()); |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(shoppingGoods.getGoodType())) { |
| | | |
| | | doProjectTk(projUseOperationDto); |
| | | |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(shoppingGoods.getGoodType())) { |
| | | |
| | | taocanTk(projUseOperationDto); |
| | | } |
| | | |
| | | |
| | | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 套餐退款 |
| | | * @param projUseOperationDto |
| | | */ |
| | | private void taocanTk(ProjUseOperationDto projUseOperationDto) { |
| | | |
| | | List<SysProjUse> projUseList = sysProjUseDao.selectByOrderItemId(projUseOperationDto.getOrderItemId()); |
| | | |
| | | List<SysProjUse> tcList = projUseList.stream().filter(item -> Objects.isNull(item.getTaocanId()) && item.getStatus().equals(Dictionary.TAOCAN_STATUS_YX) ).collect(Collectors.toList()); |
| | | |
| | | if (tcList.size() < projUseOperationDto.getCount()) { |
| | | throw new GlobleException("套餐余次不足"); |
| | | } |
| | | projUseOperationDto.setOrderOperationType(OrderOperationEnum.RETURN); |
| | | for (int i = 0; i < projUseOperationDto.getCount(); i++) { |
| | | SysProjUse sysProjUse = tcList.get(i); |
| | | setTaocanTk(sysProjUse,projUseOperationDto); |
| | | //设置套餐下的项目无效 |
| | | projUseList.stream().filter(item->Objects.equals(sysProjUse.getId(),item.getTaocanId())).collect(Collectors.toList()) |
| | | .forEach(item-> setTaocanTk(item,projUseOperationDto)); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void setTaocanTk(SysProjUse sysProjUse, ProjUseOperationDto projUseOperationDto) { |
| | | sysProjUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_TK); |
| | | sysProjUse.setSurplusCount(0); |
| | | sysProjUseDao.update(sysProjUse); |
| | | saveProjUseFlow(projUseOperationDto,sysProjUse); |
| | | } |
| | | |
| | | /** |
| | | * 项目退款 |
| | | * @param projUseOperationDto |
| | | */ |
| | | private void doProjectTk(ProjUseOperationDto projUseOperationDto) { |
| | | |
| | | List<SysProjUse> projUseList = sysProjUseDao.selectByOrderItemId(projUseOperationDto.getOrderItemId()); |
| | | if(projUseList.size()==1){ |
| | | SysProjUse sysProjUse = projUseList.get(0); |
| | | int sub = sysProjUse.getSurplusCount() - projUseOperationDto.getCount(); |
| | | if (sub < 0) { |
| | | throw new GlobleException("项目余次不足"); |
| | | } else if (sub == 0) { |
| | | sysProjUse.setIsOver(Dictionary.FLAG_YES_Y); |
| | | sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_TK); |
| | | } |
| | | sysProjUse.setSurplusCount(sub); |
| | | sysProjUseDao.update(sysProjUse); |
| | | projUseOperationDto.setOrderOperationType(OrderOperationEnum.RETURN); |
| | | //保存操作流水 |
| | | saveProjUseFlow(projUseOperationDto,sysProjUse); |
| | | }else{ |
| | | throw new GlobleException("查询项目余次异常"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存项目操作流水 |
| | | * @param projUseOperationDto |
| | | * @param sysProjUse |
| | | */ |
| | | private void saveProjUseFlow(ProjUseOperationDto projUseOperationDto, SysProjUse sysProjUse) { |
| | | SysProjUseFlow sysProjUseFlow = SysProjUseMapper.INSTANCE.projUseToFlow(sysProjUse); |
| | | sysProjUseFlow.setOptionType(projUseOperationDto.getOrderOperationType().getDisplayName()); |
| | | SysUsers user = sysUsersDao.selectById(projUseOperationDto.getUpdateUserId()); |
| | | sysProjUseFlow.setUpdateBy(user.getSuName()); |
| | | sysProjUseFlow.setCreateBy(user.getSuName()); |
| | | sysProjUseDao.insertFlow(sysProjUseFlow); |
| | | } |
| | | |
| | | /** |
| | | * 添加用户套餐 |
| | | * |
| | | * @param projUseDtoList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public void addUserProjUse(List<ProjUseOperationDto> projUseDtoList) { |
| | | |
| | | if(CollUtil.isEmpty(projUseDtoList)){ |
| | | throw new GlobleException("projUseDtoList 不能为空"); |
| | | } |
| | | |
| | | List<ShoppingGoods> shoppingGoodsList = shoppingGoodsDao.selectByIds(projUseDtoList.stream().map(ProjUseOperationDto::getGoodsId).collect(Collectors.toList())); |
| | | Map<Long, ShoppingGoods> shoppingGoodsMap = shoppingGoodsList.stream().collect(Collectors.toMap(ShoppingGoods::getId, Function.identity())); |
| | | |
| | | for (ProjUseOperationDto projUseOperationDto : projUseDtoList) { |
| | | |
| | | ShoppingGoods shoppingGoods = shoppingGoodsMap.get(projUseOperationDto.getGoodsId()); |
| | | if (Dictionary.SHOPPING_GOODS_TYPE_XM.equals(shoppingGoods.getGoodType())) { |
| | | createProjectUse(projUseOperationDto, shoppingGoods); |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(shoppingGoods.getGoodType())) { |
| | | //每个套餐独立生成一个明细 |
| | | int orderCount = projUseOperationDto.getCount(); |
| | | while (orderCount > 0) { |
| | | createTaocanProjUse(projUseOperationDto, shoppingGoods); |
| | | orderCount--; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | private void createTaocanProjUse(ProjUseOperationDto projUseOperationDto, ShoppingGoods shoppingGoods) { |
| | | |
| | | GroupValidateStatusCheckUtil.check(projUseOperationDto,ProjUseGroup.addTc.class); |
| | | |
| | | //新建套餐 |
| | | SysProjUse taocanProjUse = new SysProjUse(); |
| | | |
| | | ShoppingGoods taocanShoppingGoods = shoppingGoods; |
| | | |
| | | Long projId = shoppingGoods.getId(); |
| | | |
| | | taocanProjUse.setProjId(projId); |
| | | taocanProjUse.setIsOver(Dictionary.DELETED_N); |
| | | taocanProjUse.setOrderItemId(projUseOperationDto.getOrderItemId()); |
| | | |
| | | taocanProjUse.setProjName(taocanShoppingGoods.getName()); |
| | | taocanProjUse.setVipId(projUseOperationDto.getVipId()); |
| | | taocanProjUse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | taocanProjUse.setType(Dictionary.SHOPPING_GOODS_TYPE_TC); |
| | | taocanProjUse.setIsCourse(taocanShoppingGoods.getIsCourse()); |
| | | taocanProjUse.setIsInfinite(taocanShoppingGoods.getIsInfinite()); |
| | | // 赠送和打折后金额为0的都视为赠送项目 |
| | | if (projUseOperationDto.isFree()) { |
| | | taocanProjUse.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | | } else { |
| | | taocanProjUse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | } |
| | | // 失效时间 |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(taocanShoppingGoods, 1, null); |
| | | taocanProjUse.setFailTime(invalidTime); |
| | | sysProjUseDao.insert(taocanProjUse); |
| | | //计划次数 |
| | | int surplusCount = 0; |
| | | //总余额 |
| | | Double sumBanance = 0D; |
| | | //创建套餐绑定的项目 |
| | | List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(projId, ShoppingGoods.SHOPPING_GOODS_TYPE_XM); |
| | | for (ShoppingGoodsAssemble assemble : assembleList) { |
| | | ProjUseOperationDto projUseDto = new ProjUseOperationDto(); |
| | | projUseDto.setCount(assemble.getTotal()); |
| | | projUseDto.setGoodsId(assemble.getShoppingGoodsId()); |
| | | projUseDto.setFree(projUseOperationDto.isFree()); |
| | | projUseDto.setPayMoney(MoneyUtil.mul(assemble.getPrice(), projUseOperationDto.getTcZk())); |
| | | projUseDto.setOrderItemId(projUseOperationDto.getOrderItemId()); |
| | | projUseDto.setVipId(projUseOperationDto.getVipId()); |
| | | projUseDto.setTcId(taocanProjUse.getId()); |
| | | projUseDto.setUpdateUserId(projUseOperationDto.getUpdateUserId()); |
| | | projUseDto.setDeductionNum(assemble.getDeductionNum()); |
| | | SysProjUse tempUse = createProjectUse(projUseDto, assemble.getShoppingGoods()); |
| | | sumBanance += tempUse.getBalance(); |
| | | surplusCount += tempUse.getSurplusCount(); |
| | | } |
| | | if (Dictionary.FLAG_NO_N.equals(taocanShoppingGoods.getIsCourse())) { |
| | | //固定套餐,剩余次数等于绑定项目的次数 |
| | | taocanProjUse.setSurplusCount(surplusCount); |
| | | //合计套餐余额 |
| | | taocanProjUse.setBalance(sumBanance); |
| | | } else { |
| | | //任选套餐剩余次数等于最大使用次数 |
| | | taocanProjUse.setSurplusCount(taocanShoppingGoods.getCarUseCount()); |
| | | taocanProjUse.setBalance(projUseOperationDto.getPayMoney()); |
| | | } |
| | | |
| | | sysProjUseDao.update(taocanProjUse); |
| | | } |
| | | |
| | | private SysProjUse createProjectUse(ProjUseOperationDto projUseOperationDto, ShoppingGoods shoppingGoods) { |
| | | |
| | | GroupValidateStatusCheckUtil.check(projUseOperationDto,ProjUseGroup.addProject.class); |
| | | |
| | | SysProjUse puse = new SysProjUse(); |
| | | puse.setIsOver(Dictionary.DELETED_N); |
| | | puse.setOrderItemId(projUseOperationDto.getOrderItemId()); |
| | | puse.setProjId(projUseOperationDto.getGoodsId()); |
| | | puse.setSurplusCount(projUseOperationDto.getCount()); |
| | | puse.setVipId(projUseOperationDto.getVipId()); |
| | | puse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | puse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | puse.setProjName(shoppingGoods.getName()); |
| | | puse.setTaocanId(projUseOperationDto.getTcId()); |
| | | puse.setDeductionNum(projUseOperationDto.getDeductionNum()); |
| | | // 赠送和打折后金额为0的都视为赠送项目 |
| | | if (!projUseOperationDto.isFree()) { |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | puse.setPrice(projUseOperationDto.getPayMoney()); |
| | | } else { |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | | //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗 |
| | | boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE); |
| | | if (zsConsumeAchieve) { |
| | | //赠送情况下,如果收款金额大于0,就是赠送金额划扣的情况,金额即为划扣的折扣金额 |
| | | if (projUseOperationDto.getPayMoney() > 0) { |
| | | puse.setPrice(projUseOperationDto.getPayMoney()); |
| | | } else { |
| | | puse.setPrice(shoppingGoods.getSealPice()); |
| | | } |
| | | } else { |
| | | puse.setPrice(0D); |
| | | } |
| | | } |
| | | |
| | | // 设置失效时间 |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 1, null); |
| | | puse.setFailTime(invalidTime); |
| | | puse.setBalance(puse.getPrice() * puse.getSurplusCount()); |
| | | sysProjUseDao.insert(puse); |
| | | return puse; |
| | | } |
| | | |
| | | |
| | | @Override |
| | |
| | | public int findTaocanCountForCourseAndInfinite(Long taocanId, Long vipId) { |
| | | return sysProjUseDao.selectTaocanCountForCourseAndInfinite(taocanId, vipId); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByOrderItemId(Long id) { |
| | | int count=sysProjUseDao.selectUseCountByOrderItemId(id); |
| | | if(count>0){ |
| | | SysProjUse query=new SysProjUse(); |
| | | query.setOrderItemId(id); |
| | | List<SysProjUse> sysProjUses = sysProjUseDao.selectByModel(query); |
| | | if(sysProjUses.size()>1){ |
| | | throw new GlobleException(sysProjUses.get(0).getProjName()+"套餐已经被使用无法删除"); |
| | | }else { |
| | | throw new GlobleException(sysProjUses.get(0).getProjName()+"项目已经被使用无法删除"); |
| | | } |
| | | }else { |
| | | sysProjUseDao.deleteByOrderItemId(id); |
| | | } |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private SysOrderDao sysOrderDao; |
| | | |
| | | @Override |
| | | public void updateDealStatus(Long vipId, int isDeal) { |
| | | SysVipInfo vipInfo = new SysVipInfo(); |
| | | vipInfo.setIsDeal(isDeal); |
| | | vipInfo.setIsDeal(SysVipInfo.DEAL_VIP); |
| | | sysVipInfoDao.update(vipInfo); |
| | | } |
| | | |
| | | /** |
| | | * 新增会员储值卡 |
| | |
| | | }else{ |
| | | sysVipInfo.setPhoto(defaultWoman); |
| | | } |
| | | sysVipInfo.setIsDelete(Dictionary.DELETED_N); |
| | | int i=sysVipInfoDao.insert(sysVipInfo); |
| | | //创建用户默认储值卡 |
| | | addVipDefaultCard(sysVipInfo.getId()); |
| | |
| | | @Override |
| | | public int remove(List<Long> list) { |
| | | |
| | | return sysVipInfoDao.deleteByIds(list); |
| | | return sysVipInfoDao.deleteLogicByIds(list); |
| | | |
| | | } |
| | | |
| | |
| | | @Override |
| | | public int removeById(Long id) { |
| | | |
| | | return sysVipInfoDao.deleteById(id); |
| | | return sysVipInfoDao.deleteLogicByIds(Arrays.asList(id)); |
| | | |
| | | } |
| | | |
| | |
| | | }else{ |
| | | sysVipInfo.setPhoto(defaultWoman); |
| | | } |
| | | sysVipInfo.setIsDelete(Dictionary.DELETED_N); |
| | | int i=sysVipInfoDao.insert(sysVipInfo); |
| | | modifyVipWithOtherInfo(sysVipInfo); |
| | | return i; |
| | |
| | | }else{ |
| | | vipInfo.setPhoto(defaultWoman); |
| | | } |
| | | vipInfo.setIsDelete(Dictionary.DELETED_N); |
| | | int i=sysVipInfoDao.insert(vipInfo); |
| | | |
| | | if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) { |
| | |
| | | public Integer findVipArrearsStatisticsTotal(SysVipInfo sysVipInfo) { |
| | | return sysVipInfoDao.selectVipArrearsStatisticsTotal(sysVipInfo); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.hive.validation; |
| | | |
| | | public interface MoneyCardUseGroup { |
| | | |
| | | |
| | | /** |
| | | * 退款 |
| | | */ |
| | | interface moneyCardUseTk { |
| | | } |
| | | |
| | | /** |
| | | * 充值 |
| | | */ |
| | | interface moneyCardUseCz { |
| | | } |
| | | |
| | | /** |
| | | * 订单修改金额 |
| | | */ |
| | | interface moneyCardUseOrderChange { |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.hive.validation; |
| | | |
| | | public interface ProjUseGroup { |
| | | |
| | | /** |
| | | * 新增会员项目 |
| | | */ |
| | | interface addProject { |
| | | } |
| | | |
| | | /** |
| | | * 新增会员套餐 |
| | | */ |
| | | interface addTc { |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 退款扣减次数 |
| | | */ |
| | | interface projectTk { |
| | | } |
| | | |
| | | /** |
| | | * 套餐退款 |
| | | */ |
| | | interface taocanTk { |
| | | } |
| | | |
| | | } |
| | |
| | | shoppingGoods.setAssembleGoods(assembleListGoods); |
| | | List<ShoppingGoodsAssemble> assembleListProj = shoppingGoodsAssembleDao.selectProjByShoppingGoodsId(shoppingGoods.getId()); |
| | | shoppingGoods.setAssembleProj(assembleListProj); |
| | | } else if (Dictionary.SHOPPING_GOODS_TYPE_ZHK.equals(shoppingGoods.getGoodType())) { |
| | | List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectAssembleShoppingGoodsByShoppingGoodsId(shoppingGoods.getId()); |
| | | shoppingGoods.setZongheCarGoods(assembleList); |
| | | } |
| | | |
| | | |
| | |
| | | // 返回充值卡编辑界面 |
| | | WebUtil.getRequest().setAttribute("obj", shoppingGoods); |
| | | return "admin/hive-erp/products/money-card-form"; |
| | | } else if (shoppingGoods.getGoodType().equals(Dictionary.SHOPPING_GOODS_TYPE_ZHK)) { |
| | | WebUtil.getRequest().setAttribute("obj", shoppingGoods); |
| | | return "admin/hive-erp/products/zonghe-card-form"; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.matrix.system.padApi.action; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.*; |
| | | 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.dao.SysCompanyDao; |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | | import com.matrix.system.common.init.LocalCache; |
| | | import com.matrix.system.common.service.SysUsersService; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.bean.SysBeauticianState; |
| | | import com.matrix.system.hive.bean.SysBedInfo; |
| | | import com.matrix.system.hive.bean.SysProjServices; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.dao.SysBedInfoDao; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.service.SysBedInfoService; |
| | | import com.matrix.system.hive.service.SysOrderService; |
| | | import com.matrix.system.hive.service.SysShopInfoService; |
| | | import com.matrix.system.hive.service.SysWorktimeService; |
| | | import com.matrix.system.padApi.dto.Base64UploadDto; |
| | | import com.matrix.system.padApi.dto.PadOrderListDto; |
| | | import com.matrix.system.padApi.dto.WebPadLoginDto; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.apache.log4j.Logger; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.util.FileCopyUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import sun.misc.BASE64Decoder; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @CrossOrigin(origins = "*") |
| | | @Api(value = "PadApiCommonAction", tags = "pad端公共请求类(含登陆)") |
| | | @RestController |
| | | @RequestMapping(value = "/api/common/pad") |
| | | public class PadApiCommonAction extends BaseController { |
| | | |
| | | @Autowired |
| | | private SysUsersService sysUsersService; |
| | | |
| | | @Autowired |
| | | private DefaultAuthorityManager authorityManager; |
| | | |
| | | @Autowired |
| | | SysShopInfoDao sysShopInfoDao; |
| | | |
| | | @Autowired |
| | | SysCompanyDao sysCompanyDao; |
| | | |
| | | @Autowired |
| | | private SysShopInfoService sysShopInfoService; |
| | | |
| | | @Resource |
| | | private SysOrderService sysOrderService; |
| | | |
| | | @Resource |
| | | private SysBedInfoService bedInfoService; |
| | | |
| | | @Resource |
| | | private SysWorktimeService sysWorkTimeService; |
| | | |
| | | @Resource |
| | | private SysUsersService usersService; |
| | | |
| | | @Autowired |
| | | private SysBedInfoDao sysBedInfoDao; |
| | | |
| | | @Value("${login_public_key}") |
| | | private String publicKey; |
| | | @Autowired |
| | | private SysUsersDao sysUsersDao; |
| | | |
| | | |
| | | Logger log = Logger.getLogger(PadApiCommonAction.class); |
| | | |
| | | @Value("${file_storage_path}") |
| | | private String fileStoragePath; |
| | | @Value("${static_resource_url}") |
| | | private String nginxUrl; |
| | | |
| | | /** |
| | | * 最大值 |
| | | */ |
| | | private Long maxSize = 1024*1024*100L; |
| | | |
| | | @ApiOperation(value = "登陆接口", notes = "pad端登陆接口") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "OK", response = UserInfoVo.class) |
| | | }) |
| | | @PostMapping(value = "/login") |
| | | public AjaxResult dologin(@RequestBody @Validated WebPadLoginDto loginDto) throws Exception { |
| | | |
| | | SysUsers user = new SysUsers(); |
| | | user.setSuAccount(loginDto.getUsername()); |
| | | user.setSuPassword(loginDto.getPassword()); |
| | | LoginStrategy apLogin = new AccountPasswordLogin(user, sysUsersService); |
| | | user = authorityManager.login(apLogin); |
| | | |
| | | UserInfoVo userInfoVo = new UserInfoVo(); |
| | | if(user.getShopId()!=null){ |
| | | SysShopInfo shopInfo = sysShopInfoService.findById(user.getShopId()); |
| | | user.setShopName(shopInfo.getShopName()); |
| | | userInfoVo.setShopName(shopInfo.getShopShortName()); |
| | | } |
| | | user.setSuPassword(null); |
| | | |
| | | String token = UUIDUtil.getRandomID(); |
| | | LocalCache.save(token, user); |
| | | |
| | | userInfoVo.setId(user.getSuId()); |
| | | userInfoVo.setName(user.getSuName()); |
| | | userInfoVo.setRoleName(user.getRoleName()); |
| | | userInfoVo.setPhoto(user.getSuPhoto()); |
| | | |
| | | String sb = token + "_1" + "_/api/vip/findVipInfoById/972"; |
| | | AjaxResult result = AjaxResult.buildSuccessInstance("登陆成功"); |
| | | authorityManager.initUserPower(result); |
| | | result.putInMap("user", userInfoVo); |
| | | result.putInMap("token", token); |
| | | result.putInMap("rasToken", RSAUtils.encryptByPublicKey(sb, publicKey)); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "首页", notes = "首页") |
| | | @GetMapping(value = "/frist/{suId}") |
| | | public AjaxResult frist(@PathVariable Long suId) { |
| | | SysUsers user = usersService.findById(suId); |
| | | LogUtil.info("首页 shopId={}", user.getShopId()); |
| | | // SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | PadOrderListDto orderListDto = new PadOrderListDto(); |
| | | orderListDto.setPageNum(1); |
| | | orderListDto.setPageSize(5); |
| | | int offset = (orderListDto.getPageNum() - 1) * orderListDto.getPageSize(); |
| | | int limit = orderListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | if(ObjectUtil.isNotEmpty(user.getShopId())){ |
| | | orderListDto.setShopId(user.getShopId()); |
| | | } |
| | | // if (!DataAuthUtil.hasAllShopAuth()) { |
| | | // orderListDto.setShopId(user.getShopId()); |
| | | // } |
| | | |
| | | if(ObjectUtil.isNotEmpty(user.getCompanyId())){ |
| | | orderListDto.setCompanyId(user.getCompanyId()); |
| | | } |
| | | // QueryUtil.setQueryLimitCom(orderListDto); |
| | | List<PadOrderDetailVo> padApiOrderListInPage = sysOrderService.findPadApiOrderListInPage(orderListDto, pageVo); |
| | | |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | result.putInMap("orderList",padApiOrderListInPage); |
| | | |
| | | Date date = new Date(); |
| | | SysUsers shopstaffInfo = new SysUsers(); |
| | | shopstaffInfo.setCompanyId(user.getCompanyId()); |
| | | shopstaffInfo.setShopId(user.getShopId()); |
| | | shopstaffInfo.setRoleName(Dictionary.STAFF_POST_MLS); |
| | | List<SysUsers> mls = sysUsersDao.selectByRoleName(shopstaffInfo); |
| | | LogUtil.info("美疗师 size={}", mls.size()); |
| | | // List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS); |
| | | if(CollUtil.isNotEmpty(mls)){ |
| | | SysBeauticianState sysBeauticianState = new SysBeauticianState(); |
| | | sysBeauticianState.setBeginTime(DateUtil.getStartDate(date)); |
| | | sysBeauticianState.setEndTime(DateUtil.getStartDate(date)); |
| | | String panBanCodes = DateUtil.dateToString(sysBeauticianState.getBeginTime(),DateUtil.DATE_FORMAT_NO_SPLITE_DD); |
| | | List<SysUsers> staffs=new ArrayList<>(); |
| | | // if(sysWorkTimeService.isInWorkTime(user.getShopId(),sysBeauticianState.getBeginTime(),sysBeauticianState.getEndTime())){ |
| | | staffs= sysUsersService.findByCodeBeaStateShop(user.getShopId(), |
| | | sysBeauticianState, panBanCodes); |
| | | if(CollUtil.isNotEmpty(staffs)){ |
| | | result.putInMap("usedMls", mls.size() - staffs.size()); |
| | | result.putInMap("freeMls", staffs.size()); |
| | | }else{ |
| | | result.putInMap("usedMls", mls.size()); |
| | | result.putInMap("freeMls", 0); |
| | | } |
| | | // } |
| | | } |
| | | |
| | | SysBedInfo bedInfo = new SysBedInfo(); |
| | | bedInfo.setShopId(user.getShopId()); |
| | | List<SysBedInfo> totalBed = bedInfoService.findByModel(bedInfo); |
| | | if(CollUtil.isNotEmpty(totalBed)){ |
| | | SysProjServices sysProjServices = new SysProjServices(); |
| | | sysProjServices.setShopId(user.getShopId()); |
| | | |
| | | sysProjServices.setStartTime(DateUtil.getStartDate(date)); |
| | | sysProjServices.setEndTime(DateUtil.getStartDate(date)); |
| | | List<SysBedInfo> freeBed = sysBedInfoDao.findFreeBed(sysProjServices); |
| | | // List<SysBedInfo> freeBed = bedInfoService.findFreeBed(sysProjServices); |
| | | if(CollUtil.isNotEmpty(freeBed)){ |
| | | result.putInMap("usedBed", totalBed.size() - freeBed.size()); |
| | | result.putInMap("freeBed", freeBed); |
| | | }else{ |
| | | result.putInMap("usedBed", totalBed); |
| | | result.putInMap("freeBed", 0); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "用户退出系统", notes = "用户退出系统") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = AjaxResult.class) |
| | | }) |
| | | @GetMapping(value = "/loginOut") |
| | | public AjaxResult loginOut() { |
| | | authorityManager.getLoginOut(); |
| | | return AjaxResult.buildSuccessInstance("退出系统成功"); |
| | | } |
| | | |
| | | /** |
| | | * 文件上传方法 |
| | | */ |
| | | @ApiOperation(value = "文件上传方法", notes = "文件上传方法") |
| | | @PostMapping(value = "/doUpload") |
| | | public AjaxResult doFileUpload(@RequestBody @Validated Base64UploadDto uploadDto){ |
| | | // 文件保存目录路径 |
| | | String savePath = fileStoragePath; |
| | | // 文件保存目录URL |
| | | String saveUrl = nginxUrl; |
| | | // 保存和访问路径检查 |
| | | if (StringUtils.isBlank(saveUrl) || StringUtils.isBlank(savePath)) { |
| | | return AjaxResult.buildFailInstance("文件上传失败错误代码:001"); |
| | | } |
| | | // 检查目录 |
| | | File uploadDir = new File(savePath); |
| | | if (!uploadDir.isDirectory()) { |
| | | uploadDir.mkdir(); |
| | | } |
| | | log.info("uploadDto:" + uploadDto.getBase64Str()); |
| | | BASE64Decoder decoder = new BASE64Decoder(); |
| | | byte[] bytes = new byte[0]; |
| | | try { |
| | | bytes = decoder.decodeBuffer(uploadDto.getBase64Str()); |
| | | } catch (IOException e) { |
| | | return AjaxResult.buildFailInstance("上传文件失败"); |
| | | } |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | String ymd = sdf.format(new Date()); |
| | | savePath += ymd + "/"; |
| | | saveUrl += ymd + "/"; |
| | | File dirFile = new File(savePath); |
| | | if (!dirFile.exists()) { |
| | | dirFile.mkdirs(); |
| | | } |
| | | if (bytes.length > maxSize) { |
| | | return AjaxResult.buildFailInstance("上传文件大小超过限制"); |
| | | } |
| | | String newFileName = UUIDUtil.getRandomID() + UUIDUtil.getRandomID() + ".png"; |
| | | File uploadedFile = new File(savePath, newFileName); |
| | | try { |
| | | FileCopyUtils.copy(bytes, uploadedFile); |
| | | } catch (Exception e) { |
| | | return AjaxResult.buildFailInstance("上传文件失败"); |
| | | } |
| | | log.info("saveUrl:" + saveUrl); |
| | | String visitPath = saveUrl + newFileName; |
| | | log.info("上传一个文件:" + newFileName); |
| | | log.info("访问路径:" + visitPath); |
| | | |
| | | AjaxResult result = AjaxResult.buildSuccessInstance("上传成功"); |
| | | result.putInMap("path", visitPath); |
| | | result.putInMap("fileName", newFileName); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.action; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.ShoppingGoods; |
| | | import com.matrix.system.hive.bean.SysGoodsType; |
| | | import com.matrix.system.hive.bean.SysStoreInfo; |
| | | import com.matrix.system.hive.dao.SysStoreInfoDao; |
| | | import com.matrix.system.hive.service.SysGoodsTypeService; |
| | | import com.matrix.system.padApi.dto.PadKucunListDto; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @CrossOrigin(origins = "*") |
| | | @Api(value = "PadKucunAction", tags = "pad端库存请求") |
| | | @RestController |
| | | @RequestMapping(value = "/api/pad/kucun") |
| | | public class PadKucunAction extends BaseController { |
| | | |
| | | @Resource |
| | | private SysGoodsTypeService currentService; |
| | | |
| | | @Resource |
| | | private SysStoreInfoDao sysStoreInfoDao; |
| | | |
| | | @ApiOperation(value = "显示所有分类列表", notes = "显示所有分类列表") |
| | | @PostMapping(value = "/all") |
| | | public AjaxResult all() { |
| | | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysGoodsType sysGoodsType = new SysGoodsType(); |
| | | sysGoodsType.setCompanyId(users.getCompanyId()); |
| | | List<SysGoodsType> list=currentService.findByModel(sysGoodsType); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, currentService.findByModel(sysGoodsType), 0); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "显示库存列表", notes = "显示库存列表") |
| | | @PostMapping(value = "/showCountList") |
| | | public AjaxResult showCountList(@RequestBody @Validated PadKucunListDto padKucunListDto) { |
| | | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysStoreInfo sysStoreInfo = new SysStoreInfo(); |
| | | sysStoreInfo.setShopId(users.getShopId()); |
| | | sysStoreInfo.setCompanyId(users.getCompanyId()); |
| | | |
| | | int offset = (padKucunListDto.getPageNum() - 1) * padKucunListDto.getPageSize(); |
| | | int limit = padKucunListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | if(StrUtil.isNotEmpty(padKucunListDto.getQueryKey())){ |
| | | sysStoreInfo.setQueryKey(padKucunListDto.getQueryKey()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(padKucunListDto.getGoodsSortId())){ |
| | | ShoppingGoods shoppingGoods = new ShoppingGoods(); |
| | | shoppingGoods.setGoodsSortId(padKucunListDto.getGoodsSortId()); |
| | | sysStoreInfo.setGoods(shoppingGoods); |
| | | } |
| | | |
| | | if (!DataAuthUtil.hasAllShopAuth()) { |
| | | padKucunListDto.setShopId(users.getShopId()); |
| | | } |
| | | QueryUtil.setQueryLimitCom(padKucunListDto); |
| | | |
| | | List<SysStoreInfo> dataList = sysStoreInfoDao.selectCountInPage(sysStoreInfo, pageVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, sysStoreInfoDao.selectCountTotalRecord(sysStoreInfo)); |
| | | return result; |
| | | } |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.action; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.matrix.component.asyncmessage.AsyncMessageManager; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.app.vo.OrderDetailVo; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.CustomerDataDictionary; |
| | | 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.dao.CustomerDataDictionaryDao; |
| | | import com.matrix.system.common.service.SysUsersService; |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.ShoppingGoodsDao; |
| | | import com.matrix.system.hive.dao.SysOrderItemDao; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.padApi.dto.PadOrderListDto; |
| | | import com.matrix.system.padApi.dto.PadShowListDto; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailVo; |
| | | import com.matrix.system.shopXcx.mqTask.AsyncMessageRouting; |
| | | import com.matrix.system.wechart.templateMsg.UniformMsgParam; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @CrossOrigin(origins = "*") |
| | | @Api(value = "PadOrderAction", tags = "pad端订单请求") |
| | | @RestController |
| | | @RequestMapping(value = "/api/pad/order") |
| | | public class PadOrderAction extends BaseController { |
| | | |
| | | @Resource |
| | | private SysOrderService sysOrderService; |
| | | @Resource |
| | | private SysOrderService orderService; |
| | | @Autowired |
| | | private BusParameterSettingsDao busParameterSettingsDao; |
| | | @Autowired |
| | | private SysOrderItemDao orderItemDao; |
| | | @Autowired |
| | | private SysUsersService sysUsersService; |
| | | @Autowired |
| | | private CustomerDataDictionaryDao dataDictionaryDao; |
| | | @Resource |
| | | private SysShopInfoService currentService; |
| | | @Resource |
| | | private MoneyCardUseService cardUseService; |
| | | @Autowired |
| | | private AsyncMessageManager asyncMessageManager; |
| | | @Resource |
| | | private SysShopInfoDao shopInfoDao; |
| | | @Resource |
| | | private ShoppingGoodsService shoppingGoodsService; |
| | | |
| | | @ApiOperation(value = "获取订单列表", notes = "获取订单列表") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = PadOrderDetailVo.class) |
| | | }) |
| | | @PostMapping(value = "/findOrderList") |
| | | public AjaxResult findOrderList(@RequestBody @Validated PadOrderListDto orderListDto) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | int offset = (orderListDto.getPageNum() - 1) * orderListDto.getPageSize(); |
| | | int limit = orderListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | //默认排序 |
| | | if (StringUtils.isBlank(pageVo.getSort())) { |
| | | pageVo.setSort("order_time"); |
| | | } |
| | | if (StringUtils.isBlank(pageVo.getOrder())) { |
| | | pageVo.setOrder("desc"); |
| | | } |
| | | if (!DataAuthUtil.hasAllShopAuth()) { |
| | | orderListDto.setShopId(getMe().getShopId()); |
| | | } |
| | | QueryUtil.setQueryLimitCom(orderListDto); |
| | | |
| | | SysOrder sysOrder = new SysOrder(); |
| | | sysOrder.setShopId(orderListDto.getShopId()); |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getOrderStatus())){ |
| | | sysOrder.setStatu(orderListDto.getStatus()); |
| | | } |
| | | |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getBeginTimeVo())){ |
| | | sysOrder.setBeginTimeVo(orderListDto.getBeginTimeVo()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getEndTimeVo())){ |
| | | sysOrder.setEndTimeVo(orderListDto.getEndTimeVo()); |
| | | } |
| | | |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getVipId())){ |
| | | sysOrder.setVipId(orderListDto.getVipId()); |
| | | } |
| | | if(StrUtil.isNotEmpty(orderListDto.getQueryKey())){ |
| | | sysOrder.setKeyWordVo(orderListDto.getQueryKey()); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, orderService.findInPage(sysOrder, pageVo), |
| | | orderService.findTotal(sysOrder)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取订单详情", notes = "获取订单详情") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = OrderDetailVo.class) |
| | | }) |
| | | @GetMapping(value = "/findOrderDetail/{orderId}") |
| | | public AjaxResult findOrderDetail(@PathVariable("orderId") Long orderId) { |
| | | OrderDetailVo orderDetail = sysOrderService.findApiOrderDetailByOrderId(orderId); |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功"); |
| | | ajaxResult.putInMap("orderDetail", orderDetail); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | @ApiOperation(value = "取消订单", notes = "取消订单") |
| | | @GetMapping(value = "/cancelOrder/{id}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult cancelOrder(@PathVariable Long id) { |
| | | |
| | | SysOrder order = orderService.findById(id); |
| | | if (ObjectUtil.isEmpty(order)) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "订单不存在!"); |
| | | } |
| | | |
| | | BusParameterSettings shopManageAbleCancelDfkOrder = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_ABLE_CANCEL_DFK_ORDER, order.getCompanyId()); |
| | | if (StringUtils.isNotBlank(shopManageAbleCancelDfkOrder.getParamValue()) |
| | | && BooleanEnum.TRUE.getValue() == shopManageAbleCancelDfkOrder.getIntParamValue()) { |
| | | |
| | | if (!Dictionary.ORDER_STATU_DFK.equals(order.getStatu())) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "您只能取消待付款订单"); |
| | | } |
| | | } |
| | | orderService.cancelOrder(id); |
| | | return AjaxResult.buildSuccessInstance("取消成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "收款", notes = "收款") |
| | | @PostMapping(value = "/sk") |
| | | public AjaxResult sk(@RequestBody SysOrder order) throws GlobleException { |
| | | orderService.payOrder(order); |
| | | return AjaxResult.buildSuccessInstance("收款成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "补交", notes = "补交") |
| | | @PostMapping(value = "/bj") |
| | | public AjaxResult bj(@RequestBody SysOrder order){ |
| | | orderService.updateAfterMoney(order); |
| | | return AjaxResult.buildSuccessInstance("补交成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询当前登录人", notes = "查询当前登录人") |
| | | @GetMapping(value = "/getLoginUser") |
| | | public AjaxResult getLoginUser() { |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | result.putInMap("user", user); |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "根据ID查询用户", notes = "根据ID查询用户") |
| | | @GetMapping(value = "/getUserById/{id}") |
| | | public AjaxResult getUserById(@PathVariable Long id) { |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | SysUsers user = sysUsersService.findById(id); |
| | | result.putInMap("user", user); |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "获取业绩用户列表", notes = "获取业绩用户列表") |
| | | @GetMapping(value = "/shopAll") |
| | | public AjaxResult shopAll() { |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, sysUsersService.findByRoleName(true, null)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取业绩类型", notes = "获取业绩类型") |
| | | @GetMapping(value = "getListByParentCode/{parentCode}") |
| | | public AjaxResult getListByParentCode(@PathVariable String parentCode) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | List<CustomerDataDictionary> list = dataDictionaryDao.selectByParentCode(parentCode, user.getCompanyId()); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, list, list.size()); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询当前登录用户所在门店信息", notes = "查询当前登录用户所在门店信息") |
| | | @GetMapping(value = "findUserShop") |
| | | public AjaxResult findUserShop() { |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, |
| | | java.util.Arrays.asList(currentService.findById(user.getShopId())), null); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取用户的可用充值卡", notes = "获取用户的可用充值卡") |
| | | @GetMapping(value = "getUseMoneyCard/{vipId}") |
| | | public AjaxResult getUseMoneyCard(@PathVariable Long vipId) { |
| | | MoneyCardUse moneyCardUse = new MoneyCardUse(); |
| | | moneyCardUse.setVipId(vipId); |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | List<MoneyCardUse> cards = cardUseService.findByModel(moneyCardUse); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, cards); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据订单ID查询订单信息", notes = "根据订单ID查询订单信息") |
| | | @GetMapping(value = "/findOrderById/{id}") |
| | | public AjaxResult findOrderById(@PathVariable Long id) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | SysOrder order = orderService.findById(id); |
| | | order.setItems(orderItemDao.selectByOrderId(id)); |
| | | return AjaxResult.buildSuccessInstance(order); |
| | | } |
| | | |
| | | @ApiOperation(value = "列表显示搜索项目绑定的产品信息", notes = "列表显示搜索项目绑定的产品信息") |
| | | @PostMapping(value = "/showList") |
| | | public AjaxResult showList(@RequestBody PadShowListDto padShowListDto) { |
| | | |
| | | int offset = (padShowListDto.getPageNum() - 1) * padShowListDto.getPageSize(); |
| | | int limit = padShowListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | ShoppingGoods shoppingGoods = new ShoppingGoods(); |
| | | if(StrUtil.isNotEmpty(padShowListDto.getName())){ |
| | | shoppingGoods.setName(padShowListDto.getName()); |
| | | } |
| | | if(StrUtil.isNotEmpty(padShowListDto.getGoodType())){ |
| | | shoppingGoods.setGoodType(padShowListDto.getGoodType()); |
| | | } |
| | | // QueryUtil.setQueryLimit(shoppingGoods); |
| | | if(StringUtils.isBlank(pageVo.getSort())){ |
| | | pageVo.setOrder("desc"); |
| | | pageVo.setSort("createTime"); |
| | | } |
| | | //2表示查询总部产品 |
| | | // if (shoppingGoods.getHeadquarters()!=null && 2==shoppingGoods.getHeadquarters()) { |
| | | // //仅查询本店产品 |
| | | // SysShopInfo zbShop = shopInfoDao.selectZbShop(getMe().getCompanyId()); |
| | | // //如果是总部自己查询自己的库存则不需加入这个调价 |
| | | // if (getMe().getShopId().equals(zbShop.getId())){ |
| | | // shoppingGoods.setHeadquarters(1); |
| | | // } |
| | | // } |
| | | SysShopInfo zbShop = shopInfoDao.selectZbShop(getMe().getCompanyId()); |
| | | if (getMe().getShopId().equals(zbShop.getId())){ |
| | | shoppingGoods.setHeadquarters(1); |
| | | } |
| | | shoppingGoods.setIsDel(ShoppingGoods.NORMAL); |
| | | List<ShoppingGoods> dataList = shoppingGoodsService.findInPage(shoppingGoods, pageVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, shoppingGoodsService.findTotal(shoppingGoods)); |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation(value = "计算订单金额", notes = "计算订单金额") |
| | | @PostMapping(value = "/calculationOrder") |
| | | public AjaxResult calculationOrder(@RequestBody SysOrder sysOrder) { |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | BigDecimal zkTotal = BigDecimal.ZERO; |
| | | //默认排序 |
| | | List<SysOrderItem> items = sysOrder.getItems(); |
| | | |
| | | for (int i = 0; i < items.size(); i++) { |
| | | SysOrderItem item = items.get(i); |
| | | zkTotal = zkTotal.add(new BigDecimal(item.getZkPrice() * item.getCount())); |
| | | total = total.add(new BigDecimal(item.getPrice() * item.getCount())); |
| | | } |
| | | SysOrder sysOrderResult = new SysOrder(); |
| | | sysOrderResult.setZkTotal(zkTotal.setScale(2, BigDecimal.ROUND_DOWN).doubleValue()); |
| | | sysOrderResult.setTotal(total.doubleValue()); |
| | | |
| | | return AjaxResult.buildSuccessInstance(sysOrderResult); |
| | | } |
| | | |
| | | @ApiOperation(value = "订单支付", notes = "订单支付") |
| | | @PostMapping(value = "/payOrder") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult payOrder(@RequestBody SysOrder sysOrder) { |
| | | SysUsers user = getMe(); |
| | | sysOrder.setShopId(user.getShopId()); |
| | | sysOrder.setOrderType(SysOrder.ORDER_TYPE_SEAL); |
| | | sysOrder.setIsHasRefund(SysOrder.IS_HAS_REFUND_N); |
| | | //校验订单是否满足结算调价,新订单则保存订单,已有订单则删除后更新 |
| | | sysOrder = orderService.checkAndSaveOrder(sysOrder); |
| | | orderService.payOrder(sysOrder); |
| | | |
| | | //发送微信公众号提醒 |
| | | UniformMsgParam uniformMsgParam = new UniformMsgParam(user.getCompanyId(), UniformMsgParam.GZH_GMCG); |
| | | uniformMsgParam.put("orderId", sysOrder.getId()); |
| | | asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam); |
| | | |
| | | //处理用户购买的产品 |
| | | return AjaxResult.buildSuccessInstance(sysOrder, "订单结算成功"); |
| | | } |
| | | |
| | | @ApiOperation(value = "订单保存接口-挂单", notes = "订单保存接口-挂单") |
| | | @PostMapping(value = "/saveOrder") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveOrder(@RequestBody SysOrder sysOrder) { |
| | | SysUsers user = getMe(); |
| | | sysOrder.setShopId(user.getShopId()); |
| | | //校验保存订单 |
| | | sysOrder = orderService.checkAndSaveOrder(sysOrder); |
| | | //处理用户购买的产品 |
| | | return AjaxResult.buildSuccessInstance(sysOrder, "订单保存成功"); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | ShoppingGoodsDao shoppingGoodsDao; |
| | | |
| | | @Autowired |
| | | private SysOrderItemService orderItemService; |
| | | |
| | | @Autowired |
| | | private AchieveNewService achieveNewService; |
| | | |
| | | @Autowired |
| | | private SysVipInfoService sysVipInfoService; |
| | | |
| | | @Autowired |
| | | private SysOrderFlowService sysOrderFlowService; |
| | | |
| | | @ApiOperation(value = "列表进入详情", notes = "列表进入详情") |
| | | @PostMapping(value = "/findOrderDetailByIdOrNo") |
| | | public AjaxResult findOrderDetailByIdOrNo(@RequestBody SysOrder orderVo) { |
| | | // 根据id查到对应的订单信息 |
| | | SysOrder order = null; |
| | | if (orderVo.getId() != null) { |
| | | order = orderService.findById(orderVo.getId()); |
| | | } else if (StringUtils.isNotBlank(orderVo.getOrderNo())) { |
| | | List<SysOrder> byModel = orderService.findByModel(orderVo); |
| | | if (byModel.size() == 1) { |
| | | order = orderService.findById(byModel.get(0).getId()); |
| | | } |
| | | } |
| | | List<SysOrderItem> sysOrderItems = orderItemDao.selectByOrderId(order.getId()); |
| | | order.setItems(sysOrderItems); |
| | | |
| | | SysVipInfo vipInfo = sysVipInfoService.findById(order.getVipId()); |
| | | // 根据会员Id查到会员有效的会员卡 |
| | | // 根据订单号查找订单条目 |
| | | List<SysOrderItem> orderItems = orderItemService.findByOrderId(order.getId()); |
| | | |
| | | MoneyCardUse moneyCardUse = new MoneyCardUse(); |
| | | moneyCardUse.setVipId(order.getVipId()); |
| | | List<MoneyCardUse> cards = cardUseService.findByModel(moneyCardUse); |
| | | |
| | | List<SysOrderFlow> flows = sysOrderFlowService.findByOrderId(order.getId()); |
| | | order.setFlows(flows); |
| | | |
| | | List<SysOrderFlow> payMethods = sysOrderFlowService.findPayMethodsAmount(order.getId()); |
| | | |
| | | List<AchieveNew> achieveList = achieveNewService.findOrderItemAchieve(order.getId()); |
| | | |
| | | AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功"); |
| | | ajaxResult.putInMap("orderItems", orderItems); |
| | | ajaxResult.putInMap("order", order); |
| | | ajaxResult.putInMap("cards", cards); |
| | | ajaxResult.putInMap("vipInfo", vipInfo); |
| | | ajaxResult.putInMap("payMethods", payMethods); |
| | | ajaxResult.putInMap("achieveList", achieveList); |
| | | return ajaxResult; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.action; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.matrix.core.anotations.RemoveRequestToken; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.pojo.VerifyResult; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | 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.DataAuthUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.padApi.dto.PadServiceListDto; |
| | | import com.matrix.system.padApi.dto.PadSignServiceDto; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @CrossOrigin(origins = "*") |
| | | @Api(value = "PadServiceAction", tags = "pad端服务单请求") |
| | | @RestController |
| | | @RequestMapping(value = "/api/pad/service") |
| | | public class PadServiceAction extends BaseController { |
| | | |
| | | @Resource |
| | | private SysProjServicesService projServicesSerivce; |
| | | @Resource |
| | | private SysProjUseService projUseService; |
| | | @Resource |
| | | private SysBedInfoService bedInfoService; |
| | | @Autowired |
| | | SysProjGoodsDao sysProjGoodsDao; |
| | | @Resource |
| | | private SysProjServicesService sysProjServicesService; |
| | | @Resource |
| | | private SysVipInfoService sysVipInfoService; |
| | | @Autowired |
| | | private SysBeauticianStateDao beauticianStateDao; |
| | | @Autowired |
| | | AchieveNewService achieveNewService; |
| | | @Autowired |
| | | private SysBedStateDao sysBedStateDao; |
| | | @Autowired |
| | | ShoppingGoodsAssembleDao goodsAssembleDao; |
| | | @Autowired |
| | | SysShopInfoDao shopInfoDao; |
| | | @Resource |
| | | private SysUsersService usersService; |
| | | @Autowired |
| | | private SysProjServicesDao sysProjServicesDao; |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | @Resource |
| | | private SysUsersService sysUsersService; |
| | | @Resource |
| | | private SysWorktimeService sysWorkTimeService; |
| | | @Autowired |
| | | private SysBeauticianStateDao sysBeauticianStateDao; |
| | | @Autowired |
| | | private ShoppingGoodsDao shoppingGoodsDao; |
| | | @Resource |
| | | private SysStoreInfoDao sysStoreInfoDao; |
| | | @Resource |
| | | private SysWorktimeService worktimeService; |
| | | |
| | | /** |
| | | * 获取用户所有可用的项目和套餐 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取用户所有可用的项目和套餐", notes = "获取用户所有可用的项目和套餐") |
| | | @GetMapping(value = "/getUserProjInfo/{vipId}") |
| | | public AjaxResult getUserProjInfo(@PathVariable("vipId")Long vipId) { |
| | | AjaxResult result = AjaxResult.buildSuccessInstance("查询成功"); |
| | | |
| | | SysProjUse queryUse = new SysProjUse(); |
| | | queryUse.setVipId(vipId); |
| | | queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | queryUse.setTaocanId(-1L); |
| | | queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | List<SysProjUse> projList = projUseService.findInPage(queryUse, null); |
| | | //切换到套餐查询条件 |
| | | queryUse.setTaocanId(null); |
| | | queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_TC); |
| | | List<SysProjUse> taoCanList = projUseService.findInPage(queryUse, null); |
| | | taoCanList.forEach(item->{ |
| | | item.setTaocanProjUse(projUseService.selectTaocanProjUse(item.getId(), queryUse.getStatus())); |
| | | item.setProjInfo(shoppingGoodsDao.selectById(item.getProjId())); |
| | | }); |
| | | result.putInMap("projList", projList); |
| | | result.putInMap("taoCanList", taoCanList); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 显示所有服务单列表 |
| | | */ |
| | | @ApiOperation(value = "显示所有服务单列表", notes = "显示所有服务单列表") |
| | | @PostMapping(value = "/showList") |
| | | // public AjaxResult showList(@RequestBody SysProjServices projService, PaginationVO pageVo) { |
| | | public AjaxResult showList(@RequestBody @Validated PadServiceListDto orderListDto) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | int offset = (orderListDto.getPageNum() - 1) * orderListDto.getPageSize(); |
| | | int limit = orderListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | if (!DataAuthUtil.hasAllShopAuth()) { |
| | | orderListDto.setShopId(user.getShopId()); |
| | | } |
| | | QueryUtil.setQueryLimitCom(orderListDto); |
| | | //默认排序 |
| | | if (StringUtils.isBlank(pageVo.getSort())) { |
| | | pageVo.setSort("create_time"); |
| | | } |
| | | if (StringUtils.isBlank(pageVo.getOrder())) { |
| | | pageVo.setOrder("desc"); |
| | | } |
| | | |
| | | SysProjServices projService = new SysProjServices(); |
| | | if (!DataAuthUtil.hasAllShopAuth()) { |
| | | projService.setShopId(getMe().getShopId()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getBeginTime())){ |
| | | projService.setBeginTime(orderListDto.getBeginTime()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getClosureTime())){ |
| | | projService.setClosureTime(orderListDto.getClosureTime()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getVipId())){ |
| | | projService.setVipId(orderListDto.getVipId()); |
| | | } |
| | | if(ObjectUtil.isNotEmpty(orderListDto.getQueryKey())){ |
| | | projService.setQueryKey(orderListDto.getQueryKey()); |
| | | } |
| | | if(StrUtil.isNotEmpty(orderListDto.getState())){ |
| | | projService.setState(orderListDto.getState()); |
| | | } |
| | | QueryUtil.setQueryLimitCom(projService); |
| | | List<SysProjServices> dataList = projServicesSerivce.findInPage(projService, pageVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, projServicesSerivce.findTotal(projService)); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 进入预约排班详情 |
| | | */ |
| | | @ApiOperation(value = "进入预约排班详情", notes = "进入预约排班详情") |
| | | @PostMapping(value = "/serviceInfo") |
| | | public AjaxResult findPbxq(@RequestBody SysProjServices projServicesVo) { |
| | | QueryUtil.setQueryLimitCom(projServicesVo); |
| | | // 获取服务单信息 |
| | | SysProjServices projServices = null; |
| | | if(projServicesVo.getId()!=null){ |
| | | projServices= sysProjServicesService.findById(projServicesVo.getId()); |
| | | }else if(StringUtils.isNotBlank(projServicesVo.getServiceNo())) { |
| | | List<SysProjServices> byModel = sysProjServicesService.findByModel(projServicesVo); |
| | | if (byModel.size() == 1) { |
| | | projServices= sysProjServicesService.findById( byModel.get(0).getId()); |
| | | } |
| | | } |
| | | if(projServices==null){ |
| | | throw new GlobleException("未查询到单据信息"); |
| | | } |
| | | // 获取服务单所有信息 |
| | | // 设置会员信息 |
| | | projServices.setVipInfo(sysVipInfoService.findById(projServices.getVipId())); |
| | | //补充服务单扩展信息=============== |
| | | List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId()); |
| | | if (CollUtil.isNotEmpty(beauticianStateList)) { |
| | | for (SysBeauticianState sysBeauticianState : beauticianStateList) { |
| | | if (sysBeauticianState.getProjUse().getTaocanId() != null) { |
| | | SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId()); |
| | | if(sysProjUse != null) { |
| | | sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName() + "--" + sysBeauticianState.getProjInfo().getName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | projServices.setServiceItems(beauticianStateList); |
| | | |
| | | SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId()); |
| | | projServices.setBedState(sysBedState); |
| | | //补充服务单扩展信息===============END |
| | | |
| | | // 根据岗位名称查询员工 |
| | | List<SysUsers> pls = usersService.findByRoleName(true, Dictionary.STAFF_POST_PLS); |
| | | pls.addAll(usersService.findByRoleName(true, Dictionary.STAFF_POST_PLZG)); |
| | | List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS); |
| | | WebUtil.getRequest().setAttribute("pls", pls); |
| | | WebUtil.getRequest().setAttribute("mls", mls); |
| | | |
| | | SysBedInfo bedInfo = new SysBedInfo(); |
| | | bedInfo.setShopId(getMe().getShopId()); |
| | | // 显示当前查询的服务订单的项目信息 |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | result.putInMap("obj", projServices); |
| | | result.putInMap("serviceId", projServicesVo.getId()); |
| | | result.putInMap("pageFlae", projServicesVo.getPageFlae()); |
| | | result.putInMap("cw", bedInfoService.findByModel(bedInfo)); |
| | | result.putInMap("pls", pls); |
| | | result.putInMap("mls", mls); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取空闲床位 |
| | | */ |
| | | @ApiOperation(value = "获取空闲床位", notes = "获取空闲床位") |
| | | @PostMapping(value = "/showFreedBed") |
| | | public AjaxResult showFreedBed(@RequestBody SysProjServices sysProjServices) { |
| | | sysProjServices.setShopId(getMe().getShopId()); |
| | | List<SysBedInfo> beds = bedInfoService.findFreeBed(sysProjServices); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, beds, 0); |
| | | } |
| | | |
| | | /** |
| | | * 获取美疗师 |
| | | */ |
| | | @ApiOperation(value = "获取美疗师", notes = "获取美疗师") |
| | | @PostMapping(value = "/getPaiBanBeauticianList") |
| | | public AjaxResult getPaiBanBeauticianList(@RequestBody SysBeauticianState sysBeauticianState) { |
| | | // 根据时间获取一段排班码 |
| | | String panBanCodes = DateUtil.dateToString(sysBeauticianState.getBeginTime(),DateUtil.DATE_FORMAT_NO_SPLITE_DD); |
| | | // 获取登陆的用户 |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | List<SysUsers> staffs=new ArrayList<>(); |
| | | if(sysWorkTimeService.isInWorkTime(user.getShopId(),sysBeauticianState.getBeginTime(),sysBeauticianState.getEndTime())){ |
| | | staffs= sysUsersService.findByCodeBeaStateShop(user.getShopId(), |
| | | sysBeauticianState, panBanCodes); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, staffs, 0); |
| | | } |
| | | |
| | | /** |
| | | * 获取配料师 |
| | | */ |
| | | @ApiOperation(value = "获取配料师", notes = "获取配料师") |
| | | @GetMapping(value = "/getShopStaffByRoleName") |
| | | public AjaxResult getStaffByRoleName() { |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, sysUsersService.findByRoleName(true, "配料师")); |
| | | } |
| | | |
| | | /** |
| | | * 获取工作时间 |
| | | */ |
| | | @ApiOperation(value = "获取工作时间", notes = "获取工作时间") |
| | | @GetMapping(value = "/getWorkTime") |
| | | public AjaxResult getWorkTime() { |
| | | Long shopId = getMe().getShopId(); |
| | | Date minTime = worktimeService.findMinTime(shopId); |
| | | Date maxTime = worktimeService.findMaxTime(shopId); |
| | | if (minTime == null || maxTime == null) { |
| | | return AjaxResult.buildFailInstance("门店没有班次信息,请先设置门店班次"); |
| | | } else { |
| | | return AjaxResult.buildSuccessInstance(java.util.Arrays.asList( |
| | | DateUtil.dateToString(minTime, "HH:mm"), |
| | | DateUtil.dateToString(maxTime, "HH:mm"))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增项目 |
| | | */ |
| | | @ApiOperation(value = "新增项目", notes = "新增项目") |
| | | @PostMapping(value = "/addService") |
| | | public AjaxResult servicceAdd(@RequestBody SysProjServices sysProjServices) { |
| | | if (CollectionUtils.isEmpty(sysProjServices.getServiceItems())) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "没有选中可消耗的项目"); |
| | | } |
| | | //检测欠款 |
| | | VerifyResult arrearsVerifyResult = sysProjServicesService.checkArrears(sysProjServices); |
| | | if (arrearsVerifyResult.isError()) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, arrearsVerifyResult.getMsg()); |
| | | } |
| | | //检测余次 |
| | | VerifyResult balanceverifyResult = sysProjServicesService.checkBalance(sysProjServices); |
| | | if (balanceverifyResult.isError()) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, balanceverifyResult.getMsg()); |
| | | } |
| | | if (StrUtil.isEmpty(sysProjServices.getState())) { |
| | | sysProjServices.setState(Dictionary.SERVICE_STATU_DYY); |
| | | } |
| | | SysProjServices newSysProjServices = sysProjServicesService.addSysProjServices(sysProjServices); |
| | | if (newSysProjServices != null) { |
| | | AjaxResult result = AjaxResult.buildSuccessInstance("下单成功!"); |
| | | result.putInMap("newSysProjServices", newSysProjServices); |
| | | return result; |
| | | } else { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "下单失败!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除服务单项目/套餐 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "删除服务单项目/套餐", notes = "删除服务单项目/套餐") |
| | | @GetMapping(value = "/delServiceOrderItems/{id}") |
| | | public AjaxResult delServiceOrderItems(@PathVariable("id")Long id) { |
| | | sysProjServicesService.deleteProjServiceItemById(id); |
| | | return AjaxResult.buildSuccessInstance("删除成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 排班 |
| | | */ |
| | | @ApiOperation(value = "排班", notes = "排班") |
| | | @PostMapping(value = "/servicePaiBan") |
| | | public AjaxResult servicePaiBan(@RequestBody SysProjServices projServices, String dataTime) throws GlobleException { |
| | | int i = sysProjServicesService.paiban(projServices, dataTime); |
| | | if (i > 0) { |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "排班成功"); |
| | | } else { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "排班失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据id取消预约 |
| | | */ |
| | | @ApiOperation(value = "根据id取消预约", notes = "根据id取消预约") |
| | | @GetMapping(value = "/cancelOrder/{id}") |
| | | public AjaxResult cancelOrder(@PathVariable("id")Long id) { |
| | | |
| | | SysProjServices checkProjServices = sysProjServicesDao.selectById(id); |
| | | QueryUtil.setQueryLimitCom(checkProjServices); |
| | | BusParameterSettings shopManageAbleCancelDfkOrder = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_ABLE_CANCEL_DFK_ORDER, checkProjServices.getCompanyId()); |
| | | if (StringUtils.isNotBlank(shopManageAbleCancelDfkOrder.getParamValue()) |
| | | && BooleanEnum.TRUE.getValue() == shopManageAbleCancelDfkOrder.getIntParamValue()) { |
| | | |
| | | if (!checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DYY) |
| | | && !checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DQR)) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "您只能取消待预约订单"); |
| | | } |
| | | }else{ |
| | | if (checkProjServices.getState().equals(Dictionary.SERVICE_STATU_FWWC) |
| | | || checkProjServices.getState().equals(Dictionary.SERVICE_STATU_FFJS)) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "当前状态无法取消订单"); |
| | | } |
| | | } |
| | | |
| | | int i = sysProjServicesService.modifyCancelProjServices(checkProjServices); |
| | | if (i > 0) { |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "取消预约成功"); |
| | | } else { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "取消预约失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 开始配料 |
| | | */ |
| | | @ApiOperation(value = "开始配料", notes = "开始配料") |
| | | @GetMapping(value = "/startpl/{id}") |
| | | public AjaxResult startpl(@PathVariable("id")Long id) { |
| | | // 将服务状态为待配料的更新为配料中 |
| | | SysProjServices sysProjServices = projServicesSerivce.findById(id); |
| | | List<SysBeauticianState> beauticianStateList = sysBeauticianStateDao.selectBySerIds(sysProjServices.getId()); |
| | | List<ShoppingGoods> projInfoList = new ArrayList<>(); |
| | | for (SysBeauticianState beauticianState : beauticianStateList) { |
| | | ShoppingGoods sysProjInfo = shoppingGoodsDao.selectById(beauticianState.getProjId()); |
| | | sysProjInfo.setAssembleGoods(goodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysProjInfo.getId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP)); |
| | | projInfoList.add(sysProjInfo); |
| | | } |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | result.putInMap("serviceId", id); |
| | | result.putInMap("projInfoList", projInfoList); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 按产品批次显示选择配料 |
| | | */ |
| | | @ApiOperation(value = "按产品批次显示选择配料", notes = "按产品批次显示选择配料") |
| | | @PostMapping(value = "/showCountList") |
| | | public AjaxResult showCountList(@RequestBody SysStoreInfo sysStoreInfo, PaginationVO pageVo) { |
| | | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | sysStoreInfo.setShopId(users.getShopId()); |
| | | sysStoreInfo.setCompanyId(users.getCompanyId()); |
| | | |
| | | List<SysStoreInfo> dataList = sysStoreInfoDao.selectCountInPage(sysStoreInfo, pageVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, sysStoreInfoDao.selectCountTotalRecord(sysStoreInfo)); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 配料完成 |
| | | */ |
| | | @ApiOperation(value = "配料完成", notes = "配料完成") |
| | | @PostMapping(value = "/endPl") |
| | | @RemoveRequestToken |
| | | public AjaxResult endPl(@RequestBody SysProjServices projServices) { |
| | | projServicesSerivce.modifyPLProjServices(projServices); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "配料成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 进入划扣页面 |
| | | */ |
| | | @ApiOperation(value = "进入划扣页面", notes = "进入划扣页面") |
| | | @GetMapping(value = "/serviceHkPage/{id}") |
| | | public AjaxResult serviceHkPage(@PathVariable("id")Long id) { |
| | | // 获取服务单信息 |
| | | SysProjServices projServices = sysProjServicesService.findById(id); |
| | | |
| | | projServices.setVipInfo(sysVipInfoService.findById(projServices.getVipId())); |
| | | |
| | | //补充服务单扩展信息=============== |
| | | List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(id); |
| | | projServices.setServiceItems(beauticianStateList); |
| | | |
| | | SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId()); |
| | | projServices.setBedState(sysBedState); |
| | | //补充服务单扩展信息===============END |
| | | |
| | | // 获取服务单所有信息 |
| | | WebUtil.getRequest().setAttribute("obj", projServices); |
| | | WebUtil.getRequest().setAttribute("serviceId", id); |
| | | |
| | | // 准备页面数据 |
| | | // 根据岗位名称查询员工 |
| | | List<SysUsers> pls = usersService.findByRoleName(true, Dictionary.STAFF_POST_PLS); |
| | | pls.addAll(usersService.findByRoleName(true, Dictionary.STAFF_POST_PLZG)); |
| | | List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS); |
| | | WebUtil.getRequest().setAttribute("pls", pls); |
| | | WebUtil.getRequest().setAttribute("mls", mls); |
| | | SysBedInfo bedInfo = new SysBedInfo(); |
| | | bedInfo.setShopId(getMe().getShopId()); |
| | | WebUtil.getRequest().setAttribute("cw", bedInfoService.findByModel(bedInfo)); |
| | | |
| | | |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | result.putInMap("obj", projServices); |
| | | result.putInMap("serviceId", id); |
| | | result.putInMap("cw", bedInfoService.findByModel(bedInfo)); |
| | | result.putInMap("pls", pls); |
| | | result.putInMap("mls", mls); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 设置客户签名 |
| | | */ |
| | | @ApiOperation(value = "设置客户签名", notes = "设置客户签名") |
| | | @PostMapping(value = "/signService") |
| | | public AjaxResult signService(@RequestBody PadSignServiceDto padSignServiceDto) { |
| | | SysProjServices services = new SysProjServices(); |
| | | services.setId(padSignServiceDto.getId()); |
| | | services.setSignPic(padSignServiceDto.getSignPic()); |
| | | int i = sysProjServicesService.signService(services); |
| | | if (i > 0) { |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "签名成功"); |
| | | } else { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "签名失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置服务单划扣成功 |
| | | */ |
| | | @ApiOperation(value = "设置服务单划扣成功", notes = "设置服务单划扣成功") |
| | | @GetMapping(value = "/hkService/{id}") |
| | | public AjaxResult hkService(@PathVariable("id")Long id) { |
| | | SysProjServices services = new SysProjServices(); |
| | | services.setId(id); |
| | | int i = sysProjServicesService.modifyHKProjServices(services); |
| | | if (i > 0) { |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "划扣成功"); |
| | | } else { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "划扣失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 编辑排班详情 |
| | | */ |
| | | @ApiOperation(value = "编辑排班详情", notes = "编辑排班详情") |
| | | @GetMapping(value = "/yypb/{id}") |
| | | public AjaxResult findProject(@PathVariable("id")Long id) { |
| | | // 获取服务单信息 |
| | | SysProjServices projServices = sysProjServicesService.findById(id); |
| | | // 获取操作的用户 |
| | | projServices.setVipInfo(sysVipInfoService.findById(projServices.getVipId())); |
| | | |
| | | // 设置排班的默认日期 |
| | | String dateTime = null; |
| | | if (dateTime == null || dateTime.equals("")) { |
| | | |
| | | SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getBedId(), projServices.getId()); |
| | | |
| | | if (sysBedState != null && sysBedState.getStartTime() != null) { |
| | | dateTime = DateUtil.dateToString(sysBedState.getStartTime(), DateUtil.DATE_FORMAT_DD); |
| | | } else { |
| | | dateTime = DateUtil.dateToString(projServices.getYyTime(), DateUtil.DATE_FORMAT_DD); |
| | | } |
| | | } |
| | | WebUtil.getRequest().setAttribute("dateTime", dateTime); |
| | | // 获取服务单所有信息 |
| | | WebUtil.getRequest().setAttribute("obj", projServices); |
| | | |
| | | // 获取服务单对一下的项目信息 |
| | | // 准备页面数据 |
| | | // 根据岗位名称查询员工 |
| | | List<SysUsers> pls = usersService.findByRoleName(true, Dictionary.STAFF_POST_PLS); |
| | | pls.addAll(usersService.findByRoleName(true, Dictionary.STAFF_POST_PLZG)); |
| | | List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS); |
| | | WebUtil.getRequest().setAttribute("pls", pls); |
| | | WebUtil.getRequest().setAttribute("mls", mls); |
| | | |
| | | SysBedInfo bedInfo = new SysBedInfo(); |
| | | bedInfo.setShopId(getMe().getShopId()); |
| | | // 床位 |
| | | WebUtil.getRequest().setAttribute("cw", bedInfoService.findByModel(bedInfo)); |
| | | |
| | | |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | result.putInMap("dateTime", dateTime); |
| | | result.putInMap("obj", projServices); |
| | | result.putInMap("cw", bedInfoService.findByModel(bedInfo)); |
| | | result.putInMap("pls", pls); |
| | | result.putInMap("mls", mls); |
| | | return result; |
| | | // 显示当前查询的服务订单的项目信息 |
| | | // return "admin/hive/beautySalon/yypb-form"; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.action; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.matrix.component.asyncmessage.AsyncMessageManager; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.CustomerDataDictionary; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.CustomerDataDictionaryDao; |
| | | import com.matrix.system.common.service.SysUsersService; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.action.BaseController; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.pojo.CzXkVo; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.padApi.dto.*; |
| | | import com.matrix.system.score.dao.ScoreUseRecordDao; |
| | | import com.matrix.system.score.dao.ScoreVipDetailDao; |
| | | import com.matrix.system.shopXcx.api.dto.ScoreFlowDto; |
| | | import com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo; |
| | | import com.matrix.system.shopXcx.mqTask.AsyncMessageRouting; |
| | | import com.matrix.system.wechart.templateMsg.UniformMsgParam; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @CrossOrigin(origins = "*") |
| | | @Api(value = "PadVipAction", tags = "pad端Vip客户请求") |
| | | @RestController |
| | | @RequestMapping(value = "/api/pad/vipInfo") |
| | | public class PadVipAction extends BaseController { |
| | | |
| | | @Resource |
| | | private SysVipInfoService vipInfoService; |
| | | @Resource |
| | | private SysOrderService sysOrderService; |
| | | @Autowired |
| | | ShoppingGoodsDao shoppingGoodsDao; |
| | | @Autowired |
| | | private ScoreVipDetailDao scoreVipDetailDao; |
| | | @Resource |
| | | private MoneyCardUseService cardUseService; |
| | | @Autowired |
| | | private MoneyCardUseDao moneyCardUseDao; |
| | | @Autowired |
| | | private SysVipLabelDao sysVipLabelDao; |
| | | @Resource |
| | | private SysOrderService orderService; |
| | | @Autowired |
| | | private AsyncMessageManager asyncMessageManager; |
| | | @Autowired |
| | | private SysUsersService sysUsersService; |
| | | @Autowired |
| | | private CustomerDataDictionaryDao dataDictionaryDao; |
| | | |
| | | /** |
| | | * 显示所有的会员信息 |
| | | */ |
| | | @ApiOperation(value = "显示所有的会员信息列表", notes = "显示所有的会员信息列表") |
| | | @PostMapping(value = "/showVipInfoList") |
| | | public AjaxResult showList(@RequestBody @Validated PadVipListDto padVipListDto) { |
| | | |
| | | SysVipInfo vipInfo = new SysVipInfo(); |
| | | QueryUtil.setQueryLimit(vipInfo); |
| | | String queryKey = padVipListDto.getQueryKey(); |
| | | if(StrUtil.isNotEmpty(queryKey)){ |
| | | vipInfo.setPadQueryKey(queryKey); |
| | | } |
| | | int offset = (padVipListDto.getPageNum() - 1) * padVipListDto.getPageSize(); |
| | | int limit = padVipListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | //默认排序 |
| | | if (StringUtils.isBlank(pageVo.getSort())) { |
| | | pageVo.setSort("create_time"); |
| | | } |
| | | if (StringUtils.isBlank(pageVo.getOrder())) { |
| | | pageVo.setOrder("desc"); |
| | | } |
| | | |
| | | return showList(vipInfoService, vipInfo, pageVo); |
| | | } |
| | | |
| | | /** |
| | | * 添加或修改会员信息 |
| | | */ |
| | | @ApiOperation(value = "添加或修改会员信息", notes = "添加或修改会员信息") |
| | | @PostMapping(value = "/addOrModify") |
| | | public AjaxResult addOrModify(@RequestBody SysVipInfo vipInfo) { |
| | | if (vipInfo.getId() != null) { |
| | | return modify(vipInfoService, vipInfo, "会员信息"); |
| | | } else { |
| | | vipInfo.setVipState(Dictionary.VIP_STATE_HY); |
| | | SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | if(vipInfo.getShopId()==null){ |
| | | vipInfo.setShopId(users.getShopId()); |
| | | } |
| | | if(vipInfo.getCompanyId()==null){ |
| | | vipInfo.setCompanyId(users.getCompanyId()); |
| | | } |
| | | return add(vipInfoService, vipInfo, "会员信息"); |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private SysVipLevelService cardLevelService; |
| | | |
| | | @ApiOperation(value = "显示所有的会员卡等级信息,不分页", notes = "显示所有的会员卡等级信息,不分页") |
| | | @GetMapping(value = "/all") |
| | | public AjaxResult all() { |
| | | SysVipLevel sysVipLevel = new SysVipLevel(); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, cardLevelService.findByModel(sysVipLevel), null); |
| | | } |
| | | |
| | | @Resource |
| | | private SysShopInfoService shopInfoService; // 店铺Service |
| | | |
| | | @ApiOperation(value = "所属门店,不分页", notes = "所属门店,不分页") |
| | | @GetMapping(value = "/findShopByRole") |
| | | public AjaxResult findShopByRole() { |
| | | SysUsers user = getMe(); |
| | | SysShopInfo shopInfo = new SysShopInfo(); |
| | | shopInfo.setCompanyId(user.getCompanyId()); |
| | | if(!user.getSuUserType().equals(AppConstance.USER_TYPE_ADMIN) && !user.getShopRole().equals(Dictionary.FLAG_YES_Y)){ |
| | | shopInfo.setId(user.getShopId()); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, shopInfoService.findByModel(shopInfo), null); |
| | | } |
| | | |
| | | /** |
| | | * 查看会员信息 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | @ApiOperation(value = "查看会员信息", notes = "查看会员信息") |
| | | @GetMapping(value = "/showVipInfo/{phone}") |
| | | public AjaxResult findByModel(@PathVariable("phone")String phone) { |
| | | List<SysVipInfo> vips = vipInfoService.findByVipNoOrTel(phone); |
| | | if (vips.size() > 0) { |
| | | vips.get(0).setPointAll(scoreVipDetailDao.selectUserTotalScore(vips.get(0).getId())); |
| | | vips.get(0).setSysOrder(sysOrderService.findSysOrderTjByVipId(vips.get(0).getId())); |
| | | vips.get(0).setLevelCard(cardUseService.findByVipId(vips.get(0).getId())); |
| | | vips.get(0).setLabels(sysVipLabelDao.selectByVipId(vips.get(0).getId())); |
| | | vips.get(0).setAge(DateUtil.getAgeForBirthDay(vips.get(0).getBirthday1())); |
| | | vips.get(0).setBalance(moneyCardUseDao.selectVipCardTotalMoney(vips.get(0).getId())); |
| | | vips.get(0).setArrears(sysOrderService.findVipArrearsByVipId(vips.get(0).getId())); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, vips, 0); |
| | | return result; |
| | | } else { |
| | | return AjaxResult.buildFailInstance("未查到询客户信息"); |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private SysProjUseService projUseService; |
| | | |
| | | @ApiOperation(value = "项目使用情况", notes = "") |
| | | @PostMapping(value = "/projectList") |
| | | public AjaxResult showTc(@RequestBody PadProjectDto padProjectDto) { |
| | | |
| | | int offset = (padProjectDto.getPageNum() - 1) * padProjectDto.getPageSize(); |
| | | int limit = padProjectDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | SysProjUse sysProjUse = new SysProjUse(); |
| | | sysProjUse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | sysProjUse.setTaocanId(-1L); |
| | | sysProjUse.setVipId(padProjectDto.getVipId()); |
| | | if(StrUtil.isNotEmpty(padProjectDto.getState())){ |
| | | sysProjUse.setStatus(padProjectDto.getState()); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, |
| | | projUseService.findInPage(sysProjUse, pageVo), projUseService.findTotal(sysProjUse)); |
| | | } |
| | | |
| | | /** |
| | | * 会员充值卡的列表显示 |
| | | */ |
| | | @ApiOperation(value = "充值卡的列表显示", notes = "") |
| | | @PostMapping(value = "/showVipMoneyCardList") |
| | | public AjaxResult showVipMoneyCardList(@RequestBody PadVipCardDto padVipCardDto) { |
| | | |
| | | int offset = (padVipCardDto.getPageNum() - 1) * padVipCardDto.getPageSize(); |
| | | int limit = padVipCardDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | MoneyCardUse moneyCardUse = new MoneyCardUse(); |
| | | moneyCardUse.setVipId(padVipCardDto.getVipId()); |
| | | if(StrUtil.isNotEmpty(padVipCardDto.getState())){ |
| | | moneyCardUse.setStatus(padVipCardDto.getState()); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, cardUseService.findVipCardUseInPage( |
| | | moneyCardUse, pageVo), cardUseService.findTotalVipCardUse(moneyCardUse)); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private SysProjUseService sysProjUseService; |
| | | |
| | | @ApiOperation(value = "套餐使用情况", notes = "") |
| | | @PostMapping(value = "/tcList") |
| | | public AjaxResult showTc(@RequestBody PadTcDto padTcDto) { |
| | | int offset = (padTcDto.getPageNum() - 1) * padTcDto.getPageSize(); |
| | | int limit = padTcDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | SysProjUse sysProjUse = new SysProjUse(); |
| | | sysProjUse.setType(Dictionary.SHOPPING_GOODS_TYPE_TC); |
| | | sysProjUse.setVipId(padTcDto.getVipId()); |
| | | if(StrUtil.isNotEmpty(padTcDto.getState())){ |
| | | sysProjUse.setStatus(padTcDto.getState()); |
| | | } |
| | | List<SysProjUse> projUseList =sysProjUseService.findInPage(sysProjUse,pageVo); |
| | | //设置套餐中的项目 |
| | | projUseList.forEach(taocanProjUse -> { |
| | | taocanProjUse.setTaocanProjUse(sysProjUseService.selectTaocanProjUse(taocanProjUse.getId(),sysProjUse.getStatus())); |
| | | }); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, projUseList, sysProjUseService.findTotal(sysProjUse)); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Autowired |
| | | private ScoreUseRecordDao scoreUseRecordDao; |
| | | |
| | | @ApiOperation(value = "积分流水记录", notes = "") |
| | | @PostMapping(value = "/flowList") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = ScoreUseRecordVo.class) |
| | | }) |
| | | public AjaxResult getFlowList(@RequestBody ScoreFlowDto scoreFlowDto) { |
| | | SysVipInfo vipInfo = sysVipInfoDao.selectById(scoreFlowDto.getVipId()); |
| | | scoreFlowDto.setVipId(vipInfo.getId()); |
| | | Page<ScoreUseRecordVo> page=new Page<>(scoreFlowDto.getPageNum(),scoreFlowDto.getPageSize()); |
| | | IPage<ScoreUseRecordVo> shopScoreRecord = scoreUseRecordDao.selectFlowList(page,scoreFlowDto); |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(shopScoreRecord.getRecords(),shopScoreRecord.getTotal()); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private SysSkinCheckRecordDao sysSkinCheckRecordDao; |
| | | |
| | | @ApiOperation(value = "皮肤检测记录", notes = "") |
| | | @PostMapping(value = "/skinList") |
| | | public @ResponseBody AjaxResult showList(@RequestBody PadSkinDto padSkinDto) { |
| | | |
| | | int offset = (padSkinDto.getPageNum() - 1) * padSkinDto.getPageSize(); |
| | | int limit = padSkinDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | |
| | | SysSkinCheckRecord sysSkinCheckRecord = new SysSkinCheckRecord(); |
| | | sysSkinCheckRecord.setUserId(padSkinDto.getVipId()); |
| | | List<SysSkinCheckRecord> dataList = sysSkinCheckRecordDao.selectInPage(sysSkinCheckRecord, pageVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, |
| | | sysSkinCheckRecordDao.selectTotalRecord(sysSkinCheckRecord)); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 充值 查询门店所有员工 |
| | | */ |
| | | @ApiOperation(value = "充值 查询门店所有员工", notes = "充值 查询门店所有员工") |
| | | @GetMapping(value = "/shopAll") |
| | | public AjaxResult shopAll() { |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, sysUsersService.findByRoleName(true, null)); |
| | | } |
| | | /** |
| | | * 充值 查询业绩类型 |
| | | */ |
| | | @ApiOperation(value = "充值 查询业绩类型", notes = "充值 查询业绩类型") |
| | | @GetMapping(value = "getListByParentCode/{parentCode}") |
| | | public AjaxResult getListByParentCode(@PathVariable String parentCode) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | List<CustomerDataDictionary> list = dataDictionaryDao.selectByParentCode(parentCode, user.getCompanyId()); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, list, list.size()); |
| | | } |
| | | |
| | | /** |
| | | * 充值 查询当前登录人 |
| | | */ |
| | | @ApiOperation(value = "充值 查询当前登录人", notes = "充值 查询当前登录人") |
| | | @GetMapping(value = "getLoginUser") |
| | | public AjaxResult getLoginUser() { |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | result.putInMap("user", user); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 充值 |
| | | */ |
| | | @ApiOperation(value = "充值", notes = "充值") |
| | | @PostMapping(value = "/cz") |
| | | public AjaxResult cz(@RequestBody CzXkVo czVo) { |
| | | SysOrder order= orderService.moneyCardCz(czVo); |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "充值成功"); |
| | | |
| | | //发送微信公众号提醒 |
| | | UniformMsgParam uniformMsgParam=new UniformMsgParam(order.getCompanyId(),UniformMsgParam.GZH_CZCG); |
| | | uniformMsgParam.put("orderId",order.getId()); |
| | | asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam); |
| | | |
| | | result.putInMap("orderId",order.getId()); |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | @ApiModel(value = "Base64UploadDto", description = "接收参数类") |
| | | @Data |
| | | public class Base64UploadDto { |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "base64字符串") |
| | | public String base64Str; |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @ApiModel(value = "PadKucunListDto", description = "库存列表接收参数类") |
| | | @Data |
| | | public class PadKucunListDto extends BasePageDto { |
| | | @ApiModelProperty(value = "库存分类ID", example = "") |
| | | private Long goodsSortId; |
| | | |
| | | @ApiModelProperty(value = "查询字段") |
| | | private String queryKey; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | } |
| | | |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @ApiModel(value = "PadOrderListDto", description = "订单列表接收参数类") |
| | | public class PadOrderListDto extends BasePageDto { |
| | | |
| | | @ApiModelProperty(value = "订单状态 0-全部 1-待付款 2-已付款 3-欠款 4-已取消 全部默认传空字符串", example = "1") |
| | | private Integer orderStatus; |
| | | |
| | | public Long getVipId() { |
| | | return vipId; |
| | | } |
| | | |
| | | public void setVipId(Long vipId) { |
| | | this.vipId = vipId; |
| | | } |
| | | |
| | | @ApiModelProperty(value = "会员id", example = "1") |
| | | private Long vipId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "查询字段") |
| | | private String queryKey; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | private Date orderTime; |
| | | |
| | | public Date getBeginTimeVo() { |
| | | return beginTimeVo; |
| | | } |
| | | |
| | | public void setBeginTimeVo(Date beginTimeVo) { |
| | | this.beginTimeVo = beginTimeVo; |
| | | } |
| | | |
| | | @DateTimeFormat(pattern = DateUtil.DATE_FORMAT_MM) |
| | | private Date beginTimeVo; |
| | | |
| | | public Date getEndTimeVo() { |
| | | return endTimeVo; |
| | | } |
| | | |
| | | public void setEndTimeVo(Date endTimeVo) { |
| | | this.endTimeVo = endTimeVo; |
| | | } |
| | | |
| | | @DateTimeFormat(pattern = DateUtil.DATE_FORMAT_MM) |
| | | private Date endTimeVo; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | |
| | | public Date getOrderTime() { |
| | | return orderTime; |
| | | } |
| | | |
| | | public void setOrderTime(Date orderTime) { |
| | | this.orderTime = orderTime; |
| | | } |
| | | |
| | | public Long getCompanyId() { |
| | | return companyId; |
| | | } |
| | | |
| | | public void setCompanyId(Long companyId) { |
| | | this.companyId = companyId; |
| | | } |
| | | |
| | | public Long getShopId() { |
| | | return shopId; |
| | | } |
| | | |
| | | public void setShopId(Long shopId) { |
| | | this.shopId = shopId; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getQueryKey() { |
| | | return queryKey; |
| | | } |
| | | |
| | | public void setQueryKey(String queryKey) { |
| | | this.queryKey = queryKey; |
| | | } |
| | | |
| | | public Integer getOrderStatus() { |
| | | return orderStatus; |
| | | } |
| | | |
| | | public void setOrderStatus(Integer orderStatus) { |
| | | this.orderStatus = orderStatus; |
| | | switch (orderStatus) { |
| | | case 0 : |
| | | this.status = ""; |
| | | break; |
| | | case 1: |
| | | this.status = "待付款"; |
| | | break; |
| | | case 2: |
| | | this.status = "已付款"; |
| | | break; |
| | | case 3: |
| | | this.status = "欠款"; |
| | | break; |
| | | case 4: |
| | | this.status = "已取消"; |
| | | break; |
| | | default: |
| | | this.status = ""; |
| | | break; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @ApiModel(value = "PadProjectDto", description = "列表接收参数类") |
| | | @Data |
| | | public class PadProjectDto extends BasePageDto { |
| | | |
| | | @ApiModelProperty(value = "会员id", example = "1") |
| | | private Long vipId; |
| | | |
| | | @ApiModelProperty(value = "状态", example = "") |
| | | private String state; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @ApiModel(value = "PadServiceListDto", description = "服务单列表接收参数类") |
| | | @Data |
| | | public class PadServiceListDto extends BasePageDto { |
| | | @ApiModelProperty(value = "状态", example = "待预约") |
| | | private String state; |
| | | |
| | | @ApiModelProperty(value = "会员id", example = "1") |
| | | private Long vipId; |
| | | |
| | | @ApiModelProperty(value = "查询字段") |
| | | private String queryKey; |
| | | |
| | | @ApiModelProperty(value = "预约开始时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date beginTime; |
| | | |
| | | @ApiModelProperty(value = "预约结束时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date closureTime; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @ApiModel(value = "PadShowListDto", description = "列表接收参数类") |
| | | @Data |
| | | public class PadShowListDto extends BasePageDto { |
| | | /** |
| | | * 产品名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 商品分类 组合商品/家居产品/项目/充值卡/综合卡 |
| | | * |
| | | * @return |
| | | */ |
| | | private String goodType; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @ApiModel(value = "PadSignServiceDto", description = "接收参数类") |
| | | @Data |
| | | public class PadSignServiceDto { |
| | | |
| | | @ApiModelProperty(value = "服务单ID", example = "123456") |
| | | @NotNull(message = "服务单不能为空") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "签名图片", example = "") |
| | | @NotBlank(message = "签名图片不能为空") |
| | | private String signPic; |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @ApiModel(value = "PadSkinDto", description = "列表接收参数类") |
| | | @Data |
| | | public class PadSkinDto extends BasePageDto { |
| | | |
| | | @ApiModelProperty(value = "会员id", example = "1") |
| | | private Long vipId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @ApiModel(value = "PadTcDto", description = "列表接收参数类") |
| | | @Data |
| | | public class PadTcDto extends BasePageDto { |
| | | |
| | | |
| | | @ApiModelProperty(value = "会员id", example = "1") |
| | | private Long vipId; |
| | | |
| | | @ApiModelProperty(value = "状态", example = "") |
| | | private String state; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @ApiModel(value = "PadVipCardDto", description = "列表接收参数类") |
| | | @Data |
| | | public class PadVipCardDto extends BasePageDto { |
| | | |
| | | @ApiModelProperty(value = "会员id", example = "1") |
| | | private Long vipId; |
| | | |
| | | @ApiModelProperty(value = "状态", example = "") |
| | | private String state; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import com.matrix.system.app.dto.BasePageDto; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @ApiModel(value = "PadVipListDto", description = "订单列表接收参数类") |
| | | @Data |
| | | public class PadVipListDto extends BasePageDto { |
| | | |
| | | @ApiModelProperty(value = "查询字段") |
| | | private String queryKey; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private Long companyId; |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | @Data |
| | | public class WebPadLoginDto { |
| | | |
| | | @ApiModelProperty(value = "用户名", example = "1234") |
| | | @NotBlank(message = "用户名或密码错误") |
| | | private String username; |
| | | |
| | | @ApiModelProperty(value = "密码", example = "123456") |
| | | @NotBlank(message = "用户名或密码错误") |
| | | private String password; |
| | | |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.vo; |
| | | |
| | | import com.matrix.system.app.vo.OrderDetailAchieveItemVo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @ApiModel(value = "PadOrderDetailItemVo", description = "订单详情明细表") |
| | | public class PadOrderDetailItemVo { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "数量") |
| | | private String count; |
| | | |
| | | @ApiModelProperty(value = "现金支付") |
| | | private BigDecimal cashPay; |
| | | |
| | | @ApiModelProperty(value = "储值卡支付") |
| | | private BigDecimal cardPay; |
| | | |
| | | @ApiModelProperty(value = "欠款") |
| | | private BigDecimal arrears; |
| | | |
| | | @ApiModelProperty(value = "原价") |
| | | private BigDecimal price; |
| | | |
| | | @ApiModelProperty(value = "折扣价格") |
| | | private BigDecimal zkPrice; |
| | | |
| | | @ApiModelProperty(value = "支付状态") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "订单业绩") |
| | | private List<OrderDetailAchieveItemVo> achieves; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public List<OrderDetailAchieveItemVo> getAchieves() { |
| | | return achieves; |
| | | } |
| | | |
| | | public void setAchieves(List<OrderDetailAchieveItemVo> achieves) { |
| | | this.achieves = achieves; |
| | | } |
| | | |
| | | public String getGoodsName() { |
| | | return goodsName; |
| | | } |
| | | |
| | | public void setGoodsName(String goodsName) { |
| | | this.goodsName = goodsName; |
| | | } |
| | | |
| | | public String getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(String count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public BigDecimal getCashPay() { |
| | | return cashPay; |
| | | } |
| | | |
| | | public void setCashPay(BigDecimal cashPay) { |
| | | this.cashPay = cashPay; |
| | | } |
| | | |
| | | public BigDecimal getCardPay() { |
| | | return cardPay; |
| | | } |
| | | |
| | | public void setCardPay(BigDecimal cardPay) { |
| | | this.cardPay = cardPay; |
| | | } |
| | | |
| | | public BigDecimal getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(BigDecimal price) { |
| | | this.price = price; |
| | | } |
| | | |
| | | public BigDecimal getZkPrice() { |
| | | return zkPrice; |
| | | } |
| | | |
| | | public void setZkPrice(BigDecimal zkPrice) { |
| | | this.zkPrice = zkPrice; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public BigDecimal getArrears() { |
| | | return arrears; |
| | | } |
| | | |
| | | public void setArrears(BigDecimal arrears) { |
| | | this.arrears = arrears; |
| | | } |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.system.app.vo.OrderDetailItemVo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @ApiModel(value = "PadOrderDetailVo", description = "订单详情返回参数类") |
| | | public class PadOrderDetailVo { |
| | | |
| | | @ApiModelProperty(value = "订单ID") |
| | | private String orderId; |
| | | |
| | | @ApiModelProperty(value = "会员ID") |
| | | private String vipId; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty(value = "客户") |
| | | private String vipName; |
| | | |
| | | @ApiModelProperty(value = "手机") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private String orderStatus; |
| | | |
| | | @ApiModelProperty(value = "顾问") |
| | | private String staffName; |
| | | |
| | | @ApiModelProperty(value = "订单总价") |
| | | private BigDecimal needPay; |
| | | |
| | | @ApiModelProperty(value = "折后价") |
| | | private BigDecimal realPay; |
| | | |
| | | @JsonFormat(pattern = DateUtil.DATE_FORMAT_SS, timezone = "GMT+8") |
| | | @ApiModelProperty(value = "下单时间") |
| | | private Date orderTime; |
| | | |
| | | @ApiModelProperty(value = "现金支付金额") |
| | | private BigDecimal cashPay; |
| | | |
| | | @ApiModelProperty(value = "储值卡支付金额") |
| | | private BigDecimal cardPay; |
| | | |
| | | @ApiModelProperty(value = "优惠金额") |
| | | private BigDecimal discount; |
| | | |
| | | @ApiModelProperty(value = "订单明细") |
| | | private List<OrderDetailItemVo> items; |
| | | |
| | | @ApiModelProperty(value = "欠款") |
| | | private BigDecimal arrears; |
| | | |
| | | public String getVipId() { |
| | | return vipId; |
| | | } |
| | | |
| | | public void setVipId(String vipId) { |
| | | this.vipId = vipId; |
| | | } |
| | | |
| | | public Date getOrderTime() { |
| | | return orderTime; |
| | | } |
| | | |
| | | public void setOrderTime(Date orderTime) { |
| | | this.orderTime = orderTime; |
| | | } |
| | | |
| | | public String getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(String orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public BigDecimal getArrears() { |
| | | return arrears; |
| | | } |
| | | |
| | | public void setArrears(BigDecimal arrears) { |
| | | this.arrears = arrears; |
| | | } |
| | | |
| | | public String getOrderStatus() { |
| | | return orderStatus; |
| | | } |
| | | |
| | | public void setOrderStatus(String orderStatus) { |
| | | this.orderStatus = orderStatus; |
| | | } |
| | | |
| | | public List<OrderDetailItemVo> getItems() { |
| | | return items; |
| | | } |
| | | |
| | | public void setItems(List<OrderDetailItemVo> items) { |
| | | this.items = items; |
| | | } |
| | | |
| | | public String getVipName() { |
| | | return vipName; |
| | | } |
| | | |
| | | public void setVipName(String vipName) { |
| | | this.vipName = vipName; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getOrderNo() { |
| | | return orderNo; |
| | | } |
| | | |
| | | public void setOrderNo(String orderNo) { |
| | | this.orderNo = orderNo; |
| | | } |
| | | |
| | | public String getStaffName() { |
| | | return staffName; |
| | | } |
| | | |
| | | public void setStaffName(String staffName) { |
| | | this.staffName = staffName; |
| | | } |
| | | |
| | | public BigDecimal getCashPay() { |
| | | return cashPay; |
| | | } |
| | | |
| | | public void setCashPay(BigDecimal cashPay) { |
| | | this.cashPay = cashPay; |
| | | } |
| | | |
| | | public BigDecimal getCardPay() { |
| | | return cardPay; |
| | | } |
| | | |
| | | public void setCardPay(BigDecimal cardPay) { |
| | | this.cardPay = cardPay; |
| | | } |
| | | |
| | | public BigDecimal getNeedPay() { |
| | | return needPay; |
| | | } |
| | | |
| | | public void setNeedPay(BigDecimal needPay) { |
| | | this.needPay = needPay; |
| | | } |
| | | |
| | | public BigDecimal getRealPay() { |
| | | return realPay; |
| | | } |
| | | |
| | | public void setRealPay(BigDecimal realPay) { |
| | | this.realPay = realPay; |
| | | } |
| | | |
| | | public BigDecimal getDiscount() { |
| | | return discount; |
| | | } |
| | | |
| | | public void setDiscount(BigDecimal discount) { |
| | | this.discount = discount; |
| | | } |
| | | } |
New file |
| | |
| | | package com.matrix.system.padApi.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @ApiModel(value = "UserInfoVo", description = "用户信息返回类") |
| | | @Data |
| | | public class UserInfoVo { |
| | | |
| | | @ApiModelProperty(value = "用户ID", example = "1") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "用户名称", example = "呵呵") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "职位", example = "店长") |
| | | private String roleName; |
| | | |
| | | @ApiModelProperty(value = "头像", example = "--") |
| | | private String photo; |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | private String shopName; |
| | | |
| | | } |
| | | |
| | |
| | | res.setContentType("application/octet-stream;charset=UTF-8"); |
| | | |
| | | Date date = new Date(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss"); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | res.setHeader("Content-Disposition", "attachment;filename=" + |
| | | java.net.URLEncoder.encode("订单列表" + dateFormat.format(date) + ".xlsx".trim(), "UTF-8")); |
| | | |
| | |
| | | String wechatLoginUrl = wecharLoginUrl; |
| | | String appId =xcxManagerAppid; |
| | | String secret = xcxManagerSecret; |
| | | |
| | | return String.format(wechatLoginUrl, appId, secret, code); |
| | | } |
| | | |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | oldeUser.setPhoto(loginUser.getAvatarUrl()); |
| | | oldeUser.setAvatarUrl(loginUser.getAvatarUrl()); |
| | | sysVipInfoDao.update(oldeUser); |
| | | sysVipInfoDao.deleteById(loginUser.getId()); |
| | | sysVipInfoDao.deleteLogicByIds(Arrays.asList(loginUser.getId())); |
| | | String token = userCacheManager.saveUserInfo(oldeUser); |
| | | AjaxResult result = AjaxResult.buildSuccessInstance("绑定成功"); |
| | | result.putInMap("token",token); |
| | |
| | | @DateTimeFormat(pattern= DateUtil.DATE_FORMAT_DD) |
| | | private Date failTime; |
| | | |
| | | @ApiModelProperty(value ="状态,有效,无效,转让,冻结,退款") |
| | | @ApiModelProperty(value ="状态,有效,无效,转让,冻结,") |
| | | private String status; |
| | | |
| | | |
| | |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.system.hive.bean.SysOrder; |
| | | import com.matrix.system.hive.dao.SysOrderDao; |
| | | import com.matrix.system.hive.service.SysOrderService; |
| | | import com.rabbitmq.client.DeliverCallback; |
| | | import com.rabbitmq.client.Delivery; |
| | | import com.matrix.system.hive.service.imp.SysOrderServiceHelper; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | SysOrderDao sysOrderDao; |
| | | |
| | | @Autowired |
| | | SysOrderService orderService; |
| | | SysOrderServiceHelper sysOrderServiceHelper; |
| | | |
| | | @Override |
| | | public String getName() { |
| | |
| | | List<SysOrder> list = sysOrderDao.selectByModel(sourceOrder); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | //订单出库 |
| | | orderService.addOutStore(list.get(0)); |
| | | sysOrderServiceHelper.addOutStore(list.get(0)); |
| | | } else { |
| | | LogUtil.error("订单编号{}erp不存在", orderNo); |
| | | } |
| | |
| | | import com.matrix.system.hive.service.ShoppingGoodsService; |
| | | import com.matrix.system.hive.service.SysOrderService; |
| | | import com.matrix.system.hive.service.SysVipInfoService; |
| | | import com.matrix.system.hive.service.imp.SysOrderServiceHelper; |
| | | import com.matrix.system.shopXcx.bean.ShopOrder; |
| | | import com.matrix.system.shopXcx.bean.ShopOrderDetails; |
| | | import com.matrix.system.shopXcx.bean.ShopSku; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderDao; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao; |
| | | import com.matrix.system.shopXcx.dao.ShopSkuDao; |
| | | import com.rabbitmq.client.DeliverCallback; |
| | | import com.rabbitmq.client.Delivery; |
| | | import org.apache.logging.log4j.message.Message; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | @Autowired |
| | | private ShopSalesmanGradeDao shopSalesmanGradeDao; |
| | | |
| | | @Autowired |
| | | private SysOrderServiceHelper sysOrderServiceHelper; |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void synchronizationOrderToErp(ShopOrder orderDto) { |
| | |
| | | orderItemDao.insert(orderItem); |
| | | } |
| | | break; |
| | | case Dictionary.SHOPPING_GOODS_TYPE_ZHK: |
| | | // 新增明细 |
| | | orderItem.setGoodsId(shoppingGoods.getId()); |
| | | // 每一个充值卡都看成一个单独的订单条目 |
| | | count = orderItem.getCount(); |
| | | for (int j = 0; j < count; j++) { |
| | | orderItem.setCount(1); |
| | | orderItem.setId(null); |
| | | orderItemDao.insert(orderItem); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | // 处理收款逻辑 |
| | | SysOrder sourceOrder = sysOrderDao.selectById(order.getId()); |
| | | sourceOrder.setItems(orderItemDao.selectByOrderId(order.getId())); |
| | | // 设置会员充值卡使用情况 |
| | | orderService.addMoneyCardUse(sourceOrder); |
| | | sysOrderServiceHelper.addMoneyCardUse(sourceOrder); |
| | | |
| | | // 改变客户项目套餐使用情况 |
| | | orderService.addTaocanProj(sourceOrder); |
| | | |
| | | // 设置销量 |
| | | orderService.setShopSelCount(sourceOrder); |
| | | sysOrderServiceHelper.addTaocanProj(sourceOrder); |
| | | |
| | | SysOrderFlow flow = new SysOrderFlow(); |
| | | flow.setFlowNo(codeService.getFlowCode() + "-" + i); |
| | |
| | | #数据库链接 |
| | | spring.datasource.username=ct_test |
| | | spring.datasource.password=123456 |
| | | spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 |
| | | |
| | | spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&useSSL=false |
| | | |
| | | #是否启用debug模式 |
| | | debug=false |
| | |
| | | showExcptionUrl=http://test.hive.jyymatrix.cc/showException |
| | | |
| | | |
| | | xcx_manager_appid=wx2948b3b914a9722e |
| | | xcx_manager_secret=1685dfd99a43e213ed8be07870b898ba |
| | | |
| | | |
| | | #百度编辑器,覆盖默认配置 |
| | | ueditor.imageUrlPrefix=http://testfile.hive.jyymatrix.cc/uploadeFile |
| | | ueditor.imagePathFormat=/image/{yyyy}{mm}{dd}/{time}{rand:6} |
| | |
| | | |
| | | spring.profiles.active=alpha |
| | | spring.profiles.active=local |
| | | evn=dev |
| | | server.port=8080 |
| | | |
New file |
| | |
| | | |
| | | ALTER TABLE `sys_proj_services` |
| | | ADD COLUMN `sign_pic` varchar(500) NULL COMMENT '签名图片' AFTER `cashier_id`; |
New file |
| | |
| | | delete from parameter_settings; |
| | | |
| | | update bus_parameter_settings set param_value=1 where param_value='是'; |
| | | update bus_parameter_settings set param_value=2 where param_value='否'; |
| | | |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (32, 'PACKAGE_PRICE', '费用', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (34, 'FREE_PACKAGE_PRICE', '免运费', 1, 'smsType', '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (35, 'SECOND_OUT_PROVINCE_PACKAGE_PRICE', '二级外省邮费', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (36, 'refund_shipping_address', '退货收货地址', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (38, 'PROVINCE_OVER_FREE_PACKAGE', '省内免邮费', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (39, 'OUT_PROVINCE_PACKAGE', '外省包裹', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (40, 'MSG_ALERT_CONTENT_REFUND', '退款短信提醒内容', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (41, 'MSG_ALERT_MOBILE', '提醒手机号码', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (42, 'MSG_ALERT_CONTENT', '短信提醒内容', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (43, 'member_day', '会员日', 4, 'weekType', '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (44, 'max_shop_product', '热销产品最大显示条数', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (45, 'IN_PROVINCE_PACKAGE_PRICE', '省内邮费', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (46, 'IN_PROVINCE_PACKAGE_LIST', '省内列表', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (47, 'IN_PROVINCE_PACKAGE', '省内包裹', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (48, 'FIRST_OUT_PROVINCE_PACKAGE_PRICE', '一级外省邮费', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (49, 'dyqsfyf', '低于起送费运费', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (50, 'miniprogramAppid', '小程序APPID', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (51, 'miniprogramSecret', '小程序Secret', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (52, 'gzhAppId', '公众号APPID', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (53, 'gzhSecret', '公众号Secret', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (54, 'wecharPayMchId', '微信支付商户号', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (55, 'wecharPaySecret', '微信支付秘钥', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (56, 'wecharPaynotifyUrl', '微信支付回调地址', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (58, 'certLocalPath', '微信支付证书', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (59, 'SERVICE_OVER_BEGIN_END', '服务单跳过服务开始与结束步骤', 2, 'whetherType', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (60, 'APP_BANNER_GL', 'APP管理模块Banner', 6, NULL, 'APP设置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (61, 'WAREHOUSE_MANAGE_STOCK', '是否管理产品库存', 2, 'whetherType', '仓库设置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (62, 'wecharpayRechargeNotifyurl', '储值卡充值回调地址', 1, NULL, '微信开发配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (63, 'shopManageJjcpasConsume', '家居产品销售是否生成消耗业绩', 2, 'whetherType', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (64, 'SALE_MAN_IS_CONSUME_ACHIEVE', '下单人是否计算消耗业绩', 2, 'whetherType', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (65, 'wxOrderNoticeDingdingToken', '钉钉通知token', 1, NULL, '微商城配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (66, 'ZS_CONSUME_ACHIEVE', '赠送项目是否计算消耗业绩', 2, 'whetherType', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (67, 'shopManageGiftisfree', '赠送金额购买产品算赠送购买', 2, 'whetherType', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (68, 'shopManageAbleCancelDfkOrder', '门店是否只能取消待付款订单,服务单', 2, 'whetherType', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (69, 'SERVICE_FLOW_TEMPLATE', '跟进记录模板', 1, '', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (70, 'OPEN_SMS_NOTICE', '是否开启短信提醒', 2, 'whetherType', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (71, 'OPEN_SERVICE_ORDER_AUTO_BATCHING', '开启服务单自动配料', 2, 'whetherType', '店务配置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (72, 'ADMIN_SYSTEM_TITLE', '系统名称', 1, NULL, '品牌设置'); |
| | | INSERT INTO `parameter_settings`(`id`, `code`, `name`, `type`, `value`, `category`) VALUES (73, 'ADMIN_BRAND_TITLE', '品牌名称', 1, NULL, '品牌设置'); |
| | | |
| | |
| | | LEFT JOIN shop_activities d ON a.award_id = d.id |
| | | <where> |
| | | a.company_id = #{record.companyId} |
| | | and a.activity_id = #{record.actId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | and a.activity_id = #{record.actId} |
| | | <if test="record.yhmc != null and record.yhmc != ''"> |
| | | and b.nick_name like concat('%',#{record.yhmc},'%') |
| | | </if> |
| | |
| | | left join activity_sign_receive_record e on a.receive_id= e.id |
| | | left join shop_delivery_info f on a.logistics_id= f.id |
| | | <where> |
| | | a.company_id = #{record.companyId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | a.company_id = #{record.companyId} |
| | | <if test="record.zjzxm != null and record.zjzxm != ''"> |
| | | and b.nick_name like concat('%',#{record.zjzxm},'%') |
| | | </if> |
| | |
| | | FROM |
| | | activity_sign_receive_record a |
| | | left join sys_vip_info b on a.user_id= b.id |
| | | where a.user_id = #{userId} and a.award_id = #{receiveId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | where a.user_id = #{userId} and a.award_id = #{receiveId} |
| | | </select> |
| | | |
| | | <select id="selectShopDeliveryInfoByLogisticsId" resultType="com.matrix.system.shopXcx.bean.ShopDeliveryInfo"> |
| | |
| | | LEFT JOIN sys_vip_info c ON a.vip_id = c.id |
| | | LEFT JOIN sys_shop_info d ON a.shop_id = d.id |
| | | <where> |
| | | a.company_id=#{param.companyId} and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | a.company_id=#{param.companyId} |
| | | <if test="param.shopId != null and param.shopId != 0 "> |
| | | and a.shop_id=#{param.shopId} |
| | | </if> |
| | |
| | | sys_vip_info a |
| | | WHERE |
| | | a.recommend_id = #{userId} |
| | | AND a.is_sales = #{isSales} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | AND a.is_sales = #{isSales} |
| | | </select> |
| | | |
| | | <select id="findShopSalesmanApplyList" resultType="com.matrix.system.fenxiao.vo.ShopSalesmanApplyVo"> |
| | |
| | | WHERE s.id = a.parent_user_id ) parentUser, |
| | | c.nick_name parentUserNow, |
| | | ( SELECT COUNT(*) FROM sys_vip_info |
| | | WHERE recommend_id = a.user_id AND is_sales != 1 and (IS_DELETE is null or IS_DELETE = '')) lowerLevelNum, |
| | | WHERE recommend_id = a.user_id AND is_sales != 1 ) lowerLevelNum, |
| | | ( SELECT COUNT(*) FROM sys_vip_info |
| | | WHERE recommend_id = a.user_id AND is_sales = 1 and (IS_DELETE is null or IS_DELETE = '')) invitedNum, |
| | | WHERE recommend_id = a.user_id AND is_sales = 1 ) invitedNum, |
| | | ( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order |
| | | WHERE order_status = 2 AND sales_user_id = a.user_id ) totalRevenue, |
| | | ( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order |
| | |
| | | LEFT JOIN shop_salesman_grade g ON a.grade_id = g.id |
| | | LEFT JOIN sys_vip_info c ON c.id = b.recommend_id |
| | | <where> |
| | | a.company_id=#{record.companyId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | a.company_id=#{record.companyId} |
| | | <if test="record.shenheState != null and record.shenheState != ''"> |
| | | and a.apply_status=#{record.shenheState} |
| | | </if> |
| | |
| | | LEFT JOIN sys_vip_info b ON a.user_id = b.id |
| | | <where> |
| | | a.company_id = #{record.companyId} |
| | | and a.apply_status = #{record.applyStatus} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | and a.apply_status = #{record.applyStatus} |
| | | <if test="record.nickName != null and record.nickName != ''"> |
| | | and b.nick_name like concat('%',#{record.nickName},'%') |
| | | </if> |
| | |
| | | <where> |
| | | a.company_id = #{record.companyId} |
| | | and a.is_sales != 1 |
| | | and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | |
| | | <if test="record.nickName != null and record.nickName != ''"> |
| | | and a.nick_name like concat('%',#{record.nickName},'%') |
| | | </if> |
| | |
| | | ( SELECT count( * ) FROM shop_salesman_order c WHERE c.sales_user_id = #{openId} and revenue_type =1 ) AS salesorderCount, |
| | | ( SELECT count( * ) FROM shop_salesman_order c WHERE c.sales_user_id = #{openId} and revenue_type =2 ) AS invitationOrderCount, |
| | | (select count(*) from sys_vip_info where recommend_id=#{openId} and is_sales=1 |
| | | and (IS_DELETE is null or IS_DELETE = '')) as invitationCount, |
| | | ) as invitationCount, |
| | | (select count(*) from sys_vip_info where recommend_id=#{openId} and is_sales=2 |
| | | and (IS_DELETE is null or IS_DELETE = '')) as customerCount |
| | | ) as customerCount |
| | | from sys_vip_info a where |
| | | a.id=#{id} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | a.id=#{id} |
| | | |
| | | </select> |
| | | |
| | |
| | | WHERE s.id = a.parent_user_id ) parentUser, |
| | | ( SELECT COUNT(*) FROM sys_vip_info |
| | | WHERE recommend_id = a.user_id AND is_sales != 1 |
| | | and (IS_DELETE is null or IS_DELETE = '')) lowerLevelNum, |
| | | ) lowerLevelNum, |
| | | ( SELECT COUNT(*) FROM sys_vip_info |
| | | WHERE recommend_id = a.user_id AND is_sales = 1 |
| | | and (IS_DELETE is null or IS_DELETE = '')) invitedNum, |
| | | ) invitedNum, |
| | | ( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order |
| | | WHERE order_status = 2 AND sales_user_id = a.user_id ) totalRevenue, |
| | | ( SELECT IFNULL(sum(IFNULL(amount, 0)), 0) FROM shop_salesman_order |
| | |
| | | shop_salesman_apply a |
| | | LEFT JOIN sys_vip_info b ON a.user_id = b.id |
| | | LEFT JOIN shop_salesman_grade g ON a.grade_id = g.id |
| | | where a.id = #{applyId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | where a.id = #{applyId} |
| | | </select> |
| | | |
| | | <select id="findCustomDetail" resultType="com.matrix.system.fenxiao.vo.ShopCustomDetailVo"> |
| | |
| | | <where> |
| | | b.company_id = #{record.companyId} |
| | | AND b.is_sales != 1 |
| | | and b.recommend_id = #{record.userId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | and b.recommend_id = #{record.userId} |
| | | <if test="record.userName != null and record.userName != ''"> |
| | | and b.nick_name like concat('%',#{record.userName},'%') |
| | | </if> |
| | |
| | | a.company_id = #{record.companyId} |
| | | AND b.is_sales = 1 |
| | | and b.recommend_id = #{record.userId} |
| | | and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | |
| | | and a.apply_status = 2 |
| | | <if test="record.userName != null and record.userName != ''"> |
| | | and b.nick_name like concat('%',#{record.userName},'%') |
| | |
| | | left join shop_order c on a.order_id=c.id |
| | | LEFT JOIN sys_shop_info f on f.id = c.store_id |
| | | <where> |
| | | a.sales_user_id = #{record.userId} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | a.sales_user_id = #{record.userId} |
| | | <if test="record.orderType != null and record.orderType != ''"> |
| | | and a.order_status = #{record.orderType} |
| | | </if> |
| | |
| | | LEFT JOIN shopping_goods_category i ON e.cate_id = i.id |
| | | left join sys_proj_services l on a.service_order_id=l.id |
| | | <where> |
| | | and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | |
| | | <if test="record!=null"> |
| | | <if |
| | | test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) "> |
| | |
| | | LEFT JOIN shopping_goods_category j ON i.parent_id = j.id |
| | | left join sys_proj_services l on a.service_order_id=l.id |
| | | <where> |
| | | and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | |
| | | <if test="record!=null"> |
| | | <if |
| | | test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) "> |
| | |
| | | left join sys_users b on a.BEATUY_ID=b.su_id |
| | | inner join sys_shop_info c on c.id=a.SHOP_ID |
| | | <where> |
| | | and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | |
| | | <if test="record.vipName != null and record.vipName !=''"> |
| | | and (a.vip_name like CONCAT(CONCAT('%', #{record.vipName}), '%') or a.vip_no=#{record.vipName} or a.phone = #{record.vipName}) |
| | | </if> |
| | |
| | | left join sys_users b on a.BEATUY_ID=b.su_id |
| | | inner join sys_shop_info c on c.id=a.SHOP_ID |
| | | <where> |
| | | and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | |
| | | <if test="record.vipName != null and record.vipName !=''"> |
| | | and (a.vip_name like CONCAT(CONCAT('%', #{record.vipName}), '%') or a.vip_no=#{record.vipName} or a.phone = #{record.vipName}) |
| | | </if> |
| | |
| | | left join sys_order_item j on a.order_item_id=j.ID |
| | | left join achieve_rule u on u.id=e.achieve_rule_id |
| | | <where> |
| | | and a.company_id = #{record.companyId} and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | and a.company_id = #{record.companyId} |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id = #{record.shopId} |
| | | </if> |
| | |
| | | from sys_users a |
| | | left join achieve_new b on a.su_id=b.beault_id |
| | | left join sys_vip_info c on b.vip_id=c.ID |
| | | where 1=1 and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record.companyId != null"> |
| | | and a.company_id=#{record.companyId} |
| | | </if> |
| | |
| | | from sys_users a |
| | | left join achieve_new b on a.su_id=b.beault_id |
| | | left join sys_vip_info c on b.vip_id=c.ID |
| | | where 1=1 and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record.companyId != null"> |
| | | and a.company_id=#{record.companyId} |
| | | </if> |
| | |
| | | LEFT JOIN sys_proj_services b ON a.SERVICES_ID = b.ID |
| | | LEFT JOIN sys_vip_info c ON b.VIP_ID = c.ID |
| | | LEFT JOIN sys_users d on d.su_id=a.STAFF_ID |
| | | WHERE b.state='服务单结束' and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | WHERE b.state='服务单结束' |
| | | ) t |
| | | GROUP BY |
| | | t.VIP_ID, |
| | |
| | | LEFT JOIN sys_proj_services b on a.service_id=b.ID |
| | | LEFT JOIN sys_vip_info c on b.VIP_ID=c.ID |
| | | LEFT JOIN sys_users e on e.su_id=a.operation_id |
| | | where 1=1 and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | |
| | | <if test="record.beginTime != null "> |
| | |
| | | LEFT JOIN sys_proj_services b on a.service_id=b.ID |
| | | LEFT JOIN sys_vip_info c on b.VIP_ID=c.ID |
| | | LEFT JOIN sys_users e on e.su_id=a.operation_id |
| | | where 1=1 and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | |
| | | <if test="record.beginTime != null "> |
| | |
| | | and a.operation_id = #{record.operationId} |
| | | </if> |
| | | <if test="record.shopId != null and record.shopId !='' "> |
| | | AND b.VIP_ID IN (SELECT t.ID FROM sys_vip_info t WHERE t.shop_id = #{record.shopId} and (t.IS_DELETE is null or t.IS_DELETE = '')) |
| | | AND b.VIP_ID IN (SELECT t.ID FROM sys_vip_info t WHERE t.shop_id = #{record.shopId} ) |
| | | </if> |
| | | <if test="record.shopId != null and record.shopId !='' "> |
| | | AND b.shop_id = #{record.shopId} |
| | |
| | | LEFT JOIN sys_proj_services b on a.service_id=b.ID |
| | | LEFT JOIN sys_vip_info c on b.VIP_ID=c.ID |
| | | LEFT JOIN sys_users e on e.su_id=a.operation_id |
| | | where 1=1 and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | |
| | | <if test="record.beginTime != null "> |
| | |
| | | LEFT JOIN sys_proj_services b on a.service_id=b.ID |
| | | LEFT JOIN sys_vip_info c on b.VIP_ID=c.ID |
| | | LEFT JOIN sys_users e on e.su_id=a.operation_id |
| | | where 1=1 and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | |
| | | <if test="record.beginTime != null "> |
| | |
| | | and a.operation_id = #{record.operationId} |
| | | </if> |
| | | <if test="record.shopId != null and record.shopId !='' "> |
| | | AND b.VIP_ID IN (SELECT t.ID FROM sys_vip_info t WHERE t.shop_id = #{record.shopId} and (t.IS_DELETE is null or t.IS_DELETE = '')) |
| | | AND b.VIP_ID IN (SELECT t.ID FROM sys_vip_info t WHERE t.shop_id = #{record.shopId} ) |
| | | </if> |
| | | <if test="record.searchShop != null and record.searchShop !=''"> |
| | | AND b.shop_id = #{record.searchShop} |
| | |
| | | LEFT JOIN sys_proj_services b on a.service_id=b.ID |
| | | LEFT JOIN sys_vip_info c on b.VIP_ID=c.ID |
| | | LEFT JOIN sys_users e on e.su_id=a.operation_id |
| | | where 1=1 and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | |
| | | <if test="record.beginTime != null "> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.matrix.system.hive.dao.ShoppingGoodsDao"> |
| | | <cache readOnly="true"></cache> |
| | | |
| | | <resultMap type="ShoppingGoods" id="ShoppingGoodsMap"> |
| | | |
| | | <id property="id" column="id" /> |
| | |
| | | and a.STATE !='预约取消' |
| | | and a.STATE !='待确认' |
| | | and a.STATE !='服务单结束' |
| | | and a.STATE !='待预约' and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | and a.STATE !='待预约' |
| | | order by a.BEGIN_TIME asc |
| | | |
| | | </select> |
| | |
| | | left join sys_vip_info c on a.vip_id=c.id |
| | | <where> |
| | | and a.company_id=#{companyId} |
| | | and (c.IS_DELETE is null or c.IS_DELETE = '') |
| | | |
| | | <if test="shopId != null "> |
| | | and a.shop_id=#{shopId} |
| | | </if> |
| | |
| | | <insert id="insert" parameterType="SysInstoreInfo" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | INSERT INTO sys_instore_info ( |
| | | ID, |
| | | INSTORE_DATE, |
| | | INSTORE_TYPE, |
| | | AMMOUNT_ALL, |
| | |
| | | company_id |
| | | ) |
| | | VALUES ( |
| | | #{id}, |
| | | #{instoreDate}, |
| | | #{instoreType}, |
| | | #{ammountAll}, |
| | |
| | | left JOIN sys_users c on c.su_id=a.STAFF_ID |
| | | left JOIN sys_users e on e.su_id=a.cashier_id |
| | | left JOIN sys_shop_info d on d.ID=a.SHOP_ID |
| | | where 1=1 and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | <if test="record.keyWordVo != null and record.keyWordVo!='' "> |
| | | and (b.PHONE like concat('%',#{record.keyWordVo},'%') |
| | |
| | | LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID |
| | | left JOIN sys_users c on c.su_id=a.STAFF_ID |
| | | left JOIN sys_shop_info d on d.ID=a.SHOP_ID |
| | | where 1=1 and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | where 1=1 |
| | | <if test="record!=null"> |
| | | <if test="record.keyWordVo != null and record.keyWordVo!='' "> |
| | | and (b.PHONE like concat('%',#{record.keyWordVo},'%') |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectPadApiOrderListInPage" resultType="com.matrix.system.padApi.vo.PadOrderDetailVo"> |
| | | select |
| | | a.id orderId, |
| | | a.VIP_ID vipId, |
| | | a.ORDER_NO orderNo, |
| | | a.ORDER_TIME orderTime, |
| | | a.STATU orderStatus, |
| | | a.ZK_TOTAL needPay, |
| | | (a.card_Pay + a.cash_Pay) realPay, |
| | | a.arrears arrears, |
| | | b.su_name staffName, |
| | | c.VIP_NAME vipName, |
| | | c.PHONE phone |
| | | from sys_order a |
| | | left join sys_users b on a.STAFF_ID = b.su_id |
| | | left join sys_vip_info c on c.id = a.VIP_ID |
| | | <where> |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(c.vip_name, #{record.queryKey}) or instr(c.phone, #{record.queryKey}) or instr(a.order_no, #{record.queryKey})) |
| | | </if> |
| | | <if test="record.status != null and record.status != ''"> |
| | | and a.statu = #{record.status} |
| | | </if> |
| | | <if test="record.orderTime != null "> |
| | | and a.ORDER_TIME = #{record.orderTime} |
| | | </if> |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id=#{record.shopId} |
| | | </if> |
| | | <if test="record.companyId != null"> |
| | | and a.company_id=#{record.companyId} |
| | | </if> |
| | | </where> |
| | | <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 --> |
| | | order by a.order_time desc |
| | | <if test="pageVo.offset >=0 and pageVo.limit >0"> |
| | | limit |
| | | #{pageVo.offset},#{pageVo.limit} |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectApiOrderListTotal" resultType="java.lang.Integer"> |
| | | select |
| | | count(1) |
| | |
| | | </if> |
| | | <if test="record.status != null and record.status != ''"> |
| | | and a.statu = #{record.status} |
| | | </if> |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id=#{record.shopId} |
| | | </if> |
| | | <if test="record.companyId != null"> |
| | | and a.company_id=#{record.companyId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectPadApiOrderListTotal" resultType="java.lang.Integer"> |
| | | select |
| | | count(1) |
| | | from sys_order a |
| | | left join sys_users b on a.STAFF_ID = b.su_id |
| | | left join sys_vip_info c on c.id = a.VIP_ID |
| | | <where> |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(c.vip_name, #{record.queryKey}) or instr(c.phone, #{record.queryKey}) or instr(a.order_no, #{record.queryKey})) |
| | | </if> |
| | | <if test="record.status != null and record.status != ''"> |
| | | and a.statu = #{record.status} |
| | | </if> |
| | | <if test="record.orderTime != null "> |
| | | and a.ORDER_TIME = #{record.orderTime} |
| | | </if> |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id=#{record.shopId} |
| | |
| | | where a.id=#{orderId} |
| | | </select> |
| | | |
| | | <select id="selectPadApiOrderDetailById" resultType="com.matrix.system.padApi.vo.PadOrderDetailVo"> |
| | | select |
| | | a.id orderId, |
| | | b.VIP_NAME vipName, |
| | | b.PHONE phone, |
| | | a.ORDER_NO orderNo, |
| | | c.su_name staffName, |
| | | a.cash_Pay cashPay, |
| | | a.card_Pay cardPay, |
| | | a.ZK_TOTAL needPay, |
| | | a.cash_Pay + a.card_Pay realPay, |
| | | a.arrears arrears, |
| | | a.TOTAL - a.ZK_TOTAL discount, |
| | | a.STATU orderStatus, |
| | | a.order_time orderTime |
| | | from sys_order a |
| | | inner join sys_vip_info b on a.VIP_ID=b.ID |
| | | left join sys_users c on a.STAFF_ID=c.su_id |
| | | where a.id=#{orderId} |
| | | </select> |
| | | |
| | | <select id="selectShopAchieveRanking" resultType="com.matrix.system.app.vo.RankingVo"> |
| | | select |
| | | b.shop_short_name name, |
| | |
| | | <insert id="insert" parameterType="SysOrderItem" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | INSERT INTO sys_order_item ( |
| | | ID, |
| | | ORDER_ID, |
| | | COUNT, |
| | | refundCount, |
| | |
| | | pay_method_detail |
| | | ) |
| | | VALUES ( |
| | | #{id}, |
| | | #{orderId}, |
| | | #{count}, |
| | | #{refundCount}, |
| | |
| | | a.card_Pay cardPay, |
| | | a.PRICE price, |
| | | a.ZK_PRICE zkPrice, |
| | | a.type type, |
| | | a.status status |
| | | from sys_order_item a |
| | | inner join shopping_goods b on a.goods_id=b.id |
| | | where a.ORDER_ID=#{orderId}; |
| | | </select> |
| | | |
| | | <select id="selectPadApiOrderDetailItemsByOrderId" resultType="com.matrix.system.padApi.vo.PadOrderDetailItemVo"> |
| | | select |
| | | a.id id, |
| | | b.name goodsName, |
| | | a.COUNT count, |
| | | a.cash_Pay cashPay, |
| | | a.card_Pay cardPay, |
| | | a.PRICE price, |
| | | a.ZK_PRICE zkPrice, |
| | | a.status status |
| | | from sys_order_item a |
| | | inner join shopping_goods b on a.goods_id=b.id |
| | |
| | | left join sys_order b on a.ORDER_ID=b.id |
| | | where a.type='家居产品' and DATE_FORMAT(a.create_time,'%Y-%m')='2021-04' and b.company_id=17 and b.STATU='已付款'; |
| | | </select> |
| | | <select id="selectOrderStatusByItemId" resultType="java.lang.String"> |
| | | select b.statu from sys_order_item a |
| | | left join sys_order b on a.ORDER_ID=b.id |
| | | where a.id=#{orderItemId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result property="reply" column="reply"/> |
| | | <result property="overtimeNotice" column="overtime_notice"/> |
| | | <result property="cashierId" column="cashier_id"/> |
| | | <result property="signPic" column="sign_pic"/> |
| | | <result property="cashierName" column="cashierName"/> |
| | | |
| | | |
| | |
| | | <if test="cashierId != null "> |
| | | cashier_id = #{cashierId}, |
| | | </if> |
| | | <if test="signPic != null "> |
| | | sign_pic = #{signPic}, |
| | | </if> |
| | | </set> |
| | | WHERE id=#{id} |
| | | </update> |
| | |
| | | FROM sys_proj_services a |
| | | LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID |
| | | left join sys_beautician_state c on a.id=c.SERVICES_ID |
| | | WHERE 1 = 1 and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | WHERE 1 = 1 |
| | | <if test="record!=null"> |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(c.vip_name, #{record.queryKey}) or instr(c.phone, #{record.queryKey}) or instr(a.order_no, #{record.queryKey})) |
| | | </if> |
| | | <if test="record.queryStaffId != null and record.queryStaffId !='' "> |
| | | and (a.CREATE_STAFF_ID = #{record.queryStaffId} or c.STAFF_ID=#{record.queryStaffId} ) |
| | | </if> |
| | |
| | | FROM sys_proj_services a |
| | | LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID |
| | | left join sys_beautician_state c on a.id=c.SERVICES_ID |
| | | WHERE 1 = 1 and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | WHERE 1 = 1 |
| | | <if test="record!=null"> |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(c.vip_name, #{record.queryKey}) or instr(c.phone, #{record.queryKey}) or instr(a.order_no, #{record.queryKey})) |
| | | </if> |
| | | <if test="record.queryStaffId != null and record.queryStaffId !='' "> |
| | | and (a.CREATE_STAFF_ID = #{record.queryStaffId} or c.STAFF_ID=#{record.queryStaffId} ) |
| | | </if> |
| | |
| | | FROM sys_proj_services a |
| | | LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID |
| | | left join sys_beautician_state c on a.id=c.SERVICES_ID |
| | | where a.ID=#{id} and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | where a.ID=#{id} |
| | | </select> |
| | | |
| | | <select id="selectNeedNoticeService" resultMap="SysProjServicesMap"> |
| | |
| | | LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID |
| | | where a.YY_TIME > now() |
| | | and DATE_ADD(now(),INTERVAL 1 HOUR) > a.YY_TIME |
| | | and overtime_notice is null and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | and overtime_notice is null |
| | | </select> |
| | | |
| | | |
| | |
| | | FROM sys_proj_services a |
| | | LEFT JOIN sys_vip_info b on b.ID=a.VIP_ID |
| | | left join sys_beautician_state c on a.id=c.SERVICES_ID |
| | | WHERE 1 = 1 and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | WHERE 1 = 1 |
| | | <if test="record!=null"> |
| | | <if test="record.queryStaffId != null and record.queryStaffId !='' "> |
| | | and (a.CREATE_STAFF_ID = #{record.queryStaffId} or c.STAFF_ID=#{record.queryStaffId} ) |
| | |
| | | left join sys_proj_use g on b.puse_id=g.ID |
| | | left join sys_shop_info h on a.SHOP_ID=h.ID |
| | | <where> |
| | | and a.company_id=#{record.companyId} and (e.IS_DELETE is null or e.IS_DELETE = '') |
| | | and a.company_id=#{record.companyId} |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(a.SERVICE_NO, #{record.queryKey}) or instr(e.phone, #{record.queryKey}) or instr(e.vip_name, #{record.queryKey}) ) |
| | | </if> |
| | |
| | | left join sys_users f on f.su_id=b.STAFF_ID |
| | | left join sys_proj_use g on b.puse_id=g.ID |
| | | <where> |
| | | and a.company_id=#{record.companyId} and (e.IS_DELETE is null or e.IS_DELETE = '') |
| | | and a.company_id=#{record.companyId} |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(a.SERVICE_NO, #{record.queryKey}) or instr(e.phone, #{record.queryKey}) or instr(e.vip_name, #{record.queryKey}) ) |
| | | </if> |
| | |
| | | left join sys_shop_info h on a.SHOP_ID=h.ID |
| | | left join shopping_goods m on g.proj_id=m.id |
| | | <where> |
| | | and (e.IS_DELETE is null or e.IS_DELETE = '') |
| | | |
| | | <if test="queryKey != null and queryKey != ''"> |
| | | and instr(a.SERVICE_NO, #{queryKey}) |
| | | </if> |
| | |
| | | left join sys_proj_use g on b.puse_id=g.ID |
| | | left join sys_shop_info h on a.SHOP_ID=h.ID |
| | | left join shopping_goods m on g.proj_id=m.id |
| | | where a.id=#{id} and (e.IS_DELETE is null or e.IS_DELETE = '') |
| | | where a.id=#{id} |
| | | </select> |
| | | |
| | | |
| | |
| | | create_time, |
| | | update_by, |
| | | update_time, |
| | | id, |
| | | proj_use_id, |
| | | surplus_count, |
| | | is_over, |
| | |
| | | now(), |
| | | #{updateBy}, |
| | | now(), |
| | | #{id}, |
| | | #{projUseId}, |
| | | #{surplusCount}, |
| | | #{isOver}, |
| | |
| | | select count(1) from sys_proj_use |
| | | where taocan_id=#{taocanId} and vip_id=#{vipId} |
| | | </select> |
| | | <select id="selectUseCountByOrderItemId" resultType="java.lang.Integer"> |
| | | SELECT count(*) |
| | | from sys_beautician_state a |
| | | LEFT JOIN sys_proj_use b on a.puse_id=b.ID |
| | | left join sys_proj_services c on a.SERVICES_ID=c.id |
| | | where b.ORDER_ITEM_ID=#{orderItemId} |
| | | and c.STATE !='预约取消'; |
| | | </select> |
| | | <select id="selectByOrderItemId" resultType="com.matrix.system.hive.bean.SysProjUse"> |
| | | select * from sys_proj_use where ORDER_ITEM_ID =#{orderItemId} |
| | | </select> |
| | | </mapper> |
| | |
| | | COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, |
| | | EMAIL,CREATE_TIME,UUID,BALANCE,blood,sfCard,link,marry,vocation,handleTime from |
| | | sys_vip_info |
| | | WHERE company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') |
| | | WHERE company_id=#{companyId} and IS_DELETE = 'N' |
| | | and (STAFF_ID = #{staffId} or BEATUY_ID = #{staffId}) |
| | | AND datediff(date_add(concat( |
| | | date_format(BIRTHDAY1, "%Y"), |
| | |
| | | select count(*) from |
| | | sys_vip_info |
| | | WHERE |
| | | company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') |
| | | company_id=#{companyId} and IS_DELETE = 'N' |
| | | AND (STAFF_ID = #{staffId} or BEATUY_ID = #{staffId}) |
| | | AND datediff(date_add(concat( |
| | | date_format(BIRTHDAY1, "%Y"), |
| | |
| | | sys_vip_info a |
| | | LEFT JOIN service_record b ON a.ID |
| | | = b.vip_id |
| | | WHERE company_id=#{companyId} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | WHERE company_id=#{companyId} and a.IS_DELETE = 'N' |
| | | and (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) |
| | | AND b.follow_time BETWEEN curdate() |
| | | AND |
| | |
| | | LEFT JOIN service_record b ON a.ID |
| | | = b.vip_id |
| | | WHERE |
| | | company_id=#{companyId} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | company_id=#{companyId} |
| | | and a.IS_DELETE = 'N' |
| | | and |
| | | (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) |
| | | AND b.follow_time BETWEEN curdate() |
| | |
| | | sys_vip_info a |
| | | LEFT JOIN sys_proj_services b ON a.ID = b.VIP_ID |
| | | WHERE |
| | | company_id=#{companyId} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | company_id=#{companyId} |
| | | and a.IS_DELETE = 'N' |
| | | and |
| | | (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) |
| | | AND b.YY_TIME BETWEEN curdate() |
| | |
| | | |
| | | LEFT JOIN sys_proj_services b ON a.ID = b.VIP_ID |
| | | WHERE |
| | | company_id=#{companyId} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | company_id=#{companyId} |
| | | and a.IS_DELETE = 'N' |
| | | and |
| | | (a.STAFF_ID = #{staffId} or a.BEATUY_ID = #{staffId}) |
| | | AND b.YY_TIME BETWEEN curdate() |
| | |
| | | </delete> |
| | | |
| | | <update id="deleteLogicByIds" parameterType="java.util.List"> |
| | | UPDATE sys_vip_info set IS_DELETE = '已删除' where ID in |
| | | UPDATE sys_vip_info set IS_DELETE = 'Y' where ID in |
| | | <foreach collection="list" index="index" item="item" open="(" |
| | | separator="," close=")"> |
| | | #{item} |
| | |
| | | |
| | | <select id="findByOpenId" resultMap="SysVipInfoMap"> |
| | | select * |
| | | from sys_vip_info where openid=#{openId} and (IS_DELETE is null or IS_DELETE = '') |
| | | from sys_vip_info where openid=#{openId} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | <!-- 根据手机和密码查询 --> |
| | |
| | | <!-- 判断是否为唯一 --> |
| | | <select id="selectTotalByField" resultType="java.lang.Integer"> |
| | | select count(*) from |
| | | sys_vip_info where ${field} = #{value} and (IS_DELETE is null or IS_DELETE = '') |
| | | sys_vip_info where ${field} = #{value} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | <!-- 根据对象查询 --> |
| | |
| | | COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, |
| | | EMAIL,CREATE_TIME,UUID,BALANCE |
| | | from sys_vip_info where |
| | | company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') |
| | | company_id=#{companyId} and IS_DELETE = 'N' |
| | | and PHONE like concat('%',#{keyWord},'%') limit 0,10 |
| | | |
| | | </select> |
| | |
| | | COMMISSION_ALL,IN_DATE,STAFF_ID,SHOP_ID,IS_DELETE,REMARK,PASSWORD, |
| | | EMAIL,CREATE_TIME,UUID,BALANCE,blood,sfCard,link,marry,vocation |
| | | from sys_vip_info |
| | | where company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') |
| | | where company_id=#{companyId} and IS_DELETE = 'N' |
| | | and (instr(PHONE,#{keyWord}) |
| | | or instr(VIP_NAME ,#{keyWord}) |
| | | or instr(zjm ,#{keyWord}) |
| | |
| | | <include refid="select"></include> |
| | | <include refid="from"></include> |
| | | where 1=1 |
| | | and a.IS_DELETE = 'N' |
| | | and |
| | | (a.VIP_NO =#{key} or |
| | | a.VIP_NAME =#{key} or |
| | |
| | | |
| | | <sql id="whereVo"> |
| | | <where> |
| | | and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | a.IS_DELETE = 'N' |
| | | <if test="record!=null"> |
| | | <if test="record.keyWord != null and record.keyWord !='' "> |
| | | and (a.VIP_NO like CONCAT('%',#{record.keyWord},'%') or |
| | |
| | | </sql> |
| | | |
| | | <sql id="where"> |
| | | where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where 1=1 and a.IS_DELETE = 'N' |
| | | <if test="record!=null"> |
| | | <if test="record.id != null and record.id !='' "> |
| | | and a.ID = #{record.id} |
| | |
| | | </if> |
| | | <if test="record.phone != null and record.phone !='' "> |
| | | and a.PHONE like CONCAT('%',#{record.phone},'%') |
| | | </if> |
| | | <if test="record.padQueryKey != null and record.padQueryKey !='' "> |
| | | and (a.PHONE like CONCAT('%',#{record.padQueryKey},'%') |
| | | or instr(a.VIP_NAME ,#{record.padQueryKey}) ) |
| | | </if> |
| | | <if test="record.sex != null and record.sex !='' "> |
| | | and a.SEX = #{record.sex} |
| | |
| | | |
| | | (select a.id from sys_vip_info a |
| | | |
| | | where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where 1=1 and a.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and a.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | f.vip_name as name |
| | | from sys_vip_info d |
| | | LEFT JOIN sys_vip_info f on d.parent_id = f.id |
| | | where 1=1 and (d.IS_DELETE is null or d.IS_DELETE = '') |
| | | where 1=1 and d.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and d.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | |
| | | (select a.id from sys_vip_info a |
| | | |
| | | where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where 1=1 and a.IS_DELETE = 'N') |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and a.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | f.vip_name as name |
| | | from sys_vip_info d |
| | | LEFT JOIN sys_vip_info f on d.parent_id = f.id |
| | | where 1=1 and (d.IS_DELETE is null or d.IS_DELETE = '') |
| | | where 1=1 and d.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and d.parent_id = #{record.parentId} |
| | | </if>)k |
| | |
| | | f.vip_name as name |
| | | from sys_vip_info d |
| | | LEFT JOIN sys_vip_info f on d.parent_id = f.id |
| | | where 1=1 and (d.IS_DELETE is null or d.IS_DELETE = '') |
| | | where 1=1 and d.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and d.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | count(*) |
| | | from sys_vip_info d |
| | | LEFT JOIN sys_vip_info f on d.parent_id = f.id |
| | | where 1=1 and (d.IS_DELETE is null or d.IS_DELETE = '') |
| | | where 1=1 and d.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and d.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | |
| | | (select a.id from sys_vip_info a |
| | | |
| | | where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where 1=1 and a.IS_DELETE = 'N' |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and a.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | |
| | | (select a.id from sys_vip_info a |
| | | |
| | | where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where a.IS_DELETE = 'N') |
| | | <if test="record.parentId != null and record.parentId !='' "> |
| | | and a.parent_id = #{record.parentId} |
| | | </if> |
| | |
| | | |
| | | <select id="selectByPhone" resultMap="SysVipInfoMapSimple"> |
| | | |
| | | select * from sys_vip_info where PHONE = #{phone} and company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') |
| | | select * from sys_vip_info where PHONE = #{phone} and company_id=#{companyId} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | |
| | | <select id="selectVipTelphoneByIds" resultType="java.lang.String"> |
| | | select phone from sys_vip_info |
| | | where phone is not null and (IS_DELETE is null or IS_DELETE = '') and id in |
| | | where phone is not null and IS_DELETE = 'N' and id in |
| | | <foreach collection="list" index="index" item="item" open="(" |
| | | separator="," close=")"> |
| | | #{item} |
| | |
| | | <select id="selectAllVipPhone" resultType="java.lang.String"> |
| | | select phone from sys_vip_info |
| | | where |
| | | company_id=#{companyId} and (IS_DELETE is null or IS_DELETE = '') |
| | | company_id=#{companyId} and IS_DELETE = 'N' |
| | | and phone is not null |
| | | |
| | | </select> |
| | | |
| | | <select id="selectVipPhoneWithShop" resultType="java.lang.String"> |
| | | select phone from sys_vip_info |
| | | where phone is not null and shop_id=#{shopId} and (IS_DELETE is null or IS_DELETE = '') |
| | | where phone is not null and shop_id=#{shopId} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | <select id="selectOldUserByTelphone" resultMap="SysVipInfoMap"> |
| | | select * from sys_vip_info where phone=#{telphone} and is_deal=1 and (IS_DELETE is null or IS_DELETE = '') |
| | | select * from sys_vip_info where phone=#{telphone} and is_deal=1 and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | |
| | |
| | | </insert> |
| | | |
| | | <select id="selectVipInfoByVipNo" resultMap="SysVipInfoMapSimple"> |
| | | select * from sys_vip_info where company_id=#{companyId} and vip_no=#{vipNo} and (IS_DELETE is null or IS_DELETE = '') |
| | | select * from sys_vip_info where company_id=#{companyId} and vip_no=#{vipNo} and IS_DELETE = 'N' |
| | | </select> |
| | | |
| | | <select id="selectVipAddressBookByList" resultType="com.matrix.system.app.vo.VipInfoListVo"> |
| | |
| | | </if> |
| | | left join sys_shop_info g on a.shop_id = g.id |
| | | left join sys_vip_level h on a.level_id=h.id |
| | | where 1=1 and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where 1=1 and a.IS_DELETE = 'N' |
| | | <if test="record.queryKey != null and record.queryKey != ''"> |
| | | and (instr(PHONE,#{record.queryKey}) |
| | | or instr(VIP_NAME ,#{record.queryKey}) |
| | |
| | | left join money_card_use b on a.ID = b.vip_id and b.status='有效' |
| | | left join sys_vip_level c on a.LEVEL_ID = c.ID |
| | | left join sys_shop_info e on a.SHOP_ID=e.ID |
| | | where a.ID=#{id} and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where a.ID=#{id} |
| | | </select> |
| | | |
| | | |
| | |
| | | inner join sys_order b on a.ID=b.VIP_ID |
| | | inner join sys_shop_info c on a.SHOP_ID=c.ID |
| | | left join sys_users d on a.STAFF_ID=d.su_id |
| | | where b.STATU='欠款' and b.arrears!=0 and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where b.STATU='欠款' and b.arrears!=0 and a.IS_DELETE = 'N' |
| | | <if test="record.companyId!=null"> |
| | | and a.company_id=#{record.companyId} |
| | | </if> |
| | |
| | | inner join sys_order b on a.ID=b.VIP_ID |
| | | inner join sys_shop_info c on a.SHOP_ID=c.ID |
| | | left join sys_users d on a.STAFF_ID=d.su_id |
| | | where b.STATU='欠款' and b.arrears!=0 and (a.IS_DELETE is null or a.IS_DELETE = '') |
| | | where b.STATU='欠款' and b.arrears!=0 and a.IS_DELETE = 'N' |
| | | <if test="record.companyId!=null"> |
| | | and a.company_id=#{record.companyId} |
| | | </if> |
| | |
| | | from shop_activities_group_join t1 |
| | | inner join shop_activities_group_price t2 on t1.gp_id=t2.id |
| | | inner join sys_vip_info t3 on t1.gj_head_id=t3.id |
| | | where t1.act_id = #{record.actId} and (t3.IS_DELETE is null or t3.IS_DELETE = '') |
| | | where t1.act_id = #{record.actId} |
| | | <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 --> |
| | | <if test="pageVo.sort !=null and pageVo.order !=null"> |
| | | order by |
| | |
| | | from shop_activities_group_join t1 |
| | | inner join shop_activities_group_join_user t2 on t1.id=t2.gj_id and t2.is_has_cancel=2 and t2.is_has_pay=1 |
| | | left join sys_vip_info t3 on t2.user_id=t3.id |
| | | where t1.id=#{gjId} and (t3.IS_DELETE is null or t3.IS_DELETE = '') |
| | | where t1.id=#{gjId} |
| | | </select> |
| | | |
| | | <select id="selectOwnerGroupJoinInfoWithNoPay" resultMap="ShopActivitiesGroupJoinMap"> |
| | |
| | | from shop_activities_group_join t1 |
| | | inner join shop_activities_group_join_user t2 on t1.id=t2.gj_id and t2.is_has_cancel=2 |
| | | left join sys_vip_info t3 on t2.user_id=t3.id |
| | | where t1.id=#{gjId} and (t3.IS_DELETE is null or t3.IS_DELETE = '') |
| | | where t1.id=#{gjId} |
| | | </select> |
| | | |
| | | <select id="selectIsExistGroupInfoByUserId" resultMap="ShopActivitiesGroupJoinMap"> |
| | |
| | | from shop_activities_group_join t1 |
| | | inner join shop_activities_group_price t2 on t1.gp_id=t2.id |
| | | left join sys_vip_info t3 on t1.gj_head_id=t3.id |
| | | where t1.act_id=#{actId} and t1.gj_status=3 and (t3.IS_DELETE is null or t3.IS_DELETE = '') |
| | | where t1.act_id=#{actId} and t1.gj_status=3 |
| | | </select> |
| | | |
| | | <select id="selectGroupAndPriceById" resultMap="ShopActivitiesGroupJoinMap"> |
| | |
| | | left join sys_shop_info t4 on t3.store_id=t4.id |
| | | left join sys_vip_info t5 on t1.user_id=t5.id |
| | | left join shop_product t6 on t2.goods_id=t6.id |
| | | where t2.act_id=#{record.actId} and (t5.IS_DELETE is null or t5.IS_DELETE = '') |
| | | where t2.act_id=#{record.actId} |
| | | <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 --> |
| | | <if test="pageVo.sort !=null and pageVo.order !=null"> |
| | | order by |
| | |
| | | left join sys_shop_info t4 on t3.store_id=t4.id |
| | | left join sys_vip_info t5 on t1.user_id=t5.id |
| | | left join shop_product t6 on t2.goods_id=t6.id |
| | | where t2.act_id=#{record.actId} and (t5.IS_DELETE is null or t5.IS_DELETE = '') |
| | | where t2.act_id=#{record.actId} |
| | | </select> |
| | | |
| | | <!-- 根据id查询--> |
| | |
| | | LEFT JOIN shop_order o ON c.order_id = o.id |
| | | LEFT JOIN sys_vip_info b ON c.user_id = b.id |
| | | <where> |
| | | and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | |
| | | |
| | | <if test="record!=null"> |
| | | <if test="(record.userId!=null and record.userId!='') or (record.userId!='' and record.userId==0) "> |
| | |
| | | AND p.del_flag = 2 |
| | | AND o.del_flag = 2 |
| | | AND c.del_flag = 2 |
| | | AND c.com_audit_status = 1 and (b.IS_DELETE is null or b.IS_DELETE = '') |
| | | AND c.com_audit_status = 1 |
| | | </where> |
| | | order by c.create_time desc |
| | | <if test="record.offset >=0 and record.limit >0"> |
| | |
| | | app: _this, |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | //TODO 优化下拉加载 |
| | | data: {name: _this.queryKey,goodType:_this.goodsType , limit: pageSize, offset : offset}, |
| | | data: {name: _this.queryKey,goodType:_this.goodsType , limit: pageSize, offset : offset, staus:'上架'}, |
| | | url: basePath + "/admin/shoppinggoods/showList", |
| | | callback: function (data) { |
| | | _this.searchTableData = data.rows; |
| | |
| | | label="单价"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="count" |
| | | label="可退数量"> |
| | | <template slot-scope="scope"> |
| | | {{scope.row.count- scope.row.refundCount}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="退款单价"> |
| | | <template slot-scope="scope"> |
| | |
| | | } |
| | | } |
| | | |
| | | item.achaeveList = achieveList; |
| | | item.achieveList = achieveList; |
| | | } |
| | | if (item.returnStore) { |
| | | item.isReturnStore = 'Y'; |
| | |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-main> |
| | | <el-footer style="margin: 15px; padding: 20px 50px;"> |
| | | <el-row type="flex"> |
| | | <el-col :span="5"> |
| | | <h1>客户签名:</h1> |
| | | </el-col> |
| | | <el-col :span="10"> |
| | | <img v-if="imageUrlTitle" :src="imageUrlTitle" style="max-width: 200px;"> |
| | | </el-col> |
| | | </el-row> |
| | | </el-footer> |
| | | </el-container> |
| | | </div> |
| | | <script type="text/javascript" th:src="@{/js/plugin/LodopFuncs.js}"></script> |
| | |
| | | el : "#app", |
| | | data : { |
| | | serviceOrderInfo : "", |
| | | imageUrlTitle : "", |
| | | tabName : "serviceOrder", |
| | | tableData : [], |
| | | bedList : [], |
| | |
| | | created :function () { |
| | | this.bedList = /*[[${cw}]]*/ |
| | | this.serviceOrderInfo = /*[[${obj}]]*/ |
| | | this.imageUrlTitle = this.serviceOrderInfo.signPic; |
| | | this.tableData = this.serviceOrderInfo.serviceItems; |
| | | this.plsList = /*[[${yls}]]*/ |
| | | console.log(this.plsList); |
| | |
| | | break; |
| | | case '服务完成': |
| | | html +=btns[4].replace('VALUE',value); |
| | | html += btns[2].replace('VALUE',value); |
| | | // html += btns[2].replace('VALUE',value); |
| | | break; |
| | | case '待确认': |
| | | html +=btns[7].replace('VALUE',value); |
| | |
| | | |
| | | function cancelOrder() { |
| | | var id=myGrid.getSelectItemId(); |
| | | var items=myGrid.getSelectItem(); |
| | | if(items.statu != "待付款"){ |
| | | layer.msg("只允许取消【待付款】状态的订单", { |
| | | icon: 7 |
| | | }); |
| | | return false; |
| | | } |
| | | layer.confirm('确定取消此订单?', { |
| | | btn: ['确认', '取消'] //可以无限个按钮 |
| | | }, function(index, layero){ |
| | |
| | | |
| | | </head> |
| | | <body> |
| | | <div class="ibox-content container-fluid" id="app"> |
| | | <div class="ibox-content container-fluid" id="app" v-cloak> |
| | | <el-container> |
| | | <el-header style="background-color: white; margin: 15px; line-height: 60px"> |
| | | <el-col :span="7"> |
| | |
| | | prop="failTime" |
| | | label="到期时间"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="createTime" |
| | | label="创建时间"> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | | <template slot-scope="scope"> |
| | | <el-button matrix:btn="vipinfoClub-youxiao" v-if="scope.row.status!='有效'" type="text" size="small" @click="tabProjValid(scope.$index, scope.row)">有效</el-button> |
| | |
| | | <el-table-column |
| | | prop="failTime" |
| | | label="到期时间"> |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | prop="createTime" |
| | | label="创建时间"> |
| | | </el-table-column> |
| | | <el-table-column label="操作" fixed="right" width="160"> |
| | | <template slot-scope="scope"> |
| | |
| | | label="到期时间" width="160"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="createTime" |
| | | label="创建时间"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="remark" |
| | | label="备注"> |
| | | </el-table-column> |
| | |
| | | }, |
| | | url: basePath + '/admin/bedInfo/showFreedBed', |
| | | callback: function (data) { |
| | | _this.beds = data.rows; |
| | | if(data.rows.length > 0){ |
| | | _this.beds = data.rows; |
| | | }else{ |
| | | _this.beds = data.rows; |
| | | _this.projService.bedId = ''; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | |
| | | </div> |
| | | <div class="form-group mr-20"> |
| | | <label for="staus">状态</label> |
| | | <select class="form-control autoFull" name="staus" nullmsg="状态不能为空" dataType="*" id="staus" |
| | | data-filed="name" |
| | | data-value="name" |
| | | th:data-url="@{/admin/dataDictionary/showDataDictionary}" |
| | | data-param="{type:'项目状态'}"> |
| | | <option value=''>请选择项目状态</option> |
| | | <select class="form-control " name="staus" nullmsg="状态不能为空" dataType="*" id="staus"> |
| | | <option value=''>全部</option> |
| | | <option value='上架' selected ="selected ">上架</option> |
| | | <option value=''>下架</option> |
| | | </select> |
| | | </div> |
| | | <div class="form-group mr-20"> |
| | |
| | | </div> |
| | | <div class="form-group mr-20"> |
| | | <label for="staus">状态</label> |
| | | <select class="form-control autoFull" name="staus" nullmsg="状态不能为空" dataType="*" id="staus" |
| | | data-filed="name" |
| | | data-value="name" |
| | | th:data-url="@{/admin/dataDictionary/showDataDictionary}" |
| | | data-param="{type:'项目状态'}"> |
| | | <option value=''>请选择项目状态</option> |
| | | <select class="form-control " name="staus" nullmsg="状态不能为空" dataType="*" id="staus"> |
| | | <option value=''>全部</option> |
| | | <option value='上架' selected ="selected ">上架</option> |
| | | <option value=''>下架</option> |
| | | </select> |
| | | </div> |
| | | <div class="form-group mr-20"> |
| | |
| | | }, |
| | | }); |
| | | |
| | | $("#staff").change(function(){ |
| | | if($("#staff").val()!=null){ |
| | | $.AjaxProxy({c:false}).invoke(basePath+"/admin/shopstaffInfo/findById?id="+$("#staff").val(), function(loj) { |
| | | var shopId=loj.getString(0,"shopId"); |
| | | console.log($("#staff").val()); |
| | | console.log(shopId); |
| | | $("#shopId").val(shopId).trigger("change"); |
| | | }); |
| | | } |
| | | }); |
| | | // $("#staff").change(function(){ |
| | | // if($("#staff").val()!=null){ |
| | | // $.AjaxProxy({c:false}).invoke(basePath+"/admin/shopstaffInfo/findById?id="+$("#staff").val(), function(loj) { |
| | | // var shopId=loj.getString(0,"shopId"); |
| | | // console.log($("#staff").val()); |
| | | // console.log(shopId); |
| | | // $("#shopId").val(shopId).trigger("change"); |
| | | // }); |
| | | // } |
| | | // }); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | <body class="fixed-sidebar full-height-layout gray-bg" |
| | | style="overflow: hidden"> |
| | | <div id="wrapper"> |
| | | <div id="wrapper" v-cloak> |
| | | <!--左侧导航开始--> |
| | | <nav class="navbar-default navbar-static-side" role="navigation"> |
| | | <div class="nav-close"> |
| | |
| | | <a id="dLabel" data-toggle="dropdown" class="dropdown-toggle" href="#" aria-haspopup="true" aria-expanded="true"> |
| | | <span class="clear" style="height: auto;"> |
| | | <span class="block m-t-xs"> |
| | | <<<<<<< HEAD |
| | | <strong class="font-bold">阿尔法云管理系统</strong> |
| | | ======= |
| | | <strong class="font-bold">{{systemName}}</strong> |
| | | >>>>>>> feature/订单服务单代码改造 |
| | | </span> |
| | | </span> |
| | | </a> |
| | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <script type="text/javascript" th:src="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.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> |
| | | var app = new Vue({ |
| | | el: '#wrapper', |
| | | data: { |
| | | systemName: '', |
| | | }, |
| | | created: function () { |
| | | this.loadInfo(); |
| | | }, |
| | | mounted: function () { |
| | | }, |
| | | methods: { |
| | | loadInfo() { |
| | | let _this = this; |
| | | //加载配置 |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | type: 'Get', |
| | | data: {}, |
| | | url: basePath + '/admin/busParameterSettings/getSystemName', |
| | | callback: function (data) { |
| | | _this.systemName = data.info; |
| | | document.title = _this.systemName; |
| | | console.log(_this.systemName); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | </script> |
| | | </html> |
| | |
| | | <link rel="stylesheet" th:href="@{/plugin/bootstrap-3.3.5/css/bootstrap.min.css}"> |
| | | <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/> |
| | | </head> |
| | | <style> |
| | | .el-upload__input { |
| | | display: none !important; |
| | | } |
| | | </style> |
| | | <body> |
| | | <div class="ibox-content" id="app" v-cloak> |
| | | |
| | |
| | | |
| | | <template v-for="paramSetting in paramSettings"> |
| | | |
| | | <div v-if="paramSetting.type==4" class="form-group"> |
| | | <label class="col-md-2 control-label">{{paramSetting.name}}</label> |
| | | </div> |
| | | |
| | | |
| | | <div class="form-group" v-if="paramSetting.type==1"> |
| | | <label class="col-md-2 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-8"> |
| | | <label class="col-md-4 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-4"> |
| | | <el-input v-model="paramSetting.userValue"></el-input> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="form-group" v-if="paramSetting.type==2"> |
| | | <label class="col-md-2 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-8"> |
| | | <el-select v-model="paramSetting.userValue" placeholder="请选择"> |
| | | <label class="col-md-4 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-4" style="float:left;margin-top: 8px;"> |
| | | <el-radio-group v-model="paramSetting.userValue"> |
| | | <el-radio v-for="item in buttonTypeTwo" |
| | | :key="item.value" |
| | | :label="item.displayName" |
| | | :value="item.displayName"></el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" v-if="paramSetting.type==3"> |
| | | <label class="col-md-4 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-4"> |
| | | <el-select v-model="paramSetting.userValue" placeholder=""> |
| | | <el-option |
| | | v-for="item in paramSetting.value" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item"> |
| | | v-for="item in buttonTypeThree" |
| | | :key="item.value" |
| | | :label="item.displayName" |
| | | :value="item.displayName"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" v-if="paramSetting.type==3"> |
| | | <label class="col-md-2 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-8"> |
| | | <el-checkbox-group v-model="paramSetting.userValue"> |
| | | <template v-for="item in paramSetting.value"> |
| | | <el-checkbox v-bind:label="item" v-bind:value="item"></el-checkbox> |
| | | </template> |
| | | </el-checkbox-group> |
| | | <div class="form-group" v-if="paramSetting.type==4"> |
| | | <label class="col-md-4 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-4"> |
| | | <el-select v-model="paramSetting.userValue" multiple placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in buttonTypeFour" |
| | | :key="item.value" |
| | | :label="item.displayName" |
| | | :value="item.displayName"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" v-if="paramSetting.type==5"> |
| | | <label class="col-md-2 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-8"> |
| | | <el-input type="textarea" :rows="2" v-model="paramSetting.userValue"></el-input> |
| | | <label class="col-md-4 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-4"> |
| | | <el-upload |
| | | class="upload-demo" |
| | | action="/admin/multipleUploadFile/doUpload" |
| | | :on-preview="handlePreview" |
| | | :on-success="uploadSuccess" |
| | | :on-remove="handleRemove" |
| | | :before-remove="beforeRemove" |
| | | multiple |
| | | :limit="1" |
| | | :on-exceed="handleExceed" |
| | | :file-list="fileList"> |
| | | <el-button size="small" type="primary">点击上传</el-button> |
| | | <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> |
| | | </el-upload> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group" v-if="paramSetting.type==6"> |
| | | <label class="col-md-4 control-label">{{paramSetting.name}}</label> |
| | | <div class="col-md-4"> |
| | | <el-upload |
| | | action="/admin/multipleUploadFile/doUpload" |
| | | :show-file-list="false" |
| | | :on-success="imageLineSuccess"> |
| | | <img v-if="imageLine" :src="imageLine" style="max-width: 300px;"> |
| | | <el-button size="small" type="primary">点击上传</el-button> |
| | | </el-upload> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | warehouses: [], |
| | | shops: [], |
| | | categoryList: [], |
| | | buttonTypeThree:[], |
| | | buttonTypeFour:[], |
| | | buttonTypeTwo:[], |
| | | fileList:[], |
| | | codeName:'', |
| | | imageLine:'', |
| | | type:2, |
| | | }, |
| | | created: function () { |
| | | this.loadInfo(); |
| | |
| | | data: {}, |
| | | url: basePath + '/admin/busParameterSettings/getAllCategoryList', |
| | | callback: function (data) { |
| | | |
| | | let categoryList = data.rows; |
| | | for (let i = 0; i < categoryList.length; i++) { |
| | | if (categoryList[i].type == 3) { |
| | | if (categoryList[i].value) { |
| | | categoryList[i].value = categoryList[i].value.split(","); |
| | | } |
| | | } |
| | | } |
| | | console.log(categoryList); |
| | | _this.categoryList = categoryList; |
| | | _this.currentCategory = categoryList[0]; |
| | |
| | | }); |
| | | }, |
| | | |
| | | //获取枚举列表 |
| | | loadEnum(codeName,type){ |
| | | let _this = this; |
| | | //获取枚举列表 |
| | | AjaxProxy.requst({ |
| | | app: _this, |
| | | url: basePath + '/common/data/getEnums', |
| | | data:{"enumCodes":[_this.codeName]}, |
| | | callback: function (data) { |
| | | if(_this.type === 3){ |
| | | _this.buttonTypeThree = data.data[''+_this.codeName+'']; |
| | | }else if(_this.type === 4){ |
| | | _this.buttonTypeFour = data.data[''+_this.codeName+'']; |
| | | }else if(_this.type === 2){ |
| | | _this.buttonTypeTwo = data.data[''+_this.codeName+'']; |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //改变编辑页面,切换页面元素 |
| | | changeCategory(index) { |
| | |
| | | callback: function (data) { |
| | | let paramSettings = data.rows; |
| | | for (let i = 0; i < paramSettings.length; i++) { |
| | | if (paramSettings[i].type == 3) { |
| | | paramSettings[i].value = paramSettings[i].value.split(","); |
| | | if (paramSettings[i].userValue) { |
| | | paramSettings[i].userValue = paramSettings[i].userValue.split(","); |
| | | if (paramSettings[i].type === 2) { |
| | | if(paramSettings[i].value != null && paramSettings[i].value != ''){ |
| | | if(paramSettings[i].userValue === '1'){ |
| | | paramSettings[i].userValue = '是'; |
| | | }else if(paramSettings[i].userValue === '2'){ |
| | | paramSettings[i].userValue = '否'; |
| | | } |
| | | _this.codeName = paramSettings[i].value; |
| | | _this.type = paramSettings[i].type; |
| | | _this.loadEnum(_this.codeName,_this.type); |
| | | } |
| | | } else if (paramSettings[i].type == 2) { |
| | | paramSettings[i].value = paramSettings[i].value.split(","); |
| | | |
| | | } |
| | | }else if(paramSettings[i].type === 3){ |
| | | if(paramSettings[i].value != null && paramSettings[i].value != ''){ |
| | | _this.codeName = paramSettings[i].value; |
| | | _this.type = paramSettings[i].type; |
| | | _this.loadEnum(_this.codeName,_this.type); |
| | | } |
| | | }else if(paramSettings[i].type === 4){ |
| | | if(paramSettings[i].value != null && paramSettings[i].value != ''){ |
| | | //下拉框回显 |
| | | paramSettings[i].userValue = paramSettings[i].userValue.split(','); |
| | | _this.codeName = paramSettings[i].value; |
| | | _this.type = paramSettings[i].type; |
| | | _this.loadEnum(_this.codeName,_this.type); |
| | | } |
| | | }else if(paramSettings[i].type === 5){ |
| | | if(paramSettings[i].value != null && paramSettings[i].value != ''){ |
| | | alert(paramSettings[i].userValue+"----类型"); |
| | | _this.fileList.push(paramSettings[i].userValue); |
| | | } |
| | | }else if(paramSettings[i].type === 6){ |
| | | _this.imageLine = paramSettings[i].userValue; |
| | | } |
| | | } |
| | | _this.paramSettings = paramSettings; |
| | | console.log("over"); |
| | |
| | | }); |
| | | }, |
| | | |
| | | submit() { |
| | | handleRemove(file, fileList) { |
| | | console.log(file, fileList); |
| | | }, |
| | | handlePreview(file) { |
| | | console.log(file); |
| | | }, |
| | | handleExceed(files, fileList) { |
| | | this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); |
| | | }, |
| | | beforeRemove(file, fileList) { |
| | | return this.$confirm(`确定移除 ${ file.name }?`); |
| | | }, |
| | | uploadSuccess(res, file) { |
| | | this.imageLine = res.path; |
| | | }, |
| | | imageLineSuccess(res, file) { |
| | | this.imageLine = res.path; |
| | | }, |
| | | |
| | | submit() { |
| | | console.log("提交"); |
| | | let _this = this; |
| | | let submitDate = []; |
| | | for (let i = 0; i < _this.paramSettings.length; i++) { |
| | | let paramSetting = _this.paramSettings[i]; |
| | | |
| | | let userValue = paramSetting.userValue; |
| | | |
| | | if (paramSetting.type == 3) { |
| | | if (paramSetting.type == 4) { |
| | | userValue = paramSetting.userValue.join(","); |
| | | } |
| | | |
| | | if (paramSetting.type == 6) { |
| | | userValue = _this.imageLine; |
| | | } |
| | | let obj = { |
| | | code: paramSetting.code, |
| | | userValue: userValue |
| | | } |
| | | |
| | | submitDate.push(obj); |
| | | } |
| | | |
| | |
| | | </head> |
| | | |
| | | <body> |
| | | <div id="app"> |
| | | <div id="app" v-cloak> |
| | | |
| | | <el-row class=""> |
| | | <el-col :span="6"> |
| | |
| | | display: block; |
| | | padding: 20px 12px; |
| | | width: 100%; |
| | | font-size: 14px |
| | | font-size: 14px; |
| | | -webkit-box-shadow: none !important; |
| | | box-shadow: none !important; |
| | | border-radius: 0px !important; |
| | |
| | | package com.matrix; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.authority.DefaultAuthorityManager; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.SysCompanyDao; |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.fenxiao.dao.BizUserDao; |
| | | import com.matrix.system.fenxiao.entity.BizUser; |
| | | import com.matrix.system.hive.bean.*; |
| | | import com.matrix.system.hive.bean.MoneyCardUse; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysBedInfoDao; |
| | |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.padApi.dto.PadOrderListDto; |
| | | import com.matrix.system.padApi.vo.PadOrderDetailVo; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | |
| | | moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | List<MoneyCardUse> cards = cardUseService.findByModel(moneyCardUse); |
| | | } |
| | | @Test |
| | | public void testFrist(){ |
| | | SysUsers user = new SysUsers(); |
| | | user.setShopId(13L); |
| | | user.setCompanyId(17L); |
| | | // SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | PadOrderListDto orderListDto = new PadOrderListDto(); |
| | | orderListDto.setPageNum(1); |
| | | orderListDto.setPageSize(5); |
| | | int offset = (orderListDto.getPageNum() - 1) * orderListDto.getPageSize(); |
| | | int limit = orderListDto.getPageSize(); |
| | | PaginationVO pageVo = new PaginationVO(); |
| | | pageVo.setOffset(offset); |
| | | pageVo.setLimit(limit); |
| | | // if (!DataAuthUtil.hasAllShopAuth()) { |
| | | orderListDto.setShopId(user.getShopId()); |
| | | // } |
| | | // QueryUtil.setQueryLimitCom(orderListDto); |
| | | List<PadOrderDetailVo> padApiOrderListInPage = sysOrderService.findPadApiOrderListInPage(orderListDto, pageVo); |
| | | |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(""); |
| | | result.putInMap("orderList",padApiOrderListInPage); |
| | | |
| | | // List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS); |
| | | user.setRoleName(Dictionary.STAFF_POST_MLS); |
| | | List<SysUsers> mls = sysUsersDao.selectByRoleName(user); |
| | | Date date = new Date(); |
| | | if(CollUtil.isNotEmpty(mls)){ |
| | | SysBeauticianState sysBeauticianState = new SysBeauticianState(); |
| | | sysBeauticianState.setBeginTime(DateUtil.getStartDate(date)); |
| | | sysBeauticianState.setEndTime(DateUtil.getStartDate(date)); |
| | | String panBanCodes = DateUtil.dateToString(sysBeauticianState.getBeginTime(),DateUtil.DATE_FORMAT_NO_SPLITE_DD); |
| | | List<SysUsers> staffs=new ArrayList<>(); |
| | | if(sysWorkTimeService.isInWorkTime(user.getShopId(),sysBeauticianState.getBeginTime(),sysBeauticianState.getEndTime())){ |
| | | staffs= sysUsersService.findByCodeBeaStateShop(user.getShopId(), |
| | | sysBeauticianState, panBanCodes); |
| | | if(CollUtil.isNotEmpty(staffs)){ |
| | | result.putInMap("usedMls", mls.size() - staffs.size()); |
| | | result.putInMap("freeMls", staffs.size()); |
| | | }else{ |
| | | result.putInMap("usedMls", mls.size()); |
| | | result.putInMap("freeMls", 0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | SysBedInfo bedInfo = new SysBedInfo(); |
| | | bedInfo.setShopId(user.getShopId()); |
| | | List<SysBedInfo> totalBed = bedInfoService.findByModel(bedInfo); |
| | | if(CollUtil.isNotEmpty(totalBed)){ |
| | | SysProjServices sysProjServices = new SysProjServices(); |
| | | sysProjServices.setShopId(user.getShopId()); |
| | | |
| | | sysProjServices.setStartTime(DateUtil.getStartDate(date)); |
| | | sysProjServices.setEndTime(DateUtil.getStartDate(date)); |
| | | List<SysBedInfo> freeBed = sysBedInfoDao.findFreeBed(sysProjServices); |
| | | if(CollUtil.isNotEmpty(freeBed)){ |
| | | result.putInMap("usedBed", totalBed.size() - freeBed.size()); |
| | | result.putInMap("freeBed", freeBed); |
| | | }else{ |
| | | result.putInMap("usedBed", totalBed); |
| | | result.putInMap("freeBed", 0); |
| | | } |
| | | } |
| | | System.out.println(result.toString()); |
| | | } |
| | | public SysUsers getMe() { |
| | | return (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | } |
| | | |
| | | @Test |
| | | @Transactional |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.MoneyCardUse; |
| | | import com.matrix.system.hive.bean.SysProjUse; |
| | | import com.matrix.system.hive.dao.MoneyCardUseDao; |
| | | import com.matrix.system.hive.dao.ShoppingGoodsDao; |
| | | import com.matrix.system.hive.service.SysProjUseService; |
| | | import com.matrix.system.hive.service.imp.SysVipInfoServiceImpl; |
| | | import com.matrix.system.score.dao.ScoreVipDetailDao; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | |
| | | import org.springframework.test.annotation.Rollback; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | MoneyCardUseDao moneyCardUseDao; |
| | | @Resource |
| | | private SysProjUseService projUseService; |
| | | @Autowired |
| | | private ShoppingGoodsDao shoppingGoodsDao; |
| | | |
| | | @Test |
| | | public void testGetVipInfo(){ |
| | | |
| | | Long vipId = 111L; |
| | | AjaxResult result = AjaxResult.buildSuccessInstance("查询成功"); |
| | | SysProjUse queryUse = new SysProjUse(); |
| | | queryUse.setVipId(vipId); |
| | | queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | queryUse.setTaocanId(-1L); |
| | | queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | List<SysProjUse> projList = projUseService.findInPage(queryUse, null); |
| | | //切换到套餐查询条件 |
| | | queryUse.setTaocanId(null); |
| | | queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_TC); |
| | | List<SysProjUse> taoCanList = projUseService.findInPage(queryUse, null); |
| | | taoCanList.forEach(item->{ |
| | | item.setTaocanProjUse(projUseService.selectTaocanProjUse(item.getId(), queryUse.getStatus())); |
| | | item.setProjInfo(shoppingGoodsDao.selectById(item.getProjId())); |
| | | }); |
| | | result.putInMap("projList", projList); |
| | | result.putInMap("taoCanList", taoCanList); |
| | | } |
| | | |
| | | |
| | | @Test |
| | |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.matrix.component.redis.RedisClient; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.SysFunction; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | | import com.matrix.system.common.dao.UtilDao; |
| | | import com.matrix.system.common.service.BusParameterSettingService; |
| | | import com.matrix.system.common.service.OperationLogService; |
| | | import com.matrix.system.common.tools.ServiceUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.constance.TableMapping; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.enums.OperationButtonEnum; |
| | | import com.matrix.system.enums.OperationFunctionEnum; |
| | | import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanGradeDao; |
| | | import com.matrix.system.fenxiao.dao.ShopSalesmanOrderDao; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanGrade; |
| | | import com.matrix.system.fenxiao.entity.ShopSalesmanOrder; |
| | | import com.matrix.system.hive.bean.SysBeauticianState; |
| | | import com.matrix.system.hive.bean.SysBedState; |
| | | import com.matrix.system.hive.bean.SysProjServices; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysOrderDao; |
| | | import com.matrix.system.hive.dao.SysOrderItemDao; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.hive.service.CodeService; |
| | | import com.matrix.system.hive.service.ShoppingGoodsService; |
| | | import com.matrix.system.hive.service.SysOrderService; |
| | | import com.matrix.system.hive.service.SysVipInfoService; |
| | | import com.matrix.system.hive.service.imp.SysVipInfoServiceImpl; |
| | | import com.matrix.system.score.dao.ScoreVipDetailDao; |
| | | import com.matrix.system.hive.dao.*; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | | import com.matrix.system.shopXcx.bean.ShopOrder; |
| | | import com.matrix.system.shopXcx.bean.ShopOrderDetails; |
| | | import com.matrix.system.shopXcx.bean.ShopProduct; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderDao; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderDetailsDao; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderV2Dao; |
| | | import com.matrix.system.shopXcx.dao.ShopSkuDao; |
| | | import com.matrix.system.shopXcx.mqTask.OrderDingDingNoticeTask; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 测试类示例 |
| | |
| | | @Autowired |
| | | SysVipInfoService sysVipInfoService; |
| | | |
| | | |
| | | @Autowired |
| | | private SysVipInfoDao vipDap; |
| | | |
| | | @Autowired |
| | | SysVipInfoDao vipDao; |
| | |
| | | @Autowired |
| | | private ShopSalesmanGradeDao shopSalesmanGradeDao; |
| | | |
| | | @Autowired |
| | | private BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | |
| | | @Autowired |
| | | SysBedStateDao sysBedStateDao; |
| | | @Autowired |
| | | private SysProjServicesDao sysProjServicesDao; |
| | | |
| | | @Autowired |
| | | private SysBedStateDao bedStateDao; |
| | | |
| | | @Autowired |
| | | private SysBeauticianStateDao beauticianStateDao; |
| | | |
| | | @Autowired |
| | | TaiYanAliyunSmsService taiYanAliyunSmsService; |
| | | |
| | | @Autowired |
| | | ServicesFlowDao servicesFlowDao; |
| | | |
| | | @Autowired |
| | | SysUsersDao userDao; |
| | | |
| | | @Autowired |
| | | ShoppingGoodsAssembleDao shoppingGoodsAssembleDao; |
| | | |
| | | @Autowired |
| | | BusParameterSettingService busParameterSettingService; |
| | | |
| | | @Autowired |
| | | ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | @Autowired |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Autowired |
| | | ShoppingGoodsAssembleDao goodsAssembleDao; |
| | | |
| | | @Autowired |
| | | private OperationLogService operationLogService; |
| | | @Autowired |
| | | private UtilDao utilDao; |
| | | |
| | | @Autowired |
| | | private ServiceUtil serviceUtil; |
| | | |
| | | @Test |
| | | public void testQuChong(){ |
| | | boolean b = serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "PHONE", "18229856946", |
| | | "company_id", 17); |
| | | System.out.println("___________" + b); |
| | | } |
| | | |
| | | private HashMap<String, Object> excuteTow(String tableName, String column1, Object value1, String column2, |
| | | Object value2) { |
| | | HashMap<String, Object> query = new HashMap<>(MatrixConstance.COLLECTION_SIZE); |
| | | query.put("tableName", tableName); |
| | | query.put("column1", column1); |
| | | query.put("value1", value1); |
| | | query.put("column2", column2); |
| | | query.put("value2", value2); |
| | | query = (HashMap<String, Object>) utilDao.selectRepeatTowColumn(query); |
| | | return query; |
| | | } |
| | | |
| | | @Test |
| | | public void testServiceError(){ |
| | | SysProjServices projServices = new SysProjServices(); |
| | | projServices.setId(12948L); |
| | | |
| | | SysProjServices checkprojServices = sysProjServicesDao.selectById(projServices.getId()); |
| | | if (!checkprojServices.getState().equals(Dictionary.SERVICE_STATU_FWZ)) { |
| | | throw new GlobleException("该服务单状态为" + checkprojServices.getState() + ",不可以进行当前操作!"); |
| | | } |
| | | SysBeauticianState checkBeauticianState = new SysBeauticianState(); |
| | | checkBeauticianState.setServicesId(projServices.getId()); |
| | | checkBeauticianState.setState(Dictionary.BEATUI_STATE_FWJS); |
| | | int rerunlt = beauticianStateDao.chengItemState(checkBeauticianState); |
| | | |
| | | // 验证是否是最后一个美疗师结束服务 |
| | | boolean isOver = true; |
| | | List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(checkprojServices.getId()); |
| | | for (SysBeauticianState beauticianState : beauticianStateList) { |
| | | if (!beauticianState.getState().equals(Dictionary.BEATUI_STATE_FWJS)) { |
| | | isOver = false; |
| | | break; |
| | | } |
| | | } |
| | | if (isOver) { |
| | | // 释放床位资源 |
| | | SysBedState checkBedState = sysBedStateDao.selectBySerIdAndBedId(checkprojServices.getBedId(), checkprojServices.getId()); |
| | | if (checkBedState != null) { |
| | | checkBedState.setBedState(Dictionary.BED_STATE_SYJS); |
| | | bedStateDao.update(checkBedState); |
| | | } |
| | | checkprojServices.setEndTime(new Date()); |
| | | // 计算时差 |
| | | long minspace = DateUtil.getDifTimeMin(checkprojServices.getStartTime(), checkprojServices.getEndTime()) |
| | | - checkprojServices.getTotalTime(); |
| | | // 判断是服务超时还是服务提前结束,如果minspace大于0则是超时服务,小于0则是提前结束服务 |
| | | checkprojServices.setIsOverTime(minspace + ""); |
| | | checkprojServices.setState(Dictionary.SERVICE_STATU_FWWC); |
| | | sysProjServicesDao.update(checkprojServices); |
| | | } |
| | | //保存单据日志 |
| | | operationLogService.saveOperation(checkprojServices.getCompanyId(), checkprojServices.getShopId(),1028L, |
| | | OperationFunctionEnum.SERVICE_ORDER, |
| | | OperationButtonEnum.SERVICE_ORDER_END, |
| | | checkprojServices.getId(), |
| | | checkprojServices.getServiceNo(), |
| | | checkprojServices.getVipId()); |
| | | } |
| | | |
| | | public boolean isSettingOpen(String settingKey,Long companyId) { |
| | | BusParameterSettings busParameterSettings = busParameterSettingsDao.selectCompanyParamByCode(settingKey, companyId); |
| | | return ( |
| | | Objects.nonNull(busParameterSettings) |
| | | && StringUtils.isNotBlank(busParameterSettings.getParamValue()) |
| | | // && AppConstance.IS_Y.equals(busParameterSettings.getParamValue()) |
| | | && BooleanEnum.TRUE.getValue() == busParameterSettings.getIntParamValue() |
| | | ); |
| | | } |
| | | |
| | | @Test |
| | | public void testBoolean(){ |
| | | boolean settingOpen = isSettingOpen(AppConstance.OPEN_SERVICE_ORDER_AUTO_BATCHING, 17L); |
| | | System.out.println("----------------------------"+settingOpen); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | @Rollback |
| | |
| | | newSetting11.setCategory("店务配置"); |
| | | newSettings.add(newSetting11); |
| | | |
| | | ParameterSettings newSetting12=new ParameterSettings(); |
| | | newSetting11.setCode(AppConstance.ADMIN_SYSTEM_TITLE); |
| | | newSetting11.setName("系统名称"); |
| | | newSetting11.setType(1); |
| | | newSetting11.setCategory("品牌设置"); |
| | | newSettings.add(newSetting12); |
| | | |
| | | ParameterSettings newSetting13=new ParameterSettings(); |
| | | newSetting11.setCode(AppConstance.ADMIN_BRAND_TITLE); |
| | | newSetting11.setName("品牌名称"); |
| | | newSetting11.setType(1); |
| | | newSetting11.setCategory("品牌设置"); |
| | | newSettings.add(newSetting13); |
| | | |
| | | for (ParameterSettings newSetting : newSettings) { |
| | | List<ParameterSettings> parameterSettings = parameterSettingsDao.selectByModel(newSetting); |
| | | if(CollectionUtil.isEmpty(parameterSettings)){ |