| @@ -0,0 +1,86 @@ | |||
| package com.iformall.controller.sm; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.sm.PersonMould; | |||
| import com.iformall.domain.po.sm.ServiceInfo; | |||
| import com.iformall.enums.EnumaMouldPatchStatus; | |||
| import com.iformall.service.sm.PersonMouldService; | |||
| import com.iformall.service.sm.ServiceInfoService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.util.List; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("/personPatch") | |||
| @Api(description = "模板接口") | |||
| public class PersonMouldController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private PersonMouldService personMouldService; | |||
| @Autowired | |||
| private ServiceInfoService serviceInfoService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("alList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute PersonMould record, Integer pageNum, Integer pageSize) { | |||
| if (record == null) record = new PersonMould(); | |||
| if(record.getVideoType() != null && record.getVideoType().intValue() == -1){ | |||
| record.setVideoType(null); | |||
| } | |||
| if(record.getSex() != null && record.getSex().intValue() == -1){ | |||
| record.setSex(null); | |||
| } | |||
| record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
| record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
| final PageInfo<PersonMould> page = personMouldService.listAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("接入商分页列表接口") | |||
| @GetMapping("serviceMouldList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData serviceMouldList(@ModelAttribute PersonMould record, Integer pageNum, Integer pageSize) { | |||
| MallUserInfo user = this.getUser(); | |||
| ServiceInfo si = serviceInfoService.getServiceInfoByMallUserInfo(user.getId()); | |||
| if (null == si) { | |||
| return new ResultData(); | |||
| } | |||
| List<Long> mouldIds = personMouldService.getServiceMouldIds(si.getId()); | |||
| if (null == mouldIds || mouldIds.size() <= 0 ) { | |||
| return new ResultData(); | |||
| } | |||
| PersonMould pm = new PersonMould(); | |||
| pm.setIds(mouldIds); | |||
| if(record.getVideoType() != null && record.getVideoType().intValue() == -1){ | |||
| record.setVideoType(null); | |||
| } | |||
| if(record.getSex() != null && record.getSex().intValue() == -1){ | |||
| record.setSex(null); | |||
| } | |||
| record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | |||
| record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | |||
| final PageInfo<PersonMould> page = personMouldService.listAsPage(record, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| } | |||
| @@ -4,18 +4,29 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.ApiVersion; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.R; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.controller.sys.mallUserInfo.MallUserInfoBaseController; | |||
| import com.iformall.domain.dto.sm.SaveServiceInfoDTO; | |||
| import com.iformall.domain.dto.sm.UpdateServiceInfoDTO; | |||
| import com.iformall.domain.dto.sm.UpdateServiceInfoStatusDTO; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.sm.PersonMould; | |||
| import com.iformall.domain.po.sm.ServiceInfo; | |||
| import com.iformall.enums.EnumProject; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.enums.EnumaMouldPatchStatus; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import com.iformall.service.sm.PersonMouldService; | |||
| import com.iformall.service.sm.ServiceInfoService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -25,13 +36,16 @@ import java.util.List; | |||
| @RestController | |||
| @RequestMapping("/serviceInfo") | |||
| @Api(tags = "合作商接口") | |||
| public class ServiceInfoController extends BaseController { | |||
| public class ServiceInfoController extends MallUserInfoBaseController{ | |||
| @Autowired | |||
| private ServiceInfoService serviceInfoService; | |||
| @Autowired | |||
| private MallUserInfoService mallUserInfoService; | |||
| @Autowired | |||
| private PersonMouldService personMouldService; | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("分页查询合作商") | |||
| @@ -51,7 +65,7 @@ public class ServiceInfoController extends BaseController { | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("新增合作商") | |||
| @ApiOperation("新增合作商(同步生成密钥)") | |||
| @PostMapping("/save") | |||
| public R<Void> saveServiceInfo(@RequestBody SaveServiceInfoDTO dto) { | |||
| serviceInfoService.saveServiceInfo(dto); | |||
| @@ -59,10 +73,39 @@ public class ServiceInfoController extends BaseController { | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("新增登录账号") | |||
| @ApiOperation("慧影-设置登录账号") | |||
| @PostMapping("/saveMallUserInfo") | |||
| public R<Void> saveMallUserInfo(@RequestBody MallUserInfo dto) { | |||
| mallUserInfoService.saveOrUpdate(dto); | |||
| public R<Void> saveMallUserInfo(@RequestBody MallUserInfo dto,Long id) { | |||
| ServiceInfo si = serviceInfoService.getServiceInfo(id); | |||
| if (null == si) { | |||
| throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"id无效"); | |||
| } | |||
| dto.setId(si.getMallUserInfo()); | |||
| if (null == dto.getId() || dto.getId() <= 0 ) { | |||
| ResultData data = this.doCreateUser(dto, EnumProject.PROJECT_2); | |||
| if (data.code == Result.SUCCESS) { | |||
| MallUserInfo mui = (MallUserInfo) data.data; | |||
| si.setMallUserInfo(mui.getId()); | |||
| serviceInfoService.updateServiceInfo(si); | |||
| }else { | |||
| throw new BizException(data.code,data.message); | |||
| } | |||
| }else { | |||
| this.doUpdateUser(dto, EnumProject.PROJECT_2); | |||
| } | |||
| return R.ok(); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("慧影-设置时长") | |||
| @PostMapping("/setRemainingTimes") | |||
| public R<Void> setRemainingTimes(Long id,Long times) { | |||
| ServiceInfo si = serviceInfoService.getServiceInfo(id); | |||
| if (null == si) { | |||
| throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"id无效"); | |||
| } | |||
| si.setRemainingTimes(times); | |||
| serviceInfoService.updateServiceInfo(si); | |||
| return R.ok(); | |||
| } | |||
| @@ -81,4 +124,36 @@ public class ServiceInfoController extends BaseController { | |||
| serviceInfoService.updateServiceInfoStatus(dto); | |||
| return R.ok(); | |||
| } | |||
| @ApiOperation("接入商分页列表接口") | |||
| @GetMapping("personMouldIdList") | |||
| public ResultData serviceMouldIdList() { | |||
| MallUserInfo user = this.getUser(); | |||
| ServiceInfo si = serviceInfoService.getServiceInfoByMallUserInfo(user.getId()); | |||
| if (null == si) { | |||
| return new ResultData(); | |||
| } | |||
| List<Long> mouldIds = personMouldService.getServiceMouldIds(si.getId()); | |||
| return new ResultData(mouldIds); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("设置关联模板") | |||
| @PostMapping("/associatedMould") | |||
| public R<Void> associatedMould(Long[] mouldIds,Long serviceId) { | |||
| if (null == mouldIds || mouldIds.length <= 0 ) { | |||
| throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"请选择模板"); | |||
| } | |||
| serviceInfoService.associatedMoulds(mouldIds, serviceId); | |||
| return R.ok(); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("设置关联模板") | |||
| @PostMapping("/current") | |||
| public ResultData currentInfo() { | |||
| MallUserInfo user = this.getUser(); | |||
| ServiceInfo si = serviceInfoService.getServiceInfoByMallUserInfo(user.getId()); | |||
| return new ResultData(si); | |||
| } | |||
| } | |||
| @@ -6,10 +6,15 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.R; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.constant.SwaggerConstant; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.dto.sm.UpdateThirdPartyApiStatusDTO; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxThirdPartyApi; | |||
| import com.iformall.domain.po.sm.ServiceInfo; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.service.WxThirdPartyApiService; | |||
| import com.iformall.service.sm.ServiceInfoService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -18,10 +23,13 @@ import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("/thirdPartyApi") | |||
| @Api(tags = "秘钥接口") | |||
| public class ThirdPartyApiController { | |||
| public class ThirdPartyApiController extends BaseController{ | |||
| @Autowired | |||
| private WxThirdPartyApiService thirdPartyApiService; | |||
| @Autowired | |||
| private ServiceInfoService serviceInfoService; | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("分页查询秘钥") | |||
| @@ -39,6 +47,18 @@ public class ThirdPartyApiController { | |||
| } | |||
| return R.ok(thirdPartyApiService.getThirdPartyApi(id)); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("当前api信息") | |||
| @GetMapping("/current") | |||
| public R<WxThirdPartyApi> current() { | |||
| MallUserInfo user = this.getUser(); | |||
| ServiceInfo si = serviceInfoService.getServiceInfoByMallUserInfo(user.getId()); | |||
| if (null == si) { | |||
| throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"当前登录账号无接入方信息."); | |||
| } | |||
| return R.ok(thirdPartyApiService.getThirdPartyApiByServiceId(si.getId())); | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation("修改秘钥状态") | |||
| @@ -200,7 +200,7 @@ public class MallUserInfoController extends MallUserInfoBaseController { | |||
| } | |||
| @ApiVersion(group = SwaggerConstant.V_1_0_0) | |||
| @ApiOperation(value = "慧影-修改密码", notes = "{\"userName\",\"string\",\"code\",\"string\",\"pwd\",\"string\"}") | |||
| @ApiOperation(value = "慧影-修改密码", notes = "{\"userName\",\"string\",\"pwd\",\"string\"}") | |||
| @PostMapping("/updatepwd") | |||
| @SystemControllerLog(description = "用户管理-修改密码") | |||
| public ResultData updatepwd(@RequestBody Map<String, String> params) { | |||
| @@ -434,15 +434,15 @@ public class MallUserInfoBaseController extends BaseController{ | |||
| public ResultData doUpdatepwd(Map<String, String> params,EnumProject projectType) { | |||
| // String phone,String code,String pwd | |||
| String userName = params.get("userName"); | |||
| String code = params.get("code"); | |||
| // String code = params.get("code"); | |||
| String pwd = params.get("pwd"); | |||
| if (StringUtils.isBlank(userName)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "userName不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(code)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); | |||
| } | |||
| // if (StringUtils.isBlank(code)) { | |||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "验证码不能为空"); | |||
| // } | |||
| if (StringUtils.isBlank(pwd)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "密码不能为空"); | |||
| } | |||
| @@ -462,7 +462,8 @@ public class MallUserInfoBaseController extends BaseController{ | |||
| try { | |||
| return userInfoService.updatepwd(user, code); | |||
| //return userInfoService.updatepwd(user, code); | |||
| return userInfoService.updatepwd(user, null); | |||
| } catch (Exception e) { | |||
| return new ResultData(Result.ERROR, e.getMessage()); | |||
| } | |||
| @@ -29,5 +29,17 @@ ADD COLUMN project_type int(1) NOT NULL COMMENT '所属项目EnumProject' ; | |||
| ALTER TABLE wx_msg_validationcode | |||
| ADD COLUMN project_type int(1) NOT NULL COMMENT '所属项目EnumProject' ; | |||
| ALTER TABLE service_info | |||
| ADD COLUMN remaining_times bigint NOT NULL DEFAULT 0 COMMENT '剩余时长(秒)' ; | |||
| CREATE TABLE `service_person_mould` ( | |||
| `id` bigint NOT NULL COMMENT '主键ID', | |||
| `person_mould_id` bigint NOT NULL COMMENT 'PersonMould编号', | |||
| `service_id` bigint NOT NULL COMMENT 'ServiceInfo编码', | |||
| `create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |||
| `update_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', | |||
| `wx_third_party_api_id` bigint NOT NULL, | |||
| PRIMARY KEY (`id`) USING BTREE, | |||
| UNIQUE KEY `id_UNIQUE` (`id`) USING BTREE | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='接入方关联模板'; | |||
| @@ -92,5 +92,6 @@ public class PersonMouldController extends BaseController { | |||
| return new ResultData(personMould); | |||
| } | |||
| } | |||
| @@ -20,6 +20,7 @@ public class SaveServiceInfoDTO { | |||
| private String code; | |||
| @ApiModelProperty("接入方式(1:api接入,2:私有化接入)") | |||
| private Integer type; | |||
| public static ServiceInfo mapping(SaveServiceInfoDTO dto) { | |||
| ServiceInfo serviceInfo = new ServiceInfo(); | |||
| @@ -30,21 +30,12 @@ public class WxThirdPartyApi extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="加密key",name="signKey") | |||
| private String signKey; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="apiUrl") | |||
| private String apiUrl; | |||
| @io.swagger.annotations.ApiModelProperty(value="token",name="token") | |||
| private String token; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="tokenExpiredTime") | |||
| private Date tokenExpiredTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="登陆username",name="userName") | |||
| private String userName; | |||
| @io.swagger.annotations.ApiModelProperty(value="登陆password",name="password") | |||
| private String password; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="version") | |||
| private String version; | |||
| @@ -72,4 +72,10 @@ public class ServiceInfo extends BaseEntity{ | |||
| */ | |||
| @TableField("mall_user_info") | |||
| private Long mallUserInfo; | |||
| /** | |||
| * 登录用户 | |||
| */ | |||
| @TableField("remaining_times") | |||
| private Long remainingTimes; | |||
| } | |||
| @@ -0,0 +1,28 @@ | |||
| package com.iformall.domain.po.sm; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| @TableName(value = "service_person_mould") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class ServicePersonMould extends BaseEntity { | |||
| private static final long serialVersionUID = 5153174991543978589L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="PersonMould编号",name="personMouldId") | |||
| private Long personMouldId; | |||
| @io.swagger.annotations.ApiModelProperty(value="ServiceInfo编码",name="serviceId") | |||
| private Long serviceId; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| } | |||
| @@ -0,0 +1,16 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.sm.ServicePersonMould; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| public interface ServicePersonMouldMapper extends CommonMapper<ServicePersonMould, Long> { | |||
| List<Long> findMouldIdList(ServicePersonMould record); | |||
| void deleteByServiceId(@Param("serviceId") Long serviceId); | |||
| void saveBatch(@Param("list") List<ServicePersonMould> list); | |||
| } | |||
| @@ -46,4 +46,6 @@ public interface WxThirdPartyApiService { | |||
| void updateThirdPartyApiStatus(UpdateThirdPartyApiStatusDTO dto); | |||
| WxThirdPartyApi getThirdPartyApi(Long id); | |||
| WxThirdPartyApi getThirdPartyApiByServiceId(Long id); | |||
| } | |||
| @@ -261,7 +261,7 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| @Override | |||
| public ResultData updatepwd(MallUserInfo user, String code) { | |||
| if(checkCodeValid(user, code)) { | |||
| //if(checkCodeValid(user, code)) { | |||
| try { | |||
| MallUserInfo updateUser = new MallUserInfo(); | |||
| updateUser.setId(user.getId()); | |||
| @@ -272,9 +272,9 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| logger.error("db failed: 用户-" + user.getUsername() + ", e:" + e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||
| } | |||
| } else { | |||
| return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND, false); | |||
| } | |||
| // } else { | |||
| // return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND, false); | |||
| // } | |||
| return new ResultData(); | |||
| } | |||
| @@ -102,6 +102,14 @@ public class WxThirdPartyApiServiceImpl implements WxThirdPartyApiService { | |||
| List<WxThirdPartyApi> vos = wxThirdPartyApiMapper.listThirdPartyApi(thirdPartyApi); | |||
| return !CollectionUtils.isEmpty(vos) ? vos.get(0) : null; | |||
| } | |||
| @Override | |||
| public WxThirdPartyApi getThirdPartyApiByServiceId(Long serviceId) { | |||
| WxThirdPartyApi thirdPartyApi = new WxThirdPartyApi(); | |||
| thirdPartyApi.setServiceId(serviceId); | |||
| List<WxThirdPartyApi> vos = wxThirdPartyApiMapper.listThirdPartyApi(thirdPartyApi); | |||
| return !CollectionUtils.isEmpty(vos) ? vos.get(0) : null; | |||
| } | |||
| /** | |||
| * 构建秘钥实体 | |||
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.service.sm; | |||
| import java.util.List; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.sm.MouldPatch; | |||
| @@ -42,5 +44,8 @@ public interface PersonMouldService { | |||
| void deleteById(Long id); | |||
| void updateOnline(PersonMould record); | |||
| //接入商的模板编号 | |||
| List<Long> getServiceMouldIds(Long serviceId); | |||
| } | |||
| @@ -39,6 +39,8 @@ public interface ServiceInfoService { | |||
| * @param dto | |||
| */ | |||
| void updateServiceInfo(UpdateServiceInfoDTO dto); | |||
| void updateServiceInfo(ServiceInfo serviceInfo); | |||
| /** | |||
| * 修改接入商状态 | |||
| @@ -48,4 +50,8 @@ public interface ServiceInfoService { | |||
| void updateServiceInfoStatus(UpdateServiceInfoStatusDTO dto); | |||
| ServiceInfo getServiceInfo(Long id); | |||
| ServiceInfo getServiceInfoByMallUserInfo(Long mallUserInfoId); | |||
| void associatedMoulds(Long[] mouldIds,Long id); | |||
| } | |||
| @@ -7,11 +7,13 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.sm.MouldPatch; | |||
| import com.iformall.domain.po.sm.MouldPatchSign; | |||
| import com.iformall.domain.po.sm.PersonMould; | |||
| import com.iformall.domain.po.sm.ServicePersonMould; | |||
| import com.iformall.enums.EnumColour; | |||
| import com.iformall.enums.EnumMouldSendType; | |||
| import com.iformall.enums.EnumaMouldPatchStatus; | |||
| import com.iformall.mapper.MouldPatchMapper; | |||
| import com.iformall.mapper.PersonMouldMapper; | |||
| import com.iformall.mapper.ServicePersonMouldMapper; | |||
| import com.iformall.service.sm.MouldPatchService; | |||
| import com.iformall.service.sm.MouldPatchSignService; | |||
| import com.iformall.service.sm.PersonMouldService; | |||
| @@ -35,6 +37,9 @@ public class PersonMouldServiceImpl implements PersonMouldService { | |||
| @Autowired | |||
| MouldPatchSignService mouldPatchSignService; | |||
| @Autowired | |||
| ServicePersonMouldMapper servicePersonMouldMapper; | |||
| @Override | |||
| @@ -116,4 +121,11 @@ public class PersonMouldServiceImpl implements PersonMouldService { | |||
| personMouldMapper.updateById(personMouldUpd); | |||
| } | |||
| @Override | |||
| public List<Long> getServiceMouldIds(Long serviceId) { | |||
| ServicePersonMould spm = new ServicePersonMould(); | |||
| spm.setServiceId(serviceId); | |||
| return servicePersonMouldMapper.findMouldIdList(spm); | |||
| } | |||
| } | |||
| @@ -6,11 +6,14 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.CommonConstants; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.sm.*; | |||
| import com.iformall.domain.po.WxThirdPartyApi; | |||
| import com.iformall.domain.po.sm.ServiceInfo; | |||
| import com.iformall.domain.po.sm.ServicePersonMould; | |||
| import com.iformall.exception.BizException; | |||
| import com.iformall.mapper.ServiceInfoMapper; | |||
| import com.iformall.mapper.ServicePersonMouldMapper; | |||
| import com.iformall.mapper.WxThirdPartyApiMapper; | |||
| import com.iformall.service.WxThirdPartyApiService; | |||
| import com.iformall.service.sm.ServiceInfoService; | |||
| @@ -19,6 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Service | |||
| @@ -30,6 +35,8 @@ public class ServiceInfoServiceImpl implements ServiceInfoService { | |||
| private WxThirdPartyApiService thirdPartyApiService; | |||
| @Autowired | |||
| private WxThirdPartyApiMapper wxThirdPartyApiMapper; | |||
| @Autowired | |||
| private ServicePersonMouldMapper servicePersonMouldMapper; | |||
| @Transactional(rollbackFor = Exception.class) | |||
| @Override | |||
| @@ -63,6 +70,11 @@ public class ServiceInfoServiceImpl implements ServiceInfoService { | |||
| public void updateServiceInfo(UpdateServiceInfoDTO dto) { | |||
| serviceInfoMapper.updateById(UpdateServiceInfoDTO.mapping(dto)); | |||
| } | |||
| @Override | |||
| public void updateServiceInfo(ServiceInfo serviceInfo) { | |||
| serviceInfoMapper.updateById(serviceInfo); | |||
| } | |||
| @Transactional(rollbackFor = Exception.class) | |||
| @Override | |||
| @@ -87,4 +99,30 @@ public class ServiceInfoServiceImpl implements ServiceInfoService { | |||
| List<ServiceInfo> serviceInfos = serviceInfoMapper.listServiceInfo(serviceInfo); | |||
| return !CollectionUtils.isEmpty(serviceInfos) ? serviceInfos.get(0) : null; | |||
| } | |||
| @Override | |||
| public ServiceInfo getServiceInfoByMallUserInfo(Long mallUserInfoId) { | |||
| ServiceInfo serviceInfo = new ServiceInfo(); | |||
| serviceInfo.setMallUserInfo(mallUserInfoId); | |||
| List<ServiceInfo> serviceInfos = serviceInfoMapper.listServiceInfo(serviceInfo); | |||
| return !CollectionUtils.isEmpty(serviceInfos) ? serviceInfos.get(0) : null; | |||
| } | |||
| @Override | |||
| public void associatedMoulds(Long[] mouldIds, Long id) { | |||
| servicePersonMouldMapper.deleteByServiceId(id); | |||
| if (null != mouldIds && mouldIds.length > 0 ) { | |||
| List<ServicePersonMould> spmlist = new ArrayList<ServicePersonMould>(); | |||
| for (int i = 0 ; i < mouldIds.length ; i ++) { | |||
| ServicePersonMould spm = new ServicePersonMould(); | |||
| spm.setId(IdWorker.get().nextId()); | |||
| spm.setPersonMouldId(mouldIds[i]); | |||
| spm.setServiceId(id); | |||
| spm.setCreateDate(new Date()); | |||
| spm.setUpdateDate(new Date()); | |||
| spmlist.add(spm); | |||
| } | |||
| servicePersonMouldMapper.saveBatch(spmlist); | |||
| } | |||
| } | |||
| } | |||
| @@ -5,7 +5,7 @@ | |||
| <sql id="allColumns"> | |||
| `id`, `create_time`, `update_time`, `name`, `address`, `code`, `type`, `status`, `del_flag`, `mall_user_info` | |||
| `id`, `create_time`, `update_time`, `name`, `address`, `code`, `type`, `status`, `del_flag`, `mall_user_info`,`remaining_times` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -0,0 +1,56 @@ | |||
| <?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.ServicePersonMouldMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.sm.ServicePersonMould"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="person_mould_id" jdbcType="BIGINT" property="personMouldId"/> | |||
| <result column="service_id" jdbcType="BIGINT" property="serviceId" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`, `person_mould_id`, `service_id`, `create_date`, `update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </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 customized desc,${sortColumns}</if> | |||
| </sql> | |||
| <select id="findMouldIdList" parameterType="com.iformall.domain.po.sm.ServicePersonMould" resultMap="BaseResultMap"> | |||
| select person_mould_id | |||
| from service_person_mould where service_id = #{serviceId} | |||
| </select> | |||
| <delete id = "deleteByServiceId"> | |||
| delete from service_person_mould where service_id = #{serviceId} | |||
| </delete> | |||
| <insert id="saveBatch" parameterType="java.util.List"> | |||
| INSERT INTO service_person_mould (`id`, `person_mould_id`, `service_id`,`create_date`, `update_date`) | |||
| VALUES | |||
| <foreach collection="list" item="item" separator=","> | |||
| ( | |||
| #{item.id}, | |||
| #{item.personMouldId}, | |||
| #{item.serviceId}, | |||
| #{item.createDate}, | |||
| #{item.updateDate} | |||
| ) | |||
| </foreach> | |||
| </insert> | |||
| </mapper> | |||
| @@ -10,18 +10,15 @@ | |||
| <result column="app_id" jdbcType="VARCHAR" property="appId"/> | |||
| <result column="app_key" jdbcType="VARCHAR" property="appKey"/> | |||
| <result column="sign_key" jdbcType="VARCHAR" property="signKey"/> | |||
| <result column="api_url" jdbcType="VARCHAR" property="apiUrl"/> | |||
| <result column="token" jdbcType="VARCHAR" property="token"/> | |||
| <result column="token_expired_time" jdbcType="TIMESTAMP" property="tokenExpiredTime"/> | |||
| <result column="user_name" jdbcType="VARCHAR" property="userName"/> | |||
| <result column="password" jdbcType="VARCHAR" property="password"/> | |||
| <result column="version" jdbcType="VARCHAR" property="version"/> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||
| <result column="tp_id" jdbcType="VARCHAR" property="tpId"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`, `tenant_id`, `parent_tenant_id`, `type`, `name`, `service_id`, `app_id`, `app_key`, `sign_key`, `api_url`, `token`, `token_expired_time`, `user_name`, `password`, `version`, `tp_id`, `remark`, `status` | |||
| `id`, `tenant_id`, `parent_tenant_id`, `type`, `name`, `service_id`, `app_id`, `app_key`, `sign_key`, `token`, `token_expired_time`, `version`, `tp_id`, `remark`, `status` | |||
| </sql> | |||
| <sql id="generalWhereConditions"> | |||