| | |
| | | import com.panzhihua.common.model.dtos.partybuilding.NewFightIntegral; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.building.IntegratingTaskVO; |
| | | import com.panzhihua.common.model.vos.community.building.NewFightConvenientMerchantVO; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_dangjian.dao.ComActIntegralUsersMapper; |
| | | import com.panzhihua.service_dangjian.entity.ComActIntegralUser; |
| | | import com.panzhihua.service_dangjian.entity.ComActIntegralUserTrade; |
| | | import com.panzhihua.service_dangjian.entity.IntegratingTask; |
| | | import com.panzhihua.service_dangjian.service.ComActIntegralUserChangeDAOService; |
| | | import com.panzhihua.service_dangjian.service.ComActIntegralUserTradeDaoService; |
| | | import com.panzhihua.service_dangjian.service.ComActIntegralUsersService; |
| | | import com.panzhihua.service_dangjian.service.NewFightIntegratingTaskService; |
| | | import com.panzhihua.service_dangjian.entity.NewFightConvenientMerchant; |
| | | import com.panzhihua.service_dangjian.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private NewFightIntegratingTaskService taskService; |
| | | |
| | | @Resource |
| | | private NewFightConvenientMerchantService merchantService; |
| | | |
| | | |
| | | @Override |
| | |
| | | Integer integralAvailableResident = integralUserDO.getIntegralAvailableResident(); |
| | | Integer integralFrozenResident = integralUserDO.getIntegralFrozenResident(); |
| | | |
| | | if(!StringUtils.isEmpty(item.getIntegralNum())) |
| | | { |
| | | amount=Integer.valueOf(item.getIntegralNum()); |
| | | } |
| | | |
| | | //业务类型 9商城积分兑换 10商家线下积分兑换 11花城登录 12 查看问题清单 " |
| | | // "13查看需求清单 14 查看报道服务活动 15查看微心愿 16 查看随手拍 17 每日签到 18 上传“随手拍”或“微心愿 |
| | | switch (item.getType()) |
| | | { |
| | | case "9": |
| | | //商城积分兑换 |
| | | item.setAddOrReduce(2); |
| | | //积分总数加减 |
| | | break; |
| | | case "10": |
| | | //商家线下积分兑换 |
| | | item.setAddOrReduce(2); |
| | | //商家线下积分兑换 增加 |
| | | //商家积分增加 |
| | | NewFightConvenientMerchant merchant=merchantService.selectMerchantById(item.getMerchantId()); |
| | | int allMoney=0; |
| | | if(!StringUtils.isEmpty(merchant.getBusinessCredit())) |
| | | { |
| | | allMoney=Integer.valueOf(merchant.getBusinessCredit()); |
| | | } |
| | | if (item.getAddOrReduce() == ComActIntegralUserTrade.changeType.add) |
| | | { |
| | | allMoney=allMoney+Integer.valueOf(item.getIntegralNum()); |
| | | |
| | | } |
| | | else |
| | | { |
| | | //商家积分减少 |
| | | allMoney=allMoney-Integer.valueOf(item.getIntegralNum()); |
| | | } |
| | | NewFightConvenientMerchantVO merchantVO=new NewFightConvenientMerchantVO(); |
| | | merchantVO.setId(merchant.getId()); |
| | | merchantVO.setBusinessCredit(allMoney+""); |
| | | merchantService.editData(merchantVO); |
| | | break; |
| | | case "11": |
| | | //花城登录 |
| | |
| | | //15查看微心愿 |
| | | case "16": |
| | | //查看随手拍 |
| | | // item.setAddOrReduce(1); |
| | | // item.setIntegralNum("1"); |
| | | // break; |
| | | case "17": |
| | | //每日签到 |
| | | IntegratingTask task2=taskService.getDetails(item.getUserId(), |
| | | item.getCommunityId(),item.getType()); |
| | | if(task2!=null && StringUtils.equals("2",task2.getIsDraw()) ) |
| | | { |
| | | return R.ok(); |
| | | } |
| | | item.setAddOrReduce(1); |
| | | item.setIntegralNum("1"); |
| | | IntegratingTaskVO taskVO2=new IntegratingTaskVO(); |
| | | taskVO2.setIsDraw("2"); |
| | | taskVO2.setId(item.getTaskId()); |
| | | taskService.editData(taskVO2); |
| | | break; |
| | | case "17": |
| | | //每日签到 |
| | | // IntegratingTask task2=taskService.getDetails(item.getUserId(), |
| | | // item.getCommunityId(),item.getType()); |
| | | // if(task2!=null && StringUtils.equals("2",task2.getIsDraw()) ) |
| | | // { |
| | | // return R.ok(); |
| | | // } |
| | | item.setAddOrReduce(1); |
| | | // IntegratingTaskVO taskVO2=new IntegratingTaskVO(); |
| | | // taskVO2.setIsDraw("2"); |
| | | // taskVO2.setId(item.getTaskId()); |
| | | // taskService.editData(taskVO2); |
| | | break; |
| | | case "18": |
| | | //上传“随手拍”或“微心愿 |
| | |
| | | // integralUserDO.setIntegralAvailableVolunteer(addIntegral(integralUserDO.getIntegralAvailableVolunteer() + amount)); |
| | | // } |
| | | |
| | | //获取积分 |
| | | if(!StringUtils.isEmpty(item.getIntegralNum())) |
| | | { |
| | | amount=Integer.valueOf(item.getIntegralNum()); |
| | | } |
| | | |
| | | |
| | | //积分总数加减 |
| | | if (item.getAddOrReduce() == ComActIntegralUserTrade.changeType.reduce) |
| | | if (item.getAddOrReduce() == ComActIntegralUserTrade.changeType.add) |
| | | { |
| | | int integralResidentNow = addIntegral(integralResident + amount); |
| | | integralUserDO.setIntegralResident(integralResidentNow); |
| | |
| | | //积分总数加减 |
| | | if (item.getAddOrReduce() == ComActIntegralUserTrade.changeType.reduce) |
| | | { |
| | | integralUserDO.setIntegralSum(addIntegral(integralSum - amount)); |
| | | // integralUserDO.setIntegralSum(addIntegral(integralSum - amount)); |
| | | integralUserDO.setIntegralAvailableSum(addIntegral(integralAvailableSum - amount)); |
| | | } |
| | | else { |