# Conflicts: # mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java # mallinkService/src/main/resources/mapper/WxBillAllMapper.xmlrelease_toaliyun_real
| @@ -0,0 +1,48 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.service.WxBillActionService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Api(description = "账单操作记录") | |||
| @RestController | |||
| @RequestMapping("wxBillAction") | |||
| public class WxBillActionController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxBillActionService wxBillActionService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "账单操作记录-列表") | |||
| public ResultData list(@ModelAttribute WxBillAction wxBillAction, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillActionController::list"); | |||
| if (null == wxBillAction) { | |||
| wxBillAction = new WxBillAction(); | |||
| } | |||
| wxBillAction.setTenantId(getTenantId()); | |||
| wxBillAction.setSortColumns(WxBillAction.Field.Id_DESC); | |||
| PageInfo<WxBillAction> result = wxBillActionService.listAsPage(wxBillAction, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| } | |||
| @@ -11,6 +11,7 @@ import com.iformall.domain.vo.WxCouponCarVo; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponStatus; | |||
| import com.iformall.enums.EnumETCPCode; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.ETCPUtil; | |||
| import com.iformall.utils.TJDCarUtil; | |||
| @@ -148,7 +149,13 @@ public class WxCarController extends BaseController { | |||
| // 1期只有一个虚拟商户,可以写在商场配置里 | |||
| businessId = objParams.getString("businessId"); | |||
| } | |||
| String ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| if (ret == null) { | |||
| logger.error("quanTemplate failed, 优免券模板未发现"); | |||
| return new ResultData(ErrorCode.ETCP_CMD_FAIL.getCode(), "获取优免券模板异常"); | |||
| @@ -300,6 +307,7 @@ public class WxCarController extends BaseController { | |||
| String version = objParams.getString("version"); | |||
| if (park.getParkingId() == null) { | |||
| // those code is not supported | |||
| /* | |||
| String lat = objParams.getString("lat"); | |||
| String lon = objParams.getString("lon"); | |||
| String radius = objParams.getString("radius"); | |||
| @@ -323,10 +331,18 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| } | |||
| */ | |||
| } | |||
| if (park.getParkingId() != null) { | |||
| String ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId()); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId()); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||
| if (retObj.get("data") != null) { | |||
| @@ -36,9 +36,12 @@ public class WxChartDataController extends BaseController { | |||
| }) | |||
| @SystemControllerLog(description = "报表-图表") | |||
| public ResultData queryData(@RequestParam Map<String, String> params) { | |||
| logger.debug("[" + getIpAddr() + "] WxChartDataController::queryData"); | |||
| String chart = params.get("chart"); | |||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart); | |||
| params.put("tenantId",super.getTenantId()); | |||
| return wxChartDataService.queryData(params); | |||
| ResultData data = wxChartDataService.queryData(params); | |||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart + " end"); | |||
| return data; | |||
| } | |||
| } | |||
| @@ -45,8 +45,7 @@ public class WxCreditHistoryController extends BaseController | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { | |||
| //Assert.notNull(wxCreditHistory.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCreditHistory.setTenantId(getTenantId()); | |||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | |||
| return new ResultData(); | |||
| } | |||
| @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxScoreRules") | |||
| @Api(description = "成长值规则相关接口") | |||
| @Api(description = "成长值积分规则相关接口") | |||
| public class WxScoreRulesController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @@ -35,11 +35,20 @@ public class WxScoreRulesController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| @SystemControllerLog(description = "成长值-配置-新增") | |||
| @SystemControllerLog(description = "成长值-积分-配置-新增") | |||
| public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::add"); | |||
| wxScoreRules.setTenantId(getTenantId()); | |||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("积分配置") | |||
| @GetMapping("/credit_rules") | |||
| @SystemControllerLog(description = "积分-配置") | |||
| public ResultData creditRulesList() { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantId()); | |||
| return new ResultData(scoreRules); | |||
| } | |||
| } | |||
| @@ -71,8 +71,7 @@ public class WxShopController extends BaseController { | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::delete"); | |||
| Integer isAdmin = getUser().getIsAdmin(); | |||
| wxShopService.deleteById(id, isAdmin); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| return wxShopService.deleteById(id, isAdmin); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE `wx_shop` | |||
| ADD COLUMN `is_del` smallint(2) DEFAULT 0 COMMENT '是否删除1是0否'; | |||
| @@ -0,0 +1,14 @@ | |||
| DROP TABLE IF EXISTS `wx_bill_action` ; | |||
| CREATE TABLE `wx_bill_action` ( | |||
| `id` bigint(64) NOT NULL COMMENT 'ID', | |||
| `tenant_id` varchar(50) NOT NULL COMMENT '租户Id', | |||
| `user_id` bigint(64) NOT NULL COMMENT '用户ID', | |||
| `user_name` varchar(100) NOT NULL COMMENT '用户名', | |||
| `phone` varchar(20) NOT NULL COMMENT '手机号', | |||
| `action` smallint(2) NOT NULL COMMENT '动作', | |||
| `details` varchar(200) NOT NULL COMMENT '明细', | |||
| `createtime` datetime NOT NULL COMMENT '创建时间', | |||
| `updatetime` datetime NOT NULL COMMENT '更新时间', | |||
| PRIMARY KEY (`id`), | |||
| INDEX `id_index` USING BTREE (`id`) comment '' | |||
| ) ENGINE=`InnoDB` ROW_FORMAT=DYNAMIC COMMENT='账单操作记录' CHECKSUM=0 DELAY_KEY_WRITE=0; | |||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.ETCPUtil; | |||
| import com.iformall.utils.TJDCarUtil; | |||
| @@ -109,16 +110,26 @@ public class WxCarController extends BaseController { | |||
| String merchantKey = objParams.getString("merchantKey"); | |||
| String version = objParams.getString("version"); | |||
| String ret = etcp.userSignin(url, appId, merchantNo, merchantKey, version, phone); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.userSignin(url, appId, merchantNo, merchantKey, version, phone); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||
| // 获取绑定的车牌 | |||
| JSONObject dataObj = retObj.getJSONObject("data"); | |||
| dataObj.put("vendor", EnumCarVendor.CAR_ETCP.getCode()); | |||
| String etcpToken = dataObj.getString("token"); | |||
| JSONObject dataObj1 = syncCarNumbers(user.getId(), user.getTenantId(), park.getVendorType(), | |||
| url, merchantNo, merchantKey, version, | |||
| etcpToken); | |||
| try { | |||
| JSONObject dataObj1 = syncCarNumbers(user.getId(), user.getTenantId(), park.getVendorType(), | |||
| url, merchantNo, merchantKey, version, | |||
| etcpToken); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP cmd error: " + e.getMessage()); | |||
| } | |||
| // c端必须保存此token | |||
| return new ResultData(dataObj); | |||
| } else { | |||
| @@ -152,8 +163,13 @@ public class WxCarController extends BaseController { | |||
| String etcpToken) { | |||
| String ret; | |||
| JSONObject retObj; | |||
| ret = etcp.carNum(url, merchantNo, merchantKey, version, etcpToken); | |||
| /*{"code": 0,"msg": "ok","data": {"number": 3,"carList": ["晋 BMZ105","云 C12345"]}} */ | |||
| try { | |||
| ret = etcp.carNum(url, merchantNo, merchantKey, version, etcpToken); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| retObj = JSON.parseObject(ret); | |||
| JSONObject dataObj1 = retObj.getJSONObject("data"); | |||
| dataObj1.put("vendor", iVendorType); | |||
| @@ -251,7 +267,13 @@ public class WxCarController extends BaseController { | |||
| String merchantKey = objParams.getString("merchantKey"); | |||
| String version = objParams.getString("version"); | |||
| String ret = etcp.bindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber, null); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.bindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber, null); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == 0) { | |||
| // 插入车牌 | |||
| @@ -375,7 +397,14 @@ public class WxCarController extends BaseController { | |||
| String merchantKey = objParams.getString("merchantKey"); | |||
| String version = objParams.getString("version"); | |||
| String ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == 0) { | |||
| try { | |||
| @@ -497,7 +526,14 @@ public class WxCarController extends BaseController { | |||
| String merchantKey = objParams.getString("merchantKey"); | |||
| String version = objParams.getString("version"); | |||
| String ret = etcp.orderUnpay(url, appId, merchantNo, merchantKey, version, etcpToken, carNumber); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.orderUnpay(url, appId, merchantNo, merchantKey, version, etcpToken, carNumber); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == 0) { | |||
| JSONObject feeObj = retObj.getJSONArray("data").getJSONObject(0); | |||
| @@ -667,8 +703,14 @@ public class WxCarController extends BaseController { | |||
| businessId = objParams.getString("businessId"); | |||
| } | |||
| String ret = etcp.bCouponRecord(url, merchantNo, merchantKey, version, | |||
| etcpToken, park.getParkId(), businessId, carNumber, String.valueOf(userCar.getCouponFreeId())); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.bCouponRecord(url, merchantNo, merchantKey, version, | |||
| etcpToken, park.getParkId(), businessId, carNumber, String.valueOf(userCar.getCouponFreeId())); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||
| @@ -732,6 +774,7 @@ public class WxCarController extends BaseController { | |||
| String version = objParams.getString("version"); | |||
| if (park.getParkingId() == null) { | |||
| // those code is not supported | |||
| /* | |||
| String lat = objParams.getString("lat"); | |||
| String lon = objParams.getString("lon"); | |||
| String radius = objParams.getString("radius"); | |||
| @@ -755,10 +798,17 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| } | |||
| */ | |||
| } | |||
| if (park.getParkingId() != null) { | |||
| String ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId()); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId()); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||
| @@ -26,6 +26,7 @@ public enum ErrorCode{ | |||
| SYS_NUMBER_FORMAT_ERROR(1011, "数字转化异常"), | |||
| SYS_EXTEND_JSON_ERROR(1012, "JSON格式异常"), | |||
| SYS_REPEAT_SUBMIT_EXCEPTION(1013, "请勿重复操作"), | |||
| REPORT_TYPE_UNKNOWN(1014, "不支持的报表类型"), | |||
| /** | |||
| * 数据库 | |||
| @@ -273,6 +274,8 @@ public enum ErrorCode{ | |||
| */ | |||
| MEM_IMPORT_ERR(13000, "模板导入失败,请检查数据,尝试重新导入"), | |||
| MEM_SCORE_NOT_ENOUGH(13001, "成长值不够扣减值"), | |||
| CREDIT_ZERO(13100,"本次操作积分为零"), | |||
| CREDIT_NOT_ENOUGH(13101, "积分不够扣减值"), | |||
| /** | |||
| * 标签 | |||
| @@ -330,7 +333,7 @@ public enum ErrorCode{ | |||
| SHOP_IS_RENT(22001,"商铺已出租"), | |||
| SHOP_NOT_SELECTED(22002, "未选择商铺"), | |||
| SHOP_BAN_DELETED(22003, "已出租的商铺无法删除"), | |||
| SHOP_DELETED_BY_ADMIN(22004, "超管才能删除此商铺"), | |||
| SHOP_DELETED_BY_ADMIN(22004, "仅超级管理员能删除该商铺"), | |||
| /** | |||
| @@ -0,0 +1,199 @@ | |||
| package com.iformall.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Table(name = "wx_bill_action") | |||
| public class WxBillAction implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> ids) { | |||
| this.ids = ids; | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "账单ID", name = "billId") | |||
| private Long billId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "用户ID", name = "userId") | |||
| private Long userId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "用户名称", name = "userName") | |||
| private String userName; | |||
| @io.swagger.annotations.ApiModelProperty(value = "手机号", name = "phone") | |||
| private String phone; | |||
| @io.swagger.annotations.ApiModelProperty(value = "动作", name = "action") | |||
| private Integer action; | |||
| @io.swagger.annotations.ApiModelProperty(value = "描述", name = "details") | |||
| private String details; | |||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createtime") | |||
| private Date createtime; | |||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updatetime") | |||
| private Date updatetime; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public Long getBillId() { | |||
| return billId; | |||
| } | |||
| public void setBillId(Long billId) { | |||
| this.billId = billId; | |||
| } | |||
| public Long getUserId() { | |||
| return userId; | |||
| } | |||
| public void setUserId(Long userId) { | |||
| this.userId = userId; | |||
| } | |||
| public String getUserName() { | |||
| return userName; | |||
| } | |||
| public void setUserName(String userName) { | |||
| this.userName = userName; | |||
| } | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(String phone) { | |||
| this.phone = phone; | |||
| } | |||
| public Integer getAction() { | |||
| return action; | |||
| } | |||
| public void setAction(Integer action) { | |||
| this.action = action; | |||
| } | |||
| public String getDetails() { | |||
| return details; | |||
| } | |||
| public void setDetails(String details) { | |||
| this.details = details; | |||
| } | |||
| public Date getCreatetime() { | |||
| return createtime; | |||
| } | |||
| public void setCreatetime(Date createtime) { | |||
| this.createtime = createtime; | |||
| } | |||
| public Date getUpdatetime() { | |||
| return updatetime; | |||
| } | |||
| public void setUpdatetime(Date updatetime) { | |||
| this.updatetime = updatetime; | |||
| } | |||
| public static enum Field { | |||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"); | |||
| private String value; | |||
| Field(String value) { | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(WxBillAction.Field... fields) { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| List<Field> fList = new java.util.ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -157,6 +157,9 @@ public class WxCUser implements Serializable { | |||
| private Date subsSubscribeTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="关注订阅号Scene",name="subsSubscribeScene") | |||
| private String subsSubscribeScene; | |||
| /**积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | |||
| private Integer credit; | |||
| //渠道名称 | |||
| @@ -488,7 +491,15 @@ public class WxCUser implements Serializable { | |||
| this.subsSubscribeScene = subsSubscribeScene; | |||
| } | |||
| public static enum Field | |||
| public Integer getCredit() { | |||
| return credit; | |||
| } | |||
| public void setCredit(Integer credit) { | |||
| this.credit = credit; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| @@ -520,7 +531,9 @@ public class WxCUser implements Serializable { | |||
| ,LoginCount_ASC("`login_count` ASC"),LoginCount_DESC("`login_count` DESC") | |||
| ,ExtraInfo_ASC("`extra_info` ASC"),ExtraInfo_DESC("`extra_info` DESC") | |||
| ,IsSubscribe_ASC("`is_subscribe` ASC"),IsSubscribe_DESC("`is_subscribe` DESC") | |||
| ; | |||
| ,Credit_ASC("`credit` ASC"),Credit_DESC("`credit` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| @@ -114,9 +114,12 @@ public class WxCUserBasicInfo implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") | |||
| private String level; | |||
| /**积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") | |||
| private Integer credit; | |||
| @Transient | |||
| @Excel(name="标签",width = 20,orderNum = "10") | |||
| @Excel(name="标签",width = 50,orderNum = "10") | |||
| private String tagNames; | |||
| @@ -304,6 +307,14 @@ public class WxCUserBasicInfo implements Serializable { | |||
| this.carCount = carCount; | |||
| } | |||
| public Integer getCredit() { | |||
| return credit; | |||
| } | |||
| public void setCredit(Integer credit) { | |||
| this.credit = credit; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -319,7 +330,9 @@ public class WxCUserBasicInfo implements Serializable { | |||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ; | |||
| ,Credit_ASC("`credit` ASC"),Credit_DESC("`credit` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| @@ -2,6 +2,7 @@ package com.iformall.domain.po; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import lombok.Data; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| @@ -21,6 +22,7 @@ import java.io.Serializable; | |||
| */ | |||
| @Table(name = "wx_score_rules") | |||
| @Data | |||
| public class WxScoreRules implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @@ -35,7 +37,11 @@ public class WxScoreRules implements Serializable { | |||
| " {\"businessId\":3,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":4,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":5,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":6,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}" + | |||
| " {\"businessId\":6,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":7,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":8,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":9,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":10,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}" + | |||
| "]}," + | |||
| "{\"id\":3,\"limit\":1,\"step\":1,\"score\":100,\"desc\":\"绑定车牌1个\"}," + | |||
| "{\"id\":4,\"limit\":0,\"step\":1,\"score\":10 ,\"desc\":\"连接WIFI1次\"}," + | |||
| @@ -95,6 +101,11 @@ public class WxScoreRules implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="1成长值 2积分",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="清除前多少年积分",name="clearYear") | |||
| private Integer clearYear; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| @@ -227,4 +238,5 @@ public class WxScoreRules implements Serializable { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -126,6 +126,17 @@ public class WxShop implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value = "邮箱", name = "email") | |||
| private String email; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = " ") | |||
| private Integer isDel; | |||
| public Integer getIsDel() { | |||
| return isDel; | |||
| } | |||
| public void setIsDel(Integer isDel) { | |||
| this.isDel = isDel; | |||
| } | |||
| public String getEmail() { | |||
| return email; | |||
| } | |||
| @@ -0,0 +1,265 @@ | |||
| package com.iformall.domain.vo; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public class WxBillAllVo { | |||
| Long id; | |||
| String tenantId; | |||
| Long merchantId; | |||
| Long shopId; | |||
| //@Excel(name="商铺号",width = 20,orderNum = "1") | |||
| String shopNumber; | |||
| //@Excel(name="商户名称",width = 20,orderNum = "2") | |||
| String merchantName; | |||
| //@Excel(name="商铺类型",width = 20,orderNum = "3", replace = {"店铺_1","多经点位_2"}) | |||
| Integer rentShopType; | |||
| @Excel(name="费用类型",width = 20,orderNum = "4") | |||
| String billType; | |||
| @Excel(name="实际应收金额(元)",width = 20,orderNum = "5") | |||
| String receivePayStr; | |||
| @Excel(name="实收金额(元)",width = 20,orderNum = "6") | |||
| String payStr; | |||
| @Excel(name="欠缴金额(元)",width = 20,orderNum = "7") | |||
| String oweStr; | |||
| @Excel(name="缴款截止日期",width = 20,orderNum = "8", format="yyyy-MM-dd") | |||
| Date receiveDate; | |||
| @Excel(name="逾期天数",width = 20,orderNum = "9") | |||
| Integer expiredDay; | |||
| @Excel(name="账单状态",width = 20,orderNum = "10", replace = {"欠缴_1","待缴_2","已结清_3","未到期_4","已退还_5","失效_6"}) | |||
| Integer status; | |||
| Integer billTypeValue; | |||
| Integer needPay; | |||
| Integer receivePay; | |||
| Integer pay; | |||
| Integer owe; | |||
| Date payDate; | |||
| Date starttime; | |||
| Date endtime; | |||
| String manager; | |||
| String managerPhone; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long merchantId) { | |||
| this.merchantId = merchantId; | |||
| } | |||
| public Long getShopId() { | |||
| return shopId; | |||
| } | |||
| public void setShopId(Long shopId) { | |||
| this.shopId = shopId; | |||
| } | |||
| public Integer getBillTypeValue() { | |||
| return billTypeValue; | |||
| } | |||
| public void setBillTypeValue(Integer billTypeValue) { | |||
| this.billTypeValue = billTypeValue; | |||
| } | |||
| public String getBillType() { | |||
| return billType; | |||
| } | |||
| public void setBillType(String billType) { | |||
| this.billType = billType; | |||
| } | |||
| public Integer getNeedPay() { | |||
| return needPay; | |||
| } | |||
| public void setNeedPay(Integer needPay) { | |||
| this.needPay = needPay; | |||
| } | |||
| public Integer getReceivePay() { | |||
| return receivePay; | |||
| } | |||
| public void setReceivePay(Integer receivePay) { | |||
| this.receivePay = receivePay; | |||
| } | |||
| public Integer getPay() { | |||
| return pay; | |||
| } | |||
| public void setPay(Integer pay) { | |||
| this.pay = pay; | |||
| } | |||
| public Integer getOwe() { | |||
| return owe; | |||
| } | |||
| public void setOwe(Integer owe) { | |||
| this.owe = owe; | |||
| } | |||
| public Date getReceiveDate() { | |||
| return receiveDate; | |||
| } | |||
| public void setReceiveDate(Date receiveDate) { | |||
| this.receiveDate = receiveDate; | |||
| } | |||
| public Date getPayDate() { | |||
| return payDate; | |||
| } | |||
| public void setPayDate(Date payDate) { | |||
| this.payDate = payDate; | |||
| } | |||
| public Integer getExpiredDay() { | |||
| return expiredDay; | |||
| } | |||
| public void setExpiredDay(Integer expiredDay) { | |||
| this.expiredDay = expiredDay; | |||
| } | |||
| public Integer getStatus() { | |||
| return status; | |||
| } | |||
| public void setStatus(Integer status) { | |||
| this.status = status; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public Date getStarttime() { | |||
| return starttime; | |||
| } | |||
| public void setStarttime(Date starttime) { | |||
| this.starttime = starttime; | |||
| } | |||
| public Date getEndtime() { | |||
| return endtime; | |||
| } | |||
| public void setEndtime(Date endtime) { | |||
| this.endtime = endtime; | |||
| } | |||
| public Integer getRentShopType() { | |||
| return rentShopType; | |||
| } | |||
| public void setRentShopType(Integer rentShopType) { | |||
| this.rentShopType = rentShopType; | |||
| } | |||
| public String getMerchantName() { | |||
| return merchantName; | |||
| } | |||
| public void setMerchantName(String merchantName) { | |||
| this.merchantName = merchantName; | |||
| } | |||
| public String getShopNumber() { | |||
| return shopNumber; | |||
| } | |||
| public void setShopNumber(String shopNumber) { | |||
| this.shopNumber = shopNumber; | |||
| } | |||
| public String getManager() { | |||
| return manager; | |||
| } | |||
| public void setManager(String manager) { | |||
| this.manager = manager; | |||
| } | |||
| public String getManagerPhone() { | |||
| return managerPhone; | |||
| } | |||
| public void setManagerPhone(String managerPhone) { | |||
| this.managerPhone = managerPhone; | |||
| } | |||
| public String getReceivePayStr() { | |||
| if(getReceivePay()!=null) { | |||
| receivePayStr = new BigDecimal(getReceivePay()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return receivePayStr; | |||
| } | |||
| public void setReceivePayStr(String receivePayStr) { | |||
| this.receivePayStr = receivePayStr; | |||
| } | |||
| public String getPayStr() { | |||
| if(getPay()!=null) { | |||
| payStr = new BigDecimal(getPay()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return payStr; | |||
| } | |||
| public void setPayStr(String payStr) { | |||
| this.payStr = payStr; | |||
| } | |||
| public String getOweStr() { | |||
| if(getOwe()!=null) { | |||
| oweStr = new BigDecimal(getOwe()).divide(new BigDecimal(100)).toString(); | |||
| } | |||
| return oweStr; | |||
| } | |||
| public void setOweStr(String oweStr) { | |||
| this.oweStr = oweStr; | |||
| } | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumBillAction { | |||
| SELF_SERVICE_PAY(1, "自助缴费"), | |||
| UPDATE_BILL(2, "变更账单"), | |||
| OFFLINE_PAY(3, "线下缴费"), | |||
| DEPOSIT_PAY(4, "押金缴费"), | |||
| DEPOSIT_RETURN(5, "押金退款"),; | |||
| public static EnumBillAction getEnum(Integer code) { | |||
| for (EnumBillAction value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumBillAction(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -12,7 +12,12 @@ public enum EnumBusiness { | |||
| BUSINESS_ID3(3, "服饰"), | |||
| BUSINESS_ID4(4, "亲子"), | |||
| BUSINESS_ID5(5, "超市"), | |||
| BUSINESS_ID6(6, "其他"), | |||
| BUSINESS_ID6(6, "其它"), | |||
| BUSINESS_ID7(7, "美妆"), | |||
| BUSINESS_ID8(8, "珠宝"), | |||
| BUSINESS_ID9(9, "服务"), | |||
| BUSINESS_ID10(10, "家居") | |||
| ; | |||
| public static EnumBusiness getEnum(Integer code) { | |||
| @@ -13,7 +13,7 @@ public enum EnumChart { | |||
| HYYHSJ(6, "活跃用户数据"), | |||
| XSSJ(7, "销售数据"), | |||
| JDSJ(8, "解单数据"), | |||
| JRCNCLL(9, "今日场内车流量"), | |||
| JRCNCLL(9, "今日场内车流量"), // 合并至历史车流量 | |||
| JRYBCPL(10, "今日已绑车牌量"), | |||
| SSCLL(11, "实时车流量"), | |||
| LSCLL(12, "历史车流量"), | |||
| @@ -13,7 +13,9 @@ public enum EnumScoreType { | |||
| WECHAT_PHONE(6, "微信用户手机授权"), | |||
| COMPLETE_INFO(7, "完善个人信息"), | |||
| MEM_IMPORT(8, "会员导入"), | |||
| MEM_REDUCE(9, "会员成长值扣减"); | |||
| MEM_REDUCE(9, "会员成长值扣减"), | |||
| SPEND_CREDIT(10, "消费积分"), | |||
| CHANGE_CREDIT(11, "积分兑换"); | |||
| public static EnumScoreType getEnum(Integer code) { | |||
| for (EnumScoreType value : values()) { | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.domain.po.WxShop; | |||
| import java.util.List; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxBillActionMapper extends CommonMapper<WxBillAction, Long> { | |||
| List<WxShop> findList(WxBillAction wxBillAction); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillAllVo; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -11,7 +12,7 @@ import java.util.Map; | |||
| public interface WxBillAllMapper { | |||
| List<Map<String,Object>> list(WxBillAll record); | |||
| List<WxBillAllVo> list(WxBillAll record); | |||
| Map<String,Object> queryOweInfo(WxBillAll record); | |||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxScoreHistory; | |||
| import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| import com.iformall.domain.po.WxCreditHistory; | |||
| @@ -11,5 +12,10 @@ public interface WxCreditHistoryMapper extends CommonMapper<WxCreditHistory, Lon | |||
| List<WxCreditHistoryVo> findListMore(WxCreditHistory wxCreditHistory); | |||
| int loginCount(WxCreditHistory wxCreditHistory); | |||
| int creditAmount(Long cUserId); | |||
| int countList(WxCreditHistory wxCreditHistory); | |||
| } | |||
| @@ -9,7 +9,7 @@ import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public interface WxRentContractMapper extends CommonMapper<WxRentContract, String> { | |||
| public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> { | |||
| List<WxRentContract> findList(WxRentContract wxRentContract); | |||
| @@ -47,4 +47,6 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Strin | |||
| List<WxRentContract> getMerchants(WxRentContract wxRentContract); | |||
| int selectRentContractCountByShopId(WxRentContract wxRentContract); | |||
| } | |||
| @@ -4,9 +4,11 @@ import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxTags; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxTagsMapper extends CommonMapper<WxTags, String> { | |||
| List<WxTags> findList(WxTags wxTags); | |||
| List<WxTags> findListAll(); | |||
| List<WxTags> getByName(String name); | |||
| } | |||
| @@ -0,0 +1,10 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| public interface WxBillActionService { | |||
| PageInfo<WxBillAction> listAsPage(WxBillAction record, Integer pageIndex, Integer pageSize); | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxCreditHistoryDto; | |||
| import com.iformall.domain.po.WxCreditHistory; | |||
| import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| @@ -41,7 +42,7 @@ public interface WxCreditHistoryService { | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCreditHistory record); | |||
| ResultData saveOrUpdate(WxCreditHistory record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| @@ -11,6 +11,13 @@ public interface WxScoreRulesService { | |||
| * @return | |||
| */ | |||
| WxScoreRules getScoreRules(String tenantId); | |||
| /** | |||
| * 获取租户的积分规则 | |||
| * @param tenantId | |||
| * @return | |||
| */ | |||
| WxScoreRules getCreditRules(String tenantId); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| @@ -42,7 +42,7 @@ public interface WxShopService { | |||
| * @param id | |||
| * @param isAdmin | |||
| */ | |||
| void deleteById(Long id, Integer isAdmin); | |||
| ResultData deleteById(Long id, Integer isAdmin); | |||
| ResultData getbshoplist(String tenantId, String shopNumber); | |||
| @@ -0,0 +1,28 @@ | |||
| package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.mapper.WxBillActionMapper; | |||
| import com.iformall.service.WxBillActionService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Service | |||
| public class WxBillActionServiceImpl implements WxBillActionService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxBillActionMapper wxBillActionMapper; | |||
| @Override | |||
| public PageInfo<WxBillAction> listAsPage(WxBillAction record, Integer pageIndex, Integer pageSize) { | |||
| logger.info("查询账单操作记录列表"); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillActionMapper.findList(record)); | |||
| } | |||
| } | |||
| @@ -1,15 +1,16 @@ | |||
| package com.iformall.service.impl; | |||
| import cn.afterturn.easypoi.excel.entity.ExportParams; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillAllVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -21,6 +22,7 @@ import org.apache.poi.ss.usermodel.Cell; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.xssf.usermodel.XSSFSheet; | |||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -32,6 +34,7 @@ import javax.servlet.http.HttpServletResponse; | |||
| import java.io.*; | |||
| import java.math.BigDecimal; | |||
| import java.math.RoundingMode; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| @@ -87,6 +90,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| @Autowired | |||
| WxBillOtherDepositMapper wxBillOtherDepositMapper; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Autowired | |||
| MqBaseProducer mqBaseProducer; | |||
| @@ -94,9 +100,8 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| public Map<String, Object> listAsPage(WxBillAll record, Integer pageIndex, Integer pageSize) { | |||
| //更新各账单状态 | |||
| updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billList = wxBillAllMapper.list(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billList); | |||
| PageInfo<WxBillAllVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBillAllMapper.list(record)); | |||
| Map<String, Object> result = new HashMap<>(); | |||
| result.put("pageInfo", pageInfo); | |||
| return result; | |||
| @@ -202,6 +207,37 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| } | |||
| } | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) { | |||
| Map<Long, List<WxBillAllVo>> billMapList = wxBillAllMapper.list(wxBillAll) | |||
| .parallelStream() | |||
| .collect(Collectors.groupingBy(WxBillAllVo::getMerchantId)); | |||
| List<Map<String, Object>> list = new ArrayList<>(); | |||
| Iterator<Map.Entry<Long, List<WxBillAllVo>>> entries = billMapList.entrySet().iterator(); | |||
| while (entries.hasNext()) { | |||
| Map.Entry<Long, List<WxBillAllVo>> entry = entries.next(); | |||
| Map<String,Object> map = new HashMap<>(); | |||
| ExportParams deptExportParams = new ExportParams(); | |||
| WxBillAllVo first = ((List<WxBillAllVo>)(entry.getValue())).get(0); | |||
| deptExportParams.setSheetName(first.getMerchantName()); | |||
| deptExportParams.setTitle(first.getMerchantName() | |||
| + " (" | |||
| + EnumRentShopType.getEnum((Integer)first.getRentShopType()).getMessage() | |||
| + "-"+first.getShopNumber() | |||
| + ")"); | |||
| //deptExportParams.setSecondTitle(); | |||
| map.put("title", deptExportParams); | |||
| map.put("entity", WxBillAllVo.class); | |||
| map.put("data", entry.getValue()); | |||
| list.add(map); | |||
| } | |||
| excelService.exportExcel(list, "账单数据.xls", response); | |||
| } | |||
| /* | |||
| @Override | |||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) { | |||
| //得到当前月 | |||
| @@ -341,7 +377,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| private int updateBillOther(Map<String, Object> bill) { | |||
| logger.info("updateBillOther params:"+bill.toString()); | |||
| Object id = bill.get("id"); | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| @@ -33,6 +34,7 @@ import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.*; | |||
| import java.util.concurrent.TimeUnit; | |||
| import java.util.stream.Collectors; | |||
| @Service | |||
| public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| @@ -148,6 +150,13 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| public void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCUserBasicInfoVo> list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| List<WxTags> tagList = wxTagsMapper.findListAll(); | |||
| Map<Long, String> tagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); | |||
| list.stream().filter(u->u.getTags()!=null).forEach(u->{ | |||
| List<Long> ids = JSONObject.parseArray(u.getTags(), Long.class); | |||
| String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/"); | |||
| u.setTagNames(tagNames); | |||
| }); | |||
| excelService.exportExcel(list,null,"会员信息",WxCUserBasicInfoVo.class,"会员信息数据.xls",response); | |||
| } | |||
| /* | |||
| @@ -166,8 +175,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| WxTags wxTagsQ = new WxTags(); | |||
| List<WxTags> tagList = wxTagsMapper.findList(wxTagsQ); | |||
| List<Long> tagIdList = new ArrayList<Long>(); | |||
| @@ -594,7 +594,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| public void downFile(String filePath, String filename, String exportFileName, | |||
| HttpServletResponse response, HttpServletRequest req) throws IOException { | |||
| try { | |||
| @@ -624,5 +624,5 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| } | |||
| @@ -3,20 +3,29 @@ package com.iformall.service.impl; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.google.common.collect.Lists; | |||
| import com.iformall.domain.dto.WxCreditHistoryDto; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| import com.iformall.enums.EnumBusiness; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.WxCreditHistoryService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| @Service | |||
| @Slf4j | |||
| public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| @Autowired | |||
| @@ -34,6 +43,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| @Autowired | |||
| MallUserInfoMapper mallUserInfoMapper; | |||
| @Autowired | |||
| WxScoreRulesService wxScoreRulesService; | |||
| @Override | |||
| public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record)); | |||
| @@ -113,27 +125,202 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxCreditHistory record) { | |||
| public ResultData saveOrUpdate(WxCreditHistory record) { | |||
| WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId()); | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId()); | |||
| if (wxCUser == null && wxCUserBasicInfo == null) { | |||
| //验证此用户是否存在 | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| //获取当前用户总积分 | |||
| int currentCreditAmount = wxCreditHistoryMapper.creditAmount(record.getCUserId()); | |||
| //计算出需要新增或减少的积分 | |||
| int creditChangeNum = creditIncrement(record); | |||
| if (creditChangeNum == 0) { | |||
| return new ResultData(ErrorCode.CREDIT_ZERO); | |||
| } | |||
| if (currentCreditAmount + creditChangeNum < 0) { | |||
| return new ResultData(ErrorCode.CREDIT_NOT_ENOUGH); | |||
| } | |||
| record.setCreditNum(creditChangeNum); | |||
| record.setCreditAmount(currentCreditAmount + creditChangeNum); | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxCreditHistoryMapper.insertSelective(record); | |||
| //将计算出来新的总积分 更新到两张用户表里 | |||
| updateCredit(wxCUser,wxCUserBasicInfo,record.getCreditAmount()); | |||
| } else { | |||
| wxCreditHistoryMapper.updateByPrimaryKeySelective(record); | |||
| //wxCreditHistoryMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "积分操作成功"); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxCreditHistoryMapper.deleteByPrimaryKey(id); | |||
| } | |||
| //根据积分类型计算"增加积分" | |||
| private int creditIncrement(WxCreditHistory record) { | |||
| if (record.getCreditType() == EnumScoreType.LOGIN.getCode()) { | |||
| return loginAddCredit(record); | |||
| } | |||
| if (record.getCreditType() == EnumScoreType.BIND_CAR.getCode()) { | |||
| return bindCarAddCredit(record); | |||
| } | |||
| if (record.getCreditType() == EnumScoreType.WIFI_CONNECTION.getCode()) { | |||
| return wifiAddCredit(); | |||
| } | |||
| if (record.getCreditType() == EnumScoreType.WECHAT_PERSION.getCode()) { | |||
| return personAddCredit(record); | |||
| } | |||
| if (record.getCreditType() == EnumScoreType.WECHAT_PHONE.getCode()) { | |||
| return phoneAddCredit(record); | |||
| } | |||
| if (record.getCreditType() == EnumScoreType.COMPLETE_INFO.getCode()) { | |||
| return infoAddCredit(record); | |||
| } | |||
| if (record.getCreditType() == EnumScoreType.SPEND_CREDIT.getCode()) { | |||
| return spendCredit(record); | |||
| } | |||
| if (record.getCreditType() == EnumScoreType.CHANGE_CREDIT.getCode()) { | |||
| //TODO 待实现 | |||
| return changeCredit(record); | |||
| } | |||
| if (record.getCreditType() == EnumScoreType.CONSUMPTION.getCode()) { | |||
| return payAddCredit(record); | |||
| } | |||
| return 0; | |||
| } | |||
| private int loginAddCredit(WxCreditHistory record) { | |||
| //如果当天已经登录过则跳过 | |||
| if (wxCreditHistoryMapper.loginCount(record) > 0) { | |||
| return 0; | |||
| } | |||
| // 1. 获取当前租户下积分的增加规则 | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| // 2. 增长的积分 | |||
| return wxScoreRules.getRule(EnumScoreType.LOGIN,WxScoreRules.SCORE); | |||
| } | |||
| private int bindCarAddCredit(WxCreditHistory record) { | |||
| // 1. 获取score rules | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| // 2. 增长的积分 | |||
| return wxScoreRules.getRule(EnumScoreType.BIND_CAR,WxScoreRules.SCORE); | |||
| } | |||
| private int wifiAddCredit() { | |||
| int addCreditNumber = 0; | |||
| return addCreditNumber; | |||
| } | |||
| private int personAddCredit(WxCreditHistory record) { | |||
| // 1. 获取score rules | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| // 2. 增长的积分 | |||
| return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE); | |||
| } | |||
| private int phoneAddCredit(WxCreditHistory record) { | |||
| // 1. 获取score rules | |||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| // 2. 获取成长值 | |||
| return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE); | |||
| } | |||
| private int checkCompleteInfoScoreCount(WxCUser cUser) { | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setTenantId(cUser.getTenantId()); | |||
| wxCreditHistory.setCUserId(cUser.getId()); | |||
| wxCreditHistory.setCreditType(EnumScoreType.COMPLETE_INFO.getCode()); | |||
| return wxCreditHistoryMapper.countList(wxCreditHistory); | |||
| } | |||
| private int infoAddCredit(WxCreditHistory record) { | |||
| WxCUser user = wxCUserMapper.selectByPrimaryKey(record.getCUserId()); | |||
| if (user == null || checkCompleteInfoScoreCount(user) > 0) | |||
| return 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user.getTenantId()); | |||
| // 2. 获取成长值 | |||
| return scoreRules.getRule(EnumScoreType.COMPLETE_INFO,WxScoreRules.SCORE); | |||
| } | |||
| private int spendCredit(WxCreditHistory record){ | |||
| int spendCredit = record.getCreditNum(); | |||
| return -spendCredit; | |||
| } | |||
| private int changeCredit(WxCreditHistory record){ | |||
| //TODO 积分兑换扣减规则 | |||
| return 0; | |||
| } | |||
| private int payAddCredit(WxCreditHistory record) { | |||
| int addCreditNumber = 0; | |||
| // 订单金额为0时不计入 | |||
| if (record.getCreditNum() == 0) | |||
| return 0; | |||
| // 1. 获取score rules | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||
| // 2. 获取成长值 by id | |||
| JSONObject payRule = scoreRules.getRuleObj(EnumScoreType.CONSUMPTION); | |||
| // 3. 获取成长值 by 业态 | |||
| JSONObject busRule = null; | |||
| JSONObject busRuleOther = null; | |||
| JSONArray busRules = payRule.getJSONArray("childs"); | |||
| if (busRules != null) { | |||
| for (int i = 0; i < busRules.size(); i++) { | |||
| JSONObject bus = (JSONObject) busRules.get(i); | |||
| Integer businessId1 = bus.getInteger("businessId"); | |||
| if (record.getBusinessId().equals(businessId1)) { | |||
| busRule = bus; | |||
| } | |||
| if (businessId1.equals(EnumBusiness.BUSINESS_ID6.getCode())) { | |||
| busRuleOther = bus; | |||
| } | |||
| } | |||
| if (busRule == null) { | |||
| busRule = busRuleOther; | |||
| } | |||
| } | |||
| if (busRule == null) { | |||
| busRule = payRule; | |||
| } | |||
| Double priceCondition = busRule.getDouble(WxScoreRules.STEP) * 100; // 元->分 | |||
| int baseScore = busRule.getInteger(WxScoreRules.SCORE); // 消费增长积分 | |||
| // 4. 计算积分 | |||
| Double dScoreT = Math.floor(record.getSpend() * 1.0D / priceCondition * baseScore); | |||
| addCreditNumber = dScoreT.intValue(); | |||
| log.info("CREDIT:" + busRule.toJSONString() + "\nAddCredit: " + addCreditNumber); | |||
| return addCreditNumber; | |||
| } | |||
| /** | |||
| * 更新两个表中的最新总积分 | |||
| * @param creditAmount 用户最新总积分 | |||
| */ | |||
| private void updateCredit(WxCUser wxCUser, WxCUserBasicInfo wxCUserBasicInfo, int creditAmount) { | |||
| if (wxCUser != null) { | |||
| wxCUser.setCredit(creditAmount); | |||
| wxCUserMapper.updateByPrimaryKeySelective(wxCUser); | |||
| } | |||
| if (wxCUserBasicInfo != null) { | |||
| wxCUserBasicInfo.setCredit(creditAmount); | |||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(wxCUserBasicInfo); | |||
| } | |||
| } | |||
| } | |||
| @@ -167,7 +167,7 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| public void downFile(String filePath, String filename, String exportFileName, | |||
| HttpServletResponse response, HttpServletRequest req) throws IOException { | |||
| @@ -198,6 +198,6 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| */ | |||
| } | |||
| @@ -205,19 +205,40 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| Date date = new Date(); | |||
| record.setCreatetime(date); | |||
| record.setUpdatetime(date); | |||
| try { | |||
| if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| String rentInfo = record.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| int size = rentInfoArray.size(); | |||
| if (size == 0) { | |||
| return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | |||
| } | |||
| //查询rent_info 包括 shopId | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setTenantId(record.getTenantId()); | |||
| wxRentContract.setShopId(rentInfoObject.getLong("shopId")); | |||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContract); | |||
| if (count > 0) { | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | |||
| } | |||
| } | |||
| } else { | |||
| WxRentContract wxRentContract = new WxRentContract(); | |||
| wxRentContract.setTenantId(record.getTenantId()); | |||
| wxRentContract.setShopId(record.getShopId()); | |||
| long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) | |||
| && !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) | |||
| && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) | |||
| && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) | |||
| && !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode())).count(); | |||
| filter(rc -> rc.get("status").equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) | |||
| || rc.get("status").equals(EnumRentContractStatus.RENT_PAID.getCode()) | |||
| || rc.get("status").equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | |||
| } | |||
| } | |||
| try { | |||
| record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||
| wxRentContractMapper.insertSelective(record); | |||
| } catch (Exception e) { | |||
| @@ -264,51 +285,58 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); | |||
| List<WxBillRent> resultList = wxBillRentMapper.findList(wxBillRent); | |||
| boolean change = false; | |||
| if(CollectionUtils.isEmpty(resultList)){ | |||
| change = true; | |||
| }else if(record.getAdjustPeriod().intValue() != dbRent.getAdjustPeriod().intValue()){ | |||
| change = true; | |||
| ResultData resultData = null; | |||
| if (dbRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| // 更新 | |||
| resultData = getResultDataForUpdate(record, userId); | |||
| //删除预账单,重新生成 | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); | |||
| }else{ | |||
| if(record.getReceivePeriod() != null && record.getLease()!=null && record.getPrice()!= null) { | |||
| if (record.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getPrice().equals(dbRent.getPrice()) | |||
| || !record.getAdjustRatio().replaceAll("\\s*","").equals(dbRent.getAdjustRatio().replaceAll("\\s*","")) | |||
| ) { | |||
| change = true; | |||
| } | |||
| } else if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getRevenue().equals(dbRent.getRevenue()) | |||
| || !record.getPayRatio().equals(dbRent.getPayRatio()) | |||
| ) { | |||
| change = true; | |||
| } | |||
| } else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getPrice().equals(dbRent.getPrice()) | |||
| || !record.getPayRatio().equals(dbRent.getPayRatio()) | |||
| ) { | |||
| change = true; | |||
| boolean change = false; | |||
| if (CollectionUtils.isEmpty(resultList)) { | |||
| change = true; | |||
| } else if (record.getAdjustPeriod().intValue() != dbRent.getAdjustPeriod().intValue()) { | |||
| change = true; | |||
| } else { | |||
| if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null) { | |||
| if (record.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getPrice().equals(dbRent.getPrice()) | |||
| || !record.getAdjustRatio().replaceAll("\\s*", "").equals(dbRent.getAdjustRatio().replaceAll("\\s*", "")) | |||
| ) { | |||
| change = true; | |||
| } | |||
| } else if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getRevenue().equals(dbRent.getRevenue()) | |||
| || !record.getPayRatio().equals(dbRent.getPayRatio()) | |||
| ) { | |||
| change = true; | |||
| } | |||
| } else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { | |||
| if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) | |||
| || !record.getLease().equals(dbRent.getLease()) | |||
| || !record.getType().equals(dbRent.getType()) | |||
| || !record.getPrice().equals(dbRent.getPrice()) | |||
| || !record.getPayRatio().equals(dbRent.getPayRatio()) | |||
| ) { | |||
| change = true; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| // 更新 | |||
| ResultData resultData = getResultDataForUpdate(record, userId); | |||
| //有改变,删除预账单,重新生成 | |||
| if(change) { | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); | |||
| // 更新 | |||
| resultData = getResultDataForUpdate(record, userId); | |||
| //有改变,删除预账单,重新生成 | |||
| if (change) { | |||
| wxBillRentMapper.deletePreviewBill(record); | |||
| resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); | |||
| } | |||
| } | |||
| //启动审批流 | |||
| @@ -373,20 +401,40 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| record.setDeposit(record.getDeposit() == null ? 0 : record.getDeposit()); | |||
| record.setUpdatetime(new Date()); | |||
| try { | |||
| WxRentContract wxRentContractParams = new WxRentContract(); | |||
| wxRentContractParams.setTenantId(record.getTenantId()); | |||
| wxRentContractParams.setShopId(record.getShopId()); | |||
| long count = wxRentContractMapper.queryRentContractData(wxRentContractParams).stream(). | |||
| filter(rc -> !rc.get("status").equals(EnumRentContractStatus.CONTRACT_TERMINATE.getCode()) | |||
| && !rc.get("status").equals(EnumRentContractStatus.WAIT_SIGN.getCode()) | |||
| && !rc.get("status").equals(EnumRentContractStatus.INVALID.getCode()) | |||
| && !rc.get("status").equals(EnumRentContractStatus.CONTRACT_END.getCode()) | |||
| && !rc.get("status").equals(EnumRentContractStatus.INTENTION.getCode()) | |||
| && !rc.get("id").equals(wxRentContract.getId())).count(); | |||
| if (record.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| String rentInfo = record.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| int size = rentInfoArray.size(); | |||
| if (size == 0) { | |||
| return new ResultData(ErrorCode.SHOP_NOT_SELECTED); | |||
| } | |||
| //查询rent_info 包括 shopId | |||
| for (int i = 0; i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| WxRentContract wxRentContractQuery = new WxRentContract(); | |||
| wxRentContractQuery.setTenantId(record.getTenantId()); | |||
| wxRentContractQuery.setShopId(rentInfoObject.getLong("shopId")); | |||
| int count = wxRentContractMapper.selectRentContractCountByShopId(wxRentContractQuery); | |||
| if (count > 0) { | |||
| String shopNumber = rentInfoObject.getString("shopNumber"); | |||
| return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shopNumber + " 已出租"); | |||
| } | |||
| } | |||
| } else { | |||
| WxRentContract wxRentContractQuery = new WxRentContract(); | |||
| wxRentContractQuery.setTenantId(record.getTenantId()); | |||
| wxRentContractQuery.setShopId(record.getShopId()); | |||
| long count = wxRentContractMapper.queryRentContractData(wxRentContract).stream(). | |||
| filter(rc -> rc.get("status").equals(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()) | |||
| || rc.get("status").equals(EnumRentContractStatus.RENT_PAID.getCode()) | |||
| || rc.get("status").equals(EnumRentContractStatus.CONTRACT_END_SOON.getCode())).count(); | |||
| if (count > 0) { | |||
| return new ResultData(ErrorCode.RENT_CONTRACT_WITH_SHOP_IS_FOUND); | |||
| } | |||
| } | |||
| try { | |||
| wxRentContractMapper.updateByPrimaryKeySelective(record); | |||
| } catch (Exception e) { | |||
| logger.error("更新租赁合同信息失败,e:" + e.getMessage()); | |||
| @@ -442,15 +490,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxBillDeposit.setUpdatetime(date); | |||
| wxBillDeposit.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | |||
| wxBillDeposit.setRentShopType(wxRentContract.getRentShopType()); | |||
| String rentInfo = wxRentContract.getRentInfo(); | |||
| if (rentInfo != null) { | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| Map<String, Object> shopInfo = new HashMap<>(); | |||
| for (int i = 0, size = rentInfoArray.size(); i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| shopInfo.put(rentInfoObject.getString("shopNumber"), rentInfoObject.get("deposit")); | |||
| if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| String rentInfo = wxRentContract.getRentInfo(); | |||
| if (rentInfo != null) { | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| Map<String, Object> shopInfo = new HashMap<>(); | |||
| for (int i = 0, size = rentInfoArray.size(); i < size; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| shopInfo.put(rentInfoObject.getString("shopNumber"), rentInfoObject.get("deposit")); | |||
| } | |||
| wxBillDeposit.setShopInfo(JSONObject.toJSONString(shopInfo)); | |||
| } | |||
| wxBillDeposit.setShopInfo(JSONObject.toJSONString(shopInfo)); | |||
| } | |||
| try { | |||
| wxBillDepositMapper.insertSelective(wxBillDeposit); | |||
| @@ -513,7 +563,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| int[] priceArr = new int[arraySize]; | |||
| for (int i = 0; i < arraySize; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| priceArr[i] = rentInfoObject.getIntValue("price"); | |||
| priceArr[i] = new BigDecimal(rentInfoObject.getIntValue("price")).multiply(new BigDecimal(100)).intValue(); | |||
| } | |||
| priceList.add(priceArr); | |||
| //大于一年 | |||
| @@ -526,8 +576,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| for (int j = 0; j < arraySize; j++) { | |||
| rentInfoObject = rentInfoArray.getJSONObject(j); | |||
| adjustRatio = rentInfoObject.getJSONArray("adjustRatio"); | |||
| double price = priceList.get(i)[j] + priceList.get(i)[j] * adjustRatio.getIntValue(i) / 10000.0; | |||
| priceArrs[j] = new BigDecimal(price).setScale(0, RoundingMode.HALF_EVEN).intValue(); | |||
| BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getIntValue(i)).divide(new BigDecimal(100))); | |||
| BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply); | |||
| priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).intValue(); | |||
| } | |||
| priceList.add(priceArrs); | |||
| } | |||
| @@ -535,32 +586,50 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| public List<WxBillRent> buildRentMonth(WxMerchant wxMerchant, Long userId, WxRentContract wxRentContract, int receivePeriod, Integer lease, Date rentalStartDate, Integer price,Integer isPreview) { | |||
| String rentInfo = wxRentContract.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| List<int[]> priceList = computePrice(rentInfo); | |||
| int size = priceList.size(); | |||
| int[] priceArrs = new int[size]; | |||
| for (int i = 0; i < size; i++) { | |||
| int[] priceInt = priceList.get(i); | |||
| int sum = 0; | |||
| for (int p : priceInt) { | |||
| sum += p; | |||
| int size = 0; | |||
| int[] priceArrs = null; | |||
| List<Map<String, Object>> shopInfos = new ArrayList<>(); | |||
| if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { | |||
| String rentInfo = wxRentContract.getRentInfo(); | |||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | |||
| List<int[]> priceList = computePrice(rentInfo); | |||
| size = priceList.size(); | |||
| priceArrs = new int[size]; | |||
| for (int i = 0; i < size; i++) { | |||
| int[] priceInt = priceList.get(i); | |||
| int sum = 0; | |||
| for (int p : priceInt) { | |||
| sum += p; | |||
| } | |||
| priceArrs[i] = sum; | |||
| } | |||
| priceArrs[i] = sum; | |||
| } | |||
| List<Map<String, Object>> shopInfos = new ArrayList<>(); | |||
| for (int i = 0; i < size; i++) { | |||
| Map<String, Object> shopInfo = new HashMap<>(); | |||
| int[] ints = priceList.get(i); | |||
| for (int j = 0; j < ints.length; j++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); | |||
| shopInfo.put(rentInfoObject.getString("shopNumber"), ints[j]); | |||
| for (int i = 0; i < size; i++) { | |||
| Map<String, Object> shopInfo = new HashMap<>(); | |||
| int[] ints = priceList.get(i); | |||
| for (int j = 0; j < ints.length; j++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); | |||
| shopInfo.put(rentInfoObject.getString("shopNumber"), ints[j]); | |||
| } | |||
| shopInfos.add(shopInfo); | |||
| } | |||
| } else { | |||
| String adjustRatio = wxRentContract.getAdjustRatio(); | |||
| List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class); | |||
| integers.add(0, 0); | |||
| size = integers.size(); | |||
| priceArrs = new int[size]; | |||
| priceArrs[0] = price; | |||
| double priceD = price; | |||
| for (int i = 1; i < size; i++) { | |||
| priceD = priceD + priceD * integers.get(i) / 10000.0; | |||
| priceArrs[i] = new BigDecimal(priceD).setScale(0, RoundingMode.HALF_EVEN).intValue(); | |||
| } | |||
| shopInfos.add(shopInfo); | |||
| } | |||
| int month = 12; | |||
| int divide = lease / month; | |||
| int mod = lease % month; | |||
| @@ -579,7 +648,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| instance.setTime(rentalStartDate); | |||
| //开始时间 | |||
| instance.add(Calendar.MONTH, month * i); | |||
| Map<String, Object> resultMap = buildRent(leaseArr[i], receivePeriod, priceArrs[i], instance.getTime(), Calendar.MONTH, wxRentContract, userId, wxMerchant, billcount, isPreview, shopInfos.get(i)); | |||
| Map<String, Object> resultMap = buildRent(leaseArr[i], receivePeriod, priceArrs[i], instance.getTime(), Calendar.MONTH, wxRentContract, userId, wxMerchant, billcount, isPreview, shopInfos.isEmpty() ? null : shopInfos.get(i)); | |||
| List<WxBillRent> billRentList = (List<WxBillRent>)resultMap.get("billList"); | |||
| billcount = (Integer)resultMap.get("billcount"); | |||
| resultList.addAll(billRentList); | |||
| @@ -1538,67 +1607,4 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| wxRentContractMapper.updateApplyStatus(wxRentContract); | |||
| } | |||
| public static void main(String[] args) { | |||
| JSONArray rentInfoArray = JSONArray.parseArray("[{shopId:0,shopNumber:0,price:1000,adjustRatio:[1100,1100]},{shopId:1,shopNumber:1,price:2000,adjustRatio:[1200,1200]},{shopId:2,shopNumber:2,price:3000,adjustRatio:[1300,1300]}]"); | |||
| int arraySize = rentInfoArray.size(); | |||
| List<int[]> priceList = new ArrayList<>(); | |||
| //第一年 | |||
| int[] priceArr = new int[arraySize]; | |||
| for (int i = 0; i < arraySize; i++) { | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | |||
| priceArr[i] = rentInfoObject.getIntValue("price"); | |||
| } | |||
| priceList.add(priceArr); | |||
| //大于一年 | |||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(0); | |||
| JSONArray adjustRatio = rentInfoObject.getJSONArray("adjustRatio"); | |||
| int adjustRatioSize = adjustRatio.size(); | |||
| for (int i = 0; i < adjustRatioSize; i++) { | |||
| int[] priceArrs = new int[arraySize]; | |||
| for (int j = 0; j < arraySize; j++) { | |||
| rentInfoObject = rentInfoArray.getJSONObject(j); | |||
| adjustRatio = rentInfoObject.getJSONArray("adjustRatio");// | |||
| double price = priceList.get(i)[j] + priceList.get(i)[j] * adjustRatio.getIntValue(i) / 10000.0; | |||
| priceArrs[j] = new BigDecimal(price).setScale(0, RoundingMode.HALF_EVEN).intValue(); | |||
| } | |||
| priceList.add(priceArrs); | |||
| } | |||
| int size = priceList.size(); | |||
| int[] priceArrs = new int[size]; | |||
| for (int i = 0; i < size; i++) { | |||
| int[] price = priceList.get(i); | |||
| int sum = 0; | |||
| for (int p : price) { | |||
| sum += p; | |||
| } | |||
| priceArrs[i] = sum; | |||
| } | |||
| List<Map<String, Object>> shopInfos = new ArrayList<>(); | |||
| for (int i = 0; i < size; i++) { | |||
| Map<String, Object> shopInfo = new HashMap<>(); | |||
| int[] ints = priceList.get(i); | |||
| for (int j = 0; j < ints.length; j++) { | |||
| rentInfoObject = rentInfoArray.getJSONObject(j); | |||
| shopInfo.put(rentInfoObject.getString("shopNumber"), ints[j]); | |||
| } | |||
| shopInfos.add(shopInfo); | |||
| } | |||
| System.out.println(shopInfos); | |||
| //System.out.println(Arrays.toString(priceArr)); | |||
| // Calendar a = Calendar.getInstance(); | |||
| // a.set(Calendar.DATE, 1); | |||
| // a.roll(Calendar.DATE, -1); | |||
| // int maxDate = a.get(Calendar.DATE); | |||
| // System.out.println(maxDate); | |||
| // a.clear(); | |||
| // a.setTime(new Date()); | |||
| // System.out.println(a.get(Calendar.DAY_OF_MONTH)); | |||
| } | |||
| } | |||
| @@ -28,6 +28,8 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| private String keyPrev = "setting:scorerules:"; | |||
| private String creditKeyPrev = "setting:creditrules:"; | |||
| @Autowired | |||
| WxScoreRulesMapper wxScoreRulesMapper; | |||
| @Autowired | |||
| @@ -57,6 +59,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| WxScoreRules scoreRules = new WxScoreRules(); | |||
| scoreRules.setTenantId(tenantId); | |||
| scoreRules.setType(1); | |||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | |||
| if (list.size() > 0) { | |||
| scoreRules = list.get(0); | |||
| @@ -76,6 +79,39 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| return scoreRules; | |||
| } | |||
| @Override | |||
| public WxScoreRules getCreditRules(String tenantId) { | |||
| // get pushLime from cache | |||
| String key = creditKeyPrev + tenantId; | |||
| // 缓存存在 | |||
| if (scoreRulesRedisTemplate.hasKey(key)) { | |||
| WxScoreRules wScoreRules = scoreRulesRedisTemplate.opsForValue().get(key); | |||
| logger.info("WxScoreRulesServiceImpl.getScoreRules() : 从缓存中获取了积分值设置 >> " + wScoreRules.toString()); | |||
| return wScoreRules; | |||
| } | |||
| WxScoreRules scoreRules = new WxScoreRules(); | |||
| scoreRules.setTenantId(tenantId); | |||
| scoreRules.setType(2); | |||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | |||
| if (list.size() > 0) { | |||
| scoreRules = list.get(0); | |||
| } else { | |||
| // 如果积分规则不存在,启用默认值 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| scoreRules.setId(idWorker.nextId()); | |||
| scoreRules.setRules(WxScoreRules.getDefaultRules()); | |||
| wxScoreRulesMapper.insertSelective(scoreRules); | |||
| } | |||
| // 插入缓存 | |||
| scoreRulesRedisTemplate.opsForValue().set(key, scoreRules); | |||
| logger.info("WxScoreRulesServiceImpl.getScoreRules() : 积分设置插入缓存 >> " + scoreRules.toString()); | |||
| return scoreRules; | |||
| } | |||
| @Override | |||
| @@ -89,12 +125,23 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| wxScoreRulesMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| // 缓存存在,删除缓存 | |||
| String key = keyPrev + record.getTenantId(); | |||
| boolean hasKey = scoreRulesRedisTemplate.hasKey(key); | |||
| if (hasKey) { | |||
| scoreRulesRedisTemplate.delete(key); | |||
| logger.info("WxScoreRulesServiceImpl.saveOrUpdate() : 从缓存中删除成长值设置 >> " + record.toString()); | |||
| if (record != null && record.getType() == 1) { | |||
| // 缓存存在,删除缓存 | |||
| String key = keyPrev + record.getTenantId(); | |||
| boolean hasKey = scoreRulesRedisTemplate.hasKey(key); | |||
| if (hasKey) { | |||
| scoreRulesRedisTemplate.delete(key); | |||
| logger.info("WxScoreRulesServiceImpl.saveOrUpdate() : 从缓存中删除成长值设置 >> " + record.toString()); | |||
| } | |||
| } | |||
| if (record != null && record.getType() == 2) { | |||
| // 缓存存在,删除缓存 | |||
| String key = creditKeyPrev + record.getTenantId(); | |||
| boolean hasKey = scoreRulesRedisTemplate.hasKey(key); | |||
| if (hasKey) { | |||
| scoreRulesRedisTemplate.delete(key); | |||
| logger.info("WxScoreRulesServiceImpl.saveOrUpdate() : 从缓存中删除积分设置 >> " + record.toString()); | |||
| } | |||
| } | |||
| } | |||
| @@ -123,6 +170,8 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| } | |||
| } | |||
| private void resetBasicUserScore(Long userId, int scoreNumber) { | |||
| // 1. basicUser | |||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectByPrimaryKey(userId); | |||
| @@ -9,19 +9,14 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMerchantShop; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.vo.WxShopVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.EnumRentShopType; | |||
| import com.iformall.enums.EnumShopStatus; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| import com.iformall.mapper.WxMerchantShopMapper; | |||
| import com.iformall.mapper.WxShopMapper; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxShopService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DownFileUtil; | |||
| import org.apache.commons.io.FileUtils; | |||
| import org.apache.poi.ss.usermodel.Cell; | |||
| import org.apache.poi.ss.usermodel.Row; | |||
| import org.apache.poi.xssf.streaming.SXSSFSheet; | |||
| import org.apache.poi.xssf.streaming.SXSSFWorkbook; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -29,9 +24,10 @@ import org.springframework.stereotype.Service; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.util.*; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| public class WxShopServiceImpl implements WxShopService { | |||
| @@ -83,21 +79,39 @@ public class WxShopServiceImpl implements WxShopService { | |||
| } | |||
| @Override | |||
| public void deleteById(Long id, Integer isAdmin) { | |||
| public ResultData deleteById(Long id, Integer isAdmin) { | |||
| //1、已出租不让删除 | |||
| WxShop wxShop = wxShopMapper.selectByPrimaryKey(id); | |||
| if (wxShop == null) { | |||
| return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND); | |||
| } | |||
| if (wxShop.getStatus().equals(EnumShopStatus.RENT.getCode())) { | |||
| throw new MallinkException(ErrorCode.SHOP_BAN_DELETED); | |||
| return new ResultData(ErrorCode.SHOP_BAN_DELETED); | |||
| } | |||
| //2、是否关联过商户 | |||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | |||
| wxMerchantShop.setShopId(wxShop.getId()); | |||
| int count = wxMerchantShopMapper.selectCount(wxMerchantShop); | |||
| List<WxMerchantShop> wxMerchantShops = wxMerchantShopMapper.select(wxMerchantShop); | |||
| //有关联过商户必须是管理员才能删除 | |||
| if (count > 0 && !isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) { | |||
| throw new MallinkException(ErrorCode.SHOP_DELETED_BY_ADMIN); | |||
| int count = wxMerchantShops.size(); | |||
| if (count > 0) { | |||
| if (!isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) { | |||
| return new ResultData(ErrorCode.SHOP_DELETED_BY_ADMIN); | |||
| } | |||
| //更新标记 | |||
| wxShop.setIsDel(EnumDelStatus.DEL.getCode()); | |||
| wxShopMapper.updateByPrimaryKeySelective(wxShop); | |||
| //关联表 | |||
| for (int i = 0; i < count; i++) { | |||
| WxMerchantShop updateMerchantShop = wxMerchantShops.get(i); | |||
| updateMerchantShop.setIsDel(EnumDelStatus.DEL.getCode()); | |||
| wxMerchantShopMapper.updateByPrimaryKeySelective(updateMerchantShop); | |||
| } | |||
| } else { | |||
| //无关联商铺直接删除 | |||
| wxShopMapper.deleteByPrimaryKey(id); | |||
| } | |||
| wxShopMapper.deleteByPrimaryKey(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功"); | |||
| } | |||
| @Override | |||
| @@ -3,6 +3,8 @@ package com.iformall.utils; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.exception.MallinkException; | |||
| import okhttp3.*; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -306,7 +308,7 @@ public class ETCPUtil { | |||
| * } | |||
| */ | |||
| public String userSignin(String baseUrl, String appId, String merchantNo, String merchantKey, String version, | |||
| String mobilePhone) { | |||
| String mobilePhone) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("appId", appId); | |||
| jsonObject.put("mobilePhone", mobilePhone); | |||
| @@ -315,8 +317,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + userSigninUrl.replaceAll("\\{version}", version), data, sign, | |||
| String respStr = doPost(baseUrl + userSigninUrl.replaceAll("\\{version}", version), data, sign, | |||
| timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -333,7 +339,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String bindCar(String baseUrl, String merchantNo, String merchantKey, String version, | |||
| String etcpToken, | |||
| String plateNumber, String plateColor) { | |||
| String plateNumber, String plateColor) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| jsonObject.put("plateNumber", plateNumber); | |||
| @@ -346,8 +352,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + bindCarUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + bindCarUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -363,7 +373,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String unbindCar(String baseUrl, String merchantNo, String merchantKey, String version, | |||
| String etcpToken, | |||
| String plateNumber) { | |||
| String plateNumber) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| jsonObject.put("plateNumber", plateNumber); | |||
| @@ -372,8 +382,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + unbindCarUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + unbindCarUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -392,7 +406,7 @@ public class ETCPUtil { | |||
| public String carAuth(String baseUrl, String merchantNo, String merchantKey, String version, | |||
| String etcpToken, | |||
| String carFrameNum, String plateNumber, String carEngineNum | |||
| ) { | |||
| ) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| jsonObject.put("carFrameNum", carFrameNum); | |||
| @@ -403,8 +417,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + carAuthUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + carAuthUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -423,7 +441,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String carRetrieve(String baseUrl, String merchantNo, String merchantKey, String version, | |||
| String etcpToken, | |||
| String carFrameNum, String plateNumber, String carEngineNum, String plateColor ) { | |||
| String carFrameNum, String plateNumber, String carEngineNum, String plateColor ) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| jsonObject.put("carFrameNum", carFrameNum); | |||
| @@ -436,8 +454,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + carRetrieveUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + carRetrieveUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -458,7 +480,7 @@ public class ETCPUtil { | |||
| * } | |||
| */ | |||
| public String carNum(String baseUrl, String merchantNo, String merchantKey, String version, | |||
| String etcpToken) { | |||
| String etcpToken) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| @@ -466,8 +488,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doGet(baseUrl + carNumUrl.replaceAll("\\{version}", version), | |||
| String respStr = doGet(baseUrl + carNumUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -481,7 +507,7 @@ public class ETCPUtil { | |||
| public String orderUnpay(String baseUrl, | |||
| String appId, String merchantNo, String merchantKey, String version, | |||
| String etcpToken, | |||
| String plateNumber) { | |||
| String plateNumber) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| jsonObject.put("plateNumber", plateNumber); | |||
| @@ -493,8 +519,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doGet(baseUrl + orderUnpayUrl.replaceAll("\\{version}", version), | |||
| String respStr = doGet(baseUrl + orderUnpayUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -508,7 +538,7 @@ public class ETCPUtil { | |||
| public String couponList(String baseUrl, | |||
| String merchantNo, String merchantKey, String version, | |||
| String etcpToken, | |||
| String lastCode, String pageSize) { | |||
| String lastCode, String pageSize) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| if (!StringUtils.isBlank(lastCode)) | |||
| @@ -519,8 +549,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doGet(baseUrl + couponListUrl.replaceAll("\\{version}", version), | |||
| String respStr = doGet(baseUrl + couponListUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -531,7 +565,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String orderHistory(String baseUrl, | |||
| String merchantNo, String merchantKey, String version, | |||
| String etcpToken) { | |||
| String etcpToken) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| @@ -539,8 +573,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doGet(baseUrl + orderHistoryUrl.replaceAll("\\{version}", version), | |||
| String respStr = doGet(baseUrl + orderHistoryUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -555,7 +593,7 @@ public class ETCPUtil { | |||
| public String orderPay(String baseUrl, | |||
| String merchantNo, String merchantKey, String version, | |||
| String etcpToken, String orderId, | |||
| String returnUrl, String couponCode) { | |||
| String returnUrl, String couponCode) throws MallinkException { | |||
| // payType 支付方式(1 微信公众号内支付 2 支付宝 H5 支付 3 微信二维码 4 支付宝二维码 5 微信 H5)(非空) | |||
| int payType = 1; | |||
| JSONObject jsonObject = new JSONObject(); | |||
| @@ -571,8 +609,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + orderpayUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + orderpayUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -591,7 +633,7 @@ public class ETCPUtil { | |||
| String appId, String merchantNo, String merchantKey, String version, | |||
| String etcpToken, | |||
| String orderId, String externalOrderId, | |||
| BigDecimal payment, String payTime, String verificationInfo) { | |||
| BigDecimal payment, String payTime, String verificationInfo) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| jsonObject.put("orderId", orderId); | |||
| @@ -607,8 +649,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + orderPaidUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + orderPaidUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -619,7 +665,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String parkingInfo(String baseUrl, | |||
| String merchantNo, String merchantKey, String version, | |||
| String lat, String lon, String radius) { | |||
| String lat, String lon, String radius) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("lat", lat); | |||
| jsonObject.put("lon", lon); | |||
| @@ -630,8 +676,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + parkingInfoUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + parkingInfoUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -642,7 +692,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String parkingStatus(String baseUrl, | |||
| String merchantNo, String merchantKey, String version, | |||
| String parkingId) { | |||
| String parkingId) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("parkingId", parkingId); | |||
| @@ -650,8 +700,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + parkingStatusUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + parkingStatusUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -662,7 +716,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String getDebt(String baseUrl, | |||
| String appId, String merchantNo, String merchantKey, String version, | |||
| String etcpToken, String carNumber) { | |||
| String etcpToken, String carNumber) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| jsonObject.put("appId", appId); | |||
| @@ -672,8 +726,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + parkingStatusUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + parkingStatusUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -686,7 +744,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String repayDebt(String baseUrl, | |||
| String merchantNo, String merchantKey, String version, | |||
| String etcpToken, String returnUrl) { | |||
| String etcpToken, String returnUrl) throws MallinkException { | |||
| // payType(1:支付宝 2:微信H5) | |||
| int payType = 2; | |||
| JSONObject jsonObject = new JSONObject(); | |||
| @@ -698,8 +756,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + parkingStatusUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + parkingStatusUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -709,7 +771,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String getBCouponList(String baseUrl, | |||
| String merchantNo, String merchantKey, String version, | |||
| String parkId, String businessId) { | |||
| String parkId, String businessId) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("parkId", parkId); | |||
| jsonObject.put("businessId", businessId); | |||
| @@ -718,8 +780,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + bCouponListUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + bCouponListUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -731,7 +797,7 @@ public class ETCPUtil { | |||
| public String bCouponRecord(String baseUrl, | |||
| String merchantNo, String merchantKey, String version, | |||
| String etcpToken, | |||
| String parkId, String businessId, String carNumber, String couponFreeId) { | |||
| String parkId, String businessId, String carNumber, String couponFreeId) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("token", etcpToken); | |||
| jsonObject.put("parkId", parkId); | |||
| @@ -743,8 +809,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + bCouponRecordUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + bCouponRecordUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| /** | |||
| @@ -755,7 +825,7 @@ public class ETCPUtil { | |||
| */ | |||
| public String carSimulation(String baseUrl, | |||
| String appId, String merchantNo, String merchantKey, String version, | |||
| String plateNumber) { | |||
| String plateNumber) throws MallinkException { | |||
| JSONObject jsonObject = new JSONObject(); | |||
| jsonObject.put("appId", appId); | |||
| jsonObject.put("plateNumber", plateNumber); | |||
| @@ -764,8 +834,12 @@ public class ETCPUtil { | |||
| String timeStamp = dateTimeFormatter.format(LocalDateTime.now()); | |||
| String sign = genSign(data, merchantKey, timeStamp); | |||
| return doPost(baseUrl + bCarSimulationUrl.replaceAll("\\{version}", version), | |||
| String respStr = doPost(baseUrl + bCarSimulationUrl.replaceAll("\\{version}", version), | |||
| data, sign, timeStamp, merchantNo); | |||
| if(respStr.startsWith("<html>")) { | |||
| throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); | |||
| } | |||
| return respStr; | |||
| } | |||
| private String doPost(String url, String data, String sign, String timeStamp, String merchantNo) { | |||
| @@ -0,0 +1,57 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillActionMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBillAction"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="bill_id" jdbcType="BIGINT" property="bill_id"/> | |||
| <result column="user_id" jdbcType="BIGINT" property="userId"/> | |||
| <result column="user_name" jdbcType="VARCHAR" property="userName"/> | |||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | |||
| <result column="action" jdbcType="INTEGER" property="action"/> | |||
| <result column="details" jdbcType="VARCHAR" property="details"/> | |||
| <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/> | |||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`bill_id`,`user_id`,`user_name`,`phone`,`action`,`details`,`createtime`,`updatetime` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != action "> | |||
| and `action` = #{action} | |||
| </if> | |||
| <if test=" null != billId "> | |||
| and `bill_id` = #{billId} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxBillAction" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_bill_action | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||
| @@ -2,12 +2,47 @@ | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxBillAllMapper"> | |||
| <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | |||
| select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | |||
| bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status, | |||
| bill.tenant_id tenantId,m.name merchantName,s.shop_number | |||
| shopNumber,bill.starttime,bill.endtime,bill.name,s.manager,s.manager_phone managerPhone, | |||
| bill.rent_shop_type rentShopType from ( | |||
| <resultMap id="allVoResultMap" type="com.iformall.domain.vo.WxBillAllVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenantId" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="merchantId" jdbcType="INTEGER" property="merchantId" /> | |||
| <result column="shopId" jdbcType="INTEGER" property="shopId" /> | |||
| <result column="billTypeValue" jdbcType="INTEGER" property="billTypeValue"/> | |||
| <result column="billType" jdbcType="VARCHAR" property="billType"/> | |||
| <result column="needPay" jdbcType="INTEGER" property="needPay" /> | |||
| <result column="merchantName" jdbcType="VARCHAR" property="merchantName" /> | |||
| <result column="rentShopType" jdbcType="INTEGER" property="rentShopType"/> | |||
| <result column="receiveDate" jdbcType="TIMESTAMP" property="receiveDate" /> | |||
| <result column="expiredDay" jdbcType="INTEGER" property="expiredDay" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="receivePay" jdbcType="INTEGER" property="receivePay" /> | |||
| <result column="owe" jdbcType="INTEGER" property="owe" /> | |||
| <result column="pay" jdbcType="INTEGER" property="pay" /> | |||
| <result column="payDate" jdbcType="TIMESTAMP" property="payDate" /> | |||
| <result column="starttime" jdbcType="TIMESTAMP" property="starttime" /> | |||
| <result column="endtime" jdbcType="TIMESTAMP" property="endtime" /> | |||
| <result column="shopNumber" jdbcType="VARCHAR" property="shopNumber"/> | |||
| <result column="manager" jdbcType="VARCHAR" property="manager"/> | |||
| <result column="managerPhone" jdbcType="VARCHAR" property="managerPhone"/> | |||
| </resultMap> | |||
| <select id="list" parameterType="com.iformall.domain.vo.WxBillAll" resultMap="allVoResultMap"> | |||
| select | |||
| bill.id,bill.tenant_id tenantId,bill.merchant_id merchantId,bill.shop_id shopId, | |||
| bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | |||
| bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate, | |||
| bill.expired_day expiredDay,bill.status, | |||
| bill.starttime,bill.endtime,bill.name,bill.rent_shop_type rentShopType, | |||
| m.name merchantName, | |||
| s.shop_number shopNumber, s.manager, s.manager_phone managerPhone | |||
| from ( | |||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | |||
| @@ -53,14 +88,14 @@ | |||
| <if test=" null != billTypeValue ">and bill.bill_type_value = #{billTypeValue}</if> | |||
| <if test=" null != status ">and bill.`status` = #{status}</if> | |||
| <if test=" null != rentShopType ">and bill.rent_shop_type = #{rentShopType}</if> | |||
| order by bill.id desc,bill.merchant_id,bill.status,bill.receive_date desc | |||
| </select> | |||
| <select id="queryOweInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | |||
| select count(bill.id) owncount,IFNULL(sum(bill.owe),0) owe from ( | |||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | |||
| @@ -103,9 +138,9 @@ | |||
| and bill.rent_shop_type = #{rentShopType} | |||
| </if> | |||
| </select> | |||
| <select id="queryPaidInfo" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | |||
| select count(bill.id) paycount,IFNULL(sum(bill.pay),0) pay from ( | |||
| select id,merchant_id,shop_id,tenant_id,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,rent_shop_type from wx_bill_rent where is_preview = 0 | |||
| @@ -147,8 +182,8 @@ | |||
| and bill.rent_shop_type = #{rentShopType} | |||
| </if> | |||
| </select> | |||
| <select id="listData" resultType="hashmap" parameterType="com.iformall.domain.vo.WxBillAll"> | |||
| select bill.id,bill.merchant_id merchantId,bill.shop_id shopId,bill.bill_type_value billTypeValue,bill.bill_type billType,bill.need_pay needPay, | |||
| bill.receive_pay receivePay,bill.pay,bill.owe,bill.receive_date receiveDate,bill.pay_date payDate,bill.expired_day expiredDay,bill.status, | |||
| @@ -209,12 +244,12 @@ | |||
| #{status} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != typeList "> | |||
| and bill.`bill_type_value` in | |||
| <foreach collection="typeList" index="index" item="type" open="(" separator="," close=")"> | |||
| #{type} | |||
| </foreach> | |||
| </foreach> | |||
| </if> | |||
| <if test="null!=starttime and null!=endtime"> | |||
| and DATE_FORMAT(bill.receive_date,'%Y-%m') between #{starttime} and #{endtime} | |||
| @@ -230,98 +265,52 @@ | |||
| </if> | |||
| order by bill.merchant_id,bill.status,bill.receive_date desc | |||
| </select> | |||
| <select id="getWaitPayBill" resultType="hashmap"> | |||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.receive_date receiveDate, | |||
| bill.need_pay needPay,m.link_phone linkPhone,app.appname from ( | |||
| select bill.tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | |||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent_deposit | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property where is_preview = 0 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property_deposit | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_daily where type=1 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_daily where type=2 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_other | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_other_deposit | |||
| ) bill | |||
| where DATEDIFF(bill.receive_date,now())=3 and bill.status not in(3,5,6) | |||
| group by bill.tenant_id,bill.merchant_id,bill.receive_date) bill | |||
| left join wx_merchant m on bill.merchant_id=m.id | |||
| left join (select tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | |||
| where m.status=1 | |||
| </select> | |||
| <select id="getWaitPayBillForEmail" resultType="hashmap"> | |||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.receive_date receiveDate, | |||
| bill.need_pay needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType,ws.manager,ws.manager_phone managerPhone from ( | |||
| select bill.bill_type,bill.tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | |||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent_deposit | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property where is_preview = 0 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property_deposit | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_daily where type=1 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_daily where type=2 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_other | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_other_deposit | |||
| ) bill | |||
| group by bill.tenant_id,bill.merchant_id,bill.receive_date,bill.bill_type | |||
| bill.need_pay needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType from ( | |||
| select bill.bill_type,bill.tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | |||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'租赁押金' name,2 bill_type_value,'租赁押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_rent_deposit | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'物业费' name,3 bill_type_value,'物业费' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property where is_preview = 0 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'物业押金' name,4 bill_type_value,'物业押金' | |||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | |||
| endtime,rent_shop_type from wx_bill_property_deposit | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'水费' name,5 bill_type_value,'水费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_daily where type=1 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,'电费' name,6 bill_type_value,'电费' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_daily where type=2 | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,name,7 bill_type_value,'其他' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_other | |||
| union | |||
| select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as | |||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | |||
| from wx_bill_other_deposit | |||
| ) bill | |||
| where DATEDIFF(bill.receive_date,now())=3 and bill.status not in(3,5,6) | |||
| group by bill.tenant_id,bill.merchant_id,bill.receive_date) bill | |||
| left join wx_merchant m on bill.merchant_id=m.id | |||
| left join (select tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | |||
| left join wx_merchant_shop wms on wms.merchant_id = m.id | |||
| left join wx_shop ws on wms.shop_id = ws.id | |||
| where m.status=1 | |||
| </select> | |||
| <select id="getOweBill" resultType="hashmap"> | |||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.owe,m.link_phone linkPhone,app.appname from ( | |||
| select bill.tenant_id,bill.merchant_id,sum(owe) owe from ( | |||
| @@ -17,11 +17,12 @@ | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="level" jdbcType="VARCHAR" property="level"/> | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | |||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, | |||
| `create_date`,`update_date`,`tenant_id`,`name`,`level`,`nick_name` | |||
| `create_date`,`update_date`,`tenant_id`,`name`,`level`,`nick_name`,`credit` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -63,6 +64,10 @@ | |||
| and `poins` = #{poins} | |||
| </if> | |||
| <if test=" null != credit "> | |||
| and `credit` = #{credit} | |||
| </if> | |||
| <if test=" null != tagId "> | |||
| and `tag_id` = #{tagId} | |||
| </if> | |||
| @@ -43,6 +43,7 @@ | |||
| <result column="subs_subscribe" jdbcType="TINYINT" property="subsSubscribe"/> | |||
| <result column="subs_subscribe_time" jdbcType="TIMESTAMP" property="subsSubscribeTime"/> | |||
| <result column="subs_subscribe_scene" jdbcType="VARCHAR" property="subsSubscribeScene"/> | |||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -53,7 +54,7 @@ | |||
| `login_count`, `extra_info`, `is_subscribe`, | |||
| `open_app_id`, | |||
| `mp_open_id`,`mp_app_id`,`mp_subscribe`,`mp_subscribe_time`,`mp_subscribe_scene`, | |||
| `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene` | |||
| `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene`,`credit` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -199,6 +200,10 @@ | |||
| and `subs_app_id` = #{subsAppId} | |||
| </if> | |||
| <if test=" null != credit "> | |||
| and `credit` = #{credit} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -8,7 +8,7 @@ | |||
| <result column="credit_amount" jdbcType="INTEGER" property="creditAmount" /> | |||
| <result column="credit_num" jdbcType="INTEGER" property="creditNum" /> | |||
| <result column="credit_type" jdbcType="INTEGER" property="creditType" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="credateDate" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="receipt_url" jdbcType="VARCHAR" property="receiptUrl" /> | |||
| <result column="operator_type" jdbcType="INTEGER" property="operatorType" /> | |||
| <result column="operator_id" jdbcType="BIGINT" property="operatorId" /> | |||
| @@ -118,5 +118,53 @@ | |||
| credit.id DESC | |||
| </select> | |||
| <select id="loginCount" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Integer"> | |||
| select COUNT(0) from wx_credit_history | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != creditType "> | |||
| and `credit_type` = #{creditType} | |||
| </if> | |||
| and DATEDIFF(`create_date`,now())=0 | |||
| </select> | |||
| <select id="countTodayList" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Integer"> | |||
| select count(0) | |||
| from wx_credit_history | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != creditType "> | |||
| and `credit_type` = #{creditType} | |||
| </if> | |||
| and DATEDIFF(`create_date`,now())=0 | |||
| </select> | |||
| <select id="creditAmount" parameterType="java.lang.Long" resultType="java.lang.Integer"> | |||
| SELECT credit_amount FROM wx_credit_history where c_user_id = #{cUserId} ORDER BY id desc limit 1 | |||
| </select> | |||
| <select id="countList" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Integer"> | |||
| select count(0) | |||
| from wx_credit_history | |||
| where 1=1 | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != cUserId "> | |||
| and `c_user_id` = #{cUserId} | |||
| </if> | |||
| <if test=" null != creditType "> | |||
| and `credit_type` = #{creditType} | |||
| </if> | |||
| </select> | |||
| </mapper> | |||
| @@ -223,5 +223,9 @@ | |||
| and merchant_id not in(select merchant_id from wx_property_contract where status in(2,3,4)) | |||
| <if test=" null != rentShopType ">and rent_shop_type = #{rentShopType}</if> | |||
| </select> | |||
| <select id="selectRentContractCountByShopId" parameterType="com.iformall.domain.po.WxRentContract" resultType="int"> | |||
| select count(*) from wx_rent_contract where tenant_id=#{tenantId} and json_contains(json_extract(rent_info,'$[*].shopId'),concat('"',${shopId},'"')) and status in (2,3,4) | |||
| </select> | |||
| </mapper> | |||
| @@ -7,10 +7,12 @@ | |||
| <result column="rules" jdbcType="VARCHAR" property="rules"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||
| <result column="clear_year" jdbcType="INTEGER" property="clearYear"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`rules`,`create_date`,`update_date` | |||
| `id`,`tenant_id`,`rules`,`create_date`,`update_date`,`type`,`clear_year` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -29,6 +31,12 @@ | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != clearYear "> | |||
| and `clear_year` = #{clearYear} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -25,16 +25,18 @@ | |||
| <result column="point_type" jdbcType="INTEGER" property="pointType"/> | |||
| <result column="comments" jdbcType="VARCHAR" property="comments"/> | |||
| <result column="email" property="email"/> | |||
| <result column="is_del" jdbcType="INTEGER" property="isDel"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`shop_number`,`build_area`,`operation_area`,`building`, | |||
| `floor`,`status`,`x`,`y`,`addr`,`baidu_poi`,`longitude`,`latitude`,`create_date`, | |||
| `update_date`,`img_url`,`manager`,`manager_phone`,`type`,`point_type`,`comments`,email | |||
| `update_date`,`img_url`,`manager`,`manager_phone`,`type`,`point_type`,`comments`,email,`is_del` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| where is_del=0 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| @@ -132,6 +134,7 @@ | |||
| <if test=" null != email "> | |||
| and `email` = #{email} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -160,7 +163,7 @@ | |||
| left join wx_merchant m on ms.merchant_id=m.id | |||
| left join wx_mall_building b on s.building=b.id | |||
| left join wx_mall_floor f on s.floor=f.id | |||
| where 1 = 1 | |||
| where s.is_del=0 | |||
| <if test=" null != id "> | |||
| and s.`id` = #{id} | |||
| @@ -322,7 +325,7 @@ | |||
| left join wx_mall_floor f on s.floor=f.id | |||
| left join wx_business bus on m.business_id = bus.id | |||
| left join wx_brand brand on m.brand = brand.id | |||
| where 1 = 1 | |||
| where s.is_del=0 | |||
| <if test=" null != id "> | |||
| and s.`id` = #{id} | |||
| @@ -432,7 +435,7 @@ | |||
| <select id="getbshoplist" resultType="hashmap" parameterType="hashmap"> | |||
| select id,shop_number shopNumber from wx_shop | |||
| where tenant_id=#{tenantId} and shop_number = #{shopNumber} | |||
| where tenant_id=#{tenantId} and shop_number = #{shopNumber} and is_del=0 | |||
| </select> | |||
| <select id="getMerchantShopByShopId" resultType="hashmap" parameterType="hashmap"> | |||
| @@ -442,12 +445,12 @@ | |||
| from wx_merchant_shop ms inner join wx_merchant m on ms.merchant_id=m.id | |||
| inner join wx_shop s on ms.shop_id=s.id | |||
| inner join wx_rent_contract c on ms.merchant_id=c.merchant_id | |||
| where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0 | |||
| where ms.tenant_id=#{tenantId} and ms.shop_id=#{shopId} and ms.is_del=0 and s.is_del=0 | |||
| </select> | |||
| <select id="queryShopLeftInfo" resultType="hashmap" parameterType="hashmap"> | |||
| select count(id) shopcount,IFNULL(sum(build_area),0) area from wx_shop | |||
| where tenant_id=#{tenantId} and status=#{status} | |||
| where tenant_id=#{tenantId} and status=#{status} and is_del=0 | |||
| </select> | |||
| <select id="listShopFromContract" parameterType="com.iformall.domain.po.WxShop" resultType="hashmap"> | |||
| @@ -460,7 +463,7 @@ | |||
| left join wx_merchant m on ms.merchant_id=m.id | |||
| left join wx_mall_building b on s.building=b.id | |||
| left join wx_mall_floor f on s.floor=f.id | |||
| where 1=1 and ms.is_del=0 | |||
| where s.is_del=0 and ms.is_del=0 | |||
| and s.tenant_id=#{tenantId} | |||
| <if test=" null != status"> | |||
| and s.`status` = #{status} | |||
| @@ -483,7 +486,8 @@ | |||
| <select id="hasShopNumber" parameterType="com.iformall.domain.po.WxShop" resultType="Integer"> | |||
| select count(*) from wx_shop where tenant_id=#{tenantId} and shop_number=#{shopNumber} and `type`=#{type} | |||
| select count(*) from wx_shop where tenant_id=#{tenantId} and shop_number=#{shopNumber} and `type`=#{type} and | |||
| is_del=0 | |||
| <if test=" null != id"> | |||
| and id != #{id} | |||
| </if> | |||
| @@ -64,4 +64,7 @@ | |||
| and `name` = #{name} | |||
| </if> | |||
| </select> | |||
| <select id="findListAll" resultMap="BaseResultMap"> | |||
| select id,name from wx_tags | |||
| </select> | |||
| </mapper> | |||